@ds-mo/ui 0.2.4 → 0.4.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/dist/components/ds-accordion.d.ts +11 -0
- package/dist/components/ds-accordion.js +2 -0
- package/dist/components/ds-accordion.js.map +1 -0
- package/dist/components/ds-badge.d.ts +11 -0
- package/dist/components/ds-badge.js +2 -0
- package/dist/components/ds-badge.js.map +1 -0
- package/dist/components/ds-banner.d.ts +11 -0
- package/dist/components/ds-banner.js +2 -0
- package/dist/components/ds-banner.js.map +1 -0
- package/dist/components/ds-breadcrumb.d.ts +11 -0
- package/dist/components/ds-breadcrumb.js +2 -0
- package/dist/components/ds-breadcrumb.js.map +1 -0
- package/dist/components/ds-button.d.ts +11 -0
- package/dist/components/ds-button.js +2 -0
- package/dist/components/ds-button.js.map +1 -0
- package/dist/components/ds-card.d.ts +11 -0
- package/dist/components/ds-card.js +2 -0
- package/dist/components/ds-card.js.map +1 -0
- package/dist/components/ds-checkbox.d.ts +11 -0
- package/dist/components/ds-checkbox.js +2 -0
- package/dist/components/ds-checkbox.js.map +1 -0
- package/dist/components/ds-divider.d.ts +11 -0
- package/dist/components/ds-divider.js +2 -0
- package/dist/components/ds-divider.js.map +1 -0
- package/dist/components/ds-empty-state.d.ts +11 -0
- package/dist/components/ds-empty-state.js +2 -0
- package/dist/components/ds-empty-state.js.map +1 -0
- package/dist/components/ds-fade.d.ts +11 -0
- package/dist/components/ds-fade.js +2 -0
- package/dist/components/ds-fade.js.map +1 -0
- package/dist/components/ds-field.d.ts +11 -0
- package/dist/components/ds-field.js +2 -0
- package/dist/components/ds-field.js.map +1 -0
- package/dist/components/ds-header.d.ts +11 -0
- package/dist/components/ds-header.js +2 -0
- package/dist/components/ds-header.js.map +1 -0
- package/dist/components/ds-input.d.ts +11 -0
- package/dist/components/ds-input.js +2 -0
- package/dist/components/ds-input.js.map +1 -0
- package/dist/components/ds-loader.d.ts +11 -0
- package/dist/components/ds-loader.js +2 -0
- package/dist/components/ds-loader.js.map +1 -0
- package/dist/components/ds-menu.d.ts +11 -0
- package/dist/components/ds-menu.js +2 -0
- package/dist/components/ds-menu.js.map +1 -0
- package/dist/components/ds-modal.d.ts +11 -0
- package/dist/components/ds-modal.js +2 -0
- package/dist/components/ds-modal.js.map +1 -0
- package/dist/components/ds-pagination.d.ts +11 -0
- package/dist/components/ds-pagination.js +2 -0
- package/dist/components/ds-pagination.js.map +1 -0
- package/dist/components/ds-radio-group.d.ts +11 -0
- package/dist/components/ds-radio-group.js +2 -0
- package/dist/components/ds-radio-group.js.map +1 -0
- package/dist/components/ds-scrollbar.d.ts +11 -0
- package/dist/components/ds-scrollbar.js +2 -0
- package/dist/components/ds-scrollbar.js.map +1 -0
- package/dist/components/ds-sidebar.d.ts +11 -0
- package/dist/components/ds-sidebar.js +2 -0
- package/dist/components/ds-sidebar.js.map +1 -0
- package/dist/components/ds-skeleton.d.ts +11 -0
- package/dist/components/ds-skeleton.js +2 -0
- package/dist/components/ds-skeleton.js.map +1 -0
- package/dist/components/ds-slider.d.ts +11 -0
- package/dist/components/ds-slider.js +2 -0
- package/dist/components/ds-slider.js.map +1 -0
- package/dist/components/ds-surface.d.ts +11 -0
- package/dist/components/ds-surface.js +2 -0
- package/dist/components/ds-surface.js.map +1 -0
- package/dist/components/ds-tab-group.d.ts +11 -0
- package/dist/components/ds-tab-group.js +2 -0
- package/dist/components/ds-tab-group.js.map +1 -0
- package/dist/components/ds-table.d.ts +11 -0
- package/dist/components/ds-table.js +2 -0
- package/dist/components/ds-table.js.map +1 -0
- package/dist/components/ds-tag.d.ts +11 -0
- package/dist/components/ds-tag.js +2 -0
- package/dist/components/ds-tag.js.map +1 -0
- package/dist/components/ds-text.d.ts +11 -0
- package/dist/components/ds-text.js +2 -0
- package/dist/components/ds-text.js.map +1 -0
- package/dist/components/ds-toast-provider.d.ts +11 -0
- package/dist/components/ds-toast-provider.js +2 -0
- package/dist/components/ds-toast-provider.js.map +1 -0
- package/dist/components/ds-toggle.d.ts +11 -0
- package/dist/components/ds-toggle.js +2 -0
- package/dist/components/ds-toggle.js.map +1 -0
- package/dist/components/ds-tooltip.d.ts +11 -0
- package/dist/components/ds-tooltip.js +2 -0
- package/dist/components/ds-tooltip.js.map +1 -0
- package/dist/components/index.d.ts +33 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/p-BcuUR5Ao.js +2 -0
- package/dist/components/p-BcuUR5Ao.js.map +1 -0
- package/dist/types/.stencil/Accordion/Accordion.d.ts +28 -0
- package/dist/types/.stencil/Badge/Badge.d.ts +8 -0
- package/dist/types/.stencil/Badge/index.d.ts +2 -0
- package/dist/types/.stencil/Banner/Banner.d.ts +29 -0
- package/dist/types/.stencil/Breadcrumb/Breadcrumb.d.ts +16 -0
- package/dist/types/.stencil/Button/Button.d.ts +38 -0
- package/dist/types/.stencil/Button/index.d.ts +2 -0
- package/dist/types/.stencil/Card/Card.d.ts +8 -0
- package/dist/types/.stencil/Checkbox/Checkbox.d.ts +13 -0
- package/dist/types/.stencil/Checkbox/index.d.ts +2 -0
- package/dist/types/.stencil/Divider/Divider.d.ts +7 -0
- package/dist/types/.stencil/Divider/index.d.ts +2 -0
- package/dist/types/.stencil/EmptyState/EmptyState.d.ts +7 -0
- package/dist/types/.stencil/Fade/Fade.d.ts +10 -0
- package/dist/types/.stencil/Fade/index.d.ts +2 -0
- package/dist/types/.stencil/Field/Field.d.ts +8 -0
- package/dist/types/.stencil/Header/Header.d.ts +7 -0
- package/dist/types/.stencil/Input/Input.d.ts +26 -0
- package/dist/types/.stencil/Input/index.d.ts +2 -0
- package/dist/types/.stencil/Loader/Loader.d.ts +12 -0
- package/dist/types/.stencil/Loader/index.d.ts +2 -0
- package/dist/types/.stencil/Menu/Menu.d.ts +60 -0
- package/dist/types/.stencil/Modal/Modal.d.ts +31 -0
- package/dist/types/.stencil/Pagination/Pagination.d.ts +11 -0
- package/dist/types/.stencil/RadioGroup/RadioGroup.d.ts +21 -0
- package/dist/types/.stencil/RadioGroup/index.d.ts +2 -0
- package/dist/types/.stencil/Scrollbar/Scrollbar.d.ts +27 -0
- package/dist/types/.stencil/Sidebar/Sidebar.d.ts +29 -0
- package/dist/types/.stencil/Skeleton/Skeleton.d.ts +16 -0
- package/dist/types/.stencil/Skeleton/index.d.ts +2 -0
- package/dist/types/.stencil/Slider/Slider.d.ts +18 -0
- package/dist/types/.stencil/Slider/index.d.ts +2 -0
- package/dist/types/.stencil/Surface/Surface.d.ts +22 -0
- package/dist/types/.stencil/TabGroup/TabGroup.d.ts +29 -0
- package/dist/types/.stencil/Table/Table.d.ts +50 -0
- package/dist/types/.stencil/Tag/Tag.d.ts +32 -0
- package/dist/types/.stencil/Tag/index.d.ts +2 -0
- package/dist/types/.stencil/Text/Text.d.ts +22 -0
- package/dist/types/.stencil/Text/index.d.ts +2 -0
- package/dist/types/.stencil/Toast/Toast.d.ts +15 -0
- package/dist/types/.stencil/Toast/toast-service.d.ts +24 -0
- package/dist/types/.stencil/Toggle/Toggle.d.ts +10 -0
- package/dist/types/.stencil/Toggle/index.d.ts +2 -0
- package/dist/types/.stencil/Tooltip/Tooltip.d.ts +36 -0
- package/dist/types/components.d.ts +2024 -0
- package/dist/types/stencil-public-runtime.d.ts +1860 -0
- package/package.json +33 -29
- package/src/angular/angular-component-lib/utils.ts +65 -0
- package/src/angular/index.ts +35 -0
- package/src/angular/proxies.ts +819 -0
- package/dist/index.css +0 -2
- package/dist/index.d.ts +0 -969
- package/dist/index.js +0 -2492
- package/dist/index.js.map +0 -1
- package/dist/r/accordion.json +0 -79
- package/dist/r/badge.json +0 -69
- package/dist/r/banner.json +0 -90
- package/dist/r/breadcrumb.json +0 -70
- package/dist/r/button-group.json +0 -65
- package/dist/r/button.json +0 -137
- package/dist/r/card.json +0 -82
- package/dist/r/checkbox.json +0 -91
- package/dist/r/divider.json +0 -57
- package/dist/r/empty-state.json +0 -69
- package/dist/r/error-boundary.json +0 -66
- package/dist/r/fade.json +0 -65
- package/dist/r/field.json +0 -71
- package/dist/r/header.json +0 -67
- package/dist/r/input.json +0 -77
- package/dist/r/loader.json +0 -54
- package/dist/r/menu.json +0 -130
- package/dist/r/modal.json +0 -93
- package/dist/r/pagination.json +0 -80
- package/dist/r/radio.json +0 -85
- package/dist/r/registry.json +0 -1600
- package/dist/r/scrollbar.json +0 -68
- package/dist/r/select.json +0 -93
- package/dist/r/sidebar.json +0 -105
- package/dist/r/skeleton.json +0 -72
- package/dist/r/slider.json +0 -87
- package/dist/r/surface.json +0 -97
- package/dist/r/tab-group.json +0 -72
- package/dist/r/tab.json +0 -71
- package/dist/r/table.json +0 -110
- package/dist/r/tag.json +0 -110
- package/dist/r/text.json +0 -94
- package/dist/r/toast.json +0 -77
- package/dist/r/toggle-button-group.json +0 -65
- package/dist/r/toggle-button.json +0 -94
- package/dist/r/toggle.json +0 -65
- package/dist/r/tooltip.json +0 -86
- package/src/components/Accordion/Accordion.module.css +0 -66
- package/src/components/Accordion/Accordion.stories.tsx +0 -95
- package/src/components/Accordion/Accordion.tsx +0 -122
- package/src/components/Accordion/index.ts +0 -2
- package/src/components/Badge/Badge.module.css +0 -6
- package/src/components/Badge/Badge.stories.tsx +0 -99
- package/src/components/Badge/Badge.tsx +0 -23
- package/src/components/Badge/index.ts +0 -2
- package/src/components/Banner/Banner.module.css +0 -67
- package/src/components/Banner/Banner.stories.tsx +0 -81
- package/src/components/Banner/Banner.tsx +0 -109
- package/src/components/Banner/index.ts +0 -2
- package/src/components/Breadcrumb/Breadcrumb.module.css +0 -46
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +0 -72
- package/src/components/Breadcrumb/Breadcrumb.tsx +0 -68
- package/src/components/Breadcrumb/index.ts +0 -2
- package/src/components/Button/Button.mdx +0 -143
- package/src/components/Button/Button.module.css +0 -343
- package/src/components/Button/Button.stories.tsx +0 -575
- package/src/components/Button/Button.tsx +0 -201
- package/src/components/Button/index.ts +0 -10
- package/src/components/ButtonGroup/ButtonGroup.module.css +0 -157
- package/src/components/ButtonGroup/ButtonGroup.stories.tsx +0 -384
- package/src/components/ButtonGroup/ButtonGroup.tsx +0 -122
- package/src/components/ButtonGroup/index.ts +0 -2
- package/src/components/Card/Card.module.css +0 -36
- package/src/components/Card/Card.stories.tsx +0 -78
- package/src/components/Card/Card.tsx +0 -53
- package/src/components/Card/index.ts +0 -2
- package/src/components/Checkbox/Checkbox.module.css +0 -47
- package/src/components/Checkbox/Checkbox.stories.tsx +0 -129
- package/src/components/Checkbox/Checkbox.tsx +0 -68
- package/src/components/Checkbox/index.ts +0 -2
- package/src/components/Divider/Divider.module.css +0 -19
- package/src/components/Divider/Divider.stories.tsx +0 -55
- package/src/components/Divider/Divider.tsx +0 -28
- package/src/components/Divider/index.ts +0 -2
- package/src/components/EmptyState/EmptyState.module.css +0 -8
- package/src/components/EmptyState/EmptyState.stories.tsx +0 -53
- package/src/components/EmptyState/EmptyState.tsx +0 -31
- package/src/components/EmptyState/index.ts +0 -2
- package/src/components/ErrorBoundary/ErrorBoundary.module.css +0 -18
- package/src/components/ErrorBoundary/ErrorBoundary.stories.tsx +0 -38
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +0 -50
- package/src/components/ErrorBoundary/index.ts +0 -2
- package/src/components/Fade/Fade.module.css +0 -31
- package/src/components/Fade/Fade.stories.tsx +0 -35
- package/src/components/Fade/Fade.tsx +0 -33
- package/src/components/Fade/index.ts +0 -2
- package/src/components/Field/Field.module.css +0 -5
- package/src/components/Field/Field.stories.tsx +0 -111
- package/src/components/Field/Field.tsx +0 -22
- package/src/components/Field/index.ts +0 -2
- package/src/components/Header/Header.module.css +0 -33
- package/src/components/Header/Header.stories.tsx +0 -52
- package/src/components/Header/Header.tsx +0 -42
- package/src/components/Header/index.ts +0 -2
- package/src/components/Input/Input.module.css +0 -71
- package/src/components/Input/Input.stories.tsx +0 -135
- package/src/components/Input/Input.tsx +0 -76
- package/src/components/Input/index.ts +0 -2
- package/src/components/LabelWrap/LabelWrap.module.css +0 -34
- package/src/components/LabelWrap/LabelWrap.tsx +0 -32
- package/src/components/LabelWrap/index.ts +0 -1
- package/src/components/Loader/Loader.module.css +0 -9
- package/src/components/Loader/Loader.stories.tsx +0 -44
- package/src/components/Loader/Loader.tsx +0 -43
- package/src/components/Loader/index.ts +0 -2
- package/src/components/Menu/DestructiveMenuItem.module.css +0 -57
- package/src/components/Menu/DestructiveMenuItem.tsx +0 -64
- package/src/components/Menu/Menu.module.css +0 -49
- package/src/components/Menu/Menu.stories.tsx +0 -129
- package/src/components/Menu/Menu.tsx +0 -269
- package/src/components/Menu/MenuItem.module.css +0 -84
- package/src/components/Menu/MenuItem.tsx +0 -101
- package/src/components/Menu/index.ts +0 -6
- package/src/components/Modal/Modal.module.css +0 -67
- package/src/components/Modal/Modal.stories.tsx +0 -71
- package/src/components/Modal/Modal.tsx +0 -122
- package/src/components/Modal/index.ts +0 -2
- package/src/components/Pagination/Pagination.module.css +0 -64
- package/src/components/Pagination/Pagination.stories.tsx +0 -51
- package/src/components/Pagination/Pagination.tsx +0 -103
- package/src/components/Pagination/index.ts +0 -2
- package/src/components/Radio/Radio.module.css +0 -61
- package/src/components/Radio/Radio.stories.tsx +0 -101
- package/src/components/Radio/Radio.tsx +0 -108
- package/src/components/Radio/index.ts +0 -2
- package/src/components/Scrollbar/Scrollbar.module.css +0 -81
- package/src/components/Scrollbar/Scrollbar.stories.tsx +0 -46
- package/src/components/Scrollbar/Scrollbar.tsx +0 -187
- package/src/components/Scrollbar/index.ts +0 -2
- package/src/components/Select/Select.module.css +0 -31
- package/src/components/Select/Select.stories.tsx +0 -59
- package/src/components/Select/Select.tsx +0 -92
- package/src/components/Select/index.ts +0 -2
- package/src/components/Sidebar/Sidebar.module.css +0 -161
- package/src/components/Sidebar/Sidebar.stories.tsx +0 -125
- package/src/components/Sidebar/Sidebar.tsx +0 -129
- package/src/components/Sidebar/SidebarItem.tsx +0 -57
- package/src/components/Sidebar/SidebarSection.tsx +0 -42
- package/src/components/Sidebar/index.ts +0 -6
- package/src/components/Skeleton/Skeleton.module.css +0 -53
- package/src/components/Skeleton/Skeleton.stories.tsx +0 -89
- package/src/components/Skeleton/Skeleton.tsx +0 -66
- package/src/components/Skeleton/index.ts +0 -2
- package/src/components/Slider/Slider.module.css +0 -62
- package/src/components/Slider/Slider.stories.tsx +0 -120
- package/src/components/Slider/Slider.tsx +0 -74
- package/src/components/Slider/index.ts +0 -2
- package/src/components/Surface/Surface.module.css +0 -222
- package/src/components/Surface/Surface.stories.tsx +0 -213
- package/src/components/Surface/Surface.tsx +0 -219
- package/src/components/Surface/index.ts +0 -12
- package/src/components/Tab/Tab.module.css +0 -66
- package/src/components/Tab/Tab.stories.tsx +0 -103
- package/src/components/Tab/Tab.tsx +0 -41
- package/src/components/Tab/index.ts +0 -2
- package/src/components/TabGroup/TabGroup.module.css +0 -26
- package/src/components/TabGroup/TabGroup.stories.tsx +0 -60
- package/src/components/TabGroup/TabGroup.tsx +0 -83
- package/src/components/TabGroup/index.ts +0 -2
- package/src/components/Table/Table.module.css +0 -130
- package/src/components/Table/Table.stories.tsx +0 -111
- package/src/components/Table/Table.tsx +0 -226
- package/src/components/Table/index.ts +0 -11
- package/src/components/Tag/Tag.module.css +0 -270
- package/src/components/Tag/Tag.stories.tsx +0 -399
- package/src/components/Tag/Tag.tsx +0 -162
- package/src/components/Tag/index.ts +0 -2
- package/src/components/Text/Text.module.css +0 -166
- package/src/components/Text/Text.stories.tsx +0 -212
- package/src/components/Text/Text.tsx +0 -181
- package/src/components/Text/index.ts +0 -13
- package/src/components/Toast/Toast.module.css +0 -91
- package/src/components/Toast/Toast.stories.tsx +0 -66
- package/src/components/Toast/Toast.tsx +0 -182
- package/src/components/Toast/index.ts +0 -8
- package/src/components/Toggle/Toggle.module.css +0 -87
- package/src/components/Toggle/Toggle.stories.tsx +0 -85
- package/src/components/Toggle/Toggle.tsx +0 -52
- package/src/components/Toggle/index.ts +0 -2
- package/src/components/ToggleButton/ToggleButton.module.css +0 -172
- package/src/components/ToggleButton/ToggleButton.stories.tsx +0 -299
- package/src/components/ToggleButton/ToggleButton.tsx +0 -118
- package/src/components/ToggleButton/index.ts +0 -2
- package/src/components/ToggleButtonGroup/ToggleButtonGroup.module.css +0 -163
- package/src/components/ToggleButtonGroup/ToggleButtonGroup.stories.tsx +0 -341
- package/src/components/ToggleButtonGroup/ToggleButtonGroup.tsx +0 -111
- package/src/components/ToggleButtonGroup/index.ts +0 -2
- package/src/components/Tooltip/Tooltip.module.css +0 -45
- package/src/components/Tooltip/Tooltip.stories.tsx +0 -46
- package/src/components/Tooltip/Tooltip.tsx +0 -224
- package/src/components/Tooltip/index.ts +0 -2
- package/src/css-modules.d.ts +0 -4
- package/src/docs/ColorUsage.mdx +0 -195
- package/src/docs/ElevationUsage.mdx +0 -95
- package/src/docs/Introduction.mdx +0 -97
- package/src/docs/OpticalSizing.mdx +0 -178
- package/src/docs/TypographyUsage.mdx +0 -121
- package/src/index.ts +0 -154
- package/src/stories/Colors.stories.tsx +0 -528
- package/src/stories/Dimensions.stories.tsx +0 -200
- package/src/stories/Effects.stories.tsx +0 -231
- package/src/stories/Icons.stories.tsx +0 -159
- package/src/stories/Typography.stories.tsx +0 -157
- package/src/types/icons.ts +0 -15
- package/src/types/index.ts +0 -1
- package/src/utils/cn.ts +0 -6
- package/src/utils/css-tokens.ts +0 -22
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
.group {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
gap: var(--dimension-space-025);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.horizontal {
|
|
8
|
-
flex-direction: row;
|
|
9
|
-
gap: var(--dimension-space-100);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/* ─── Radio item ────────────────────────────────────────────────────────────── */
|
|
13
|
-
|
|
14
|
-
.radio {
|
|
15
|
-
display: flex;
|
|
16
|
-
align-items: center;
|
|
17
|
-
gap: var(--dimension-space-050);
|
|
18
|
-
padding: var(--dimension-space-075);
|
|
19
|
-
height: var(--dimension-size-400);
|
|
20
|
-
box-sizing: border-box;
|
|
21
|
-
cursor: pointer;
|
|
22
|
-
-webkit-user-select: none;
|
|
23
|
-
user-select: none;
|
|
24
|
-
border-radius: var(--dimension-radius-075);
|
|
25
|
-
transition: background-color var(--effect-motion-short-2);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.radio:hover { background-color: var(--color-interaction-hover); }
|
|
29
|
-
.radio:active { background-color: var(--color-interaction-pressed); }
|
|
30
|
-
|
|
31
|
-
.inactive {
|
|
32
|
-
cursor: not-allowed;
|
|
33
|
-
opacity: 0.5;
|
|
34
|
-
pointer-events: none;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/* ─── Circle indicator ──────────────────────────────────────────────────────── */
|
|
38
|
-
|
|
39
|
-
.circle {
|
|
40
|
-
width: 20px;
|
|
41
|
-
height: 20px;
|
|
42
|
-
border: 1.5px solid var(--color-foreground-secondary);
|
|
43
|
-
border-radius: var(--dimension-radius-half);
|
|
44
|
-
display: flex;
|
|
45
|
-
align-items: center;
|
|
46
|
-
justify-content: center;
|
|
47
|
-
flex-shrink: 0;
|
|
48
|
-
transition: all var(--effect-motion-short-2);
|
|
49
|
-
box-sizing: border-box;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.circleChecked {
|
|
53
|
-
border-color: var(--color-foreground-primary);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.dot {
|
|
57
|
-
width: 10px;
|
|
58
|
-
height: 10px;
|
|
59
|
-
border-radius: var(--dimension-radius-half);
|
|
60
|
-
background-color: var(--color-foreground-primary);
|
|
61
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
|
-
import { RadioGroup } from './Radio';
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof RadioGroup> = {
|
|
6
|
-
title: 'Classic/RadioGroup',
|
|
7
|
-
component: RadioGroup,
|
|
8
|
-
args: {
|
|
9
|
-
direction: 'vertical',
|
|
10
|
-
inactive: false,
|
|
11
|
-
},
|
|
12
|
-
argTypes: {
|
|
13
|
-
direction: { control: 'select', options: ['vertical', 'horizontal'] },
|
|
14
|
-
inactive: { control: 'boolean' },
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default meta;
|
|
19
|
-
type Story = StoryObj<typeof RadioGroup>;
|
|
20
|
-
|
|
21
|
-
const OPTIONS = [
|
|
22
|
-
{ label: 'Option A', value: 'a' },
|
|
23
|
-
{ label: 'Option B', value: 'b' },
|
|
24
|
-
{ label: 'Option C', value: 'c' },
|
|
25
|
-
{ label: 'Option D', value: 'd' },
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
const Controlled = (props: Partial<React.ComponentProps<typeof RadioGroup>>) => {
|
|
29
|
-
const [value, setValue] = useState('b');
|
|
30
|
-
return (
|
|
31
|
-
<RadioGroup
|
|
32
|
-
value={value}
|
|
33
|
-
onChange={setValue}
|
|
34
|
-
options={OPTIONS}
|
|
35
|
-
aria-label="Demo radio group"
|
|
36
|
-
{...props}
|
|
37
|
-
/>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const Playground: Story = {
|
|
42
|
-
render: args => <Controlled {...args} />,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
// ─── Matrix ───────────────────────────────────────────────────────────────────
|
|
46
|
-
|
|
47
|
-
const col: React.CSSProperties = { display: 'flex', flexDirection: 'column', gap: 24 };
|
|
48
|
-
const section = (text: string) => (
|
|
49
|
-
<div style={{ fontSize: 11, fontWeight: 600, letterSpacing: '0.05em', textTransform: 'uppercase', color: '#555', marginTop: 8 }}>
|
|
50
|
-
{text}
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
export const Matrix: Story = {
|
|
55
|
-
parameters: { layout: 'padded' },
|
|
56
|
-
render: () => (
|
|
57
|
-
<div style={col}>
|
|
58
|
-
{section('Vertical (default)')}
|
|
59
|
-
<Controlled />
|
|
60
|
-
{section('Horizontal')}
|
|
61
|
-
<Controlled direction="horizontal" />
|
|
62
|
-
{section('Inactive')}
|
|
63
|
-
<RadioGroup
|
|
64
|
-
value="b"
|
|
65
|
-
onChange={() => {}}
|
|
66
|
-
options={OPTIONS}
|
|
67
|
-
inactive
|
|
68
|
-
aria-label="Disabled group"
|
|
69
|
-
/>
|
|
70
|
-
{section('With inactive individual option')}
|
|
71
|
-
<Controlled
|
|
72
|
-
options={[
|
|
73
|
-
{ label: 'Available', value: 'a' },
|
|
74
|
-
{ label: 'Available', value: 'b' },
|
|
75
|
-
{ label: 'Unavailable', value: 'c', inactive: true },
|
|
76
|
-
{ label: 'Available', value: 'd' },
|
|
77
|
-
]}
|
|
78
|
-
/>
|
|
79
|
-
</div>
|
|
80
|
-
),
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export const Default: Story = {
|
|
84
|
-
render: () => <Controlled />,
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
export const Horizontal: Story = {
|
|
88
|
-
render: () => <Controlled direction="horizontal" />,
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export const Inactive: Story = {
|
|
92
|
-
render: () => (
|
|
93
|
-
<RadioGroup
|
|
94
|
-
value="a"
|
|
95
|
-
onChange={() => {}}
|
|
96
|
-
options={OPTIONS}
|
|
97
|
-
inactive
|
|
98
|
-
aria-label="Disabled group"
|
|
99
|
-
/>
|
|
100
|
-
),
|
|
101
|
-
};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import { cn } from '@/utils/cn';
|
|
3
|
-
import { Text } from '@/components/Text';
|
|
4
|
-
import styles from './Radio.module.css';
|
|
5
|
-
|
|
6
|
-
export interface RadioOption {
|
|
7
|
-
label: string;
|
|
8
|
-
value: string;
|
|
9
|
-
inactive?: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface RadioGroupProps {
|
|
13
|
-
/** Currently selected value. */
|
|
14
|
-
value: string;
|
|
15
|
-
/** Called when selection changes. */
|
|
16
|
-
onChange: (value: string) => void;
|
|
17
|
-
/** Radio options to render. */
|
|
18
|
-
options: RadioOption[];
|
|
19
|
-
/** Group label for accessibility. */
|
|
20
|
-
'aria-label'?: string;
|
|
21
|
-
/** Layout direction. */
|
|
22
|
-
direction?: 'vertical' | 'horizontal';
|
|
23
|
-
/** Disables the entire group. */
|
|
24
|
-
inactive?: boolean;
|
|
25
|
-
className?: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const RadioGroup = forwardRef<HTMLDivElement, RadioGroupProps>(
|
|
29
|
-
(
|
|
30
|
-
{
|
|
31
|
-
value,
|
|
32
|
-
onChange,
|
|
33
|
-
options,
|
|
34
|
-
'aria-label': ariaLabel,
|
|
35
|
-
direction = 'vertical',
|
|
36
|
-
inactive = false,
|
|
37
|
-
className,
|
|
38
|
-
},
|
|
39
|
-
ref
|
|
40
|
-
) => (
|
|
41
|
-
<div
|
|
42
|
-
ref={ref}
|
|
43
|
-
role="radiogroup"
|
|
44
|
-
aria-label={ariaLabel}
|
|
45
|
-
className={cn(
|
|
46
|
-
styles.group,
|
|
47
|
-
direction === 'horizontal' && styles.horizontal,
|
|
48
|
-
className
|
|
49
|
-
)}
|
|
50
|
-
>
|
|
51
|
-
{options.map(opt => (
|
|
52
|
-
<RadioItem
|
|
53
|
-
key={opt.value}
|
|
54
|
-
label={opt.label}
|
|
55
|
-
checked={value === opt.value}
|
|
56
|
-
inactive={inactive || opt.inactive}
|
|
57
|
-
onChange={() => onChange(opt.value)}
|
|
58
|
-
/>
|
|
59
|
-
))}
|
|
60
|
-
</div>
|
|
61
|
-
)
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
RadioGroup.displayName = 'RadioGroup';
|
|
65
|
-
|
|
66
|
-
/* ─── Individual Radio Item ─────────────────────────────────────────────────── */
|
|
67
|
-
|
|
68
|
-
export interface RadioItemProps {
|
|
69
|
-
label: string;
|
|
70
|
-
checked?: boolean;
|
|
71
|
-
onChange?: () => void;
|
|
72
|
-
inactive?: boolean;
|
|
73
|
-
className?: string;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export const RadioItem = forwardRef<HTMLDivElement, RadioItemProps>(
|
|
77
|
-
({ label, checked = false, onChange, inactive = false, className }, ref) => {
|
|
78
|
-
const handleClick = () => {
|
|
79
|
-
if (!inactive && !checked) onChange?.();
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<div
|
|
84
|
-
ref={ref}
|
|
85
|
-
role="radio"
|
|
86
|
-
aria-checked={checked}
|
|
87
|
-
tabIndex={inactive ? -1 : 0}
|
|
88
|
-
className={cn(styles.radio, inactive && styles.inactive, className)}
|
|
89
|
-
onClick={handleClick}
|
|
90
|
-
onKeyDown={e => {
|
|
91
|
-
if (e.key === ' ' || e.key === 'Enter') {
|
|
92
|
-
e.preventDefault();
|
|
93
|
-
handleClick();
|
|
94
|
-
}
|
|
95
|
-
}}
|
|
96
|
-
>
|
|
97
|
-
<span className={cn(styles.circle, checked && styles.circleChecked)}>
|
|
98
|
-
{checked && <span className={styles.dot} />}
|
|
99
|
-
</span>
|
|
100
|
-
<Text variant="text-body-medium" as="span" color="inherit">
|
|
101
|
-
{label}
|
|
102
|
-
</Text>
|
|
103
|
-
</div>
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
RadioItem.displayName = 'RadioItem';
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
position: relative;
|
|
3
|
-
width: 100%;
|
|
4
|
-
height: 100%;
|
|
5
|
-
overflow: hidden;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.content {
|
|
9
|
-
width: 100%;
|
|
10
|
-
height: 100%;
|
|
11
|
-
min-height: 0;
|
|
12
|
-
overflow-y: auto;
|
|
13
|
-
overflow-x: auto;
|
|
14
|
-
scrollbar-width: none;
|
|
15
|
-
-ms-overflow-style: none;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.content::-webkit-scrollbar { display: none; }
|
|
19
|
-
|
|
20
|
-
.track {
|
|
21
|
-
position: absolute;
|
|
22
|
-
top: 0; right: 0; bottom: 0;
|
|
23
|
-
width: var(--dimension-size-050, 4px);
|
|
24
|
-
pointer-events: none;
|
|
25
|
-
z-index: 10;
|
|
26
|
-
opacity: 0;
|
|
27
|
-
transition: opacity var(--effect-motion-short-2);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.container[data-show-track='true'] .track {
|
|
31
|
-
opacity: 1;
|
|
32
|
-
pointer-events: auto;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.thumb {
|
|
36
|
-
position: absolute;
|
|
37
|
-
right: 0;
|
|
38
|
-
width: var(--dimension-size-050, 4px);
|
|
39
|
-
cursor: grab;
|
|
40
|
-
border-radius: 0;
|
|
41
|
-
background-color: var(--color-foreground-quaternary);
|
|
42
|
-
transition: background-color var(--effect-motion-short-2);
|
|
43
|
-
-webkit-user-select: none;
|
|
44
|
-
user-select: none;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.thumb:active { cursor: grabbing; }
|
|
48
|
-
|
|
49
|
-
.trackHorizontal {
|
|
50
|
-
position: absolute;
|
|
51
|
-
left: 0; right: 0; bottom: 0;
|
|
52
|
-
height: var(--dimension-size-050, 4px);
|
|
53
|
-
pointer-events: none;
|
|
54
|
-
z-index: 10;
|
|
55
|
-
opacity: 0;
|
|
56
|
-
transition: opacity var(--effect-motion-short-2);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.container[data-show-track='true'] .trackHorizontal {
|
|
60
|
-
opacity: 1;
|
|
61
|
-
pointer-events: auto;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.thumbHorizontal {
|
|
65
|
-
position: absolute;
|
|
66
|
-
bottom: 0;
|
|
67
|
-
height: var(--dimension-size-050, 4px);
|
|
68
|
-
cursor: grab;
|
|
69
|
-
border-radius: 0;
|
|
70
|
-
background-color: var(--color-foreground-quaternary);
|
|
71
|
-
transition: background-color var(--effect-motion-short-2);
|
|
72
|
-
-webkit-user-select: none;
|
|
73
|
-
user-select: none;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.thumbHorizontal:active { cursor: grabbing; }
|
|
77
|
-
|
|
78
|
-
.thick .track { width: var(--dimension-size-100, 8px); }
|
|
79
|
-
.thick .thumb { width: var(--dimension-size-100, 8px); }
|
|
80
|
-
.thick .trackHorizontal { height: var(--dimension-size-100, 8px); }
|
|
81
|
-
.thick .thumbHorizontal { height: var(--dimension-size-100, 8px); }
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { Scrollbar } from './Scrollbar';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof Scrollbar> = {
|
|
5
|
-
title: 'Layout/Scrollbar',
|
|
6
|
-
component: Scrollbar,
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export default meta;
|
|
10
|
-
type Story = StoryObj<typeof Scrollbar>;
|
|
11
|
-
|
|
12
|
-
const longContent = Array.from({ length: 30 }, (_, i) => (
|
|
13
|
-
<div key={i} style={{ padding: '8px 12px', borderBottom: '1px solid var(--color-border-tertiary)' }}>
|
|
14
|
-
Item {i + 1}
|
|
15
|
-
</div>
|
|
16
|
-
));
|
|
17
|
-
|
|
18
|
-
export const Default: Story = {
|
|
19
|
-
render: () => (
|
|
20
|
-
<div style={{ height: 300, width: 260, padding: 24 }}>
|
|
21
|
-
<Scrollbar>
|
|
22
|
-
{longContent}
|
|
23
|
-
</Scrollbar>
|
|
24
|
-
</div>
|
|
25
|
-
),
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const Thick: Story = {
|
|
29
|
-
render: () => (
|
|
30
|
-
<div style={{ height: 300, width: 260, padding: 24 }}>
|
|
31
|
-
<Scrollbar variant="thick">
|
|
32
|
-
{longContent}
|
|
33
|
-
</Scrollbar>
|
|
34
|
-
</div>
|
|
35
|
-
),
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const ShowTrackOnHover: Story = {
|
|
39
|
-
render: () => (
|
|
40
|
-
<div style={{ height: 300, width: 260, padding: 24 }}>
|
|
41
|
-
<Scrollbar showTrackOnHover>
|
|
42
|
-
{longContent}
|
|
43
|
-
</Scrollbar>
|
|
44
|
-
</div>
|
|
45
|
-
),
|
|
46
|
-
};
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useEffect, useState, useCallback } from 'react';
|
|
2
|
-
import { cn } from '@/utils/cn';
|
|
3
|
-
import styles from './Scrollbar.module.css';
|
|
4
|
-
|
|
5
|
-
export type ScrollbarVariant = 'default' | 'thick';
|
|
6
|
-
|
|
7
|
-
export interface ScrollbarProps {
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
className?: string;
|
|
10
|
-
variant?: ScrollbarVariant;
|
|
11
|
-
showTrackOnHover?: boolean;
|
|
12
|
-
onScroll?: (e: React.UIEvent<HTMLDivElement>) => void;
|
|
13
|
-
fadeOverlay?: React.ReactNode;
|
|
14
|
-
contentRef?: React.RefObject<HTMLDivElement>;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const Scrollbar: React.FC<ScrollbarProps> = ({
|
|
18
|
-
children,
|
|
19
|
-
className,
|
|
20
|
-
variant = 'default',
|
|
21
|
-
showTrackOnHover = true,
|
|
22
|
-
onScroll,
|
|
23
|
-
fadeOverlay,
|
|
24
|
-
contentRef: externalContentRef,
|
|
25
|
-
}) => {
|
|
26
|
-
const containerRef = useRef<HTMLDivElement>(null);
|
|
27
|
-
const internalContentRef = useRef<HTMLDivElement>(null);
|
|
28
|
-
const contentRef = externalContentRef || internalContentRef;
|
|
29
|
-
const thumbRef = useRef<HTMLDivElement>(null);
|
|
30
|
-
const thumbHRef = useRef<HTMLDivElement>(null);
|
|
31
|
-
const [thumbHeight, setThumbHeight] = useState(0);
|
|
32
|
-
const [thumbTop, setThumbTop] = useState(0);
|
|
33
|
-
const [thumbWidth, setThumbWidth] = useState(0);
|
|
34
|
-
const [thumbLeft, setThumbLeft] = useState(0);
|
|
35
|
-
const [isDragging, setIsDragging] = useState(false);
|
|
36
|
-
const [isDraggingH, setIsDraggingH] = useState(false);
|
|
37
|
-
const [isPointerInside, setIsPointerInside] = useState(false);
|
|
38
|
-
const dragStartY = useRef(0);
|
|
39
|
-
const dragStartScrollTop = useRef(0);
|
|
40
|
-
const dragStartX = useRef(0);
|
|
41
|
-
const dragStartScrollLeft = useRef(0);
|
|
42
|
-
|
|
43
|
-
const handleMouseEnter = useCallback(() => {
|
|
44
|
-
if (showTrackOnHover) setIsPointerInside(true);
|
|
45
|
-
}, [showTrackOnHover]);
|
|
46
|
-
|
|
47
|
-
const handleMouseLeave = useCallback(() => {
|
|
48
|
-
setIsPointerInside(false);
|
|
49
|
-
}, []);
|
|
50
|
-
|
|
51
|
-
const updateThumb = useCallback(() => {
|
|
52
|
-
const container = containerRef.current;
|
|
53
|
-
const content = contentRef.current;
|
|
54
|
-
if (!container || !content) return;
|
|
55
|
-
|
|
56
|
-
const containerHeight = container.clientHeight;
|
|
57
|
-
const containerWidth = container.clientWidth;
|
|
58
|
-
const contentHeight = content.scrollHeight;
|
|
59
|
-
const contentWidth = content.scrollWidth;
|
|
60
|
-
const scrollTop = content.scrollTop;
|
|
61
|
-
const scrollLeft = content.scrollLeft;
|
|
62
|
-
|
|
63
|
-
if (contentHeight <= containerHeight) {
|
|
64
|
-
setThumbHeight(0);
|
|
65
|
-
} else {
|
|
66
|
-
const ratio = containerHeight / contentHeight;
|
|
67
|
-
const h = Math.max(20, containerHeight * ratio);
|
|
68
|
-
setThumbHeight(h);
|
|
69
|
-
setThumbTop((scrollTop / (contentHeight - containerHeight)) * (containerHeight - h));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (contentWidth <= containerWidth) {
|
|
73
|
-
setThumbWidth(0);
|
|
74
|
-
} else {
|
|
75
|
-
const ratio = containerWidth / contentWidth;
|
|
76
|
-
const w = Math.max(20, containerWidth * ratio);
|
|
77
|
-
setThumbWidth(w);
|
|
78
|
-
setThumbLeft((scrollLeft / (contentWidth - containerWidth)) * (containerWidth - w));
|
|
79
|
-
}
|
|
80
|
-
}, [contentRef]);
|
|
81
|
-
|
|
82
|
-
useEffect(() => {
|
|
83
|
-
const content = contentRef.current;
|
|
84
|
-
if (!content) return;
|
|
85
|
-
const handleScroll = (e: Event) => {
|
|
86
|
-
updateThumb();
|
|
87
|
-
if (onScroll) onScroll(e as unknown as React.UIEvent<HTMLDivElement>);
|
|
88
|
-
};
|
|
89
|
-
content.addEventListener('scroll', handleScroll);
|
|
90
|
-
return () => content.removeEventListener('scroll', handleScroll);
|
|
91
|
-
}, [updateThumb, onScroll, contentRef]);
|
|
92
|
-
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
const content = contentRef.current;
|
|
95
|
-
if (!content) return;
|
|
96
|
-
const handleResize = () => updateThumb();
|
|
97
|
-
window.addEventListener('resize', handleResize);
|
|
98
|
-
if (typeof ResizeObserver !== 'undefined') {
|
|
99
|
-
const observer = new ResizeObserver(handleResize);
|
|
100
|
-
observer.observe(content);
|
|
101
|
-
return () => { window.removeEventListener('resize', handleResize); observer.disconnect(); };
|
|
102
|
-
}
|
|
103
|
-
return () => window.removeEventListener('resize', handleResize);
|
|
104
|
-
}, [updateThumb, contentRef]);
|
|
105
|
-
|
|
106
|
-
useEffect(() => { updateThumb(); }, [updateThumb, children]);
|
|
107
|
-
|
|
108
|
-
const handleThumbMouseDown = useCallback((e: React.MouseEvent) => {
|
|
109
|
-
e.preventDefault();
|
|
110
|
-
e.stopPropagation();
|
|
111
|
-
const content = contentRef.current;
|
|
112
|
-
if (!content) return;
|
|
113
|
-
setIsDragging(true);
|
|
114
|
-
dragStartY.current = e.clientY;
|
|
115
|
-
dragStartScrollTop.current = content.scrollTop;
|
|
116
|
-
const handleMouseMove = (e: MouseEvent) => {
|
|
117
|
-
const container = containerRef.current;
|
|
118
|
-
if (!container || !content) return;
|
|
119
|
-
const deltaY = e.clientY - dragStartY.current;
|
|
120
|
-
const scrollableHeight = content.scrollHeight - container.clientHeight;
|
|
121
|
-
const scrollRatio = scrollableHeight / (container.clientHeight - thumbHeight);
|
|
122
|
-
content.scrollTop = Math.max(0, Math.min(scrollableHeight, dragStartScrollTop.current + deltaY * scrollRatio));
|
|
123
|
-
};
|
|
124
|
-
const handleMouseUp = () => {
|
|
125
|
-
setIsDragging(false);
|
|
126
|
-
document.removeEventListener('mousemove', handleMouseMove);
|
|
127
|
-
document.removeEventListener('mouseup', handleMouseUp);
|
|
128
|
-
};
|
|
129
|
-
document.addEventListener('mousemove', handleMouseMove);
|
|
130
|
-
document.addEventListener('mouseup', handleMouseUp);
|
|
131
|
-
}, [thumbHeight, contentRef]);
|
|
132
|
-
|
|
133
|
-
const handleThumbHMouseDown = useCallback((e: React.MouseEvent) => {
|
|
134
|
-
e.preventDefault();
|
|
135
|
-
e.stopPropagation();
|
|
136
|
-
const content = contentRef.current;
|
|
137
|
-
if (!content) return;
|
|
138
|
-
setIsDraggingH(true);
|
|
139
|
-
dragStartX.current = e.clientX;
|
|
140
|
-
dragStartScrollLeft.current = content.scrollLeft;
|
|
141
|
-
const handleMouseMove = (e: MouseEvent) => {
|
|
142
|
-
const container = containerRef.current;
|
|
143
|
-
if (!container || !content) return;
|
|
144
|
-
const deltaX = e.clientX - dragStartX.current;
|
|
145
|
-
const scrollableWidth = content.scrollWidth - container.clientWidth;
|
|
146
|
-
const scrollRatio = scrollableWidth / (container.clientWidth - thumbWidth);
|
|
147
|
-
content.scrollLeft = Math.max(0, Math.min(scrollableWidth, dragStartScrollLeft.current + deltaX * scrollRatio));
|
|
148
|
-
};
|
|
149
|
-
const handleMouseUp = () => {
|
|
150
|
-
setIsDraggingH(false);
|
|
151
|
-
document.removeEventListener('mousemove', handleMouseMove);
|
|
152
|
-
document.removeEventListener('mouseup', handleMouseUp);
|
|
153
|
-
};
|
|
154
|
-
document.addEventListener('mousemove', handleMouseMove);
|
|
155
|
-
document.addEventListener('mouseup', handleMouseUp);
|
|
156
|
-
}, [thumbWidth, contentRef]);
|
|
157
|
-
|
|
158
|
-
const showThumb = thumbHeight > 0;
|
|
159
|
-
const showThumbH = thumbWidth > 0;
|
|
160
|
-
const showTrack = showTrackOnHover && (isPointerInside || isDragging || isDraggingH);
|
|
161
|
-
|
|
162
|
-
return (
|
|
163
|
-
<div
|
|
164
|
-
ref={containerRef}
|
|
165
|
-
className={cn(styles.container, variant === 'thick' && styles.thick, className)}
|
|
166
|
-
onMouseEnter={handleMouseEnter}
|
|
167
|
-
onMouseLeave={handleMouseLeave}
|
|
168
|
-
data-dragging={isDragging || isDraggingH}
|
|
169
|
-
data-show-track={showTrack ? 'true' : 'false'}
|
|
170
|
-
>
|
|
171
|
-
<div ref={contentRef} className={styles.content}>{children}</div>
|
|
172
|
-
{fadeOverlay}
|
|
173
|
-
{showThumb && (
|
|
174
|
-
<div className={styles.track}>
|
|
175
|
-
<div ref={thumbRef} className={styles.thumb} style={{ height: `${thumbHeight}px`, top: `${thumbTop}px` }} onMouseDown={handleThumbMouseDown} />
|
|
176
|
-
</div>
|
|
177
|
-
)}
|
|
178
|
-
{showThumbH && (
|
|
179
|
-
<div className={styles.trackHorizontal}>
|
|
180
|
-
<div ref={thumbHRef} className={styles.thumbHorizontal} style={{ width: `${thumbWidth}px`, left: `${thumbLeft}px` }} onMouseDown={handleThumbHMouseDown} />
|
|
181
|
-
</div>
|
|
182
|
-
)}
|
|
183
|
-
</div>
|
|
184
|
-
);
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
Scrollbar.displayName = 'Scrollbar';
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
.selectWrapper {
|
|
2
|
-
width: 100%;
|
|
3
|
-
position: relative;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.selectButton {
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
justify-content: space-between;
|
|
10
|
-
width: 100%;
|
|
11
|
-
height: var(--dimension-size-400);
|
|
12
|
-
padding: 0 var(--dimension-space-075);
|
|
13
|
-
gap: var(--dimension-space-050);
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
-webkit-user-select: none;
|
|
16
|
-
user-select: none;
|
|
17
|
-
border: none;
|
|
18
|
-
outline: none;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.selectButton:disabled {
|
|
22
|
-
opacity: 0.5;
|
|
23
|
-
cursor: not-allowed;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.chevron {
|
|
27
|
-
display: flex;
|
|
28
|
-
align-items: center;
|
|
29
|
-
color: var(--color-foreground-secondary);
|
|
30
|
-
flex-shrink: 0;
|
|
31
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
|
-
import { Select } from './Select';
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof Select> = {
|
|
6
|
-
title: 'Components/Select',
|
|
7
|
-
component: Select,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export default meta;
|
|
11
|
-
type Story = StoryObj<typeof Select>;
|
|
12
|
-
|
|
13
|
-
const fruitOptions = [
|
|
14
|
-
{ value: 'apple', label: 'Apple' },
|
|
15
|
-
{ value: 'banana', label: 'Banana' },
|
|
16
|
-
{ value: 'cherry', label: 'Cherry' },
|
|
17
|
-
{ value: 'date', label: 'Date' },
|
|
18
|
-
{ value: 'elderberry', label: 'Elderberry' },
|
|
19
|
-
];
|
|
20
|
-
|
|
21
|
-
export const Default: Story = {
|
|
22
|
-
render: () => {
|
|
23
|
-
const [value, setValue] = useState<string | number>('');
|
|
24
|
-
return (
|
|
25
|
-
<div style={{ width: 260, padding: 24 }}>
|
|
26
|
-
<Select
|
|
27
|
-
value={value}
|
|
28
|
-
onChange={setValue}
|
|
29
|
-
options={fruitOptions}
|
|
30
|
-
placeholder="Select a fruit"
|
|
31
|
-
/>
|
|
32
|
-
</div>
|
|
33
|
-
);
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const WithValue: Story = {
|
|
38
|
-
render: () => {
|
|
39
|
-
const [value, setValue] = useState<string | number>('cherry');
|
|
40
|
-
return (
|
|
41
|
-
<div style={{ width: 260, padding: 24 }}>
|
|
42
|
-
<Select value={value} onChange={setValue} options={fruitOptions} />
|
|
43
|
-
</div>
|
|
44
|
-
);
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const Inactive: Story = {
|
|
49
|
-
render: () => (
|
|
50
|
-
<div style={{ width: 260, padding: 24 }}>
|
|
51
|
-
<Select
|
|
52
|
-
value="banana"
|
|
53
|
-
onChange={() => {}}
|
|
54
|
-
options={fruitOptions}
|
|
55
|
-
inactive
|
|
56
|
-
/>
|
|
57
|
-
</div>
|
|
58
|
-
),
|
|
59
|
-
};
|