@recursica/adapter-mantine-v8 1.3.2 → 1.3.4
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/CHANGELOG.md +15 -0
- package/dist/adapter-mantine-v8.cjs +1 -1
- package/dist/adapter-mantine-v8.cjs.map +1 -1
- package/dist/adapter-mantine-v8.js +338 -331
- package/dist/adapter-mantine-v8.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/docs/PHILOSOPHY.md +4 -0
- package/package.json +4 -8
- package/src/components/Heading/HEADING_IMPLEMENTATION_NOTES.md +9 -0
- package/src/components/Panel/PANEL_IMPLEMENTATION_NOTES.md +8 -0
- package/src/components/Panel/Panel.tsx +23 -6
- package/src/components/Text/TEXT_IMPLEMENTATION_NOTES.md +10 -0
- package/src/components/Text/Text.headings.dom.test.tsx +51 -0
- package/src/components/Text/Text.tsx +9 -0
- package/.storybook/commonArgTypes.ts +0 -148
- package/recursica_brand.json +0 -2610
- package/recursica_tokens.json +0 -769
- package/recursica_ui-kit.json +0 -9049
- package/recursica_variables_scoped.css +0 -6178
- package/src/Introduction.stories.tsx +0 -149
- package/src/components/Accordion/Accordion.stories.tsx +0 -189
- package/src/components/AssistiveElement/AssistiveElement.stories.tsx +0 -68
- package/src/components/AutoComplete/AutoComplete.stories.tsx +0 -336
- package/src/components/Avatar/Avatar.stories.tsx +0 -92
- package/src/components/Badge/Badge.stories.tsx +0 -78
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +0 -114
- package/src/components/Button/Button.stories.tsx +0 -192
- package/src/components/Card/Card.stories.tsx +0 -76
- package/src/components/Checkbox/Checkbox.stories.tsx +0 -97
- package/src/components/Checkbox/CheckboxGroup.stories.tsx +0 -139
- package/src/components/Chip/Chip.stories.tsx +0 -128
- package/src/components/Container/Container.stories.tsx +0 -118
- package/src/components/DatePicker/DatePicker.stories.tsx +0 -158
- package/src/components/Dropdown/Dropdown.stories.tsx +0 -252
- package/src/components/FileInput/FileInput.stories.tsx +0 -313
- package/src/components/FileUpload/FileUpload.stories.tsx +0 -362
- package/src/components/Flex/Flex.stories.tsx +0 -128
- package/src/components/FormControlLayout/FormControlLayout.stories.tsx +0 -118
- package/src/components/FormControlWrapper/FormControlWrapper.stories.tsx +0 -129
- package/src/components/Group/Group.stories.tsx +0 -120
- package/src/components/Heading/Heading.stories.tsx +0 -112
- package/src/components/HoverCard/HoverCard.stories.tsx +0 -172
- package/src/components/Label/Label.stories.tsx +0 -131
- package/src/components/LayoutGrid/LayoutGrid.stories.tsx +0 -61
- package/src/components/Link/Link.stories.tsx +0 -58
- package/src/components/Loader/Loader.stories.tsx +0 -123
- package/src/components/Menu/Menu.stories.tsx +0 -370
- package/src/components/Modal/Modal.stories.tsx +0 -105
- package/src/components/NumberInput/NumberInput.stories.tsx +0 -96
- package/src/components/Pagination/Pagination.stories.tsx +0 -48
- package/src/components/Panel/Panel.stories.tsx +0 -227
- package/src/components/Popover/Popover.stories.tsx +0 -133
- package/src/components/Radio/Radio.stories.tsx +0 -93
- package/src/components/Radio/RadioGroup.stories.tsx +0 -117
- package/src/components/ReadOnlyField/ReadOnlyField.stories.tsx +0 -163
- package/src/components/SegmentedControl/SegmentedControl.stories.tsx +0 -106
- package/src/components/Slider/Slider.stories.tsx +0 -282
- package/src/components/Stack/Stack.stories.tsx +0 -108
- package/src/components/Stepper/Stepper.stories.tsx +0 -148
- package/src/components/Switch/Switch.stories.tsx +0 -114
- package/src/components/Switch/SwitchGroup.stories.tsx +0 -132
- package/src/components/Table/Table.stories.tsx +0 -140
- package/src/components/Tabs/Tabs.stories.tsx +0 -154
- package/src/components/Text/Text.stories.tsx +0 -123
- package/src/components/TextArea/TextArea.stories.tsx +0 -94
- package/src/components/TextField/TextField.stories.tsx +0 -162
- package/src/components/TimePicker/TimePicker.stories.tsx +0 -141
- package/src/components/Timeline/Timeline.stories.tsx +0 -128
- package/src/components/Toast/Toast.stories.tsx +0 -67
- package/src/components/Tooltip/Tooltip.stories.tsx +0 -165
- package/src/components/TransferList/TransferList.stories.tsx +0 -121
- package/src/components/Tree/Tree.stories.tsx +0 -104
|
@@ -1,336 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { AutoComplete } from "./AutoComplete";
|
|
3
|
-
import { formControlArgTypes } from "../../../.storybook/commonArgTypes";
|
|
4
|
-
import { renderRichOption } from "../../utils/renderRichOption";
|
|
5
|
-
import styles from "./AutoComplete.module.css";
|
|
6
|
-
|
|
7
|
-
const meta: Meta<typeof AutoComplete> = {
|
|
8
|
-
title: "UI-Kit/AutoComplete",
|
|
9
|
-
component: AutoComplete,
|
|
10
|
-
tags: ["autodocs"],
|
|
11
|
-
parameters: {
|
|
12
|
-
docs: {
|
|
13
|
-
description: {
|
|
14
|
-
component: `
|
|
15
|
-
The \`AutoComplete\` primitive provides a text input with a dropdown menu for displaying suggestions as the user types.
|
|
16
|
-
|
|
17
|
-
### Architectural Decoupling
|
|
18
|
-
Recursica wraps the internal Mantine \`<Autocomplete>\` component inside the \`WithReadOnlyWrapper\`, ensuring it integrates perfectly with the strict design system form architecture.
|
|
19
|
-
|
|
20
|
-
### Examples
|
|
21
|
-
Always structure horizontal architectures via the generic \`formLayout\` parameter.
|
|
22
|
-
\`\`\`tsx
|
|
23
|
-
<AutoComplete
|
|
24
|
-
label="Country"
|
|
25
|
-
assistiveText="Select your country of residence."
|
|
26
|
-
data={["United States", "Canada", "Mexico", "United Kingdom", "France"]}
|
|
27
|
-
formLayout="stacked"
|
|
28
|
-
/>
|
|
29
|
-
\`\`\`
|
|
30
|
-
`,
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
argTypes: {
|
|
35
|
-
...formControlArgTypes,
|
|
36
|
-
disabled: {
|
|
37
|
-
control: "boolean",
|
|
38
|
-
description:
|
|
39
|
-
"Maps the formal disabled variable states structurally to the input core.",
|
|
40
|
-
},
|
|
41
|
-
error: {
|
|
42
|
-
control: "text",
|
|
43
|
-
description:
|
|
44
|
-
"Applies the strict error string boundary rendering invalid structures seamlessly.",
|
|
45
|
-
},
|
|
46
|
-
required: {
|
|
47
|
-
control: "boolean",
|
|
48
|
-
},
|
|
49
|
-
label: {
|
|
50
|
-
control: "text",
|
|
51
|
-
},
|
|
52
|
-
assistiveText: {
|
|
53
|
-
control: "text",
|
|
54
|
-
},
|
|
55
|
-
readOnly: {
|
|
56
|
-
control: "boolean",
|
|
57
|
-
description:
|
|
58
|
-
"Toggles structural read-only data presentation explicitly blocking standard component bindings.",
|
|
59
|
-
},
|
|
60
|
-
wrapItemText: {
|
|
61
|
-
control: "boolean",
|
|
62
|
-
description:
|
|
63
|
-
"Wraps option label/supportingText onto additional lines instead of truncating with an ellipsis.",
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export default meta;
|
|
69
|
-
|
|
70
|
-
type Story = StoryObj<typeof AutoComplete>;
|
|
71
|
-
|
|
72
|
-
export const Default: Story = {
|
|
73
|
-
args: {
|
|
74
|
-
disabled: false,
|
|
75
|
-
readOnly: false,
|
|
76
|
-
label: "Country Selection",
|
|
77
|
-
placeholder: "Start typing...",
|
|
78
|
-
data: [
|
|
79
|
-
"United States",
|
|
80
|
-
"Canada",
|
|
81
|
-
"Mexico",
|
|
82
|
-
"United Kingdom",
|
|
83
|
-
"France",
|
|
84
|
-
"Germany",
|
|
85
|
-
"Japan",
|
|
86
|
-
"Brazil",
|
|
87
|
-
"India",
|
|
88
|
-
"Australia",
|
|
89
|
-
],
|
|
90
|
-
assistiveText: "Search from a predefined list of countries.",
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export const FormsSideBySide: Story = {
|
|
95
|
-
args: {
|
|
96
|
-
label: "Primary Region",
|
|
97
|
-
placeholder: "Select region...",
|
|
98
|
-
data: ["US-East", "US-West", "EU-Central", "AP-South", "SA-East"],
|
|
99
|
-
assistiveText:
|
|
100
|
-
"Select the primary region for the deployment. This violently long string tests native textual wrapping safely mapping alongside inputs.",
|
|
101
|
-
formLayout: "side-by-side",
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
export const WithLeadingIcon: Story = {
|
|
106
|
-
args: {
|
|
107
|
-
label: "Search Projects",
|
|
108
|
-
placeholder: "Project name...",
|
|
109
|
-
data: ["Alpha", "Beta", "Gamma", "Delta", "Epsilon"],
|
|
110
|
-
leftSection: (
|
|
111
|
-
<svg
|
|
112
|
-
width="24"
|
|
113
|
-
height="24"
|
|
114
|
-
viewBox="0 0 24 24"
|
|
115
|
-
fill="none"
|
|
116
|
-
stroke="currentColor"
|
|
117
|
-
strokeWidth="2"
|
|
118
|
-
strokeLinecap="round"
|
|
119
|
-
strokeLinejoin="round"
|
|
120
|
-
>
|
|
121
|
-
<circle cx="11" cy="11" r="8"></circle>
|
|
122
|
-
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
|
|
123
|
-
</svg>
|
|
124
|
-
),
|
|
125
|
-
},
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
export const WithTrailingIcon: Story = {
|
|
129
|
-
args: {
|
|
130
|
-
label: "Validation URL",
|
|
131
|
-
placeholder: "https://recursica.dev",
|
|
132
|
-
data: [
|
|
133
|
-
"https://recursica.dev",
|
|
134
|
-
"https://beta.recursica.dev",
|
|
135
|
-
"https://api.recursica.dev",
|
|
136
|
-
],
|
|
137
|
-
rightSection: (
|
|
138
|
-
<svg
|
|
139
|
-
width="24"
|
|
140
|
-
height="24"
|
|
141
|
-
viewBox="0 0 24 24"
|
|
142
|
-
fill="none"
|
|
143
|
-
stroke="currentColor"
|
|
144
|
-
strokeWidth="2"
|
|
145
|
-
strokeLinecap="round"
|
|
146
|
-
strokeLinejoin="round"
|
|
147
|
-
>
|
|
148
|
-
<polyline points="20 6 9 17 4 12"></polyline>
|
|
149
|
-
</svg>
|
|
150
|
-
),
|
|
151
|
-
},
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
const UserIcon = (
|
|
155
|
-
<svg
|
|
156
|
-
width="16"
|
|
157
|
-
height="16"
|
|
158
|
-
viewBox="0 0 24 24"
|
|
159
|
-
fill="none"
|
|
160
|
-
stroke="currentColor"
|
|
161
|
-
strokeWidth="2"
|
|
162
|
-
strokeLinecap="round"
|
|
163
|
-
strokeLinejoin="round"
|
|
164
|
-
>
|
|
165
|
-
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
|
|
166
|
-
<circle cx="12" cy="7" r="4"></circle>
|
|
167
|
-
</svg>
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
export const WithRichOptions: Story = {
|
|
171
|
-
args: {
|
|
172
|
-
label: "Assignee",
|
|
173
|
-
placeholder: "Search team members...",
|
|
174
|
-
data: [
|
|
175
|
-
{
|
|
176
|
-
value: "jdoe",
|
|
177
|
-
label: "Jane Doe",
|
|
178
|
-
leadingIcon: UserIcon,
|
|
179
|
-
supportingText: "jane.doe@example.com",
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
value: "asmith",
|
|
183
|
-
label: "Alex Smith",
|
|
184
|
-
leadingIcon: UserIcon,
|
|
185
|
-
supportingText: "alex.smith@example.com",
|
|
186
|
-
},
|
|
187
|
-
{ value: "unassigned", label: "Unassigned" },
|
|
188
|
-
],
|
|
189
|
-
assistiveText:
|
|
190
|
-
"Each option can show a leading icon and supporting text — see MANTINE_ADAPTER_RICH_OPTION_DATA.md.",
|
|
191
|
-
},
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
export const WithRichOptionsWrapped: Story = {
|
|
195
|
-
args: {
|
|
196
|
-
label: "Assignee",
|
|
197
|
-
placeholder: "Search team members...",
|
|
198
|
-
wrapItemText: true,
|
|
199
|
-
data: [
|
|
200
|
-
{
|
|
201
|
-
value: "jdoe",
|
|
202
|
-
label: "Jane Doe, Senior Staff Engineer, Platform Infrastructure",
|
|
203
|
-
leadingIcon: UserIcon,
|
|
204
|
-
supportingText:
|
|
205
|
-
"jane.doe@example.com — Platform Infrastructure team, on-call rotation lead",
|
|
206
|
-
},
|
|
207
|
-
{ value: "unassigned", label: "Unassigned" },
|
|
208
|
-
],
|
|
209
|
-
assistiveText:
|
|
210
|
-
"wrapItemText=true — long label/supportingText wrap instead of truncating.",
|
|
211
|
-
},
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
const optionRowPreviewClassNames = {
|
|
215
|
-
optionContent: styles.optionContent,
|
|
216
|
-
optionIcon: styles.optionIcon,
|
|
217
|
-
optionText: styles.optionText,
|
|
218
|
-
optionTextWrap: styles.optionTextWrap,
|
|
219
|
-
optionSupportingText: styles.optionSupportingText,
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
const OPTION_ROW_PREVIEW_ITEMS = [
|
|
223
|
-
{
|
|
224
|
-
value: "icon-and-supporting",
|
|
225
|
-
label: "Jane Doe",
|
|
226
|
-
leadingIcon: UserIcon,
|
|
227
|
-
supportingText: "jane.doe@example.com",
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
value: "no-icon",
|
|
231
|
-
label: "Alex Smith",
|
|
232
|
-
supportingText:
|
|
233
|
-
"No leadingIcon — label/supportingText shift left, no reserved icon space",
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
value: "no-supporting-text",
|
|
237
|
-
label: "Taylor Rivera",
|
|
238
|
-
leadingIcon: UserIcon,
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
value: "plain",
|
|
242
|
-
label: "Plain option — no leadingIcon, no supportingText",
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
value: "long-text",
|
|
246
|
-
label:
|
|
247
|
-
"A very long option label that, with wrapItemText, wraps onto a second line instead of overflowing the fixed-width dropdown — otherwise it truncates with an ellipsis",
|
|
248
|
-
leadingIcon: UserIcon,
|
|
249
|
-
supportingText:
|
|
250
|
-
"A similarly long supporting text string, to confirm the same wrap-or-truncate behavior applies to it too",
|
|
251
|
-
},
|
|
252
|
-
];
|
|
253
|
-
|
|
254
|
-
// Renders the option row content directly — outside the floating/portal menu — inside a
|
|
255
|
-
// container sized to AutoComplete's own max-width token. Spacing between rows, icon/
|
|
256
|
-
// supportingText presence-or-absence alignment, and long-text wrapping/truncation are all much
|
|
257
|
-
// easier to inspect this way than by opening the real (portal-rendered) combobox dropdown. See
|
|
258
|
-
// MANTINE_ADAPTER_RICH_OPTION_DATA.md.
|
|
259
|
-
const renderOptionRowPreview = (wrapItemText: boolean) => (
|
|
260
|
-
<div
|
|
261
|
-
className={styles.dropdown}
|
|
262
|
-
style={{
|
|
263
|
-
width:
|
|
264
|
-
"var(--recursica_ui-kit_components_autocomplete_variants_layouts_stacked_properties_max-width)",
|
|
265
|
-
}}
|
|
266
|
-
>
|
|
267
|
-
{OPTION_ROW_PREVIEW_ITEMS.map((item) => (
|
|
268
|
-
<div key={item.value} className={styles.option}>
|
|
269
|
-
{renderRichOption(
|
|
270
|
-
{ option: item },
|
|
271
|
-
optionRowPreviewClassNames,
|
|
272
|
-
wrapItemText,
|
|
273
|
-
)}
|
|
274
|
-
</div>
|
|
275
|
-
))}
|
|
276
|
-
</div>
|
|
277
|
-
);
|
|
278
|
-
|
|
279
|
-
// Default: `wrapItemText` is false — label/supportingText truncate to a single line with an
|
|
280
|
-
// ellipsis instead of wrapping.
|
|
281
|
-
export const RichOptionRowPreview: Story = {
|
|
282
|
-
parameters: {
|
|
283
|
-
controls: { disable: true },
|
|
284
|
-
},
|
|
285
|
-
render: () => renderOptionRowPreview(false),
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
// `wrapItemText: true` — label/supportingText wrap onto additional lines instead of truncating.
|
|
289
|
-
export const RichOptionRowPreviewWrapped: Story = {
|
|
290
|
-
parameters: {
|
|
291
|
-
controls: { disable: true },
|
|
292
|
-
},
|
|
293
|
-
render: () => renderOptionRowPreview(true),
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
export const Disabled: Story = {
|
|
297
|
-
args: {
|
|
298
|
-
label: "Disabled Deployment Node",
|
|
299
|
-
placeholder: "Disabled primitive map...",
|
|
300
|
-
data: ["Node 1", "Node 2", "Node 3"],
|
|
301
|
-
disabled: true,
|
|
302
|
-
},
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
export const ErrorState: Story = {
|
|
306
|
-
args: {
|
|
307
|
-
label: "Cluster Failure",
|
|
308
|
-
placeholder: "Failing component instance...",
|
|
309
|
-
data: ["Cluster A", "Cluster B", "Cluster C"],
|
|
310
|
-
defaultValue: "Invalid Cluster",
|
|
311
|
-
error:
|
|
312
|
-
"Critical runtime node disconnect detected traversing DOM architecture.",
|
|
313
|
-
required: true,
|
|
314
|
-
},
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
export const StaticReadOnly: Story = {
|
|
318
|
-
args: {
|
|
319
|
-
label: "Static ReadOnly Review",
|
|
320
|
-
placeholder: "Ignored...",
|
|
321
|
-
data: ["Option 1", "Option 2"],
|
|
322
|
-
value: "Explicitly Uneditable Bound Output",
|
|
323
|
-
readOnly: true,
|
|
324
|
-
},
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
export const EditableReadOnly: Story = {
|
|
328
|
-
args: {
|
|
329
|
-
label: "Editable ReadOnly Review",
|
|
330
|
-
placeholder: "Ignored until active...",
|
|
331
|
-
data: ["Option 1", "Option 2"],
|
|
332
|
-
defaultValue: "Waiting for Edit Execution",
|
|
333
|
-
readOnly: true,
|
|
334
|
-
labelWithEditIcon: true,
|
|
335
|
-
},
|
|
336
|
-
};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { Avatar } from "./Avatar";
|
|
4
|
-
|
|
5
|
-
type AvatarStoryProps = React.ComponentProps<typeof Avatar>;
|
|
6
|
-
|
|
7
|
-
const meta: Meta<AvatarStoryProps> = {
|
|
8
|
-
title: "UI-Kit/Avatar",
|
|
9
|
-
component: Avatar,
|
|
10
|
-
tags: ["autodocs"],
|
|
11
|
-
argTypes: {
|
|
12
|
-
variant: {
|
|
13
|
-
control: "select",
|
|
14
|
-
options: ["solid", "outline", "ghost"],
|
|
15
|
-
description:
|
|
16
|
-
"The visual variant of the avatar (applies to icon/text styles)",
|
|
17
|
-
},
|
|
18
|
-
size: {
|
|
19
|
-
control: "radio",
|
|
20
|
-
options: ["default", "small", "large"],
|
|
21
|
-
description: "The size of the avatar",
|
|
22
|
-
},
|
|
23
|
-
src: {
|
|
24
|
-
control: "text",
|
|
25
|
-
description: "Image URL for the image style avatar",
|
|
26
|
-
},
|
|
27
|
-
icon: {
|
|
28
|
-
table: {
|
|
29
|
-
disable: true,
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default meta;
|
|
36
|
-
|
|
37
|
-
type Story = StoryObj<AvatarStoryProps>;
|
|
38
|
-
|
|
39
|
-
export const Default: Story = {
|
|
40
|
-
args: {
|
|
41
|
-
size: "default",
|
|
42
|
-
variant: "solid",
|
|
43
|
-
},
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
45
|
-
render: ({ withLayer, layer, ...args }: any) => {
|
|
46
|
-
return <Avatar {...args} />;
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export const TextSolidDefault: Story = {
|
|
51
|
-
args: {
|
|
52
|
-
children: "JD",
|
|
53
|
-
variant: "solid",
|
|
54
|
-
size: "default",
|
|
55
|
-
},
|
|
56
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
57
|
-
render: ({ withLayer, layer, ...args }: any) => <Avatar {...args} />,
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const ImageLarge: Story = {
|
|
61
|
-
args: {
|
|
62
|
-
src: "https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=250&q=80",
|
|
63
|
-
size: "large",
|
|
64
|
-
},
|
|
65
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
66
|
-
render: ({ withLayer, layer, ...args }: any) => <Avatar {...args} />,
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export const IconSmallGhost: Story = {
|
|
70
|
-
args: {
|
|
71
|
-
size: "small",
|
|
72
|
-
variant: "ghost",
|
|
73
|
-
icon: (
|
|
74
|
-
<svg
|
|
75
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
76
|
-
width="16"
|
|
77
|
-
height="16"
|
|
78
|
-
viewBox="0 0 24 24"
|
|
79
|
-
fill="none"
|
|
80
|
-
stroke="currentColor"
|
|
81
|
-
strokeWidth="2"
|
|
82
|
-
strokeLinecap="round"
|
|
83
|
-
strokeLinejoin="round"
|
|
84
|
-
>
|
|
85
|
-
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
|
|
86
|
-
<circle cx="12" cy="7" r="4"></circle>
|
|
87
|
-
</svg>
|
|
88
|
-
),
|
|
89
|
-
},
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
91
|
-
render: ({ withLayer, layer, ...args }: any) => <Avatar {...args} />,
|
|
92
|
-
};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { Badge } from "./Badge";
|
|
4
|
-
import { Layer } from "@recursica/adapter-common";
|
|
5
|
-
|
|
6
|
-
type BadgeStoryProps = React.ComponentProps<typeof Badge>;
|
|
7
|
-
|
|
8
|
-
const meta: Meta<BadgeStoryProps> = {
|
|
9
|
-
title: "UI-Kit/Badge",
|
|
10
|
-
component: Badge,
|
|
11
|
-
tags: ["autodocs"],
|
|
12
|
-
argTypes: {
|
|
13
|
-
variant: {
|
|
14
|
-
control: "select",
|
|
15
|
-
options: ["alert", "primary-color", "success", "warning"],
|
|
16
|
-
description: "The style / intent mapping for the badge",
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default meta;
|
|
22
|
-
|
|
23
|
-
type Story = StoryObj<BadgeStoryProps>;
|
|
24
|
-
|
|
25
|
-
export const Default: Story = {
|
|
26
|
-
args: {
|
|
27
|
-
children: "Badge Label",
|
|
28
|
-
variant: "primary-color",
|
|
29
|
-
},
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
31
|
-
render: ({ withLayer, layer, ...args }: any) => {
|
|
32
|
-
return <Badge {...args} />;
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const StaticAlert: Story = {
|
|
37
|
-
args: {
|
|
38
|
-
children: "Alert Badge",
|
|
39
|
-
variant: "alert",
|
|
40
|
-
},
|
|
41
|
-
render: (args: BadgeStoryProps) => <Badge {...args} />,
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const StaticPrimary: Story = {
|
|
45
|
-
args: {
|
|
46
|
-
children: "Primary Badge",
|
|
47
|
-
variant: "primary-color",
|
|
48
|
-
},
|
|
49
|
-
render: (args: BadgeStoryProps) => <Badge {...args} />,
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const StaticSuccess: Story = {
|
|
53
|
-
args: {
|
|
54
|
-
children: "Success Badge",
|
|
55
|
-
variant: "success",
|
|
56
|
-
},
|
|
57
|
-
render: (args: BadgeStoryProps) => <Badge {...args} />,
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const StaticWarning: Story = {
|
|
61
|
-
args: {
|
|
62
|
-
children: "Warning Badge",
|
|
63
|
-
variant: "warning",
|
|
64
|
-
},
|
|
65
|
-
render: (args: BadgeStoryProps) => <Badge {...args} />,
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export const LayerOneAlert: Story = {
|
|
69
|
-
args: {
|
|
70
|
-
children: "Layer 1 Alert",
|
|
71
|
-
variant: "alert",
|
|
72
|
-
},
|
|
73
|
-
render: (args: BadgeStoryProps) => (
|
|
74
|
-
<Layer layer={1} style={{ padding: "24px" }}>
|
|
75
|
-
<Badge {...args} />
|
|
76
|
-
</Layer>
|
|
77
|
-
),
|
|
78
|
-
};
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { Breadcrumb } from "./Breadcrumb";
|
|
4
|
-
import { Link } from "../Link";
|
|
5
|
-
|
|
6
|
-
type BreadcrumbStoryProps = React.ComponentProps<typeof Breadcrumb> & {
|
|
7
|
-
items?: string[];
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const meta: Meta<BreadcrumbStoryProps> = {
|
|
11
|
-
title: "UI-Kit/Breadcrumb",
|
|
12
|
-
component: Breadcrumb,
|
|
13
|
-
tags: ["autodocs"],
|
|
14
|
-
parameters: {
|
|
15
|
-
docs: {
|
|
16
|
-
description: {
|
|
17
|
-
component:
|
|
18
|
-
"**Proper usage** (see `Default`): every crumb except the last is a `Link`; the last " +
|
|
19
|
-
"crumb — the current page — is plain text (e.g. a `<span>`), not a link. `Breadcrumb` " +
|
|
20
|
-
"does its best to neutralize a `Link` passed as the last item anyway (see " +
|
|
21
|
-
"`LastItemAsLink`), but that's a safety net, not something to rely on — see " +
|
|
22
|
-
"BREADCRUMB_IMPLEMENTATION_NOTES.md.",
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
argTypes: {
|
|
27
|
-
children: {
|
|
28
|
-
table: {
|
|
29
|
-
disable: true,
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
items: {
|
|
33
|
-
control: "object",
|
|
34
|
-
description:
|
|
35
|
-
"Array of string labels used to dynamically generate the interactive Breadcrumb nodes.",
|
|
36
|
-
table: {
|
|
37
|
-
category: "Story Controls",
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
separator: {
|
|
41
|
-
control: "text",
|
|
42
|
-
description: "Custom separator between items",
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
args: {
|
|
46
|
-
items: ["Home", "Components", "Breadcrumbs"],
|
|
47
|
-
},
|
|
48
|
-
render: ({ items, children, ...args }) => {
|
|
49
|
-
const mappedChildren = items
|
|
50
|
-
? items.map((label, index) =>
|
|
51
|
-
// The last crumb represents the current page, so it's plain text,
|
|
52
|
-
// not a link — matches standard breadcrumb UX.
|
|
53
|
-
index === items.length - 1 ? (
|
|
54
|
-
<span key={index}>{label}</span>
|
|
55
|
-
) : (
|
|
56
|
-
<Link href="#" key={index}>
|
|
57
|
-
{label}
|
|
58
|
-
</Link>
|
|
59
|
-
),
|
|
60
|
-
)
|
|
61
|
-
: children;
|
|
62
|
-
|
|
63
|
-
return <Breadcrumb children={mappedChildren} {...args} />;
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export default meta;
|
|
68
|
-
|
|
69
|
-
type Story = StoryObj<BreadcrumbStoryProps>;
|
|
70
|
-
|
|
71
|
-
export const Default: Story = {
|
|
72
|
-
args: {
|
|
73
|
-
items: ["Dashboard", "Settings", "Security"],
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export const CustomSeparator: Story = {
|
|
78
|
-
args: {
|
|
79
|
-
items: ["Root", "Branch", "Leaf"],
|
|
80
|
-
separator: "→",
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export const LastItemAsLink: Story = {
|
|
85
|
-
name: "Last Item As Link (Incorrect Usage)",
|
|
86
|
-
args: {
|
|
87
|
-
// Bypass the `items` convenience prop (which always renders the last crumb as a span) to
|
|
88
|
-
// demonstrate what happens if a caller wraps every crumb, including the last, in a `Link`.
|
|
89
|
-
items: undefined,
|
|
90
|
-
children: [
|
|
91
|
-
<Link href="#" key="dashboard">
|
|
92
|
-
Dashboard
|
|
93
|
-
</Link>,
|
|
94
|
-
<Link href="#" key="settings">
|
|
95
|
-
Settings
|
|
96
|
-
</Link>,
|
|
97
|
-
<Link href="#" key="security">
|
|
98
|
-
Security
|
|
99
|
-
</Link>,
|
|
100
|
-
],
|
|
101
|
-
},
|
|
102
|
-
parameters: {
|
|
103
|
-
docs: {
|
|
104
|
-
description: {
|
|
105
|
-
story:
|
|
106
|
-
"Incorrect usage, kept as a story to prove Breadcrumb still handles it: the last " +
|
|
107
|
-
'crumb is a `Link`, but Breadcrumb adds `aria-current="page"`, strips its `href`/' +
|
|
108
|
-
"`onClick`, drops it from the tab order, and the CSS reset removes Link's color/" +
|
|
109
|
-
"underline — it renders identically to `Default`'s plain-text current item. Don't " +
|
|
110
|
-
"rely on this; pass plain text for the last crumb instead.",
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
};
|