@scalewing/react 0.7.0 → 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 (74) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +1 -1
  3. package/dist/components/Badge.d.ts +2 -1
  4. package/dist/components/Badge.js +2 -1
  5. package/dist/components/Box.d.ts +3 -2
  6. package/dist/components/Box.js +3 -2
  7. package/dist/components/Button.js +1 -1
  8. package/dist/components/Inline.js +1 -1
  9. package/dist/components/Stack.js +1 -1
  10. package/dist/css/breakpoints.d.ts +8 -0
  11. package/dist/css/breakpoints.js +11 -0
  12. package/dist/css/css-accordion.d.ts +2 -0
  13. package/dist/css/css-accordion.js +33 -0
  14. package/dist/css/css-action-menu.d.ts +2 -0
  15. package/dist/css/css-action-menu.js +95 -0
  16. package/dist/css/css-button.d.ts +7 -0
  17. package/dist/css/css-button.js +68 -0
  18. package/dist/css/css-chart.d.ts +2 -0
  19. package/dist/css/css-chart.js +98 -0
  20. package/dist/css/css-checkbox.d.ts +2 -0
  21. package/dist/css/css-checkbox.js +127 -0
  22. package/dist/css/css-chrome.d.ts +2 -0
  23. package/dist/css/css-chrome.js +59 -0
  24. package/dist/css/css-components.d.ts +1 -0
  25. package/dist/css/css-components.js +130 -0
  26. package/dist/css/css-data.d.ts +7 -0
  27. package/dist/css/css-data.js +189 -0
  28. package/dist/css/css-date-field.d.ts +2 -0
  29. package/dist/css/css-date-field.js +77 -0
  30. package/dist/css/css-dialog.d.ts +2 -0
  31. package/dist/css/css-dialog.js +29 -0
  32. package/dist/css/css-document.d.ts +1 -0
  33. package/dist/css/css-document.js +102 -0
  34. package/dist/css/css-field.d.ts +2 -0
  35. package/dist/css/css-field.js +33 -0
  36. package/dist/css/css-filter-chips.d.ts +2 -0
  37. package/dist/css/css-filter-chips.js +92 -0
  38. package/dist/css/css-palettes.d.ts +4 -0
  39. package/dist/css/css-palettes.js +52 -0
  40. package/dist/css/css-progress.d.ts +2 -0
  41. package/dist/css/css-progress.js +77 -0
  42. package/dist/css/css-radio-group.d.ts +2 -0
  43. package/dist/css/css-radio-group.js +148 -0
  44. package/dist/css/css-responsive.d.ts +2 -0
  45. package/dist/css/css-responsive.js +12 -0
  46. package/dist/css/css-select.d.ts +2 -0
  47. package/dist/css/css-select.js +134 -0
  48. package/dist/css/css-separator.d.ts +2 -0
  49. package/dist/css/css-separator.js +26 -0
  50. package/dist/css/css-spinner.d.ts +2 -0
  51. package/dist/css/css-spinner.js +45 -0
  52. package/dist/css/css-split.d.ts +2 -0
  53. package/dist/css/css-split.js +67 -0
  54. package/dist/css/css-switch.d.ts +2 -0
  55. package/dist/css/css-switch.js +115 -0
  56. package/dist/css/css-toast.d.ts +2 -0
  57. package/dist/css/css-toast.js +92 -0
  58. package/dist/css/css-tooltip.d.ts +2 -0
  59. package/dist/css/css-tooltip.js +35 -0
  60. package/dist/css/css-utilities.d.ts +1 -0
  61. package/dist/css/css-utilities.js +57 -0
  62. package/dist/css/css-variables.d.ts +2 -0
  63. package/dist/css/css-variables.js +61 -0
  64. package/dist/css/spacing-classes.d.ts +10 -0
  65. package/dist/css/spacing-classes.js +40 -0
  66. package/dist/css/stylesheet.d.ts +3 -0
  67. package/dist/css/stylesheet.js +75 -0
  68. package/dist/index.d.ts +3 -1
  69. package/dist/index.js +2 -1
  70. package/dist/spacing-classes.js +1 -1
  71. package/dist/styles.css +8 -0
  72. package/dist/visibility-classes.d.ts +6 -0
  73. package/dist/visibility-classes.js +7 -0
  74. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @scalewing/react
