@senvenli/react 0.3.3 → 0.3.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.
Files changed (93) hide show
  1. package/dist/action/fab.d.ts +7 -0
  2. package/dist/action/fab.js +22 -3
  3. package/dist/action/fab.js.map +1 -1
  4. package/dist/collection/data-table.d.ts +1 -1
  5. package/dist/collection/data-table.js +2 -2
  6. package/dist/collection/data-table.js.map +1 -1
  7. package/dist/collection/table.d.ts +7 -2
  8. package/dist/collection/table.js +17 -7
  9. package/dist/collection/table.js.map +1 -1
  10. package/dist/i18n.d.ts +8 -0
  11. package/dist/i18n.js +18 -1
  12. package/dist/i18n.js.map +1 -1
  13. package/dist/navigation/index.d.ts +2 -2
  14. package/dist/navigation/index.js +1 -1
  15. package/dist/navigation/index.js.map +1 -1
  16. package/dist/navigation/sidebar.d.ts +18 -0
  17. package/dist/navigation/sidebar.js +26 -2
  18. package/dist/navigation/sidebar.js.map +1 -1
  19. package/dist/overlay/floating.js +4 -1
  20. package/dist/overlay/floating.js.map +1 -1
  21. package/dist/overlay/index.d.ts +2 -0
  22. package/dist/overlay/index.js +2 -1
  23. package/dist/overlay/index.js.map +1 -1
  24. package/dist/overlay/tour.d.ts +88 -0
  25. package/dist/overlay/tour.js +302 -0
  26. package/dist/overlay/tour.js.map +1 -0
  27. package/package.json +2 -2
  28. package/dist/action/files.d.ts +0 -70
  29. package/dist/action/files.js +0 -156
  30. package/dist/action/files.js.map +0 -1
  31. package/dist/action/theme-toggle.d.ts +0 -43
  32. package/dist/action/theme-toggle.js +0 -259
  33. package/dist/action/theme-toggle.js.map +0 -1
  34. package/dist/display/image-crop.d.ts +0 -106
  35. package/dist/display/image-crop.js +0 -117
  36. package/dist/display/image-crop.js.map +0 -1
  37. package/dist/display/image-cropper.d.ts +0 -68
  38. package/dist/display/image-cropper.js +0 -284
  39. package/dist/display/image-cropper.js.map +0 -1
  40. package/dist/display/lozenge.d.ts +0 -30
  41. package/dist/display/lozenge.js +0 -55
  42. package/dist/display/lozenge.js.map +0 -1
  43. package/dist/display/scroll-area.d.ts +0 -29
  44. package/dist/display/scroll-area.js +0 -95
  45. package/dist/display/scroll-area.js.map +0 -1
  46. package/dist/feedback/cooldown.d.ts +0 -17
  47. package/dist/feedback/cooldown.js +0 -59
  48. package/dist/feedback/cooldown.js.map +0 -1
  49. package/dist/feedback/status-dot.d.ts +0 -23
  50. package/dist/feedback/status-dot.js +0 -37
  51. package/dist/feedback/status-dot.js.map +0 -1
  52. package/dist/form/input-otp.d.ts +0 -35
  53. package/dist/form/input-otp.js +0 -83
  54. package/dist/form/input-otp.js.map +0 -1
  55. package/dist/layout/auth-form-layout.d.ts +0 -71
  56. package/dist/layout/auth-form-layout.js +0 -61
  57. package/dist/layout/auth-form-layout.js.map +0 -1
  58. package/dist/layout/auth-layout.d.ts +0 -59
  59. package/dist/layout/auth-layout.js +0 -26
  60. package/dist/layout/auth-layout.js.map +0 -1
  61. package/dist/layout/pressable.d.ts +0 -40
  62. package/dist/layout/pressable.js +0 -65
  63. package/dist/layout/pressable.js.map +0 -1
  64. package/dist/layout/reset-sent-card.d.ts +0 -39
  65. package/dist/layout/reset-sent-card.js +0 -22
  66. package/dist/layout/reset-sent-card.js.map +0 -1
  67. package/dist/navigation/dock.d.ts +0 -27
  68. package/dist/navigation/dock.js +0 -47
  69. package/dist/navigation/dock.js.map +0 -1
  70. package/dist/navigation/footer.d.ts +0 -43
  71. package/dist/navigation/footer.js +0 -43
  72. package/dist/navigation/footer.js.map +0 -1
  73. package/dist/navigation/language-names.d.ts +0 -19
  74. package/dist/navigation/language-names.js +0 -79
  75. package/dist/navigation/language-names.js.map +0 -1
  76. package/dist/navigation/language-switcher.d.ts +0 -55
  77. package/dist/navigation/language-switcher.js +0 -53
  78. package/dist/navigation/language-switcher.js.map +0 -1
  79. package/dist/navigation/panel-header.d.ts +0 -37
  80. package/dist/navigation/panel-header.js +0 -50
  81. package/dist/navigation/panel-header.js.map +0 -1
  82. package/dist/navigation/toolbar.d.ts +0 -37
  83. package/dist/navigation/toolbar.js +0 -334
  84. package/dist/navigation/toolbar.js.map +0 -1
  85. package/dist/overlay/command-palette.d.ts +0 -53
  86. package/dist/overlay/command-palette.js +0 -130
  87. package/dist/overlay/command-palette.js.map +0 -1
  88. package/dist/overlay/overlay.d.ts +0 -299
  89. package/dist/overlay/overlay.js +0 -558
  90. package/dist/overlay/overlay.js.map +0 -1
  91. package/dist/selection/radio-card.d.ts +0 -31
  92. package/dist/selection/radio-card.js +0 -29
  93. package/dist/selection/radio-card.js.map +0 -1
