@dbcdk/react-components 0.0.4 → 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
|
@@ -59,6 +59,9 @@ function OperatorDropdown({
|
|
|
59
59
|
}) {
|
|
60
60
|
const popRef = react.useRef(null);
|
|
61
61
|
const [activeIndex, setActiveIndex] = react.useState(() => Math.max(0, operators.indexOf(value)));
|
|
62
|
+
react.useEffect(() => {
|
|
63
|
+
setActiveIndex(Math.max(0, operators.indexOf(value)));
|
|
64
|
+
}, [operators, value]);
|
|
62
65
|
const handleSelect = (op) => {
|
|
63
66
|
var _a;
|
|
64
67
|
onChange(op);
|
|
@@ -98,31 +101,42 @@ function FilterField({
|
|
|
98
101
|
field,
|
|
99
102
|
control,
|
|
100
103
|
operator,
|
|
104
|
+
value,
|
|
101
105
|
onChange,
|
|
102
106
|
operators,
|
|
103
107
|
options = [],
|
|
104
108
|
single = true,
|
|
105
|
-
|
|
106
|
-
size = "sm",
|
|
109
|
+
size = "md",
|
|
107
110
|
label,
|
|
108
111
|
placeholder = "Type value\u2026",
|
|
109
112
|
disabled,
|
|
110
113
|
...inputProps
|
|
111
114
|
}) {
|
|
115
|
+
const [selectedOperator, setSelectedOperator] = react.useState(operator);
|
|
112
116
|
const ops = react.useMemo(() => operators != null ? operators : DEFAULT_TEXT_OPERATORS, [operators]);
|
|
113
|
-
const [op, setOp] = react.useState(operator);
|
|
114
|
-
const [val, setVal] = react.useState(value);
|
|
115
117
|
react.useEffect(() => {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
}, [operator]);
|
|
119
|
+
react.useEffect(() => {
|
|
120
|
+
if (ops.includes(operator)) {
|
|
121
|
+
setSelectedOperator(operator);
|
|
122
|
+
}
|
|
123
|
+
}, [operator]);
|
|
124
|
+
const emit = (next) => {
|
|
125
|
+
var _a, _b, _c;
|
|
126
|
+
setSelectedOperator((_a = next.operator) != null ? _a : selectedOperator);
|
|
127
|
+
onChange({
|
|
128
|
+
field,
|
|
129
|
+
operator: (_b = next.operator) != null ? _b : selectedOperator,
|
|
130
|
+
value: (_c = next.value) != null ? _c : value
|
|
131
|
+
});
|
|
132
|
+
};
|
|
119
133
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ` ${styles__default.default.filterField} ${styles__default.default[size]}`, children: [
|
|
120
134
|
label ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: `${styles__default.default.label} ${styles__default.default[size]}`, children: label }) : null,
|
|
121
135
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
122
136
|
OperatorDropdown,
|
|
123
137
|
{
|
|
124
|
-
value:
|
|
125
|
-
onChange:
|
|
138
|
+
value: selectedOperator,
|
|
139
|
+
onChange: (op) => emit({ operator: op }),
|
|
126
140
|
operators: ops,
|
|
127
141
|
size,
|
|
128
142
|
disabled
|
|
@@ -132,24 +146,25 @@ function FilterField({
|
|
|
132
146
|
Input.Input,
|
|
133
147
|
{
|
|
134
148
|
...inputProps,
|
|
135
|
-
value:
|
|
136
|
-
onChange: (e) =>
|
|
149
|
+
value: value != null ? value : "",
|
|
150
|
+
onChange: (e) => emit({ value: e.currentTarget.value }),
|
|
137
151
|
inputSize: size,
|
|
138
152
|
placeholder,
|
|
153
|
+
fullWidth: true,
|
|
139
154
|
minWidth: "120px",
|
|
140
155
|
disabled,
|
|
141
|
-
onClear: () =>
|
|
156
|
+
onClear: () => emit({ value: "" })
|
|
142
157
|
}
|
|
143
158
|
) : single ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
144
159
|
Select.Select,
|
|
145
160
|
{
|
|
146
161
|
options,
|
|
147
|
-
selectedValue:
|
|
148
|
-
onChange: (v) =>
|
|
162
|
+
selectedValue: value != null ? value : null,
|
|
163
|
+
onChange: (v) => emit({ value: v }),
|
|
149
164
|
placeholder,
|
|
150
165
|
size,
|
|
151
166
|
variant: "inline",
|
|
152
|
-
onClear: () =>
|
|
167
|
+
onClear: () => emit({ value: "" })
|
|
153
168
|
}
|
|
154
169
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
155
170
|
MultiSelect.MultiSelect,
|
|
@@ -157,13 +172,13 @@ function FilterField({
|
|
|
157
172
|
options,
|
|
158
173
|
size,
|
|
159
174
|
variant: "inline",
|
|
160
|
-
selectedValues: Array.isArray(
|
|
175
|
+
selectedValues: Array.isArray(value) ? value : [],
|
|
161
176
|
onChange: (v) => {
|
|
162
|
-
const current = new Set(Array.isArray(
|
|
177
|
+
const current = new Set(Array.isArray(value) ? value : []);
|
|
163
178
|
current.has(v) ? current.delete(v) : current.add(v);
|
|
164
|
-
|
|
179
|
+
emit({ value: Array.from(current) });
|
|
165
180
|
},
|
|
166
|
-
onClear: () =>
|
|
181
|
+
onClear: () => emit({ value: [] }),
|
|
167
182
|
children: placeholder
|
|
168
183
|
}
|
|
169
184
|
) })
|
|
@@ -14,15 +14,15 @@ export interface FilterFieldProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
14
14
|
field: string;
|
|
15
15
|
control: 'input' | 'select';
|
|
16
16
|
operator: Operator;
|
|
17
|
+
value: string | string[] | null;
|
|
17
18
|
onChange: (e: FilterEvent) => void;
|
|
18
19
|
operators?: Operator[];
|
|
19
20
|
options?: MultiselectOption[];
|
|
20
21
|
single?: boolean;
|
|
21
|
-
value?: string | string[] | null;
|
|
22
22
|
size?: 'sm' | 'md' | 'lg';
|
|
23
23
|
label?: string;
|
|
24
24
|
placeholder?: string;
|
|
25
25
|
disabled?: boolean;
|
|
26
26
|
}
|
|
27
27
|
export declare const NUMBER_OPERATORS: Operator[];
|
|
28
|
-
export declare function FilterField({ field, control, operator, onChange, operators, options, single,
|
|
28
|
+
export declare function FilterField({ field, control, operator, value, onChange, operators, options, single, size, label, placeholder, disabled, ...inputProps }: FilterFieldProps): React.ReactElement;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { useState, useMemo, useEffect, useRef } from 'react';
|
|
3
3
|
import { Check } from 'lucide-react';
|
|
4
4
|
import { Popover } from '../popover/Popover';
|
|
5
5
|
import { Input } from '../input/Input';
|
|
@@ -53,6 +53,9 @@ function OperatorDropdown({
|
|
|
53
53
|
}) {
|
|
54
54
|
const popRef = useRef(null);
|
|
55
55
|
const [activeIndex, setActiveIndex] = useState(() => Math.max(0, operators.indexOf(value)));
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
setActiveIndex(Math.max(0, operators.indexOf(value)));
|
|
58
|
+
}, [operators, value]);
|
|
56
59
|
const handleSelect = (op) => {
|
|
57
60
|
var _a;
|
|
58
61
|
onChange(op);
|
|
@@ -92,31 +95,42 @@ function FilterField({
|
|
|
92
95
|
field,
|
|
93
96
|
control,
|
|
94
97
|
operator,
|
|
98
|
+
value,
|
|
95
99
|
onChange,
|
|
96
100
|
operators,
|
|
97
101
|
options = [],
|
|
98
102
|
single = true,
|
|
99
|
-
|
|
100
|
-
size = "sm",
|
|
103
|
+
size = "md",
|
|
101
104
|
label,
|
|
102
105
|
placeholder = "Type value\u2026",
|
|
103
106
|
disabled,
|
|
104
107
|
...inputProps
|
|
105
108
|
}) {
|
|
109
|
+
const [selectedOperator, setSelectedOperator] = useState(operator);
|
|
106
110
|
const ops = useMemo(() => operators != null ? operators : DEFAULT_TEXT_OPERATORS, [operators]);
|
|
107
|
-
const [op, setOp] = useState(operator);
|
|
108
|
-
const [val, setVal] = useState(value);
|
|
109
111
|
useEffect(() => {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
}, [operator]);
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (ops.includes(operator)) {
|
|
115
|
+
setSelectedOperator(operator);
|
|
116
|
+
}
|
|
117
|
+
}, [operator]);
|
|
118
|
+
const emit = (next) => {
|
|
119
|
+
var _a, _b, _c;
|
|
120
|
+
setSelectedOperator((_a = next.operator) != null ? _a : selectedOperator);
|
|
121
|
+
onChange({
|
|
122
|
+
field,
|
|
123
|
+
operator: (_b = next.operator) != null ? _b : selectedOperator,
|
|
124
|
+
value: (_c = next.value) != null ? _c : value
|
|
125
|
+
});
|
|
126
|
+
};
|
|
113
127
|
return /* @__PURE__ */ jsxs("div", { className: ` ${styles.filterField} ${styles[size]}`, children: [
|
|
114
128
|
label ? /* @__PURE__ */ jsx("span", { className: `${styles.label} ${styles[size]}`, children: label }) : null,
|
|
115
129
|
/* @__PURE__ */ jsx(
|
|
116
130
|
OperatorDropdown,
|
|
117
131
|
{
|
|
118
|
-
value:
|
|
119
|
-
onChange:
|
|
132
|
+
value: selectedOperator,
|
|
133
|
+
onChange: (op) => emit({ operator: op }),
|
|
120
134
|
operators: ops,
|
|
121
135
|
size,
|
|
122
136
|
disabled
|
|
@@ -126,24 +140,25 @@ function FilterField({
|
|
|
126
140
|
Input,
|
|
127
141
|
{
|
|
128
142
|
...inputProps,
|
|
129
|
-
value:
|
|
130
|
-
onChange: (e) =>
|
|
143
|
+
value: value != null ? value : "",
|
|
144
|
+
onChange: (e) => emit({ value: e.currentTarget.value }),
|
|
131
145
|
inputSize: size,
|
|
132
146
|
placeholder,
|
|
147
|
+
fullWidth: true,
|
|
133
148
|
minWidth: "120px",
|
|
134
149
|
disabled,
|
|
135
|
-
onClear: () =>
|
|
150
|
+
onClear: () => emit({ value: "" })
|
|
136
151
|
}
|
|
137
152
|
) : single ? /* @__PURE__ */ jsx(
|
|
138
153
|
Select,
|
|
139
154
|
{
|
|
140
155
|
options,
|
|
141
|
-
selectedValue:
|
|
142
|
-
onChange: (v) =>
|
|
156
|
+
selectedValue: value != null ? value : null,
|
|
157
|
+
onChange: (v) => emit({ value: v }),
|
|
143
158
|
placeholder,
|
|
144
159
|
size,
|
|
145
160
|
variant: "inline",
|
|
146
|
-
onClear: () =>
|
|
161
|
+
onClear: () => emit({ value: "" })
|
|
147
162
|
}
|
|
148
163
|
) : /* @__PURE__ */ jsx(
|
|
149
164
|
MultiSelect,
|
|
@@ -151,13 +166,13 @@ function FilterField({
|
|
|
151
166
|
options,
|
|
152
167
|
size,
|
|
153
168
|
variant: "inline",
|
|
154
|
-
selectedValues: Array.isArray(
|
|
169
|
+
selectedValues: Array.isArray(value) ? value : [],
|
|
155
170
|
onChange: (v) => {
|
|
156
|
-
const current = new Set(Array.isArray(
|
|
171
|
+
const current = new Set(Array.isArray(value) ? value : []);
|
|
157
172
|
current.has(v) ? current.delete(v) : current.add(v);
|
|
158
|
-
|
|
173
|
+
emit({ value: Array.from(current) });
|
|
159
174
|
},
|
|
160
|
-
onClear: () =>
|
|
175
|
+
onClear: () => emit({ value: [] }),
|
|
161
176
|
children: placeholder
|
|
162
177
|
}
|
|
163
178
|
) })
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
gap: 0;
|
|
5
5
|
font-size: var(--font-size-sm);
|
|
6
6
|
font-family: var(--font-family);
|
|
7
|
-
background: var(--color-surface);
|
|
8
|
-
color: var(--color-
|
|
7
|
+
background: var(--color-bg-surface);
|
|
8
|
+
color: var(--color-fg-default);
|
|
9
9
|
|
|
10
|
-
border: var(--border-width-thin) solid var(--color-border);
|
|
10
|
+
border: var(--border-width-thin) solid var(--color-border-default);
|
|
11
11
|
border-radius: var(--border-radius-default);
|
|
12
12
|
|
|
13
13
|
transition:
|
|
@@ -22,21 +22,19 @@
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
.filterField.sm {
|
|
25
|
-
|
|
25
|
+
block-size: calc(var(--component-size-sm) + var(--density));
|
|
26
26
|
}
|
|
27
27
|
.filterField.md {
|
|
28
|
-
|
|
28
|
+
block-size: calc(var(--component-size-md) + var(--density));
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
.filterField .label {
|
|
32
32
|
display: inline-flex;
|
|
33
33
|
align-items: center;
|
|
34
|
-
|
|
35
|
-
padding-
|
|
36
|
-
padding-inline: var(--spacing-sm); /* 12px */
|
|
37
|
-
|
|
34
|
+
padding-block: calc(var(--spacing-2xs) + var(--density));
|
|
35
|
+
padding-inline: var(--spacing-sm);
|
|
38
36
|
font-size: var(--font-size-sm);
|
|
39
|
-
color: var(--color-
|
|
37
|
+
color: var(--color-fg-muted);
|
|
40
38
|
white-space: nowrap;
|
|
41
39
|
user-select: none;
|
|
42
40
|
}
|
|
@@ -45,16 +43,14 @@
|
|
|
45
43
|
display: inline-flex;
|
|
46
44
|
align-items: center;
|
|
47
45
|
justify-content: center;
|
|
48
|
-
|
|
46
|
+
height: 100%;
|
|
49
47
|
padding-block: calc(var(--spacing-2xs) + var(--density));
|
|
50
48
|
padding-inline: var(--spacing-sm);
|
|
51
|
-
|
|
52
49
|
background: var(--opac-bg-default);
|
|
53
|
-
color: var(--color-
|
|
50
|
+
color: var(--color-fg-default);
|
|
54
51
|
border: 0;
|
|
55
52
|
border-radius: 0;
|
|
56
53
|
cursor: pointer;
|
|
57
|
-
|
|
58
54
|
transition:
|
|
59
55
|
background-color var(--transition-fast) var(--ease-standard),
|
|
60
56
|
color var(--transition-fast) var(--ease-standard);
|
|
@@ -69,7 +65,7 @@
|
|
|
69
65
|
.filterField .operatorTrigger:disabled,
|
|
70
66
|
.filterField .operatorTrigger[aria-disabled='true'] {
|
|
71
67
|
cursor: not-allowed;
|
|
72
|
-
color: var(--color-disabled-
|
|
68
|
+
color: var(--color-disabled-fg);
|
|
73
69
|
background: var(--color-disabled-bg);
|
|
74
70
|
}
|
|
75
71
|
|
|
@@ -90,20 +86,18 @@
|
|
|
90
86
|
border: 0;
|
|
91
87
|
outline: none;
|
|
92
88
|
background: transparent;
|
|
93
|
-
color: var(--color-
|
|
89
|
+
color: var(--color-fg-default);
|
|
94
90
|
font: inherit;
|
|
95
|
-
|
|
96
91
|
inline-size: auto;
|
|
97
92
|
min-inline-size: 10ch;
|
|
98
|
-
|
|
99
93
|
block-size: 100%;
|
|
100
94
|
}
|
|
101
95
|
|
|
102
96
|
.filterField input::placeholder {
|
|
103
|
-
color: var(--color-
|
|
97
|
+
color: var(--color-fg-muted);
|
|
104
98
|
}
|
|
105
99
|
|
|
106
100
|
.filterField input:disabled {
|
|
107
|
-
color: var(--color-disabled-
|
|
101
|
+
color: var(--color-disabled-fg);
|
|
108
102
|
cursor: not-allowed;
|
|
109
103
|
}
|
|
@@ -18,12 +18,18 @@ function Headline({
|
|
|
18
18
|
weight = 600,
|
|
19
19
|
subHeadline,
|
|
20
20
|
addition,
|
|
21
|
-
icon
|
|
21
|
+
icon,
|
|
22
|
+
tone
|
|
22
23
|
}) {
|
|
23
24
|
const Tag = `h${size}`;
|
|
25
|
+
const containerClassName = [styles__default.default.headlineContainer, tone ? styles__default.default[`tone-${tone}`] : ""].filter(Boolean).join(" ");
|
|
26
|
+
const headlineClassName = [
|
|
27
|
+
styles__default.default.headline,
|
|
28
|
+
disableMargin ? styles__default.default.noMargin : "",
|
|
29
|
+
marker ? styles__default.default.marker : ""
|
|
30
|
+
].filter(Boolean).join(" ");
|
|
24
31
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
25
|
-
|
|
26
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.headlineContainer, children: [
|
|
32
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: containerClassName, children: [
|
|
27
33
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
28
34
|
Tag,
|
|
29
35
|
{
|
|
@@ -31,7 +37,7 @@ function Headline({
|
|
|
31
37
|
"--font-weight": weight,
|
|
32
38
|
"--marker-color": severity$1 ? severity.SeverityBgColor[severity$1] : void 0
|
|
33
39
|
},
|
|
34
|
-
className:
|
|
40
|
+
className: headlineClassName,
|
|
35
41
|
children: [
|
|
36
42
|
icon || severity$1 && !marker ? /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { customIcon: icon, severity: severity$1 }) : null,
|
|
37
43
|
children
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { JSX, PropsWithChildren } from 'react';
|
|
2
2
|
import { Severity } from '../../constants/severity.types';
|
|
3
|
+
type HeadlineTone = 'dark' | 'light';
|
|
3
4
|
interface HeadlineProps extends React.AriaAttributes {
|
|
4
5
|
size?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
5
6
|
marker?: boolean;
|
|
@@ -9,6 +10,13 @@ interface HeadlineProps extends React.AriaAttributes {
|
|
|
9
10
|
subHeadline?: string | JSX.Element;
|
|
10
11
|
addition?: React.ReactNode;
|
|
11
12
|
icon?: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Optional visual tone override:
|
|
15
|
+
* - dark: force normal foreground colours
|
|
16
|
+
* - light: force on-strong/light text
|
|
17
|
+
* If omitted, the headline simply inherits its colour from its parent.
|
|
18
|
+
*/
|
|
19
|
+
tone?: HeadlineTone;
|
|
12
20
|
}
|
|
13
|
-
export declare function Headline({ size, marker, disableMargin, children, severity, weight, subHeadline, addition, icon, }: PropsWithChildren<HeadlineProps>): React.ReactNode;
|
|
21
|
+
export declare function Headline({ size, marker, disableMargin, children, severity, weight, subHeadline, addition, icon, tone, }: PropsWithChildren<HeadlineProps>): React.ReactNode;
|
|
14
22
|
export {};
|
|
@@ -12,12 +12,18 @@ function Headline({
|
|
|
12
12
|
weight = 600,
|
|
13
13
|
subHeadline,
|
|
14
14
|
addition,
|
|
15
|
-
icon
|
|
15
|
+
icon,
|
|
16
|
+
tone
|
|
16
17
|
}) {
|
|
17
18
|
const Tag = `h${size}`;
|
|
19
|
+
const containerClassName = [styles.headlineContainer, tone ? styles[`tone-${tone}`] : ""].filter(Boolean).join(" ");
|
|
20
|
+
const headlineClassName = [
|
|
21
|
+
styles.headline,
|
|
22
|
+
disableMargin ? styles.noMargin : "",
|
|
23
|
+
marker ? styles.marker : ""
|
|
24
|
+
].filter(Boolean).join(" ");
|
|
18
25
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19
|
-
|
|
20
|
-
/* @__PURE__ */ jsxs("div", { className: styles.headlineContainer, children: [
|
|
26
|
+
/* @__PURE__ */ jsxs("div", { className: containerClassName, children: [
|
|
21
27
|
/* @__PURE__ */ jsxs(
|
|
22
28
|
Tag,
|
|
23
29
|
{
|
|
@@ -25,7 +31,7 @@ function Headline({
|
|
|
25
31
|
"--font-weight": weight,
|
|
26
32
|
"--marker-color": severity ? SeverityBgColor[severity] : void 0
|
|
27
33
|
},
|
|
28
|
-
className:
|
|
34
|
+
className: headlineClassName,
|
|
29
35
|
children: [
|
|
30
36
|
icon || severity && !marker ? /* @__PURE__ */ jsx(Icon, { customIcon: icon, severity }) : null,
|
|
31
37
|
children
|
|
@@ -5,30 +5,55 @@
|
|
|
5
5
|
flex-wrap: wrap;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
/* Base headline: inherit colour from parent surface */
|
|
8
9
|
.headline {
|
|
10
|
+
position: relative;
|
|
9
11
|
display: inline-flex;
|
|
10
12
|
align-items: center;
|
|
11
|
-
gap: var(--spacing-
|
|
12
|
-
font-weight: var(--font-weight-bold);
|
|
13
|
+
gap: var(--spacing-xs);
|
|
14
|
+
font-weight: var(--font-weight, var(--font-weight-bold));
|
|
13
15
|
letter-spacing: var(--letter-spacing-tight);
|
|
14
|
-
color:
|
|
16
|
+
color: inherit;
|
|
15
17
|
line-height: var(--line-height-tight);
|
|
16
18
|
transition: color var(--transition-fast) var(--ease-standard);
|
|
17
19
|
}
|
|
18
20
|
|
|
21
|
+
/* Optional tone overrides for special cases (hero sections, etc.) */
|
|
22
|
+
|
|
23
|
+
.tone-dark .headline {
|
|
24
|
+
color: var(--color-fg-default);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.tone-light .headline {
|
|
28
|
+
color: var(--color-fg-on-strong);
|
|
29
|
+
}
|
|
30
|
+
|
|
19
31
|
.noMargin {
|
|
20
32
|
margin: 0;
|
|
21
33
|
}
|
|
22
34
|
|
|
23
|
-
.marker {
|
|
24
|
-
|
|
25
|
-
|
|
35
|
+
.headline.marker {
|
|
36
|
+
padding-inline-start: calc(var(--border-width-thick) + var(--spacing-sm));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.headline.marker::before {
|
|
40
|
+
content: '';
|
|
41
|
+
position: absolute;
|
|
42
|
+
inset-block: 0;
|
|
43
|
+
inset-inline-start: 0;
|
|
44
|
+
inline-size: var(--border-width-thick);
|
|
45
|
+
background-color: var(--marker-color, var(--color-brand));
|
|
26
46
|
border-start-start-radius: var(--border-radius-default);
|
|
27
47
|
border-end-start-radius: var(--border-radius-default);
|
|
48
|
+
box-shadow: inset 0 0 0 1px var(--color-border-subtle);
|
|
49
|
+
pointer-events: none;
|
|
28
50
|
}
|
|
29
51
|
|
|
52
|
+
/* Subheadline inherits colour but is slightly softened,
|
|
53
|
+
so it works on both light and dark text surfaces. */
|
|
30
54
|
.subHeadline {
|
|
31
|
-
color:
|
|
55
|
+
color: inherit;
|
|
56
|
+
opacity: 0.85;
|
|
32
57
|
font-size: var(--font-size-md);
|
|
33
58
|
margin-block-start: calc(var(--spacing-2xs) * -1);
|
|
34
59
|
line-height: var(--line-height-normal);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
.container {
|
|
2
|
-
display: flex;
|
|
2
|
+
display: inline-flex;
|
|
3
3
|
align-items: center;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
vertical-align: middle;
|
|
5
|
+
gap: var(--spacing-xxs);
|
|
6
|
+
color: var(--color-fg-subtle);
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
.icon {
|
|
@@ -10,25 +11,25 @@
|
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
.icon svg {
|
|
13
|
-
height: var(--icon-size);
|
|
14
|
+
height: var(--icon-size-md);
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
.success {
|
|
17
|
-
color: var(--color-success);
|
|
18
|
+
color: var(--color-status-success);
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
.error {
|
|
21
|
-
color: var(--color-error);
|
|
22
|
+
color: var(--color-status-error);
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
.warning {
|
|
25
|
-
color: var(--color-warning);
|
|
26
|
+
color: var(--color-status-warning);
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
.info {
|
|
29
|
-
color: var(--color-info);
|
|
30
|
+
color: var(--color-status-info);
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
.brand {
|
|
33
|
-
color: var(--color-
|
|
34
|
+
color: var(--color-fg-on-brand);
|
|
34
35
|
}
|
|
@@ -4,6 +4,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var styles = require('../input/Input.module.css');
|
|
6
6
|
var ClearButton = require('../clear-button/ClearButton');
|
|
7
|
+
var Button = require('../button/Button');
|
|
7
8
|
|
|
8
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
10
|
|
|
@@ -18,30 +19,70 @@ function mergeRefs(...refs) {
|
|
|
18
19
|
}
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
|
-
const Input = react.forwardRef(function Input2({
|
|
22
|
+
const Input = react.forwardRef(function Input2({
|
|
23
|
+
label,
|
|
24
|
+
icon,
|
|
25
|
+
minWidth,
|
|
26
|
+
width,
|
|
27
|
+
fullWidth,
|
|
28
|
+
inputSize = "md",
|
|
29
|
+
variant = "outlined",
|
|
30
|
+
autoFocus,
|
|
31
|
+
onClear,
|
|
32
|
+
onButtonClick,
|
|
33
|
+
buttonLabel,
|
|
34
|
+
buttonIcon,
|
|
35
|
+
style,
|
|
36
|
+
...rest
|
|
37
|
+
}, ref) {
|
|
22
38
|
const inputRef = react.useRef(null);
|
|
23
39
|
react.useEffect(() => {
|
|
24
40
|
var _a;
|
|
25
41
|
if (autoFocus) (_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
26
42
|
}, [autoFocus]);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
const hasButton = Boolean(onButtonClick || buttonLabel || buttonIcon);
|
|
44
|
+
const rootStyle = {
|
|
45
|
+
...style != null ? style : {},
|
|
46
|
+
...minWidth ? { ["--input-min-width"]: minWidth } : null,
|
|
47
|
+
...width ? { ["--input-width"]: width } : null
|
|
48
|
+
};
|
|
49
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
style: rootStyle,
|
|
53
|
+
className: [
|
|
54
|
+
styles__default.default.container,
|
|
55
|
+
fullWidth ? styles__default.default.fullWidth : "",
|
|
56
|
+
onClear ? styles__default.default.withClear : "",
|
|
57
|
+
hasButton ? styles__default.default.withButton : ""
|
|
58
|
+
].filter(Boolean).join(" "),
|
|
59
|
+
children: [
|
|
60
|
+
label && /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: label, children: label }),
|
|
61
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.field, children: [
|
|
62
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.icon, children: icon }),
|
|
63
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
64
|
+
"input",
|
|
65
|
+
{
|
|
66
|
+
id: label,
|
|
67
|
+
...rest,
|
|
68
|
+
ref: mergeRefs(inputRef, ref),
|
|
69
|
+
className: [
|
|
70
|
+
styles__default.default.input,
|
|
71
|
+
icon ? styles__default.default.inputWithIcon : "",
|
|
72
|
+
inputSize ? styles__default.default[inputSize] : "",
|
|
73
|
+
styles__default.default[variant]
|
|
74
|
+
].filter(Boolean).join(" ")
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
onClear && /* @__PURE__ */ jsxRuntime.jsx(ClearButton.ClearButton, { onClick: onClear, absolute: true })
|
|
78
|
+
] }),
|
|
79
|
+
hasButton && /* @__PURE__ */ jsxRuntime.jsxs(Button.Button, { onClick: onButtonClick, className: styles__default.default.trailingButton, children: [
|
|
80
|
+
buttonIcon != null ? buttonIcon : null,
|
|
81
|
+
buttonLabel != null ? buttonLabel : null
|
|
82
|
+
] })
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
);
|
|
45
86
|
});
|
|
46
87
|
Input.displayName = "Input";
|
|
47
88
|
|
|
@@ -5,9 +5,14 @@ export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement>
|
|
|
5
5
|
label?: string;
|
|
6
6
|
icon?: React.ReactNode;
|
|
7
7
|
autoFocus?: boolean;
|
|
8
|
-
minWidth?: string;
|
|
8
|
+
minWidth?: string | number;
|
|
9
|
+
width?: string | number;
|
|
10
|
+
fullWidth?: boolean;
|
|
9
11
|
inputSize?: Size;
|
|
10
12
|
variant?: InputVariant;
|
|
11
13
|
onClear?: () => void;
|
|
14
|
+
onButtonClick?: () => void;
|
|
15
|
+
buttonLabel?: string;
|
|
16
|
+
buttonIcon?: React.ReactNode;
|
|
12
17
|
}
|
|
13
|
-
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
18
|
+
export declare const Input: React.ForwardRefExoticComponent<React.PropsWithoutRef<InputProps> & React.RefAttributes<HTMLInputElement>>;
|