@dbcdk/react-components 0.0.4 → 0.0.6
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/assets/logo.js +2 -85
- package/dist/components/__stories__/_data/table.d.ts +15 -0
- package/dist/components/__stories__/_data/table.js +49 -0
- package/dist/components/__stories__/story-components/Colors.d.ts +11 -0
- package/dist/components/__stories__/story-components/Colors.js +96 -0
- package/dist/components/__stories__/story-components/Colors.module.css +27 -0
- package/dist/components/__stories__/story-components/Spacing.d.ts +2 -0
- package/dist/components/__stories__/story-components/Spacing.js +76 -0
- package/dist/components/__stories__/story-components/Spacing.module.css +154 -0
- package/dist/components/app-header/AppHeader.d.ts +4 -3
- package/dist/components/app-header/AppHeader.js +3 -6
- package/dist/components/app-header/AppHeader.module.css +10 -15
- package/dist/components/attribute-chip/AttributeChip.d.ts +9 -0
- package/dist/components/attribute-chip/AttributeChip.js +5 -0
- package/dist/components/attribute-chip/AttributeChip.module.css +65 -0
- package/dist/components/avatar/Avatar.d.ts +5 -3
- package/dist/components/avatar/Avatar.js +37 -37
- package/dist/components/avatar/Avatar.module.css +27 -0
- package/dist/components/breadcrumbs/Breadcrumbs.d.ts +4 -4
- package/dist/components/breadcrumbs/Breadcrumbs.js +4 -14
- package/dist/components/breadcrumbs/Breadcrumbs.module.css +19 -22
- package/dist/components/button/Button.d.ts +6 -2
- package/dist/components/button/Button.js +56 -50
- package/dist/components/button/Button.module.css +119 -56
- package/dist/components/card/Card.d.ts +23 -7
- package/dist/components/card/Card.js +20 -21
- package/dist/components/card/Card.module.css +148 -44
- package/dist/components/card-container/CardContainer.d.ts +6 -3
- package/dist/components/card-container/CardContainer.js +4 -15
- package/dist/components/card-container/CardContainer.module.css +40 -0
- package/dist/components/chip/Chip.d.ts +7 -5
- package/dist/components/chip/Chip.js +14 -37
- package/dist/components/chip/Chip.module.css +50 -27
- package/dist/components/circle/Circle.d.ts +3 -2
- package/dist/components/circle/Circle.js +3 -10
- package/dist/components/circle/Circle.module.css +11 -11
- package/dist/components/clear-button/ClearButton.d.ts +2 -1
- package/dist/components/clear-button/ClearButton.js +6 -17
- package/dist/components/clear-button/ClearButton.module.css +8 -7
- package/dist/components/code-block/CodeBlock.d.ts +7 -0
- package/dist/components/code-block/CodeBlock.js +6 -0
- package/dist/components/code-block/CodeBlock.module.css +60 -0
- package/dist/components/copy-button/CopyButton.d.ts +10 -0
- package/dist/components/copy-button/CopyButton.js +22 -0
- package/dist/components/copy-button/CopyButton.module.css +6 -0
- package/dist/components/datetime-picker/DateTimePicker.d.ts +42 -0
- package/dist/components/datetime-picker/DateTimePicker.js +403 -0
- package/dist/components/datetime-picker/DateTimePicker.module.css +144 -0
- package/dist/components/filter-field/FilterField.d.ts +6 -3
- package/dist/components/filter-field/FilterField.js +130 -158
- package/dist/components/filter-field/FilterField.module.css +35 -25
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.d.ts +36 -0
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.js +53 -0
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.module.css +60 -0
- package/dist/components/forms/checkbox/Checkbox.d.ts +31 -0
- package/dist/components/forms/checkbox/Checkbox.js +27 -0
- package/dist/components/{checkbox → forms/checkbox}/Checkbox.module.css +10 -11
- package/dist/components/forms/checkbox-group/CheckboxGroup.d.ts +47 -0
- package/dist/components/forms/checkbox-group/CheckboxGroup.js +75 -0
- package/dist/components/forms/checkbox-group/CheckboxGroup.module.css +115 -0
- package/dist/components/forms/input/Input.d.ts +22 -0
- package/dist/components/forms/input/Input.js +70 -0
- package/dist/components/forms/input/Input.module.css +160 -0
- package/dist/components/forms/input-container/InputContainer.d.ts +15 -0
- package/dist/components/forms/input-container/InputContainer.js +15 -0
- package/dist/components/forms/input-container/InputContainer.module.css +34 -0
- package/dist/components/forms/multi-select/MultiSelect.d.ts +20 -0
- package/dist/components/forms/multi-select/MultiSelect.js +19 -0
- package/dist/components/forms/select/Select.d.ts +21 -0
- package/dist/components/forms/select/Select.js +94 -0
- package/dist/components/forms/text-area/Textarea.d.ts +17 -0
- package/dist/components/forms/text-area/Textarea.js +33 -0
- package/dist/components/forms/text-area/Textarea.module.css +26 -0
- package/dist/components/headline/Headline.d.ts +9 -1
- package/dist/components/headline/Headline.js +18 -37
- package/dist/components/headline/Headline.module.css +32 -7
- package/dist/components/hyperlink/Hyperlink.d.ts +9 -0
- package/dist/components/hyperlink/Hyperlink.js +11 -0
- package/dist/components/hyperlink/Hyperlink.module.css +23 -0
- package/dist/components/icon/Icon.d.ts +4 -3
- package/dist/components/icon/Icon.js +11 -17
- package/dist/components/icon/Icon.module.css +10 -9
- package/dist/components/menu/Menu.js +25 -67
- package/dist/components/menu/Menu.module.css +10 -32
- package/dist/components/meta-bar/MetaBar.d.ts +11 -0
- package/dist/components/meta-bar/MetaBar.js +9 -0
- package/dist/components/meta-bar/MetaBar.module.css +12 -0
- package/dist/components/nav-bar/NavBar.d.ts +5 -5
- package/dist/components/nav-bar/NavBar.js +15 -45
- package/dist/components/nav-bar/NavBar.module.css +11 -16
- package/dist/components/overlay/modal/Modal.d.ts +23 -0
- package/dist/components/overlay/modal/Modal.js +92 -0
- package/dist/components/overlay/modal/Modal.module.css +66 -0
- package/dist/components/overlay/modal/provider/ModalProvider.d.ts +20 -0
- package/dist/components/overlay/modal/provider/ModalProvider.js +70 -0
- package/dist/components/overlay/side-panel/SidePanel.d.ts +16 -0
- package/dist/components/overlay/side-panel/SidePanel.js +10 -0
- package/dist/components/overlay/side-panel/SidePanel.module.css +56 -0
- package/dist/components/overlay/side-panel/useSidePanel.d.ts +5 -0
- package/dist/components/overlay/side-panel/useSidePanel.js +11 -0
- package/dist/components/overlay/tooltip/Tooltip.d.ts +13 -0
- package/dist/components/overlay/tooltip/Tooltip.js +17 -0
- package/dist/components/overlay/tooltip/Tooltip.module.css +106 -0
- package/dist/components/overlay/tooltip/TooltipProvider.d.ts +20 -0
- package/dist/components/overlay/tooltip/TooltipProvider.js +244 -0
- package/dist/components/overlay/tooltip/useTooltipTrigger.d.ts +24 -0
- package/dist/components/overlay/tooltip/useTooltipTrigger.js +108 -0
- package/dist/components/page/Page.d.ts +7 -6
- package/dist/components/page/Page.js +4 -21
- package/dist/components/page/Page.module.css +2 -2
- package/dist/components/page-layout/PageLayout.d.ts +12 -20
- package/dist/components/page-layout/PageLayout.js +35 -88
- package/dist/components/page-layout/PageLayout.module.css +4 -80
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.d.ts +11 -0
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.js +7 -0
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.module.css +84 -0
- package/dist/components/pagination/Pagination.d.ts +4 -1
- package/dist/components/pagination/Pagination.js +38 -105
- package/dist/components/pagination/Pagination.module.css +11 -3
- package/dist/components/panel/Panel.d.ts +4 -3
- package/dist/components/panel/Panel.js +5 -10
- package/dist/components/panel/Panel.module.css +5 -7
- package/dist/components/popover/Popover.d.ts +3 -1
- package/dist/components/popover/Popover.js +116 -124
- package/dist/components/popover/Popover.module.css +4 -6
- package/dist/components/search-box/SearchBox.d.ts +11 -8
- package/dist/components/search-box/SearchBox.js +112 -149
- package/dist/components/search-box/SearchBox.module.css +0 -1
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.d.ts +1 -1
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.js +47 -88
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.module.css +5 -1
- package/dist/components/sidebar/Sidebar.d.ts +3 -1
- package/dist/components/sidebar/Sidebar.js +5 -29
- package/dist/components/sidebar/components/SidebarItem.js +6 -12
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.d.ts +4 -2
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +48 -62
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css +9 -38
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.d.ts +9 -0
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +13 -0
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.module.css +155 -0
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.d.ts +3 -1
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +4 -18
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css +25 -12
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.d.ts +1 -1
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +9 -22
- package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.js +20 -18
- package/dist/components/sidebar/providers/SidebarProvider.d.ts +9 -4
- package/dist/components/sidebar/providers/SidebarProvider.js +188 -73
- package/dist/components/skeleton-loader/SkeletonLoader.js +68 -266
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.js +11 -34
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.module.css +0 -12
- package/dist/components/split-button/SplitButton.d.ts +7 -5
- package/dist/components/split-button/SplitButton.js +4 -27
- package/dist/components/split-pane/SplitPane.d.ts +34 -0
- package/dist/components/split-pane/SplitPane.js +78 -0
- package/dist/components/split-pane/SplitPane.module.css +106 -0
- package/dist/components/split-pane/provider/SplitPaneContext.d.ts +23 -0
- package/dist/components/split-pane/provider/SplitPaneContext.js +85 -0
- package/dist/components/table/Table.d.ts +28 -10
- package/dist/components/table/Table.js +117 -172
- package/dist/components/table/Table.module.css +78 -47
- package/dist/components/table/components/column-resizer/ColumnResizer.js +4 -15
- package/dist/components/table/components/empty-state/EmptyState.d.ts +41 -0
- package/dist/components/table/components/empty-state/EmptyState.js +27 -0
- package/dist/components/table/components/empty-state/EmptyState.module.css +16 -0
- package/dist/components/table/components/table-settings/TableSettings.d.ts +8 -0
- package/dist/components/table/components/table-settings/TableSettings.js +12 -0
- package/dist/components/table/tanstack.d.ts +14 -0
- package/dist/components/table/tanstack.js +162 -0
- package/dist/components/tabs/Tabs.d.ts +7 -3
- package/dist/components/tabs/Tabs.js +32 -65
- package/dist/components/tabs/Tabs.module.css +9 -9
- package/dist/components/toast/Toast.d.ts +14 -0
- package/dist/components/toast/Toast.js +8 -0
- package/dist/components/toast/Toast.module.css +102 -0
- package/dist/components/toast/provider/ToastProvider.d.ts +23 -0
- package/dist/components/toast/provider/ToastProvider.js +64 -0
- package/dist/components/user-display/UserDisplay.d.ts +2 -1
- package/dist/components/user-display/UserDisplay.js +4 -20
- package/dist/components/user-display/UserDisplay.module.css +2 -2
- package/dist/constants/severity.d.ts +1 -1
- package/dist/constants/severity.js +14 -16
- package/dist/constants/severity.types.d.ts +1 -1
- package/dist/constants/severity.types.js +1 -1
- package/dist/constants/sizes.d.ts +1 -1
- package/dist/constants/sizes.js +6 -7
- package/dist/hooks/usePagination.d.ts +33 -0
- package/dist/hooks/usePagination.js +79 -0
- package/dist/hooks/useSorting.d.ts +49 -0
- package/dist/hooks/useSorting.js +118 -0
- package/dist/hooks/useTableData.d.ts +40 -0
- package/dist/hooks/useTableData.js +45 -0
- package/dist/hooks/useTableSelection.d.ts +25 -0
- package/dist/hooks/useTableSelection.js +128 -0
- package/dist/hooks/useTableSettings.d.ts +7 -0
- package/dist/hooks/useTableSettings.js +24 -0
- package/dist/hooks/useTheme.d.ts +3 -7
- package/dist/hooks/useTheme.js +52 -47
- package/dist/hooks/useTimeDuration.d.ts +22 -0
- package/dist/hooks/useTimeDuration.js +36 -0
- package/dist/hooks/useViewportFill.d.ts +3 -2
- package/dist/hooks/useViewportFill.js +55 -48
- package/dist/index.d.ts +32 -6
- package/dist/index.js +33 -6
- package/dist/src/styles/styles.css +101 -8
- package/dist/styles/css-helper-classes/flex.css +101 -0
- package/dist/styles/css-helper-classes/typography.css +7 -0
- package/dist/styles/styles.css +101 -8
- package/dist/styles/themes/dbc/dark.css +207 -100
- package/dist/styles/themes/dbc/light.css +185 -90
- package/dist/styles/themes/forfatterweb/light.css +1 -1
- package/dist/styles/themes/types.js +1 -1
- package/dist/types/a11y-props.types.d.ts +5 -5
- package/dist/types/a11y-props.types.js +1 -1
- package/dist/types/sizes.types.d.ts +2 -2
- package/dist/types/sizes.types.js +1 -1
- package/dist/utils/arrays/nested-filtering.js +43 -33
- package/dist/utils/date/formatDate.js +25 -16
- package/package.json +33 -18
- package/dist/assets/logo.cjs +0 -87
- package/dist/components/app-header/AppHeader.cjs +0 -14
- package/dist/components/avatar/Avatar.cjs +0 -67
- package/dist/components/breadcrumbs/Breadcrumbs.cjs +0 -23
- package/dist/components/button/Button.cjs +0 -79
- package/dist/components/card/Card.cjs +0 -29
- package/dist/components/card-container/CardContainer.cjs +0 -23
- package/dist/components/checkbox/Checkbox.cjs +0 -43
- package/dist/components/checkbox/Checkbox.d.ts +0 -12
- package/dist/components/checkbox/Checkbox.js +0 -37
- package/dist/components/chip/Chip.cjs +0 -49
- package/dist/components/circle/Circle.cjs +0 -18
- package/dist/components/clear-button/ClearButton.cjs +0 -26
- package/dist/components/data-summary/DataSummary.cjs +0 -49
- package/dist/components/data-summary/DataSummary.d.ts +0 -19
- package/dist/components/data-summary/DataSummary.js +0 -43
- package/dist/components/data-summary/DataSummary.module.css +0 -51
- package/dist/components/filter-field/FilterField.cjs +0 -174
- package/dist/components/headline/Headline.cjs +0 -47
- package/dist/components/icon/Icon.cjs +0 -27
- package/dist/components/input/Input.cjs +0 -48
- package/dist/components/input/Input.d.ts +0 -13
- package/dist/components/input/Input.js +0 -42
- package/dist/components/input/Input.module.css +0 -112
- package/dist/components/menu/Menu.cjs +0 -96
- package/dist/components/multi-select/MultiSelect.cjs +0 -48
- package/dist/components/multi-select/MultiSelect.d.ts +0 -18
- package/dist/components/multi-select/MultiSelect.js +0 -46
- package/dist/components/nav-bar/NavBar.cjs +0 -55
- package/dist/components/page/Page.cjs +0 -30
- package/dist/components/page-layout/PageLayout.cjs +0 -101
- package/dist/components/pagination/Pagination.cjs +0 -117
- package/dist/components/panel/Panel.cjs +0 -18
- package/dist/components/popover/Popover.cjs +0 -132
- package/dist/components/search-box/SearchBox.cjs +0 -162
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.cjs +0 -97
- package/dist/components/select/Select.cjs +0 -52
- package/dist/components/select/Select.d.ts +0 -11
- package/dist/components/select/Select.js +0 -50
- package/dist/components/sidebar/Sidebar.cjs +0 -38
- package/dist/components/sidebar/Sidebar.module.css +0 -66
- package/dist/components/sidebar/components/SidebarItem.cjs +0 -16
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs +0 -74
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.cjs +0 -27
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.cjs +0 -28
- package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.cjs +0 -25
- package/dist/components/sidebar/providers/SidebarProvider.cjs +0 -81
- package/dist/components/skeleton-loader/SkeletonLoader.cjs +0 -270
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.cjs +0 -42
- package/dist/components/split-button/SplitButton.cjs +0 -37
- package/dist/components/table/Table.cjs +0 -181
- package/dist/components/table/components/column-resizer/ColumnResizer.cjs +0 -22
- package/dist/components/tabs/Tabs.cjs +0 -74
- package/dist/components/text-area/Textarea.cjs +0 -62
- package/dist/components/text-area/Textarea.d.ts +0 -14
- package/dist/components/text-area/Textarea.js +0 -56
- package/dist/components/text-area/Textarea.module.css +0 -3
- package/dist/components/tooltip/Tooltip.cjs +0 -78
- package/dist/components/tooltip/Tooltip.d.ts +0 -11
- package/dist/components/tooltip/Tooltip.js +0 -72
- package/dist/components/tooltip/Tooltip.module.css +0 -84
- package/dist/components/user-display/UserDisplay.cjs +0 -28
- package/dist/constants/severity.cjs +0 -21
- package/dist/constants/severity.types.cjs +0 -2
- package/dist/constants/sizes.cjs +0 -10
- package/dist/hooks/useTheme.cjs +0 -58
- package/dist/hooks/useViewportFill.cjs +0 -52
- package/dist/index.cjs +0 -264
- package/dist/styles/themes/types.cjs +0 -2
- package/dist/tanstack.cjs +0 -231
- package/dist/tanstack.d.ts +0 -25
- package/dist/tanstack.js +0 -206
- package/dist/types/a11y-props.types.cjs +0 -2
- package/dist/types/assets.d.cjs +0 -2
- package/dist/types/assets.d.js +0 -1
- package/dist/types/css.d.cjs +0 -2
- package/dist/types/css.d.js +0 -1
- package/dist/types/sizes.types.cjs +0 -2
- package/dist/utils/arrays/nested-filtering.cjs +0 -40
- package/dist/utils/date/formatDate.cjs +0 -19
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
white-space: nowrap;
|
|
5
|
+
border-radius: var(--border-radius-default);
|
|
6
|
+
border: 1px solid var(--color-border-subtle);
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
font-family: var(--font-family);
|
|
9
|
+
font-weight: var(--font-weight-default);
|
|
10
|
+
line-height: var(--line-height-tight);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.label,
|
|
14
|
+
.value {
|
|
15
|
+
display: inline-flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
height: 100%;
|
|
18
|
+
padding-inline: var(--spacing-sm);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.label {
|
|
22
|
+
background: var(--color-bg-contextual);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.value {
|
|
26
|
+
background: var(--color-bg-contextual-subtle);
|
|
27
|
+
color: var(--color-fg-default);
|
|
28
|
+
font-weight: var(--font-weight-medium);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Optional: separator between label and value */
|
|
32
|
+
.value {
|
|
33
|
+
border-left: 1px solid var(--color-border-subtle);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* Sizes */
|
|
37
|
+
.sm {
|
|
38
|
+
height: var(--component-size-xs);
|
|
39
|
+
font-size: var(--font-size-xs);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.md {
|
|
43
|
+
height: var(--component-size-sm);
|
|
44
|
+
font-size: var(--font-size-sm);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.lg {
|
|
48
|
+
height: var(--component-size-md);
|
|
49
|
+
font-size: var(--font-size-md);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.sm .label,
|
|
53
|
+
.sm .value {
|
|
54
|
+
padding-inline: var(--spacing-xs);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.md .label,
|
|
58
|
+
.md .value {
|
|
59
|
+
padding-inline: var(--spacing-sm);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.lg .label,
|
|
63
|
+
.lg .value {
|
|
64
|
+
padding-inline: var(--spacing-md);
|
|
65
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ButtonHTMLAttributes, JSX } from 'react';
|
|
3
3
|
import type { Severity } from '../../constants/severity.types';
|
|
4
|
-
import {
|
|
4
|
+
import type { Size } from '../../types/sizes.types';
|
|
5
5
|
interface AvatarProps extends Partial<ButtonHTMLAttributes<HTMLButtonElement>> {
|
|
6
6
|
image?: React.ReactNode;
|
|
7
7
|
imgSrc?: string;
|
|
@@ -10,6 +10,8 @@ interface AvatarProps extends Partial<ButtonHTMLAttributes<HTMLButtonElement>> {
|
|
|
10
10
|
color?: Severity;
|
|
11
11
|
button?: boolean;
|
|
12
12
|
size?: Size;
|
|
13
|
+
fullWidth?: boolean;
|
|
14
|
+
photographerCredit?: string;
|
|
13
15
|
}
|
|
14
|
-
export declare function Avatar({ image, imgSrc, imgAlt, fullName, color, button, size, ...rest }: AvatarProps): JSX.Element;
|
|
16
|
+
export declare function Avatar({ image, imgSrc, imgAlt, fullName, color, button, size, className, fullWidth, photographerCredit, ...rest }: AvatarProps): JSX.Element;
|
|
15
17
|
export {};
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { jsx } from
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import styles from './Avatar.module.css';
|
|
4
|
+
import { SeverityBgColor, SeverityTextColor } from '../../constants/severity';
|
|
4
5
|
import { sizes } from '../../constants/sizes';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
6
|
+
export function Avatar({ image, imgSrc, imgAlt, fullName, color = 'brand', button, size = 'md', className, fullWidth = false, photographerCredit, ...rest }) {
|
|
7
|
+
const text = fullName
|
|
8
|
+
? fullName
|
|
9
|
+
.trim()
|
|
10
|
+
.split(/\s+/)
|
|
11
|
+
.map(name => name.charAt(0))
|
|
12
|
+
.join('')
|
|
13
|
+
.toUpperCase()
|
|
14
|
+
: '';
|
|
15
|
+
const styleVars = {
|
|
16
|
+
'--bg': SeverityBgColor[color],
|
|
17
|
+
'--text': SeverityTextColor[color],
|
|
18
|
+
'--size': fullWidth ? '100%' : sizes[size],
|
|
19
|
+
};
|
|
20
|
+
// Unique id per component instance so multiple avatars don't clash
|
|
21
|
+
const pathId = React.useId();
|
|
22
|
+
const renderImage = () => {
|
|
23
|
+
if (image) {
|
|
24
|
+
// If it's a valid React element, merge our className; otherwise render as-is
|
|
25
|
+
if (React.isValidElement(image)) {
|
|
26
|
+
const mergedClass = [image.props.className, styles.image].filter(Boolean).join(' ');
|
|
27
|
+
return React.cloneElement(image, { className: mergedClass });
|
|
28
|
+
}
|
|
29
|
+
return _jsx("span", { className: styles.imageSlot, children: image });
|
|
30
|
+
}
|
|
31
|
+
if (imgSrc) {
|
|
32
|
+
return _jsx("img", { className: styles.image, src: imgSrc, alt: imgAlt });
|
|
33
|
+
}
|
|
34
|
+
return (_jsx("span", { className: styles.avatar, "aria-hidden": "true", children: text }));
|
|
35
|
+
};
|
|
36
|
+
// Keep button behavior as before (no circular credit)
|
|
37
|
+
if (button) {
|
|
38
|
+
return (_jsx("button", { type: "button", ...rest, className: [styles.container, styles.button, className].filter(Boolean).join(' '), style: styleVars, children: renderImage() }));
|
|
30
39
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
return /* @__PURE__ */ jsx("span", { className: styles.avatar, "aria-hidden": "true", children: text });
|
|
35
|
-
};
|
|
36
|
-
if (button) {
|
|
37
|
-
return /* @__PURE__ */ jsx("button", { ...rest, className: `${styles.container} ${styles.button}`, style: styleVars, children: renderImage() });
|
|
38
|
-
}
|
|
39
|
-
return /* @__PURE__ */ jsx("div", { className: styles.container, style: styleVars, children: renderImage() });
|
|
40
|
+
// Non-button: wrapper to overlay circular credit SVG
|
|
41
|
+
return (_jsxs("div", { className: [styles.wrapper, className].filter(Boolean).join(' '), style: styleVars, children: [_jsx("div", { className: styles.container, children: renderImage() }), photographerCredit && (_jsxs("svg", { className: styles.creditText, viewBox: "0 0 100 100", "aria-hidden": "true", focusable: "false", children: [_jsx("defs", { children: _jsx("path", { id: pathId, d: "\n M 50, 50\n m -42, 0\n a 42,42 0 1,1 84,0\n a 42,42 0 1,1 -84,0\n " }) }), _jsx("text", { children: _jsx("textPath", { xlinkHref: `#${pathId}`, startOffset: "50%", textAnchor: "middle", children: photographerCredit }) })] }))] }));
|
|
40
42
|
}
|
|
41
|
-
|
|
42
|
-
export { Avatar };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
.container {
|
|
2
2
|
inline-size: var(--size);
|
|
3
3
|
block-size: var(--size);
|
|
4
|
+
max-inline-size: var(--component-size-xl);
|
|
4
5
|
aspect-ratio: 1 / 1;
|
|
5
6
|
border-radius: var(--border-radius-round);
|
|
6
7
|
background-color: var(--bg);
|
|
@@ -18,6 +19,7 @@
|
|
|
18
19
|
background: var(--bg);
|
|
19
20
|
transition: opacity var(--transition-fast) var(--ease-standard);
|
|
20
21
|
}
|
|
22
|
+
|
|
21
23
|
.container.button:hover {
|
|
22
24
|
opacity: 0.8;
|
|
23
25
|
}
|
|
@@ -41,3 +43,28 @@
|
|
|
41
43
|
.imageSlot {
|
|
42
44
|
display: contents;
|
|
43
45
|
}
|
|
46
|
+
|
|
47
|
+
/* Wrapper for non-button avatar so we can overlay SVG */
|
|
48
|
+
.wrapper {
|
|
49
|
+
position: relative;
|
|
50
|
+
display: inline-block;
|
|
51
|
+
color: var(--text);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* Circular photographer credit text overlay */
|
|
55
|
+
.creditText {
|
|
56
|
+
position: absolute;
|
|
57
|
+
inset: 0;
|
|
58
|
+
width: 100%;
|
|
59
|
+
height: 100%;
|
|
60
|
+
pointer-events: none;
|
|
61
|
+
fill: currentColor;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Make sure the font is large enough and clearly visible */
|
|
65
|
+
.creditText text {
|
|
66
|
+
font-size: 11px;
|
|
67
|
+
font-weight: 600;
|
|
68
|
+
text-transform: uppercase;
|
|
69
|
+
letter-spacing: 0.08em;
|
|
70
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ReactNode, HTMLAttributes, JSX } from 'react';
|
|
2
2
|
export interface BreadcrumbItem {
|
|
3
|
-
label: string |
|
|
3
|
+
label: string | ReactNode;
|
|
4
4
|
onClick?: () => void;
|
|
5
|
-
icon?:
|
|
5
|
+
icon?: ReactNode;
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
hidden?: boolean;
|
|
8
8
|
}
|
|
9
9
|
export interface BreadcrumbsProps {
|
|
10
10
|
items: BreadcrumbItem[];
|
|
11
11
|
}
|
|
12
|
-
export declare function Breadcrumbs({ items }: BreadcrumbsProps): JSX.Element;
|
|
12
|
+
export declare function Breadcrumbs({ items, ...navProps }: BreadcrumbsProps & HTMLAttributes<HTMLElement>): JSX.Element;
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import { jsx, jsxs } from
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from 'react';
|
|
3
3
|
import styles from './Breadcrumbs.module.css';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function Breadcrumbs({ items }) {
|
|
7
|
-
return /* @__PURE__ */ jsx("nav", { className: styles.breadcrumbs, "aria-label": "breadcrumb", children: /* @__PURE__ */ jsx("ul", { children: items.map((item, index) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
8
|
-
/* @__PURE__ */ jsxs("li", { children: [
|
|
9
|
-
item.icon && item.icon,
|
|
10
|
-
item.onClick ? /* @__PURE__ */ jsx("button", { onClick: item.onClick, children: item.label }) : /* @__PURE__ */ jsx("span", { children: item.label })
|
|
11
|
-
] }),
|
|
12
|
-
index < items.length - 1 && /* @__PURE__ */ jsx("span", { className: styles.separator, children: /* @__PURE__ */ jsx(ChevronRight, {}) })
|
|
13
|
-
] }, `breadcrumbItem-${item.label}-${index}`)) }) });
|
|
4
|
+
export function Breadcrumbs({ items, ...navProps }) {
|
|
5
|
+
return (_jsx("nav", { className: styles.breadcrumbs, "aria-label": "breadcrumb", ...navProps, children: _jsx("ul", { children: items.map((item, index) => (_jsxs(Fragment, { children: [_jsxs("li", { children: [item.icon && item.icon, item.onClick ? (_jsx("button", { onClick: item.onClick, children: item.label })) : (_jsx("span", { children: item.label }))] }), index < items.length - 1 && _jsx("span", { className: styles.separator, children: "/" })] }, `breadcrumbItem-${item.label}-${index}`))) }) }));
|
|
14
6
|
}
|
|
15
|
-
|
|
16
|
-
export { Breadcrumbs };
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
margin: 0;
|
|
11
11
|
padding: 0;
|
|
12
12
|
font-size: var(--font-size-sm);
|
|
13
|
-
gap: var(--space-inline-sm);
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
.breadcrumbs li {
|
|
@@ -19,7 +18,7 @@
|
|
|
19
18
|
gap: var(--spacing-xxs);
|
|
20
19
|
padding-block: calc(var(--spacing-xxs) + var(--density));
|
|
21
20
|
padding-inline: 0;
|
|
22
|
-
color: var(--color-
|
|
21
|
+
color: var(--color-fg-default);
|
|
23
22
|
border-radius: var(--border-radius-sm);
|
|
24
23
|
position: relative;
|
|
25
24
|
transition:
|
|
@@ -27,47 +26,45 @@
|
|
|
27
26
|
background-color var(--transition-fast) var(--ease-standard);
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
.breadcrumbs li:hover {
|
|
31
|
-
color: var(--color-
|
|
32
|
-
background-color: var(--color-
|
|
29
|
+
.breadcrumbs li:hover button {
|
|
30
|
+
color: var(--color-fg-default);
|
|
31
|
+
background-color: var(--color-bg-contextual);
|
|
33
32
|
cursor: pointer;
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
.breadcrumbs li[aria-current='page'],
|
|
37
36
|
.breadcrumbs li:last-of-type {
|
|
38
|
-
color: var(--color-
|
|
37
|
+
color: var(--color-fg-default);
|
|
39
38
|
cursor: default;
|
|
40
39
|
}
|
|
41
40
|
|
|
42
|
-
.breadcrumbs li[aria-current='page']
|
|
43
|
-
.breadcrumbs li:last-of-type
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
inset-inline-start: 0;
|
|
47
|
-
inset-block-end: 0;
|
|
48
|
-
inline-size: 100%;
|
|
49
|
-
block-size: 2px;
|
|
50
|
-
background-color: var(--color-primary);
|
|
51
|
-
border-radius: 1px;
|
|
52
|
-
pointer-events: none;
|
|
41
|
+
.breadcrumbs li[aria-current='page'] button,
|
|
42
|
+
.breadcrumbs li:last-of-type button {
|
|
43
|
+
background-color: var(--color-bg-contextual) !important;
|
|
44
|
+
font-weight: var(--font-weight-medium);
|
|
53
45
|
}
|
|
54
46
|
|
|
55
47
|
.separator {
|
|
56
48
|
display: flex;
|
|
57
49
|
align-items: center;
|
|
58
|
-
|
|
50
|
+
padding: 0 var(--spacing-xs);
|
|
51
|
+
color: var(--color-fg-subtle);
|
|
52
|
+
font-size: var(--font-size-md);
|
|
59
53
|
}
|
|
60
54
|
|
|
61
55
|
.breadcrumbs li svg {
|
|
62
|
-
inline-size:
|
|
63
|
-
block-size:
|
|
56
|
+
inline-size: var(--icon-size-sm);
|
|
57
|
+
block-size: var(--icon-size-sm);
|
|
64
58
|
}
|
|
59
|
+
|
|
65
60
|
.breadcrumbs a,
|
|
66
61
|
.breadcrumbs button,
|
|
67
62
|
.breadcrumbs [role='link'] {
|
|
68
63
|
all: unset;
|
|
69
64
|
color: inherit;
|
|
70
|
-
border-radius: var(--border-radius-
|
|
65
|
+
border-radius: var(--border-radius-default);
|
|
66
|
+
background-color: var(--color-bg-contextual-subtle);
|
|
67
|
+
padding: var(--spacing-xxs) var(--spacing-sm);
|
|
71
68
|
}
|
|
72
69
|
|
|
73
70
|
.breadcrumbs a:focus-visible,
|
|
@@ -79,6 +76,6 @@
|
|
|
79
76
|
|
|
80
77
|
.breadcrumbs [aria-disabled='true'],
|
|
81
78
|
.breadcrumbs .is-disabled {
|
|
82
|
-
color: var(--color-disabled-
|
|
79
|
+
color: var(--color-disabled-fg);
|
|
83
80
|
pointer-events: none;
|
|
84
81
|
}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import type { Size } from '../../types/sizes.types';
|
|
2
3
|
export type ButtonVariant = 'primary' | 'secondary' | 'outlined' | 'default' | 'inline' | 'success' | 'danger';
|
|
4
|
+
export type ButtonSize = Exclude<Size, 'xl'>;
|
|
3
5
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
6
|
variant?: ButtonVariant;
|
|
5
|
-
size?:
|
|
7
|
+
size?: ButtonSize;
|
|
8
|
+
fullWidth?: boolean;
|
|
6
9
|
icon?: React.ReactNode;
|
|
7
10
|
loading?: boolean;
|
|
8
11
|
active?: boolean;
|
|
9
12
|
spinIcon?: boolean;
|
|
10
|
-
tooltip?:
|
|
13
|
+
tooltip?: React.ReactNode;
|
|
14
|
+
tooltipPlacement?: 'top' | 'right' | 'bottom' | 'left';
|
|
11
15
|
isLink?: boolean;
|
|
12
16
|
}
|
|
13
17
|
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,54 +1,60 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { LoaderCircle } from 'lucide-react';
|
|
2
4
|
import * as React from 'react';
|
|
5
|
+
import { useTooltipTrigger } from '../../components/overlay/tooltip/useTooltipTrigger';
|
|
3
6
|
import styles from './Button.module.css';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
styles.button,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
].filter(Boolean).join(" ");
|
|
29
|
-
if (isLink && React.isValidElement(children)) {
|
|
30
|
-
buttonEl = React.cloneElement(children, {
|
|
31
|
-
className,
|
|
32
|
-
...rest,
|
|
33
|
-
ref,
|
|
34
|
-
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
35
|
-
icon && /* @__PURE__ */ jsx("span", { className: `${styles.icon} ${spinIcon ? "spin" : ""}`, children: icon }),
|
|
36
|
-
children.props.children,
|
|
37
|
-
loading && /* @__PURE__ */ jsx("span", { style: { display: "flex", opacity: 0.5 }, className: "spin", children: /* @__PURE__ */ jsx(LoaderCircle, {}) })
|
|
38
|
-
] })
|
|
7
|
+
function cx(...parts) {
|
|
8
|
+
return parts.filter(Boolean).join(' ');
|
|
9
|
+
}
|
|
10
|
+
function mergeRefs(...refs) {
|
|
11
|
+
return (node) => {
|
|
12
|
+
for (const ref of refs) {
|
|
13
|
+
if (!ref)
|
|
14
|
+
continue;
|
|
15
|
+
if (typeof ref === 'function')
|
|
16
|
+
ref(node);
|
|
17
|
+
else
|
|
18
|
+
ref.current = node;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export const Button = React.forwardRef(function Button({ variant = 'outlined', size = 'md', fullWidth, icon, children, loading, active, spinIcon, tooltip, tooltipPlacement = 'top', isLink, type = 'button', ...rest }, ref) {
|
|
23
|
+
const { className: userClassName, ...buttonProps } = rest;
|
|
24
|
+
const computedClassName = cx(styles.button, styles[variant], styles[size], fullWidth ? styles.fullWidth : '', active ? styles.active : '', loading ? styles.loading : '', isLink ? styles.link : '', userClassName);
|
|
25
|
+
const tooltipEnabled = Boolean(tooltip);
|
|
26
|
+
// Tooltip anchored to the actual clickable element (button or link element)
|
|
27
|
+
const { triggerProps, id: tooltipId } = useTooltipTrigger({
|
|
28
|
+
content: tooltipEnabled ? tooltip : null,
|
|
29
|
+
placement: tooltipPlacement,
|
|
30
|
+
offset: 8,
|
|
39
31
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
32
|
+
// Merge aria-describedby (button may already have one)
|
|
33
|
+
const describedBy = (() => {
|
|
34
|
+
const existing = typeof buttonProps['aria-describedby'] === 'string'
|
|
35
|
+
? buttonProps['aria-describedby']
|
|
36
|
+
: '';
|
|
37
|
+
const ids = [existing, tooltipEnabled ? tooltipId : ''].filter(Boolean);
|
|
38
|
+
return ids.length ? ids.join(' ') : undefined;
|
|
39
|
+
})();
|
|
40
|
+
const content = (_jsxs(_Fragment, { children: [icon && _jsx("span", { className: cx(styles.icon, spinIcon ? 'spin' : ''), children: icon }), children, loading && (_jsx("span", { style: { display: 'flex', opacity: 0.5 }, className: "spin", children: _jsx(LoaderCircle, {}) }))] }));
|
|
41
|
+
let buttonEl;
|
|
42
|
+
if (isLink && React.isValidElement(children)) {
|
|
43
|
+
// If this is a link-style button, we need to attach tooltip handlers + ref to the child.
|
|
44
|
+
const childClassName = typeof children.props.className === 'string' ? children.props.className : '';
|
|
45
|
+
const childRef = children.ref;
|
|
46
|
+
buttonEl = React.cloneElement(children, {
|
|
47
|
+
...buttonProps,
|
|
48
|
+
ref: mergeRefs(childRef, ref),
|
|
49
|
+
className: cx(childClassName, computedClassName),
|
|
50
|
+
...(tooltipEnabled ? triggerProps : {}),
|
|
51
|
+
'aria-describedby': describedBy,
|
|
52
|
+
children: (_jsxs(_Fragment, { children: [icon && _jsx("span", { className: cx(styles.icon, spinIcon ? 'spin' : ''), children: icon }), children.props.children, loading && (_jsx("span", { style: { display: 'flex', opacity: 0.5 }, className: "spin", children: _jsx(LoaderCircle, {}) }))] })),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
buttonEl = (_jsx("button", { className: computedClassName, type: type, ...buttonProps, ...(tooltipEnabled ? triggerProps : {}), "aria-describedby": describedBy, children: content }));
|
|
57
|
+
}
|
|
58
|
+
return buttonEl;
|
|
51
59
|
});
|
|
52
|
-
Button.displayName =
|
|
53
|
-
|
|
54
|
-
export { Button };
|
|
60
|
+
Button.displayName = 'Button';
|