@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,110 @@
|
|
|
1
|
+
.ds-slider {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100%;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
border: var(--border-width-1) solid var(--color-border);
|
|
6
|
+
border-radius: var(--radius-lg);
|
|
7
|
+
background: var(--color-surface-sunken);
|
|
8
|
+
isolation: isolate;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.ds-slider:focus-visible {
|
|
12
|
+
outline: var(--border-width-2) solid var(--color-focus-ring);
|
|
13
|
+
outline-offset: 2px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.ds-slider__viewport {
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 100%;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
touch-action: pan-y;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ds-slider__track {
|
|
24
|
+
display: flex;
|
|
25
|
+
height: 100%;
|
|
26
|
+
transition: transform var(--duration-slower) var(--easing-standard);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.ds-slider__slide {
|
|
30
|
+
flex: 0 0 100%;
|
|
31
|
+
height: 100%;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.ds-slider__image {
|
|
35
|
+
display: block;
|
|
36
|
+
width: 100%;
|
|
37
|
+
height: 100%;
|
|
38
|
+
object-fit: cover;
|
|
39
|
+
user-select: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Controls: secondary Buttons floating over the image */
|
|
43
|
+
.ds-slider__control {
|
|
44
|
+
position: absolute;
|
|
45
|
+
z-index: var(--z-raised);
|
|
46
|
+
border-radius: var(--radius-full);
|
|
47
|
+
box-shadow: var(--shadow-md);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.ds-slider__control--prev,
|
|
51
|
+
.ds-slider__control--next {
|
|
52
|
+
top: 50%;
|
|
53
|
+
transform: translateY(-50%);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.ds-slider__control--prev { left: var(--space-3); }
|
|
57
|
+
.ds-slider__control--next { right: var(--space-3); }
|
|
58
|
+
|
|
59
|
+
.ds-slider__control--play {
|
|
60
|
+
top: var(--space-3);
|
|
61
|
+
right: var(--space-3);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.ds-slider__control:disabled {
|
|
65
|
+
opacity: 0;
|
|
66
|
+
pointer-events: none;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* Dots */
|
|
70
|
+
.ds-slider__dots {
|
|
71
|
+
position: absolute;
|
|
72
|
+
z-index: var(--z-raised);
|
|
73
|
+
bottom: var(--space-3);
|
|
74
|
+
left: 50%;
|
|
75
|
+
transform: translateX(-50%);
|
|
76
|
+
display: flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
gap: var(--space-2);
|
|
79
|
+
padding: var(--space-2) var(--space-3);
|
|
80
|
+
border-radius: var(--radius-full);
|
|
81
|
+
background: var(--color-overlay);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.ds-slider__dot {
|
|
85
|
+
width: var(--space-2);
|
|
86
|
+
height: var(--space-2);
|
|
87
|
+
padding: 0;
|
|
88
|
+
border: 0;
|
|
89
|
+
border-radius: var(--radius-full);
|
|
90
|
+
background: var(--color-text-on-overlay);
|
|
91
|
+
opacity: 0.5;
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
transition:
|
|
94
|
+
width var(--duration-normal) var(--easing-standard),
|
|
95
|
+
opacity var(--duration-fast) var(--easing-standard);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.ds-slider__dot:hover {
|
|
99
|
+
opacity: 0.8;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.ds-slider__dot:focus-visible {
|
|
103
|
+
outline: var(--border-width-2) solid var(--color-focus-ring);
|
|
104
|
+
outline-offset: 2px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.ds-slider__dot--active {
|
|
108
|
+
width: var(--space-6);
|
|
109
|
+
opacity: 1;
|
|
110
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
// src/components/organisms/table/components/cell/index.tsx
|
|
3
|
+
function Cell({ head, children }) {
|
|
4
|
+
return /* @__PURE__ */ jsx(head ? "th" : "td", {
|
|
5
|
+
className: `ds-table__cell ${head ? "ds-table__cell--head" : ""}`,
|
|
6
|
+
children
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export { Cell as default };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_jsx"],"sources":["../../../../../../src/components/organisms/table/components/cell/index.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\n\ninterface CellProps {\n children?: ReactNode;\n /** Render as a header cell (`<th>`) */\n head?: boolean;\n}\n\nfunction Cell({ head, children }: CellProps) {\n const Tag = head ? \"th\" : \"td\";\n return <Tag className={`ds-table__cell ${head ? \"ds-table__cell--head\" : \"\"}`}>{children}</Tag>;\n}\n\nexport default Cell;\n"],"mappings":";;AAQA,SAAS,KAAK,EAAE,MAAM,YAAuB;CAE3C,OAAOA,oBADK,OAAO,OAAO,MACnB;EAAK,WAAW,kBAAkB,OAAO,yBAAyB;EAAO;CAAc,CAAA;AAChG"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Component, type ChangeEvent, type ReactNode } from "react";
|
|
2
|
+
/** A table row: its values are rendered in order, one cell each */
|
|
3
|
+
export type TableRow = Record<string, ReactNode>;
|
|
4
|
+
export interface TablePagination {
|
|
5
|
+
/** Initial rows per page (5, 10 or 20). Default 10 */
|
|
6
|
+
pageSize?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface TableProps {
|
|
9
|
+
/** Header labels */
|
|
10
|
+
headers?: ReactNode[];
|
|
11
|
+
/** Rows to show */
|
|
12
|
+
rows: TableRow[];
|
|
13
|
+
/** Enable pagination */
|
|
14
|
+
pagination?: TablePagination;
|
|
15
|
+
}
|
|
16
|
+
interface TableState {
|
|
17
|
+
page: number;
|
|
18
|
+
pageSize: number;
|
|
19
|
+
}
|
|
20
|
+
declare class Table extends Component<TableProps, TableState> {
|
|
21
|
+
constructor(props: TableProps);
|
|
22
|
+
pageChange(page: number): void;
|
|
23
|
+
pageSizeChange(event: ChangeEvent<HTMLSelectElement>): void;
|
|
24
|
+
renderHeader(): import("react").JSX.Element | null;
|
|
25
|
+
renderBody(): import("react").JSX.Element;
|
|
26
|
+
renderFooter(): import("react").JSX.Element | null;
|
|
27
|
+
render(): import("react").JSX.Element;
|
|
28
|
+
}
|
|
29
|
+
export default Table;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Component } from "react";
|
|
2
|
+
import Cell from "./components/cell/index.js";
|
|
3
|
+
import Pagination from "../../molecules/pagination/index.js";
|
|
4
|
+
import Select from "../../molecules/select/index.js";
|
|
5
|
+
import './styles.css';/* empty css */
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/components/organisms/table/index.tsx
|
|
8
|
+
var PAGE_SIZE_OPTIONS = [
|
|
9
|
+
5,
|
|
10
|
+
10,
|
|
11
|
+
20
|
|
12
|
+
].map((n) => ({
|
|
13
|
+
value: String(n),
|
|
14
|
+
label: String(n)
|
|
15
|
+
}));
|
|
16
|
+
var Table = class extends Component {
|
|
17
|
+
constructor(props) {
|
|
18
|
+
super(props);
|
|
19
|
+
this.state = {
|
|
20
|
+
page: 0,
|
|
21
|
+
pageSize: props.pagination && props.pagination.pageSize || 10
|
|
22
|
+
};
|
|
23
|
+
this.renderHeader = this.renderHeader.bind(this);
|
|
24
|
+
this.renderBody = this.renderBody.bind(this);
|
|
25
|
+
this.renderFooter = this.renderFooter.bind(this);
|
|
26
|
+
this.pageChange = this.pageChange.bind(this);
|
|
27
|
+
this.pageSizeChange = this.pageSizeChange.bind(this);
|
|
28
|
+
}
|
|
29
|
+
pageChange(page) {
|
|
30
|
+
this.setState({ page: page - 1 });
|
|
31
|
+
}
|
|
32
|
+
pageSizeChange(event) {
|
|
33
|
+
this.setState({
|
|
34
|
+
page: 0,
|
|
35
|
+
pageSize: parseInt(event.target.value, 10)
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
renderHeader() {
|
|
39
|
+
const { headers } = this.props;
|
|
40
|
+
if (!headers) return null;
|
|
41
|
+
return /* @__PURE__ */ jsx("thead", {
|
|
42
|
+
className: "ds-table__head",
|
|
43
|
+
children: /* @__PURE__ */ jsx("tr", { children: headers.map((header, i) => /* @__PURE__ */ jsx(Cell, {
|
|
44
|
+
head: true,
|
|
45
|
+
children: header
|
|
46
|
+
}, i)) })
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
renderBody() {
|
|
50
|
+
const { rows, pagination } = this.props;
|
|
51
|
+
const { page, pageSize } = this.state;
|
|
52
|
+
const items = !pagination ? rows : rows.slice(page * pageSize, page * pageSize + pageSize);
|
|
53
|
+
return /* @__PURE__ */ jsx("tbody", {
|
|
54
|
+
className: "ds-table__body",
|
|
55
|
+
children: items.map((row, i) => {
|
|
56
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
57
|
+
className: "ds-table__row",
|
|
58
|
+
children: Object.values(row).map((cell, j) => /* @__PURE__ */ jsx(Cell, { children: cell }, `${i}${j}`))
|
|
59
|
+
}, i);
|
|
60
|
+
})
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
renderFooter() {
|
|
64
|
+
const { rows, pagination, headers } = this.props;
|
|
65
|
+
const { page, pageSize } = this.state;
|
|
66
|
+
const numPages = Math.max(1, Math.ceil(rows.length / pageSize));
|
|
67
|
+
if (!pagination) return null;
|
|
68
|
+
return /* @__PURE__ */ jsx("tfoot", {
|
|
69
|
+
className: "ds-table__foot",
|
|
70
|
+
children: /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
|
|
71
|
+
colSpan: headers ? headers.length : 1,
|
|
72
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
73
|
+
className: "ds-table__pagination",
|
|
74
|
+
children: [/* @__PURE__ */ jsxs("label", {
|
|
75
|
+
className: "ds-table__page-size",
|
|
76
|
+
children: ["Rows", /* @__PURE__ */ jsx(Select, {
|
|
77
|
+
size: "sm",
|
|
78
|
+
value: String(pageSize),
|
|
79
|
+
onChange: this.pageSizeChange,
|
|
80
|
+
options: PAGE_SIZE_OPTIONS
|
|
81
|
+
})]
|
|
82
|
+
}), /* @__PURE__ */ jsx(Pagination, {
|
|
83
|
+
className: "ds-table__page-nav",
|
|
84
|
+
page: Math.min(page + 1, numPages),
|
|
85
|
+
pageCount: numPages,
|
|
86
|
+
onChange: this.pageChange
|
|
87
|
+
})]
|
|
88
|
+
})
|
|
89
|
+
}) })
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
render() {
|
|
93
|
+
return /* @__PURE__ */ jsx("div", {
|
|
94
|
+
className: "ds-table",
|
|
95
|
+
children: /* @__PURE__ */ jsxs("table", { children: [
|
|
96
|
+
this.renderHeader(),
|
|
97
|
+
this.renderBody(),
|
|
98
|
+
this.renderFooter()
|
|
99
|
+
] })
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
export { Table as default };
|
|
104
|
+
|
|
105
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_jsx","_jsxs"],"sources":["../../../../src/components/organisms/table/index.tsx"],"sourcesContent":["import { Component, type ChangeEvent, type ReactNode } from \"react\";\nimport Cell from \"./components/cell\";\nimport Pagination from \"../../molecules/pagination\";\nimport Select from \"../../molecules/select\";\n\nimport \"./styles.css\";\n\nconst PAGE_SIZE_OPTIONS = [5, 10, 20].map((n) => ({ value: String(n), label: String(n) }));\n\n/** A table row: its values are rendered in order, one cell each */\nexport type TableRow = Record<string, ReactNode>;\n\nexport interface TablePagination {\n /** Initial rows per page (5, 10 or 20). Default 10 */\n pageSize?: number;\n}\n\nexport interface TableProps {\n /** Header labels */\n headers?: ReactNode[];\n /** Rows to show */\n rows: TableRow[];\n /** Enable pagination */\n pagination?: TablePagination;\n}\n\ninterface TableState {\n page: number;\n pageSize: number;\n}\n\nclass Table extends Component<TableProps, TableState> {\n constructor(props: TableProps) {\n super(props);\n\n this.state = {\n page: 0,\n pageSize: (props.pagination && props.pagination.pageSize) || 10\n };\n\n this.renderHeader = this.renderHeader.bind(this);\n this.renderBody = this.renderBody.bind(this);\n this.renderFooter = this.renderFooter.bind(this);\n this.pageChange = this.pageChange.bind(this);\n this.pageSizeChange = this.pageSizeChange.bind(this);\n }\n\n pageChange(page: number) {\n this.setState({ page: page - 1 });\n }\n\n pageSizeChange(event: ChangeEvent<HTMLSelectElement>) {\n this.setState({\n page: 0,\n pageSize: parseInt(event.target.value, 10)\n });\n }\n\n renderHeader() {\n const { headers } = this.props;\n if (!headers) {\n return null;\n }\n return (\n <thead className=\"ds-table__head\">\n <tr>\n {headers.map((header, i) => (\n <Cell key={i} head>\n {header}\n </Cell>\n ))}\n </tr>\n </thead>\n );\n }\n\n renderBody() {\n const { rows, pagination } = this.props;\n const { page, pageSize } = this.state;\n\n const items = !pagination\n ? rows\n : rows.slice(page * pageSize, page * pageSize + pageSize);\n\n return (\n <tbody className=\"ds-table__body\">\n {items.map((row, i) => {\n return (\n <tr key={i} className=\"ds-table__row\">\n {Object.values(row).map((cell, j) => (\n <Cell key={`${i}${j}`}>\n {cell}\n </Cell>\n ))}\n </tr>\n );\n })}\n </tbody>\n );\n }\n\n renderFooter() {\n const { rows, pagination, headers } = this.props;\n const { page, pageSize } = this.state;\n\n const numPages = Math.max(1, Math.ceil(rows.length / pageSize));\n if (!pagination) {\n return null;\n }\n return (\n <tfoot className=\"ds-table__foot\">\n <tr>\n <td colSpan={headers ? headers.length : 1}>\n <div className=\"ds-table__pagination\">\n <label className=\"ds-table__page-size\">\n Rows\n <Select size=\"sm\" value={String(pageSize)} onChange={this.pageSizeChange} options={PAGE_SIZE_OPTIONS} />\n </label>\n <Pagination\n className=\"ds-table__page-nav\"\n page={Math.min(page + 1, numPages)}\n pageCount={numPages}\n onChange={this.pageChange}\n />\n </div>\n </td>\n </tr>\n </tfoot>\n );\n }\n\n render() {\n return (\n <div className=\"ds-table\">\n <table>\n {this.renderHeader()}\n {this.renderBody()}\n {this.renderFooter()}\n </table>\n </div>\n );\n }\n}\n\nexport default Table;\n"],"mappings":";;;;;;;AAOA,IAAM,oBAAoB;CAAC;CAAG;CAAI;AAAE,CAAC,CAAC,KAAK,OAAO;CAAE,OAAO,OAAO,CAAC;CAAG,OAAO,OAAO,CAAC;AAAE,EAAE;AAwBzF,IAAM,QAAN,cAAoB,UAAkC;CACpD,YAAY,OAAmB;EAC7B,MAAM,KAAK;EAEX,KAAK,QAAQ;GACX,MAAM;GACN,UAAW,MAAM,cAAc,MAAM,WAAW,YAAa;EAC/D;EAEA,KAAK,eAAe,KAAK,aAAa,KAAK,IAAI;EAC/C,KAAK,aAAa,KAAK,WAAW,KAAK,IAAI;EAC3C,KAAK,eAAe,KAAK,aAAa,KAAK,IAAI;EAC/C,KAAK,aAAa,KAAK,WAAW,KAAK,IAAI;EAC3C,KAAK,iBAAiB,KAAK,eAAe,KAAK,IAAI;CACrD;CAEA,WAAW,MAAc;EACvB,KAAK,SAAS,EAAE,MAAM,OAAO,EAAE,CAAC;CAClC;CAEA,eAAe,OAAuC;EACpD,KAAK,SAAS;GACZ,MAAM;GACN,UAAU,SAAS,MAAM,OAAO,OAAO,EAAE;EAC3C,CAAC;CACH;CAEA,eAAe;EACb,MAAM,EAAE,YAAY,KAAK;EACzB,IAAI,CAAC,SACH,OAAO;EAET,OACEA,oBAAC,SAAD;GAAO,WAAU;GACf,UAAAA,oBAAC,MAAD,EAAA,UACG,QAAQ,KAAK,QAAQ,MACpBA,oBAAC,MAAD;IAAc,MAAA;IACX,UAAA;GACG,GAFK,CAEL,CACP,EACC,CAAA;EACC,CAAA;CAEX;CAEA,aAAa;EACX,MAAM,EAAE,MAAM,eAAe,KAAK;EAClC,MAAM,EAAE,MAAM,aAAa,KAAK;EAEhC,MAAM,QAAQ,CAAC,aACX,OACA,KAAK,MAAM,OAAO,UAAU,OAAO,WAAW,QAAQ;EAE1D,OACEA,oBAAC,SAAD;GAAO,WAAU;GACd,UAAA,MAAM,KAAK,KAAK,MAAM;IACrB,OACEA,oBAAC,MAAD;KAAY,WAAU;KACnB,UAAA,OAAO,OAAO,GAAG,CAAC,CAAC,KAAK,MAAM,MAC7BA,oBAAC,MAAD,EAAA,UACG,KACG,GAFK,GAAG,IAAI,GAEZ,CACP;IACC,GANK,CAML;GAER,CAAC;EACI,CAAA;CAEX;CAEA,eAAe;EACb,MAAM,EAAE,MAAM,YAAY,YAAY,KAAK;EAC3C,MAAM,EAAE,MAAM,aAAa,KAAK;EAEhC,MAAM,WAAW,KAAK,IAAI,GAAG,KAAK,KAAK,KAAK,SAAS,QAAQ,CAAC;EAC9D,IAAI,CAAC,YACH,OAAO;EAET,OACEA,oBAAC,SAAD;GAAO,WAAU;GACf,UAAAA,oBAAC,MAAD,EAAA,UACEA,oBAAC,MAAD;IAAI,SAAS,UAAU,QAAQ,SAAS;IACtC,UAAAC,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACEA,qBAAC,SAAD;MAAO,WAAU;MAAjB,UAAA,CAAuC,QAErCD,oBAAC,QAAD;OAAQ,MAAK;OAAK,OAAO,OAAO,QAAQ;OAAG,UAAU,KAAK;OAAgB,SAAS;MAAoB,CAAA,CAClG;KACP,CAAA,GAAAA,oBAAC,YAAD;MACE,WAAU;MACV,MAAM,KAAK,IAAI,OAAO,GAAG,QAAQ;MACjC,WAAW;MACX,UAAU,KAAK;KAChB,CAAA,CACE;;GACH,CAAA,EACF,CAAA;EACC,CAAA;CAEX;CAEA,SAAS;EACP,OACEA,oBAAC,OAAD;GAAK,WAAU;GACb,UAAAC,qBAAC,SAAD,EAAA,UAAA;IACG,KAAK,aAAa;IAClB,KAAK,WAAW;IAChB,KAAK,aAAa;GACd,EAAA,CAAA;EACJ,CAAA;CAET;AACF"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
.ds-table {
|
|
2
|
+
width: 100%;
|
|
3
|
+
overflow-x: auto;
|
|
4
|
+
border: var(--border-width-1) solid var(--color-border);
|
|
5
|
+
border-radius: var(--radius-lg);
|
|
6
|
+
background: var(--color-surface);
|
|
7
|
+
color: var(--color-text);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.ds-table table {
|
|
11
|
+
width: 100%;
|
|
12
|
+
border-collapse: collapse;
|
|
13
|
+
font-size: var(--font-size-sm);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.ds-table__cell {
|
|
17
|
+
padding: var(--space-3) var(--space-4);
|
|
18
|
+
text-align: left;
|
|
19
|
+
border-bottom: var(--border-width-1) solid var(--color-border);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.ds-table__cell--head {
|
|
23
|
+
background: var(--color-bg-subtle);
|
|
24
|
+
color: var(--color-text-muted);
|
|
25
|
+
font-size: var(--font-size-xs);
|
|
26
|
+
font-weight: var(--font-weight-semibold);
|
|
27
|
+
text-transform: uppercase;
|
|
28
|
+
letter-spacing: 0.04em;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ds-table__row:nth-child(even) {
|
|
32
|
+
background: var(--color-bg-subtle);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.ds-table__row:hover {
|
|
36
|
+
background: var(--color-primary-subtle);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.ds-table__body .ds-table__row:last-child .ds-table__cell {
|
|
40
|
+
border-bottom: 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.ds-table__foot td {
|
|
44
|
+
padding: var(--space-2) var(--space-4);
|
|
45
|
+
border-top: var(--border-width-1) solid var(--color-border);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.ds-table__pagination {
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
flex-wrap: wrap;
|
|
52
|
+
justify-content: space-between;
|
|
53
|
+
gap: var(--space-4);
|
|
54
|
+
color: var(--color-text-muted);
|
|
55
|
+
font-size: var(--font-size-sm);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.ds-table__page-size {
|
|
59
|
+
display: inline-flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
gap: var(--space-2);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.ds-table__page-nav {
|
|
65
|
+
margin-left: auto;
|
|
66
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface TerminalProps {
|
|
3
|
+
/** Output shown above the prompt */
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
/** Called with the command typed when Enter is pressed */
|
|
6
|
+
onCommand?: (command: string) => void;
|
|
7
|
+
/** User shown in the prompt */
|
|
8
|
+
username?: string;
|
|
9
|
+
/** Host shown in the prompt. Default: `window.location.hostname` */
|
|
10
|
+
host?: string;
|
|
11
|
+
/** Current directory shown in the prompt */
|
|
12
|
+
path?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const Terminal: ({ children, onCommand, username, host, path, }: TerminalProps) => import("react").JSX.Element;
|
|
15
|
+
export default Terminal;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { useEffect, useId, useState } from "react";
|
|
2
|
+
import './styles.css';/* empty css */
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
// src/components/organisms/terminal/index.tsx
|
|
5
|
+
var Terminal = ({ children, onCommand, username = "user", host = typeof window !== "undefined" ? window.location.hostname : "localhost", path = "~" }) => {
|
|
6
|
+
const id = `terminal-${useId()}`;
|
|
7
|
+
const [history, setHistory] = useState([]);
|
|
8
|
+
const [historyPos, setHistoryPos] = useState(0);
|
|
9
|
+
const [command, setCommand] = useState("");
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const terminal = document.getElementById(id);
|
|
12
|
+
if (!terminal) return void 0;
|
|
13
|
+
terminal.addEventListener("keydown", handleKey);
|
|
14
|
+
return () => {
|
|
15
|
+
terminal.removeEventListener("keydown", handleKey);
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
const handleKey = (e) => {
|
|
19
|
+
e.stopPropagation();
|
|
20
|
+
if (e.keyCode === 13) {
|
|
21
|
+
setHistory([command, ...history]);
|
|
22
|
+
setCommand("");
|
|
23
|
+
if (onCommand) onCommand(command);
|
|
24
|
+
}
|
|
25
|
+
if (e.keyCode === 8) setCommand(command.slice(0, -1));
|
|
26
|
+
if (e.keyCode === 38) {
|
|
27
|
+
if (history.length > historyPos + 1) {
|
|
28
|
+
setCommand(history[historyPos + 1]);
|
|
29
|
+
setHistoryPos(historyPos + 1);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (e.keyCode === 40) {
|
|
33
|
+
if (historyPos > 0) {
|
|
34
|
+
setCommand(history[historyPos - 1]);
|
|
35
|
+
setHistoryPos(historyPos - 1);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (e.keyCode >= 48 && e.keyCode <= 57 || e.keyCode >= 65 && e.keyCode <= 90 || e.keyCode >= 96 && e.keyCode <= 105 || e.keyCode === 32) setCommand(`${command}${e.key}`);
|
|
39
|
+
};
|
|
40
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
41
|
+
className: "ds-terminal",
|
|
42
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
43
|
+
className: "ds-terminal__toolbar",
|
|
44
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
45
|
+
className: "ds-terminal__buttons",
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ jsx("button", {
|
|
48
|
+
className: "ds-terminal__button ds-terminal__button--exit",
|
|
49
|
+
"aria-label": "Close",
|
|
50
|
+
children: "✕"
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ jsx("button", {
|
|
53
|
+
className: "ds-terminal__button",
|
|
54
|
+
"aria-label": "Minimize",
|
|
55
|
+
children: "─"
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ jsx("button", {
|
|
58
|
+
className: "ds-terminal__button",
|
|
59
|
+
"aria-label": "Maximize",
|
|
60
|
+
children: "◻"
|
|
61
|
+
})
|
|
62
|
+
]
|
|
63
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
64
|
+
className: "ds-terminal__title",
|
|
65
|
+
children: [
|
|
66
|
+
username,
|
|
67
|
+
"@",
|
|
68
|
+
host,
|
|
69
|
+
":~"
|
|
70
|
+
]
|
|
71
|
+
})]
|
|
72
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
73
|
+
className: "ds-terminal__body",
|
|
74
|
+
id,
|
|
75
|
+
tabIndex: 0,
|
|
76
|
+
children: [/* @__PURE__ */ jsx("pre", {
|
|
77
|
+
className: "ds-terminal__history",
|
|
78
|
+
children
|
|
79
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
80
|
+
className: "ds-terminal__prompt",
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ jsxs("span", {
|
|
83
|
+
className: "ds-terminal__user",
|
|
84
|
+
children: [
|
|
85
|
+
username,
|
|
86
|
+
"@",
|
|
87
|
+
host,
|
|
88
|
+
":"
|
|
89
|
+
]
|
|
90
|
+
}),
|
|
91
|
+
/* @__PURE__ */ jsx("span", {
|
|
92
|
+
className: "ds-terminal__location",
|
|
93
|
+
children: path
|
|
94
|
+
}),
|
|
95
|
+
/* @__PURE__ */ jsx("span", {
|
|
96
|
+
className: "ds-terminal__dollar",
|
|
97
|
+
children: "$"
|
|
98
|
+
}),
|
|
99
|
+
/* @__PURE__ */ jsx("span", {
|
|
100
|
+
className: "ds-terminal__command",
|
|
101
|
+
children: command
|
|
102
|
+
}),
|
|
103
|
+
/* @__PURE__ */ jsx("span", { className: "ds-terminal__cursor" })
|
|
104
|
+
]
|
|
105
|
+
})]
|
|
106
|
+
})]
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
export { Terminal as default };
|
|
110
|
+
|
|
111
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_jsxs","_jsx"],"sources":["../../../../src/components/organisms/terminal/index.tsx"],"sourcesContent":["import { useState, useEffect, useId, type ReactNode } from \"react\";\nimport \"./styles.css\";\n\nexport interface TerminalProps {\n /** Output shown above the prompt */\n children?: ReactNode;\n /** Called with the command typed when Enter is pressed */\n onCommand?: (command: string) => void;\n /** User shown in the prompt */\n username?: string;\n /** Host shown in the prompt. Default: `window.location.hostname` */\n host?: string;\n /** Current directory shown in the prompt */\n path?: string;\n}\n\nconst Terminal = ({\n children,\n onCommand,\n username = \"user\",\n host = typeof window !== \"undefined\" ? window.location.hostname : \"localhost\",\n path = \"~\",\n}: TerminalProps) => {\n const id = `terminal-${useId()}`;\n const [history, setHistory] = useState<string[]>([]);\n const [historyPos, setHistoryPos] = useState(0);\n const [command, setCommand] = useState(\"\");\n\n useEffect(() => {\n const terminal = document.getElementById(id);\n if (!terminal) return undefined;\n terminal.addEventListener(\"keydown\", handleKey);\n\n return () => {\n terminal.removeEventListener(\"keydown\", handleKey);\n };\n });\n\n const handleKey = (e: KeyboardEvent) => {\n e.stopPropagation();\n if (e.keyCode === 13) {\n setHistory([command, ...history]);\n setCommand(\"\");\n if (onCommand) {\n onCommand(command);\n }\n }\n if (e.keyCode === 8) {\n setCommand(command.slice(0, -1));\n }\n if (e.keyCode === 38) {\n //arrow up\n if (history.length > historyPos + 1) {\n setCommand(history[historyPos + 1]);\n setHistoryPos(historyPos + 1);\n }\n }\n if (e.keyCode === 40) {\n //arrow down\n if (historyPos > 0) {\n setCommand(history[historyPos - 1]);\n setHistoryPos(historyPos - 1);\n }\n }\n if (\n (e.keyCode >= 48 && e.keyCode <= 57) ||\n (e.keyCode >= 65 && e.keyCode <= 90) ||\n (e.keyCode >= 96 && e.keyCode <= 105) ||\n e.keyCode === 32\n ) {\n setCommand(`${command}${e.key}`);\n }\n };\n\n return (\n <div className=\"ds-terminal\">\n <div className=\"ds-terminal__toolbar\">\n <div className=\"ds-terminal__buttons\">\n <button className=\"ds-terminal__button ds-terminal__button--exit\" aria-label=\"Close\">\n ✕\n </button>\n <button className=\"ds-terminal__button\" aria-label=\"Minimize\">─</button>\n <button className=\"ds-terminal__button\" aria-label=\"Maximize\">◻</button>\n </div>\n <p className=\"ds-terminal__title\">\n {username}@{host}:~\n </p>\n </div>\n <div className=\"ds-terminal__body\" id={id} tabIndex={0}>\n <pre className=\"ds-terminal__history\">{children}</pre>\n <div className=\"ds-terminal__prompt\">\n <span className=\"ds-terminal__user\">\n {username}@{host}:\n </span>\n <span className=\"ds-terminal__location\">{path}</span>\n <span className=\"ds-terminal__dollar\">$</span>\n <span className=\"ds-terminal__command\">{command}</span>\n <span className=\"ds-terminal__cursor\"></span>\n </div>\n </div>\n </div>\n );\n};\n\nexport default Terminal;\n"],"mappings":";;;;AAgBA,IAAM,YAAY,EAChB,UACA,WACA,WAAW,QACX,OAAO,OAAO,WAAW,cAAc,OAAO,SAAS,WAAW,aAClE,OAAO,UACY;CACnB,MAAM,KAAK,YAAY,MAAM;CAC7B,MAAM,CAAC,SAAS,cAAc,SAAmB,CAAC,CAAC;CACnD,MAAM,CAAC,YAAY,iBAAiB,SAAS,CAAC;CAC9C,MAAM,CAAC,SAAS,cAAc,SAAS,EAAE;CAEzC,gBAAgB;EACd,MAAM,WAAW,SAAS,eAAe,EAAE;EAC3C,IAAI,CAAC,UAAU,OAAO,KAAA;EACtB,SAAS,iBAAiB,WAAW,SAAS;EAE9C,aAAa;GACX,SAAS,oBAAoB,WAAW,SAAS;EACnD;CACF,CAAC;CAED,MAAM,aAAa,MAAqB;EACtC,EAAE,gBAAgB;EAClB,IAAI,EAAE,YAAY,IAAI;GACpB,WAAW,CAAC,SAAS,GAAG,OAAO,CAAC;GAChC,WAAW,EAAE;GACb,IAAI,WACF,UAAU,OAAO;EAErB;EACA,IAAI,EAAE,YAAY,GAChB,WAAW,QAAQ,MAAM,GAAG,EAAE,CAAC;EAEjC,IAAI,EAAE,YAAY,IAEZ;OAAA,QAAQ,SAAS,aAAa,GAAG;IACnC,WAAW,QAAQ,aAAa,EAAE;IAClC,cAAc,aAAa,CAAC;GAC9B;;EAEF,IAAI,EAAE,YAAY,IAEZ;OAAA,aAAa,GAAG;IAClB,WAAW,QAAQ,aAAa,EAAE;IAClC,cAAc,aAAa,CAAC;GAC9B;;EAEF,IACG,EAAE,WAAW,MAAM,EAAE,WAAW,MAChC,EAAE,WAAW,MAAM,EAAE,WAAW,MAChC,EAAE,WAAW,MAAM,EAAE,WAAW,OACjC,EAAE,YAAY,IAEd,WAAW,GAAG,UAAU,EAAE,KAAK;CAEnC;CAEA,OACEA,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACEA,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACEA,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA;KACEC,oBAAC,UAAD;MAAQ,WAAU;MAAgD,cAAW;MAAQ,UAAA;KAE7E,CAAA;KACRA,oBAAC,UAAD;MAAQ,WAAU;MAAsB,cAAW;MAAW,UAAA;KAAe,CAAA;KAC7EA,oBAAC,UAAD;MAAQ,WAAU;MAAsB,cAAW;MAAW,UAAA;KAAe,CAAA;IAC1E;GACL,CAAA,GAAAD,qBAAC,KAAD;IAAG,WAAU;IAAb,UAAA;KACG;KAAS;KAAE;KAAK;IAChB;GACA,CAAA,CAAA;EACL,CAAA,GAAAA,qBAAC,OAAD;GAAK,WAAU;GAAwB;GAAI,UAAU;GAArD,UAAA,CACEC,oBAAC,OAAD;IAAK,WAAU;IAAwB;GAAc,CAAA,GACrDD,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA;KACEA,qBAAC,QAAD;MAAM,WAAU;MAAhB,UAAA;OACG;OAAS;OAAE;OAAK;MACb;;KACNC,oBAAC,QAAD;MAAM,WAAU;MAAyB,UAAA;KAAW,CAAA;KACpDA,oBAAC,QAAD;MAAM,WAAU;MAAsB,UAAA;KAAO,CAAA;KAC7CA,oBAAC,QAAD;MAAM,WAAU;MAAwB,UAAA;KAAc,CAAA;KACtDA,oBAAC,QAAD,EAAM,WAAU,sBAA4B,CAAA;IACzC;GACF,CAAA,CAAA;EACF,CAAA,CAAA;;AAET"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Terminal keeps its "Ubuntu terminal" look in both themes on purpose.
|
|
3
|
+
* Those colors are COMPONENT TOKENS (defined here, used only here). Everything else
|
|
4
|
+
* (spacing, radius, type scale, shadow, motion) comes from the design system.
|
|
5
|
+
*/
|
|
6
|
+
.ds-terminal {
|
|
7
|
+
--terminal-bg: rgb(56 4 40 / 0.95);
|
|
8
|
+
--terminal-toolbar-from: #504b45;
|
|
9
|
+
--terminal-toolbar-to: #3c3b37;
|
|
10
|
+
--terminal-button-from: #7d7871;
|
|
11
|
+
--terminal-button-to: #595953;
|
|
12
|
+
--terminal-exit-from: #f37458;
|
|
13
|
+
--terminal-exit-to: #de4c12;
|
|
14
|
+
--terminal-title: #d5d0ce;
|
|
15
|
+
--terminal-text: #dddddd;
|
|
16
|
+
--terminal-user: #87d441;
|
|
17
|
+
--terminal-location: #6d85a9;
|
|
18
|
+
--terminal-cursor: #ffffff;
|
|
19
|
+
--terminal-toolbar-height: 1.75rem;
|
|
20
|
+
--terminal-font: "Ubuntu Mono", var(--font-mono);
|
|
21
|
+
|
|
22
|
+
width: 600px;
|
|
23
|
+
max-width: 100%;
|
|
24
|
+
height: 400px;
|
|
25
|
+
border-radius: var(--radius-lg);
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
box-shadow: var(--shadow-xl);
|
|
28
|
+
font-family: var(--font-sans);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ds-terminal__toolbar {
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
gap: var(--space-2);
|
|
35
|
+
height: var(--terminal-toolbar-height);
|
|
36
|
+
padding: 0 var(--space-2);
|
|
37
|
+
background: linear-gradient(var(--terminal-toolbar-from), var(--terminal-toolbar-to));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.ds-terminal__buttons {
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
gap: var(--space-1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ds-terminal__button {
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
width: 0.75rem;
|
|
51
|
+
height: 0.75rem;
|
|
52
|
+
padding: 0;
|
|
53
|
+
border: none;
|
|
54
|
+
border-radius: var(--radius-full);
|
|
55
|
+
background: linear-gradient(var(--terminal-button-from), var(--terminal-button-to));
|
|
56
|
+
font-size: 0.4375rem;
|
|
57
|
+
line-height: 1;
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.ds-terminal__button--exit {
|
|
62
|
+
background: linear-gradient(var(--terminal-exit-from), var(--terminal-exit-to));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.ds-terminal__title {
|
|
66
|
+
margin: 0;
|
|
67
|
+
color: var(--terminal-title);
|
|
68
|
+
font-size: var(--font-size-xs);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.ds-terminal__body {
|
|
72
|
+
height: calc(100% - var(--terminal-toolbar-height));
|
|
73
|
+
padding: var(--space-2) var(--space-3);
|
|
74
|
+
overflow-y: auto;
|
|
75
|
+
background: var(--terminal-bg);
|
|
76
|
+
font-family: var(--terminal-font);
|
|
77
|
+
font-size: var(--font-size-md);
|
|
78
|
+
line-height: var(--line-height-tight);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.ds-terminal__body:focus {
|
|
82
|
+
outline: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.ds-terminal__body:focus-visible {
|
|
86
|
+
box-shadow: inset 0 0 0 var(--border-width-2) var(--color-focus-ring);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.ds-terminal__history {
|
|
90
|
+
margin: 0;
|
|
91
|
+
font-family: inherit;
|
|
92
|
+
font-size: inherit;
|
|
93
|
+
color: var(--terminal-text);
|
|
94
|
+
white-space: pre-wrap;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.ds-terminal__prompt {
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
margin-top: var(--space-2);
|
|
101
|
+
color: var(--terminal-text);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.ds-terminal__user { color: var(--terminal-user); }
|
|
105
|
+
.ds-terminal__location { color: var(--terminal-location); }
|
|
106
|
+
|
|
107
|
+
.ds-terminal__command {
|
|
108
|
+
margin-left: var(--space-1);
|
|
109
|
+
white-space: pre;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.ds-terminal__cursor {
|
|
113
|
+
display: block;
|
|
114
|
+
width: 0.5rem;
|
|
115
|
+
height: 1.0625rem;
|
|
116
|
+
background: var(--terminal-cursor);
|
|
117
|
+
animation: ds-terminal-blink 1000ms var(--easing-standard) infinite alternate;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@keyframes ds-terminal-blink {
|
|
121
|
+
from { opacity: 0; }
|
|
122
|
+
to { opacity: 1; }
|
|
123
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
export type ToastVariant = "info" | "success" | "warning" | "danger";
|
|
3
|
+
export type ToastPlacement = "top-right" | "top-left" | "bottom-right" | "bottom-left" | "top-center" | "bottom-center";
|
|
4
|
+
export interface ToastAction {
|
|
5
|
+
/** Button text */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Called when the action is clicked (the toast is then dismissed) */
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
}
|
|
10
|
+
export interface ToastOptions {
|
|
11
|
+
/** Main text */
|
|
12
|
+
title?: ReactNode;
|
|
13
|
+
/** Secondary text */
|
|
14
|
+
description?: ReactNode;
|
|
15
|
+
/** Colour and semantics; `danger` is announced assertively (`role="alert"`) */
|
|
16
|
+
variant?: ToastVariant;
|
|
17
|
+
/** Time before auto-dismissing, in ms. `Infinity` keeps it until dismissed. Pauses on hover / focus. */
|
|
18
|
+
duration?: number;
|
|
19
|
+
/** Optional action button */
|
|
20
|
+
action?: ToastAction;
|
|
21
|
+
}
|
|
22
|
+
export interface ToastProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
|
|
23
|
+
/** Main text */
|
|
24
|
+
title?: ReactNode;
|
|
25
|
+
/** Secondary text */
|
|
26
|
+
description?: ReactNode;
|
|
27
|
+
/** Colour and semantics; `danger` uses `role="alert"`, the rest `role="status"` */
|
|
28
|
+
variant?: ToastVariant;
|
|
29
|
+
/** Auto-dismiss after this many ms (calls `onDismiss`). `Infinity` disables it. Pauses on hover / focus. */
|
|
30
|
+
duration?: number;
|
|
31
|
+
/** Optional action button */
|
|
32
|
+
action?: ToastAction;
|
|
33
|
+
/** Called by the dismiss button, the action and the auto-dismiss timer */
|
|
34
|
+
onDismiss?: () => void;
|
|
35
|
+
/** Accessible label of the dismiss button */
|
|
36
|
+
dismissLabel?: string;
|
|
37
|
+
}
|
|
38
|
+
/** A single notification. Used by `ToastProvider`, but can be rendered on its own. */
|
|
39
|
+
export declare function Toast({ title, description, variant, duration, action, onDismiss, dismissLabel, className, onMouseEnter, onMouseLeave, onFocus, onBlur, ...rest }: ToastProps): import("react").JSX.Element;
|
|
40
|
+
export interface ToastApi {
|
|
41
|
+
/** Shows a toast and returns its id */
|
|
42
|
+
toast: (options: ToastOptions) => string;
|
|
43
|
+
/** Removes a toast by id */
|
|
44
|
+
dismiss: (id: string) => void;
|
|
45
|
+
/** Removes every toast */
|
|
46
|
+
dismissAll: () => void;
|
|
47
|
+
}
|
|
48
|
+
export interface ToastProviderProps {
|
|
49
|
+
/** App content */
|
|
50
|
+
children?: ReactNode;
|
|
51
|
+
/** Corner / edge of the viewport where toasts stack */
|
|
52
|
+
placement?: ToastPlacement;
|
|
53
|
+
/** Maximum number of visible toasts; extra ones wait in a queue */
|
|
54
|
+
max?: number;
|
|
55
|
+
/** Default auto-dismiss time in ms */
|
|
56
|
+
duration?: number;
|
|
57
|
+
/** Accessible name of the notifications region */
|
|
58
|
+
label?: string;
|
|
59
|
+
/** Accessible label of each dismiss button */
|
|
60
|
+
dismissLabel?: string;
|
|
61
|
+
}
|
|
62
|
+
/** Access the toast API. Must be called inside a `ToastProvider`. */
|
|
63
|
+
export declare function useToast(): ToastApi;
|
|
64
|
+
/** Provides `useToast()` and renders the notifications region in a portal. */
|
|
65
|
+
declare function ToastProvider({ children, placement, max, duration, label, dismissLabel, }: ToastProviderProps): import("react").JSX.Element;
|
|
66
|
+
export default ToastProvider;
|