@nulogy/components 15.2.0 → 15.2.2
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/README.md +3 -3
- package/dist/main.js +5735 -5628
- package/dist/main.module.js +5731 -5624
- package/dist/src/Alert/Alert.story.d.ts +15 -19
- package/dist/src/Alert/Alert.story.js +25 -14
- package/dist/src/BrandedNavBar/NavBar.story.d.ts +4 -6
- package/dist/src/BrandedNavBar/NavBar.story.js +11 -3
- package/dist/src/BrandedNavBar/SmallNavBar.story.d.ts +5 -2
- package/dist/src/BrandedNavBar/SmallNavBar.story.js +26 -5
- package/dist/src/DatePickers/stories/DatePicker.story.d.ts +7 -3
- package/dist/src/DatePickers/stories/DatePicker.story.js +54 -22
- package/dist/src/DescriptionList/lib/utils.js +1 -1
- package/dist/src/DescriptionList/stories/DescriptionList.column.story.js +1 -1
- package/dist/src/DescriptionList/stories/DescriptionList.group-min-width.story.d.ts +7 -8
- package/dist/src/DescriptionList/stories/DescriptionList.group-min-width.story.js +15 -12
- package/dist/src/DescriptionList/stories/DescriptionList.layout.story.js +1 -1
- package/dist/src/DescriptionList/stories/DescriptionList.playground.story.d.ts +7 -8
- package/dist/src/DescriptionList/stories/DescriptionList.playground.story.js +200 -195
- package/dist/src/Layout/Header.d.ts +1 -1
- package/dist/src/Layout/Header.story.d.ts +10 -9
- package/dist/src/Layout/Header.story.js +9 -8
- package/dist/src/Layout/Sidebar.story.d.ts +4 -1
- package/dist/src/Layout/Sidebar.story.js +10 -3
- package/dist/src/Modal/Modal.story.d.ts +39 -61
- package/dist/src/Modal/Modal.story.js +110 -85
- package/dist/src/NDSProvider/renderWithNDSProvider.spec-utils.d.ts +2 -1
- package/dist/src/Radio/Radio.story.d.ts +316 -32
- package/dist/src/Radio/Radio.story.js +36 -22
- package/dist/src/Select/MenuList.js +1 -1
- package/dist/src/Select/Select.d.ts +1 -1
- package/dist/src/Select/Select.spec-utils.js +1 -0
- package/dist/src/Select/Select.story.d.ts +5 -1
- package/dist/src/Select/Select.story.js +93 -2
- package/dist/src/Table/stories/BaseTable.story.d.ts +11 -7
- package/dist/src/Table/stories/BaseTable.story.js +156 -34
- package/dist/src/Table/stories/SortingColumnHeader.story.d.ts +5 -2
- package/dist/src/Table/stories/SortingColumnHeader.story.js +20 -3
- package/dist/src/Table/stories/Table.story.d.ts +7 -14
- package/dist/src/Table/stories/Table.story.js +172 -127
- package/dist/src/Toggle/ToggleButton.js +1 -1
- package/dist/src/Tooltip/Tooltip.story.d.ts +15 -52
- package/dist/src/Tooltip/Tooltip.story.js +79 -71
- package/dist/src/testing/matchers/toHaveStyle.d.ts +15 -0
- package/dist/src/testing/matchers/toHaveStyle.js +50 -0
- package/dist/src/testing/matchers/toMatchDate.d.ts +1 -0
- package/dist/src/testing/matchers/toMatchDate.js +1 -1
- package/dist/src/utils/DetectOutsideClick.d.ts +3 -0
- package/dist/src/utils/DetectOutsideClick.js +3 -0
- package/dist/src/utils/ScrollIndicators.js +1 -1
- package/dist/src/utils/generateId.d.ts +5 -0
- package/dist/src/utils/generateId.js +5 -0
- package/dist/src/utils/index.d.ts +0 -1
- package/dist/src/utils/index.js +0 -1
- package/dist/src/utils/numberFromDimension/numberFromDimension.spec.js +1 -0
- package/dist/vitest.config.d.ts +2 -0
- package/dist/vitest.config.js +11 -0
- package/package.json +24 -61
- package/dist/src/NDSProvider/mountWithNDSProvider.spec-utils.d.ts +0 -1
- package/dist/src/NDSProvider/mountWithNDSProvider.spec-utils.js +0 -4
- package/dist/src/utils/withWindowDimensions.d.ts +0 -3
- package/dist/src/utils/withWindowDimensions.js +0 -28
|
@@ -16,202 +16,207 @@ import { Link } from "../../Link";
|
|
|
16
16
|
import { StatusIndicator } from "../../StatusIndicator";
|
|
17
17
|
import { Resizable } from "../../utils/story/resizable";
|
|
18
18
|
import { OutlinedDt, OutlinedDd } from "./fixtures";
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
React.createElement(
|
|
75
|
-
React.createElement(
|
|
76
|
-
|
|
77
|
-
React.createElement(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
React.createElement(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
React.createElement(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
{ value: "stacked", label: "Stacked" },
|
|
95
|
-
{ value: "inline", label: "Inline" },
|
|
96
|
-
{ value: "auto", label: "Auto" },
|
|
97
|
-
], labelText: "Layout" }),
|
|
98
|
-
React.createElement(Input, { value: autoLayoutBreakpoint, onChange: (e) => setAutoLayoutBreakpoint(e.target.value), labelText: "Auto Layout Breakpoint", placeholder: "e.g., 640px", disabled: layout !== "auto" })),
|
|
99
|
-
React.createElement(Select, { value: density, onChange: (value) => setDensity(value), options: [
|
|
100
|
-
{ value: "compact", label: "Compact" },
|
|
101
|
-
{ value: "medium", label: "Medium" },
|
|
102
|
-
{ value: "relaxed", label: "Relaxed" },
|
|
103
|
-
], labelText: "Density" }),
|
|
104
|
-
React.createElement(Select, { value: fontSize, onChange: (value) => setFontSize(value), options: Object.keys(theme.fontSizes).map((size) => ({
|
|
105
|
-
value: size,
|
|
106
|
-
label: size,
|
|
107
|
-
})), labelText: "Font Size" }),
|
|
108
|
-
React.createElement(Select, { value: lineHeight, onChange: (value) => setLineHeight(value), options: Object.keys(theme.lineHeights).map((height) => ({
|
|
109
|
-
value: height,
|
|
110
|
-
label: height,
|
|
111
|
-
})), labelText: "Line Height" }),
|
|
19
|
+
export default {
|
|
20
|
+
title: "Components/DescriptionList/Playground",
|
|
21
|
+
};
|
|
22
|
+
export const Playground = {
|
|
23
|
+
render: () => {
|
|
24
|
+
const [hoveredGroupIndex, setHoveredGroupIndex] = useState(null);
|
|
25
|
+
const [outlined, setOutlined] = useState(false);
|
|
26
|
+
const [containerOutline, setContainerOutline] = useState(true);
|
|
27
|
+
const [layout, setLayout] = useState("stacked");
|
|
28
|
+
const [density, setDensity] = useState("medium");
|
|
29
|
+
const [descriptionTermMaxWidth, setDescriptionTermMaxWidth] = useState("320px");
|
|
30
|
+
const [fontSize, setFontSize] = useState("medium");
|
|
31
|
+
const [lineHeight, setLineHeight] = useState("base");
|
|
32
|
+
const initialBreakpointColumns = [{ breakpoint: "extraSmall", columns: 1 }];
|
|
33
|
+
const [columns, setColumns] = useState(1);
|
|
34
|
+
const [breakpointColumns, setBreakpointColumns] = useState(initialBreakpointColumns);
|
|
35
|
+
const [groupMinWidth, setGroupMinWidth] = useState(undefined);
|
|
36
|
+
const [containerWidth, setContainerWidth] = useState("720px");
|
|
37
|
+
const [showDivider, setShowDivider] = useState(false);
|
|
38
|
+
const [autoLayoutBreakpoint, setAutoLayoutBreakpoint] = useState("640px");
|
|
39
|
+
const [rowSpan] = useState(0);
|
|
40
|
+
const [columnSpan] = useState(0);
|
|
41
|
+
const [additionalGroups, setAdditionalGroups] = useState([]);
|
|
42
|
+
const [DtValue] = useState("Key");
|
|
43
|
+
const [DdValue] = useState("Value");
|
|
44
|
+
const theme = useTheme();
|
|
45
|
+
const updateGroup = (index, updates) => {
|
|
46
|
+
setAdditionalGroups((groups) => groups.map((group, i) => {
|
|
47
|
+
if (i === index) {
|
|
48
|
+
return Object.assign(Object.assign({}, group), updates);
|
|
49
|
+
}
|
|
50
|
+
return group;
|
|
51
|
+
}));
|
|
52
|
+
};
|
|
53
|
+
const deleteGroup = (index) => {
|
|
54
|
+
setAdditionalGroups((groups) => groups.filter((_, i) => i !== index));
|
|
55
|
+
};
|
|
56
|
+
const addRandomGroup = () => {
|
|
57
|
+
setAdditionalGroups([
|
|
58
|
+
...additionalGroups,
|
|
59
|
+
{
|
|
60
|
+
dt: DtValue,
|
|
61
|
+
dd: DdValue,
|
|
62
|
+
rowSpan: rowSpan,
|
|
63
|
+
columnSpan: columnSpan,
|
|
64
|
+
isExpanded: false,
|
|
65
|
+
},
|
|
66
|
+
]);
|
|
67
|
+
};
|
|
68
|
+
const toggleGroupExpansion = (index) => {
|
|
69
|
+
setAdditionalGroups((groups) => groups.map((group, i) => (i === index ? Object.assign(Object.assign({}, group), { isExpanded: !group.isExpanded }) : group)));
|
|
70
|
+
};
|
|
71
|
+
const DescriptionListElement = (
|
|
72
|
+
// @ts-expect-error - This is not a valid use of the component, since we're passing both columns and groupMinWidth,
|
|
73
|
+
// but it's needed for this story
|
|
74
|
+
React.createElement(DescriptionList, { layout: layout, density: density, columns: columns, groupMinWidth: groupMinWidth, showDivider: showDivider, autoLayoutBreakpoint: autoLayoutBreakpoint, descriptionTermMaxWidth: descriptionTermMaxWidth, fontSize: fontSize, lineHeight: lineHeight },
|
|
75
|
+
React.createElement(DescriptionGroup, null,
|
|
76
|
+
React.createElement(OutlinedDt, { "$outlined": outlined, "$highlighted": false }, "Customer"),
|
|
77
|
+
React.createElement(OutlinedDd, { "$outlined": outlined, "$highlighted": false }, "Nulogy")),
|
|
78
|
+
React.createElement(DescriptionGroup, null,
|
|
79
|
+
React.createElement(OutlinedDt, { "$outlined": outlined, "$highlighted": false }, "Order number"),
|
|
80
|
+
React.createElement(OutlinedDd, { "$outlined": outlined, "$highlighted": false },
|
|
81
|
+
React.createElement(Link, { href: "/customer-details" }, "P12-90381-2039"))),
|
|
82
|
+
React.createElement(DescriptionGroup, null,
|
|
83
|
+
React.createElement(OutlinedDt, { "$outlined": outlined, "$highlighted": false }, "Status"),
|
|
84
|
+
React.createElement(OutlinedDd, { "$outlined": outlined, "$highlighted": false },
|
|
85
|
+
React.createElement(StatusIndicator, { type: "success" }, "Paid"))),
|
|
86
|
+
React.createElement(DescriptionGroup, null,
|
|
87
|
+
React.createElement(OutlinedDt, { "$outlined": outlined, "$highlighted": false }, "Amount"),
|
|
88
|
+
React.createElement(OutlinedDd, { "$outlined": outlined, "$highlighted": false }, "$202.12")),
|
|
89
|
+
additionalGroups.map((group, index) => (React.createElement(DescriptionGroup, { rowSpan: group.rowSpan, columnSpan: group.columnSpan, key: index },
|
|
90
|
+
React.createElement(OutlinedDt, { "$outlined": outlined, "$highlighted": hoveredGroupIndex === index }, group.dt),
|
|
91
|
+
React.createElement(OutlinedDd, { "$outlined": outlined, "$highlighted": hoveredGroupIndex === index }, group.dd))))));
|
|
92
|
+
return (React.createElement(Flex, null,
|
|
93
|
+
React.createElement(Sidebar, { height: "100%", width: "450px", hideCloseButton: true, isOpen: true, title: "Controls", overlay: "hide", top: "0px", bottom: "0px" },
|
|
112
94
|
React.createElement(Flex, { flexDirection: "column", gap: "x2" },
|
|
113
|
-
React.createElement(Flex, {
|
|
114
|
-
React.createElement(
|
|
115
|
-
React.createElement(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const newBreakpointColumns = breakpointColumns.filter((_, i) => i !== index);
|
|
167
|
-
if (newBreakpointColumns.length === 1) {
|
|
168
|
-
// Convert back to single number when only one breakpoint remains
|
|
169
|
-
setColumns(newBreakpointColumns[0].columns);
|
|
170
|
-
setBreakpointColumns(newBreakpointColumns);
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
95
|
+
React.createElement(Flex, { gap: "x2", flexDirection: "column" },
|
|
96
|
+
React.createElement(Input, { value: descriptionTermMaxWidth, onChange: (e) => setDescriptionTermMaxWidth(e.target.value), labelText: "Description Term Max Width", placeholder: "e.g., 320px" }),
|
|
97
|
+
React.createElement(Select, { value: layout, onChange: (value) => setLayout(value), options: [
|
|
98
|
+
{ value: "stacked", label: "Stacked" },
|
|
99
|
+
{ value: "inline", label: "Inline" },
|
|
100
|
+
{ value: "auto", label: "Auto" },
|
|
101
|
+
], labelText: "Layout" }),
|
|
102
|
+
React.createElement(Input, { value: autoLayoutBreakpoint, onChange: (e) => setAutoLayoutBreakpoint(e.target.value), labelText: "Auto Layout Breakpoint", placeholder: "e.g., 640px", disabled: layout !== "auto" })),
|
|
103
|
+
React.createElement(Select, { value: density, onChange: (value) => setDensity(value), options: [
|
|
104
|
+
{ value: "compact", label: "Compact" },
|
|
105
|
+
{ value: "medium", label: "Medium" },
|
|
106
|
+
{ value: "relaxed", label: "Relaxed" },
|
|
107
|
+
], labelText: "Density" }),
|
|
108
|
+
React.createElement(Select, { value: fontSize, onChange: (value) => setFontSize(value), options: Object.keys(theme.fontSizes).map((size) => ({
|
|
109
|
+
value: size,
|
|
110
|
+
label: size,
|
|
111
|
+
})), labelText: "Font Size" }),
|
|
112
|
+
React.createElement(Select, { value: lineHeight, onChange: (value) => setLineHeight(value), options: Object.keys(theme.lineHeights).map((height) => ({
|
|
113
|
+
value: height,
|
|
114
|
+
label: height,
|
|
115
|
+
})), labelText: "Line Height" }),
|
|
116
|
+
React.createElement(Flex, { flexDirection: "column", gap: "x2" },
|
|
117
|
+
React.createElement(Flex, { justifyContent: "space-between", alignItems: "center" },
|
|
118
|
+
React.createElement(Text, { fontWeight: "bold" }, "Columns"),
|
|
119
|
+
React.createElement(IconicButton, { onClick: () => {
|
|
120
|
+
const currentColumnValue = breakpointColumns[0].columns;
|
|
121
|
+
const availableBreakpoints = Object.keys(theme.breakpoints).filter((breakpoint) => !breakpointColumns.some((col) => col.breakpoint === breakpoint || breakpoint === "map"));
|
|
122
|
+
if (breakpointColumns.length === 1) {
|
|
123
|
+
// First time adding a breakpoint, convert the single column to a breakpoint
|
|
124
|
+
const firstBreakpoint = breakpointColumns[0].breakpoint;
|
|
125
|
+
setBreakpointColumns([
|
|
126
|
+
{ breakpoint: firstBreakpoint, columns: currentColumnValue },
|
|
127
|
+
{ breakpoint: availableBreakpoints[0], columns: currentColumnValue },
|
|
128
|
+
]);
|
|
129
|
+
setColumns({
|
|
130
|
+
[firstBreakpoint]: currentColumnValue,
|
|
131
|
+
[availableBreakpoints[0]]: currentColumnValue,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
// Add another breakpoint
|
|
136
|
+
const nextBreakpoint = availableBreakpoints[0];
|
|
137
|
+
setBreakpointColumns([
|
|
138
|
+
...breakpointColumns,
|
|
139
|
+
{ breakpoint: nextBreakpoint, columns: currentColumnValue },
|
|
140
|
+
]);
|
|
141
|
+
setColumns(Object.fromEntries([...breakpointColumns, { breakpoint: nextBreakpoint, columns: currentColumnValue }].map(({ breakpoint, columns }) => [breakpoint, columns])));
|
|
142
|
+
}
|
|
143
|
+
}, icon: "add", tooltip: "Add column per breakpoint", disabled: breakpointColumns.length >= Object.keys(theme.breakpoints).length - 1 })),
|
|
144
|
+
React.createElement(Flex, { flexDirection: "column", gap: "x2" }, breakpointColumns.map((breakpointColumn, index) => (React.createElement(Flex, { key: index, gap: "x2", alignItems: "flex-end" },
|
|
145
|
+
breakpointColumns.length > 1 && (React.createElement(Select, { minWidth: "240px", value: breakpointColumn.breakpoint, onChange: (value) => {
|
|
146
|
+
const newBreakpointColumns = [...breakpointColumns];
|
|
147
|
+
newBreakpointColumns[index] = Object.assign(Object.assign({}, breakpointColumn), { breakpoint: value });
|
|
173
148
|
setBreakpointColumns(newBreakpointColumns);
|
|
174
149
|
setColumns(Object.fromEntries(newBreakpointColumns.map(({ breakpoint, columns }) => [breakpoint, columns])));
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
150
|
+
}, options: Object.keys(theme.breakpoints)
|
|
151
|
+
.filter((breakpoint) => breakpoint === breakpointColumn.breakpoint ||
|
|
152
|
+
!breakpointColumns.some((col) => col.breakpoint === breakpoint || breakpoint === "map"))
|
|
153
|
+
.map((breakpoint) => ({
|
|
154
|
+
value: breakpoint,
|
|
155
|
+
label: `${breakpoint} (${theme.breakpoints[breakpoint]})`,
|
|
156
|
+
})), labelText: index === 0 ? "Breakpoint" : undefined })),
|
|
157
|
+
React.createElement(Input, { inputWidth: breakpointColumns.length === 1 ? undefined : "95px", type: "number", value: breakpointColumn.columns, onChange: (e) => {
|
|
158
|
+
const newValue = Math.max(1, Number(e.target.value));
|
|
159
|
+
const newBreakpointColumns = [...breakpointColumns];
|
|
160
|
+
newBreakpointColumns[index] = Object.assign(Object.assign({}, breakpointColumn), { columns: newValue });
|
|
161
|
+
setBreakpointColumns(newBreakpointColumns);
|
|
162
|
+
if (breakpointColumns.length === 1) {
|
|
163
|
+
setColumns(newValue);
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
setColumns(Object.fromEntries(newBreakpointColumns.map(({ breakpoint, columns }) => [breakpoint, columns])));
|
|
167
|
+
}
|
|
168
|
+
}, labelText: breakpointColumns.length === 1 ? "Number of columns" : index === 0 ? "Columns" : undefined, placeholder: "Number of columns", min: 1 }),
|
|
169
|
+
breakpointColumns.length > 1 && (React.createElement(IconicButton, { icon: "delete", onClick: () => {
|
|
170
|
+
const newBreakpointColumns = breakpointColumns.filter((_, i) => i !== index);
|
|
171
|
+
if (newBreakpointColumns.length === 1) {
|
|
172
|
+
// Convert back to single number when only one breakpoint remains
|
|
173
|
+
setColumns(newBreakpointColumns[0].columns);
|
|
174
|
+
setBreakpointColumns(newBreakpointColumns);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
setBreakpointColumns(newBreakpointColumns);
|
|
178
|
+
setColumns(Object.fromEntries(newBreakpointColumns.map(({ breakpoint, columns }) => [breakpoint, columns])));
|
|
179
|
+
}
|
|
180
|
+
} }))))))),
|
|
181
|
+
React.createElement(Input, { value: groupMinWidth !== null && groupMinWidth !== void 0 ? groupMinWidth : "", onChange: (e) => {
|
|
182
|
+
const value = e.target.value || undefined;
|
|
183
|
+
setGroupMinWidth(value);
|
|
184
|
+
if (value)
|
|
185
|
+
setColumns(undefined);
|
|
186
|
+
}, labelText: "Group Min Width", placeholder: "e.g., 200px", disabled: !!columns }),
|
|
187
|
+
React.createElement(Checkbox, { labelText: "Show divider", checked: showDivider, onChange: () => setShowDivider(!showDivider) }),
|
|
188
|
+
React.createElement(HorizontalDivider, null),
|
|
189
|
+
React.createElement(Text, { fontWeight: "bold" }, "Debugging"),
|
|
190
|
+
React.createElement(Checkbox, { labelText: "Show Group outline", checked: outlined, onChange: () => setOutlined(!outlined) }),
|
|
191
|
+
React.createElement(Input, { value: containerWidth, onChange: (e) => setContainerWidth(e.target.value), labelText: "Container Width", placeholder: "e.g., 720px" }),
|
|
192
|
+
React.createElement(Checkbox, { labelText: "Show container outline", checked: containerOutline, onChange: () => setContainerOutline(!containerOutline) }),
|
|
193
|
+
React.createElement(HorizontalDivider, null),
|
|
194
|
+
React.createElement(Flex, { justifyContent: "space-between", alignItems: "center" },
|
|
195
|
+
React.createElement(Text, { fontWeight: "bold" }, "Additional Groups"),
|
|
196
|
+
React.createElement(IconicButton, { onClick: addRandomGroup, icon: "add" })),
|
|
197
|
+
React.createElement(Box, null,
|
|
198
|
+
additionalGroups.length === 0 && (React.createElement(Text, { fontSize: "sm", color: "midGrey" }, "No additional groups")),
|
|
199
|
+
React.createElement(Flex, { flexDirection: "column" }, additionalGroups.map((group, index) => (React.createElement(React.Fragment, null,
|
|
200
|
+
index > 0 && React.createElement(HorizontalDivider, null),
|
|
201
|
+
React.createElement(Box, { key: index, onMouseEnter: () => setHoveredGroupIndex(index), onMouseLeave: () => setHoveredGroupIndex(null) },
|
|
202
|
+
React.createElement(Flex, { justifyContent: "space-between", alignItems: "center", mb: group.isExpanded ? "x2" : "none" },
|
|
203
|
+
React.createElement(Flex, { alignItems: "center", gap: "x2" },
|
|
204
|
+
React.createElement(IconicButton, { icon: group.isExpanded ? "downArrow" : "rightArrow", onClick: () => toggleGroupExpansion(index) }),
|
|
205
|
+
React.createElement(Text, null,
|
|
206
|
+
"Group ",
|
|
207
|
+
index + 1)),
|
|
208
|
+
React.createElement(IconicButton, { onClick: () => deleteGroup(index), icon: "delete" })),
|
|
209
|
+
group.isExpanded && (React.createElement(Flex, { flexDirection: "column", gap: "x2" },
|
|
210
|
+
React.createElement(Input, { value: group.dt, onChange: (e) => updateGroup(index, { dt: e.target.value }), labelText: "Description Term" }),
|
|
211
|
+
React.createElement(Textarea, { value: group.dd, onChange: (e) => updateGroup(index, { dd: e.target.value }), labelText: "Description Data" }),
|
|
212
|
+
React.createElement(Flex, { gap: "x2" },
|
|
213
|
+
React.createElement(Input, { type: "number", value: group.rowSpan, onChange: (e) => updateGroup(index, { rowSpan: Number(e.target.value) }), labelText: "Row Span", min: 1 }),
|
|
214
|
+
React.createElement(Input, { type: "number", value: group.columnSpan, onChange: (e) => updateGroup(index, { columnSpan: Number(e.target.value) }), labelText: "Column Span", min: 1 })))))))))))),
|
|
215
|
+
React.createElement(Box, { flex: 1 },
|
|
216
|
+
React.createElement(Heading1, { mb: "x3" }, "Playground"),
|
|
217
|
+
React.createElement(Resizable, { containerWidth: containerWidth, onResize: (width) => setContainerWidth(`${width}px`), showContainerOutline: containerOutline }, DescriptionListElement))));
|
|
218
|
+
},
|
|
219
|
+
parameters: {
|
|
220
|
+
chromatic: { disable: true },
|
|
221
|
+
},
|
|
217
222
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
import { BoxProps } from "../Box";
|
|
3
3
|
type Breakpoint = string | number;
|
|
4
|
-
interface HeaderProps extends Omit<BoxProps, "title"> {
|
|
4
|
+
export interface HeaderProps extends Omit<BoxProps, "title"> {
|
|
5
5
|
renderBreadcrumbs?: () => ReactNode;
|
|
6
6
|
title?: ReactNode;
|
|
7
7
|
subtitle?: string;
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare const Default: () => React.JSX.Element;
|
|
3
|
-
export declare const TitleAsReactElement: () => React.JSX.Element;
|
|
4
|
-
export declare const WithActions: () => React.JSX.Element;
|
|
5
|
-
export declare const WithSubTitle: () => React.JSX.Element;
|
|
6
|
-
export declare const WithContent: () => React.JSX.Element;
|
|
7
|
-
export declare const WithSummary: () => React.JSX.Element;
|
|
8
|
-
export declare const WithAnUndecoratedBackground: () => React.JSX.Element;
|
|
9
|
-
export declare const WithCustomBackground: () => React.JSX.Element;
|
|
10
|
-
export declare const WithEverything: () => React.JSX.Element;
|
|
11
2
|
declare const _default: {
|
|
12
3
|
title: string;
|
|
4
|
+
component: ({ background, renderBreadcrumbs, title, undecorated, children, subtitle, breakpoints, renderActions, renderSummary, ...rest }: import("./Header").HeaderProps) => React.JSX.Element;
|
|
13
5
|
parameters: {
|
|
14
6
|
layout: string;
|
|
15
7
|
chromatic: {
|
|
@@ -18,3 +10,12 @@ declare const _default: {
|
|
|
18
10
|
};
|
|
19
11
|
};
|
|
20
12
|
export default _default;
|
|
13
|
+
export declare const Default: () => React.JSX.Element;
|
|
14
|
+
export declare const TitleAsReactElement: () => React.JSX.Element;
|
|
15
|
+
export declare const WithActions: () => React.JSX.Element;
|
|
16
|
+
export declare const WithSubTitle: () => React.JSX.Element;
|
|
17
|
+
export declare const WithContent: () => React.JSX.Element;
|
|
18
|
+
export declare const WithSummary: () => React.JSX.Element;
|
|
19
|
+
export declare const WithAnUndecoratedBackground: () => React.JSX.Element;
|
|
20
|
+
export declare const WithCustomBackground: () => React.JSX.Element;
|
|
21
|
+
export declare const WithEverything: () => React.JSX.Element;
|
|
@@ -6,6 +6,15 @@ import SummaryDivider from "../Summary/SummaryDivider";
|
|
|
6
6
|
import DropdownMenu from "../DropdownMenu/DropdownMenu";
|
|
7
7
|
import numberFromDimension from "../utils/numberFromDimension";
|
|
8
8
|
import { legacy as theme } from "../theme/theme";
|
|
9
|
+
const viewports = [theme.breakpoints.small, theme.breakpoints.medium, theme.breakpoints.large].map(numberFromDimension);
|
|
10
|
+
export default {
|
|
11
|
+
title: "Components/Header",
|
|
12
|
+
component: Header,
|
|
13
|
+
parameters: {
|
|
14
|
+
layout: "fullscreen",
|
|
15
|
+
chromatic: { viewports },
|
|
16
|
+
},
|
|
17
|
+
};
|
|
9
18
|
export const Default = () => (React.createElement(Header, { renderBreadcrumbs: () => (React.createElement(Breadcrumbs, null,
|
|
10
19
|
React.createElement(Link, { href: "/" }, "Home"),
|
|
11
20
|
React.createElement(Link, { href: "/" }, "Materials"))), title: "Materials Overview" }));
|
|
@@ -60,11 +69,3 @@ export const WithEverything = () => (React.createElement(Header, { breakpoints:
|
|
|
60
69
|
React.createElement(DropdownLink, { href: "/" }, "Dropdown Link"),
|
|
61
70
|
React.createElement(DropdownButton, null, "Dropdown Button"))) },
|
|
62
71
|
React.createElement(Box, { border: "1px dashed", borderColor: "grey", py: "half", px: "x1", borderRadius: "small" }, "Extra content")));
|
|
63
|
-
const viewports = [theme.breakpoints.small, theme.breakpoints.medium, theme.breakpoints.large].map(numberFromDimension);
|
|
64
|
-
export default {
|
|
65
|
-
title: "Components/Header",
|
|
66
|
-
parameters: {
|
|
67
|
-
layout: "fullscreen",
|
|
68
|
-
chromatic: { viewports },
|
|
69
|
-
},
|
|
70
|
-
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react";
|
|
1
2
|
import React from "react";
|
|
3
|
+
import { Sidebar } from "..";
|
|
2
4
|
declare const _default: {
|
|
3
5
|
title: string;
|
|
4
6
|
parameters: {
|
|
@@ -9,10 +11,11 @@ declare const _default: {
|
|
|
9
11
|
};
|
|
10
12
|
};
|
|
11
13
|
export default _default;
|
|
14
|
+
type Story = StoryObj<typeof Sidebar>;
|
|
12
15
|
export declare const _Sidebar: () => React.JSX.Element;
|
|
13
16
|
export declare const WithoutOverlay: () => React.JSX.Element;
|
|
14
17
|
export declare const OpenByDefault: () => React.JSX.Element;
|
|
15
|
-
export declare const WithCustomOffset:
|
|
18
|
+
export declare const WithCustomOffset: Story;
|
|
16
19
|
export declare const DontCloseOnOutsideClick: () => React.JSX.Element;
|
|
17
20
|
export declare const WithoutCloseButton: () => React.JSX.Element;
|
|
18
21
|
export declare const WithALongTitle: () => React.JSX.Element;
|
|
@@ -9,7 +9,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { text } from "@storybook/addon-knobs";
|
|
13
12
|
import React, { useState, useRef } from "react";
|
|
14
13
|
import { ApplicationFrame, Breadcrumbs, Link, Page, Sidebar, Select, PrimaryButton, Box, Textarea, Heading3, Navigation, } from "..";
|
|
15
14
|
import { useUrlProps } from "../utils/testing/useUrlProps";
|
|
@@ -93,7 +92,7 @@ export const OpenByDefault = () => {
|
|
|
93
92
|
React.createElement(Box, { height: "3000px", width: "100%", bg: "lightBlue", mt: "x3", p: "x2" }, "Space for more content")),
|
|
94
93
|
React.createElement(ExampleSidebar, { isOpen: isOpen, onClose: closeSidebar, triggerRef: triggerRef, "aria-controls": "openSidebarTrigger" }))));
|
|
95
94
|
};
|
|
96
|
-
|
|
95
|
+
const WithCustomOffsetComponent = (args) => {
|
|
97
96
|
const [isOpen, setIsOpen] = useState(true);
|
|
98
97
|
const triggerRef = useRef(null);
|
|
99
98
|
const toggleSidebar = () => {
|
|
@@ -109,7 +108,15 @@ export const WithCustomOffset = () => {
|
|
|
109
108
|
React.createElement(Box, { minWidth: "300px" },
|
|
110
109
|
React.createElement(PrimaryButton, { onClick: toggleSidebar, ref: triggerRef, id: "openSidebarTrigger" }, "Open Sidebar"),
|
|
111
110
|
React.createElement(Box, { height: "3000px", width: "100%", bg: "lightBlue", mt: "x3", p: "x2" }, "Space for more content")),
|
|
112
|
-
React.createElement(ExampleSidebar, { isOpen: isOpen, onClose: closeSidebar, triggerRef: triggerRef, "aria-controls": "openSidebarTrigger"
|
|
111
|
+
React.createElement(ExampleSidebar, Object.assign({ isOpen: isOpen, onClose: closeSidebar, triggerRef: triggerRef, "aria-controls": "openSidebarTrigger" }, args)))));
|
|
112
|
+
};
|
|
113
|
+
export const WithCustomOffset = {
|
|
114
|
+
args: {
|
|
115
|
+
offset: "400px",
|
|
116
|
+
duration: 0.5,
|
|
117
|
+
},
|
|
118
|
+
name: "With custom offset",
|
|
119
|
+
render: (args) => React.createElement(WithCustomOffsetComponent, Object.assign({}, args)),
|
|
113
120
|
};
|
|
114
121
|
export const DontCloseOnOutsideClick = () => {
|
|
115
122
|
const [isOpen, setIsOpen] = useState(false);
|