@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,99 @@
|
|
|
1
|
+
.ds-switch {
|
|
2
|
+
--ds-switch-height: var(--space-5);
|
|
3
|
+
--ds-switch-width: var(--space-8);
|
|
4
|
+
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
gap: var(--space-2);
|
|
8
|
+
font-family: var(--font-sans);
|
|
9
|
+
font-size: var(--font-size-sm);
|
|
10
|
+
color: var(--color-text);
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.ds-switch--sm {
|
|
15
|
+
--ds-switch-height: var(--space-4);
|
|
16
|
+
--ds-switch-width: var(--space-6);
|
|
17
|
+
font-size: var(--font-size-xs);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.ds-switch__control {
|
|
21
|
+
position: relative;
|
|
22
|
+
display: inline-flex;
|
|
23
|
+
flex-shrink: 0;
|
|
24
|
+
width: var(--ds-switch-width);
|
|
25
|
+
height: var(--ds-switch-height);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ds-switch__input {
|
|
29
|
+
position: absolute;
|
|
30
|
+
inset: 0;
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 100%;
|
|
33
|
+
margin: 0;
|
|
34
|
+
opacity: 0;
|
|
35
|
+
cursor: inherit;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.ds-switch__track {
|
|
39
|
+
position: relative;
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 100%;
|
|
42
|
+
border-radius: var(--radius-full);
|
|
43
|
+
background: var(--color-border-strong);
|
|
44
|
+
pointer-events: none;
|
|
45
|
+
transition: background-color var(--duration-normal) var(--easing-standard);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.ds-switch__thumb {
|
|
49
|
+
position: absolute;
|
|
50
|
+
top: calc(var(--space-px) * 2);
|
|
51
|
+
left: calc(var(--space-px) * 2);
|
|
52
|
+
width: calc(var(--ds-switch-height) - var(--space-px) * 4);
|
|
53
|
+
height: calc(var(--ds-switch-height) - var(--space-px) * 4);
|
|
54
|
+
border-radius: var(--radius-full);
|
|
55
|
+
background: var(--color-surface);
|
|
56
|
+
box-shadow: var(--shadow-sm);
|
|
57
|
+
transition: transform var(--duration-normal) var(--easing-standard);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.ds-switch:hover .ds-switch__input:not(:disabled):not(:checked) + .ds-switch__track {
|
|
61
|
+
background: var(--color-text-subtle);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.ds-switch__input:checked + .ds-switch__track {
|
|
65
|
+
background: var(--color-primary);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.ds-switch:hover .ds-switch__input:not(:disabled):checked + .ds-switch__track {
|
|
69
|
+
background: var(--color-primary-hover);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.ds-switch__input:checked + .ds-switch__track .ds-switch__thumb {
|
|
73
|
+
transform: translateX(calc(var(--ds-switch-width) - var(--ds-switch-height)));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.ds-switch__input:focus-visible + .ds-switch__track {
|
|
77
|
+
outline: var(--border-width-2) solid var(--color-focus-ring);
|
|
78
|
+
outline-offset: 2px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.ds-switch--disabled {
|
|
82
|
+
color: var(--color-text-disabled);
|
|
83
|
+
cursor: not-allowed;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.ds-switch--disabled .ds-switch__track {
|
|
87
|
+
opacity: 0.5;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@media (prefers-reduced-motion: reduce) {
|
|
91
|
+
.ds-switch__track,
|
|
92
|
+
.ds-switch__thumb {
|
|
93
|
+
transition: none;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.ds-switch--invalid .ds-switch__track {
|
|
98
|
+
box-shadow: 0 0 0 var(--border-width-2) var(--color-danger);
|
|
99
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { InputHTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export type TextInputSize = "sm" | "md" | "lg";
|
|
3
|
+
export interface TextInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
4
|
+
/** Height and padding, from the control-size tokens */
|
|
5
|
+
size?: TextInputSize;
|
|
6
|
+
/** Marks the value as invalid (sets `aria-invalid` and a danger border) */
|
|
7
|
+
invalid?: boolean;
|
|
8
|
+
/** Decorative content rendered before the input (e.g. an icon) */
|
|
9
|
+
startIcon?: ReactNode;
|
|
10
|
+
/** Decorative content rendered after the input (e.g. an icon) */
|
|
11
|
+
endIcon?: ReactNode;
|
|
12
|
+
/** Stretch to the container width */
|
|
13
|
+
fullWidth?: boolean;
|
|
14
|
+
/** Class name applied to the root wrapper element (the native input receives the rest of the props) */
|
|
15
|
+
className?: string;
|
|
16
|
+
/** Class name applied to the native `<input>` */
|
|
17
|
+
inputClassName?: string;
|
|
18
|
+
}
|
|
19
|
+
declare const TextInput: import("react").ForwardRefExoticComponent<TextInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
20
|
+
export default TextInput;
|
|
@@ -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/text-input/index.tsx
|
|
6
|
+
var TextInput = forwardRef(function TextInput({ size = "md", invalid = false, startIcon, endIcon, fullWidth = false, className, inputClassName, type = "text", disabled, ...rest }, ref) {
|
|
7
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
8
|
+
className: cx("ds-text-input", `ds-text-input--${size}`, invalid && "ds-text-input--invalid", disabled && "ds-text-input--disabled", fullWidth && "ds-text-input--full", className),
|
|
9
|
+
children: [
|
|
10
|
+
startIcon != null && /* @__PURE__ */ jsx("span", {
|
|
11
|
+
className: "ds-text-input__icon ds-text-input__icon--start",
|
|
12
|
+
"aria-hidden": "true",
|
|
13
|
+
children: startIcon
|
|
14
|
+
}),
|
|
15
|
+
/* @__PURE__ */ jsx("input", {
|
|
16
|
+
ref,
|
|
17
|
+
type,
|
|
18
|
+
disabled,
|
|
19
|
+
"aria-invalid": invalid || void 0,
|
|
20
|
+
className: cx("ds-text-input__field", inputClassName),
|
|
21
|
+
...rest
|
|
22
|
+
}),
|
|
23
|
+
endIcon != null && /* @__PURE__ */ jsx("span", {
|
|
24
|
+
className: "ds-text-input__icon ds-text-input__icon--end",
|
|
25
|
+
"aria-hidden": "true",
|
|
26
|
+
children: endIcon
|
|
27
|
+
})
|
|
28
|
+
]
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
export { TextInput as default };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_jsxs","_jsx"],"sources":["../../../../src/components/atoms/text-input/index.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { InputHTMLAttributes, ReactNode } from \"react\";\nimport { cx } from \"../../utils/cx\";\nimport \"./styles.css\";\n\nexport type TextInputSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface TextInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"size\"> {\n /** Height and padding, from the control-size tokens */\n size?: TextInputSize;\n /** Marks the value as invalid (sets `aria-invalid` and a danger border) */\n invalid?: boolean;\n /** Decorative content rendered before the input (e.g. an icon) */\n startIcon?: ReactNode;\n /** Decorative content rendered after the input (e.g. an icon) */\n endIcon?: ReactNode;\n /** Stretch to the container width */\n fullWidth?: boolean;\n /** Class name applied to the root wrapper element (the native input receives the rest of the props) */\n className?: string;\n /** Class name applied to the native `<input>` */\n inputClassName?: string;\n}\n\nconst TextInput = forwardRef<HTMLInputElement, TextInputProps>(function TextInput(\n {\n size = \"md\",\n invalid = false,\n startIcon,\n endIcon,\n fullWidth = false,\n className,\n inputClassName,\n type = \"text\",\n disabled,\n ...rest\n },\n ref\n) {\n return (\n <span\n className={cx(\n \"ds-text-input\",\n `ds-text-input--${size}`,\n invalid && \"ds-text-input--invalid\",\n disabled && \"ds-text-input--disabled\",\n fullWidth && \"ds-text-input--full\",\n className\n )}\n >\n {startIcon != null && (\n <span className=\"ds-text-input__icon ds-text-input__icon--start\" aria-hidden=\"true\">\n {startIcon}\n </span>\n )}\n <input\n ref={ref}\n type={type}\n disabled={disabled}\n aria-invalid={invalid || undefined}\n className={cx(\"ds-text-input__field\", inputClassName)}\n {...rest}\n />\n {endIcon != null && (\n <span className=\"ds-text-input__icon ds-text-input__icon--end\" aria-hidden=\"true\">\n {endIcon}\n </span>\n )}\n </span>\n );\n});\n\nexport default TextInput;\n"],"mappings":";;;;;AAwBA,IAAM,YAAY,WAA6C,SAAS,UACtE,EACE,OAAO,MACP,UAAU,OACV,WACA,SACA,YAAY,OACZ,WACA,gBACA,OAAO,QACP,UACA,GAAG,QAEL,KACA;CACA,OACEA,qBAAC,QAAD;EACE,WAAW,GACT,iBACA,kBAAkB,QAClB,WAAW,0BACX,YAAY,2BACZ,aAAa,uBACb,SACF;EARF,UAAA;GAUG,aAAa,QACZC,oBAAC,QAAD;IAAM,WAAU;IAAiD,eAAY;IAC1E,UAAA;GACG,CAAA;GAERA,oBAAC,SAAD;IACO;IACC;IACI;IACV,gBAAc,WAAW,KAAA;IACzB,WAAW,GAAG,wBAAwB,cAAc;IACpD,GAAI;GACL,CAAA;GACA,WAAW,QACVA,oBAAC,QAAD;IAAM,WAAU;IAA+C,eAAY;IACxE,UAAA;GACG,CAAA;EAEJ;;AAEV,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
.ds-text-input {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: var(--space-2);
|
|
5
|
+
height: var(--control-height-md);
|
|
6
|
+
padding: 0 var(--control-padding-x-md);
|
|
7
|
+
border: var(--border-width-1) solid var(--color-border-strong);
|
|
8
|
+
border-radius: var(--radius-md);
|
|
9
|
+
background: var(--color-surface);
|
|
10
|
+
color: var(--color-text);
|
|
11
|
+
font-family: var(--font-sans);
|
|
12
|
+
font-size: var(--font-size-sm);
|
|
13
|
+
transition:
|
|
14
|
+
border-color var(--duration-fast) var(--easing-standard),
|
|
15
|
+
box-shadow var(--duration-fast) var(--easing-standard);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ds-text-input:hover:not(.ds-text-input--disabled) {
|
|
19
|
+
border-color: var(--color-text-subtle);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.ds-text-input:focus-within {
|
|
23
|
+
outline: var(--border-width-2) solid var(--color-focus-ring);
|
|
24
|
+
outline-offset: 2px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.ds-text-input__field {
|
|
28
|
+
flex: 1;
|
|
29
|
+
min-width: 0;
|
|
30
|
+
height: 100%;
|
|
31
|
+
padding: 0;
|
|
32
|
+
border: 0;
|
|
33
|
+
background: transparent;
|
|
34
|
+
color: inherit;
|
|
35
|
+
font: inherit;
|
|
36
|
+
outline: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.ds-text-input__field::placeholder {
|
|
40
|
+
color: var(--color-text-subtle);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.ds-text-input__icon {
|
|
44
|
+
display: inline-flex;
|
|
45
|
+
flex-shrink: 0;
|
|
46
|
+
align-items: center;
|
|
47
|
+
color: var(--color-text-muted);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.ds-text-input--sm {
|
|
51
|
+
height: var(--control-height-sm);
|
|
52
|
+
padding: 0 var(--control-padding-x-sm);
|
|
53
|
+
font-size: var(--font-size-xs);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.ds-text-input--lg {
|
|
57
|
+
height: var(--control-height-lg);
|
|
58
|
+
padding: 0 var(--control-padding-x-lg);
|
|
59
|
+
font-size: var(--font-size-md);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.ds-text-input--full {
|
|
63
|
+
display: flex;
|
|
64
|
+
width: 100%;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.ds-text-input--invalid,
|
|
68
|
+
.ds-text-input--invalid:hover:not(.ds-text-input--disabled) {
|
|
69
|
+
border-color: var(--color-danger);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.ds-text-input--disabled {
|
|
73
|
+
background: var(--color-bg-subtle);
|
|
74
|
+
color: var(--color-text-disabled);
|
|
75
|
+
cursor: not-allowed;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.ds-text-input--disabled .ds-text-input__field {
|
|
79
|
+
cursor: not-allowed;
|
|
80
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TextareaHTMLAttributes } from "react";
|
|
2
|
+
export type TextareaResize = "none" | "vertical" | "both";
|
|
3
|
+
export interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
4
|
+
/** Marks the value as invalid (sets `aria-invalid` and a danger border) */
|
|
5
|
+
invalid?: boolean;
|
|
6
|
+
/** Which directions the user can resize the field in. Ignored (forced to `none`) when `autoResize` is on */
|
|
7
|
+
resize?: TextareaResize;
|
|
8
|
+
/** Grow the height automatically to fit the content */
|
|
9
|
+
autoResize?: boolean;
|
|
10
|
+
/** Stretch to the container width */
|
|
11
|
+
fullWidth?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const Textarea: import("react").ForwardRefExoticComponent<TextareaProps & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
14
|
+
export default Textarea;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { forwardRef, useCallback, useLayoutEffect, useRef } from "react";
|
|
2
|
+
import { cx } from "../../utils/cx.js";
|
|
3
|
+
import './styles.css';/* empty css */
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
// src/components/atoms/textarea/index.tsx
|
|
6
|
+
var Textarea = forwardRef(function Textarea({ invalid = false, resize = "vertical", autoResize = false, fullWidth = false, rows = 3, className, onChange, value, ...rest }, forwardedRef) {
|
|
7
|
+
const innerRef = useRef(null);
|
|
8
|
+
const setRef = useCallback((node) => {
|
|
9
|
+
innerRef.current = node;
|
|
10
|
+
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
11
|
+
else if (forwardedRef) forwardedRef.current = node;
|
|
12
|
+
}, [forwardedRef]);
|
|
13
|
+
const fit = useCallback(() => {
|
|
14
|
+
const el = innerRef.current;
|
|
15
|
+
if (!el || !autoResize) return;
|
|
16
|
+
el.style.height = "auto";
|
|
17
|
+
el.style.height = `${el.scrollHeight}px`;
|
|
18
|
+
}, [autoResize]);
|
|
19
|
+
useLayoutEffect(() => {
|
|
20
|
+
if (autoResize) fit();
|
|
21
|
+
else if (innerRef.current) innerRef.current.style.height = "";
|
|
22
|
+
}, [
|
|
23
|
+
autoResize,
|
|
24
|
+
fit,
|
|
25
|
+
value
|
|
26
|
+
]);
|
|
27
|
+
const handleChange = (event) => {
|
|
28
|
+
fit();
|
|
29
|
+
onChange?.(event);
|
|
30
|
+
};
|
|
31
|
+
return /* @__PURE__ */ jsx("textarea", {
|
|
32
|
+
ref: setRef,
|
|
33
|
+
rows,
|
|
34
|
+
value,
|
|
35
|
+
"aria-invalid": invalid || void 0,
|
|
36
|
+
onChange: handleChange,
|
|
37
|
+
className: cx("ds-textarea", `ds-textarea--resize-${autoResize ? "none" : resize}`, autoResize && "ds-textarea--auto", invalid && "ds-textarea--invalid", fullWidth && "ds-textarea--full", className),
|
|
38
|
+
...rest
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
export { Textarea as default };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_jsx"],"sources":["../../../../src/components/atoms/textarea/index.tsx"],"sourcesContent":["import { forwardRef, useCallback, useLayoutEffect, useRef } from \"react\";\nimport type { ChangeEvent, TextareaHTMLAttributes } from \"react\";\nimport { cx } from \"../../utils/cx\";\nimport \"./styles.css\";\n\nexport type TextareaResize = \"none\" | \"vertical\" | \"both\";\n\nexport interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {\n /** Marks the value as invalid (sets `aria-invalid` and a danger border) */\n invalid?: boolean;\n /** Which directions the user can resize the field in. Ignored (forced to `none`) when `autoResize` is on */\n resize?: TextareaResize;\n /** Grow the height automatically to fit the content */\n autoResize?: boolean;\n /** Stretch to the container width */\n fullWidth?: boolean;\n}\n\nconst Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(function Textarea(\n { invalid = false, resize = \"vertical\", autoResize = false, fullWidth = false, rows = 3, className, onChange, value, ...rest },\n forwardedRef\n) {\n const innerRef = useRef<HTMLTextAreaElement | null>(null);\n\n const setRef = useCallback(\n (node: HTMLTextAreaElement | null) => {\n innerRef.current = node;\n if (typeof forwardedRef === \"function\") forwardedRef(node);\n else if (forwardedRef) forwardedRef.current = node;\n },\n [forwardedRef]\n );\n\n const fit = useCallback(() => {\n const el = innerRef.current;\n if (!el || !autoResize) return;\n el.style.height = \"auto\";\n el.style.height = `${el.scrollHeight}px`;\n }, [autoResize]);\n\n // Re-fit when the controlled value changes or autoResize is toggled.\n useLayoutEffect(() => {\n if (autoResize) fit();\n else if (innerRef.current) innerRef.current.style.height = \"\";\n }, [autoResize, fit, value]);\n\n const handleChange = (event: ChangeEvent<HTMLTextAreaElement>) => {\n fit();\n onChange?.(event);\n };\n\n return (\n <textarea\n ref={setRef}\n rows={rows}\n value={value}\n aria-invalid={invalid || undefined}\n onChange={handleChange}\n className={cx(\n \"ds-textarea\",\n `ds-textarea--resize-${autoResize ? \"none\" : resize}`,\n autoResize && \"ds-textarea--auto\",\n invalid && \"ds-textarea--invalid\",\n fullWidth && \"ds-textarea--full\",\n className\n )}\n {...rest}\n />\n );\n});\n\nexport default Textarea;\n"],"mappings":";;;;;AAkBA,IAAM,WAAW,WAA+C,SAAS,SACvE,EAAE,UAAU,OAAO,SAAS,YAAY,aAAa,OAAO,YAAY,OAAO,OAAO,GAAG,WAAW,UAAU,OAAO,GAAG,QACxH,cACA;CACA,MAAM,WAAW,OAAmC,IAAI;CAExD,MAAM,SAAS,aACZ,SAAqC;EACpC,SAAS,UAAU;EACnB,IAAI,OAAO,iBAAiB,YAAY,aAAa,IAAI;OACpD,IAAI,cAAc,aAAa,UAAU;CAChD,GACA,CAAC,YAAY,CACf;CAEA,MAAM,MAAM,kBAAkB;EAC5B,MAAM,KAAK,SAAS;EACpB,IAAI,CAAC,MAAM,CAAC,YAAY;EACxB,GAAG,MAAM,SAAS;EAClB,GAAG,MAAM,SAAS,GAAG,GAAG,aAAa;CACvC,GAAG,CAAC,UAAU,CAAC;CAGf,sBAAsB;EACpB,IAAI,YAAY,IAAI;OACf,IAAI,SAAS,SAAS,SAAS,QAAQ,MAAM,SAAS;CAC7D,GAAG;EAAC;EAAY;EAAK;CAAK,CAAC;CAE3B,MAAM,gBAAgB,UAA4C;EAChE,IAAI;EACJ,WAAW,KAAK;CAClB;CAEA,OACEA,oBAAC,YAAD;EACE,KAAK;EACC;EACC;EACP,gBAAc,WAAW,KAAA;EACzB,UAAU;EACV,WAAW,GACT,eACA,uBAAuB,aAAa,SAAS,UAC7C,cAAc,qBACd,WAAW,wBACX,aAAa,qBACb,SACF;EACA,GAAI;CACL,CAAA;AAEL,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
.ds-textarea {
|
|
2
|
+
display: block;
|
|
3
|
+
min-height: var(--control-height-md);
|
|
4
|
+
padding: var(--space-2) var(--control-padding-x-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
|
+
line-height: var(--line-height-normal);
|
|
12
|
+
transition: border-color var(--duration-fast) var(--easing-standard);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.ds-textarea::placeholder {
|
|
16
|
+
color: var(--color-text-subtle);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.ds-textarea:hover:not(:disabled) {
|
|
20
|
+
border-color: var(--color-text-subtle);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ds-textarea:focus-visible {
|
|
24
|
+
outline: var(--border-width-2) solid var(--color-focus-ring);
|
|
25
|
+
outline-offset: 2px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ds-textarea:disabled {
|
|
29
|
+
background: var(--color-bg-subtle);
|
|
30
|
+
color: var(--color-text-disabled);
|
|
31
|
+
cursor: not-allowed;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.ds-textarea--resize-none { resize: none; }
|
|
35
|
+
.ds-textarea--resize-vertical { resize: vertical; }
|
|
36
|
+
.ds-textarea--resize-both { resize: both; }
|
|
37
|
+
|
|
38
|
+
.ds-textarea--auto {
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.ds-textarea--full {
|
|
43
|
+
width: 100%;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ds-textarea--invalid,
|
|
47
|
+
.ds-textarea--invalid:hover:not(:disabled) {
|
|
48
|
+
border-color: var(--color-danger);
|
|
49
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
3
|
+
export type HeadingSize = "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl";
|
|
4
|
+
export type TextElement = "p" | "span" | "div" | "small" | "strong" | "em" | "label";
|
|
5
|
+
export type TextSize = "xs" | "sm" | "md" | "lg";
|
|
6
|
+
export type TextTone = "default" | "muted" | "subtle" | "primary" | "success" | "warning" | "danger";
|
|
7
|
+
export type TextWeight = "regular" | "medium" | "semibold" | "bold";
|
|
8
|
+
export interface HeadingProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
9
|
+
/** Semantic level, renders `h1`..`h6` */
|
|
10
|
+
level?: HeadingLevel;
|
|
11
|
+
/** Visual size override (font-size token). Defaults to a size matching the level */
|
|
12
|
+
size?: HeadingSize;
|
|
13
|
+
}
|
|
14
|
+
export declare function Heading({ level, size, className, children, ...rest }: HeadingProps): import("react").JSX.Element;
|
|
15
|
+
export interface TextProps extends HTMLAttributes<HTMLElement> {
|
|
16
|
+
/** Element to render */
|
|
17
|
+
as?: TextElement;
|
|
18
|
+
/** Font size */
|
|
19
|
+
size?: TextSize;
|
|
20
|
+
/** Text color */
|
|
21
|
+
tone?: TextTone;
|
|
22
|
+
/** Font weight */
|
|
23
|
+
weight?: TextWeight;
|
|
24
|
+
/** Cut the text to one line with an ellipsis */
|
|
25
|
+
truncate?: boolean;
|
|
26
|
+
/** `for` attribute, when rendered as `label` */
|
|
27
|
+
htmlFor?: string;
|
|
28
|
+
}
|
|
29
|
+
declare function Text({ as: Tag, size, tone, weight, truncate, className, children, ...rest }: TextProps): import("react").JSX.Element;
|
|
30
|
+
export default Text;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { cx } from "../../utils/cx.js";
|
|
2
|
+
import './styles.css';/* empty css */
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/components/atoms/typography/index.tsx
|
|
5
|
+
var defaultHeadingSize = {
|
|
6
|
+
1: "4xl",
|
|
7
|
+
2: "3xl",
|
|
8
|
+
3: "2xl",
|
|
9
|
+
4: "xl",
|
|
10
|
+
5: "lg",
|
|
11
|
+
6: "md"
|
|
12
|
+
};
|
|
13
|
+
function Heading({ level = 2, size, className, children, ...rest }) {
|
|
14
|
+
const Tag = `h${level}`;
|
|
15
|
+
return /* @__PURE__ */ jsx(Tag, {
|
|
16
|
+
className: cx("ds-heading", `ds-heading--${size ?? defaultHeadingSize[level]}`, className),
|
|
17
|
+
...rest,
|
|
18
|
+
children
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function Text({ as: Tag = "p", size = "md", tone = "default", weight = "regular", truncate = false, className, children, ...rest }) {
|
|
22
|
+
return /* @__PURE__ */ jsx(Tag, {
|
|
23
|
+
className: cx("ds-text", `ds-text--${size}`, `ds-text--tone-${tone}`, `ds-text--weight-${weight}`, truncate && "ds-text--truncate", className),
|
|
24
|
+
...rest,
|
|
25
|
+
children
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export { Heading, Text as default };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_jsx"],"sources":["../../../../src/components/atoms/typography/index.tsx"],"sourcesContent":["import type { HTMLAttributes } from \"react\";\nimport { cx } from \"../../utils/cx\";\nimport \"./styles.css\";\n\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\nexport type HeadingSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\" | \"4xl\";\nexport type TextElement = \"p\" | \"span\" | \"div\" | \"small\" | \"strong\" | \"em\" | \"label\";\nexport type TextSize = \"xs\" | \"sm\" | \"md\" | \"lg\";\nexport type TextTone = \"default\" | \"muted\" | \"subtle\" | \"primary\" | \"success\" | \"warning\" | \"danger\";\nexport type TextWeight = \"regular\" | \"medium\" | \"semibold\" | \"bold\";\n\nexport interface HeadingProps extends HTMLAttributes<HTMLHeadingElement> {\n /** Semantic level, renders `h1`..`h6` */\n level?: HeadingLevel;\n /** Visual size override (font-size token). Defaults to a size matching the level */\n size?: HeadingSize;\n}\n\nconst defaultHeadingSize: Record<HeadingLevel, HeadingSize> = {\n 1: \"4xl\",\n 2: \"3xl\",\n 3: \"2xl\",\n 4: \"xl\",\n 5: \"lg\",\n 6: \"md\",\n};\n\nexport function Heading({ level = 2, size, className, children, ...rest }: HeadingProps) {\n const Tag = `h${level}` as const;\n return (\n <Tag\n className={cx(\"ds-heading\", `ds-heading--${size ?? defaultHeadingSize[level]}`, className)}\n {...rest}\n >\n {children}\n </Tag>\n );\n}\n\nexport interface TextProps extends HTMLAttributes<HTMLElement> {\n /** Element to render */\n as?: TextElement;\n /** Font size */\n size?: TextSize;\n /** Text color */\n tone?: TextTone;\n /** Font weight */\n weight?: TextWeight;\n /** Cut the text to one line with an ellipsis */\n truncate?: boolean;\n /** `for` attribute, when rendered as `label` */\n htmlFor?: string;\n}\n\nfunction Text({\n as: Tag = \"p\",\n size = \"md\",\n tone = \"default\",\n weight = \"regular\",\n truncate = false,\n className,\n children,\n ...rest\n}: TextProps) {\n return (\n <Tag\n className={cx(\n \"ds-text\",\n `ds-text--${size}`,\n `ds-text--tone-${tone}`,\n `ds-text--weight-${weight}`,\n truncate && \"ds-text--truncate\",\n className,\n )}\n {...rest}\n >\n {children}\n </Tag>\n );\n}\n\nexport default Text;\n"],"mappings":";;;;AAkBA,IAAM,qBAAwD;CAC5D,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;AACL;AAEA,SAAgB,QAAQ,EAAE,QAAQ,GAAG,MAAM,WAAW,UAAU,GAAG,QAAsB;CACvF,MAAM,MAAM,IAAI;CAChB,OACEA,oBAAC,KAAD;EACE,WAAW,GAAG,cAAc,eAAe,QAAQ,mBAAmB,UAAU,SAAS;EACzF,GAAI;EAEH;CACE,CAAA;AAET;AAiBA,SAAS,KAAK,EACZ,IAAI,MAAM,KACV,OAAO,MACP,OAAO,WACP,SAAS,WACT,WAAW,OACX,WACA,UACA,GAAG,QACS;CACZ,OACEA,oBAAC,KAAD;EACE,WAAW,GACT,WACA,YAAY,QACZ,iBAAiB,QACjB,mBAAmB,UACnB,YAAY,qBACZ,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* Heading */
|
|
2
|
+
.ds-heading {
|
|
3
|
+
margin: 0;
|
|
4
|
+
color: var(--color-text);
|
|
5
|
+
font-family: var(--font-sans);
|
|
6
|
+
font-weight: var(--font-weight-bold);
|
|
7
|
+
line-height: var(--line-height-tight);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.ds-heading--xs { font-size: var(--font-size-xs); }
|
|
11
|
+
.ds-heading--sm { font-size: var(--font-size-sm); }
|
|
12
|
+
.ds-heading--md { font-size: var(--font-size-md); }
|
|
13
|
+
.ds-heading--lg { font-size: var(--font-size-lg); }
|
|
14
|
+
.ds-heading--xl { font-size: var(--font-size-xl); }
|
|
15
|
+
.ds-heading--2xl { font-size: var(--font-size-2xl); }
|
|
16
|
+
.ds-heading--3xl { font-size: var(--font-size-3xl); }
|
|
17
|
+
.ds-heading--4xl { font-size: var(--font-size-4xl); }
|
|
18
|
+
|
|
19
|
+
/* Text */
|
|
20
|
+
.ds-text {
|
|
21
|
+
margin: 0;
|
|
22
|
+
font-family: var(--font-sans);
|
|
23
|
+
line-height: var(--line-height-normal);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ds-text--xs { font-size: var(--font-size-xs); }
|
|
27
|
+
.ds-text--sm { font-size: var(--font-size-sm); }
|
|
28
|
+
.ds-text--md { font-size: var(--font-size-md); }
|
|
29
|
+
.ds-text--lg { font-size: var(--font-size-lg); }
|
|
30
|
+
|
|
31
|
+
.ds-text--tone-default { color: var(--color-text); }
|
|
32
|
+
.ds-text--tone-muted { color: var(--color-text-muted); }
|
|
33
|
+
.ds-text--tone-subtle { color: var(--color-text-subtle); }
|
|
34
|
+
.ds-text--tone-primary { color: var(--color-primary-text); }
|
|
35
|
+
.ds-text--tone-success { color: var(--color-success-text); }
|
|
36
|
+
.ds-text--tone-warning { color: var(--color-warning-text); }
|
|
37
|
+
.ds-text--tone-danger { color: var(--color-danger-text); }
|
|
38
|
+
|
|
39
|
+
.ds-text--weight-regular { font-weight: var(--font-weight-regular); }
|
|
40
|
+
.ds-text--weight-medium { font-weight: var(--font-weight-medium); }
|
|
41
|
+
.ds-text--weight-semibold { font-weight: var(--font-weight-semibold); }
|
|
42
|
+
.ds-text--weight-bold { font-weight: var(--font-weight-bold); }
|
|
43
|
+
|
|
44
|
+
.ds-text--truncate {
|
|
45
|
+
display: block;
|
|
46
|
+
max-width: 100%;
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
text-overflow: ellipsis;
|
|
49
|
+
white-space: nowrap;
|
|
50
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface VideoPlayerProps {
|
|
2
|
+
/** Embed URL (YouTube `/embed/…`, Vimeo player URL…) */
|
|
3
|
+
src: string;
|
|
4
|
+
/** Accessible title of the iframe */
|
|
5
|
+
title?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
declare function VideoPlayer({ src, title, className }: VideoPlayerProps): import("react").JSX.Element;
|
|
9
|
+
export default VideoPlayer;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import './styles.css';/* empty css */
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/components/atoms/video-player/index.tsx
|
|
4
|
+
function VideoPlayer({ src, title = "Video", className = "" }) {
|
|
5
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6
|
+
className: `ds-video ${className}`,
|
|
7
|
+
children: /* @__PURE__ */ jsx("iframe", {
|
|
8
|
+
src,
|
|
9
|
+
title,
|
|
10
|
+
frameBorder: "0",
|
|
11
|
+
allowFullScreen: true
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export { VideoPlayer as default };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_jsx"],"sources":["../../../../src/components/atoms/video-player/index.tsx"],"sourcesContent":["import \"./styles.css\";\n\nexport interface VideoPlayerProps {\n /** Embed URL (YouTube `/embed/…`, Vimeo player URL…) */\n src: string;\n /** Accessible title of the iframe */\n title?: string;\n className?: string;\n}\n\nfunction VideoPlayer({ src, title = \"Video\", className = \"\" }: VideoPlayerProps) {\n return (\n <div className={`ds-video ${className}`}>\n <iframe src={src} title={title} frameBorder=\"0\" allowFullScreen></iframe>\n </div>\n );\n}\n\nexport default VideoPlayer;\n"],"mappings":";;;AAUA,SAAS,YAAY,EAAE,KAAK,QAAQ,SAAS,YAAY,MAAwB;CAC/E,OACEA,oBAAC,OAAD;EAAK,WAAW,YAAY;EAC1B,UAAAA,oBAAC,UAAD;GAAa;GAAY;GAAO,aAAY;GAAI,iBAAA;EAAwB,CAAA;CACrE,CAAA;AAET"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.ds-video {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100%;
|
|
4
|
+
aspect-ratio: 16 / 9;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
border-radius: var(--radius-lg);
|
|
7
|
+
background: var(--color-surface-sunken);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.ds-video iframe,
|
|
11
|
+
.ds-video object,
|
|
12
|
+
.ds-video embed {
|
|
13
|
+
position: absolute;
|
|
14
|
+
inset: 0;
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 100%;
|
|
17
|
+
border: 0;
|
|
18
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
export interface VisuallyHiddenProps extends HTMLAttributes<HTMLElement> {
|
|
3
|
+
/** Element to render */
|
|
4
|
+
as?: "span" | "div";
|
|
5
|
+
}
|
|
6
|
+
declare function VisuallyHidden({ as: Tag, className, ...rest }: VisuallyHiddenProps): import("react").JSX.Element;
|
|
7
|
+
export default VisuallyHidden;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cx } from "../../utils/cx.js";
|
|
2
|
+
import './styles.css';/* empty css */
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/components/atoms/visually-hidden/index.tsx
|
|
5
|
+
function VisuallyHidden({ as: Tag = "span", className, ...rest }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(Tag, {
|
|
7
|
+
className: cx("ds-visually-hidden", className),
|
|
8
|
+
...rest
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export { VisuallyHidden as default };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_jsx"],"sources":["../../../../src/components/atoms/visually-hidden/index.tsx"],"sourcesContent":["import type { HTMLAttributes } from \"react\";\nimport { cx } from \"../../utils/cx\";\nimport \"./styles.css\";\n\nexport interface VisuallyHiddenProps extends HTMLAttributes<HTMLElement> {\n /** Element to render */\n as?: \"span\" | \"div\";\n}\n\nfunction VisuallyHidden({ as: Tag = \"span\", className, ...rest }: VisuallyHiddenProps) {\n return <Tag className={cx(\"ds-visually-hidden\", className)} {...rest} />;\n}\n\nexport default VisuallyHidden;\n"],"mappings":";;;;AASA,SAAS,eAAe,EAAE,IAAI,MAAM,QAAQ,WAAW,GAAG,QAA6B;CACrF,OAAOA,oBAAC,KAAD;EAAK,WAAW,GAAG,sBAAsB,SAAS;EAAG,GAAI;CAAO,CAAA;AACzE"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { useControllableState } from "./use-controllable-state.js";
|
|
2
|
+
import { useClickOutside } from "./use-click-outside.js";
|
|
3
|
+
import { getFocusable, useFocusTrap } from "./use-focus-trap.js";
|
|
4
|
+
export { getFocusable, useClickOutside, useControllableState, useFocusTrap };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Calls `handler` on a pointer down outside every element in `refs`.
|
|
4
|
+
* Pass `enabled = false` to pause the listener (e.g. while a popover is closed).
|
|
5
|
+
*/
|
|
6
|
+
export declare function useClickOutside(refs: RefObject<HTMLElement | null> | Array<RefObject<HTMLElement | null>>, handler: (event: PointerEvent | MouseEvent | TouchEvent) => void, enabled?: boolean): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
// src/components/hooks/use-click-outside.ts
|
|
3
|
+
/**
|
|
4
|
+
* Calls `handler` on a pointer down outside every element in `refs`.
|
|
5
|
+
* Pass `enabled = false` to pause the listener (e.g. while a popover is closed).
|
|
6
|
+
*/
|
|
7
|
+
function useClickOutside(refs, handler, enabled = true) {
|
|
8
|
+
const handlerRef = useRef(handler);
|
|
9
|
+
handlerRef.current = handler;
|
|
10
|
+
const refsRef = useRef(refs);
|
|
11
|
+
refsRef.current = refs;
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (!enabled) return;
|
|
14
|
+
const listener = (event) => {
|
|
15
|
+
const target = event.target;
|
|
16
|
+
if (!target) return;
|
|
17
|
+
if ((Array.isArray(refsRef.current) ? refsRef.current : [refsRef.current]).some((ref) => ref.current?.contains(target))) return;
|
|
18
|
+
handlerRef.current(event);
|
|
19
|
+
};
|
|
20
|
+
document.addEventListener("mousedown", listener);
|
|
21
|
+
document.addEventListener("touchstart", listener);
|
|
22
|
+
return () => {
|
|
23
|
+
document.removeEventListener("mousedown", listener);
|
|
24
|
+
document.removeEventListener("touchstart", listener);
|
|
25
|
+
};
|
|
26
|
+
}, [enabled]);
|
|
27
|
+
}
|
|
28
|
+
export { useClickOutside };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=use-click-outside.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-click-outside.js","names":[],"sources":["../../../src/components/hooks/use-click-outside.ts"],"sourcesContent":["import { useEffect, useRef, type RefObject } from \"react\";\n\n/**\n * Calls `handler` on a pointer down outside every element in `refs`.\n * Pass `enabled = false` to pause the listener (e.g. while a popover is closed).\n */\nexport function useClickOutside(\n refs: RefObject<HTMLElement | null> | Array<RefObject<HTMLElement | null>>,\n handler: (event: PointerEvent | MouseEvent | TouchEvent) => void,\n enabled = true\n) {\n const handlerRef = useRef(handler);\n handlerRef.current = handler;\n const refsRef = useRef(refs);\n refsRef.current = refs;\n\n useEffect(() => {\n if (!enabled) return;\n const listener = (event: PointerEvent | MouseEvent | TouchEvent) => {\n const target = event.target as Node | null;\n if (!target) return;\n const list = Array.isArray(refsRef.current) ? refsRef.current : [refsRef.current];\n if (list.some((ref) => ref.current?.contains(target))) return;\n handlerRef.current(event);\n };\n document.addEventListener(\"mousedown\", listener);\n document.addEventListener(\"touchstart\", listener);\n return () => {\n document.removeEventListener(\"mousedown\", listener);\n document.removeEventListener(\"touchstart\", listener);\n };\n }, [enabled]);\n}\n"],"mappings":";;;;;;AAMA,SAAgB,gBACd,MACA,SACA,UAAU,MACV;CACA,MAAM,aAAa,OAAO,OAAO;CACjC,WAAW,UAAU;CACrB,MAAM,UAAU,OAAO,IAAI;CAC3B,QAAQ,UAAU;CAElB,gBAAgB;EACd,IAAI,CAAC,SAAS;EACd,MAAM,YAAY,UAAkD;GAClE,MAAM,SAAS,MAAM;GACrB,IAAI,CAAC,QAAQ;GAEb,KADa,MAAM,QAAQ,QAAQ,OAAO,IAAI,QAAQ,UAAU,CAAC,QAAQ,OAAO,EAAA,CACvE,MAAM,QAAQ,IAAI,SAAS,SAAS,MAAM,CAAC,GAAG;GACvD,WAAW,QAAQ,KAAK;EAC1B;EACA,SAAS,iBAAiB,aAAa,QAAQ;EAC/C,SAAS,iBAAiB,cAAc,QAAQ;EAChD,aAAa;GACX,SAAS,oBAAoB,aAAa,QAAQ;GAClD,SAAS,oBAAoB,cAAc,QAAQ;EACrD;CACF,GAAG,CAAC,OAAO,CAAC;AACd"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State that can be controlled (`value` + `onChange`) or uncontrolled (`defaultValue`).
|
|
3
|
+
* Returns `[value, setValue]`; `setValue` always calls `onChange`.
|
|
4
|
+
*/
|
|
5
|
+
export declare function useControllableState<T>(value: T | undefined, defaultValue: T, onChange?: (value: T) => void): [T, (next: T | ((prev: T) => T)) => void];
|