@sereno-ds/ui 0.44.0 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -39,6 +39,9 @@ These components carry a class the stylesheet's state rules hang on:
39
39
  | the actions of `AvatarUpload` | `sereno-menuitem` | |
40
40
  | the collapse control of `SidebarNav` | `sereno-sidenav-toggle` | |
41
41
  | `Input` (its row), `Textarea`, the boxes of `Select`, `DatePicker` and `Autocomplete` | `sereno-field` | `data-active` while a popup is open |
42
+ | `Switch` | `sereno-switch` on the track, `sereno-switch-thumb` on the thumb | |
43
+ | each segment of a `Stepper` | `sereno-step` | `data-state` is `done`, `active` or `todo` |
44
+ | `Card` | `sereno-card` | `data-selected` when `selected` |
42
45
 
43
46
  The state rules have the specificity of `.sereno-btn:hover` (one class and one pseudo-class), so a rule of yours with the same specificity **that comes later** wins, with no `!important`:
44
47
 
@@ -55,6 +58,10 @@ Or change what the DS reads, on the element itself (the component reads `--inter
55
58
 
56
59
  The class names and the `data-` attributes are the styling hooks. The `--sd-*` custom properties are how the component hands its values to the stylesheet and are **not** a public API: restyle with the rules above, not by setting them.
57
60
 
61
+ #### High contrast (forced colors)
62
+
63
+ In Windows High Contrast (`forced-colors: active`) the browser replaces every colour with a system one and drops every `box-shadow`. `styles.css` has a block for that mode: the keyboard focus of `Button`, `IconButton`, `Card`, `ActionCard`, `Switch` and the text fields is drawn as a `Highlight` outline, and the `Switch` is drawn with a border and system fills (it has no other way to show up). Current, selected and checked states survive too: the current page of a `Pagination`, the current item of a `SidebarNav` or `BottomNav`, a selected `Tab` (an underline), a selected `Table` row and a selected `Card` or `ActionCard` (a heavier border in the selection colour), the segments of a `Stepper` (system fills) and a checked `Checkbox` or `Radio` (filled, with the mark drawn in the matching text colour). Nothing there applies outside forced colors, and a rule of your own on those classes still wins by coming later. If you restyle a focus ring or a selected state as a shadow or a fill, do the same for forced colors; and never put a `Highlight` fill behind text, the browser draws a box behind the letters in this mode.
64
+
58
65
  ### 2. Provide the fonts
59
66
 
60
67
  Components reference three font CSS variables. Define them however you host fonts; the tokens already carry a system fallback, so text renders without them, just off-brand.
@@ -50,12 +50,9 @@ function ActionCard({
50
50
  textAlign: "left",
51
51
  fontFamily: "var(--font-body)",
52
52
  color: "inherit",
53
- border: "none",
54
53
  borderRadius: "var(--radius-card)",
55
54
  cursor: disabled ? "not-allowed" : "pointer",
56
55
  transition: "var(--transition-control)",
57
- // The focus ring is the box-shadow of `.sereno-action:focus-visible`, the same substitute `Button` and `Card` use.
58
- outline: "none",
59
56
  ...style
60
57
  }),
61
58
  children: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/ActionCard.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ChevronRight } from 'lucide-react';\nimport { sx } from '../_internal/style';\nimport { Typography } from './Typography';\n\nexport type ActionCardVariant = 'default' | 'primary' | 'error';\n\n/**\n * A whole card you press: an icon, a title, a line of explanation and an arrow, in a real\n * `<button>`. For the options of a decision (\"Reschedule\", \"Cancel the booking\") and for the\n * entries of a settings flow. A `Card` with `interactive` is the bare surface; this is the\n * finished control, with the keyboard, the focus ring and the disabled state taken care of.\n *\n * It is an action, not a radio: arrow keys do not move between cards. `selected` marks a card as\n * a toggle (`aria-pressed`); for \"choose exactly one of these\" the semantics are a radio group's,\n * which this is not.\n */\nexport interface ActionCardProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'title' | 'children'> {\n /** What the card does. Short: it is the name a screen reader says. */\n title: React.ReactNode;\n /** One line that says what happens. */\n description?: React.ReactNode;\n /** An icon (a `lucide-react` element), drawn in a tile on the left. Hidden from a screen reader: the title says it. */\n icon?: React.ReactNode;\n /** What sits on the right. An arrow by default; any node, or `null` for nothing. */\n trailing?: React.ReactNode;\n /**\n * Passing it (true or false) makes the card a toggle: it reports `aria-pressed` and, when true,\n * wears the brand ring. Leave it out for a plain action.\n */\n selected?: boolean;\n /** `primary` is the option to steer toward, `error` a destructive one. */\n variant?: ActionCardVariant;\n}\n\n// `title` is the text color of the variant, when it has one. The error one is `--status-error-fg`, not\n// `--interactive-error`: on the hover fill the latter is 3.53:1 in the light theme (4.2:1 in the dark one),\n// under AA for text this size, where the status text color stays at 4.86:1 and 6.69:1.\nconst VARIANTS: Record<ActionCardVariant, { tileBg: string; tileFg: string; edge: string; title?: string }> = {\n default: { tileBg: 'var(--bg-subtle)', tileFg: 'var(--text-secondary)', edge: 'var(--border-brand)' },\n primary: { tileBg: 'var(--interactive-primary)', tileFg: 'var(--interactive-primary-fg)', edge: 'var(--border-brand)' },\n error: { tileBg: 'var(--status-error-bg)', tileFg: 'var(--status-error-fg)', edge: 'var(--status-error-dot)', title: 'var(--status-error-fg)' },\n};\n\n// The fill of a hovered card: a few percent of the variant's own ring color over the surface. Not\n// `--interactive-ghost-hover`: that grey is the very color of the icon tile (`--bg-subtle`), so on hover the\n// tile vanished into the card. This tint keeps the tile showing (1.20:1 against it in the light theme, 1.17:1\n// in the dark one, close to the 1.28:1 and 1.23:1 it has against the idle card) and keeps every text above AA.\nconst hoverFill = (edge: string) => 'color-mix(in srgb, ' + edge + ' 6%, var(--bg-surface))';\n\nexport function ActionCard({\n title,\n description,\n icon,\n trailing,\n selected,\n variant = 'default',\n disabled = false,\n className,\n style,\n ...rest\n}: ActionCardProps) {\n const v = VARIANTS[variant] || VARIANTS.default;\n const on = selected === true;\n const arrow = trailing === undefined ? <ChevronRight size={18} strokeWidth={1.75} aria-hidden /> : trailing;\n\n // The ring and the fill, each with its hover value, as custom properties `.sereno-action` (styles.css) switches\n // between on `:hover`, `:active` and `:focus-visible` (SS-577): the card holds no hover / press / focus state.\n // A selected card wears the same ring hovered or not; a disabled one has no hover value at all.\n const ring = on ? '0 0 0 1.5px ' + v.edge : '0 0 0 1px ' + (disabled ? 'var(--border-subtle)' : 'var(--border-default)');\n const ringHover = on ? ring : '0 0 0 1px ' + v.edge;\n // Only set when disabled: a `color: undefined` in a style would wipe the Typography's own.\n const muted = disabled ? { color: 'var(--text-disabled)' } : undefined;\n const titleStyle = disabled ? muted : v.title ? { color: v.title } : undefined;\n\n return (\n <button\n type=\"button\"\n disabled={disabled}\n aria-pressed={selected}\n {...rest}\n className={['sereno-action', className].filter(Boolean).join(' ')}\n style={sx({\n '--sd-bg': 'var(--bg-surface)',\n '--sd-bg-hover': disabled ? undefined : hoverFill(v.edge),\n '--sd-ring': ring,\n '--sd-ring-hover': disabled ? undefined : ringHover,\n display: 'flex',\n alignItems: 'center',\n gap: 'var(--space-3)',\n width: '100%',\n minWidth: 0,\n padding: 'var(--space-3) var(--space-4)',\n textAlign: 'left',\n fontFamily: 'var(--font-body)',\n color: 'inherit',\n border: 'none',\n borderRadius: 'var(--radius-card)',\n cursor: disabled ? 'not-allowed' : 'pointer',\n transition: 'var(--transition-control)',\n // The focus ring is the box-shadow of `.sereno-action:focus-visible`, the same substitute `Button` and `Card` use.\n outline: 'none',\n ...style,\n })}\n >\n {icon ? (\n <span\n aria-hidden\n style={sx({\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n flex: '0 0 auto',\n width: 40,\n height: 40,\n borderRadius: 'var(--radius-md)',\n background: disabled ? 'var(--interactive-disabled-bg)' : v.tileBg,\n color: disabled ? 'var(--interactive-disabled-fg)' : v.tileFg,\n })}\n >\n {icon}\n </span>\n ) : null}\n\n <span style={sx({ display: 'flex', flexDirection: 'column', gap: 2, flex: '1 1 auto', minWidth: 0 })}>\n <Typography as=\"span\" variant=\"label\" style={titleStyle}>\n {title}\n </Typography>\n {description ? (\n <Typography as=\"span\" variant=\"bodySm\" style={muted}>\n {description}\n </Typography>\n ) : null}\n </span>\n\n {arrow ? (\n <span style={sx({ display: 'inline-flex', flex: '0 0 auto', color: disabled ? 'var(--text-disabled)' : 'var(--text-muted)' })}>\n {arrow}\n </span>\n ) : null}\n </button>\n );\n}\n"],"mappings":";AAkEyC,cA4DnC,YA5DmC;AA/DzC,SAAS,oBAAoB;AAC7B,SA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Z,KAAK;AAAA,QACL,OAAO;AAAA,QACP,UAAU;AAAA,QACV,SAAS;AAAA,QACT,WAAW;AAAA,QACX,YAAY;AAAA,QACZ,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,cAAc;AAAA,QACd,QAAQ,WAAW,gBAAgB;AAAA,QACnC,YAAY;AAAA;AAAA,QAEZ,SAAS;AAAA,QACT,GAAG;AAAA,MACL,CAAC;AAAA,MAEA;AAAA,eACC;AAAA,UAAC;AAAA;AAAA,YACC,eAAW;AAAA,YACX,OAAO,GAAG;AAAA,cACR,SAAS;AAAA,cACT,YAAY;AAAA,cACZ,gBAAgB;AAAA,cAChB,MAAM;AAAA,cACN,OAAO;AAAA,cACP,QAAQ;AAAA,cACR,cAAc;AAAA,cACd,YAAY,WAAW,mCAAmC,EAAE;AAAA,cAC5D,OAAO,WAAW,mCAAmC,EAAE;AAAA,YACzD,CAAC;AAAA,YAEA;AAAA;AAAA,QACH,IACE;AAAA,QAEJ,qBAAC,UAAK,OAAO,GAAG,EAAE,SAAS,QAAQ,eAAe,UAAU,KAAK,GAAG,MAAM,YAAY,UAAU,EAAE,CAAC,GACjG;AAAA,8BAAC,cAAW,IAAG,QAAO,SAAQ,SAAQ,OAAO,YAC1C,iBACH;AAAA,UACC,cACC,oBAAC,cAAW,IAAG,QAAO,SAAQ,UAAS,OAAO,OAC3C,uBACH,IACE;AAAA,WACN;AAAA,QAEC,QACC,oBAAC,UAAK,OAAO,GAAG,EAAE,SAAS,eAAe,MAAM,YAAY,OAAO,WAAW,yBAAyB,oBAAoB,CAAC,GACzH,iBACH,IACE;AAAA;AAAA;AAAA,EACN;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/core/ActionCard.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ChevronRight } from 'lucide-react';\nimport { sx } from '../_internal/style';\nimport { Typography } from './Typography';\n\nexport type ActionCardVariant = 'default' | 'primary' | 'error';\n\n/**\n * A whole card you press: an icon, a title, a line of explanation and an arrow, in a real\n * `<button>`. For the options of a decision (\"Reschedule\", \"Cancel the booking\") and for the\n * entries of a settings flow. A `Card` with `interactive` is the bare surface; this is the\n * finished control, with the keyboard, the focus ring and the disabled state taken care of.\n *\n * It is an action, not a radio: arrow keys do not move between cards. `selected` marks a card as\n * a toggle (`aria-pressed`); for \"choose exactly one of these\" the semantics are a radio group's,\n * which this is not.\n */\nexport interface ActionCardProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'title' | 'children'> {\n /** What the card does. Short: it is the name a screen reader says. */\n title: React.ReactNode;\n /** One line that says what happens. */\n description?: React.ReactNode;\n /** An icon (a `lucide-react` element), drawn in a tile on the left. Hidden from a screen reader: the title says it. */\n icon?: React.ReactNode;\n /** What sits on the right. An arrow by default; any node, or `null` for nothing. */\n trailing?: React.ReactNode;\n /**\n * Passing it (true or false) makes the card a toggle: it reports `aria-pressed` and, when true,\n * wears the brand ring. Leave it out for a plain action.\n */\n selected?: boolean;\n /** `primary` is the option to steer toward, `error` a destructive one. */\n variant?: ActionCardVariant;\n}\n\n// `title` is the text color of the variant, when it has one. The error one is `--status-error-fg`, not\n// `--interactive-error`: on the hover fill the latter is 3.53:1 in the light theme (4.2:1 in the dark one),\n// under AA for text this size, where the status text color stays at 4.86:1 and 6.69:1.\nconst VARIANTS: Record<ActionCardVariant, { tileBg: string; tileFg: string; edge: string; title?: string }> = {\n default: { tileBg: 'var(--bg-subtle)', tileFg: 'var(--text-secondary)', edge: 'var(--border-brand)' },\n primary: { tileBg: 'var(--interactive-primary)', tileFg: 'var(--interactive-primary-fg)', edge: 'var(--border-brand)' },\n error: { tileBg: 'var(--status-error-bg)', tileFg: 'var(--status-error-fg)', edge: 'var(--status-error-dot)', title: 'var(--status-error-fg)' },\n};\n\n// The fill of a hovered card: a few percent of the variant's own ring color over the surface. Not\n// `--interactive-ghost-hover`: that grey is the very color of the icon tile (`--bg-subtle`), so on hover the\n// tile vanished into the card. This tint keeps the tile showing (1.20:1 against it in the light theme, 1.17:1\n// in the dark one, close to the 1.28:1 and 1.23:1 it has against the idle card) and keeps every text above AA.\nconst hoverFill = (edge: string) => 'color-mix(in srgb, ' + edge + ' 6%, var(--bg-surface))';\n\nexport function ActionCard({\n title,\n description,\n icon,\n trailing,\n selected,\n variant = 'default',\n disabled = false,\n className,\n style,\n ...rest\n}: ActionCardProps) {\n const v = VARIANTS[variant] || VARIANTS.default;\n const on = selected === true;\n const arrow = trailing === undefined ? <ChevronRight size={18} strokeWidth={1.75} aria-hidden /> : trailing;\n\n // The ring and the fill, each with its hover value, as custom properties `.sereno-action` (styles.css) switches\n // between on `:hover`, `:active` and `:focus-visible` (SS-577): the card holds no hover / press / focus state.\n // A selected card wears the same ring hovered or not; a disabled one has no hover value at all.\n const ring = on ? '0 0 0 1.5px ' + v.edge : '0 0 0 1px ' + (disabled ? 'var(--border-subtle)' : 'var(--border-default)');\n const ringHover = on ? ring : '0 0 0 1px ' + v.edge;\n // Only set when disabled: a `color: undefined` in a style would wipe the Typography's own.\n const muted = disabled ? { color: 'var(--text-disabled)' } : undefined;\n const titleStyle = disabled ? muted : v.title ? { color: v.title } : undefined;\n\n return (\n <button\n type=\"button\"\n disabled={disabled}\n aria-pressed={selected}\n {...rest}\n className={['sereno-action', className].filter(Boolean).join(' ')}\n style={sx({\n '--sd-bg': 'var(--bg-surface)',\n '--sd-bg-hover': disabled ? undefined : hoverFill(v.edge),\n '--sd-ring': ring,\n '--sd-ring-hover': disabled ? undefined : ringHover,\n display: 'flex',\n alignItems: 'center',\n gap: 'var(--space-3)',\n width: '100%',\n minWidth: 0,\n padding: 'var(--space-3) var(--space-4)',\n textAlign: 'left',\n fontFamily: 'var(--font-body)',\n color: 'inherit',\n borderRadius: 'var(--radius-card)',\n cursor: disabled ? 'not-allowed' : 'pointer',\n transition: 'var(--transition-control)',\n ...style,\n })}\n >\n {icon ? (\n <span\n aria-hidden\n style={sx({\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n flex: '0 0 auto',\n width: 40,\n height: 40,\n borderRadius: 'var(--radius-md)',\n background: disabled ? 'var(--interactive-disabled-bg)' : v.tileBg,\n color: disabled ? 'var(--interactive-disabled-fg)' : v.tileFg,\n })}\n >\n {icon}\n </span>\n ) : null}\n\n <span style={sx({ display: 'flex', flexDirection: 'column', gap: 2, flex: '1 1 auto', minWidth: 0 })}>\n <Typography as=\"span\" variant=\"label\" style={titleStyle}>\n {title}\n </Typography>\n {description ? (\n <Typography as=\"span\" variant=\"bodySm\" style={muted}>\n {description}\n </Typography>\n ) : null}\n </span>\n\n {arrow ? (\n <span style={sx({ display: 'inline-flex', flex: '0 0 auto', color: disabled ? 'var(--text-disabled)' : 'var(--text-muted)' })}>\n {arrow}\n </span>\n ) : null}\n </button>\n );\n}\n"],"mappings":";AAkEyC,cAyDnC,YAzDmC;AA/DzC,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAmC3B,MAAM,WAAwG;AAAA,EAC5G,SAAS,EAAE,QAAQ,oBAAoB,QAAQ,yBAAyB,MAAM,sBAAsB;AAAA,EACpG,SAAS,EAAE,QAAQ,8BAA8B,QAAQ,iCAAiC,MAAM,sBAAsB;AAAA,EACtH,OAAO,EAAE,QAAQ,0BAA0B,QAAQ,0BAA0B,MAAM,2BAA2B,OAAO,yBAAyB;AAChJ;AAMA,MAAM,YAAY,CAAC,SAAiB,wBAAwB,OAAO;AAE5D,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAoB;AAClB,QAAM,IAAI,SAAS,OAAO,KAAK,SAAS;AACxC,QAAM,KAAK,aAAa;AACxB,QAAM,QAAQ,aAAa,SAAY,oBAAC,gBAAa,MAAM,IAAI,aAAa,MAAM,eAAW,MAAC,IAAK;AAKnG,QAAM,OAAO,KAAK,iBAAiB,EAAE,OAAO,g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,QAAO,SAAQ,SAAQ,OAAO,YAC1C,iBACH;AAAA,UACC,cACC,oBAAC,cAAW,IAAG,QAAO,SAAQ,UAAS,OAAO,OAC3C,uBACH,IACE;AAAA,WACN;AAAA,QAEC,QACC,oBAAC,UAAK,OAAO,GAAG,EAAE,SAAS,eAAe,MAAM,YAAY,OAAO,WAAW,yBAAyB,oBAAoB,CAAC,GACzH,iBACH,IACE;AAAA;AAAA;AAAA,EACN;AAEJ;","names":[]}
@@ -57,7 +57,6 @@ function Button({ variant = "primary", size = "md", fullWidth = false, disabled
57
57
  cursor: disabled ? "not-allowed" : "pointer",
58
58
  opacity: loading ? 0.75 : 1,
59
59
  transition: "var(--transition-control)",
60
- outline: "none",
61
60
  textUnderlineOffset: "2px",
62
61
  ...style
63
62
  }),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/Button.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\n\n/**\n * Primary action control. `primary` for navigation-level commitment, `accent` for the single\n * conversion action on a view. `success` / `warning` / `error` are the semantic fills, using the\n * same words as Badge / Alert / Toast. (No `info` - in Sereno that is the brand indigo = `primary`.)\n */\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Visual role. Only one `accent` button per screen. */\n variant?: 'primary' | 'accent' | 'secondary' | 'ghost' | 'link' | 'success' | 'warning' | 'error';\n /** Control height. `lg`/`xl` are the mobile defaults (≥44px tap target). */\n size?: 'sm' | 'md' | 'lg' | 'xl';\n fullWidth?: boolean;\n disabled?: boolean;\n /** Shows a spinner and blocks interaction. */\n loading?: boolean;\n iconLeft?: React.ReactNode;\n iconRight?: React.ReactNode;\n children?: React.ReactNode;\n}\n\nconst SIZES = {\n sm: { h: 'var(--control-height-sm)', px: 'var(--space-3)', fs: 'var(--text-sm)', gap: '6px' },\n md: { h: 'var(--control-height-md)', px: 'var(--space-4)', fs: 'var(--text-base)', gap: '8px' },\n lg: { h: 'var(--control-height-lg)', px: 'var(--space-5)', fs: 'var(--text-md)', gap: '10px' },\n xl: { h: 'var(--control-height-xl)', px: 'var(--space-6)', fs: 'var(--text-lg)', gap: '10px' },\n} as const;\n\n/**\n * What a variant looks like in each state, as the custom properties `.sereno-btn` (styles.css) reads:\n * the base, then only what differs on `:hover`, `:active` (pressed) and `:focus-visible` (SS-577). The\n * browser switches between them, so a button holds no hover / press / focus state and does not re-render when\n * the pointer crosses it. A property left out falls back to the one before it in the CSS.\n */\nfunction stateVars(variant: NonNullable<ButtonProps['variant']>): Record<string, string> {\n switch (variant) {\n case 'accent':\n return { '--sd-bg': 'var(--interactive-accent)', '--sd-bg-hover': 'var(--interactive-accent-hover)', '--sd-bg-active': 'var(--interactive-accent-active)', '--sd-fg': 'var(--interactive-accent-fg)', '--sd-bd': 'transparent', '--sd-sh': 'var(--shadow-xs)', '--sd-sh-hover': 'var(--shadow-accent)', '--sd-ring': 'var(--focus-ring-accent)' };\n case 'secondary':\n return { '--sd-bg': 'var(--interactive-secondary)', '--sd-bg-hover': 'var(--interactive-secondary-hover)', '--sd-bg-active': 'var(--interactive-secondary-active)', '--sd-fg': 'var(--interactive-secondary-fg)', '--sd-bd': 'var(--border-default)', '--sd-sh': 'var(--shadow-xs)' };\n case 'ghost':\n return { '--sd-bg': 'transparent', '--sd-bg-hover': 'var(--interactive-ghost-hover)', '--sd-fg': 'var(--text-secondary)', '--sd-bd': 'transparent', '--sd-sh': 'none' };\n case 'success':\n return { '--sd-bg': 'var(--interactive-success)', '--sd-bg-hover': 'var(--interactive-success-hover)', '--sd-fg': 'var(--interactive-success-fg)', '--sd-bd': 'transparent', '--sd-sh': 'var(--shadow-xs)' };\n case 'warning':\n return { '--sd-bg': 'var(--interactive-warning)', '--sd-bg-hover': 'var(--interactive-warning-hover)', '--sd-fg': 'var(--interactive-warning-fg)', '--sd-bd': 'transparent', '--sd-sh': 'var(--shadow-xs)' };\n case 'error':\n return { '--sd-bg': 'var(--interactive-error)', '--sd-bg-hover': 'var(--interactive-error-hover)', '--sd-fg': 'var(--interactive-error-fg)', '--sd-bd': 'transparent', '--sd-sh': 'var(--shadow-xs)' };\n case 'link':\n return { '--sd-bg': 'transparent', '--sd-fg': 'var(--text-link)', '--sd-fg-hover': 'var(--text-link-hover)', '--sd-bd': 'transparent', '--sd-sh': 'none', '--sd-deco-hover': 'underline' };\n default:\n return { '--sd-bg': 'var(--interactive-primary)', '--sd-bg-hover': 'var(--interactive-primary-hover)', '--sd-bg-active': 'var(--interactive-primary-active)', '--sd-fg': 'var(--interactive-primary-fg)', '--sd-bd': 'transparent', '--sd-sh': 'var(--shadow-xs)', '--sd-sh-hover': 'var(--shadow-brand)' };\n }\n}\n\n/** A disabled control: one look, no hover, no press, no ring (the CSS rules exclude `:disabled`). */\nconst DISABLED_VARS = { '--sd-bg': 'var(--interactive-disabled-bg)', '--sd-fg': 'var(--interactive-disabled-fg)', '--sd-bd': 'transparent', '--sd-sh': 'none' };\n\nexport function Button({ variant = 'primary', size = 'md', fullWidth = false, disabled = false, loading = false, iconLeft, iconRight, children, className, style, ...rest }: ButtonProps) {\n const sz = SIZES[size] || SIZES.md;\n const isLink = variant === 'link';\n return (\n <button\n type=\"button\"\n disabled={disabled || loading}\n {...rest}\n className={['sereno-btn', className].filter(Boolean).join(' ')}\n style={sx({\n ...(disabled ? DISABLED_VARS : stateVars(variant)),\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: sz.gap,\n height: isLink ? 'auto' : sz.h,\n padding: isLink ? 0 : '0 ' + sz.px,\n width: fullWidth ? '100%' : undefined,\n fontFamily: 'var(--font-body)',\n fontSize: sz.fs,\n fontWeight: 'var(--weight-semibold)',\n letterSpacing: 'var(--tracking-snug)',\n borderRadius: isLink ? 'var(--radius-xs)' : 'var(--radius-control)',\n borderWidth: 'var(--border-width-hairline)',\n borderStyle: 'solid',\n cursor: disabled ? 'not-allowed' : 'pointer',\n opacity: loading ? 0.75 : 1,\n transition: 'var(--transition-control)',\n outline: 'none',\n textUnderlineOffset: '2px',\n ...style,\n })}\n >\n {loading ? (\n <span style={sx({ width: '1em', height: '1em', borderRadius: '999px', border: '2px solid currentColor', borderTopColor: 'transparent', display: 'inline-block', animation: 'sereno-spin .7s linear infinite' })} />\n ) : (\n iconLeft\n )}\n {children}\n {iconRight}\n </button>\n );\n}"],"mappings":";AAiEI,SA8BI,KA9BJ;AA9DJ,SAAS,UAAU;AAqBnB,MAAM,QAAQ;AAAA,EACZ,IAAI,EAAE,GAAG,4BAA4B,IAAI,kBAAkB,IAAI,kBAAkB,KAAK,MAAM;AAAA,EAC5F,IAAI,EAAE,GAAG,4BAA4B,IAAI,kBAAkB,IAAI,oBAAoB,KAAK,MAAM;AAAA,EAC9F,IAAI,EAAE,GAAG,4BAA4B,IAAI,kBAAkB,IAAI,kBAAkB,KAAK,OAAO;AAAA,EAC7F,IAAI,EAAE,GAAG,4BAA4B,IAAI,kBAAkB,IAAI,kBAAkB,KAAK,OAAO;AAC/F;AAQA,SAAS,UAAU,SAAsE;AACvF,UAAQ,SAAS;AAAA,IACf,KAAK;AACH,aAAO,EAAE,WAAW,6BAA6B,iBAAiB,mCAAmC,kBAAkB,oCAAoC,WAAW,gCAAgC,WAAW,eAAe,WAAW,oBAAoB,iBAAiB,wBAAwB,aAAa,2BAA2B;AAAA,IAClV,KAAK;AACH,aAAO,EAAE,WAAW,gCAAgC,iBAAiB,sCAAsC,kBAAkB,uCAAuC,WAAW,mCAAmC,WAAW,yBAAyB,WAAW,mBAAmB;AAAA,IACtR,KAAK;AACH,aAAO,EAAE,WAAW,eAAe,iBAAiB,kCAAkC,WAAW,yBAAyB,WAAW,eAAe,WAAW,OAAO;AAAA,IACxK,KAAK;AACH,aAAO,EAAE,WAAW,8BAA8B,iBAAiB,oCAAoC,WAAW,iCAAiC,WAAW,eAAe,WAAW,mBAAmB;AAAA,IAC7M,KAAK;AACH,aAAO,EAAE,WAAW,8BAA8B,iBAAiB,oCAAoC,WAAW,iCAAiC,WAAW,eAAe,W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aAAa;AAAA,QACb,QAAQ,WAAW,gBAAgB;AAAA,QACnC,SAAS,UAAU,OAAO;AAAA,QAC1B,YAAY;AAAA,QACZ,SAAS;AAAA,QACT,qBAAqB;AAAA,QACrB,GAAG;AAAA,MACL,CAAC;AAAA,MAEA;AAAA,kBACC,oBAAC,UAAK,OAAO,GAAG,EAAE,OAAO,OAAO,QAAQ,OAAO,cAAc,SAAS,QAAQ,0BAA0B,gBAAgB,eAAe,SAAS,gBAAgB,WAAW,kCAAkC,CAAC,GAAG,IAEjN;AAAA,QAED;AAAA,QACA;AAAA;AAAA;AAAA,EACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/core/Button.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\n\n/**\n * Primary action control. `primary` for navigation-level commitment, `accent` for the single\n * conversion action on a view. `success` / `warning` / `error` are the semantic fills, using the\n * same words as Badge / Alert / Toast. (No `info` - in Sereno that is the brand indigo = `primary`.)\n */\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Visual role. Only one `accent` button per screen. */\n variant?: 'primary' | 'accent' | 'secondary' | 'ghost' | 'link' | 'success' | 'warning' | 'error';\n /** Control height. `lg`/`xl` are the mobile defaults (≥44px tap target). */\n size?: 'sm' | 'md' | 'lg' | 'xl';\n fullWidth?: boolean;\n disabled?: boolean;\n /** Shows a spinner and blocks interaction. */\n loading?: boolean;\n iconLeft?: React.ReactNode;\n iconRight?: React.ReactNode;\n children?: React.ReactNode;\n}\n\nconst SIZES = {\n sm: { h: 'var(--control-height-sm)', px: 'var(--space-3)', fs: 'var(--text-sm)', gap: '6px' },\n md: { h: 'var(--control-height-md)', px: 'var(--space-4)', fs: 'var(--text-base)', gap: '8px' },\n lg: { h: 'var(--control-height-lg)', px: 'var(--space-5)', fs: 'var(--text-md)', gap: '10px' },\n xl: { h: 'var(--control-height-xl)', px: 'var(--space-6)', fs: 'var(--text-lg)', gap: '10px' },\n} as const;\n\n/**\n * What a variant looks like in each state, as the custom properties `.sereno-btn` (styles.css) reads:\n * the base, then only what differs on `:hover`, `:active` (pressed) and `:focus-visible` (SS-577). The\n * browser switches between them, so a button holds no hover / press / focus state and does not re-render when\n * the pointer crosses it. A property left out falls back to the one before it in the CSS.\n */\nfunction stateVars(variant: NonNullable<ButtonProps['variant']>): Record<string, string> {\n switch (variant) {\n case 'accent':\n return { '--sd-bg': 'var(--interactive-accent)', '--sd-bg-hover': 'var(--interactive-accent-hover)', '--sd-bg-active': 'var(--interactive-accent-active)', '--sd-fg': 'var(--interactive-accent-fg)', '--sd-bd': 'transparent', '--sd-sh': 'var(--shadow-xs)', '--sd-sh-hover': 'var(--shadow-accent)', '--sd-ring': 'var(--focus-ring-accent)' };\n case 'secondary':\n return { '--sd-bg': 'var(--interactive-secondary)', '--sd-bg-hover': 'var(--interactive-secondary-hover)', '--sd-bg-active': 'var(--interactive-secondary-active)', '--sd-fg': 'var(--interactive-secondary-fg)', '--sd-bd': 'var(--border-default)', '--sd-sh': 'var(--shadow-xs)' };\n case 'ghost':\n return { '--sd-bg': 'transparent', '--sd-bg-hover': 'var(--interactive-ghost-hover)', '--sd-fg': 'var(--text-secondary)', '--sd-bd': 'transparent', '--sd-sh': 'none' };\n case 'success':\n return { '--sd-bg': 'var(--interactive-success)', '--sd-bg-hover': 'var(--interactive-success-hover)', '--sd-fg': 'var(--interactive-success-fg)', '--sd-bd': 'transparent', '--sd-sh': 'var(--shadow-xs)' };\n case 'warning':\n return { '--sd-bg': 'var(--interactive-warning)', '--sd-bg-hover': 'var(--interactive-warning-hover)', '--sd-fg': 'var(--interactive-warning-fg)', '--sd-bd': 'transparent', '--sd-sh': 'var(--shadow-xs)' };\n case 'error':\n return { '--sd-bg': 'var(--interactive-error)', '--sd-bg-hover': 'var(--interactive-error-hover)', '--sd-fg': 'var(--interactive-error-fg)', '--sd-bd': 'transparent', '--sd-sh': 'var(--shadow-xs)' };\n case 'link':\n return { '--sd-bg': 'transparent', '--sd-fg': 'var(--text-link)', '--sd-fg-hover': 'var(--text-link-hover)', '--sd-bd': 'transparent', '--sd-sh': 'none', '--sd-deco-hover': 'underline' };\n default:\n return { '--sd-bg': 'var(--interactive-primary)', '--sd-bg-hover': 'var(--interactive-primary-hover)', '--sd-bg-active': 'var(--interactive-primary-active)', '--sd-fg': 'var(--interactive-primary-fg)', '--sd-bd': 'transparent', '--sd-sh': 'var(--shadow-xs)', '--sd-sh-hover': 'var(--shadow-brand)' };\n }\n}\n\n/** A disabled control: one look, no hover, no press, no ring (the CSS rules exclude `:disabled`). */\nconst DISABLED_VARS = { '--sd-bg': 'var(--interactive-disabled-bg)', '--sd-fg': 'var(--interactive-disabled-fg)', '--sd-bd': 'transparent', '--sd-sh': 'none' };\n\nexport function Button({ variant = 'primary', size = 'md', fullWidth = false, disabled = false, loading = false, iconLeft, iconRight, children, className, style, ...rest }: ButtonProps) {\n const sz = SIZES[size] || SIZES.md;\n const isLink = variant === 'link';\n return (\n <button\n type=\"button\"\n disabled={disabled || loading}\n {...rest}\n className={['sereno-btn', className].filter(Boolean).join(' ')}\n style={sx({\n ...(disabled ? DISABLED_VARS : stateVars(variant)),\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: sz.gap,\n height: isLink ? 'auto' : sz.h,\n padding: isLink ? 0 : '0 ' + sz.px,\n width: fullWidth ? '100%' : undefined,\n fontFamily: 'var(--font-body)',\n fontSize: sz.fs,\n fontWeight: 'var(--weight-semibold)',\n letterSpacing: 'var(--tracking-snug)',\n borderRadius: isLink ? 'var(--radius-xs)' : 'var(--radius-control)',\n borderWidth: 'var(--border-width-hairline)',\n borderStyle: 'solid',\n cursor: disabled ? 'not-allowed' : 'pointer',\n opacity: loading ? 0.75 : 1,\n transition: 'var(--transition-control)',\n textUnderlineOffset: '2px',\n ...style,\n })}\n >\n {loading ? (\n <span style={sx({ width: '1em', height: '1em', borderRadius: '999px', border: '2px solid currentColor', borderTopColor: 'transparent', display: 'inline-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GAAG;AAAA,MACL,CAAC;AAAA,MAEA;AAAA,kBACC,oBAAC,UAAK,OAAO,GAAG,EAAE,OAAO,OAAO,QAAQ,OAAO,cAAc,SAAS,QAAQ,0BAA0B,gBAAgB,eAAe,SAAS,gBAAgB,WAAW,kCAAkC,CAAC,GAAG,IAEjN;AAAA,QAED;AAAA,QACA;AAAA;AAAA;AAAA,EACH;AAEJ;","names":[]}
package/dist/core/Card.js CHANGED
@@ -27,6 +27,7 @@ function Card({ padding = "md", elevation = "sm", interactive = false, selected
27
27
  className: ["sereno-card", className].filter(Boolean).join(" "),
28
28
  "data-interactive": interactive || void 0,
29
29
  "data-clickable": clickable || void 0,
30
+ "data-selected": selected || void 0,
30
31
  style: sx({
31
32
  "--sd-ring": ring,
32
33
  "--sd-ring-h": ringHover,
@@ -37,9 +38,6 @@ function Card({ padding = "md", elevation = "sm", interactive = false, selected
37
38
  padding: PADS[padding],
38
39
  transition: "var(--transition-control)",
39
40
  cursor: interactive ? "pointer" : "default",
40
- // outline:none is safe here (unlike the CSS-class pattern elsewhere in
41
- // this package): the focus ring is the box-shadow `.sereno-card[data-clickable]:focus-visible` draws.
42
- outline: clickable ? "none" : void 0,
43
41
  ...style
44
42
  }),
45
43
  children
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/Card.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\n\n/** Neutral surface container: a crisp 1px ring + optional soft lift + 14px radius. The base of every list row and panel. */\nexport interface CardProps extends React.HTMLAttributes<HTMLDivElement> {\n padding?: 'none' | 'sm' | 'md' | 'lg';\n elevation?: 'none' | 'sm' | 'md' | 'lg';\n /** Adds hover lift, press scale and pointer cursor. */\n interactive?: boolean;\n /** Brand-coloured ring for a chosen option. */\n selected?: boolean;\n children?: React.ReactNode;\n}\n\nconst PADS = { none: 0, sm: 'var(--space-3)', md: 'var(--space-4)', lg: 'var(--space-5)' } as const;\n// The edge is a box-shadow ring (pixel-crisp at any radius), with the elevation\n// drop-shadow layered beneath it - never a real `border` fighting the shadow.\nconst DROP = { none: '', sm: 'var(--shadow-xs)', md: 'var(--shadow-md)', lg: 'var(--shadow-lg)' } as const;\n/** A shadow that draws nothing: lets `box-shadow: ring, drop` stay valid when there is no drop (`elevation=\"none\"`). */\nconst NO_SHADOW = '0 0 0 0 transparent';\n\nexport function Card({ padding = 'md', elevation = 'sm', interactive = false, selected = false, children, style, className, onClick, onKeyDown, ...rest }: CardProps) {\n // A Card only needs real button semantics (SS-228) when it owns its own\n // onClick - `interactive` alone (no onClick) means it's just borrowing the\n // hover/press visual inside an already-interactive wrapper (e.g. the\n // landing page's Cards inside a <Link>), and giving it a tabIndex there\n // would nest one focusable control inside another.\n const clickable = interactive && !!onClick;\n\n // The edge is a ring and the lift a drop shadow, each with its hover value. `.sereno-card` (styles.css)\n // switches between them on :hover / :active / :focus-visible (SS-577), so the card keeps no state.\n const ring = selected ? '0 0 0 1.5px var(--border-brand)' : '0 0 0 1px var(--border-default)';\n const ringHover = selected ? ring : '0 0 0 1px var(--border-strong)';\n const drop = (selected ? 'var(--shadow-md)' : DROP[elevation]) || NO_SHADOW;\n const dropHover = selected ? 'var(--shadow-md)' : elevation === 'lg' ? 'var(--shadow-lg)' : 'var(--shadow-md)';\n\n return (\n <div\n role={clickable ? 'button' : undefined}\n tabIndex={clickable ? 0 : undefined}\n onClick={onClick}\n onKeyDown={\n clickable\n ? (e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n // Not a real MouseEvent - every onClick in this codebase ignores\n // the event argument, so the cast is safe in practice.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- see above\n onClick(e as any);\n }\n onKeyDown?.(e);\n }\n : onKeyDown\n }\n {...rest}\n className={['sereno-card', className].filter(Boolean).join(' ')}\n data-interactive={interactive || undefined}\n data-clickable={clickable || undefined}\n style={sx({\n '--sd-ring': ring,\n '--sd-ring-h': ringHover,\n '--sd-drop': drop,\n '--sd-drop-h': dropHover,\n background: 'var(--bg-surface)',\n borderRadius: 'var(--radius-card)',\n padding: PADS[padding],\n transition: 'var(--transition-control)',\n cursor: interactive ? 'pointer' : 'default',\n // outline:none is safe here (unlike the CSS-class pattern elsewhere in\n // this package): the focus ring is the box-shadow `.sereno-card[data-clickable]:focus-visible` draws.\n outline: clickable ? 'none' : undefined,\n ...style,\n })}\n >\n {children}\n </div>\n );\n}\n"],"mappings":";AAuCI;AApCJ,SAAS,UAAU;AAanB,MAAM,OAAO,EAAE,MAAM,GAAG,IAAI,kBAAkB,IAAI,kBAAkB,IAAI,iBAAiB;AAGzF,MAAM,OAAO,EAAE,MAAM,IAAI,IAAI,oBAAoB,IAAI,oBAAoB,IAAI,mBAAmB;AAEhG,MAAM,YAAY;AAEX,SAAS,KAAK,EAAE,UAAU,MAAM,YAAY,MAAM,cAAc,OAAO,WAAW,OAAO,UAAU,OAAO,WAAW,SAAS,WAAW,GAAG,KAAK,GAAc;AAMpK,QAAM,YAAY,eAAe,CAAC,CAAC;AAInC,QAAM,OAAO,WAAW,oCAAoC;AAC5D,QAAM,YAAY,WAAW,OAAO;AACpC,QAAM,QAAQ,WAAW,qBAAqB,KAAK,SAAS,MAAM;AAClE,QAAM,YAAY,WAAW,qBAAqB,cAAc,OAAO,qBAAqB;AAE5F,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM,YAAY,WAAW;AAAA,MAC7B,UAAU,YAAY,IAAI;AAAA,MAC1B;AAAA,MACA,WACE,YACI,CAAC,MAAM;AACL,YAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,KAAK;AACtC,YAAE,eAAe;AAIjB,kBAAQ,CAAQ;AAAA,QAClB;AACA,oBAAY,CAAC;AAAA,MACf,IACA;AAAA,MAEL,GAAG;AAAA,MACJ,WAAW,CAAC,eAAe,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,MAC9D,oBAAkB,eAAe;AAAA,MACjC,kBAAgB,aAAa;AAAA,MAC7B,OAAO,GAAG;AAAA,QACR,aAAa;AAAA,QACb,eAAe;AAAA,QACf,aAAa;AAAA,QACb,eAAe;AAAA,QACf,YAAY;AAAA,QACZ,cAAc;AAAA,QACd,SAAS,KAAK,OAAO;AAAA,QACrB,YAAY;AAAA,QACZ,QAAQ,cAAc,YAAY;AAAA;AAAA;AAAA,QAGlC,SAAS,YAAY,SAAS;AAAA,QAC9B,GAAG;AAAA,MACL,CAAC;AAAA,MAEA;AAAA;AAAA,EACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/core/Card.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\n\n/** Neutral surface container: a crisp 1px ring + optional soft lift + 14px radius. The base of every list row and panel. */\nexport interface CardProps extends React.HTMLAttributes<HTMLDivElement> {\n padding?: 'none' | 'sm' | 'md' | 'lg';\n elevation?: 'none' | 'sm' | 'md' | 'lg';\n /** Adds hover lift, press scale and pointer cursor. */\n interactive?: boolean;\n /** Brand-coloured ring for a chosen option. */\n selected?: boolean;\n children?: React.ReactNode;\n}\n\nconst PADS = { none: 0, sm: 'var(--space-3)', md: 'var(--space-4)', lg: 'var(--space-5)' } as const;\n// The edge is a box-shadow ring (pixel-crisp at any radius), with the elevation\n// drop-shadow layered beneath it - never a real `border` fighting the shadow.\nconst DROP = { none: '', sm: 'var(--shadow-xs)', md: 'var(--shadow-md)', lg: 'var(--shadow-lg)' } as const;\n/** A shadow that draws nothing: lets `box-shadow: ring, drop` stay valid when there is no drop (`elevation=\"none\"`). */\nconst NO_SHADOW = '0 0 0 0 transparent';\n\nexport function Card({ padding = 'md', elevation = 'sm', interactive = false, selected = false, children, style, className, onClick, onKeyDown, ...rest }: CardProps) {\n // A Card only needs real button semantics (SS-228) when it owns its own\n // onClick - `interactive` alone (no onClick) means it's just borrowing the\n // hover/press visual inside an already-interactive wrapper (e.g. the\n // landing page's Cards inside a <Link>), and giving it a tabIndex there\n // would nest one focusable control inside another.\n const clickable = interactive && !!onClick;\n\n // The edge is a ring and the lift a drop shadow, each with its hover value. `.sereno-card` (styles.css)\n // switches between them on :hover / :active / :focus-visible (SS-577), so the card keeps no state.\n const ring = selected ? '0 0 0 1.5px var(--border-brand)' : '0 0 0 1px var(--border-default)';\n const ringHover = selected ? ring : '0 0 0 1px var(--border-strong)';\n const drop = (selected ? 'var(--shadow-md)' : DROP[elevation]) || NO_SHADOW;\n const dropHover = selected ? 'var(--shadow-md)' : elevation === 'lg' ? 'var(--shadow-lg)' : 'var(--shadow-md)';\n\n return (\n <div\n role={clickable ? 'button' : undefined}\n tabIndex={clickable ? 0 : undefined}\n onClick={onClick}\n onKeyDown={\n clickable\n ? (e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n // Not a real MouseEvent - every onClick in this codebase ignores\n // the event argument, so the cast is safe in practice.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- see above\n onClick(e as any);\n }\n onKeyDown?.(e);\n }\n : onKeyDown\n }\n {...rest}\n className={['sereno-card', className].filter(Boolean).join(' ')}\n data-interactive={interactive || undefined}\n data-clickable={clickable || undefined}\n data-selected={selected || undefined}\n style={sx({\n '--sd-ring': ring,\n '--sd-ring-h': ringHover,\n '--sd-drop': drop,\n '--sd-drop-h': dropHover,\n background: 'var(--bg-surface)',\n borderRadius: 'var(--radius-card)',\n padding: PADS[padding],\n transition: 'var(--transition-control)',\n cursor: interactive ? 'pointer' : 'default',\n ...style,\n })}\n >\n {children}\n </div>\n );\n}\n"],"mappings":";AAuCI;AApCJ,SAAS,UAAU;AAanB,MAAM,OAAO,EAAE,MAAM,GAAG,IAAI,kBAAkB,IAAI,kBAAkB,IAAI,iBAAiB;AAGzF,MAAM,OAAO,EAAE,MAAM,IAAI,IAAI,oBAAoB,IAAI,oBAAoB,IAAI,mBAAmB;AAEhG,MAAM,YAAY;AAEX,SAAS,KAAK,EAAE,UAAU,MAAM,YAAY,MAAM,cAAc,OAAO,WAAW,OAAO,UAAU,OAAO,WAAW,SAAS,WAAW,GAAG,KAAK,GAAc;AAMpK,QAAM,YAAY,eAAe,CAAC,CAAC;AAInC,QAAM,OAAO,WAAW,oCAAoC;AAC5D,QAAM,YAAY,WAAW,OAAO;AACpC,QAAM,QAAQ,WAAW,qBAAqB,KAAK,SAAS,MAAM;AAClE,QAAM,YAAY,WAAW,qBAAqB,cAAc,OAAO,qBAAqB;AAE5F,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM,YAAY,WAAW;AAAA,MAC7B,UAAU,YAAY,IAAI;AAAA,MAC1B;AAAA,MACA,WACE,YACI,CAAC,MAAM;AACL,YAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,KAAK;AACtC,YAAE,eAAe;AAIjB,kBAAQ,CAAQ;AAAA,QAClB;AACA,oBAAY,CAAC;AAAA,MACf,IACA;AAAA,MAEL,GAAG;AAAA,MACJ,WAAW,CAAC,eAAe,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,MAC9D,oBAAkB,eAAe;AAAA,MACjC,kBAAgB,aAAa;AAAA,MAC7B,iBAAe,YAAY;AAAA,MAC3B,OAAO,GAAG;AAAA,QACR,aAAa;AAAA,QACb,eAAe;AAAA,QACf,aAAa;AAAA,QACb,eAAe;AAAA,QACf,YAAY;AAAA,QACZ,cAAc;AAAA,QACd,SAAS,KAAK,OAAO;AAAA,QACrB,YAAY;AAAA,QACZ,QAAQ,cAAc,YAAY;AAAA,QAClC,GAAG;AAAA,MACL,CAAC;AAAA,MAEA;AAAA;AAAA,EACH;AAEJ;","names":[]}
@@ -46,7 +46,6 @@ function IconButton({ variant = "ghost", size = "md", label, disabled = false, c
46
46
  borderStyle: "solid",
47
47
  cursor: disabled ? "not-allowed" : "pointer",
48
48
  transition: "var(--transition-control)",
49
- outline: "none",
50
49
  ...style
51
50
  }),
