@nswds/ui 9.2.0 → 9.3.1

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 (48) hide show
  1. package/dist/components/breadcrumb.d.ts +1 -1
  2. package/dist/components/breadcrumb.js +5 -4
  3. package/dist/components/breadcrumb.js.map +1 -1
  4. package/dist/components/button-group.js +3 -2
  5. package/dist/components/button-group.js.map +1 -1
  6. package/dist/components/button.d.ts +2 -2
  7. package/dist/components/callout.d.ts +2 -2
  8. package/dist/components/callout.js +4 -3
  9. package/dist/components/callout.js.map +1 -1
  10. package/dist/components/description-list.js +7 -4
  11. package/dist/components/description-list.js.map +1 -1
  12. package/dist/components/expandable-search.js +5 -4
  13. package/dist/components/expandable-search.js.map +1 -1
  14. package/dist/components/footer.d.ts +1 -1
  15. package/dist/components/footer.js +9 -5
  16. package/dist/components/footer.js.map +1 -1
  17. package/dist/components/header.d.ts +1 -1
  18. package/dist/components/header.js +9 -5
  19. package/dist/components/header.js.map +1 -1
  20. package/dist/components/hero.d.ts +2 -2
  21. package/dist/components/hero.js +22 -11
  22. package/dist/components/hero.js.map +1 -1
  23. package/dist/components/input-group.d.ts +1 -1
  24. package/dist/components/link.d.ts +1 -1
  25. package/dist/components/main-nav.d.ts +1 -1
  26. package/dist/components/main-nav.js +9 -5
  27. package/dist/components/main-nav.js.map +1 -1
  28. package/dist/components/masthead.d.ts +1 -1
  29. package/dist/components/masthead.js +8 -4
  30. package/dist/components/masthead.js.map +1 -1
  31. package/dist/components/native-select.js +9 -6
  32. package/dist/components/native-select.js.map +1 -1
  33. package/dist/components/page-header.d.ts +138 -0
  34. package/dist/components/page-header.js +181 -0
  35. package/dist/components/page-header.js.map +1 -0
  36. package/dist/components/select.js +6 -3
  37. package/dist/components/select.js.map +1 -1
  38. package/dist/components/skeleton.js +4 -3
  39. package/dist/components/skeleton.js.map +1 -1
  40. package/dist/components/tabs.js +7 -5
  41. package/dist/components/tabs.js.map +1 -1
  42. package/dist/index.d.ts +1 -0
  43. package/dist/index.js +1 -0
  44. package/dist/lib/resolve-variant.d.ts +23 -0
  45. package/dist/lib/resolve-variant.js +7 -0
  46. package/dist/lib/resolve-variant.js.map +1 -0
  47. package/dist/styles.css +1 -1
  48. package/package.json +5 -4
@@ -1,6 +1,7 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { cva } from 'class-variance-authority';
3
3
  import { IconExpandMore } from '../icons/expand-more.js';
4
+ import { resolveVariant } from '../lib/resolve-variant.js';
4
5
  import { cn } from '../lib/utils.js';
5
6
 
6
7
  const nativeSelectVariants = cva(
@@ -27,6 +28,8 @@ const nativeSelectVariants = cva(
27
28
  }
28
29
  );
