@sereno-ds/ui 0.44.0 → 0.45.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,7 @@ 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 | |
42
43
 
43
44
  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
45
 
@@ -55,6 +56,10 @@ Or change what the DS reads, on the element itself (the component reads `--inter
55
56
 
56
57
  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
58
 
59
+ #### High contrast (forced colors)
60
+
61
+ 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). Nothing there applies outside forced colors, and an `outline` rule of your own on those classes still wins by coming later. If you restyle a focus ring as a shadow, do the same for forced colors.
62
+
58
63
  ### 2. Provide the fonts
59
64
 
60
65
  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.
@@ -54,8 +54,6 @@ function ActionCard({
54
54
  borderRadius: "var(--radius-card)",
55
55
  cursor: disabled ? "not-allowed" : "pointer",
56
56
  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
57
  ...style
60
58
  }),
61
59
  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,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;AA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AAgB;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 border: 'none',\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: '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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;AAA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;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-block', animation: 'sereno-spin .7s linear infinite' })} />\n ) : (\n iconLeft\n )}\n {children}\n {iconRight}\n </button>\n );\n}"],"mappings":";AAiEI,SA6BI,KA7BJ;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,IAA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J,SAAS,OAAO,EAAE,UAAU,WAAW,OAAO,MAAM,YAAY,OAAO,WAAW,OAAO,UAAU,OAAO,UAAU,WAAW,UAAU,WAAW,OAAO,GAAG,KAAK,GAAgB;AACxL,QAAM,KAAK,MAAM,IAAI,KAAK,MAAM;AAChC,QAAM,SAAS,YAAY;AAC3B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,UAAU,YAAY;AAAA,MACrB,GAAG;AAAA,MACJ,WAAW,CAAC,cAAc,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,MAC7D,OAAO,GAAG;AAAA,QACR,GAAI,WAAW,gBAAgB,UAAU,OAAO;AAAA,QAChD,SAAS;AAAA,QACT,YAAY;AAAA,QACZ,gBAAgB;AAAA,QAChB,KAAK,GAAG;AAAA,QACR,QAAQ,SAAS,SAAS,GAAG;AAAA,QAC7B,SAAS,SAAS,IAAI,OAAO,GAAG;AAAA,QAChC,OAAO,YAAY,SAAS;AAAA,QAC5B,YAAY;AAAA,QACZ,UAAU,GAAG;AAAA,QACb,YAAY;AAAA,QACZ,eAAe;AAAA,QACf,cAAc,SAAS,qBAAqB;AAAA,QAC5C,aAAa;AAAA,QACb,aAAa;AAAA,QACb,QAAQ,WAAW,gBAAgB;AAAA,QACnC,SAAS,UAAU,OAAO;AAAA,QAC1B,YAAY;AAAA,QACZ,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":[]}
package/dist/core/Card.js CHANGED
@@ -37,9 +37,6 @@ function Card({ padding = "md", elevation = "sm", interactive = false, selected
37
37
  padding: PADS[padding],
38
38
  transition: "var(--transition-control)",
39
39
  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
40
  ...style
44
41
  }),
45
42
  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 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,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,E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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,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,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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ACA,OAAO,GAAG;AAAA,cACR,UAAU;AAAA,cACV,OAAO,EAAE;AAAA,cACT,QAAQ,EAAE;AAAA,cACV,MAAM;AAAA,cACN,cAAc;AAAA,cACd,YAAY,UAAU,+BAA+B;AAAA,cACrD,YAAY;AAAA,YACd,CAAC;AAAA,YAED;AAAA,cAAC;AAAA;AAAA,gBACC,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,YAAY;AAAA,kBACZ,WAAW;AAAA,kBACX,YAAY;AAAA,gBACd,CAAC;AAAA;AAAA,YACH;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,OAAO,cAAc;","names":["Switch"]}
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 // 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,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,eAAe,UAAU,KAAK,EAAE,CAAC,GACjE;AAAA,mBACC,oBAAC,UAAK,OAAO,GAAG,EAAE,YAAY,oBAAoB,UAAU,oBAAoB,YAAY,wBAAwB,OAAO,sBAAsB,CAAC,GAAI,iBAAM;AAAA,UAE7J,eACC,oBAAC,UAAK,OAAO,GAAG,EAAE,YAAY,oBAAoB,UAAU,kBAAkB,OAAO,qBAAqB,YAAY,KAAK,CAAC,GAAI,uBAAY;AAAA,WAEhJ;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA,MAAK;AAAA,YACL,gBAAc;AAAA,YACd,cAAY,SAAS;AAAA,YACrB,iBAAe,YAAY;AAAA,YAC3B,UAAU,WAAW,SAAY;AAAA,YACjC,WAAU;AAAA,YACV,SAAS;AAAA,YACT,WAAW,CAAC,MAAM;AAChB,kBAAI,EAAE,QAAQ,OAAO,EAAE,QAAQ,SAAS;AACtC,kBAAE,eAAe;AACjB,uBAAO;AAAA,cACT;AAAA,YACF;AAAA,YACA,OAAO,GAAG;AAAA,cACR,UAAU;AAAA,cACV,OAAO,EAAE;AAAA,cACT,QAAQ,EAAE;AAAA,cACV,MAAM;AAAA,cACN,cAAc;AAAA;AAAA;AAAA,cAGd,WAAW,UAAU,+BAA+B;AAAA,cACpD,YAAY;AAAA,YACd,CAAC;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;A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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,S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,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,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"]}
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,7 @@
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;
93
100
  background: var(--sd-bg);
94
101
  box-shadow: var(--sd-ring);
95
102
  }
@@ -134,6 +141,9 @@
134
141
  border-color: var(--sd-bd, var(--border-default));
135
142
  box-shadow: none;
136
143
  }
144
+ textarea.sereno-field {
145
+ outline: none;
146
+ }
137
147
  .sereno-field:where(textarea:focus, :has(> input:focus), [data-active]) {
138
148
  border-color: var(--sd-bd-active, var(--border-focus));
139
149
  box-shadow: var(--sd-ring-active, var(--focus-ring));
@@ -175,6 +185,10 @@
175
185
  /* Switch is a role=switch <span>, not an input - give it a keyboard focus ring. */
176
186
  .sereno-switch {
177
187
  outline: none;
188
+ background: var(--sd-bg);
189
+ }
190
+ .sereno-switch-thumb {
191
+ background: #fff;
178
192
  }
179
193
  .sereno-switch:focus-visible {
180
194
  box-shadow: var(--focus-ring);
@@ -461,3 +475,55 @@
461
475
  @media (prefers-reduced-motion: reduce) {
462
476
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
463
477
  }
478
+
479
+ /* ── Forced colors / Windows High Contrast (#135) ────────────────────────────────────
480
+ In this mode the browser swaps every authored colour for a system one and drops every `box-shadow`. A focus
481
+ ring drawn as a shadow therefore disappears, and so does a state told only by a fill (the Switch's track and
482
+ thumb). A system colour keyword (`Highlight`, `ButtonText`, `Canvas`, `GrayText`...) is the one value the
483
+ browser keeps, so this block redraws those cues with them: an `outline` where the ring was a shadow, and a
484
+ border and system fills for the Switch. Nothing here applies outside forced colors.
485
+
486
+ The `outline: none` of `.sereno-btn`, `.sereno-action`, `.sereno-card[data-clickable]` and `textarea.sereno-field`
487
+ lives in the rules above and not inline, exactly so these rules (one pseudo-class more specific) can win it back.
488
+ The specificity stays low and there is no `!important`: an app can still restyle any of it. */
489
+ @media (forced-colors: active) {
490
+ .sereno-btn:focus-visible:where(:not(:disabled)),
491
+ .sereno-action:focus-visible,
492
+ .sereno-card[data-clickable]:focus-visible,
493
+ .sereno-switch:focus-visible {
494
+ outline: 2px solid Highlight;
495
+ outline-offset: 2px;
496
+ }
497
+ /* A text field's frame is active while a text box inside it has the focus, or a popup is open. */
498
+ .sereno-field:where(:has(> input:focus), [data-active]),
499
+ textarea.sereno-field:focus {
500
+ outline: 2px solid Highlight;
501
+ outline-offset: 1px;
502
+ border-color: Highlight;
503
+ }
504
+ /* Switch: a framed track (content-box, so the thumb keeps the coordinates it has in the normal mode), a thumb in
505
+ the text colour, and the on state filled with the selection colour. */
506
+ .sereno-switch {
507
+ box-sizing: content-box;
508
+ border: 2px solid ButtonText;
509
+ background: Canvas;
510
+ }
511
+ .sereno-switch[aria-checked='true'] {
512
+ border-color: Highlight;
513
+ background: Highlight;
514
+ }
515
+ .sereno-switch[aria-disabled='true'] {
516
+ border-color: GrayText;
517
+ background: Canvas;
518
+ }
519
+ .sereno-switch-thumb {
520
+ background: ButtonText;
521
+ box-shadow: none;
522
+ }
523
+ .sereno-switch[aria-checked='true'] .sereno-switch-thumb {
524
+ background: HighlightText;
525
+ }
526
+ .sereno-switch[aria-disabled='true'] .sereno-switch-thumb {
527
+ background: GrayText;
528
+ }
529
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sereno-ds/ui",
3
- "version": "0.44.0",
3
+ "version": "0.45.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",