@@ -1,83 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import * as React from "react";
4
- import { Input, TextField as AriaTextField, } from "react-aria-components";
5
- import { cn } from "../utils.js";
6
- import { FieldDescription, FieldError, FieldLabel } from "./field-parts.js";
7
- import { FIELD_STACK } from "./styles.js";
8
- import { useFieldValidation } from "./validation.js";
9
- /**
10
- * A one-time code: one real input with `autocomplete="one-time-code"` and a
11
- * numeric keypad, so SMS autofill and paste fill every box at once; the
12
- * boxes are only its picture. React Aria has no OTP primitive, so this is a TextField with a visual layer.
13
- */
14
- /**
15
- * The digits to keep from the input's text. The caret is pinned to the end,
16
- * so a full code pasted or autofilled over an old one arrives appended
17
- * ("111111" + "222222"): when a whole code was added, the new one wins.
18
- */
19
- function takeCode(text, previous, length) {
20
- const digits = text.replace(/\D/g, "");
21
- if (digits.length > length && digits.length - previous.length >= length)
22
- return digits.slice(-length);
23
- return digits.slice(0, length);
24
- }
25
- export const InputOTP = React.forwardRef(function InputOTP({ label, length = 6, description, errorMessage, onComplete, value, defaultValue, onChange, validate, onBlur, requiredValidation, ...rest }, ref) {
26
- const [uncontrolled, setUncontrolled] = React.useState(defaultValue ?? "");
27
- const code = (value ?? uncontrolled).replace(/\D/g, "").slice(0, length);
28
- const [focused, setFocused] = React.useState(false);
29
- const inputRef = React.useRef(null);
30
- const setRefs = (node) => {
31
- inputRef.current = node;
32
- if (typeof ref === "function")
33
- ref(node);
34
- else if (ref)
35
- ref.current = node;
36
- };
37
- const active = Math.min(code.length, length - 1);
38
- // The last code passed to onComplete: a new full code (pasted over an old one) completes again.
39
- const completed = React.useRef(code.length === length ? code : null);
40
- const timing = useFieldValidation({
41
- validate,
42
- value: value === undefined ? undefined : code,
43
- initialValue: defaultValue ?? "",
44
- isRequired: rest.isRequired,
45
- requiredValidation,
46
- onBlur: onBlur,
47
- onChange: (digits) => {
48
- if (value === undefined)
49
- setUncontrolled(digits);
50
- onChange?.(digits);
51
- if (digits.length === length) {
52
- if (completed.current !== digits) {
53
- completed.current = digits;
54
- onComplete?.(digits);
55
- }
56
- }
57
- else
58
- completed.current = null;
59
- },
60
- validationBehavior: rest.validationBehavior,
61
- });
62
- const pinCaret = (input) => {
63
- const end = input.value.length;
64
- if (input.selectionStart !== end || input.selectionEnd !== end)
65
- input.setSelectionRange(end, end);
66
- };
67
- return (_jsx(AriaTextField, { ...rest, value: code, validationBehavior: timing.validationBehavior, validate: timing.validate, onBlur: timing.onBlur, onChange: (next) => timing.onChange?.(takeCode(next, code, length)), "data-slot": "input-otp", className: FIELD_STACK, children: ({ isInvalid, isDisabled }) => (_jsxs(_Fragment, { children: [_jsx(FieldLabel, { isRequired: rest.isRequired, children: label }), _jsxs("div", { "data-slot": "input-otp-boxes",
68
- // As wide as its cells, never wider than its column: on a narrow phone the cells shrink instead
69
- // of pushing the field (and the page) sideways. Codes read left to right in every locale, so the row
70
- // (cells, separator and the hidden input) stays LTR on an RTL page: "1234" never shows as "4 3 2 1".
71
- dir: "ltr", className: "relative flex w-full max-w-fit items-center gap-ds-100", onMouseDown: (event) => {
72
- event.preventDefault();
73
- inputRef.current?.focus();
74
- }, children: [_jsx(Input, { ref: setRefs, inputMode: "numeric", autoComplete: "one-time-code",
75
- // No maxLength: the browser would cut "482 917" to six characters before the digits are picked out.
76
- pattern: "\\d*", "data-slot": "input-otp-input", onFocus: (event) => {
77
- setFocused(true);
78
- pinCaret(event.currentTarget);
79
- },
80
- // Boxes fill left to right: arrows, Home and clicks never move the caret off the end.
81
- onSelect: (event) => pinCaret(event.currentTarget), onKeyUp: (event) => pinCaret(event.currentTarget), onBlur: () => setFocused(false), className: "absolute inset-0 z-10 h-full w-full cursor-text bg-transparent text-transparent caret-transparent outline-hidden selection:bg-transparent" }), Array.from({ length }, (_, index) => (_jsxs(React.Fragment, { children: [length === 6 && index === 3 && (_jsx("span", { "aria-hidden": "true", "data-slot": "input-otp-separator", className: "h-0.5 w-ds-100 shrink-0 rounded-ds-full bg-ds-border-bold" })), _jsxs("span", { "aria-hidden": "true", "data-slot": "input-otp-box", "data-active": focused && index === active ? true : undefined, className: cn("relative inline-flex h-13 w-11 min-w-0 items-center justify-center rounded-ds-medium border bg-ds-background-input", "text-metric-medium tabular-nums text-ds-text", isInvalid ? "border-ds-border-danger" : "border-ds-border-bold", focused && index === active && "border-ds-border-focused outline-1 outline-solid -outline-offset-2 outline-ds-border-focused", isDisabled && "border-transparent bg-ds-background-disabled text-ds-text-disabled"), children: [code[index] ?? "", focused && index === active && code.length < length && (_jsx("span", { className: "h-5 w-px animate-pulse bg-ds-text motion-reduce:animate-none" }))] })] }, index)))] }), description && _jsx(FieldDescription, { children: description }), _jsx(FieldError, { children: errorMessage })] })) }));
82
- });
83
- //# sourceMappingURL=input-otp.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"input-otp.js","sourceRoot":"","sources":["../../src/form/input-otp.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,KAAK,EACL,SAAS,IAAI,aAAa,GAE3B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EA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cesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport {\n Input,\n TextField as AriaTextField,\n type TextFieldProps as AriaTextFieldProps,\n} from \"react-aria-components\";\n\nimport { cn } from \"../utils\";\nimport { FieldDescription, FieldError, FieldLabel } from \"./field-parts\";\nimport { FIELD_STACK } from \"./styles\";\nimport { useFieldValidation, type RequiredValidation } from \"./validation\";\n\nexport type InputOTPProps = Omit<\n AriaTextFieldProps,\n \"className\" | \"style\" | \"children\" | \"type\" | \"inputMode\" | \"autoComplete\" | \"maxLength\"\n> & {\n label: React.ReactNode;\n /** 4 or 6 digits; 6 splits 3 + 3 with a dash. */\n length?: 4 | 6;\n description?: React.ReactNode;\n /** Say what to do: \"Wrong code. Enter the latest code from your phone.\" */\n errorMessage?: React.ReactNode;\n /** Called once the last digit is entered (submit there). */\n onComplete?: (code: string) => void;\n /**\n * Who says an empty required field is missing: `field` (default) or `app`. With `app` a DS\n * Form's `onSubmit` runs with the field empty, and the app's own error must clear on change. See\n * {@link RequiredValidation} for the whole contract.\n */\n requiredValidation?: RequiredValidation;\n};\n\n/**\n * A one-time code: one real input with `autocomplete=\"one-time-code\"` and a\n * numeric keypad, so SMS autofill and paste fill every box at once; the\n * boxes are only its picture. React Aria has no OTP primitive, so this is a TextField with a visual layer.\n */\n/**\n * The digits to keep from the input's text. The caret is pinned to the end,\n * so a full code pasted or autofilled over an old one arrives appended\n * (\"111111\" + \"222222\"): when a whole code was added, the new one wins.\n */\nfunction takeCode(text: string, previous: string, length: number) {\n const digits = text.replace(/\\D/g, \"\");\n if (digits.length > length && digits.length - previous.length >= length) return digits.slice(-length);\n return digits.slice(0, length);\n}\n\nexport const InputOTP = React.forwardRef<HTMLInputElement, InputOTPProps>(function InputOTP(\n { label, length = 6, description, errorMessage, onComplete, value, defaultValue, onChange, validate, onBlur, requiredValidation, ...rest },\n ref,\n) {\n const [uncontrolled, setUncontrolled] = React.useState(defaultValue ?? \"\");\n const code = (value ?? uncontrolled).replace(/\\D/g, \"\").slice(0, length);\n const [focused, setFocused] = React.useState(false);\n const inputRef = React.useRef<HTMLInputElement | null>(null);\n\n const setRefs = (node: HTMLInputElement | null) => {\n inputRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n };\n\n const active = Math.min(code.length, length - 1);\n // The last code passed to onComplete: a new full code (pasted over an old one) completes again.\n const completed = React.useRef<string | null>(code.length === length ? code : null);\n const timing = useFieldValidation<string>({\n validate,\n value: value === undefined ? undefined : code,\n initialValue: defaultValue ?? \"\",\n isRequired: rest.isRequired,\n requiredValidation,\n onBlur: onBlur as ((event: React.FocusEvent) => void) | undefined,\n onChange: (digits) => {\n if (value === undefined) setUncontrolled(digits);\n onChange?.(digits);\n if (digits.length === length) {\n if (completed.current !== digits) {\n completed.current = digits;\n onComplete?.(digits);\n }\n } else completed.current = null;\n },\n validationBehavior: rest.validationBehavior,\n });\n const pinCaret = (input: HTMLInputElement) => {\n const end = input.value.length;\n if (input.selectionStart !== end || input.selectionEnd !== end) input.setSelectionRange(end, end);\n };\n return (\n <AriaTextField\n {...rest}\n value={code}\n validationBehavior={timing.validationBehavior}\n validate={timing.validate}\n onBlur={timing.onBlur}\n onChange={(next) => timing.onChange?.(takeCode(next, code, length))}\n data-slot=\"input-otp\"\n className={FIELD_STACK}\n >\n {({ isInvalid, isDisabled }) => (\n <>\n <FieldLabel isRequired={rest.isRequired}>{label}</FieldLabel>\n <div\n data-slot=\"input-otp-boxes\"\n // As wide as its cells, never wider than its column: on a narrow phone the cells shrink instead\n // of pushing the field (and the page) sideways. Codes read left to right in every locale, so the row\n // (cells, separator and the hidden input) stays LTR on an RTL page: \"1234\" never shows as \"4 3 2 1\".\n dir=\"ltr\"\n className=\"relative flex w-full max-w-fit items-center gap-ds-100\"\n onMouseDown={(event) => {\n event.preventDefault();\n inputRef.current?.focus();\n }}\n >\n <Input\n ref={setRefs}\n inputMode=\"numeric\"\n autoComplete=\"one-time-code\"\n // No maxLength: the browser would cut \"482 917\" to six characters before the digits are picked out.\n pattern=\"\\d*\"\n data-slot=\"input-otp-input\"\n onFocus={(event) => {\n setFocused(true);\n pinCaret(event.currentTarget);\n }}\n // Boxes fill left to right: arrows, Home and clicks never move the caret off the end.\n onSelect={(event) => pinCaret(event.currentTarget)}\n onKeyUp={(event) => pinCaret(event.currentTarget)}\n onBlur={() => setFocused(false)}\n className=\"absolute inset-0 z-10 h-full w-full cursor-text bg-transparent text-transparent caret-transparent outline-hidden selection:bg-transparent\"\n />\n {Array.from({ length }, (_, index) => (\n <React.Fragment key={index}>\n {length === 6 && index === 3 && (\n <span aria-hidden=\"true\" data-slot=\"input-otp-separator\" className=\"h-0.5 w-ds-100 shrink-0 rounded-ds-full bg-ds-border-bold\" />\n )}\n <span\n aria-hidden=\"true\"\n data-slot=\"input-otp-box\"\n data-active={focused && index === active ? true : undefined}\n className={cn(\n \"relative inline-flex h-13 w-11 min-w-0 items-center justify-center rounded-ds-medium border bg-ds-background-input\",\n \"text-metric-medium tabular-nums text-ds-text\",\n isInvalid ? \"border-ds-border-danger\" : \"border-ds-border-bold\",\n focused && index === active && \"border-ds-border-focused outline-1 outline-solid -outline-offset-2 outline-ds-border-focused\",\n isDisabled && \"border-transparent bg-ds-background-disabled text-ds-text-disabled\",\n )}\n >\n {code[index] ?? \"\"}\n {focused && index === active && code.length < length && (\n <span className=\"h-5 w-px animate-pulse bg-ds-text motion-reduce:animate-none\" />\n )}\n </span>\n </React.Fragment>\n ))}\n </div>\n {description && <FieldDescription>{description}</FieldDescription>}\n <FieldError>{errorMessage}</FieldError>\n </>\n )}\n </AriaTextField>\n );\n});\n"]}
@@ -1,71 +0,0 @@
1
- import * as React from "react";
2
- export type AuthFormLayoutSurface = "card" | "plain";
3
- /** A heading at the given level; the type style is the caller's, so the level never changes the look. */
4
- export declare function TitleTag({ level, className, children }: {
5
- level: 1 | 2 | 3;
6
- className?: string;
7
- children: React.ReactNode;
8
- }): React.JSX.Element;
9
- export interface AuthFormLayoutProps {
10
- /**
11
- * `card` (default) raises the panel onto its own surface; `plain` lets it sit
12
- * directly on the pane. The default matches the busiest existing screen.
13
- */
14
- surface?: AuthFormLayoutSurface;
15
- /** The screen's heading. */
16
- title: React.ReactNode;
17
- /** One line under the heading. */
18
- description?: React.ReactNode;
19
- /**
20
- * The heading's type style, a DS heading class: `text-heading-large` by default; a screen with a longer title
21
- * may step down (`text-heading-medium`).
22
- */
23
- titleClassName?: string;
24
- /** The title's heading level: 1 (the page's own heading, by default), or 2 when the page has its own h1. */
25
- headingLevel?: 1 | 2 | 3;
26
- /** Above everything, at the inline end — a language switcher, a back link. */
27
- headerSlot?: React.ReactNode;
28
- /** The compact brand header, mobile only: the brand pane is desktop-only. */
29
- logoSlot?: React.ReactNode;
30
- /** Under the body — a secondary route out of the screen. */
31
- footerSlot?: React.ReactNode;
32
- /** Last, set apart — legal text, a support line. */
33
- noticeSlot?: React.ReactNode;
34
- /**
35
- * The spacing between the form's rows (`space-y-4` by default), merged onto a native form child. The DS `Form`
36
- * takes no className and keeps its own gap, so this has no effect on it.
37
- */
38
- bodyClassName?: string;
39
- /**
40
- * A single element — the screen's own form. The layout renders the body
41
- * region *through* it, so it keeps its element, its handler and its
42
- * attributes while the rhythm arrives from here.
43
- *
44
- * A form component (rather than a `<form>`) must pass `className` and
45
- * `data-slot` on to its element, or the rhythm is lost.
46
- */
47
- children: React.ReactNode;
48
- className?: string;
49
- }
50
- /**
51
- * The panel an auth screen's credentials sit in: surface, header and logo rows,
52
- * heading and description, the body region's rhythm, and the footer and notice
53
- * rows beneath it (the auth pattern).
54
- *
55
- * Everything a screen *does* stays with the screen — submission, field state,
56
- * validation, lockout, the submit control. This layout owns only where those
57
- * things sit. The seam is the body region: the caller passes its own form
58
- * element as the single child; the layout puts the gap above it on a wrapper and merges the rows' spacing
59
- * onto the element itself (a native form takes it; the DS Form keeps its own gap and `data-slot`):
60
- *
61
- * - The form remains a real element, so its handler, `noValidate` and
62
- * `aria-busy` behave exactly as they did before this layout existed.
63
- * - The header, logo, footer and notice rows sit *outside* the form. A control
64
- * placed there is not the form's to submit.
65
- *
66
- * The single-child contract is real: a fragment or two siblings fail at render
67
- * rather than silently losing the rhythm. Override the spacing with
68
- * `bodyClassName`, not by adding classes to the child — the merge with the
69
- * child's own is a concatenation, not a Tailwind-aware one.
70
- */
71
- export declare function AuthFormLayout({ surface, title, description, titleClassName, headingLevel, headerSlot, logoSlot, footerSlot, noticeSlot, bodyClassName, children, className, }: AuthFormLayoutProps): React.JSX.Element;
@@ -1,61 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import * as React from "react";
4
- import { cn } from "../utils.js";
5
- /** A heading at the given level; the type style is the caller's, so the level never changes the look. */
6
- export function TitleTag({ level, className, children }) {
7
- const Tag = `h${level}`;
8
- return _jsx(Tag, { className: className, children: children });
9
- }
10
- const REACT_LAZY_TYPE = Symbol.for("react.lazy");
11
- function isLazyReference(value) {
12
- return (value !== null &&
13
- typeof value === "object" &&
14
- value.$$typeof === REACT_LAZY_TYPE &&
15
- typeof value._payload?.then === "function");
16
- }
17
- /**
18
- * The body region rendered through the screen's own element. A child that a server component passed
19
- * arrives as a `react.lazy` reference once the Flight payload is split — sometimes a reference to a
20
- * reference — so each layer is resolved with `use()` before the element is read.
21
- */
22
- function AuthFormBody({ className, children }) {
23
- let child = children;
24
- for (let depth = 0; isLazyReference(child) && depth < 8; depth += 1) {
25
- child = React.use(child._payload);
26
- }
27
- const element = React.Children.only(child);
28
- // As the slot did before: the classes concatenate (CSS order decides, not a Tailwind-aware merge),
29
- // and a data-slot the child sets itself wins.
30
- return React.cloneElement(element, {
31
- "data-slot": element.props["data-slot"] ?? "auth-form-body",
32
- className: [className, element.props.className].filter(Boolean).join(" "),
33
- });
34
- }
35
- /**
36
- * The panel an auth screen's credentials sit in: surface, header and logo rows,
37
- * heading and description, the body region's rhythm, and the footer and notice
38
- * rows beneath it (the auth pattern).
39
- *
40
- * Everything a screen *does* stays with the screen — submission, field state,
41
- * validation, lockout, the submit control. This layout owns only where those
42
- * things sit. The seam is the body region: the caller passes its own form
43
- * element as the single child; the layout puts the gap above it on a wrapper and merges the rows' spacing
44
- * onto the element itself (a native form takes it; the DS Form keeps its own gap and `data-slot`):
45
- *
46
- * - The form remains a real element, so its handler, `noValidate` and
47
- * `aria-busy` behave exactly as they did before this layout existed.
48
- * - The header, logo, footer and notice rows sit *outside* the form. A control
49
- * placed there is not the form's to submit.
50
- *
51
- * The single-child contract is real: a fragment or two siblings fail at render
52
- * rather than silently losing the rhythm. Override the spacing with
53
- * `bodyClassName`, not by adding classes to the child — the merge with the
54
- * child's own is a concatenation, not a Tailwind-aware one.
55
- */
56
- export function AuthFormLayout({ surface = "card", title, description, titleClassName = "text-heading-large", headingLevel = 1, headerSlot, logoSlot, footerSlot, noticeSlot, bodyClassName, children, className, }) {
57
- return (_jsxs("div", { "data-slot": "auth-card", "data-surface": surface, className: cn("w-full", surface === "card"
58
- ? "max-w-100 rounded-2xl bg-ds-surface-raised p-ds-300 shadow-ds-raised sm:p-7"
59
- : "max-w-sm", className), children: [headerSlot && _jsx("div", { "data-slot": "auth-card-header", className: "mb-ds-300 flex justify-end", children: headerSlot }), logoSlot && _jsx("div", { "data-slot": "auth-card-logo", className: "mb-7 flex items-center lg:hidden", children: logoSlot }), _jsxs("div", { className: "space-y-1.5", children: [_jsx(TitleTag, { level: headingLevel, className: cn("text-ds-text", titleClassName), children: title }), description && _jsx("p", { className: "text-body text-ds-text-subtle", children: description })] }), _jsx("div", { "data-slot": "auth-form-region", className: "mt-ds-400", children: _jsx(AuthFormBody, { className: cn("space-y-4", bodyClassName), children: children }) }), footerSlot && _jsx("div", { "data-slot": "auth-card-footer", className: "mt-ds-300 flex justify-center", children: footerSlot }), noticeSlot && _jsx("div", { "data-slot": "auth-card-notice", className: "mt-8", children: noticeSlot })] }));
60
- }
61
- //# sourceMappingURL=auth-form-layout.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth-form-layout.js","sour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AE,UAAU,GAAO,IAChF,CACP,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"../utils\";\n\nexport type AuthFormLayoutSurface = \"card\" | \"plain\";\n\n/** A heading at the given level; the type style is the caller's, so the level never changes the look. */\nexport function TitleTag({ level, className, children }: { level: 1 | 2 | 3; className?: string; children: React.ReactNode }) {\n const Tag = `h${level}` as const;\n return <Tag className={className}>{children}</Tag>;\n}\n\nexport interface AuthFormLayoutProps {\n /**\n * `card` (default) raises the panel onto its own surface; `plain` lets it sit\n * directly on the pane. The default matches the busiest existing screen.\n */\n surface?: AuthFormLayoutSurface;\n /** The screen's heading. */\n title: React.ReactNode;\n /** One line under the heading. */\n description?: React.ReactNode;\n /**\n * The heading's type style, a DS heading class: `text-heading-large` by default; a screen with a longer title\n * may step down (`text-heading-medium`).\n */\n titleClassName?: string;\n /** The title's heading level: 1 (the page's own heading, by default), or 2 when the page has its own h1. */\n headingLevel?: 1 | 2 | 3;\n /** Above everything, at the inline end — a language switcher, a back link. */\n headerSlot?: React.ReactNode;\n /** The compact brand header, mobile only: the brand pane is desktop-only. */\n logoSlot?: React.ReactNode;\n /** Under the body — a secondary route out of the screen. */\n footerSlot?: React.ReactNode;\n /** Last, set apart — legal text, a support line. */\n noticeSlot?: React.ReactNode;\n /**\n * The spacing between the form's rows (`space-y-4` by default), merged onto a native form child. The DS `Form`\n * takes no className and keeps its own gap, so this has no effect on it.\n */\n bodyClassName?: string;\n /**\n * A single element — the screen's own form. The layout renders the body\n * region *through* it, so it keeps its element, its handler and its\n * attributes while the rhythm arrives from here.\n *\n * A form component (rather than a `<form>`) must pass `className` and\n * `data-slot` on to its element, or the rhythm is lost.\n */\n children: React.ReactNode;\n className?: string;\n}\n\nconst REACT_LAZY_TYPE = Symbol.for(\"react.lazy\");\n\nfunction isLazyReference(value: unknown): value is { _payload: PromiseLike<unknown> } {\n return (\n value !== null &&\n typeof value === \"object\" &&\n (value as { $$typeof?: unknown }).$$typeof === REACT_LAZY_TYPE &&\n typeof (value as { _payload?: { then?: unknown } })._payload?.then === \"function\"\n );\n}\n\n/**\n * The body region rendered through the screen's own element. A child that a server component passed\n * arrives as a `react.lazy` reference once the Flight payload is split — sometimes a reference to a\n * reference — so each layer is resolved with `use()` before the element is read.\n */\nfunction AuthFormBody({ className, children }: { className: string; children: React.ReactNode }) {\n let child: React.ReactNode = children;\n for (let depth = 0; isLazyReference(child) && depth < 8; depth += 1) {\n child = React.use(child._payload) as React.ReactNode;\n }\n const element = React.Children.only(child) as React.ReactElement<{ className?: string; \"data-slot\"?: string }>;\n // As the slot did before: the classes concatenate (CSS order decides, not a Tailwind-aware merge),\n // and a data-slot the child sets itself wins.\n return React.cloneElement(element, {\n \"data-slot\": element.props[\"data-slot\"] ?? \"auth-form-body\",\n className: [className, element.props.className].filter(Boolean).join(\" \"),\n } as React.Attributes & { className?: string });\n}\n\n/**\n * The panel an auth screen's credentials sit in: surface, header and logo rows,\n * heading and description, the body region's rhythm, and the footer and notice\n * rows beneath it (the auth pattern).\n *\n * Everything a screen *does* stays with the screen — submission, field state,\n * validation, lockout, the submit control. This layout owns only where those\n * things sit. The seam is the body region: the caller passes its own form\n * element as the single child; the layout puts the gap above it on a wrapper and merges the rows' spacing\n * onto the element itself (a native form takes it; the DS Form keeps its own gap and `data-slot`):\n *\n * - The form remains a real element, so its handler, `noValidate` and\n * `aria-busy` behave exactly as they did before this layout existed.\n * - The header, logo, footer and notice rows sit *outside* the form. A control\n * placed there is not the form's to submit.\n *\n * The single-child contract is real: a fragment or two siblings fail at render\n * rather than silently losing the rhythm. Override the spacing with\n * `bodyClassName`, not by adding classes to the child — the merge with the\n * child's own is a concatenation, not a Tailwind-aware one.\n */\nexport function AuthFormLayout({\n surface = \"card\",\n title,\n description,\n titleClassName = \"text-heading-large\",\n headingLevel = 1,\n headerSlot,\n logoSlot,\n footerSlot,\n noticeSlot,\n bodyClassName,\n children,\n className,\n}: AuthFormLayoutProps) {\n return (\n <div\n data-slot=\"auth-card\"\n data-surface={surface}\n className={cn(\n \"w-full\",\n surface === \"card\"\n ? \"max-w-100 rounded-2xl bg-ds-surface-raised p-ds-300 shadow-ds-raised sm:p-7\"\n : \"max-w-sm\",\n className,\n )}\n >\n {headerSlot && <div data-slot=\"auth-card-header\" className=\"mb-ds-300 flex justify-end\">{headerSlot}</div>}\n\n {logoSlot && <div data-slot=\"auth-card-logo\" className=\"mb-7 flex items-center lg:hidden\">{logoSlot}</div>}\n\n <div className=\"space-y-1.5\">\n <TitleTag level={headingLevel} className={cn(\"text-ds-text\", titleClassName)}>{title}</TitleTag>\n {description && <p className=\"text-body text-ds-text-subtle\">{description}</p>}\n </div>\n\n {/* The gap above the form sits on a wrapper: the DS Form takes no className (its own gap is its rhythm),\n so a margin merged onto it would be lost. */}\n <div data-slot=\"auth-form-region\" className=\"mt-ds-400\">\n <AuthFormBody className={cn(\"space-y-4\", bodyClassName)}>{children}</AuthFormBody>\n </div>\n\n {footerSlot && <div data-slot=\"auth-card-footer\" className=\"mt-ds-300 flex justify-center\">{footerSlot}</div>}\n\n {noticeSlot && <div data-slot=\"auth-card-notice\" className=\"mt-8\">{noticeSlot}</div>}\n </div>\n );\n}\n"]}
@@ -1,59 +0,0 @@
1
- import * as React from "react";
2
- export interface AuthLayoutProps {
3
- /** Top of the brand pane — the logo lockup. */
4
- brandLogo?: React.ReactNode;
5
- /** Middle of the brand pane — kicker / headline / copy / stats. */
6
- brandContent?: React.ReactNode;
7
- /** Bottom of the brand pane — a low-key footer line. */
8
- brandFooter?: React.ReactNode;
9
- /**
10
- * What rides at the start of the footer row, before `brandFooter` — a rule, a
11
- * mark, a motif. Nothing paints when it is absent: this layout carries no
12
- * signature of its own, so an app that wants one passes it.
13
- */
14
- brandFooterLead?: React.ReactNode;
15
- /**
16
- * Decoration behind the brand pane's content. A slot rather than a choice —
17
- * the layout knows the geometry, the app knows what it wants to look like.
18
- *
19
- * The pane is the positioning context and clips its overflow, so what goes
20
- * here should be `absolute inset-0 pointer-events-none` (and `aria-hidden`,
21
- * being decoration). It is rendered first and the pane's own rows carry
22
- * `relative`, so a backdrop that follows that shape sits behind them.
23
- */
24
- brandBackdrop?: React.ReactNode;
25
- /**
26
- * The brand pane's own ground: its background and the text color its
27
- * contents inherit. The layout has no opinion, because the surface is where
28
- * two apps sharing this skeleton most need to differ.
29
- */
30
- brandClassName?: string;
31
- /** The credentials pane's corner control (top, inline end). */
32
- topRightSlot?: React.ReactNode;
33
- /** The credentials content — typically an `AuthFormLayout`. */
34
- children: React.ReactNode;
35
- /**
36
- * The credentials pane's element: `main` (default) when the layout is the page, `div` when the app's shell already
37
- * renders the page's one `<main>`.
38
- */
39
- credentialsElement?: "main" | "div";
40
- className?: string;
41
- }
42
- /**
43
- * The split-screen skeleton an auth screen is built on: a desktop-only brand
44
- * pane beside a centered credentials pane (the auth pattern).
45
- *
46
- * Only the geometry lives here — the column ratio, the pane's top / middle /
47
- * bottom rhythm, the clipping, the full-height centring, the corner control.
48
- * Every surface is a slot: the ground arrives as `brandClassName`, the
49
- * decoration as `brandBackdrop`, the footer motif as `brandFooterLead`, so two
50
- * apps that want to look unrelated still share one skeleton.
51
- *
52
- * The split follows the layout's own width (a container query, 64rem and up), not the viewport's, so it also holds
53
- * inside a dialog, a preview frame or a shell with a sidebar.
54
- *
55
- * The brand pane is wide-only; on a narrow layout the credentials pane is the screen,
56
- * so a compact brand header belongs to the form (`AuthFormLayout`'s `logoSlot`).
57
- * The corner control sits at the inline end, so it mirrors in right-to-left.
58
- */
59
- export declare function AuthLayout({ brandLogo, brandContent, brandFooter, brandFooterLead, brandBackdrop, brandClassName, topRightSlot, children, credentialsElement: Credentials, className, }: AuthLayoutProps): React.JSX.Element;
@@ -1,26 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import * as React from "react";
3
- import { cn } from "../utils.js";
4
- /**
5
- * The split-screen skeleton an auth screen is built on: a desktop-only brand
6
- * pane beside a centered credentials pane (the auth pattern).
7
- *
8
- * Only the geometry lives here — the column ratio, the pane's top / middle /
9
- * bottom rhythm, the clipping, the full-height centring, the corner control.
10
- * Every surface is a slot: the ground arrives as `brandClassName`, the
11
- * decoration as `brandBackdrop`, the footer motif as `brandFooterLead`, so two
12
- * apps that want to look unrelated still share one skeleton.
13
- *
14
- * The split follows the layout's own width (a container query, 64rem and up), not the viewport's, so it also holds
15
- * inside a dialog, a preview frame or a shell with a sidebar.
16
- *
17
- * The brand pane is wide-only; on a narrow layout the credentials pane is the screen,
18
- * so a compact brand header belongs to the form (`AuthFormLayout`'s `logoSlot`).
19
- * The corner control sits at the inline end, so it mirrors in right-to-left.
20
- */
21
- export function AuthLayout({ brandLogo, brandContent, brandFooter, brandFooterLead, brandBackdrop, brandClassName, topRightSlot, children, credentialsElement: Credentials = "main", className, }) {
22
- return (
23
- // The container is the outer box: an element cannot query its own width, so the grid is one level in.
24
- _jsx("div", { "data-slot": "auth-layout", className: cn("@container min-h-svh", className), children: _jsxs("div", { "data-slot": "auth-layout-grid", className: "grid min-h-svh @5xl:grid-cols-[1.05fr_1fr]", children: [_jsxs("aside", { "data-slot": "auth-brand", className: cn("relative hidden overflow-hidden @5xl:flex @5xl:flex-col @5xl:justify-between @5xl:p-ds-600 @7xl:p-ds-800", brandClassName), children: [brandBackdrop, brandLogo && _jsx("div", { className: "relative", children: brandLogo }), brandContent && _jsx("div", { className: "relative", children: brandContent }), _jsxs("div", { "data-slot": "auth-brand-footer", className: "relative flex items-center gap-ds-200", children: [brandFooterLead, brandFooter && _jsx("div", { className: "min-w-0", children: brandFooter })] })] }), _jsxs(Credentials, { "data-slot": "auth-credentials", className: "relative flex h-full min-h-0 flex-col items-center justify-center bg-ds-surface px-ds-250 py-ds-600 text-ds-text", children: [topRightSlot && (_jsx("div", { "data-slot": "auth-corner", className: "absolute top-ds-200 end-ds-200 z-10", children: topRightSlot })), children] })] }) }));
25
- }
26
- //# sourceMappingURL=auth-layout.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth-layout.js","sourceRoot":"","sources":["../../src/layout/auth-layout.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AA2C9B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,SAAS,EACT,YAAY,EACZ,WAAW,EACX,eAAe,EACf,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAAE,WAAW,GAAG,MAAM,EACxC,SAAS,GACO;IAChB,OAAO;IACL,sGAAsG;IACtG,2BAAe,aAAa,EAAC,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,SAAS,CAAC,YAC3E,4BAAe,kBAAkB,EAAC,SAAS,EAAC,4CAA4C,aACtF,8BACY,YAAY,EACtB,SAAS,EAAE,EAAE,CACX,0GAA0G,EAC1G,cAAc,CACf,aAEA,aAAa,EAEb,SAAS,IAAI,cAAK,SAAS,EAAC,UAAU,YAAE,SAAS,GAAO,EAExD,YAAY,IAAI,cAAK,SAAS,EAAC,UAAU,YAAE,YAAY,GAAO,EAK/D,4BAAe,mBAAmB,EAAC,SAAS,EAAC,uCAAuC,aACjF,eAAe,EACf,WAAW,IAAI,cAAK,SAAS,EAAC,SAAS,YAAE,WAAW,GAAO,IACxD,IACA,EAER,MAAC,WAAW,iBACA,kBAAkB,EAC5B,SAAS,EAAC,kHAAkH,aAE3H,YAAY,IAAI,CACf,2BAAe,aAAa,EAAC,SAAS,EAAC,qCAAqC,YACzE,YAAY,GACT,CACP,EACA,QAAQ,IACG,IACV,GACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["import * as React from \"react\";\n\nimport { cn } from \"../utils\";\n\nexport interface AuthLayoutProps {\n /** Top of the brand pane — the logo lockup. */\n brandLogo?: React.ReactNode;\n /** Middle of the brand pane — kicker / headline / copy / stats. */\n brandContent?: React.ReactNode;\n /** Bottom of the brand pane — a low-key footer line. */\n brandFooter?: React.ReactNode;\n /**\n * What rides at the start of the footer row, before `brandFooter` — a rule, a\n * mark, a motif. Nothing paints when it is absent: this layout carries no\n * signature of its own, so an app that wants one passes it.\n */\n brandFooterLead?: React.ReactNode;\n /**\n * Decoration behind the brand pane's content. A slot rather than a choice —\n * the layout knows the geometry, the app knows what it wants to look like.\n *\n * The pane is the positioning context and clips its overflow, so what goes\n * here should be `absolute inset-0 pointer-events-none` (and `aria-hidden`,\n * being decoration). It is rendered first and the pane's own rows carry\n * `relative`, so a backdrop that follows that shape sits behind them.\n */\n brandBackdrop?: React.ReactNode;\n /**\n * The brand pane's own ground: its background and the text color its\n * contents inherit. The layout has no opinion, because the surface is where\n * two apps sharing this skeleton most need to differ.\n */\n brandClassName?: string;\n /** The credentials pane's corner control (top, inline end). */\n topRightSlot?: React.ReactNode;\n /** The credentials content — typically an `AuthFormLayout`. */\n children: React.ReactNode;\n /**\n * The credentials pane's element: `main` (default) when the layout is the page, `div` when the app's shell already\n * renders the page's one `<main>`.\n */\n credentialsElement?: \"main\" | \"div\";\n className?: string;\n}\n\n/**\n * The split-screen skeleton an auth screen is built on: a desktop-only brand\n * pane beside a centered credentials pane (the auth pattern).\n *\n * Only the geometry lives here — the column ratio, the pane's top / middle /\n * bottom rhythm, the clipping, the full-height centring, the corner control.\n * Every surface is a slot: the ground arrives as `brandClassName`, the\n * decoration as `brandBackdrop`, the footer motif as `brandFooterLead`, so two\n * apps that want to look unrelated still share one skeleton.\n *\n * The split follows the layout's own width (a container query, 64rem and up), not the viewport's, so it also holds\n * inside a dialog, a preview frame or a shell with a sidebar.\n *\n * The brand pane is wide-only; on a narrow layout the credentials pane is the screen,\n * so a compact brand header belongs to the form (`AuthFormLayout`'s `logoSlot`).\n * The corner control sits at the inline end, so it mirrors in right-to-left.\n */\nexport function AuthLayout({\n brandLogo,\n brandContent,\n brandFooter,\n brandFooterLead,\n brandBackdrop,\n brandClassName,\n topRightSlot,\n children,\n credentialsElement: Credentials = \"main\",\n className,\n}: AuthLayoutProps) {\n return (\n // The container is the outer box: an element cannot query its own width, so the grid is one level in.\n <div data-slot=\"auth-layout\" className={cn(\"@container min-h-svh\", className)}>\n <div data-slot=\"auth-layout-grid\" className=\"grid min-h-svh @5xl:grid-cols-[1.05fr_1fr]\">\n <aside\n data-slot=\"auth-brand\"\n className={cn(\n \"relative hidden overflow-hidden @5xl:flex @5xl:flex-col @5xl:justify-between @5xl:p-ds-600 @7xl:p-ds-800\",\n brandClassName,\n )}\n >\n {brandBackdrop}\n\n {brandLogo && <div className=\"relative\">{brandLogo}</div>}\n\n {brandContent && <div className=\"relative\">{brandContent}</div>}\n\n {/* Always rendered, even when it holds nothing. The pane is a `justify-between` column, so\n dropping this row slams the narrative against the bottom edge; a zero-height\n spacer holds the top / middle / bottom rhythm whatever the consumer supplies. */}\n <div data-slot=\"auth-brand-footer\" className=\"relative flex items-center gap-ds-200\">\n {brandFooterLead}\n {brandFooter && <div className=\"min-w-0\">{brandFooter}</div>}\n </div>\n </aside>\n\n <Credentials\n data-slot=\"auth-credentials\"\n className=\"relative flex h-full min-h-0 flex-col items-center justify-center bg-ds-surface px-ds-250 py-ds-600 text-ds-text\"\n >\n {topRightSlot && (\n <div data-slot=\"auth-corner\" className=\"absolute top-ds-200 end-ds-200 z-10\">\n {topRightSlot}\n </div>\n )}\n {children}\n </Credentials>\n </div>\n </div>\n );\n}\n"]}
@@ -1,40 +0,0 @@
1
- import * as React from "react";
2
- import { type ButtonProps, type LinkProps, type PressEvent } from "react-aria-components";
3
- import { type BoxStyleProps } from "./box.js";
4
- /**
5
- * Shared look for every Pressable: no native chrome, a 24px minimum hit
6
- * area, a 2px inner `ds-border-focused` border on keyboard focus only, and hover / pressed
7
- * feedback from tokens. A surface with a shadow lifts to the overlay shadow
8
- * on hover and settles back to the raised one while pressed (the interactive
9
- * Card rule); every Pressable also takes the hover / pressed fill of its ground.
10
- */
11
- export declare function pressableClasses(style: BoxStyleProps & {
12
- fullWidth?: boolean;
13
- }): string;
14
- type PressableBase = BoxStyleProps & {
15
- /** As wide as its container (default `true`), as a button or a link; `false` hugs what it holds. */
16
- fullWidth?: boolean;
17
- children?: React.ReactNode;
18
- isDisabled?: boolean;
19
- /** Required when the content has no text that names the action. */
20
- "aria-label"?: string;
21
- id?: string;
22
- };
23
- export type PressableProps = PressableBase & (({
24
- href?: undefined;
25
- onPress?: (event: PressEvent) => void;
26
- } & Pick<ButtonProps, "type" | "form" | "aria-describedby" | "aria-pressed" | "aria-expanded">) | ({
27
- href: string;
28
- onPress?: (event: PressEvent) => void;
29
- } & Pick<LinkProps, "target" | "rel" | "routerOptions" | "aria-describedby">));
30
- /**
31
- * Makes a custom surface clickable with React Aria's press handling: mouse,
32
- * touch, keyboard (Enter / Space) and screen readers, with consistent
33
- * hover, pressed and focus-visible states. With `href` it is a link that
34
- * goes through the host router (`DesignSystemProvider`); otherwise a button.
35
- *
36
- * Content is phrasing content only (a `<button>` or `<a>` may not hold block
37
- * elements): lay it out with `Stack` / `Inline` / `Box` `as="span"`.
38
- */
39
- export declare const Pressable: React.ForwardRefExoticComponent<PressableProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
40
- export {};
@@ -1,65 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import * as React from "react";
4
- import { Button, Link } from "react-aria-components";
5
- import { cn } from "../utils.js";
6
- import { boxClasses } from "./box.js";
7
- /**
8
- * Hover and pressed fills follow the ground the Pressable starts from, so a
9
- * selected or neutral surface keeps its meaning while it reacts. Status
10
- * grounds (information, success…) keep their fill; their feedback is the
11
- * shadow or the focus ring.
12
- */
13
- const HOVER_FILL = {
14
- none: "data-[hovered]:bg-ds-surface-hovered",
15
- surface: "data-[hovered]:bg-ds-surface-hovered",
16
- "surface-raised": "data-[hovered]:bg-ds-surface-hovered",
17
- "surface-overlay": "data-[hovered]:bg-ds-surface-hovered",
18
- "surface-sunken": "data-[hovered]:bg-ds-background-neutral-hovered",
19
- neutral: "data-[hovered]:bg-ds-background-neutral-hovered",
20
- selected: "data-[hovered]:bg-ds-background-selected-hovered",
21
- "brand-subtle": "data-[hovered]:bg-ds-background-selected-hovered",
22
- };
23
- const PRESSED_FILL = {
24
- none: "data-[pressed]:bg-ds-background-neutral-hovered",
25
- surface: "data-[pressed]:bg-ds-background-neutral-hovered",
26
- "surface-raised": "data-[pressed]:bg-ds-background-neutral-hovered",
27
- "surface-overlay": "data-[pressed]:bg-ds-background-neutral-hovered",
28
- "surface-sunken": "data-[pressed]:bg-ds-background-neutral-pressed",
29
- neutral: "data-[pressed]:bg-ds-background-neutral-pressed",
30
- selected: "data-[pressed]:bg-ds-background-selected-pressed",
31
- "brand-subtle": "data-[pressed]:bg-ds-background-selected-hovered",
32
- };
33
- /**
34
- * Shared look for every Pressable: no native chrome, a 24px minimum hit
35
- * area, a 2px inner `ds-border-focused` border on keyboard focus only, and hover / pressed
36
- * feedback from tokens. A surface with a shadow lifts to the overlay shadow
37
- * on hover and settles back to the raised one while pressed (the interactive
38
- * Card rule); every Pressable also takes the hover / pressed fill of its ground.
39
- */
40
- export function pressableClasses(style) {
41
- const ground = style.background ?? "none";
42
- return cn(
43
- // A <button> sizes to its content even as a block; `w-full` makes it fill like the link form does.
44
- style.fullWidth === false ? "w-fit" : "w-full", "relative block min-h-6 min-w-6 cursor-pointer appearance-none text-start text-inherit [font:inherit] outline-hidden select-none", "transition-[background-color,box-shadow] duration-(--ds-duration-instant) ease-ds-standard",
45
- // Keyboard focus: a 2px inner border (no outer ring); pointer focus shows nothing.
46
- "data-[focus-visible]:inset-ring-2 data-[focus-visible]:inset-ring-ds-border-focused", style.shadow && "data-[hovered]:shadow-ds-overlay data-[pressed]:shadow-ds-raised", HOVER_FILL[ground], PRESSED_FILL[ground], "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50", boxClasses(style));
47
- }
48
- /**
49
- * Makes a custom surface clickable with React Aria's press handling: mouse,
50
- * touch, keyboard (Enter / Space) and screen readers, with consistent
51
- * hover, pressed and focus-visible states. With `href` it is a link that
52
- * goes through the host router (`DesignSystemProvider`); otherwise a button.
53
- *
54
- * Content is phrasing content only (a `<button>` or `<a>` may not hold block
55
- * elements): lay it out with `Stack` / `Inline` / `Box` `as="span"`.
56
- */
57
- export const Pressable = React.forwardRef(function Pressable({ padding, paddingInline, paddingBlock, background, radius, shadow, border, fullWidth = true, children, ...rest }, ref) {
58
- const className = pressableClasses({ padding, paddingInline, paddingBlock, background, radius, shadow, border, fullWidth });
59
- if (rest.href !== undefined) {
60
- return (_jsx(Link, { ...rest, ref: ref, "data-slot": "pressable", className: className, children: children }));
61
- }
62
- const { href: _href, ...buttonProps } = rest;
63
- return (_jsx(Button, { type: "button", ...buttonProps, ref: ref, "data-slot": "pressable", className: className, children: children }));
64
- });
65
- //# sourceMappingURL=pressable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pressable.js","sourceRoot":"","sources":["../../src/layout/pressable.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAqD,MAAM,uBAAuB,CAAC;AAExG,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAsB,MAAM,OAAO,CAAC;AAGvD;;;;;GAKG;AACH,MAAM,UAAU,GAAiD;IAC/D,IAAI,EAAE,sCAAsC;IAC5C,OAAO,EAAE,sCAAsC;IAC/C,gBAAgB,EAAE,sCAAsC;IACxD,iBAAiB,EAAE,sCAAsC;IACzD,gBAAgB,EAAE,iDAAiD;IACnE,OAAO,EAAE,iDAAiD;IAC1D,QAAQ,EAAE,kDAAkD;IAC5D,cAAc,EAAE,kDAAkD;CACnE,CAAC;AACF,MAAM,YAAY,GAAiD;IACjE,IAAI,EAAE,iDAAiD;IACvD,OAAO,EAAE,iDAAiD;IAC1D,gBAAgB,EAAE,iDAAiD;IAC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AAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,GAAG,IAAI,CAAC;IAC7C,OAAO,CACL,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,KAAK,WAAW,EAAE,GAAG,EAAE,GAAmC,eAAY,WAAW,EAAC,SAAS,EAAE,SAAS,YACxH,QAAQ,GACF,CACV,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Button, Link, type ButtonProps, type LinkProps, type PressEvent } from \"react-aria-components\";\n\nimport { cn } from \"../utils\";\nimport { boxClasses, type BoxStyleProps } from \"./box\";\nimport type { Background } from \"./tokens\";\n\n/**\n * Hover and pressed fills follow the ground the Pressable starts from, so a\n * selected or neutral surface keeps its meaning while it reacts. Status\n * grounds (information, success…) keep their fill; their feedback is the\n * shadow or the focus ring.\n */\nconst HOVER_FILL: Partial<Record<Background | \"none\", string>> = {\n none: \"data-[hovered]:bg-ds-surface-hovered\",\n surface: \"data-[hovered]:bg-ds-surface-hovered\",\n \"surface-raised\": \"data-[hovered]:bg-ds-surface-hovered\",\n \"surface-overlay\": \"data-[hovered]:bg-ds-surface-hovered\",\n \"surface-sunken\": \"data-[hovered]:bg-ds-background-neutral-hovered\",\n neutral: \"data-[hovered]:bg-ds-background-neutral-hovered\",\n selected: \"data-[hovered]:bg-ds-background-selected-hovered\",\n \"brand-subtle\": \"data-[hovered]:bg-ds-background-selected-hovered\",\n};\nconst PRESSED_FILL: Partial<Record<Background | \"none\", string>> = {\n none: \"data-[pressed]:bg-ds-background-neutral-hovered\",\n surface: \"data-[pressed]:bg-ds-background-neutral-hovered\",\n \"surface-raised\": \"data-[pressed]:bg-ds-background-neutral-hovered\",\n \"surface-overlay\": \"data-[pressed]:bg-ds-background-neutral-hovered\",\n \"surface-sunken\": \"data-[pressed]:bg-ds-background-neutral-pressed\",\n neutral: \"data-[pressed]:bg-ds-background-neutral-pressed\",\n selected: \"data-[pressed]:bg-ds-background-selected-pressed\",\n \"brand-subtle\": \"data-[pressed]:bg-ds-background-selected-hovered\",\n};\n\n/**\n * Shared look for every Pressable: no native chrome, a 24px minimum hit\n * area, a 2px inner `ds-border-focused` border on keyboard focus only, and hover / pressed\n * feedback from tokens. A surface with a shadow lifts to the overlay shadow\n * on hover and settles back to the raised one while pressed (the interactive\n * Card rule); every Pressable also takes the hover / pressed fill of its ground.\n */\nexport function pressableClasses(style: BoxStyleProps & { fullWidth?: boolean }) {\n const ground = style.background ?? \"none\";\n return cn(\n // A <button> sizes to its content even as a block; `w-full` makes it fill like the link form does.\n style.fullWidth === false ? \"w-fit\" : \"w-full\",\n \"relative block min-h-6 min-w-6 cursor-pointer appearance-none text-start text-inherit [font:inherit] outline-hidden select-none\",\n \"transition-[background-color,box-shadow] duration-(--ds-duration-instant) ease-ds-standard\",\n // Keyboard focus: a 2px inner border (no outer ring); pointer focus shows nothing.\n \"data-[focus-visible]:inset-ring-2 data-[focus-visible]:inset-ring-ds-border-focused\",\n style.shadow && \"data-[hovered]:shadow-ds-overlay data-[pressed]:shadow-ds-raised\",\n HOVER_FILL[ground],\n PRESSED_FILL[ground],\n \"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50\",\n boxClasses(style),\n );\n}\n\ntype PressableBase = BoxStyleProps & {\n /** As wide as its container (default `true`), as a button or a link; `false` hugs what it holds. */\n fullWidth?: boolean;\n children?: React.ReactNode;\n isDisabled?: boolean;\n /** Required when the content has no text that names the action. */\n \"aria-label\"?: string;\n id?: string;\n};\n\nexport type PressableProps = PressableBase &\n (\n | ({ href?: undefined; onPress?: (event: PressEvent) => void } & Pick<ButtonProps, \"type\" | \"form\" | \"aria-describedby\" | \"aria-pressed\" | \"aria-expanded\">)\n | ({ href: string; onPress?: (event: PressEvent) => void } & Pick<LinkProps, \"target\" | \"rel\" | \"routerOptions\" | \"aria-describedby\">)\n );\n\n/**\n * Makes a custom surface clickable with React Aria's press handling: mouse,\n * touch, keyboard (Enter / Space) and screen readers, with consistent\n * hover, pressed and focus-visible states. With `href` it is a link that\n * goes through the host router (`DesignSystemProvider`); otherwise a button.\n *\n * Content is phrasing content only (a `<button>` or `<a>` may not hold block\n * elements): lay it out with `Stack` / `Inline` / `Box` `as=\"span\"`.\n */\nexport const Pressable = React.forwardRef<HTMLButtonElement | HTMLAnchorElement, PressableProps>(function Pressable(\n { padding, paddingInline, paddingBlock, background, radius, shadow, border, fullWidth = true, children, ...rest },\n ref,\n) {\n const className = pressableClasses({ padding, paddingInline, paddingBlock, background, radius, shadow, border, fullWidth });\n if (rest.href !== undefined) {\n return (\n <Link {...rest} ref={ref as React.Ref<HTMLAnchorElement>} data-slot=\"pressable\" className={className}>\n {children}\n </Link>\n );\n }\n const { href: _href, ...buttonProps } = rest;\n return (\n <Button type=\"button\" {...buttonProps} ref={ref as React.Ref<HTMLButtonElement>} data-slot=\"pressable\" className={className}>\n {children}\n </Button>\n );\n});\n"]}
@@ -1,39 +0,0 @@
1
- import * as React from "react";
2
- export interface ResetSentLabels {
3
- title: React.ReactNode;
4
- /** Enumeration-safe body, e.g. "If an account exists we've sent a reset link." */
5
- description: React.ReactNode;
6
- resend: React.ReactNode;
7
- /** Resend-button label during the cooldown, e.g. `(s) => `Resend in ${s}s``. */
8
- resendIn?: (seconds: number) => React.ReactNode;
9
- /** Shown when a resend fails (the button is usable again at once), e.g. "Couldn't resend. Try again." */
10
- resendFailed?: React.ReactNode;
11
- }
12
- export interface ResetSentCardProps {
13
- labels: ResetSentLabels;
14
- /** Sends the link again. A rejected promise (or a throw) starts no wait and shows `labels.resendFailed`. */
15
- onResend: () => void | Promise<void>;
16
- /** Seconds to disable "Resend" for after each successful send. Default 60. */
17
- cooldownSeconds?: number;
18
- /**
19
- * The wait already running when the card appears. Default `cooldownSeconds`: the link was just sent. Pass 0 when the
20
- * card shows long after the send, or the server's "retry after"; a new value restarts the wait.
21
- */
22
- initialCooldown?: number;
23
- resending?: boolean;
24
- /** Optional icon in place of the default check. */
25
- icon?: React.ReactNode;
26
- /** "Back to sign in" affordance under the actions. */
27
- backSlot?: React.ReactNode;
28
- className?: string;
29
- /** The title's heading level: 1 by default, or 2 when the page has its own h1. */
30
- headingLevel?: 1 | 2 | 3;
31
- }
32
- /**
33
- * "Check your inbox" confirmation shown after a reset link is requested
34
- * (the auth pattern). The message is deliberately
35
- * enumeration-safe, and "Resend" is rate-limited by a local cooldown so it
36
- * can't be hammered: one send at a time, and a wait after each one that succeeds. The button shows the pending
37
- * state while the send runs (or while `resending`).
38
- */
39
- export declare function ResetSentCard({ labels, onResend, cooldownSeconds, initialCooldown, resending, icon, backSlot, className, headingLevel, }: ResetSentCardProps): React.JSX.Element;
@@ -1,22 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import * as React from "react";
4
- import { Button } from "../action/button.js";
5
- import { IconGlyph } from "../display/icon.js";
6
- import { useCooldownAction } from "../feedback/cooldown.js";
7
- import { cn } from "../utils.js";
8
- import { TitleTag } from "./auth-form-layout.js";
9
- /**
10
- * "Check your inbox" confirmation shown after a reset link is requested
11
- * (the auth pattern). The message is deliberately
12
- * enumeration-safe, and "Resend" is rate-limited by a local cooldown so it
13
- * can't be hammered: one send at a time, and a wait after each one that succeeds. The button shows the pending
14
- * state while the send runs (or while `resending`).
15
- */
16
- export function ResetSentCard({ labels, onResend, cooldownSeconds = 60, initialCooldown, resending = false, icon, backSlot, className, headingLevel = 1, }) {
17
- const resend = useCooldownAction(onResend, cooldownSeconds, initialCooldown ?? cooldownSeconds);
18
- const cooling = resend.remaining > 0;
19
- const pending = resending || resend.isPending;
20
- return (_jsxs("div", { "data-slot": "auth-card", className: cn("w-full max-w-sm", className), children: [_jsx("div", { "data-slot": "reset-sent-icon", className: "flex size-11 items-center justify-center rounded-ds-full bg-ds-background-success text-ds-text-success", children: icon ?? _jsx(IconGlyph, { name: "circle-check", size: "large" }) }), _jsxs("div", { className: "mt-ds-300 space-y-1.5", children: [_jsx(TitleTag, { level: headingLevel, className: "text-heading-large text-ds-text", children: labels.title }), _jsx("p", { className: "text-body text-ds-text-subtle", children: labels.description })] }), _jsxs("div", { className: "mt-8 grid gap-ds-200", children: [_jsx(Button, { size: "large", isDisabled: cooling && !pending, isPending: pending, onPress: () => void resend.run(), children: !pending && cooling && labels.resendIn ? labels.resendIn(resend.remaining) : labels.resend }), resend.failed && labels.resendFailed && (_jsx("p", { role: "alert", className: "text-center text-body text-ds-text-danger", children: labels.resendFailed })), backSlot && _jsx("div", { className: "flex justify-center", children: backSlot })] })] }));
21
- }
22
- //# sourceMappingURL=reset-sent-card.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reset-sent-card.js","sourceRoot":"","sources":["../../src/layout/reset-sent-card.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAkC9C;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,MAAM,EACN,QAAQ,EACR,eAAe,GAAG,EAAE,EACpB,eAAe,EACf,SAAS,GAAG,KAAK,EACjB,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,YAAY,GAAG,CAAC,GACG;IACnB,MAAM,MAAM,GAAG,iBAAiB,CAAC,QAAQ,EAAE,eAAe,EAAE,eAAe,IAAI,eAAe,CAAC,CAAC;IAChG,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC;IAE9C,OAAO,CACL,4BAAe,WAAW,EAAC,SAAS,EAAE,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC,aACpE,2BACY,iBAAiB,EAC3B,SAAS,EAAC,wGAAwG,YAEjH,IAAI,IAAI,KAAC,SAAS,IAAC,IAAI,EAAC,cAAc,EAAC,IAAI,EAAC,OAAO,GAAG,GACnD,EAEN,eAAK,SAAS,EAAC,uBAAuB,aACpC,KAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,EAAE,SAAS,EAAC,iCAAiC,YAAE,MAAM,CAAC,KAAK,GAAY,EACpG,YAAG,SAAS,EAAC,+BAA+B,YAAE,MAAM,CAAC,WAAW,GAAK,IACjE,EAGN,eAAK,SAAS,EAAC,sBAAsB,aACnC,KAAC,MAAM,IACL,IAAI,EAAC,OAAO,EACZ,UAAU,EAAE,OAAO,IAAI,CAAC,OAAO,EAC/B,SAAS,EAAE,OAAO,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC,GAAG,EAAE,YAE/B,CAAC,OAAO,IAAI,OAAO,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,GACpF,EAER,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,YAAY,IAAI,CACvC,YAAG,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,2CAA2C,YAClE,MAAM,CAAC,YAAY,GAClB,CACL,EAEA,QAAQ,IAAI,cAAK,SAAS,EAAC,qBAAqB,YAAE,QAAQ,GAAO,IAC9D,IACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { Button } from \"../action/button\";\nimport { IconGlyph } from \"../display/icon\";\nimport { useCooldownAction } from \"../feedback/cooldown\";\nimport { cn } from \"../utils\";\nimport { TitleTag } from \"./auth-form-layout\";\n\nexport interface ResetSentLabels {\n title: React.ReactNode;\n /** Enumeration-safe body, e.g. \"If an account exists we've sent a reset link.\" */\n description: React.ReactNode;\n resend: React.ReactNode;\n /** Resend-button label during the cooldown, e.g. `(s) => `Resend in ${s}s``. */\n resendIn?: (seconds: number) => React.ReactNode;\n /** Shown when a resend fails (the button is usable again at once), e.g. \"Couldn't resend. Try again.\" */\n resendFailed?: React.ReactNode;\n}\n\nexport interface ResetSentCardProps {\n labels: ResetSentLabels;\n /** Sends the link again. A rejected promise (or a throw) starts no wait and shows `labels.resendFailed`. */\n onResend: () => void | Promise<void>;\n /** Seconds to disable \"Resend\" for after each successful send. Default 60. */\n cooldownSeconds?: number;\n /**\n * The wait already running when the card appears. Default `cooldownSeconds`: the link was just sent. Pass 0 when the\n * card shows long after the send, or the server's \"retry after\"; a new value restarts the wait.\n */\n initialCooldown?: number;\n resending?: boolean;\n /** Optional icon in place of the default check. */\n icon?: React.ReactNode;\n /** \"Back to sign in\" affordance under the actions. */\n backSlot?: React.ReactNode;\n className?: string;\n /** The title's heading level: 1 by default, or 2 when the page has its own h1. */\n headingLevel?: 1 | 2 | 3;\n}\n\n/**\n * \"Check your inbox\" confirmation shown after a reset link is requested\n * (the auth pattern). The message is deliberately\n * enumeration-safe, and \"Resend\" is rate-limited by a local cooldown so it\n * can't be hammered: one send at a time, and a wait after each one that succeeds. The button shows the pending\n * state while the send runs (or while `resending`).\n */\nexport function ResetSentCard({\n labels,\n onResend,\n cooldownSeconds = 60,\n initialCooldown,\n resending = false,\n icon,\n backSlot,\n className,\n headingLevel = 1,\n}: ResetSentCardProps) {\n const resend = useCooldownAction(onResend, cooldownSeconds, initialCooldown ?? cooldownSeconds);\n const cooling = resend.remaining > 0;\n const pending = resending || resend.isPending;\n\n return (\n <div data-slot=\"auth-card\" className={cn(\"w-full max-w-sm\", className)}>\n <div\n data-slot=\"reset-sent-icon\"\n className=\"flex size-11 items-center justify-center rounded-ds-full bg-ds-background-success text-ds-text-success\"\n >\n {icon ?? <IconGlyph name=\"circle-check\" size=\"large\" />}\n </div>\n\n <div className=\"mt-ds-300 space-y-1.5\">\n <TitleTag level={headingLevel} className=\"text-heading-large text-ds-text\">{labels.title}</TitleTag>\n <p className=\"text-body text-ds-text-subtle\">{labels.description}</p>\n </div>\n\n {/* A grid stretches the button to the full width, as the old `w-full` did. */}\n <div className=\"mt-8 grid gap-ds-200\">\n <Button\n size=\"large\"\n isDisabled={cooling && !pending}\n isPending={pending}\n onPress={() => void resend.run()}\n >\n {!pending && cooling && labels.resendIn ? labels.resendIn(resend.remaining) : labels.resend}\n </Button>\n\n {resend.failed && labels.resendFailed && (\n <p role=\"alert\" className=\"text-center text-body text-ds-text-danger\">\n {labels.resendFailed}\n </p>\n )}\n\n {backSlot && <div className=\"flex justify-center\">{backSlot}</div>}\n </div>\n </div>\n );\n}\n"]}
@@ -1,27 +0,0 @@
1
- import * as React from "react";
2
- import { type BadgeTone } from "../display/badge.js";
3
- import { type IconName } from "../display/icon.js";
4
- export type DockItem = {
5
- key: string;
6
- /** Always shown under the icon ("Orders"); the last item is "More" when the app has more. */
7
- label: string;
8
- icon: IconName;
9
- href: string;
10
- badge?: {
11
- value: number;
12
- tone?: BadgeTone;
13
- };
14
- };
15
- export type DockProps = {
16
- /** Four or five top destinations. */
17
- items: readonly DockItem[];
18
- currentKey?: string;
19
- /** Names the navigation landmark; "Main menu" by default. */
20
- "aria-label"?: string;
21
- };
22
- /**
23
- * The bottom tab bar on phones: four or five destinations, icon over label, padded for the home
24
- * indicator. Hidden from 768px up and while the on-screen keyboard is open; leave it out of
25
- * full-screen flows (checkout).
26
- */
27
- export declare function Dock({ items, currentKey, "aria-label": label }: DockProps): React.JSX.Element;