@robr0/design-system 0.1.0
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/LICENSE +21 -0
- package/README.md +127 -0
- package/charts.d.ts +14 -0
- package/charts.js +20 -0
- package/components/Accordion/Accordion.css +119 -0
- package/components/Accordion/Accordion.d.ts +24 -0
- package/components/Accordion/Accordion.js +76 -0
- package/components/Alert/Alert.css +252 -0
- package/components/Alert/Alert.d.ts +24 -0
- package/components/Alert/Alert.js +53 -0
- package/components/AlertDialog/AlertDialog.css +131 -0
- package/components/AlertDialog/AlertDialog.d.ts +29 -0
- package/components/AlertDialog/AlertDialog.js +143 -0
- package/components/AppLayout/AppLayout.css +52 -0
- package/components/AppLayout/AppLayout.d.ts +27 -0
- package/components/AppLayout/AppLayout.js +45 -0
- package/components/AppSidebar/AppSidebar.css +434 -0
- package/components/AppSidebar/AppSidebar.d.ts +67 -0
- package/components/AppSidebar/AppSidebar.js +272 -0
- package/components/Avatar/Avatar.css +133 -0
- package/components/Avatar/Avatar.d.ts +20 -0
- package/components/Avatar/Avatar.js +56 -0
- package/components/Avatar/demoAvatars.d.ts +14 -0
- package/components/Avatar/demoAvatars.js +16 -0
- package/components/Badge/Badge.css +68 -0
- package/components/Badge/Badge.d.ts +13 -0
- package/components/Badge/Badge.js +15 -0
- package/components/Breadcrumb/Breadcrumb.css +92 -0
- package/components/Breadcrumb/Breadcrumb.d.ts +19 -0
- package/components/Breadcrumb/Breadcrumb.js +39 -0
- package/components/Button/Button.css +381 -0
- package/components/Button/Button.d.ts +39 -0
- package/components/Button/Button.js +71 -0
- package/components/ButtonGroup/ButtonGroup.css +39 -0
- package/components/ButtonGroup/ButtonGroup.d.ts +13 -0
- package/components/ButtonGroup/ButtonGroup.js +37 -0
- package/components/Card/Card.css +169 -0
- package/components/Card/Card.d.ts +30 -0
- package/components/Card/Card.js +90 -0
- package/components/Carousel/Carousel.css +112 -0
- package/components/Carousel/Carousel.d.ts +25 -0
- package/components/Carousel/Carousel.js +126 -0
- package/components/Chart/AreaChart.d.ts +36 -0
- package/components/Chart/AreaChart.js +99 -0
- package/components/Chart/BarChart.d.ts +34 -0
- package/components/Chart/BarChart.js +107 -0
- package/components/Chart/Chart.css +176 -0
- package/components/Chart/LineChart.d.ts +34 -0
- package/components/Chart/LineChart.js +90 -0
- package/components/Chart/PieChart.d.ts +34 -0
- package/components/Chart/PieChart.js +106 -0
- package/components/Chart/RadarChart.d.ts +34 -0
- package/components/Chart/RadarChart.js +91 -0
- package/components/Chart/RadialChart.d.ts +37 -0
- package/components/Chart/RadialChart.js +119 -0
- package/components/Chart/ScatterChart.d.ts +36 -0
- package/components/Chart/ScatterChart.js +109 -0
- package/components/Chart/StackedBarChart.d.ts +34 -0
- package/components/Chart/StackedBarChart.js +111 -0
- package/components/Chart/Treemap.d.ts +33 -0
- package/components/Chart/Treemap.js +109 -0
- package/components/Checkbox/Checkbox.css +164 -0
- package/components/Checkbox/Checkbox.d.ts +45 -0
- package/components/Checkbox/Checkbox.js +125 -0
- package/components/Chip/Chip.css +195 -0
- package/components/Chip/Chip.d.ts +27 -0
- package/components/Chip/Chip.js +80 -0
- package/components/CircularButton/CircularButton.css +206 -0
- package/components/CircularButton/CircularButton.d.ts +30 -0
- package/components/CircularButton/CircularButton.js +54 -0
- package/components/CodeBlock/CodeBlock.css +180 -0
- package/components/CodeBlock/CodeBlock.d.ts +23 -0
- package/components/CodeBlock/CodeBlock.js +85 -0
- package/components/ColourSwatch/ColourSwatch.css +88 -0
- package/components/ColourSwatch/ColourSwatch.d.ts +34 -0
- package/components/ColourSwatch/ColourSwatch.js +42 -0
- package/components/Combobox/Combobox.css +411 -0
- package/components/Combobox/Combobox.d.ts +73 -0
- package/components/Combobox/Combobox.js +312 -0
- package/components/CommandPalette/CommandPalette.css +310 -0
- package/components/CommandPalette/CommandPalette.d.ts +60 -0
- package/components/CommandPalette/CommandPalette.js +263 -0
- package/components/ContactCard/ContactCard.css +123 -0
- package/components/ContactCard/ContactCard.d.ts +23 -0
- package/components/ContactCard/ContactCard.js +78 -0
- package/components/ContributionGraph/ContributionGraph.css +142 -0
- package/components/ContributionGraph/ContributionGraph.d.ts +26 -0
- package/components/ContributionGraph/ContributionGraph.js +125 -0
- package/components/DateInput/DateInput.css +163 -0
- package/components/DateInput/DateInput.d.ts +43 -0
- package/components/DateInput/DateInput.js +69 -0
- package/components/DatePicker/DatePicker.css +198 -0
- package/components/DatePicker/DatePicker.d.ts +22 -0
- package/components/DatePicker/DatePicker.js +170 -0
- package/components/Dialog/Dialog.css +176 -0
- package/components/Dialog/Dialog.d.ts +28 -0
- package/components/Dialog/Dialog.js +132 -0
- package/components/Divider/Divider.css +100 -0
- package/components/Divider/Divider.d.ts +18 -0
- package/components/Divider/Divider.js +31 -0
- package/components/Drawer/Drawer.css +262 -0
- package/components/Drawer/Drawer.d.ts +30 -0
- package/components/Drawer/Drawer.js +134 -0
- package/components/Dropdown/Dropdown.css +300 -0
- package/components/Dropdown/Dropdown.d.ts +48 -0
- package/components/Dropdown/Dropdown.js +196 -0
- package/components/DropdownMenu/DropdownMenu.css +303 -0
- package/components/DropdownMenu/DropdownMenu.d.ts +42 -0
- package/components/DropdownMenu/DropdownMenu.js +322 -0
- package/components/EmptyState/EmptyState.css +115 -0
- package/components/EmptyState/EmptyState.d.ts +27 -0
- package/components/EmptyState/EmptyState.js +32 -0
- package/components/EntityCard/EntityCard.css +69 -0
- package/components/EntityCard/EntityCard.d.ts +18 -0
- package/components/EntityCard/EntityCard.js +26 -0
- package/components/Figure/Figure.css +61 -0
- package/components/Figure/Figure.d.ts +17 -0
- package/components/Figure/Figure.js +35 -0
- package/components/FileInput/FileInput.css +308 -0
- package/components/FileInput/FileInput.d.ts +54 -0
- package/components/FileInput/FileInput.js +177 -0
- package/components/Input/Input.css +193 -0
- package/components/Input/Input.d.ts +40 -0
- package/components/Input/Input.js +71 -0
- package/components/Instructions/Instructions.css +216 -0
- package/components/Instructions/Instructions.d.ts +28 -0
- package/components/Instructions/Instructions.js +32 -0
- package/components/LinkList/LinkList.css +71 -0
- package/components/LinkList/LinkList.d.ts +20 -0
- package/components/LinkList/LinkList.js +41 -0
- package/components/MotionSwatch/MotionSwatch.css +176 -0
- package/components/MotionSwatch/MotionSwatch.d.ts +25 -0
- package/components/MotionSwatch/MotionSwatch.js +74 -0
- package/components/Nav/Nav.css +51 -0
- package/components/Nav/Nav.d.ts +19 -0
- package/components/Nav/Nav.js +26 -0
- package/components/Pagination/Pagination.css +126 -0
- package/components/Pagination/Pagination.d.ts +22 -0
- package/components/Pagination/Pagination.js +83 -0
- package/components/Popover/Popover.css +99 -0
- package/components/Popover/Popover.d.ts +28 -0
- package/components/Popover/Popover.js +102 -0
- package/components/ProgressBar/ProgressBar.css +60 -0
- package/components/ProgressBar/ProgressBar.d.ts +16 -0
- package/components/ProgressBar/ProgressBar.js +27 -0
- package/components/Quote/Quote.css +79 -0
- package/components/Quote/Quote.d.ts +18 -0
- package/components/Quote/Quote.js +26 -0
- package/components/RadioButton/RadioButton.css +132 -0
- package/components/RadioButton/RadioButton.d.ts +43 -0
- package/components/RadioButton/RadioButton.js +77 -0
- package/components/SectionTitle/SectionTitle.css +37 -0
- package/components/SectionTitle/SectionTitle.d.ts +10 -0
- package/components/SectionTitle/SectionTitle.js +17 -0
- package/components/SegmentedControl/SegmentedControl.css +129 -0
- package/components/SegmentedControl/SegmentedControl.d.ts +33 -0
- package/components/SegmentedControl/SegmentedControl.js +91 -0
- package/components/SelectionCard/SelectionCard.css +251 -0
- package/components/SelectionCard/SelectionCard.d.ts +26 -0
- package/components/SelectionCard/SelectionCard.js +85 -0
- package/components/Skeleton/Skeleton.css +79 -0
- package/components/Skeleton/Skeleton.d.ts +16 -0
- package/components/Skeleton/Skeleton.js +30 -0
- package/components/Slider/Slider.css +86 -0
- package/components/Slider/Slider.d.ts +25 -0
- package/components/Slider/Slider.js +46 -0
- package/components/SpacingSwatch/SpacingSwatch.css +108 -0
- package/components/SpacingSwatch/SpacingSwatch.d.ts +20 -0
- package/components/SpacingSwatch/SpacingSwatch.js +50 -0
- package/components/Spinner/Spinner.css +73 -0
- package/components/Spinner/Spinner.d.ts +14 -0
- package/components/Spinner/Spinner.js +42 -0
- package/components/Stat/Stat.css +78 -0
- package/components/Stat/Stat.d.ts +19 -0
- package/components/Stat/Stat.js +30 -0
- package/components/Table/Table.css +186 -0
- package/components/Table/Table.d.ts +45 -0
- package/components/Table/Table.js +65 -0
- package/components/Tabs/Tabs.css +140 -0
- package/components/Tabs/Tabs.d.ts +28 -0
- package/components/Tabs/Tabs.js +77 -0
- package/components/Textarea/Textarea.css +152 -0
- package/components/Textarea/Textarea.d.ts +40 -0
- package/components/Textarea/Textarea.js +74 -0
- package/components/Timeline/Timeline.css +339 -0
- package/components/Timeline/Timeline.d.ts +63 -0
- package/components/Timeline/Timeline.js +69 -0
- package/components/Toast/Toast.css +342 -0
- package/components/Toast/Toast.d.ts +63 -0
- package/components/Toast/Toast.js +213 -0
- package/components/ToggleGroup/ToggleGroup.css +84 -0
- package/components/ToggleGroup/ToggleGroup.d.ts +30 -0
- package/components/ToggleGroup/ToggleGroup.js +53 -0
- package/components/ToggleSwitch/ToggleSwitch.css +139 -0
- package/components/ToggleSwitch/ToggleSwitch.d.ts +23 -0
- package/components/ToggleSwitch/ToggleSwitch.js +50 -0
- package/components/Tooltip/Tooltip.css +122 -0
- package/components/Tooltip/Tooltip.d.ts +21 -0
- package/components/Tooltip/Tooltip.js +63 -0
- package/components/TypographySwatch/TypographySwatch.css +81 -0
- package/components/TypographySwatch/TypographySwatch.d.ts +24 -0
- package/components/TypographySwatch/TypographySwatch.js +40 -0
- package/components/registry.d.ts +20 -0
- package/components/registry.js +7 -0
- package/components/registry.json +67 -0
- package/components/registry.json.d.ts +70 -0
- package/components/registry.json.js +8 -0
- package/fonts/MaterialSymbolsRounded-VariableFont_FILL,GRAD,opsz,wght.woff2 +0 -0
- package/fonts/material-symbols.css +94 -0
- package/index.d.ts +62 -0
- package/index.js +123 -0
- package/package.json +63 -0
- package/tokens/registry.d.ts +22 -0
- package/tokens/registry.js +14 -0
- package/tokens/registry.json +203 -0
- package/tokens/registry.json.d.ts +206 -0
- package/tokens/registry.json.js +8 -0
- package/tokens/tokens-dark.css +119 -0
- package/tokens/tokens-light.css +159 -0
- package/tokens/tokens-motion.css +68 -0
- package/tokens/tokens-primitives.css +176 -0
- package/tokens/tokens-typography.css +116 -0
- package/tokens/tokens.css +11 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import "./SelectionCard.css";
|
|
4
|
+
const CheckIcon = () => /* @__PURE__ */ jsx(
|
|
5
|
+
"svg",
|
|
6
|
+
{
|
|
7
|
+
className: "ds-selection-card__check-icon",
|
|
8
|
+
width: "14",
|
|
9
|
+
height: "14",
|
|
10
|
+
viewBox: "0 0 14 14",
|
|
11
|
+
fill: "none",
|
|
12
|
+
"aria-hidden": "true",
|
|
13
|
+
children: /* @__PURE__ */ jsx(
|
|
14
|
+
"path",
|
|
15
|
+
{
|
|
16
|
+
d: "M2 7.5L5.5 11L12 3",
|
|
17
|
+
stroke: "currentColor",
|
|
18
|
+
strokeWidth: "2",
|
|
19
|
+
strokeLinecap: "round",
|
|
20
|
+
strokeLinejoin: "round"
|
|
21
|
+
}
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
const SelectionCard = ({
|
|
26
|
+
mode = "radio",
|
|
27
|
+
options,
|
|
28
|
+
value,
|
|
29
|
+
onChange,
|
|
30
|
+
name,
|
|
31
|
+
className = ""
|
|
32
|
+
}) => {
|
|
33
|
+
const baseClass = "ds-selection-card";
|
|
34
|
+
const selectedValues = Array.isArray(value) ? value : value !== void 0 ? [value] : [];
|
|
35
|
+
const isSelected = (optionValue) => selectedValues.includes(optionValue);
|
|
36
|
+
const handleSelect = (option) => {
|
|
37
|
+
if (option.disabled || !onChange) return;
|
|
38
|
+
if (mode === "radio") {
|
|
39
|
+
onChange(option.value);
|
|
40
|
+
} else {
|
|
41
|
+
const newValues = isSelected(option.value) ? selectedValues.filter((v) => v !== option.value) : [...selectedValues, option.value];
|
|
42
|
+
onChange(newValues);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const handleKeyDown = (e, option) => {
|
|
46
|
+
if (e.key === " " || e.key === "Enter") {
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
handleSelect(option);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const groupRole = mode === "radio" ? "radiogroup" : "group";
|
|
52
|
+
const itemRole = mode === "radio" ? "radio" : mode === "toggle" ? "switch" : "checkbox";
|
|
53
|
+
const groupClasses = [`${baseClass}-group`, className].filter(Boolean).join(" ");
|
|
54
|
+
return /* @__PURE__ */ jsx("div", { className: groupClasses, role: groupRole, "aria-label": name, children: options.map((option) => {
|
|
55
|
+
const selected = isSelected(option.value);
|
|
56
|
+
const cardClasses = [
|
|
57
|
+
baseClass,
|
|
58
|
+
selected ? `${baseClass}--selected` : "",
|
|
59
|
+
option.disabled ? `${baseClass}--disabled` : ""
|
|
60
|
+
].filter(Boolean).join(" ");
|
|
61
|
+
return /* @__PURE__ */ jsxs(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
className: cardClasses,
|
|
65
|
+
role: itemRole,
|
|
66
|
+
"aria-checked": selected,
|
|
67
|
+
"aria-disabled": option.disabled,
|
|
68
|
+
tabIndex: option.disabled ? -1 : 0,
|
|
69
|
+
onClick: () => handleSelect(option),
|
|
70
|
+
onKeyDown: (e) => handleKeyDown(e, option),
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__content`, children: [
|
|
73
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: option.label }),
|
|
74
|
+
option.description && /* @__PURE__ */ jsx("span", { className: `${baseClass}__description`, children: option.description })
|
|
75
|
+
] }),
|
|
76
|
+
/* @__PURE__ */ jsx("div", { className: `${baseClass}__indicator`, children: mode === "radio" ? /* @__PURE__ */ jsx("div", { className: `${baseClass}__radio`, children: /* @__PURE__ */ jsx("div", { className: `${baseClass}__radio-dot` }) }) : mode === "toggle" ? /* @__PURE__ */ jsx("div", { className: `${baseClass}__toggle ${selected ? "" : `${baseClass}__toggle--off`}`, children: /* @__PURE__ */ jsx("div", { className: `${baseClass}__toggle-thumb`, children: /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded ds-selection-card__toggle-icon", "aria-hidden": "true", children: "check" }) }) }) : /* @__PURE__ */ jsx("div", { className: `${baseClass}__checkbox`, children: /* @__PURE__ */ jsx(CheckIcon, {}) }) })
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
option.value
|
|
80
|
+
);
|
|
81
|
+
}) });
|
|
82
|
+
};
|
|
83
|
+
export {
|
|
84
|
+
SelectionCard
|
|
85
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
SKELETON COMPONENT
|
|
3
|
+
Placeholder while content is loading
|
|
4
|
+
============================================ */
|
|
5
|
+
|
|
6
|
+
.ds-skeleton {
|
|
7
|
+
background-color: var(--color-bg-container-secondary);
|
|
8
|
+
position: relative;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.ds-skeleton::after {
|
|
13
|
+
content: '';
|
|
14
|
+
position: absolute;
|
|
15
|
+
top: 0;
|
|
16
|
+
left: 0;
|
|
17
|
+
right: 0;
|
|
18
|
+
bottom: 0;
|
|
19
|
+
background: linear-gradient(
|
|
20
|
+
90deg,
|
|
21
|
+
transparent 0%,
|
|
22
|
+
var(--color-bg-container-primary) 50%,
|
|
23
|
+
transparent 100%
|
|
24
|
+
);
|
|
25
|
+
animation: ds-skeleton-shimmer var(--motion-duration-loop-shimmer) ease-in-out infinite;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* ============================================
|
|
29
|
+
TEXT VARIANT
|
|
30
|
+
============================================ */
|
|
31
|
+
|
|
32
|
+
.ds-skeleton--text {
|
|
33
|
+
height: 14px;
|
|
34
|
+
border-radius: var(--radius-sm);
|
|
35
|
+
width: 100%;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* ============================================
|
|
39
|
+
CIRCULAR VARIANT
|
|
40
|
+
============================================ */
|
|
41
|
+
|
|
42
|
+
.ds-skeleton--circular {
|
|
43
|
+
width: 40px;
|
|
44
|
+
height: 40px;
|
|
45
|
+
border-radius: var(--radius-full);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* ============================================
|
|
49
|
+
RECTANGULAR VARIANT
|
|
50
|
+
============================================ */
|
|
51
|
+
|
|
52
|
+
.ds-skeleton--rectangular {
|
|
53
|
+
width: 100%;
|
|
54
|
+
height: 100px;
|
|
55
|
+
border-radius: var(--radius-sm);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* ============================================
|
|
59
|
+
TEXT GROUP
|
|
60
|
+
============================================ */
|
|
61
|
+
|
|
62
|
+
.ds-skeleton__group {
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
gap: var(--padding-xs);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* ============================================
|
|
69
|
+
SHIMMER ANIMATION
|
|
70
|
+
============================================ */
|
|
71
|
+
|
|
72
|
+
@keyframes ds-skeleton-shimmer {
|
|
73
|
+
0% {
|
|
74
|
+
transform: translateX(-100%);
|
|
75
|
+
}
|
|
76
|
+
100% {
|
|
77
|
+
transform: translateX(100%);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface SkeletonProps {
|
|
2
|
+
/** Shape of the skeleton */
|
|
3
|
+
variant?: 'text' | 'circular' | 'rectangular';
|
|
4
|
+
/** Width (CSS value, e.g. '100%', '200px') */
|
|
5
|
+
width?: string;
|
|
6
|
+
/** Height (CSS value, e.g. '20px', '100px') */
|
|
7
|
+
height?: string;
|
|
8
|
+
/** Number of text lines to render (only for text variant) */
|
|
9
|
+
lines?: number;
|
|
10
|
+
/** Additional CSS classes */
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Skeleton displays a placeholder while content is loading.
|
|
15
|
+
*/
|
|
16
|
+
export declare const Skeleton: ({ variant, width, height, lines, className, }: SkeletonProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "./Skeleton.css";
|
|
3
|
+
const Skeleton = ({
|
|
4
|
+
variant = "text",
|
|
5
|
+
width,
|
|
6
|
+
height,
|
|
7
|
+
lines = 1,
|
|
8
|
+
className = ""
|
|
9
|
+
}) => {
|
|
10
|
+
const baseClass = "ds-skeleton";
|
|
11
|
+
const classes = [baseClass, `${baseClass}--${variant}`, className].filter(Boolean).join(" ");
|
|
12
|
+
if (variant === "text" && lines > 1) {
|
|
13
|
+
return /* @__PURE__ */ jsx("div", { className: `${baseClass}__group`, role: "status", "aria-label": "Loading", "aria-busy": "true", style: { width }, children: Array.from({ length: lines }).map((_, i) => /* @__PURE__ */ jsx(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
className: classes,
|
|
17
|
+
"aria-hidden": "true",
|
|
18
|
+
style: {
|
|
19
|
+
width: i === lines - 1 ? "75%" : "100%",
|
|
20
|
+
height
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
i
|
|
24
|
+
)) });
|
|
25
|
+
}
|
|
26
|
+
return /* @__PURE__ */ jsx("div", { className: classes, role: "status", "aria-label": "Loading", "aria-busy": "true", style: { width, height } });
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
Skeleton
|
|
30
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
SLIDER COMPONENT
|
|
3
|
+
Range input for selecting values
|
|
4
|
+
============================================ */
|
|
5
|
+
|
|
6
|
+
.ds-slider {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
width: 100%;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* ============================================
|
|
13
|
+
INPUT — RESET & BASE
|
|
14
|
+
============================================ */
|
|
15
|
+
|
|
16
|
+
.ds-slider__input {
|
|
17
|
+
-webkit-appearance: none;
|
|
18
|
+
appearance: none;
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 6px;
|
|
21
|
+
border-radius: var(--radius-full);
|
|
22
|
+
outline: none;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
background: var(--color-bg-container-secondary);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.ds-slider--compact .ds-slider__input {
|
|
28
|
+
height: 4px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* ============================================
|
|
32
|
+
THUMB — WEBKIT
|
|
33
|
+
============================================ */
|
|
34
|
+
|
|
35
|
+
.ds-slider__input::-webkit-slider-thumb {
|
|
36
|
+
-webkit-appearance: none;
|
|
37
|
+
appearance: none;
|
|
38
|
+
width: 20px;
|
|
39
|
+
height: 20px;
|
|
40
|
+
border-radius: var(--radius-full);
|
|
41
|
+
background: var(--color-action-primary-bg);
|
|
42
|
+
border: 2px solid var(--color-action-primary-bg);
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
transition: box-shadow var(--motion-duration-fast) var(--motion-ease-standard);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.ds-slider--compact .ds-slider__input::-webkit-slider-thumb {
|
|
48
|
+
width: 16px;
|
|
49
|
+
height: 16px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.ds-slider__input::-webkit-slider-thumb:hover {
|
|
53
|
+
box-shadow: 0 0 0 4px var(--color-action-primary-bg-hover);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* ============================================
|
|
57
|
+
THUMB — MOZ
|
|
58
|
+
============================================ */
|
|
59
|
+
|
|
60
|
+
.ds-slider__input::-moz-range-thumb {
|
|
61
|
+
width: 20px;
|
|
62
|
+
height: 20px;
|
|
63
|
+
border-radius: var(--radius-full);
|
|
64
|
+
background: var(--color-action-primary-bg);
|
|
65
|
+
border: 2px solid var(--color-action-primary-bg);
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
transition: box-shadow var(--motion-duration-fast) var(--motion-ease-standard);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.ds-slider--compact .ds-slider__input::-moz-range-thumb {
|
|
71
|
+
width: 16px;
|
|
72
|
+
height: 16px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.ds-slider__input::-moz-range-thumb:hover {
|
|
76
|
+
box-shadow: 0 0 0 4px var(--color-action-primary-bg-hover);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* ============================================
|
|
80
|
+
DISABLED
|
|
81
|
+
============================================ */
|
|
82
|
+
|
|
83
|
+
.ds-slider--disabled {
|
|
84
|
+
opacity: 0.4;
|
|
85
|
+
pointer-events: none;
|
|
86
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface SliderProps {
|
|
3
|
+
/** Current value */
|
|
4
|
+
value?: number;
|
|
5
|
+
/** Minimum value */
|
|
6
|
+
min?: number;
|
|
7
|
+
/** Maximum value */
|
|
8
|
+
max?: number;
|
|
9
|
+
/** Step increment */
|
|
10
|
+
step?: number;
|
|
11
|
+
/** Disabled state */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/** Size */
|
|
14
|
+
size?: 'default' | 'compact';
|
|
15
|
+
/** Change handler */
|
|
16
|
+
onChange?: (value: number) => void;
|
|
17
|
+
/** Accessible label */
|
|
18
|
+
ariaLabel?: string;
|
|
19
|
+
/** Additional CSS classes */
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Slider allows selecting a value from within a given range.
|
|
24
|
+
*/
|
|
25
|
+
export declare const Slider: ({ value, min, max, step, disabled, size, onChange, ariaLabel, className, }: SliderProps) => React.JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import "./Slider.css";
|
|
4
|
+
const Slider = ({
|
|
5
|
+
value = 50,
|
|
6
|
+
min = 0,
|
|
7
|
+
max = 100,
|
|
8
|
+
step = 1,
|
|
9
|
+
disabled = false,
|
|
10
|
+
size = "default",
|
|
11
|
+
onChange,
|
|
12
|
+
ariaLabel = "Slider",
|
|
13
|
+
className = ""
|
|
14
|
+
}) => {
|
|
15
|
+
const baseClass = "ds-slider";
|
|
16
|
+
const classes = [
|
|
17
|
+
baseClass,
|
|
18
|
+
`${baseClass}--${size}`,
|
|
19
|
+
disabled ? `${baseClass}--disabled` : "",
|
|
20
|
+
className
|
|
21
|
+
].filter(Boolean).join(" ");
|
|
22
|
+
const percentage = (value - min) / (max - min) * 100;
|
|
23
|
+
const handleChange = (e) => {
|
|
24
|
+
onChange?.(Number(e.target.value));
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ jsx("div", { className: classes, children: /* @__PURE__ */ jsx(
|
|
27
|
+
"input",
|
|
28
|
+
{
|
|
29
|
+
type: "range",
|
|
30
|
+
className: `${baseClass}__input`,
|
|
31
|
+
value,
|
|
32
|
+
min,
|
|
33
|
+
max,
|
|
34
|
+
step,
|
|
35
|
+
disabled,
|
|
36
|
+
onChange: handleChange,
|
|
37
|
+
"aria-label": ariaLabel,
|
|
38
|
+
style: {
|
|
39
|
+
background: `linear-gradient(to right, var(--color-action-primary-bg) ${percentage}%, var(--color-bg-container-secondary) ${percentage}%)`
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
) });
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
Slider
|
|
46
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
SPACING SWATCH COMPONENT
|
|
3
|
+
Card that displays a spatial token with a
|
|
4
|
+
visual preview, size label, and pixel value.
|
|
5
|
+
============================================ */
|
|
6
|
+
|
|
7
|
+
.ds-spacing-swatch {
|
|
8
|
+
/* Layout */
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
align-items: center;
|
|
12
|
+
gap: var(--gap-lg); /* 20px */
|
|
13
|
+
|
|
14
|
+
/* Sizing */
|
|
15
|
+
flex: 1 1 0;
|
|
16
|
+
min-width: 140px;
|
|
17
|
+
|
|
18
|
+
/* Appearance */
|
|
19
|
+
background: var(--color-bg-container-primary-semi);
|
|
20
|
+
border: var(--border-xs) solid var(--color-bg-container-border);
|
|
21
|
+
border-radius: var(--radius-xl); /* 24px */
|
|
22
|
+
padding: var(--padding-lg); /* 20px */
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* ============================================
|
|
26
|
+
PREVIEW AREA
|
|
27
|
+
Centred container for the visual element
|
|
28
|
+
============================================ */
|
|
29
|
+
|
|
30
|
+
.ds-spacing-swatch__preview {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
min-height: 60px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* ============================================
|
|
38
|
+
BORDER VARIANT
|
|
39
|
+
Vertical coloured bar showing border width
|
|
40
|
+
============================================ */
|
|
41
|
+
|
|
42
|
+
.ds-spacing-swatch__border-bar {
|
|
43
|
+
height: 50px;
|
|
44
|
+
background: var(--color-core-accent-violet);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* ============================================
|
|
48
|
+
RADIUS VARIANT
|
|
49
|
+
Square with visible border-radius
|
|
50
|
+
============================================ */
|
|
51
|
+
|
|
52
|
+
.ds-spacing-swatch__radius-box {
|
|
53
|
+
width: 50px;
|
|
54
|
+
height: 50px;
|
|
55
|
+
background: transparent;
|
|
56
|
+
border: 1px solid var(--color-status-positive-border);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* ============================================
|
|
60
|
+
GAP VARIANT
|
|
61
|
+
Two vertical lines separated by the gap width
|
|
62
|
+
============================================ */
|
|
63
|
+
|
|
64
|
+
.ds-spacing-swatch__gap-bar {
|
|
65
|
+
height: 50px;
|
|
66
|
+
border-left: 1px solid var(--color-core-accent-coral);
|
|
67
|
+
border-right: 1px solid var(--color-core-accent-coral);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* ============================================
|
|
71
|
+
PADDING VARIANT
|
|
72
|
+
Outer box with inner box showing the padding
|
|
73
|
+
============================================ */
|
|
74
|
+
|
|
75
|
+
.ds-spacing-swatch__padding-outer {
|
|
76
|
+
border: 1px solid var(--color-core-ui-secondary);
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.ds-spacing-swatch__padding-inner {
|
|
83
|
+
width: 10px;
|
|
84
|
+
height: 10px;
|
|
85
|
+
border: 1px solid var(--color-status-neutral-border);
|
|
86
|
+
border-radius: 1px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* ============================================
|
|
90
|
+
LABEL & VALUE
|
|
91
|
+
============================================ */
|
|
92
|
+
|
|
93
|
+
.ds-spacing-swatch__label {
|
|
94
|
+
font-family: var(--font-paragraph-family);
|
|
95
|
+
font-size: var(--font-paragraph-size);
|
|
96
|
+
font-weight: var(--font-heading-3-weight);
|
|
97
|
+
line-height: var(--font-paragraph-line-height);
|
|
98
|
+
color: var(--color-text-primary);
|
|
99
|
+
text-align: center;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.ds-spacing-swatch__value {
|
|
103
|
+
font-family: var(--font-paragraph-family);
|
|
104
|
+
font-size: var(--font-paragraph-size);
|
|
105
|
+
font-weight: var(--font-paragraph-weight);
|
|
106
|
+
line-height: var(--font-paragraph-line-height);
|
|
107
|
+
color: var(--color-text-tertiary);
|
|
108
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type SpacingSwatchVariant = 'border' | 'radius' | 'gap' | 'padding';
|
|
2
|
+
export interface SpacingSwatchProps {
|
|
3
|
+
/** Size label (e.g. "XS", "MD", "Full") */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Pixel value to display (e.g. "1px", "24px", "999px") */
|
|
6
|
+
value: string;
|
|
7
|
+
/** Numeric pixel amount used to size the preview element */
|
|
8
|
+
px: number;
|
|
9
|
+
/** Which type of spatial preview to render */
|
|
10
|
+
variant: SpacingSwatchVariant;
|
|
11
|
+
/** Additional CSS classes */
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* SpacingSwatch component from Figma design system.
|
|
16
|
+
* Displays a spatial token card with a visual preview,
|
|
17
|
+
* size label, and pixel value. Four variants cover
|
|
18
|
+
* border width, radius, gap, and padding tokens.
|
|
19
|
+
*/
|
|
20
|
+
export declare const SpacingSwatch: ({ label, value, px, variant, className, }: SpacingSwatchProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import "./SpacingSwatch.css";
|
|
3
|
+
const SpacingSwatch = ({
|
|
4
|
+
label,
|
|
5
|
+
value,
|
|
6
|
+
px,
|
|
7
|
+
variant,
|
|
8
|
+
className = ""
|
|
9
|
+
}) => {
|
|
10
|
+
const baseClass = "ds-spacing-swatch";
|
|
11
|
+
const classes = [baseClass, className].filter(Boolean).join(" ");
|
|
12
|
+
return /* @__PURE__ */ jsxs("div", { className: classes, children: [
|
|
13
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__preview`, children: [
|
|
14
|
+
variant === "border" && /* @__PURE__ */ jsx(
|
|
15
|
+
"div",
|
|
16
|
+
{
|
|
17
|
+
className: `${baseClass}__border-bar`,
|
|
18
|
+
style: { width: `${px}px` }
|
|
19
|
+
}
|
|
20
|
+
),
|
|
21
|
+
variant === "radius" && /* @__PURE__ */ jsx(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
className: `${baseClass}__radius-box`,
|
|
25
|
+
style: { borderRadius: px >= 999 ? "50%" : `${px}px` }
|
|
26
|
+
}
|
|
27
|
+
),
|
|
28
|
+
variant === "gap" && /* @__PURE__ */ jsx(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
className: `${baseClass}__gap-bar`,
|
|
32
|
+
style: { width: `${px}px` }
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
variant === "padding" && /* @__PURE__ */ jsx(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
className: `${baseClass}__padding-outer`,
|
|
39
|
+
style: { padding: `${px}px` },
|
|
40
|
+
children: /* @__PURE__ */ jsx("div", { className: `${baseClass}__padding-inner` })
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
] }),
|
|
44
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: label }),
|
|
45
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__value`, children: value })
|
|
46
|
+
] });
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
SpacingSwatch
|
|
50
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
SPINNER COMPONENT
|
|
3
|
+
Animated circular loading indicator
|
|
4
|
+
============================================ */
|
|
5
|
+
|
|
6
|
+
.ds-spinner {
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* ============================================
|
|
13
|
+
SIZES
|
|
14
|
+
============================================ */
|
|
15
|
+
|
|
16
|
+
.ds-spinner--sm {
|
|
17
|
+
width: 16px;
|
|
18
|
+
height: 16px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.ds-spinner--md {
|
|
22
|
+
width: 24px;
|
|
23
|
+
height: 24px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ds-spinner--lg {
|
|
27
|
+
width: 36px;
|
|
28
|
+
height: 36px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* ============================================
|
|
32
|
+
SVG
|
|
33
|
+
============================================ */
|
|
34
|
+
|
|
35
|
+
.ds-spinner__circle {
|
|
36
|
+
width: 100%;
|
|
37
|
+
height: 100%;
|
|
38
|
+
animation: ds-spinner-rotate var(--motion-duration-loop-spin) var(--motion-ease-linear) infinite;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.ds-spinner__track {
|
|
42
|
+
stroke: var(--color-bg-container-secondary);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ds-spinner__arc {
|
|
46
|
+
stroke-dasharray: 44;
|
|
47
|
+
stroke-dashoffset: 32;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* ============================================
|
|
51
|
+
VARIANTS
|
|
52
|
+
============================================ */
|
|
53
|
+
|
|
54
|
+
.ds-spinner--primary .ds-spinner__arc {
|
|
55
|
+
stroke: var(--color-action-primary-bg);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.ds-spinner--neutral .ds-spinner__arc {
|
|
59
|
+
stroke: var(--color-text-secondary);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* ============================================
|
|
63
|
+
ANIMATION
|
|
64
|
+
============================================ */
|
|
65
|
+
|
|
66
|
+
@keyframes ds-spinner-rotate {
|
|
67
|
+
from {
|
|
68
|
+
transform: rotate(0deg);
|
|
69
|
+
}
|
|
70
|
+
to {
|
|
71
|
+
transform: rotate(360deg);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface SpinnerProps {
|
|
2
|
+
/** Size of the spinner */
|
|
3
|
+
size?: 'sm' | 'md' | 'lg';
|
|
4
|
+
/** Visual variant */
|
|
5
|
+
variant?: 'primary' | 'neutral';
|
|
6
|
+
/** Accessible label */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** Additional CSS classes */
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Spinner indicates a loading state with an animated circular indicator.
|
|
13
|
+
*/
|
|
14
|
+
export declare const Spinner: ({ size, variant, label, className, }: SpinnerProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "./Spinner.css";
|
|
3
|
+
const Spinner = ({
|
|
4
|
+
size = "md",
|
|
5
|
+
variant = "primary",
|
|
6
|
+
label = "Loading",
|
|
7
|
+
className = ""
|
|
8
|
+
}) => {
|
|
9
|
+
const baseClass = "ds-spinner";
|
|
10
|
+
const classes = [
|
|
11
|
+
baseClass,
|
|
12
|
+
`${baseClass}--${size}`,
|
|
13
|
+
`${baseClass}--${variant}`,
|
|
14
|
+
className
|
|
15
|
+
].filter(Boolean).join(" ");
|
|
16
|
+
return /* @__PURE__ */ jsx("span", { className: classes, role: "status", "aria-label": label, children: /* @__PURE__ */ jsxs("svg", { className: `${baseClass}__circle`, viewBox: "0 0 24 24", fill: "none", children: [
|
|
17
|
+
/* @__PURE__ */ jsx(
|
|
18
|
+
"circle",
|
|
19
|
+
{
|
|
20
|
+
className: `${baseClass}__track`,
|
|
21
|
+
cx: "12",
|
|
22
|
+
cy: "12",
|
|
23
|
+
r: "10",
|
|
24
|
+
strokeWidth: "3"
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
/* @__PURE__ */ jsx(
|
|
28
|
+
"circle",
|
|
29
|
+
{
|
|
30
|
+
className: `${baseClass}__arc`,
|
|
31
|
+
cx: "12",
|
|
32
|
+
cy: "12",
|
|
33
|
+
r: "10",
|
|
34
|
+
strokeWidth: "3",
|
|
35
|
+
strokeLinecap: "round"
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
] }) });
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
Spinner
|
|
42
|
+
};
|