2
2
 
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 52b45c0: Start stable versioning at 1.0.0. Packages now release independently with semantic versioning.
8
+
9
+ `@scalewing/tokens` no longer contains web CSS. It removes `generateStylesheet`, `utilityClassCatalog`, `buttonClassNames`, `badgeClassNames`, `badgeSizes`, `badgeTones`, `BadgeSize`, `BadgeTone`, `spacingClass`, `PaddingAxis`, `GapAxis`, `paddingAxes`, `gapAxes`, `breakpointScale`, `Breakpoint`, `HideDirection`, `hideClass` (never published), and the `./styles.css` and `./palette/*.css` exports. Web apps keep importing `@scalewing/react/styles.css` and `@scalewing/react/palette/<id>.css`, which are unchanged. `@scalewing/react` now generates that CSS and exports `utilityClassCatalog`, `badgeSizes`, and `badgeTones`.
10
+
11
+ ### Minor Changes
12
+
13
+ - 3a3240e: Add `Box` `hideBelow` and `hideFrom` responsive visibility props backed by a `md` breakpoint token and generated `sw-hide-*` classes.
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [3a3240e]
18
+ - Updated dependencies [52b45c0]
19
+ - @scalewing/tokens@1.0.0
20
+
3
21
  ## 0.7.0
4
22
 
5
23
  ### Minor Changes