52
51
  children
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/IconButton.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\n\n/**\n * Square icon-only control for toolbars, card corners and top bars. Always pass `label`.\n * `success` / `warning` / `error` are solid semantic fills - same words as Button / Badge.\n */\nexport interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: 'ghost' | 'secondary' | 'primary' | 'success' | 'warning' | 'error';\n size?: 'sm' | 'md' | 'lg';\n /** Accessible name - becomes aria-label and title. Required. */\n label: string;\n disabled?: boolean;\n /** The icon element (Lucide 20px stroke 1.75). */\n children?: React.ReactNode;\n}\n\nconst S = { sm: 32, md: 40, lg: 48 } as const;\n\n/** Solid-fill variants: [base, hover, fg]. */\nconst SOLID: Partial<Record<NonNullable<IconButtonProps['variant']>, [string, string, string]>> = {\n primary: ['--interactive-primary', '--interactive-primary-hover', '--interactive-primary-fg'],\n success: ['--interactive-success', '--interactive-success-hover', '--interactive-success-fg'],\n warning: ['--interactive-warning', '--interactive-warning-hover', '--interactive-warning-fg'],\n error: ['--interactive-error', '--interactive-error-hover', '--interactive-error-fg'],\n};\n\nexport function IconButton({ variant = 'ghost', size = 'md', label, disabled = false, children, className, style, ...rest }: IconButtonProps) {\n const d = S[size] || S.md;\n const solid = SOLID[variant];\n const outline = variant === 'secondary';\n\n // The values of each state, for `.sereno-btn` (styles.css) to switch between on :hover / :active / :focus-visible\n // (SS-577). Only a press scale and a focus ring are common to all; the rest is per variant.\n let vars: Record<string, string>;\n if (disabled) {\n vars = { '--sd-bg': 'var(--interactive-disabled-bg)', '--sd-fg': 'var(--interactive-disabled-fg)' };\n } else if (solid) {\n vars = { '--sd-bg': `var(${solid[0]})`, '--sd-bg-hover': `var(${solid[1]})`, '--sd-fg': `var(${solid[2]})` };\n } else if (outline) {\n vars = { '--sd-bg': 'var(--interactive-secondary)', '--sd-bg-hover': 'var(--interactive-secondary-hover)', '--sd-fg': 'var(--text-secondary)' };\n } else {\n vars = { '--sd-bg': 'transparent', '--sd-bg-hover': 'var(--interactive-ghost-hover)', '--sd-fg': 'var(--text-secondary)' };\n }\n vars['--sd-bd'] = outline ? 'var(--border-default)' : 'transparent';\n vars['--sd-sh'] = 'none';\n\n return (\n <button\n type=\"button\"\n aria-label={label}\n title={label}\n disabled={disabled}\n {...rest}\n className={['sereno-btn', className].filter(Boolean).join(' ')}\n style={sx({\n ...vars,\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: d,\n height: d,\n flex: '0 0 auto',\n borderRadius: 'var(--radius-control)',\n borderWidth: 'var(--border-width-hairline)',\n borderStyle: 'solid',\n cursor: disabled ? 'not-allowed' : 'pointer',\n transition: 'var(--transition-control)',\n outline: 'none',\n ...style,\n })}\n >\n {children}\n </button>\n );\n}\n"],"mappings":";AAkDI;AA/CJ,SAAS,UAAU;AAgBnB,MAAM,IAAI,EAAE,IAAI,IAAI,IAAI,IAAI,IAAI,GAAG;AAGnC,MAAM,QAA4F;AAAA,EAChG,SAAS,CAAC,yBAAyB,+BAA+B,0BAA0B;AAAA,EAC5F,SAAS,CAAC,yBAAyB,+BAA+B,0BAA0B;AAAA,EAC5F,SAAS,CAAC,yBAAyB,+BAA+B,0BAA0B;AAAA,EAC5F,OAAO,CAAC,uBAAuB,6BAA6B,wBAAwB;AACtF;AAEO,SAAS,WAAW,EAAE,UAAU,SAAS,OAAO,MAAM,OAAO,WAAW,OAAO,UAAU,WAAW,OAAO,GAAG,KAAK,GAAoB;AAC5I,QAAM,IAAI,EAAE,IAAI,KAAK,EAAE;AACvB,QAAM,QAAQ,MAAM,OAAO;AAC3B,QAAM,UAAU,YAAY;AAI5B,MAAI;AACJ,MAAI,UAAU;AACZ,WAAO,EAAE,WAAW,kCAAkC,WAAW,iCAAiC;AAAA,EACpG,WAAW,OAAO;AAChB,WAAO,EAAE,WAAW,OAAO,MAAM,CAAC,CAAC,KAAK,iBAAiB,OAAO,MAAM,CAAC,CAAC,KAAK,WAAW,OAAO,MAAM,CAAC,CAAC,IAAI;AAAA,EAC7G,WAAW,SAAS;AAClB,WAAO,EAAE,WAAW,gCAAgC,iBAAiB,sCAAsC,WAAW,wBAAwB;AAAA,EAChJ,OAAO;AACL,WAAO,EAAE,WAAW,eAAe,iBAAiB,kCAAkC,WAAW,wBAAwB;AAAA,EAC3H;AACA,OAAK,SAAS,IAAI,UAAU,0BAA0B;AACtD,OAAK,SAAS,IAAI;AAElB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,cAAY;AAAA,MACZ,OAAO;AAAA,MACP;AAAA,MACC,GAAG;AAAA,MACJ,WAAW,CAAC,cAAc,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,MAC7D,OAAO,GAAG;AAAA,QACR,GAAG;AAAA,QACH,SAAS;AAAA,QACT,YAAY;AAAA,QACZ,gBAAgB;AAAA,QAChB,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,MAAM;AAAA,QACN,cAAc;AAAA,QACd,aAAa;AAAA,QACb,aAAa;AAAA,QACb,QAAQ,WAAW,gBAAgB;AAAA,QACnC,YAAY;AAAA,QACZ,SAAS;AAAA,QACT,GAAG;AAAA,MACL,CAAC;AAAA,MAEA;AAAA;AAAA,EACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/core/IconButton.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\n\n/**\n * Square icon-only control for toolbars, card corners and top bars. Always pass `label`.\n * `success` / `warning` / `error` are solid semantic fills - same words as Button / Badge.\n */\nexport interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: 'ghost' | 'secondary' | 'primary' | 'success' | 'warning' | 'error';\n size?: 'sm' | 'md' | 'lg';\n /** Accessible name - becomes aria-label and title. Required. */\n label: string;\n disabled?: boolean;\n /** The icon element (Lucide 20px stroke 1.75). */\n children?: React.ReactNode;\n}\n\nconst S = { sm: 32, md: 40, lg: 48 } as const;\n\n/** Solid-fill variants: [base, hover, fg]. */\nconst SOLID: Partial<Record<NonNullable<IconButtonProps['variant']>, [string, string, string]>> = {\n primary: ['--interactive-primary', '--interactive-primary-hover', '--interactive-primary-fg'],\n success: ['--interactive-success', '--interactive-success-hover', '--interactive-success-fg'],\n warning: ['--interactive-warning', '--interactive-warning-hover', '--interactive-warning-fg'],\n error: ['--interactive-error', '--interactive-error-hover', '--interactive-error-fg'],\n};\n\nexport function IconButton({ variant = 'ghost', size = 'md', label, disabled = false, children, className, style, ...rest }: IconButtonProps) {\n const d = S[size] || S.md;\n const solid = SOLID[variant];\n const outline = variant === 'secondary';\n\n // The values of each state, for `.sereno-btn` (styles.css) to switch between on :hover / :active / :focus-visible\n // (SS-577). Only a press scale and a focus ring are common to all; the rest is per variant.\n let vars: Record<string, string>;\n if (disabled) {\n vars = { '--sd-bg': 'var(--interactive-disabled-bg)', '--sd-fg': 'var(--interactive-disabled-fg)' };\n } else if (solid) {\n vars = { '--sd-bg': `var(${solid[0]})`, '--sd-bg-hover': `var(${solid[1]})`, '--sd-fg': `var(${solid[2]})` };\n } else if (outline) {\n vars = { '--sd-bg': 'var(--interactive-secondary)', '--sd-bg-hover': 'var(--interactive-secondary-hover)', '--sd-fg': 'var(--text-secondary)' };\n } else {\n vars = { '--sd-bg': 'transparent', '--sd-bg-hover': 'var(--interactive-ghost-hover)', '--sd-fg': 'var(--text-secondary)' };\n }\n vars['--sd-bd'] = outline ? 'var(--border-default)' : 'transparent';\n vars['--sd-sh'] = 'none';\n\n return (\n <button\n type=\"button\"\n aria-label={label}\n title={label}\n disabled={disabled}\n {...rest}\n className={['sereno-btn', className].filter(Boolean).join(' ')}\n style={sx({\n ...vars,\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: d,\n height: d,\n flex: '0 0 auto',\n borderRadius: 'var(--radius-control)',\n borderWidth: 'var(--border-width-hairline)',\n borderStyle: 'solid',\n cursor: disabled ? 'not-allowed' : 'pointer',\n transition: 'var(--transition-control)',\n ...style,\n })}\n >\n {children}\n </button>\n );\n}\n"],"mappings":";AAkDI;AA/CJ,SAAS,UAAU;AAgBnB,MAAM,I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A,QAChB,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,MAAM;AAAA,QACN,cAAc;AAAA,QACd,aAAa;AAAA,QACb,aAAa;AAAA,QACb,QAAQ,WAAW,gBAAgB;AAAA,QACnC,YAAY;AAAA,QACZ,GAAG;AAAA,MACL,CAAC;AAAA,MAEA;AAAA;AAAA,EACH;AAEJ;","names":[]}
@@ -57,12 +57,15 @@ const Switch = React.forwardRef(function Switch2({
57
57
  height: t.h,
58
58
  flex: "0 0 auto",
59
59
  borderRadius: "var(--radius-pill)",
60
- background: checked ? "var(--interactive-primary)" : "var(--border-strong)",
60
+ // The fill is `background: var(--sd-bg)` in styles.css (an inline colour would beat the rules that
61
+ // restyle it in forced colors).
62
+ "--sd-bg": checked ? "var(--interactive-primary)" : "var(--border-strong)",
61
63
  transition: "background-color var(--duration-normal) var(--ease-standard)"
62
64
  }),
63
65
  children: /* @__PURE__ */ jsx(
64
66
  "span",
65
67
  {
68
+ className: "sereno-switch-thumb",
66
69
  style: sx({
67
70
  position: "absolute",
68
71
  top: 3,
@@ -70,7 +73,6 @@ const Switch = React.forwardRef(function Switch2({
70
73
  width: t.thumb,
71
74
  height: t.thumb,
72
75
  borderRadius: "999px",
73
- background: "#fff",
74
76
  boxShadow: "var(--shadow-sm)",
75
77
  transition: "left var(--duration-normal) var(--ease-gentle)"
76
78
  })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/forms/Switch.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\n\n/** Instant-apply toggle for settings rows (agenda online, lembretes, tema). Never use inside a form that needs Save. Host must include the `.sereno-switch` focus rule (see globals.css). */\nexport interface SwitchProps {\n label?: string;\n description?: string;\n checked?: boolean;\n disabled?: boolean;\n /** Track size. `sm` for dense settings lists; `md` is the default. Matches `Checkbox` / `Radio`. */\n size?: 'sm' | 'md';\n onChange?: (e: { target: { checked: boolean } }) => void;\n style?: React.CSSProperties;\n /**\n * Accessible name for the `role=\"switch\"` element. Wrapping it in a\n * `<label>` (below) only associates text for *native* labelable controls -\n * a custom ARIA widget still announces with no name at all otherwise (SS-232\n * caught this live via axe: `aria-toggle-field-name`). Defaults to `label`;\n * only pass this separately for a label-less switch (an icon-only row).\n */\n 'aria-label'?: string;\n}\n\nconst TRACK = { sm: { w: 36, h: 22, thumb: 16 }, md: { w: 44, h: 26, thumb: 20 } } as const;\n\n/**\n * `ref` reaches the `<span role=\"switch\">` - there's no native form element\n * underneath, so this only gives you `.focus()` (useful for\n * `setFocus()`-on-error), never `.value`/`.checked`. Switch is documented as\n * \"never use inside a form that needs Save\" already; it isn't a\n * `react-hook-form` `register()` candidate regardless of `ref` - use\n * `Controller` if one genuinely needs to live in a saved form.\n */\nexport const Switch = React.forwardRef<HTMLSpanElement, SwitchProps>(function Switch({\n label,\n description,\n checked = false,\n disabled,\n size = 'md',\n onChange,\n style,\n 'aria-label': ariaLabel,\n}: SwitchProps, ref) {\n const t = TRACK[size];\n const toggle = () => {\n if (!disabled && onChange) onChange({ target: { checked: !checked } });\n };\n return (\n <label\n style={sx({\n display: 'flex',\n gap: 'var(--space-3)',\n alignItems: 'center',\n justifyContent: 'space-between',\n cursor: disabled ? 'not-allowed' : 'pointer',\n opacity: disabled ? 0.6 : 1,\n ...style,\n })}\n >\n <span style={sx({ display: 'flex', flexDirection: 'column', gap: 2 })}>\n {label && (\n <span style={sx({ fontFamily: 'var(--font-body)', fontSize: 'var(--text-base)', fontWeight: 'var(--weight-medium)', color: 'var(--text-primary)' })}>{label}</span>\n )}\n {description && (\n <span style={sx({ fontFamily: 'var(--font-body)', fontSize: 'var(--text-xs)', color: 'var(--text-muted)', lineHeight: 1.45 })}>{description}</span>\n )}\n </span>\n <span\n ref={ref}\n role=\"switch\"\n aria-checked={checked}\n aria-label={label ?? ariaLabel}\n aria-disabled={disabled || undefined}\n tabIndex={disabled ? undefined : 0}\n className=\"sereno-switch\"\n onClick={toggle}\n onKeyDown={(e) => {\n if (e.key === ' ' || e.key === 'Enter') {\n e.preventDefault();\n toggle();\n }\n }}\n style={sx({\n position: 'relative',\n width: t.w,\n height: t.h,\n flex: '0 0 auto',\n borderRadius: 'var(--radius-pill)',\n background: checked ? 'var(--interactive-primary)' : 'var(--border-strong)',\n transition: 'background-color var(--duration-normal) var(--ease-standard)',\n })}\n >\n <span\n style={sx({\n position: 'absolute',\n top: 3,\n left: checked ? t.w - t.thumb - 3 : 3,\n width: t.thumb,\n height: t.thumb,\n borderRadius: '999px',\n background: '#fff',\n boxShadow: 'var(--shadow-sm)',\n transition: 'left var(--duration-normal) var(--ease-gentle)',\n })}\n />\n </span>\n </label>\n );\n});\n\nSwitch.displayName = 'Switch';\n"],"mappings":";AA6DM,SAEI,KAFJ;AA3DN,YAAY,WAAW;AACvB,SAAS,UAAU;AAsBnB,MAAM,QAAQ,EAAE,IAAI,EAAE,GAAG,IAAI,GAAG,IAAI,OAAO,GAAG,GAAG,IAAI,EAAE,GAAG,IAAI,GAAG,IAAI,OAAO,GAAG,EAAE;AAU1E,MAAM,SAAS,MAAM,WAAyC,SAASA,QAAO;AAAA,EACnF;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,cAAc;AAChB,GAAgB,KAAK;AACnB,QAAM,IAAI,MAAM,IAAI;AACpB,QAAM,SAAS,MAAM;AACnB,QAAI,CAAC,YAAY,SAAU,UAAS,EAAE,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAAE,CAAC;AAAA,EACvE;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,GAAG;AAAA,QACR,SAAS;AAAA,QACT,KAAK;AAAA,QACL,YAAY;AAAA,QACZ,gBAAgB;AAAA,QAChB,QAAQ,WAAW,gBAAgB;AAAA,QACnC,SAAS,WAAW,MAAM;AAAA,QAC1B,GAAG;AAAA,MACL,CAAC;AAAA,MAED;AAAA,6BAAC,UAAK,OAAO,GAAG,EAAE,SAAS,QAAQ,eAA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ent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\n\n/** Instant-apply toggle for settings rows (agenda online, lembretes, tema). Never use inside a form that needs Save. Host must include the `.sereno-switch` focus rule (see globals.css). */\nexport interface SwitchProps {\n label?: string;\n description?: string;\n checked?: boolean;\n disabled?: boolean;\n /** Track size. `sm` for dense settings lists; `md` is the default. Matches `Checkbox` / `Radio`. */\n size?: 'sm' | 'md';\n onChange?: (e: { target: { checked: boolean } }) => void;\n style?: React.CSSProperties;\n /**\n * Accessible name for the `role=\"switch\"` element. Wrapping it in a\n * `<label>` (below) only associates text for *native* labelable controls -\n * a custom ARIA widget still announces with no name at all otherwise (SS-232\n * caught this live via axe: `aria-toggle-field-name`). Defaults to `label`;\n * only pass this separately for a label-less switch (an icon-only row).\n */\n 'aria-label'?: string;\n}\n\nconst TRACK = { sm: { w: 36, h: 22, thumb: 16 }, md: { w: 44, h: 26, thumb: 20 } } as const;\n\n/**\n * `ref` reaches the `<span role=\"switch\">` - there's no native form element\n * underneath, so this only gives you `.focus()` (useful for\n * `setFocus()`-on-error), never `.value`/`.checked`. Switch is documented as\n * \"never use inside a form that needs Save\" already; it isn't a\n * `react-hook-form` `register()` candidate regardless of `ref` - use\n * `Controller` if one genuinely needs to live in a saved form.\n */\nexport const Switch = React.forwardRef<HTMLSpanElement, SwitchProps>(function Switch({\n label,\n description,\n checked = false,\n disabled,\n size = 'md',\n onChange,\n style,\n 'aria-label': ariaLabel,\n}: SwitchProps, ref) {\n const t = TRACK[size];\n const toggle = () => {\n if (!disabled && onChange) onChange({ target: { checked: !checked } });\n };\n return (\n <label\n style={sx({\n display: 'flex',\n gap: 'var(--space-3)',\n alignItems: 'center',\n justifyContent: 'space-between',\n cursor: disabled ? 'not-allowed' : 'pointer',\n opacity: disabled ? 0.6 : 1,\n ...style,\n })}\n >\n <span style={sx({ display: 'flex', flexDirection: 'column', gap: 2 })}>\n {label && (\n <span style={sx({ fontFamily: 'var(--font-body)', fontSize: 'var(--text-base)', fontWeight: 'var(--weight-medium)', color: 'var(--text-primary)' })}>{label}</span>\n )}\n {description && (\n <span style={sx({ fontFamily: 'var(--font-body)', fontSize: 'var(--text-xs)', color: 'var(--text-muted)', lineHeight: 1.45 })}>{description}</span>\n )}\n </span>\n <span\n ref={ref}\n role=\"switch\"\n aria-checked={checked}\n aria-label={label ?? ariaLabel}\n aria-disabled={disabled || undefined}\n tabIndex={disabled ? undefined : 0}\n className=\"sereno-switch\"\n onClick={toggle}\n onKeyDown={(e) => {\n if (e.key === ' ' || e.key === 'Enter') {\n e.preventDefault();\n toggle();\n }\n }}\n style={sx({\n position: 'relative',\n width: t.w,\n height: t.h,\n flex: '0 0 auto',\n borderRadius: 'var(--radius-pill)',\n // The fill is `background: var(--sd-bg)` in styles.css (an inline colour would beat the rules that\n // restyle it in forced colors).\n '--sd-bg': checked ? 'var(--interactive-primary)' : 'var(--border-strong)',\n transition: 'background-color var(--duration-normal) var(--ease-standard)',\n })}\n >\n <span\n className=\"sereno-switch-thumb\"\n style={sx({\n position: 'absolute',\n top: 3,\n left: checked ? t.w - t.thumb - 3 : 3,\n width: t.thumb,\n height: t.thumb,\n borderRadius: '999px',\n boxShadow: 'var(--shadow-sm)',\n transition: 'left var(--duration-normal) var(--ease-gentle)',\n })}\n />\n </span>\n </label>\n );\n});\n\nSwitch.displayName = 'Switch';\n"],"mappings":";AA6DM,SAEI,KAFJ;AA3DN,YAAY,WAAW;AACvB,SAAS,UAAU;AAsBnB,MAAM,QAAQ,EAAE,IAAI,EAAE,GAAG,IAAI,GAAG,IAAI,OAAO,GAAG,GAAG,IAAI,EAAE,GAAG,IAAI,GAAG,IAAI,OAAO,GAAG,EAAE;AAU1E,MAAM,SAAS,MAAM,WAAyC,SAASA,QAAO;AAAA,EACnF;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,cAAc;AAChB,GAAgB,KAAK;AACnB,QAAM,IAAI,MAA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AAAA,YAED;AAAA,cAAC;AAAA;AAAA,gBACC,WAAU;AAAA,gBACV,OAAO,GAAG;AAAA,kBACR,UAAU;AAAA,kBACV,KAAK;AAAA,kBACL,MAAM,UAAU,EAAE,IAAI,EAAE,QAAQ,IAAI;AAAA,kBACpC,OAAO,EAAE;AAAA,kBACT,QAAQ,EAAE;AAAA,kBACV,cAAc;AAAA,kBACd,WAAW;AAAA,kBACX,YAAY;AAAA,gBACd,CAAC;AAAA;AAAA,YACH;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,OAAO,cAAc;","names":["Switch"]}
@@ -70,7 +70,6 @@ const Textarea = React.forwardRef(function Textarea2({
70
70
  background: disabled ? "var(--interactive-disabled-bg)" : "var(--bg-surface)",
71
71
  borderWidth: "var(--border-width-hairline)",
72
72
  borderStyle: "solid",
73
- outline: "none",
74
73
  fontFamily: "var(--font-body)",
75
74
  fontSize: "var(--text-base)",
76
75
  lineHeight: "var(--leading-normal)",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/forms/Textarea.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\nimport { Field } from '../_internal/Field';\nimport { fieldA11y } from '../_internal/fieldA11y';\nimport { CharCount } from '../_internal/CharCount';\nimport { mergeRefs } from '../_internal/mergeRefs';\nimport { useValueLength } from '../_internal/useValueLength';\nimport { fieldFrameVars } from './_internal/fieldFrame';\n\n/** Multi-line field for booking notes and service descriptions. */\nexport interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {\n label?: string;\n hint?: string;\n error?: string;\n required?: boolean;\n rows?: number;\n /**\n * Show a `n / max` character counter on the hint row. Implied when `maxLength`\n * is set; pass `showCount` on its own for a bare count with no ceiling.\n */\n showCount?: boolean;\n containerStyle?: React.CSSProperties;\n /** Reserve the hint/error row's height even with neither set - stops the\n * field from growing the moment a validation message appears. */\n preserveHelperSpace?: boolean;\n}\n\nexport const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(function Textarea(\n {\n label,\n hint,\n error,\n required,\n rows = 4,\n showCount,\n preserveHelperSpace,\n disabled,\n id,\n style,\n containerStyle,\n className,\n 'aria-describedby': describedBy,\n 'aria-invalid': invalid,\n 'aria-required': ariaRequired,\n ...rest\n },\n ref,\n) {\n const textareaRef = React.useRef<HTMLTextAreaElement>(null);\n // Stable across renders, so a form library's ref callback isn't detached and re-attached each time.\n const setRefs = React.useMemo(() => mergeRefs(textareaRef, ref), [ref]);\n // SSR-stable id (the DS source used Math.random(), which breaks hydration).\n const autoId = React.useId();\n const rid = id || autoId;\n // Names the hint / error line and flags the error, so a screen reader reads both with the field.\n const a11y = fieldA11y(rid, { hint, error, describedBy, invalid, required, ariaRequired });\n\n const max = typeof rest.maxLength === 'number' ? rest.maxLength : undefined;\n const showCounter = Boolean(showCount) || max != null;\n // Controlled: the count comes from `value`. Uncontrolled: from the element itself, so a\n // value written by code (react-hook-form's `reset()` / `setValue()`, `el.value = …`) counts too.\n const uncount = useValueLength(\n textareaRef,\n showCounter && rest.value === undefined,\n typeof rest.defaultValue === 'string' || typeof rest.defaultValue === 'number' ? String(rest.defaultValue).length : 0,\n );\n const count = rest.value !== undefined ? String(rest.value ?? '').length : uncount;\n\n return (\n <Field\n label={label}\n hint={hint}\n error={error}\n required={required}\n requiredExposed\n htmlFor={rid}\n style={containerStyle}\n counter={showCounter ? <CharCount count={count} max={max} /> : undefined}\n preserveHelperSpace={preserveHelperSpace}\n >\n <textarea\n id={rid}\n ref={setRefs}\n rows={rows}\n disabled={disabled}\n {...rest}\n {...a11y}\n // The border colour and the focus ring are CSS (`.sereno-field:focus` in styles.css, SS-582): the field\n // keeps no focus state, and a caller's `onFocus` / `onBlur` (react-hook-form's `register()` injects\n // one) stays in `...rest`, untouched.\n className={['sereno-field', className].filter(Boolean).join(' ')}\n style={sx({\n ...fieldFrameVars(!!error),\n width: '100%',\n padding: 'var(--space-3)',\n resize: 'vertical',\n borderRadius: 'var(--radius-control)',\n background: disabled ? 'var(--interactive-disabled-bg)' : 'var(--bg-surface)',\n borderWidth: 'var(--border-width-hairline)',\n borderStyle: 'solid',\n outline: 'none',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-base)',\n lineHeight: 'var(--leading-normal)',\n color: disabled ? 'var(--text-disabled)' : 'var(--text-primary)',\n transition: 'var(--transition-control)',\n ...style,\n })}\n />\n </Field>\n );\n});\n\nTextarea.displayName = 'Textarea';"],"mappings":";AA+E6B;AA7E7B,YAAY,WAAW;AACvB,SAAS,UAAU;AACnB,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAoBxB,MAAM,WAAW,MAAM,WAA+C,SAASA,UACpF;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,oBAAoB;AAAA,EACpB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,GAAG;AACL,GACA,KACA;AACA,QAAM,cAAc,MAAM,OAA4B,IAAI;AAE1D,QAAM,UAAU,MAAM,QAAQ,MAAM,UAAU,aAAa,GAAG,GAAG,CAAC,GAAG,CAAC;AAEtE,QAAM,SAAS,MAAM,MAAM;AAC3B,QAAM,MAAM,MAAM;AAElB,QAAM,OAAO,UAAU,KAAK,EAAE,MAAM,OAAO,aAAa,SAAS,UAAU,aAAa,CAAC;AAEzF,QAAM,MAAM,OAAO,KAAK,cAAc,WAAW,KAAK,YAAY;AAClE,QAAM,cAAc,QAAQ,SAAS,KAAK,OAAO;AAGjD,QAAM,UAAU;AAAA,IACd;AAAA,IACA,eAAe,KAAK,UAAU;AAAA,IAC9B,OAAO,KAAK,iBAAiB,YAAY,OAAO,KAAK,iBAAiB,WAAW,OAAO,KAAK,YAAY,EAAE,SAAS;AAAA,EACtH;AACA,QAAM,QAAQ,KAAK,UAAU,SAAY,OAAO,KAAK,SAAS,EAAE,EAAE,SAAS;AAE3E,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,iBAAe;AAAA,MACf,SAAS;AAAA,MACT,OAAO;AAAA,MACP,SAAS,cAAc,oBAAC,aAAU,OAAc,KAAU,IAAK;AAAA,MAC/D;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,IAAI;AAAA,UACJ,KAAK;AAAA,UACL;AAAA,UACA;AAAA,UACC,GAAG;AAAA,UACH,GAAG;AAAA,UAIJ,WAAW,CAAC,gBAAgB,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,UAC/D,OAAO,GAAG;AAAA,YACR,GAAG,eAAe,CAAC,CAAC,KAAK;AAAA,YACzB,OAAO;AAAA,YACP,SAAS;AAAA,YACT,QAAQ;AAAA,YACR,cAAc;AAAA,YACd,YAAY,WAAW,mCAAmC;AAAA,YAC1D,aAAa;AAAA,YACb,aAAa;AAAA,YACb,SAAS;AAAA,YACT,YAAY;AAAA,YACZ,UAAU;AAAA,YACV,YAAY;AAAA,YACZ,OAAO,WAAW,yBAAyB;AAAA,YAC3C,YAAY;AAAA,YACZ,GAAG;AAAA,UACL,CAAC;AAAA;AAAA,MACH;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,SAAS,cAAc;","names":["Textarea"]}
1
+ {"version":3,"sources":["../../src/forms/Textarea.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\nimport { Field } from '../_internal/Field';\nimport { fieldA11y } from '../_internal/fieldA11y';\nimport { CharCount } from '../_internal/CharCount';\nimport { mergeRefs } from '../_internal/mergeRefs';\nimport { useValueLength } from '../_internal/useValueLength';\nimport { fieldFrameVars } from './_internal/fieldFrame';\n\n/** Multi-line field for booking notes and service descriptions. */\nexport interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {\n label?: string;\n hint?: string;\n error?: string;\n required?: boolean;\n rows?: number;\n /**\n * Show a `n / max` character counter on the hint row. Implied when `maxLength`\n * is set; pass `showCount` on its own for a bare count with no ceiling.\n */\n showCount?: boolean;\n containerStyle?: React.CSSProperties;\n /** Reserve the hint/error row's height even with neither set - stops the\n * field from growing the moment a validation message appears. */\n preserveHelperSpace?: boolean;\n}\n\nexport const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(function Textarea(\n {\n label,\n hint,\n error,\n required,\n rows = 4,\n showCount,\n preserveHelperSpace,\n disabled,\n id,\n style,\n containerStyle,\n className,\n 'aria-describedby': describedBy,\n 'aria-invalid': invalid,\n 'aria-required': ariaRequired,\n ...rest\n },\n ref,\n) {\n const textareaRef = React.useRef<HTMLTextAreaElement>(null);\n // Stable across renders, so a form library's ref callback isn't detached and re-attached each time.\n const setRefs = React.useMemo(() => mergeRefs(textareaRef, ref), [ref]);\n // SSR-stable id (the DS source used Math.random(), which breaks hydration).\n const autoId = React.useId();\n const rid = id || autoId;\n // Names the hint / error line and flags the error, so a screen reader reads both with the field.\n const a11y = fieldA11y(rid, { hint, error, describedBy, invalid, required, ariaRequired });\n\n const max = typeof rest.maxLength === 'number' ? rest.maxLength : undefined;\n const showCounter = Boolean(showCount) || max != null;\n // Controlled: the count comes from `value`. Uncontrolled: from the element itself, so a\n // value written by code (react-hook-form's `reset()` / `setValue()`, `el.value = …`) counts too.\n const uncount = useValueLength(\n textareaRef,\n showCounter && rest.value === undefined,\n typeof rest.defaultValue === 'string' || typeof rest.defaultValue === 'number' ? String(rest.defaultValue).length : 0,\n );\n const count = rest.value !== undefined ? String(rest.value ?? '').length : uncount;\n\n return (\n <Field\n label={label}\n hint={hint}\n error={error}\n required={required}\n requiredExposed\n htmlFor={rid}\n style={containerStyle}\n counter={showCounter ? <CharCount count={count} max={max} /> : undefined}\n preserveHelperSpace={preserveHelperSpace}\n >\n <textarea\n id={rid}\n ref={setRefs}\n rows={rows}\n disabled={disabled}\n {...rest}\n {...a11y}\n // The border colour and the focus ring are CSS (`.sereno-field:focus` in styles.css, SS-582): the field\n // keeps no focus state, and a caller's `onFocus` / `onBlur` (react-hook-form's `register()` injects\n // one) stays in `...rest`, untouched.\n className={['sereno-field', className].filter(Boolean).join(' ')}\n style={sx({\n ...fieldFrameVars(!!error),\n width: '100%',\n padding: 'var(--space-3)',\n resize: 'vertical',\n borderRadius: 'var(--radius-control)',\n background: disabled ? 'var(--interactive-disabled-bg)' : 'var(--bg-surface)',\n borderWidth: 'var(--border-width-hairline)',\n borderStyle: 'solid',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-base)',\n lineHeight: 'var(--leading-normal)',\n color: disabled ? 'var(--text-disabled)' : 'var(--text-primary)',\n transition: 'var(--transition-control)',\n ...style,\n })}\n />\n </Field>\n );\n});\n\nTextarea.displayName = 'Textarea';"],"mappings":";AA+E6B;AA7E7B,YAAY,WAAW;AACvB,SAAS,UAAU;AACnB,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAoBxB,MAAM,WAAW,MAAM,WAA+C,SAASA,UACpF;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,oBAAoB;AAAA,EACpB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,GAAG;AACL,GACA,KACA;AACA,QAAM,cAAc,MAAM,OAA4B,IAAI;AAE1D,QAAM,UAAU,MAAM,QAAQ,MAAM,UAAU,aAAa,GAAG,GAAG,CAAC,GAAG,CAAC;AAEtE,QAAM,SAAS,MAAM,MAAM;AAC3B,QAAM,MAAM,MAAM;AAElB,QAAM,OAAO,UAAU,KA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77
77
  const done = i < current;
78
78
  const active = i === current;
79
79
  const reachable = typeof onStepClick === "function" && i <= current;
80
+ const state = done ? "done" : active ? "active" : "todo";
80
81
  const common = {
81
82
  flex: dots ? "0 0 auto" : 1,
82
83
  border: "none",
83
84
  padding: 0,
84
85
  cursor: reachable ? "pointer" : "default",
85
- background: done || active ? "var(--interactive-primary)" : "var(--border-default)",
86
+ "--sd-bg": done || active ? "var(--interactive-primary)" : "var(--border-default)",
86
87
  transition: "background-color var(--duration-normal) var(--ease-standard)"
87
88
  };
88
89
  return dots ? /* @__PURE__ */ jsx(
@@ -90,6 +91,8 @@ function Step({ label, index }) {
90
91
  {
91
92
  "aria-label": label,
92
93
  "aria-current": active ? "step" : void 0,
94
+ className: "sereno-step",
95
+ "data-state": state,
93
96
  disabled: !reachable,
94
97
  onClick: () => reachable && onStepClick(i),
95
98
  style: sx({
@@ -105,6 +108,8 @@ function Step({ label, index }) {
105
108
  {
106
109
  "aria-label": label,
107
110
  "aria-current": active ? "step" : void 0,
111
+ className: "sereno-step",
112
+ "data-state": state,
108
113
  disabled: !reachable,
109
114
  onClick: () => reachable && onStepClick(i),
110
115
  style: sx({ ...common, height: 3, borderRadius: "var(--radius-pill)" })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/navigation/Stepper.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\n\n/**\n * Progress indicator for a linear multi-step flow - a **compound component**\n * (onboarding, guided setup). Renders the segment track plus a\n * `<counter> · <label>` line (a dot separates the counter from the current\n * step's label). The counter defaults to `Step N of M` - the DS ships no\n * localised copy; pass `stepLabel` for another language.\n *\n * ```tsx\n * <Stepper current={step} onStepClick={setStep}>\n * <Stepper.Step label=\"Your profile\" />\n * <Stepper.Step label=\"First service\" />\n * <Stepper.Step label=\"Your schedule\" />\n * </Stepper>\n * ```\n */\nexport interface StepperProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Zero-based index of the active step. */\n current?: number;\n /** When provided, completed and current steps become clickable (back-navigation only). */\n onStepClick?: (index: number) => void;\n /** `bar` = full-width segments (desktop wizards). `dots` = compact pills (mobile). */\n variant?: 'bar' | 'dots';\n /**\n * Formats the step counter (both args 1-based / total). Default:\n * `` `Step ${current} of ${total}` ``. Return `null` to drop the counter and\n * show only the current step's `label`.\n */\n stepLabel?: (current: number, total: number) => React.ReactNode;\n children: React.ReactNode;\n}\n\nexport interface StepperStepProps {\n /** Stable identifier - not read by `Stepper` itself, only for the caller's own use (e.g. a React `key`). */\n value?: string;\n /** Short label - shown next to the step counter while this step is active. */\n label: string;\n /** Set by the root via `cloneElement` - this step's position among its siblings. Not for consumers to pass. */\n index?: number;\n}\n\ninterface StepperContextValue {\n current: number;\n onStepClick?: (index: number) => void;\n variant: 'bar' | 'dots';\n}\n\nconst defaultStepLabel = (current: number, total: number) => `Step ${current} of ${total}`;\n\nconst StepperContext = React.createContext<StepperContextValue | null>(null);\n\nfunction useStepperContext(component: string): StepperContextValue {\n const ctx = React.useContext(StepperContext);\n if (!ctx) throw new Error(`<Stepper.${component}> must be rendered inside <Stepper>.`);\n return ctx;\n}\n\nfunction StepperRoot({ current = 0, onStepClick, variant = 'bar', stepLabel = defaultStepLabel, children, style, ...rest }: StepperProps) {\n const dots = variant === 'dots';\n // Steps render their own segment (DOM order does the layout, like `Tabs.Tab`);\n // the root only needs each one's position (to compare against `current`) and,\n // for the line below the track, the active one's `label`.\n const items = React.Children.toArray(children) as React.ReactElement<StepperStepProps>[];\n const activeLabel = items[current]?.props.label;\n\n const ctx: StepperContextValue = { current, onStepClick, variant };\n\n return (\n <StepperContext.Provider value={ctx}>\n <div {...rest} style={sx({ display: 'flex', flexDirection: 'column', gap: 'var(--space-3)', ...style })}>\n <div style={sx({ display: 'flex', gap: dots ? 'var(--space-2)' : 'var(--space-1)', alignItems: 'center' })}>\n {items.map((child, i) => React.cloneElement(child, { index: i, key: child.key ?? i }))}\n </div>\n {activeLabel !== undefined && (\n <div\n key={current}\n style={sx({\n display: 'flex',\n alignItems: 'center',\n gap: 'var(--space-2)',\n minWidth: 0,\n animation: 'sereno-fade-in var(--duration-fast) var(--ease-out)',\n })}\n >\n {(() => {\n const counter = stepLabel(current + 1, items.length);\n return counter == null ? null : (\n <>\n <span\n style={sx({\n flex: '0 0 auto',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-2xs)',\n fontWeight: 'var(--weight-bold)',\n letterSpacing: 'var(--tracking-wide)',\n textTransform: 'uppercase',\n color: 'var(--text-muted)',\n })}\n >\n {counter}\n </span>\n <span aria-hidden style={sx({ flex: '0 0 auto', width: 3, height: 3, borderRadius: '999px', background: 'var(--border-strong)' })} />\n </>\n );\n })()}\n <span\n style={sx({\n minWidth: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-sm)',\n fontWeight: 'var(--weight-semibold)',\n color: 'var(--text-primary)',\n })}\n >\n {activeLabel}\n </span>\n </div>\n )}\n </div>\n </StepperContext.Provider>\n );\n}\n\nfunction Step({ label, index }: StepperStepProps) {\n const { current, onStepClick, variant } = useStepperContext('Step');\n const dots = variant === 'dots';\n const i = index ?? 0;\n const done = i < current;\n const active = i === current;\n const reachable = typeof onStepClick === 'function' && i <= current;\n const common = {\n flex: dots ? '0 0 auto' : 1,\n border: 'none',\n padding: 0,\n cursor: reachable ? 'pointer' : 'default',\n background: done || active ? 'var(--interactive-primary)' : 'var(--border-default)',\n transition: 'background-color var(--duration-normal) var(--ease-standard)',\n };\n return dots ? (\n <button\n aria-label={label}\n aria-current={active ? 'step' : undefined}\n disabled={!reachable}\n onClick={() => reachable && onStepClick!(i)}\n style={sx({\n ...common,\n width: active ? 24 : 8,\n height: 8,\n borderRadius: 'var(--radius-pill)',\n transition: `${common.transition}, width var(--duration-normal) var(--ease-standard)`,\n })}\n />\n ) : (\n <button\n aria-label={label}\n aria-current={active ? 'step' : undefined}\n disabled={!reachable}\n onClick={() => reachable &&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AY;AAAA,EACd;AACA,SAAO,OACL;AAAA,IAAC;AAAA;AAAA,MACC,cAAY;AAAA,MACZ,gBAAc,SAAS,SAAS;AAAA,MAChC,UAAU,CAAC;AAAA,MACX,SAAS,MAAM,aAAa,YAAa,CAAC;AAAA,MAC1C,OAAO,GAAG;AAAA,QACR,GAAG;AAAA,QACH,OAAO,SAAS,KAAK;AAAA,QACrB,QAAQ;AAAA,QACR,cAAc;AAAA,QACd,YAAY,GAAG,OAAO,UAAU;AAAA,MAClC,CAAC;AAAA;AAAA,EACH,IAEA;AAAA,IAAC;AAAA;AAAA,MACC,cAAY;AAAA,MACZ,gBAAc,SAAS,SAAS;AAAA,MAChC,UAAU,CAAC;AAAA,MACX,SAAS,MAAM,aAAa,YAAa,CAAC;AAAA,MAC1C,OAAO,GAAG,EAAE,GAAG,QAAQ,QAAQ,GAAG,cAAc,qBAAqB,CAAC;AAAA;AAAA,EACxE;AAEJ;AAEO,MAAM,UAAU,OAAO,OAAO,aAAa,EAAE,KAAK,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../src/navigation/Stepper.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\n\n/**\n * Progress indicator for a linear multi-step flow - a **compound component**\n * (onboarding, guided setup). Renders the segment track plus a\n * `<counter> · <label>` line (a dot separates the counter from the current\n * step's label). The counter defaults to `Step N of M` - the DS ships no\n * localised copy; pass `stepLabel` for another language.\n *\n * ```tsx\n * <Stepper current={step} onStepClick={setStep}>\n * <Stepper.Step label=\"Your profile\" />\n * <Stepper.Step label=\"First service\" />\n * <Stepper.Step label=\"Your schedule\" />\n * </Stepper>\n * ```\n */\nexport interface StepperProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Zero-based index of the active step. */\n current?: number;\n /** When provided, completed and current steps become clickable (back-navigation only). */\n onStepClick?: (index: number) => void;\n /** `bar` = full-width segments (desktop wizards). `dots` = compact pills (mobile). */\n variant?: 'bar' | 'dots';\n /**\n * Formats the step counter (both args 1-based / total). Default:\n * `` `Step ${current} of ${total}` ``. Return `null` to drop the counter and\n * show only the current step's `label`.\n */\n stepLabel?: (current: number, total: number) => React.ReactNode;\n children: React.ReactNode;\n}\n\nexport interface StepperStepProps {\n /** Stable identifier - not read by `Stepper` itself, only for the caller's own use (e.g. a React `key`). */\n value?: string;\n /** Short label - shown next to the step counter while this step is active. */\n label: string;\n /** Set by the root via `cloneElement` - this step's position among its siblings. Not for consumers to pass. */\n index?: number;\n}\n\ninterface StepperContextValue {\n current: number;\n onStepClick?: (index: number) => void;\n variant: 'bar' | 'dots';\n}\n\nconst defaultStepLabel = (current: number, total: number) => `Step ${current} of ${total}`;\n\nconst StepperContext = React.createContext<StepperContextValue | null>(null);\n\nfunction useStepperContext(component: string): StepperContextValue {\n const ctx = React.useContext(StepperContext);\n if (!ctx) throw new Error(`<Stepper.${component}> must be rendered inside <Stepper>.`);\n return ctx;\n}\n\nfunction StepperRoot({ current = 0, onStepClick, variant = 'bar', stepLabel = defaultStepLabel, children, style, ...rest }: StepperProps) {\n const dots = variant === 'dots';\n // Steps render their own segment (DOM order does the layout, like `Tabs.Tab`);\n // the root only needs each one's position (to compare against `current`) and,\n // for the line below the track, the active one's `label`.\n const items = React.Children.toArray(children) as React.ReactElement<StepperStepProps>[];\n const activeLabel = items[current]?.props.label;\n\n const ctx: StepperContextValue = { current, onStepClick, variant };\n\n return (\n <StepperContext.Provider value={ctx}>\n <div {...rest} style={sx({ display: 'flex', flexDirection: 'column', gap: 'var(--space-3)', ...style })}>\n <div style={sx({ display: 'flex', gap: dots ? 'var(--space-2)' : 'var(--space-1)', alignItems: 'center' })}>\n {items.map((child, i) => React.cloneElement(child, { index: i, key: child.key ?? i }))}\n </div>\n {activeLabel !== undefined && (\n <div\n key={current}\n style={sx({\n display: 'flex',\n alignItems: 'center',\n gap: 'var(--space-2)',\n minWidth: 0,\n animation: 'sereno-fade-in var(--duration-fast) var(--ease-out)',\n })}\n >\n {(() => {\n const counter = stepLabel(current + 1, items.length);\n return counter == null ? null : (\n <>\n <span\n style={sx({\n flex: '0 0 auto',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-2xs)',\n fontWeight: 'var(--weight-bold)',\n letterSpacing: 'var(--tracking-wide)',\n textTransform: 'uppercase',\n color: 'var(--text-muted)',\n })}\n >\n {counter}\n </span>\n <span aria-hidden style={sx({ flex: '0 0 auto', width: 3, height: 3, borderRadius: '999px', background: 'var(--border-strong)' })} />\n </>\n );\n })()}\n <span\n style={sx({\n minWidth: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-sm)',\n fontWeight: 'var(--weight-semibold)',\n color: 'var(--text-primary)',\n })}\n >\n {activeLabel}\n </span>\n </div>\n )}\n </div>\n </StepperContext.Provider>\n );\n}\n\nfunction Step({ label, index }: StepperStepProps) {\n const { current, onStepClick, variant } = useStepperContext('Step');\n const dots = variant === 'dots';\n const i = index ?? 0;\n const done = i < current;\n const active = i === current;\n const reachable = typeof onStepClick === 'function' && i <= current;\n // The fill is `background: var(--sd-bg)` in styles.css, and `data-state` is what the forced-colors rules key on\n // (an inline colour would beat them, and the browser forces every authored colour in that mode).\n const state = done ? 'done' : active ? 'active' : 'todo';\n const common = {\n flex: dots ? '0 0 auto' : 1,\n border: 'none',\n padding: 0,\n cursor: reachable ? 'pointer' : 'default',\n '--sd-bg': done || active ? 'var(--interactive-primary)' : 'var(--border-default)',\n transition: 'background-color var(--duration-normal) var(--ease-standard)',\n };\n return dots ? (\n <button\n aria-label={label}\n aria-current={active ? 'step' : undefined}\n className=\"sereno-step\"\n data-state={state}\n disabled={!reachable}\n onClick={() => reachable && onStepClick!(i)}\n style={sx({\n ...common,\n width: active ? 24 : 8,\n height: 8,\n borderRadius: 'var(--radius-pill)',\n transition: `${common.transition}, width var(--duration-normal) var(--ease-standard)`,\n })}\n />\n ) : (\n <button\n aria-label={label}\n aria-current={active ? 'step' : undefined}\n className=\"sereno-step\"\n data-state={state}\n disabled={!reachable}\n onClick={() => reachable && onStepClick!(i)}\n style={sx({ ...common, height: 3, borderRadius: 'var(--radius-pill)' })}\n />\n );\n}\n\nexport const Stepper = Object.assign(StepperRoot, { Step });\n"],"mappings":";AA0EQ,SAiBQ,UAjBR,KAiBQ,YAjBR;AAxER,YAAY,WAAW;AACvB,SAAS,UAAU;AAgDnB,MAAM,mBAAmB,CAAC,SAAiB,UAAkB,QAAQ,OAAO,OAAO,KAAK;AAExF,MAAM,iBAAiB,MAAM,cAA0C,IAAI;AAE3E,SAAS,kBAAkB,WAAwC;AACjE,QAAM,MAAM,MAAM,WAAW,cAAc;AAC3C,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,YAAY,SAAS,sCAAsC;AACrF,SAAO;AACT;AAEA,SAAS,YAAY,EAAE,UAAU,GAAG,aAAa,UAAU,OAAO,YAAY,kBAAkB,UAAU,OAAO,GAAG,KAAK,GAAiB;AACxI,QAAM,OAAO,YAAY;AAIzB,QAAM,QAAQ,MAAM,SAAS,QAAQ,QAAQ;AAC7C,QAAM,cAAc,MAAM,OAAO,GAAG,MAAM;AAE1C,QAAM,MAA2B,EAAE,SAAS,aAAa,QAAQ;AAEjE,SACE,oBAAC,eAAe,UAAf,EAAwB,OAAO,KAC9B,+BAAC,SAAK,GAAG,MAAM,OAAO,GAAG,EAAE,SAAS,QAAQ,eAAe,UAAU,KAAK,kBAAkB,GAAG,MAAM,CAAC,GACpG;AAAA,wBAAC,SAAI,OAAO,GAAG,EAAE,SAAS,QAAQ,KAAK,OAAO,mBAAmB,kBAAkB,YAAY,SAAS,CAAC,GACtG,gBAAM,IAAI,CAAC,OAAO,MAAM,MAAM,aAAa,OAAO,EAAE,OAAO,GAAG,KAAK,MAAM,OAAO,EAAE,CAAC,CAAC,GACvF;AAAA,IACC,gBAAgB,UACf;AAAA,MAAC;AAAA;AAAA,QAEC,OAAO,GAAG;AAAA,UACR,SAAS;AAAA,UACT,YAAY;AA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,IACR,SAAS;AAAA,IACT,QAAQ,YAAY,YAAY;AAAA,IAChC,WAAW,QAAQ,SAAS,+BAA+B;AAAA,IAC3D,YAAY;AAAA,EACd;AACA,SAAO,OACL;AAAA,IAAC;AAAA;AAAA,MACC,cAAY;AAAA,MACZ,gBAAc,SAAS,SAAS;AAAA,MAChC,WAAU;AAAA,MACV,cAAY;AAAA,MACZ,UAAU,CAAC;AAAA,MACX,SAAS,MAAM,aAAa,YAAa,CAAC;AAAA,MAC1C,OAAO,GAAG;AAAA,QACR,GAAG;AAAA,QACH,OAAO,SAAS,KAAK;AAAA,QACrB,QAAQ;AAAA,QACR,cAAc;AAAA,QACd,YAAY,GAAG,OAAO,UAAU;AAAA,MAClC,CAAC;AAAA;AAAA,EACH,IAEA;AAAA,IAAC;AAAA;AAAA,MACC,cAAY;AAAA,MACZ,gBAAc,SAAS,SAAS;AAAA,MAChC,WAAU;AAAA,MACV,cAAY;AAAA,MACZ,UAAU,CAAC;AAAA,MACX,SAAS,MAAM,aAAa,YAAa,CAAC;AAAA,MAC1C,OAAO,GAAG,EAAE,GAAG,QAAQ,QAAQ,GAAG,cAAc,qBAAqB,CAAC;AAAA;AAAA,EACxE;AAEJ;AAEO,MAAM,UAAU,OAAO,OAAO,aAAa,EAAE,KAAK,CAAC;","names":[]}
package/dist/styles.css CHANGED
@@ -47,6 +47,9 @@
47
47
  specificity of `.sereno-btn:hover` (0,2,0), so an app's own `.my-button:hover` overrides it by being
48
48
  later in the cascade; the base `.sereno-btn` stays (0,1,0) so it still beats a global `button {}` reset. */
49
49
  .sereno-btn {
50
+ /* The focus ring is a box-shadow; the browser's own outline would double it. In forced colors the shadow is
51
+ dropped and the block at the end of this file turns an outline on again. */
52
+ outline: none;
50
53
  background: var(--sd-bg);
51
54
  color: var(--sd-fg);
52
55
  border-color: var(--sd-bd);
@@ -79,6 +82,9 @@
79
82
  .sereno-card[data-interactive]:active {
80
83
  transform: scale(var(--press-scale));
81
84
  }
85
+ .sereno-card[data-clickable] {
86
+ outline: none;
87
+ }
82
88
  .sereno-card[data-clickable]:focus-visible {
83
89
  box-shadow: var(--sd-ring), var(--sd-drop), var(--focus-ring);
84
90
  }
@@ -90,6 +96,8 @@
90
96
  `--sd-bg-hover`). A disabled card has no hover value and the rules leave it out; the focus ring goes on top of
91
97
  whichever ring the card is showing, hovered or not. */
92
98
  .sereno-action {
99
+ outline: none;
100
+ border: none;
93
101
  background: var(--sd-bg);
94
102
  box-shadow: var(--sd-ring);
95
103
  }
@@ -134,6 +142,9 @@
134
142
  border-color: var(--sd-bd, var(--border-default));
135
143
  box-shadow: none;
136
144
  }
145
+ textarea.sereno-field {
146
+ outline: none;
147
+ }
137
148
  .sereno-field:where(textarea:focus, :has(> input:focus), [data-active]) {
138
149
  border-color: var(--sd-bd-active, var(--border-focus));
139
150
  box-shadow: var(--sd-ring-active, var(--focus-ring));
@@ -175,6 +186,10 @@
175
186
  /* Switch is a role=switch <span>, not an input - give it a keyboard focus ring. */
176
187
  .sereno-switch {
177
188
  outline: none;
189
+ background: var(--sd-bg);
190
+ }
191
+ .sereno-switch-thumb {
192
+ background: #fff;
178
193
  }
179
194
  .sereno-switch:focus-visible {
180
195
  box-shadow: var(--focus-ring);
@@ -259,6 +274,11 @@
259
274
  border-color: var(--sd-bd-hover, var(--sd-bd));
260
275
  }
261
276
 
277
+ /* Stepper segment: its fill is a --sd-bg value so the forced-colors rules can restyle it by `data-state`. */
278
+ .sereno-step {
279
+ background: var(--sd-bg);
280
+ }
281
+
262
282
  /* ── In-field affix button ───────────────────────────────────────────────────
263
283
  A bare icon button that sits inside the field frame (Input's password reveal,
264
284
  SearchInput's clear, FileUpload / AvatarUpload actions). NOTE: the class is
@@ -461,3 +481,150 @@
461
481
  @media (prefers-reduced-motion: reduce) {
462
482
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
463
483
  }
484
+
485
+ /* ── Forced colors / Windows High Contrast (#135) ────────────────────────────────────
486
+ In this mode the browser swaps every authored colour for a system one and drops every `box-shadow`. A focus
487
+ ring drawn as a shadow therefore disappears, and so does a state told only by a fill (the Switch's track and
488
+ thumb). A system colour keyword (`Highlight`, `ButtonText`, `Canvas`, `GrayText`...) is the one value the
489
+ browser keeps, so this block redraws those cues with them: an `outline` where the ring was a shadow, and a
490
+ border and system fills for the Switch. Nothing here applies outside forced colors.
491
+
492
+ The `outline: none` of `.sereno-btn`, `.sereno-action`, `.sereno-card[data-clickable]` and `textarea.sereno-field`
493
+ lives in the rules above and not inline, exactly so these rules (one pseudo-class more specific) can win it back.
494
+ The specificity stays low and there is no `!important`: an app can still restyle any of it. */
495
+ @media (forced-colors: active) {
496
+ .sereno-btn:focus-visible:where(:not(:disabled)),
497
+ .sereno-action:focus-visible,
498
+ .sereno-card[data-clickable]:focus-visible,
499
+ .sereno-switch:focus-visible {
500
+ outline: 2px solid Highlight;
501
+ outline-offset: 2px;
502
+ }
503
+ /* A text field's frame is active while a text box inside it has the focus, or a popup is open. */
504
+ .sereno-field:where(:has(> input:focus), [data-active]),
505
+ textarea.sereno-field:focus {
506
+ outline: 2px solid Highlight;
507
+ outline-offset: 1px;
508
+ border-color: Highlight;
509
+ }
510
+ /* Switch: a framed track (content-box, so the thumb keeps the coordinates it has in the normal mode), a thumb in
511
+ the text colour, and the on state filled with the selection colour. */
512
+ .sereno-switch {
513
+ box-sizing: content-box;
514
+ border: 2px solid ButtonText;
515
+ background: Canvas;
516
+ }
517
+ .sereno-switch[aria-checked='true'] {
518
+ border-color: Highlight;
519
+ background: Highlight;
520
+ }
521
+ .sereno-switch[aria-disabled='true'] {
522
+ border-color: GrayText;
523
+ background: Canvas;
524
+ }
525
+ .sereno-switch-thumb {
526
+ background: ButtonText;
527
+ box-shadow: none;
528
+ }
529
+ .sereno-switch[aria-checked='true'] .sereno-switch-thumb {
530
+ background: HighlightText;
531
+ }
532
+ .sereno-switch[aria-disabled='true'][aria-checked='true'] {
533
+ background: GrayText;
534
+ }
535
+ .sereno-switch[aria-disabled='true'] .sereno-switch-thumb {
536
+ background: GrayText;
537
+ }
538
+ .sereno-switch[aria-disabled='true'][aria-checked='true'] .sereno-switch-thumb {
539
+ background: Canvas;
540
+ }
541
+
542
+ /* ── Current, selected and checked states (#141) ────────────────────────────────────
543
+ A state told only by a fill or a shadow is lost in this mode, so each one gets a cue that survives. For anything
544
+ that carries TEXT the cue is a border, an underline or both, never a fill: Chromium draws a Canvas-coloured backplate
545
+ behind text on any non-Canvas fill in forced colors (white text on a white box), so `Highlight` behind a label
546
+ makes the label unreadable. A fill is used only where there is no text: the Stepper segments, a Checkbox, a Radio. */
547
+
548
+ /* The edge of a card is a shadow ring in the normal mode, which is dropped: give both cards a border, and the selected
549
+ one a heavier one in the selection colour. */
550
+ .sereno-card,
551
+ .sereno-action {
552
+ border: 1px solid CanvasText;
553
+ }
554
+ .sereno-card[data-selected],
555
+ .sereno-action[aria-pressed='true'] {
556
+ border: 3px solid Highlight;
557
+ }
558
+
559
+ /* The current page of a Pagination (a Button with aria-current). */
560
+ .sereno-btn[aria-current='page'] {
561
+ border: 3px solid Highlight;
562
+ text-decoration: underline;
563
+ }
564
+
565
+ /* The current item of a SidebarNav or a BottomNav, and the selected Tab. */
566
+ .sereno-sidenav-row[aria-current='page'],
567
+ .sereno-bottom-nav-item[aria-current='page'],
568
+ .sereno-tab[aria-selected='true'] {
569
+ text-decoration: underline Highlight 2px;
570
+ text-underline-offset: 4px;
571
+ }
572
+
573
+ /* A selected Table row: a rule above and below it in the selection colour. */
574
+ .sereno-table tbody tr[data-selected] td {
575
+ border-top: 2px solid Highlight;
576
+ border-bottom: 2px solid Highlight;
577
+ }
578
+
579
+ /* Stepper: done and current segments in the selection colour, the ones to come in the disabled one. */
580
+ .sereno-step[data-state='done'],
581
+ .sereno-step[data-state='active'] {
582
+ background: Highlight;
583
+ }
584
+ .sereno-step[data-state='todo'] {
585
+ background: GrayText;
586
+ }
587
+
588
+ /* Checkbox and Radio: the check, the dash and the dot are images or inset shadows in the normal mode, and both are lost.
589
+ Here the box is filled with the selection colour and the mark is drawn with borders, in the matching text colour, so it
590
+ reads on any palette. `!important` only here: the normal-mode rules for a checked box are `!important` themselves. */
591
+ .sereno-check,
592
+ .sereno-radio {
593
+ position: relative;
594
+ }
595
+ .sereno-check:checked,
596
+ .sereno-check:indeterminate,
597
+ .sereno-radio:checked {
598
+ background-color: Highlight !important;
599
+ background-image: none !important;
600
+ border-color: Highlight !important;
601
+ box-shadow: none !important;
602
+ }
603
+ .sereno-check:checked::after {
604
+ content: '';
605
+ position: absolute;
606
+ left: 32%;
607
+ top: 12%;
608
+ width: 30%;
609
+ height: 55%;
610
+ border: solid HighlightText;
611
+ border-width: 0 2px 2px 0;
612
+ transform: rotate(45deg);
613
+ }
614
+ .sereno-check:indeterminate::after {
615
+ content: '';
616
+ position: absolute;
617
+ left: 22%;
618
+ right: 22%;
619
+ top: calc(50% - 1px);
620
+ height: 2px;
621
+ background: HighlightText;
622
+ }
623
+ .sereno-radio:checked::after {
624
+ content: '';
625
+ position: absolute;
626
+ inset: 30%;
627
+ border-radius: 50%;
628
+ background: HighlightText;
629
+ }
630
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sereno-ds/ui",
3
- "version": "0.44.0",
3
+ "version": "0.46.0",
4
4
  "description": "Sereno Design System: React primitives (token-driven, inline styles, no UI base lib).",
5
5
  "license": "MIT",
6
6
  "author": "Sereno",