29
30
  function NativeSelect({ className, variant, size, ...props }) {
31
+ const variantway = resolveVariant(variant, "default");
32
+ const sizeway = resolveVariant(size, "default");
30
33
  return /* @__PURE__ */ jsxs(
31
34
  "div",
32
35
  {
@@ -35,17 +38,17 @@ function NativeSelect({ className, variant, size, ...props }) {
35
38
  className
36
39
  ),
37
40
  "data-slot": "native-select-wrapper",
38
- "data-size": size ?? "default",
39
- "data-variant": variant ?? "default",
41
+ "data-size": sizeway,
42
+ "data-variant": variantway,
40
43
  children: [
41
44
  /* @__PURE__ */ jsx(
42
45
  "select",
43
46
  {
44
47
  "data-slot": "native-select",
45
- "data-size": size ?? "default",
46
- "data-variant": variant ?? "default",
47
- className: cn(nativeSelectVariants({ variant, size })),
48
- ...props
48
+ ...props,
49
+ "data-size": sizeway,
50
+ "data-variant": variantway,
51
+ className: cn(nativeSelectVariants({ variant: variantway, size: sizeway }))
49
52
  }
50
53
  ),
51
54
  /* @__PURE__ */ jsx(
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/native-select.tsx"],"names":[],"mappings":";;;;;AAMA,MAAM,oBAAA,GAAuB,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM3B,8gBAAA;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OA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AS,CAAA;AAAA,MACvD,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,oBAAA,CAAqB,EAAE,SAAA,EAAW,GAAG,OAAM,EAAqC;AACvF,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,wBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,+BAAA,EAAiC,SAAS,CAAA;AAAA,MACvD,GAAG;AAAA;AAAA,GACN;AAEJ","file":"native-select.js","sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { IconExpandMore } from '../icons/expand-more.js'\nimport { cn } from '../lib/utils.js'\n\nconst nativeSelectVariants = cva(\n // Field foundation shared with Input (input.tsx) and the Select trigger: the\n // same --input-* semantic tokens, 16px text, and an outline-based focus ring.\n // appearance-none hides the native arrow so our chevron shows; no outline-none\n // (it would suppress the focus-visible outline). Dark mode and brand themes\n // restyle via tokens, so there are no dark: variants.\n 'w-full min-w-0 appearance-none rounded-sm text-base text-(--input-foreground) select-none selection:bg-primary selection:text-primary-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--input-ring) disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-2 aria-invalid:border-(--input-invalid-border) aria-invalid:hover:bg-(--input-invalid-surface-hover) aria-invalid:focus-visible:outline-(--input-invalid-ring) motion-safe:transition-colors',\n {\n variants: {\n variant: {\n // Crisp field — bordered white box; matches Input and Select's default.\n default:\n 'border border-(--input-border) bg-(--input-surface) hover:bg-(--input-surface-hover)',\n // Filled band — borderless tinted surface that reveals its border on hover.\n filled: 'border border-transparent bg-secondary hover:border-(--input-border)',\n },\n size: {\n default: 'h-12 ps-4 pe-10',\n sm: 'h-10 ps-3 pe-9',\n },\n },\n defaultVariants: { variant: 'default', size: 'default' },\n },\n)\n\ntype NativeSelectProps = Omit<React.ComponentProps<'select'>, 'size'> &\n VariantProps<typeof nativeSelectVariants>\n\nfunction NativeSelect({ className, variant, size, ...props }: NativeSelectProps) {\n return (\n <div\n className={cn(\n 'group/native-select relative w-fit has-[select:disabled]:opacity-50',\n className,\n )}\n data-slot='native-select-wrapper'\n data-size={size ?? 'default'}\n data-variant={variant ?? 'default'}\n >\n <select\n data-slot='native-select'\n data-size={size ?? 'default'}\n data-variant={variant ?? 'default'}\n className={cn(nativeSelectVariants({ variant, size }))}\n {...props}\n />\n <IconExpandMore\n className='pointer-events-none absolute end-3 top-1/2 size-5 -translate-y-1/2 text-primary select-none'\n aria-hidden='true'\n data-slot='native-select-icon'\n />\n </div>\n )\n}\n\nfunction NativeSelectOption({ className, ...props }: React.ComponentProps<'option'>) {\n return (\n <option\n data-slot='native-select-option'\n className={cn('bg-[Canvas] text-[CanvasText]', className)}\n {...props}\n />\n )\n}\n\nfunction NativeSelectOptGroup({ className, ...props }: React.ComponentProps<'optgroup'>) {\n return (\n <optgroup\n data-slot='native-select-optgroup'\n className={cn('bg-[Canvas] text-[CanvasText]', className)}\n {...props}\n />\n )\n}\n\nexport { NativeSelect, NativeSelectOptGroup, NativeSelectOption, nativeSelectVariants }\n"]}
1
+ {"version":3,"sources":["../../src/components/native-select.tsx"],"names":[],"mappings":";;;;;;AAOA,MAAM,oBAAA,GAAuB,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM3B,8gBAAA;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA;AAAA,QAEP,OAAA,EACE,sFAAA;AAAA;AAAA,QAEF,MAAA,EAAQ;AAAA,OACV;AAAA,MACA,IAAA,EAAM;AAAA,QACJ,OAAA,EAAS,iBAAA;AAAA,QACT,EAAA,EAAI;AAAA;AACN,KACF;AAAA,IACA,eAAA,EAAiB,EAAE,OAAA,EAAS,SAAA,EAAW,MAAM,SAAA;AAAU;AAE3D;AAKA,SAAS,aAAa,EAAE,SAAA,EAAW,SAAS,IAAA,EAAM,GAAG,OAAM,EAAsB;AAG/E,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AW,EAAA,CAAG,+BAAA,EAAiC,SAAS,CAAA;AAAA,MACvD,GAAG;AAAA;AAAA,GACN;AAEJ","file":"native-select.js","sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { IconExpandMore } from '../icons/expand-more.js'\nimport { resolveVariant } from '../lib/resolve-variant.js'\nimport { cn } from '../lib/utils.js'\n\nconst nativeSelectVariants = cva(\n // Field foundation shared with Input (input.tsx) and the Select trigger: the\n // same --input-* semantic tokens, 16px text, and an outline-based focus ring.\n // appearance-none hides the native arrow so our chevron shows; no outline-none\n // (it would suppress the focus-visible outline). Dark mode and brand themes\n // restyle via tokens, so there are no dark: variants.\n 'w-full min-w-0 appearance-none rounded-sm text-base text-(--input-foreground) select-none selection:bg-primary selection:text-primary-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--input-ring) disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-2 aria-invalid:border-(--input-invalid-border) aria-invalid:hover:bg-(--input-invalid-surface-hover) aria-invalid:focus-visible:outline-(--input-invalid-ring) motion-safe:transition-colors',\n {\n variants: {\n variant: {\n // Crisp field — bordered white box; matches Input and Select's default.\n default:\n 'border border-(--input-border) bg-(--input-surface) hover:bg-(--input-surface-hover)',\n // Filled band — borderless tinted surface that reveals its border on hover.\n filled: 'border border-transparent bg-secondary hover:border-(--input-border)',\n },\n size: {\n default: 'h-12 ps-4 pe-10',\n sm: 'h-10 ps-3 pe-9',\n },\n },\n defaultVariants: { variant: 'default', size: 'default' },\n },\n)\n\ntype NativeSelectProps = Omit<React.ComponentProps<'select'>, 'size'> &\n VariantProps<typeof nativeSelectVariants>\n\nfunction NativeSelect({ className, variant, size, ...props }: NativeSelectProps) {\n // Resolved once (see `resolveVariant`), so cva and the four data attributes\n // agree for `null` and `''` as well as the default spelling.\n const variantway = resolveVariant(variant, 'default')\n const sizeway = resolveVariant(size, 'default')\n return (\n <div\n className={cn(\n 'group/native-select relative w-fit has-[select:disabled]:opacity-50',\n className,\n )}\n data-slot='native-select-wrapper'\n data-size={sizeway}\n data-variant={variantway}\n >\n <select\n data-slot='native-select'\n {...props}\n // After the spread, so a consumer's own `data-*` cannot desync the\n // attributes from the classes both derive from the resolved values.\n data-size={sizeway}\n data-variant={variantway}\n className={cn(nativeSelectVariants({ variant: variantway, size: sizeway }))}\n />\n <IconExpandMore\n className='pointer-events-none absolute end-3 top-1/2 size-5 -translate-y-1/2 text-primary select-none'\n aria-hidden='true'\n data-slot='native-select-icon'\n />\n </div>\n )\n}\n\nfunction NativeSelectOption({ className, ...props }: React.ComponentProps<'option'>) {\n return (\n <option\n data-slot='native-select-option'\n className={cn('bg-[Canvas] text-[CanvasText]', className)}\n {...props}\n />\n )\n}\n\nfunction NativeSelectOptGroup({ className, ...props }: React.ComponentProps<'optgroup'>) {\n return (\n <optgroup\n data-slot='native-select-optgroup'\n className={cn('bg-[Canvas] text-[CanvasText]', className)}\n {...props}\n />\n )\n}\n\nexport { NativeSelect, NativeSelectOptGroup, NativeSelectOption, nativeSelectVariants }\n"]}
@@ -0,0 +1,138 @@
1
+ import * as class_variance_authority_types from 'class-variance-authority/types';
2
+ import * as React from 'react';
3
+ import { VariantProps } from 'class-variance-authority';
4
+
5
+ /**
6
+ * The colourways a page header's title box can wear. Each sets two custom
7
+ * properties the slots read: `--page-header-box`, the flat band the title is
8
+ * painted on, and `--page-header-rule`, the colour of the short rule under
9
+ * the standfirst. A third, `--page-header-ink`, is the interactive ink
10
+ * (`primary-800` light / `primary-200` dark, the Role-Flip Rule) and is the
11
+ * same in every colourway: the meta row's hairline is drawn in it, and so is
12
+ * the rule everywhere except `red`, where the rule follows the box. The ink
13
+ * is not declared here: it aliases `--overlay-ink` from `overlayInk`
14
+ * (`src/lib/overlay.ts`), the one declaration Breadcrumb and the overlays
15
+ * share, so a retune of the ink stays one edit (AGENTS.md §3).
16
+ *
17
+ * The box fills are palette steps, not role tokens (AGENTS.md §3, recorded
18
+ * exception): `blue` is `primary-600`, the masterbrand's Blue 02 and the
19
+ * colour the Transport for NSW reference uses, which no semantic role
20
+ * carries — `--primary` is the interactive fill and flips to a brighter
21
+ * blue in dark mode, where a brand band should hold still. White on it
22
+ * measures 4.57:1 (the same step Footer and MainNav record), which clears
23
+ * the 4.5:1 normal-text bar of WCAG 2.2 AA 1.4.3 with almost no headroom;
24
+ * the title being large text (32px and up, semibold), where the bar is 3:1,
25
+ * is the safety net under a retuned palette, not what makes it pass. It is
26
+ * theme-invariant, as `red` (`accent-600`, the waratah red) is; `navy`
27
+ * (`primary-800`, the brand band) lifts one step in dark mode, to
28
+ * `primary-700`, so the box stays distinct from a Header `dark` band above
29
+ * it, which deepens to `primary-950`. That partial flip is deliberate and
30
+ * recorded against DESIGN.md's Whole-Set Flip Rule.
31
+ */
32
+ declare const pageHeaderColors: {
33
+ blue: string;
34
+ navy: string;
35
+ red: string;
36
+ };
37
+ type PageHeaderColor = keyof typeof pageHeaderColors;
38
+ declare const pageHeaderVariants: (props?: ({
39
+ color?: "blue" | "navy" | "red" | null | undefined;
40
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
41
+ /**
42
+ * The inner column, carrying the same lateral rhythm as `Container`, `Hero`
43
+ * and the chrome components (16px → 24px → 48px, funnelled through
44
+ * `--page-header-padding-x`), so the title's text lines up with the Header
45
+ * and Breadcrumb above it. The title box hangs back into that padding by its
46
+ * own horizontal padding, which is why the inset is a property and not a bare
47
+ * utility: a consumer who retunes the column keeps the box on the margin.
48
+ */
49
+ declare const pageHeaderInnerVariants: (props?: ({
50
+ container?: "fluid" | "contained" | null | undefined;
51
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
52
+ type PageHeaderProps = Omit<React.ComponentPropsWithoutRef<'section'>, 'color'> & VariantProps<typeof pageHeaderVariants> & VariantProps<typeof pageHeaderInnerVariants> & {
53
+ /**
54
+ * `id` of the `PageHeaderTitle`. Names the section so it is exposed as a
55
+ * `region` landmark; as with `Section` and `Hero`, no fallback name is
56
+ * invented.
57
+ */
58
+ labelledBy?: string;
59
+ /** Classes applied to the inner column. */
60
+ innerClassName?: string;
61
+ ref?: React.Ref<HTMLElement>;
62
+ };
63
+ /**
64
+ * The opening of a content page: the page title wearing its own flat colour
65
+ * band, one box per wrapped line, then a standfirst and optionally a short
66
+ * rule or a meta row. It sits under the site's Header and Breadcrumb, which
67
+ * are separate components — a page header renders no breadcrumb of its own.
68
+ * For the opening band of a landing page, with actions and an illustration,
69
+ * use `Hero`.
70
+ *
71
+ * Compose it from its slots:
72
+ *
73
+ * ```tsx
74
+ * <PageHeader labelledBy='page-title'>
75
+ * <PageHeaderTitle id='page-title'>Discovery Pass</PageHeaderTitle>
76
+ * <PageHeaderDescription>
77
+ * Get unlimited travel on NSW TrainLink Regional trains and coaches.
78
+ * </PageHeaderDescription>
79
+ * <PageHeaderRule />
80
+ * </PageHeader>
81
+ * ```
82
+ */
83
+ declare function PageHeader({ className, innerClassName, color, container, labelledBy, ref, children, ...props }: PageHeaderProps): React.JSX.Element;
84
+ type PageHeaderTitleProps = React.ComponentPropsWithoutRef<'h1'> & {
85
+ /**
86
+ * The heading element. `1` by default, because a page header opens the
87
+ * page and its title is the page's title; `2` for a header that opens a
88
+ * section of a page whose `h1` sits elsewhere, so the outline stays in
89
+ * order (WCAG 1.3.1).
90
+ */
91
+ headingLevel?: 1 | 2;
92
+ ref?: React.Ref<HTMLHeadingElement>;
93
+ };
94
+ /**
95
+ * The page title on its band. The heading is inline, so the band is drawn
96
+ * per line (`box-decoration-break: clone`) and each box fits its own line's
97
+ * words: a short title is one box, a long one a stack of boxes that touch.
98
+ * Semibold at 48px from `sm:` and 32px below, with the tracking the
99
+ * masterbrand's display setting asks for, and sentence case — the brand sets
100
+ * nothing in uppercase.
101
+ *
102
+ * The box hangs back into the margin by its own horizontal padding, so the
103
+ * TEXT sits on the column, lined up with the breadcrumb above and the body
104
+ * below, and the colour reaches out past it. A block wrapper gives the title
105
+ * its measure (40rem, retuned through `--page-header-title-max-width` like
106
+ * the column's own `--page-header-max-width`), holds the air between it and
107
+ * the breadcrumb above (24px, 16px on a phone), and puts the slots after it
108
+ * on a new line.
109
+ */
110
+ declare function PageHeaderTitle({ className, headingLevel, ref, ...props }: PageHeaderTitleProps): React.JSX.Element;
111
+ type PageHeaderDescriptionProps = React.ComponentPropsWithoutRef<'p'> & {
112
+ ref?: React.Ref<HTMLParagraphElement>;
113
+ };
114
+ /**
115
+ * The standfirst: one or two light sentences under the title, 20/30 at a
116
+ * 62ch measure, stepping to 18px on a phone.
117
+ */
118
+ declare function PageHeaderDescription({ className, ref, ...props }: PageHeaderDescriptionProps): React.JSX.Element;
119
+ type PageHeaderRuleProps = React.ComponentPropsWithoutRef<'div'> & {
120
+ ref?: React.Ref<HTMLDivElement>;
121
+ };
122
+ /**
123
+ * A short rule closing the header, 48×4px in the ink — or, in the `red`
124
+ * colourway, in the box's red. Square-cornered: the brand is flat. Decorative,
125
+ * so it is hidden from assistive technology.
126
+ */
127
+ declare function PageHeaderRule({ className, ref, ...props }: PageHeaderRuleProps): React.JSX.Element;
128
+ type PageHeaderMetaProps = React.ComponentPropsWithoutRef<'div'> & {
129
+ ref?: React.Ref<HTMLDivElement>;
130
+ };
131
+ /**
132
+ * An optional row of facts about the page under a hairline in the ink — when
133
+ * it was last updated, which site it belongs to. Its children are the
134
+ * consumer's `span`s, spread to the row's two ends and stacked on a phone.
135
+ */
136
+ declare function PageHeaderMeta({ className, ref, ...props }: PageHeaderMetaProps): React.JSX.Element;
137
+
138
+ export { PageHeader, type PageHeaderColor, PageHeaderDescription, type PageHeaderDescriptionProps, PageHeaderMeta, type PageHeaderMetaProps, type PageHeaderProps, PageHeaderRule, type PageHeaderRuleProps, PageHeaderTitle, type PageHeaderTitleProps, pageHeaderColors, pageHeaderInnerVariants, pageHeaderVariants };
@@ -0,0 +1,181 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { cva } from 'class-variance-authority';
3
+ import { overlayInk } from '../lib/overlay.js';
4
+ import { resolveVariant } from '../lib/resolve-variant.js';
5
+ import { cn } from '../lib/utils.js';
6
+
7
+ const pageHeaderColors = {
8
+ blue: "[--page-header-box:var(--primary-600)] [--page-header-rule:var(--page-header-ink)]",
9
+ navy: [
10
+ "[--page-header-box:var(--primary-800)] dark:[--page-header-box:var(--primary-700)]",
11
+ "[--page-header-rule:var(--page-header-ink)]"
12
+ ].join(" "),
13
+ red: "[--page-header-box:var(--accent-600)] [--page-header-rule:var(--accent-600)]"
14
+ };
15
+ const DEFAULT_PAGE_HEADER_COLOR = "blue";
16
+ const DEFAULT_PAGE_HEADER_CONTAINER = "fluid";
17
+ const pageHeaderVariants = cva(
18
+ [
19
+ "w-full text-foreground",
20
+ // The interactive ink, flipping for dark mode (DESIGN.md, The Role-Flip
21
+ // Rule), read from the shared declaration rather than restated. The
22
+ // hairline and, outside `red`, the rule read the alias.
23
+ overlayInk,
24
+ "[--page-header-ink:var(--overlay-ink)]"
25
+ ],
26
+ {
27
+ variants: {
28
+ color: pageHeaderColors
29
+ },
30
+ defaultVariants: {
31
+ color: DEFAULT_PAGE_HEADER_COLOR
32
+ }
33
+ }
34
+ );
35
+ const pageHeaderInnerVariants = cva(
36
+ [
37
+ "mx-auto w-full",
38
+ "px-(--page-header-padding-x)",
39
+ "[--page-header-padding-x:--spacing(4)] sm:[--page-header-padding-x:--spacing(6)] lg:[--page-header-padding-x:--spacing(12)]",
40
+ // Vertical rhythm, on the 4px grid: a little air under the breadcrumb,
41
+ // and a full step before the page's first body heading.
42
+ "pt-2 pb-10"
43
+ ],
44
+ {
45
+ variants: {
46
+ container: {
47
+ // Full-bleed, matching the chrome's default. `--page-header-max-width`
48
+ // is still read so a shell app can constrain the column without
49
+ // switching variants.
50
+ fluid: "max-w-[var(--page-header-max-width,none)]",
51
+ // Centred content column, legacy nsw-container parity (1200px).
52
+ contained: "max-w-[var(--page-header-max-width,75rem)]"
53
+ }
54
+ },
55
+ defaultVariants: {
56
+ container: DEFAULT_PAGE_HEADER_CONTAINER
57
+ }
58
+ }
59
+ );
60
+ function PageHeader({
61
+ className,
62
+ innerClassName,
63
+ color,
64
+ container,
65
+ labelledBy,
66
+ ref,
67
+ children,
68
+ ...props
69
+ }) {
70
+ const colorway = resolveVariant(color, DEFAULT_PAGE_HEADER_COLOR);
71
+ const containerway = resolveVariant(container, DEFAULT_PAGE_HEADER_CONTAINER);
72
+ return /* @__PURE__ */ jsx(
73
+ "section",
74
+ {
75
+ ref,
76
+ "data-slot": "page-header",
77
+ "aria-labelledby": labelledBy,
78
+ ...props,
79
+ "data-color": colorway,
80
+ className: cn(pageHeaderVariants({ color: colorway, className })),
81
+ children: /* @__PURE__ */ jsx(
82
+ "div",
83
+ {
84
+ "data-slot": "page-header-inner",
85
+ className: cn(pageHeaderInnerVariants({ container: containerway }), innerClassName),
86
+ children
87
+ }
88
+ )
89
+ }
90
+ );
91
+ }
92
+ function PageHeaderTitle({ className, headingLevel = 1, ref, ...props }) {
93
+ const Heading = `h${headingLevel}`;
94
+ return /* @__PURE__ */ jsx(
95
+ "div",
96
+ {
97
+ "data-slot": "page-header-title-row",
98
+ className: "max-w-[var(--page-header-title-max-width,40rem)] text-balance wrap-break-word max-sm:mt-4 sm:mt-6",
99
+ children: /* @__PURE__ */ jsx(
100
+ Heading,
101
+ {
102
+ ref,
103
+ "data-slot": "page-header-title",
104
+ className: cn(
105
+ // The box colour falls back to `blue`'s step so a title rendered
106
+ // outside a PageHeader (or copied without it) still paints. It is a
107
+ // literal because Tailwind only emits complete class strings; keep
108
+ // it in step with `pageHeaderColors.blue`.
109
+ "inline bg-[var(--page-header-box,var(--primary-600))] box-decoration-clone font-semibold tracking-tight text-white",
110
+ // 1.46 is the line-height at which the boxes of a wrapped title
111
+ // touch with neither a gap nor an overlap — the box is the line box
112
+ // plus the vertical padding, so the two are tuned together for
113
+ // Public Sans' ascent and descent; another `--font-sans` shows a
114
+ // seam or an overlap of a pixel or two between lines.
115
+ "max-sm:text-[2rem]/[1.46] sm:text-5xl/[1.46]",
116
+ "max-sm:px-3 max-sm:py-1 sm:px-4 sm:py-1.5",
117
+ // The hang is capped at the column inset, so a shell app that
118
+ // retunes --page-header-padding-x to 0 gets a box on the column
119
+ // rather than one poking out of the section.
120
+ "max-sm:-ms-[min(--spacing(3),var(--page-header-padding-x))] sm:-ms-[min(--spacing(4),var(--page-header-padding-x))]",
121
+ className
122
+ ),
123
+ ...props
124
+ }
125
+ )
126
+ }
127
+ );
128
+ }
129
+ function PageHeaderDescription({ className, ref, ...props }) {
130
+ return /* @__PURE__ */ jsx(
131
+ "p",
132
+ {
133
+ ref,
134
+ "data-slot": "page-header-description",
135
+ className: cn(
136
+ "max-w-[62ch] font-light text-pretty",
137
+ "max-sm:mt-4 max-sm:text-lg/[1.5] sm:mt-5 sm:text-xl/[1.5]",
138
+ className
139
+ ),
140
+ ...props
141
+ }
142
+ );
143
+ }
144
+ function PageHeaderRule({ className, ref, ...props }) {
145
+ return /* @__PURE__ */ jsx(
146
+ "div",
147
+ {
148
+ ref,
149
+ "aria-hidden": "true",
150
+ "data-slot": "page-header-rule",
151
+ className: cn(
152
+ // Outside a PageHeader the rule takes the text colour, which is
153
+ // theme-correct on its own, rather than a restated ink.
154
+ "h-1 w-12 bg-[var(--page-header-rule,currentColor)] max-sm:mt-6 sm:mt-7",
155
+ className
156
+ ),
157
+ ...props
158
+ }
159
+ );
160
+ }
161
+ function PageHeaderMeta({ className, ref, ...props }) {
162
+ return /* @__PURE__ */ jsx(
163
+ "div",
164
+ {
165
+ ref,
166
+ "data-slot": "page-header-meta",
167
+ className: cn(
168
+ // The hairline falls back to the row's own (muted) text colour when
169
+ // there is no PageHeader ink above it.
170
+ "flex border-t border-[var(--page-header-ink,currentColor)] pt-3 text-muted-foreground",
171
+ "max-sm:mt-6 max-sm:flex-col max-sm:gap-1 sm:mt-9 sm:flex-wrap sm:justify-between sm:gap-4",
172
+ className
173
+ ),
174
+ ...props
175
+ }
176
+ );
177
+ }
178
+
179
+ export { PageHeader, PageHeaderDescription, PageHeaderMeta, PageHeaderRule, PageHeaderTitle, pageHeaderColors, pageHeaderInnerVariants, pageHeaderVariants };
180
+ //# sourceMappingURL=page-header.js.map
181
+ //# sourceMappingURL=page-header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/page-header.tsx"],"names":[],"mappings":";;;;;;AAmCA,MAAM,gBAAA,GAAmB;AAAA,EACvB,IAAA,EAAM,oFAAA;AAAA,EACN,IAAA,EAAM;AAAA,IACJ,oFAAA;AAAA,IACA;AAAA,GACF,CAAE,KAAK,GAAG,CAAA;AAAA,EACV,GAAA,EAAK;AACP;AAIA,MAAM,yBAAA,GAA6C,MAAA;AAEnD,MAAM,6BAAA,GAAgC,OAAA;AAEtC,MAAM,kBAAA,GAAqB,GAAA;AAAA,EACzB;AAAA,IACE,wBAAA;AAAA;AAAA;AAAA;AAAA,IAIA,UAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,KAAA,EAAO;AAAA,KACT;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,KAAA,EAAO;AAAA;AACT;AAEJ;AAUA,MAAM,uBAAA,GAA0B,GAAA;AAAA,EAC9B;AAAA,IACE,gBAAA;AAAA,IACA,8BAAA;AAAA,IACA,6HAAA;AAAA;AAAA;AAAA,IAGA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,SAAA,EAAW;AAAA;AAAA;AAAA;AAAA,QAIT,KAAA,EAAO,2CAAA;AAAA;AAAA,QAEP,SAAA,EAAW;AAAA;AACb,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,SAAA,EAAW;AAAA;AACb;AAEJ;AAsCA,SAAS,UAAA,CAAW;AAAA,EAClB,SAAA;AAAA,EACA,cAAA;AAAA,EACA,KAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,GAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAoB;AAK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AA;AAAA;AACN;AAAA,GACF;AAEJ;AAUA,SAAS,sBAAsB,EAAE,SAAA,EAAW,GAAA,EAAK,GAAG,OAAM,EAA+B;AACvF,EAAA,uBACE,GAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,yBAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,qCAAA;AAAA,QACA,2DAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAWA,SAAS,eAAe,EAAE,SAAA,EAAW,GAAA,EAAK,GAAG,OAAM,EAAwB;AACzE,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,aAAA,EAAY,MAAA;AAAA,MACZ,WAAA,EAAU,kBAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA;AAAA;AAAA,QAGT,wEAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAWA,SAAS,eAAe,EAAE,SAAA,EAAW,GAAA,EAAK,GAAG,OAAM,EAAwB;AACzE,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,kBAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA;AAAA;AAAA,QAGT,uFAAA;AAAA,QACA,2FAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ","file":"page-header.js","sourcesContent":["import type * as React from 'react'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { overlayInk } from '../lib/overlay.js'\nimport { resolveVariant } from '../lib/resolve-variant.js'\nimport { cn } from '../lib/utils.js'\n\n/**\n * The colourways a page header's title box can wear. Each sets two custom\n * properties the slots read: `--page-header-box`, the flat band the title is\n * painted on, and `--page-header-rule`, the colour of the short rule under\n * the standfirst. A third, `--page-header-ink`, is the interactive ink\n * (`primary-800` light / `primary-200` dark, the Role-Flip Rule) and is the\n * same in every colourway: the meta row's hairline is drawn in it, and so is\n * the rule everywhere except `red`, where the rule follows the box. The ink\n * is not declared here: it aliases `--overlay-ink` from `overlayInk`\n * (`src/lib/overlay.ts`), the one declaration Breadcrumb and the overlays\n * share, so a retune of the ink stays one edit (AGENTS.md §3).\n *\n * The box fills are palette steps, not role tokens (AGENTS.md §3, recorded\n * exception): `blue` is `primary-600`, the masterbrand's Blue 02 and the\n * colour the Transport for NSW reference uses, which no semantic role\n * carries — `--primary` is the interactive fill and flips to a brighter\n * blue in dark mode, where a brand band should hold still. White on it\n * measures 4.57:1 (the same step Footer and MainNav record), which clears\n * the 4.5:1 normal-text bar of WCAG 2.2 AA 1.4.3 with almost no headroom;\n * the title being large text (32px and up, semibold), where the bar is 3:1,\n * is the safety net under a retuned palette, not what makes it pass. It is\n * theme-invariant, as `red` (`accent-600`, the waratah red) is; `navy`\n * (`primary-800`, the brand band) lifts one step in dark mode, to\n * `primary-700`, so the box stays distinct from a Header `dark` band above\n * it, which deepens to `primary-950`. That partial flip is deliberate and\n * recorded against DESIGN.md's Whole-Set Flip Rule.\n */\nconst pageHeaderColors = {\n blue: '[--page-header-box:var(--primary-600)] [--page-header-rule:var(--page-header-ink)]',\n navy: [\n '[--page-header-box:var(--primary-800)] dark:[--page-header-box:var(--primary-700)]',\n '[--page-header-rule:var(--page-header-ink)]',\n ].join(' '),\n red: '[--page-header-box:var(--accent-600)] [--page-header-rule:var(--accent-600)]',\n}\n\ntype PageHeaderColor = keyof typeof pageHeaderColors\n\nconst DEFAULT_PAGE_HEADER_COLOR: PageHeaderColor = 'blue'\n// Shared by cva's defaultVariants and the `resolveVariant` call in `PageHeader`.\nconst DEFAULT_PAGE_HEADER_CONTAINER = 'fluid'\n\nconst pageHeaderVariants = cva(\n [\n 'w-full text-foreground',\n // The interactive ink, flipping for dark mode (DESIGN.md, The Role-Flip\n // Rule), read from the shared declaration rather than restated. The\n // hairline and, outside `red`, the rule read the alias.\n overlayInk,\n '[--page-header-ink:var(--overlay-ink)]',\n ],\n {\n variants: {\n color: pageHeaderColors,\n },\n defaultVariants: {\n color: DEFAULT_PAGE_HEADER_COLOR,\n },\n },\n)\n\n/**\n * The inner column, carrying the same lateral rhythm as `Container`, `Hero`\n * and the chrome components (16px → 24px → 48px, funnelled through\n * `--page-header-padding-x`), so the title's text lines up with the Header\n * and Breadcrumb above it. The title box hangs back into that padding by its\n * own horizontal padding, which is why the inset is a property and not a bare\n * utility: a consumer who retunes the column keeps the box on the margin.\n */\nconst pageHeaderInnerVariants = cva(\n [\n 'mx-auto w-full',\n 'px-(--page-header-padding-x)',\n '[--page-header-padding-x:--spacing(4)] sm:[--page-header-padding-x:--spacing(6)] lg:[--page-header-padding-x:--spacing(12)]',\n // Vertical rhythm, on the 4px grid: a little air under the breadcrumb,\n // and a full step before the page's first body heading.\n 'pt-2 pb-10',\n ],\n {\n variants: {\n container: {\n // Full-bleed, matching the chrome's default. `--page-header-max-width`\n // is still read so a shell app can constrain the column without\n // switching variants.\n fluid: 'max-w-[var(--page-header-max-width,none)]',\n // Centred content column, legacy nsw-container parity (1200px).\n contained: 'max-w-[var(--page-header-max-width,75rem)]',\n },\n },\n defaultVariants: {\n container: DEFAULT_PAGE_HEADER_CONTAINER,\n },\n },\n)\n\n// The native `color` attribute is omitted so the prop type admits the `null`\n// cva's `VariantProps` allows and the component resolves.\ntype PageHeaderProps = Omit<React.ComponentPropsWithoutRef<'section'>, 'color'> &\n VariantProps<typeof pageHeaderVariants> &\n VariantProps<typeof pageHeaderInnerVariants> & {\n /**\n * `id` of the `PageHeaderTitle`. Names the section so it is exposed as a\n * `region` landmark; as with `Section` and `Hero`, no fallback name is\n * invented.\n */\n labelledBy?: string\n /** Classes applied to the inner column. */\n innerClassName?: string\n ref?: React.Ref<HTMLElement>\n }\n\n/**\n * The opening of a content page: the page title wearing its own flat colour\n * band, one box per wrapped line, then a standfirst and optionally a short\n * rule or a meta row. It sits under the site's Header and Breadcrumb, which\n * are separate components — a page header renders no breadcrumb of its own.\n * For the opening band of a landing page, with actions and an illustration,\n * use `Hero`.\n *\n * Compose it from its slots:\n *\n * ```tsx\n * <PageHeader labelledBy='page-title'>\n * <PageHeaderTitle id='page-title'>Discovery Pass</PageHeaderTitle>\n * <PageHeaderDescription>\n * Get unlimited travel on NSW TrainLink Regional trains and coaches.\n * </PageHeaderDescription>\n * <PageHeaderRule />\n * </PageHeader>\n * ```\n */\nfunction PageHeader({\n className,\n innerClassName,\n color,\n container,\n labelledBy,\n ref,\n children,\n ...props\n}: PageHeaderProps) {\n // Resolved once (see `resolveVariant`), so cva and `data-color` agree for\n // `null` and `''` as well as the default spelling, and\n // `container={null}` keeps the inner wrapper's max-width class, which reads\n // `--page-header-max-width`, instead of dropping it.\n const colorway = resolveVariant(color, DEFAULT_PAGE_HEADER_COLOR)\n const containerway = resolveVariant(container, DEFAULT_PAGE_HEADER_CONTAINER)\n return (\n <section\n ref={ref}\n data-slot='page-header'\n aria-labelledby={labelledBy}\n {...props}\n // After the spread, so a consumer's own `data-*` cannot desync the\n // attribute from the classes both derive from the resolved value.\n data-color={colorway}\n className={cn(pageHeaderVariants({ color: colorway, className }))}\n >\n <div\n data-slot='page-header-inner'\n className={cn(pageHeaderInnerVariants({ container: containerway }), innerClassName)}\n >\n {children}\n </div>\n </section>\n )\n}\n\ntype PageHeaderTitleProps = React.ComponentPropsWithoutRef<'h1'> & {\n /**\n * The heading element. `1` by default, because a page header opens the\n * page and its title is the page's title; `2` for a header that opens a\n * section of a page whose `h1` sits elsewhere, so the outline stays in\n * order (WCAG 1.3.1).\n */\n headingLevel?: 1 | 2\n ref?: React.Ref<HTMLHeadingElement>\n}\n\n/**\n * The page title on its band. The heading is inline, so the band is drawn\n * per line (`box-decoration-break: clone`) and each box fits its own line's\n * words: a short title is one box, a long one a stack of boxes that touch.\n * Semibold at 48px from `sm:` and 32px below, with the tracking the\n * masterbrand's display setting asks for, and sentence case — the brand sets\n * nothing in uppercase.\n *\n * The box hangs back into the margin by its own horizontal padding, so the\n * TEXT sits on the column, lined up with the breadcrumb above and the body\n * below, and the colour reaches out past it. A block wrapper gives the title\n * its measure (40rem, retuned through `--page-header-title-max-width` like\n * the column's own `--page-header-max-width`), holds the air between it and\n * the breadcrumb above (24px, 16px on a phone), and puts the slots after it\n * on a new line.\n */\nfunction PageHeaderTitle({ className, headingLevel = 1, ref, ...props }: PageHeaderTitleProps) {\n const Heading = `h${headingLevel}` as const\n return (\n <div\n data-slot='page-header-title-row'\n // wrap-break-word so one unbreakable token (a URL, an acronym) wraps\n // inside a 320px viewport instead of pushing past it (WCAG 1.4.10).\n // text-balance lives here, not on the heading: balancing is a property\n // of the block container, and on the inline heading it does nothing.\n className='max-w-[var(--page-header-title-max-width,40rem)] text-balance wrap-break-word max-sm:mt-4 sm:mt-6'\n >\n <Heading\n ref={ref}\n data-slot='page-header-title'\n className={cn(\n // The box colour falls back to `blue`'s step so a title rendered\n // outside a PageHeader (or copied without it) still paints. It is a\n // literal because Tailwind only emits complete class strings; keep\n // it in step with `pageHeaderColors.blue`.\n 'inline bg-[var(--page-header-box,var(--primary-600))] box-decoration-clone font-semibold tracking-tight text-white',\n // 1.46 is the line-height at which the boxes of a wrapped title\n // touch with neither a gap nor an overlap — the box is the line box\n // plus the vertical padding, so the two are tuned together for\n // Public Sans' ascent and descent; another `--font-sans` shows a\n // seam or an overlap of a pixel or two between lines.\n 'max-sm:text-[2rem]/[1.46] sm:text-5xl/[1.46]',\n 'max-sm:px-3 max-sm:py-1 sm:px-4 sm:py-1.5',\n // The hang is capped at the column inset, so a shell app that\n // retunes --page-header-padding-x to 0 gets a box on the column\n // rather than one poking out of the section.\n 'max-sm:-ms-[min(--spacing(3),var(--page-header-padding-x))] sm:-ms-[min(--spacing(4),var(--page-header-padding-x))]',\n className,\n )}\n {...props}\n />\n </div>\n )\n}\n\ntype PageHeaderDescriptionProps = React.ComponentPropsWithoutRef<'p'> & {\n ref?: React.Ref<HTMLParagraphElement>\n}\n\n/**\n * The standfirst: one or two light sentences under the title, 20/30 at a\n * 62ch measure, stepping to 18px on a phone.\n */\nfunction PageHeaderDescription({ className, ref, ...props }: PageHeaderDescriptionProps) {\n return (\n <p\n ref={ref}\n data-slot='page-header-description'\n className={cn(\n 'max-w-[62ch] font-light text-pretty',\n 'max-sm:mt-4 max-sm:text-lg/[1.5] sm:mt-5 sm:text-xl/[1.5]',\n className,\n )}\n {...props}\n />\n )\n}\n\ntype PageHeaderRuleProps = React.ComponentPropsWithoutRef<'div'> & {\n ref?: React.Ref<HTMLDivElement>\n}\n\n/**\n * A short rule closing the header, 48×4px in the ink — or, in the `red`\n * colourway, in the box's red. Square-cornered: the brand is flat. Decorative,\n * so it is hidden from assistive technology.\n */\nfunction PageHeaderRule({ className, ref, ...props }: PageHeaderRuleProps) {\n return (\n <div\n ref={ref}\n aria-hidden='true'\n data-slot='page-header-rule'\n className={cn(\n // Outside a PageHeader the rule takes the text colour, which is\n // theme-correct on its own, rather than a restated ink.\n 'h-1 w-12 bg-[var(--page-header-rule,currentColor)] max-sm:mt-6 sm:mt-7',\n className,\n )}\n {...props}\n />\n )\n}\n\ntype PageHeaderMetaProps = React.ComponentPropsWithoutRef<'div'> & {\n ref?: React.Ref<HTMLDivElement>\n}\n\n/**\n * An optional row of facts about the page under a hairline in the ink — when\n * it was last updated, which site it belongs to. Its children are the\n * consumer's `span`s, spread to the row's two ends and stacked on a phone.\n */\nfunction PageHeaderMeta({ className, ref, ...props }: PageHeaderMetaProps) {\n return (\n <div\n ref={ref}\n data-slot='page-header-meta'\n className={cn(\n // The hairline falls back to the row's own (muted) text colour when\n // there is no PageHeader ink above it.\n 'flex border-t border-[var(--page-header-ink,currentColor)] pt-3 text-muted-foreground',\n 'max-sm:mt-6 max-sm:flex-col max-sm:gap-1 sm:mt-9 sm:flex-wrap sm:justify-between sm:gap-4',\n className,\n )}\n {...props}\n />\n )\n}\n\nexport {\n PageHeader,\n pageHeaderColors,\n PageHeaderDescription,\n pageHeaderInnerVariants,\n PageHeaderMeta,\n PageHeaderRule,\n PageHeaderTitle,\n pageHeaderVariants,\n}\nexport type {\n PageHeaderColor,\n PageHeaderDescriptionProps,\n PageHeaderMetaProps,\n PageHeaderProps,\n PageHeaderRuleProps,\n PageHeaderTitleProps,\n}\n"]}
@@ -6,6 +6,7 @@ import { IconCheck } from '../icons/check.js';
6
6
  import { IconExpandLess } from '../icons/expand-less.js';
7
7
  import { IconExpandMore } from '../icons/expand-more.js';
8
8
  import { ButtonGroupBoundary } from '../lib/button-group-context.js';
9
+ import { resolveVariant } from '../lib/resolve-variant.js';
9
10
  import { cn } from '../lib/utils.js';
10
11
 
11
12
  const Select = Select$1.Root;
@@ -68,14 +69,16 @@ function SelectTrigger({
68
69
  children,
69
70
  ...props
70
71
  }) {
72
+ const variantway = resolveVariant(variant, "default");
73
+ const sizeway = resolveVariant(size, "default");
71
74
  return /* @__PURE__ */ jsxs(
72
75
  Select$1.Trigger,
73
76
  {
74
77
  "data-slot": "select-trigger",
75
- "data-size": size ?? "default",
76
- "data-variant": variant ?? "default",
77
- className: cn(selectTriggerVariants({ variant, size, className })),
78
78
  ...props,
79
+ "data-size": sizeway,
80
+ "data-variant": variantway,
81
+ className: cn(selectTriggerVariants({ variant: variantway, size: sizeway, className })),
79
82
  children: [
80
83
  children,
81
84
  /* @__PURE__ */ jsx(
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/select.tsx"],"names":["SelectPrimitive"],"mappings":";;;;;;;;;AAYA,MAAM,SAASA,QAAA,CAAgB;AAE/B,SAAS,WAAA,CAAY,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACzE,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,KAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,iBAAA,EAAmB,SAAS,CAAA;AAAA,MACzC,GAAG;AAAA;AAAA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C,WAAA,EAAU,yBAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,0HAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEJ,8BAAC,cAAA,EAAA,EAAe;AAAA;AAAA,GAClB;AAEJ;AAEA,SAAS,sBAAA,CAAuB;AAAA,EAC9B,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAiE;AAC/D,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,eAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,2BAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,6HAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEJ,8BAAC,cAAA,EAAA,EAAe;AAAA;AAAA,GAClB;AAEJ","file":"select.js","sourcesContent":["'use client'\n\nimport { Select as SelectPrimitive } from '@base-ui/react/select'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { IconCheck } from '../icons/check.js'\nimport { IconExpandLess } from '../icons/expand-less.js'\nimport { IconExpandMore } from '../icons/expand-more.js'\nimport { ButtonGroupBoundary } from '../lib/button-group-context.js'\nimport { cn } from '../lib/utils.js'\n\nconst Select = SelectPrimitive.Root\n\nfunction SelectGroup({ className, ...props }: SelectPrimitive.Group.Props) {\n return (\n <SelectPrimitive.Group\n data-slot='select-group'\n className={cn('scroll-my-1 p-1', className)}\n {...props}\n />\n )\n}\n\nfunction SelectValue({ className, ...props }: SelectPrimitive.Value.Props) {\n return (\n <SelectPrimitive.Value\n data-slot='select-value'\n className={cn('flex flex-1 text-start', className)}\n {...props}\n />\n )\n}\n\nconst selectTriggerVariants = cva(\n // Field foundation shared with Input (input.tsx): the same --input-* semantic\n // tokens, 16px text, and an outline-based focus ring. No `outline-none` here —\n // it sets --tw-outline-style:none on the element and would suppress the focus\n // outline below. Dark mode and brand themes restyle via tokens, so there are\n // no dark: variants.\n //\n // Focus is `focus:`, not the `focus-visible:` Input uses — like Button, and\n // for the same reason (see button.tsx). This trigger is a <button>, and a\n // button focused by MOUSE does not match :focus-visible, so on a pointer click\n // the ring never painted. A native <select> DOES match :focus-visible on click\n // (the browser's form-control heuristic), which is why NativeSelect keeps\n // focus-visible; this custom trigger cannot, so `focus:` rings on click too and\n // the control reads as focused like the rest of the field family. Do not\n // \"unify\" it back to focus-visible.\n \"flex w-fit items-center justify-between gap-2 rounded-sm text-base whitespace-nowrap text-(--input-foreground) focus:outline focus:outline-2 focus:outline-offset-2 focus:outline-(--input-ring) disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-2 aria-invalid:border-(--input-invalid-border) aria-invalid:hover:bg-(--input-invalid-surface-hover) aria-invalid:focus:outline-(--input-invalid-ring) data-placeholder:text-(--input-placeholder) *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 motion-safe:transition-colors [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n variant: {\n // Crisp field — bordered white box; the default, matches Input exactly.\n default:\n 'border border-(--input-border) bg-(--input-surface) hover:bg-(--input-surface-hover)',\n // Filled band — borderless tinted surface that reveals its border on hover.\n filled: 'border border-transparent bg-secondary hover:border-(--input-border)',\n },\n size: {\n default: 'h-12 px-4 py-2',\n sm: 'h-10 px-3 py-1.5',\n },\n },\n defaultVariants: { variant: 'default', size: 'default' },\n },\n)\n\nfunction SelectTrigger({\n className,\n variant,\n size,\n children,\n ...props\n}: SelectPrimitive.Trigger.Props & VariantProps<typeof selectTriggerVariants>) {\n return (\n <SelectPrimitive.Trigger\n data-slot='select-trigger'\n data-size={size ?? 'default'}\n data-variant={variant ?? 'default'}\n className={cn(selectTriggerVariants({ variant, size, className }))}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon\n render={<IconExpandMore className='pointer-events-none size-5 text-primary' />}\n />\n </SelectPrimitive.Trigger>\n )\n}\n\nfunction SelectContent({\n className,\n children,\n side = 'bottom',\n sideOffset = 4,\n align = 'center',\n alignOffset = 0,\n alignItemWithTrigger = true,\n ...props\n}: SelectPrimitive.Popup.Props &\n Pick<\n SelectPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset' | 'alignItemWithTrigger'\n >) {\n return (\n <SelectPrimitive.Portal>\n {/* Stops a ButtonGroup's context at the portal — see ButtonGroupBoundary. */}\n <ButtonGroupBoundary>\n <SelectPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n alignItemWithTrigger={alignItemWithTrigger}\n className='isolate z-50'\n >\n <SelectPrimitive.Popup\n data-slot='select-content'\n data-align-trigger={alignItemWithTrigger}\n className={cn(\n 'relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n className,\n )}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.List>{children}</SelectPrimitive.List>\n <SelectScrollDownButton />\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </ButtonGroupBoundary>\n </SelectPrimitive.Portal>\n )\n}\n\nfunction SelectLabel({ className, ...props }: SelectPrimitive.GroupLabel.Props) {\n return (\n <SelectPrimitive.GroupLabel\n data-slot='select-label'\n className={cn('px-4 py-2 text-base font-semibold text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nfunction SelectItem({ className, children, ...props }: SelectPrimitive.Item.Props) {\n return (\n <SelectPrimitive.Item\n data-slot='select-item'\n className={cn(\n \"relative flex min-h-11 w-full cursor-default items-center gap-2 rounded-sm py-2 ps-4 pe-9 text-base outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2\",\n className,\n )}\n {...props}\n >\n <SelectPrimitive.ItemText className='flex flex-1 shrink-0 gap-2 whitespace-nowrap'>\n {children}\n </SelectPrimitive.ItemText>\n <SelectPrimitive.ItemIndicator\n render={\n <span className='pointer-events-none absolute end-2 flex items-center justify-center' />\n }\n >\n <IconCheck className='pointer-events-none' />\n </SelectPrimitive.ItemIndicator>\n </SelectPrimitive.Item>\n )\n}\n\nfunction SelectSeparator({ className, ...props }: SelectPrimitive.Separator.Props) {\n return (\n <SelectPrimitive.Separator\n data-slot='select-separator'\n className={cn('pointer-events-none -mx-1 my-1 h-px bg-border/50', className)}\n {...props}\n />\n )\n}\n\nfunction SelectScrollUpButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollUpArrow>) {\n return (\n <SelectPrimitive.ScrollUpArrow\n data-slot='select-scroll-up-button'\n className={cn(\n \"top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5\",\n className,\n )}\n {...props}\n >\n <IconExpandLess />\n </SelectPrimitive.ScrollUpArrow>\n )\n}\n\nfunction SelectScrollDownButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollDownArrow>) {\n return (\n <SelectPrimitive.ScrollDownArrow\n data-slot='select-scroll-down-button'\n className={cn(\n \"bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5\",\n className,\n )}\n {...props}\n >\n <IconExpandMore />\n </SelectPrimitive.ScrollDownArrow>\n )\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n selectTriggerVariants,\n SelectValue,\n}\n"]}
1
+ {"version":3,"sources":["../../src/components/select.tsx"],"names":["SelectPrimitive"],"mappings":";;;;;;;;;;AAaA,MAAM,SAASA,QAAA,CAAgB;AAE/B,SAAS,WAAA,CAAY,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACzE,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,KAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,iBAAA,EAAmB,SAAS,CAAA;AAAA,MACzC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,WAAA,CAAY,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACzE,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,KAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,wBAAA,EAA0B,SAAS,CAAA;AAAA,MAChD,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,MAAM,qBAAA,GAAwB,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAe5B,uuBAAA;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA;AAAA,QAEP,OAAA,EACE,sFAAA;AAAA;AAAA,QAEF,MAAA,EAAQ;AAAA,OACV;AAAA,MACA,IAAA,EAAM;AAAA,QACJ,OAAA,EAAS,gBAAA;AAAA,QACT,EAAA,EAAI;AAAA;AACN,KACF;AAAA,IACA,eAAA,EAAiB,EAAE,OAAA,EAAS,SAAA,EAAW,MAAM,SAAA;AA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base-ui/react/select'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { IconCheck } from '../icons/check.js'\nimport { IconExpandLess } from '../icons/expand-less.js'\nimport { IconExpandMore } from '../icons/expand-more.js'\nimport { ButtonGroupBoundary } from '../lib/button-group-context.js'\nimport { resolveVariant } from '../lib/resolve-variant.js'\nimport { cn } from '../lib/utils.js'\n\nconst Select = SelectPrimitive.Root\n\nfunction SelectGroup({ className, ...props }: SelectPrimitive.Group.Props) {\n return (\n <SelectPrimitive.Group\n data-slot='select-group'\n className={cn('scroll-my-1 p-1', className)}\n {...props}\n />\n )\n}\n\nfunction SelectValue({ className, ...props }: SelectPrimitive.Value.Props) {\n return (\n <SelectPrimitive.Value\n data-slot='select-value'\n className={cn('flex flex-1 text-start', className)}\n {...props}\n />\n )\n}\n\nconst selectTriggerVariants = cva(\n // Field foundation shared with Input (input.tsx): the same --input-* semantic\n // tokens, 16px text, and an outline-based focus ring. No `outline-none` here —\n // it sets --tw-outline-style:none on the element and would suppress the focus\n // outline below. Dark mode and brand themes restyle via tokens, so there are\n // no dark: variants.\n //\n // Focus is `focus:`, not the `focus-visible:` Input uses — like Button, and\n // for the same reason (see button.tsx). This trigger is a <button>, and a\n // button focused by MOUSE does not match :focus-visible, so on a pointer click\n // the ring never painted. A native <select> DOES match :focus-visible on click\n // (the browser's form-control heuristic), which is why NativeSelect keeps\n // focus-visible; this custom trigger cannot, so `focus:` rings on click too and\n // the control reads as focused like the rest of the field family. Do not\n // \"unify\" it back to focus-visible.\n \"flex w-fit items-center justify-between gap-2 rounded-sm text-base whitespace-nowrap text-(--input-foreground) focus:outline focus:outline-2 focus:outline-offset-2 focus:outline-(--input-ring) disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-2 aria-invalid:border-(--input-invalid-border) aria-invalid:hover:bg-(--input-invalid-surface-hover) aria-invalid:focus:outline-(--input-invalid-ring) data-placeholder:text-(--input-placeholder) *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 motion-safe:transition-colors [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n variant: {\n // Crisp field — bordered white box; the default, matches Input exactly.\n default:\n 'border border-(--input-border) bg-(--input-surface) hover:bg-(--input-surface-hover)',\n // Filled band — borderless tinted surface that reveals its border on hover.\n filled: 'border border-transparent bg-secondary hover:border-(--input-border)',\n },\n size: {\n default: 'h-12 px-4 py-2',\n sm: 'h-10 px-3 py-1.5',\n },\n },\n defaultVariants: { variant: 'default', size: 'default' },\n },\n)\n\nfunction SelectTrigger({\n className,\n variant,\n size,\n children,\n ...props\n}: SelectPrimitive.Trigger.Props & VariantProps<typeof selectTriggerVariants>) {\n // Resolved once (see `resolveVariant`), so cva and the data attributes\n // agree for `null` and `''` as well as the default spelling.\n const variantway = resolveVariant(variant, 'default')\n const sizeway = resolveVariant(size, 'default')\n return (\n <SelectPrimitive.Trigger\n data-slot='select-trigger'\n {...props}\n // After the spread, so a consumer's own `data-*` cannot desync the\n // attribute from the classes both derive from the resolved value.\n data-size={sizeway}\n data-variant={variantway}\n className={cn(selectTriggerVariants({ variant: variantway, size: sizeway, className }))}\n >\n {children}\n <SelectPrimitive.Icon\n render={<IconExpandMore className='pointer-events-none size-5 text-primary' />}\n />\n </SelectPrimitive.Trigger>\n )\n}\n\nfunction SelectContent({\n className,\n children,\n side = 'bottom',\n sideOffset = 4,\n align = 'center',\n alignOffset = 0,\n alignItemWithTrigger = true,\n ...props\n}: SelectPrimitive.Popup.Props &\n Pick<\n SelectPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset' | 'alignItemWithTrigger'\n >) {\n return (\n <SelectPrimitive.Portal>\n {/* Stops a ButtonGroup's context at the portal — see ButtonGroupBoundary. */}\n <ButtonGroupBoundary>\n <SelectPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n alignItemWithTrigger={alignItemWithTrigger}\n className='isolate z-50'\n >\n <SelectPrimitive.Popup\n data-slot='select-content'\n data-align-trigger={alignItemWithTrigger}\n className={cn(\n 'relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n className,\n )}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.List>{children}</SelectPrimitive.List>\n <SelectScrollDownButton />\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </ButtonGroupBoundary>\n </SelectPrimitive.Portal>\n )\n}\n\nfunction SelectLabel({ className, ...props }: SelectPrimitive.GroupLabel.Props) {\n return (\n <SelectPrimitive.GroupLabel\n data-slot='select-label'\n className={cn('px-4 py-2 text-base font-semibold text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nfunction SelectItem({ className, children, ...props }: SelectPrimitive.Item.Props) {\n return (\n <SelectPrimitive.Item\n data-slot='select-item'\n className={cn(\n \"relative flex min-h-11 w-full cursor-default items-center gap-2 rounded-sm py-2 ps-4 pe-9 text-base outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2\",\n className,\n )}\n {...props}\n >\n <SelectPrimitive.ItemText className='flex flex-1 shrink-0 gap-2 whitespace-nowrap'>\n {children}\n </SelectPrimitive.ItemText>\n <SelectPrimitive.ItemIndicator\n render={\n <span className='pointer-events-none absolute end-2 flex items-center justify-center' />\n }\n >\n <IconCheck className='pointer-events-none' />\n </SelectPrimitive.ItemIndicator>\n </SelectPrimitive.Item>\n )\n}\n\nfunction SelectSeparator({ className, ...props }: SelectPrimitive.Separator.Props) {\n return (\n <SelectPrimitive.Separator\n data-slot='select-separator'\n className={cn('pointer-events-none -mx-1 my-1 h-px bg-border/50', className)}\n {...props}\n />\n )\n}\n\nfunction SelectScrollUpButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollUpArrow>) {\n return (\n <SelectPrimitive.ScrollUpArrow\n data-slot='select-scroll-up-button'\n className={cn(\n \"top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5\",\n className,\n )}\n {...props}\n >\n <IconExpandLess />\n </SelectPrimitive.ScrollUpArrow>\n )\n}\n\nfunction SelectScrollDownButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollDownArrow>) {\n return (\n <SelectPrimitive.ScrollDownArrow\n data-slot='select-scroll-down-button'\n className={cn(\n \"bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5\",\n className,\n )}\n {...props}\n >\n <IconExpandMore />\n </SelectPrimitive.ScrollDownArrow>\n )\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n selectTriggerVariants,\n SelectValue,\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { cva } from 'class-variance-authority';
3
+ import { resolveVariant } from '../lib/resolve-variant.js';
3
4
  import { cn } from '../lib/utils.js';
4
5
 
5
6
  const skeletonVariants = cva("motion-safe:animate-pulse", {
@@ -17,14 +18,14 @@ function Skeleton({
17
18
  variant,
18
19
  ...props
19
20
  }) {
20
- const look = variant ?? "default";
21
+ const look = resolveVariant(variant, "default");
21
22
  return /* @__PURE__ */ jsx(
22
23
  "div",
23
24
  {
24
25
  "data-slot": "skeleton",
26
+ ...props,
25
27
  "data-variant": look,
26
- className: cn(skeletonVariants({ variant: look, className })),
27
- ...props
28
+ className: cn(skeletonVariants({ variant: look, className }))
28
29
  }
29
30
  );
30
31
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/skeleton.tsx"],"names":[],"mappings":";;;;AAkBA,MAAM,gBAAA,GAAmB,IAAI,2BAAA,EAA6B;AAAA,EACxD,QAAA,EAAU;AAAA,IACR,OAAA,EAAS;AAAA,MACP,OAAA,EAAS,6BAAA;AAAA,MACT,IAAA,EAAM,+BAAA;AAAA,MACN,IAAA,EAAM;AAAA;AACR,GACF;AAAA,EACA,eAAA,EAAiB,EAAE,OAAA,EAAS,SAAA;AAC9B,CAAC;AAYD,SAAS,QAAA,CAAS;AAAA,EAChB,SAAA;AAAA,EACA,OAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAwE;AAGtE,EAAA,MAAM,OAAO,OAAA,IAAW,SAAA;AACxB,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,UAAA;AAAA,MACV,cAAA,EAAc,IAAA;AAAA,MACd,SAAA,EAAW,GAAG,gBAAA,CAAiB,EAAE,SAAS,IAAA,EAAM,SAAA,EAAW,CAAC,CAAA;AAAA,MAC3D,GAAG;AAAA;AAAA,GACN;AAEJ","file":"skeleton.js","sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { cn } from '../lib/utils.js'\n\n/**\n * The three approved looks (design-shotgun, overlays-20260923), matching the\n * `variant` of Dialog, AlertDialog and DropdownMenu so a loading state can\n * wear the same family as the surface around it:\n *\n * - `default` (Hairline): a filled block, 8px corners.\n * - `band`: a square-cornered band.\n * - `rule`: an outlined block in the strong border colour, no fill.\n *\n * The fills are the ink at 10–12%, not `bg-muted`: in dark mode `--muted` and\n * `--background` resolve to the same token, so a muted block vanishes on the\n * page, while an ink tint reads on the page, a card and a popover alike.\n */\nconst skeletonVariants = cva('motion-safe:animate-pulse', {\n variants: {\n variant: {\n default: 'rounded-md bg-foreground/10',\n band: 'rounded-none bg-foreground/12',\n rule: 'rounded-sm border border-(--border-strong) bg-transparent',\n },\n },\n defaultVariants: { variant: 'default' },\n})\n\n/**\n * A placeholder block shown where content is still loading. Size it with\n * utilities (`h-4 w-48`, `size-12 rounded-full`) to echo the shape of what\n * will replace it.\n *\n * It is purely visual, so announce the wait yourself: put `aria-busy=\"true\"`\n * on the region being loaded, and give screen-reader users a text status\n * (a visually hidden \"Loading…\") rather than relying on these shapes. The\n * pulse only runs under `prefers-reduced-motion: no-preference`.\n */\nfunction Skeleton({\n className,\n variant,\n ...props\n}: React.ComponentProps<'div'> & VariantProps<typeof skeletonVariants>) {\n // Coalesce before cva: it treats `null` as \"no variant\" and skips the\n // default, which would leave the block with no fill at all.\n const look = variant ?? 'default'\n return (\n <div\n data-slot='skeleton'\n data-variant={look}\n className={cn(skeletonVariants({ variant: look, className }))}\n {...props}\n />\n )\n}\n\nexport { Skeleton, skeletonVariants }\n"]}
1
+ {"version":3,"sources":["../../src/components/skeleton.tsx"],"names":[],"mappings":";;;;;AAmBA,MAAM,gBAAA,GAAmB,IAAI,2BAAA,EAA6B;AAAA,EACxD,QAAA,EAAU;AAAA,IACR,OAAA,EAAS;AAAA,MACP,OAAA,EAAS,6BAAA;AAAA,MACT,IAAA,EAAM,+BAAA;AAAA,MACN,IAAA,EAAM;AAAA;AACR,GACF;AAAA,EACA,eAAA,EAAiB,EAAE,OAAA,EAAS,SAAA;AAC9B,CAAC;AAYD,SAAS,QAAA,CAAS;AAAA,EAChB,SAAA;AAAA,EACA,OAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAwE;AAGtE,EAAA,MAAM,IAAA,GAAO,cAAA,CAAe,OAAA,EAAS,SAAS,CAAA;AAC9C,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,UAAA;AAAA,MACT,GAAG,KAAA;AAAA,MAGJ,cAAA,EAAc,IAAA;AAAA,MACd,SAAA,EAAW,GAAG,gBAAA,CAAiB,EAAE,SAAS,IAAA,EAAM,SAAA,EAAW,CAAC;AAAA;AAAA,GAC9D;AAEJ","file":"skeleton.js","sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { resolveVariant } from '../lib/resolve-variant.js'\nimport { cn } from '../lib/utils.js'\n\n/**\n * The three approved looks (design-shotgun, overlays-20260923), matching the\n * `variant` of Dialog, AlertDialog and DropdownMenu so a loading state can\n * wear the same family as the surface around it:\n *\n * - `default` (Hairline): a filled block, 8px corners.\n * - `band`: a square-cornered band.\n * - `rule`: an outlined block in the strong border colour, no fill.\n *\n * The fills are the ink at 10–12%, not `bg-muted`: in dark mode `--muted` and\n * `--background` resolve to the same token, so a muted block vanishes on the\n * page, while an ink tint reads on the page, a card and a popover alike.\n */\nconst skeletonVariants = cva('motion-safe:animate-pulse', {\n variants: {\n variant: {\n default: 'rounded-md bg-foreground/10',\n band: 'rounded-none bg-foreground/12',\n rule: 'rounded-sm border border-(--border-strong) bg-transparent',\n },\n },\n defaultVariants: { variant: 'default' },\n})\n\n/**\n * A placeholder block shown where content is still loading. Size it with\n * utilities (`h-4 w-48`, `size-12 rounded-full`) to echo the shape of what\n * will replace it.\n *\n * It is purely visual, so announce the wait yourself: put `aria-busy=\"true\"`\n * on the region being loaded, and give screen-reader users a text status\n * (a visually hidden \"Loading…\") rather than relying on these shapes. The\n * pulse only runs under `prefers-reduced-motion: no-preference`.\n */\nfunction Skeleton({\n className,\n variant,\n ...props\n}: React.ComponentProps<'div'> & VariantProps<typeof skeletonVariants>) {\n // Resolved once (see `resolveVariant`): cva treats `null` as \"no variant\"\n // and skips the default, which would leave the block with no fill at all.\n const look = resolveVariant(variant, 'default')\n return (\n <div\n data-slot='skeleton'\n {...props}\n // After the spread, so a consumer's own `data-*` cannot desync the\n // attribute from the classes both derive from the resolved value.\n data-variant={look}\n className={cn(skeletonVariants({ variant: look, className }))}\n />\n )\n}\n\nexport { Skeleton, skeletonVariants }\n"]}
@@ -3,6 +3,7 @@ import { jsx } from 'react/jsx-runtime';
3
3
  import { Tabs as Tabs$1 } from '@base-ui/react/tabs';
4
4
  import { cva } from 'class-variance-authority';
5
5
  import * as React from 'react';
6
+ import { resolveVariant } from '../lib/resolve-variant.js';
6
7
  import { cn } from '../lib/utils.js';
7
8
 
8
9
  function Tabs({ className, orientation = "horizontal", ...props }) {
@@ -51,16 +52,17 @@ const tabsListVariants = cva("group/tabs-list flex items-center text-muted-foreg
51
52
  const TabsListContext = React.createContext("default");
52
53
  function TabsList({
53
54
  className,
54
- variant = "default",
55
+ variant,
55
56
  ...props
56
57
  }) {
57
- return /* @__PURE__ */ jsx(TabsListContext.Provider, { value: variant ?? "default", children: /* @__PURE__ */ jsx(
58
+ const look = resolveVariant(variant, "default");
59
+ return /* @__PURE__ */ jsx(TabsListContext.Provider, { value: look, children: /* @__PURE__ */ jsx(
58
60
  Tabs$1.List,
59
61
  {
60
62
  "data-slot": "tabs-list",
61
- "data-variant": variant,
62
- className: cn(tabsListVariants({ variant }), className),
63
- ...props
63
+ ...props,
64
+ "data-variant": look,
65
+ className: cn(tabsListVariants({ variant: look }), className)
64
66
  }
65
67
  ) });
66
68
  }