@dbcdk/react-components 0.0.3 → 0.0.5
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.cjs +10 -10
- package/dist/assets/logo.js +10 -10
- package/dist/components/__stories__/story-components/Colors.cjs +159 -0
- package/dist/components/__stories__/story-components/Colors.d.ts +10 -0
- package/dist/components/__stories__/story-components/Colors.js +151 -0
- package/dist/components/__stories__/story-components/Colors.module.css +27 -0
- package/dist/components/__stories__/story-components/Spacing.cjs +190 -0
- package/dist/components/__stories__/story-components/Spacing.d.ts +1 -0
- package/dist/components/__stories__/story-components/Spacing.js +184 -0
- package/dist/components/__stories__/story-components/Spacing.module.css +154 -0
- package/dist/components/app-header/AppHeader.module.css +10 -15
- package/dist/components/attribute-chip/AttributeChip.cjs +22 -0
- package/dist/components/attribute-chip/AttributeChip.d.ts +8 -0
- package/dist/components/attribute-chip/AttributeChip.js +16 -0
- package/dist/components/attribute-chip/AttributeChip.module.css +65 -0
- package/dist/components/avatar/Avatar.cjs +38 -4
- package/dist/components/avatar/Avatar.d.ts +4 -2
- package/dist/components/avatar/Avatar.js +39 -5
- package/dist/components/avatar/Avatar.module.css +27 -0
- package/dist/components/breadcrumbs/Breadcrumbs.cjs +1 -2
- package/dist/components/breadcrumbs/Breadcrumbs.js +1 -2
- package/dist/components/breadcrumbs/Breadcrumbs.module.css +19 -22
- package/dist/components/button/Button.cjs +20 -12
- package/dist/components/button/Button.d.ts +4 -1
- package/dist/components/button/Button.js +20 -12
- package/dist/components/button/Button.module.css +118 -55
- package/dist/components/card/Card.cjs +53 -13
- package/dist/components/card/Card.d.ts +21 -6
- package/dist/components/card/Card.js +54 -14
- package/dist/components/card/Card.module.css +148 -44
- package/dist/components/card-container/CardContainer.cjs +6 -5
- package/dist/components/card-container/CardContainer.d.ts +5 -2
- package/dist/components/card-container/CardContainer.js +6 -5
- package/dist/components/card-container/CardContainer.module.css +40 -0
- package/dist/components/checkbox/Checkbox.cjs +3 -4
- package/dist/components/checkbox/Checkbox.d.ts +1 -1
- package/dist/components/checkbox/Checkbox.js +3 -4
- package/dist/components/checkbox/Checkbox.module.css +10 -10
- package/dist/components/chip/Chip.cjs +2 -1
- package/dist/components/chip/Chip.d.ts +2 -1
- package/dist/components/chip/Chip.js +2 -1
- package/dist/components/chip/Chip.module.css +42 -27
- package/dist/components/circle/Circle.module.css +11 -11
- package/dist/components/clear-button/ClearButton.cjs +3 -3
- package/dist/components/clear-button/ClearButton.js +3 -3
- package/dist/components/clear-button/ClearButton.module.css +8 -7
- package/dist/components/code-block/CodeBlock.cjs +18 -0
- package/dist/components/code-block/CodeBlock.d.ts +6 -0
- package/dist/components/code-block/CodeBlock.js +12 -0
- package/dist/components/code-block/CodeBlock.module.css +60 -0
- package/dist/components/copy-button/CopyButton.cjs +35 -0
- package/dist/components/copy-button/CopyButton.d.ts +9 -0
- package/dist/components/copy-button/CopyButton.js +29 -0
- package/dist/components/copy-button/CopyButton.module.css +6 -0
- package/dist/components/datetime-picker/DateTimePicker.cjs +504 -0
- package/dist/components/datetime-picker/DateTimePicker.d.ts +39 -0
- package/dist/components/datetime-picker/DateTimePicker.js +498 -0
- package/dist/components/datetime-picker/DateTimePicker.module.css +144 -0
- package/dist/components/filter-field/FilterField.cjs +34 -19
- package/dist/components/filter-field/FilterField.d.ts +2 -2
- package/dist/components/filter-field/FilterField.js +35 -20
- package/dist/components/filter-field/FilterField.module.css +14 -20
- package/dist/components/headline/Headline.cjs +10 -4
- package/dist/components/headline/Headline.d.ts +9 -1
- package/dist/components/headline/Headline.js +10 -4
- package/dist/components/headline/Headline.module.css +32 -7
- package/dist/components/icon/Icon.module.css +10 -9
- package/dist/components/input/Input.cjs +60 -19
- package/dist/components/input/Input.d.ts +7 -2
- package/dist/components/input/Input.js +60 -19
- package/dist/components/input/Input.module.css +90 -43
- package/dist/components/link/Link.cjs +46 -0
- package/dist/components/link/Link.d.ts +9 -0
- package/dist/components/link/Link.js +21 -0
- package/dist/components/link/Link.module.css +32 -0
- package/dist/components/menu/Menu.module.css +10 -32
- package/dist/components/meta-bar/MetaBar.cjs +29 -0
- package/dist/components/meta-bar/MetaBar.d.ts +11 -0
- package/dist/components/meta-bar/MetaBar.js +22 -0
- package/dist/components/meta-bar/MetaBar.module.css +12 -0
- package/dist/components/modal/Modal.cjs +134 -0
- package/dist/components/modal/Modal.d.ts +21 -0
- package/dist/components/modal/Modal.js +128 -0
- package/dist/components/modal/Modal.module.css +66 -0
- package/dist/components/modal/provider/ModalProvider.cjs +80 -0
- package/dist/components/modal/provider/ModalProvider.d.ts +21 -0
- package/dist/components/modal/provider/ModalProvider.js +77 -0
- package/dist/components/multi-select/MultiSelect.cjs +12 -1
- package/dist/components/multi-select/MultiSelect.js +12 -1
- package/dist/components/nav-bar/NavBar.module.css +11 -16
- package/dist/components/page/Page.module.css +2 -2
- package/dist/components/page-layout/PageLayout.cjs +5 -22
- package/dist/components/page-layout/PageLayout.d.ts +1 -8
- package/dist/components/page-layout/PageLayout.js +5 -22
- package/dist/components/page-layout/PageLayout.module.css +4 -80
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.cjs +32 -0
- 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 +25 -0
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.module.css +84 -0
- package/dist/components/pagination/Pagination.cjs +83 -67
- package/dist/components/pagination/Pagination.d.ts +3 -1
- package/dist/components/pagination/Pagination.js +84 -68
- package/dist/components/pagination/Pagination.module.css +11 -3
- package/dist/components/panel/Panel.module.css +5 -7
- package/dist/components/popover/Popover.cjs +25 -8
- package/dist/components/popover/Popover.d.ts +2 -1
- package/dist/components/popover/Popover.js +25 -8
- package/dist/components/popover/Popover.module.css +4 -6
- package/dist/components/search-box/SearchBox.cjs +50 -37
- package/dist/components/search-box/SearchBox.d.ts +10 -7
- package/dist/components/search-box/SearchBox.js +50 -37
- package/dist/components/search-box/SearchBox.module.css +0 -1
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.cjs +12 -6
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.js +12 -6
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.module.css +5 -1
- package/dist/components/select/Select.cjs +82 -13
- package/dist/components/select/Select.d.ts +2 -1
- package/dist/components/select/Select.js +83 -14
- package/dist/components/sidebar/Sidebar.cjs +3 -30
- package/dist/components/sidebar/Sidebar.d.ts +2 -1
- package/dist/components/sidebar/Sidebar.js +4 -26
- package/dist/components/sidebar/components/SidebarItem.cjs +3 -1
- package/dist/components/sidebar/components/SidebarItem.js +3 -1
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs +40 -14
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.d.ts +3 -1
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +40 -14
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css +9 -38
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.cjs +50 -0
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.d.ts +8 -0
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +43 -0
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.module.css +155 -0
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.cjs +16 -9
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.d.ts +2 -1
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +16 -9
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css +25 -12
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.cjs +2 -1
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.d.ts +1 -1
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +2 -1
- package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.cjs +29 -2
- package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.js +25 -2
- package/dist/components/sidebar/providers/SidebarProvider.cjs +108 -10
- package/dist/components/sidebar/providers/SidebarProvider.d.ts +7 -3
- package/dist/components/sidebar/providers/SidebarProvider.js +109 -11
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.cjs +1 -1
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.js +1 -1
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.module.css +0 -12
- package/dist/components/split-pane/SplitPane.cjs +123 -0
- package/dist/components/split-pane/SplitPane.d.ts +34 -0
- package/dist/components/split-pane/SplitPane.js +114 -0
- package/dist/components/split-pane/SplitPane.module.css +106 -0
- package/dist/components/split-pane/provider/SplitPaneContext.cjs +87 -0
- package/dist/components/split-pane/provider/SplitPaneContext.d.ts +23 -0
- package/dist/components/split-pane/provider/SplitPaneContext.js +79 -0
- package/dist/components/table/Table.cjs +180 -112
- package/dist/components/table/Table.d.ts +22 -6
- package/dist/components/table/Table.js +181 -113
- package/dist/components/table/Table.module.css +74 -47
- package/dist/components/table/components/empty-state/EmptyState.cjs +52 -0
- package/dist/components/table/components/empty-state/EmptyState.d.ts +40 -0
- package/dist/components/table/components/empty-state/EmptyState.js +46 -0
- package/dist/components/table/components/empty-state/EmptyState.module.css +16 -0
- package/dist/components/table/components/table-settings/TableSettings.cjs +32 -0
- package/dist/components/table/components/table-settings/TableSettings.d.ts +7 -0
- package/dist/components/table/components/table-settings/TableSettings.js +30 -0
- package/dist/{tanstack.cjs → components/table/tanstack.cjs} +61 -99
- package/dist/components/table/tanstack.d.ts +14 -0
- package/dist/{tanstack.js → components/table/tanstack.js} +61 -99
- package/dist/components/tabs/Tabs.cjs +33 -17
- package/dist/components/tabs/Tabs.d.ts +6 -3
- package/dist/components/tabs/Tabs.js +33 -17
- package/dist/components/tabs/Tabs.module.css +9 -9
- package/dist/components/toast/Toast.cjs +47 -0
- package/dist/components/toast/Toast.d.ts +14 -0
- package/dist/components/toast/Toast.js +41 -0
- package/dist/components/toast/Toast.module.css +101 -0
- package/dist/components/toast/provider/ToastProvider.cjs +98 -0
- package/dist/components/toast/provider/ToastProvider.d.ts +23 -0
- package/dist/components/toast/provider/ToastProvider.js +91 -0
- package/dist/components/tooltip/Tooltip.cjs +134 -29
- package/dist/components/tooltip/Tooltip.js +135 -30
- package/dist/components/tooltip/Tooltip.module.css +25 -43
- package/dist/components/user-display/UserDisplay.module.css +2 -2
- package/dist/constants/severity.cjs +12 -12
- package/dist/constants/severity.js +12 -12
- package/dist/constants/sizes.cjs +1 -0
- package/dist/constants/sizes.d.ts +1 -1
- package/dist/constants/sizes.js +1 -0
- package/dist/hooks/usePagination.cjs +88 -0
- package/dist/hooks/usePagination.d.ts +33 -0
- package/dist/hooks/usePagination.js +86 -0
- package/dist/hooks/useSorting.cjs +118 -0
- package/dist/hooks/useSorting.d.ts +49 -0
- package/dist/hooks/useSorting.js +116 -0
- package/dist/hooks/useTableData.cjs +52 -0
- package/dist/hooks/useTableData.d.ts +40 -0
- package/dist/hooks/useTableData.js +50 -0
- package/dist/hooks/useTableSelection.cjs +130 -0
- package/dist/hooks/useTableSelection.d.ts +25 -0
- package/dist/hooks/useTableSelection.js +128 -0
- package/dist/hooks/useTableSettings.cjs +28 -0
- package/dist/hooks/useTableSettings.d.ts +7 -0
- package/dist/hooks/useTableSettings.js +26 -0
- package/dist/hooks/useTimeDuration.cjs +39 -0
- package/dist/hooks/useTimeDuration.d.ts +22 -0
- package/dist/hooks/useTimeDuration.js +37 -0
- package/dist/hooks/useViewportFill.js +1 -1
- package/dist/index.cjs +119 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +17 -0
- package/dist/src/styles/styles.css +101 -8
- package/dist/styles/css-helper-classes/flex.css +97 -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 +206 -99
- package/dist/styles/themes/dbc/light.css +183 -89
- package/dist/types/sizes.types.d.ts +2 -2
- package/package.json +17 -11
- 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/sidebar/Sidebar.module.css +0 -66
- package/dist/tanstack.d.ts +0 -25
|
@@ -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
|
+
}
|
|
@@ -37,14 +37,18 @@ function Avatar({
|
|
|
37
37
|
color = "brand",
|
|
38
38
|
button,
|
|
39
39
|
size = "md",
|
|
40
|
+
className,
|
|
41
|
+
fullWidth = false,
|
|
42
|
+
photographerCredit,
|
|
40
43
|
...rest
|
|
41
44
|
}) {
|
|
42
|
-
const text = fullName ? fullName.split(
|
|
45
|
+
const text = fullName ? fullName.trim().split(/\s+/).map((name) => name.charAt(0)).join("").toUpperCase() : "";
|
|
43
46
|
const styleVars = {
|
|
44
47
|
"--bg": severity.SeverityBgColor[color],
|
|
45
48
|
"--text": severity.SeverityTextColor[color],
|
|
46
|
-
"--size": sizes.sizes[size]
|
|
49
|
+
"--size": fullWidth ? "100%" : sizes.sizes[size]
|
|
47
50
|
};
|
|
51
|
+
const pathId = React__namespace.useId();
|
|
48
52
|
const renderImage = () => {
|
|
49
53
|
if (image) {
|
|
50
54
|
if (React__namespace.isValidElement(image)) {
|
|
@@ -59,9 +63,39 @@ function Avatar({
|
|
|
59
63
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.avatar, "aria-hidden": "true", children: text });
|
|
60
64
|
};
|
|
61
65
|
if (button) {
|
|
62
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
66
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
67
|
+
"button",
|
|
68
|
+
{
|
|
69
|
+
type: "button",
|
|
70
|
+
...rest,
|
|
71
|
+
className: [styles__default.default.container, styles__default.default.button, className].filter(Boolean).join(" "),
|
|
72
|
+
style: styleVars,
|
|
73
|
+
children: renderImage()
|
|
74
|
+
}
|
|
75
|
+
);
|
|
63
76
|
}
|
|
64
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
77
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: [styles__default.default.wrapper, className].filter(Boolean).join(" "), style: styleVars, children: [
|
|
78
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.container, children: renderImage() }),
|
|
79
|
+
photographerCredit && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
80
|
+
"svg",
|
|
81
|
+
{
|
|
82
|
+
className: styles__default.default.creditText,
|
|
83
|
+
viewBox: "0 0 100 100",
|
|
84
|
+
"aria-hidden": "true",
|
|
85
|
+
focusable: "false",
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
88
|
+
"path",
|
|
89
|
+
{
|
|
90
|
+
id: pathId,
|
|
91
|
+
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 "
|
|
92
|
+
}
|
|
93
|
+
) }),
|
|
94
|
+
/* @__PURE__ */ jsxRuntime.jsx("text", { children: /* @__PURE__ */ jsxRuntime.jsx("textPath", { xlinkHref: `#${pathId}`, startOffset: "50%", textAnchor: "middle", children: photographerCredit }) })
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
] });
|
|
65
99
|
}
|
|
66
100
|
|
|
67
101
|
exports.Avatar = Avatar;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import type { ButtonHTMLAttributes } from 'react';
|
|
2
3
|
import type { Size } from '../../types/sizes.types';
|
|
3
4
|
import type { Severity } from '../../constants/severity.types';
|
|
4
|
-
import { ButtonHTMLAttributes } from 'react';
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import styles from './Avatar.module.css';
|
|
4
4
|
import { sizes } from '../../constants/sizes';
|
|
@@ -12,14 +12,18 @@ function Avatar({
|
|
|
12
12
|
color = "brand",
|
|
13
13
|
button,
|
|
14
14
|
size = "md",
|
|
15
|
+
className,
|
|
16
|
+
fullWidth = false,
|
|
17
|
+
photographerCredit,
|
|
15
18
|
...rest
|
|
16
19
|
}) {
|
|
17
|
-
const text = fullName ? fullName.split(
|
|
20
|
+
const text = fullName ? fullName.trim().split(/\s+/).map((name) => name.charAt(0)).join("").toUpperCase() : "";
|
|
18
21
|
const styleVars = {
|
|
19
22
|
"--bg": SeverityBgColor[color],
|
|
20
23
|
"--text": SeverityTextColor[color],
|
|
21
|
-
"--size": sizes[size]
|
|
24
|
+
"--size": fullWidth ? "100%" : sizes[size]
|
|
22
25
|
};
|
|
26
|
+
const pathId = React.useId();
|
|
23
27
|
const renderImage = () => {
|
|
24
28
|
if (image) {
|
|
25
29
|
if (React.isValidElement(image)) {
|
|
@@ -34,9 +38,39 @@ function Avatar({
|
|
|
34
38
|
return /* @__PURE__ */ jsx("span", { className: styles.avatar, "aria-hidden": "true", children: text });
|
|
35
39
|
};
|
|
36
40
|
if (button) {
|
|
37
|
-
return /* @__PURE__ */ jsx(
|
|
41
|
+
return /* @__PURE__ */ jsx(
|
|
42
|
+
"button",
|
|
43
|
+
{
|
|
44
|
+
type: "button",
|
|
45
|
+
...rest,
|
|
46
|
+
className: [styles.container, styles.button, className].filter(Boolean).join(" "),
|
|
47
|
+
style: styleVars,
|
|
48
|
+
children: renderImage()
|
|
49
|
+
}
|
|
50
|
+
);
|
|
38
51
|
}
|
|
39
|
-
return /* @__PURE__ */
|
|
52
|
+
return /* @__PURE__ */ jsxs("div", { className: [styles.wrapper, className].filter(Boolean).join(" "), style: styleVars, children: [
|
|
53
|
+
/* @__PURE__ */ jsx("div", { className: styles.container, children: renderImage() }),
|
|
54
|
+
photographerCredit && /* @__PURE__ */ jsxs(
|
|
55
|
+
"svg",
|
|
56
|
+
{
|
|
57
|
+
className: styles.creditText,
|
|
58
|
+
viewBox: "0 0 100 100",
|
|
59
|
+
"aria-hidden": "true",
|
|
60
|
+
focusable: "false",
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx(
|
|
63
|
+
"path",
|
|
64
|
+
{
|
|
65
|
+
id: pathId,
|
|
66
|
+
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 "
|
|
67
|
+
}
|
|
68
|
+
) }),
|
|
69
|
+
/* @__PURE__ */ jsx("text", { children: /* @__PURE__ */ jsx("textPath", { xlinkHref: `#${pathId}`, startOffset: "50%", textAnchor: "middle", children: photographerCredit }) })
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
] });
|
|
40
74
|
}
|
|
41
75
|
|
|
42
76
|
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,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var lucideReact = require('lucide-react');
|
|
5
4
|
var styles = require('./Breadcrumbs.module.css');
|
|
6
5
|
var React = require('react');
|
|
7
6
|
|
|
@@ -16,7 +15,7 @@ function Breadcrumbs({ items }) {
|
|
|
16
15
|
item.icon && item.icon,
|
|
17
16
|
item.onClick ? /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: item.onClick, children: item.label }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label })
|
|
18
17
|
] }),
|
|
19
|
-
index < items.length - 1 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.separator, children:
|
|
18
|
+
index < items.length - 1 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.separator, children: "/" })
|
|
20
19
|
] }, `breadcrumbItem-${item.label}-${index}`)) }) });
|
|
21
20
|
}
|
|
22
21
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { ChevronRight } from 'lucide-react';
|
|
3
2
|
import styles from './Breadcrumbs.module.css';
|
|
4
3
|
import React from 'react';
|
|
5
4
|
|
|
@@ -9,7 +8,7 @@ function Breadcrumbs({ items }) {
|
|
|
9
8
|
item.icon && item.icon,
|
|
10
9
|
item.onClick ? /* @__PURE__ */ jsx("button", { onClick: item.onClick, children: item.label }) : /* @__PURE__ */ jsx("span", { children: item.label })
|
|
11
10
|
] }),
|
|
12
|
-
index < items.length - 1 && /* @__PURE__ */ jsx("span", { className: styles.separator, children:
|
|
11
|
+
index < items.length - 1 && /* @__PURE__ */ jsx("span", { className: styles.separator, children: "/" })
|
|
13
12
|
] }, `breadcrumbItem-${item.label}-${index}`)) }) });
|
|
14
13
|
}
|
|
15
14
|
|
|
@@ -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
|
}
|
|
@@ -29,9 +29,13 @@ function _interopNamespace(e) {
|
|
|
29
29
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
30
30
|
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
31
31
|
|
|
32
|
+
function cx(...parts) {
|
|
33
|
+
return parts.filter(Boolean).join(" ");
|
|
34
|
+
}
|
|
32
35
|
const Button = React__namespace.forwardRef(function Button2({
|
|
33
36
|
variant = "outlined",
|
|
34
37
|
size = "md",
|
|
38
|
+
fullWidth,
|
|
35
39
|
icon,
|
|
36
40
|
children,
|
|
37
41
|
loading,
|
|
@@ -41,33 +45,37 @@ const Button = React__namespace.forwardRef(function Button2({
|
|
|
41
45
|
isLink,
|
|
42
46
|
...rest
|
|
43
47
|
}, ref) {
|
|
44
|
-
|
|
45
|
-
const
|
|
48
|
+
const { className: userClassName, ...buttonProps } = rest;
|
|
49
|
+
const computedClassName = cx(
|
|
46
50
|
styles__default.default.button,
|
|
47
51
|
styles__default.default[variant],
|
|
48
52
|
styles__default.default[size],
|
|
53
|
+
fullWidth ? styles__default.default.fullWidth : "",
|
|
49
54
|
active ? styles__default.default.active : "",
|
|
50
55
|
loading ? styles__default.default.loading : "",
|
|
51
56
|
isLink ? styles__default.default.link : "",
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
userClassName
|
|
58
|
+
);
|
|
59
|
+
const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
60
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cx(styles__default.default.icon, spinIcon ? "spin" : ""), children: icon }),
|
|
61
|
+
children,
|
|
62
|
+
loading && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "flex", opacity: 0.5 }, className: "spin", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LoaderCircle, {}) })
|
|
63
|
+
] });
|
|
64
|
+
let buttonEl;
|
|
54
65
|
if (isLink && React__namespace.isValidElement(children)) {
|
|
66
|
+
const childClassName = typeof children.props.className === "string" ? children.props.className : "";
|
|
55
67
|
buttonEl = React__namespace.cloneElement(children, {
|
|
56
|
-
|
|
57
|
-
...rest,
|
|
68
|
+
...buttonProps,
|
|
58
69
|
ref,
|
|
70
|
+
className: cx(childClassName, computedClassName),
|
|
59
71
|
children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
60
|
-
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className:
|
|
72
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cx(styles__default.default.icon, spinIcon ? "spin" : ""), children: icon }),
|
|
61
73
|
children.props.children,
|
|
62
74
|
loading && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "flex", opacity: 0.5 }, className: "spin", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LoaderCircle, {}) })
|
|
63
75
|
] })
|
|
64
76
|
});
|
|
65
77
|
} else {
|
|
66
|
-
buttonEl = /* @__PURE__ */ jsxRuntime.
|
|
67
|
-
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `${styles__default.default.icon} ${spinIcon ? "spin" : ""}`, children: icon }),
|
|
68
|
-
children,
|
|
69
|
-
loading && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "flex", opacity: 0.5 }, className: "spin", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LoaderCircle, {}) })
|
|
70
|
-
] });
|
|
78
|
+
buttonEl = /* @__PURE__ */ jsxRuntime.jsx("button", { ref, className: computedClassName, ...buttonProps, children: content });
|
|
71
79
|
}
|
|
72
80
|
if (tooltip) {
|
|
73
81
|
return /* @__PURE__ */ jsxRuntime.jsx(Tooltip.Tooltip, { content: tooltip, children: buttonEl });
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { 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;
|
|
@@ -4,9 +4,13 @@ import styles from './Button.module.css';
|
|
|
4
4
|
import { LoaderCircle } from 'lucide-react';
|
|
5
5
|
import { Tooltip } from '../tooltip/Tooltip';
|
|
6
6
|
|
|
7
|
+
function cx(...parts) {
|
|
8
|
+
return parts.filter(Boolean).join(" ");
|
|
9
|
+
}
|
|
7
10
|
const Button = React.forwardRef(function Button2({
|
|
8
11
|
variant = "outlined",
|
|
9
12
|
size = "md",
|
|
13
|
+
fullWidth,
|
|
10
14
|
icon,
|
|
11
15
|
children,
|
|
12
16
|
loading,
|
|
@@ -16,33 +20,37 @@ const Button = React.forwardRef(function Button2({
|
|
|
16
20
|
isLink,
|
|
17
21
|
...rest
|
|
18
22
|
}, ref) {
|
|
19
|
-
|
|
20
|
-
const
|
|
23
|
+
const { className: userClassName, ...buttonProps } = rest;
|
|
24
|
+
const computedClassName = cx(
|
|
21
25
|
styles.button,
|
|
22
26
|
styles[variant],
|
|
23
27
|
styles[size],
|
|
28
|
+
fullWidth ? styles.fullWidth : "",
|
|
24
29
|
active ? styles.active : "",
|
|
25
30
|
loading ? styles.loading : "",
|
|
26
31
|
isLink ? styles.link : "",
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
userClassName
|
|
33
|
+
);
|
|
34
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
35
|
+
icon && /* @__PURE__ */ jsx("span", { className: cx(styles.icon, spinIcon ? "spin" : ""), children: icon }),
|
|
36
|
+
children,
|
|
37
|
+
loading && /* @__PURE__ */ jsx("span", { style: { display: "flex", opacity: 0.5 }, className: "spin", children: /* @__PURE__ */ jsx(LoaderCircle, {}) })
|
|
38
|
+
] });
|
|
39
|
+
let buttonEl;
|
|
29
40
|
if (isLink && React.isValidElement(children)) {
|
|
41
|
+
const childClassName = typeof children.props.className === "string" ? children.props.className : "";
|
|
30
42
|
buttonEl = React.cloneElement(children, {
|
|
31
|
-
|
|
32
|
-
...rest,
|
|
43
|
+
...buttonProps,
|
|
33
44
|
ref,
|
|
45
|
+
className: cx(childClassName, computedClassName),
|
|
34
46
|
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
35
|
-
icon && /* @__PURE__ */ jsx("span", { className:
|
|
47
|
+
icon && /* @__PURE__ */ jsx("span", { className: cx(styles.icon, spinIcon ? "spin" : ""), children: icon }),
|
|
36
48
|
children.props.children,
|
|
37
49
|
loading && /* @__PURE__ */ jsx("span", { style: { display: "flex", opacity: 0.5 }, className: "spin", children: /* @__PURE__ */ jsx(LoaderCircle, {}) })
|
|
38
50
|
] })
|
|
39
51
|
});
|
|
40
52
|
} else {
|
|
41
|
-
buttonEl = /* @__PURE__ */
|
|
42
|
-
icon && /* @__PURE__ */ jsx("span", { className: `${styles.icon} ${spinIcon ? "spin" : ""}`, children: icon }),
|
|
43
|
-
children,
|
|
44
|
-
loading && /* @__PURE__ */ jsx("span", { style: { display: "flex", opacity: 0.5 }, className: "spin", children: /* @__PURE__ */ jsx(LoaderCircle, {}) })
|
|
45
|
-
] });
|
|
53
|
+
buttonEl = /* @__PURE__ */ jsx("button", { ref, className: computedClassName, ...buttonProps, children: content });
|
|
46
54
|
}
|
|
47
55
|
if (tooltip) {
|
|
48
56
|
return /* @__PURE__ */ jsx(Tooltip, { content: tooltip, children: buttonEl });
|