@fanvue/ui 3.40.1 → 3.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Checkbox/Checkbox.cjs +6 -6
- package/dist/cjs/components/Checkbox/Checkbox.cjs.map +1 -1
- package/dist/cjs/components/Dialog/Dialog.cjs +63 -55
- package/dist/cjs/components/Dialog/Dialog.cjs.map +1 -1
- package/dist/cjs/components/Icons/CommentIcon.cjs +74 -0
- package/dist/cjs/components/Icons/CommentIcon.cjs.map +1 -0
- package/dist/cjs/components/Tabs/Tabs.cjs +26 -1
- package/dist/cjs/components/Tabs/Tabs.cjs.map +1 -1
- package/dist/cjs/components/Tabs/TabsList.cjs +163 -22
- package/dist/cjs/components/Tabs/TabsList.cjs.map +1 -1
- package/dist/cjs/components/Tabs/TabsOverflow.cjs +123 -0
- package/dist/cjs/components/Tabs/TabsOverflow.cjs.map +1 -0
- package/dist/cjs/components/Tabs/TabsTrigger.cjs +27 -14
- package/dist/cjs/components/Tabs/TabsTrigger.cjs.map +1 -1
- package/dist/cjs/index.cjs +5 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.mjs +6 -6
- package/dist/components/Checkbox/Checkbox.mjs.map +1 -1
- package/dist/components/Dialog/Dialog.mjs +63 -55
- package/dist/components/Dialog/Dialog.mjs.map +1 -1
- package/dist/components/Icons/CommentIcon.mjs +57 -0
- package/dist/components/Icons/CommentIcon.mjs.map +1 -0
- package/dist/components/Tabs/Tabs.mjs +26 -2
- package/dist/components/Tabs/Tabs.mjs.map +1 -1
- package/dist/components/Tabs/TabsList.mjs +164 -23
- package/dist/components/Tabs/TabsList.mjs.map +1 -1
- package/dist/components/Tabs/TabsOverflow.mjs +106 -0
- package/dist/components/Tabs/TabsOverflow.mjs.map +1 -0
- package/dist/components/Tabs/TabsTrigger.mjs +27 -14
- package/dist/components/Tabs/TabsTrigger.mjs.map +1 -1
- package/dist/index.d.ts +103 -19
- package/dist/index.mjs +5 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -80,13 +80,13 @@ const Checkbox = React.forwardRef(
|
|
|
80
80
|
"data-[state=checked]:border-content-primary data-[state=checked]:bg-content-primary data-[state=checked]:text-content-primary-inverted",
|
|
81
81
|
// Indeterminate state
|
|
82
82
|
"data-[state=indeterminate]:border-content-primary data-[state=indeterminate]:bg-content-primary data-[state=indeterminate]:text-content-primary-inverted",
|
|
83
|
-
// Hover & active state
|
|
84
|
-
"hover:ring-2 hover:ring-brand-primary-default group-hover:ring-2 group-hover:ring-brand-primary-default",
|
|
85
|
-
"not-disabled:active:ring-2 not-disabled:active:ring-brand-primary-default",
|
|
86
|
-
// Focus state
|
|
87
|
-
"focus-visible:shadow-focus-ring focus-visible:outline-none",
|
|
83
|
+
// Hover & active state (inset, like the focus ring, so overflow containers can't clip it)
|
|
84
|
+
"hover:inset-ring-2 hover:inset-ring-brand-primary-default group-hover:inset-ring-2 group-hover:inset-ring-brand-primary-default",
|
|
85
|
+
"not-disabled:active:inset-ring-2 not-disabled:active:inset-ring-brand-primary-default",
|
|
86
|
+
// Focus state (drops the hover ring, which would otherwise paint over the focus ring)
|
|
87
|
+
"focus-visible:inset-ring-0 focus-visible:shadow-focus-ring focus-visible:outline-none",
|
|
88
88
|
// Disabled state
|
|
89
|
-
"disabled:cursor-not-allowed disabled:border-neutral-alphas-600 disabled:
|
|
89
|
+
"disabled:inset-ring-0 disabled:cursor-not-allowed disabled:border-neutral-alphas-600 disabled:group-hover:inset-ring-0",
|
|
90
90
|
"disabled:data-[state=checked]:border-neutral-alphas-600 disabled:data-[state=checked]:bg-neutral-alphas-600 disabled:data-[state=checked]:text-content-tertiary",
|
|
91
91
|
!hasLabel && className
|
|
92
92
|
),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.mjs","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as CheckboxPrimitive from \"@radix-ui/react-checkbox\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { CheckIcon } from \"../Icons/CheckIcon\";\nimport { MinusIcon } from \"../Icons/MinusIcon\";\n\n/**\n * Size variant for the checkbox.\n *\n * - `\"20\"` (default) — 20px box, body-lg label.\n * - `\"16\"` — 16px box, body-md label, used in compact contexts like data tables.\n * - `\"default\"` and `\"small\"` are legacy aliases retained for back-compat\n * (`\"default\"` → `\"20\"`, `\"small\"` → `\"20\"` with smaller label typography).\n */\nexport type CheckboxSize =\n | \"20\"\n | \"16\"\n /** @deprecated Use `\"20\"` instead. */\n | \"default\"\n /** @deprecated Use `\"20\"` (the smaller-typography variant remains via `\"small\"`). */\n | \"small\";\n\nconst BOX_SIZE_CLASS: Record<\"20\" | \"16\", string> = {\n \"20\": \"size-5\",\n \"16\": \"size-4\",\n};\n\nconst INDICATOR_SIZE_CLASS: Record<\"20\" | \"16\", string> = {\n \"20\": \"size-3\",\n \"16\": \"size-2.5\",\n};\n\nexport interface CheckboxProps\n extends Omit<React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>, \"asChild\"> {\n /** Size variant. @default \"20\" */\n size?: CheckboxSize;\n /** Label text displayed next to the checkbox. */\n label?: string;\n /** Descriptive text displayed below the label. */\n helperText?: string;\n}\n\n/**\n * A checkbox input with optional label and helper text. Supports checked,\n * unchecked, and indeterminate states.\n *\n * The ref type is intentionally `HTMLInputElement` (not `HTMLButtonElement`) for\n * form-library compatibility — libraries like react-hook-form call `register()`\n * which expects an `HTMLInputElement` ref. A hidden `<input>` is synced to the\n * Radix checkbox state via `useImperativeHandle`.\n *\n * @example\n * ```tsx\n * <Checkbox label=\"Accept terms\" helperText=\"Required to continue\" />\n * ```\n */\nexport const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(\n ({ className, size = \"20\", label, helperText, disabled, name, ...props }, ref) => {\n const id = React.useId();\n const helperTextId = helperText ? `${id}-helper` : undefined;\n const hasLabel = Boolean(label || helperText);\n const boxSize: \"20\" | \"16\" = size === \"16\" ? \"16\" : \"20\";\n const useSmallLabelTypography = size === \"small\";\n\n if (\n process.env.NODE_ENV !== \"production\" &&\n !label &&\n !props[\"aria-label\"] &&\n !props[\"aria-labelledby\"]\n ) {\n console.warn(\n \"Checkbox: No accessible name provided. Add a `label`, `aria-label`, or `aria-labelledby` prop so screen readers can announce this checkbox.\",\n );\n }\n\n // Hidden input for form library compatibility (e.g. react-hook-form register)\n const inputRef = React.useRef<HTMLInputElement>(null);\n React.useImperativeHandle(ref, () => inputRef.current as HTMLInputElement);\n\n const handleCheckedChange = (value: boolean | \"indeterminate\") => {\n const checked = value === true;\n if (inputRef.current) {\n inputRef.current.checked = checked;\n inputRef.current.dispatchEvent(new Event(\"change\", { bubbles: true }));\n }\n props.onCheckedChange?.(value);\n };\n\n const checkboxElement = (\n <span\n className={cn(\n \"relative inline-flex shrink-0\",\n BOX_SIZE_CLASS[boxSize],\n // Alignment when used with label\n label && (helperText ? \"mt-1\" : \"mt-0.5\"),\n )}\n >\n <input\n ref={inputRef}\n type=\"checkbox\"\n name={name}\n disabled={disabled}\n aria-hidden\n tabIndex={-1}\n onChange={() => {}}\n className=\"pointer-events-none absolute size-px overflow-hidden opacity-0\"\n style={{ clip: \"rect(0,0,0,0)\" }}\n />\n <CheckboxPrimitive.Root\n id={id}\n disabled={disabled}\n aria-describedby={helperTextId}\n data-testid=\"checkbox\"\n {...props}\n onCheckedChange={handleCheckedChange}\n className={cn(\n // Base styles\n \"flex items-center justify-center rounded-2xs border\",\n BOX_SIZE_CLASS[boxSize],\n \"transition-[border-color,background-color,color,box-shadow] duration-150\",\n // Default state\n \"border-content-primary bg-transparent text-transparent\",\n // Checked state\n \"data-[state=checked]:border-content-primary data-[state=checked]:bg-content-primary data-[state=checked]:text-content-primary-inverted\",\n // Indeterminate state\n \"data-[state=indeterminate]:border-content-primary data-[state=indeterminate]:bg-content-primary data-[state=indeterminate]:text-content-primary-inverted\",\n // Hover & active state\n \"hover:ring-2 hover:ring-brand-primary-default group-hover:ring-2 group-hover:ring-brand-primary-default\",\n \"not-disabled:active:ring-2 not-disabled:active:ring-brand-primary-default\",\n // Focus state\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n // Disabled state\n \"disabled:cursor-not-allowed disabled:border-neutral-alphas-600 disabled:ring-0 disabled:group-hover:ring-0\",\n \"disabled:data-[state=checked]:border-neutral-alphas-600 disabled:data-[state=checked]:bg-neutral-alphas-600 disabled:data-[state=checked]:text-content-tertiary\",\n !hasLabel && className,\n )}\n >\n <CheckboxPrimitive.Indicator\n forceMount\n className={cn(\n \"flex items-center justify-center text-content-primary-inverted\",\n INDICATOR_SIZE_CLASS[boxSize],\n \"data-[state=unchecked]:invisible\",\n )}\n >\n {props.checked === \"indeterminate\" ? <MinusIcon /> : <CheckIcon />}\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n </span>\n );\n\n if (!hasLabel) {\n return checkboxElement;\n }\n\n return (\n <div\n className={cn(\n \"inline-flex flex-col gap-0.5\",\n disabled && \"is-disabled cursor-not-allowed\",\n className,\n )}\n >\n <div className=\"group inline-flex items-start gap-2\">\n {checkboxElement}\n {label && (\n <label\n htmlFor={id}\n className={cn(\n \"cursor-pointer select-none text-content-primary\",\n \"group-has-disabled:cursor-not-allowed group-has-disabled:text-content-tertiary\",\n useSmallLabelTypography\n ? \"typography-body-small-14px-semibold\"\n : \"typography-body-default-16px-semibold\",\n )}\n >\n {label}\n </label>\n )}\n </div>\n {helperText && (\n <span\n id={helperTextId}\n className={cn(\n \"ml-7 text-content-secondary\",\n \"in-[.is-disabled]:cursor-not-allowed in-[.is-disabled]:text-content-tertiary\",\n useSmallLabelTypography\n ? \"typography-description-12px-regular\"\n : \"typography-body-small-14px-regular\",\n )}\n >\n {helperText}\n </span>\n )}\n </div>\n );\n },\n);\n\nCheckbox.displayName = \"Checkbox\";\n"],"names":[],"mappings":";;;;;;;AAsBA,MAAM,iBAA8C;AAAA,EAClD,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,uBAAoD;AAAA,EACxD,MAAM;AAAA,EACN,MAAM;AACR;AA0BO,MAAM,WAAW,MAAM;AAAA,EAC5B,CAAC,EAAE,WAAW,OAAO,MAAM,OAAO,YAAY,UAAU,MAAM,GAAG,MAAA,GAAS,QAAQ;AAChF,UAAM,KAAK,MAAM,MAAA;AACjB,UAAM,eAAe,aAAa,GAAG,EAAE,YAA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AA;AAAA,gBAEA;AAAA;AAAA,gBAEA;AAAA,gBACA;AAAA;AAAA,gBAEA;AAAA;AAAA,gBAEA;AAAA,gBACA;AAAA,gBACA,CAAC,YAAY;AAAA,cAAA;AAAA,cAGf,UAAA;AAAA,gBAAC,kBAAkB;AAAA,gBAAlB;AAAA,kBACC,YAAU;AAAA,kBACV,WAAW;AAAA,oBACT;AAAA,oBACA,qBAAqB,OAAO;AAAA,oBAC5B;AAAA,kBAAA;AAAA,kBAGD,gBAAM,YAAY,sCAAmB,WAAA,EAAU,wBAAM,WAAA,CAAA,CAAU;AAAA,gBAAA;AAAA,cAAA;AAAA,YAClE;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IAAA;AAIJ,QAAI,CAAC,UAAU;AACb,aAAO;AAAA,IACT;AAEA,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW;AAAA,UACT;AAAA,UACA,YAAY;AAAA,UACZ;AAAA,QAAA;AAAA,QAGF,UAAA;AAAA,UAAA,qBAAC,OAAA,EAAI,WAAU,uCACZ,UAAA;AAAA,YAAA;AAAA,YACA,SACC;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,SAAS;AAAA,gBACT,WAAW;AAAA,kBACT;AAAA,kBACA;AAAA,kBACA,0BACI,wCACA;AAAA,gBAAA;AAAA,gBAGL,UAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UACH,GAEJ;AAAA,UACC,cACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,IAAI;AAAA,cACJ,WAAW;AAAA,gBACT;AAAA,gBACA;AAAA,gBACA,0BACI,wCACA;AAAA,cAAA;AAAA,cAGL,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,SAAS,cAAc;"}
|
|
1
|
+
{"version":3,"file":"Checkbox.mjs","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as CheckboxPrimitive from \"@radix-ui/react-checkbox\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { CheckIcon } from \"../Icons/CheckIcon\";\nimport { MinusIcon } from \"../Icons/MinusIcon\";\n\n/**\n * Size variant for the checkbox.\n *\n * - `\"20\"` (default) — 20px box, body-lg label.\n * - `\"16\"` — 16px box, body-md label, used in compact contexts like data tables.\n * - `\"default\"` and `\"small\"` are legacy aliases retained for back-compat\n * (`\"default\"` → `\"20\"`, `\"small\"` → `\"20\"` with smaller label typography).\n */\nexport type CheckboxSize =\n | \"20\"\n | \"16\"\n /** @deprecated Use `\"20\"` instead. */\n | \"default\"\n /** @deprecated Use `\"20\"` (the smaller-typography variant remains via `\"small\"`). */\n | \"small\";\n\nconst BOX_SIZE_CLASS: Record<\"20\" | \"16\", string> = {\n \"20\": \"size-5\",\n \"16\": \"size-4\",\n};\n\nconst INDICATOR_SIZE_CLASS: Record<\"20\" | \"16\", string> = {\n \"20\": \"size-3\",\n \"16\": \"size-2.5\",\n};\n\nexport interface CheckboxProps\n extends Omit<React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>, \"asChild\"> {\n /** Size variant. @default \"20\" */\n size?: CheckboxSize;\n /** Label text displayed next to the checkbox. */\n label?: string;\n /** Descriptive text displayed below the label. */\n helperText?: string;\n}\n\n/**\n * A checkbox input with optional label and helper text. Supports checked,\n * unchecked, and indeterminate states.\n *\n * The ref type is intentionally `HTMLInputElement` (not `HTMLButtonElement`) for\n * form-library compatibility — libraries like react-hook-form call `register()`\n * which expects an `HTMLInputElement` ref. A hidden `<input>` is synced to the\n * Radix checkbox state via `useImperativeHandle`.\n *\n * @example\n * ```tsx\n * <Checkbox label=\"Accept terms\" helperText=\"Required to continue\" />\n * ```\n */\nexport const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(\n ({ className, size = \"20\", label, helperText, disabled, name, ...props }, ref) => {\n const id = React.useId();\n const helperTextId = helperText ? `${id}-helper` : undefined;\n const hasLabel = Boolean(label || helperText);\n const boxSize: \"20\" | \"16\" = size === \"16\" ? \"16\" : \"20\";\n const useSmallLabelTypography = size === \"small\";\n\n if (\n process.env.NODE_ENV !== \"production\" &&\n !label &&\n !props[\"aria-label\"] &&\n !props[\"aria-labelledby\"]\n ) {\n console.warn(\n \"Checkbox: No accessible name provided. Add a `label`, `aria-label`, or `aria-labelledby` prop so screen readers can announce this checkbox.\",\n );\n }\n\n // Hidden input for form library compatibility (e.g. react-hook-form register)\n const inputRef = React.useRef<HTMLInputElement>(null);\n React.useImperativeHandle(ref, () => inputRef.current as HTMLInputElement);\n\n const handleCheckedChange = (value: boolean | \"indeterminate\") => {\n const checked = value === true;\n if (inputRef.current) {\n inputRef.current.checked = checked;\n inputRef.current.dispatchEvent(new Event(\"change\", { bubbles: true }));\n }\n props.onCheckedChange?.(value);\n };\n\n const checkboxElement = (\n <span\n className={cn(\n \"relative inline-flex shrink-0\",\n BOX_SIZE_CLASS[boxSize],\n // Alignment when used with label\n label && (helperText ? \"mt-1\" : \"mt-0.5\"),\n )}\n >\n <input\n ref={inputRef}\n type=\"checkbox\"\n name={name}\n disabled={disabled}\n aria-hidden\n tabIndex={-1}\n onChange={() => {}}\n className=\"pointer-events-none absolute size-px overflow-hidden opacity-0\"\n style={{ clip: \"rect(0,0,0,0)\" }}\n />\n <CheckboxPrimitive.Root\n id={id}\n disabled={disabled}\n aria-describedby={helperTextId}\n data-testid=\"checkbox\"\n {...props}\n onCheckedChange={handleCheckedChange}\n className={cn(\n // Base styles\n \"flex items-center justify-center rounded-2xs border\",\n BOX_SIZE_CLASS[boxSize],\n \"transition-[border-color,background-color,color,box-shadow] duration-150\",\n // Default state\n \"border-content-primary bg-transparent text-transparent\",\n // Checked state\n \"data-[state=checked]:border-content-primary data-[state=checked]:bg-content-primary data-[state=checked]:text-content-primary-inverted\",\n // Indeterminate state\n \"data-[state=indeterminate]:border-content-primary data-[state=indeterminate]:bg-content-primary data-[state=indeterminate]:text-content-primary-inverted\",\n // Hover & active state (inset, like the focus ring, so overflow containers can't clip it)\n \"hover:inset-ring-2 hover:inset-ring-brand-primary-default group-hover:inset-ring-2 group-hover:inset-ring-brand-primary-default\",\n \"not-disabled:active:inset-ring-2 not-disabled:active:inset-ring-brand-primary-default\",\n // Focus state (drops the hover ring, which would otherwise paint over the focus ring)\n \"focus-visible:inset-ring-0 focus-visible:shadow-focus-ring focus-visible:outline-none\",\n // Disabled state\n \"disabled:inset-ring-0 disabled:cursor-not-allowed disabled:border-neutral-alphas-600 disabled:group-hover:inset-ring-0\",\n \"disabled:data-[state=checked]:border-neutral-alphas-600 disabled:data-[state=checked]:bg-neutral-alphas-600 disabled:data-[state=checked]:text-content-tertiary\",\n !hasLabel && className,\n )}\n >\n <CheckboxPrimitive.Indicator\n forceMount\n className={cn(\n \"flex items-center justify-center text-content-primary-inverted\",\n INDICATOR_SIZE_CLASS[boxSize],\n \"data-[state=unchecked]:invisible\",\n )}\n >\n {props.checked === \"indeterminate\" ? <MinusIcon /> : <CheckIcon />}\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n </span>\n );\n\n if (!hasLabel) {\n return checkboxElement;\n }\n\n return (\n <div\n className={cn(\n \"inline-flex flex-col gap-0.5\",\n disabled && \"is-disabled cursor-not-allowed\",\n className,\n )}\n >\n <div className=\"group inline-flex items-start gap-2\">\n {checkboxElement}\n {label && (\n <label\n htmlFor={id}\n className={cn(\n \"cursor-pointer select-none text-content-primary\",\n \"group-has-disabled:cursor-not-allowed group-has-disabled:text-content-tertiary\",\n useSmallLabelTypography\n ? \"typography-body-small-14px-semibold\"\n : \"typography-body-default-16px-semibold\",\n )}\n >\n {label}\n </label>\n )}\n </div>\n {helperText && (\n <span\n id={helperTextId}\n className={cn(\n \"ml-7 text-content-secondary\",\n \"in-[.is-disabled]:cursor-not-allowed in-[.is-disabled]:text-content-tertiary\",\n useSmallLabelTypography\n ? \"typography-description-12px-regular\"\n : \"typography-body-small-14px-regular\",\n )}\n >\n {helperText}\n </span>\n )}\n </div>\n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AA,UACH,GAEJ;AAAA,UACC,cACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,IAAI;AAAA,cACJ,WAAW;AAAA,gBACT;AAAA,gBACA;AAAA,gBACA,0BACI,wCACA;AAAA,cAAA;AAAA,cAGL,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,SAAS,cAAc;"}
|
|
@@ -53,64 +53,72 @@ const DialogContent = React.forwardRef(
|
|
|
53
53
|
},
|
|
54
54
|
props
|
|
55
55
|
);
|
|
56
|
-
const content = /* @__PURE__ */ jsxs(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
56
|
+
const content = /* @__PURE__ */ jsxs(
|
|
57
|
+
DialogPrimitive.Content,
|
|
58
|
+
{
|
|
59
|
+
ref,
|
|
60
|
+
style: { zIndex: "var(--fanvue-ui-portal-z-index, 50)", ...style },
|
|
61
|
+
onOpenAutoFocus: (e) => {
|
|
62
|
+
if (onOpenAutoFocus) {
|
|
63
|
+
onOpenAutoFocus(e);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
e.currentTarget.focus();
|
|
68
|
+
},
|
|
69
|
+
className: cn(
|
|
70
|
+
"fixed flex flex-col overflow-hidden border border-modal-stroke bg-modal-background shadow-blur-menu backdrop-blur-[4px] focus:outline-none",
|
|
71
|
+
"data-[state=open]:fade-in-0 data-[state=open]:animate-in",
|
|
72
|
+
"data-[state=closed]:fade-out-0 data-[state=closed]:animate-out",
|
|
73
|
+
"data-[state=closed]:pointer-events-none!",
|
|
74
|
+
mobilePresentation === "card" ? (
|
|
75
|
+
// Floating confirmation card (v2-modal): 16px side margins, vertically centered, 32px radius
|
|
76
|
+
cn(
|
|
77
|
+
"dialog-max-h-dynamic inset-x-4 top-1/2 -translate-y-1/2 rounded-xl p-6",
|
|
78
|
+
"data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95",
|
|
79
|
+
"sm:inset-x-auto"
|
|
80
|
+
)
|
|
81
|
+
) : (
|
|
82
|
+
// Bottom sheet pinned to the viewport bottom edge
|
|
83
|
+
cn(
|
|
84
|
+
"dialog-max-h-dynamic inset-x-0 bottom-0 w-full rounded-t-xl p-4 pt-3",
|
|
85
|
+
"pb-[calc(1rem+env(safe-area-inset-bottom,0px))]",
|
|
86
|
+
"data-[state=open]:slide-in-from-bottom-full",
|
|
87
|
+
"data-[state=closed]:slide-out-to-bottom-full",
|
|
88
|
+
"sm:data-[state=open]:slide-in-from-bottom-0 sm:data-[state=open]:zoom-in-95",
|
|
89
|
+
"sm:data-[state=closed]:slide-out-to-bottom-0 sm:data-[state=closed]:zoom-out-95"
|
|
90
|
+
)
|
|
91
|
+
),
|
|
92
|
+
"sm:dialog-max-h-dynamic sm:inset-auto sm:top-1/2 sm:left-1/2 sm:w-full sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-lg sm:p-6",
|
|
93
|
+
"duration-200",
|
|
94
|
+
SIZE_CLASSES[size],
|
|
95
|
+
className
|
|
96
|
+
),
|
|
97
|
+
...contentProps,
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ jsx(DialogPrimitive.Close, { ref: closeRef, hidden: true, tabIndex: -1, "aria-hidden": "true" }),
|
|
100
|
+
showMobileHandle && mobilePresentation === "sheet" && /* @__PURE__ */ jsx(
|
|
101
|
+
"div",
|
|
102
|
+
{
|
|
103
|
+
"aria-hidden": "true",
|
|
104
|
+
className: "mb-3 h-1 w-8 shrink-0 self-center rounded-full bg-icons-tertiary sm:hidden"
|
|
67
105
|
}
|
|
68
|
-
e.preventDefault();
|
|
69
|
-
e.currentTarget.focus();
|
|
70
|
-
},
|
|
71
|
-
className: cn(
|
|
72
|
-
"fixed flex flex-col overflow-hidden border border-modal-stroke bg-modal-background shadow-blur-menu backdrop-blur-[4px] focus:outline-none",
|
|
73
|
-
"data-[state=open]:fade-in-0 data-[state=open]:animate-in",
|
|
74
|
-
"data-[state=closed]:fade-out-0 data-[state=closed]:animate-out",
|
|
75
|
-
mobilePresentation === "card" ? (
|
|
76
|
-
// Floating confirmation card (v2-modal): 16px side margins, vertically centered, 32px radius
|
|
77
|
-
cn(
|
|
78
|
-
"dialog-max-h-dynamic inset-x-4 top-1/2 -translate-y-1/2 rounded-xl p-6",
|
|
79
|
-
"data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95",
|
|
80
|
-
"sm:inset-x-auto"
|
|
81
|
-
)
|
|
82
|
-
) : (
|
|
83
|
-
// Bottom sheet pinned to the viewport bottom edge
|
|
84
|
-
cn(
|
|
85
|
-
"dialog-max-h-dynamic inset-x-0 bottom-0 w-full rounded-t-xl p-4 pt-3",
|
|
86
|
-
"pb-[calc(1rem+env(safe-area-inset-bottom,0px))]",
|
|
87
|
-
"data-[state=open]:slide-in-from-bottom-full",
|
|
88
|
-
"data-[state=closed]:slide-out-to-bottom-full",
|
|
89
|
-
"sm:data-[state=open]:slide-in-from-bottom-0 sm:data-[state=open]:zoom-in-95",
|
|
90
|
-
"sm:data-[state=closed]:slide-out-to-bottom-0 sm:data-[state=closed]:zoom-out-95"
|
|
91
|
-
)
|
|
92
|
-
),
|
|
93
|
-
"sm:dialog-max-h-dynamic sm:inset-auto sm:top-1/2 sm:left-1/2 sm:w-full sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-lg sm:p-6",
|
|
94
|
-
"duration-200",
|
|
95
|
-
SIZE_CLASSES[size],
|
|
96
|
-
className
|
|
97
106
|
),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
children
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
const overlayElement = overlay ? /* @__PURE__ */ jsx(DialogOverlay, { ...overlayProps }) : null;
|
|
112
|
+
if (!portal) {
|
|
113
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
114
|
+
overlayElement,
|
|
115
|
+
content
|
|
116
|
+
] });
|
|
117
|
+
}
|
|
118
|
+
return /* @__PURE__ */ jsxs(DialogPrimitive.Portal, { children: [
|
|
119
|
+
overlayElement,
|
|
120
|
+
content
|
|
112
121
|
] });
|
|
113
|
-
return portal ? /* @__PURE__ */ jsx(DialogPrimitive.Portal, { children: content }) : content;
|
|
114
122
|
}
|
|
115
123
|
);
|
|
116
124
|
DialogContent.displayName = "DialogContent";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.mjs","sources":["../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { useDragToDismiss } from \"../../utils/useDragToDismiss\";\nimport { useSuppressClickAfterDrag } from \"../../utils/useSuppressClickAfterDrag\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { ArrowLeftIcon } from \"../Icons/ArrowLeftIcon\";\nimport { CloseIcon } from \"../Icons/CloseIcon\";\n\n/** Props for the {@link Dialog} root component. */\nexport interface DialogProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root> {\n /** Controlled open state. When provided, you must also supply `onOpenChange`. */\n open?: boolean;\n /** Called when the open state changes. Required when `open` is controlled. */\n onOpenChange?: (open: boolean) => void;\n /** The open state of the dialog when it is initially rendered (uncontrolled). */\n defaultOpen?: boolean;\n}\n\n/** Root component that manages open/close state for a dialog. */\nexport const Dialog = DialogPrimitive.Root;\n\n/** Props for the {@link DialogTrigger} component. */\nexport type DialogTriggerProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;\n\n/**\n * The element that opens the dialog when clicked.\n *\n * On touch / pen, a press-and-release that crosses a small movement threshold\n * is treated as a drag and the resulting synthetic click is suppressed —\n * defends against Android Chrome opening the dialog on a scroll-drag-end.\n */\nexport const DialogTrigger = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Trigger>,\n DialogTriggerProps\n>((props, ref) => <DialogPrimitive.Trigger ref={ref} {...useSuppressClickAfterDrag(props)} />);\nDialogTrigger.displayName = \"DialogTrigger\";\n\n/** Convenience alias for Radix `Dialog.Close`. Closes the dialog when clicked. */\nexport const DialogClose = DialogPrimitive.Close;\n\n/** Props for the {@link DialogClose} component. */\nexport type DialogCloseProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;\n\nexport interface DialogOverlayProps\n extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay> {}\n\n/**\n * Semi-transparent backdrop rendered behind the dialog content.\n * Rendered by {@link DialogContent}; portaled to `document.body` when {@link DialogContent} `portal` is true.\n */\nexport const DialogOverlay = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Overlay>,\n DialogOverlayProps\n>(({ className, style, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n \"data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 fixed inset-0 bg-background-overlay-default data-[state=closed]:animate-out data-[state=open]:animate-in\",\n className,\n )}\n style={{ zIndex: \"var(--fanvue-ui-portal-z-index, 50)\", ...style }}\n {...props}\n />\n));\nDialogOverlay.displayName = \"DialogOverlay\";\n\nexport interface DialogContentProps\n extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {\n /**\n * Width preset for the dialog.\n * - `\"sm\"` — 400px max-width (confirmations, simple forms)\n * - `\"md\"` — 440px max-width (default, standard dialogs)\n * - `\"lg\"` — 600px max-width (complex content, tables)\n *\n * @default \"md\"\n */\n size?: \"sm\" | \"md\" | \"lg\";\n /** When true, renders overlay automatically. @default true */\n overlay?: boolean;\n /**\n * When true, teleports overlay and panel to `document.body`.\n * When false, renders inline in the React tree (useful inside theme providers or scoped containers).\n * @default true\n */\n portal?: boolean;\n /** Show the v2 mobile sheet pull handle. Only rendered when `mobilePresentation` is `\"sheet\"`. @default true */\n showMobileHandle?: boolean;\n /**\n * How the dialog presents below the `sm` breakpoint.\n * - `\"sheet\"` — bottom sheet pinned to the viewport bottom edge (default)\n * - `\"card\"` — centered floating card per the v2-modal confirmation spec:\n * 16px side margins, 24px padding, 32px radius on all corners, no pull handle\n *\n * @default \"sheet\"\n */\n mobilePresentation?: \"sheet\" | \"card\";\n /** Props forwarded to the default {@link DialogOverlay} when `overlay` is `true`. */\n overlayProps?: DialogOverlayProps;\n}\n\nconst SIZE_CLASSES: Record<NonNullable<DialogContentProps[\"size\"]>, string> = {\n sm: \"sm:max-w-[400px]\",\n md: \"sm:max-w-[440px]\",\n lg: \"sm:max-w-[600px]\",\n};\n\n/**\n * The dialog panel. Includes the overlay by default and portals to `document.body` by default.\n *\n * Set `portal={false}` to keep overlay and content in the DOM subtree of the parent `Dialog`.\n * `fixed` positioning still applies; ancestors with `transform` or `overflow` may affect layout.\n *\n * On mobile viewports (<640px), the dialog slides up from the bottom as a sheet\n * with top-only border radius by default; pass `mobilePresentation=\"card\"` to\n * render a centered floating card instead (used for small confirmation dialogs).\n * On larger viewports it renders centered with full border radius.\n *\n * @example\n * ```tsx\n * <Dialog>\n * <DialogTrigger asChild>\n * <Button>Open</Button>\n * </DialogTrigger>\n * <DialogContent>\n * <DialogHeader>\n * <DialogTitle>Title</DialogTitle>\n * </DialogHeader>\n * <DialogBody>Content here</DialogBody>\n * <DialogFooter>\n * <DialogClose asChild>\n * <Button variant=\"secondary\">Cancel</Button>\n * </DialogClose>\n * <Button>Accept</Button>\n * </DialogFooter>\n * </DialogContent>\n * </Dialog>\n * ```\n */\nexport const DialogContent = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Content>,\n DialogContentProps\n>(\n (\n {\n className,\n children,\n size = \"md\",\n overlay = true,\n portal = true,\n showMobileHandle = true,\n mobilePresentation = \"sheet\",\n overlayProps,\n style,\n onOpenAutoFocus,\n ...props\n },\n ref,\n ) => {\n const closeRef = React.useRef<HTMLButtonElement>(null);\n const contentProps = useDragToDismiss(\n {\n enabled: mobilePresentation === \"sheet\",\n media: \"(max-width: 639.98px)\",\n onDismiss: () => closeRef.current?.click(),\n },\n props,\n );\n const content = (\n <>\n {overlay && <DialogOverlay {...overlayProps} />}\n <DialogPrimitive.Content\n ref={ref}\n style={{ zIndex: \"var(--fanvue-ui-portal-z-index, 50)\", ...style }}\n onOpenAutoFocus={(e) => {\n if (onOpenAutoFocus) {\n onOpenAutoFocus(e);\n return;\n }\n e.preventDefault();\n (e.currentTarget as HTMLElement).focus();\n }}\n className={cn(\n \"fixed flex flex-col overflow-hidden border border-modal-stroke bg-modal-background shadow-blur-menu backdrop-blur-[4px] focus:outline-none\",\n \"data-[state=open]:fade-in-0 data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=closed]:animate-out\",\n mobilePresentation === \"card\"\n ? // Floating confirmation card (v2-modal): 16px side margins, vertically centered, 32px radius\n cn(\n \"dialog-max-h-dynamic inset-x-4 top-1/2 -translate-y-1/2 rounded-xl p-6\",\n \"data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95\",\n \"sm:inset-x-auto\",\n )\n : // Bottom sheet pinned to the viewport bottom edge\n cn(\n \"dialog-max-h-dynamic inset-x-0 bottom-0 w-full rounded-t-xl p-4 pt-3\",\n \"pb-[calc(1rem+env(safe-area-inset-bottom,0px))]\",\n \"data-[state=open]:slide-in-from-bottom-full\",\n \"data-[state=closed]:slide-out-to-bottom-full\",\n \"sm:data-[state=open]:slide-in-from-bottom-0 sm:data-[state=open]:zoom-in-95\",\n \"sm:data-[state=closed]:slide-out-to-bottom-0 sm:data-[state=closed]:zoom-out-95\",\n ),\n \"sm:dialog-max-h-dynamic sm:inset-auto sm:top-1/2 sm:left-1/2 sm:w-full sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-lg sm:p-6\",\n \"duration-200\",\n SIZE_CLASSES[size],\n className,\n )}\n {...contentProps}\n >\n <DialogPrimitive.Close ref={closeRef} hidden tabIndex={-1} aria-hidden=\"true\" />\n {showMobileHandle && mobilePresentation === \"sheet\" && (\n <div\n aria-hidden=\"true\"\n className=\"mb-3 h-1 w-8 shrink-0 self-center rounded-full bg-icons-tertiary sm:hidden\"\n />\n )}\n {children}\n </DialogPrimitive.Content>\n </>\n );\n\n return portal ? <DialogPrimitive.Portal>{content}</DialogPrimitive.Portal> : content;\n },\n);\nDialogContent.displayName = \"DialogContent\";\n\nexport interface DialogHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Show the close (X) button in the header. @default true */\n showClose?: boolean;\n /** Show a back arrow button on the left side. Defaults to `true` when `onBack` is provided. */\n showBack?: boolean;\n /** Called when the back button is clicked. */\n onBack?: () => void;\n /** Accessible label for the back button. @default \"Go back\" */\n backLabel?: string;\n /** Accessible label for the close button. @default \"Close\" */\n closeLabel?: string;\n}\n\n/**\n * Header bar for the dialog. Renders the title with an optional back arrow\n * and close button.\n *\n * @example\n * ```tsx\n * <DialogHeader>\n * <DialogTitle>Settings</DialogTitle>\n * </DialogHeader>\n *\n * <DialogHeader showBack onBack={() => setStep(0)}>\n * <DialogTitle>Step 2</DialogTitle>\n * </DialogHeader>\n * ```\n */\nexport const DialogHeader = React.forwardRef<HTMLDivElement, DialogHeaderProps>(\n (\n {\n className,\n children,\n showClose = true,\n showBack,\n onBack,\n backLabel = \"Go back\",\n closeLabel = \"Close\",\n ...props\n },\n ref,\n ) => {\n const shouldShowBack = showBack ?? !!onBack;\n\n return (\n <div\n ref={ref}\n // items-start (not items-center) so the back/close buttons align to the\n // title's first line; otherwise they float to the vertical center of a\n // multi-line title + description column.\n className={cn(\"flex shrink-0 items-start justify-end gap-4\", className)}\n {...props}\n >\n {shouldShowBack && (\n <IconButton\n variant=\"secondary\"\n size=\"32\"\n icon={<ArrowLeftIcon size={16} />}\n onClick={onBack}\n disabled={!onBack}\n aria-label={backLabel}\n />\n )}\n <div className=\"flex min-w-0 flex-1 flex-col gap-1.5\">{children}</div>\n {showClose && (\n <DialogPrimitive.Close asChild>\n <IconButton\n variant=\"secondary\"\n size=\"32\"\n icon={<CloseIcon size={16} />}\n aria-label={closeLabel}\n />\n </DialogPrimitive.Close>\n )}\n </div>\n );\n },\n);\nDialogHeader.displayName = \"DialogHeader\";\n\n/** Props for the {@link DialogTitle} component. */\nexport type DialogTitleProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;\n\n/**\n * Accessible title for the dialog. Must be rendered inside {@link DialogHeader}\n * or directly within {@link DialogContent}.\n */\nexport const DialogTitle = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Title>,\n DialogTitleProps\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn(\"typography-header-heading-xs text-content-primary\", className)}\n {...props}\n />\n));\nDialogTitle.displayName = \"DialogTitle\";\n\n/** Props for the {@link DialogDescription} component. */\nexport type DialogDescriptionProps = React.ComponentPropsWithoutRef<\n typeof DialogPrimitive.Description\n>;\n\n/** Accessible description for the dialog. Rendered as secondary text. */\nexport const DialogDescription = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Description>,\n DialogDescriptionProps\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn(\"typography-body-default-16px-regular text-content-secondary\", className)}\n {...props}\n />\n));\nDialogDescription.displayName = \"DialogDescription\";\n\nexport interface DialogBodyProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Scrollable content area (slot) between the header and footer.\n * Grows to fill available space and scrolls when content overflows.\n */\nexport const DialogBody = React.forwardRef<HTMLDivElement, DialogBodyProps>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"flex-1 overflow-y-auto py-4\", className)} {...props} />\n ),\n);\nDialogBody.displayName = \"DialogBody\";\n\nexport interface DialogFooterProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Footer bar for the dialog. Typically contains action buttons.\n * Children are laid out in a horizontal row with equal flex-basis.\n */\nexport const DialogFooter = React.forwardRef<HTMLDivElement, DialogFooterProps>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex shrink-0 items-center gap-2\", \"[&>*]:min-w-0 [&>*]:flex-1\", className)}\n {...props}\n />\n ),\n);\nDialogFooter.displayName = \"DialogFooter\";\n"],"names":[],"mappings":";;;;;;;;;;AAoBO,MAAM,SAAS,gBAAgB;AAY/B,MAAM,gBAAgB,MAAM,WAGjC,CAAC,OAAO,QAAQ,oBAAC,gBAAgB,SAAhB,EAAwB,KAAW,GAAG,0BAA0B,KAAK,GAAG,CAAE;AAC7F,cAAc,cAAc;AAGrB,MAAM,cAAc,gBAAgB;AAYpC,MAAM,gBAAgB,MAAM,WAGjC,CAAC,EAAE,WAAW,OAAO,GAAG,SAAS,QACjC;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAEF,OAAO,EAAE,QAAQ,uCAAuC,GAAG,MAAA;AAAA,IAC1D,GAAG;AAAA,EAAA;AACN,CACD;AACD,cAAc,cAAc;AAoC5B,MAAM,eAAwE;AAAA,EAC5E,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAkCO,MAAM,gBAAgB,MAAM;AAAA,EAIjC,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,UAAU;AAAA,IACV,SAAS;AAAA,IACT,mBAAmB;AAAA,IACnB,qBAAqB;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,WAAW,MAAM,OAA0B,IAAI;AACrD,UAAM,eAAe;AAAA,MACnB;AAAA,QACE,SAAS,uBAAuB;AAAA,QAChC,OAAO;AAAA,QACP,WAAW,MAAM,SAAS,SA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ACD,kBAAkB,cAAc;AAQzB,MAAM,aAAa,MAAM;AAAA,EAC9B,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QACxB,oBAAC,OAAA,EAAI,KAAU,WAAW,GAAG,+BAA+B,SAAS,GAAI,GAAG,MAAA,CAAO;AAEvF;AACA,WAAW,cAAc;AAQlB,MAAM,eAAe,MAAM;AAAA,EAChC,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QACxB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,WAAW,GAAG,oCAAoC,8BAA8B,SAAS;AAAA,MACxF,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;AACA,aAAa,cAAc;"}
|
|
1
|
+
{"version":3,"file":"Dialog.mjs","sources":["../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { useDragToDismiss } from \"../../utils/useDragToDismiss\";\nimport { useSuppressClickAfterDrag } from \"../../utils/useSuppressClickAfterDrag\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { ArrowLeftIcon } from \"../Icons/ArrowLeftIcon\";\nimport { CloseIcon } from \"../Icons/CloseIcon\";\n\n/** Props for the {@link Dialog} root component. */\nexport interface DialogProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root> {\n /** Controlled open state. When provided, you must also supply `onOpenChange`. */\n open?: boolean;\n /** Called when the open state changes. Required when `open` is controlled. */\n onOpenChange?: (open: boolean) => void;\n /** The open state of the dialog when it is initially rendered (uncontrolled). */\n defaultOpen?: boolean;\n}\n\n/** Root component that manages open/close state for a dialog. */\nexport const Dialog = DialogPrimitive.Root;\n\n/** Props for the {@link DialogTrigger} component. */\nexport type DialogTriggerProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;\n\n/**\n * The element that opens the dialog when clicked.\n *\n * On touch / pen, a press-and-release that crosses a small movement threshold\n * is treated as a drag and the resulting synthetic click is suppressed —\n * defends against Android Chrome opening the dialog on a scroll-drag-end.\n */\nexport const DialogTrigger = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Trigger>,\n DialogTriggerProps\n>((props, ref) => <DialogPrimitive.Trigger ref={ref} {...useSuppressClickAfterDrag(props)} />);\nDialogTrigger.displayName = \"DialogTrigger\";\n\n/** Convenience alias for Radix `Dialog.Close`. Closes the dialog when clicked. */\nexport const DialogClose = DialogPrimitive.Close;\n\n/** Props for the {@link DialogClose} component. */\nexport type DialogCloseProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;\n\nexport interface DialogOverlayProps\n extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay> {}\n\n/**\n * Semi-transparent backdrop rendered behind the dialog content.\n * Rendered by {@link DialogContent}; portaled to `document.body` when {@link DialogContent} `portal` is true.\n */\nexport const DialogOverlay = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Overlay>,\n DialogOverlayProps\n>(({ className, style, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n \"data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 fixed inset-0 bg-background-overlay-default data-[state=closed]:animate-out data-[state=open]:animate-in\",\n className,\n )}\n style={{ zIndex: \"var(--fanvue-ui-portal-z-index, 50)\", ...style }}\n {...props}\n />\n));\nDialogOverlay.displayName = \"DialogOverlay\";\n\nexport interface DialogContentProps\n extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {\n /**\n * Width preset for the dialog.\n * - `\"sm\"` — 400px max-width (confirmations, simple forms)\n * - `\"md\"` — 440px max-width (default, standard dialogs)\n * - `\"lg\"` — 600px max-width (complex content, tables)\n *\n * @default \"md\"\n */\n size?: \"sm\" | \"md\" | \"lg\";\n /** When true, renders overlay automatically. @default true */\n overlay?: boolean;\n /**\n * When true, teleports overlay and panel to `document.body`.\n * When false, renders inline in the React tree (useful inside theme providers or scoped containers).\n * @default true\n */\n portal?: boolean;\n /** Show the v2 mobile sheet pull handle. Only rendered when `mobilePresentation` is `\"sheet\"`. @default true */\n showMobileHandle?: boolean;\n /**\n * How the dialog presents below the `sm` breakpoint.\n * - `\"sheet\"` — bottom sheet pinned to the viewport bottom edge (default)\n * - `\"card\"` — centered floating card per the v2-modal confirmation spec:\n * 16px side margins, 24px padding, 32px radius on all corners, no pull handle\n *\n * @default \"sheet\"\n */\n mobilePresentation?: \"sheet\" | \"card\";\n /** Props forwarded to the default {@link DialogOverlay} when `overlay` is `true`. */\n overlayProps?: DialogOverlayProps;\n}\n\nconst SIZE_CLASSES: Record<NonNullable<DialogContentProps[\"size\"]>, string> = {\n sm: \"sm:max-w-[400px]\",\n md: \"sm:max-w-[440px]\",\n lg: \"sm:max-w-[600px]\",\n};\n\n/**\n * The dialog panel. Includes the overlay by default and portals to `document.body` by default.\n *\n * Set `portal={false}` to keep overlay and content in the DOM subtree of the parent `Dialog`.\n * `fixed` positioning still applies; ancestors with `transform` or `overflow` may affect layout.\n *\n * On mobile viewports (<640px), the dialog slides up from the bottom as a sheet\n * with top-only border radius by default; pass `mobilePresentation=\"card\"` to\n * render a centered floating card instead (used for small confirmation dialogs).\n * On larger viewports it renders centered with full border radius.\n *\n * It animates in and out. While the closing animation plays the panel stays\n * mounted but ignores pointer input, so a second click can't act on it.\n *\n * @example\n * ```tsx\n * <Dialog>\n * <DialogTrigger asChild>\n * <Button>Open</Button>\n * </DialogTrigger>\n * <DialogContent>\n * <DialogHeader>\n * <DialogTitle>Title</DialogTitle>\n * </DialogHeader>\n * <DialogBody>Content here</DialogBody>\n * <DialogFooter>\n * <DialogClose asChild>\n * <Button variant=\"secondary\">Cancel</Button>\n * </DialogClose>\n * <Button>Accept</Button>\n * </DialogFooter>\n * </DialogContent>\n * </Dialog>\n * ```\n */\nexport const DialogContent = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Content>,\n DialogContentProps\n>(\n (\n {\n className,\n children,\n size = \"md\",\n overlay = true,\n portal = true,\n showMobileHandle = true,\n mobilePresentation = \"sheet\",\n overlayProps,\n style,\n onOpenAutoFocus,\n ...props\n },\n ref,\n ) => {\n const closeRef = React.useRef<HTMLButtonElement>(null);\n const contentProps = useDragToDismiss(\n {\n enabled: mobilePresentation === \"sheet\",\n media: \"(max-width: 639.98px)\",\n onDismiss: () => closeRef.current?.click(),\n },\n props,\n );\n const content = (\n <DialogPrimitive.Content\n ref={ref}\n style={{ zIndex: \"var(--fanvue-ui-portal-z-index, 50)\", ...style }}\n onOpenAutoFocus={(e) => {\n if (onOpenAutoFocus) {\n onOpenAutoFocus(e);\n return;\n }\n e.preventDefault();\n (e.currentTarget as HTMLElement).focus();\n }}\n className={cn(\n \"fixed flex flex-col overflow-hidden border border-modal-stroke bg-modal-background shadow-blur-menu backdrop-blur-[4px] focus:outline-none\",\n \"data-[state=open]:fade-in-0 data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=closed]:animate-out\",\n \"data-[state=closed]:pointer-events-none!\",\n mobilePresentation === \"card\"\n ? // Floating confirmation card (v2-modal): 16px side margins, vertically centered, 32px radius\n cn(\n \"dialog-max-h-dynamic inset-x-4 top-1/2 -translate-y-1/2 rounded-xl p-6\",\n \"data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95\",\n \"sm:inset-x-auto\",\n )\n : // Bottom sheet pinned to the viewport bottom edge\n cn(\n \"dialog-max-h-dynamic inset-x-0 bottom-0 w-full rounded-t-xl p-4 pt-3\",\n \"pb-[calc(1rem+env(safe-area-inset-bottom,0px))]\",\n \"data-[state=open]:slide-in-from-bottom-full\",\n \"data-[state=closed]:slide-out-to-bottom-full\",\n \"sm:data-[state=open]:slide-in-from-bottom-0 sm:data-[state=open]:zoom-in-95\",\n \"sm:data-[state=closed]:slide-out-to-bottom-0 sm:data-[state=closed]:zoom-out-95\",\n ),\n \"sm:dialog-max-h-dynamic sm:inset-auto sm:top-1/2 sm:left-1/2 sm:w-full sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-lg sm:p-6\",\n \"duration-200\",\n SIZE_CLASSES[size],\n className,\n )}\n {...contentProps}\n >\n <DialogPrimitive.Close ref={closeRef} hidden tabIndex={-1} aria-hidden=\"true\" />\n {showMobileHandle && mobilePresentation === \"sheet\" && (\n <div\n aria-hidden=\"true\"\n className=\"mb-3 h-1 w-8 shrink-0 self-center rounded-full bg-icons-tertiary sm:hidden\"\n />\n )}\n {children}\n </DialogPrimitive.Content>\n );\n const overlayElement = overlay ? <DialogOverlay {...overlayProps} /> : null;\n\n if (!portal) {\n return (\n <>\n {overlayElement}\n {content}\n </>\n );\n }\n return (\n <DialogPrimitive.Portal>\n {overlayElement}\n {content}\n </DialogPrimitive.Portal>\n );\n },\n);\nDialogContent.displayName = \"DialogContent\";\n\nexport interface DialogHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Show the close (X) button in the header. @default true */\n showClose?: boolean;\n /** Show a back arrow button on the left side. Defaults to `true` when `onBack` is provided. */\n showBack?: boolean;\n /** Called when the back button is clicked. */\n onBack?: () => void;\n /** Accessible label for the back button. @default \"Go back\" */\n backLabel?: string;\n /** Accessible label for the close button. @default \"Close\" */\n closeLabel?: string;\n}\n\n/**\n * Header bar for the dialog. Renders the title with an optional back arrow\n * and close button.\n *\n * @example\n * ```tsx\n * <DialogHeader>\n * <DialogTitle>Settings</DialogTitle>\n * </DialogHeader>\n *\n * <DialogHeader showBack onBack={() => setStep(0)}>\n * <DialogTitle>Step 2</DialogTitle>\n * </DialogHeader>\n * ```\n */\nexport const DialogHeader = React.forwardRef<HTMLDivElement, DialogHeaderProps>(\n (\n {\n className,\n children,\n showClose = true,\n showBack,\n onBack,\n backLabel = \"Go back\",\n closeLabel = \"Close\",\n ...props\n },\n ref,\n ) => {\n const shouldShowBack = showBack ?? !!onBack;\n\n return (\n <div\n ref={ref}\n // items-start (not items-center) so the back/close buttons align to the\n // title's first line; otherwise they float to the vertical center of a\n // multi-line title + description column.\n className={cn(\"flex shrink-0 items-start justify-end gap-4\", className)}\n {...props}\n >\n {shouldShowBack && (\n <IconButton\n variant=\"secondary\"\n size=\"32\"\n icon={<ArrowLeftIcon size={16} />}\n onClick={onBack}\n disabled={!onBack}\n aria-label={backLabel}\n />\n )}\n <div className=\"flex min-w-0 flex-1 flex-col gap-1.5\">{children}</div>\n {showClose && (\n <DialogPrimitive.Close asChild>\n <IconButton\n variant=\"secondary\"\n size=\"32\"\n icon={<CloseIcon size={16} />}\n aria-label={closeLabel}\n />\n </DialogPrimitive.Close>\n )}\n </div>\n );\n },\n);\nDialogHeader.displayName = \"DialogHeader\";\n\n/** Props for the {@link DialogTitle} component. */\nexport type DialogTitleProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;\n\n/**\n * Accessible title for the dialog. Must be rendered inside {@link DialogHeader}\n * or directly within {@link DialogContent}.\n */\nexport const DialogTitle = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Title>,\n DialogTitleProps\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn(\"typography-header-heading-xs text-content-primary\", className)}\n {...props}\n />\n));\nDialogTitle.displayName = \"DialogTitle\";\n\n/** Props for the {@link DialogDescription} component. */\nexport type DialogDescriptionProps = React.ComponentPropsWithoutRef<\n typeof DialogPrimitive.Description\n>;\n\n/** Accessible description for the dialog. Rendered as secondary text. */\nexport const DialogDescription = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Description>,\n DialogDescriptionProps\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn(\"typography-body-default-16px-regular text-content-secondary\", className)}\n {...props}\n />\n));\nDialogDescription.displayName = \"DialogDescription\";\n\nexport interface DialogBodyProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Scrollable content area (slot) between the header and footer.\n * Grows to fill available space and scrolls when content overflows.\n */\nexport const DialogBody = React.forwardRef<HTMLDivElement, DialogBodyProps>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"flex-1 overflow-y-auto py-4\", className)} {...props} />\n ),\n);\nDialogBody.displayName = \"DialogBody\";\n\nexport interface DialogFooterProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Footer bar for the dialog. Typically contains action buttons.\n * Children are laid out in a horizontal row with equal flex-basis.\n */\nexport const DialogFooter = React.forwardRef<HTMLDivElement, DialogFooterProps>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex shrink-0 items-center gap-2\", \"[&>*]:min-w-0 [&>*]:flex-1\", className)}\n {...props}\n />\n ),\n);\nDialogFooter.displayName = \"DialogFooter\";\n"],"names":[],"mappings":";;;;;;;;;;AAoBO,MAAM,SAAS,gBAAgB;AAY/B,MAAM,gBAAgB,MAAM,WAGjC,CAAC,OAAO,QAAQ,oBAAC,gBAAgB,SAAhB,EAAwB,KAAW,GAAG,0BAA0B,KAAK,GAAG,CAAE;AAC7F,cAAc,cAAc;AAGrB,MAAM,cAAc,gBAAgB;AAYpC,MAAM,gBAAgB,MAAM,WAGjC,CAAC,EAAE,WAAW,OAAO,GAAG,SAAS,QACjC;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAEF,OAAO,EAAE,QAAQ,uCAAuC,GAAG,MAAA;AAAA,IAC1D,GAAG;AAAA,EAAA;AACN,CACD;AACD,cAAc,cAAc;AAoC5B,MAAM,eAAwE;AAAA,EAC5E,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAqCO,MAAM,gBAAgB,MAAM;AAAA,EAIjC,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,UAAU;AAAA,IACV,SAAS;AAAA,IACT,mBAAmB;AAAA,IACnB,qBAAqB;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,WAAW,MAAM,OAA0B,IAA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AM,oBAAoB,MAAM,WAGrC,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAC1B;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAW,GAAG,+DAA+D,SAAS;AAAA,IACrF,GAAG;AAAA,EAAA;AACN,CACD;AACD,kBAAkB,cAAc;AAQzB,MAAM,aAAa,MAAM;AAAA,EAC9B,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QACxB,oBAAC,OAAA,EAAI,KAAU,WAAW,GAAG,+BAA+B,SAAS,GAAI,GAAG,MAAA,CAAO;AAEvF;AACA,WAAW,cAAc;AAQlB,MAAM,eAAe,MAAM;AAAA,EAChC,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QACxB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,WAAW,GAAG,oCAAoC,8BAA8B,SAAS;AAAA,MACxF,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;AACA,aAAa,cAAc;"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { BaseIcon } from "./BaseIcon.mjs";
|
|
5
|
+
const VARIANTS = {
|
|
6
|
+
16: {
|
|
7
|
+
outlined: [
|
|
8
|
+
{
|
|
9
|
+
d: "M8 14.834c-1.02 0-2.013-.22-2.933-.66a.8.8 0 0 0-.387-.054l-1.807.434c-.46.113-.88.013-1.166-.267-.28-.28-.38-.707-.267-1.167l.433-1.8c.02-.08 0-.28-.053-.386a6.85 6.85 0 0 1-.567-4.08c.46-2.834 2.754-5.134 5.587-5.6 2.227-.367 4.407.326 5.987 1.906s2.273 3.76 1.906 5.987c-.466 2.84-2.586 5.02-5.4 5.553A6.5 6.5 0 0 1 8 14.834m-3.233-1.72c.246 0 .52.053.733.16a5.86 5.86 0 0 0 3.653.453c2.4-.453 4.207-2.313 4.6-4.733.314-1.907-.28-3.767-1.626-5.114-1.347-1.346-3.214-1.94-5.12-1.626-2.414.393-4.367 2.36-4.76 4.773a5.9 5.9 0 0 0 .486 3.487c.147.306.194.74.12 1.053l-.433 1.8c-.033.147-.007.213 0 .22s.073.04.22 0l1.807-.433c.093-.027.206-.04.32-.04"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
d: "M11.627 7.14a.5.5 0 0 1-.467-.327 3.4 3.4 0 0 0-1.94-1.96.497.497 0 0 1-.287-.646c.1-.26.387-.387.647-.287a4.4 4.4 0 0 1 2.52 2.54.5.5 0 0 1-.473.68"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
filled: [
|
|
16
|
+
{
|
|
17
|
+
d: "M6.873 1.426c-2.766.454-5 2.687-5.446 5.454a6.7 6.7 0 0 0 .553 3.986c.093.2.14.54.087.76l-.454 1.894c-.153.633.234 1.02.867.866.66-.153 1.44-.346 1.9-.453a1.3 1.3 0 0 1 .753.087 6.7 6.7 0 0 0 4.174.52c2.753-.52 4.813-2.647 5.266-5.414a6.674 6.674 0 0 0-7.7-7.7m4.927 5.68a.4.4 0 0 1-.173.034.49.49 0 0 1-.467-.32 3.4 3.4 0 0 0-1.947-1.967.51.51 0 0 1-.286-.647.51.51 0 0 1 .646-.286 4.4 4.4 0 0 1 2.52 2.546.49.49 0 0 1-.293.64"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
24: {
|
|
22
|
+
outlined: [
|
|
23
|
+
{
|
|
24
|
+
d: "M12 22.25c-1.53 0-3.02-.33-4.4-.99-.16-.07-.46-.11-.58-.08l-2.71.65c-.69.17-1.32.02-1.75-.4-.42-.42-.57-1.06-.4-1.75l.65-2.7c.03-.12 0-.42-.08-.58-.9-1.89-1.2-4.01-.85-6.12.69-4.25 4.13-7.7 8.38-8.4 3.34-.55 6.61.49 8.98 2.86s3.41 5.64 2.86 8.98c-.7 4.26-3.88 7.53-8.1 8.33-.67.14-1.34.2-2 .2m-4.85-2.58c.37 0 .78.08 1.1.24 1.69.81 3.59 1.04 5.48.68 3.6-.68 6.31-3.47 6.9-7.1.47-2.86-.42-5.65-2.44-7.67s-4.82-2.91-7.68-2.44c-3.62.59-6.55 3.54-7.14 7.16-.29 1.81-.04 3.62.73 5.23.22.46.29 1.11.18 1.58l-.65 2.7c-.05.22-.01.32 0 .33s.11.06.33 0l2.71-.65c.14-.04.31-.06.48-.06"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
d: "M17.44 10.71c-.3 0-.59-.19-.7-.49a5.08 5.08 0 0 0-2.91-2.94.746.746 0 0 1-.43-.97c.15-.39.58-.58.97-.43a6.6 6.6 0 0 1 3.78 3.81.75.75 0 0 1-.44.97c-.09.04-.18.05-.27.05"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
filled: [
|
|
31
|
+
{
|
|
32
|
+
d: "M10.31 2.14c-4.15.68-7.5 4.03-8.17 8.18-.35 2.16-.01 4.21.83 5.98.14.3.21.81.13 1.14l-.68 2.84c-.23.95.35 1.53 1.3 1.3.99-.23 2.16-.52 2.85-.68.33-.08.83-.01 1.13.13 1.85.88 4.01 1.21 6.26.78 4.13-.78 7.22-3.97 7.9-8.12A10.01 10.01 0 0 0 10.31 2.14m7.39 8.52c-.08.04-.17.05-.26.05-.31 0-.59-.18-.7-.48a5.1 5.1 0 0 0-2.92-2.95.763.763 0 0 1-.43-.97c.15-.38.59-.57.97-.43a6.6 6.6 0 0 1 3.78 3.82c.15.39-.05.82-.44.96"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
32: {
|
|
37
|
+
outlined: [
|
|
38
|
+
{
|
|
39
|
+
d: "M16 29.667c-2.04 0-4.026-.44-5.866-1.32-.214-.093-.614-.146-.774-.107l-3.613.867c-.92.227-1.76.027-2.333-.533-.56-.56-.76-1.413-.534-2.334l.867-3.6c.04-.16 0-.56-.107-.773-1.2-2.52-1.6-5.347-1.133-8.16.92-5.666 5.507-10.266 11.173-11.2 4.454-.733 8.814.654 11.974 3.814s4.546 7.52 3.813 11.973c-.933 5.68-5.173 10.04-10.8 11.107-.893.186-1.787.266-2.667.266m-6.466-3.44c.493 0 1.04.107 1.466.32 2.254 1.08 4.787 1.387 7.307.907 4.8-.907 8.413-4.627 9.2-9.467.627-3.813-.56-7.533-3.253-10.226s-6.427-3.88-10.24-3.254c-4.827.787-8.734 4.72-9.52 9.547-.387 2.413-.054 4.827.973 6.973.293.613.387 1.48.24 2.107l-.867 3.6c-.066.293-.013.427 0 .44.014.013.147.08.44 0l3.614-.867c.186-.053.413-.08.64-.08"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
d: "M23.253 14.28c-.4 0-.787-.253-.933-.653a6.77 6.77 0 0 0-3.88-3.92.994.994 0 0 1-.573-1.293.994.994 0 0 1 1.293-.573 8.8 8.8 0 0 1 5.04 5.08 1 1 0 0 1-.587 1.293.9.9 0 0 1-.36.067"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
filled: [
|
|
46
|
+
{
|
|
47
|
+
d: "M13.747 2.853c-5.534.906-10 5.373-10.894 10.906-.466 2.88-.013 5.614 1.107 7.974.187.4.28 1.08.173 1.52l-.906 3.786c-.307 1.267.466 2.04 1.733 1.734 1.32-.307 2.88-.694 3.8-.907.44-.107 1.107-.013 1.507.173 2.466 1.174 5.346 1.614 8.346 1.04 5.507-1.04 9.627-5.293 10.534-10.826a13.348 13.348 0 0 0-15.4-15.4m9.853 11.36a.8.8 0 0 1-.347.066.98.98 0 0 1-.933-.64 6.78 6.78 0 0 0-3.893-3.933c-.507-.2-.76-.773-.574-1.293.2-.507.787-.76 1.294-.574a8.8 8.8 0 0 1 5.04 5.094.98.98 0 0 1-.587 1.28"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const CommentIcon = React.forwardRef((props, ref) => /* @__PURE__ */ jsx(BaseIcon, { ref, variants: VARIANTS, ...props }));
|
|
53
|
+
CommentIcon.displayName = "CommentIcon";
|
|
54
|
+
export {
|
|
55
|
+
CommentIcon
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=CommentIcon.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommentIcon.mjs","sources":["../../../src/components/Icons/CommentIcon.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { BaseIcon } from \"./BaseIcon\";\nimport type { BaseIconProps, IconVariants } from \"./types\";\n\nconst VARIANTS: IconVariants = {\n 16: {\n outlined: [\n {\n d: \"M8 14.834c-1.02 0-2.013-.22-2.933-.66a.8.8 0 0 0-.387-.054l-1.807.434c-.46.113-.88.013-1.166-.267-.28-.28-.38-.707-.267-1.167l.433-1.8c.02-.08 0-.28-.053-.386a6.85 6.85 0 0 1-.567-4.08c.46-2.834 2.754-5.134 5.587-5.6 2.227-.367 4.407.326 5.987 1.906s2.273 3.76 1.906 5.987c-.466 2.84-2.586 5.02-5.4 5.553A6.5 6.5 0 0 1 8 14.834m-3.233-1.72c.246 0 .52.053.733.16a5.86 5.86 0 0 0 3.653.453c2.4-.453 4.207-2.313 4.6-4.733.314-1.907-.28-3.767-1.626-5.114-1.347-1.346-3.214-1.94-5.12-1.626-2.414.393-4.367 2.36-4.76 4.773a5.9 5.9 0 0 0 .486 3.487c.147.306.194.74.12 1.053l-.433 1.8c-.033.147-.007.213 0 .22s.073.04.22 0l1.807-.433c.093-.027.206-.04.32-.04\",\n },\n {\n d: \"M11.627 7.14a.5.5 0 0 1-.467-.327 3.4 3.4 0 0 0-1.94-1.96.497.497 0 0 1-.287-.646c.1-.26.387-.387.647-.287a4.4 4.4 0 0 1 2.52 2.54.5.5 0 0 1-.473.68\",\n },\n ],\n filled: [\n {\n d: \"M6.873 1.426c-2.766.454-5 2.687-5.446 5.454a6.7 6.7 0 0 0 .553 3.986c.093.2.14.54.087.76l-.454 1.894c-.153.633.234 1.02.867.866.66-.153 1.44-.346 1.9-.453a1.3 1.3 0 0 1 .753.087 6.7 6.7 0 0 0 4.174.52c2.753-.52 4.813-2.647 5.266-5.414a6.674 6.674 0 0 0-7.7-7.7m4.927 5.68a.4.4 0 0 1-.173.034.49.49 0 0 1-.467-.32 3.4 3.4 0 0 0-1.947-1.967.51.51 0 0 1-.286-.647.51.51 0 0 1 .646-.286 4.4 4.4 0 0 1 2.52 2.546.49.49 0 0 1-.293.64\",\n },\n ],\n },\n 24: {\n outlined: [\n {\n d: \"M12 22.25c-1.53 0-3.02-.33-4.4-.99-.16-.07-.46-.11-.58-.08l-2.71.65c-.69.17-1.32.02-1.75-.4-.42-.42-.57-1.06-.4-1.75l.65-2.7c.03-.12 0-.42-.08-.58-.9-1.89-1.2-4.01-.85-6.12.69-4.25 4.13-7.7 8.38-8.4 3.34-.55 6.61.49 8.98 2.86s3.41 5.64 2.86 8.98c-.7 4.26-3.88 7.53-8.1 8.33-.67.14-1.34.2-2 .2m-4.85-2.58c.37 0 .78.08 1.1.24 1.69.81 3.59 1.04 5.48.68 3.6-.68 6.31-3.47 6.9-7.1.47-2.86-.42-5.65-2.44-7.67s-4.82-2.91-7.68-2.44c-3.62.59-6.55 3.54-7.14 7.16-.29 1.81-.04 3.62.73 5.23.22.46.29 1.11.18 1.58l-.65 2.7c-.05.22-.01.32 0 .33s.11.06.33 0l2.71-.65c.14-.04.31-.06.48-.06\",\n },\n {\n d: \"M17.44 10.71c-.3 0-.59-.19-.7-.49a5.08 5.08 0 0 0-2.91-2.94.746.746 0 0 1-.43-.97c.15-.39.58-.58.97-.43a6.6 6.6 0 0 1 3.78 3.81.75.75 0 0 1-.44.97c-.09.04-.18.05-.27.05\",\n },\n ],\n filled: [\n {\n d: \"M10.31 2.14c-4.15.68-7.5 4.03-8.17 8.18-.35 2.16-.01 4.21.83 5.98.14.3.21.81.13 1.14l-.68 2.84c-.23.95.35 1.53 1.3 1.3.99-.23 2.16-.52 2.85-.68.33-.08.83-.01 1.13.13 1.85.88 4.01 1.21 6.26.78 4.13-.78 7.22-3.97 7.9-8.12A10.01 10.01 0 0 0 10.31 2.14m7.39 8.52c-.08.04-.17.05-.26.05-.31 0-.59-.18-.7-.48a5.1 5.1 0 0 0-2.92-2.95.763.763 0 0 1-.43-.97c.15-.38.59-.57.97-.43a6.6 6.6 0 0 1 3.78 3.82c.15.39-.05.82-.44.96\",\n },\n ],\n },\n 32: {\n outlined: [\n {\n d: \"M16 29.667c-2.04 0-4.026-.44-5.866-1.32-.214-.093-.614-.146-.774-.107l-3.613.867c-.92.227-1.76.027-2.333-.533-.56-.56-.76-1.413-.534-2.334l.867-3.6c.04-.16 0-.56-.107-.773-1.2-2.52-1.6-5.347-1.133-8.16.92-5.666 5.507-10.266 11.173-11.2 4.454-.733 8.814.654 11.974 3.814s4.546 7.52 3.813 11.973c-.933 5.68-5.173 10.04-10.8 11.107-.893.186-1.787.266-2.667.266m-6.466-3.44c.493 0 1.04.107 1.466.32 2.254 1.08 4.787 1.387 7.307.907 4.8-.907 8.413-4.627 9.2-9.467.627-3.813-.56-7.533-3.253-10.226s-6.427-3.88-10.24-3.254c-4.827.787-8.734 4.72-9.52 9.547-.387 2.413-.054 4.827.973 6.973.293.613.387 1.48.24 2.107l-.867 3.6c-.066.293-.013.427 0 .44.014.013.147.08.44 0l3.614-.867c.186-.053.413-.08.64-.08\",\n },\n {\n d: \"M23.253 14.28c-.4 0-.787-.253-.933-.653a6.77 6.77 0 0 0-3.88-3.92.994.994 0 0 1-.573-1.293.994.994 0 0 1 1.293-.573 8.8 8.8 0 0 1 5.04 5.08 1 1 0 0 1-.587 1.293.9.9 0 0 1-.36.067\",\n },\n ],\n filled: [\n {\n d: \"M13.747 2.853c-5.534.906-10 5.373-10.894 10.906-.466 2.88-.013 5.614 1.107 7.974.187.4.28 1.08.173 1.52l-.906 3.786c-.307 1.267.466 2.04 1.733 1.734 1.32-.307 2.88-.694 3.8-.907.44-.107 1.107-.013 1.507.173 2.466 1.174 5.346 1.614 8.346 1.04 5.507-1.04 9.627-5.293 10.534-10.826a13.348 13.348 0 0 0-15.4-15.4m9.853 11.36a.8.8 0 0 1-.347.066.98.98 0 0 1-.933-.64 6.78 6.78 0 0 0-3.893-3.933c-.507-.2-.76-.773-.574-1.293.2-.507.787-.76 1.294-.574a8.8 8.8 0 0 1 5.04 5.094.98.98 0 0 1-.587 1.28\",\n },\n ],\n },\n};\n\n/** Props for {@link CommentIcon}. See {@link BaseIconProps} for the shared shape. */\nexport type CommentIconProps = BaseIconProps;\n\n/**\n * Comment icon. Renders at sizes 16, 24, or 32 px with outlined and filled variants.\n *\n * @example\n * ```tsx\n * <CommentIcon size={24} filled />\n * ```\n */\nexport const CommentIcon = React.forwardRef<SVGSVGElement, CommentIconProps>((props, ref) => (\n <BaseIcon ref={ref} variants={VARIANTS} {...props} />\n));\n\nCommentIcon.displayName = \"CommentIcon\";\n"],"names":[],"mappings":";;;;AAIA,MAAM,WAAyB;AAAA,EAC7B,IAAI;AAAA,IACF,UAAU;AAAA,MACR;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,MAEL;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,IAEF,QAAQ;AAAA,MACN;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,EACF;AAAA,EAEF,IAAI;AAAA,IACF,UAAU;AAAA,MACR;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,MAEL;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,IAEF,QAAQ;AAAA,MACN;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,EACF;AAAA,EAEF,IAAI;AAAA,IACF,UAAU;AAAA,MACR;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,MAEL;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,IAEF,QAAQ;AAAA,MACN;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,EACF;AAEJ;AAaO,MAAM,cAAc,MAAM,WAA4C,CAAC,OAAO,QACnF,oBAAC,UAAA,EAAS,KAAU,UAAU,UAAW,GAAG,OAAO,CACpD;AAED,YAAY,cAAc;"}
|
|
@@ -1,7 +1,31 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
3
|
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
3
|
-
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
const OVERFLOW_TAB_VALUE = "fanvue-ui-tabs-overflow";
|
|
6
|
+
const TabsValueContext = React.createContext({ value: void 0, select: () => {
|
|
7
|
+
} });
|
|
8
|
+
const Tabs = React.forwardRef(
|
|
9
|
+
({ value: valueProp, defaultValue, onValueChange, ...props }, ref) => {
|
|
10
|
+
const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue);
|
|
11
|
+
const isControlled = valueProp !== void 0;
|
|
12
|
+
const value = isControlled ? valueProp : uncontrolledValue;
|
|
13
|
+
const select = React.useCallback(
|
|
14
|
+
(next) => {
|
|
15
|
+
if (next === OVERFLOW_TAB_VALUE) return;
|
|
16
|
+
if (!isControlled) setUncontrolledValue(next);
|
|
17
|
+
onValueChange?.(next);
|
|
18
|
+
},
|
|
19
|
+
[isControlled, onValueChange]
|
|
20
|
+
);
|
|
21
|
+
const context = React.useMemo(() => ({ value, select }), [value, select]);
|
|
22
|
+
return /* @__PURE__ */ jsx(TabsValueContext.Provider, { value: context, children: /* @__PURE__ */ jsx(TabsPrimitive.Root, { ref, value: value ?? "", onValueChange: select, ...props }) });
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
Tabs.displayName = "Tabs";
|
|
4
26
|
export {
|
|
5
|
-
|
|
27
|
+
OVERFLOW_TAB_VALUE,
|
|
28
|
+
Tabs,
|
|
29
|
+
TabsValueContext
|
|
6
30
|
};
|
|
7
31
|
//# sourceMappingURL=Tabs.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.mjs","sources":["../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["import * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport
|
|
1
|
+
{"version":3,"file":"Tabs.mjs","sources":["../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["import * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport * as React from \"react\";\n\n/**\n * Value a {@link TabsOverflow} tab carries while none of its items is active.\n * {@link Tabs} never reports or stores it, so focusing More under automatic\n * activation selects nothing.\n */\nexport const OVERFLOW_TAB_VALUE = \"fanvue-ui-tabs-overflow\";\n\n/** Props for the {@link Tabs} root component. Extends Radix `Tabs.Root` props. */\nexport type TabsProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.Root>;\n\n/**\n * Root container for a tabbed interface. Manages the active tab state and\n * coordinates {@link TabsList}, {@link TabsTrigger}, and {@link TabsContent}.\n *\n * Built on Radix UI `Tabs`.\n *\n * @example\n * ```tsx\n * <Tabs defaultValue=\"tab1\">\n * <TabsList>\n * <TabsTrigger value=\"tab1\">Tab 1</TabsTrigger>\n * <TabsTrigger value=\"tab2\">Tab 2</TabsTrigger>\n * </TabsList>\n * <TabsContent value=\"tab1\">Content 1</TabsContent>\n * <TabsContent value=\"tab2\">Content 2</TabsContent>\n * </Tabs>\n * ```\n */\nexport const TabsValueContext = React.createContext<{\n value: string | undefined;\n select: (value: string) => void;\n}>({ value: undefined, select: () => {} });\n\nexport const Tabs = React.forwardRef<React.ComponentRef<typeof TabsPrimitive.Root>, TabsProps>(\n ({ value: valueProp, defaultValue, onValueChange, ...props }, ref) => {\n const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue);\n const isControlled = valueProp !== undefined;\n const value = isControlled ? valueProp : uncontrolledValue;\n\n const select = React.useCallback(\n (next: string) => {\n if (next === OVERFLOW_TAB_VALUE) return;\n if (!isControlled) setUncontrolledValue(next);\n onValueChange?.(next);\n },\n [isControlled, onValueChange],\n );\n\n const context = React.useMemo(() => ({ value, select }), [value, select]);\n\n return (\n <TabsValueContext.Provider value={context}>\n <TabsPrimitive.Root ref={ref} value={value ?? \"\"} onValueChange={select} {...props} />\n </TabsValueContext.Provider>\n );\n },\n);\n\nTabs.displayName = \"Tabs\";\n"],"names":[],"mappings":";;;;AAQO,MAAM,qBAAqB;AAuB3B,MAAM,mBAAmB,MAAM,cAGnC,EAAE,OAAO,QAAW,QAAQ,MAAM;AAAC,EAAA,CAAG;AAElC,MAAM,OAAO,MAAM;AAAA,EACxB,CAAC,EAAE,OAAO,WAAW,cAAc,eAAe,GAAG,MAAA,GAAS,QAAQ;AACpE,UAAM,CAAC,mBAAmB,oBAAoB,IAAI,MAAM,SAAS,YAAY;AAC7E,UAAM,eAAe,cAAc;AACnC,UAAM,QAAQ,eAAe,YAAY;AAEzC,UAAM,SAAS,MAAM;AAAA,MACnB,CAAC,SAAiB;AAChB,YAAI,SAAS,mBAAoB;AACjC,YAAI,CAAC,aAAc,sBAAqB,IAAI;AAC5C,wBAAgB,IAAI;AAAA,MACtB;AAAA,MACA,CAAC,cAAc,aAAa;AAAA,IAAA;AAG9B,UAAM,UAAU,MAAM,QAAQ,OAAO,EAAE,OAAO,OAAA,IAAW,CAAC,OAAO,MAAM,CAAC;AAExE,+BACG,iBAAiB,UAAjB,EAA0B,OAAO,SAChC,8BAAC,cAAc,MAAd,EAAmB,KAAU,OAAO,SAAS,IAAI,eAAe,QAAS,GAAG,OAAO,GACtF;AAAA,EAEJ;AACF;AAEA,KAAK,cAAc;"}
|