@lateralus-ai/shipping-ui 2.0.0-dev.3 → 2.0.0-dev.30
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/components/Entry.d.ts +27 -7
- package/dist/components/PageHeader.d.ts +41 -0
- package/dist/components/ScrollableList.d.ts +22 -0
- package/dist/components/Tabs.d.ts +5 -5
- package/dist/components/index.d.ts +4 -2
- package/dist/domain/Filters/FilterDropdown.d.ts +119 -0
- package/dist/domain/Filters/FilterPill.d.ts +22 -5
- package/dist/domain/Filters/FilterPills.d.ts +18 -0
- package/dist/domain/Filters/FilteredPill.d.ts +15 -5
- package/dist/domain/Filters/formatActiveFilterChipLabel.d.ts +11 -0
- package/dist/domain/Filters/index.d.ts +8 -3
- package/dist/index.cjs +33 -33
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +6383 -4792
- package/dist/patterns/Search/ResultRow.d.ts +11 -5
- package/dist/patterns/Sidebar/sidebar-styles.d.ts +2 -1
- package/dist/primitives/Badge.d.ts +7 -4
- package/dist/primitives/Button.d.ts +3 -1
- package/dist/primitives/Switch.d.ts +5 -0
- package/dist/primitives/index.d.ts +1 -1
- package/dist/tailwind-theme.d.ts +8 -4
- package/dist/theme-entry-Dwr2mV7_.js +1 -0
- package/dist/{theme-entry-CxDa1D0_.mjs → theme-entry-tLBc6zGT.mjs} +12 -8
- package/dist/theme.cjs +1 -1
- package/dist/theme.esm.js +1 -1
- package/package.json +3 -2
- package/src/components/EmptyState.tsx +44 -44
- package/src/components/Entry.tsx +119 -45
- package/src/components/Modal.tsx +141 -141
- package/src/components/PageHeader.tsx +132 -0
- package/src/components/ScrollableList.tsx +61 -0
- package/src/components/Tabs.tsx +33 -26
- package/src/components/index.ts +15 -1
- package/src/domain/Filters/FilterDropdown.tsx +540 -0
- package/src/domain/Filters/FilterPill.tsx +74 -25
- package/src/domain/Filters/FilterPills.tsx +34 -0
- package/src/domain/Filters/FilteredPill.tsx +59 -39
- package/src/domain/Filters/FiltersBar.tsx +72 -76
- package/src/domain/Filters/formatActiveFilterChipLabel.ts +23 -0
- package/src/domain/Filters/index.ts +37 -3
- package/src/icons/arrow-paths.ts +8 -8
- package/src/icons/chevron-paths.ts +17 -17
- package/src/icons/icons-data.ts +656 -656
- package/src/index.ts +11 -0
- package/src/patterns/Search/ResultRow.tsx +24 -38
- package/src/patterns/Search/SearchModal.tsx +26 -8
- package/src/patterns/Sidebar/CollapsibleNavGroup.tsx +1 -1
- package/src/patterns/Sidebar/SidebarAction.tsx +26 -17
- package/src/patterns/Sidebar/SidebarEntry.tsx +54 -39
- package/src/patterns/Sidebar/SidebarLink.tsx +30 -20
- package/src/patterns/Sidebar/assets/logo-compliance-mark.png +5 -5
- package/src/patterns/Sidebar/assets/logo-compliance-mask.png +13 -13
- package/src/patterns/Sidebar/assets/logo-compliance.svg +17 -17
- package/src/patterns/Sidebar/assets/logo-technical-avatar.svg +17 -17
- package/src/patterns/Sidebar/assets/logo-technical-mark.png +5 -5
- package/src/patterns/Sidebar/assets/logo-technical.svg +16 -16
- package/src/patterns/Sidebar/sidebar-styles.ts +2 -1
- package/src/primitives/Badge.tsx +20 -10
- package/src/primitives/Button.tsx +21 -11
- package/src/primitives/Logo.tsx +20 -8
- package/src/primitives/Switch.tsx +27 -7
- package/src/primitives/button-styles.ts +92 -92
- package/src/primitives/index.ts +1 -1
- package/src/stories/canvases/ButtonsCanvas.tsx +107 -107
- package/src/stories/canvases/ButtonsMatrixCanvas.tsx +65 -65
- package/src/stories/canvases/ContentCanvas.tsx +253 -14
- package/src/stories/canvases/FiltersCanvas.tsx +171 -41
- package/src/stories/canvases/figma-buttons-layout.ts +83 -83
- package/src/stories/canvases/figma-widths.ts +28 -28
- package/src/stories/canvases/helpers.tsx +146 -146
- package/src/stories/components/Buttons.stories.tsx +11 -11
- package/src/stories/components/Chat.stories.tsx +11 -11
- package/src/stories/components/Content.stories.tsx +11 -11
- package/src/stories/components/Core.stories.tsx +11 -11
- package/src/stories/components/DomainForms.stories.tsx +11 -11
- package/src/stories/components/Filters.stories.tsx +11 -11
- package/src/stories/components/Forms.stories.tsx +11 -11
- package/src/stories/components/Icons.stories.tsx +11 -11
- package/src/stories/components/Illustrations.stories.tsx +11 -11
- package/src/stories/components/Library.stories.tsx +11 -11
- package/src/stories/components/Modals.stories.tsx +11 -11
- package/src/stories/components/Report.stories.tsx +11 -11
- package/src/stories/components/ReportLayout.stories.tsx +11 -11
- package/src/stories/components/Search.stories.tsx +11 -11
- package/src/stories/components/Settings.stories.tsx +11 -11
- package/src/stories/components/Ships.stories.tsx +11 -11
- package/src/stories/components/SidebarLayouts.stories.tsx +11 -11
- package/src/stories/components/Skeletons.stories.tsx +11 -11
- package/src/stories/components/Workflows.stories.tsx +11 -11
- package/src/stories/style-guide/Buttons.stories.tsx +11 -11
- package/src/stories/style-guide/ColorTokens.stories.tsx +11 -11
- package/src/stories/style-guide/Colors.stories.tsx +11 -11
- package/src/stories/style-guide/RaiseLevels.stories.tsx +11 -11
- package/src/stories/style-guide/Typography.stories.tsx +11 -11
- package/src/tailwind-theme.ts +8 -4
- package/src/theme-entry.ts +2 -2
- package/src/utils/cn.ts +28 -1
- package/dist/theme-entry-D2X3Ptjf.js +0 -1
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
/** Figma Buttons > Content > Button frame — 414×312, slots 106×40 */
|
|
2
|
-
|
|
3
|
-
export const FIGMA_BUTTONS_GRID = {
|
|
4
|
-
width: 414,
|
|
5
|
-
height: 312,
|
|
6
|
-
} as const;
|
|
7
|
-
|
|
8
|
-
export type ButtonVisualState = "idle" | "hover" | "disabled";
|
|
9
|
-
|
|
10
|
-
export type ButtonGridSlot = {
|
|
11
|
-
hierarchy:
|
|
12
|
-
| "primary"
|
|
13
|
-
| "secondary"
|
|
14
|
-
| "tertiary"
|
|
15
|
-
| "quaternary"
|
|
16
|
-
| "destructive";
|
|
17
|
-
visualState: ButtonVisualState;
|
|
18
|
-
x: number;
|
|
19
|
-
y: number;
|
|
20
|
-
width: number;
|
|
21
|
-
height: number;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const BUTTON_WIDTH = 106;
|
|
25
|
-
const BUTTON_HEIGHT = 40;
|
|
26
|
-
const COLUMN_X = [24, 154, 284] as const;
|
|
27
|
-
const ROW_Y = [24, 80, 136, 192, 248] as const;
|
|
28
|
-
|
|
29
|
-
const hierarchies = [
|
|
30
|
-
"primary",
|
|
31
|
-
"secondary",
|
|
32
|
-
"tertiary",
|
|
33
|
-
"quaternary",
|
|
34
|
-
"destructive",
|
|
35
|
-
] as const;
|
|
36
|
-
|
|
37
|
-
const visualStates: ButtonVisualState[] = ["idle", "hover", "disabled"];
|
|
38
|
-
|
|
39
|
-
export const FIGMA_BUTTON_SLOTS: ButtonGridSlot[] = hierarchies.flatMap(
|
|
40
|
-
(hierarchy, rowIndex) =>
|
|
41
|
-
visualStates.map((visualState, columnIndex) => ({
|
|
42
|
-
hierarchy,
|
|
43
|
-
visualState,
|
|
44
|
-
x: COLUMN_X[columnIndex],
|
|
45
|
-
y: ROW_Y[rowIndex],
|
|
46
|
-
width: BUTTON_WIDTH,
|
|
47
|
-
height: BUTTON_HEIGHT,
|
|
48
|
-
})),
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
export type ButtonVariantSlot = {
|
|
52
|
-
hierarchy: (typeof hierarchies)[number];
|
|
53
|
-
variant: "noIcon" | "noDropdown";
|
|
54
|
-
x: number;
|
|
55
|
-
y: number;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const VARIANT_COLUMN_X = [414, 544] as const;
|
|
59
|
-
|
|
60
|
-
/** Extra canvas slots — excluded from `data-figma-buttons-grid` visual clip */
|
|
61
|
-
export const BUTTON_VARIANT_SLOTS: ButtonVariantSlot[] = hierarchies.flatMap(
|
|
62
|
-
(hierarchy, rowIndex) => [
|
|
63
|
-
{
|
|
64
|
-
hierarchy,
|
|
65
|
-
variant: "noIcon" as const,
|
|
66
|
-
x: VARIANT_COLUMN_X[0],
|
|
67
|
-
y: ROW_Y[rowIndex],
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
hierarchy,
|
|
71
|
-
variant: "noDropdown" as const,
|
|
72
|
-
x: VARIANT_COLUMN_X[1],
|
|
73
|
-
y: ROW_Y[rowIndex],
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
export const FIGMA_BUTTONS_CANVAS = {
|
|
79
|
-
figmaGridWidth: FIGMA_BUTTONS_GRID.width,
|
|
80
|
-
figmaGridHeight: FIGMA_BUTTONS_GRID.height,
|
|
81
|
-
width: VARIANT_COLUMN_X[1] + BUTTON_WIDTH + 24,
|
|
82
|
-
height: FIGMA_BUTTONS_GRID.height,
|
|
83
|
-
} as const;
|
|
1
|
+
/** Figma Buttons > Content > Button frame — 414×312, slots 106×40 */
|
|
2
|
+
|
|
3
|
+
export const FIGMA_BUTTONS_GRID = {
|
|
4
|
+
width: 414,
|
|
5
|
+
height: 312,
|
|
6
|
+
} as const;
|
|
7
|
+
|
|
8
|
+
export type ButtonVisualState = "idle" | "hover" | "disabled";
|
|
9
|
+
|
|
10
|
+
export type ButtonGridSlot = {
|
|
11
|
+
hierarchy:
|
|
12
|
+
| "primary"
|
|
13
|
+
| "secondary"
|
|
14
|
+
| "tertiary"
|
|
15
|
+
| "quaternary"
|
|
16
|
+
| "destructive";
|
|
17
|
+
visualState: ButtonVisualState;
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const BUTTON_WIDTH = 106;
|
|
25
|
+
const BUTTON_HEIGHT = 40;
|
|
26
|
+
const COLUMN_X = [24, 154, 284] as const;
|
|
27
|
+
const ROW_Y = [24, 80, 136, 192, 248] as const;
|
|
28
|
+
|
|
29
|
+
const hierarchies = [
|
|
30
|
+
"primary",
|
|
31
|
+
"secondary",
|
|
32
|
+
"tertiary",
|
|
33
|
+
"quaternary",
|
|
34
|
+
"destructive",
|
|
35
|
+
] as const;
|
|
36
|
+
|
|
37
|
+
const visualStates: ButtonVisualState[] = ["idle", "hover", "disabled"];
|
|
38
|
+
|
|
39
|
+
export const FIGMA_BUTTON_SLOTS: ButtonGridSlot[] = hierarchies.flatMap(
|
|
40
|
+
(hierarchy, rowIndex) =>
|
|
41
|
+
visualStates.map((visualState, columnIndex) => ({
|
|
42
|
+
hierarchy,
|
|
43
|
+
visualState,
|
|
44
|
+
x: COLUMN_X[columnIndex],
|
|
45
|
+
y: ROW_Y[rowIndex],
|
|
46
|
+
width: BUTTON_WIDTH,
|
|
47
|
+
height: BUTTON_HEIGHT,
|
|
48
|
+
})),
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export type ButtonVariantSlot = {
|
|
52
|
+
hierarchy: (typeof hierarchies)[number];
|
|
53
|
+
variant: "noIcon" | "noDropdown";
|
|
54
|
+
x: number;
|
|
55
|
+
y: number;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const VARIANT_COLUMN_X = [414, 544] as const;
|
|
59
|
+
|
|
60
|
+
/** Extra canvas slots — excluded from `data-figma-buttons-grid` visual clip */
|
|
61
|
+
export const BUTTON_VARIANT_SLOTS: ButtonVariantSlot[] = hierarchies.flatMap(
|
|
62
|
+
(hierarchy, rowIndex) => [
|
|
63
|
+
{
|
|
64
|
+
hierarchy,
|
|
65
|
+
variant: "noIcon" as const,
|
|
66
|
+
x: VARIANT_COLUMN_X[0],
|
|
67
|
+
y: ROW_Y[rowIndex],
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
hierarchy,
|
|
71
|
+
variant: "noDropdown" as const,
|
|
72
|
+
x: VARIANT_COLUMN_X[1],
|
|
73
|
+
y: ROW_Y[rowIndex],
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
export const FIGMA_BUTTONS_CANVAS = {
|
|
79
|
+
figmaGridWidth: FIGMA_BUTTONS_GRID.width,
|
|
80
|
+
figmaGridHeight: FIGMA_BUTTONS_GRID.height,
|
|
81
|
+
width: VARIANT_COLUMN_X[1] + BUTTON_WIDTH + 24,
|
|
82
|
+
height: FIGMA_BUTTONS_GRID.height,
|
|
83
|
+
} as const;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
/** Figma frame widths — source of truth for Storybook canvas pages */
|
|
2
|
-
export const FIGMA_WIDTHS = {
|
|
3
|
-
colors: 3060,
|
|
4
|
-
colorTokens: 1064,
|
|
5
|
-
typography: 1064,
|
|
6
|
-
buttonsMatrix: 808,
|
|
7
|
-
raiseLevels: 760,
|
|
8
|
-
buttons: 526,
|
|
9
|
-
icons: 774,
|
|
10
|
-
core: 732,
|
|
11
|
-
illustrations: 1152,
|
|
12
|
-
sidebar: 464,
|
|
13
|
-
sidebarLayouts: 1432,
|
|
14
|
-
chat: 1558,
|
|
15
|
-
ships: 1280,
|
|
16
|
-
content: 1280,
|
|
17
|
-
forms: 564,
|
|
18
|
-
report: 770,
|
|
19
|
-
modals: 1434,
|
|
20
|
-
skeletons: 512,
|
|
21
|
-
reportLayout: 960,
|
|
22
|
-
search: 848,
|
|
23
|
-
settings: 1076,
|
|
24
|
-
workflows: 1536,
|
|
25
|
-
domainForms: 1488,
|
|
26
|
-
filters: 1232,
|
|
27
|
-
library: 1288,
|
|
28
|
-
} as const;
|
|
1
|
+
/** Figma frame widths — source of truth for Storybook canvas pages */
|
|
2
|
+
export const FIGMA_WIDTHS = {
|
|
3
|
+
colors: 3060,
|
|
4
|
+
colorTokens: 1064,
|
|
5
|
+
typography: 1064,
|
|
6
|
+
buttonsMatrix: 808,
|
|
7
|
+
raiseLevels: 760,
|
|
8
|
+
buttons: 526,
|
|
9
|
+
icons: 774,
|
|
10
|
+
core: 732,
|
|
11
|
+
illustrations: 1152,
|
|
12
|
+
sidebar: 464,
|
|
13
|
+
sidebarLayouts: 1432,
|
|
14
|
+
chat: 1558,
|
|
15
|
+
ships: 1280,
|
|
16
|
+
content: 1280,
|
|
17
|
+
forms: 564,
|
|
18
|
+
report: 770,
|
|
19
|
+
modals: 1434,
|
|
20
|
+
skeletons: 512,
|
|
21
|
+
reportLayout: 960,
|
|
22
|
+
search: 848,
|
|
23
|
+
settings: 1076,
|
|
24
|
+
workflows: 1536,
|
|
25
|
+
domainForms: 1488,
|
|
26
|
+
filters: 1232,
|
|
27
|
+
library: 1288,
|
|
28
|
+
} as const;
|
|
@@ -1,146 +1,146 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import { colorScales } from "../../tokens/colors";
|
|
3
|
-
import { cn } from "../../utils/cn";
|
|
4
|
-
|
|
5
|
-
type ButtonHierarchy =
|
|
6
|
-
| "primary"
|
|
7
|
-
| "secondary"
|
|
8
|
-
| "tertiary"
|
|
9
|
-
| "quaternary"
|
|
10
|
-
| "destructive";
|
|
11
|
-
type VisualState = "idle" | "hover" | "disabled";
|
|
12
|
-
|
|
13
|
-
const hierarchyStyles: Record<ButtonHierarchy, Record<VisualState, string>> = {
|
|
14
|
-
primary: {
|
|
15
|
-
idle: "bg-action-primary-idle text-action-primary-on-idle",
|
|
16
|
-
hover: "bg-action-primary-hover text-action-primary-on-hover",
|
|
17
|
-
disabled: "bg-action-primary-disabled text-action-primary-on-disabled",
|
|
18
|
-
},
|
|
19
|
-
secondary: {
|
|
20
|
-
idle: "border border-divider-primary bg-action-secondary-idle text-action-secondary-on-idle",
|
|
21
|
-
hover: "border border-divider-secondary bg-action-secondary-hover text-action-secondary-on-hover",
|
|
22
|
-
disabled:
|
|
23
|
-
"border border-divider-primary bg-action-secondary-disabled text-action-secondary-on-disabled",
|
|
24
|
-
},
|
|
25
|
-
tertiary: {
|
|
26
|
-
idle: "bg-action-tertiary-idle text-action-tertiary-on-idle",
|
|
27
|
-
hover: "bg-action-tertiary-hover text-action-tertiary-on-hover",
|
|
28
|
-
disabled: "bg-action-tertiary-disabled text-action-tertiary-on-disabled",
|
|
29
|
-
},
|
|
30
|
-
quaternary: {
|
|
31
|
-
idle: "bg-action-quaternary-idle text-action-quaternary-on-idle",
|
|
32
|
-
hover: "bg-action-quaternary-hover text-action-quaternary-on-hover",
|
|
33
|
-
disabled:
|
|
34
|
-
"bg-action-quaternary-disabled text-action-quaternary-on-disabled",
|
|
35
|
-
},
|
|
36
|
-
destructive: {
|
|
37
|
-
idle: "bg-action-destructive-idle text-action-destructive-on-idle",
|
|
38
|
-
hover: "bg-action-destructive-hover text-action-destructive-on-hover",
|
|
39
|
-
disabled:
|
|
40
|
-
"bg-action-destructive-disabled text-action-destructive-on-disabled",
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const ButtonSnapshot = ({
|
|
45
|
-
hierarchy,
|
|
46
|
-
visualState = "idle",
|
|
47
|
-
children = "Button",
|
|
48
|
-
}: {
|
|
49
|
-
hierarchy: ButtonHierarchy;
|
|
50
|
-
visualState?: VisualState;
|
|
51
|
-
children?: ReactNode;
|
|
52
|
-
}) => (
|
|
53
|
-
<span
|
|
54
|
-
className={cn(
|
|
55
|
-
"inline-flex min-h-10 min-w-[94px] items-center justify-center rounded-control px-2 text-caption-1 tracking-[0.32px]",
|
|
56
|
-
visualState === "disabled" && "cursor-not-allowed",
|
|
57
|
-
hierarchyStyles[hierarchy][visualState],
|
|
58
|
-
)}
|
|
59
|
-
>
|
|
60
|
-
{children}
|
|
61
|
-
</span>
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
export const IconButtonSnapshot = ({
|
|
65
|
-
hierarchy = "tertiary",
|
|
66
|
-
visualState = "idle",
|
|
67
|
-
size = "large",
|
|
68
|
-
}: {
|
|
69
|
-
hierarchy?: "tertiary" | "quaternary";
|
|
70
|
-
visualState?: "idle" | "hover";
|
|
71
|
-
size?: "large" | "small";
|
|
72
|
-
}) => {
|
|
73
|
-
const idleHover: Record<"tertiary" | "quaternary", Record<"idle" | "hover", string>> = {
|
|
74
|
-
tertiary: {
|
|
75
|
-
idle: "bg-action-tertiary-idle text-action-tertiary-on-idle",
|
|
76
|
-
hover: "bg-action-tertiary-hover text-action-tertiary-on-hover",
|
|
77
|
-
},
|
|
78
|
-
quaternary: {
|
|
79
|
-
idle: "bg-action-quaternary-idle text-action-quaternary-on-idle",
|
|
80
|
-
hover: "bg-action-quaternary-hover text-action-quaternary-on-hover",
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
return (
|
|
85
|
-
<span
|
|
86
|
-
className={cn(
|
|
87
|
-
"inline-flex items-center justify-center rounded-control text-action-tertiary-on-idle",
|
|
88
|
-
size === "large" ? "size-10 [&>svg]:size-6" : "size-8 [&>svg]:size-4",
|
|
89
|
-
idleHover[hierarchy][visualState],
|
|
90
|
-
)}
|
|
91
|
-
>
|
|
92
|
-
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" aria-hidden>
|
|
93
|
-
<path d="M12 5v14M5 12h14" strokeLinecap="round" />
|
|
94
|
-
</svg>
|
|
95
|
-
</span>
|
|
96
|
-
);
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
type ColorScaleName = keyof typeof colorScales;
|
|
100
|
-
|
|
101
|
-
export const ColorScaleRow = ({ name }: { name: ColorScaleName }) => {
|
|
102
|
-
const scale = colorScales[name];
|
|
103
|
-
const shades = ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"] as const;
|
|
104
|
-
|
|
105
|
-
return (
|
|
106
|
-
<div className="mb-8">
|
|
107
|
-
<p className="mb-2 text-subheader-em capitalize text-display-on-light-primary">{name}</p>
|
|
108
|
-
<div className="flex">
|
|
109
|
-
{shades.map((shade) => (
|
|
110
|
-
<div
|
|
111
|
-
key={shade}
|
|
112
|
-
className="flex h-20 w-[100px] items-center justify-center text-body text-display-on-light-primary"
|
|
113
|
-
style={{ backgroundColor: scale[shade] }}
|
|
114
|
-
>
|
|
115
|
-
{shade}
|
|
116
|
-
</div>
|
|
117
|
-
))}
|
|
118
|
-
</div>
|
|
119
|
-
</div>
|
|
120
|
-
);
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export const SemanticSwatch = ({
|
|
124
|
-
label,
|
|
125
|
-
cssVar,
|
|
126
|
-
textClassName = "text-display-on-light-primary",
|
|
127
|
-
}: {
|
|
128
|
-
label: string;
|
|
129
|
-
cssVar: string;
|
|
130
|
-
textClassName?: string;
|
|
131
|
-
}) => (
|
|
132
|
-
<div className="w-[250px]">
|
|
133
|
-
<div
|
|
134
|
-
className={cn("flex h-[90px] items-end rounded-control p-3 text-caption-2-em", textClassName)}
|
|
135
|
-
style={{ background: `var(${cssVar})` }}
|
|
136
|
-
>
|
|
137
|
-
{label}
|
|
138
|
-
</div>
|
|
139
|
-
</div>
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
export const formatIconLabel = (name: string) =>
|
|
143
|
-
name
|
|
144
|
-
.replace(/([A-Z])/g, " $1")
|
|
145
|
-
.replace(/^./, (char) => char.toUpperCase())
|
|
146
|
-
.trim();
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { colorScales } from "../../tokens/colors";
|
|
3
|
+
import { cn } from "../../utils/cn";
|
|
4
|
+
|
|
5
|
+
type ButtonHierarchy =
|
|
6
|
+
| "primary"
|
|
7
|
+
| "secondary"
|
|
8
|
+
| "tertiary"
|
|
9
|
+
| "quaternary"
|
|
10
|
+
| "destructive";
|
|
11
|
+
type VisualState = "idle" | "hover" | "disabled";
|
|
12
|
+
|
|
13
|
+
const hierarchyStyles: Record<ButtonHierarchy, Record<VisualState, string>> = {
|
|
14
|
+
primary: {
|
|
15
|
+
idle: "bg-action-primary-idle text-action-primary-on-idle",
|
|
16
|
+
hover: "bg-action-primary-hover text-action-primary-on-hover",
|
|
17
|
+
disabled: "bg-action-primary-disabled text-action-primary-on-disabled",
|
|
18
|
+
},
|
|
19
|
+
secondary: {
|
|
20
|
+
idle: "border border-divider-primary bg-action-secondary-idle text-action-secondary-on-idle",
|
|
21
|
+
hover: "border border-divider-secondary bg-action-secondary-hover text-action-secondary-on-hover",
|
|
22
|
+
disabled:
|
|
23
|
+
"border border-divider-primary bg-action-secondary-disabled text-action-secondary-on-disabled",
|
|
24
|
+
},
|
|
25
|
+
tertiary: {
|
|
26
|
+
idle: "bg-action-tertiary-idle text-action-tertiary-on-idle",
|
|
27
|
+
hover: "bg-action-tertiary-hover text-action-tertiary-on-hover",
|
|
28
|
+
disabled: "bg-action-tertiary-disabled text-action-tertiary-on-disabled",
|
|
29
|
+
},
|
|
30
|
+
quaternary: {
|
|
31
|
+
idle: "bg-action-quaternary-idle text-action-quaternary-on-idle",
|
|
32
|
+
hover: "bg-action-quaternary-hover text-action-quaternary-on-hover",
|
|
33
|
+
disabled:
|
|
34
|
+
"bg-action-quaternary-disabled text-action-quaternary-on-disabled",
|
|
35
|
+
},
|
|
36
|
+
destructive: {
|
|
37
|
+
idle: "bg-action-destructive-idle text-action-destructive-on-idle",
|
|
38
|
+
hover: "bg-action-destructive-hover text-action-destructive-on-hover",
|
|
39
|
+
disabled:
|
|
40
|
+
"bg-action-destructive-disabled text-action-destructive-on-disabled",
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const ButtonSnapshot = ({
|
|
45
|
+
hierarchy,
|
|
46
|
+
visualState = "idle",
|
|
47
|
+
children = "Button",
|
|
48
|
+
}: {
|
|
49
|
+
hierarchy: ButtonHierarchy;
|
|
50
|
+
visualState?: VisualState;
|
|
51
|
+
children?: ReactNode;
|
|
52
|
+
}) => (
|
|
53
|
+
<span
|
|
54
|
+
className={cn(
|
|
55
|
+
"inline-flex min-h-10 min-w-[94px] items-center justify-center rounded-control px-2 text-caption-1 tracking-[0.32px]",
|
|
56
|
+
visualState === "disabled" && "cursor-not-allowed",
|
|
57
|
+
hierarchyStyles[hierarchy][visualState],
|
|
58
|
+
)}
|
|
59
|
+
>
|
|
60
|
+
{children}
|
|
61
|
+
</span>
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
export const IconButtonSnapshot = ({
|
|
65
|
+
hierarchy = "tertiary",
|
|
66
|
+
visualState = "idle",
|
|
67
|
+
size = "large",
|
|
68
|
+
}: {
|
|
69
|
+
hierarchy?: "tertiary" | "quaternary";
|
|
70
|
+
visualState?: "idle" | "hover";
|
|
71
|
+
size?: "large" | "small";
|
|
72
|
+
}) => {
|
|
73
|
+
const idleHover: Record<"tertiary" | "quaternary", Record<"idle" | "hover", string>> = {
|
|
74
|
+
tertiary: {
|
|
75
|
+
idle: "bg-action-tertiary-idle text-action-tertiary-on-idle",
|
|
76
|
+
hover: "bg-action-tertiary-hover text-action-tertiary-on-hover",
|
|
77
|
+
},
|
|
78
|
+
quaternary: {
|
|
79
|
+
idle: "bg-action-quaternary-idle text-action-quaternary-on-idle",
|
|
80
|
+
hover: "bg-action-quaternary-hover text-action-quaternary-on-hover",
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<span
|
|
86
|
+
className={cn(
|
|
87
|
+
"inline-flex items-center justify-center rounded-control text-action-tertiary-on-idle",
|
|
88
|
+
size === "large" ? "size-10 [&>svg]:size-6" : "size-8 [&>svg]:size-4",
|
|
89
|
+
idleHover[hierarchy][visualState],
|
|
90
|
+
)}
|
|
91
|
+
>
|
|
92
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" aria-hidden>
|
|
93
|
+
<path d="M12 5v14M5 12h14" strokeLinecap="round" />
|
|
94
|
+
</svg>
|
|
95
|
+
</span>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
type ColorScaleName = keyof typeof colorScales;
|
|
100
|
+
|
|
101
|
+
export const ColorScaleRow = ({ name }: { name: ColorScaleName }) => {
|
|
102
|
+
const scale = colorScales[name];
|
|
103
|
+
const shades = ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"] as const;
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<div className="mb-8">
|
|
107
|
+
<p className="mb-2 text-subheader-em capitalize text-display-on-light-primary">{name}</p>
|
|
108
|
+
<div className="flex">
|
|
109
|
+
{shades.map((shade) => (
|
|
110
|
+
<div
|
|
111
|
+
key={shade}
|
|
112
|
+
className="flex h-20 w-[100px] items-center justify-center text-body text-display-on-light-primary"
|
|
113
|
+
style={{ backgroundColor: scale[shade] }}
|
|
114
|
+
>
|
|
115
|
+
{shade}
|
|
116
|
+
</div>
|
|
117
|
+
))}
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export const SemanticSwatch = ({
|
|
124
|
+
label,
|
|
125
|
+
cssVar,
|
|
126
|
+
textClassName = "text-display-on-light-primary",
|
|
127
|
+
}: {
|
|
128
|
+
label: string;
|
|
129
|
+
cssVar: string;
|
|
130
|
+
textClassName?: string;
|
|
131
|
+
}) => (
|
|
132
|
+
<div className="w-[250px]">
|
|
133
|
+
<div
|
|
134
|
+
className={cn("flex h-[90px] items-end rounded-control p-3 text-caption-2-em", textClassName)}
|
|
135
|
+
style={{ background: `var(${cssVar})` }}
|
|
136
|
+
>
|
|
137
|
+
{label}
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
export const formatIconLabel = (name: string) =>
|
|
143
|
+
name
|
|
144
|
+
.replace(/([A-Z])/g, " $1")
|
|
145
|
+
.replace(/^./, (char) => char.toUpperCase())
|
|
146
|
+
.trim();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { ButtonsCanvas } from "../canvases/ButtonsCanvas";
|
|
3
|
-
|
|
4
|
-
const meta: Meta = {
|
|
5
|
-
title: "Components/Buttons",
|
|
6
|
-
parameters: { layout: "fullscreen" },
|
|
7
|
-
};
|
|
8
|
-
export default meta;
|
|
9
|
-
|
|
10
|
-
type Story = StoryObj;
|
|
11
|
-
export const Canvas: Story = { render: () => <ButtonsCanvas /> };
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ButtonsCanvas } from "../canvases/ButtonsCanvas";
|
|
3
|
+
|
|
4
|
+
const meta: Meta = {
|
|
5
|
+
title: "Components/Buttons",
|
|
6
|
+
parameters: { layout: "fullscreen" },
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
|
|
10
|
+
type Story = StoryObj;
|
|
11
|
+
export const Canvas: Story = { render: () => <ButtonsCanvas /> };
|
|
12
12
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { ChatCanvas } from "../canvases/ChatCanvas";
|
|
3
|
-
|
|
4
|
-
const meta: Meta = {
|
|
5
|
-
title: "Components/Chat",
|
|
6
|
-
parameters: { layout: "fullscreen" },
|
|
7
|
-
};
|
|
8
|
-
export default meta;
|
|
9
|
-
|
|
10
|
-
type Story = StoryObj;
|
|
11
|
-
export const Canvas: Story = { render: () => <ChatCanvas /> };
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ChatCanvas } from "../canvases/ChatCanvas";
|
|
3
|
+
|
|
4
|
+
const meta: Meta = {
|
|
5
|
+
title: "Components/Chat",
|
|
6
|
+
parameters: { layout: "fullscreen" },
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
|
|
10
|
+
type Story = StoryObj;
|
|
11
|
+
export const Canvas: Story = { render: () => <ChatCanvas /> };
|
|
12
12
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { ContentCanvas } from "../canvases/ContentCanvas";
|
|
3
|
-
|
|
4
|
-
const meta: Meta = {
|
|
5
|
-
title: "Components/Content",
|
|
6
|
-
parameters: { layout: "fullscreen" },
|
|
7
|
-
};
|
|
8
|
-
export default meta;
|
|
9
|
-
|
|
10
|
-
type Story = StoryObj;
|
|
11
|
-
export const Canvas: Story = { render: () => <ContentCanvas /> };
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ContentCanvas } from "../canvases/ContentCanvas";
|
|
3
|
+
|
|
4
|
+
const meta: Meta = {
|
|
5
|
+
title: "Components/Content",
|
|
6
|
+
parameters: { layout: "fullscreen" },
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
|
|
10
|
+
type Story = StoryObj;
|
|
11
|
+
export const Canvas: Story = { render: () => <ContentCanvas /> };
|
|
12
12
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { CoreCanvas } from "../canvases/CoreCanvas";
|
|
3
|
-
|
|
4
|
-
const meta: Meta = {
|
|
5
|
-
title: "Components/Core",
|
|
6
|
-
parameters: { layout: "fullscreen" },
|
|
7
|
-
};
|
|
8
|
-
export default meta;
|
|
9
|
-
|
|
10
|
-
type Story = StoryObj;
|
|
11
|
-
export const Canvas: Story = { render: () => <CoreCanvas /> };
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { CoreCanvas } from "../canvases/CoreCanvas";
|
|
3
|
+
|
|
4
|
+
const meta: Meta = {
|
|
5
|
+
title: "Components/Core",
|
|
6
|
+
parameters: { layout: "fullscreen" },
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
|
|
10
|
+
type Story = StoryObj;
|
|
11
|
+
export const Canvas: Story = { render: () => <CoreCanvas /> };
|
|
12
12
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { DomainFormsCanvas } from "../canvases/DomainFormsCanvas";
|
|
3
|
-
|
|
4
|
-
const meta: Meta = {
|
|
5
|
-
title: "Components/Domain Forms",
|
|
6
|
-
parameters: { layout: "fullscreen" },
|
|
7
|
-
};
|
|
8
|
-
export default meta;
|
|
9
|
-
|
|
10
|
-
type Story = StoryObj;
|
|
11
|
-
export const Canvas: Story = { render: () => <DomainFormsCanvas /> };
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { DomainFormsCanvas } from "../canvases/DomainFormsCanvas";
|
|
3
|
+
|
|
4
|
+
const meta: Meta = {
|
|
5
|
+
title: "Components/Domain Forms",
|
|
6
|
+
parameters: { layout: "fullscreen" },
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
|
|
10
|
+
type Story = StoryObj;
|
|
11
|
+
export const Canvas: Story = { render: () => <DomainFormsCanvas /> };
|
|
12
12
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { FiltersCanvas } from "../canvases/FiltersCanvas";
|
|
3
|
-
|
|
4
|
-
const meta: Meta = {
|
|
5
|
-
title: "Components/Filters",
|
|
6
|
-
parameters: { layout: "fullscreen" },
|
|
7
|
-
};
|
|
8
|
-
export default meta;
|
|
9
|
-
|
|
10
|
-
type Story = StoryObj;
|
|
11
|
-
export const Canvas: Story = { render: () => <FiltersCanvas /> };
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { FiltersCanvas } from "../canvases/FiltersCanvas";
|
|
3
|
+
|
|
4
|
+
const meta: Meta = {
|
|
5
|
+
title: "Components/Filters",
|
|
6
|
+
parameters: { layout: "fullscreen" },
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
|
|
10
|
+
type Story = StoryObj;
|
|
11
|
+
export const Canvas: Story = { render: () => <FiltersCanvas /> };
|
|
12
12
|
|