@jesusgm/react-components 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +158 -0
- package/dist/components/atoms/avatar/index.d.ts +19 -0
- package/dist/components/atoms/avatar/index.js +44 -0
- package/dist/components/atoms/avatar/index.js.map +1 -0
- package/dist/components/atoms/avatar/styles.css +50 -0
- package/dist/components/atoms/badge/index.d.ts +17 -0
- package/dist/components/atoms/badge/index.js +37 -0
- package/dist/components/atoms/badge/index.js.map +1 -0
- package/dist/components/atoms/badge/styles.css +83 -0
- package/dist/components/atoms/button/index.d.ts +16 -0
- package/dist/components/atoms/button/index.js +22 -0
- package/dist/components/atoms/button/index.js.map +1 -0
- package/dist/components/atoms/button/styles.css +77 -0
- package/dist/components/atoms/checkbox/index.d.ts +13 -0
- package/dist/components/atoms/checkbox/index.js +63 -0
- package/dist/components/atoms/checkbox/index.js.map +1 -0
- package/dist/components/atoms/checkbox/styles.css +87 -0
- package/dist/components/atoms/code-highlighter/index.d.ts +8 -0
- package/dist/components/atoms/code-highlighter/index.js +24 -0
- package/dist/components/atoms/code-highlighter/index.js.map +1 -0
- package/dist/components/atoms/code-highlighter/railscasts.css +1 -0
- package/dist/components/atoms/code-highlighter/styles.css +17 -0
- package/dist/components/atoms/divider/index.d.ts +10 -0
- package/dist/components/atoms/divider/index.js +25 -0
- package/dist/components/atoms/divider/index.js.map +1 -0
- package/dist/components/atoms/divider/styles.css +56 -0
- package/dist/components/atoms/icon/index.d.ts +23 -0
- package/dist/components/atoms/icon/index.js +20 -0
- package/dist/components/atoms/icon/index.js.map +1 -0
- package/dist/components/atoms/icon/styles.css +13 -0
- package/dist/components/atoms/kbd/index.d.ts +7 -0
- package/dist/components/atoms/kbd/index.js +26 -0
- package/dist/components/atoms/kbd/index.js.map +1 -0
- package/dist/components/atoms/kbd/styles.css +29 -0
- package/dist/components/atoms/label/index.d.ts +9 -0
- package/dist/components/atoms/label/index.js +18 -0
- package/dist/components/atoms/label/index.js.map +1 -0
- package/dist/components/atoms/label/styles.css +19 -0
- package/dist/components/atoms/link/index.d.ts +12 -0
- package/dist/components/atoms/link/index.js +32 -0
- package/dist/components/atoms/link/index.js.map +1 -0
- package/dist/components/atoms/link/styles.css +54 -0
- package/dist/components/atoms/progress-bar/index.d.ts +23 -0
- package/dist/components/atoms/progress-bar/index.js +45 -0
- package/dist/components/atoms/progress-bar/index.js.map +1 -0
- package/dist/components/atoms/progress-bar/styles.css +75 -0
- package/dist/components/atoms/radio/context.d.ts +9 -0
- package/dist/components/atoms/radio/context.js +9 -0
- package/dist/components/atoms/radio/context.js.map +1 -0
- package/dist/components/atoms/radio/index.d.ts +15 -0
- package/dist/components/atoms/radio/index.js +44 -0
- package/dist/components/atoms/radio/index.js.map +1 -0
- package/dist/components/atoms/radio/radio-group.d.ts +25 -0
- package/dist/components/atoms/radio/radio-group.js +49 -0
- package/dist/components/atoms/radio/radio-group.js.map +1 -0
- package/dist/components/atoms/radio/styles.css +110 -0
- package/dist/components/atoms/skeleton/index.d.ts +15 -0
- package/dist/components/atoms/skeleton/index.js +38 -0
- package/dist/components/atoms/skeleton/index.js.map +1 -0
- package/dist/components/atoms/skeleton/styles.css +57 -0
- package/dist/components/atoms/spinner/index.d.ts +11 -0
- package/dist/components/atoms/spinner/index.js +22 -0
- package/dist/components/atoms/spinner/index.js.map +1 -0
- package/dist/components/atoms/spinner/styles.css +51 -0
- package/dist/components/atoms/switch/index.d.ts +14 -0
- package/dist/components/atoms/switch/index.js +33 -0
- package/dist/components/atoms/switch/index.js.map +1 -0
- package/dist/components/atoms/switch/styles.css +99 -0
- package/dist/components/atoms/text-input/index.d.ts +20 -0
- package/dist/components/atoms/text-input/index.js +33 -0
- package/dist/components/atoms/text-input/index.js.map +1 -0
- package/dist/components/atoms/text-input/styles.css +80 -0
- package/dist/components/atoms/textarea/index.d.ts +14 -0
- package/dist/components/atoms/textarea/index.js +43 -0
- package/dist/components/atoms/textarea/index.js.map +1 -0
- package/dist/components/atoms/textarea/styles.css +49 -0
- package/dist/components/atoms/typography/index.d.ts +30 -0
- package/dist/components/atoms/typography/index.js +30 -0
- package/dist/components/atoms/typography/index.js.map +1 -0
- package/dist/components/atoms/typography/styles.css +50 -0
- package/dist/components/atoms/video-player/index.d.ts +9 -0
- package/dist/components/atoms/video-player/index.js +17 -0
- package/dist/components/atoms/video-player/index.js.map +1 -0
- package/dist/components/atoms/video-player/styles.css +18 -0
- package/dist/components/atoms/visually-hidden/index.d.ts +7 -0
- package/dist/components/atoms/visually-hidden/index.js +13 -0
- package/dist/components/atoms/visually-hidden/index.js.map +1 -0
- package/dist/components/atoms/visually-hidden/styles.css +12 -0
- package/dist/components/hooks/index.d.ts +3 -0
- package/dist/components/hooks/index.js +4 -0
- package/dist/components/hooks/use-click-outside.d.ts +6 -0
- package/dist/components/hooks/use-click-outside.js +30 -0
- package/dist/components/hooks/use-click-outside.js.map +1 -0
- package/dist/components/hooks/use-controllable-state.d.ts +5 -0
- package/dist/components/hooks/use-controllable-state.js +22 -0
- package/dist/components/hooks/use-controllable-state.js.map +1 -0
- package/dist/components/hooks/use-focus-trap.d.ts +8 -0
- package/dist/components/hooks/use-focus-trap.js +57 -0
- package/dist/components/hooks/use-focus-trap.js.map +1 -0
- package/dist/components/index.d.ts +122 -0
- package/dist/components/index.js +74 -0
- package/dist/components/molecules/accordion/index.d.ts +27 -0
- package/dist/components/molecules/accordion/index.js +98 -0
- package/dist/components/molecules/accordion/index.js.map +1 -0
- package/dist/components/molecules/accordion/styles.css +75 -0
- package/dist/components/molecules/alert/index.d.ts +18 -0
- package/dist/components/molecules/alert/index.js +91 -0
- package/dist/components/molecules/alert/index.js.map +1 -0
- package/dist/components/molecules/alert/styles.css +97 -0
- package/dist/components/molecules/binary-clock/index.d.ts +16 -0
- package/dist/components/molecules/binary-clock/index.js +66 -0
- package/dist/components/molecules/binary-clock/index.js.map +1 -0
- package/dist/components/molecules/binary-clock/styles.css +46 -0
- package/dist/components/molecules/breadcrumb/index.d.ts +23 -0
- package/dist/components/molecules/breadcrumb/index.js +79 -0
- package/dist/components/molecules/breadcrumb/index.js.map +1 -0
- package/dist/components/molecules/breadcrumb/styles.css +61 -0
- package/dist/components/molecules/card/index.d.ts +39 -0
- package/dist/components/molecules/card/index.js +60 -0
- package/dist/components/molecules/card/index.js.map +1 -0
- package/dist/components/molecules/card/styles.css +105 -0
- package/dist/components/molecules/chart/index.d.ts +14 -0
- package/dist/components/molecules/chart/index.js +104 -0
- package/dist/components/molecules/chart/index.js.map +1 -0
- package/dist/components/molecules/conflict-resolver/components/conflictItem.d.ts +8 -0
- package/dist/components/molecules/conflict-resolver/components/conflictItem.js +58 -0
- package/dist/components/molecules/conflict-resolver/components/conflictItem.js.map +1 -0
- package/dist/components/molecules/conflict-resolver/components/styles.css +64 -0
- package/dist/components/molecules/conflict-resolver/index.d.ts +10 -0
- package/dist/components/molecules/conflict-resolver/index.js +35 -0
- package/dist/components/molecules/conflict-resolver/index.js.map +1 -0
- package/dist/components/molecules/conflict-resolver/types.d.ts +10 -0
- package/dist/components/molecules/dropable-list/draggable.d.ts +9 -0
- package/dist/components/molecules/dropable-list/draggable.js +18 -0
- package/dist/components/molecules/dropable-list/draggable.js.map +1 -0
- package/dist/components/molecules/dropable-list/index.d.ts +20 -0
- package/dist/components/molecules/dropable-list/index.js +52 -0
- package/dist/components/molecules/dropable-list/index.js.map +1 -0
- package/dist/components/molecules/dropable-list/styles.css +63 -0
- package/dist/components/molecules/dropdown-menu/index.d.ts +43 -0
- package/dist/components/molecules/dropdown-menu/index.js +226 -0
- package/dist/components/molecules/dropdown-menu/index.js.map +1 -0
- package/dist/components/molecules/dropdown-menu/styles.css +94 -0
- package/dist/components/molecules/empty-state/index.d.ts +16 -0
- package/dist/components/molecules/empty-state/index.js +32 -0
- package/dist/components/molecules/empty-state/index.js.map +1 -0
- package/dist/components/molecules/empty-state/styles.css +64 -0
- package/dist/components/molecules/file-input/index.d.ts +39 -0
- package/dist/components/molecules/file-input/index.js +121 -0
- package/dist/components/molecules/file-input/index.js.map +1 -0
- package/dist/components/molecules/file-input/styles.css +86 -0
- package/dist/components/molecules/form-field/index.d.ts +38 -0
- package/dist/components/molecules/form-field/index.js +71 -0
- package/dist/components/molecules/form-field/index.js.map +1 -0
- package/dist/components/molecules/form-field/styles.css +43 -0
- package/dist/components/molecules/list/index.d.ts +25 -0
- package/dist/components/molecules/list/index.js +30 -0
- package/dist/components/molecules/list/index.js.map +1 -0
- package/dist/components/molecules/list/styles.css +28 -0
- package/dist/components/molecules/number-stepper/index.d.ts +31 -0
- package/dist/components/molecules/number-stepper/index.js +163 -0
- package/dist/components/molecules/number-stepper/index.js.map +1 -0
- package/dist/components/molecules/number-stepper/styles.css +69 -0
- package/dist/components/molecules/pagination/index.d.ts +39 -0
- package/dist/components/molecules/pagination/index.js +111 -0
- package/dist/components/molecules/pagination/index.js.map +1 -0
- package/dist/components/molecules/pagination/styles.css +41 -0
- package/dist/components/molecules/popover/index.d.ts +22 -0
- package/dist/components/molecules/popover/index.js +76 -0
- package/dist/components/molecules/popover/index.js.map +1 -0
- package/dist/components/molecules/popover/positioning.d.ts +40 -0
- package/dist/components/molecules/popover/positioning.js +115 -0
- package/dist/components/molecules/popover/positioning.js.map +1 -0
- package/dist/components/molecules/popover/styles.css +36 -0
- package/dist/components/molecules/rating/index.d.ts +33 -0
- package/dist/components/molecules/rating/index.js +117 -0
- package/dist/components/molecules/rating/index.js.map +1 -0
- package/dist/components/molecules/rating/styles.css +94 -0
- package/dist/components/molecules/search-input/index.d.ts +23 -0
- package/dist/components/molecules/search-input/index.js +118 -0
- package/dist/components/molecules/search-input/index.js.map +1 -0
- package/dist/components/molecules/search-input/styles.css +69 -0
- package/dist/components/molecules/segmented-control/button-group.d.ts +10 -0
- package/dist/components/molecules/segmented-control/button-group.js +15 -0
- package/dist/components/molecules/segmented-control/button-group.js.map +1 -0
- package/dist/components/molecules/segmented-control/index.d.ts +38 -0
- package/dist/components/molecules/segmented-control/index.js +80 -0
- package/dist/components/molecules/segmented-control/index.js.map +1 -0
- package/dist/components/molecules/segmented-control/styles.css +130 -0
- package/dist/components/molecules/select/index.d.ts +30 -0
- package/dist/components/molecules/select/index.js +48 -0
- package/dist/components/molecules/select/index.js.map +1 -0
- package/dist/components/molecules/select/styles.css +102 -0
- package/dist/components/molecules/tabs/index.d.ts +31 -0
- package/dist/components/molecules/tabs/index.js +87 -0
- package/dist/components/molecules/tabs/index.js.map +1 -0
- package/dist/components/molecules/tabs/styles.css +87 -0
- package/dist/components/molecules/tag-cloud/index.d.ts +16 -0
- package/dist/components/molecules/tag-cloud/index.js +133 -0
- package/dist/components/molecules/tag-cloud/index.js.map +1 -0
- package/dist/components/molecules/tag-cloud/styles.css +29 -0
- package/dist/components/molecules/tooltip/index.d.ts +22 -0
- package/dist/components/molecules/tooltip/index.js +83 -0
- package/dist/components/molecules/tooltip/index.js.map +1 -0
- package/dist/components/molecules/tooltip/styles.css +30 -0
- package/dist/components/molecules/virtualized-list/index.d.ts +5 -0
- package/dist/components/molecules/virtualized-list/index.js +3 -0
- package/dist/components/molecules/virtualized-list/lista/index.d.ts +11 -0
- package/dist/components/molecules/virtualized-list/lista/index.js +30 -0
- package/dist/components/molecules/virtualized-list/lista/index.js.map +1 -0
- package/dist/components/molecules/virtualized-list/lista/styles.css +27 -0
- package/dist/components/molecules/virtualized-list/lista-slow/index.d.ts +10 -0
- package/dist/components/molecules/virtualized-list/lista-slow/index.js +17 -0
- package/dist/components/molecules/virtualized-list/lista-slow/index.js.map +1 -0
- package/dist/components/molecules/virtualized-list/row/index.d.ts +9 -0
- package/dist/components/molecules/virtualized-list/row/index.js +30 -0
- package/dist/components/molecules/virtualized-list/row/index.js.map +1 -0
- package/dist/components/molecules/virtualized-list/types.d.ts +4 -0
- package/dist/components/organisms/combobox/index.d.ts +82 -0
- package/dist/components/organisms/combobox/index.js +386 -0
- package/dist/components/organisms/combobox/index.js.map +1 -0
- package/dist/components/organisms/combobox/styles.css +269 -0
- package/dist/components/organisms/command-palette/index.d.ts +49 -0
- package/dist/components/organisms/command-palette/index.js +239 -0
- package/dist/components/organisms/command-palette/index.js.map +1 -0
- package/dist/components/organisms/command-palette/score.d.ts +12 -0
- package/dist/components/organisms/command-palette/score.js +43 -0
- package/dist/components/organisms/command-palette/score.js.map +1 -0
- package/dist/components/organisms/command-palette/styles.css +212 -0
- package/dist/components/organisms/date-picker/calendar.d.ts +29 -0
- package/dist/components/organisms/date-picker/calendar.js +178 -0
- package/dist/components/organisms/date-picker/calendar.js.map +1 -0
- package/dist/components/organisms/date-picker/date-utils.d.ts +52 -0
- package/dist/components/organisms/date-picker/date-utils.js +139 -0
- package/dist/components/organisms/date-picker/date-utils.js.map +1 -0
- package/dist/components/organisms/date-picker/index.d.ts +54 -0
- package/dist/components/organisms/date-picker/index.js +173 -0
- package/dist/components/organisms/date-picker/index.js.map +1 -0
- package/dist/components/organisms/date-picker/styles.css +179 -0
- package/dist/components/organisms/drawer/index.d.ts +16 -0
- package/dist/components/organisms/drawer/index.js +15 -0
- package/dist/components/organisms/drawer/index.js.map +1 -0
- package/dist/components/organisms/drawer/styles.css +163 -0
- package/dist/components/organisms/editor/index.d.ts +13 -0
- package/dist/components/organisms/editor/index.js +56 -0
- package/dist/components/organisms/editor/index.js.map +1 -0
- package/dist/components/organisms/editor/styles.css +61 -0
- package/dist/components/organisms/form/context.d.ts +7 -0
- package/dist/components/organisms/form/context.js +11 -0
- package/dist/components/organisms/form/context.js.map +1 -0
- package/dist/components/organisms/form/field.d.ts +18 -0
- package/dist/components/organisms/form/field.js +98 -0
- package/dist/components/organisms/form/field.js.map +1 -0
- package/dist/components/organisms/form/form-actions.d.ts +8 -0
- package/dist/components/organisms/form/form-actions.js +13 -0
- package/dist/components/organisms/form/form-actions.js.map +1 -0
- package/dist/components/organisms/form/index.d.ts +24 -0
- package/dist/components/organisms/form/index.js +215 -0
- package/dist/components/organisms/form/index.js.map +1 -0
- package/dist/components/organisms/form/styles.css +29 -0
- package/dist/components/organisms/form/types.d.ts +95 -0
- package/dist/components/organisms/form/validation.d.ts +5 -0
- package/dist/components/organisms/form/validation.js +35 -0
- package/dist/components/organisms/form/validation.js.map +1 -0
- package/dist/components/organisms/header/index.d.ts +40 -0
- package/dist/components/organisms/header/index.js +186 -0
- package/dist/components/organisms/header/index.js.map +1 -0
- package/dist/components/organisms/header/styles.css +126 -0
- package/dist/components/organisms/modal/dialog-base.d.ts +31 -0
- package/dist/components/organisms/modal/dialog-base.js +123 -0
- package/dist/components/organisms/modal/dialog-base.js.map +1 -0
- package/dist/components/organisms/modal/index.d.ts +13 -0
- package/dist/components/organisms/modal/index.js +15 -0
- package/dist/components/organisms/modal/index.js.map +1 -0
- package/dist/components/organisms/modal/styles.css +143 -0
- package/dist/components/organisms/presenter/components/slides/simple/index.d.ts +13 -0
- package/dist/components/organisms/presenter/components/slides/simple/index.js +16 -0
- package/dist/components/organisms/presenter/components/slides/simple/index.js.map +1 -0
- package/dist/components/organisms/presenter/components/slides/simple/styles.css +6 -0
- package/dist/components/organisms/presenter/index.d.ts +17 -0
- package/dist/components/organisms/presenter/index.js +63 -0
- package/dist/components/organisms/presenter/index.js.map +1 -0
- package/dist/components/organisms/presenter/styles.css +75 -0
- package/dist/components/organisms/sidebar/index.d.ts +50 -0
- package/dist/components/organisms/sidebar/index.js +157 -0
- package/dist/components/organisms/sidebar/index.js.map +1 -0
- package/dist/components/organisms/sidebar/styles.css +197 -0
- package/dist/components/organisms/slider/index.d.ts +47 -0
- package/dist/components/organisms/slider/index.js +214 -0
- package/dist/components/organisms/slider/index.js.map +1 -0
- package/dist/components/organisms/slider/styles.css +110 -0
- package/dist/components/organisms/table/components/cell/index.d.ts +8 -0
- package/dist/components/organisms/table/components/cell/index.js +11 -0
- package/dist/components/organisms/table/components/cell/index.js.map +1 -0
- package/dist/components/organisms/table/index.d.ts +29 -0
- package/dist/components/organisms/table/index.js +105 -0
- package/dist/components/organisms/table/index.js.map +1 -0
- package/dist/components/organisms/table/styles.css +66 -0
- package/dist/components/organisms/terminal/index.d.ts +15 -0
- package/dist/components/organisms/terminal/index.js +111 -0
- package/dist/components/organisms/terminal/index.js.map +1 -0
- package/dist/components/organisms/terminal/styles.css +123 -0
- package/dist/components/organisms/toast/index.d.ts +66 -0
- package/dist/components/organisms/toast/index.js +142 -0
- package/dist/components/organisms/toast/index.js.map +1 -0
- package/dist/components/organisms/toast/styles.css +138 -0
- package/dist/components/organisms/wizard/index.d.ts +44 -0
- package/dist/components/organisms/wizard/index.js +171 -0
- package/dist/components/organisms/wizard/index.js.map +1 -0
- package/dist/components/organisms/wizard/styles.css +160 -0
- package/dist/components/utils/cx.d.ts +2 -0
- package/dist/components/utils/cx.js +8 -0
- package/dist/components/utils/cx.js.map +1 -0
- package/dist/components/utils/portal/index.d.ts +9 -0
- package/dist/components/utils/portal/index.js +13 -0
- package/dist/components/utils/portal/index.js.map +1 -0
- package/dist/components/utils/theme-provider/index.d.ts +22 -0
- package/dist/components/utils/theme-provider/index.js +36 -0
- package/dist/components/utils/theme-provider/index.js.map +1 -0
- package/dist/styles.css +743 -0
- package/dist/tokens.css +299 -0
- package/package.json +390 -4
- package/README.md +0 -3
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
.ds-file-input {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: var(--space-4);
|
|
5
|
+
color: var(--color-text);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.ds-file-input__field {
|
|
9
|
+
display: none;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.ds-file-input__drop-area {
|
|
13
|
+
padding: var(--space-8) var(--space-4);
|
|
14
|
+
border: var(--border-width-2) dashed var(--color-border-strong);
|
|
15
|
+
border-radius: var(--radius-lg);
|
|
16
|
+
background: var(--color-bg-subtle);
|
|
17
|
+
color: var(--color-text-muted);
|
|
18
|
+
font-size: var(--font-size-sm);
|
|
19
|
+
text-align: center;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
transition: border-color var(--duration-fast) var(--easing-standard),
|
|
22
|
+
background-color var(--duration-fast) var(--easing-standard);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ds-file-input__drop-area:hover {
|
|
26
|
+
border-color: var(--color-primary);
|
|
27
|
+
background: var(--color-primary-subtle);
|
|
28
|
+
color: var(--color-primary-text);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ds-file-input__list {
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-wrap: wrap;
|
|
34
|
+
gap: var(--space-4);
|
|
35
|
+
margin: 0;
|
|
36
|
+
padding: 0;
|
|
37
|
+
list-style: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.ds-file-input__file {
|
|
41
|
+
position: relative;
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
align-items: center;
|
|
45
|
+
gap: var(--space-2);
|
|
46
|
+
width: 88px;
|
|
47
|
+
padding: var(--space-3) var(--space-2);
|
|
48
|
+
border: var(--border-width-1) solid var(--color-border);
|
|
49
|
+
border-radius: var(--radius-lg);
|
|
50
|
+
background: var(--color-surface);
|
|
51
|
+
text-align: center;
|
|
52
|
+
word-break: break-word;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.ds-file-input__icon {
|
|
56
|
+
width: var(--icon-size-xl);
|
|
57
|
+
height: var(--icon-size-xl);
|
|
58
|
+
color: var(--color-text-subtle);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.ds-file-input__name {
|
|
62
|
+
font-size: var(--font-size-xs);
|
|
63
|
+
color: var(--color-text-muted);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.ds-file-input__remove {
|
|
67
|
+
position: absolute;
|
|
68
|
+
top: var(--space-1);
|
|
69
|
+
right: var(--space-1);
|
|
70
|
+
display: inline-flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
width: var(--icon-size-lg);
|
|
74
|
+
height: var(--icon-size-lg);
|
|
75
|
+
padding: 0;
|
|
76
|
+
border: 0;
|
|
77
|
+
border-radius: var(--radius-full);
|
|
78
|
+
background: transparent;
|
|
79
|
+
color: var(--color-text-subtle);
|
|
80
|
+
cursor: pointer;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.ds-file-input__remove:hover {
|
|
84
|
+
background: var(--color-danger-subtle);
|
|
85
|
+
color: var(--color-danger-text);
|
|
86
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
/** Props FormField wires into its control (also passed to a render-prop child) */
|
|
3
|
+
export interface FormFieldControlProps {
|
|
4
|
+
/** Id of the control, referenced by the label's `htmlFor` */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Ids of the helper text and error message, when present */
|
|
7
|
+
"aria-describedby"?: string;
|
|
8
|
+
/** `true` when there is an error */
|
|
9
|
+
"aria-invalid"?: true;
|
|
10
|
+
/** `true` when there is an error (understood by the library's form controls) */
|
|
11
|
+
invalid?: boolean;
|
|
12
|
+
/** Mirrors the field's `required` prop */
|
|
13
|
+
required?: boolean;
|
|
14
|
+
/** Mirrors the field's `disabled` prop */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface FormFieldProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
18
|
+
/** Visible label of the control */
|
|
19
|
+
label?: ReactNode;
|
|
20
|
+
/** Id of the control. Generated when omitted (or taken from the child's own `id`) */
|
|
21
|
+
htmlFor?: string;
|
|
22
|
+
/** Marks the field as required (label marker + `required` on the control) */
|
|
23
|
+
required?: boolean;
|
|
24
|
+
/** Hint shown under the control, linked with `aria-describedby` */
|
|
25
|
+
helperText?: ReactNode;
|
|
26
|
+
/** Error message. When present the control is marked invalid and the message is announced politely */
|
|
27
|
+
error?: ReactNode;
|
|
28
|
+
/** Disables the control and dims the label */
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The control. A single element is cloned with `id`, `aria-describedby`, `aria-invalid`, `invalid`,
|
|
32
|
+
* `required` and `disabled` (only the props it does not already set). Pass a function
|
|
33
|
+
* `(fieldProps) => ReactNode` to wire a custom control yourself.
|
|
34
|
+
*/
|
|
35
|
+
children?: ReactNode | ((fieldProps: FormFieldControlProps) => ReactNode);
|
|
36
|
+
}
|
|
37
|
+
declare function FormField({ label, htmlFor, required, helperText, error, disabled, className, children, ...rest }: FormFieldProps): import("react").JSX.Element;
|
|
38
|
+
export default FormField;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Children, cloneElement, isValidElement, useId } from "react";
|
|
2
|
+
import Label from "../../atoms/label/index.js";
|
|
3
|
+
import { cx } from "../../utils/cx.js";
|
|
4
|
+
import './styles.css';/* empty css */
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/components/molecules/form-field/index.tsx
|
|
7
|
+
function FormField({ label, htmlFor, required = false, helperText, error, disabled = false, className, children, ...rest }) {
|
|
8
|
+
const autoId = useId();
|
|
9
|
+
const single = typeof children !== "function" && Children.count(children) === 1 && isValidElement(children) ? children : null;
|
|
10
|
+
const childId = single && typeof single.props.id === "string" ? single.props.id : void 0;
|
|
11
|
+
const id = htmlFor ?? childId ?? `ds-field-${autoId}`;
|
|
12
|
+
const helperId = `${id}-helper`;
|
|
13
|
+
const errorId = `${id}-error`;
|
|
14
|
+
const hasError = error != null && error !== false && error !== "";
|
|
15
|
+
const describedBy = [helperText != null ? helperId : null, hasError ? errorId : null].filter(Boolean).join(" ") || void 0;
|
|
16
|
+
const fieldProps = {
|
|
17
|
+
id,
|
|
18
|
+
"aria-describedby": describedBy,
|
|
19
|
+
"aria-invalid": hasError ? true : void 0,
|
|
20
|
+
invalid: hasError || void 0,
|
|
21
|
+
required: required || void 0,
|
|
22
|
+
disabled: disabled || void 0
|
|
23
|
+
};
|
|
24
|
+
let control = children;
|
|
25
|
+
if (typeof children === "function") control = children(fieldProps);
|
|
26
|
+
else if (single) {
|
|
27
|
+
const own = single.props;
|
|
28
|
+
const isDomElement = typeof single.type === "string";
|
|
29
|
+
const extra = {};
|
|
30
|
+
if (own.id === void 0) extra.id = id;
|
|
31
|
+
if (describedBy) extra["aria-describedby"] = [typeof own["aria-describedby"] === "string" ? own["aria-describedby"] : "", describedBy].filter(Boolean).join(" ");
|
|
32
|
+
if (hasError) {
|
|
33
|
+
if (own["aria-invalid"] === void 0) extra["aria-invalid"] = true;
|
|
34
|
+
if (!isDomElement && own.invalid === void 0) extra.invalid = true;
|
|
35
|
+
}
|
|
36
|
+
if (required && own.required === void 0) extra.required = true;
|
|
37
|
+
if (disabled && own.disabled === void 0) extra.disabled = true;
|
|
38
|
+
control = cloneElement(single, extra);
|
|
39
|
+
}
|
|
40
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
41
|
+
className: cx("ds-form-field", hasError && "ds-form-field--invalid", disabled && "ds-form-field--disabled", className),
|
|
42
|
+
...rest,
|
|
43
|
+
children: [
|
|
44
|
+
label != null && /* @__PURE__ */ jsx(Label, {
|
|
45
|
+
htmlFor: id,
|
|
46
|
+
required,
|
|
47
|
+
disabled,
|
|
48
|
+
className: "ds-form-field__label",
|
|
49
|
+
children: label
|
|
50
|
+
}),
|
|
51
|
+
/* @__PURE__ */ jsx("div", {
|
|
52
|
+
className: "ds-form-field__control",
|
|
53
|
+
children: control
|
|
54
|
+
}),
|
|
55
|
+
helperText != null && /* @__PURE__ */ jsx("p", {
|
|
56
|
+
id: helperId,
|
|
57
|
+
className: "ds-form-field__helper",
|
|
58
|
+
children: helperText
|
|
59
|
+
}),
|
|
60
|
+
/* @__PURE__ */ jsx("p", {
|
|
61
|
+
id: errorId,
|
|
62
|
+
className: "ds-form-field__error",
|
|
63
|
+
"aria-live": "polite",
|
|
64
|
+
children: hasError ? error : null
|
|
65
|
+
})
|
|
66
|
+
]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
export { FormField as default };
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_jsxs","_jsx"],"sources":["../../../../src/components/molecules/form-field/index.tsx"],"sourcesContent":["import { Children, cloneElement, isValidElement, useId } from \"react\";\nimport type { HTMLAttributes, ReactElement, ReactNode } from \"react\";\nimport Label from \"../../atoms/label\";\nimport { cx } from \"../../utils/cx\";\nimport \"./styles.css\";\n\n/** Props FormField wires into its control (also passed to a render-prop child) */\nexport interface FormFieldControlProps {\n /** Id of the control, referenced by the label's `htmlFor` */\n id: string;\n /** Ids of the helper text and error message, when present */\n \"aria-describedby\"?: string;\n /** `true` when there is an error */\n \"aria-invalid\"?: true;\n /** `true` when there is an error (understood by the library's form controls) */\n invalid?: boolean;\n /** Mirrors the field's `required` prop */\n required?: boolean;\n /** Mirrors the field's `disabled` prop */\n disabled?: boolean;\n}\n\nexport interface FormFieldProps extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\n /** Visible label of the control */\n label?: ReactNode;\n /** Id of the control. Generated when omitted (or taken from the child's own `id`) */\n htmlFor?: string;\n /** Marks the field as required (label marker + `required` on the control) */\n required?: boolean;\n /** Hint shown under the control, linked with `aria-describedby` */\n helperText?: ReactNode;\n /** Error message. When present the control is marked invalid and the message is announced politely */\n error?: ReactNode;\n /** Disables the control and dims the label */\n disabled?: boolean;\n /**\n * The control. A single element is cloned with `id`, `aria-describedby`, `aria-invalid`, `invalid`,\n * `required` and `disabled` (only the props it does not already set). Pass a function\n * `(fieldProps) => ReactNode` to wire a custom control yourself.\n */\n children?: ReactNode | ((fieldProps: FormFieldControlProps) => ReactNode);\n}\n\ntype AnyProps = Record<string, unknown>;\n\nfunction FormField({\n label,\n htmlFor,\n required = false,\n helperText,\n error,\n disabled = false,\n className,\n children,\n ...rest\n}: FormFieldProps) {\n const autoId = useId();\n const single =\n typeof children !== \"function\" && Children.count(children) === 1 && isValidElement(children)\n ? (children as ReactElement<AnyProps>)\n : null;\n const childId = single && typeof single.props.id === \"string\" ? single.props.id : undefined;\n const id = htmlFor ?? childId ?? `ds-field-${autoId}`;\n const helperId = `${id}-helper`;\n const errorId = `${id}-error`;\n const hasError = error != null && error !== false && error !== \"\";\n const describedBy = [helperText != null ? helperId : null, hasError ? errorId : null].filter(Boolean).join(\" \") || undefined;\n\n const fieldProps: FormFieldControlProps = {\n id,\n \"aria-describedby\": describedBy,\n \"aria-invalid\": hasError ? true : undefined,\n invalid: hasError || undefined,\n required: required || undefined,\n disabled: disabled || undefined,\n };\n\n let control: ReactNode = children as ReactNode;\n if (typeof children === \"function\") {\n control = children(fieldProps);\n } else if (single) {\n const own = single.props;\n const isDomElement = typeof single.type === \"string\";\n const extra: AnyProps = {};\n if (own.id === undefined) extra.id = id;\n if (describedBy) {\n const existing = typeof own[\"aria-describedby\"] === \"string\" ? own[\"aria-describedby\"] : \"\";\n extra[\"aria-describedby\"] = [existing, describedBy].filter(Boolean).join(\" \");\n }\n if (hasError) {\n if (own[\"aria-invalid\"] === undefined) extra[\"aria-invalid\"] = true;\n if (!isDomElement && own.invalid === undefined) extra.invalid = true;\n }\n if (required && own.required === undefined) extra.required = true;\n if (disabled && own.disabled === undefined) extra.disabled = true;\n control = cloneElement(single, extra);\n }\n\n return (\n <div\n className={cx(\"ds-form-field\", hasError && \"ds-form-field--invalid\", disabled && \"ds-form-field--disabled\", className)}\n {...rest}\n >\n {label != null && (\n <Label htmlFor={id} required={required} disabled={disabled} className=\"ds-form-field__label\">\n {label}\n </Label>\n )}\n <div className=\"ds-form-field__control\">{control}</div>\n {helperText != null && (\n <p id={helperId} className=\"ds-form-field__helper\">\n {helperText}\n </p>\n )}\n <p id={errorId} className=\"ds-form-field__error\" aria-live=\"polite\">\n {hasError ? error : null}\n </p>\n </div>\n );\n}\n\nexport default FormField;\n"],"mappings":";;;;;;AA6CA,SAAS,UAAU,EACjB,OACA,SACA,WAAW,OACX,YACA,OACA,WAAW,OACX,WACA,UACA,GAAG,QACc;CACjB,MAAM,SAAS,MAAM;CACrB,MAAM,SACJ,OAAO,aAAa,cAAc,SAAS,MAAM,QAAQ,MAAM,KAAK,eAAe,QAAQ,IACtF,WACD;CACN,MAAM,UAAU,UAAU,OAAO,OAAO,MAAM,OAAO,WAAW,OAAO,MAAM,KAAK,KAAA;CAClF,MAAM,KAAK,WAAW,WAAW,YAAY;CAC7C,MAAM,WAAW,GAAG,GAAG;CACvB,MAAM,UAAU,GAAG,GAAG;CACtB,MAAM,WAAW,SAAS,QAAQ,UAAU,SAAS,UAAU;CAC/D,MAAM,cAAc,CAAC,cAAc,OAAO,WAAW,MAAM,WAAW,UAAU,IAAI,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,KAAK,KAAA;CAEnH,MAAM,aAAoC;EACxC;EACA,oBAAoB;EACpB,gBAAgB,WAAW,OAAO,KAAA;EAClC,SAAS,YAAY,KAAA;EACrB,UAAU,YAAY,KAAA;EACtB,UAAU,YAAY,KAAA;CACxB;CAEA,IAAI,UAAqB;CACzB,IAAI,OAAO,aAAa,YACtB,UAAU,SAAS,UAAU;MACxB,IAAI,QAAQ;EACjB,MAAM,MAAM,OAAO;EACnB,MAAM,eAAe,OAAO,OAAO,SAAS;EAC5C,MAAM,QAAkB,CAAC;EACzB,IAAI,IAAI,OAAO,KAAA,GAAW,MAAM,KAAK;EACrC,IAAI,aAEF,MAAM,sBAAsB,CADX,OAAO,IAAI,wBAAwB,WAAW,IAAI,sBAAsB,IAClD,WAAW,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAE9E,IAAI,UAAU;GACZ,IAAI,IAAI,oBAAoB,KAAA,GAAW,MAAM,kBAAkB;GAC/D,IAAI,CAAC,gBAAgB,IAAI,YAAY,KAAA,GAAW,MAAM,UAAU;EAClE;EACA,IAAI,YAAY,IAAI,aAAa,KAAA,GAAW,MAAM,WAAW;EAC7D,IAAI,YAAY,IAAI,aAAa,KAAA,GAAW,MAAM,WAAW;EAC7D,UAAU,aAAa,QAAQ,KAAK;CACtC;CAEA,OACEA,qBAAC,OAAD;EACE,WAAW,GAAG,iBAAiB,YAAY,0BAA0B,YAAY,2BAA2B,SAAS;EACrH,GAAI;EAFN,UAAA;GAIG,SAAS,QACRC,oBAAC,OAAD;IAAO,SAAS;IAAc;IAAoB;IAAU,WAAU;IACnE,UAAA;GACI,CAAA;GAETA,oBAAC,OAAD;IAAK,WAAU;IAA0B,UAAA;GAAa,CAAA;GACrD,cAAc,QACbA,oBAAC,KAAD;IAAG,IAAI;IAAU,WAAU;IACxB,UAAA;GACA,CAAA;GAELA,oBAAC,KAAD;IAAG,IAAI;IAAS,WAAU;IAAuB,aAAU;IACxD,UAAA,WAAW,QAAQ;GACnB,CAAA;EACA;;AAET"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.ds-form-field {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: var(--space-1);
|
|
5
|
+
font-family: var(--font-sans);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.ds-form-field__label {
|
|
9
|
+
margin-bottom: var(--space-1);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.ds-form-field__control {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.ds-form-field__control > * {
|
|
18
|
+
align-self: flex-start;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.ds-form-field__helper,
|
|
22
|
+
.ds-form-field__error {
|
|
23
|
+
margin: 0;
|
|
24
|
+
font-size: var(--font-size-xs);
|
|
25
|
+
line-height: var(--line-height-normal);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ds-form-field__helper {
|
|
29
|
+
color: var(--color-text-muted);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ds-form-field__error {
|
|
33
|
+
color: var(--color-danger-text);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.ds-form-field__error:empty {
|
|
37
|
+
/* Kept in the DOM (empty) so the live region exists before a message appears */
|
|
38
|
+
margin-top: calc(-1 * var(--space-1));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.ds-form-field--disabled .ds-form-field__helper {
|
|
42
|
+
color: var(--color-text-disabled);
|
|
43
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
/** Props each `ListItem` receives: the item fields, `itemProps`, and the ones below */
|
|
3
|
+
export type ListItemProps<T> = T & {
|
|
4
|
+
index: number;
|
|
5
|
+
className: string;
|
|
6
|
+
onClick: () => void;
|
|
7
|
+
};
|
|
8
|
+
export interface ListProps<T extends object> {
|
|
9
|
+
/** Array of elements to list */
|
|
10
|
+
children: T[];
|
|
11
|
+
/** Component used to render each element. Without it, each item is rendered as a `<li>` (the item itself must then be renderable) */
|
|
12
|
+
ListItem?: ComponentType<ListItemProps<T>>;
|
|
13
|
+
/** Field used as React key and to detect the selected item */
|
|
14
|
+
identifier?: keyof T & string;
|
|
15
|
+
/** Class of the list */
|
|
16
|
+
className?: string;
|
|
17
|
+
/** Identifier value of the selected item */
|
|
18
|
+
selected?: unknown;
|
|
19
|
+
/** Called with the clicked item */
|
|
20
|
+
onItemClick?: (item: T) => void;
|
|
21
|
+
/** Additional props passed to each item */
|
|
22
|
+
itemProps?: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
declare function List<T extends object>({ children, ListItem, selected, identifier, className, onItemClick, itemProps, }: ListProps<T>): import("react").JSX.Element;
|
|
25
|
+
export default List;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import './styles.css';/* empty css */
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/components/molecules/list/index.tsx
|
|
4
|
+
function List({ children, ListItem, selected, identifier, className, onItemClick, itemProps }) {
|
|
5
|
+
const key = identifier || "id";
|
|
6
|
+
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("ul", {
|
|
7
|
+
className: `ds-list ${className || ""}`,
|
|
8
|
+
children: children.map((item, index) => {
|
|
9
|
+
const id = item[key];
|
|
10
|
+
const itemClass = `ds-list__item ${id === selected ? "selected ds-list__item--selected" : ""}`;
|
|
11
|
+
const onClick = () => onItemClick?.(item);
|
|
12
|
+
if (ListItem) return /* @__PURE__ */ jsx(ListItem, {
|
|
13
|
+
...item,
|
|
14
|
+
...itemProps,
|
|
15
|
+
index,
|
|
16
|
+
className: itemClass,
|
|
17
|
+
onClick
|
|
18
|
+
}, String(id));
|
|
19
|
+
return /* @__PURE__ */ jsx("li", {
|
|
20
|
+
...itemProps,
|
|
21
|
+
className: itemClass,
|
|
22
|
+
onClick,
|
|
23
|
+
children: item
|
|
24
|
+
}, String(id));
|
|
25
|
+
})
|
|
26
|
+
}) });
|
|
27
|
+
}
|
|
28
|
+
export { List as default };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_jsx"],"sources":["../../../../src/components/molecules/list/index.tsx"],"sourcesContent":["import type { ComponentType, ReactNode } from \"react\";\nimport \"./styles.css\";\n\n/** Props each `ListItem` receives: the item fields, `itemProps`, and the ones below */\nexport type ListItemProps<T> = T & {\n index: number;\n className: string;\n onClick: () => void;\n};\n\nexport interface ListProps<T extends object> {\n /** Array of elements to list */\n children: T[];\n /** Component used to render each element. Without it, each item is rendered as a `<li>` (the item itself must then be renderable) */\n ListItem?: ComponentType<ListItemProps<T>>;\n /** Field used as React key and to detect the selected item */\n identifier?: keyof T & string;\n /** Class of the list */\n className?: string;\n /** Identifier value of the selected item */\n selected?: unknown;\n /** Called with the clicked item */\n onItemClick?: (item: T) => void;\n /** Additional props passed to each item */\n itemProps?: Record<string, unknown>;\n}\n\nfunction List<T extends object>({\n children,\n ListItem,\n selected,\n identifier,\n className,\n onItemClick,\n itemProps,\n}: ListProps<T>) {\n const key = (identifier || \"id\") as keyof T;\n return (\n <div>\n <ul className={`ds-list ${className || \"\"}`}>\n {children.map((item, index) => {\n const id = item[key];\n const isSelected = id === selected;\n const itemClass = `ds-list__item ${isSelected ? \"selected ds-list__item--selected\" : \"\"}`;\n const onClick = () => onItemClick?.(item);\n if (ListItem) {\n return (\n <ListItem\n key={String(id)}\n {...item}\n {...itemProps}\n index={index}\n className={itemClass}\n onClick={onClick}\n />\n );\n }\n return (\n <li key={String(id)} {...itemProps} className={itemClass} onClick={onClick}>\n {item as ReactNode}\n </li>\n );\n })}\n </ul>\n </div>\n );\n}\n\nexport default List;\n"],"mappings":";;;AA2BA,SAAS,KAAuB,EAC9B,UACA,UACA,UACA,YACA,WACA,aACA,aACe;CACf,MAAM,MAAO,cAAc;CAC3B,OACEA,oBAAC,OAAD,EAAA,UACEA,oBAAC,MAAD;EAAI,WAAW,WAAW,aAAa;EACpC,UAAA,SAAS,KAAK,MAAM,UAAU;GAC7B,MAAM,KAAK,KAAK;GAEhB,MAAM,YAAY,iBADC,OAAO,WACsB,qCAAqC;GACrF,MAAM,gBAAgB,cAAc,IAAI;GACxC,IAAI,UACF,OACEA,oBAAC,UAAD;IAEE,GAAI;IACJ,GAAI;IACG;IACP,WAAW;IACF;GACV,GANM,OAAO,EAAE,CAMf;GAGL,OACEA,oBAAC,MAAD;IAAqB,GAAI;IAAW,WAAW;IAAoB;IAChE,UAAA;GACC,GAFK,OAAO,EAAE,CAEd;EAER,CAAC;CACC,CAAA,EACD,CAAA;AAET"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.ds-list {
|
|
2
|
+
margin: 0;
|
|
3
|
+
padding: var(--space-1);
|
|
4
|
+
list-style: none;
|
|
5
|
+
border: var(--border-width-1) solid var(--color-border);
|
|
6
|
+
border-radius: var(--radius-lg);
|
|
7
|
+
background: var(--color-surface);
|
|
8
|
+
color: var(--color-text);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.ds-list > li {
|
|
12
|
+
padding: var(--space-2) var(--space-3);
|
|
13
|
+
border-radius: var(--radius-md);
|
|
14
|
+
font-size: var(--font-size-sm);
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
transition: background-color var(--duration-fast) var(--easing-standard);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.ds-list > li:hover {
|
|
20
|
+
background: var(--color-neutral);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ds-list > li.selected,
|
|
24
|
+
.ds-list .ds-list__item--selected {
|
|
25
|
+
background: var(--color-primary-subtle);
|
|
26
|
+
color: var(--color-primary-text);
|
|
27
|
+
font-weight: var(--font-weight-medium);
|
|
28
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { InputHTMLAttributes } from "react";
|
|
2
|
+
export type NumberStepperSize = "sm" | "md" | "lg";
|
|
3
|
+
export interface NumberStepperProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "value" | "defaultValue" | "onChange" | "size" | "type" | "min" | "max" | "step"> {
|
|
4
|
+
/** Current number (controlled). `null` means empty */
|
|
5
|
+
value?: number | null;
|
|
6
|
+
/** Initial number (uncontrolled). `null` means empty */
|
|
7
|
+
defaultValue?: number | null;
|
|
8
|
+
/** Called with the new number, or `null` when the field is emptied */
|
|
9
|
+
onChange?: (value: number | null) => void;
|
|
10
|
+
/** Lowest allowed value */
|
|
11
|
+
min?: number;
|
|
12
|
+
/** Highest allowed value */
|
|
13
|
+
max?: number;
|
|
14
|
+
/** Amount added or removed by the buttons and arrow keys (Shift and PageUp/PageDown use ×10) */
|
|
15
|
+
step?: number;
|
|
16
|
+
/** Decimal places to round to and display. Default: the decimals of `step` */
|
|
17
|
+
precision?: number;
|
|
18
|
+
/** Height, from the control-size tokens */
|
|
19
|
+
size?: NumberStepperSize;
|
|
20
|
+
/** Marks the value as invalid (sets `aria-invalid` and a danger border) */
|
|
21
|
+
invalid?: boolean;
|
|
22
|
+
/** Accessible label of the decrement button. Default "Decrease" */
|
|
23
|
+
decrementLabel?: string;
|
|
24
|
+
/** Accessible label of the increment button. Default "Increase" */
|
|
25
|
+
incrementLabel?: string;
|
|
26
|
+
/** Class name applied to the root wrapper element (the native input receives the rest of the props) */
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
/** Numeric input with decrement/increment buttons and spinbutton keyboard support. */
|
|
30
|
+
declare const NumberStepper: import("react").ForwardRefExoticComponent<NumberStepperProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
31
|
+
export default NumberStepper;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { forwardRef, useState } from "react";
|
|
2
|
+
import Button from "../../atoms/button/index.js";
|
|
3
|
+
import { useControllableState } from "../../hooks/use-controllable-state.js";
|
|
4
|
+
import { cx } from "../../utils/cx.js";
|
|
5
|
+
import './styles.css';/* empty css */
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/components/molecules/number-stepper/index.tsx
|
|
8
|
+
var decimalsOf = (n) => {
|
|
9
|
+
const text = String(n);
|
|
10
|
+
const dot = text.indexOf(".");
|
|
11
|
+
return dot === -1 ? 0 : text.length - dot - 1;
|
|
12
|
+
};
|
|
13
|
+
/** Numeric input with decrement/increment buttons and spinbutton keyboard support. */
|
|
14
|
+
var NumberStepper = forwardRef(function NumberStepper({ value, defaultValue = null, onChange, min, max, step = 1, precision, size = "md", invalid = false, disabled = false, readOnly = false, decrementLabel = "Decrease", incrementLabel = "Increase", className, style, onKeyDown, onBlur, ...rest }, ref) {
|
|
15
|
+
const [current, setCurrent] = useControllableState(value, defaultValue, onChange);
|
|
16
|
+
const [draft, setDraft] = useState(null);
|
|
17
|
+
const digits = precision ?? decimalsOf(step);
|
|
18
|
+
const round = (n) => Number(n.toFixed(digits));
|
|
19
|
+
const clamp = (n) => Math.min(max ?? 1e400, Math.max(min ?? -1e400, n));
|
|
20
|
+
const format = (n) => n == null ? "" : precision != null ? n.toFixed(precision) : String(n);
|
|
21
|
+
const parse = (text) => {
|
|
22
|
+
const normalized = text.trim().replace(",", ".");
|
|
23
|
+
if (normalized === "") return null;
|
|
24
|
+
const n = Number(normalized);
|
|
25
|
+
return Number.isFinite(n) ? n : void 0;
|
|
26
|
+
};
|
|
27
|
+
const commit = (next) => {
|
|
28
|
+
setDraft(null);
|
|
29
|
+
setCurrent(next == null ? null : round(clamp(next)));
|
|
30
|
+
};
|
|
31
|
+
const stepBy = (delta) => {
|
|
32
|
+
if (disabled || readOnly) return;
|
|
33
|
+
const base = draft != null ? parse(draft) ?? current : current;
|
|
34
|
+
if (base == null) {
|
|
35
|
+
commit(delta > 0 ? min ?? 0 : max ?? min ?? 0);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
commit(base + delta);
|
|
39
|
+
};
|
|
40
|
+
const handleChange = (event) => {
|
|
41
|
+
const text = event.target.value;
|
|
42
|
+
setDraft(text);
|
|
43
|
+
const parsed = parse(text);
|
|
44
|
+
if (parsed !== void 0) setCurrent(parsed);
|
|
45
|
+
};
|
|
46
|
+
const handleBlur = (event) => {
|
|
47
|
+
if (draft != null) {
|
|
48
|
+
const parsed = parse(draft);
|
|
49
|
+
commit(parsed === void 0 ? current : parsed);
|
|
50
|
+
} else if (current != null) commit(current);
|
|
51
|
+
onBlur?.(event);
|
|
52
|
+
};
|
|
53
|
+
const handleKeyDown = (event) => {
|
|
54
|
+
onKeyDown?.(event);
|
|
55
|
+
if (event.defaultPrevented) return;
|
|
56
|
+
const big = step * 10;
|
|
57
|
+
switch (event.key) {
|
|
58
|
+
case "ArrowUp":
|
|
59
|
+
stepBy(event.shiftKey ? big : step);
|
|
60
|
+
break;
|
|
61
|
+
case "ArrowDown":
|
|
62
|
+
stepBy(-(event.shiftKey ? big : step));
|
|
63
|
+
break;
|
|
64
|
+
case "PageUp":
|
|
65
|
+
stepBy(big);
|
|
66
|
+
break;
|
|
67
|
+
case "PageDown":
|
|
68
|
+
stepBy(-big);
|
|
69
|
+
break;
|
|
70
|
+
case "Home":
|
|
71
|
+
if (min == null) return;
|
|
72
|
+
if (!disabled && !readOnly) commit(min);
|
|
73
|
+
break;
|
|
74
|
+
case "End":
|
|
75
|
+
if (max == null) return;
|
|
76
|
+
if (!disabled && !readOnly) commit(max);
|
|
77
|
+
break;
|
|
78
|
+
case "Enter":
|
|
79
|
+
if (draft != null) commit(parse(draft) ?? current);
|
|
80
|
+
return;
|
|
81
|
+
default: return;
|
|
82
|
+
}
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
};
|
|
85
|
+
const atMin = current != null && min != null && current <= min;
|
|
86
|
+
const atMax = current != null && max != null && current >= max;
|
|
87
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
88
|
+
className: cx("ds-number-stepper", `ds-number-stepper--${size}`, invalid && "ds-number-stepper--invalid", disabled && "ds-number-stepper--disabled", className),
|
|
89
|
+
style,
|
|
90
|
+
children: [
|
|
91
|
+
/* @__PURE__ */ jsx(Button, {
|
|
92
|
+
className: "ds-number-stepper__button",
|
|
93
|
+
size,
|
|
94
|
+
variant: "ghost",
|
|
95
|
+
iconOnly: true,
|
|
96
|
+
tabIndex: -1,
|
|
97
|
+
"aria-label": decrementLabel,
|
|
98
|
+
disabled: disabled || readOnly || atMin,
|
|
99
|
+
onClick: () => stepBy(-step),
|
|
100
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
101
|
+
viewBox: "0 0 16 16",
|
|
102
|
+
fill: "none",
|
|
103
|
+
width: "1em",
|
|
104
|
+
height: "1em",
|
|
105
|
+
"aria-hidden": "true",
|
|
106
|
+
focusable: "false",
|
|
107
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
108
|
+
d: "M3.5 8h9",
|
|
109
|
+
stroke: "currentColor",
|
|
110
|
+
strokeWidth: "1.6",
|
|
111
|
+
strokeLinecap: "round"
|
|
112
|
+
})
|
|
113
|
+
})
|
|
114
|
+
}),
|
|
115
|
+
/* @__PURE__ */ jsx("input", {
|
|
116
|
+
ref,
|
|
117
|
+
type: "text",
|
|
118
|
+
inputMode: "decimal",
|
|
119
|
+
role: "spinbutton",
|
|
120
|
+
autoComplete: "off",
|
|
121
|
+
className: "ds-number-stepper__field",
|
|
122
|
+
value: draft ?? format(current),
|
|
123
|
+
"aria-valuenow": current ?? void 0,
|
|
124
|
+
"aria-valuemin": min,
|
|
125
|
+
"aria-valuemax": max,
|
|
126
|
+
"aria-invalid": invalid || void 0,
|
|
127
|
+
disabled,
|
|
128
|
+
readOnly,
|
|
129
|
+
onChange: handleChange,
|
|
130
|
+
onBlur: handleBlur,
|
|
131
|
+
onKeyDown: handleKeyDown,
|
|
132
|
+
...rest
|
|
133
|
+
}),
|
|
134
|
+
/* @__PURE__ */ jsx(Button, {
|
|
135
|
+
className: "ds-number-stepper__button",
|
|
136
|
+
size,
|
|
137
|
+
variant: "ghost",
|
|
138
|
+
iconOnly: true,
|
|
139
|
+
tabIndex: -1,
|
|
140
|
+
"aria-label": incrementLabel,
|
|
141
|
+
disabled: disabled || readOnly || atMax,
|
|
142
|
+
onClick: () => stepBy(step),
|
|
143
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
144
|
+
viewBox: "0 0 16 16",
|
|
145
|
+
fill: "none",
|
|
146
|
+
width: "1em",
|
|
147
|
+
height: "1em",
|
|
148
|
+
"aria-hidden": "true",
|
|
149
|
+
focusable: "false",
|
|
150
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
151
|
+
d: "M3.5 8h9M8 3.5v9",
|
|
152
|
+
stroke: "currentColor",
|
|
153
|
+
strokeWidth: "1.6",
|
|
154
|
+
strokeLinecap: "round"
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
})
|
|
158
|
+
]
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
export { NumberStepper as default };
|
|
162
|
+
|
|
163
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_jsxs","_jsx"],"sources":["../../../../src/components/molecules/number-stepper/index.tsx"],"sourcesContent":["import { forwardRef, useState } from \"react\";\nimport type { ChangeEvent, FocusEvent, InputHTMLAttributes, KeyboardEvent } from \"react\";\nimport Button from \"../../atoms/button\";\nimport { useControllableState } from \"../../hooks\";\nimport { cx } from \"../../utils/cx\";\nimport \"./styles.css\";\n\nexport type NumberStepperSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface NumberStepperProps\n extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"value\" | \"defaultValue\" | \"onChange\" | \"size\" | \"type\" | \"min\" | \"max\" | \"step\"\n > {\n /** Current number (controlled). `null` means empty */\n value?: number | null;\n /** Initial number (uncontrolled). `null` means empty */\n defaultValue?: number | null;\n /** Called with the new number, or `null` when the field is emptied */\n onChange?: (value: number | null) => void;\n /** Lowest allowed value */\n min?: number;\n /** Highest allowed value */\n max?: number;\n /** Amount added or removed by the buttons and arrow keys (Shift and PageUp/PageDown use ×10) */\n step?: number;\n /** Decimal places to round to and display. Default: the decimals of `step` */\n precision?: number;\n /** Height, from the control-size tokens */\n size?: NumberStepperSize;\n /** Marks the value as invalid (sets `aria-invalid` and a danger border) */\n invalid?: boolean;\n /** Accessible label of the decrement button. Default \"Decrease\" */\n decrementLabel?: string;\n /** Accessible label of the increment button. Default \"Increase\" */\n incrementLabel?: string;\n /** Class name applied to the root wrapper element (the native input receives the rest of the props) */\n className?: string;\n}\n\nconst decimalsOf = (n: number) => {\n const text = String(n);\n const dot = text.indexOf(\".\");\n return dot === -1 ? 0 : text.length - dot - 1;\n};\n\n/** Numeric input with decrement/increment buttons and spinbutton keyboard support. */\nconst NumberStepper = forwardRef<HTMLInputElement, NumberStepperProps>(function NumberStepper(\n {\n value,\n defaultValue = null,\n onChange,\n min,\n max,\n step = 1,\n precision,\n size = \"md\",\n invalid = false,\n disabled = false,\n readOnly = false,\n decrementLabel = \"Decrease\",\n incrementLabel = \"Increase\",\n className,\n style,\n onKeyDown,\n onBlur,\n ...rest\n },\n ref\n) {\n const [current, setCurrent] = useControllableState<number | null>(value, defaultValue, onChange);\n // Raw text while the user is typing; null shows the formatted value.\n const [draft, setDraft] = useState<string | null>(null);\n const digits = precision ?? decimalsOf(step);\n\n const round = (n: number) => Number(n.toFixed(digits));\n const clamp = (n: number) => Math.min(max ?? Infinity, Math.max(min ?? -Infinity, n));\n const format = (n: number | null) => (n == null ? \"\" : precision != null ? n.toFixed(precision) : String(n));\n const parse = (text: string) => {\n const normalized = text.trim().replace(\",\", \".\");\n if (normalized === \"\") return null;\n const n = Number(normalized);\n return Number.isFinite(n) ? n : undefined;\n };\n\n const commit = (next: number | null) => {\n setDraft(null);\n setCurrent(next == null ? null : round(clamp(next)));\n };\n\n const stepBy = (delta: number) => {\n if (disabled || readOnly) return;\n const base = draft != null ? (parse(draft) ?? current) : current;\n if (base == null) {\n commit(delta > 0 ? (min ?? 0) : (max ?? min ?? 0));\n return;\n }\n commit(base + delta);\n };\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n const text = event.target.value;\n setDraft(text);\n const parsed = parse(text);\n if (parsed !== undefined) setCurrent(parsed);\n };\n\n const handleBlur = (event: FocusEvent<HTMLInputElement>) => {\n if (draft != null) {\n const parsed = parse(draft);\n commit(parsed === undefined ? current : parsed);\n } else if (current != null) {\n commit(current);\n }\n onBlur?.(event);\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n const big = step * 10;\n switch (event.key) {\n case \"ArrowUp\":\n stepBy(event.shiftKey ? big : step);\n break;\n case \"ArrowDown\":\n stepBy(-(event.shiftKey ? big : step));\n break;\n case \"PageUp\":\n stepBy(big);\n break;\n case \"PageDown\":\n stepBy(-big);\n break;\n case \"Home\":\n if (min == null) return;\n if (!disabled && !readOnly) commit(min);\n break;\n case \"End\":\n if (max == null) return;\n if (!disabled && !readOnly) commit(max);\n break;\n case \"Enter\":\n if (draft != null) commit(parse(draft) ?? current);\n return;\n default:\n return;\n }\n event.preventDefault();\n };\n\n const atMin = current != null && min != null && current <= min;\n const atMax = current != null && max != null && current >= max;\n\n return (\n <div\n className={cx(\n \"ds-number-stepper\",\n `ds-number-stepper--${size}`,\n invalid && \"ds-number-stepper--invalid\",\n disabled && \"ds-number-stepper--disabled\",\n className\n )}\n style={style}\n >\n <Button\n className=\"ds-number-stepper__button\"\n size={size}\n variant=\"ghost\"\n iconOnly\n tabIndex={-1}\n aria-label={decrementLabel}\n disabled={disabled || readOnly || atMin}\n onClick={() => stepBy(-step)}\n >\n <svg viewBox=\"0 0 16 16\" fill=\"none\" width=\"1em\" height=\"1em\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M3.5 8h9\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" />\n </svg>\n </Button>\n <input\n ref={ref}\n type=\"text\"\n inputMode=\"decimal\"\n role=\"spinbutton\"\n autoComplete=\"off\"\n className=\"ds-number-stepper__field\"\n value={draft ?? format(current)}\n aria-valuenow={current ?? undefined}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-invalid={invalid || undefined}\n disabled={disabled}\n readOnly={readOnly}\n onChange={handleChange}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n {...rest}\n />\n <Button\n className=\"ds-number-stepper__button\"\n size={size}\n variant=\"ghost\"\n iconOnly\n tabIndex={-1}\n aria-label={incrementLabel}\n disabled={disabled || readOnly || atMax}\n onClick={() => stepBy(step)}\n >\n <svg viewBox=\"0 0 16 16\" fill=\"none\" width=\"1em\" height=\"1em\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M3.5 8h9M8 3.5v9\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" />\n </svg>\n </Button>\n </div>\n );\n});\n\nexport default NumberStepper;\n"],"mappings":"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"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
.ds-number-stepper {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
height: var(--control-height-md);
|
|
5
|
+
border: var(--border-width-1) solid var(--color-border-strong);
|
|
6
|
+
border-radius: var(--radius-md);
|
|
7
|
+
background: var(--color-surface);
|
|
8
|
+
color: var(--color-text);
|
|
9
|
+
font-family: var(--font-sans);
|
|
10
|
+
font-size: var(--font-size-sm);
|
|
11
|
+
transition: border-color var(--duration-fast) var(--easing-standard);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.ds-number-stepper:hover:not(.ds-number-stepper--disabled) {
|
|
15
|
+
border-color: var(--color-text-subtle);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ds-number-stepper:focus-within {
|
|
19
|
+
outline: var(--border-width-2) solid var(--color-focus-ring);
|
|
20
|
+
outline-offset: 2px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ds-number-stepper__field {
|
|
24
|
+
width: 6ch;
|
|
25
|
+
min-width: 0;
|
|
26
|
+
height: 100%;
|
|
27
|
+
padding: 0 var(--space-1);
|
|
28
|
+
border: 0;
|
|
29
|
+
background: transparent;
|
|
30
|
+
color: inherit;
|
|
31
|
+
font: inherit;
|
|
32
|
+
font-variant-numeric: tabular-nums;
|
|
33
|
+
text-align: center;
|
|
34
|
+
outline: none;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.ds-number-stepper__button.ds-button {
|
|
38
|
+
height: 100%;
|
|
39
|
+
border: 0;
|
|
40
|
+
border-radius: 0;
|
|
41
|
+
color: var(--color-text-muted);
|
|
42
|
+
}
|
|
43
|
+
.ds-number-stepper__button.ds-button:first-child {
|
|
44
|
+
border-radius: var(--radius-md) 0 0 var(--radius-md);
|
|
45
|
+
}
|
|
46
|
+
.ds-number-stepper__button.ds-button:last-child {
|
|
47
|
+
border-radius: 0 var(--radius-md) var(--radius-md) 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.ds-number-stepper--sm {
|
|
51
|
+
height: var(--control-height-sm);
|
|
52
|
+
font-size: var(--font-size-xs);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.ds-number-stepper--lg {
|
|
56
|
+
height: var(--control-height-lg);
|
|
57
|
+
font-size: var(--font-size-md);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.ds-number-stepper--invalid,
|
|
61
|
+
.ds-number-stepper--invalid:hover:not(.ds-number-stepper--disabled) {
|
|
62
|
+
border-color: var(--color-danger);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.ds-number-stepper--disabled {
|
|
66
|
+
background: var(--color-bg-subtle);
|
|
67
|
+
color: var(--color-text-disabled);
|
|
68
|
+
cursor: not-allowed;
|
|
69
|
+
}
|