Skip to content

Commit

Permalink
add Value.Upload component
Browse files Browse the repository at this point in the history
  • Loading branch information
langz committed Nov 7, 2024
1 parent 2a92018 commit 9296f78
Show file tree
Hide file tree
Showing 17 changed files with 729 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ import ComponentBox from '../../../../../../shared/tags/ComponentBox'
import { Card } from '@dnb/eufemia/src'
import { Field, Form, Value } from '@dnb/eufemia/src/extensions/forms'

function createMockFile(name: string, size: number, type: string) {
const file = new File([], name, { type })
Object.defineProperty(file, 'size', {
get() {
return size
},
})
return file
}

export const DefaultLayout = () => {
return (
<ComponentBox data-visual-test="forms-value-summary-list-default">
Expand Down Expand Up @@ -132,15 +142,24 @@ export function InheritVisibility() {

export function InheritLabel() {
return (
<ComponentBox>
<ComponentBox scope={{ createMockFile }}>
<Form.Handler>
<Card stack>
<Field.String path="/foo" defaultValue="foo" label="foo label" />
<Field.String path="/bar" defaultValue="bar" label="bar label" />
<Field.Upload
path="/baz"
defaultValue={[
{ file: createMockFile('fileName-1.png', 100, 'image/png') },
{ file: createMockFile('fileName-2.png', 200, 'image/png') },
]}
label="baz label"
/>

<Value.SummaryList inheritLabel>
<Value.String path="/foo" />
<Value.String path="/bar" />
<Value.Upload path="/baz" />
</Value.SummaryList>
</Card>
</Form.Handler>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: 'Upload'
description: '`Value.Upload` will render the selected country.'
componentType: 'feature-value'
showTabs: true
tabs:
- title: Info
key: '/info'
- title: Demos
key: '/demos'
- title: Properties
key: '/properties'
breadcrumb:
- text: Forms
href: /uilib/extensions/forms/
- text: Value
href: /uilib/extensions/forms/Value/
- text: Upload
href: /uilib/extensions/forms/Value/Upload/
---

import Info from 'Docs/uilib/extensions/forms/Value/Upload/info'
import Demos from 'Docs/uilib/extensions/forms/Value/Upload/demos'

<Info />
<Demos />
Loading

0 comments on commit 9296f78

Please sign in to comment.