@scalewing/react 0.6.1 → 1.0.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.
Files changed (99) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +62 -1
  3. package/dist/components/ActionMenu.d.ts +16 -0
  4. package/dist/components/ActionMenu.js +142 -0
  5. package/dist/components/Badge.d.ts +2 -1
  6. package/dist/components/Badge.js +2 -1
  7. package/dist/components/Box.d.ts +3 -2
  8. package/dist/components/Box.js +3 -2
  9. package/dist/components/Button.d.ts +1 -1
  10. package/dist/components/Button.js +1 -1
  11. package/dist/components/Checkbox.d.ts +10 -0
  12. package/dist/components/Checkbox.js +17 -0
  13. package/dist/components/DateField.d.ts +12 -0
  14. package/dist/components/DateField.js +30 -0
  15. package/dist/components/Field.d.ts +4 -1
  16. package/dist/components/Field.js +36 -3
  17. package/dist/components/FilterChips.d.ts +12 -0
  18. package/dist/components/FilterChips.js +20 -0
  19. package/dist/components/Inline.js +1 -1
  20. package/dist/components/Progress.d.ts +8 -0
  21. package/dist/components/Progress.js +13 -0
  22. package/dist/components/RadioGroup.d.ts +16 -0
  23. package/dist/components/RadioGroup.js +27 -0
  24. package/dist/components/Separator.d.ts +6 -0
  25. package/dist/components/Separator.js +4 -0
  26. package/dist/components/Spinner.d.ts +11 -0
  27. package/dist/components/Spinner.js +10 -0
  28. package/dist/components/Stack.js +1 -1
  29. package/dist/components/Switch.d.ts +8 -0
  30. package/dist/components/Switch.js +11 -0
  31. package/dist/components/Tooltip.d.ts +8 -0
  32. package/dist/components/Tooltip.js +40 -0
  33. package/dist/css/breakpoints.d.ts +8 -0
  34. package/dist/css/breakpoints.js +11 -0
  35. package/dist/css/css-accordion.d.ts +2 -0
  36. package/dist/css/css-accordion.js +33 -0
  37. package/dist/css/css-action-menu.d.ts +2 -0
  38. package/dist/css/css-action-menu.js +95 -0
  39. package/dist/css/css-button.d.ts +7 -0
  40. package/dist/css/css-button.js +68 -0
  41. package/dist/css/css-chart.d.ts +2 -0
  42. package/dist/css/css-chart.js +98 -0
  43. package/dist/css/css-checkbox.d.ts +2 -0
  44. package/dist/css/css-checkbox.js +127 -0
  45. package/dist/css/css-chrome.d.ts +2 -0
  46. package/dist/css/css-chrome.js +59 -0
  47. package/dist/css/css-components.d.ts +1 -0
  48. package/dist/css/css-components.js +130 -0
  49. package/dist/css/css-data.d.ts +7 -0
  50. package/dist/css/css-data.js +189 -0
  51. package/dist/css/css-date-field.d.ts +2 -0
  52. package/dist/css/css-date-field.js +77 -0
  53. package/dist/css/css-dialog.d.ts +2 -0
  54. package/dist/css/css-dialog.js +29 -0
  55. package/dist/css/css-document.d.ts +1 -0
  56. package/dist/css/css-document.js +102 -0
  57. package/dist/css/css-field.d.ts +2 -0
  58. package/dist/css/css-field.js +33 -0
  59. package/dist/css/css-filter-chips.d.ts +2 -0
  60. package/dist/css/css-filter-chips.js +92 -0
  61. package/dist/css/css-palettes.d.ts +4 -0
  62. package/dist/css/css-palettes.js +52 -0
  63. package/dist/css/css-progress.d.ts +2 -0
  64. package/dist/css/css-progress.js +77 -0
  65. package/dist/css/css-radio-group.d.ts +2 -0
  66. package/dist/css/css-radio-group.js +148 -0
  67. package/dist/css/css-responsive.d.ts +2 -0
  68. package/dist/css/css-responsive.js +12 -0
  69. package/dist/css/css-select.d.ts +2 -0
  70. package/dist/css/css-select.js +134 -0
  71. package/dist/css/css-separator.d.ts +2 -0
  72. package/dist/css/css-separator.js +26 -0
  73. package/dist/css/css-spinner.d.ts +2 -0
  74. package/dist/css/css-spinner.js +45 -0
  75. package/dist/css/css-split.d.ts +2 -0
  76. package/dist/css/css-split.js +67 -0
  77. package/dist/css/css-switch.d.ts +2 -0
  78. package/dist/css/css-switch.js +115 -0
  79. package/dist/css/css-toast.d.ts +2 -0
  80. package/dist/css/css-toast.js +92 -0
  81. package/dist/css/css-tooltip.d.ts +2 -0
  82. package/dist/css/css-tooltip.js +35 -0
  83. package/dist/css/css-utilities.d.ts +1 -0
  84. package/dist/css/css-utilities.js +57 -0
  85. package/dist/css/css-variables.d.ts +2 -0
  86. package/dist/css/css-variables.js +61 -0
  87. package/dist/css/spacing-classes.d.ts +10 -0
  88. package/dist/css/spacing-classes.js +40 -0
  89. package/dist/css/stylesheet.d.ts +3 -0
  90. package/dist/css/stylesheet.js +75 -0
  91. package/dist/date-only.d.ts +3 -0
  92. package/dist/date-only.js +31 -0
  93. package/dist/index.d.ts +15 -1
  94. package/dist/index.js +12 -1
  95. package/dist/spacing-classes.js +1 -1
  96. package/dist/styles.css +762 -20
  97. package/dist/visibility-classes.d.ts +6 -0
  98. package/dist/visibility-classes.js +7 -0
  99. package/package.json +4 -3
