@sereno-ds/ui 0.36.3 → 0.36.4
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 +12 -12
- package/dist/_internal/Field.d.ts +1 -1
- package/dist/_internal/Field.js +2 -2
- package/dist/_internal/Field.js.map +1 -1
- package/dist/_internal/mask.d.ts +1 -1
- package/dist/_internal/mask.js.map +1 -1
- package/dist/core/Avatar.d.ts +1 -1
- package/dist/core/Avatar.js.map +1 -1
- package/dist/core/Badge.js +1 -1
- package/dist/core/Badge.js.map +1 -1
- package/dist/core/Brand.d.ts +2 -2
- package/dist/core/Brand.js.map +1 -1
- package/dist/core/Button.d.ts +1 -1
- package/dist/core/Button.js.map +1 -1
- package/dist/core/Card.js +1 -1
- package/dist/core/Card.js.map +1 -1
- package/dist/core/IconButton.d.ts +2 -2
- package/dist/core/IconButton.js.map +1 -1
- package/dist/core/Menu.d.ts +5 -5
- package/dist/core/Menu.js.map +1 -1
- package/dist/core/Table.d.ts +7 -7
- package/dist/core/Table.js +1 -1
- package/dist/core/Table.js.map +1 -1
- package/dist/core/Typography.d.ts +3 -3
- package/dist/core/Typography.js +1 -1
- package/dist/core/Typography.js.map +1 -1
- package/dist/feedback/Alert.d.ts +2 -2
- package/dist/feedback/Alert.js.map +1 -1
- package/dist/feedback/Dialog.d.ts +5 -5
- package/dist/feedback/Dialog.js.map +1 -1
- package/dist/feedback/Skeleton.d.ts +1 -1
- package/dist/feedback/Skeleton.js.map +1 -1
- package/dist/feedback/Toast.d.ts +1 -1
- package/dist/feedback/Toast.js.map +1 -1
- package/dist/feedback/ToastProvider.d.ts +3 -3
- package/dist/feedback/ToastProvider.js +1 -1
- package/dist/feedback/ToastProvider.js.map +1 -1
- package/dist/forms/AvatarUpload.d.ts +5 -5
- package/dist/forms/AvatarUpload.js +2 -2
- package/dist/forms/AvatarUpload.js.map +1 -1
- package/dist/forms/Checkbox.d.ts +3 -3
- package/dist/forms/Checkbox.js +1 -1
- package/dist/forms/Checkbox.js.map +1 -1
- package/dist/forms/DatePicker.d.ts +9 -9
- package/dist/forms/DatePicker.js +1 -1
- package/dist/forms/DatePicker.js.map +1 -1
- package/dist/forms/DateTimePicker.d.ts +14 -14
- package/dist/forms/DateTimePicker.js +2 -2
- package/dist/forms/DateTimePicker.js.map +1 -1
- package/dist/forms/FileUpload.d.ts +4 -4
- package/dist/forms/FileUpload.js.map +1 -1
- package/dist/forms/Input.d.ts +1 -1
- package/dist/forms/Input.js +1 -1
- package/dist/forms/Input.js.map +1 -1
- package/dist/forms/Radio.d.ts +5 -5
- package/dist/forms/Radio.js.map +1 -1
- package/dist/forms/SearchInput.d.ts +2 -2
- package/dist/forms/SearchInput.js.map +1 -1
- package/dist/forms/Select.d.ts +9 -9
- package/dist/forms/Select.js.map +1 -1
- package/dist/forms/Switch.d.ts +3 -3
- package/dist/forms/Switch.js.map +1 -1
- package/dist/forms/Textarea.d.ts +1 -1
- package/dist/forms/Textarea.js.map +1 -1
- package/dist/forms/_internal/CalendarGrid.d.ts +6 -6
- package/dist/forms/_internal/CalendarGrid.js +1 -1
- package/dist/forms/_internal/CalendarGrid.js.map +1 -1
- package/dist/forms/_internal/fieldBoxStyle.d.ts +2 -2
- package/dist/forms/_internal/fieldBoxStyle.js +2 -2
- package/dist/forms/_internal/fieldBoxStyle.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/navigation/BottomNav.d.ts +1 -1
- package/dist/navigation/BottomNav.js +1 -1
- package/dist/navigation/BottomNav.js.map +1 -1
- package/dist/navigation/SidebarNav.d.ts +9 -9
- package/dist/navigation/SidebarNav.js +1 -1
- package/dist/navigation/SidebarNav.js.map +1 -1
- package/dist/navigation/Stepper.d.ts +5 -5
- package/dist/navigation/Stepper.js.map +1 -1
- package/dist/navigation/Tabs.d.ts +2 -2
- package/dist/navigation/Tabs.js +11 -11
- package/dist/navigation/Tabs.js.map +1 -1
- package/dist/navigation/TopBar.d.ts +3 -3
- package/dist/navigation/TopBar.js.map +1 -1
- package/dist/styles.css +23 -23
- package/dist/theme/ThemeProvider.d.ts +1 -1
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Progress indicator for a linear multi-step flow
|
|
4
|
+
* Progress indicator for a linear multi-step flow - a **compound component**
|
|
5
5
|
* (onboarding, guided setup). Renders the segment track plus a
|
|
6
6
|
* `<counter> · <label>` line (a dot separates the counter from the current
|
|
7
|
-
* step's label). The counter defaults to `Step N of M`
|
|
7
|
+
* step's label). The counter defaults to `Step N of M` - the DS ships no
|
|
8
8
|
* localised copy; pass `stepLabel` for another language.
|
|
9
9
|
*
|
|
10
10
|
* ```tsx
|
|
@@ -31,11 +31,11 @@ interface StepperProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
31
31
|
children: React.ReactNode;
|
|
32
32
|
}
|
|
33
33
|
interface StepperStepProps {
|
|
34
|
-
/** Stable identifier
|
|
34
|
+
/** Stable identifier - not read by `Stepper` itself, only for the caller's own use (e.g. a React `key`). */
|
|
35
35
|
value?: string;
|
|
36
|
-
/** Short label
|
|
36
|
+
/** Short label - shown next to the step counter while this step is active. */
|
|
37
37
|
label: string;
|
|
38
|
-
/** Set by the root via `cloneElement`
|
|
38
|
+
/** Set by the root via `cloneElement` - this step's position among its siblings. Not for consumers to pass. */
|
|
39
39
|
index?: number;
|
|
40
40
|
}
|
|
41
41
|
declare function StepperRoot({ current, onStepClick, variant, stepLabel, children, style, ...rest }: StepperProps): React.JSX.Element;
|
|
@@ -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
|
|
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 && 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,k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KAAK,EAAE,OAAO,MAAM,GAAqB;AAChD,QAAM,EAAE,SAAS,aAAa,QAAQ,IAAI,kBAAkB,MAAM;AAClE,QAAM,OAAO,YAAY;AACzB,QAAM,IAAI,SAAS;AACnB,QAAM,OAAO,IAAI;AACjB,QAAM,SAAS,MAAM;AACrB,QAAM,YAAY,OAAO,gBAAgB,cAAc,KAAK;AAC5D,QAAM,SAAS;AAAA,IACb,MAAM,OAAO,aAAa;AAAA,IAC1B,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,QAAQ,YAAY,YAAY;AAAA,IAChC,YAAY,QAAQ,SAAS,+BAA+B;AAAA,IAC5D,YAAY;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,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Horizontal section switcher
|
|
4
|
+
* Horizontal section switcher - a **compound component**. `underline` for
|
|
5
5
|
* page-level sections, `pill` for filters inside a panel. When the tabs
|
|
6
6
|
* overflow their width the strip scrolls horizontally, with a chevron on
|
|
7
7
|
* whichever side has more; picking a tab scrolls it into view.
|
|
@@ -17,7 +17,7 @@ import * as React from 'react';
|
|
|
17
17
|
* </Tabs>
|
|
18
18
|
* ```
|
|
19
19
|
*
|
|
20
|
-
* `Tabs.Panel` is optional
|
|
20
|
+
* `Tabs.Panel` is optional - nothing requires it. Render your own content
|
|
21
21
|
* next to `Tabs.List`, keyed off the controlled `value`, if that reads
|
|
22
22
|
* better for the screen.
|
|
23
23
|
*/
|
package/dist/navigation/Tabs.js
CHANGED
|
@@ -118,7 +118,7 @@ function List({ children, style, onKeyDown, ...rest }) {
|
|
|
118
118
|
gap: pill ? "var(--space-1)" : "var(--space-5)",
|
|
119
119
|
padding: pill ? "var(--space-1)" : 0,
|
|
120
120
|
// The chevron overlays this edge (see ScrollChevron) rather than
|
|
121
|
-
// reserving permanent space for itself
|
|
121
|
+
// reserving permanent space for itself - reserving space fit fewer
|
|
122
122
|
// tabs on screen at once for no real benefit once the chevron
|
|
123
123
|
// paints correctly above whatever tab is underneath it (the actual
|
|
124
124
|
// bug, fixed below on Tab). scroll-padding keeps scrollIntoView
|
|
@@ -139,7 +139,7 @@ function List({ children, style, onKeyDown, ...rest }) {
|
|
|
139
139
|
pointerEvents: "none",
|
|
140
140
|
transition: "left 200ms ease, width 200ms ease, top 200ms ease, height 200ms ease",
|
|
141
141
|
// Match the active Tab's own box exactly (offsetTop/offsetHeight,
|
|
142
|
-
// not top:0/bottom:0)
|
|
142
|
+
// not top:0/bottom:0) - the latter is relative to the scroll
|
|
143
143
|
// container's *padding edge*, which for `pill` ignores the
|
|
144
144
|
// container's own padding and over-fills it top-to-bottom.
|
|
145
145
|
...pill ? { top: indicator.top, height: indicator.height, borderRadius: "var(--radius-pill)", background: "var(--bg-surface)", boxShadow: "var(--shadow-xs)" } : { top: "auto", bottom: 0, height: 2, background: "var(--interactive-primary)" }
|
|
@@ -176,10 +176,10 @@ function Tab({ value, icon, count, children, style, ...rest }) {
|
|
|
176
176
|
},
|
|
177
177
|
style: sx({
|
|
178
178
|
// position:relative (no explicit z-index) is enough to paint above
|
|
179
|
-
// the indicator
|
|
179
|
+
// the indicator - both sit in the DOM-order-decided stacking layer,
|
|
180
180
|
// and this comes later. An explicit z-index would promote this into
|
|
181
181
|
// its own stacking context ranked ahead of *everything* z-index:auto,
|
|
182
|
-
// including the unrelated ScrollChevron sibling outside this row
|
|
182
|
+
// including the unrelated ScrollChevron sibling outside this row -
|
|
183
183
|
// which is exactly the bug that shipped: the chevron ended up
|
|
184
184
|
// painted underneath every tab, visible only through the gaps
|
|
185
185
|
// between glyphs of whichever tab it overlapped.
|
|
@@ -192,13 +192,13 @@ function Tab({ value, icon, count, children, style, ...rest }) {
|
|
|
192
192
|
gap: "var(--space-2)",
|
|
193
193
|
border: "none",
|
|
194
194
|
cursor: "pointer",
|
|
195
|
-
// Not inline outline:none
|
|
195
|
+
// Not inline outline:none - see the .sereno-tab rule in styles.css
|
|
196
196
|
// for why that would permanently beat :focus-visible.
|
|
197
197
|
background: "transparent",
|
|
198
198
|
borderRadius: pill ? "var(--radius-pill)" : 0,
|
|
199
199
|
// Symmetric top/bottom (SS-228 follow-up): this used to be `0 0
|
|
200
|
-
// var(--space-3)`
|
|
201
|
-
// underline bar's gap on the bottom
|
|
200
|
+
// var(--space-3)` - no top padding, all the reserved space for the
|
|
201
|
+
// underline bar's gap on the bottom - which left the label sitting
|
|
202
202
|
// visibly above the button's own box center (and by extension above
|
|
203
203
|
// center of the focus-ring outline, which traces that box). Equal
|
|
204
204
|
// padding centers the label; ScrollChevron no longer needs its old
|
|
@@ -223,7 +223,7 @@ function Tab({ value, icon, count, children, style, ...rest }) {
|
|
|
223
223
|
padding: "1px 6px",
|
|
224
224
|
borderRadius: "999px",
|
|
225
225
|
background: active ? "var(--bg-brand-soft)" : pill ? "var(--bg-surface)" : "var(--bg-subtle)",
|
|
226
|
-
// text-muted here was < 4.5:1 on bg-subtle (SS-230)
|
|
226
|
+
// text-muted here was < 4.5:1 on bg-subtle (SS-230) - text-secondary
|
|
227
227
|
// both fixes that and matches the inactive tab label's own color
|
|
228
228
|
// (line ~253), which was already text-secondary, not text-muted.
|
|
229
229
|
color: active ? "var(--text-brand)" : "var(--text-secondary)"
|
|
@@ -241,7 +241,7 @@ function Panel({ value, children, ...rest }) {
|
|
|
241
241
|
return (
|
|
242
242
|
// tabIndex=0 (WAI-ARIA APG Tabs pattern): the panel itself is the next
|
|
243
243
|
// Tab stop after the tablist, so keyboard users land in the tab's own
|
|
244
|
-
// content next
|
|
244
|
+
// content next - not in whatever unrelated element happens to follow it
|
|
245
245
|
// in the DOM (e.g. this docs site's own "Show Code" toggle). A consumer
|
|
246
246
|
// rendering focusable content of its own can override via `rest`.
|
|
247
247
|
/* @__PURE__ */ jsx("div", { role: "tabpanel", tabIndex: 0, ...rest, children })
|
|
@@ -262,7 +262,7 @@ function ScrollChevron({ side, fade, pill, onClick }) {
|
|
|
262
262
|
alignItems: "center",
|
|
263
263
|
justifyContent: side === "left" ? "flex-start" : "flex-end",
|
|
264
264
|
pointerEvents: "none",
|
|
265
|
-
// Fades the tab it overlays out towards this edge
|
|
265
|
+
// Fades the tab it overlays out towards this edge - the button
|
|
266
266
|
// itself paints above every tab (Tab has no explicit z-index, so
|
|
267
267
|
// it can't outrank this), so it's never actually hidden by one;
|
|
268
268
|
// this is purely about not hard-cutting the text right at the
|
|
@@ -290,7 +290,7 @@ function ScrollChevron({ side, fade, pill, onClick }) {
|
|
|
290
290
|
boxShadow: "var(--shadow-md)",
|
|
291
291
|
color: "var(--text-secondary)",
|
|
292
292
|
cursor: "pointer"
|
|
293
|
-
// No vertical correction needed here anymore
|
|
293
|
+
// No vertical correction needed here anymore - Tab's own padding
|
|
294
294
|
// is symmetric top/bottom for both variants now, so the row's
|
|
295
295
|
// geometric center already matches the label's center.
|
|
296
296
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/navigation/Tabs.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ChevronLeft, ChevronRight } from 'lucide-react';\nimport { sx } from '../_internal/style';\n\n/**\n * Horizontal section switcher — a **compound component**. `underline` for\n * page-level sections, `pill` for filters inside a panel. When the tabs\n * overflow their width the strip scrolls horizontally, with a chevron on\n * whichever side has more; picking a tab scrolls it into view.\n *\n * ```tsx\n * <Tabs value={tab} onChange={setTab} variant=\"pill\">\n * <Tabs.List>\n * <Tabs.Tab value=\"today\" count={5}>Today</Tabs.Tab>\n * <Tabs.Tab value=\"week\" count={23}>Week</Tabs.Tab>\n * </Tabs.List>\n * <Tabs.Panel value=\"today\">…</Tabs.Panel>\n * <Tabs.Panel value=\"week\">…</Tabs.Panel>\n * </Tabs>\n * ```\n *\n * `Tabs.Panel` is optional — nothing requires it. Render your own content\n * next to `Tabs.List`, keyed off the controlled `value`, if that reads\n * better for the screen.\n */\nexport interface TabsProps {\n value?: string;\n onChange?: (value: string) => void;\n variant?: 'underline' | 'pill';\n fullWidth?: boolean;\n children: React.ReactNode;\n}\n\nexport interface TabsListProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {\n children: React.ReactNode;\n}\n\nexport interface TabsTabProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'onClick'> {\n value: string;\n icon?: React.ReactNode;\n count?: number;\n children: React.ReactNode;\n}\n\nexport interface TabsPanelProps extends React.HTMLAttributes<HTMLDivElement> {\n value: string;\n children: React.ReactNode;\n}\n\ninterface TabsContextValue {\n value?: string;\n onChange?: (value: string) => void;\n variant: 'underline' | 'pill';\n fullWidth: boolean;\n}\n\n/** Width of the overflow chevron's fade-out + hit area, and how much\n * scroll-padding the strip keeps on that side so scrollIntoView doesn't land\n * a tab half-hidden behind it. The chevron overlays this edge rather than\n * reserving space for itself — reserving space fit fewer tabs on screen at\n * once, for no benefit once the chevron reliably paints above the tab under\n * it (see Tab's z-index comment). */\nconst CHEVRON_W = 56;\n\nconst TabsContext = React.createContext<TabsContextValue | null>(null);\n\nfunction useTabsContext(component: string): TabsContextValue {\n const ctx = React.useContext(TabsContext);\n if (!ctx) throw new Error(`<Tabs.${component}> must be rendered inside <Tabs>.`);\n return ctx;\n}\n\nfunction TabsRoot({ value, onChange, variant = 'underline', fullWidth = false, children }: TabsProps) {\n const ctx = React.useMemo<TabsContextValue>(() => ({ value, onChange, variant, fullWidth }), [value, onChange, variant, fullWidth]);\n return <TabsContext.Provider value={ctx}>{children}</TabsContext.Provider>;\n}\n\nfunction List({ children, style, onKeyDown, ...rest }: TabsListProps) {\n const { value: activeValue, onChange, variant, fullWidth } = useTabsContext('List');\n const pill = variant === 'pill';\n const scrollRef = React.useRef<HTMLDivElement>(null);\n const [edge, setEdge] = React.useState({ left: false, right: false });\n const [indicator, setIndicator] = React.useState<{ left: number; width: number; top: number; height: number } | null>(null);\n\n const measureEdges = React.useCallback(() => {\n const el = scrollRef.current;\n if (!el) return;\n setEdge({\n left: el.scrollLeft > 1,\n right: el.scrollLeft + el.clientWidth < el.scrollWidth - 1,\n });\n }, []);\n\n // Finds the active <Tabs.Tab> by its data-tab-value (no ref registry needed\n // — children render into this same scroll container) and measures it in the\n // container's own coordinate space, so `indicator.left` lines up with the\n // absolutely-positioned bar/pill below.\n const measureIndicator = React.useCallback(() => {\n const el = scrollRef.current;\n if (!el || activeValue == null) {\n setIndicator(null);\n return;\n }\n let active: HTMLElement | null = null;\n el.querySelectorAll<HTMLElement>('[data-tab-value]').forEach((tab) => {\n if (tab.dataset.tabValue === activeValue) active = tab;\n });\n setIndicator(\n active\n ? { left: (active as HTMLElement).offsetLeft, width: (active as HTMLElement).offsetWidth, top: (active as HTMLElement).offsetTop, height: (active as HTMLElement).offsetHeight }\n : null,\n );\n }, [activeValue]);\n\n // Layout effect so the indicator lands in the right spot before paint —\n // no visible jump from a stale position on the very first render after a\n // value change.\n React.useLayoutEffect(() => {\n measureIndicator();\n }, [measureIndicator, children]);\n\n React.useEffect(() => {\n const el = scrollRef.current;\n if (!el) return;\n measureEdges();\n el.addEventListener('scroll', measureEdges, { passive: true });\n const ro = new ResizeObserver(() => {\n measureEdges();\n measureIndicator();\n });\n ro.observe(el);\n return () => {\n el.removeEventListener('scroll', measureEdges);\n ro.disconnect();\n };\n }, [measureEdges, measureIndicator, children]);\n\n const nudge = (dir: 1 | -1) => {\n scrollRef.current?.scrollBy({ left: dir * scrollRef.current.clientWidth * 0.72, behavior: 'smooth' });\n };\n\n // Roving tabindex (SS-228): only the active Tab is ever tabIndex=0 (below),\n // so Tab enters/leaves the whole strip in one stop. Left/Right move — and,\n // matching this component's own \"click selects immediately\" contract\n // (automatic activation, not a separate confirm step), also *select* — the\n // adjacent tab, wrapping at the ends; Home/End jump to the first/last.\n // Reuses the same data-tab-value DOM query as measureIndicator above rather\n // than cloning children, for the same reason: List doesn't otherwise need\n // to know each Tab's position.\n const onListKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key !== 'ArrowLeft' && e.key !== 'ArrowRight' && e.key !== 'Home' && e.key !== 'End') return;\n const el = scrollRef.current;\n if (!el) return;\n const tabs = Array.from(el.querySelectorAll<HTMLElement>('[data-tab-value]'));\n if (tabs.length === 0) return;\n const current = tabs.findIndex((t) => t.dataset.tabValue === activeValue);\n let next = current;\n if (e.key === 'ArrowRight') next = current < 0 ? 0 : (current + 1) % tabs.length;\n else if (e.key === 'ArrowLeft') next = current < 0 ? tabs.length - 1 : (current - 1 + tabs.length) % tabs.length;\n else if (e.key === 'Home') next = 0;\n else if (e.key === 'End') next = tabs.length - 1;\n e.preventDefault();\n const nextTab = tabs[next];\n const nextValue = nextTab.dataset.tabValue;\n if (nextValue !== undefined) onChange?.(nextValue);\n nextTab.focus();\n nextTab.scrollIntoView({ inline: 'nearest', block: 'nearest' });\n };\n\n const fade = pill ? 'var(--bg-subtle)' : 'var(--bg-surface)';\n\n return (\n <div\n style={sx({\n position: 'relative',\n display: pill && !fullWidth ? 'inline-flex' : 'flex',\n alignSelf: pill && !fullWidth ? 'flex-start' : undefined,\n width: !pill && fullWidth ? '100%' : undefined,\n maxWidth: '100%',\n borderRadius: pill ? 'var(--radius-pill)' : 0,\n background: pill ? 'var(--bg-subtle)' : 'transparent',\n borderBottom: pill ? 'none' : 'var(--border-width-hairline) solid var(--border-default)',\n ...style,\n })}\n >\n <div\n ref={scrollRef}\n role=\"tablist\"\n {...rest}\n onKeyDown={(e) => {\n onListKeyDown(e);\n onKeyDown?.(e);\n }}\n className={'sereno-tab-scroll' + (rest.className ? ' ' + rest.className : '')}\n style={sx({\n position: 'relative',\n display: 'flex',\n flex: 1,\n minWidth: 0,\n overflowX: 'auto',\n gap: pill ? 'var(--space-1)' : 'var(--space-5)',\n padding: pill ? 'var(--space-1)' : 0,\n // The chevron overlays this edge (see ScrollChevron) rather than\n // reserving permanent space for itself — reserving space fit fewer\n // tabs on screen at once for no real benefit once the chevron\n // paints correctly above whatever tab is underneath it (the actual\n // bug, fixed below on Tab). scroll-padding keeps scrollIntoView\n // from landing a tab half-behind the chevron's fade.\n scrollPaddingLeft: CHEVRON_W,\n scrollPaddingRight: CHEVRON_W,\n })}\n >\n {indicator && (\n <span\n aria-hidden\n style={sx({\n position: 'absolute',\n left: indicator.left,\n width: indicator.width,\n zIndex: 0,\n pointerEvents: 'none',\n transition: 'left 200ms ease, width 200ms ease, top 200ms ease, height 200ms ease',\n // Match the active Tab's own box exactly (offsetTop/offsetHeight,\n // not top:0/bottom:0) — the latter is relative to the scroll\n // container's *padding edge*, which for `pill` ignores the\n // container's own padding and over-fills it top-to-bottom.\n ...(pill\n ? { top: indicator.top, height: indicator.height, borderRadius: 'var(--radius-pill)', background: 'var(--bg-surface)', boxShadow: 'var(--shadow-xs)' }\n : { top: 'auto', bottom: 0, height: 2, background: 'var(--interactive-primary)' }),\n })}\n />\n )}\n {children}\n </div>\n\n {edge.left && <ScrollChevron side=\"left\" fade={fade} pill={pill} onClick={() => nudge(-1)} />}\n {edge.right && <ScrollChevron side=\"right\" fade={fade} pill={pill} onClick={() => nudge(1)} />}\n </div>\n );\n}\n\nfunction Tab({ value, icon, count, children, style, ...rest }: TabsTabProps) {\n const { value: activeValue, onChange, variant, fullWidth } = useTabsContext('Tab');\n const pill = variant === 'pill';\n const active = activeValue === value;\n\n return (\n <button\n type=\"button\"\n role=\"tab\"\n aria-selected={active}\n data-tab-value={value}\n // Roving tabindex (SS-228): only the active tab is a Tab stop — List's\n // onKeyDown moves *and* focuses between tabs with the arrow keys, so\n // Tab itself only needs to enter/leave the strip once.\n tabIndex={active ? 0 : -1}\n {...rest}\n className={'sereno-tab' + (rest.className ? ' ' + rest.className : '')}\n onClick={(e) => {\n onChange?.(value);\n e.currentTarget.scrollIntoView({ inline: 'nearest', block: 'nearest' });\n }}\n style={sx({\n // position:relative (no explicit z-index) is enough to paint above\n // the indicator — both sit in the DOM-order-decided stacking layer,\n // and this comes later. An explicit z-index would promote this into\n // its own stacking context ranked ahead of *everything* z-index:auto,\n // including the unrelated ScrollChevron sibling outside this row —\n // which is exactly the bug that shipped: the chevron ended up\n // painted underneath every tab, visible only through the gaps\n // between glyphs of whichever tab it overlapped.\n position: 'relative',\n flex: fullWidth ? 1 : '0 0 auto',\n whiteSpace: 'nowrap',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 'var(--space-2)',\n border: 'none',\n cursor: 'pointer',\n // Not inline outline:none — see the .sereno-tab rule in styles.css\n // for why that would permanently beat :focus-visible.\n background: 'transparent',\n borderRadius: pill ? 'var(--radius-pill)' : 0,\n // Symmetric top/bottom (SS-228 follow-up): this used to be `0 0\n // var(--space-3)` — no top padding, all the reserved space for the\n // underline bar's gap on the bottom — which left the label sitting\n // visibly above the button's own box center (and by extension above\n // center of the focus-ring outline, which traces that box). Equal\n // padding centers the label; ScrollChevron no longer needs its old\n // -6px compensation for this (see its own comment).\n padding: pill ? '8px var(--space-4)' : 'var(--space-3) 0',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-base)',\n fontWeight: active ? 'var(--weight-semibold)' : 'var(--weight-medium)',\n color: active ? (pill ? 'var(--text-primary)' : 'var(--text-brand)') : 'var(--text-secondary)',\n transition: 'var(--transition-control)',\n ...style,\n })}\n >\n {icon}\n {children}\n {count !== undefined && (\n <span\n style={sx({\n fontSize: 'var(--text-2xs)',\n fontWeight: 'var(--weight-bold)',\n padding: '1px 6px',\n borderRadius: '999px',\n background: active ? 'var(--bg-brand-soft)' : pill ? 'var(--bg-surface)' : 'var(--bg-subtle)',\n // text-muted here was < 4.5:1 on bg-subtle (SS-230) — text-secondary\n // both fixes that and matches the inactive tab label's own color\n // (line ~253), which was already text-secondary, not text-muted.\n color: active ? 'var(--text-brand)' : 'var(--text-secondary)',\n })}\n >\n {count}\n </span>\n )}\n </button>\n );\n}\n\nfunction Panel({ value, children, ...rest }: TabsPanelProps) {\n const { value: activeValue } = useTabsContext('Panel');\n if (activeValue !== value) return null;\n return (\n // tabIndex=0 (WAI-ARIA APG Tabs pattern): the panel itself is the next\n // Tab stop after the tablist, so keyboard users land in the tab's own\n // content next — not in whatever unrelated element happens to follow it\n // in the DOM (e.g. this docs site's own \"Show Code\" toggle). A consumer\n // rendering focusable content of its own can override via `rest`.\n <div role=\"tabpanel\" tabIndex={0} {...rest}>\n {children}\n </div>\n );\n}\n\nfunction ScrollChevron({ side, fade, pill, onClick }: { side: 'left' | 'right'; fade: string; pill: boolean; onClick: () => void }) {\n return (\n <span\n aria-hidden\n style={sx({\n position: 'absolute',\n top: 0,\n bottom: 0,\n [side]: 0,\n width: CHEVRON_W,\n display: 'flex',\n alignItems: 'center',\n justifyContent: side === 'left' ? 'flex-start' : 'flex-end',\n pointerEvents: 'none',\n // Fades the tab it overlays out towards this edge — the button\n // itself paints above every tab (Tab has no explicit z-index, so\n // it can't outrank this), so it's never actually hidden by one;\n // this is purely about not hard-cutting the text right at the\n // button's boundary.\n background: `linear-gradient(to ${side === 'left' ? 'right' : 'left'}, ${fade} 55%, transparent)`,\n borderRadius: pill ? 'var(--radius-pill)' : 0,\n })}\n >\n <button\n type=\"button\"\n tabIndex={-1}\n onClick={onClick}\n style={sx({\n pointerEvents: 'auto',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: 26,\n height: 26,\n borderRadius: '999px',\n border: '1px solid var(--border-strong)',\n // White, matching the DS's other floating circular controls.\n background: 'var(--bg-surface)',\n boxShadow: 'var(--shadow-md)',\n color: 'var(--text-secondary)',\n cursor: 'pointer',\n // No vertical correction needed here anymore — Tab's own padding\n // is symmetric top/bottom for both variants now, so the row's\n // geometric center already matches the label's center.\n })}\n >\n {side === 'left' ? <ChevronLeft size={16} strokeWidth={2} /> : <ChevronRight size={16} strokeWidth={2} />}\n </button>\n </span>\n );\n}\n\nexport const Tabs = Object.assign(TabsRoot, { List, Tab, Panel });\n"],"mappings":";AA4ES,cA+GH,YA/GG;AA1ET,YAAY,WAAW;AACvB,SAAS,aAAa,oBAAoB;AAC1C,SAAS,UAAU;AA4DnB,MAAM,YAAY;AAElB,MAAM,cAAc,MAAM,cAAuC,IAAI;AAErE,SAAS,eAAe,WAAqC;AAC3D,QAAM,MAAM,MAAM,WAAW,WAAW;AACxC,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,SAAS,SAAS,mCAAmC;AAC/E,SAAO;AACT;AAEA,SAAS,SAAS,EAAE,OAAO,UAAU,UAAU,aAAa,YAAY,OAAO,SAAS,GAAc;AACpG,QAAM,MAAM,MAAM,QAA0B,OAAO,EAAE,OAAO,UAAU,SAAS,UAAU,IAAI,CAAC,OAAO,UAAU,SAAS,SAAS,CAAC;AAClI,SAAO,oBAAC,YAAY,UAAZ,EAAqB,OAAO,KAAM,UAAS;AACrD;AAEA,SAAS,KAAK,EAAE,UAAU,OAAO,WAAW,GAAG,KAAK,GAAkB;AACpE,QAAM,EAAE,OAAO,aAAa,UAAU,SAAS,UAAU,IAAI,eAAe,MAAM;AAClF,QAAM,OAAO,YAAY;AACzB,QAAM,YAAY,MAAM,OAAuB,IAAI;AAC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AY;AAAA,YACZ,WAAW;AAAA,YACX,OAAO;AAAA,YACP,QAAQ;AAAA;AAAA;AAAA;AAAA,UAIV,CAAC;AAAA,UAEA,mBAAS,SAAS,oBAAC,eAAY,MAAM,IAAI,aAAa,GAAG,IAAK,oBAAC,gBAAa,MAAM,IAAI,aAAa,GAAG;AAAA;AAAA,MACzG;AAAA;AAAA,EACF;AAEJ;AAEO,MAAM,OAAO,OAAO,OAAO,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/navigation/Tabs.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ChevronLeft, ChevronRight } from 'lucide-react';\nimport { sx } from '../_internal/style';\n\n/**\n * Horizontal section switcher - a **compound component**. `underline` for\n * page-level sections, `pill` for filters inside a panel. When the tabs\n * overflow their width the strip scrolls horizontally, with a chevron on\n * whichever side has more; picking a tab scrolls it into view.\n *\n * ```tsx\n * <Tabs value={tab} onChange={setTab} variant=\"pill\">\n * <Tabs.List>\n * <Tabs.Tab value=\"today\" count={5}>Today</Tabs.Tab>\n * <Tabs.Tab value=\"week\" count={23}>Week</Tabs.Tab>\n * </Tabs.List>\n * <Tabs.Panel value=\"today\">…</Tabs.Panel>\n * <Tabs.Panel value=\"week\">…</Tabs.Panel>\n * </Tabs>\n * ```\n *\n * `Tabs.Panel` is optional - nothing requires it. Render your own content\n * next to `Tabs.List`, keyed off the controlled `value`, if that reads\n * better for the screen.\n */\nexport interface TabsProps {\n value?: string;\n onChange?: (value: string) => void;\n variant?: 'underline' | 'pill';\n fullWidth?: boolean;\n children: React.ReactNode;\n}\n\nexport interface TabsListProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {\n children: React.ReactNode;\n}\n\nexport interface TabsTabProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'onClick'> {\n value: string;\n icon?: React.ReactNode;\n count?: number;\n children: React.ReactNode;\n}\n\nexport interface TabsPanelProps extends React.HTMLAttributes<HTMLDivElement> {\n value: string;\n children: React.ReactNode;\n}\n\ninterface TabsContextValue {\n value?: string;\n onChange?: (value: string) => void;\n variant: 'underline' | 'pill';\n fullWidth: boolean;\n}\n\n/** Width of the overflow chevron's fade-out + hit area, and how much\n * scroll-padding the strip keeps on that side so scrollIntoView doesn't land\n * a tab half-hidden behind it. The chevron overlays this edge rather than\n * reserving space for itself - reserving space fit fewer tabs on screen at\n * once, for no benefit once the chevron reliably paints above the tab under\n * it (see Tab's z-index comment). */\nconst CHEVRON_W = 56;\n\nconst TabsContext = React.createContext<TabsContextValue | null>(null);\n\nfunction useTabsContext(component: string): TabsContextValue {\n const ctx = React.useContext(TabsContext);\n if (!ctx) throw new Error(`<Tabs.${component}> must be rendered inside <Tabs>.`);\n return ctx;\n}\n\nfunction TabsRoot({ value, onChange, variant = 'underline', fullWidth = false, children }: TabsProps) {\n const ctx = React.useMemo<TabsContextValue>(() => ({ value, onChange, variant, fullWidth }), [value, onChange, variant, fullWidth]);\n return <TabsContext.Provider value={ctx}>{children}</TabsContext.Provider>;\n}\n\nfunction List({ children, style, onKeyDown, ...rest }: TabsListProps) {\n const { value: activeValue, onChange, variant, fullWidth } = useTabsContext('List');\n const pill = variant === 'pill';\n const scrollRef = React.useRef<HTMLDivElement>(null);\n const [edge, setEdge] = React.useState({ left: false, right: false });\n const [indicator, setIndicator] = React.useState<{ left: number; width: number; top: number; height: number } | null>(null);\n\n const measureEdges = React.useCallback(() => {\n const el = scrollRef.current;\n if (!el) return;\n setEdge({\n left: el.scrollLeft > 1,\n right: el.scrollLeft + el.clientWidth < el.scrollWidth - 1,\n });\n }, []);\n\n // Finds the active <Tabs.Tab> by its data-tab-value (no ref registry needed,\n // children render into this same scroll container) and measures it in the\n // container's own coordinate space, so `indicator.left` lines up with the\n // absolutely-positioned bar/pill below.\n const measureIndicator = React.useCallback(() => {\n const el = scrollRef.current;\n if (!el || activeValue == null) {\n setIndicator(null);\n return;\n }\n let active: HTMLElement | null = null;\n el.querySelectorAll<HTMLElement>('[data-tab-value]').forEach((tab) => {\n if (tab.dataset.tabValue === activeValue) active = tab;\n });\n setIndicator(\n active\n ? { left: (active as HTMLElement).offsetLeft, width: (active as HTMLElement).offsetWidth, top: (active as HTMLElement).offsetTop, height: (active as HTMLElement).offsetHeight }\n : null,\n );\n }, [activeValue]);\n\n // Layout effect so the indicator lands in the right spot before paint -\n // no visible jump from a stale position on the very first render after a\n // value change.\n React.useLayoutEffect(() => {\n measureIndicator();\n }, [measureIndicator, children]);\n\n React.useEffect(() => {\n const el = scrollRef.current;\n if (!el) return;\n measureEdges();\n el.addEventListener('scroll', measureEdges, { passive: true });\n const ro = new ResizeObserver(() => {\n measureEdges();\n measureIndicator();\n });\n ro.observe(el);\n return () => {\n el.removeEventListener('scroll', measureEdges);\n ro.disconnect();\n };\n }, [measureEdges, measureIndicator, children]);\n\n const nudge = (dir: 1 | -1) => {\n scrollRef.current?.scrollBy({ left: dir * scrollRef.current.clientWidth * 0.72, behavior: 'smooth' });\n };\n\n // Roving tabindex (SS-228): only the active Tab is ever tabIndex=0 (below),\n // so Tab enters/leaves the whole strip in one stop. Left/Right move - and,\n // matching this component's own \"click selects immediately\" contract\n // (automatic activation, not a separate confirm step), also *select* - the\n // adjacent tab, wrapping at the ends; Home/End jump to the first/last.\n // Reuses the same data-tab-value DOM query as measureIndicator above rather\n // than cloning children, for the same reason: List doesn't otherwise need\n // to know each Tab's position.\n const onListKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key !== 'ArrowLeft' && e.key !== 'ArrowRight' && e.key !== 'Home' && e.key !== 'End') return;\n const el = scrollRef.current;\n if (!el) return;\n const tabs = Array.from(el.querySelectorAll<HTMLElement>('[data-tab-value]'));\n if (tabs.length === 0) return;\n const current = tabs.findIndex((t) => t.dataset.tabValue === activeValue);\n let next = current;\n if (e.key === 'ArrowRight') next = current < 0 ? 0 : (current + 1) % tabs.length;\n else if (e.key === 'ArrowLeft') next = current < 0 ? tabs.length - 1 : (current - 1 + tabs.length) % tabs.length;\n else if (e.key === 'Home') next = 0;\n else if (e.key === 'End') next = tabs.length - 1;\n e.preventDefault();\n const nextTab = tabs[next];\n const nextValue = nextTab.dataset.tabValue;\n if (nextValue !== undefined) onChange?.(nextValue);\n nextTab.focus();\n nextTab.scrollIntoView({ inline: 'nearest', block: 'nearest' });\n };\n\n const fade = pill ? 'var(--bg-subtle)' : 'var(--bg-surface)';\n\n return (\n <div\n style={sx({\n position: 'relative',\n display: pill && !fullWidth ? 'inline-flex' : 'flex',\n alignSelf: pill && !fullWidth ? 'flex-start' : undefined,\n width: !pill && fullWidth ? '100%' : undefined,\n maxWidth: '100%',\n borderRadius: pill ? 'var(--radius-pill)' : 0,\n background: pill ? 'var(--bg-subtle)' : 'transparent',\n borderBottom: pill ? 'none' : 'var(--border-width-hairline) solid var(--border-default)',\n ...style,\n })}\n >\n <div\n ref={scrollRef}\n role=\"tablist\"\n {...rest}\n onKeyDown={(e) => {\n onListKeyDown(e);\n onKeyDown?.(e);\n }}\n className={'sereno-tab-scroll' + (rest.className ? ' ' + rest.className : '')}\n style={sx({\n position: 'relative',\n display: 'flex',\n flex: 1,\n minWidth: 0,\n overflowX: 'auto',\n gap: pill ? 'var(--space-1)' : 'var(--space-5)',\n padding: pill ? 'var(--space-1)' : 0,\n // The chevron overlays this edge (see ScrollChevron) rather than\n // reserving permanent space for itself - reserving space fit fewer\n // tabs on screen at once for no real benefit once the chevron\n // paints correctly above whatever tab is underneath it (the actual\n // bug, fixed below on Tab). scroll-padding keeps scrollIntoView\n // from landing a tab half-behind the chevron's fade.\n scrollPaddingLeft: CHEVRON_W,\n scrollPaddingRight: CHEVRON_W,\n })}\n >\n {indicator && (\n <span\n aria-hidden\n style={sx({\n position: 'absolute',\n left: indicator.left,\n width: indicator.width,\n zIndex: 0,\n pointerEvents: 'none',\n transition: 'left 200ms ease, width 200ms ease, top 200ms ease, height 200ms ease',\n // Match the active Tab's own box exactly (offsetTop/offsetHeight,\n // not top:0/bottom:0) - the latter is relative to the scroll\n // container's *padding edge*, which for `pill` ignores the\n // container's own padding and over-fills it top-to-bottom.\n ...(pill\n ? { top: indicator.top, height: indicator.height, borderRadius: 'var(--radius-pill)', background: 'var(--bg-surface)', boxShadow: 'var(--shadow-xs)' }\n : { top: 'auto', bottom: 0, height: 2, background: 'var(--interactive-primary)' }),\n })}\n />\n )}\n {children}\n </div>\n\n {edge.left && <ScrollChevron side=\"left\" fade={fade} pill={pill} onClick={() => nudge(-1)} />}\n {edge.right && <ScrollChevron side=\"right\" fade={fade} pill={pill} onClick={() => nudge(1)} />}\n </div>\n );\n}\n\nfunction Tab({ value, icon, count, children, style, ...rest }: TabsTabProps) {\n const { value: activeValue, onChange, variant, fullWidth } = useTabsContext('Tab');\n const pill = variant === 'pill';\n const active = activeValue === value;\n\n return (\n <button\n type=\"button\"\n role=\"tab\"\n aria-selected={active}\n data-tab-value={value}\n // Roving tabindex (SS-228): only the active tab is a Tab stop - List's\n // onKeyDown moves *and* focuses between tabs with the arrow keys, so\n // Tab itself only needs to enter/leave the strip once.\n tabIndex={active ? 0 : -1}\n {...rest}\n className={'sereno-tab' + (rest.className ? ' ' + rest.className : '')}\n onClick={(e) => {\n onChange?.(value);\n e.currentTarget.scrollIntoView({ inline: 'nearest', block: 'nearest' });\n }}\n style={sx({\n // position:relative (no explicit z-index) is enough to paint above\n // the indicator - both sit in the DOM-order-decided stacking layer,\n // and this comes later. An explicit z-index would promote this into\n // its own stacking context ranked ahead of *everything* z-index:auto,\n // including the unrelated ScrollChevron sibling outside this row -\n // which is exactly the bug that shipped: the chevron ended up\n // painted underneath every tab, visible only through the gaps\n // between glyphs of whichever tab it overlapped.\n position: 'relative',\n flex: fullWidth ? 1 : '0 0 auto',\n whiteSpace: 'nowrap',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 'var(--space-2)',\n border: 'none',\n cursor: 'pointer',\n // Not inline outline:none - see the .sereno-tab rule in styles.css\n // for why that would permanently beat :focus-visible.\n background: 'transparent',\n borderRadius: pill ? 'var(--radius-pill)' : 0,\n // Symmetric top/bottom (SS-228 follow-up): this used to be `0 0\n // var(--space-3)` - no top padding, all the reserved space for the\n // underline bar's gap on the bottom - which left the label sitting\n // visibly above the button's own box center (and by extension above\n // center of the focus-ring outline, which traces that box). Equal\n // padding centers the label; ScrollChevron no longer needs its old\n // -6px compensation for this (see its own comment).\n padding: pill ? '8px var(--space-4)' : 'var(--space-3) 0',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-base)',\n fontWeight: active ? 'var(--weight-semibold)' : 'var(--weight-medium)',\n color: active ? (pill ? 'var(--text-primary)' : 'var(--text-brand)') : 'var(--text-secondary)',\n transition: 'var(--transition-control)',\n ...style,\n })}\n >\n {icon}\n {children}\n {count !== undefined && (\n <span\n style={sx({\n fontSize: 'var(--text-2xs)',\n fontWeight: 'var(--weight-bold)',\n padding: '1px 6px',\n borderRadius: '999px',\n background: active ? 'var(--bg-brand-soft)' : pill ? 'var(--bg-surface)' : 'var(--bg-subtle)',\n // text-muted here was < 4.5:1 on bg-subtle (SS-230) - text-secondary\n // both fixes that and matches the inactive tab label's own color\n // (line ~253), which was already text-secondary, not text-muted.\n color: active ? 'var(--text-brand)' : 'var(--text-secondary)',\n })}\n >\n {count}\n </span>\n )}\n </button>\n );\n}\n\nfunction Panel({ value, children, ...rest }: TabsPanelProps) {\n const { value: activeValue } = useTabsContext('Panel');\n if (activeValue !== value) return null;\n return (\n // tabIndex=0 (WAI-ARIA APG Tabs pattern): the panel itself is the next\n // Tab stop after the tablist, so keyboard users land in the tab's own\n // content next - not in whatever unrelated element happens to follow it\n // in the DOM (e.g. this docs site's own \"Show Code\" toggle). A consumer\n // rendering focusable content of its own can override via `rest`.\n <div role=\"tabpanel\" tabIndex={0} {...rest}>\n {children}\n </div>\n );\n}\n\nfunction ScrollChevron({ side, fade, pill, onClick }: { side: 'left' | 'right'; fade: string; pill: boolean; onClick: () => void }) {\n return (\n <span\n aria-hidden\n style={sx({\n position: 'absolute',\n top: 0,\n bottom: 0,\n [side]: 0,\n width: CHEVRON_W,\n display: 'flex',\n alignItems: 'center',\n justifyContent: side === 'left' ? 'flex-start' : 'flex-end',\n pointerEvents: 'none',\n // Fades the tab it overlays out towards this edge - the button\n // itself paints above every tab (Tab has no explicit z-index, so\n // it can't outrank this), so it's never actually hidden by one;\n // this is purely about not hard-cutting the text right at the\n // button's boundary.\n background: `linear-gradient(to ${side === 'left' ? 'right' : 'left'}, ${fade} 55%, transparent)`,\n borderRadius: pill ? 'var(--radius-pill)' : 0,\n })}\n >\n <button\n type=\"button\"\n tabIndex={-1}\n onClick={onClick}\n style={sx({\n pointerEvents: 'auto',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: 26,\n height: 26,\n borderRadius: '999px',\n border: '1px solid var(--border-strong)',\n // White, matching the DS's other floating circular controls.\n background: 'var(--bg-surface)',\n boxShadow: 'var(--shadow-md)',\n color: 'var(--text-secondary)',\n cursor: 'pointer',\n // No vertical correction needed here anymore - Tab's own padding\n // is symmetric top/bottom for both variants now, so the row's\n // geometric center already matches the label's center.\n })}\n >\n {side === 'left' ? <ChevronLeft size={16} strokeWidth={2} /> : <ChevronRight size={16} strokeWidth={2} />}\n </button>\n </span>\n );\n}\n\nexport const Tabs = Object.assign(TabsRoot, { List, Tab, Panel });\n"],"mappings":";AA4ES,cA+GH,YA/GG;AA1ET,YAAY,WAAW;AACvB,SAAS,aAAa,oBAAoB;AAC1C,SAAS,UAAU;AA4DnB,MAAM,YAAY;AAElB,MAAM,cAAc,MAAM,cAAuC,IAAI;AAErE,SAAS,eAAe,WAAqC;AAC3D,QAAM,MAAM,MAAM,WAAW,WAAW;AACxC,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,SAAS,SAAS,mCAAmC;AAC/E,SAAO;AACT;AAEA,SAAS,SAAS,EAAE,OAAO,UAAU,UAAU,aAAa,YAAY,OAAO,SAAS,GAAc;AACpG,QA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,sBAAsB,SAAS,SAAS,UAAU,MAAM,KAAK,IAAI;AAAA,QAC7E,cAAc,OAAO,uBAAuB;AAAA,MAC9C,CAAC;AAAA,MAED;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,UAAU;AAAA,UACV;AAAA,UACA,OAAO,GAAG;AAAA,YACR,eAAe;AAAA,YACf,SAAS;AAAA,YACT,YAAY;AAAA,YACZ,gBAAgB;AAAA,YAChB,OAAO;AAAA,YACP,QAAQ;AAAA,YACR,cAAc;AAAA,YACd,QAAQ;AAAA;AAAA,YAER,YAAY;AAAA,YACZ,WAAW;AAAA,YACX,OAAO;AAAA,YACP,QAAQ;AAAA;AAAA;AAAA;AAAA,UAIV,CAAC;AAAA,UAEA,mBAAS,SAAS,oBAAC,eAAY,MAAM,IAAI,aAAa,GAAG,IAAK,oBAAC,gBAAa,MAAM,IAAI,aAAa,GAAG;AAAA;AAAA,MACzG;AAAA;AAAA,EACF;AAEJ;AAEO,MAAM,OAAO,OAAO,OAAO,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;","names":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Sticky page header
|
|
4
|
+
* Sticky page header - a **compound component**. 60px tall, blurred
|
|
5
5
|
* translucent. `Leading` / `Title` / `Actions` are all optional, independent
|
|
6
|
-
* slots
|
|
6
|
+
* slots - use whichever the screen needs.
|
|
7
7
|
*
|
|
8
8
|
* ```tsx
|
|
9
9
|
* <TopBar>
|
|
@@ -32,7 +32,7 @@ interface TopBarActionsProps {
|
|
|
32
32
|
children?: React.ReactNode;
|
|
33
33
|
}
|
|
34
34
|
declare function TopBarRoot({ sticky, transparent, children, style, ...rest }: TopBarProps): React.JSX.Element;
|
|
35
|
-
/** No wrapper of its own
|
|
35
|
+
/** No wrapper of its own - renders exactly what you give it, first in the row. */
|
|
36
36
|
declare function Leading({ children }: TopBarLeadingProps): React.JSX.Element;
|
|
37
37
|
declare function Title({ subtitle, children }: TopBarTitleProps): React.JSX.Element;
|
|
38
38
|
declare function Actions({ children }: TopBarActionsProps): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/navigation/TopBar.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\n\n/**\n * Sticky page header
|
|
1
|
+
{"version":3,"sources":["../../src/navigation/TopBar.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\n\n/**\n * Sticky page header - a **compound component**. 60px tall, blurred\n * translucent. `Leading` / `Title` / `Actions` are all optional, independent\n * slots - use whichever the screen needs.\n *\n * ```tsx\n * <TopBar>\n * <TopBar.Leading><IconButton label=\"Back\"><ChevronLeft /></IconButton></TopBar.Leading>\n * <TopBar.Title subtitle=\"Therapy session\">Pick a time</TopBar.Title>\n * <TopBar.Actions><IconButton label=\"Notifications\"><Bell /></IconButton></TopBar.Actions>\n * </TopBar>\n * ```\n */\nexport interface TopBarProps extends React.HTMLAttributes<HTMLElement> {\n sticky?: boolean;\n /** Drops the blur/border for hero headers. */\n transparent?: boolean;\n children?: React.ReactNode;\n}\n\nexport interface TopBarLeadingProps {\n /** Usually a back `IconButton` or the wordmark. */\n children?: React.ReactNode;\n}\n\nexport interface TopBarTitleProps {\n /** Plain string in most cases; accepts nodes for e.g. a `<time>` element or a responsive date. */\n subtitle?: React.ReactNode;\n children?: React.ReactNode;\n}\n\nexport interface TopBarActionsProps {\n children?: React.ReactNode;\n}\n\nfunction TopBarRoot({ sticky = true, transparent = false, children, style, ...rest }: TopBarProps) {\n return (\n <header\n {...rest}\n style={sx({\n display: 'flex',\n alignItems: 'center',\n gap: 'var(--space-3)',\n height: 'var(--topbar-height)',\n padding: '0 var(--gutter-mobile)',\n position: sticky ? 'sticky' : 'relative',\n top: 0,\n zIndex: 20,\n background: transparent ? 'transparent' : 'color-mix(in srgb,var(--bg-surface) 88%,transparent)',\n backdropFilter: transparent ? 'none' : 'blur(12px)',\n borderBottom: transparent ? 'none' : 'var(--border-width-hairline) solid var(--border-default)',\n ...style,\n })}\n >\n {children}\n </header>\n );\n}\n\n/** No wrapper of its own - renders exactly what you give it, first in the row. */\nfunction Leading({ children }: TopBarLeadingProps) {\n return <>{children}</>;\n}\n\nfunction Title({ subtitle, children }: TopBarTitleProps) {\n return (\n <div style={sx({ flex: 1, minWidth: 0, display: 'flex', flexDirection: 'column', gap: 1 })}>\n {children && (\n <span\n style={sx({\n fontFamily: 'var(--font-display)',\n fontSize: 'var(--text-lg)',\n fontWeight: 'var(--weight-bold)',\n letterSpacing: 'var(--tracking-tight)',\n color: 'var(--text-primary)',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n })}\n >\n {children}\n </span>\n )}\n {subtitle && (\n <span\n style={sx({\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-xs)',\n color: 'var(--text-muted)',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n })}\n >\n {subtitle}\n </span>\n )}\n </div>\n );\n}\n\nfunction Actions({ children }: TopBarActionsProps) {\n return <div style={sx({ display: 'flex', alignItems: 'center', gap: 'var(--space-2)' })}>{children}</div>;\n}\n\nexport const TopBar = Object.assign(TopBarRoot, { Leading, Title, Actions });\n"],"mappings":";AA0CI,SAwBK,UAxBL,KA6BA,YA7BA;AAvCJ,SAAS,UAAU;AAqCnB,SAAS,WAAW,EAAE,SAAS,MAAM,cAAc,OAAO,UAAU,OAAO,GAAG,KAAK,GAAgB;AACjG,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,OAAO,GAAG;AAAA,QACR,SAAS;AAAA,QACT,YAAY;AAAA,QACZ,KAAK;AAAA,QACL,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,UAAU,SAAS,WAAW;AAAA,QAC9B,KAAK;AAAA,QACL,QAAQ;AAAA,QACR,YAAY,cAAc,gBAAgB;AAAA,QAC1C,gBAAgB,cAAc,SAAS;AAAA,QACvC,cAAc,cAAc,SAAS;AAAA,QACrC,GAAG;AAAA,MACL,CAAC;AAAA,MAEA;AAAA;AAAA,EACH;AAEJ;AAGA,SAAS,QAAQ,EAAE,SAAS,GAAuB;AACjD,SAAO,gCAAG,UAAS;AACrB;AAEA,SAAS,MAAM,EAAE,UAAU,SAAS,GAAqB;AACvD,SACE,qBAAC,SAAI,OAAO,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,QAAQ,eAAe,UAAU,KAAK,EAAE,CAAC,GACtF;AAAA,gBACC;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,GAAG;AAAA,UACR,YAAY;AAAA,UACZ,UAAU;AAAA,UACV,YAAY;AAAA,UACZ,eAAe;AAAA,UACf,OAAO;AAAA,UACP,UAAU;AAAA,UACV,cAAc;AAAA,UACd,YAAY;AAAA,QACd,CAAC;AAAA,QAEA;AAAA;AAAA,IACH;AAAA,IAED,YACC;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,GAAG;AAAA,UACR,YAAY;AAAA,UACZ,UAAU;AAAA,UACV,OAAO;AAAA,UACP,UAAU;AAAA,UACV,cAAc;AAAA,UACd,YAAY;AAAA,QACd,CAAC;AAAA,QAEA;AAAA;AAAA,IACH;AAAA,KAEJ;AAEJ;AAEA,SAAS,QAAQ,EAAE,SAAS,GAAuB;AACjD,SAAO,oBAAC,SAAI,OAAO,GAAG,EAAE,SAAS,QAAQ,YAAY,UAAU,KAAK,iBAAiB,CAAC,GAAI,UAAS;AACrG;AAEO,MAAM,SAAS,OAAO,OAAO,YAAY,EAAE,SAAS,OAAO,QAAQ,CAAC;","names":[]}
|
package/dist/styles.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* ─────────────────────────────────────────────────────────────────────────────
|
|
2
|
-
@sereno-ds/ui
|
|
2
|
+
@sereno-ds/ui - component stylesheet.
|
|
3
3
|
|
|
4
4
|
The Sereno components are token-driven inline styles, but a handful of things
|
|
5
5
|
can't live in an inline `style`: @keyframes, pseudo-classes (:checked,
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import '@sereno-ds/ui/styles.css'; // (today: this file, via app/globals.css)
|
|
11
11
|
|
|
12
|
-
Depends on the design tokens (custom properties) being defined
|
|
12
|
+
Depends on the design tokens (custom properties) being defined - see
|
|
13
13
|
app/styles/tokens/*.css (future @sereno-ds/tokens).
|
|
14
14
|
|
|
15
15
|
Not included here (host-app concerns, not the library):
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
All three need these host rules for their checked / focus states. */
|
|
38
38
|
.sereno-check:checked,
|
|
39
39
|
.sereno-check:indeterminate {
|
|
40
|
-
/* `background-color`, not the `background` shorthand
|
|
40
|
+
/* `background-color`, not the `background` shorthand - the shorthand would
|
|
41
41
|
reset `background-size` and the glyph would stop scaling with the box. */
|
|
42
42
|
background-color: var(--interactive-primary) !important;
|
|
43
43
|
border-color: var(--interactive-primary) !important;
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
.sereno-radio[data-size='sm']:checked {
|
|
60
60
|
box-shadow: inset 0 0 0 3px var(--bg-surface) !important;
|
|
61
61
|
}
|
|
62
|
-
/* Switch is a role=switch <span>, not an input
|
|
62
|
+
/* Switch is a role=switch <span>, not an input - give it a keyboard focus ring. */
|
|
63
63
|
.sereno-switch {
|
|
64
64
|
outline: none;
|
|
65
65
|
}
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
/* ── Tabs ────────────────────────────────────────────────────────────────────
|
|
71
|
-
The strip scrolls horizontally when it overflows
|
|
71
|
+
The strip scrolls horizontally when it overflows - hide the scrollbar
|
|
72
72
|
(the chevrons are the affordance). */
|
|
73
73
|
.sereno-tab-scroll {
|
|
74
74
|
scrollbar-width: none;
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
.sereno-tab-scroll::-webkit-scrollbar {
|
|
78
78
|
display: none;
|
|
79
79
|
}
|
|
80
|
-
/* Tab's own focus ring (SS-228)
|
|
80
|
+
/* Tab's own focus ring (SS-228) - it used to set outline:none inline with
|
|
81
81
|
nothing to replace it, which (as with DateTimePicker's day grid) always
|
|
82
82
|
beats a class selector's :focus-visible rule no matter what, roving
|
|
83
83
|
tabindex or not. Suppressed here instead, same specificity as the
|
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/* ── SidebarNav ──────────────────────────────────────────────────────────────
|
|
94
|
-
Thin scroll area, a keyboard ring on its plain <button> rows, and
|
|
95
|
-
collapsed
|
|
94
|
+
Thin scroll area, a keyboard ring on its plain <button> rows, and - when
|
|
95
|
+
collapsed - a hidden scrollbar so a scrollbar gutter can't push the centred
|
|
96
96
|
icons off-axis from the header mark. */
|
|
97
97
|
.sereno-sidenav {
|
|
98
98
|
scrollbar-width: thin;
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
.sereno-sidenav-root[data-collapsed] .sereno-sidenav::-webkit-scrollbar {
|
|
112
112
|
display: none;
|
|
113
113
|
}
|
|
114
|
-
/* The section break
|
|
114
|
+
/* The section break - every `SidebarNav.Section` but the first gets the gap +
|
|
115
115
|
divider; `Section` itself doesn't know its own position among siblings. */
|
|
116
116
|
.sereno-sidenav-section:not(:first-child) {
|
|
117
117
|
margin-top: var(--space-3);
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
/* ── In-field affix button ───────────────────────────────────────────────────
|
|
135
135
|
A bare icon button that sits inside the field frame (Input's password reveal,
|
|
136
136
|
SearchInput's clear, FileUpload / AvatarUpload actions). NOTE: the class is
|
|
137
|
-
`ds-affix-btn` for historical reasons
|
|
137
|
+
`ds-affix-btn` for historical reasons - rename to `sereno-affix-btn` is a
|
|
138
138
|
breaking class-contract change, deferred. */
|
|
139
139
|
.ds-affix-btn {
|
|
140
140
|
display: inline-flex;
|
|
@@ -154,12 +154,12 @@
|
|
|
154
154
|
.ds-affix-btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
|
|
155
155
|
|
|
156
156
|
/* ── Table ──────────────────────────────────────────────────────────────────
|
|
157
|
-
Ships with @sereno-ds/ui's compound <Table>. The parts stay thin
|
|
157
|
+
Ships with @sereno-ds/ui's compound <Table>. The parts stay thin - structure,
|
|
158
158
|
density, dividers, hover / focus / sticky / zebra live here, keyed off
|
|
159
159
|
data-* on the <table> root. */
|
|
160
160
|
.sereno-table { width: 100%; border-collapse: collapse; font-family: var(--font-body); }
|
|
161
161
|
/* Visually-hidden <caption>. `top/left: 0` pins it to the (position: relative)
|
|
162
|
-
scroll region
|
|
162
|
+
scroll region - without an anchor a position:absolute caption falls back to its
|
|
163
163
|
static offset against the viewport and stretches the page's scroll height. */
|
|
164
164
|
.sereno-table caption { position: absolute; top: 0; left: 0; width: 1px; height: 1px; padding: 0; margin: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
|
|
165
165
|
.sereno-table thead tr { background: var(--bg-subtle); }
|
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
.sereno-table th button { transition: color var(--duration-fast) var(--ease-standard); }
|
|
195
195
|
.sereno-table th button:hover { color: var(--text-primary); }
|
|
196
196
|
/* `min-width: 0` lets the region shrink below the table's `min-width` when it's a
|
|
197
|
-
flex / grid item
|
|
197
|
+
flex / grid item - without it the wide table forces its ancestors open and the
|
|
198
198
|
*page* scrolls sideways instead of this box. `position: relative` anchors the
|
|
199
199
|
visually-hidden <caption> here (see the caption rule above). */
|
|
200
200
|
.sereno-table-scroll { outline: none; position: relative; min-width: 0; max-width: 100%; }
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
/* ── Dialog ────────────────────────────────────────────────────────────────
|
|
231
|
-
Header ✕ button
|
|
231
|
+
Header ✕ button - hover/focus states that can't be inline. */
|
|
232
232
|
.sereno-dialog-close:hover { background: var(--interactive-ghost-hover); color: var(--text-primary); }
|
|
233
233
|
.sereno-dialog-close:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
|
|
234
234
|
/* Footer `fill`: every action shares each line and grows to fill it, so a wrap never leaves one
|
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
.sereno-dialog-footer[data-fill] > * { flex: 1 1 auto; }
|
|
237
237
|
|
|
238
238
|
/* ── Dismiss ✕ (Alert / Toast) ─────────────────────────────────────────────
|
|
239
|
-
Ghost icon button on a tinted surface
|
|
239
|
+
Ghost icon button on a tinted surface - tint the hover from currentColor so
|
|
240
240
|
it reads on every tone. */
|
|
241
241
|
.sereno-dismiss { transition: opacity var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard); }
|
|
242
242
|
.sereno-dismiss:hover { opacity: 1; background: color-mix(in srgb, currentColor 14%, transparent); }
|
|
@@ -245,7 +245,7 @@
|
|
|
245
245
|
/* ── Toast viewport (ToastProvider) ────────────────────────────────────────
|
|
246
246
|
Enter/exit per stacked toast + the auto-dismiss countdown bar. Direction
|
|
247
247
|
depends on the anchored edge. The reduced-motion rule below damps all of it
|
|
248
|
-
(the JS timer still dismisses on schedule
|
|
248
|
+
(the JS timer still dismisses on schedule - only the visuals are stilled). */
|
|
249
249
|
.sereno-toast-item { animation: sereno-toast-in var(--duration-normal) var(--ease-out); }
|
|
250
250
|
.sereno-toast-item[data-edge='top'] { animation-name: sereno-toast-in-top; }
|
|
251
251
|
.sereno-toast-item[data-leaving='true'] { animation: sereno-toast-out var(--duration-fast) var(--ease-in) forwards; }
|
|
@@ -269,7 +269,7 @@
|
|
|
269
269
|
inline styles. The header title button lives here too. */
|
|
270
270
|
.sereno-dtp-title:hover { background: var(--interactive-ghost-hover); }
|
|
271
271
|
.sereno-dtp-title:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
|
|
272
|
-
/* fade only
|
|
272
|
+
/* fade only - the box is centred with translateX(-50%), so no transform anim. */
|
|
273
273
|
.sereno-dtp-pop { animation: sereno-fade-in var(--duration-fast) var(--ease-standard); }
|
|
274
274
|
.sereno-dtp-grid button {
|
|
275
275
|
height: 34px;
|
|
@@ -286,24 +286,24 @@
|
|
|
286
286
|
}
|
|
287
287
|
.sereno-dtp-grid button:hover { background: var(--interactive-ghost-hover); }
|
|
288
288
|
.sereno-dtp-grid button:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; }
|
|
289
|
-
/* The day grid's own focus ring (SS-228)
|
|
289
|
+
/* The day grid's own focus ring (SS-228) - was missing entirely: the day
|
|
290
290
|
button used to set outline:none *inline*, which always wins over a class
|
|
291
291
|
selector regardless of :focus-visible, so the roving-tabindex cursor was
|
|
292
|
-
keyboard-functional but completely invisible. Suppressed here instead
|
|
292
|
+
keyboard-functional but completely invisible. Suppressed here instead -
|
|
293
293
|
same specificity as the :focus-visible rule below, so source order
|
|
294
294
|
decides and the override actually takes. Separate from .sereno-dtp-grid
|
|
295
|
-
on purpose
|
|
295
|
+
on purpose - that class is the month/year popover's mini-grid, whose
|
|
296
296
|
:hover / [data-current] rules don't belong on a day cell (it already has
|
|
297
297
|
its own selected/today styling driven from React state, not CSS
|
|
298
298
|
attribute selectors). */
|
|
299
299
|
.sereno-dtp-days button { outline: none; }
|
|
300
300
|
.sereno-dtp-days button:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; }
|
|
301
|
-
/* Time-slot grid (SS-228 sweep)
|
|
301
|
+
/* Time-slot grid (SS-228 sweep) - same bug, same fix: an inline outline:none
|
|
302
302
|
with nothing to replace it, found auditing every remaining inline
|
|
303
303
|
outline:none in the package after the day-grid and Tabs fixes above. */
|
|
304
304
|
.sereno-dtp-time button { outline: none; }
|
|
305
305
|
.sereno-dtp-time button:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; }
|
|
306
|
-
/* BottomNav.Item (SS-228 sweep)
|
|
306
|
+
/* BottomNav.Item (SS-228 sweep) - identical bug: outline suppressed inline
|
|
307
307
|
with no substitute at all (no useInteract-style box-shadow ring either). */
|
|
308
308
|
.sereno-bottom-nav-item { outline: none; }
|
|
309
309
|
.sereno-bottom-nav-item:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; }
|
|
@@ -315,7 +315,7 @@
|
|
|
315
315
|
|
|
316
316
|
/* ── Reduced motion ──────────────────────────────────────────────────────────
|
|
317
317
|
The token layer already zeroes `--duration-*`, but Button's spinner and
|
|
318
|
-
Skeleton's pulse use fixed loop durations
|
|
318
|
+
Skeleton's pulse use fixed loop durations - damp every animation so the
|
|
319
319
|
library honours the preference on its own. */
|
|
320
320
|
@media (prefers-reduced-motion: reduce) {
|
|
321
321
|
* { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Wraps next-themes so it writes `data-theme="light|dark"` on <html>
|
|
4
|
+
* Wraps next-themes so it writes `data-theme="light|dark"` on <html> - the exact
|
|
5
5
|
* hook the Sereno tokens switch on (`[data-theme="dark"]` in colors.css / elevation.css).
|
|
6
6
|
* Defaults to the OS preference; the choice is remembered in localStorage.
|
|
7
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/theme/ThemeProvider.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ThemeProvider as NextThemesProvider } from 'next-themes';\n\n/**\n * Wraps next-themes so it writes `data-theme=\"light|dark\"` on <html>
|
|
1
|
+
{"version":3,"sources":["../../src/theme/ThemeProvider.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ThemeProvider as NextThemesProvider } from 'next-themes';\n\n/**\n * Wraps next-themes so it writes `data-theme=\"light|dark\"` on <html> - the exact\n * hook the Sereno tokens switch on (`[data-theme=\"dark\"]` in colors.css / elevation.css).\n * Defaults to the OS preference; the choice is remembered in localStorage.\n */\nexport function ThemeProvider({ children }: { children: React.ReactNode }) {\n return (\n <NextThemesProvider attribute=\"data-theme\" defaultTheme=\"system\" enableSystem enableColorScheme={false} disableTransitionOnChange>\n {children}\n </NextThemesProvider>\n );\n}\n"],"mappings":";AAYI;AATJ,SAAS,iBAAiB,0BAA0B;AAO7C,SAAS,cAAc,EAAE,SAAS,GAAkC;AACzE,SACE,oBAAC,sBAAmB,WAAU,cAAa,cAAa,UAAS,cAAY,MAAC,mBAAmB,OAAO,2BAAyB,MAC9H,UACH;AAEJ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sereno-ds/ui",
|
|
3
|
-
"version": "0.36.
|
|
4
|
-
"description": "Sereno Design System
|
|
3
|
+
"version": "0.36.4",
|
|
4
|
+
"description": "Sereno Design System: React primitives (token-driven, inline styles, no UI base lib).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Sereno",
|
|
7
7
|
"repository": {
|