@dbcdk/react-components 0.0.95 → 0.0.97
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/alert/Alert.d.ts +13 -0
- package/dist/components/forms/input/Input.d.ts +2 -1
- package/dist/components/forms/input-container/InputContainer.d.ts +3 -1
- package/dist/components/forms/text-area/Textarea.d.ts +1 -1
- package/dist/components/stack/Stack.d.ts +11 -3
- package/dist/components/table/Table.d.ts +1 -1
- package/dist/components/table/Table.types.d.ts +3 -0
- package/dist/components/table/components/TableHeader.d.ts +2 -1
- package/dist/index.cjs +12750 -0
- package/dist/index.css +7149 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +12641 -78
- package/dist/tanstack.cjs +2674 -0
- package/dist/tanstack.css +1267 -0
- package/dist/tanstack.js +2650 -3
- package/dist/themes/dbc.css +3 -0
- package/dist/themes/forfatterweb.css +2 -0
- package/package.json +11 -10
- package/dist/assets/logo.js +0 -2
- package/dist/components/__stories__/_data/table.d.ts +0 -15
- package/dist/components/__stories__/_data/table.js +0 -55
- package/dist/components/__stories__/_data/tabs.d.ts +0 -9
- package/dist/components/__stories__/_data/tabs.js +0 -31
- package/dist/components/__stories__/story-components/Colors.d.ts +0 -11
- package/dist/components/__stories__/story-components/Colors.js +0 -96
- package/dist/components/__stories__/story-components/Colors.module.css +0 -27
- package/dist/components/__stories__/story-components/ComponentSizes.d.ts +0 -2
- package/dist/components/__stories__/story-components/ComponentSizes.js +0 -26
- package/dist/components/__stories__/story-components/Elevation.d.ts +0 -2
- package/dist/components/__stories__/story-components/Elevation.js +0 -49
- package/dist/components/__stories__/story-components/Flex.d.ts +0 -2
- package/dist/components/__stories__/story-components/Flex.js +0 -177
- package/dist/components/__stories__/story-components/Flex.module.css +0 -317
- package/dist/components/__stories__/story-components/Spacing.d.ts +0 -6
- package/dist/components/__stories__/story-components/Spacing.js +0 -76
- package/dist/components/__stories__/story-components/Spacing.module.css +0 -154
- package/dist/components/accordion/Accordion.js +0 -70
- package/dist/components/accordion/Accordion.module.css +0 -28
- package/dist/components/accordion/components/AccordionRow.js +0 -53
- package/dist/components/accordion/components/AccordionRow.module.css +0 -90
- package/dist/components/app-header/AppHeader.js +0 -5
- package/dist/components/app-header/AppHeader.module.css +0 -74
- package/dist/components/attribute-chip/AttributeChip.js +0 -5
- package/dist/components/attribute-chip/AttributeChip.module.css +0 -65
- package/dist/components/avatar/Avatar.js +0 -48
- package/dist/components/avatar/Avatar.module.css +0 -91
- package/dist/components/breadcrumbs/Breadcrumbs.js +0 -6
- package/dist/components/breadcrumbs/Breadcrumbs.module.css +0 -80
- package/dist/components/button/Button.js +0 -81
- package/dist/components/button/Button.module.css +0 -249
- package/dist/components/button-select/ButtonSelect.js +0 -7
- package/dist/components/button-select/ButtonSelect.module.css +0 -40
- package/dist/components/card/Card.js +0 -71
- package/dist/components/card/Card.module.css +0 -160
- package/dist/components/card/components/CardMeta.js +0 -26
- package/dist/components/card/components/CardMeta.module.css +0 -55
- package/dist/components/card-container/CardContainer.js +0 -6
- package/dist/components/card-container/CardContainer.module.css +0 -61
- package/dist/components/chip/Chip.js +0 -31
- package/dist/components/chip/Chip.module.css +0 -236
- package/dist/components/circle/Circle.js +0 -5
- package/dist/components/circle/Circle.module.css +0 -128
- package/dist/components/clear-button/ClearButton.js +0 -13
- package/dist/components/clear-button/ClearButton.module.css +0 -26
- package/dist/components/code-block/CodeBlock.js +0 -58
- package/dist/components/code-block/CodeBlock.module.css +0 -124
- package/dist/components/copy-button/CopyButton.js +0 -78
- package/dist/components/copy-button/CopyButton.module.css +0 -22
- package/dist/components/datetime-picker/DateTimePicker.js +0 -403
- package/dist/components/datetime-picker/DateTimePicker.module.css +0 -155
- package/dist/components/datetime-picker/dateTimeHelpers.js +0 -248
- package/dist/components/divider/Divider.js +0 -12
- package/dist/components/filter-field/FilterField.js +0 -191
- package/dist/components/filter-field/FilterField.module.css +0 -379
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.js +0 -52
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.module.css +0 -59
- package/dist/components/forms/checkbox/Checkbox.js +0 -26
- package/dist/components/forms/checkbox/Checkbox.module.css +0 -99
- package/dist/components/forms/checkbox-group/CheckboxGroup.js +0 -75
- package/dist/components/forms/checkbox-group/CheckboxGroup.module.css +0 -115
- package/dist/components/forms/form-select/FormSelect.js +0 -86
- package/dist/components/forms/form-select/FormSelect.module.css +0 -236
- package/dist/components/forms/input/Input.js +0 -77
- package/dist/components/forms/input/Input.module.css +0 -468
- package/dist/components/forms/input-container/InputContainer.js +0 -15
- package/dist/components/forms/input-container/InputContainer.module.css +0 -56
- package/dist/components/forms/multi-select/MultiSelect.js +0 -122
- package/dist/components/forms/radio-buttons/RadioButton.js +0 -26
- package/dist/components/forms/radio-buttons/RadioButtonGroup.js +0 -19
- package/dist/components/forms/radio-buttons/RadioButtons.module.css +0 -118
- package/dist/components/forms/select/Select.js +0 -185
- package/dist/components/forms/select/Select.module.css +0 -32
- package/dist/components/forms/text-area/Textarea.js +0 -47
- package/dist/components/forms/text-area/Textarea.module.css +0 -70
- package/dist/components/forms/typeahead/Typeahead.js +0 -668
- package/dist/components/forms/typeahead/Typeahead.module.css +0 -38
- package/dist/components/grid/Grid.js +0 -23
- package/dist/components/grid/Grid.module.css +0 -35
- package/dist/components/headline/CollapsibleHeadline.js +0 -29
- package/dist/components/headline/Headline.js +0 -26
- package/dist/components/headline/Headline.module.css +0 -165
- package/dist/components/hyperlink/Hyperlink.js +0 -40
- package/dist/components/hyperlink/Hyperlink.module.css +0 -107
- package/dist/components/icon/Icon.js +0 -14
- package/dist/components/icon/Icon.module.css +0 -36
- package/dist/components/interval-select/IntervalSelect.js +0 -99
- package/dist/components/json-viewer/HighlightedText.js +0 -6
- package/dist/components/json-viewer/JsonNode.js +0 -30
- package/dist/components/json-viewer/JsonViewer.js +0 -68
- package/dist/components/json-viewer/JsonViewer.module.css +0 -346
- package/dist/components/json-viewer/types.js +0 -1
- package/dist/components/json-viewer/useClipboardStatus.js +0 -11
- package/dist/components/json-viewer/utils.js +0 -125
- package/dist/components/menu/Menu.js +0 -165
- package/dist/components/menu/Menu.module.css +0 -211
- package/dist/components/meta-bar/MetaBar.js +0 -9
- package/dist/components/meta-bar/MetaBar.module.css +0 -27
- package/dist/components/nav-bar/NavBar.js +0 -29
- package/dist/components/nav-bar/NavBar.module.css +0 -200
- package/dist/components/overlay/fade-overlay/FadeOverlay.js +0 -8
- package/dist/components/overlay/fade-overlay/FadeOverlay.module.css +0 -54
- package/dist/components/overlay/modal/Modal.js +0 -115
- package/dist/components/overlay/modal/Modal.module.css +0 -109
- package/dist/components/overlay/modal/provider/ModalProvider.js +0 -73
- package/dist/components/overlay/side-panel/SidePanel.js +0 -83
- package/dist/components/overlay/side-panel/SidePanel.module.css +0 -177
- package/dist/components/overlay/side-panel/useSidePanel.js +0 -11
- package/dist/components/overlay/tooltip/Tooltip.js +0 -17
- package/dist/components/overlay/tooltip/Tooltip.module.css +0 -104
- package/dist/components/overlay/tooltip/TooltipProvider.js +0 -255
- package/dist/components/overlay/tooltip/useTooltipTrigger.js +0 -118
- package/dist/components/page/Page.js +0 -11
- package/dist/components/page/Page.module.css +0 -76
- package/dist/components/page-layout/PageLayout.js +0 -76
- package/dist/components/page-layout/PageLayout.module.css +0 -236
- package/dist/components/page-layout/components/layout-footer/LayoutFooter.js +0 -27
- package/dist/components/page-layout/components/layout-footer/LayoutFooter.module.css +0 -89
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.js +0 -14
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.module.css +0 -84
- package/dist/components/pagination/Pagination.js +0 -56
- package/dist/components/pagination/Pagination.module.css +0 -25
- package/dist/components/panel/Panel.js +0 -7
- package/dist/components/panel/Panel.module.css +0 -29
- package/dist/components/popover/Popover.js +0 -257
- package/dist/components/popover/Popover.module.css +0 -54
- package/dist/components/search-box/SearchBox.js +0 -170
- package/dist/components/search-box/SearchBox.module.css +0 -21
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.js +0 -48
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.module.css +0 -167
- package/dist/components/sidebar/Sidebar.js +0 -6
- package/dist/components/sidebar/components/SidebarItem.js +0 -8
- package/dist/components/sidebar/components/SidebarItem.module.css +0 -0
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +0 -63
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css +0 -29
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +0 -153
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.module.css +0 -260
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +0 -18
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css +0 -106
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +0 -26
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.module.css +0 -20
- package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.js +0 -30
- package/dist/components/sidebar/providers/SidebarProvider.js +0 -229
- package/dist/components/skeleton-loader/SkeletonLoader.js +0 -73
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.js +0 -13
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.module.css +0 -51
- package/dist/components/split-button/SplitButton.js +0 -10
- package/dist/components/split-button/SplitButton.module.css +0 -32
- package/dist/components/split-pane/SplitPane.js +0 -107
- package/dist/components/split-pane/SplitPane.module.css +0 -111
- package/dist/components/split-pane/provider/SplitPaneContext.js +0 -124
- package/dist/components/stack/Stack.js +0 -19
- package/dist/components/state-page/StatePage.js +0 -20
- package/dist/components/state-page/StatePage.module.css +0 -9
- package/dist/components/state-page/empty.js +0 -2
- package/dist/components/state-page/error.js +0 -2
- package/dist/components/state-page/notFound.js +0 -2
- package/dist/components/sticky-footer-layout/StickyFooterLayout.js +0 -64
- package/dist/components/table/Table.js +0 -50
- package/dist/components/table/Table.module.css +0 -536
- package/dist/components/table/Table.types.js +0 -1
- package/dist/components/table/TanstackTable.js +0 -111
- package/dist/components/table/components/TableBody.js +0 -10
- package/dist/components/table/components/TableHeader.js +0 -7
- package/dist/components/table/components/TableHeaderCell.js +0 -24
- package/dist/components/table/components/TableLoadingBody.js +0 -26
- package/dist/components/table/components/TablePagination.js +0 -1
- package/dist/components/table/components/TableRow.js +0 -54
- package/dist/components/table/components/TableSelectionCell.js +0 -16
- package/dist/components/table/components/column-resizer/ColumnResizer.js +0 -5
- package/dist/components/table/components/column-resizer/ColumnResizer.module.css +0 -22
- package/dist/components/table/components/empty-state/EmptyState.js +0 -23
- package/dist/components/table/components/empty-state/EmptyState.module.css +0 -4
- package/dist/components/table/components/table-settings/TableSettings.js +0 -63
- package/dist/components/table/hooks/useTableRowInteractions.js +0 -30
- package/dist/components/table/table.classes.js +0 -23
- package/dist/components/table/table.utils.js +0 -47
- package/dist/components/table/tanstackTable.utils.js +0 -175
- package/dist/components/tabs/Tabs.js +0 -125
- package/dist/components/tabs/Tabs.module.css +0 -204
- package/dist/components/theme-button/ThemeButton.js +0 -23
- package/dist/components/toast/Toast.js +0 -20
- package/dist/components/toast/Toast.module.css +0 -161
- package/dist/components/toast/provider/ToastProvider.js +0 -70
- package/dist/components/user-display/UserDisplay.js +0 -6
- package/dist/components/user-display/UserDisplay.module.css +0 -25
- package/dist/constants/severity.js +0 -24
- package/dist/constants/severity.types.js +0 -1
- package/dist/constants/sizes.js +0 -7
- package/dist/hooks/useDeviceSize.js +0 -32
- package/dist/hooks/useListNavigation.js +0 -234
- package/dist/hooks/usePagination.js +0 -140
- package/dist/hooks/useSorting.js +0 -118
- package/dist/hooks/useTableData.js +0 -45
- package/dist/hooks/useTableSelection.js +0 -164
- package/dist/hooks/useTableSettings.js +0 -71
- package/dist/hooks/useTheme.js +0 -66
- package/dist/hooks/useTimeDuration.js +0 -68
- package/dist/hooks/useViewportFill.js +0 -77
- package/dist/styles/animation.js +0 -5
- package/dist/styles/themes/types.js +0 -1
- package/dist/types/a11y-props.types.js +0 -1
- package/dist/types/sizes.types.js +0 -1
- package/dist/utils/arrays/nested-filtering.js +0 -48
- package/dist/utils/date/formatDate.js +0 -51
- package/dist/utils/localStorage.utils.js +0 -78
- package/dist/utils/text/get-highlighted-segments.js +0 -46
|
@@ -1,468 +0,0 @@
|
|
|
1
|
-
/* Root control group */
|
|
2
|
-
.container {
|
|
3
|
-
display: inline-flex;
|
|
4
|
-
align-items: stretch;
|
|
5
|
-
flex-grow: 1;
|
|
6
|
-
gap: 0;
|
|
7
|
-
inline-size: var(--input-width, auto);
|
|
8
|
-
min-inline-size: var(--input-min-width, 0);
|
|
9
|
-
max-inline-size: var(--input-max-width, none);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/* When you want it to take available space */
|
|
13
|
-
.fullWidth {
|
|
14
|
-
display: flex;
|
|
15
|
-
inline-size: 100%;
|
|
16
|
-
min-inline-size: 0;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/* The "field" (input + icons + clear) */
|
|
20
|
-
.field {
|
|
21
|
-
position: relative;
|
|
22
|
-
display: flex;
|
|
23
|
-
align-items: center;
|
|
24
|
-
flex: 1 1 auto;
|
|
25
|
-
height: 100%;
|
|
26
|
-
min-inline-size: 0;
|
|
27
|
-
color: var(--color-fg-default);
|
|
28
|
-
background: var(--color-bg-surface);
|
|
29
|
-
border: var(--border-width-thin) solid var(--color-border-default);
|
|
30
|
-
border-radius: var(--border-radius-default);
|
|
31
|
-
box-sizing: border-box;
|
|
32
|
-
transition:
|
|
33
|
-
background-color var(--transition-fast) var(--ease-standard),
|
|
34
|
-
border-color var(--transition-fast) var(--ease-standard),
|
|
35
|
-
box-shadow var(--transition-fast) var(--ease-standard),
|
|
36
|
-
color var(--transition-fast) var(--ease-standard);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/* Actual input */
|
|
40
|
-
.input {
|
|
41
|
-
flex: 1 1 auto;
|
|
42
|
-
min-inline-size: 0;
|
|
43
|
-
inline-size: 100%;
|
|
44
|
-
box-sizing: border-box;
|
|
45
|
-
text-overflow: ellipsis;
|
|
46
|
-
color: var(--color-fg-default);
|
|
47
|
-
background: transparent;
|
|
48
|
-
font-family: var(--font-family);
|
|
49
|
-
font-size: var(--font-size-sm);
|
|
50
|
-
line-height: var(--line-height-normal);
|
|
51
|
-
border: none;
|
|
52
|
-
outline: none;
|
|
53
|
-
padding-inline: var(--spacing-sm);
|
|
54
|
-
padding-block: var(--spacing-xs);
|
|
55
|
-
margin: 0;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.input::placeholder {
|
|
59
|
-
color: var(--color-fg-subtle) !important;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.input:disabled {
|
|
63
|
-
background-color: transparent;
|
|
64
|
-
color: var(--color-disabled-fg);
|
|
65
|
-
cursor: not-allowed;
|
|
66
|
-
opacity: 1;
|
|
67
|
-
box-shadow: none;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/* Button group styling */
|
|
71
|
-
.withButton .field {
|
|
72
|
-
border-top-right-radius: 0;
|
|
73
|
-
border-bottom-right-radius: 0;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/*
|
|
77
|
-
When onClear exists, do not keep extra inline-end padding on the input itself.
|
|
78
|
-
The clear affordance already reserves the needed space via:
|
|
79
|
-
- the inline clearSlot inside endAdornment, or
|
|
80
|
-
- the absolute clear button path.
|
|
81
|
-
*/
|
|
82
|
-
.withClear .input {
|
|
83
|
-
padding-inline-end: 0;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/* When clear is inline with other end adornments, keep the input tight as well. */
|
|
87
|
-
.withInlineClear .input {
|
|
88
|
-
padding-inline-end: 0;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/* Global focus reset - variants own visible focus treatment */
|
|
92
|
-
.input:focus-visible {
|
|
93
|
-
outline: none;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/* =========================
|
|
97
|
-
Variants
|
|
98
|
-
========================= */
|
|
99
|
-
|
|
100
|
-
/* Stronger field chrome for forms/settings */
|
|
101
|
-
.outlined {
|
|
102
|
-
background-color: var(--color-bg-surface);
|
|
103
|
-
border-color: var(--color-border-default);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.outlined:hover:not([aria-disabled='true']) {
|
|
107
|
-
border-color: var(--color-border-strong);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.outlined:focus-within:not([aria-disabled='true']) {
|
|
111
|
-
border-color: var(--color-border-selected);
|
|
112
|
-
box-shadow: inset 0 0 0 1px var(--color-border-selected);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.surface {
|
|
116
|
-
background-color: var(--color-bg-surface);
|
|
117
|
-
border: 1px solid var(--color-border-subtle);
|
|
118
|
-
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.surface:hover:not([aria-disabled='true']) {
|
|
122
|
-
border-color: var(--color-border-default);
|
|
123
|
-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.surface:focus-within:not([aria-disabled='true']) {
|
|
127
|
-
border-color: var(--color-border-selected);
|
|
128
|
-
box-shadow: inset 0 0 0 1px var(--color-border-selected);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/* Old filled/tinted behavior, now renamed subtle */
|
|
132
|
-
.subtle {
|
|
133
|
-
background-color: var(--color-bg-toolbar);
|
|
134
|
-
border-color: transparent;
|
|
135
|
-
box-shadow: inset 0 0 0 1px transparent;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.subtle:hover:not([aria-disabled='true']) {
|
|
139
|
-
background-color: var(--color-bg-toolbar-hover);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.subtle:focus-within:not([aria-disabled='true']) {
|
|
143
|
-
border-color: var(--color-border-selected);
|
|
144
|
-
box-shadow: inset 0 0 0 1px var(--color-border-selected);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.embedded {
|
|
148
|
-
background-color: transparent;
|
|
149
|
-
border-color: transparent;
|
|
150
|
-
border-radius: 0;
|
|
151
|
-
box-shadow: none;
|
|
152
|
-
padding-block: 0;
|
|
153
|
-
block-size: 100%;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.embedded:hover:not([aria-disabled='true']),
|
|
157
|
-
.embedded:focus-within:not([aria-disabled='true']) {
|
|
158
|
-
background-color: transparent;
|
|
159
|
-
border-color: transparent;
|
|
160
|
-
box-shadow: none;
|
|
161
|
-
outline: none;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.standalone {
|
|
165
|
-
background-color: var(--color-bg-surface);
|
|
166
|
-
border-color: var(--color-border-subtle);
|
|
167
|
-
border-radius: var(--border-radius-rounded);
|
|
168
|
-
box-shadow: var(--shadow-xs), var(--shadow-sm);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
.standalone .input {
|
|
172
|
-
padding-inline: var(--spacing-md);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
.standalone:hover:not([aria-disabled='true']) {
|
|
176
|
-
border-color: var(--color-border-strong);
|
|
177
|
-
box-shadow: var(--shadow-sm), var(--shadow-md);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
.standalone:focus-within:not([aria-disabled='true']) {
|
|
181
|
-
border-color: var(--color-border-selected);
|
|
182
|
-
box-shadow:
|
|
183
|
-
var(--shadow-xs),
|
|
184
|
-
var(--shadow-md),
|
|
185
|
-
inset 0 0 0 1px var(--color-border-selected);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/* =========================
|
|
189
|
-
Modified state
|
|
190
|
-
========================= */
|
|
191
|
-
|
|
192
|
-
.modified {
|
|
193
|
-
background-color: color-mix(in srgb, var(--color-status-warning-bg) 22%, var(--color-bg-surface));
|
|
194
|
-
border-color: color-mix(
|
|
195
|
-
in srgb,
|
|
196
|
-
var(--color-status-warning-border) 45%,
|
|
197
|
-
var(--color-border-default)
|
|
198
|
-
);
|
|
199
|
-
border-left-color: var(--color-status-warning-border);
|
|
200
|
-
border-left-width: 4px;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/* Hover should stay warm, not switch back to the normal border */
|
|
204
|
-
.modified:hover:not([aria-disabled='true']) {
|
|
205
|
-
background-color: color-mix(in srgb, var(--color-status-warning-bg) 28%, var(--color-bg-surface));
|
|
206
|
-
border-color: color-mix(
|
|
207
|
-
in srgb,
|
|
208
|
-
var(--color-status-warning-border) 60%,
|
|
209
|
-
var(--color-border-default)
|
|
210
|
-
);
|
|
211
|
-
border-left-color: var(--color-status-warning-border);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/* Focus should also stay warm and readable */
|
|
215
|
-
.modified:focus-within:not([aria-disabled='true']) {
|
|
216
|
-
background-color: color-mix(in srgb, var(--color-status-warning-bg) 28%, var(--color-bg-surface));
|
|
217
|
-
border-color: color-mix(
|
|
218
|
-
in srgb,
|
|
219
|
-
var(--color-status-warning-border) 75%,
|
|
220
|
-
var(--color-border-default)
|
|
221
|
-
);
|
|
222
|
-
border-left-color: var(--color-status-warning-border);
|
|
223
|
-
box-shadow: inset 0 0 0 1px
|
|
224
|
-
color-mix(in srgb, var(--color-status-warning-border) 55%, var(--color-border-default));
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/* Variant-specific tweaks when modified */
|
|
228
|
-
.surface.modified {
|
|
229
|
-
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
.surface.modified:hover:not([aria-disabled='true']) {
|
|
233
|
-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
.surface.modified:focus-within:not([aria-disabled='true']) {
|
|
237
|
-
box-shadow: inset 0 0 0 1px
|
|
238
|
-
color-mix(in srgb, var(--color-status-warning-border) 55%, var(--color-border-default));
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
.subtle.modified {
|
|
242
|
-
background-color: color-mix(in srgb, var(--color-status-warning-bg) 30%, var(--color-bg-toolbar));
|
|
243
|
-
border-color: transparent;
|
|
244
|
-
border-left-color: var(--color-status-warning-border);
|
|
245
|
-
border-left-width: 4px;
|
|
246
|
-
box-shadow: none;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
.subtle.modified:hover:not([aria-disabled='true']) {
|
|
250
|
-
background-color: color-mix(
|
|
251
|
-
in srgb,
|
|
252
|
-
var(--color-status-warning-bg) 36%,
|
|
253
|
-
var(--color-bg-toolbar-hover)
|
|
254
|
-
);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
.subtle.modified:focus-within:not([aria-disabled='true']) {
|
|
258
|
-
border-color: color-mix(
|
|
259
|
-
in srgb,
|
|
260
|
-
var(--color-status-warning-border) 75%,
|
|
261
|
-
var(--color-border-default)
|
|
262
|
-
);
|
|
263
|
-
border-left-color: var(--color-status-warning-border);
|
|
264
|
-
box-shadow: inset 0 0 0 1px
|
|
265
|
-
color-mix(in srgb, var(--color-status-warning-border) 55%, var(--color-border-default));
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
.standalone.modified {
|
|
269
|
-
box-shadow: var(--shadow-xs), var(--shadow-md);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
.standalone.modified:hover:not([aria-disabled='true']) {
|
|
273
|
-
box-shadow: var(--shadow-sm), var(--shadow-md);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
.standalone.modified:focus-within:not([aria-disabled='true']) {
|
|
277
|
-
box-shadow:
|
|
278
|
-
var(--shadow-xs),
|
|
279
|
-
var(--shadow-md),
|
|
280
|
-
inset 0 0 0 1px
|
|
281
|
-
color-mix(in srgb, var(--color-status-warning-border) 55%, var(--color-border-default));
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/* Embedded should stay visually light, but can still get the marker */
|
|
285
|
-
.embedded.modified {
|
|
286
|
-
background-color: color-mix(in srgb, var(--color-status-warning-bg) 18%, transparent);
|
|
287
|
-
border-color: transparent;
|
|
288
|
-
border-left-color: var(--color-status-warning-border);
|
|
289
|
-
border-left-width: 3px;
|
|
290
|
-
box-shadow: none;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
.embedded.modified:hover:not([aria-disabled='true']),
|
|
294
|
-
.embedded.modified:focus-within:not([aria-disabled='true']) {
|
|
295
|
-
background-color: color-mix(in srgb, var(--color-status-warning-bg) 22%, transparent);
|
|
296
|
-
border-color: transparent;
|
|
297
|
-
border-left-color: var(--color-status-warning-border);
|
|
298
|
-
box-shadow: none;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
/* Disabled modified state */
|
|
302
|
-
.modified[aria-disabled='true'] {
|
|
303
|
-
background-color: var(--color-disabled-bg);
|
|
304
|
-
border-color: var(--color-disabled-border);
|
|
305
|
-
border-left-color: var(--color-disabled-border);
|
|
306
|
-
border-left-width: var(--border-width-thin);
|
|
307
|
-
box-shadow: none;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
/* Sizes */
|
|
311
|
-
.xs {
|
|
312
|
-
block-size: var(--component-size-xs);
|
|
313
|
-
font-size: var(--font-size-xs);
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
.input.xs {
|
|
317
|
-
padding-inline: var(--spacing-xxs);
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
.sm {
|
|
321
|
-
block-size: var(--component-size-sm);
|
|
322
|
-
font-size: var(--font-size-sm);
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
.sm.embedded,
|
|
326
|
-
.md.embedded,
|
|
327
|
-
.lg.embedded {
|
|
328
|
-
block-size: 100%;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
.md {
|
|
332
|
-
block-size: var(--component-size-md);
|
|
333
|
-
font-size: var(--font-size-sm);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
.lg {
|
|
337
|
-
block-size: var(--component-size-lg);
|
|
338
|
-
font-size: var(--font-size-lg);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
/* Leading icon */
|
|
342
|
-
.fieldWithIcon .input {
|
|
343
|
-
padding-inline-start: calc(var(--spacing-sm) + var(--icon-size-md) + var(--spacing-xs));
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
.embedded.fieldWithIcon .input {
|
|
347
|
-
padding-inline-start: calc(var(--spacing-xs) + var(--icon-size-md) + var(--spacing-xs));
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
.icon {
|
|
351
|
-
position: absolute;
|
|
352
|
-
inset-inline-start: var(--spacing-sm);
|
|
353
|
-
top: 50%;
|
|
354
|
-
transform: translateY(-50%);
|
|
355
|
-
display: inline-flex;
|
|
356
|
-
align-items: center;
|
|
357
|
-
justify-content: center;
|
|
358
|
-
inline-size: var(--icon-size-md);
|
|
359
|
-
block-size: var(--icon-size-md);
|
|
360
|
-
pointer-events: none;
|
|
361
|
-
color: var(--color-fg-subtle);
|
|
362
|
-
transition: color var(--transition-fast) var(--ease-standard);
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
.embedded .icon {
|
|
366
|
-
inset-inline-start: var(--spacing-xs);
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
.field:focus-within .icon {
|
|
370
|
-
color: var(--color-fg-muted);
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
.icon svg {
|
|
374
|
-
inline-size: var(--icon-size-md);
|
|
375
|
-
block-size: var(--icon-size-md);
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
/* Trailing label (unit, currency, etc.) */
|
|
379
|
-
.withTrailingLabel .field {
|
|
380
|
-
border-top-right-radius: 0;
|
|
381
|
-
border-bottom-right-radius: 0;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
.trailingLabel {
|
|
385
|
-
display: flex;
|
|
386
|
-
align-items: center;
|
|
387
|
-
flex: 0 0 auto;
|
|
388
|
-
padding-inline: var(--spacing-sm);
|
|
389
|
-
font-family: var(--font-family);
|
|
390
|
-
font-size: var(--font-size-sm);
|
|
391
|
-
color: var(--color-fg-muted);
|
|
392
|
-
background: var(--color-bg-toolbar);
|
|
393
|
-
border: var(--border-width-thin) solid var(--color-border-default);
|
|
394
|
-
margin-left: calc(-1 * var(--border-width-thin));
|
|
395
|
-
border-top-right-radius: var(--border-radius-default);
|
|
396
|
-
border-bottom-right-radius: var(--border-radius-default);
|
|
397
|
-
white-space: nowrap;
|
|
398
|
-
user-select: none;
|
|
399
|
-
box-sizing: border-box;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
.withTrailingLabel:has(.standalone) .trailingLabel {
|
|
403
|
-
border-top-right-radius: var(--border-radius-rounded);
|
|
404
|
-
border-bottom-right-radius: var(--border-radius-rounded);
|
|
405
|
-
border-color: var(--color-border-subtle);
|
|
406
|
-
background-color: var(--color-bg-surface);
|
|
407
|
-
box-shadow: var(--shadow-xs), var(--shadow-sm);
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
/* Trailing action button (outside field) */
|
|
411
|
-
.trailingButton {
|
|
412
|
-
flex: 0 0 auto;
|
|
413
|
-
border-top-left-radius: 0;
|
|
414
|
-
border-bottom-left-radius: 0;
|
|
415
|
-
border-left: var(--border-width-thin) solid transparent;
|
|
416
|
-
margin-left: calc(-1 * var(--border-width-thin));
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
.trailingButton:hover {
|
|
420
|
-
border-color: var(--color-border-default);
|
|
421
|
-
z-index: 2;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
/* Standalone variant: pill-shaped trailing button to match the field */
|
|
425
|
-
.withButton:has(.standalone) .trailingButton {
|
|
426
|
-
border-top-right-radius: var(--border-radius-rounded);
|
|
427
|
-
border-bottom-right-radius: var(--border-radius-rounded);
|
|
428
|
-
border-left-color: var(--color-border-subtle);
|
|
429
|
-
border-color: var(--color-border-subtle);
|
|
430
|
-
background-color: var(--color-bg-surface);
|
|
431
|
-
box-shadow: var(--shadow-xs), var(--shadow-sm);
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
.withButton:has(.standalone) .trailingButton:hover {
|
|
435
|
-
border-color: var(--color-border-strong);
|
|
436
|
-
box-shadow: var(--shadow-sm), var(--shadow-sm);
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
/* Date/time picker indicator (WebKit) */
|
|
440
|
-
.input[type='datetime-local']::-webkit-calendar-picker-indicator {
|
|
441
|
-
filter: invert(0.7);
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
/* Start and end adornments */
|
|
445
|
-
.startAdornment {
|
|
446
|
-
display: flex;
|
|
447
|
-
align-items: center;
|
|
448
|
-
gap: 4px;
|
|
449
|
-
margin-left: var(--spacing-xs);
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
.endAdornment {
|
|
453
|
-
display: flex;
|
|
454
|
-
align-items: center;
|
|
455
|
-
flex: 0 0 auto;
|
|
456
|
-
gap: 2px;
|
|
457
|
-
margin-inline-start: auto;
|
|
458
|
-
margin-right: var(--spacing-xxs);
|
|
459
|
-
color: var(--color-fg-subtle);
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
.clearSlot {
|
|
463
|
-
display: inline-flex;
|
|
464
|
-
align-items: center;
|
|
465
|
-
justify-content: center;
|
|
466
|
-
min-inline-size: calc(16px + (var(--spacing-xxs) * 2));
|
|
467
|
-
min-block-size: calc(16px + (var(--spacing-xxs) * 2));
|
|
468
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import styles from './InputContainer.module.css';
|
|
3
|
-
export function InputContainer({ label, htmlFor, error, helpText, helpTextAddition, fullWidth = false, required = false, children, orientation = 'horizontal', labelWidth = '160px', modified = false, }) {
|
|
4
|
-
const message = error !== null && error !== void 0 ? error : helpText;
|
|
5
|
-
const messageClass = error ? styles.errorText : styles.helpText;
|
|
6
|
-
const renderLabel = label && (_jsxs("label", { className: styles.label, htmlFor: htmlFor, children: [label, required && _jsx("span", { className: styles.required, children: " *" })] }));
|
|
7
|
-
const renderMessageRow = (message || helpTextAddition) && (_jsxs("div", { className: `${messageClass} ${styles.messageRow}`, children: [_jsx("span", { children: message }), helpTextAddition && _jsx("span", { className: styles.helpTextAddition, children: helpTextAddition })] }));
|
|
8
|
-
if (orientation === 'vertical') {
|
|
9
|
-
return (_jsxs("div", { "data-modified": modified ? 'true' : undefined, className: `dbc-flex dbc-flex-column dbc-gap-xs ${styles.inputContainer}`, style: { width: fullWidth ? '100%' : undefined }, children: [renderLabel, children, renderMessageRow] }));
|
|
10
|
-
}
|
|
11
|
-
return (_jsx("div", { "data-modified": modified ? 'true' : undefined, className: styles.inputContainer, style: {
|
|
12
|
-
'--label-width': labelWidth,
|
|
13
|
-
width: fullWidth ? '100%' : undefined,
|
|
14
|
-
}, children: _jsxs("div", { className: `${styles.horizontal} dbc-flex dbc-flex-column dbc-gap-xs`, children: [_jsxs("div", { className: `${styles.labelContainer} dbc-flex dbc-items-center dbc-gap-xs`, children: [renderLabel, children] }), renderMessageRow] }) }));
|
|
15
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
.horizontal {
|
|
2
|
-
--gap: var(--spacing-sm);
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.labelContainer {
|
|
6
|
-
gap: var(--gap);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.label {
|
|
10
|
-
color: var(--color-fg-default);
|
|
11
|
-
font-size: var(--font-size-sm);
|
|
12
|
-
font-weight: var(--font-weight-medium);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.horizontal .errorText,
|
|
16
|
-
.horizontal .helpText {
|
|
17
|
-
margin-left: calc(var(--label-width) + var(--gap));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.helpText {
|
|
21
|
-
color: var(--color-fg-subtle);
|
|
22
|
-
font-size: var(--font-size-sm);
|
|
23
|
-
display: flex;
|
|
24
|
-
align-items: center;
|
|
25
|
-
justify-content: space-between;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.helpTextAddition {
|
|
29
|
-
color: var(--color-fg-subtle);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.horizontal label {
|
|
33
|
-
width: var(--label-width);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.errorText {
|
|
37
|
-
color: var(--color-status-error);
|
|
38
|
-
font-size: var(--font-size-sm);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.required {
|
|
42
|
-
color: var(--color-status-error);
|
|
43
|
-
font-weight: bold;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.messageRow {
|
|
47
|
-
min-height: 1lh;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/* Optional: keep this only for controls whose own label lives inside children,
|
|
51
|
-
such as checkbox/radio wrappers. It will not affect Input's top label. */
|
|
52
|
-
.inputContainer[data-modified] label:not(.label) {
|
|
53
|
-
background-color: color-mix(in srgb, var(--color-status-warning-bg) 35%, transparent);
|
|
54
|
-
border-radius: var(--border-radius-default);
|
|
55
|
-
padding: 2px 6px;
|
|
56
|
-
}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Check, Search, Square } from 'lucide-react';
|
|
3
|
-
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
-
import { Button } from '../../../components/button/Button';
|
|
5
|
-
import { Chip } from '../../../components/chip/Chip';
|
|
6
|
-
import { ClearButton } from '../../../components/clear-button/ClearButton';
|
|
7
|
-
import { Input } from '../../../components/forms/input/Input';
|
|
8
|
-
import { Menu } from '../../../components/menu/Menu';
|
|
9
|
-
import { Popover } from '../../../components/popover/Popover';
|
|
10
|
-
import { useListNavigation } from '../../../hooks/useListNavigation';
|
|
11
|
-
export function MultiSelect({ options, selectedValues = [], onChange, placeholder = 'Vælg', children, variant = 'outlined', size = 'md', onClear, dataCy, fullWidth = false, disabled = false, searchable = false, searchPlaceholder = 'Søg', emptyMessage = 'Ingen resultater', }) {
|
|
12
|
-
const selectedSet = useMemo(() => new Set(selectedValues), [selectedValues]);
|
|
13
|
-
const popoverRef = useRef(null);
|
|
14
|
-
const searchInputRef = useRef(null);
|
|
15
|
-
const [open, setOpen] = useState(false);
|
|
16
|
-
const [searchQuery, setSearchQuery] = useState('');
|
|
17
|
-
const filteredOptions = useMemo(() => {
|
|
18
|
-
const normalizedQuery = searchQuery.trim().toLocaleLowerCase();
|
|
19
|
-
if (!normalizedQuery)
|
|
20
|
-
return options;
|
|
21
|
-
return options.filter(option => option.label.toLocaleLowerCase().includes(normalizedQuery));
|
|
22
|
-
}, [options, searchQuery]);
|
|
23
|
-
const { activeIndex, setActiveIndex, optionRefs, resetActiveIndex, clearTypeahead, handleKeyDown, } = useListNavigation({
|
|
24
|
-
options: filteredOptions,
|
|
25
|
-
getLabel: option => option.label,
|
|
26
|
-
isOpen: open,
|
|
27
|
-
onOpenChange: setOpen,
|
|
28
|
-
searchable,
|
|
29
|
-
searchInputRef,
|
|
30
|
-
getInitialActiveIndex: items => {
|
|
31
|
-
const selectedIndex = items.findIndex(option => selectedSet.has(option.value));
|
|
32
|
-
return selectedIndex >= 0 ? selectedIndex : 0;
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
var _a;
|
|
37
|
-
if (!open || !searchable)
|
|
38
|
-
return;
|
|
39
|
-
(_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
40
|
-
}, [open, searchable]);
|
|
41
|
-
const toggleValue = (value) => {
|
|
42
|
-
if (disabled)
|
|
43
|
-
return;
|
|
44
|
-
const next = new Set(selectedSet);
|
|
45
|
-
if (next.has(value))
|
|
46
|
-
next.delete(value);
|
|
47
|
-
else
|
|
48
|
-
next.add(value);
|
|
49
|
-
onChange(Array.from(next));
|
|
50
|
-
};
|
|
51
|
-
const handleCombinedKeyDown = (e) => {
|
|
52
|
-
var _a;
|
|
53
|
-
if (searchable && e.target === searchInputRef.current) {
|
|
54
|
-
switch (e.key) {
|
|
55
|
-
case 'Enter':
|
|
56
|
-
if (filteredOptions[activeIndex]) {
|
|
57
|
-
e.preventDefault();
|
|
58
|
-
toggleValue(filteredOptions[activeIndex].value);
|
|
59
|
-
}
|
|
60
|
-
return;
|
|
61
|
-
case ' ':
|
|
62
|
-
if (filteredOptions[activeIndex]) {
|
|
63
|
-
e.preventDefault();
|
|
64
|
-
toggleValue(filteredOptions[activeIndex].value);
|
|
65
|
-
}
|
|
66
|
-
return;
|
|
67
|
-
default:
|
|
68
|
-
handleKeyDown(e);
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
switch (e.key) {
|
|
73
|
-
case 'Enter':
|
|
74
|
-
case ' ': {
|
|
75
|
-
e.preventDefault();
|
|
76
|
-
clearTypeahead();
|
|
77
|
-
if (!open) {
|
|
78
|
-
setOpen(true);
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
const activeOption = filteredOptions[activeIndex];
|
|
82
|
-
if (activeOption)
|
|
83
|
-
toggleValue(activeOption.value);
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
case 'Escape':
|
|
87
|
-
if (!open)
|
|
88
|
-
return;
|
|
89
|
-
e.preventDefault();
|
|
90
|
-
(_a = popoverRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
91
|
-
return;
|
|
92
|
-
default:
|
|
93
|
-
handleKeyDown(e);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
return (_jsx(Popover, { ref: popoverRef, open: open, onOpenChange: next => {
|
|
97
|
-
setOpen(next);
|
|
98
|
-
if (next) {
|
|
99
|
-
resetActiveIndex();
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
setSearchQuery('');
|
|
103
|
-
}
|
|
104
|
-
}, dataCy: dataCy, fullWidth: fullWidth, autoFocusContent: false, returnFocus: true, trigger: (onClick, icon, isOpen) => (_jsx(Button, { variant: variant, onClick: onClick, onKeyDown: handleCombinedKeyDown, size: size, fullWidth: fullWidth, disabled: disabled, "aria-haspopup": "menu", "aria-expanded": !!isOpen, children: _jsxs("span", { className: "dbc-flex dbc-justify-between dbc-items-center dbc-gap-xxs", style: { width: '100%' }, children: [_jsxs("span", { className: "dbc-flex dbc-items-center dbc-gap-xxs", children: [_jsx("span", { children: children !== null && children !== void 0 ? children : placeholder }), selectedValues.length > 0 ? _jsx(Chip, { size: "sm", children: selectedValues.length }) : null] }), _jsxs("span", { className: "dbc-flex dbc-items-center dbc-gap-xxs", children: [onClear && selectedValues.length > 0 ? _jsx(ClearButton, { onClick: onClear }) : null, _jsx("span", { style: { color: 'var(--color-fg-subtle)', display: 'inline-flex' }, children: icon })] })] }) })), children: _jsxs(Menu, { onKeyDown: handleCombinedKeyDown, children: [searchable ? (_jsx(Menu.Item, { children: _jsx(Input, { ref: searchInputRef, value: searchQuery, onChange: e => setSearchQuery(e.target.value), onKeyDown: handleCombinedKeyDown, placeholder: searchPlaceholder, icon: _jsx(Search, { size: 16 }), fullWidth: true }) })) : null, filteredOptions.map((option, index) => {
|
|
105
|
-
const isSelected = selectedSet.has(option.value);
|
|
106
|
-
const isActive = index === activeIndex;
|
|
107
|
-
return (_jsx(Menu.Item, { active: isActive, children: _jsxs("button", { ref: el => {
|
|
108
|
-
if (optionRefs.current) {
|
|
109
|
-
optionRefs.current[index] = el;
|
|
110
|
-
}
|
|
111
|
-
}, type: "button", role: "menuitemcheckbox", "aria-checked": isSelected, tabIndex: isActive ? 0 : -1, disabled: disabled, onFocus: () => setActiveIndex(index), onClick: () => toggleValue(option.value), children: [_jsx("span", { style: {
|
|
112
|
-
pointerEvents: 'none',
|
|
113
|
-
display: 'flex',
|
|
114
|
-
alignItems: 'center',
|
|
115
|
-
color: !isSelected ? 'var(--color-border-strong)' : 'inherit',
|
|
116
|
-
}, children: isSelected ? _jsx(Check, {}) : _jsx(Square, {}) }), option.icon ? (_jsx("span", { style: {
|
|
117
|
-
pointerEvents: 'none',
|
|
118
|
-
display: 'flex',
|
|
119
|
-
alignItems: 'center',
|
|
120
|
-
}, children: option.icon })) : null, _jsx("span", { children: option.label })] }) }, option.value));
|
|
121
|
-
}), filteredOptions.length === 0 ? _jsx(Menu.Item, { disabled: true, children: emptyMessage }) : null] }) }));
|
|
122
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useId } from 'react';
|
|
4
|
-
import styles from './RadioButtons.module.css';
|
|
5
|
-
import { InputContainer } from '../input-container/InputContainer';
|
|
6
|
-
export function RadioButton({ name, value, selectedValue, checked, onChange, disabled, label, variant = 'outlined', size = 'md', containerLabel, error, helpText, orientation = 'horizontal', labelWidth = '160px', fullWidth = false, required = false, noContainer = false, id, 'data-cy': dataCy, }) {
|
|
7
|
-
const generatedId = useId();
|
|
8
|
-
const controlId = id !== null && id !== void 0 ? id : `radio-${generatedId}`;
|
|
9
|
-
const isChecked = selectedValue !== undefined ? selectedValue === value : Boolean(checked);
|
|
10
|
-
const content = (_jsxs("span", { className: styles.container, "data-cy": dataCy, children: [_jsxs("span", { className: styles.controlWrap, children: [_jsx("input", { id: controlId, className: styles.input, type: "radio", name: name, value: value, checked: isChecked, disabled: disabled, required: required, "aria-invalid": Boolean(error) || undefined, onChange: e => {
|
|
11
|
-
if (disabled)
|
|
12
|
-
return;
|
|
13
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value, e);
|
|
14
|
-
} }), _jsx("span", { className: [
|
|
15
|
-
styles.radio,
|
|
16
|
-
isChecked ? styles.checked : '',
|
|
17
|
-
disabled ? styles.disabled : '',
|
|
18
|
-
styles[variant],
|
|
19
|
-
styles[size],
|
|
20
|
-
]
|
|
21
|
-
.filter(Boolean)
|
|
22
|
-
.join(' '), "aria-hidden": "true", children: _jsx("span", { className: styles.dot }) })] }), label && (_jsx("label", { className: styles.label, htmlFor: controlId, children: label }))] }));
|
|
23
|
-
if (noContainer || (!containerLabel && !error))
|
|
24
|
-
return content;
|
|
25
|
-
return (_jsx(InputContainer, { label: containerLabel, htmlFor: controlId, error: error, helpText: helpText, orientation: orientation, labelWidth: labelWidth, fullWidth: fullWidth, required: required, children: content }));
|
|
26
|
-
}
|