@teamofsilicons/silicon-ui 0.2.0 → 0.3.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/README.md +4 -3
- package/check.mjs +14 -5
- package/components/activity-heatmap/activity-heatmap.module.css +4 -4
- package/components/alert/alert.module.css +1 -1
- package/components/announcement-bar/announcement-bar.module.css +6 -6
- package/components/avatar/avatar.d.ts +2 -2
- package/components/avatar/avatar.js +1 -1
- package/components/avatar/avatar.module.css +5 -2
- package/components/avatar-group/avatar-group.module.css +4 -4
- package/components/badge/badge.module.css +4 -4
- package/components/bar-chart/bar-chart.module.css +4 -4
- package/components/billing-toggle/billing-toggle.module.css +10 -10
- package/components/bottom-sheet/bottom-sheet.module.css +4 -5
- package/components/breadcrumb/breadcrumb.d.ts +8 -2
- package/components/breadcrumb/breadcrumb.js +21 -9
- package/components/breadcrumb/breadcrumb.module.css +7 -3
- package/components/brush-chart/brush-chart.module.css +9 -9
- package/components/button/button.d.ts +7 -2
- package/components/button/button.js +3 -1
- package/components/button/button.module.css +10 -1
- package/components/button-group/button-group.module.css +6 -6
- package/components/calendar/calendar.module.css +7 -7
- package/components/card/card.module.css +2 -2
- package/components/card-stack/card-stack.module.css +2 -3
- package/components/carousel/carousel.module.css +2 -2
- package/components/chat-thread/chat-thread.module.css +41 -41
- package/components/checkbox/checkbox.module.css +1 -1
- package/components/chip-group/chip-group.module.css +2 -2
- package/components/code-block/code-block.module.css +7 -14
- package/components/color-picker/color-picker.module.css +20 -21
- package/components/combobox/combobox.module.css +2 -2
- package/components/command-palette/command-palette.module.css +18 -18
- package/components/comment-thread/comment-thread.module.css +35 -35
- package/components/confirm-morph/confirm-morph.module.css +9 -9
- package/components/context-menu/context-menu.module.css +3 -3
- package/components/countdown/countdown.module.css +4 -4
- package/components/date-picker/date-picker.module.css +6 -6
- package/components/date-range-picker/date-range-picker.module.css +21 -21
- package/components/dialog/dialog.module.css +2 -2
- package/components/donut-chart/donut-chart.module.css +4 -4
- package/components/drawer/drawer.module.css +5 -5
- package/components/dropdown-menu/dropdown-menu.d.ts +71 -1
- package/components/dropdown-menu/dropdown-menu.js +100 -6
- package/components/dropdown-menu/dropdown-menu.module.css +15 -5
- package/components/elastic-slider/elastic-slider.module.css +4 -4
- package/components/expandable-card/expandable-card.module.css +1 -1
- package/components/expanding-button-group/expanding-button-group.module.css +1 -1
- package/components/expanding-search/expanding-search.module.css +9 -9
- package/components/file-dropzone/file-dropzone.module.css +21 -21
- package/components/file-upload/file-upload.module.css +7 -7
- package/components/filter-toolbar/filter-toolbar.module.css +9 -9
- package/components/floating-button-group/floating-button-group.module.css +6 -6
- package/components/gauge/gauge.module.css +2 -2
- package/components/hover-card/hover-card.module.css +2 -2
- package/components/image-compare/image-compare.module.css +4 -4
- package/components/inline-edit/inline-edit.module.css +12 -12
- package/components/json-viewer/json-viewer.module.css +12 -12
- package/components/line-chart/line-chart.module.css +8 -8
- package/components/mention-input/mention-input.module.css +8 -8
- package/components/metric-card/metric-card.module.css +1 -1
- package/components/money-input/money-input.module.css +9 -9
- package/components/morph-select/morph-select.module.css +13 -13
- package/components/multi-select/multi-select.module.css +6 -6
- package/components/nav-list/nav-list.d.ts +64 -0
- package/components/nav-list/nav-list.js +103 -0
- package/components/nav-list/nav-list.module.css +25 -0
- package/components/notification-center/notification-center.module.css +27 -27
- package/components/number-field/number-field.module.css +2 -2
- package/components/otp-input/otp-input.module.css +4 -4
- package/components/password-field/password-field.module.css +1 -1
- package/components/password-strength/password-strength.module.css +7 -7
- package/components/phone-input/phone-input.module.css +19 -19
- package/components/popover/popover.module.css +2 -2
- package/components/progress/progress.module.css +1 -1
- package/components/radio-cards/radio-cards.module.css +8 -8
- package/components/radio-group/radio-group.module.css +1 -1
- package/components/resizable-panels/resizable-panels.module.css +5 -5
- package/components/rich-text-editor/rich-text-editor.module.css +12 -12
- package/components/ridgeline/ridgeline.module.css +7 -7
- package/components/scroll-area/scroll-area.module.css +8 -8
- package/components/segmented-control/segmented-control.d.ts +3 -1
- package/components/segmented-control/segmented-control.js +2 -2
- package/components/segmented-control/segmented-control.module.css +7 -4
- package/components/select/select.module.css +5 -5
- package/components/shortcut-recorder/shortcut-recorder.module.css +15 -15
- package/components/signature-pad/signature-pad.module.css +11 -11
- package/components/slider/slider.module.css +4 -4
- package/components/slope-chart/slope-chart.module.css +7 -7
- package/components/sortable-data-table/sortable-data-table.module.css +4 -4
- package/components/split-button/split-button.module.css +5 -5
- package/components/stepper/stepper.module.css +3 -3
- package/components/streamgraph/streamgraph.module.css +7 -7
- package/components/swipe-actions/swipe-actions.module.css +5 -5
- package/components/switch/switch.module.css +1 -1
- package/components/tabs/tabs.d.ts +9 -2
- package/components/tabs/tabs.js +4 -2
- package/components/tabs/tabs.module.css +7 -2
- package/components/tag-input/tag-input.module.css +4 -4
- package/components/time-picker/time-picker.module.css +3 -3
- package/components/timeline/timeline.module.css +3 -3
- package/components/toast/toast.module.css +5 -5
- package/components/toast-stack/toast-stack.module.css +5 -5
- package/components/tooltip/tooltip.module.css +1 -1
- package/components/tree-view/tree-view.module.css +7 -7
- package/components/treemap/treemap.module.css +13 -13
- package/components/usage-meter/usage-meter.module.css +5 -5
- package/components/user-menu/user-menu.module.css +22 -22
- package/components/waffle-chart/waffle-chart.module.css +7 -7
- package/components.json +416 -1
- package/eslint.js +35 -3
- package/package.json +1 -1
- package/styles.css +44 -4
package/eslint.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Options:
|
|
9
9
|
* files globs the rules apply to (default: every .tsx and .jsx file)
|
|
10
|
+
* allowExperimental components whose experimental parts or prop values this app may use (a deliberate, reviewable opt-in)
|
|
10
11
|
* ignores globs they skip (for example a vendored exception)
|
|
11
12
|
* elements override the element → component table below
|
|
12
13
|
*
|
|
@@ -14,6 +15,17 @@
|
|
|
14
15
|
* if your own config also sets either rule, put this one last and move your entries into `extraSyntax` / `extraImports`.
|
|
15
16
|
*/
|
|
16
17
|
|
|
18
|
+
import fs from "node:fs";
|
|
19
|
+
|
|
20
|
+
/** This release's catalog (components.json next to this file): which components, parts or prop values are experimental. */
|
|
21
|
+
function catalog() {
|
|
22
|
+
try {
|
|
23
|
+
return JSON.parse(fs.readFileSync(new URL("./components.json", import.meta.url), "utf8"));
|
|
24
|
+
} catch {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
17
29
|
/** Raw elements Silicon UI already has a component for. */
|
|
18
30
|
export const ELEMENTS = {
|
|
19
31
|
button: "Use Button (actions) or ButtonLink (navigation) from @teamofsilicons/silicon-ui.",
|
|
@@ -34,7 +46,27 @@ const IMPORTS = [
|
|
|
34
46
|
},
|
|
35
47
|
];
|
|
36
48
|
|
|
37
|
-
export default function siliconUi({ files = ["**/*.{tsx,jsx}"], ignores = [], elements = ELEMENTS, extraSyntax = [], extraImports = [] } = {}) {
|
|
49
|
+
export default function siliconUi({ files = ["**/*.{tsx,jsx}"], ignores = [], elements = ELEMENTS, extraSyntax = [], extraImports = [], allowExperimental = [] } = {}) {
|
|
50
|
+
const entries = catalog().filter(entry => !allowExperimental.includes(entry.name));
|
|
51
|
+
const optIn = name => `To try it, add "${name}" to siliconUi({ allowExperimental }) in your ESLint config.`;
|
|
52
|
+
// A whole experimental component: any import of it.
|
|
53
|
+
const gated = entries.filter(entry => entry.status === "experimental").map(entry => ({
|
|
54
|
+
regex: `^@teamofsilicons/silicon-ui/${entry.name}$`,
|
|
55
|
+
message: `${entry.name} is experimental: it may still change and is not for production. ${optIn(entry.name)}`,
|
|
56
|
+
}));
|
|
57
|
+
// Experimental parts of a stable component: only those named imports.
|
|
58
|
+
const gatedParts = entries.filter(entry => entry.status !== "experimental" && entry.experimentalExports?.length).map(entry => ({
|
|
59
|
+
name: `@teamofsilicons/silicon-ui/${entry.name}`,
|
|
60
|
+
importNames: entry.experimentalExports,
|
|
61
|
+
message: `These parts of ${entry.name} are experimental: they may still change and are not for production. ${optIn(entry.name)}`,
|
|
62
|
+
}));
|
|
63
|
+
// Experimental values of a stable component's prop, such as <Button size="xs">. The value "*" gates a new prop
|
|
64
|
+
// whatever its value, such as <Breadcrumb maxItems={3}>.
|
|
65
|
+
const gatedProps = entries.flatMap(entry => Object.entries(entry.experimentalProps ?? {}).flatMap(([component, props]) =>
|
|
66
|
+
Object.entries(props).flatMap(([prop, values]) => values.map(value => ({
|
|
67
|
+
selector: `JSXOpeningElement[name.name="${component}"] > JSXAttribute[name.name="${prop}"]${value === "*" ? "" : `[value.value="${value}"]`}`,
|
|
68
|
+
message: `${component} ${value === "*" ? prop : `${prop}="${value}"`} is experimental: it may still change and is not for production. ${optIn(entry.name)}`,
|
|
69
|
+
})))));
|
|
38
70
|
const syntax = Object.entries(elements).map(([name, message]) => ({
|
|
39
71
|
selector: `JSXOpeningElement[name.type="JSXIdentifier"][name.name="${name}"]`,
|
|
40
72
|
message: `<${name}> is not allowed here. ${message}`,
|
|
@@ -45,8 +77,8 @@ export default function siliconUi({ files = ["**/*.{tsx,jsx}"], ignores = [], el
|
|
|
45
77
|
files,
|
|
46
78
|
ignores,
|
|
47
79
|
rules: {
|
|
48
|
-
"no-restricted-syntax": ["error", ...syntax, ...extraSyntax],
|
|
49
|
-
"no-restricted-imports": ["error", { patterns: [...IMPORTS, ...extraImports] }],
|
|
80
|
+
"no-restricted-syntax": ["error", ...syntax, ...gatedProps, ...extraSyntax],
|
|
81
|
+
"no-restricted-imports": ["error", { paths: gatedParts, patterns: [...IMPORTS, ...gated, ...extraImports] }],
|
|
50
82
|
},
|
|
51
83
|
},
|
|
52
84
|
];
|
package/package.json
CHANGED
package/styles.css
CHANGED
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
--surface: var(--neutral-0);
|
|
17
17
|
--surface-raised: var(--neutral-0);
|
|
18
18
|
--surface-muted: var(--neutral-2);
|
|
19
|
+
/* One step stronger than --surface-muted: the hover and press of a muted fill (a soft button). */
|
|
20
|
+
--surface-pressed: var(--neutral-3);
|
|
19
21
|
--foreground: var(--neutral-11);
|
|
20
22
|
--text-secondary: var(--neutral-8);
|
|
21
23
|
--text-muted: var(--neutral-7);
|
|
@@ -53,6 +55,27 @@
|
|
|
53
55
|
--shadow-resting: 0 1px 2px oklch(0% 0 0 / .035);
|
|
54
56
|
--shadow-raised: 0 6px 18px oklch(0% 0 0 / .065), 0 1px 3px oklch(0% 0 0 / .035);
|
|
55
57
|
--shadow-floating: 0 20px 48px oklch(0% 0 0 / .105), 0 3px 10px oklch(0% 0 0 / .045);
|
|
58
|
+
/* Layers, edges and shadows by role (component CSS uses these instead of raw colours). */
|
|
59
|
+
--scrim: oklch(10% 0 0 / .46); /* behind a modal layer: dialog, drawer, sheet, mobile menu */
|
|
60
|
+
--scrim-soft: oklch(10% 0 0 / .16); /* behind a non-modal panel */
|
|
61
|
+
--shade: oklch(0% 0 0 / .035); /* a faint tint over a surface, such as a stacked card */
|
|
62
|
+
--media-scrim: oklch(0% 0 0 / .45); /* over a photo, under text */
|
|
63
|
+
--on-media: var(--color-white); /* text over a photo */
|
|
64
|
+
--edge-inset: inset 0 0 0 1px oklch(0% 0 0 / .08); /* a hairline inside a swatch, thumbnail or track */
|
|
65
|
+
--shadow-hairline: 0 0 0 .5px oklch(0% 0 0 / .14);
|
|
66
|
+
--shadow-knob: 0 2px 8px oklch(0% 0 0 / .3); /* a draggable handle that must read on any colour */
|
|
67
|
+
--shadow-thumb: 0 1px 2px oklch(0% 0 0 / .06), 0 2px 6px oklch(0% 0 0 / .04); /* small lifted controls and cards */
|
|
68
|
+
--shadow-drop: drop-shadow(0 18px 36px oklch(0% 0 0 / .12)) drop-shadow(0 2px 6px oklch(0% 0 0 / .06)); /* filter: floating previews */
|
|
69
|
+
--shadow-showcase: 0 1px 1px rgb(20 24 40 / .04), 0 10px 30px -12px rgb(20 24 40 / .22); /* hero product shots */
|
|
70
|
+
--shadow-showcase-lg: 0 1px 1px rgb(20 24 40 / .04), 0 24px 48px -16px rgb(20 24 40 / .16), 0 60px 120px -40px rgb(40 48 110 / .22);
|
|
71
|
+
--glow: #b9c2ff; /* the light line on a dark hero window */
|
|
72
|
+
/* Code highlighting roles (CodeBlock); each has contrast in both themes. */
|
|
73
|
+
--syntax-string: oklch(46% .13 150); --syntax-number: oklch(50% .14 55); --syntax-keyword: oklch(48% .15 285);
|
|
74
|
+
--syntax-type: oklch(46% .13 230); --syntax-function: oklch(43% .12 25); --syntax-property: oklch(44% .12 85);
|
|
75
|
+
/* File types (TreeView): each brand hue, mixed with the text colour in the component. */
|
|
76
|
+
--file-typescript: #3178c6; --file-stylesheet: #8b6ace; --file-markdown: #38896b; --file-json: #c48637;
|
|
77
|
+
/* Theme-independent constants, for things that must stay black or white in both themes (colour picker planes). */
|
|
78
|
+
--color-black: #000; --color-white: #fff;
|
|
56
79
|
/* Brand gradient: soft lavender to warm peach. Light enough for dark text (--silicon-gradient-foreground, >12:1). */
|
|
57
80
|
--silicon-gradient-from: oklch(90% .045 300);
|
|
58
81
|
--silicon-gradient-to: oklch(92% .045 65);
|
|
@@ -64,8 +87,8 @@
|
|
|
64
87
|
--silicon-gradient-line: linear-gradient(100deg, oklch(83% .06 300), oklch(86% .06 65));
|
|
65
88
|
/* Text-safe stops for gradient text and small marks (>4.5:1 on the surface). */
|
|
66
89
|
--silicon-gradient-ink: linear-gradient(100deg, oklch(47% .1 300), oklch(50% .09 55));
|
|
67
|
-
/* Space, by role: tight 4 · related 8 · group 12 · inset 16 · comfort 20 · section 24 · block 32 · page 48 · stage 64 · screen 80. */
|
|
68
|
-
--space-tight: 4px; --space-related: 8px; --space-group: 12px; --space-inset: 16px; --space-comfort: 20px;
|
|
90
|
+
/* Space, by role: hair 2 · tight 4 · related 8 · group 12 · inset 16 · comfort 20 · section 24 · block 32 · page 48 · stage 64 · screen 80. */
|
|
91
|
+
--space-hair: 2px; --space-tight: 4px; --space-related: 8px; --space-group: 12px; --space-inset: 16px; --space-comfort: 20px;
|
|
69
92
|
--space-section: 24px; --space-block: 32px; --space-page: 48px; --space-stage: 64px; --space-screen: 80px;
|
|
70
93
|
/* Radius, by role: detail for small marks and swatches, control for buttons and fields, container for cards and menus,
|
|
71
94
|
overlay for dialogs and sheets, full for pills and dots. Every corner in every component reads one of these.
|
|
@@ -74,9 +97,10 @@
|
|
|
74
97
|
--radius-detail: 2px; --radius-control: 6px; --radius-container: 8px; --radius-overlay: 12px; --radius-full: 999px;
|
|
75
98
|
/* Corner shape. Squircle by default; see the corner rule after the dark theme. */
|
|
76
99
|
--corner-shape: squircle;
|
|
77
|
-
|
|
100
|
+
/* xs is for dense UI (tree rows, toolbars); 24px is the smallest target WCAG 2.5.8 allows, so the scale stops there. */
|
|
101
|
+
--control-height-xs: 1.5rem; --control-height-sm: 2.25rem; --control-height-md: 2.75rem; --control-height-lg: 3.125rem;
|
|
78
102
|
--font-display: var(--font-geist, "Geist Variable"), sans-serif;
|
|
79
|
-
--font-body: var(--font-
|
|
103
|
+
--font-body: var(--font-hanken-grotesk, "Hanken Grotesk Variable"), sans-serif;
|
|
80
104
|
--text-xs: .75rem; --text-sm: .875rem; --text-base: 1rem; --text-lg: 1.125rem;
|
|
81
105
|
--text-xl: 1.375rem; --text-2xl: 1.75rem; --text-3xl: 2.25rem;
|
|
82
106
|
--text-4xl: 3.25rem; --text-5xl: 4.5rem;
|
|
@@ -89,6 +113,13 @@
|
|
|
89
113
|
/* Spring with a gentle settle (bounce .15). Pair with --duration-spring for transform transitions. */
|
|
90
114
|
--ease-spring: linear(0, 0.0258, 0.09, 0.1763, 0.2732, 0.3724, 0.4683, 0.5573, 0.6376, 0.7082, 0.7689, 0.8202, 0.8628, 0.8976, 0.9256, 0.9476, 0.9648, 0.9778, 0.9875, 0.9945, 0.9994, 1.0026, 1.0047, 1.0058, 1.0062, 1.0062, 1.0059, 1.0055, 1.0049, 1.0043, 1.0036, 1.0031, 1.0025, 1.002, 1.0016, 1.0013, 1);
|
|
91
115
|
--duration-instant: 120ms; --duration-fast: 160ms; --duration-standard: 240ms; --duration-considered: 480ms; --duration-spring: 580ms;
|
|
116
|
+
/* Stagger steps (the same values as motionTokens.stagger). Keep total stagger under roughly 400ms. */
|
|
117
|
+
--stagger-item: 35ms;
|
|
118
|
+
/* Stacking order, by role. Menus and listboxes sit above popovers and dialogs because they open from inside them.
|
|
119
|
+
An app's own chrome (sticky header, sidebar, toolbar) stays below --layer-overlay, so dims and every floating
|
|
120
|
+
layer cover it: use --layer-sticky, or calc(var(--layer-overlay) - 1) at most. */
|
|
121
|
+
--layer-raised: 10; --layer-sticky: 20; --layer-overlay: 50; --layer-dialog: 51;
|
|
122
|
+
--layer-popover: 60; --layer-dropdown: 70; --layer-toast: 80; --layer-tooltip: 90;
|
|
92
123
|
}
|
|
93
124
|
|
|
94
125
|
:root[data-theme="dark"] {
|
|
@@ -98,6 +129,7 @@
|
|
|
98
129
|
--surface-raised: oklch(24% 0 0);
|
|
99
130
|
/* Keep muted surfaces and hover states distinct from the base surface in dark mode. */
|
|
100
131
|
--surface-muted: oklch(26% 0 0);
|
|
132
|
+
--surface-pressed: oklch(30% 0 0);
|
|
101
133
|
--foreground: oklch(96% 0 0);
|
|
102
134
|
--text-secondary: oklch(77% 0 0);
|
|
103
135
|
--text-muted: oklch(64% 0 0);
|
|
@@ -123,6 +155,14 @@
|
|
|
123
155
|
--shadow-resting: 0 1px 2px oklch(0% 0 0 / .18);
|
|
124
156
|
--shadow-raised: 0 8px 22px oklch(0% 0 0 / .22);
|
|
125
157
|
--shadow-floating: 0 22px 55px oklch(0% 0 0 / .34);
|
|
158
|
+
--scrim: oklch(0% 0 0 / .52);
|
|
159
|
+
--shade: oklch(0% 0 0 / .22);
|
|
160
|
+
--shadow-thumb: inset 0 1px 0 oklch(100% 0 0 / .05), 0 1px 2px oklch(0% 0 0 / .3);
|
|
161
|
+
--shadow-drop: drop-shadow(0 20px 44px oklch(0% 0 0 / .5));
|
|
162
|
+
--shadow-showcase: inset 0 1px 0 color-mix(in oklab, var(--foreground) 8%, transparent), 0 10px 30px -12px rgb(0 0 0 / .6);
|
|
163
|
+
--shadow-showcase-lg: inset 0 1px 0 color-mix(in oklab, var(--foreground) 9%, transparent), 0 24px 48px -16px rgb(0 0 0 / .6), 0 60px 140px -40px rgb(40 50 140 / .35);
|
|
164
|
+
--syntax-string: oklch(77% .15 150); --syntax-number: oklch(80% .14 75); --syntax-keyword: oklch(78% .16 285);
|
|
165
|
+
--syntax-type: oklch(79% .13 230); --syntax-function: oklch(80% .13 25); --syntax-property: oklch(79% .12 85);
|
|
126
166
|
--silicon-gradient-from: oklch(38% .05 300);
|
|
127
167
|
--silicon-gradient-to: oklch(40% .045 60);
|
|
128
168
|
--silicon-gradient-foreground: oklch(96% .005 300);
|