@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,75 @@
|
|
|
1
|
+
.ds-progress {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: var(--space-1);
|
|
5
|
+
width: 100%;
|
|
6
|
+
font-family: var(--font-sans);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.ds-progress__header {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: baseline;
|
|
12
|
+
justify-content: space-between;
|
|
13
|
+
gap: var(--space-2);
|
|
14
|
+
font-size: var(--font-size-sm);
|
|
15
|
+
color: var(--color-text);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ds-progress__label {
|
|
19
|
+
font-weight: var(--font-weight-medium);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.ds-progress__value {
|
|
23
|
+
margin-left: auto;
|
|
24
|
+
color: var(--color-text-muted);
|
|
25
|
+
font-variant-numeric: tabular-nums;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ds-progress__track {
|
|
29
|
+
position: relative;
|
|
30
|
+
width: 100%;
|
|
31
|
+
height: var(--space-2);
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
border-radius: var(--radius-full);
|
|
34
|
+
background: var(--color-neutral);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.ds-progress--sm .ds-progress__track {
|
|
38
|
+
height: var(--space-1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.ds-progress__fill {
|
|
42
|
+
height: 100%;
|
|
43
|
+
border-radius: inherit;
|
|
44
|
+
background: var(--color-primary);
|
|
45
|
+
transition: width var(--duration-normal) var(--easing-standard);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.ds-progress--success .ds-progress__fill { background: var(--color-success); }
|
|
49
|
+
.ds-progress--warning .ds-progress__fill { background: var(--color-warning); }
|
|
50
|
+
.ds-progress--danger .ds-progress__fill { background: var(--color-danger); }
|
|
51
|
+
|
|
52
|
+
.ds-progress__track--indeterminate .ds-progress__fill {
|
|
53
|
+
position: absolute;
|
|
54
|
+
top: 0;
|
|
55
|
+
left: 0;
|
|
56
|
+
width: 40%;
|
|
57
|
+
animation: ds-progress-indeterminate calc(var(--duration-slower) * 3) var(--easing-standard) infinite;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@keyframes ds-progress-indeterminate {
|
|
61
|
+
from {
|
|
62
|
+
transform: translateX(-100%);
|
|
63
|
+
}
|
|
64
|
+
to {
|
|
65
|
+
transform: translateX(250%);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@media (prefers-reduced-motion: reduce) {
|
|
70
|
+
.ds-progress__track--indeterminate .ds-progress__fill {
|
|
71
|
+
animation: none;
|
|
72
|
+
width: 100%;
|
|
73
|
+
opacity: 0.5;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface RadioGroupContextValue {
|
|
2
|
+
name: string;
|
|
3
|
+
value: string;
|
|
4
|
+
disabled: boolean;
|
|
5
|
+
invalid: boolean;
|
|
6
|
+
onValueChange: (value: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const RadioGroupContext: import("react").Context<RadioGroupContextValue | null>;
|
|
9
|
+
export declare function useRadioGroup(): RadioGroupContextValue | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
// src/components/atoms/radio/context.ts
|
|
3
|
+
var RadioGroupContext = createContext(null);
|
|
4
|
+
function useRadioGroup() {
|
|
5
|
+
return useContext(RadioGroupContext);
|
|
6
|
+
}
|
|
7
|
+
export { RadioGroupContext, useRadioGroup };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","names":[],"sources":["../../../../src/components/atoms/radio/context.ts"],"sourcesContent":["import { createContext, useContext } from \"react\";\n\nexport interface RadioGroupContextValue {\n name: string;\n value: string;\n disabled: boolean;\n invalid: boolean;\n onValueChange: (value: string) => void;\n}\n\nexport const RadioGroupContext = createContext<RadioGroupContextValue | null>(null);\n\nexport function useRadioGroup(): RadioGroupContextValue | null {\n return useContext(RadioGroupContext);\n}\n"],"mappings":";;AAUA,IAAa,oBAAoB,cAA6C,IAAI;AAElF,SAAgB,gBAA+C;CAC7D,OAAO,WAAW,iBAAiB;AACrC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { InputHTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export { RadioGroup } from "./radio-group";
|
|
3
|
+
export type { RadioGroupProps, RadioGroupOrientation } from "./radio-group";
|
|
4
|
+
export interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value"> {
|
|
5
|
+
/** Value submitted with the form and compared against the RadioGroup value */
|
|
6
|
+
value: string;
|
|
7
|
+
/** Text or content shown next to the radio; clicking it selects the radio */
|
|
8
|
+
label?: ReactNode;
|
|
9
|
+
/** Marks the value as invalid */
|
|
10
|
+
invalid?: boolean;
|
|
11
|
+
/** Class name applied to the root element (the native input receives the rest of the props) */
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const Radio: import("react").ForwardRefExoticComponent<RadioProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
15
|
+
export default Radio;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import { cx } from "../../utils/cx.js";
|
|
3
|
+
import { useRadioGroup } from "./context.js";
|
|
4
|
+
import './styles.css';/* empty css */
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { RadioGroup } from "./radio-group.js";
|
|
7
|
+
// src/components/atoms/radio/index.tsx
|
|
8
|
+
var Radio = forwardRef(function Radio({ value, label, invalid = false, className, style, disabled, checked, name, onChange, ...rest }, ref) {
|
|
9
|
+
const group = useRadioGroup();
|
|
10
|
+
const isDisabled = disabled ?? group?.disabled ?? false;
|
|
11
|
+
const isInvalid = invalid || (group?.invalid ?? false);
|
|
12
|
+
const handleChange = (event) => {
|
|
13
|
+
onChange?.(event);
|
|
14
|
+
if (group && event.target.checked) group.onValueChange(value);
|
|
15
|
+
};
|
|
16
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
17
|
+
className: cx("ds-radio", isInvalid && "ds-radio--invalid", isDisabled && "ds-radio--disabled", className),
|
|
18
|
+
style,
|
|
19
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
20
|
+
className: "ds-radio__control",
|
|
21
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
22
|
+
ref,
|
|
23
|
+
type: "radio",
|
|
24
|
+
className: "ds-radio__input",
|
|
25
|
+
value,
|
|
26
|
+
name: group ? group.name : name,
|
|
27
|
+
checked: group ? group.value === value : checked,
|
|
28
|
+
disabled: isDisabled,
|
|
29
|
+
"aria-invalid": isInvalid || void 0,
|
|
30
|
+
onChange: handleChange,
|
|
31
|
+
...rest
|
|
32
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
33
|
+
className: "ds-radio__circle",
|
|
34
|
+
"aria-hidden": "true"
|
|
35
|
+
})]
|
|
36
|
+
}), label != null && /* @__PURE__ */ jsx("span", {
|
|
37
|
+
className: "ds-radio__label",
|
|
38
|
+
children: label
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
export { RadioGroup, Radio as default };
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_jsxs","_jsx"],"sources":["../../../../src/components/atoms/radio/index.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ChangeEvent, InputHTMLAttributes, ReactNode } from \"react\";\nimport { cx } from \"../../utils/cx\";\nimport { useRadioGroup } from \"./context\";\nimport \"./styles.css\";\n\nexport { RadioGroup } from \"./radio-group\";\nexport type { RadioGroupProps, RadioGroupOrientation } from \"./radio-group\";\n\nexport interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"value\"> {\n /** Value submitted with the form and compared against the RadioGroup value */\n value: string;\n /** Text or content shown next to the radio; clicking it selects the radio */\n label?: ReactNode;\n /** Marks the value as invalid */\n invalid?: boolean;\n /** Class name applied to the root element (the native input receives the rest of the props) */\n className?: string;\n}\n\nconst Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio(\n { value, label, invalid = false, className, style, disabled, checked, name, onChange, ...rest },\n ref\n) {\n const group = useRadioGroup();\n const isDisabled = disabled ?? group?.disabled ?? false;\n const isInvalid = invalid || (group?.invalid ?? false);\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n if (group && event.target.checked) group.onValueChange(value);\n };\n\n return (\n <label\n className={cx(\"ds-radio\", isInvalid && \"ds-radio--invalid\", isDisabled && \"ds-radio--disabled\", className)}\n style={style}\n >\n <span className=\"ds-radio__control\">\n <input\n ref={ref}\n type=\"radio\"\n className=\"ds-radio__input\"\n value={value}\n name={group ? group.name : name}\n checked={group ? group.value === value : checked}\n disabled={isDisabled}\n aria-invalid={isInvalid || undefined}\n onChange={handleChange}\n {...rest}\n />\n <span className=\"ds-radio__circle\" aria-hidden=\"true\" />\n </span>\n {label != null && <span className=\"ds-radio__label\">{label}</span>}\n </label>\n );\n});\n\nexport default Radio;\n"],"mappings":";;;;;;;AAoBA,IAAM,QAAQ,WAAyC,SAAS,MAC9D,EAAE,OAAO,OAAO,UAAU,OAAO,WAAW,OAAO,UAAU,SAAS,MAAM,UAAU,GAAG,QACzF,KACA;CACA,MAAM,QAAQ,cAAc;CAC5B,MAAM,aAAa,YAAY,OAAO,YAAY;CAClD,MAAM,YAAY,YAAY,OAAO,WAAW;CAEhD,MAAM,gBAAgB,UAAyC;EAC7D,WAAW,KAAK;EAChB,IAAI,SAAS,MAAM,OAAO,SAAS,MAAM,cAAc,KAAK;CAC9D;CAEA,OACEA,qBAAC,SAAD;EACE,WAAW,GAAG,YAAY,aAAa,qBAAqB,cAAc,sBAAsB,SAAS;EAClG;EAFT,UAAA,CAIEA,qBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA,CACEC,oBAAC,SAAD;IACO;IACL,MAAK;IACL,WAAU;IACH;IACP,MAAM,QAAQ,MAAM,OAAO;IAC3B,SAAS,QAAQ,MAAM,UAAU,QAAQ;IACzC,UAAU;IACV,gBAAc,aAAa,KAAA;IAC3B,UAAU;IACV,GAAI;GACL,CAAA,GACDA,oBAAC,QAAD;IAAM,WAAU;IAAmB,eAAY;GAAQ,CAAA,CACnD;EACL,CAAA,GAAA,SAAS,QAAQA,oBAAC,QAAD;GAAM,WAAU;GAAmB,UAAA;EAAY,CAAA,CAC5D;;AAEX,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export type RadioGroupOrientation = "vertical" | "horizontal";
|
|
3
|
+
export interface RadioGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> {
|
|
4
|
+
/** `name` shared by every Radio in the group (generated when omitted) */
|
|
5
|
+
name?: string;
|
|
6
|
+
/** Selected value (controlled) */
|
|
7
|
+
value?: string;
|
|
8
|
+
/** Initially selected value (uncontrolled) */
|
|
9
|
+
defaultValue?: string;
|
|
10
|
+
/** Called with the newly selected value */
|
|
11
|
+
onChange?: (value: string) => void;
|
|
12
|
+
/** Layout direction of the options */
|
|
13
|
+
orientation?: RadioGroupOrientation;
|
|
14
|
+
/** Group label, rendered as a visible legend and used as the accessible name. Pass `aria-label` instead for a hidden label */
|
|
15
|
+
label?: ReactNode;
|
|
16
|
+
/** Disables every Radio in the group */
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/** Marks the group as invalid */
|
|
19
|
+
invalid?: boolean;
|
|
20
|
+
/** Marks the group as required */
|
|
21
|
+
required?: boolean;
|
|
22
|
+
/** `Radio` elements */
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
export declare function RadioGroup({ name, value, defaultValue, onChange, orientation, label, disabled, invalid, required, className, children, ...rest }: RadioGroupProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useId, useMemo } from "react";
|
|
2
|
+
import { useControllableState } from "../../hooks/use-controllable-state.js";
|
|
3
|
+
import { cx } from "../../utils/cx.js";
|
|
4
|
+
import { RadioGroupContext } from "./context.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/components/atoms/radio/radio-group.tsx
|
|
7
|
+
function RadioGroup({ name, value, defaultValue, onChange, orientation = "vertical", label, disabled = false, invalid = false, required = false, className, children, ...rest }) {
|
|
8
|
+
const autoId = useId();
|
|
9
|
+
const groupName = name ?? `ds-radio-${autoId}`;
|
|
10
|
+
const labelId = `${autoId}-label`;
|
|
11
|
+
const [current, setCurrent] = useControllableState(value, defaultValue ?? "", onChange);
|
|
12
|
+
const ctx = useMemo(() => ({
|
|
13
|
+
name: groupName,
|
|
14
|
+
value: current,
|
|
15
|
+
disabled,
|
|
16
|
+
invalid,
|
|
17
|
+
onValueChange: setCurrent
|
|
18
|
+
}), [
|
|
19
|
+
groupName,
|
|
20
|
+
current,
|
|
21
|
+
disabled,
|
|
22
|
+
invalid,
|
|
23
|
+
setCurrent
|
|
24
|
+
]);
|
|
25
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
26
|
+
role: "radiogroup",
|
|
27
|
+
"aria-labelledby": label != null ? labelId : void 0,
|
|
28
|
+
"aria-orientation": orientation,
|
|
29
|
+
"aria-disabled": disabled || void 0,
|
|
30
|
+
"aria-invalid": invalid || void 0,
|
|
31
|
+
"aria-required": required || void 0,
|
|
32
|
+
className: cx("ds-radio-group", `ds-radio-group--${orientation}`, className),
|
|
33
|
+
...rest,
|
|
34
|
+
children: [label != null && /* @__PURE__ */ jsx("span", {
|
|
35
|
+
id: labelId,
|
|
36
|
+
className: "ds-radio-group__label",
|
|
37
|
+
children: label
|
|
38
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
39
|
+
className: "ds-radio-group__options",
|
|
40
|
+
children: /* @__PURE__ */ jsx(RadioGroupContext.Provider, {
|
|
41
|
+
value: ctx,
|
|
42
|
+
children
|
|
43
|
+
})
|
|
44
|
+
})]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
export { RadioGroup };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=radio-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-group.js","names":["_jsxs","_jsx"],"sources":["../../../../src/components/atoms/radio/radio-group.tsx"],"sourcesContent":["import { useId, useMemo } from \"react\";\nimport type { HTMLAttributes, ReactNode } from \"react\";\nimport { useControllableState } from \"../../hooks\";\nimport { cx } from \"../../utils/cx\";\nimport { RadioGroupContext } from \"./context\";\n\nexport type RadioGroupOrientation = \"vertical\" | \"horizontal\";\n\nexport interface RadioGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onChange\" | \"defaultValue\"> {\n /** `name` shared by every Radio in the group (generated when omitted) */\n name?: string;\n /** Selected value (controlled) */\n value?: string;\n /** Initially selected value (uncontrolled) */\n defaultValue?: string;\n /** Called with the newly selected value */\n onChange?: (value: string) => void;\n /** Layout direction of the options */\n orientation?: RadioGroupOrientation;\n /** Group label, rendered as a visible legend and used as the accessible name. Pass `aria-label` instead for a hidden label */\n label?: ReactNode;\n /** Disables every Radio in the group */\n disabled?: boolean;\n /** Marks the group as invalid */\n invalid?: boolean;\n /** Marks the group as required */\n required?: boolean;\n /** `Radio` elements */\n children?: ReactNode;\n}\n\nexport function RadioGroup({\n name,\n value,\n defaultValue,\n onChange,\n orientation = \"vertical\",\n label,\n disabled = false,\n invalid = false,\n required = false,\n className,\n children,\n ...rest\n}: RadioGroupProps) {\n const autoId = useId();\n const groupName = name ?? `ds-radio-${autoId}`;\n const labelId = `${autoId}-label`;\n const [current, setCurrent] = useControllableState<string>(value, defaultValue ?? \"\", onChange);\n\n const ctx = useMemo(\n () => ({ name: groupName, value: current, disabled, invalid, onValueChange: setCurrent }),\n [groupName, current, disabled, invalid, setCurrent]\n );\n\n return (\n <div\n role=\"radiogroup\"\n aria-labelledby={label != null ? labelId : undefined}\n aria-orientation={orientation}\n aria-disabled={disabled || undefined}\n aria-invalid={invalid || undefined}\n aria-required={required || undefined}\n className={cx(\"ds-radio-group\", `ds-radio-group--${orientation}`, className)}\n {...rest}\n >\n {label != null && (\n <span id={labelId} className=\"ds-radio-group__label\">\n {label}\n </span>\n )}\n <div className=\"ds-radio-group__options\">\n <RadioGroupContext.Provider value={ctx}>{children}</RadioGroupContext.Provider>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;AA+BA,SAAgB,WAAW,EACzB,MACA,OACA,cACA,UACA,cAAc,YACd,OACA,WAAW,OACX,UAAU,OACV,WAAW,OACX,WACA,UACA,GAAG,QACe;CAClB,MAAM,SAAS,MAAM;CACrB,MAAM,YAAY,QAAQ,YAAY;CACtC,MAAM,UAAU,GAAG,OAAO;CAC1B,MAAM,CAAC,SAAS,cAAc,qBAA6B,OAAO,gBAAgB,IAAI,QAAQ;CAE9F,MAAM,MAAM,eACH;EAAE,MAAM;EAAW,OAAO;EAAS;EAAU;EAAS,eAAe;CAAW,IACvF;EAAC;EAAW;EAAS;EAAU;EAAS;CAAU,CACpD;CAEA,OACEA,qBAAC,OAAD;EACE,MAAK;EACL,mBAAiB,SAAS,OAAO,UAAU,KAAA;EAC3C,oBAAkB;EAClB,iBAAe,YAAY,KAAA;EAC3B,gBAAc,WAAW,KAAA;EACzB,iBAAe,YAAY,KAAA;EAC3B,WAAW,GAAG,kBAAkB,mBAAmB,eAAe,SAAS;EAC3E,GAAI;EARN,UAAA,CAUG,SAAS,QACRC,oBAAC,QAAD;GAAM,IAAI;GAAS,WAAU;GAC1B,UAAA;EACG,CAAA,GAERA,oBAAC,OAAD;GAAK,WAAU;GACb,UAAAA,oBAAC,kBAAkB,UAAnB;IAA4B,OAAO;IAAM;GAAqC,CAAA;EAC3E,CAAA,CACF;;AAET"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
.ds-radio {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: var(--space-2);
|
|
5
|
+
font-family: var(--font-sans);
|
|
6
|
+
font-size: var(--font-size-sm);
|
|
7
|
+
color: var(--color-text);
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.ds-radio__control {
|
|
12
|
+
position: relative;
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
flex-shrink: 0;
|
|
15
|
+
width: var(--icon-size-sm);
|
|
16
|
+
height: var(--icon-size-sm);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.ds-radio__input {
|
|
20
|
+
position: absolute;
|
|
21
|
+
inset: 0;
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
margin: 0;
|
|
25
|
+
opacity: 0;
|
|
26
|
+
cursor: inherit;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.ds-radio__circle {
|
|
30
|
+
display: inline-flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
width: 100%;
|
|
34
|
+
height: 100%;
|
|
35
|
+
border: var(--border-width-1) solid var(--color-border-strong);
|
|
36
|
+
border-radius: var(--radius-full);
|
|
37
|
+
background: var(--color-surface);
|
|
38
|
+
pointer-events: none;
|
|
39
|
+
transition:
|
|
40
|
+
background-color var(--duration-fast) var(--easing-standard),
|
|
41
|
+
border-color var(--duration-fast) var(--easing-standard);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.ds-radio__circle::after {
|
|
45
|
+
content: "";
|
|
46
|
+
width: 50%;
|
|
47
|
+
height: 50%;
|
|
48
|
+
border-radius: var(--radius-full);
|
|
49
|
+
background: var(--color-text-on-primary);
|
|
50
|
+
transform: scale(0);
|
|
51
|
+
transition: transform var(--duration-fast) var(--easing-out);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.ds-radio:hover .ds-radio__input:not(:disabled) + .ds-radio__circle {
|
|
55
|
+
border-color: var(--color-primary);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.ds-radio__input:checked + .ds-radio__circle {
|
|
59
|
+
border-color: var(--color-primary);
|
|
60
|
+
background: var(--color-primary);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.ds-radio__input:checked + .ds-radio__circle::after {
|
|
64
|
+
transform: scale(1);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.ds-radio__input:focus-visible + .ds-radio__circle {
|
|
68
|
+
outline: var(--border-width-2) solid var(--color-focus-ring);
|
|
69
|
+
outline-offset: 2px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.ds-radio--invalid .ds-radio__circle,
|
|
73
|
+
.ds-radio--invalid:hover .ds-radio__input:not(:disabled) + .ds-radio__circle {
|
|
74
|
+
border-color: var(--color-danger);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.ds-radio--disabled {
|
|
78
|
+
color: var(--color-text-disabled);
|
|
79
|
+
cursor: not-allowed;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.ds-radio--disabled .ds-radio__circle {
|
|
83
|
+
opacity: 0.5;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* Group */
|
|
87
|
+
.ds-radio-group {
|
|
88
|
+
display: flex;
|
|
89
|
+
flex-direction: column;
|
|
90
|
+
gap: var(--space-2);
|
|
91
|
+
font-family: var(--font-sans);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.ds-radio-group__label {
|
|
95
|
+
font-size: var(--font-size-sm);
|
|
96
|
+
font-weight: var(--font-weight-medium);
|
|
97
|
+
color: var(--color-text);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.ds-radio-group__options {
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-direction: column;
|
|
103
|
+
gap: var(--space-2);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.ds-radio-group--horizontal .ds-radio-group__options {
|
|
107
|
+
flex-direction: row;
|
|
108
|
+
flex-wrap: wrap;
|
|
109
|
+
gap: var(--space-4);
|
|
110
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
export type SkeletonVariant = "text" | "rect" | "circle";
|
|
3
|
+
export interface SkeletonProps extends HTMLAttributes<HTMLSpanElement> {
|
|
4
|
+
/** Shape of the placeholder */
|
|
5
|
+
variant?: SkeletonVariant;
|
|
6
|
+
/** Width (number in px or any CSS length) */
|
|
7
|
+
width?: number | string;
|
|
8
|
+
/** Height (number in px or any CSS length) */
|
|
9
|
+
height?: number | string;
|
|
10
|
+
/** Number of lines, for the `text` variant. The last line is shorter */
|
|
11
|
+
lines?: number;
|
|
12
|
+
}
|
|
13
|
+
/** Loading placeholder. Hidden from assistive technology. */
|
|
14
|
+
declare function Skeleton({ variant, width, height, lines, className, style, ...rest }: SkeletonProps): import("react").JSX.Element;
|
|
15
|
+
export default Skeleton;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { cx } from "../../utils/cx.js";
|
|
2
|
+
import './styles.css';/* empty css */
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/components/atoms/skeleton/index.tsx
|
|
5
|
+
var toLength = (v) => typeof v === "number" ? `${v}px` : v;
|
|
6
|
+
/** Loading placeholder. Hidden from assistive technology. */
|
|
7
|
+
function Skeleton({ variant = "text", width, height, lines = 1, className, style, ...rest }) {
|
|
8
|
+
const size = {
|
|
9
|
+
width: toLength(width),
|
|
10
|
+
height: toLength(height)
|
|
11
|
+
};
|
|
12
|
+
if (variant === "circle" && width !== void 0 && height === void 0) size.height = size.width;
|
|
13
|
+
if (variant === "text" && lines > 1) return /* @__PURE__ */ jsx("span", {
|
|
14
|
+
className: cx("ds-skeleton-group", className),
|
|
15
|
+
"aria-hidden": "true",
|
|
16
|
+
style: {
|
|
17
|
+
width: size.width,
|
|
18
|
+
...style
|
|
19
|
+
},
|
|
20
|
+
...rest,
|
|
21
|
+
children: Array.from({ length: lines }, (_, i) => /* @__PURE__ */ jsx("span", {
|
|
22
|
+
className: cx("ds-skeleton", "ds-skeleton--text", i === lines - 1 && "ds-skeleton--last"),
|
|
23
|
+
style: { height: size.height }
|
|
24
|
+
}, i))
|
|
25
|
+
});
|
|
26
|
+
return /* @__PURE__ */ jsx("span", {
|
|
27
|
+
className: cx("ds-skeleton", `ds-skeleton--${variant}`, className),
|
|
28
|
+
"aria-hidden": "true",
|
|
29
|
+
style: {
|
|
30
|
+
...size,
|
|
31
|
+
...style
|
|
32
|
+
},
|
|
33
|
+
...rest
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export { Skeleton as default };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_jsx"],"sources":["../../../../src/components/atoms/skeleton/index.tsx"],"sourcesContent":["import type { CSSProperties, HTMLAttributes } from \"react\";\nimport { cx } from \"../../utils/cx\";\nimport \"./styles.css\";\n\nexport type SkeletonVariant = \"text\" | \"rect\" | \"circle\";\n\nexport interface SkeletonProps extends HTMLAttributes<HTMLSpanElement> {\n /** Shape of the placeholder */\n variant?: SkeletonVariant;\n /** Width (number in px or any CSS length) */\n width?: number | string;\n /** Height (number in px or any CSS length) */\n height?: number | string;\n /** Number of lines, for the `text` variant. The last line is shorter */\n lines?: number;\n}\n\nconst toLength = (v: number | string | undefined) => (typeof v === \"number\" ? `${v}px` : v);\n\n/** Loading placeholder. Hidden from assistive technology. */\nfunction Skeleton({\n variant = \"text\",\n width,\n height,\n lines = 1,\n className,\n style,\n ...rest\n}: SkeletonProps) {\n const size: CSSProperties = { width: toLength(width), height: toLength(height) };\n if (variant === \"circle\" && width !== undefined && height === undefined) size.height = size.width;\n\n if (variant === \"text\" && lines > 1) {\n return (\n <span\n className={cx(\"ds-skeleton-group\", className)}\n aria-hidden=\"true\"\n style={{ width: size.width, ...style }}\n {...rest}\n >\n {Array.from({ length: lines }, (_, i) => (\n <span\n key={i}\n className={cx(\"ds-skeleton\", \"ds-skeleton--text\", i === lines - 1 && \"ds-skeleton--last\")}\n style={{ height: size.height }}\n />\n ))}\n </span>\n );\n }\n\n return (\n <span\n className={cx(\"ds-skeleton\", `ds-skeleton--${variant}`, className)}\n aria-hidden=\"true\"\n style={{ ...size, ...style }}\n {...rest}\n />\n );\n}\n\nexport default Skeleton;\n"],"mappings":";;;;AAiBA,IAAM,YAAY,MAAoC,OAAO,MAAM,WAAW,GAAG,EAAE,MAAM;;AAGzF,SAAS,SAAS,EAChB,UAAU,QACV,OACA,QACA,QAAQ,GACR,WACA,OACA,GAAG,QACa;CAChB,MAAM,OAAsB;EAAE,OAAO,SAAS,KAAK;EAAG,QAAQ,SAAS,MAAM;CAAE;CAC/E,IAAI,YAAY,YAAY,UAAU,KAAA,KAAa,WAAW,KAAA,GAAW,KAAK,SAAS,KAAK;CAE5F,IAAI,YAAY,UAAU,QAAQ,GAChC,OACEA,oBAAC,QAAD;EACE,WAAW,GAAG,qBAAqB,SAAS;EAC5C,eAAY;EACZ,OAAO;GAAE,OAAO,KAAK;GAAO,GAAG;EAAM;EACrC,GAAI;EAEH,UAAA,MAAM,KAAK,EAAE,QAAQ,MAAM,IAAI,GAAG,MACjCA,oBAAC,QAAD;GAEE,WAAW,GAAG,eAAe,qBAAqB,MAAM,QAAQ,KAAK,mBAAmB;GACxF,OAAO,EAAE,QAAQ,KAAK,OAAO;EAC9B,GAHM,CAGN,CACF;CACG,CAAA;CAIV,OACEA,oBAAC,QAAD;EACE,WAAW,GAAG,eAAe,gBAAgB,WAAW,SAAS;EACjE,eAAY;EACZ,OAAO;GAAE,GAAG;GAAM,GAAG;EAAM;EAC3B,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
.ds-skeleton {
|
|
2
|
+
display: block;
|
|
3
|
+
width: 100%;
|
|
4
|
+
background-color: var(--color-neutral);
|
|
5
|
+
background-image: linear-gradient(
|
|
6
|
+
90deg,
|
|
7
|
+
transparent 0%,
|
|
8
|
+
var(--color-neutral-hover) 50%,
|
|
9
|
+
transparent 100%
|
|
10
|
+
);
|
|
11
|
+
background-repeat: no-repeat;
|
|
12
|
+
background-size: 200% 100%;
|
|
13
|
+
animation: ds-skeleton-shimmer calc(var(--duration-slower) * 4) var(--easing-standard) infinite;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.ds-skeleton--text {
|
|
17
|
+
height: 1em;
|
|
18
|
+
border-radius: var(--radius-sm);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.ds-skeleton--rect {
|
|
22
|
+
height: var(--space-16);
|
|
23
|
+
border-radius: var(--radius-md);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ds-skeleton--circle {
|
|
27
|
+
width: var(--control-height-md);
|
|
28
|
+
height: var(--control-height-md);
|
|
29
|
+
border-radius: var(--radius-full);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ds-skeleton-group {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
gap: var(--space-2);
|
|
36
|
+
width: 100%;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.ds-skeleton--last {
|
|
40
|
+
width: 60%;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@keyframes ds-skeleton-shimmer {
|
|
44
|
+
from {
|
|
45
|
+
background-position: 150% 0;
|
|
46
|
+
}
|
|
47
|
+
to {
|
|
48
|
+
background-position: -50% 0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@media (prefers-reduced-motion: reduce) {
|
|
53
|
+
.ds-skeleton {
|
|
54
|
+
animation: none;
|
|
55
|
+
background-image: none;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
export type SpinnerSize = "sm" | "md" | "lg";
|
|
3
|
+
export interface SpinnerProps extends HTMLAttributes<HTMLSpanElement> {
|
|
4
|
+
/** Accessible text announced to screen readers (visually hidden) */
|
|
5
|
+
label?: string;
|
|
6
|
+
/** Diameter, from the icon-size tokens */
|
|
7
|
+
size?: SpinnerSize;
|
|
8
|
+
}
|
|
9
|
+
/** Loading indicator. Inherits `currentColor`. */
|
|
10
|
+
declare function Spinner({ label, size, className, ...rest }: SpinnerProps): import("react").JSX.Element;
|
|
11
|
+
export default Spinner;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { cx } from "../../utils/cx.js";
|
|
2
|
+
import './styles.css';/* empty css */
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
// src/components/atoms/spinner/index.tsx
|
|
5
|
+
/** Loading indicator. Inherits `currentColor`. */
|
|
6
|
+
function Spinner({ label = "Loading", size = "md", className, ...rest }) {
|
|
7
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
8
|
+
role: "status",
|
|
9
|
+
className: cx("ds-spinner", `ds-spinner--${size}`, className),
|
|
10
|
+
...rest,
|
|
11
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
12
|
+
className: "ds-spinner__circle",
|
|
13
|
+
"aria-hidden": "true"
|
|
14
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
15
|
+
className: "ds-spinner__label",
|
|
16
|
+
children: label
|
|
17
|
+
})]
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export { Spinner as default };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_jsxs","_jsx"],"sources":["../../../../src/components/atoms/spinner/index.tsx"],"sourcesContent":["import type { HTMLAttributes } from \"react\";\nimport { cx } from \"../../utils/cx\";\nimport \"./styles.css\";\n\nexport type SpinnerSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface SpinnerProps extends HTMLAttributes<HTMLSpanElement> {\n /** Accessible text announced to screen readers (visually hidden) */\n label?: string;\n /** Diameter, from the icon-size tokens */\n size?: SpinnerSize;\n}\n\n/** Loading indicator. Inherits `currentColor`. */\nfunction Spinner({ label = \"Loading\", size = \"md\", className, ...rest }: SpinnerProps) {\n return (\n <span role=\"status\" className={cx(\"ds-spinner\", `ds-spinner--${size}`, className)} {...rest}>\n <span className=\"ds-spinner__circle\" aria-hidden=\"true\" />\n <span className=\"ds-spinner__label\">{label}</span>\n </span>\n );\n}\n\nexport default Spinner;\n"],"mappings":";;;;;AAcA,SAAS,QAAQ,EAAE,QAAQ,WAAW,OAAO,MAAM,WAAW,GAAG,QAAsB;CACrF,OACEA,qBAAC,QAAD;EAAM,MAAK;EAAS,WAAW,GAAG,cAAc,eAAe,QAAQ,SAAS;EAAG,GAAI;EAAvF,UAAA,CACEC,oBAAC,QAAD;GAAM,WAAU;GAAqB,eAAY;EAAQ,CAAA,GACzDA,oBAAC,QAAD;GAAM,WAAU;GAAqB,UAAA;EAAY,CAAA,CAC7C;;AAEV"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
.ds-spinner {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
color: inherit;
|
|
6
|
+
vertical-align: middle;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.ds-spinner__circle {
|
|
10
|
+
display: block;
|
|
11
|
+
width: var(--icon-size-md);
|
|
12
|
+
height: var(--icon-size-md);
|
|
13
|
+
border: var(--border-width-2) solid currentColor;
|
|
14
|
+
border-right-color: transparent;
|
|
15
|
+
border-radius: var(--radius-full);
|
|
16
|
+
animation: ds-spinner-rotate 0.75s linear infinite;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.ds-spinner--sm .ds-spinner__circle {
|
|
20
|
+
width: var(--icon-size-sm);
|
|
21
|
+
height: var(--icon-size-sm);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.ds-spinner--lg .ds-spinner__circle {
|
|
25
|
+
width: var(--icon-size-lg);
|
|
26
|
+
height: var(--icon-size-lg);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.ds-spinner__label {
|
|
30
|
+
position: absolute;
|
|
31
|
+
width: 1px;
|
|
32
|
+
height: 1px;
|
|
33
|
+
padding: 0;
|
|
34
|
+
margin: -1px;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
clip: rect(0, 0, 0, 0);
|
|
37
|
+
white-space: nowrap;
|
|
38
|
+
border: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@keyframes ds-spinner-rotate {
|
|
42
|
+
to {
|
|
43
|
+
transform: rotate(360deg);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@media (prefers-reduced-motion: reduce) {
|
|
48
|
+
.ds-spinner__circle {
|
|
49
|
+
animation-duration: 2s;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { InputHTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export type SwitchSize = "sm" | "md";
|
|
3
|
+
export interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size" | "role"> {
|
|
4
|
+
/** Text or content shown next to the toggle; clicking it toggles the switch */
|
|
5
|
+
label?: ReactNode;
|
|
6
|
+
/** Track and thumb size */
|
|
7
|
+
size?: SwitchSize;
|
|
8
|
+
/** Marks the value as invalid (sets `aria-invalid` and a danger outline) */
|
|
9
|
+
invalid?: boolean;
|
|
10
|
+
/** Class name applied to the root element (the native input receives the rest of the props) */
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const Switch: import("react").ForwardRefExoticComponent<SwitchProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
14
|
+
export default Switch;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import { cx } from "../../utils/cx.js";
|
|
3
|
+
import './styles.css';/* empty css */
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
// src/components/atoms/switch/index.tsx
|
|
6
|
+
var Switch = forwardRef(function Switch({ label, size = "md", invalid = false, className, style, disabled, ...rest }, ref) {
|
|
7
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
8
|
+
className: cx("ds-switch", `ds-switch--${size}`, disabled && "ds-switch--disabled", invalid && "ds-switch--invalid", className),
|
|
9
|
+
style,
|
|
10
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
11
|
+
className: "ds-switch__control",
|
|
12
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
13
|
+
ref,
|
|
14
|
+
type: "checkbox",
|
|
15
|
+
role: "switch",
|
|
16
|
+
className: "ds-switch__input",
|
|
17
|
+
disabled,
|
|
18
|
+
"aria-invalid": invalid || void 0,
|
|
19
|
+
...rest
|
|
20
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
21
|
+
className: "ds-switch__track",
|
|
22
|
+
"aria-hidden": "true",
|
|
23
|
+
children: /* @__PURE__ */ jsx("span", { className: "ds-switch__thumb" })
|
|
24
|
+
})]
|
|
25
|
+
}), label != null && /* @__PURE__ */ jsx("span", {
|
|
26
|
+
className: "ds-switch__label",
|
|
27
|
+
children: label
|
|
28
|
+
})]
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
export { Switch as default };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_jsxs","_jsx"],"sources":["../../../../src/components/atoms/switch/index.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { InputHTMLAttributes, ReactNode } from \"react\";\nimport { cx } from \"../../utils/cx\";\nimport \"./styles.css\";\n\nexport type SwitchSize = \"sm\" | \"md\";\n\nexport interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"size\" | \"role\"> {\n /** Text or content shown next to the toggle; clicking it toggles the switch */\n label?: ReactNode;\n /** Track and thumb size */\n size?: SwitchSize;\n /** Marks the value as invalid (sets `aria-invalid` and a danger outline) */\n invalid?: boolean;\n /** Class name applied to the root element (the native input receives the rest of the props) */\n className?: string;\n}\n\nconst Switch = forwardRef<HTMLInputElement, SwitchProps>(function Switch(\n { label, size = \"md\", invalid = false, className, style, disabled, ...rest },\n ref\n) {\n return (\n <label\n className={cx(\"ds-switch\", `ds-switch--${size}`, disabled && \"ds-switch--disabled\", invalid && \"ds-switch--invalid\", className)}\n style={style}\n >\n <span className=\"ds-switch__control\">\n <input ref={ref} type=\"checkbox\" role=\"switch\" className=\"ds-switch__input\" disabled={disabled}\n aria-invalid={invalid || undefined}\n {...rest}\n />\n <span className=\"ds-switch__track\" aria-hidden=\"true\">\n <span className=\"ds-switch__thumb\" />\n </span>\n </span>\n {label != null && <span className=\"ds-switch__label\">{label}</span>}\n </label>\n );\n});\n\nexport default Switch;\n"],"mappings":";;;;;AAkBA,IAAM,SAAS,WAA0C,SAAS,OAChE,EAAE,OAAO,OAAO,MAAM,UAAU,OAAO,WAAW,OAAO,UAAU,GAAG,QACtE,KACA;CACA,OACEA,qBAAC,SAAD;EACE,WAAW,GAAG,aAAa,cAAc,QAAQ,YAAY,uBAAuB,WAAW,sBAAsB,SAAS;EACvH;EAFT,UAAA,CAIEA,qBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA,CACEC,oBAAC,SAAD;IAAY;IAAK,MAAK;IAAW,MAAK;IAAS,WAAU;IAA6B;IACpF,gBAAc,WAAW,KAAA;IACzB,GAAI;GACL,CAAA,GACDA,oBAAC,QAAD;IAAM,WAAU;IAAmB,eAAY;IAC7C,UAAAA,oBAAC,QAAD,EAAM,WAAU,mBAAoB,CAAA;GAChC,CAAA,CACF;EACL,CAAA,GAAA,SAAS,QAAQA,oBAAC,QAAD;GAAM,WAAU;GAAoB,UAAA;EAAY,CAAA,CAC7D;;AAEX,CAAC"}
|