package/README.md CHANGED
@@ -42,7 +42,7 @@ import {
42
42
 
43
43
  Import the CSS once at the application entry. Do not copy it into your source tree. Optional: import one `@scalewing/react/palette/<id>.css` file after it, or set `data-palette` on the `data-theme` node. React apps can set `palette` on `ThemeProvider` instead.
44
44
 
45
- `Box as="a"` is a layout link. Use `Button` for press actions. `Field` associates a native `<input>` or `<select>` with a label and token gap; native text controls inherit the generated document canvas. `Select` is a labeled listbox menu when the open list must match the canvas.
45
+ `Box hideBelow="md"` hides a region under 48rem and `hideFrom="md"` hides it at 48rem and wider, so a product can swap a wide layout for a narrow one without its own stylesheet. Hidden regions leave the accessibility tree; do not use this to protect data. `Box as="a"` is a layout link. Use `Button` for press actions. `Field` associates a native `<input>` or `<select>` with a label and token gap; native text controls inherit the generated document canvas. `Select` is a labeled listbox menu when the open list must match the canvas.
46
46
 
47
47
  `Field` supports optional `description`, `error`, and `required` on one native input, select, or textarea child. It preserves an existing `aria-describedby`, appends a stable message ID, and replaces the hint with an alert when an error is supplied. `error` sets `aria-invalid` and token-owned invalid styling. The consumer owns validation and localized messages.
48
48
 
@@ -1,5 +1,6 @@
1
- import { type BadgeSize, type BadgeTone } from '@scalewing/tokens';
1
+ import { type BadgeSize, type BadgeTone, badgeSizes, badgeTones } from '../css/css-data.js';
2
2
  import { type HTMLAttributes, type ReactNode } from 'react';
3
+ export { badgeSizes, badgeTones };
3
4
  export type { BadgeSize, BadgeTone };
4
5
  export type BadgeProps = HTMLAttributes<HTMLSpanElement> & {
5
6
  children: ReactNode;
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { badgeClassNames, } from '@scalewing/tokens';
2
+ import { badgeClassNames, badgeSizes, badgeTones, } from '../css/css-data.js';
3
3
  import { forwardRef } from 'react';
4
4
  import { cx } from '../class-names.js';
5
+ export { badgeSizes, badgeTones };
5
6
  export const Badge = forwardRef(function Badge({ children, className, size = 'md', tone = 'neutral', ...rest }, ref) {
6
7
  return (_jsx("span", { ref: ref, className: cx(...badgeClassNames(tone, size), className), ...rest, children: children }));
7
8
  });
@@ -1,14 +1,15 @@
1
1
  import { type RadiusStep, type SemanticColorKey } from '@scalewing/tokens';
2
2
  import { type AnchorHTMLAttributes, type HTMLAttributes } from 'react';
3
3
  import { type SpacingProps } from '../spacing-classes.js';
4
+ import { type VisibilityProps } from '../visibility-classes.js';
4
5
  export type BoxElement = 'div' | 'section' | 'article' | 'header' | 'footer' | 'main' | 'nav' | 'aside' | 'span' | 'a' | 'label';
5
- export type BoxProps = SpacingProps & HTMLAttributes<HTMLElement> & Pick<AnchorHTMLAttributes<HTMLAnchorElement>, 'download' | 'href' | 'rel' | 'target'> & {
6
+ export type BoxProps = SpacingProps & VisibilityProps & HTMLAttributes<HTMLElement> & Pick<AnchorHTMLAttributes<HTMLAnchorElement>, 'download' | 'href' | 'rel' | 'target'> & {
6
7
  as?: BoxElement;
7
8
  background?: Extract<SemanticColorKey, 'background' | 'surface'>;
8
9
  radius?: RadiusStep;
9
10
  border?: boolean;
10
11
  };
11
- export declare const Box: import("react").ForwardRefExoticComponent<SpacingProps & HTMLAttributes<HTMLElement> & Pick<AnchorHTMLAttributes<HTMLAnchorElement>, "download" | "href" | "rel" | "target"> & {
12
+ export declare const Box: import("react").ForwardRefExoticComponent<SpacingProps & VisibilityProps & HTMLAttributes<HTMLElement> & Pick<AnchorHTMLAttributes<HTMLAnchorElement>, "download" | "href" | "rel" | "target"> & {
12
13
  as?: BoxElement;
13
14
  background?: Extract<SemanticColorKey, "background" | "surface">;
14
15
  radius?: RadiusStep;
@@ -2,7 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { forwardRef, } from 'react';
3
3
  import { cx } from '../class-names.js';
4
4
  import { spacingClassNames } from '../spacing-classes.js';
5
- export const Box = forwardRef(function Box({ as = 'div', background, border, className, padding, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, radius, style, ...rest }, ref) {
5
+ import { visibilityClassNames, } from '../visibility-classes.js';
6
+ export const Box = forwardRef(function Box({ as = 'div', background, border, className, hideBelow, hideFrom, padding, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, radius, style, ...rest }, ref) {
6
7
  const Component = as;
7
8
  return (_jsx(Component, { ref: ref, className: cx(...spacingClassNames({
8
9
  padding,
@@ -12,7 +13,7 @@ export const Box = forwardRef(function Box({ as = 'div', background, border, cla
12
13
  paddingTop,
13
14
  paddingX,
14
15
  paddingY,
15
- }), className), style: {
16
+ }), ...visibilityClassNames({ hideBelow, hideFrom }), className), style: {
16
17
  backgroundColor: background
17
18
  ? `var(--sw-color-${background})`
18
19
  : undefined,
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { buttonClassNames, } from '@scalewing/tokens';
2
+ import { buttonClassNames } from '../css/css-button.js';
3
3
  import { forwardRef } from 'react';
4
4
  import { cx } from '../class-names.js';
5
5
  export const Button = forwardRef(function Button({ children, className, disabled = false, onPress, size = 'md', type = 'button', variant = 'primary', ...rest }, ref) {
@@ -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 Inline({ align = 'center', className, gap = 0, justify = 'start', wrap = false, ...rest }) {
@@ -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 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;