@@ -0,0 +1,11 @@
1
+ export type SpinnerSize = 'sm' | 'md' | 'lg';
2
+ export type SpinnerProps = {
3
+ label: string;
4
+ size?: SpinnerSize;
5
+ decorative?: false;
6
+ } | {
7
+ label?: never;
8
+ size?: SpinnerSize;
9
+ decorative: true;
10
+ };
11
+ export declare function Spinner({ label, size, decorative, }: SpinnerProps): import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ export function Spinner({ label, size = 'md', decorative = false, }) {
4
+ const className = `sw-spinner sw-spinner-${size}`;
5
+ if (decorative)
6
+ return (_jsx("span", { "aria-hidden": "true", className: className, children: _jsx("span", { className: "sw-spinner-icon" }) }));
7
+ if (!label?.trim())
8
+ throw new RangeError('label must not be empty');
9
+ return (_jsxs("span", { className: className, role: "status", children: [_jsx("span", { "aria-hidden": "true", className: "sw-spinner-icon" }), _jsx("span", { className: "sw-sr-only", children: label })] }));
10
+ }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { spacingClass } from '@scalewing/tokens';
2
+ import { spacingClass } from '../css/spacing-classes.js';
3
3
  import { cx } from '../class-names.js';
4
4
  import { Box } from './Box.js';
