@dbcdk/react-components 0.0.96 → 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/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.js +12641 -79
- 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/alert/Alert.js +0 -17
- package/dist/components/alert/Alert.module.css +0 -98
- 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 -28
- package/dist/components/forms/checkbox/Checkbox.module.css +0 -103
- 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 -60
- 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 -185
- 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 -220
- 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 -221
- 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 -89
- 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 -33
- package/dist/components/stack/Stack.module.css +0 -61
- 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 -233
- 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,161 +0,0 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
position: fixed;
|
|
3
|
-
inset-inline-end: var(--spacing-lg);
|
|
4
|
-
inset-block-start: var(--spacing-lg);
|
|
5
|
-
display: flex;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
gap: var(--spacing-xs);
|
|
8
|
-
z-index: var(--z-toast);
|
|
9
|
-
min-width: 280px;
|
|
10
|
-
word-break: break-word;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
@media (max-width: 640px) {
|
|
14
|
-
.container {
|
|
15
|
-
inset-inline: var(--spacing-md);
|
|
16
|
-
inset-block-end: var(--spacing-md);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.toast {
|
|
21
|
-
display: flex;
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
gap: var(--spacing-xs);
|
|
24
|
-
padding: var(--spacing-xs) var(--spacing-md);
|
|
25
|
-
border-radius: var(--border-radius-md);
|
|
26
|
-
box-shadow: var(--shadow-md);
|
|
27
|
-
background-color: var(--color-bg-surface);
|
|
28
|
-
border: var(--border-width-thin) solid var(--color-border-default);
|
|
29
|
-
font-family: var(--font-family);
|
|
30
|
-
max-width: 360px;
|
|
31
|
-
animation: toast-enter var(--transition-normal) var(--ease-standard);
|
|
32
|
-
border-left-width: var(--border-width-thick);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/* Severity accents */
|
|
36
|
-
.info {
|
|
37
|
-
border-left-color: var(--color-status-info-border);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.brand {
|
|
41
|
-
border-left-color: var(--color-brand);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.success {
|
|
45
|
-
border-left-color: var(--color-status-success-border);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.warning {
|
|
49
|
-
border-left-color: var(--color-status-warning-border);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.error {
|
|
53
|
-
border-left-color: var(--color-status-error-border);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.neutral {
|
|
57
|
-
background-color: var(--color-bg-inverse);
|
|
58
|
-
color: var(--color-fg-inverse);
|
|
59
|
-
border-left-width: 0;
|
|
60
|
-
min-width: 50px;
|
|
61
|
-
max-width: 200px;
|
|
62
|
-
width: fit-content;
|
|
63
|
-
align-self: flex-end;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.dismissibleNeutral {
|
|
67
|
-
cursor: pointer;
|
|
68
|
-
transition:
|
|
69
|
-
background-color var(--transition-fast) var(--ease-standard),
|
|
70
|
-
transform 60ms ease;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.dismissibleNeutral:hover {
|
|
74
|
-
background-color: color-mix(in srgb, var(--color-bg-inverse) 92%, white);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.dismissibleNeutral:active {
|
|
78
|
-
transform: translateY(1px);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.dismissibleNeutral:focus-visible {
|
|
82
|
-
outline: 2px solid var(--color-fg-inverse);
|
|
83
|
-
outline-offset: 2px;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/* Layout */
|
|
87
|
-
.content {
|
|
88
|
-
flex: 1;
|
|
89
|
-
min-width: 0;
|
|
90
|
-
display: flex;
|
|
91
|
-
flex-direction: column;
|
|
92
|
-
gap: var(--spacing-xxs);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.row {
|
|
96
|
-
display: flex;
|
|
97
|
-
align-items: center;
|
|
98
|
-
gap: var(--spacing-xs);
|
|
99
|
-
min-width: 0;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/* Long-text handling suitable for toasts */
|
|
103
|
-
.title,
|
|
104
|
-
.message {
|
|
105
|
-
min-width: 0;
|
|
106
|
-
overflow-wrap: anywhere;
|
|
107
|
-
word-break: break-word;
|
|
108
|
-
white-space: normal;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/* Optional: clamp to avoid giant toasts */
|
|
112
|
-
.title {
|
|
113
|
-
font-size: var(--font-size-sm);
|
|
114
|
-
font-weight: var(--font-weight-semibold);
|
|
115
|
-
line-height: var(--line-height-tight);
|
|
116
|
-
|
|
117
|
-
display: -webkit-box;
|
|
118
|
-
-webkit-box-orient: vertical;
|
|
119
|
-
-webkit-line-clamp: 2;
|
|
120
|
-
overflow: hidden;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.message {
|
|
124
|
-
font-size: var(--font-size-sm);
|
|
125
|
-
line-height: var(--line-height-normal);
|
|
126
|
-
|
|
127
|
-
display: -webkit-box;
|
|
128
|
-
-webkit-box-orient: vertical;
|
|
129
|
-
-webkit-line-clamp: 4;
|
|
130
|
-
overflow: hidden;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/* Close button stays aligned at the end of the row */
|
|
134
|
-
.closeButton {
|
|
135
|
-
margin-inline-start: auto;
|
|
136
|
-
flex: 0 0 auto;
|
|
137
|
-
align-self: flex-start;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.closeIcon {
|
|
141
|
-
width: var(--icon-size-sm);
|
|
142
|
-
height: var(--icon-size-sm);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.actions {
|
|
146
|
-
display: flex;
|
|
147
|
-
justify-content: flex-end;
|
|
148
|
-
gap: var(--spacing-xs);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/* Simple enter animation */
|
|
152
|
-
@keyframes toast-enter {
|
|
153
|
-
from {
|
|
154
|
-
opacity: 0;
|
|
155
|
-
transform: translateY(6px);
|
|
156
|
-
}
|
|
157
|
-
to {
|
|
158
|
-
opacity: 1;
|
|
159
|
-
transform: translateY(0);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useCallback, useContext, useState, useRef, useEffect, } from 'react';
|
|
4
|
-
import { Toast } from '../Toast';
|
|
5
|
-
import styles from '../Toast.module.css';
|
|
6
|
-
const ToastContext = createContext(undefined);
|
|
7
|
-
export function ToastProvider({ children, defaultDuration = 4000, }) {
|
|
8
|
-
const [toasts, setToasts] = useState([]);
|
|
9
|
-
const timeouts = useRef(new Map());
|
|
10
|
-
const clearTimeoutForId = (id) => {
|
|
11
|
-
const timeoutId = timeouts.current.get(id);
|
|
12
|
-
if (timeoutId) {
|
|
13
|
-
window.clearTimeout(timeoutId);
|
|
14
|
-
timeouts.current.delete(id);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
const hideToast = useCallback((id) => {
|
|
18
|
-
clearTimeoutForId(id);
|
|
19
|
-
setToasts(prev => prev.filter(t => t.id !== id));
|
|
20
|
-
}, []);
|
|
21
|
-
const scheduleAutoDismiss = useCallback((toast) => {
|
|
22
|
-
var _a;
|
|
23
|
-
const duration = (_a = toast.duration) !== null && _a !== void 0 ? _a : defaultDuration;
|
|
24
|
-
if (!duration || duration <= 0)
|
|
25
|
-
return;
|
|
26
|
-
clearTimeoutForId(toast.id);
|
|
27
|
-
const timeoutId = window.setTimeout(() => {
|
|
28
|
-
hideToast(toast.id);
|
|
29
|
-
}, duration);
|
|
30
|
-
timeouts.current.set(toast.id, timeoutId);
|
|
31
|
-
}, [defaultDuration, hideToast]);
|
|
32
|
-
const showToast = useCallback((config) => {
|
|
33
|
-
var _a, _b, _c;
|
|
34
|
-
const id = (_c = (_a = config.id) !== null && _a !== void 0 ? _a : (_b = crypto.randomUUID) === null || _b === void 0 ? void 0 : _b.call(crypto)) !== null && _c !== void 0 ? _c : `${Date.now()}-${Math.random()}`;
|
|
35
|
-
const toast = { ...config, id };
|
|
36
|
-
setToasts(prev => [...prev, toast]);
|
|
37
|
-
scheduleAutoDismiss(toast);
|
|
38
|
-
return id;
|
|
39
|
-
}, [scheduleAutoDismiss]);
|
|
40
|
-
const clearToasts = useCallback(() => {
|
|
41
|
-
timeouts.current.forEach(timeoutId => window.clearTimeout(timeoutId));
|
|
42
|
-
timeouts.current.clear();
|
|
43
|
-
setToasts([]);
|
|
44
|
-
}, []);
|
|
45
|
-
useEffect(() => () => {
|
|
46
|
-
timeouts.current.forEach(timeoutId => window.clearTimeout(timeoutId));
|
|
47
|
-
timeouts.current.clear();
|
|
48
|
-
}, []);
|
|
49
|
-
return (_jsxs(ToastContext.Provider, { value: { showToast, hideToast, clearToasts }, children: [children, toasts.length > 0 && (_jsx("div", { className: styles.container, "aria-live": "polite", "aria-atomic": "false", children: toasts.map(toast => {
|
|
50
|
-
var _a;
|
|
51
|
-
return (_jsx(Toast, { title: toast.title, message: toast.message, severity: (_a = toast.severity) !== null && _a !== void 0 ? _a : 'info', action: toast.action && {
|
|
52
|
-
label: toast.action.label,
|
|
53
|
-
onClick: () => {
|
|
54
|
-
var _a, _b;
|
|
55
|
-
(_b = (_a = toast.action) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
56
|
-
hideToast(toast.id);
|
|
57
|
-
},
|
|
58
|
-
}, onClose: () => hideToast(toast.id) }, toast.id));
|
|
59
|
-
}) }))] }));
|
|
60
|
-
}
|
|
61
|
-
export function useToast() {
|
|
62
|
-
const ctx = useContext(ToastContext);
|
|
63
|
-
if (!ctx) {
|
|
64
|
-
throw new Error('useToast must be used within a ToastProvider');
|
|
65
|
-
}
|
|
66
|
-
return ctx;
|
|
67
|
-
}
|
|
68
|
-
export function useOptionalToast() {
|
|
69
|
-
return useContext(ToastContext);
|
|
70
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import styles from './UserDisplay.module.css';
|
|
3
|
-
import { Avatar } from '../avatar/Avatar';
|
|
4
|
-
export function UserDisplay({ name, email, role, avatarUrl }) {
|
|
5
|
-
return (_jsxs("div", { className: styles.container, children: [_jsx("div", { children: _jsx(Avatar, { imgSrc: avatarUrl, imgAlt: name, fullName: name, size: "xl" }) }), _jsxs("div", { className: styles.userInfo, children: [_jsx("h4", { children: name }), _jsx("p", { children: email }), _jsx("p", { children: role })] })] }));
|
|
6
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
display: flex;
|
|
3
|
-
gap: var(--spacing-sm);
|
|
4
|
-
align-items: center;
|
|
5
|
-
padding: var(--spacing-xs);
|
|
6
|
-
background-color: var(--opac-bg-light);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.userInfo {
|
|
10
|
-
display: flex;
|
|
11
|
-
flex-direction: column;
|
|
12
|
-
justify-content: center;
|
|
13
|
-
padding: var(--spacing-sm);
|
|
14
|
-
flex-grow: 0;
|
|
15
|
-
color: var(--color-fg-muted);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.userInfo h4 {
|
|
19
|
-
color: var(--color-fg-default);
|
|
20
|
-
margin: 0;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.userInfo p {
|
|
24
|
-
margin: 0;
|
|
25
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export const SeverityBgColor = {
|
|
2
|
-
neutral: 'var(--color-neutral-strong)',
|
|
3
|
-
brand: 'var(--color-brand)',
|
|
4
|
-
success: 'var(--color-status-success)',
|
|
5
|
-
error: 'var(--color-status-error)',
|
|
6
|
-
info: 'var(--color-status-info)',
|
|
7
|
-
warning: 'var(--color-status-warning)',
|
|
8
|
-
};
|
|
9
|
-
export const SeverityBorderColor = {
|
|
10
|
-
neutral: 'var(--color-neutral-strong)',
|
|
11
|
-
brand: 'var(--color-brand)',
|
|
12
|
-
success: 'var(--color-status-success-border)',
|
|
13
|
-
error: 'var(--color-status-error-border)',
|
|
14
|
-
info: 'var(--color-status-info-border)',
|
|
15
|
-
warning: 'var(--color-status-warning-border)',
|
|
16
|
-
};
|
|
17
|
-
export const SeverityTextColor = {
|
|
18
|
-
neutral: 'var(--color-neutral-strong-fg)',
|
|
19
|
-
brand: 'var(--color-fg-on-brand)',
|
|
20
|
-
success: 'var(--color-status-success-fg)',
|
|
21
|
-
error: 'var(--color-status-error-fg)',
|
|
22
|
-
info: 'var(--color-status-info-fg)',
|
|
23
|
-
warning: 'var(--color-status-warning-fg)',
|
|
24
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/constants/sizes.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
// Aligned with --bp-sm (640px), --bp-md (768px), --bp-lg (1024px) from base.css
|
|
4
|
-
const BREAKPOINTS = {
|
|
5
|
-
tablet: 640,
|
|
6
|
-
desktop: 1024,
|
|
7
|
-
};
|
|
8
|
-
function getDeviceSize(width) {
|
|
9
|
-
if (width < BREAKPOINTS.tablet)
|
|
10
|
-
return 'mobile';
|
|
11
|
-
if (width < BREAKPOINTS.desktop)
|
|
12
|
-
return 'tablet';
|
|
13
|
-
return 'desktop';
|
|
14
|
-
}
|
|
15
|
-
export function useDeviceSize() {
|
|
16
|
-
const [deviceSize, setDeviceSize] = useState(() => {
|
|
17
|
-
if (typeof window === 'undefined')
|
|
18
|
-
return 'desktop';
|
|
19
|
-
return getDeviceSize(window.innerWidth);
|
|
20
|
-
});
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
const mediaQueries = [
|
|
23
|
-
window.matchMedia(`(max-width: ${BREAKPOINTS.tablet - 1}px)`),
|
|
24
|
-
window.matchMedia(`(min-width: ${BREAKPOINTS.tablet}px) and (max-width: ${BREAKPOINTS.desktop - 1}px)`),
|
|
25
|
-
window.matchMedia(`(min-width: ${BREAKPOINTS.desktop}px)`),
|
|
26
|
-
];
|
|
27
|
-
const update = () => setDeviceSize(getDeviceSize(window.innerWidth));
|
|
28
|
-
mediaQueries.forEach(mq => mq.addEventListener('change', update));
|
|
29
|
-
return () => mediaQueries.forEach(mq => mq.removeEventListener('change', update));
|
|
30
|
-
}, []);
|
|
31
|
-
return deviceSize;
|
|
32
|
-
}
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
-
export function useListNavigation({ options, getLabel, isOpen, onOpenChange, searchInputRef, searchable = false, focusActiveOptionOnOpen = true, typeaheadTimeoutMs = 500, getInitialActiveIndex, }) {
|
|
3
|
-
const optionRefs = useRef([]);
|
|
4
|
-
const typeaheadRef = useRef('');
|
|
5
|
-
const typeaheadTimeoutRef = useRef(null);
|
|
6
|
-
const normalizedLabels = useMemo(() => options.map(option => getLabel(option).trim().toLocaleLowerCase()), [options, getLabel]);
|
|
7
|
-
const getDefaultInitialIndex = useCallback((items) => {
|
|
8
|
-
if (items.length === 0)
|
|
9
|
-
return -1;
|
|
10
|
-
if (getInitialActiveIndex) {
|
|
11
|
-
const nextIndex = getInitialActiveIndex(items);
|
|
12
|
-
if (nextIndex < 0)
|
|
13
|
-
return -1;
|
|
14
|
-
return Math.min(nextIndex, items.length - 1);
|
|
15
|
-
}
|
|
16
|
-
return searchable ? -1 : 0;
|
|
17
|
-
}, [getInitialActiveIndex, searchable]);
|
|
18
|
-
const [activeIndex, setActiveIndex] = useState(() => getDefaultInitialIndex(options));
|
|
19
|
-
const clearTypeahead = useCallback(() => {
|
|
20
|
-
typeaheadRef.current = '';
|
|
21
|
-
if (typeaheadTimeoutRef.current) {
|
|
22
|
-
clearTimeout(typeaheadTimeoutRef.current);
|
|
23
|
-
typeaheadTimeoutRef.current = null;
|
|
24
|
-
}
|
|
25
|
-
}, []);
|
|
26
|
-
const focusActiveOption = useCallback(() => {
|
|
27
|
-
var _a;
|
|
28
|
-
if (activeIndex < 0 || options.length === 0)
|
|
29
|
-
return;
|
|
30
|
-
(_a = optionRefs.current[activeIndex]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
31
|
-
}, [activeIndex, options.length]);
|
|
32
|
-
const resetActiveIndex = useCallback(() => {
|
|
33
|
-
setActiveIndex(getDefaultInitialIndex(options));
|
|
34
|
-
}, [getDefaultInitialIndex, options]);
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
return () => {
|
|
37
|
-
if (typeaheadTimeoutRef.current)
|
|
38
|
-
clearTimeout(typeaheadTimeoutRef.current);
|
|
39
|
-
};
|
|
40
|
-
}, []);
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
setActiveIndex(current => {
|
|
43
|
-
if (options.length === 0)
|
|
44
|
-
return -1;
|
|
45
|
-
if (current < 0)
|
|
46
|
-
return current;
|
|
47
|
-
return Math.min(current, options.length - 1);
|
|
48
|
-
});
|
|
49
|
-
}, [options]);
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
optionRefs.current = optionRefs.current.slice(0, options.length);
|
|
52
|
-
}, [options.length]);
|
|
53
|
-
useEffect(() => {
|
|
54
|
-
if (!isOpen || !focusActiveOptionOnOpen)
|
|
55
|
-
return;
|
|
56
|
-
if (searchable && document.activeElement === (searchInputRef === null || searchInputRef === void 0 ? void 0 : searchInputRef.current))
|
|
57
|
-
return;
|
|
58
|
-
focusActiveOption();
|
|
59
|
-
}, [activeIndex, focusActiveOption, focusActiveOptionOnOpen, isOpen, searchable, searchInputRef]);
|
|
60
|
-
const moveNext = useCallback(() => {
|
|
61
|
-
if (options.length === 0)
|
|
62
|
-
return;
|
|
63
|
-
setActiveIndex(index => {
|
|
64
|
-
if (index < 0)
|
|
65
|
-
return 0;
|
|
66
|
-
return Math.min(index + 1, options.length - 1);
|
|
67
|
-
});
|
|
68
|
-
}, [options.length]);
|
|
69
|
-
const movePrev = useCallback(() => {
|
|
70
|
-
if (options.length === 0)
|
|
71
|
-
return;
|
|
72
|
-
setActiveIndex(index => {
|
|
73
|
-
if (index < 0)
|
|
74
|
-
return options.length - 1;
|
|
75
|
-
return Math.max(index - 1, 0);
|
|
76
|
-
});
|
|
77
|
-
}, [options.length]);
|
|
78
|
-
const moveFirst = useCallback(() => {
|
|
79
|
-
if (options.length === 0)
|
|
80
|
-
return;
|
|
81
|
-
setActiveIndex(0);
|
|
82
|
-
}, [options.length]);
|
|
83
|
-
const moveLast = useCallback(() => {
|
|
84
|
-
if (options.length === 0)
|
|
85
|
-
return;
|
|
86
|
-
setActiveIndex(options.length - 1);
|
|
87
|
-
}, [options.length]);
|
|
88
|
-
const findTypeaheadMatch = useCallback((query, startIndex) => {
|
|
89
|
-
if (!query || options.length === 0)
|
|
90
|
-
return -1;
|
|
91
|
-
const normalizedQuery = query.trim().toLocaleLowerCase();
|
|
92
|
-
if (!normalizedQuery)
|
|
93
|
-
return -1;
|
|
94
|
-
const safeStartIndex = startIndex < 0 ? -1 : startIndex;
|
|
95
|
-
for (let step = 1; step <= options.length; step += 1) {
|
|
96
|
-
const index = (safeStartIndex + step + options.length) % options.length;
|
|
97
|
-
const label = normalizedLabels[index];
|
|
98
|
-
if (label === null || label === void 0 ? void 0 : label.startsWith(normalizedQuery))
|
|
99
|
-
return index;
|
|
100
|
-
}
|
|
101
|
-
return -1;
|
|
102
|
-
}, [normalizedLabels, options.length]);
|
|
103
|
-
const handleTypeahead = useCallback((key) => {
|
|
104
|
-
const nextBuffer = `${typeaheadRef.current}${key.toLocaleLowerCase()}`;
|
|
105
|
-
const repeatedChar = new Set(nextBuffer).size === 1;
|
|
106
|
-
let nextIndex = findTypeaheadMatch(nextBuffer, activeIndex);
|
|
107
|
-
let appliedBuffer = nextBuffer;
|
|
108
|
-
if (nextIndex < 0 && repeatedChar) {
|
|
109
|
-
appliedBuffer = key.toLocaleLowerCase();
|
|
110
|
-
nextIndex = findTypeaheadMatch(appliedBuffer, activeIndex);
|
|
111
|
-
}
|
|
112
|
-
if (typeaheadTimeoutRef.current)
|
|
113
|
-
clearTimeout(typeaheadTimeoutRef.current);
|
|
114
|
-
typeaheadRef.current = appliedBuffer;
|
|
115
|
-
typeaheadTimeoutRef.current = setTimeout(() => {
|
|
116
|
-
typeaheadRef.current = '';
|
|
117
|
-
typeaheadTimeoutRef.current = null;
|
|
118
|
-
}, typeaheadTimeoutMs);
|
|
119
|
-
if (nextIndex < 0)
|
|
120
|
-
return;
|
|
121
|
-
setActiveIndex(nextIndex);
|
|
122
|
-
if (!isOpen)
|
|
123
|
-
onOpenChange(true);
|
|
124
|
-
}, [activeIndex, findTypeaheadMatch, isOpen, onOpenChange, typeaheadTimeoutMs]);
|
|
125
|
-
const handleKeyDown = useCallback((e) => {
|
|
126
|
-
var _a;
|
|
127
|
-
const isSearchInputTarget = searchable && e.target === (searchInputRef === null || searchInputRef === void 0 ? void 0 : searchInputRef.current);
|
|
128
|
-
if (isSearchInputTarget) {
|
|
129
|
-
switch (e.key) {
|
|
130
|
-
case 'ArrowDown':
|
|
131
|
-
e.preventDefault();
|
|
132
|
-
if (!isOpen) {
|
|
133
|
-
onOpenChange(true);
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
moveNext();
|
|
137
|
-
return;
|
|
138
|
-
case 'ArrowUp':
|
|
139
|
-
e.preventDefault();
|
|
140
|
-
if (!isOpen) {
|
|
141
|
-
onOpenChange(true);
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
movePrev();
|
|
145
|
-
return;
|
|
146
|
-
case 'Home':
|
|
147
|
-
if (!isOpen)
|
|
148
|
-
return;
|
|
149
|
-
e.preventDefault();
|
|
150
|
-
moveFirst();
|
|
151
|
-
return;
|
|
152
|
-
case 'End':
|
|
153
|
-
if (!isOpen)
|
|
154
|
-
return;
|
|
155
|
-
e.preventDefault();
|
|
156
|
-
moveLast();
|
|
157
|
-
return;
|
|
158
|
-
case 'Escape':
|
|
159
|
-
e.preventDefault();
|
|
160
|
-
onOpenChange(false);
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
if (e.key.length === 1 && !e.altKey && !e.ctrlKey && !e.metaKey && !/\s/.test(e.key)) {
|
|
166
|
-
e.preventDefault();
|
|
167
|
-
handleTypeahead(e.key);
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
switch (e.key) {
|
|
171
|
-
case 'ArrowDown':
|
|
172
|
-
e.preventDefault();
|
|
173
|
-
if (!isOpen) {
|
|
174
|
-
onOpenChange(true);
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
moveNext();
|
|
178
|
-
break;
|
|
179
|
-
case 'ArrowUp':
|
|
180
|
-
e.preventDefault();
|
|
181
|
-
if (!isOpen) {
|
|
182
|
-
onOpenChange(true);
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
if (searchable &&
|
|
186
|
-
activeIndex === 0 &&
|
|
187
|
-
optionRefs.current[activeIndex] === document.activeElement) {
|
|
188
|
-
(_a = searchInputRef === null || searchInputRef === void 0 ? void 0 : searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
189
|
-
setActiveIndex(-1);
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
movePrev();
|
|
193
|
-
break;
|
|
194
|
-
case 'Home':
|
|
195
|
-
if (!isOpen)
|
|
196
|
-
return;
|
|
197
|
-
e.preventDefault();
|
|
198
|
-
moveFirst();
|
|
199
|
-
break;
|
|
200
|
-
case 'End':
|
|
201
|
-
if (!isOpen)
|
|
202
|
-
return;
|
|
203
|
-
e.preventDefault();
|
|
204
|
-
moveLast();
|
|
205
|
-
break;
|
|
206
|
-
case 'Escape':
|
|
207
|
-
if (!isOpen)
|
|
208
|
-
return;
|
|
209
|
-
e.preventDefault();
|
|
210
|
-
onOpenChange(false);
|
|
211
|
-
break;
|
|
212
|
-
}
|
|
213
|
-
}, [
|
|
214
|
-
activeIndex,
|
|
215
|
-
handleTypeahead,
|
|
216
|
-
isOpen,
|
|
217
|
-
moveFirst,
|
|
218
|
-
moveLast,
|
|
219
|
-
moveNext,
|
|
220
|
-
movePrev,
|
|
221
|
-
onOpenChange,
|
|
222
|
-
searchInputRef,
|
|
223
|
-
searchable,
|
|
224
|
-
]);
|
|
225
|
-
return {
|
|
226
|
-
activeIndex,
|
|
227
|
-
setActiveIndex,
|
|
228
|
-
optionRefs,
|
|
229
|
-
resetActiveIndex,
|
|
230
|
-
clearTypeahead,
|
|
231
|
-
handleKeyDown,
|
|
232
|
-
focusActiveOption,
|
|
233
|
-
};
|
|
234
|
-
}
|