5
5
  export function Stack({ align = 'stretch', className, gap = 0, justify = 'start', ...rest }) {
@@ -0,0 +1,8 @@
1
+ export type SwitchProps = {
2
+ label: string;
3
+ checked: boolean;
4
+ onCheckedChange: (checked: boolean) => void;
5
+ disabled?: boolean;
6
+ description?: string;
7
+ };
8
+ export declare function Switch({ label, checked, onCheckedChange, disabled, description, }: SwitchProps): import("react").JSX.Element;
@@ -0,0 +1,11 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useId } from 'react';
4
+ export function Switch({ label, checked, onCheckedChange, disabled = false, description, }) {
5
+ const labelId = useId();
6
+ const descriptionId = useId();
7
+ return (_jsxs("label", { className: "sw-switch", children: [_jsxs("span", { className: "sw-switch-control", children: [_jsx("input", { "aria-checked": checked, "aria-describedby": description ? descriptionId : undefined, "aria-labelledby": labelId, checked: checked, className: "sw-switch-input", disabled: disabled, onChange: (event) => {
8
+ if (!disabled)
9
+ onCheckedChange(event.currentTarget.checked);
10
+ }, role: "switch", type: "checkbox" }), _jsx("span", { "aria-hidden": "true", className: "sw-switch-track", children: _jsx("span", { className: "sw-switch-thumb" }) })] }), _jsxs("span", { className: "sw-switch-copy", children: [_jsx("span", { className: "sw-switch-label", id: labelId, children: label }), description ? (_jsx("span", { className: "sw-switch-description", id: descriptionId, children: description })) : null] })] }));
11
+ }
@@ -0,0 +1,8 @@
1
+ import { type ReactElement } from 'react';
2
+ export type TooltipProps = {
3
+ content: string;
4
+ trigger: ReactElement<{
5
+ 'aria-describedby'?: string;
6
+ }>;
7
+ };
8
+ export declare function Tooltip({ content, trigger }: TooltipProps): import("react").JSX.Element;
@@ -0,0 +1,40 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { cloneElement, useEffect, useId, useRef, useState, } from 'react';
4
+ export function Tooltip({ content, trigger }) {
5
+ if (!content.trim())
6
+ throw new RangeError('content must not be empty');
7
+ const [open, setOpen] = useState(false);
8
+ const id = useId();
9
+ const wrapperRef = useRef(null);
10
+ const describedBy = [trigger.props['aria-describedby'], id]
11
+ .filter(Boolean)
12
+ .join(' ');
13
+ useEffect(() => {
14
+ if (!open)
15
+ return;
16
+ function dismissOutside(event) {
17
+ if (event.target instanceof Node &&
18
+ !wrapperRef.current?.contains(event.target))
19
+ setOpen(false);
20
+ }
21
+ document.addEventListener('pointerdown', dismissOutside);
22
+ return () => document.removeEventListener('pointerdown', dismissOutside);
23
+ }, [open]);
24
+ return (_jsxs("span", { className: "sw-tooltip-anchor", onBlurCapture: (event) => {
25
+ if (!event.currentTarget.contains(event.relatedTarget))
26
+ setOpen(false);
27
+ }, onFocusCapture: () => setOpen(true), onKeyDownCapture: (event) => {
28
+ if (event.key === 'Escape')
29
+ setOpen(false);
30
+ }, onPointerEnter: (event) => {
31
+ if (event.pointerType === 'mouse' || event.pointerType === 'pen')
32
+ setOpen(true);
33
+ }, onPointerLeave: (event) => {
34
+ if (event.pointerType === 'mouse' || event.pointerType === 'pen')
35
+ setOpen(false);
36
+ }, onPointerDownCapture: (event) => {
37
+ if (event.pointerType === 'touch')
38
+ setOpen((current) => !current);
39
+ }, ref: wrapperRef, children: [cloneElement(trigger, { 'aria-describedby': describedBy }), _jsx("span", { className: "sw-tooltip", hidden: !open, id: id, role: "tooltip", children: content })] }));
40
+ }
@@ -0,0 +1,8 @@
1
+ export declare const breakpointScale: {
2
+ readonly md: 48;
3
+ };
4
+ export type Breakpoint = keyof typeof breakpointScale;
5
+ export declare const breakpoints: Breakpoint[];
6
+ export type HideDirection = 'from' | 'below';
7
+ export declare function hideClass(direction: HideDirection, breakpoint: Breakpoint): string;
8
+ export declare function breakpointQuery(direction: HideDirection, breakpoint: Breakpoint): string;
@@ -0,0 +1,11 @@
1
+ export const breakpointScale = {
2
+ md: 48,
3
+ };
4
+ export const breakpoints = Object.keys(breakpointScale);
5
+ export function hideClass(direction, breakpoint) {
6
+ return `sw-hide-${direction}-${breakpoint}`;
7
+ }
8
+ export function breakpointQuery(direction, breakpoint) {
9
+ const minWidth = `(min-width: ${breakpointScale[breakpoint]}rem)`;
10
+ return direction === 'from' ? minWidth : `not all and ${minWidth}`;
11
+ }
@@ -0,0 +1,2 @@
1
+ export declare function cssAccordionClasses(): string;
2
+ export declare function accordionClassCatalog(): string[];
@@ -0,0 +1,33 @@
1
+ export function cssAccordionClasses() {
2
+ return `.sw-accordion {
3
+ background: var(--sw-glass-fill);
4
+ border: 1px solid var(--sw-glass-border);
5
+ border-radius: var(--sw-radius-lg);
6
+ box-shadow: inset 0 1px 0 var(--sw-glass-specular);
7
+ backdrop-filter: blur(var(--sw-glass-blur)) saturate(var(--sw-glass-saturate));
8
+ -webkit-backdrop-filter: blur(var(--sw-glass-blur)) saturate(var(--sw-glass-saturate));
9
+ color: var(--sw-color-text);
10
+ }
11
+
12
+ .sw-accordion-summary {
13
+ cursor: pointer;
14
+ display: list-item;
15
+ min-height: var(--sw-control-md-min-height);
16
+ }
17
+
18
+ .sw-accordion-summary::-webkit-details-marker {
19
+ color: var(--sw-color-muted);
20
+ }
21
+
22
+ .sw-accordion-summary::marker {
23
+ color: var(--sw-color-muted);
24
+ }
25
+
26
+ .sw-accordion-summary:focus-visible {
27
+ outline: var(--sw-focus-ring-width) solid var(--sw-color-accent);
28
+ outline-offset: var(--sw-focus-ring-offset);
29
+ }`;
30
+ }
31
+ export function accordionClassCatalog() {
32
+ return ['sw-accordion', 'sw-accordion-summary'];
33
+ }
@@ -0,0 +1,2 @@
1
+ export declare function cssActionMenuClasses(): string;
2
+ export declare function actionMenuClassCatalog(): string[];
@@ -0,0 +1,95 @@
1
+ import { typographyVariants } from '@scalewing/tokens';
2
+ const label = typographyVariants.label;
3
+ export function cssActionMenuClasses() {
4
+ return `.sw-action-menu {
5
+ display: inline-flex;
6
+ position: relative;
7
+ }
8
+
9
+ .sw-action-menu-trigger {
10
+ appearance: none;
11
+ background: var(--sw-glass-fill);
12
+ border: 1px solid var(--sw-color-border);
13
+ border-radius: var(--sw-radius-sm);
14
+ color: var(--sw-color-text);
15
+ cursor: pointer;
16
+ font: inherit;
17
+ min-height: var(--sw-control-xs-min-height);
18
+ padding-inline: var(--sw-control-xs-padding-inline);
19
+ }
20
+
21
+ .sw-action-menu-trigger:focus-visible,
22
+ .sw-action-menu-item:focus-visible {
23
+ outline: var(--sw-focus-ring-width) solid var(--sw-color-accent);
24
+ outline-offset: var(--sw-focus-ring-offset);
25
+ }
26
+
27
+ .sw-action-menu-trigger:disabled {
28
+ cursor: not-allowed;
29
+ opacity: 0.5;
30
+ }
31
+
32
+ .sw-action-menu-list {
33
+ background: var(--sw-glass-fill);
34
+ border: 1px solid var(--sw-glass-border);
35
+ border-radius: var(--sw-radius-sm);
36
+ box-shadow: var(--sw-elevation-sm), inset 0 1px 0 var(--sw-glass-specular);
37
+ backdrop-filter: blur(var(--sw-glass-blur)) saturate(var(--sw-glass-saturate));
38
+ -webkit-backdrop-filter: blur(var(--sw-glass-blur)) saturate(var(--sw-glass-saturate));
39
+ box-sizing: border-box;
40
+ color: var(--sw-color-text);
41
+ margin: 0;
42
+ max-height: var(--sw-select-max);
43
+ max-width: calc(100vw - var(--sw-space-2));
44
+ min-width: max-content;
45
+ overflow: auto;
46
+ padding: var(--sw-space-1);
47
+ position: fixed;
48
+ z-index: 10;
49
+ }
50
+
51
+ .sw-action-menu-list[hidden] {
52
+ display: none;
53
+ }
54
+
55
+ .sw-action-menu-item {
56
+ align-items: center;
57
+ appearance: none;
58
+ background: transparent;
59
+ border: 0;
60
+ border-radius: var(--sw-radius-sm);
61
+ color: inherit;
62
+ cursor: pointer;
63
+ display: flex;
64
+ font-family: var(--sw-font-sans);
65
+ font-size: ${label.fontSize}px;
66
+ gap: var(--sw-space-2);
67
+ min-height: var(--sw-control-xs-min-height);
68
+ padding-inline: var(--sw-control-xs-padding-inline);
69
+ text-align: start;
70
+ width: 100%;
71
+ }
72
+
73
+ .sw-action-menu-item:hover,
74
+ .sw-action-menu-item:focus-visible {
75
+ background: color-mix(in srgb, var(--sw-color-muted) 16%, transparent);
76
+ }
77
+
78
+ .sw-action-menu-item:disabled {
79
+ cursor: not-allowed;
80
+ opacity: 0.5;
81
+ }
82
+
83
+ .sw-action-menu-item-danger {
84
+ color: var(--sw-color-danger);
85
+ }`;
86
+ }
87
+ export function actionMenuClassCatalog() {
88
+ return [
89
+ 'sw-action-menu',
90
+ 'sw-action-menu-trigger',
91
+ 'sw-action-menu-list',
92
+ 'sw-action-menu-item',
93
+ 'sw-action-menu-item-danger',
94
+ ];
95
+ }
@@ -0,0 +1,7 @@
1
+ import { type ButtonSize, type ButtonVariant } from '@scalewing/tokens';
2
+ export declare function buttonClassNames(options: {
3
+ size: ButtonSize;
4
+ variant: ButtonVariant;
5
+ }): string[];
6
+ export declare function cssButtonClasses(): string;
7
+ export declare function buttonClassCatalog(): string[];
@@ -0,0 +1,68 @@
1
+ import { buttonSizes, buttonVariants, controlScale, typographyVariants, } from '@scalewing/tokens';
2
+ const label = typographyVariants.label;
3
+ export function buttonClassNames(options) {
4
+ return [
5
+ 'sw-button',
6
+ `sw-button-${options.variant}`,
7
+ `sw-button-${options.size}`,
8
+ ];
9
+ }
10
+ function variantRules() {
11
+ return [
12
+ `.sw-button-primary { background: var(--sw-color-accent); border-color: transparent; color: var(--sw-color-onAccent); }`,
13
+ `.sw-button-secondary { background: var(--sw-color-surface); border-color: var(--sw-color-border); color: var(--sw-color-text); }`,
14
+ `.sw-button-ghost { background: transparent; border-color: transparent; color: var(--sw-color-accent); }`,
15
+ `.sw-button-danger { background: var(--sw-color-danger); border-color: transparent; color: var(--sw-color-onDanger); }`,
16
+ ].join('\n');
17
+ }
18
+ function sizeRules() {
19
+ return buttonSizes
20
+ .map((size) => {
21
+ const control = controlScale[size];
22
+ return `.sw-button-${size} { min-height: ${control.minHeight}px; padding-inline: ${control.paddingInline}px; }`;
23
+ })
24
+ .join('\n');
25
+ }
26
+ export function cssButtonClasses() {
27
+ return `.sw-button {
28
+ appearance: none;
29
+ align-items: center;
30
+ background: none;
31
+ border: 1px solid transparent;
32
+ border-radius: var(--sw-radius-pill);
33
+ box-sizing: border-box;
34
+ cursor: pointer;
35
+ display: inline-flex;
36
+ font-family: var(--sw-font-sans);
37
+ font-size: ${label.fontSize}px;
38
+ font-weight: ${label.fontWeight};
39
+ justify-content: center;
40
+ letter-spacing: ${label.letterSpacing}px;
41
+ line-height: ${label.lineHeight}px;
42
+ margin: 0;
43
+ }
44
+
45
+ .sw-button:focus-visible {
46
+ outline: var(--sw-focus-ring-width) solid var(--sw-color-accent);
47
+ outline-offset: var(--sw-focus-ring-offset);
48
+ }
49
+
50
+ .sw-button:disabled {
51
+ cursor: not-allowed;
52
+ opacity: var(--sw-disabled-opacity);
53
+ }
54
+
55
+ .sw-button[aria-pressed='false'] {
56
+ opacity: var(--sw-quiet-opacity);
57
+ }
58
+
59
+ ${variantRules()}
60
+ ${sizeRules()}`;
61
+ }
62
+ export function buttonClassCatalog() {
63
+ return [
64
+ 'sw-button',
65
+ ...buttonVariants.map((variant) => `sw-button-${variant}`),
66
+ ...buttonSizes.map((size) => `sw-button-${size}`),
67
+ ];
68
+ }
@@ -0,0 +1,2 @@
1
+ export declare function cssChartClasses(): string;
2
+ export declare function chartClassCatalog(): string[];
@@ -0,0 +1,98 @@
1
+ import { typographyVariants } from '@scalewing/tokens';
2
+ const caption = typographyVariants.caption;
3
+ const data = typographyVariants.data;
4
+ export function cssChartClasses() {
5
+ return `.sw-bar-chart {
6
+ display: grid;
7
+ gap: var(--sw-space-2);
8
+ }
9
+
10
+ .sw-bar-chart-plot {
11
+ display: grid;
12
+ gap: var(--sw-space-2);
13
+ list-style: none;
14
+ margin: 0;
15
+ padding: 0;
16
+ }
17
+
18
+ .sw-bar-chart-row,
19
+ .sw-bar-chart-axis {
20
+ align-items: center;
21
+ display: grid;
22
+ gap: var(--sw-space-3);
23
+ grid-template-columns: minmax(0, 2fr) minmax(0, 5fr) minmax(var(--sw-space-8), max-content);
24
+ }
25
+
26
+ .sw-bar-chart-label {
27
+ color: var(--sw-color-muted);
28
+ font-family: var(--sw-font-sans);
29
+ font-size: ${caption.fontSize}px;
30
+ font-weight: 400;
31
+ letter-spacing: ${caption.letterSpacing}px;
32
+ line-height: ${caption.lineHeight}px;
33
+ min-width: 0;
34
+ overflow: hidden;
35
+ text-overflow: ellipsis;
36
+ white-space: nowrap;
37
+ }
38
+
39
+ .sw-bar-chart-track {
40
+ background: var(--sw-glass-fill);
41
+ border: 1px solid var(--sw-color-border);
42
+ border-radius: var(--sw-radius-pill);
43
+ height: var(--sw-space-3);
44
+ min-width: 0;
45
+ overflow: hidden;
46
+ }
47
+
48
+ .sw-bar-chart-fill {
49
+ background: var(--sw-color-accent);
50
+ border-radius: inherit;
51
+ display: block;
52
+ height: 100%;
53
+ width: calc(var(--sw-bar-fill, 0) * 100%);
54
+ }
55
+
56
+ .sw-bar-chart-fill-negative {
57
+ background: var(--sw-color-danger);
58
+ }
59
+
60
+ .sw-bar-chart-value {
61
+ color: var(--sw-color-text);
62
+ font-family: var(--sw-font-sans);
63
+ font-size: ${data.fontSize}px;
64
+ font-variant-numeric: tabular-nums;
65
+ font-weight: ${data.fontWeight};
66
+ letter-spacing: ${data.letterSpacing}px;
67
+ line-height: ${data.lineHeight}px;
68
+ text-align: end;
69
+ }
70
+
71
+ .sw-bar-chart-axis {
72
+ color: var(--sw-color-muted);
73
+ font-family: var(--sw-font-sans);
74
+ font-size: ${caption.fontSize}px;
75
+ font-weight: 400;
76
+ letter-spacing: ${caption.letterSpacing}px;
77
+ line-height: ${caption.lineHeight}px;
78
+ }
79
+
80
+ .sw-bar-chart-axis-track {
81
+ display: flex;
82
+ justify-content: space-between;
83
+ }`;
84
+ }
85
+ export function chartClassCatalog() {
86
+ return [
87
+ 'sw-bar-chart',
88
+ 'sw-bar-chart-plot',
89
+ 'sw-bar-chart-row',
90
+ 'sw-bar-chart-axis',
91
+ 'sw-bar-chart-label',
92
+ 'sw-bar-chart-track',
93
+ 'sw-bar-chart-fill',
94
+ 'sw-bar-chart-fill-negative',
95
+ 'sw-bar-chart-value',
96
+ 'sw-bar-chart-axis-track',
97
+ ];
98
+ }
@@ -0,0 +1,2 @@
1
+ export declare function cssCheckboxClasses(): string;
2
+ export declare function checkboxClassCatalog(): string[];
@@ -0,0 +1,127 @@
1
+ import { typographyVariants } from '@scalewing/tokens';
2
+ const label = typographyVariants.label;
3
+ const caption = typographyVariants.caption;
4
+ export function cssCheckboxClasses() {
5
+ return `.sw-checkbox {
6
+ display: flex;
7
+ flex-direction: column;
8
+ gap: var(--sw-space-1);
9
+ max-width: 100%;
10
+ }
11
+
12
+ .sw-checkbox-label {
13
+ align-items: center;
14
+ cursor: pointer;
15
+ display: inline-flex;
16
+ gap: var(--sw-space-2);
17
+ max-width: 100%;
18
+ min-height: var(--sw-control-md-min-height);
19
+ width: max-content;
20
+ }
21
+
22
+ .sw-checkbox-control {
23
+ align-items: center;
24
+ display: inline-flex;
25
+ flex: 0 0 var(--sw-space-5);
26
+ height: var(--sw-space-5);
27
+ position: relative;
28
+ }
29
+
30
+ .sw-checkbox-input {
31
+ cursor: inherit;
32
+ height: 100%;
33
+ inset: 0;
34
+ margin: 0;
35
+ opacity: 0;
36
+ position: absolute;
37
+ width: 100%;
38
+ }
39
+
40
+ .sw-checkbox-mark {
41
+ background: var(--sw-glass-fill);
42
+ border: 1px solid var(--sw-color-border);
43
+ border-radius: var(--sw-radius-sm);
44
+ box-sizing: border-box;
45
+ height: var(--sw-space-5);
46
+ pointer-events: none;
47
+ position: relative;
48
+ width: var(--sw-space-5);
49
+ }
50
+
51
+ .sw-checkbox-mark::after {
52
+ border-bottom: 2px solid var(--sw-color-surface);
53
+ border-right: 2px solid var(--sw-color-surface);
54
+ content: '';
55
+ display: none;
56
+ height: var(--sw-space-2);
57
+ inset-block-start: var(--sw-space-1);
58
+ inset-inline-start: var(--sw-space-2);
59
+ position: absolute;
60
+ transform: rotate(45deg);
61
+ width: var(--sw-space-1);
62
+ }
63
+
64
+ .sw-checkbox-input:checked + .sw-checkbox-mark {
65
+ background: var(--sw-color-accent);
66
+ border-color: var(--sw-color-accent);
67
+ }
68
+
69
+ .sw-checkbox-input:checked + .sw-checkbox-mark::after { display: block; }
70
+
71
+ .sw-checkbox-input:focus-visible + .sw-checkbox-mark {
72
+ outline: var(--sw-focus-ring-width) solid var(--sw-color-accent);
73
+ outline-offset: var(--sw-focus-ring-offset);
74
+ }
75
+
76
+ .sw-checkbox-input[aria-invalid='true'] + .sw-checkbox-mark {
77
+ border-color: var(--sw-color-danger);
78
+ }
79
+
80
+ .sw-checkbox-label:has(.sw-checkbox-input:disabled) {
81
+ cursor: not-allowed;
82
+ opacity: var(--sw-disabled-opacity);
83
+ }
84
+
85
+ .sw-checkbox-text {
86
+ color: var(--sw-color-text);
87
+ font-family: var(--sw-font-sans);
88
+ font-size: ${label.fontSize}px;
89
+ font-weight: ${label.fontWeight};
90
+ line-height: ${label.lineHeight}px;
91
+ min-width: 0;
92
+ }
93
+
94
+ .sw-checkbox-description,
95
+ .sw-checkbox-error {
96
+ font-family: var(--sw-font-sans);
97
+ font-size: ${caption.fontSize}px;
98
+ line-height: ${caption.lineHeight}px;
99
+ }
100
+
101
+ .sw-checkbox-description { color: var(--sw-color-muted); }
102
+ .sw-checkbox-error { color: var(--sw-color-danger); }
103
+
104
+ @media (prefers-reduced-transparency: reduce) {
105
+ .sw-checkbox-mark { background: var(--sw-color-surface); }
106
+ .sw-checkbox-input:checked + .sw-checkbox-mark { background: var(--sw-color-accent); }
107
+ }
108
+
109
+ @media (forced-colors: active) {
110
+ .sw-checkbox-mark { background: Canvas; border-color: CanvasText; }
111
+ .sw-checkbox-input:checked + .sw-checkbox-mark { background: Highlight; border-color: Highlight; }
112
+ .sw-checkbox-input:checked + .sw-checkbox-mark::after { border-color: HighlightText; }
113
+ .sw-checkbox-input[aria-invalid='true'] + .sw-checkbox-mark { border-color: CanvasText; }
114
+ }`;
115
+ }
116
+ export function checkboxClassCatalog() {
117
+ return [
118
+ 'sw-checkbox',
119
+ 'sw-checkbox-label',
120
+ 'sw-checkbox-control',
121
+ 'sw-checkbox-input',
122
+ 'sw-checkbox-mark',
123
+ 'sw-checkbox-text',
124
+ 'sw-checkbox-description',
125
+ 'sw-checkbox-error',
126
+ ];
127
+ }
@@ -0,0 +1,2 @@
1
+ export declare function cssChromeClasses(): string;
2
+ export declare function chromeClassCatalog(): string[];
@@ -0,0 +1,59 @@
1
+ import { typographyVariants } from '@scalewing/tokens';
2
+ const caption = typographyVariants.caption;
3
+ const label = typographyVariants.label;
4
+ export function cssChromeClasses() {
5
+ return `.sw-app-header {
6
+ background: var(--sw-glass-fill);
7
+ border: 1px solid var(--sw-glass-border);
8
+ border-radius: var(--sw-radius-lg);
9
+ box-shadow: inset 0 1px 0 var(--sw-glass-specular);
10
+ backdrop-filter: blur(var(--sw-glass-blur)) saturate(var(--sw-glass-saturate));
11
+ -webkit-backdrop-filter: blur(var(--sw-glass-blur)) saturate(var(--sw-glass-saturate));
12
+ }
13
+
14
+ .sw-app-header-sticky {
15
+ position: sticky;
16
+ top: 0;
17
+ z-index: 2;
18
+ }
19
+
20
+ .sw-nav {
21
+ align-items: center;
22
+ display: inline-flex;
23
+ flex-wrap: wrap;
24
+ gap: var(--sw-space-3);
25
+ }
26
+
27
+ .sw-nav a {
28
+ font-size: ${label.fontSize}px;
29
+ font-weight: ${label.fontWeight};
30
+ letter-spacing: ${label.letterSpacing}px;
31
+ line-height: ${label.lineHeight}px;
32
+ }
33
+
34
+ .sw-nav a[aria-current='page'] {
35
+ color: var(--sw-color-text);
36
+ }
37
+
38
+ .sw-field-xs :is(select, input, textarea) {
39
+ font-size: ${caption.fontSize}px;
40
+ letter-spacing: ${caption.letterSpacing}px;
41
+ line-height: ${caption.lineHeight}px;
42
+ min-height: var(--sw-control-xs-min-height);
43
+ padding-inline: var(--sw-control-xs-padding-inline);
44
+ }
45
+
46
+ .sw-field-xs select {
47
+ background-position:
48
+ calc(100% - var(--sw-space-3)) calc(50% - 1px),
49
+ calc(100% - calc(var(--sw-space-3) - var(--sw-space-1))) calc(50% - 1px);
50
+ height: calc(var(--sw-control-xs-min-height) - 1px - 1px);
51
+ min-height: 0;
52
+ padding-inline-end: calc(
53
+ var(--sw-control-xs-padding-inline) + var(--sw-space-5)
54
+ );
55
+ }`;
56
+ }
57
+ export function chromeClassCatalog() {
58
+ return ['sw-app-header', 'sw-app-header-sticky', 'sw-nav', 'sw-field-xs'];
59
+ }
@@ -0,0 +1 @@
1
+ export declare function cssComponentClasses(): string;