@fanvue/ui 3.34.1 → 3.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/cjs/components/AiButton/AiButton.cjs +10 -4
- package/dist/cjs/components/AiButton/AiButton.cjs.map +1 -1
- package/dist/cjs/components/AudioPlayer/AudioPlayer.cjs +7 -5
- package/dist/cjs/components/AudioPlayer/AudioPlayer.cjs.map +1 -1
- package/dist/cjs/components/Icons/CogIcon.cjs +9 -9
- package/dist/cjs/components/Icons/CogIcon.cjs.map +1 -1
- package/dist/cjs/components/Select/Select.cjs +18 -6
- package/dist/cjs/components/Select/Select.cjs.map +1 -1
- package/dist/components/AiButton/AiButton.mjs +10 -4
- package/dist/components/AiButton/AiButton.mjs.map +1 -1
- package/dist/components/AudioPlayer/AudioPlayer.mjs +9 -7
- package/dist/components/AudioPlayer/AudioPlayer.mjs.map +1 -1
- package/dist/components/Icons/CogIcon.mjs +9 -9
- package/dist/components/Icons/CogIcon.mjs.map +1 -1
- package/dist/components/Select/Select.mjs +18 -6
- package/dist/components/Select/Select.mjs.map +1 -1
- package/dist/index.d.ts +9 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -204,10 +204,10 @@ pnpm storybook
|
|
|
204
204
|
|
|
205
205
|
To iterate on a component and see it live in eden (`local.fanvue.com`) without publishing:
|
|
206
206
|
|
|
207
|
-
- **Easiest:** from the pandora repo root, run `pnpm
|
|
208
|
-
- **Manual:** run `pnpm dev:watch` here, and start eden with `USE_LOCAL_FANVUE_UI=1` (or `pnpm --filter @pandora/eden start:
|
|
207
|
+
- **Easiest:** from the pandora repo root, run `pnpm start:localui`. It runs this library's watch build automatically and points eden at this checkout's `dist/`. See pandora's README ("Live-reloading `@fanvue/ui` from a local checkout"). Variants: `pnpm start:dev:localui` and `pnpm start:docker:localui` pick up the matching env files and handle AWS auth.
|
|
208
|
+
- **Manual:** run `pnpm dev:watch` here, and start eden with `USE_LOCAL_FANVUE_UI=1` (or `pnpm --filter @pandora/eden start:localui`).
|
|
209
209
|
|
|
210
|
-
Requires this repo checked out beside `pandora` (or `FANVUE_UI_PATH` set in pandora). Component markup
|
|
210
|
+
Requires this repo checked out beside `pandora` (or `FANVUE_UI_PATH` set in pandora). Component markup, Tailwind classes and design **tokens** all hot-reload: pandora's `eden/postcss.config.mjs` redirects the `@fanvue/ui/styles/theme.css` import to this checkout's `src/styles/theme.css`, so token edits show up without a published (pre)release.
|
|
211
211
|
|
|
212
212
|
## Figma + Storybook Integration
|
|
213
213
|
|
|
@@ -49,7 +49,11 @@ const ShimmerLabel = ({ text, shimmer }) => /* @__PURE__ */ jsxRuntime.jsx("span
|
|
|
49
49
|
"span",
|
|
50
50
|
{
|
|
51
51
|
className: cn.cn(
|
|
52
|
-
|
|
52
|
+
// `Content/Primary` is the resting label the design asks for, but the
|
|
53
|
+
// shimmer's keyframe peaks at that same colour, so a shimmering letter
|
|
54
|
+
// needs the dimmer base to sweep up from.
|
|
55
|
+
shimmer ? "text-content-secondary" : "text-content-primary",
|
|
56
|
+
"inline-block whitespace-pre",
|
|
53
57
|
// Gated in JS rather than with a `group-disabled/ai:` override, because
|
|
54
58
|
// that would rely on the generated rule ordering to beat `group-hover`.
|
|
55
59
|
// A faded control that still shimmers and still lights up green under the
|
|
@@ -106,14 +110,16 @@ const AiButton = React__namespace.forwardRef(
|
|
|
106
110
|
className: cn.cn(
|
|
107
111
|
"fv-ai-button",
|
|
108
112
|
"group/ai inline-flex cursor-pointer items-center justify-center whitespace-nowrap rounded-full",
|
|
109
|
-
|
|
113
|
+
// The mint AI surface the design fills this control with at rest, rather
|
|
114
|
+
// than the neutral chip it used to sit as until hovered.
|
|
115
|
+
"border border-buttons-ai-stroke-end bg-buttons-ai-default",
|
|
110
116
|
// Matched to the rim and sheen so the whole treatment arrives as one
|
|
111
117
|
// movement — at the old 300ms the outline landed ahead of the glow.
|
|
112
118
|
"transition-[background-color,border-color] duration-[400ms] ease-out",
|
|
113
|
-
"hover:border-brand-primary-default",
|
|
119
|
+
"hover:border-brand-primary-default hover:bg-buttons-ai-hover",
|
|
114
120
|
"focus-visible:outline-none",
|
|
115
121
|
"active:border-brand-primary-hover active:bg-brand-primary-muted",
|
|
116
|
-
"disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:border-
|
|
122
|
+
"disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:border-buttons-ai-stroke-end",
|
|
117
123
|
sizeVariants[size],
|
|
118
124
|
className
|
|
119
125
|
),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiButton.cjs","sources":["../../../../src/components/AiButton/AiButton.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { AIIcon } from \"../Icons/AIIcon\";\nimport type { IconSize } from \"../Icons/types\";\n\n/** Height, padding and label typography, matching {@link Button}'s scale. */\nexport type AiButtonSize = \"24\" | \"32\" | \"40\";\n\nconst sizeVariants: Record<AiButtonSize, string> = {\n // At 24 the label steps down to the 12px description scale: the 14px label\n // Button uses at this height leaves the glyph and text crowding a 24px box,\n // since 16px is the smallest authored icon geometry and cannot step down with it.\n \"24\": \"h-6 gap-1 px-2 py-1 typography-description-12px-semibold\",\n \"32\": \"h-8 gap-2 px-3 py-[7px] typography-body-small-14px-semibold\",\n \"40\": \"h-10 gap-2 px-4 py-2 typography-body-default-16px-semibold\",\n};\n\nconst iconSizeVariants: Record<AiButtonSize, IconSize> = {\n \"24\": 16,\n \"32\": 16,\n \"40\": 24,\n};\n\n/**\n * Optical size, applied on top of the authored geometry. Only 16, 24 and 32 have\n * dedicated paths, so the 24 button renders the 16px glyph down at 14 to sit with\n * its 12px label rather than towering over it.\n */\nconst iconScaleVariants: Record<AiButtonSize, string> = {\n \"24\": \"[&_svg]:size-3.5\",\n \"32\": \"\",\n \"40\": \"\",\n};\n\n/** Delay between adjacent letters, in seconds. */\nconst LETTER_STAGGER = 0.08;\n\n/**\n * Points the bottom sheen at the cursor by writing its x offset, as a percentage\n * of the button's width, straight to the DOM node. Deliberately not React state:\n * this fires every pointer-move frame, and a re-render per frame would both cost\n * more than the paint and leave the glow trailing the cursor.\n */\nconst trackPointer = (event: React.PointerEvent<HTMLButtonElement>) => {\n const { left, width } = event.currentTarget.getBoundingClientRect();\n event.currentTarget.style.setProperty(\"--fv-ai-x\", `${((event.clientX - left) / width) * 100}%`);\n};\n\n/** Props for {@link AiButton}. */\nexport interface AiButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"type\"> {\n /** Resting label. Also the accessible name unless `aria-label` is given. */\n label: string;\n /** Label shown while `active`. Falls back to {@link label}. */\n activeLabel?: string;\n /** Swap to {@link activeLabel} and keep the shimmer running. @default false */\n active?: boolean;\n /**\n * Shimmer and flicker while enabled and idle, inviting a click. Turn off when\n * several `AiButton`s sit side by side, so an idle one sits still and only the\n * `active` one reads as busy. @default true\n */\n idleShimmer?: boolean;\n /** @default \"32\" */\n size?: AiButtonSize;\n /** Replace the leading AI glyph. */\n icon?: React.ReactNode;\n /** @default \"button\" */\n type?: \"button\" | \"submit\" | \"reset\";\n}\n\n/**\n * Renders one `<span>` per character so each can carry its own animation delay.\n * The run is hidden from assistive tech — the button's accessible name comes from\n * its `aria-label`, so a screen reader says \"Analyse\" rather than spelling it out.\n */\nconst ShimmerLabel: React.FC<{ text: string; shimmer: boolean }> = ({ text, shimmer }) => (\n <span aria-hidden=\"true\">\n {Array.from(text).map((character, index) => (\n <span\n key={`${character}-${index}`}\n className={cn(\n \"inline-block whitespace-pre text-content-secondary\",\n // Gated in JS rather than with a `group-disabled/ai:` override, because\n // that would rely on the generated rule ordering to beat `group-hover`.\n // A faded control that still shimmers and still lights up green under the\n // cursor reads as busy rather than unavailable.\n shimmer && [\n \"[animation:fv-ai-letter_2s_ease-in-out_infinite]\",\n \"group-hover/ai:text-content-primary group-hover/ai:[animation:none]\",\n // On focus each letter blows up and settles, then the idle shimmer\n // resumes underneath it — the two animations are sequenced by delay.\n \"group-focus-visible/ai:[animation:fv-ai-letter-focus_1s_ease-in-out,fv-ai-letter_1.2s_ease-in-out_infinite_1s]\",\n \"group-active/ai:text-content-primary group-active/ai:[animation:none]\",\n \"group-active/ai:[text-shadow:0_0_4px_var(--color-content-primary)]\",\n ],\n \"motion-reduce:[animation:none]\",\n )}\n style={{ animationDelay: `${index * LETTER_STAGGER}s` }}\n >\n {character}\n </span>\n ))}\n </span>\n);\n\n/**\n * A pill button for AI actions. The label shimmers letter by letter and the glyph\n * flickers at rest; on hover both settle and the green treatment eases in together\n * — outline, rim and a sheen pooling along the bottom edge under the cursor, which\n * follows it across the button. On focus each letter blooms once before the shimmer\n * resumes. The lit rim and sheen come from the `fv-ai-button` utility in `base.css`.\n *\n * It shares {@link Button}'s geometry — `rounded-full`, the same heights and label\n * typography — so it sits alongside one without looking foreign. Both labels are\n * rendered stacked in a single grid cell, so swapping to `active` crossfades\n * without the button changing width.\n *\n * Honours `prefers-reduced-motion`: the shimmer and flicker are dropped and the\n * label renders in its settled state.\n *\n * Set `idleShimmer={false}` when several `AiButton`s sit side by side, so an\n * idle one sits still and the shimmer reads as \"this one is genuinely busy\"\n * rather than \"any of these could be clicked\".\n *\n * @example\n * ```tsx\n * <AiButton label=\"Analyse\" activeLabel=\"Analysing\" active={isPending} onClick={run} />\n * ```\n */\nexport const AiButton = React.forwardRef<HTMLButtonElement, AiButtonProps>(\n (\n {\n label,\n activeLabel,\n active = false,\n idleShimmer = true,\n size = \"32\",\n icon,\n type = \"button\",\n className,\n disabled,\n onPointerMove,\n onPointerLeave,\n ...props\n },\n ref,\n ) => {\n const resolvedActiveLabel = activeLabel ?? label;\n const shimmer = !disabled && (idleShimmer || active);\n\n return (\n <button\n ref={ref}\n type={type}\n disabled={disabled}\n aria-label={props[\"aria-label\"] ?? (active ? resolvedActiveLabel : label)}\n aria-busy={active || undefined}\n onPointerMove={(event) => {\n trackPointer(event);\n onPointerMove?.(event);\n }}\n // Drop back to the utility's centred default, so a keyboard focus after\n // the pointer has left does not light up wherever the cursor last was.\n onPointerLeave={(event) => {\n event.currentTarget.style.removeProperty(\"--fv-ai-x\");\n onPointerLeave?.(event);\n }}\n className={cn(\n \"fv-ai-button\",\n \"group/ai inline-flex cursor-pointer items-center justify-center whitespace-nowrap rounded-full\",\n \"border border-border-primary bg-background-primary\",\n // Matched to the rim and sheen so the whole treatment arrives as one\n // movement — at the old 300ms the outline landed ahead of the glow.\n \"transition-[background-color,border-color] duration-[400ms] ease-out\",\n \"hover:border-brand-primary-default\",\n \"focus-visible:outline-none\",\n \"active:border-brand-primary-hover active:bg-brand-primary-muted\",\n \"disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:border-border-primary\",\n sizeVariants[size],\n className,\n )}\n {...props}\n >\n <span\n className={cn(\n \"flex shrink-0 items-center text-content-primary\",\n iconScaleVariants[size],\n \"[filter:drop-shadow(0_0_2px_color-mix(in_srgb,var(--color-content-primary)_60%,transparent))]\",\n // Same reasoning as the letters: no flicker and no green lift once the\n // button is unavailable or shimmer is turned off for this instance.\n shimmer && [\n \"[animation-delay:0.5s] [animation:fv-ai-flicker_2s_linear_infinite]\",\n // Settles solid on hover, lit green from below like the sheen.\n \"group-hover/ai:[animation:none]\",\n \"group-hover/ai:[filter:drop-shadow(0_0_3px_var(--color-brand-primary-default))_drop-shadow(0_-4px_6px_color-mix(in_srgb,var(--color-content-always-black)_60%,transparent))]\",\n \"group-focus-visible/ai:[animation-delay:0.2s] group-focus-visible/ai:[animation-duration:1.2s]\",\n ],\n \"motion-reduce:[animation:none]\",\n )}\n >\n {icon ?? <AIIcon size={iconSizeVariants[size]} filled />}\n </span>\n {/* Both labels occupy one grid cell so the button keeps the width of the\n longer of the two and the swap never reflows the row around it. */}\n <span className=\"grid\">\n <span\n className={cn(\n \"col-start-1 row-start-1 transition-opacity duration-300\",\n active ? \"opacity-0\" : \"opacity-100\",\n )}\n >\n <ShimmerLabel text={label} shimmer={shimmer} />\n </span>\n <span\n className={cn(\n \"col-start-1 row-start-1 transition-opacity duration-300\",\n active ? \"opacity-100\" : \"opacity-0\",\n )}\n >\n <ShimmerLabel text={resolvedActiveLabel} shimmer={shimmer} />\n </span>\n </span>\n </button>\n );\n },\n);\n\nAiButton.displayName = \"AiButton\";\n"],"names":["jsx","cn","React","jsxs","AIIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM,eAA6C;AAAA;AAAA;AAAA;AAAA,EAIjD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,mBAAmD;AAAA,EACvD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAOA,MAAM,oBAAkD;AAAA,EACtD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAGA,MAAM,iBAAiB;AAQvB,MAAM,eAAe,CAAC,UAAiD;AACrE,QAAM,EAAE,MAAM,MAAA,IAAU,MAAM,cAAc,sBAAA;AAC5C,QAAM,cAAc,MAAM,YAAY,aAAa,IAAK,MAAM,UAAU,QAAQ,QAAS,GAAG,GAAG;AACjG;AA6BA,MAAM,eAA6D,CAAC,EAAE,MAAM,QAAA,MAC1EA,+BAAC,QAAA,EAAK,eAAY,QACf,gBAAM,KAAK,IAAI,EAAE,IAAI,CAAC,WAAW,UAChCA,2BAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IAEC,WAAWC,GAAAA;AAAAA,MACT;AAAA;AAAA;AAAA;AAAA;AAAA,MAKA,WAAW;AAAA,QACT;AAAA,QACA;AAAA;AAAA;AAAA,QAGA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,MAEF;AAAA,IAAA;AAAA,IAEF,OAAO,EAAE,gBAAgB,GAAG,QAAQ,cAAc,IAAA;AAAA,IAEjD,UAAA;AAAA,EAAA;AAAA,EApBI,GAAG,SAAS,IAAI,KAAK;AAqB5B,CACD,GACH;AA2BK,MAAM,WAAWC,iBAAM;AAAA,EAC5B,CACE;AAAA,IACE;AAAA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AAA;AAAA,gBACC,WAAWC,GAAAA;AAAAA,kBACT;AAAA,kBACA,SAAS,cAAc;AAAA,gBAAA;AAAA,gBAGzB,UAAAD,2BAAAA,IAAC,cAAA,EAAa,MAAM,OAAO,QAAA,CAAkB;AAAA,cAAA;AAAA,YAAA;AAAA,YAE/CA,2BAAAA;AAAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAWC,GAAAA;AAAAA,kBACT;AAAA,kBACA,SAAS,gBAAgB;AAAA,gBAAA;AAAA,gBAG3B,UAAAD,2BAAAA,IAAC,cAAA,EAAa,MAAM,qBAAqB,QAAA,CAAkB;AAAA,cAAA;AAAA,YAAA;AAAA,UAC7D,EAAA,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,SAAS,cAAc;;"}
|
|
1
|
+
{"version":3,"file":"AiButton.cjs","sources":["../../../../src/components/AiButton/AiButton.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { AIIcon } from \"../Icons/AIIcon\";\nimport type { IconSize } from \"../Icons/types\";\n\n/** Height, padding and label typography, matching {@link Button}'s scale. */\nexport type AiButtonSize = \"24\" | \"32\" | \"40\";\n\nconst sizeVariants: Record<AiButtonSize, string> = {\n // At 24 the label steps down to the 12px description scale: the 14px label\n // Button uses at this height leaves the glyph and text crowding a 24px box,\n // since 16px is the smallest authored icon geometry and cannot step down with it.\n \"24\": \"h-6 gap-1 px-2 py-1 typography-description-12px-semibold\",\n \"32\": \"h-8 gap-2 px-3 py-[7px] typography-body-small-14px-semibold\",\n \"40\": \"h-10 gap-2 px-4 py-2 typography-body-default-16px-semibold\",\n};\n\nconst iconSizeVariants: Record<AiButtonSize, IconSize> = {\n \"24\": 16,\n \"32\": 16,\n \"40\": 24,\n};\n\n/**\n * Optical size, applied on top of the authored geometry. Only 16, 24 and 32 have\n * dedicated paths, so the 24 button renders the 16px glyph down at 14 to sit with\n * its 12px label rather than towering over it.\n */\nconst iconScaleVariants: Record<AiButtonSize, string> = {\n \"24\": \"[&_svg]:size-3.5\",\n \"32\": \"\",\n \"40\": \"\",\n};\n\n/** Delay between adjacent letters, in seconds. */\nconst LETTER_STAGGER = 0.08;\n\n/**\n * Points the bottom sheen at the cursor by writing its x offset, as a percentage\n * of the button's width, straight to the DOM node. Deliberately not React state:\n * this fires every pointer-move frame, and a re-render per frame would both cost\n * more than the paint and leave the glow trailing the cursor.\n */\nconst trackPointer = (event: React.PointerEvent<HTMLButtonElement>) => {\n const { left, width } = event.currentTarget.getBoundingClientRect();\n event.currentTarget.style.setProperty(\"--fv-ai-x\", `${((event.clientX - left) / width) * 100}%`);\n};\n\n/** Props for {@link AiButton}. */\nexport interface AiButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"type\"> {\n /** Resting label. Also the accessible name unless `aria-label` is given. */\n label: string;\n /** Label shown while `active`. Falls back to {@link label}. */\n activeLabel?: string;\n /** Swap to {@link activeLabel} and keep the shimmer running. @default false */\n active?: boolean;\n /**\n * Shimmer and flicker while enabled and idle, inviting a click. Turn off when\n * several `AiButton`s sit side by side, so an idle one sits still and only the\n * `active` one reads as busy. @default true\n */\n idleShimmer?: boolean;\n /** @default \"32\" */\n size?: AiButtonSize;\n /** Replace the leading AI glyph. */\n icon?: React.ReactNode;\n /** @default \"button\" */\n type?: \"button\" | \"submit\" | \"reset\";\n}\n\n/**\n * Renders one `<span>` per character so each can carry its own animation delay.\n * The run is hidden from assistive tech — the button's accessible name comes from\n * its `aria-label`, so a screen reader says \"Analyse\" rather than spelling it out.\n */\nconst ShimmerLabel: React.FC<{ text: string; shimmer: boolean }> = ({ text, shimmer }) => (\n <span aria-hidden=\"true\">\n {Array.from(text).map((character, index) => (\n <span\n key={`${character}-${index}`}\n className={cn(\n // `Content/Primary` is the resting label the design asks for, but the\n // shimmer's keyframe peaks at that same colour, so a shimmering letter\n // needs the dimmer base to sweep up from.\n shimmer ? \"text-content-secondary\" : \"text-content-primary\",\n \"inline-block whitespace-pre\",\n // Gated in JS rather than with a `group-disabled/ai:` override, because\n // that would rely on the generated rule ordering to beat `group-hover`.\n // A faded control that still shimmers and still lights up green under the\n // cursor reads as busy rather than unavailable.\n shimmer && [\n \"[animation:fv-ai-letter_2s_ease-in-out_infinite]\",\n \"group-hover/ai:text-content-primary group-hover/ai:[animation:none]\",\n // On focus each letter blows up and settles, then the idle shimmer\n // resumes underneath it — the two animations are sequenced by delay.\n \"group-focus-visible/ai:[animation:fv-ai-letter-focus_1s_ease-in-out,fv-ai-letter_1.2s_ease-in-out_infinite_1s]\",\n \"group-active/ai:text-content-primary group-active/ai:[animation:none]\",\n \"group-active/ai:[text-shadow:0_0_4px_var(--color-content-primary)]\",\n ],\n \"motion-reduce:[animation:none]\",\n )}\n style={{ animationDelay: `${index * LETTER_STAGGER}s` }}\n >\n {character}\n </span>\n ))}\n </span>\n);\n\n/**\n * A pill button for AI actions. The label shimmers letter by letter and the glyph\n * flickers at rest; on hover both settle and the green treatment eases in together\n * — outline, rim and a sheen pooling along the bottom edge under the cursor, which\n * follows it across the button. On focus each letter blooms once before the shimmer\n * resumes. The lit rim and sheen come from the `fv-ai-button` utility in `base.css`.\n *\n * It shares {@link Button}'s geometry — `rounded-full`, the same heights and label\n * typography — so it sits alongside one without looking foreign. Both labels are\n * rendered stacked in a single grid cell, so swapping to `active` crossfades\n * without the button changing width.\n *\n * Honours `prefers-reduced-motion`: the shimmer and flicker are dropped and the\n * label renders in its settled state.\n *\n * Set `idleShimmer={false}` when several `AiButton`s sit side by side, so an\n * idle one sits still and the shimmer reads as \"this one is genuinely busy\"\n * rather than \"any of these could be clicked\".\n *\n * @example\n * ```tsx\n * <AiButton label=\"Analyse\" activeLabel=\"Analysing\" active={isPending} onClick={run} />\n * ```\n */\nexport const AiButton = React.forwardRef<HTMLButtonElement, AiButtonProps>(\n (\n {\n label,\n activeLabel,\n active = false,\n idleShimmer = true,\n size = \"32\",\n icon,\n type = \"button\",\n className,\n disabled,\n onPointerMove,\n onPointerLeave,\n ...props\n },\n ref,\n ) => {\n const resolvedActiveLabel = activeLabel ?? label;\n const shimmer = !disabled && (idleShimmer || active);\n\n return (\n <button\n ref={ref}\n type={type}\n disabled={disabled}\n aria-label={props[\"aria-label\"] ?? (active ? resolvedActiveLabel : label)}\n aria-busy={active || undefined}\n onPointerMove={(event) => {\n trackPointer(event);\n onPointerMove?.(event);\n }}\n // Drop back to the utility's centred default, so a keyboard focus after\n // the pointer has left does not light up wherever the cursor last was.\n onPointerLeave={(event) => {\n event.currentTarget.style.removeProperty(\"--fv-ai-x\");\n onPointerLeave?.(event);\n }}\n className={cn(\n \"fv-ai-button\",\n \"group/ai inline-flex cursor-pointer items-center justify-center whitespace-nowrap rounded-full\",\n // The mint AI surface the design fills this control with at rest, rather\n // than the neutral chip it used to sit as until hovered.\n \"border border-buttons-ai-stroke-end bg-buttons-ai-default\",\n // Matched to the rim and sheen so the whole treatment arrives as one\n // movement — at the old 300ms the outline landed ahead of the glow.\n \"transition-[background-color,border-color] duration-[400ms] ease-out\",\n \"hover:border-brand-primary-default hover:bg-buttons-ai-hover\",\n \"focus-visible:outline-none\",\n \"active:border-brand-primary-hover active:bg-brand-primary-muted\",\n \"disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:border-buttons-ai-stroke-end\",\n sizeVariants[size],\n className,\n )}\n {...props}\n >\n <span\n className={cn(\n \"flex shrink-0 items-center text-content-primary\",\n iconScaleVariants[size],\n \"[filter:drop-shadow(0_0_2px_color-mix(in_srgb,var(--color-content-primary)_60%,transparent))]\",\n // Same reasoning as the letters: no flicker and no green lift once the\n // button is unavailable or shimmer is turned off for this instance.\n shimmer && [\n \"[animation-delay:0.5s] [animation:fv-ai-flicker_2s_linear_infinite]\",\n // Settles solid on hover, lit green from below like the sheen.\n \"group-hover/ai:[animation:none]\",\n \"group-hover/ai:[filter:drop-shadow(0_0_3px_var(--color-brand-primary-default))_drop-shadow(0_-4px_6px_color-mix(in_srgb,var(--color-content-always-black)_60%,transparent))]\",\n \"group-focus-visible/ai:[animation-delay:0.2s] group-focus-visible/ai:[animation-duration:1.2s]\",\n ],\n \"motion-reduce:[animation:none]\",\n )}\n >\n {icon ?? <AIIcon size={iconSizeVariants[size]} filled />}\n </span>\n {/* Both labels occupy one grid cell so the button keeps the width of the\n longer of the two and the swap never reflows the row around it. */}\n <span className=\"grid\">\n <span\n className={cn(\n \"col-start-1 row-start-1 transition-opacity duration-300\",\n active ? \"opacity-0\" : \"opacity-100\",\n )}\n >\n <ShimmerLabel text={label} shimmer={shimmer} />\n </span>\n <span\n className={cn(\n \"col-start-1 row-start-1 transition-opacity duration-300\",\n active ? \"opacity-100\" : \"opacity-0\",\n )}\n >\n <ShimmerLabel text={resolvedActiveLabel} shimmer={shimmer} />\n </span>\n </span>\n </button>\n );\n },\n);\n\nAiButton.displayName = \"AiButton\";\n"],"names":["jsx","cn","React","jsxs","AIIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM,eAA6C;AAAA;AAAA;AAAA;AAAA,EAIjD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,mBAAmD;AAAA,EACvD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAOA,MAAM,oBAAkD;AAAA,EACtD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAGA,MAAM,iBAAiB;AAQvB,MAAM,eAAe,CAAC,UAAiD;AACrE,QAAM,EAAE,MAAM,MAAA,IAAU,MAAM,cAAc,sBAAA;AAC5C,QAAM,cAAc,MAAM,YAAY,aAAa,IAAK,MAAM,UAAU,QAAQ,QAAS,GAAG,GAAG;AACjG;AA6BA,MAAM,eAA6D,CAAC,EAAE,MAAM,QAAA,MAC1EA,+BAAC,QAAA,EAAK,eAAY,QACf,gBAAM,KAAK,IAAI,EAAE,IAAI,CAAC,WAAW,UAChCA,2BAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IAEC,WAAWC,GAAA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,YAAC;AAAA,YAAA;AAAA,cACC,WAAWC,GAAAA;AAAAA,gBACT;AAAA,gBACA,kBAAkB,IAAI;AAAA,gBACtB;AAAA;AAAA;AAAA,gBAGA,WAAW;AAAA,kBACT;AAAA;AAAA,kBAEA;AAAA,kBACA;AAAA,kBACA;AAAA,gBAAA;AAAA,gBAEF;AAAA,cAAA;AAAA,cAGD,UAAA,uCAASG,eAAA,EAAO,MAAM,iBAAiB,IAAI,GAAG,QAAM,KAAA,CAAC;AAAA,YAAA;AAAA,UAAA;AAAA,UAIxDD,2BAAAA,KAAC,QAAA,EAAK,WAAU,QACd,UAAA;AAAA,YAAAH,2BAAAA;AAAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAWC,GAAAA;AAAAA,kBACT;AAAA,kBACA,SAAS,cAAc;AAAA,gBAAA;AAAA,gBAGzB,UAAAD,2BAAAA,IAAC,cAAA,EAAa,MAAM,OAAO,QAAA,CAAkB;AAAA,cAAA;AAAA,YAAA;AAAA,YAE/CA,2BAAAA;AAAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAWC,GAAAA;AAAAA,kBACT;AAAA,kBACA,SAAS,gBAAgB;AAAA,gBAAA;AAAA,gBAG3B,UAAAD,2BAAAA,IAAC,cAAA,EAAa,MAAM,qBAAqB,QAAA,CAAkB;AAAA,cAAA;AAAA,YAAA;AAAA,UAC7D,EAAA,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,SAAS,cAAc;;"}
|
|
@@ -181,6 +181,8 @@ const AudioPlayer = React__namespace.forwardRef(
|
|
|
181
181
|
break;
|
|
182
182
|
}
|
|
183
183
|
};
|
|
184
|
+
const totalLabel = audioWaveform.formatTime(displayDuration);
|
|
185
|
+
const elapsedLabel = audioWaveform.formatTime(currentTime).padStart(totalLabel.length, "0");
|
|
184
186
|
const bars = audioWaveform.resamplePeaks(peaks, barCount);
|
|
185
187
|
const progressFraction = displayDuration && displayDuration > 0 ? Math.min(Math.max(currentTime / displayDuration, 0), 1) : 0;
|
|
186
188
|
const playedBarCount = hasStarted ? Math.round(progressFraction * bars.length) : bars.length;
|
|
@@ -244,13 +246,13 @@ const AudioPlayer = React__namespace.forwardRef(
|
|
|
244
246
|
))
|
|
245
247
|
}
|
|
246
248
|
),
|
|
247
|
-
/* @__PURE__ */ jsxRuntime.
|
|
248
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-content-primary", children:
|
|
249
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-content-secondary", children: [
|
|
249
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "typography-body-small-14px-semibold flex shrink-0 items-center gap-0.5 whitespace-nowrap tabular-nums", children: [
|
|
250
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-content-primary", children: hasStarted ? elapsedLabel : totalLabel }),
|
|
251
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: cn.cn("text-content-secondary", !hasStarted && "invisible"), children: [
|
|
250
252
|
"/",
|
|
251
|
-
|
|
253
|
+
totalLabel
|
|
252
254
|
] })
|
|
253
|
-
] })
|
|
255
|
+
] })
|
|
254
256
|
] }),
|
|
255
257
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
256
258
|
"audio",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AudioPlayer.cjs","sources":["../../../../src/components/AudioPlayer/AudioPlayer.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n decodeAudioPeaks,\n formatTime,\n generateFallbackPeaks,\n RAW_PEAK_COUNT,\n resamplePeaks,\n} from \"../../utils/audioWaveform\";\nimport { cn } from \"../../utils/cn\";\nimport { useFittedBarCount } from \"../../utils/useFittedBarCount\";\nimport { PauseIcon } from \"../Icons/PauseIcon\";\nimport { PlayIcon } from \"../Icons/PlayIcon\";\n\n/** Width of a single waveform bar, in pixels. */\nconst BAR_WIDTH_PX = 4;\n/** Gap between waveform bars, in pixels. */\nconst BAR_GAP_PX = 4;\n/** Shortest a waveform bar can render, in pixels. */\nconst MIN_BAR_HEIGHT_PX = 4;\n/** Tallest a waveform bar can render, in pixels — matches the 40px row height. */\nconst MAX_BAR_HEIGHT_PX = 26;\n/** Bar count used before the container has been measured (e.g. during SSR or in jsdom, where layout is unavailable). */\nconst DEFAULT_BAR_COUNT = 24;\n/** Seconds moved per Arrow key press while seeking. */\nconst SEEK_STEP_SECONDS = 1;\n/** Seconds moved per Page Up/Down press while seeking. */\nconst SEEK_STEP_LARGE_SECONDS = 5;\n\n/** Height of the audio player row, in pixels. Matches both the Vault card overlay and the \"Generated Audio\" modal row in Figma — both use an identical 32px play button and 40px row. */\nexport type AudioPlayerSize = \"40\";\n\nexport interface AudioPlayerProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onPlay\" | \"onPause\" | \"onEnded\"> {\n /** URL of the audio file to play. */\n src: string;\n /**\n * Total duration in seconds, used to render the timestamp before the\n * media's own metadata has loaded (and as a fallback if it never does).\n */\n duration?: number;\n /**\n * Whether playback is active (controlled). Note: once `onEnded` fires, the\n * browser has already stopped native playback. To loop or replay under\n * controlled usage, toggle this prop `false` then `true` (rather than\n * leaving it `true`) — the sync effect only calls `play()` again when this\n * value actually changes.\n */\n playing?: boolean;\n /** Initial playback state (uncontrolled). @default false */\n defaultPlaying?: boolean;\n /** Called when playback starts. */\n onPlay?: () => void;\n /** Called when playback is paused. */\n onPause?: () => void;\n /** Called when playback reaches the end of the media. */\n onEnded?: () => void;\n /** Height of the player row, in pixels. @default \"40\" */\n size?: AudioPlayerSize;\n}\n\n/**\n * A compact playback control for a single audio clip: a play/pause toggle, a\n * static amplitude waveform that doubles as a seek scrubber, and elapsed/total\n * timestamps. Designed to sit as an overlay on media thumbnails (Vault cards)\n * as well as inline rows (the AI Voice Message \"Generated Audio\" row).\n *\n * The waveform is seeded from the decoded audio when possible, falling back\n * to a deterministic (not random) placeholder derived from `src` so the\n * result is stable across renders, SSR, and Chromatic snapshots.\n *\n * @example\n * ```tsx\n * <AudioPlayer src=\"https://example.com/clip.mp3\" duration={5} />\n * ```\n */\nexport const AudioPlayer = React.forwardRef<HTMLDivElement, AudioPlayerProps>(\n (\n {\n className,\n src,\n duration,\n playing: controlledPlaying,\n defaultPlaying = false,\n onPlay,\n onPause,\n onEnded,\n size = \"40\",\n ...props\n },\n ref,\n ) => {\n const audioRef = React.useRef<HTMLAudioElement>(null);\n const trackRef = React.useRef<HTMLDivElement>(null);\n\n const [internalPlaying, setInternalPlaying] = React.useState(defaultPlaying);\n const isControlled = controlledPlaying !== undefined;\n const playing = isControlled ? controlledPlaying : internalPlaying;\n\n const [currentTime, setCurrentTime] = React.useState(0);\n const [mediaDuration, setMediaDuration] = React.useState<number | undefined>(undefined);\n const barCount = useFittedBarCount(trackRef, {\n barWidthPx: BAR_WIDTH_PX,\n gapPx: BAR_GAP_PX,\n fallback: DEFAULT_BAR_COUNT,\n });\n const [peaks, setPeaks] = React.useState<number[]>(() =>\n generateFallbackPeaks(src, RAW_PEAK_COUNT),\n );\n const [isDragging, setIsDragging] = React.useState(false);\n\n const displayDuration = mediaDuration ?? duration;\n const hasStarted = playing || currentTime > 0;\n\n // Latest-value refs so the src-change effect below can react to a src swap\n // without re-running whenever `playing`/`isControlled`/`onPause` change.\n const playingRef = React.useRef(playing);\n playingRef.current = playing;\n const isControlledRef = React.useRef(isControlled);\n isControlledRef.current = isControlled;\n const onPauseRef = React.useRef(onPause);\n onPauseRef.current = onPause;\n\n // Reset transient playback state when the source changes. Skips the\n // initial mount (there's nothing to reset yet) and, if playback was\n // active, stops it — the browser silently drops playback on a source\n // swap, so the UI (and any controlled parent) must be told via onPause.\n const isFirstSrcRenderRef = React.useRef(true);\n React.useEffect(() => {\n if (isFirstSrcRenderRef.current) {\n isFirstSrcRenderRef.current = false;\n return;\n }\n setCurrentTime(0);\n setMediaDuration(undefined);\n setPeaks(generateFallbackPeaks(src, RAW_PEAK_COUNT));\n if (playingRef.current) {\n if (!isControlledRef.current) setInternalPlaying(false);\n onPauseRef.current?.();\n }\n }, [src]);\n\n // Decode the audio to derive real waveform amplitudes, falling back to a\n // deterministic placeholder on any failure (network, CORS, unsupported format).\n React.useEffect(() => {\n let cancelled = false;\n const abortController = new AbortController();\n\n decodeAudioPeaks(src, abortController.signal)\n .then((decodedPeaks) => {\n if (!cancelled) setPeaks(decodedPeaks);\n })\n .catch(() => {\n if (!cancelled) setPeaks(generateFallbackPeaks(src, RAW_PEAK_COUNT));\n });\n\n return () => {\n cancelled = true;\n abortController.abort();\n };\n }, [src]);\n\n // Sync the controlled/uncontrolled `playing` state to the media element.\n React.useEffect(() => {\n const audio = audioRef.current;\n if (!audio) return;\n if (playing) {\n audio.play().catch(() => {\n if (!isControlled) setInternalPlaying(false);\n onPauseRef.current?.();\n });\n } else {\n audio.pause();\n }\n }, [playing, isControlled]);\n\n const handleToggle = () => {\n const next = !playing;\n if (!isControlled) setInternalPlaying(next);\n if (next) onPlay?.();\n else onPause?.();\n };\n\n const seekTo = React.useCallback(\n (time: number) => {\n if (displayDuration === undefined) return;\n const clamped = Math.min(Math.max(time, 0), displayDuration);\n setCurrentTime(clamped);\n const audio = audioRef.current;\n if (audio) audio.currentTime = clamped;\n },\n [displayDuration],\n );\n\n const seekFromClientX = React.useCallback(\n (clientX: number) => {\n const track = trackRef.current;\n if (!track || displayDuration === undefined) return;\n const rect = track.getBoundingClientRect();\n if (rect.width <= 0) return;\n const fraction = Math.min(Math.max((clientX - rect.left) / rect.width, 0), 1);\n seekTo(fraction * displayDuration);\n },\n [displayDuration, seekTo],\n );\n\n // Track drag outside the element via window listeners rather than pointer\n // capture, which some environments (and jsdom) don't fully implement.\n React.useEffect(() => {\n if (!isDragging) return;\n const handleWindowPointerMove = (event: PointerEvent) => seekFromClientX(event.clientX);\n const handleWindowPointerUp = () => setIsDragging(false);\n window.addEventListener(\"pointermove\", handleWindowPointerMove);\n window.addEventListener(\"pointerup\", handleWindowPointerUp);\n return () => {\n window.removeEventListener(\"pointermove\", handleWindowPointerMove);\n window.removeEventListener(\"pointerup\", handleWindowPointerUp);\n };\n }, [isDragging, seekFromClientX]);\n\n const handlePointerDown = (event: React.PointerEvent<HTMLDivElement>) => {\n seekFromClientX(event.clientX);\n setIsDragging(true);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (displayDuration === undefined) return;\n switch (event.key) {\n case \"ArrowRight\":\n case \"ArrowUp\":\n event.preventDefault();\n seekTo(currentTime + SEEK_STEP_SECONDS);\n break;\n case \"ArrowLeft\":\n case \"ArrowDown\":\n event.preventDefault();\n seekTo(currentTime - SEEK_STEP_SECONDS);\n break;\n case \"PageUp\":\n event.preventDefault();\n seekTo(currentTime + SEEK_STEP_LARGE_SECONDS);\n break;\n case \"PageDown\":\n event.preventDefault();\n seekTo(currentTime - SEEK_STEP_LARGE_SECONDS);\n break;\n case \"Home\":\n event.preventDefault();\n seekTo(0);\n break;\n case \"End\":\n event.preventDefault();\n seekTo(displayDuration);\n break;\n default:\n break;\n }\n };\n\n const bars = resamplePeaks(peaks, barCount);\n const progressFraction =\n displayDuration && displayDuration > 0\n ? Math.min(Math.max(currentTime / displayDuration, 0), 1)\n : 0;\n const playedBarCount = hasStarted ? Math.round(progressFraction * bars.length) : bars.length;\n const barData = bars.map((amplitude, index) => {\n const isPlayed = index < playedBarCount;\n return {\n heightPx: MIN_BAR_HEIGHT_PX + amplitude * (MAX_BAR_HEIGHT_PX - MIN_BAR_HEIGHT_PX),\n className: cn(\n \"w-1 shrink-0 rounded-3xs bg-messages-waveform-default\",\n \"motion-safe:transition-opacity motion-safe:duration-150 motion-safe:ease-in-out\",\n isPlayed ? \"opacity-100\" : \"opacity-50\",\n ),\n };\n });\n\n return (\n <div\n ref={ref}\n data-size={size}\n className={cn(\"flex w-full items-center gap-3\", className)}\n {...props}\n >\n <button\n type=\"button\"\n onClick={handleToggle}\n aria-label={playing ? \"Pause\" : \"Play\"}\n className={cn(\n \"flex size-8 shrink-0 items-center justify-center rounded-full\",\n \"bg-buttons-secondary-default text-icons-primary backdrop-blur-[40px]\",\n \"motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-in-out\",\n \"hover:bg-buttons-secondary-hover\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n )}\n >\n {playing ? <PauseIcon size={16} filled /> : <PlayIcon size={16} filled />}\n </button>\n\n <div className=\"flex min-w-0 flex-1 items-center gap-3\">\n <div\n ref={trackRef}\n role=\"slider\"\n tabIndex={0}\n aria-label=\"Seek\"\n aria-orientation=\"horizontal\"\n aria-valuemin={0}\n aria-valuemax={displayDuration}\n aria-valuenow={Math.round(currentTime)}\n aria-valuetext={\n displayDuration !== undefined\n ? `${formatTime(currentTime)} of ${formatTime(displayDuration)}`\n : formatTime(currentTime)\n }\n onPointerDown={handlePointerDown}\n onKeyDown={handleKeyDown}\n className={cn(\n \"flex h-10 min-w-0 flex-1 cursor-pointer touch-none select-none items-center gap-1 overflow-hidden\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n )}\n >\n {barData.map((bar, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: bars are a fixed-count, non-reorderable list\n <span key={index} className={bar.className} style={{ height: bar.heightPx }} />\n ))}\n </div>\n\n <span className=\"typography-body-small-14px-semibold flex shrink-0 items-center gap-0.5 whitespace-nowrap\">\n {hasStarted ? (\n <>\n <span className=\"text-content-primary\">{formatTime(currentTime)}</span>\n <span className=\"text-content-secondary\">/{formatTime(displayDuration)}</span>\n </>\n ) : (\n <span className=\"text-content-primary\">{formatTime(displayDuration)}</span>\n )}\n </span>\n </div>\n\n {/* biome-ignore lint/a11y/useMediaCaption: this is a UI sound clip (voice note / short recording), not spoken/narrated content requiring captions. */}\n <audio\n ref={audioRef}\n src={src}\n preload=\"metadata\"\n className=\"hidden\"\n onLoadedMetadata={(event) => {\n const { duration: nativeDuration } = event.currentTarget;\n setMediaDuration(Number.isFinite(nativeDuration) ? nativeDuration : undefined);\n }}\n onTimeUpdate={(event) => {\n if (isDragging) return;\n setCurrentTime(event.currentTarget.currentTime);\n }}\n onEnded={() => {\n setCurrentTime(0);\n if (!isControlled) setInternalPlaying(false);\n onEnded?.();\n }}\n />\n </div>\n );\n },\n);\n\nAudioPlayer.displayName = \"AudioPlayer\";\n"],"names":["React","useFittedBarCount","generateFallbackPeaks","RAW_PEAK_COUNT","decodeAudioPeaks","resamplePeaks","cn","jsxs","jsx","PauseIcon","PlayIcon","formatTime","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAM,eAAe;AAErB,MAAM,aAAa;AAEnB,MAAM,oBAAoB;AAE1B,MAAM,oBAAoB;AAE1B,MAAM,oBAAoB;AAE1B,MAAM,oBAAoB;AAE1B,MAAM,0BAA0B;AAiDzB,MAAM,cAAcA,iBAAM;AAAA,EAC/B,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,iBAAiB;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,WAAWA,iBAAM,OAAyB,IAAI;AACpD,UAAM,WAAWA,iBAAM,OAAuB,IAAI;AAElD,UAAM,CAAC,iBAAiB,kBAAkB,IAAIA,iBAAM,SAAS,cAAc;AAC3E,UAAM,eAAe,sBAAsB;AAC3C,UAAM,UAAU,eAAe,oBAAoB;AAEnD,UAAM,CAAC,aAAa,cAAc,IAAIA,iBAAM,SAAS,CAAC;AACtD,UAAM,CAAC,eAAe,gBAAgB,IAAIA,iBAAM,SAA6B,MAAS;AACtF,UAAM,WAAWC,kBAAAA,kBAAkB,UAAU;AAAA,MAC3C,YAAY;AAAA,MACZ,OAAO;AAAA,MACP,UAAU;AAAA,IAAA,CACX;AACD,UAAM,CAAC,OAAO,QAAQ,IAAID,iBAAM;AAAA,MAAmB,MACjDE,cAAAA,sBAAsB,KAAKC,cAAAA,cAAc;AAAA,IAAA;AAE3C,UAAM,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UAAAG,cAAAA,WAAW,WAAW,GAAE;AAAA,cAChEJ,2BAAAA,KAAC,QAAA,EAAK,WAAU,0BAAyB,UAAA;AAAA,gBAAA;AAAA,gBAAEI,cAAAA,WAAW,eAAe;AAAA,cAAA,EAAA,CAAE;AAAA,YAAA,EAAA,CACzE,mCAEC,QAAA,EAAK,WAAU,wBAAwB,UAAAA,cAAAA,WAAW,eAAe,GAAE,EAAA,CAExE;AAAA,UAAA,GACF;AAAA,UAGAH,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,KAAK;AAAA,cACL;AAAA,cACA,SAAQ;AAAA,cACR,WAAU;AAAA,cACV,kBAAkB,CAAC,UAAU;AAC3B,sBAAM,EAAE,UAAU,eAAA,IAAmB,MAAM;AAC3C,iCAAiB,OAAO,SAAS,cAAc,IAAI,iBAAiB,MAAS;AAAA,cAC/E;AAAA,cACA,cAAc,CAAC,UAAU;AACvB,oBAAI,WAAY;AAChB,+BAAe,MAAM,cAAc,WAAW;AAAA,cAChD;AAAA,cACA,SAAS,MAAM;AACb,+BAAe,CAAC;AAChB,oBAAI,CAAC,aAAc,oBAAmB,KAAK;AAC3C,0BAAA;AAAA,cACF;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,YAAY,cAAc;;"}
|
|
1
|
+
{"version":3,"file":"AudioPlayer.cjs","sources":["../../../../src/components/AudioPlayer/AudioPlayer.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n decodeAudioPeaks,\n formatTime,\n generateFallbackPeaks,\n RAW_PEAK_COUNT,\n resamplePeaks,\n} from \"../../utils/audioWaveform\";\nimport { cn } from \"../../utils/cn\";\nimport { useFittedBarCount } from \"../../utils/useFittedBarCount\";\nimport { PauseIcon } from \"../Icons/PauseIcon\";\nimport { PlayIcon } from \"../Icons/PlayIcon\";\n\n/** Width of a single waveform bar, in pixels. */\nconst BAR_WIDTH_PX = 4;\n/** Gap between waveform bars, in pixels. */\nconst BAR_GAP_PX = 4;\n/** Shortest a waveform bar can render, in pixels. */\nconst MIN_BAR_HEIGHT_PX = 4;\n/** Tallest a waveform bar can render, in pixels — matches the 40px row height. */\nconst MAX_BAR_HEIGHT_PX = 26;\n/** Bar count used before the container has been measured (e.g. during SSR or in jsdom, where layout is unavailable). */\nconst DEFAULT_BAR_COUNT = 24;\n/** Seconds moved per Arrow key press while seeking. */\nconst SEEK_STEP_SECONDS = 1;\n/** Seconds moved per Page Up/Down press while seeking. */\nconst SEEK_STEP_LARGE_SECONDS = 5;\n\n/** Height of the audio player row, in pixels. Matches both the Vault card overlay and the \"Generated Audio\" modal row in Figma — both use an identical 32px play button and 40px row. */\nexport type AudioPlayerSize = \"40\";\n\nexport interface AudioPlayerProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onPlay\" | \"onPause\" | \"onEnded\"> {\n /** URL of the audio file to play. */\n src: string;\n /**\n * Total duration in seconds, used to render the timestamp before the\n * media's own metadata has loaded (and as a fallback if it never does).\n */\n duration?: number;\n /**\n * Whether playback is active (controlled). Note: once `onEnded` fires, the\n * browser has already stopped native playback. To loop or replay under\n * controlled usage, toggle this prop `false` then `true` (rather than\n * leaving it `true`) — the sync effect only calls `play()` again when this\n * value actually changes.\n */\n playing?: boolean;\n /** Initial playback state (uncontrolled). @default false */\n defaultPlaying?: boolean;\n /** Called when playback starts. */\n onPlay?: () => void;\n /** Called when playback is paused. */\n onPause?: () => void;\n /** Called when playback reaches the end of the media. */\n onEnded?: () => void;\n /** Height of the player row, in pixels. @default \"40\" */\n size?: AudioPlayerSize;\n}\n\n/**\n * A compact playback control for a single audio clip: a play/pause toggle, a\n * static amplitude waveform that doubles as a seek scrubber, and elapsed/total\n * timestamps. Designed to sit as an overlay on media thumbnails (Vault cards)\n * as well as inline rows (the AI Voice Message \"Generated Audio\" row).\n *\n * The waveform is seeded from the decoded audio when possible, falling back\n * to a deterministic (not random) placeholder derived from `src` so the\n * result is stable across renders, SSR, and Chromatic snapshots.\n *\n * @example\n * ```tsx\n * <AudioPlayer src=\"https://example.com/clip.mp3\" duration={5} />\n * ```\n */\nexport const AudioPlayer = React.forwardRef<HTMLDivElement, AudioPlayerProps>(\n (\n {\n className,\n src,\n duration,\n playing: controlledPlaying,\n defaultPlaying = false,\n onPlay,\n onPause,\n onEnded,\n size = \"40\",\n ...props\n },\n ref,\n ) => {\n const audioRef = React.useRef<HTMLAudioElement>(null);\n const trackRef = React.useRef<HTMLDivElement>(null);\n\n const [internalPlaying, setInternalPlaying] = React.useState(defaultPlaying);\n const isControlled = controlledPlaying !== undefined;\n const playing = isControlled ? controlledPlaying : internalPlaying;\n\n const [currentTime, setCurrentTime] = React.useState(0);\n const [mediaDuration, setMediaDuration] = React.useState<number | undefined>(undefined);\n const barCount = useFittedBarCount(trackRef, {\n barWidthPx: BAR_WIDTH_PX,\n gapPx: BAR_GAP_PX,\n fallback: DEFAULT_BAR_COUNT,\n });\n const [peaks, setPeaks] = React.useState<number[]>(() =>\n generateFallbackPeaks(src, RAW_PEAK_COUNT),\n );\n const [isDragging, setIsDragging] = React.useState(false);\n\n const displayDuration = mediaDuration ?? duration;\n const hasStarted = playing || currentTime > 0;\n\n // Latest-value refs so the src-change effect below can react to a src swap\n // without re-running whenever `playing`/`isControlled`/`onPause` change.\n const playingRef = React.useRef(playing);\n playingRef.current = playing;\n const isControlledRef = React.useRef(isControlled);\n isControlledRef.current = isControlled;\n const onPauseRef = React.useRef(onPause);\n onPauseRef.current = onPause;\n\n // Reset transient playback state when the source changes. Skips the\n // initial mount (there's nothing to reset yet) and, if playback was\n // active, stops it — the browser silently drops playback on a source\n // swap, so the UI (and any controlled parent) must be told via onPause.\n const isFirstSrcRenderRef = React.useRef(true);\n React.useEffect(() => {\n if (isFirstSrcRenderRef.current) {\n isFirstSrcRenderRef.current = false;\n return;\n }\n setCurrentTime(0);\n setMediaDuration(undefined);\n setPeaks(generateFallbackPeaks(src, RAW_PEAK_COUNT));\n if (playingRef.current) {\n if (!isControlledRef.current) setInternalPlaying(false);\n onPauseRef.current?.();\n }\n }, [src]);\n\n // Decode the audio to derive real waveform amplitudes, falling back to a\n // deterministic placeholder on any failure (network, CORS, unsupported format).\n React.useEffect(() => {\n let cancelled = false;\n const abortController = new AbortController();\n\n decodeAudioPeaks(src, abortController.signal)\n .then((decodedPeaks) => {\n if (!cancelled) setPeaks(decodedPeaks);\n })\n .catch(() => {\n if (!cancelled) setPeaks(generateFallbackPeaks(src, RAW_PEAK_COUNT));\n });\n\n return () => {\n cancelled = true;\n abortController.abort();\n };\n }, [src]);\n\n // Sync the controlled/uncontrolled `playing` state to the media element.\n React.useEffect(() => {\n const audio = audioRef.current;\n if (!audio) return;\n if (playing) {\n audio.play().catch(() => {\n if (!isControlled) setInternalPlaying(false);\n onPauseRef.current?.();\n });\n } else {\n audio.pause();\n }\n }, [playing, isControlled]);\n\n const handleToggle = () => {\n const next = !playing;\n if (!isControlled) setInternalPlaying(next);\n if (next) onPlay?.();\n else onPause?.();\n };\n\n const seekTo = React.useCallback(\n (time: number) => {\n if (displayDuration === undefined) return;\n const clamped = Math.min(Math.max(time, 0), displayDuration);\n setCurrentTime(clamped);\n const audio = audioRef.current;\n if (audio) audio.currentTime = clamped;\n },\n [displayDuration],\n );\n\n const seekFromClientX = React.useCallback(\n (clientX: number) => {\n const track = trackRef.current;\n if (!track || displayDuration === undefined) return;\n const rect = track.getBoundingClientRect();\n if (rect.width <= 0) return;\n const fraction = Math.min(Math.max((clientX - rect.left) / rect.width, 0), 1);\n seekTo(fraction * displayDuration);\n },\n [displayDuration, seekTo],\n );\n\n // Track drag outside the element via window listeners rather than pointer\n // capture, which some environments (and jsdom) don't fully implement.\n React.useEffect(() => {\n if (!isDragging) return;\n const handleWindowPointerMove = (event: PointerEvent) => seekFromClientX(event.clientX);\n const handleWindowPointerUp = () => setIsDragging(false);\n window.addEventListener(\"pointermove\", handleWindowPointerMove);\n window.addEventListener(\"pointerup\", handleWindowPointerUp);\n return () => {\n window.removeEventListener(\"pointermove\", handleWindowPointerMove);\n window.removeEventListener(\"pointerup\", handleWindowPointerUp);\n };\n }, [isDragging, seekFromClientX]);\n\n const handlePointerDown = (event: React.PointerEvent<HTMLDivElement>) => {\n seekFromClientX(event.clientX);\n setIsDragging(true);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (displayDuration === undefined) return;\n switch (event.key) {\n case \"ArrowRight\":\n case \"ArrowUp\":\n event.preventDefault();\n seekTo(currentTime + SEEK_STEP_SECONDS);\n break;\n case \"ArrowLeft\":\n case \"ArrowDown\":\n event.preventDefault();\n seekTo(currentTime - SEEK_STEP_SECONDS);\n break;\n case \"PageUp\":\n event.preventDefault();\n seekTo(currentTime + SEEK_STEP_LARGE_SECONDS);\n break;\n case \"PageDown\":\n event.preventDefault();\n seekTo(currentTime - SEEK_STEP_LARGE_SECONDS);\n break;\n case \"Home\":\n event.preventDefault();\n seekTo(0);\n break;\n case \"End\":\n event.preventDefault();\n seekTo(displayDuration);\n break;\n default:\n break;\n }\n };\n\n const totalLabel = formatTime(displayDuration);\n // Zero-padded to the total's length so the two timestamps always occupy the same width\n // (seconds are already two digits, so this only ever extends the minutes field).\n const elapsedLabel = formatTime(currentTime).padStart(totalLabel.length, \"0\");\n\n const bars = resamplePeaks(peaks, barCount);\n const progressFraction =\n displayDuration && displayDuration > 0\n ? Math.min(Math.max(currentTime / displayDuration, 0), 1)\n : 0;\n const playedBarCount = hasStarted ? Math.round(progressFraction * bars.length) : bars.length;\n const barData = bars.map((amplitude, index) => {\n const isPlayed = index < playedBarCount;\n return {\n heightPx: MIN_BAR_HEIGHT_PX + amplitude * (MAX_BAR_HEIGHT_PX - MIN_BAR_HEIGHT_PX),\n className: cn(\n \"w-1 shrink-0 rounded-3xs bg-messages-waveform-default\",\n \"motion-safe:transition-opacity motion-safe:duration-150 motion-safe:ease-in-out\",\n isPlayed ? \"opacity-100\" : \"opacity-50\",\n ),\n };\n });\n\n return (\n <div\n ref={ref}\n data-size={size}\n className={cn(\"flex w-full items-center gap-3\", className)}\n {...props}\n >\n <button\n type=\"button\"\n onClick={handleToggle}\n aria-label={playing ? \"Pause\" : \"Play\"}\n className={cn(\n \"flex size-8 shrink-0 items-center justify-center rounded-full\",\n \"bg-buttons-secondary-default text-icons-primary backdrop-blur-[40px]\",\n \"motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-in-out\",\n \"hover:bg-buttons-secondary-hover\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n )}\n >\n {playing ? <PauseIcon size={16} filled /> : <PlayIcon size={16} filled />}\n </button>\n\n <div className=\"flex min-w-0 flex-1 items-center gap-3\">\n <div\n ref={trackRef}\n role=\"slider\"\n tabIndex={0}\n aria-label=\"Seek\"\n aria-orientation=\"horizontal\"\n aria-valuemin={0}\n aria-valuemax={displayDuration}\n aria-valuenow={Math.round(currentTime)}\n aria-valuetext={\n displayDuration !== undefined\n ? `${formatTime(currentTime)} of ${formatTime(displayDuration)}`\n : formatTime(currentTime)\n }\n onPointerDown={handlePointerDown}\n onKeyDown={handleKeyDown}\n className={cn(\n \"flex h-10 min-w-0 flex-1 cursor-pointer touch-none select-none items-center gap-1 overflow-hidden\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n )}\n >\n {barData.map((bar, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: bars are a fixed-count, non-reorderable list\n <span key={index} className={bar.className} style={{ height: bar.heightPx }} />\n ))}\n </div>\n\n {/* Both slots always render, the second one merely hidden before playback, so the\n timer keeps one width and the waveform never reflows. The first slot shows the\n total until playback starts, and the two labels are equal width, so the timestamp\n sits in the same place in either state. */}\n <span className=\"typography-body-small-14px-semibold flex shrink-0 items-center gap-0.5 whitespace-nowrap tabular-nums\">\n <span className=\"text-content-primary\">{hasStarted ? elapsedLabel : totalLabel}</span>\n <span className={cn(\"text-content-secondary\", !hasStarted && \"invisible\")}>\n /{totalLabel}\n </span>\n </span>\n </div>\n\n {/* biome-ignore lint/a11y/useMediaCaption: this is a UI sound clip (voice note / short recording), not spoken/narrated content requiring captions. */}\n <audio\n ref={audioRef}\n src={src}\n preload=\"metadata\"\n className=\"hidden\"\n onLoadedMetadata={(event) => {\n const { duration: nativeDuration } = event.currentTarget;\n setMediaDuration(Number.isFinite(nativeDuration) ? nativeDuration : undefined);\n }}\n onTimeUpdate={(event) => {\n if (isDragging) return;\n setCurrentTime(event.currentTarget.currentTime);\n }}\n onEnded={() => {\n setCurrentTime(0);\n if (!isControlled) setInternalPlaying(false);\n onEnded?.();\n }}\n />\n </div>\n );\n },\n);\n\nAudioPlayer.displayName = \"AudioPlayer\";\n"],"names":["React","useFittedBarCount","generateFallbackPeaks","RAW_PEAK_COUNT","decodeAudioPeaks","formatTime","resamplePeaks","cn","jsxs","jsx","PauseIcon","PlayIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAM,eAAe;AAErB,MAAM,aAAa;AAEnB,MAAM,oBAAoB;AAE1B,MAAM,oBAAoB;AAE1B,MAAM,oBAAoB;AAE1B,MAAM,oBAAoB;AAE1B,MAAM,0BAA0B;AAiDzB,MAAM,cAAcA,iBAAM;AAAA,EAC/B,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,iBAAiB;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,WAAWA,iBAAM,OAAyB,IAAI;AACpD,UAAM,WAAWA,iBAAM,OAAuB,IAAI;AAElD,UAAM,CAAC,iBAAiB,kBAAkB,IAAIA,iBAAM,SAAS,cAAc;AAC3E,UAAM,eAAe,sBAAsB;AAC3C,UAAM,UAAU,eAAe,oBAAoB;AAEnD,UAAM,CAAC,aAAa,cAAc,IAAIA,iBAAM,SAAS,CAAC;AACtD,UAAM,CAAC,eAAe,gBAAgB,IAAIA,iBAAM,SAA6B,MAAS;AACtF,UAAM,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0 1 0-3.653 2.587 2.587 0 0 1 3.653 0 2.587 2.587 0 0 1 0 3.653 2.57 2.57 0 0 1-1.827.753m0-4.166a1.58 1.58 0 0 0-1.12.46 1.594 1.594 0 0 0 0 2.24c.62.613 1.62.613 2.24 0a1.581 1.581 0 0 0-1.12-2.7"
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
|
-
d: "M9.
|
|
31
|
+
d: "M9.991 15.168c-.413 0-.82-.16-1.126-.467l-.494-.493a.594.594 0 0 0-.826-.007l-.507.48a1.59 1.59 0 0 1-1.6.36l-.487-.16a1.58 1.58 0 0 1-1.086-1.507v-.7a.58.58 0 0 0-.58-.586l-.7-.014a1.58 1.58 0 0 1-1.387-.88l-.227-.46a1.58 1.58 0 0 1 .3-1.833l.494-.493a.594.594 0 0 0 .006-.827l-.486-.506a1.58 1.58 0 0 1-.36-1.607l.16-.487c.22-.653.82-1.086 1.506-1.086h.7a.58.58 0 0 0 .587-.58l.013-.7a1.58 1.58 0 0 1 .88-1.387l.46-.227a1.58 1.58 0 0 1 1.834.3l.493.494a.594.594 0 0 0 .827.006l.506-.486a1.6 1.6 0 0 1 1.607-.36l.487.16a1.59 1.59 0 0 1 1.086 1.506v.7c0 .327.254.587.58.594l.7.013a1.57 1.57 0 0 1 1.387.88l.227.46a1.58 1.58 0 0 1-.3 1.833l-.494.494a.594.594 0 0 0-.006.826l.486.507c.407.427.547 1.04.36 1.6l-.16.486a1.58 1.58 0 0 1-1.506 1.087h-.7a.58.58 0 0 0-.587.58l-.013.7a1.57 1.57 0 0 1-.88 1.387l-.46.226a1.6 1.6 0 0 1-.714.167zm-2.033-2.127c.407 0 .82.153 1.127.46l.493.494a.59.59 0 0 0 .68.113l.46-.227c.193-.1.32-.293.327-.513l.013-.7c.02-.86.733-1.554 1.587-1.554h.7c.253 0 .48-.16.56-.406l.16-.487a.59.59 0 0 0-.134-.593l-.486-.507c-.594-.62-.58-1.62.026-2.226l.494-.494a.59.59 0 0 0 .113-.68l-.227-.46a.6.6 0 0 0-.513-.326l-.7-.014a1.6 1.6 0 0 1-1.553-1.593v-.7c0-.253-.16-.48-.407-.56l-.487-.16a.59.59 0 0 0-.593.133l-.507.48c-.62.594-1.62.58-2.226-.026l-.494-.494a.59.59 0 0 0-.68-.113l-.46.227a.6.6 0 0 0-.326.513l-.014.7a1.597 1.597 0 0 1-1.586 1.553h-.7c-.254 0-.48.16-.56.407l-.16.487a.59.59 0 0 0 .133.593l.487.507c.593.62.58 1.62-.027 2.226l-.493.494a.59.59 0 0 0-.114.68l.227.46c.1.193.293.32.513.326l.7.014c.86.02 1.554.733 1.554 1.586v.7c0 .253.16.48.406.56l.487.16c.207.067.44.02.593-.133l.507-.48c.307-.293.7-.44 1.1-.44z"
|
|
32
32
|
}
|
|
33
33
|
],
|
|
34
34
|
filled: [
|
|
35
35
|
{
|
|
36
|
-
d: "
|
|
36
|
+
d: "M13.846 8.716a1.095 1.095 0 0 1 .013-1.526l.494-.494c.333-.333.413-.84.206-1.26l-.226-.46a1.09 1.09 0 0 0-.954-.6l-.7-.013a1.093 1.093 0 0 1-1.066-1.093v-.7c0-.467-.3-.887-.747-1.034l-.487-.16a1.1 1.1 0 0 0-1.1.247l-.506.487c-.427.413-1.107.4-1.527-.014L6.753 1.603a1.1 1.1 0 0 0-1.26-.207l-.46.227c-.36.18-.594.547-.607.953l-.013.7A1.093 1.093 0 0 1 3.32 4.343h-.7c-.466 0-.886.3-1.033.747l-.16.486c-.127.38-.033.807.247 1.1l.48.507c.413.427.4 1.107-.014 1.527L1.647 9.203c-.333.333-.413.84-.207 1.26l.227.46c.18.36.547.593.953.6l.7.013a1.09 1.09 0 0 1 1.067 1.094v.7c0 .466.3.886.747 1.033l.486.16c.387.127.807.033 1.1-.247l.507-.486a1.095 1.095 0 0 1 1.527.02l.493.493c.333.333.84.413 1.26.207L10.966 14.283c.36-.18.593-.547.6-.953l.013-.7a1.09 1.09 0 0 1 1.094-1.067h.7c.466 0 .886-.3 1.033-.747l.16-.486a1.09 1.09 0 0 0-.247-1.1l-.486-.507zm-4.367.707a2.084 2.084 0 1 1-2.946-2.949A2.084 2.084 0 0 1 9.48 9.423"
|
|
37
37
|
}
|
|
38
38
|
]
|
|
39
39
|
},
|
|
40
40
|
24: {
|
|
41
41
|
outlined: [
|
|
42
42
|
{
|
|
43
|
-
d: "
|
|
43
|
+
d: "M12.005 15.93c-.99 0-1.98-.38-2.74-1.13a3.88 3.88 0 0 1 0-5.48 3.88 3.88 0 0 1 5.48 0 3.88 3.88 0 0 1 0 5.48c-.76.76-1.75 1.13-2.74 1.13m0-6.25c-.61 0-1.22.23-1.68.69a2.39 2.39 0 0 0 0 3.36c.93.92 2.43.92 3.36 0a2.372 2.372 0 0 0-1.68-4.05"
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
|
-
d: "
|
|
46
|
+
d: "M15.035 22.81c-.62 0-1.23-.24-1.69-.7l-.74-.74a.89.89 0 0 0-1.24-.01l-.76.72c-.64.61-1.56.82-2.4.54l-.73-.24a2.375 2.375 0 0 1-1.63-2.26v-1.05c0-.49-.38-.88-.87-.88l-1.05-.02c-.89-.02-1.68-.52-2.08-1.32l-.34-.69c-.46-.92-.28-2.03.45-2.75l.74-.74a.89.89 0 0 0 .01-1.24l-.73-.76c-.62-.64-.82-1.56-.54-2.41l.24-.73c.33-.98 1.23-1.63 2.26-1.63h1.05c.49 0 .88-.38.88-.87l.02-1.05c.02-.89.53-1.69 1.32-2.08l.69-.34c.92-.46 2.03-.28 2.75.45l.74.74c.34.34.89.34 1.24.01l.76-.73c.64-.61 1.56-.82 2.41-.54l.73.24c.98.33 1.63 1.24 1.63 2.26v1.05c0 .49.38.88.87.89l1.05.02c.89.02 1.69.52 2.08 1.32l.34.69c.46.92.28 2.03-.45 2.75l-.74.74a.89.89 0 0 0-.01 1.24l.73.76c.61.64.82 1.56.54 2.4l-.24.73c-.33.98-1.23 1.63-2.26 1.63h-1.05c-.49 0-.88.38-.88.87l-.02 1.05c-.02.89-.52 1.69-1.32 2.08l-.69.34c-.34.17-.71.25-1.07.25zm-3.05-3.19c.61 0 1.23.23 1.69.69l.74.74c.27.27.68.34 1.02.17l.69-.34c.29-.15.48-.44.49-.77l.02-1.05c.03-1.29 1.1-2.33 2.38-2.33h1.05c.38 0 .72-.24.84-.61l.24-.73c.1-.31.03-.65-.2-.89l-.73-.76c-.89-.93-.87-2.43.04-3.34l.74-.74c.27-.27.34-.68.17-1.02l-.34-.69a.9.9 0 0 0-.77-.49l-1.05-.02a2.4 2.4 0 0 1-2.33-2.39v-1.05a.88.88 0 0 0-.61-.84l-.73-.24a.89.89 0 0 0-.89.2l-.76.72c-.93.89-2.43.87-3.34-.04l-.74-.74a.88.88 0 0 0-1.02-.17l-.69.34c-.29.15-.48.44-.49.77l-.02 1.05a2.395 2.395 0 0 1-2.38 2.33h-1.05a.88.88 0 0 0-.84.61l-.24.73c-.1.31-.03.66.2.89l.73.76c.89.93.87 2.43-.04 3.34l-.74.74c-.27.27-.34.68-.17 1.02l.34.69c.15.29.44.48.77.49l1.05.02c1.29.03 2.33 1.1 2.33 2.38v1.05c0 .38.24.72.61.84l.73.24c.31.1.66.03.89-.2l.76-.72c.46-.44 1.05-.66 1.65-.66z"
|
|
47
47
|
}
|
|
48
48
|
],
|
|
49
49
|
filled: [
|
|
50
50
|
{
|
|
51
|
-
d: "
|
|
51
|
+
d: "M20.77 13.145c-.62-.64-.6-1.66.02-2.29l.74-.74c.5-.5.62-1.26.31-1.89l-.34-.69a1.63 1.63 0 0 0-1.43-.9l-1.05-.02a1.64 1.64 0 0 1-1.6-1.64V3.925c0-.7-.45-1.33-1.12-1.55l-.73-.24a1.64 1.64 0 0 0-1.65.37l-.76.73c-.64.62-1.66.6-2.29-.02L10.13 2.475c-.5-.5-1.26-.62-1.89-.31l-.69.34c-.54.27-.89.82-.91 1.43l-.02 1.05c-.02.89-.75 1.6-1.64 1.6H3.93c-.7 0-1.33.45-1.55 1.12l-.24.73c-.19.57-.05 1.21.37 1.65l.72.76c.62.64.6 1.66-.02 2.29l-.74.74c-.5.5-.62 1.26-.31 1.89l.34.69c.27.54.82.89 1.43.9l1.05.02c.89.02 1.6.74 1.6 1.64v1.05c0 .7.45 1.33 1.12 1.55l.73.24c.58.19 1.21.05 1.65-.37l.76-.73c.64-.61 1.66-.6 2.29.03l.74.74c.5.5 1.26.62 1.89.31l.69-.34c.54-.27.89-.82.9-1.43l.02-1.05c.02-.89.74-1.6 1.64-1.6h1.05c.7 0 1.33-.45 1.55-1.12l.24-.73c.19-.58.05-1.21-.37-1.65l-.73-.76zm-6.55 1.06a3.126 3.126 0 0 1-4.42-4.42 3.126 3.126 0 0 1 4.42 4.42"
|
|
52
52
|
}
|
|
53
53
|
]
|
|
54
54
|
},
|
|
55
55
|
32: {
|
|
56
56
|
outlined: [
|
|
57
57
|
{
|
|
58
|
-
d: "
|
|
58
|
+
d: "M16.007 21.162a5.2 5.2 0 0 1-3.653-1.506 5.174 5.174 0 0 1 0-7.307 5.174 5.174 0 0 1 7.307 0 5.174 5.174 0 0 1 0 7.307 5.14 5.14 0 0 1-3.654 1.506m0-8.333c-.813 0-1.626.307-2.24.92a3.187 3.187 0 0 0 0 4.48 3.187 3.187 0 0 0 4.48 0 3.158 3.158 0 0 0-2.24-5.4"
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
|
-
d: "
|
|
61
|
+
d: "M20.048 30.336a3.18 3.18 0 0 1-2.254-.934l-.987-.986a1.187 1.187 0 0 0-1.653-.014l-1.013.96a3.18 3.18 0 0 1-3.2.72l-.974-.32a3.17 3.17 0 0 1-2.173-3.013v-1.4c0-.653-.507-1.173-1.16-1.173l-1.4-.027a3.16 3.16 0 0 1-2.773-1.76l-.454-.92a3.16 3.16 0 0 1 .6-3.667l.987-.986a1.19 1.19 0 0 0 .013-1.654l-.973-1.013a3.17 3.17 0 0 1-.72-3.213l.32-.974a3.17 3.17 0 0 1 3.013-2.173h1.4c.654 0 1.174-.507 1.174-1.16l.026-1.4A3.17 3.17 0 0 1 9.607 2.456l.92-.454a3.16 3.16 0 0 1 3.667.6l.987.987a1.187 1.187 0 0 0 1.653.013l1.014-.973a3.19 3.19 0 0 1 3.213-.72l.973.32a3.18 3.18 0 0 1 2.174 3.013v1.4c0 .654.506 1.174 1.16 1.187l1.4.027a3.14 3.14 0 0 1 2.773 1.76l.453.92a3.16 3.16 0 0 1-.6 3.666l-.986.987a1.187 1.187 0 0 0-.014 1.653l.974 1.014a3.18 3.18 0 0 1 .72 3.2l-.32.973a3.17 3.17 0 0 1-3.014 2.173h-1.4c-.653 0-1.173.507-1.173 1.16l-.027 1.4a3.14 3.14 0 0 1-1.76 2.774l-.92.453a3.2 3.2 0 0 1-1.427.333zm-4.067-4.254c.813 0 1.64.307 2.253.92l.987.987c.36.36.906.453 1.36.227l.92-.454c.387-.2.64-.586.653-1.026l.027-1.4a3.194 3.194 0 0 1 3.173-3.107h1.4c.507 0 .96-.32 1.12-.813l.32-.974a1.18 1.18 0 0 0-.267-1.186l-.973-1.014c-1.187-1.24-1.16-3.24.053-4.453l.987-.987c.36-.36.453-.906.227-1.36l-.454-.92c-.2-.386-.586-.64-1.026-.653l-1.4-.027a3.197 3.197 0 0 1-3.107-3.186v-1.4c0-.507-.32-.96-.813-1.12l-.974-.32a1.18 1.18 0 0 0-1.186.266l-1.014.96c-1.24 1.187-3.24 1.16-4.453-.053l-.987-.987a1.18 1.18 0 0 0-1.36-.226l-.92.453c-.386.2-.64.587-.653 1.027l-.027 1.4a3.194 3.194 0 0 1-3.173 3.106h-1.4c-.507 0-.96.32-1.12.814l-.32.973c-.133.413-.04.88.267 1.187l.973 1.013c1.187 1.24 1.16 3.24-.053 4.453l-.987.987a1.18 1.18 0 0 0-.227 1.36l.454.92c.2.387.586.64 1.026.653l1.4.027a3.194 3.194 0 0 1 3.107 3.173v1.4c0 .507.32.96.813 1.12l.974.32c.413.134.88.04 1.186-.266l1.014-.96a3.16 3.16 0 0 1 2.2-.88z"
|
|
62
62
|
}
|
|
63
63
|
],
|
|
64
64
|
filled: [
|
|
65
65
|
{
|
|
66
|
-
d: "
|
|
66
|
+
d: "M27.6 17.527c-.827-.854-.8-2.214.027-3.054l.986-.986c.667-.667.827-1.68.414-2.52l-.454-.92a2.17 2.17 0 0 0-1.906-1.2l-1.4-.027a2.186 2.186 0 0 1-2.134-2.187v-1.4c0-.933-.6-1.773-1.493-2.066l-.973-.32a2.19 2.19 0 0 0-2.2.493l-1.014.973c-.853.827-2.213.8-3.053-.026L13.413 3.3a2.19 2.19 0 0 0-2.52-.413l-.92.453A2.21 2.21 0 0 0 8.76 5.247l-.027 1.4A2.186 2.186 0 0 1 6.547 8.78h-1.4c-.934 0-1.774.6-2.067 1.493l-.32.974a2.2 2.2 0 0 0 .493 2.2l.96 1.013c.827.853.8 2.213-.026 3.053l-.987.987a2.19 2.19 0 0 0-.413 2.52l.453.92a2.17 2.17 0 0 0 1.907 1.2l1.4.027a2.177 2.177 0 0 1 2.133 2.186v1.4c0 .934.6 1.774 1.493 2.067l.974.32a2.19 2.19 0 0 0 2.2-.493l1.013-.974a2.19 2.19 0 0 1 3.053.04l.987.987a2.19 2.19 0 0 0 2.52.413l.92-.453a2.17 2.17 0 0 0 1.2-1.907l.027-1.4a2.177 2.177 0 0 1 2.186-2.133h1.4c.934 0 1.774-.6 2.067-1.493l.32-.974a2.19 2.19 0 0 0-.493-2.2l-.974-1.013zm-8.733 1.413a4.168 4.168 0 0 1-5.894-5.893 4.17 4.17 0 0 1 5.894 0 4.17 4.17 0 0 1 0 5.893"
|
|
67
67
|
}
|
|
68
68
|
]
|
|
69
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CogIcon.cjs","sources":["../../../../src/components/Icons/CogIcon.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: \"M7.168 9.748c-.66 0-1.32-.253-1.826-.753a2.587 2.587 0 0 1 0-3.653 2.587 2.587 0 0 1 3.653 0 2.587 2.587 0 0 1 0 3.653 2.57 2.57 0 0 1-1.827.753m0-4.166a1.58 1.58 0 0 0-1.12.46 1.594 1.594 0 0 0 0 2.24c.62.613 1.62.613 2.24 0a1.581 1.581 0 0 0-1.12-2.7\",\n },\n {\n d: \"M9.188 14.335c-.413 0-.82-.16-1.126-.467l-.494-.493a.594.594 0 0 0-.826-.007l-.507.48a1.59 1.59 0 0 1-1.6.36l-.487-.16a1.58 1.58 0 0 1-1.086-1.507v-.7a.58.58 0 0 0-.58-.586l-.7-.014a1.58 1.58 0 0 1-1.387-.88l-.227-.46a1.58 1.58 0 0 1 .3-1.833l.494-.493a.594.594 0 0 0 .006-.827l-.486-.506a1.58 1.58 0 0 1-.36-1.607l.16-.487c.22-.653.82-1.086 1.506-1.086h.7a.58.58 0 0 0 .587-.58l.013-.7a1.58 1.58 0 0 1 .88-1.387l.46-.227a1.58 1.58 0 0 1 1.834.3l.493.494a.594.594 0 0 0 .827.006l.506-.486a1.6 1.6 0 0 1 1.607-.36l.487.16a1.59 1.59 0 0 1 1.086 1.506v.7c0 .327.254.587.58.594l.7.013a1.57 1.57 0 0 1 1.387.88l.227.46a1.58 1.58 0 0 1-.3 1.833l-.494.494a.594.594 0 0 0-.006.826l.486.507c.407.427.547 1.04.36 1.6l-.16.486a1.58 1.58 0 0 1-1.506 1.087h-.7a.58.58 0 0 0-.587.58l-.013.7a1.57 1.57 0 0 1-.88 1.387l-.46.226a1.6 1.6 0 0 1-.714.167zm-2.033-2.127c.407 0 .82.153 1.127.46l.493.494a.59.59 0 0 0 .68.113l.46-.227c.193-.1.32-.293.327-.513l.013-.7c.02-.86.733-1.554 1.587-1.554h.7c.253 0 .48-.16.56-.406l.16-.487a.59.59 0 0 0-.134-.593l-.486-.507c-.594-.62-.58-1.62.026-2.226l.494-.494a.59.59 0 0 0 .113-.68l-.227-.46a.6.6 0 0 0-.513-.326l-.7-.014a1.6 1.6 0 0 1-1.553-1.593v-.7c0-.253-.16-.48-.407-.56l-.487-.16a.59.59 0 0 0-.593.133l-.507.48c-.62.594-1.62.58-2.226-.026l-.494-.494a.59.59 0 0 0-.68-.113l-.46.227a.6.6 0 0 0-.326.513l-.014.7a1.597 1.597 0 0 1-1.586 1.553h-.7c-.254 0-.48.16-.56.407l-.16.487a.59.59 0 0 0 .133.593l.487.507c.593.62.58 1.62-.027 2.226l-.493.494a.59.59 0 0 0-.114.68l.227.46c.1.193.293.32.513.326l.7.014c.86.02 1.554.733 1.554 1.586v.7c0 .253.16.48.406.56l.487.16c.207.067.44.02.593-.133l.507-.48c.307-.293.7-.44 1.1-.44z\",\n },\n ],\n filled: [\n {\n d: \"M12.52 7.433a1.095 1.095 0 0 1 .013-1.526l.494-.494c.333-.333.413-.84.206-1.26l-.226-.46a1.09 1.09 0 0 0-.954-.6l-.7-.013a1.093 1.093 0 0 1-1.066-1.093v-.7c0-.467-.3-.887-.747-1.034l-.487-.16a1.1 1.1 0 0 0-1.1.247l-.506.487c-.427.413-1.107.4-1.527-.014L5.427.32a1.1 1.1 0 0 0-1.26-.207l-.46.227c-.36.18-.594.547-.607.953l-.013.7A1.093 1.093 0 0 1 1.993 3.06h-.7c-.466 0-.886.3-1.033.747l-.16.486c-.127.38-.033.807.247 1.1l.48.507c.413.427.4 1.107-.014 1.527L.32 7.92c-.333.333-.413.84-.207 1.26l.227.46c.18.36.547.593.953.6l.7.013a1.09 1.09 0 0 1 1.067 1.094v.7c0 .466.3.886.747 1.033l.486.16c.387.127.807.033 1.1-.247l.507-.486a1.095 1.095 0 0 1 1.527.02l.493.493c.333.333.84.413 1.26.207L9.64 13c.36-.18.593-.547.6-.953l.013-.7a1.09 1.09 0 0 1 1.094-1.067h.7c.466 0 .886-.3 1.033-.747l.16-.486a1.09 1.09 0 0 0-.247-1.1l-.486-.507zm-4.367.707a2.084 2.084 0 1 1-2.946-2.949A2.084 2.084 0 0 1 8.153 8.14\",\n },\n ],\n },\n 24: {\n outlined: [\n {\n d: \"M10.752 14.622c-.99 0-1.98-.38-2.74-1.13a3.88 3.88 0 0 1 0-5.48 3.88 3.88 0 0 1 5.48 0 3.88 3.88 0 0 1 0 5.48c-.76.76-1.75 1.13-2.74 1.13m0-6.25c-.61 0-1.22.23-1.68.69a2.39 2.39 0 0 0 0 3.36c.93.92 2.43.92 3.36 0a2.372 2.372 0 0 0-1.68-4.05\",\n },\n {\n d: \"M13.782 21.502c-.62 0-1.23-.24-1.69-.7l-.74-.74a.89.89 0 0 0-1.24-.01l-.76.72c-.64.61-1.56.82-2.4.54l-.73-.24a2.375 2.375 0 0 1-1.63-2.26v-1.05c0-.49-.38-.88-.87-.88l-1.05-.02c-.89-.02-1.68-.52-2.08-1.32l-.34-.69c-.46-.92-.28-2.03.45-2.75l.74-.74a.89.89 0 0 0 .01-1.24l-.73-.76c-.62-.64-.82-1.56-.54-2.41l.24-.73c.33-.98 1.23-1.63 2.26-1.63h1.05c.49 0 .88-.38.88-.87l.02-1.05c.02-.89.53-1.69 1.32-2.08l.69-.34c.92-.46 2.03-.28 2.75.45l.74.74c.34.34.89.34 1.24.01l.76-.73c.64-.61 1.56-.82 2.41-.54l.73.24c.98.33 1.63 1.24 1.63 2.26v1.05c0 .49.38.88.87.89l1.05.02c.89.02 1.69.52 2.08 1.32l.34.69c.46.92.28 2.03-.45 2.75l-.74.74a.89.89 0 0 0-.01 1.24l.73.76c.61.64.82 1.56.54 2.4l-.24.73c-.33.98-1.23 1.63-2.26 1.63h-1.05c-.49 0-.88.38-.88.87l-.02 1.05c-.02.89-.52 1.69-1.32 2.08l-.69.34c-.34.17-.71.25-1.07.25zm-3.05-3.19c.61 0 1.23.23 1.69.69l.74.74c.27.27.68.34 1.02.17l.69-.34c.29-.15.48-.44.49-.77l.02-1.05c.03-1.29 1.1-2.33 2.38-2.33h1.05c.38 0 .72-.24.84-.61l.24-.73c.1-.31.03-.65-.2-.89l-.73-.76c-.89-.93-.87-2.43.04-3.34l.74-.74c.27-.27.34-.68.17-1.02l-.34-.69a.9.9 0 0 0-.77-.49l-1.05-.02a2.4 2.4 0 0 1-2.33-2.39v-1.05a.88.88 0 0 0-.61-.84l-.73-.24a.89.89 0 0 0-.89.2l-.76.72c-.93.89-2.43.87-3.34-.04l-.74-.74a.88.88 0 0 0-1.02-.17l-.69.34c-.29.15-.48.44-.49.77l-.02 1.05a2.395 2.395 0 0 1-2.38 2.33h-1.05a.88.88 0 0 0-.84.61l-.24.73c-.1.31-.03.66.2.89l.73.76c.89.93.87 2.43-.04 3.34l-.74.74c-.27.27-.34.68-.17 1.02l.34.69c.15.29.44.48.77.49l1.05.02c1.29.03 2.33 1.1 2.33 2.38v1.05c0 .38.24.72.61.84l.73.24c.31.1.66.03.89-.2l.76-.72c.46-.44 1.05-.66 1.65-.66z\",\n },\n ],\n filled: [\n {\n d: \"M18.78 11.15c-.62-.64-.6-1.66.02-2.29l.74-.74c.5-.5.62-1.26.31-1.89l-.34-.69a1.63 1.63 0 0 0-1.43-.9l-1.05-.02a1.64 1.64 0 0 1-1.6-1.64V1.93c0-.7-.45-1.33-1.12-1.55l-.73-.24a1.64 1.64 0 0 0-1.65.37l-.76.73c-.64.62-1.66.6-2.29-.02L8.14.48c-.5-.5-1.26-.62-1.89-.31l-.69.34c-.54.27-.89.82-.91 1.43l-.02 1.05c-.02.89-.75 1.6-1.64 1.6H1.94c-.7 0-1.33.45-1.55 1.12l-.24.73c-.19.57-.05 1.21.37 1.65l.72.76c.62.64.6 1.66-.02 2.29l-.74.74c-.5.5-.62 1.26-.31 1.89l.34.69c.27.54.82.89 1.43.9l1.05.02c.89.02 1.6.74 1.6 1.64v1.05c0 .7.45 1.33 1.12 1.55l.73.24c.58.19 1.21.05 1.65-.37l.76-.73c.64-.61 1.66-.6 2.29.03l.74.74c.5.5 1.26.62 1.89.31l.69-.34c.54-.27.89-.82.9-1.43l.02-1.05c.02-.89.74-1.6 1.64-1.6h1.05c.7 0 1.33-.45 1.55-1.12l.24-.73c.19-.58.05-1.21-.37-1.65l-.73-.76zm-6.55 1.06a3.126 3.126 0 0 1-4.42-4.42 3.126 3.126 0 0 1 4.42 4.42\",\n },\n ],\n },\n 32: {\n outlined: [\n {\n d: \"M14.336 19.496a5.2 5.2 0 0 1-3.653-1.506 5.174 5.174 0 0 1 0-7.307 5.174 5.174 0 0 1 7.307 0 5.174 5.174 0 0 1 0 7.307 5.14 5.14 0 0 1-3.654 1.506m0-8.333c-.813 0-1.626.307-2.24.92a3.187 3.187 0 0 0 0 4.48 3.187 3.187 0 0 0 4.48 0 3.158 3.158 0 0 0-2.24-5.4\",\n },\n {\n d: \"M18.377 28.67a3.18 3.18 0 0 1-2.254-.934l-.987-.986a1.187 1.187 0 0 0-1.653-.014l-1.013.96a3.18 3.18 0 0 1-3.2.72l-.974-.32a3.17 3.17 0 0 1-2.173-3.013v-1.4c0-.653-.507-1.173-1.16-1.173l-1.4-.027a3.16 3.16 0 0 1-2.773-1.76l-.454-.92a3.16 3.16 0 0 1 .6-3.667l.987-.986a1.19 1.19 0 0 0 .013-1.654l-.973-1.013a3.17 3.17 0 0 1-.72-3.213l.32-.974a3.17 3.17 0 0 1 3.013-2.173h1.4c.654 0 1.174-.507 1.174-1.16l.026-1.4A3.17 3.17 0 0 1 7.936.79l.92-.454a3.16 3.16 0 0 1 3.667.6l.987.987a1.187 1.187 0 0 0 1.653.013l1.014-.973a3.19 3.19 0 0 1 3.213-.72l.973.32a3.18 3.18 0 0 1 2.174 3.013v1.4c0 .654.506 1.174 1.16 1.187l1.4.027a3.14 3.14 0 0 1 2.773 1.76l.453.92a3.16 3.16 0 0 1-.6 3.666l-.986.987a1.187 1.187 0 0 0-.014 1.653l.974 1.014a3.18 3.18 0 0 1 .72 3.2l-.32.973a3.17 3.17 0 0 1-3.014 2.173h-1.4c-.653 0-1.173.507-1.173 1.16l-.027 1.4a3.14 3.14 0 0 1-1.76 2.774l-.92.453a3.2 3.2 0 0 1-1.427.333zm-4.067-4.254c.813 0 1.64.307 2.253.92l.987.987c.36.36.906.453 1.36.227l.92-.454c.387-.2.64-.586.653-1.026l.027-1.4a3.194 3.194 0 0 1 3.173-3.107h1.4c.507 0 .96-.32 1.12-.813l.32-.974a1.18 1.18 0 0 0-.267-1.186l-.973-1.014c-1.187-1.24-1.16-3.24.053-4.453l.987-.987c.36-.36.453-.906.227-1.36l-.454-.92c-.2-.386-.586-.64-1.026-.653l-1.4-.027a3.197 3.197 0 0 1-3.107-3.186v-1.4c0-.507-.32-.96-.813-1.12l-.974-.32a1.18 1.18 0 0 0-1.186.266l-1.014.96c-1.24 1.187-3.24 1.16-4.453-.053l-.987-.987a1.18 1.18 0 0 0-1.36-.226l-.92.453c-.386.2-.64.587-.653 1.027l-.027 1.4a3.194 3.194 0 0 1-3.173 3.106h-1.4c-.507 0-.96.32-1.12.814l-.32.973c-.133.413-.04.88.267 1.187l.973 1.013c1.187 1.24 1.16 3.24-.053 4.453l-.987.987a1.18 1.18 0 0 0-.227 1.36l.454.92c.2.387.586.64 1.026.653l1.4.027a3.194 3.194 0 0 1 3.107 3.173v1.4c0 .507.32.96.813 1.12l.974.32c.413.134.88.04 1.186-.266l1.014-.96a3.16 3.16 0 0 1 2.2-.88z\",\n },\n ],\n filled: [\n {\n d: \"M25.04 14.867c-.827-.854-.8-2.214.027-3.054l.986-.986c.667-.667.827-1.68.414-2.52l-.454-.92a2.17 2.17 0 0 0-1.906-1.2l-1.4-.027a2.186 2.186 0 0 1-2.134-2.187v-1.4c0-.933-.6-1.773-1.493-2.066l-.973-.32a2.19 2.19 0 0 0-2.2.493l-1.014.973c-.853.827-2.213.8-3.053-.026L10.853.64a2.19 2.19 0 0 0-2.52-.413l-.92.453A2.21 2.21 0 0 0 6.2 2.587l-.027 1.4A2.186 2.186 0 0 1 3.987 6.12h-1.4c-.934 0-1.774.6-2.067 1.493l-.32.974a2.2 2.2 0 0 0 .493 2.2l.96 1.013c.827.853.8 2.213-.026 3.053l-.987.987a2.19 2.19 0 0 0-.413 2.52l.453.92a2.17 2.17 0 0 0 1.907 1.2l1.4.027a2.177 2.177 0 0 1 2.133 2.186v1.4c0 .934.6 1.774 1.493 2.067l.974.32a2.19 2.19 0 0 0 2.2-.493l1.013-.974a2.19 2.19 0 0 1 3.053.04l.987.987a2.19 2.19 0 0 0 2.52.413l.92-.453a2.17 2.17 0 0 0 1.2-1.907l.027-1.4a2.177 2.177 0 0 1 2.186-2.133h1.4c.934 0 1.774-.6 2.067-1.493l.32-.974a2.19 2.19 0 0 0-.493-2.2l-.974-1.013zm-8.733 1.413a4.168 4.168 0 0 1-5.894-5.893 4.17 4.17 0 0 1 5.894 0 4.17 4.17 0 0 1 0 5.893\",\n },\n ],\n },\n};\n\n/** Props for {@link CogIcon}. See {@link BaseIconProps} for the shared shape. */\nexport type CogIconProps = BaseIconProps;\n\n/**\n * Cog icon. Renders at sizes 16, 24, or 32 px with outlined and filled variants.\n *\n * @example\n * ```tsx\n * <CogIcon size={24} filled />\n * ```\n */\nexport const CogIcon = React.forwardRef<SVGSVGElement, CogIconProps>((props, ref) => (\n <BaseIcon ref={ref} variants={VARIANTS} {...props} />\n));\n\nCogIcon.displayName = \"CogIcon\";\n"],"names":["React","jsx","BaseIcon"],"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,UAAUA,iBAAM,WAAwC,CAAC,OAAO,QAC3EC,2BAAAA,IAACC,SAAAA,UAAA,EAAS,KAAU,UAAU,UAAW,GAAG,OAAO,CACpD;AAED,QAAQ,cAAc;;"}
|
|
1
|
+
{"version":3,"file":"CogIcon.cjs","sources":["../../../../src/components/Icons/CogIcon.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: \"M7.971 10.581c-.66 0-1.32-.253-1.826-.753a2.587 2.587 0 0 1 0-3.653 2.587 2.587 0 0 1 3.653 0 2.587 2.587 0 0 1 0 3.653 2.57 2.57 0 0 1-1.827.753m0-4.166a1.58 1.58 0 0 0-1.12.46 1.594 1.594 0 0 0 0 2.24c.62.613 1.62.613 2.24 0a1.581 1.581 0 0 0-1.12-2.7\",\n },\n {\n d: \"M9.991 15.168c-.413 0-.82-.16-1.126-.467l-.494-.493a.594.594 0 0 0-.826-.007l-.507.48a1.59 1.59 0 0 1-1.6.36l-.487-.16a1.58 1.58 0 0 1-1.086-1.507v-.7a.58.58 0 0 0-.58-.586l-.7-.014a1.58 1.58 0 0 1-1.387-.88l-.227-.46a1.58 1.58 0 0 1 .3-1.833l.494-.493a.594.594 0 0 0 .006-.827l-.486-.506a1.58 1.58 0 0 1-.36-1.607l.16-.487c.22-.653.82-1.086 1.506-1.086h.7a.58.58 0 0 0 .587-.58l.013-.7a1.58 1.58 0 0 1 .88-1.387l.46-.227a1.58 1.58 0 0 1 1.834.3l.493.494a.594.594 0 0 0 .827.006l.506-.486a1.6 1.6 0 0 1 1.607-.36l.487.16a1.59 1.59 0 0 1 1.086 1.506v.7c0 .327.254.587.58.594l.7.013a1.57 1.57 0 0 1 1.387.88l.227.46a1.58 1.58 0 0 1-.3 1.833l-.494.494a.594.594 0 0 0-.006.826l.486.507c.407.427.547 1.04.36 1.6l-.16.486a1.58 1.58 0 0 1-1.506 1.087h-.7a.58.58 0 0 0-.587.58l-.013.7a1.57 1.57 0 0 1-.88 1.387l-.46.226a1.6 1.6 0 0 1-.714.167zm-2.033-2.127c.407 0 .82.153 1.127.46l.493.494a.59.59 0 0 0 .68.113l.46-.227c.193-.1.32-.293.327-.513l.013-.7c.02-.86.733-1.554 1.587-1.554h.7c.253 0 .48-.16.56-.406l.16-.487a.59.59 0 0 0-.134-.593l-.486-.507c-.594-.62-.58-1.62.026-2.226l.494-.494a.59.59 0 0 0 .113-.68l-.227-.46a.6.6 0 0 0-.513-.326l-.7-.014a1.6 1.6 0 0 1-1.553-1.593v-.7c0-.253-.16-.48-.407-.56l-.487-.16a.59.59 0 0 0-.593.133l-.507.48c-.62.594-1.62.58-2.226-.026l-.494-.494a.59.59 0 0 0-.68-.113l-.46.227a.6.6 0 0 0-.326.513l-.014.7a1.597 1.597 0 0 1-1.586 1.553h-.7c-.254 0-.48.16-.56.407l-.16.487a.59.59 0 0 0 .133.593l.487.507c.593.62.58 1.62-.027 2.226l-.493.494a.59.59 0 0 0-.114.68l.227.46c.1.193.293.32.513.326l.7.014c.86.02 1.554.733 1.554 1.586v.7c0 .253.16.48.406.56l.487.16c.207.067.44.02.593-.133l.507-.48c.307-.293.7-.44 1.1-.44z\",\n },\n ],\n filled: [\n {\n d: \"M13.846 8.716a1.095 1.095 0 0 1 .013-1.526l.494-.494c.333-.333.413-.84.206-1.26l-.226-.46a1.09 1.09 0 0 0-.954-.6l-.7-.013a1.093 1.093 0 0 1-1.066-1.093v-.7c0-.467-.3-.887-.747-1.034l-.487-.16a1.1 1.1 0 0 0-1.1.247l-.506.487c-.427.413-1.107.4-1.527-.014L6.753 1.603a1.1 1.1 0 0 0-1.26-.207l-.46.227c-.36.18-.594.547-.607.953l-.013.7A1.093 1.093 0 0 1 3.32 4.343h-.7c-.466 0-.886.3-1.033.747l-.16.486c-.127.38-.033.807.247 1.1l.48.507c.413.427.4 1.107-.014 1.527L1.647 9.203c-.333.333-.413.84-.207 1.26l.227.46c.18.36.547.593.953.6l.7.013a1.09 1.09 0 0 1 1.067 1.094v.7c0 .466.3.886.747 1.033l.486.16c.387.127.807.033 1.1-.247l.507-.486a1.095 1.095 0 0 1 1.527.02l.493.493c.333.333.84.413 1.26.207L10.966 14.283c.36-.18.593-.547.6-.953l.013-.7a1.09 1.09 0 0 1 1.094-1.067h.7c.466 0 .886-.3 1.033-.747l.16-.486a1.09 1.09 0 0 0-.247-1.1l-.486-.507zm-4.367.707a2.084 2.084 0 1 1-2.946-2.949A2.084 2.084 0 0 1 9.48 9.423\",\n },\n ],\n },\n 24: {\n outlined: [\n {\n d: \"M12.005 15.93c-.99 0-1.98-.38-2.74-1.13a3.88 3.88 0 0 1 0-5.48 3.88 3.88 0 0 1 5.48 0 3.88 3.88 0 0 1 0 5.48c-.76.76-1.75 1.13-2.74 1.13m0-6.25c-.61 0-1.22.23-1.68.69a2.39 2.39 0 0 0 0 3.36c.93.92 2.43.92 3.36 0a2.372 2.372 0 0 0-1.68-4.05\",\n },\n {\n d: \"M15.035 22.81c-.62 0-1.23-.24-1.69-.7l-.74-.74a.89.89 0 0 0-1.24-.01l-.76.72c-.64.61-1.56.82-2.4.54l-.73-.24a2.375 2.375 0 0 1-1.63-2.26v-1.05c0-.49-.38-.88-.87-.88l-1.05-.02c-.89-.02-1.68-.52-2.08-1.32l-.34-.69c-.46-.92-.28-2.03.45-2.75l.74-.74a.89.89 0 0 0 .01-1.24l-.73-.76c-.62-.64-.82-1.56-.54-2.41l.24-.73c.33-.98 1.23-1.63 2.26-1.63h1.05c.49 0 .88-.38.88-.87l.02-1.05c.02-.89.53-1.69 1.32-2.08l.69-.34c.92-.46 2.03-.28 2.75.45l.74.74c.34.34.89.34 1.24.01l.76-.73c.64-.61 1.56-.82 2.41-.54l.73.24c.98.33 1.63 1.24 1.63 2.26v1.05c0 .49.38.88.87.89l1.05.02c.89.02 1.69.52 2.08 1.32l.34.69c.46.92.28 2.03-.45 2.75l-.74.74a.89.89 0 0 0-.01 1.24l.73.76c.61.64.82 1.56.54 2.4l-.24.73c-.33.98-1.23 1.63-2.26 1.63h-1.05c-.49 0-.88.38-.88.87l-.02 1.05c-.02.89-.52 1.69-1.32 2.08l-.69.34c-.34.17-.71.25-1.07.25zm-3.05-3.19c.61 0 1.23.23 1.69.69l.74.74c.27.27.68.34 1.02.17l.69-.34c.29-.15.48-.44.49-.77l.02-1.05c.03-1.29 1.1-2.33 2.38-2.33h1.05c.38 0 .72-.24.84-.61l.24-.73c.1-.31.03-.65-.2-.89l-.73-.76c-.89-.93-.87-2.43.04-3.34l.74-.74c.27-.27.34-.68.17-1.02l-.34-.69a.9.9 0 0 0-.77-.49l-1.05-.02a2.4 2.4 0 0 1-2.33-2.39v-1.05a.88.88 0 0 0-.61-.84l-.73-.24a.89.89 0 0 0-.89.2l-.76.72c-.93.89-2.43.87-3.34-.04l-.74-.74a.88.88 0 0 0-1.02-.17l-.69.34c-.29.15-.48.44-.49.77l-.02 1.05a2.395 2.395 0 0 1-2.38 2.33h-1.05a.88.88 0 0 0-.84.61l-.24.73c-.1.31-.03.66.2.89l.73.76c.89.93.87 2.43-.04 3.34l-.74.74c-.27.27-.34.68-.17 1.02l.34.69c.15.29.44.48.77.49l1.05.02c1.29.03 2.33 1.1 2.33 2.38v1.05c0 .38.24.72.61.84l.73.24c.31.1.66.03.89-.2l.76-.72c.46-.44 1.05-.66 1.65-.66z\",\n },\n ],\n filled: [\n {\n d: \"M20.77 13.145c-.62-.64-.6-1.66.02-2.29l.74-.74c.5-.5.62-1.26.31-1.89l-.34-.69a1.63 1.63 0 0 0-1.43-.9l-1.05-.02a1.64 1.64 0 0 1-1.6-1.64V3.925c0-.7-.45-1.33-1.12-1.55l-.73-.24a1.64 1.64 0 0 0-1.65.37l-.76.73c-.64.62-1.66.6-2.29-.02L10.13 2.475c-.5-.5-1.26-.62-1.89-.31l-.69.34c-.54.27-.89.82-.91 1.43l-.02 1.05c-.02.89-.75 1.6-1.64 1.6H3.93c-.7 0-1.33.45-1.55 1.12l-.24.73c-.19.57-.05 1.21.37 1.65l.72.76c.62.64.6 1.66-.02 2.29l-.74.74c-.5.5-.62 1.26-.31 1.89l.34.69c.27.54.82.89 1.43.9l1.05.02c.89.02 1.6.74 1.6 1.64v1.05c0 .7.45 1.33 1.12 1.55l.73.24c.58.19 1.21.05 1.65-.37l.76-.73c.64-.61 1.66-.6 2.29.03l.74.74c.5.5 1.26.62 1.89.31l.69-.34c.54-.27.89-.82.9-1.43l.02-1.05c.02-.89.74-1.6 1.64-1.6h1.05c.7 0 1.33-.45 1.55-1.12l.24-.73c.19-.58.05-1.21-.37-1.65l-.73-.76zm-6.55 1.06a3.126 3.126 0 0 1-4.42-4.42 3.126 3.126 0 0 1 4.42 4.42\",\n },\n ],\n },\n 32: {\n outlined: [\n {\n d: \"M16.007 21.162a5.2 5.2 0 0 1-3.653-1.506 5.174 5.174 0 0 1 0-7.307 5.174 5.174 0 0 1 7.307 0 5.174 5.174 0 0 1 0 7.307 5.14 5.14 0 0 1-3.654 1.506m0-8.333c-.813 0-1.626.307-2.24.92a3.187 3.187 0 0 0 0 4.48 3.187 3.187 0 0 0 4.48 0 3.158 3.158 0 0 0-2.24-5.4\",\n },\n {\n d: \"M20.048 30.336a3.18 3.18 0 0 1-2.254-.934l-.987-.986a1.187 1.187 0 0 0-1.653-.014l-1.013.96a3.18 3.18 0 0 1-3.2.72l-.974-.32a3.17 3.17 0 0 1-2.173-3.013v-1.4c0-.653-.507-1.173-1.16-1.173l-1.4-.027a3.16 3.16 0 0 1-2.773-1.76l-.454-.92a3.16 3.16 0 0 1 .6-3.667l.987-.986a1.19 1.19 0 0 0 .013-1.654l-.973-1.013a3.17 3.17 0 0 1-.72-3.213l.32-.974a3.17 3.17 0 0 1 3.013-2.173h1.4c.654 0 1.174-.507 1.174-1.16l.026-1.4A3.17 3.17 0 0 1 9.607 2.456l.92-.454a3.16 3.16 0 0 1 3.667.6l.987.987a1.187 1.187 0 0 0 1.653.013l1.014-.973a3.19 3.19 0 0 1 3.213-.72l.973.32a3.18 3.18 0 0 1 2.174 3.013v1.4c0 .654.506 1.174 1.16 1.187l1.4.027a3.14 3.14 0 0 1 2.773 1.76l.453.92a3.16 3.16 0 0 1-.6 3.666l-.986.987a1.187 1.187 0 0 0-.014 1.653l.974 1.014a3.18 3.18 0 0 1 .72 3.2l-.32.973a3.17 3.17 0 0 1-3.014 2.173h-1.4c-.653 0-1.173.507-1.173 1.16l-.027 1.4a3.14 3.14 0 0 1-1.76 2.774l-.92.453a3.2 3.2 0 0 1-1.427.333zm-4.067-4.254c.813 0 1.64.307 2.253.92l.987.987c.36.36.906.453 1.36.227l.92-.454c.387-.2.64-.586.653-1.026l.027-1.4a3.194 3.194 0 0 1 3.173-3.107h1.4c.507 0 .96-.32 1.12-.813l.32-.974a1.18 1.18 0 0 0-.267-1.186l-.973-1.014c-1.187-1.24-1.16-3.24.053-4.453l.987-.987c.36-.36.453-.906.227-1.36l-.454-.92c-.2-.386-.586-.64-1.026-.653l-1.4-.027a3.197 3.197 0 0 1-3.107-3.186v-1.4c0-.507-.32-.96-.813-1.12l-.974-.32a1.18 1.18 0 0 0-1.186.266l-1.014.96c-1.24 1.187-3.24 1.16-4.453-.053l-.987-.987a1.18 1.18 0 0 0-1.36-.226l-.92.453c-.386.2-.64.587-.653 1.027l-.027 1.4a3.194 3.194 0 0 1-3.173 3.106h-1.4c-.507 0-.96.32-1.12.814l-.32.973c-.133.413-.04.88.267 1.187l.973 1.013c1.187 1.24 1.16 3.24-.053 4.453l-.987.987a1.18 1.18 0 0 0-.227 1.36l.454.92c.2.387.586.64 1.026.653l1.4.027a3.194 3.194 0 0 1 3.107 3.173v1.4c0 .507.32.96.813 1.12l.974.32c.413.134.88.04 1.186-.266l1.014-.96a3.16 3.16 0 0 1 2.2-.88z\",\n },\n ],\n filled: [\n {\n d: \"M27.6 17.527c-.827-.854-.8-2.214.027-3.054l.986-.986c.667-.667.827-1.68.414-2.52l-.454-.92a2.17 2.17 0 0 0-1.906-1.2l-1.4-.027a2.186 2.186 0 0 1-2.134-2.187v-1.4c0-.933-.6-1.773-1.493-2.066l-.973-.32a2.19 2.19 0 0 0-2.2.493l-1.014.973c-.853.827-2.213.8-3.053-.026L13.413 3.3a2.19 2.19 0 0 0-2.52-.413l-.92.453A2.21 2.21 0 0 0 8.76 5.247l-.027 1.4A2.186 2.186 0 0 1 6.547 8.78h-1.4c-.934 0-1.774.6-2.067 1.493l-.32.974a2.2 2.2 0 0 0 .493 2.2l.96 1.013c.827.853.8 2.213-.026 3.053l-.987.987a2.19 2.19 0 0 0-.413 2.52l.453.92a2.17 2.17 0 0 0 1.907 1.2l1.4.027a2.177 2.177 0 0 1 2.133 2.186v1.4c0 .934.6 1.774 1.493 2.067l.974.32a2.19 2.19 0 0 0 2.2-.493l1.013-.974a2.19 2.19 0 0 1 3.053.04l.987.987a2.19 2.19 0 0 0 2.52.413l.92-.453a2.17 2.17 0 0 0 1.2-1.907l.027-1.4a2.177 2.177 0 0 1 2.186-2.133h1.4c.934 0 1.774-.6 2.067-1.493l.32-.974a2.19 2.19 0 0 0-.493-2.2l-.974-1.013zm-8.733 1.413a4.168 4.168 0 0 1-5.894-5.893 4.17 4.17 0 0 1 5.894 0 4.17 4.17 0 0 1 0 5.893\",\n },\n ],\n },\n};\n\n/** Props for {@link CogIcon}. See {@link BaseIconProps} for the shared shape. */\nexport type CogIconProps = BaseIconProps;\n\n/**\n * Cog icon. Renders at sizes 16, 24, or 32 px with outlined and filled variants.\n *\n * @example\n * ```tsx\n * <CogIcon size={24} filled />\n * ```\n */\nexport const CogIcon = React.forwardRef<SVGSVGElement, CogIconProps>((props, ref) => (\n <BaseIcon ref={ref} variants={VARIANTS} {...props} />\n));\n\nCogIcon.displayName = \"CogIcon\";\n"],"names":["React","jsx","BaseIcon"],"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,UAAUA,iBAAM,WAAwC,CAAC,OAAO,QAC3EC,2BAAAA,IAACC,SAAAA,UAAA,EAAS,KAAU,UAAU,UAAW,GAAG,OAAO,CACpD;AAED,QAAQ,cAAc;;"}
|
|
@@ -55,6 +55,7 @@ const Select = React__namespace.forwardRef(
|
|
|
55
55
|
label,
|
|
56
56
|
helperText,
|
|
57
57
|
size = "48",
|
|
58
|
+
variant = "default",
|
|
58
59
|
error = false,
|
|
59
60
|
errorMessage,
|
|
60
61
|
placeholder,
|
|
@@ -72,6 +73,7 @@ const Select = React__namespace.forwardRef(
|
|
|
72
73
|
const triggerId = id ?? generatedId;
|
|
73
74
|
const helperTextId = `${triggerId}-helper`;
|
|
74
75
|
const bottomText = error && errorMessage ? errorMessage : helperText;
|
|
76
|
+
const isFilled = variant === "filled";
|
|
75
77
|
return /* @__PURE__ */ jsxRuntime.jsx(SelectContext.Provider, { value: { size, error, disabled }, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
76
78
|
"div",
|
|
77
79
|
{
|
|
@@ -98,13 +100,14 @@ const Select = React__namespace.forwardRef(
|
|
|
98
100
|
"aria-describedby": bottomText ? helperTextId : void 0,
|
|
99
101
|
"aria-invalid": error || void 0,
|
|
100
102
|
className: cn.cn(
|
|
101
|
-
"flex w-full cursor-pointer items-center
|
|
103
|
+
"flex w-full cursor-pointer items-center rounded-sm border outline-none focus-visible:shadow-focus-ring motion-safe:transition-colors",
|
|
102
104
|
TRIGGER_HEIGHT[size],
|
|
103
|
-
TRIGGER_PADDING_X[size],
|
|
105
|
+
isFilled ? "px-2" : TRIGGER_PADDING_X[size],
|
|
104
106
|
TRIGGER_GAP[size],
|
|
105
107
|
TRIGGER_TYPOGRAPHY[size],
|
|
106
|
-
|
|
107
|
-
|
|
108
|
+
isFilled ? "justify-center bg-background-secondary text-content-tertiary" : "justify-between bg-inputs-inputs-primary",
|
|
109
|
+
error ? "border-error-content" : isFilled ? "border-transparent" : "border-border-primary",
|
|
110
|
+
!disabled && !error && (isFilled ? "hover:bg-neutral-alphas-100 data-[state=open]:bg-neutral-alphas-100" : "hover:border-neutral-alphas-400 data-[state=open]:border-neutral-alphas-400"),
|
|
108
111
|
disabled && "cursor-not-allowed opacity-50"
|
|
109
112
|
),
|
|
110
113
|
children: [
|
|
@@ -117,9 +120,18 @@ const Select = React__namespace.forwardRef(
|
|
|
117
120
|
children: leftIcon
|
|
118
121
|
}
|
|
119
122
|
),
|
|
120
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
123
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
124
|
+
"span",
|
|
125
|
+
{
|
|
126
|
+
className: cn.cn(
|
|
127
|
+
"min-w-0 flex-1 truncate [&>[data-placeholder]]:text-content-tertiary",
|
|
128
|
+
isFilled ? "text-center text-content-tertiary" : "text-left text-content-primary"
|
|
129
|
+
),
|
|
130
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Value, { placeholder })
|
|
131
|
+
}
|
|
132
|
+
)
|
|
121
133
|
] }),
|
|
122
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Icon, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ChevronDownIcon.ChevronDownIcon, {}) })
|
|
134
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Icon, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ChevronDownIcon.ChevronDownIcon, { size: isFilled ? 16 : 24, className: "shrink-0" }) })
|
|
123
135
|
]
|
|
124
136
|
}
|
|
125
137
|
),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.cjs","sources":["../../../../src/components/Select/Select.tsx"],"sourcesContent":["import * as SelectPrimitive from \"@radix-ui/react-select\";\nimport * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { FLOATING_CONTENT_COLLISION_PADDING } from \"@/utils/floatingContentCollisionPadding\";\nimport { CheckIcon } from \"../Icons/CheckIcon\";\nimport { ChevronDownIcon } from \"../Icons/ChevronDownIcon\";\n\n/** Select field height in pixels. */\nexport type SelectSize = \"48\" | \"40\" | \"32\";\n\ntype SelectContextValue = {\n size: SelectSize;\n error: boolean;\n disabled?: boolean;\n};\n\nconst SelectContext = React.createContext<SelectContextValue>({\n size: \"48\",\n error: false,\n});\n\nconst TRIGGER_HEIGHT: Record<SelectSize, string> = {\n \"48\": \"h-12\",\n \"40\": \"h-10\",\n \"32\": \"h-8\",\n};\n\nconst TRIGGER_PADDING_X: Record<SelectSize, string> = {\n \"48\": \"px-4\",\n \"40\": \"px-4\",\n \"32\": \"px-3\",\n};\n\nconst TRIGGER_GAP: Record<SelectSize, string> = {\n \"48\": \"gap-3\",\n \"40\": \"gap-3\",\n \"32\": \"gap-2\",\n};\n\nconst TRIGGER_TYPOGRAPHY: Record<SelectSize, string> = {\n \"48\": \"typography-body-default-16px-regular\",\n \"40\": \"typography-body-default-16px-regular\",\n \"32\": \"typography-body-small-14px-regular\",\n};\n\nexport interface SelectProps extends Omit<SelectPrimitive.SelectProps, \"dir\"> {\n /** Label text displayed above the trigger. Also used as the accessible name. */\n label?: string;\n /** Accessible name applied directly to the trigger button when no visible `label` is provided. */\n \"aria-label\"?: string;\n /** ID of an external element that labels the trigger button. */\n \"aria-labelledby\"?: string;\n /** Helper text displayed below the trigger. Replaced by `errorMessage` when `error` is `true`. */\n helperText?: string;\n /** Height of the select field in pixels. @default \"48\" */\n size?: SelectSize;\n /** Whether the field is in an error state. @default false */\n error?: boolean;\n /** Error message displayed below the trigger. Shown instead of `helperText` when `error` is `true`. */\n errorMessage?: string;\n /** Placeholder shown when no value is selected. */\n placeholder?: string;\n /** Icon element displayed at the left side of the trigger. */\n leftIcon?: React.ReactNode;\n /** Whether the field stretches to fill its container width. @default false */\n fullWidth?: boolean;\n /** Wraps the `className` of the outermost container div. */\n className?: string;\n /** HTML `id` applied to the trigger button. Auto-generated if omitted. */\n id?: string;\n}\n\n/**\n * A select field with optional label, helper/error text, and an icon slot,\n * built on Radix UI Select for full accessibility and keyboard navigation.\n *\n * Pair with {@link SelectContent} and {@link SelectItem} to provide options.\n *\n * @example\n * ```tsx\n * <Select label=\"Country\" placeholder=\"Select a country\">\n * <SelectContent>\n * <SelectItem value=\"us\">United States</SelectItem>\n * <SelectItem value=\"uk\">United Kingdom</SelectItem>\n * </SelectContent>\n * </Select>\n * ```\n */\nexport const Select = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Trigger>,\n SelectProps\n>(\n (\n {\n label,\n helperText,\n size = \"48\",\n error = false,\n errorMessage,\n placeholder,\n leftIcon,\n fullWidth = false,\n className,\n id,\n disabled,\n children,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n ...props\n },\n ref,\n ) => {\n const generatedId = React.useId();\n const triggerId = id ?? generatedId;\n const helperTextId = `${triggerId}-helper`;\n const bottomText = error && errorMessage ? errorMessage : helperText;\n\n return (\n <SelectContext.Provider value={{ size, error, disabled }}>\n <div\n className={cn(\"flex flex-col\", fullWidth && \"w-full\", className)}\n data-disabled={disabled ? \"\" : undefined}\n data-error={error ? \"\" : undefined}\n >\n {label && (\n <label\n htmlFor={triggerId}\n className=\"typography-description-12px-semibold pb-2 text-content-primary\"\n >\n {label}\n </label>\n )}\n\n <SelectPrimitive.Root disabled={disabled} {...props}>\n <SelectPrimitive.Trigger\n ref={ref}\n id={triggerId}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={bottomText ? helperTextId : undefined}\n aria-invalid={error || undefined}\n className={cn(\n \"flex w-full cursor-pointer items-center justify-between rounded-sm border bg-inputs-inputs-primary outline-none focus-visible:shadow-focus-ring motion-safe:transition-colors\",\n TRIGGER_HEIGHT[size],\n TRIGGER_PADDING_X[size],\n TRIGGER_GAP[size],\n TRIGGER_TYPOGRAPHY[size],\n error ? \"border-error-content\" : \"border-border-primary\",\n !disabled &&\n !error &&\n \"hover:border-neutral-alphas-400 data-[state=open]:border-neutral-alphas-400\",\n disabled && \"cursor-not-allowed opacity-50\",\n )}\n >\n <div className=\"flex min-w-0 items-center gap-2\">\n {leftIcon && (\n <span\n className=\"flex size-5 shrink-0 items-center justify-center text-content-secondary\"\n data-testid=\"left-icon\"\n >\n {leftIcon}\n </span>\n )}\n <span className=\"min-w-0 flex-1 truncate text-left text-content-primary [&>[data-placeholder]]:text-content-tertiary\">\n <SelectPrimitive.Value placeholder={placeholder} />\n </span>\n </div>\n\n <SelectPrimitive.Icon asChild>\n <ChevronDownIcon />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n\n {children}\n </SelectPrimitive.Root>\n\n {bottomText && (\n <p\n id={helperTextId}\n className={cn(\n \"typography-description-12px-regular px-2 pt-1 pb-0.5\",\n error ? \"text-error-content\" : \"text-content-secondary\",\n )}\n >\n {bottomText}\n </p>\n )}\n </div>\n </SelectContext.Provider>\n );\n },\n);\n\nSelect.displayName = \"Select\";\n\nexport interface SelectContentProps\n extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> {}\n\n/**\n * The dropdown panel rendered inside a portal. Place {@link SelectItem} elements\n * (and optionally {@link SelectGroup} / {@link SelectLabel}) as children.\n */\nexport const SelectContent = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Content>,\n SelectContentProps\n>(\n (\n {\n className,\n children,\n position = \"popper\",\n sideOffset = 4,\n collisionPadding = FLOATING_CONTENT_COLLISION_PADDING,\n style,\n ...props\n },\n ref,\n ) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\n position={position}\n sideOffset={sideOffset}\n collisionPadding={collisionPadding}\n style={{ zIndex: \"var(--fanvue-ui-portal-z-index, 50)\", ...style }}\n className={cn(\n \"relative w-max min-w-(--radix-select-trigger-width) max-w-(--radix-select-content-available-width) overflow-hidden rounded-sm border border-neutral-alphas-200 bg-background-primary text-content-primary shadow-[0_4px_16px_rgba(0,0,0,0.10)]\",\n \"data-[state=closed]:animate-out data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n \"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95\",\n \"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2\",\n className,\n )}\n {...props}\n >\n <SelectPrimitive.Viewport className=\"max-h-[var(--radix-select-content-available-height)] overflow-y-auto p-1\">\n {children}\n </SelectPrimitive.Viewport>\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n ),\n);\n\nSelectContent.displayName = \"SelectContent\";\n\n/** Dropdown row height in pixels, matching the V2 Menu Item spec. */\nexport type SelectItemSize = \"40\" | \"32\";\n\nconst ITEM_SIZE_CLASSES: Record<SelectItemSize, string> = {\n \"40\": \"min-h-10 py-2 typography-body-default-16px-regular\",\n \"32\": \"min-h-8 py-[7px] typography-body-small-14px-regular\",\n};\n\nconst ITEM_DESCRIPTION_TYPOGRAPHY: Record<SelectItemSize, string> = {\n \"40\": \"typography-body-small-14px-regular\",\n \"32\": \"typography-description-12px-regular\",\n};\n\nexport interface SelectItemProps\n extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item> {\n /** Row height. Defaults to the parent {@link Select} size (`48`/`40` → `40`, `32` → `32`). */\n size?: SelectItemSize;\n /** Icon (or other node) rendered before the label. Ignored when {@link SelectItemProps.avatar} is set. */\n leadingIcon?: React.ReactNode;\n /**\n * Leading avatar rendered in place of {@link SelectItemProps.leadingIcon}, for rows\n * representing a person or account. Pass an `Avatar` sized to `24`. Takes precedence over `leadingIcon`.\n */\n avatar?: React.ReactNode;\n /** Optional secondary text rendered on a second line below the label. */\n description?: React.ReactNode;\n}\n\n/**\n * Whether a `ReactNode` will actually render. Excludes `null`/`undefined` and\n * booleans so short-circuit props (e.g. `description={cond && \"…\"}`) don't flip\n * the item into a two-line/avatar layout when they resolve to `false`.\n */\nfunction isRenderableNode(node: React.ReactNode): boolean {\n return node !== null && node !== undefined && typeof node !== \"boolean\";\n}\n\n/**\n * An individual option inside {@link SelectContent}, following the V2 Menu Item spec.\n *\n * Supports a leading icon or avatar, an optional two-line layout via `description`,\n * and the standard hover / selected / disabled states. The selected row is marked\n * with a trailing check indicator.\n *\n * @example\n * ```tsx\n * <SelectItem value=\"jane\" avatar={<Avatar size={24} fallback=\"JD\" />} description=\"Product designer\">\n * Jane Doe\n * </SelectItem>\n * ```\n */\nexport const SelectItem = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Item>,\n SelectItemProps\n>(({ className, children, size, leadingIcon, avatar, description, ...props }, ref) => {\n const { size: triggerSize } = React.useContext(SelectContext);\n const itemSize: SelectItemSize = size ?? (triggerSize === \"32\" ? \"32\" : \"40\");\n const hasDescription = isRenderableNode(description);\n const hasAvatar = isRenderableNode(avatar);\n const hasLeadingIcon = isRenderableNode(leadingIcon);\n\n return (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"group relative flex w-full cursor-pointer select-none gap-2 rounded-xs px-3 text-content-primary outline-none\",\n hasDescription ? \"items-start\" : \"items-center\",\n ITEM_SIZE_CLASSES[itemSize],\n hasAvatar && !hasDescription && itemSize === \"32\" && \"py-1\",\n \"focus:bg-neutral-alphas-50 data-highlighted:bg-neutral-alphas-50\",\n \"data-disabled:pointer-events-none data-disabled:text-content-disabled\",\n className,\n )}\n {...props}\n >\n {hasAvatar ? (\n <span className=\"shrink-0\">{avatar}</span>\n ) : (\n hasLeadingIcon &&\n (hasDescription ? (\n <span className=\"flex shrink-0 items-center pt-0.5 [&>svg]:size-4\">{leadingIcon}</span>\n ) : (\n <span className=\"flex shrink-0 items-center [&>svg]:size-4\">{leadingIcon}</span>\n ))\n )}\n\n {hasDescription ? (\n <span className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <span className=\"truncate\">\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </span>\n <span\n className={cn(\n \"truncate text-content-secondary group-data-[disabled]:text-content-disabled\",\n ITEM_DESCRIPTION_TYPOGRAPHY[itemSize],\n )}\n >\n {description}\n </span>\n </span>\n ) : (\n <span className=\"min-w-0 flex-1 truncate\">\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </span>\n )}\n\n <SelectPrimitive.ItemIndicator\n className={cn(\n \"ml-auto flex size-4 shrink-0 items-center justify-center\",\n hasDescription && \"self-start\",\n )}\n >\n <CheckIcon className=\"size-4 text-content-primary group-data-[disabled]:text-content-disabled\" />\n </SelectPrimitive.ItemIndicator>\n </SelectPrimitive.Item>\n );\n});\n\nSelectItem.displayName = \"SelectItem\";\n\n/** Props for {@link SelectGroup}. */\nexport type SelectGroupProps = React.ComponentPropsWithoutRef<typeof SelectPrimitive.Group>;\n\n/**\n * Groups related {@link SelectItem} elements under a {@link SelectLabel}.\n */\nexport const SelectGroup = SelectPrimitive.Group;\nSelectGroup.displayName = \"SelectGroup\";\n\nexport interface SelectLabelProps\n extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label> {}\n\n/**\n * A non-interactive label shown above a {@link SelectGroup}.\n */\nexport const SelectLabel = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Label>,\n SelectLabelProps\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n className={cn(\n \"typography-description-12px-semibold px-3 py-1.5 text-content-secondary\",\n className,\n )}\n {...props}\n />\n));\n\nSelectLabel.displayName = \"SelectLabel\";\n\nexport interface SelectSeparatorProps\n extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator> {}\n\n/** A horizontal rule that visually separates groups in {@link SelectContent}. */\nexport const SelectSeparator = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Separator>,\n SelectSeparatorProps\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-neutral-alphas-200\", className)}\n {...props}\n />\n));\n\nSelectSeparator.displayName = \"SelectSeparator\";\n"],"names":["React","jsx","jsxs","cn","SelectPrimitive","ChevronDownIcon","FLOATING_CONTENT_COLLISION_PADDING","CheckIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAM,gBAAgBA,iBAAM,cAAkC;AAAA,EAC5D,MAAM;AAAA,EACN,OAAO;AACT,CAAC;AAED,MAAM,iBAA6C;AAAA,EACjD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,oBAAgD;AAAA,EACpD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,cAA0C;AAAA,EAC9C,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,qBAAiD;AAAA,EACrD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;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ED,gBAAgB,cAAc;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"Select.cjs","sources":["../../../../src/components/Select/Select.tsx"],"sourcesContent":["import * as SelectPrimitive from \"@radix-ui/react-select\";\nimport * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { FLOATING_CONTENT_COLLISION_PADDING } from \"@/utils/floatingContentCollisionPadding\";\nimport { CheckIcon } from \"../Icons/CheckIcon\";\nimport { ChevronDownIcon } from \"../Icons/ChevronDownIcon\";\n\n/** Select field height in pixels. */\nexport type SelectSize = \"48\" | \"40\" | \"32\";\n\n/**\n * Trigger surface. `\"default\"` is the bordered input field; `\"filled\"` is the\n * V2 Table Tab Actions pill: a `background-secondary` fill with no border and a\n * centred `content-tertiary` label, for filters that sit beside a table or chart.\n */\nexport type SelectVariant = \"default\" | \"filled\";\n\ntype SelectContextValue = {\n size: SelectSize;\n error: boolean;\n disabled?: boolean;\n};\n\nconst SelectContext = React.createContext<SelectContextValue>({\n size: \"48\",\n error: false,\n});\n\nconst TRIGGER_HEIGHT: Record<SelectSize, string> = {\n \"48\": \"h-12\",\n \"40\": \"h-10\",\n \"32\": \"h-8\",\n};\n\nconst TRIGGER_PADDING_X: Record<SelectSize, string> = {\n \"48\": \"px-4\",\n \"40\": \"px-4\",\n \"32\": \"px-3\",\n};\n\nconst TRIGGER_GAP: Record<SelectSize, string> = {\n \"48\": \"gap-3\",\n \"40\": \"gap-3\",\n \"32\": \"gap-2\",\n};\n\nconst TRIGGER_TYPOGRAPHY: Record<SelectSize, string> = {\n \"48\": \"typography-body-default-16px-regular\",\n \"40\": \"typography-body-default-16px-regular\",\n \"32\": \"typography-body-small-14px-regular\",\n};\n\nexport interface SelectProps extends Omit<SelectPrimitive.SelectProps, \"dir\"> {\n /** Label text displayed above the trigger. Also used as the accessible name. */\n label?: string;\n /** Accessible name applied directly to the trigger button when no visible `label` is provided. */\n \"aria-label\"?: string;\n /** ID of an external element that labels the trigger button. */\n \"aria-labelledby\"?: string;\n /** Helper text displayed below the trigger. Replaced by `errorMessage` when `error` is `true`. */\n helperText?: string;\n /** Height of the select field in pixels. @default \"48\" */\n size?: SelectSize;\n /** Trigger surface. See {@link SelectVariant}. @default \"default\" */\n variant?: SelectVariant;\n /** Whether the field is in an error state. @default false */\n error?: boolean;\n /** Error message displayed below the trigger. Shown instead of `helperText` when `error` is `true`. */\n errorMessage?: string;\n /** Placeholder shown when no value is selected. */\n placeholder?: string;\n /** Icon element displayed at the left side of the trigger. */\n leftIcon?: React.ReactNode;\n /** Whether the field stretches to fill its container width. @default false */\n fullWidth?: boolean;\n /** Wraps the `className` of the outermost container div. */\n className?: string;\n /** HTML `id` applied to the trigger button. Auto-generated if omitted. */\n id?: string;\n}\n\n/**\n * A select field with optional label, helper/error text, and an icon slot,\n * built on Radix UI Select for full accessibility and keyboard navigation.\n *\n * Pair with {@link SelectContent} and {@link SelectItem} to provide options.\n *\n * @example\n * ```tsx\n * <Select label=\"Country\" placeholder=\"Select a country\">\n * <SelectContent>\n * <SelectItem value=\"us\">United States</SelectItem>\n * <SelectItem value=\"uk\">United Kingdom</SelectItem>\n * </SelectContent>\n * </Select>\n * ```\n */\nexport const Select = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Trigger>,\n SelectProps\n>(\n (\n {\n label,\n helperText,\n size = \"48\",\n variant = \"default\",\n error = false,\n errorMessage,\n placeholder,\n leftIcon,\n fullWidth = false,\n className,\n id,\n disabled,\n children,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n ...props\n },\n ref,\n ) => {\n const generatedId = React.useId();\n const triggerId = id ?? generatedId;\n const helperTextId = `${triggerId}-helper`;\n const bottomText = error && errorMessage ? errorMessage : helperText;\n const isFilled = variant === \"filled\";\n\n return (\n <SelectContext.Provider value={{ size, error, disabled }}>\n <div\n className={cn(\"flex flex-col\", fullWidth && \"w-full\", className)}\n data-disabled={disabled ? \"\" : undefined}\n data-error={error ? \"\" : undefined}\n >\n {label && (\n <label\n htmlFor={triggerId}\n className=\"typography-description-12px-semibold pb-2 text-content-primary\"\n >\n {label}\n </label>\n )}\n\n <SelectPrimitive.Root disabled={disabled} {...props}>\n <SelectPrimitive.Trigger\n ref={ref}\n id={triggerId}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={bottomText ? helperTextId : undefined}\n aria-invalid={error || undefined}\n className={cn(\n \"flex w-full cursor-pointer items-center rounded-sm border outline-none focus-visible:shadow-focus-ring motion-safe:transition-colors\",\n TRIGGER_HEIGHT[size],\n isFilled ? \"px-2\" : TRIGGER_PADDING_X[size],\n TRIGGER_GAP[size],\n TRIGGER_TYPOGRAPHY[size],\n isFilled\n ? \"justify-center bg-background-secondary text-content-tertiary\"\n : \"justify-between bg-inputs-inputs-primary\",\n error\n ? \"border-error-content\"\n : isFilled\n ? \"border-transparent\"\n : \"border-border-primary\",\n !disabled &&\n !error &&\n (isFilled\n ? \"hover:bg-neutral-alphas-100 data-[state=open]:bg-neutral-alphas-100\"\n : \"hover:border-neutral-alphas-400 data-[state=open]:border-neutral-alphas-400\"),\n disabled && \"cursor-not-allowed opacity-50\",\n )}\n >\n <div className=\"flex min-w-0 items-center gap-2\">\n {leftIcon && (\n <span\n className=\"flex size-5 shrink-0 items-center justify-center text-content-secondary\"\n data-testid=\"left-icon\"\n >\n {leftIcon}\n </span>\n )}\n <span\n className={cn(\n \"min-w-0 flex-1 truncate [&>[data-placeholder]]:text-content-tertiary\",\n isFilled\n ? \"text-center text-content-tertiary\"\n : \"text-left text-content-primary\",\n )}\n >\n <SelectPrimitive.Value placeholder={placeholder} />\n </span>\n </div>\n\n <SelectPrimitive.Icon asChild>\n <ChevronDownIcon size={isFilled ? 16 : 24} className=\"shrink-0\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n\n {children}\n </SelectPrimitive.Root>\n\n {bottomText && (\n <p\n id={helperTextId}\n className={cn(\n \"typography-description-12px-regular px-2 pt-1 pb-0.5\",\n error ? \"text-error-content\" : \"text-content-secondary\",\n )}\n >\n {bottomText}\n </p>\n )}\n </div>\n </SelectContext.Provider>\n );\n },\n);\n\nSelect.displayName = \"Select\";\n\nexport interface SelectContentProps\n extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> {}\n\n/**\n * The dropdown panel rendered inside a portal. Place {@link SelectItem} elements\n * (and optionally {@link SelectGroup} / {@link SelectLabel}) as children.\n */\nexport const SelectContent = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Content>,\n SelectContentProps\n>(\n (\n {\n className,\n children,\n position = \"popper\",\n sideOffset = 4,\n collisionPadding = FLOATING_CONTENT_COLLISION_PADDING,\n style,\n ...props\n },\n ref,\n ) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\n position={position}\n sideOffset={sideOffset}\n collisionPadding={collisionPadding}\n style={{ zIndex: \"var(--fanvue-ui-portal-z-index, 50)\", ...style }}\n className={cn(\n \"relative w-max min-w-(--radix-select-trigger-width) max-w-(--radix-select-content-available-width) overflow-hidden rounded-sm border border-neutral-alphas-200 bg-background-primary text-content-primary shadow-[0_4px_16px_rgba(0,0,0,0.10)]\",\n \"data-[state=closed]:animate-out data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n \"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95\",\n \"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2\",\n className,\n )}\n {...props}\n >\n <SelectPrimitive.Viewport className=\"max-h-[var(--radix-select-content-available-height)] overflow-y-auto p-1\">\n {children}\n </SelectPrimitive.Viewport>\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n ),\n);\n\nSelectContent.displayName = \"SelectContent\";\n\n/** Dropdown row height in pixels, matching the V2 Menu Item spec. */\nexport type SelectItemSize = \"40\" | \"32\";\n\nconst ITEM_SIZE_CLASSES: Record<SelectItemSize, string> = {\n \"40\": \"min-h-10 py-2 typography-body-default-16px-regular\",\n \"32\": \"min-h-8 py-[7px] typography-body-small-14px-regular\",\n};\n\nconst ITEM_DESCRIPTION_TYPOGRAPHY: Record<SelectItemSize, string> = {\n \"40\": \"typography-body-small-14px-regular\",\n \"32\": \"typography-description-12px-regular\",\n};\n\nexport interface SelectItemProps\n extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item> {\n /** Row height. Defaults to the parent {@link Select} size (`48`/`40` → `40`, `32` → `32`). */\n size?: SelectItemSize;\n /** Icon (or other node) rendered before the label. Ignored when {@link SelectItemProps.avatar} is set. */\n leadingIcon?: React.ReactNode;\n /**\n * Leading avatar rendered in place of {@link SelectItemProps.leadingIcon}, for rows\n * representing a person or account. Pass an `Avatar` sized to `24`. Takes precedence over `leadingIcon`.\n */\n avatar?: React.ReactNode;\n /** Optional secondary text rendered on a second line below the label. */\n description?: React.ReactNode;\n}\n\n/**\n * Whether a `ReactNode` will actually render. Excludes `null`/`undefined` and\n * booleans so short-circuit props (e.g. `description={cond && \"…\"}`) don't flip\n * the item into a two-line/avatar layout when they resolve to `false`.\n */\nfunction isRenderableNode(node: React.ReactNode): boolean {\n return node !== null && node !== undefined && typeof node !== \"boolean\";\n}\n\n/**\n * An individual option inside {@link SelectContent}, following the V2 Menu Item spec.\n *\n * Supports a leading icon or avatar, an optional two-line layout via `description`,\n * and the standard hover / selected / disabled states. The selected row is marked\n * with a trailing check indicator.\n *\n * @example\n * ```tsx\n * <SelectItem value=\"jane\" avatar={<Avatar size={24} fallback=\"JD\" />} description=\"Product designer\">\n * Jane Doe\n * </SelectItem>\n * ```\n */\nexport const SelectItem = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Item>,\n SelectItemProps\n>(({ className, children, size, leadingIcon, avatar, description, ...props }, ref) => {\n const { size: triggerSize } = React.useContext(SelectContext);\n const itemSize: SelectItemSize = size ?? (triggerSize === \"32\" ? \"32\" : \"40\");\n const hasDescription = isRenderableNode(description);\n const hasAvatar = isRenderableNode(avatar);\n const hasLeadingIcon = isRenderableNode(leadingIcon);\n\n return (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"group relative flex w-full cursor-pointer select-none gap-2 rounded-xs px-3 text-content-primary outline-none\",\n hasDescription ? \"items-start\" : \"items-center\",\n ITEM_SIZE_CLASSES[itemSize],\n hasAvatar && !hasDescription && itemSize === \"32\" && \"py-1\",\n \"focus:bg-neutral-alphas-50 data-highlighted:bg-neutral-alphas-50\",\n \"data-disabled:pointer-events-none data-disabled:text-content-disabled\",\n className,\n )}\n {...props}\n >\n {hasAvatar ? (\n <span className=\"shrink-0\">{avatar}</span>\n ) : (\n hasLeadingIcon &&\n (hasDescription ? (\n <span className=\"flex shrink-0 items-center pt-0.5 [&>svg]:size-4\">{leadingIcon}</span>\n ) : (\n <span className=\"flex shrink-0 items-center [&>svg]:size-4\">{leadingIcon}</span>\n ))\n )}\n\n {hasDescription ? (\n <span className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <span className=\"truncate\">\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </span>\n <span\n className={cn(\n \"truncate text-content-secondary group-data-[disabled]:text-content-disabled\",\n ITEM_DESCRIPTION_TYPOGRAPHY[itemSize],\n )}\n >\n {description}\n </span>\n </span>\n ) : (\n <span className=\"min-w-0 flex-1 truncate\">\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </span>\n )}\n\n <SelectPrimitive.ItemIndicator\n className={cn(\n \"ml-auto flex size-4 shrink-0 items-center justify-center\",\n hasDescription && \"self-start\",\n )}\n >\n <CheckIcon className=\"size-4 text-content-primary group-data-[disabled]:text-content-disabled\" />\n </SelectPrimitive.ItemIndicator>\n </SelectPrimitive.Item>\n );\n});\n\nSelectItem.displayName = \"SelectItem\";\n\n/** Props for {@link SelectGroup}. */\nexport type SelectGroupProps = React.ComponentPropsWithoutRef<typeof SelectPrimitive.Group>;\n\n/**\n * Groups related {@link SelectItem} elements under a {@link SelectLabel}.\n */\nexport const SelectGroup = SelectPrimitive.Group;\nSelectGroup.displayName = \"SelectGroup\";\n\nexport interface SelectLabelProps\n extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label> {}\n\n/**\n * A non-interactive label shown above a {@link SelectGroup}.\n */\nexport const SelectLabel = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Label>,\n SelectLabelProps\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n className={cn(\n \"typography-description-12px-semibold px-3 py-1.5 text-content-secondary\",\n className,\n )}\n {...props}\n />\n));\n\nSelectLabel.displayName = \"SelectLabel\";\n\nexport interface SelectSeparatorProps\n extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator> {}\n\n/** A horizontal rule that visually separates groups in {@link SelectContent}. */\nexport const SelectSeparator = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Separator>,\n SelectSeparatorProps\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-neutral-alphas-200\", className)}\n {...props}\n />\n));\n\nSelectSeparator.displayName = \"SelectSeparator\";\n"],"names":["React","jsx","jsxs","cn","SelectPrimitive","ChevronDownIcon","FLOATING_CONTENT_COLLISION_PADDING","CheckIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,gBAAgBA,iBAAM,cAAkC;AAAA,EAC5D,MAAM;AAAA,EACN,OAAO;AACT,CAAC;AAED,MAAM,iBAA6C;AAAA,EACjD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,oBAAgD;AAAA,EACpD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,cAA0C;AAAA,EAC9C,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,qBAAiD;AAAA,EACrD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AA+CO,MAAM,SAASA,iBAAM;AAAA,EAI1B,CACE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cAAc;AAMnB,MAAM,kBAAkBH,iBAAM,WAGnC,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAC1BC,2BAAAA;AAAAA,EAACG,2BAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAWD,GAAAA,GAAG,yCAAyC,SAAS;AAAA,IAC/D,GAAG;AAAA,EAAA;AACN,CACD;AAED,gBAAgB,cAAc;;;;;;;"}
|
|
@@ -30,7 +30,11 @@ const ShimmerLabel = ({ text, shimmer }) => /* @__PURE__ */ jsx("span", { "aria-
|
|
|
30
30
|
"span",
|
|
31
31
|
{
|
|
32
32
|
className: cn(
|
|
33
|
-
|
|
33
|
+
// `Content/Primary` is the resting label the design asks for, but the
|
|
34
|
+
// shimmer's keyframe peaks at that same colour, so a shimmering letter
|
|
35
|
+
// needs the dimmer base to sweep up from.
|
|
36
|
+
shimmer ? "text-content-secondary" : "text-content-primary",
|
|
37
|
+
"inline-block whitespace-pre",
|
|
34
38
|
// Gated in JS rather than with a `group-disabled/ai:` override, because
|
|
35
39
|
// that would rely on the generated rule ordering to beat `group-hover`.
|
|
36
40
|
// A faded control that still shimmers and still lights up green under the
|
|
@@ -87,14 +91,16 @@ const AiButton = React.forwardRef(
|
|
|
87
91
|
className: cn(
|
|
88
92
|
"fv-ai-button",
|
|
89
93
|
"group/ai inline-flex cursor-pointer items-center justify-center whitespace-nowrap rounded-full",
|
|
90
|
-
|
|
94
|
+
// The mint AI surface the design fills this control with at rest, rather
|
|
95
|
+
// than the neutral chip it used to sit as until hovered.
|
|
96
|
+
"border border-buttons-ai-stroke-end bg-buttons-ai-default",
|
|
91
97
|
// Matched to the rim and sheen so the whole treatment arrives as one
|
|
92
98
|
// movement — at the old 300ms the outline landed ahead of the glow.
|
|
93
99
|
"transition-[background-color,border-color] duration-[400ms] ease-out",
|
|
94
|
-
"hover:border-brand-primary-default",
|
|
100
|
+
"hover:border-brand-primary-default hover:bg-buttons-ai-hover",
|
|
95
101
|
"focus-visible:outline-none",
|
|
96
102
|
"active:border-brand-primary-hover active:bg-brand-primary-muted",
|
|
97
|
-
"disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:border-
|
|
103
|
+
"disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:border-buttons-ai-stroke-end",
|
|
98
104
|
sizeVariants[size],
|
|
99
105
|
className
|
|
100
106
|
),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiButton.mjs","sources":["../../../src/components/AiButton/AiButton.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { AIIcon } from \"../Icons/AIIcon\";\nimport type { IconSize } from \"../Icons/types\";\n\n/** Height, padding and label typography, matching {@link Button}'s scale. */\nexport type AiButtonSize = \"24\" | \"32\" | \"40\";\n\nconst sizeVariants: Record<AiButtonSize, string> = {\n // At 24 the label steps down to the 12px description scale: the 14px label\n // Button uses at this height leaves the glyph and text crowding a 24px box,\n // since 16px is the smallest authored icon geometry and cannot step down with it.\n \"24\": \"h-6 gap-1 px-2 py-1 typography-description-12px-semibold\",\n \"32\": \"h-8 gap-2 px-3 py-[7px] typography-body-small-14px-semibold\",\n \"40\": \"h-10 gap-2 px-4 py-2 typography-body-default-16px-semibold\",\n};\n\nconst iconSizeVariants: Record<AiButtonSize, IconSize> = {\n \"24\": 16,\n \"32\": 16,\n \"40\": 24,\n};\n\n/**\n * Optical size, applied on top of the authored geometry. Only 16, 24 and 32 have\n * dedicated paths, so the 24 button renders the 16px glyph down at 14 to sit with\n * its 12px label rather than towering over it.\n */\nconst iconScaleVariants: Record<AiButtonSize, string> = {\n \"24\": \"[&_svg]:size-3.5\",\n \"32\": \"\",\n \"40\": \"\",\n};\n\n/** Delay between adjacent letters, in seconds. */\nconst LETTER_STAGGER = 0.08;\n\n/**\n * Points the bottom sheen at the cursor by writing its x offset, as a percentage\n * of the button's width, straight to the DOM node. Deliberately not React state:\n * this fires every pointer-move frame, and a re-render per frame would both cost\n * more than the paint and leave the glow trailing the cursor.\n */\nconst trackPointer = (event: React.PointerEvent<HTMLButtonElement>) => {\n const { left, width } = event.currentTarget.getBoundingClientRect();\n event.currentTarget.style.setProperty(\"--fv-ai-x\", `${((event.clientX - left) / width) * 100}%`);\n};\n\n/** Props for {@link AiButton}. */\nexport interface AiButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"type\"> {\n /** Resting label. Also the accessible name unless `aria-label` is given. */\n label: string;\n /** Label shown while `active`. Falls back to {@link label}. */\n activeLabel?: string;\n /** Swap to {@link activeLabel} and keep the shimmer running. @default false */\n active?: boolean;\n /**\n * Shimmer and flicker while enabled and idle, inviting a click. Turn off when\n * several `AiButton`s sit side by side, so an idle one sits still and only the\n * `active` one reads as busy. @default true\n */\n idleShimmer?: boolean;\n /** @default \"32\" */\n size?: AiButtonSize;\n /** Replace the leading AI glyph. */\n icon?: React.ReactNode;\n /** @default \"button\" */\n type?: \"button\" | \"submit\" | \"reset\";\n}\n\n/**\n * Renders one `<span>` per character so each can carry its own animation delay.\n * The run is hidden from assistive tech — the button's accessible name comes from\n * its `aria-label`, so a screen reader says \"Analyse\" rather than spelling it out.\n */\nconst ShimmerLabel: React.FC<{ text: string; shimmer: boolean }> = ({ text, shimmer }) => (\n <span aria-hidden=\"true\">\n {Array.from(text).map((character, index) => (\n <span\n key={`${character}-${index}`}\n className={cn(\n \"inline-block whitespace-pre text-content-secondary\",\n // Gated in JS rather than with a `group-disabled/ai:` override, because\n // that would rely on the generated rule ordering to beat `group-hover`.\n // A faded control that still shimmers and still lights up green under the\n // cursor reads as busy rather than unavailable.\n shimmer && [\n \"[animation:fv-ai-letter_2s_ease-in-out_infinite]\",\n \"group-hover/ai:text-content-primary group-hover/ai:[animation:none]\",\n // On focus each letter blows up and settles, then the idle shimmer\n // resumes underneath it — the two animations are sequenced by delay.\n \"group-focus-visible/ai:[animation:fv-ai-letter-focus_1s_ease-in-out,fv-ai-letter_1.2s_ease-in-out_infinite_1s]\",\n \"group-active/ai:text-content-primary group-active/ai:[animation:none]\",\n \"group-active/ai:[text-shadow:0_0_4px_var(--color-content-primary)]\",\n ],\n \"motion-reduce:[animation:none]\",\n )}\n style={{ animationDelay: `${index * LETTER_STAGGER}s` }}\n >\n {character}\n </span>\n ))}\n </span>\n);\n\n/**\n * A pill button for AI actions. The label shimmers letter by letter and the glyph\n * flickers at rest; on hover both settle and the green treatment eases in together\n * — outline, rim and a sheen pooling along the bottom edge under the cursor, which\n * follows it across the button. On focus each letter blooms once before the shimmer\n * resumes. The lit rim and sheen come from the `fv-ai-button` utility in `base.css`.\n *\n * It shares {@link Button}'s geometry — `rounded-full`, the same heights and label\n * typography — so it sits alongside one without looking foreign. Both labels are\n * rendered stacked in a single grid cell, so swapping to `active` crossfades\n * without the button changing width.\n *\n * Honours `prefers-reduced-motion`: the shimmer and flicker are dropped and the\n * label renders in its settled state.\n *\n * Set `idleShimmer={false}` when several `AiButton`s sit side by side, so an\n * idle one sits still and the shimmer reads as \"this one is genuinely busy\"\n * rather than \"any of these could be clicked\".\n *\n * @example\n * ```tsx\n * <AiButton label=\"Analyse\" activeLabel=\"Analysing\" active={isPending} onClick={run} />\n * ```\n */\nexport const AiButton = React.forwardRef<HTMLButtonElement, AiButtonProps>(\n (\n {\n label,\n activeLabel,\n active = false,\n idleShimmer = true,\n size = \"32\",\n icon,\n type = \"button\",\n className,\n disabled,\n onPointerMove,\n onPointerLeave,\n ...props\n },\n ref,\n ) => {\n const resolvedActiveLabel = activeLabel ?? label;\n const shimmer = !disabled && (idleShimmer || active);\n\n return (\n <button\n ref={ref}\n type={type}\n disabled={disabled}\n aria-label={props[\"aria-label\"] ?? (active ? resolvedActiveLabel : label)}\n aria-busy={active || undefined}\n onPointerMove={(event) => {\n trackPointer(event);\n onPointerMove?.(event);\n }}\n // Drop back to the utility's centred default, so a keyboard focus after\n // the pointer has left does not light up wherever the cursor last was.\n onPointerLeave={(event) => {\n event.currentTarget.style.removeProperty(\"--fv-ai-x\");\n onPointerLeave?.(event);\n }}\n className={cn(\n \"fv-ai-button\",\n \"group/ai inline-flex cursor-pointer items-center justify-center whitespace-nowrap rounded-full\",\n \"border border-border-primary bg-background-primary\",\n // Matched to the rim and sheen so the whole treatment arrives as one\n // movement — at the old 300ms the outline landed ahead of the glow.\n \"transition-[background-color,border-color] duration-[400ms] ease-out\",\n \"hover:border-brand-primary-default\",\n \"focus-visible:outline-none\",\n \"active:border-brand-primary-hover active:bg-brand-primary-muted\",\n \"disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:border-border-primary\",\n sizeVariants[size],\n className,\n )}\n {...props}\n >\n <span\n className={cn(\n \"flex shrink-0 items-center text-content-primary\",\n iconScaleVariants[size],\n \"[filter:drop-shadow(0_0_2px_color-mix(in_srgb,var(--color-content-primary)_60%,transparent))]\",\n // Same reasoning as the letters: no flicker and no green lift once the\n // button is unavailable or shimmer is turned off for this instance.\n shimmer && [\n \"[animation-delay:0.5s] [animation:fv-ai-flicker_2s_linear_infinite]\",\n // Settles solid on hover, lit green from below like the sheen.\n \"group-hover/ai:[animation:none]\",\n \"group-hover/ai:[filter:drop-shadow(0_0_3px_var(--color-brand-primary-default))_drop-shadow(0_-4px_6px_color-mix(in_srgb,var(--color-content-always-black)_60%,transparent))]\",\n \"group-focus-visible/ai:[animation-delay:0.2s] group-focus-visible/ai:[animation-duration:1.2s]\",\n ],\n \"motion-reduce:[animation:none]\",\n )}\n >\n {icon ?? <AIIcon size={iconSizeVariants[size]} filled />}\n </span>\n {/* Both labels occupy one grid cell so the button keeps the width of the\n longer of the two and the swap never reflows the row around it. */}\n <span className=\"grid\">\n <span\n className={cn(\n \"col-start-1 row-start-1 transition-opacity duration-300\",\n active ? \"opacity-0\" : \"opacity-100\",\n )}\n >\n <ShimmerLabel text={label} shimmer={shimmer} />\n </span>\n <span\n className={cn(\n \"col-start-1 row-start-1 transition-opacity duration-300\",\n active ? \"opacity-100\" : \"opacity-0\",\n )}\n >\n <ShimmerLabel text={resolvedActiveLabel} shimmer={shimmer} />\n </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AS,gBAAgB;AAAA,gBAAA;AAAA,gBAG3B,UAAA,oBAAC,cAAA,EAAa,MAAM,qBAAqB,QAAA,CAAkB;AAAA,cAAA;AAAA,YAAA;AAAA,UAC7D,EAAA,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,SAAS,cAAc;"}
|
|
1
|
+
{"version":3,"file":"AiButton.mjs","sources":["../../../src/components/AiButton/AiButton.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { AIIcon } from \"../Icons/AIIcon\";\nimport type { IconSize } from \"../Icons/types\";\n\n/** Height, padding and label typography, matching {@link Button}'s scale. */\nexport type AiButtonSize = \"24\" | \"32\" | \"40\";\n\nconst sizeVariants: Record<AiButtonSize, string> = {\n // At 24 the label steps down to the 12px description scale: the 14px label\n // Button uses at this height leaves the glyph and text crowding a 24px box,\n // since 16px is the smallest authored icon geometry and cannot step down with it.\n \"24\": \"h-6 gap-1 px-2 py-1 typography-description-12px-semibold\",\n \"32\": \"h-8 gap-2 px-3 py-[7px] typography-body-small-14px-semibold\",\n \"40\": \"h-10 gap-2 px-4 py-2 typography-body-default-16px-semibold\",\n};\n\nconst iconSizeVariants: Record<AiButtonSize, IconSize> = {\n \"24\": 16,\n \"32\": 16,\n \"40\": 24,\n};\n\n/**\n * Optical size, applied on top of the authored geometry. Only 16, 24 and 32 have\n * dedicated paths, so the 24 button renders the 16px glyph down at 14 to sit with\n * its 12px label rather than towering over it.\n */\nconst iconScaleVariants: Record<AiButtonSize, string> = {\n \"24\": \"[&_svg]:size-3.5\",\n \"32\": \"\",\n \"40\": \"\",\n};\n\n/** Delay between adjacent letters, in seconds. */\nconst LETTER_STAGGER = 0.08;\n\n/**\n * Points the bottom sheen at the cursor by writing its x offset, as a percentage\n * of the button's width, straight to the DOM node. Deliberately not React state:\n * this fires every pointer-move frame, and a re-render per frame would both cost\n * more than the paint and leave the glow trailing the cursor.\n */\nconst trackPointer = (event: React.PointerEvent<HTMLButtonElement>) => {\n const { left, width } = event.currentTarget.getBoundingClientRect();\n event.currentTarget.style.setProperty(\"--fv-ai-x\", `${((event.clientX - left) / width) * 100}%`);\n};\n\n/** Props for {@link AiButton}. */\nexport interface AiButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"type\"> {\n /** Resting label. Also the accessible name unless `aria-label` is given. */\n label: string;\n /** Label shown while `active`. Falls back to {@link label}. */\n activeLabel?: string;\n /** Swap to {@link activeLabel} and keep the shimmer running. @default false */\n active?: boolean;\n /**\n * Shimmer and flicker while enabled and idle, inviting a click. Turn off when\n * several `AiButton`s sit side by side, so an idle one sits still and only the\n * `active` one reads as busy. @default true\n */\n idleShimmer?: boolean;\n /** @default \"32\" */\n size?: AiButtonSize;\n /** Replace the leading AI glyph. */\n icon?: React.ReactNode;\n /** @default \"button\" */\n type?: \"button\" | \"submit\" | \"reset\";\n}\n\n/**\n * Renders one `<span>` per character so each can carry its own animation delay.\n * The run is hidden from assistive tech — the button's accessible name comes from\n * its `aria-label`, so a screen reader says \"Analyse\" rather than spelling it out.\n */\nconst ShimmerLabel: React.FC<{ text: string; shimmer: boolean }> = ({ text, shimmer }) => (\n <span aria-hidden=\"true\">\n {Array.from(text).map((character, index) => (\n <span\n key={`${character}-${index}`}\n className={cn(\n // `Content/Primary` is the resting label the design asks for, but the\n // shimmer's keyframe peaks at that same colour, so a shimmering letter\n // needs the dimmer base to sweep up from.\n shimmer ? \"text-content-secondary\" : \"text-content-primary\",\n \"inline-block whitespace-pre\",\n // Gated in JS rather than with a `group-disabled/ai:` override, because\n // that would rely on the generated rule ordering to beat `group-hover`.\n // A faded control that still shimmers and still lights up green under the\n // cursor reads as busy rather than unavailable.\n shimmer && [\n \"[animation:fv-ai-letter_2s_ease-in-out_infinite]\",\n \"group-hover/ai:text-content-primary group-hover/ai:[animation:none]\",\n // On focus each letter blows up and settles, then the idle shimmer\n // resumes underneath it — the two animations are sequenced by delay.\n \"group-focus-visible/ai:[animation:fv-ai-letter-focus_1s_ease-in-out,fv-ai-letter_1.2s_ease-in-out_infinite_1s]\",\n \"group-active/ai:text-content-primary group-active/ai:[animation:none]\",\n \"group-active/ai:[text-shadow:0_0_4px_var(--color-content-primary)]\",\n ],\n \"motion-reduce:[animation:none]\",\n )}\n style={{ animationDelay: `${index * LETTER_STAGGER}s` }}\n >\n {character}\n </span>\n ))}\n </span>\n);\n\n/**\n * A pill button for AI actions. The label shimmers letter by letter and the glyph\n * flickers at rest; on hover both settle and the green treatment eases in together\n * — outline, rim and a sheen pooling along the bottom edge under the cursor, which\n * follows it across the button. On focus each letter blooms once before the shimmer\n * resumes. The lit rim and sheen come from the `fv-ai-button` utility in `base.css`.\n *\n * It shares {@link Button}'s geometry — `rounded-full`, the same heights and label\n * typography — so it sits alongside one without looking foreign. Both labels are\n * rendered stacked in a single grid cell, so swapping to `active` crossfades\n * without the button changing width.\n *\n * Honours `prefers-reduced-motion`: the shimmer and flicker are dropped and the\n * label renders in its settled state.\n *\n * Set `idleShimmer={false}` when several `AiButton`s sit side by side, so an\n * idle one sits still and the shimmer reads as \"this one is genuinely busy\"\n * rather than \"any of these could be clicked\".\n *\n * @example\n * ```tsx\n * <AiButton label=\"Analyse\" activeLabel=\"Analysing\" active={isPending} onClick={run} />\n * ```\n */\nexport const AiButton = React.forwardRef<HTMLButtonElement, AiButtonProps>(\n (\n {\n label,\n activeLabel,\n active = false,\n idleShimmer = true,\n size = \"32\",\n icon,\n type = \"button\",\n className,\n disabled,\n onPointerMove,\n onPointerLeave,\n ...props\n },\n ref,\n ) => {\n const resolvedActiveLabel = activeLabel ?? label;\n const shimmer = !disabled && (idleShimmer || active);\n\n return (\n <button\n ref={ref}\n type={type}\n disabled={disabled}\n aria-label={props[\"aria-label\"] ?? (active ? resolvedActiveLabel : label)}\n aria-busy={active || undefined}\n onPointerMove={(event) => {\n trackPointer(event);\n onPointerMove?.(event);\n }}\n // Drop back to the utility's centred default, so a keyboard focus after\n // the pointer has left does not light up wherever the cursor last was.\n onPointerLeave={(event) => {\n event.currentTarget.style.removeProperty(\"--fv-ai-x\");\n onPointerLeave?.(event);\n }}\n className={cn(\n \"fv-ai-button\",\n \"group/ai inline-flex cursor-pointer items-center justify-center whitespace-nowrap rounded-full\",\n // The mint AI surface the design fills this control with at rest, rather\n // than the neutral chip it used to sit as until hovered.\n \"border border-buttons-ai-stroke-end bg-buttons-ai-default\",\n // Matched to the rim and sheen so the whole treatment arrives as one\n // movement — at the old 300ms the outline landed ahead of the glow.\n \"transition-[background-color,border-color] duration-[400ms] ease-out\",\n \"hover:border-brand-primary-default hover:bg-buttons-ai-hover\",\n \"focus-visible:outline-none\",\n \"active:border-brand-primary-hover active:bg-brand-primary-muted\",\n \"disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:border-buttons-ai-stroke-end\",\n sizeVariants[size],\n className,\n )}\n {...props}\n >\n <span\n className={cn(\n \"flex shrink-0 items-center text-content-primary\",\n iconScaleVariants[size],\n \"[filter:drop-shadow(0_0_2px_color-mix(in_srgb,var(--color-content-primary)_60%,transparent))]\",\n // Same reasoning as the letters: no flicker and no green lift once the\n // button is unavailable or shimmer is turned off for this instance.\n shimmer && [\n \"[animation-delay:0.5s] [animation:fv-ai-flicker_2s_linear_infinite]\",\n // Settles solid on hover, lit green from below like the sheen.\n \"group-hover/ai:[animation:none]\",\n \"group-hover/ai:[filter:drop-shadow(0_0_3px_var(--color-brand-primary-default))_drop-shadow(0_-4px_6px_color-mix(in_srgb,var(--color-content-always-black)_60%,transparent))]\",\n \"group-focus-visible/ai:[animation-delay:0.2s] group-focus-visible/ai:[animation-duration:1.2s]\",\n ],\n \"motion-reduce:[animation:none]\",\n )}\n >\n {icon ?? <AIIcon size={iconSizeVariants[size]} filled />}\n </span>\n {/* Both labels occupy one grid cell so the button keeps the width of the\n longer of the two and the swap never reflows the row around it. */}\n <span className=\"grid\">\n <span\n className={cn(\n \"col-start-1 row-start-1 transition-opacity duration-300\",\n active ? \"opacity-0\" : \"opacity-100\",\n )}\n >\n <ShimmerLabel text={label} shimmer={shimmer} />\n </span>\n <span\n className={cn(\n \"col-start-1 row-start-1 transition-opacity duration-300\",\n active ? \"opacity-100\" : \"opacity-0\",\n )}\n >\n <ShimmerLabel text={resolvedActiveLabel} shimmer={shimmer} />\n </span>\n </span>\n </button>\n );\n },\n);\n\nAiButton.displayName = \"AiButton\";\n"],"names":[],"mappings":";;;;;AAQA,MAAM,eAA6C;AAAA;AAAA;AAAA;AAAA,EAIjD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,mBAAmD;AAAA,EACvD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAOA,MAAM,oBAAkD;AAAA,EACtD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAGA,MAAM,iBAAiB;AAQvB,MAAM,eAAe,CAAC,UAAiD;AACrE,QAAM,EAAE,MAAM,MAAA,IAAU,MAAM,cAAc,sBAAA;AAC5C,QAAM,cAAc,MAAM,YAAY,aAAa,IAAK,MAAM,UAAU,QAAQ,QAAS,GAAG,GAAG;AACjG;AA6BA,MAAM,eAA6D,CAAC,EAAE,MAAM,QAAA,MAC1E,oBAAC,QAAA,EAAK,eAAY,QACf,gBAAM,KAAK,IAAI,EAAE,IAAI,CAAC,WAAW,UAChC;AAAA,EAAC;AAAA,EAAA;AAAA,IAEC,WAAW;AAAA;AAAA;AAAA;AAAA,MAIT,UAAU,2BAA2B;AAAA,MACrC;AAAA;AAAA;AAAA;AAAA;AAAA,MAKA,WAAW;AAAA,QACT;AAAA,QACA;AAAA;AAAA;AAAA,QAGA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,MAEF;AAAA,IAAA;AAAA,IAEF,OAAO,EAAE,gBAAgB,GAAG,QAAQ,cAAc,IAAA;AAAA,IAEjD,UAAA;AAAA,EAAA;AAAA,EAxBI,GAAG,SAAS,IAAI,KAAK;AAyB5B,CACD,GACH;AA2BK,MAA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cAAA;AAAA,gBACC,WAAW;AAAA,kBACT;AAAA,kBACA,SAAS,cAAc;AAAA,gBAAA;AAAA,gBAGzB,UAAA,oBAAC,cAAA,EAAa,MAAM,OAAO,QAAA,CAAkB;AAAA,cAAA;AAAA,YAAA;AAAA,YAE/C;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAW;AAAA,kBACT;AAAA,kBACA,SAAS,gBAAgB;AAAA,gBAAA;AAAA,gBAG3B,UAAA,oBAAC,cAAA,EAAa,MAAM,qBAAqB,QAAA,CAAkB;AAAA,cAAA;AAAA,YAAA;AAAA,UAC7D,EAAA,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,SAAS,cAAc;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs, jsx
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import { generateFallbackPeaks, decodeAudioPeaks,
|
|
4
|
+
import { generateFallbackPeaks, decodeAudioPeaks, formatTime, resamplePeaks, RAW_PEAK_COUNT } from "../../utils/audioWaveform.mjs";
|
|
5
5
|
import { cn } from "../../utils/cn.mjs";
|
|
6
6
|
import { useFittedBarCount } from "../../utils/useFittedBarCount.mjs";
|
|
7
7
|
import { PauseIcon } from "../Icons/PauseIcon.mjs";
|
|
@@ -162,6 +162,8 @@ const AudioPlayer = React.forwardRef(
|
|
|
162
162
|
break;
|
|
163
163
|
}
|
|
164
164
|
};
|
|
165
|
+
const totalLabel = formatTime(displayDuration);
|
|
166
|
+
const elapsedLabel = formatTime(currentTime).padStart(totalLabel.length, "0");
|
|
165
167
|
const bars = resamplePeaks(peaks, barCount);
|
|
166
168
|
const progressFraction = displayDuration && displayDuration > 0 ? Math.min(Math.max(currentTime / displayDuration, 0), 1) : 0;
|
|
167
169
|
const playedBarCount = hasStarted ? Math.round(progressFraction * bars.length) : bars.length;
|
|
@@ -225,13 +227,13 @@ const AudioPlayer = React.forwardRef(
|
|
|
225
227
|
))
|
|
226
228
|
}
|
|
227
229
|
),
|
|
228
|
-
/* @__PURE__ */
|
|
229
|
-
/* @__PURE__ */ jsx("span", { className: "text-content-primary", children:
|
|
230
|
-
/* @__PURE__ */ jsxs("span", { className: "text-content-secondary", children: [
|
|
230
|
+
/* @__PURE__ */ jsxs("span", { className: "typography-body-small-14px-semibold flex shrink-0 items-center gap-0.5 whitespace-nowrap tabular-nums", children: [
|
|
231
|
+
/* @__PURE__ */ jsx("span", { className: "text-content-primary", children: hasStarted ? elapsedLabel : totalLabel }),
|
|
232
|
+
/* @__PURE__ */ jsxs("span", { className: cn("text-content-secondary", !hasStarted && "invisible"), children: [
|
|
231
233
|
"/",
|
|
232
|
-
|
|
234
|
+
totalLabel
|
|
233
235
|
] })
|
|
234
|
-
] })
|
|
236
|
+
] })
|
|
235
237
|
] }),
|
|
236
238
|
/* @__PURE__ */ jsx(
|
|
237
239
|
"audio",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AudioPlayer.mjs","sources":["../../../src/components/AudioPlayer/AudioPlayer.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n decodeAudioPeaks,\n formatTime,\n generateFallbackPeaks,\n RAW_PEAK_COUNT,\n resamplePeaks,\n} from \"../../utils/audioWaveform\";\nimport { cn } from \"../../utils/cn\";\nimport { useFittedBarCount } from \"../../utils/useFittedBarCount\";\nimport { PauseIcon } from \"../Icons/PauseIcon\";\nimport { PlayIcon } from \"../Icons/PlayIcon\";\n\n/** Width of a single waveform bar, in pixels. */\nconst BAR_WIDTH_PX = 4;\n/** Gap between waveform bars, in pixels. */\nconst BAR_GAP_PX = 4;\n/** Shortest a waveform bar can render, in pixels. */\nconst MIN_BAR_HEIGHT_PX = 4;\n/** Tallest a waveform bar can render, in pixels — matches the 40px row height. */\nconst MAX_BAR_HEIGHT_PX = 26;\n/** Bar count used before the container has been measured (e.g. during SSR or in jsdom, where layout is unavailable). */\nconst DEFAULT_BAR_COUNT = 24;\n/** Seconds moved per Arrow key press while seeking. */\nconst SEEK_STEP_SECONDS = 1;\n/** Seconds moved per Page Up/Down press while seeking. */\nconst SEEK_STEP_LARGE_SECONDS = 5;\n\n/** Height of the audio player row, in pixels. Matches both the Vault card overlay and the \"Generated Audio\" modal row in Figma — both use an identical 32px play button and 40px row. */\nexport type AudioPlayerSize = \"40\";\n\nexport interface AudioPlayerProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onPlay\" | \"onPause\" | \"onEnded\"> {\n /** URL of the audio file to play. */\n src: string;\n /**\n * Total duration in seconds, used to render the timestamp before the\n * media's own metadata has loaded (and as a fallback if it never does).\n */\n duration?: number;\n /**\n * Whether playback is active (controlled). Note: once `onEnded` fires, the\n * browser has already stopped native playback. To loop or replay under\n * controlled usage, toggle this prop `false` then `true` (rather than\n * leaving it `true`) — the sync effect only calls `play()` again when this\n * value actually changes.\n */\n playing?: boolean;\n /** Initial playback state (uncontrolled). @default false */\n defaultPlaying?: boolean;\n /** Called when playback starts. */\n onPlay?: () => void;\n /** Called when playback is paused. */\n onPause?: () => void;\n /** Called when playback reaches the end of the media. */\n onEnded?: () => void;\n /** Height of the player row, in pixels. @default \"40\" */\n size?: AudioPlayerSize;\n}\n\n/**\n * A compact playback control for a single audio clip: a play/pause toggle, a\n * static amplitude waveform that doubles as a seek scrubber, and elapsed/total\n * timestamps. Designed to sit as an overlay on media thumbnails (Vault cards)\n * as well as inline rows (the AI Voice Message \"Generated Audio\" row).\n *\n * The waveform is seeded from the decoded audio when possible, falling back\n * to a deterministic (not random) placeholder derived from `src` so the\n * result is stable across renders, SSR, and Chromatic snapshots.\n *\n * @example\n * ```tsx\n * <AudioPlayer src=\"https://example.com/clip.mp3\" duration={5} />\n * ```\n */\nexport const AudioPlayer = React.forwardRef<HTMLDivElement, AudioPlayerProps>(\n (\n {\n className,\n src,\n duration,\n playing: controlledPlaying,\n defaultPlaying = false,\n onPlay,\n onPause,\n onEnded,\n size = \"40\",\n ...props\n },\n ref,\n ) => {\n const audioRef = React.useRef<HTMLAudioElement>(null);\n const trackRef = React.useRef<HTMLDivElement>(null);\n\n const [internalPlaying, setInternalPlaying] = React.useState(defaultPlaying);\n const isControlled = controlledPlaying !== undefined;\n const playing = isControlled ? controlledPlaying : internalPlaying;\n\n const [currentTime, setCurrentTime] = React.useState(0);\n const [mediaDuration, setMediaDuration] = React.useState<number | undefined>(undefined);\n const barCount = useFittedBarCount(trackRef, {\n barWidthPx: BAR_WIDTH_PX,\n gapPx: BAR_GAP_PX,\n fallback: DEFAULT_BAR_COUNT,\n });\n const [peaks, setPeaks] = React.useState<number[]>(() =>\n generateFallbackPeaks(src, RAW_PEAK_COUNT),\n );\n const [isDragging, setIsDragging] = React.useState(false);\n\n const displayDuration = mediaDuration ?? duration;\n const hasStarted = playing || currentTime > 0;\n\n // Latest-value refs so the src-change effect below can react to a src swap\n // without re-running whenever `playing`/`isControlled`/`onPause` change.\n const playingRef = React.useRef(playing);\n playingRef.current = playing;\n const isControlledRef = React.useRef(isControlled);\n isControlledRef.current = isControlled;\n const onPauseRef = React.useRef(onPause);\n onPauseRef.current = onPause;\n\n // Reset transient playback state when the source changes. Skips the\n // initial mount (there's nothing to reset yet) and, if playback was\n // active, stops it — the browser silently drops playback on a source\n // swap, so the UI (and any controlled parent) must be told via onPause.\n const isFirstSrcRenderRef = React.useRef(true);\n React.useEffect(() => {\n if (isFirstSrcRenderRef.current) {\n isFirstSrcRenderRef.current = false;\n return;\n }\n setCurrentTime(0);\n setMediaDuration(undefined);\n setPeaks(generateFallbackPeaks(src, RAW_PEAK_COUNT));\n if (playingRef.current) {\n if (!isControlledRef.current) setInternalPlaying(false);\n onPauseRef.current?.();\n }\n }, [src]);\n\n // Decode the audio to derive real waveform amplitudes, falling back to a\n // deterministic placeholder on any failure (network, CORS, unsupported format).\n React.useEffect(() => {\n let cancelled = false;\n const abortController = new AbortController();\n\n decodeAudioPeaks(src, abortController.signal)\n .then((decodedPeaks) => {\n if (!cancelled) setPeaks(decodedPeaks);\n })\n .catch(() => {\n if (!cancelled) setPeaks(generateFallbackPeaks(src, RAW_PEAK_COUNT));\n });\n\n return () => {\n cancelled = true;\n abortController.abort();\n };\n }, [src]);\n\n // Sync the controlled/uncontrolled `playing` state to the media element.\n React.useEffect(() => {\n const audio = audioRef.current;\n if (!audio) return;\n if (playing) {\n audio.play().catch(() => {\n if (!isControlled) setInternalPlaying(false);\n onPauseRef.current?.();\n });\n } else {\n audio.pause();\n }\n }, [playing, isControlled]);\n\n const handleToggle = () => {\n const next = !playing;\n if (!isControlled) setInternalPlaying(next);\n if (next) onPlay?.();\n else onPause?.();\n };\n\n const seekTo = React.useCallback(\n (time: number) => {\n if (displayDuration === undefined) return;\n const clamped = Math.min(Math.max(time, 0), displayDuration);\n setCurrentTime(clamped);\n const audio = audioRef.current;\n if (audio) audio.currentTime = clamped;\n },\n [displayDuration],\n );\n\n const seekFromClientX = React.useCallback(\n (clientX: number) => {\n const track = trackRef.current;\n if (!track || displayDuration === undefined) return;\n const rect = track.getBoundingClientRect();\n if (rect.width <= 0) return;\n const fraction = Math.min(Math.max((clientX - rect.left) / rect.width, 0), 1);\n seekTo(fraction * displayDuration);\n },\n [displayDuration, seekTo],\n );\n\n // Track drag outside the element via window listeners rather than pointer\n // capture, which some environments (and jsdom) don't fully implement.\n React.useEffect(() => {\n if (!isDragging) return;\n const handleWindowPointerMove = (event: PointerEvent) => seekFromClientX(event.clientX);\n const handleWindowPointerUp = () => setIsDragging(false);\n window.addEventListener(\"pointermove\", handleWindowPointerMove);\n window.addEventListener(\"pointerup\", handleWindowPointerUp);\n return () => {\n window.removeEventListener(\"pointermove\", handleWindowPointerMove);\n window.removeEventListener(\"pointerup\", handleWindowPointerUp);\n };\n }, [isDragging, seekFromClientX]);\n\n const handlePointerDown = (event: React.PointerEvent<HTMLDivElement>) => {\n seekFromClientX(event.clientX);\n setIsDragging(true);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (displayDuration === undefined) return;\n switch (event.key) {\n case \"ArrowRight\":\n case \"ArrowUp\":\n event.preventDefault();\n seekTo(currentTime + SEEK_STEP_SECONDS);\n break;\n case \"ArrowLeft\":\n case \"ArrowDown\":\n event.preventDefault();\n seekTo(currentTime - SEEK_STEP_SECONDS);\n break;\n case \"PageUp\":\n event.preventDefault();\n seekTo(currentTime + SEEK_STEP_LARGE_SECONDS);\n break;\n case \"PageDown\":\n event.preventDefault();\n seekTo(currentTime - SEEK_STEP_LARGE_SECONDS);\n break;\n case \"Home\":\n event.preventDefault();\n seekTo(0);\n break;\n case \"End\":\n event.preventDefault();\n seekTo(displayDuration);\n break;\n default:\n break;\n }\n };\n\n const bars = resamplePeaks(peaks, barCount);\n const progressFraction =\n displayDuration && displayDuration > 0\n ? Math.min(Math.max(currentTime / displayDuration, 0), 1)\n : 0;\n const playedBarCount = hasStarted ? Math.round(progressFraction * bars.length) : bars.length;\n const barData = bars.map((amplitude, index) => {\n const isPlayed = index < playedBarCount;\n return {\n heightPx: MIN_BAR_HEIGHT_PX + amplitude * (MAX_BAR_HEIGHT_PX - MIN_BAR_HEIGHT_PX),\n className: cn(\n \"w-1 shrink-0 rounded-3xs bg-messages-waveform-default\",\n \"motion-safe:transition-opacity motion-safe:duration-150 motion-safe:ease-in-out\",\n isPlayed ? \"opacity-100\" : \"opacity-50\",\n ),\n };\n });\n\n return (\n <div\n ref={ref}\n data-size={size}\n className={cn(\"flex w-full items-center gap-3\", className)}\n {...props}\n >\n <button\n type=\"button\"\n onClick={handleToggle}\n aria-label={playing ? \"Pause\" : \"Play\"}\n className={cn(\n \"flex size-8 shrink-0 items-center justify-center rounded-full\",\n \"bg-buttons-secondary-default text-icons-primary backdrop-blur-[40px]\",\n \"motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-in-out\",\n \"hover:bg-buttons-secondary-hover\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n )}\n >\n {playing ? <PauseIcon size={16} filled /> : <PlayIcon size={16} filled />}\n </button>\n\n <div className=\"flex min-w-0 flex-1 items-center gap-3\">\n <div\n ref={trackRef}\n role=\"slider\"\n tabIndex={0}\n aria-label=\"Seek\"\n aria-orientation=\"horizontal\"\n aria-valuemin={0}\n aria-valuemax={displayDuration}\n aria-valuenow={Math.round(currentTime)}\n aria-valuetext={\n displayDuration !== undefined\n ? `${formatTime(currentTime)} of ${formatTime(displayDuration)}`\n : formatTime(currentTime)\n }\n onPointerDown={handlePointerDown}\n onKeyDown={handleKeyDown}\n className={cn(\n \"flex h-10 min-w-0 flex-1 cursor-pointer touch-none select-none items-center gap-1 overflow-hidden\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n )}\n >\n {barData.map((bar, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: bars are a fixed-count, non-reorderable list\n <span key={index} className={bar.className} style={{ height: bar.heightPx }} />\n ))}\n </div>\n\n <span className=\"typography-body-small-14px-semibold flex shrink-0 items-center gap-0.5 whitespace-nowrap\">\n {hasStarted ? (\n <>\n <span className=\"text-content-primary\">{formatTime(currentTime)}</span>\n <span className=\"text-content-secondary\">/{formatTime(displayDuration)}</span>\n </>\n ) : (\n <span className=\"text-content-primary\">{formatTime(displayDuration)}</span>\n )}\n </span>\n </div>\n\n {/* biome-ignore lint/a11y/useMediaCaption: this is a UI sound clip (voice note / short recording), not spoken/narrated content requiring captions. */}\n <audio\n ref={audioRef}\n src={src}\n preload=\"metadata\"\n className=\"hidden\"\n onLoadedMetadata={(event) => {\n const { duration: nativeDuration } = event.currentTarget;\n setMediaDuration(Number.isFinite(nativeDuration) ? nativeDuration : undefined);\n }}\n onTimeUpdate={(event) => {\n if (isDragging) return;\n setCurrentTime(event.currentTarget.currentTime);\n }}\n onEnded={() => {\n setCurrentTime(0);\n if (!isControlled) setInternalPlaying(false);\n onEnded?.();\n }}\n />\n </div>\n );\n },\n);\n\nAudioPlayer.displayName = \"AudioPlayer\";\n"],"names":[],"m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ChD;AAAA,cACA,SAAS,MAAM;AACb,+BAAe,CAAC;AAChB,oBAAI,CAAC,aAAc,oBAAmB,KAAK;AAC3C,0BAAA;AAAA,cACF;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,YAAY,cAAc;"}
|
|
1
|
+
{"version":3,"file":"AudioPlayer.mjs","sources":["../../../src/components/AudioPlayer/AudioPlayer.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n decodeAudioPeaks,\n formatTime,\n generateFallbackPeaks,\n RAW_PEAK_COUNT,\n resamplePeaks,\n} from \"../../utils/audioWaveform\";\nimport { cn } from \"../../utils/cn\";\nimport { useFittedBarCount } from \"../../utils/useFittedBarCount\";\nimport { PauseIcon } from \"../Icons/PauseIcon\";\nimport { PlayIcon } from \"../Icons/PlayIcon\";\n\n/** Width of a single waveform bar, in pixels. */\nconst BAR_WIDTH_PX = 4;\n/** Gap between waveform bars, in pixels. */\nconst BAR_GAP_PX = 4;\n/** Shortest a waveform bar can render, in pixels. */\nconst MIN_BAR_HEIGHT_PX = 4;\n/** Tallest a waveform bar can render, in pixels — matches the 40px row height. */\nconst MAX_BAR_HEIGHT_PX = 26;\n/** Bar count used before the container has been measured (e.g. during SSR or in jsdom, where layout is unavailable). */\nconst DEFAULT_BAR_COUNT = 24;\n/** Seconds moved per Arrow key press while seeking. */\nconst SEEK_STEP_SECONDS = 1;\n/** Seconds moved per Page Up/Down press while seeking. */\nconst SEEK_STEP_LARGE_SECONDS = 5;\n\n/** Height of the audio player row, in pixels. Matches both the Vault card overlay and the \"Generated Audio\" modal row in Figma — both use an identical 32px play button and 40px row. */\nexport type AudioPlayerSize = \"40\";\n\nexport interface AudioPlayerProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onPlay\" | \"onPause\" | \"onEnded\"> {\n /** URL of the audio file to play. */\n src: string;\n /**\n * Total duration in seconds, used to render the timestamp before the\n * media's own metadata has loaded (and as a fallback if it never does).\n */\n duration?: number;\n /**\n * Whether playback is active (controlled). Note: once `onEnded` fires, the\n * browser has already stopped native playback. To loop or replay under\n * controlled usage, toggle this prop `false` then `true` (rather than\n * leaving it `true`) — the sync effect only calls `play()` again when this\n * value actually changes.\n */\n playing?: boolean;\n /** Initial playback state (uncontrolled). @default false */\n defaultPlaying?: boolean;\n /** Called when playback starts. */\n onPlay?: () => void;\n /** Called when playback is paused. */\n onPause?: () => void;\n /** Called when playback reaches the end of the media. */\n onEnded?: () => void;\n /** Height of the player row, in pixels. @default \"40\" */\n size?: AudioPlayerSize;\n}\n\n/**\n * A compact playback control for a single audio clip: a play/pause toggle, a\n * static amplitude waveform that doubles as a seek scrubber, and elapsed/total\n * timestamps. Designed to sit as an overlay on media thumbnails (Vault cards)\n * as well as inline rows (the AI Voice Message \"Generated Audio\" row).\n *\n * The waveform is seeded from the decoded audio when possible, falling back\n * to a deterministic (not random) placeholder derived from `src` so the\n * result is stable across renders, SSR, and Chromatic snapshots.\n *\n * @example\n * ```tsx\n * <AudioPlayer src=\"https://example.com/clip.mp3\" duration={5} />\n * ```\n */\nexport const AudioPlayer = React.forwardRef<HTMLDivElement, AudioPlayerProps>(\n (\n {\n className,\n src,\n duration,\n playing: controlledPlaying,\n defaultPlaying = false,\n onPlay,\n onPause,\n onEnded,\n size = \"40\",\n ...props\n },\n ref,\n ) => {\n const audioRef = React.useRef<HTMLAudioElement>(null);\n const trackRef = React.useRef<HTMLDivElement>(null);\n\n const [internalPlaying, setInternalPlaying] = React.useState(defaultPlaying);\n const isControlled = controlledPlaying !== undefined;\n const playing = isControlled ? controlledPlaying : internalPlaying;\n\n const [currentTime, setCurrentTime] = React.useState(0);\n const [mediaDuration, setMediaDuration] = React.useState<number | undefined>(undefined);\n const barCount = useFittedBarCount(trackRef, {\n barWidthPx: BAR_WIDTH_PX,\n gapPx: BAR_GAP_PX,\n fallback: DEFAULT_BAR_COUNT,\n });\n const [peaks, setPeaks] = React.useState<number[]>(() =>\n generateFallbackPeaks(src, RAW_PEAK_COUNT),\n );\n const [isDragging, setIsDragging] = React.useState(false);\n\n const displayDuration = mediaDuration ?? duration;\n const hasStarted = playing || currentTime > 0;\n\n // Latest-value refs so the src-change effect below can react to a src swap\n // without re-running whenever `playing`/`isControlled`/`onPause` change.\n const playingRef = React.useRef(playing);\n playingRef.current = playing;\n const isControlledRef = React.useRef(isControlled);\n isControlledRef.current = isControlled;\n const onPauseRef = React.useRef(onPause);\n onPauseRef.current = onPause;\n\n // Reset transient playback state when the source changes. Skips the\n // initial mount (there's nothing to reset yet) and, if playback was\n // active, stops it — the browser silently drops playback on a source\n // swap, so the UI (and any controlled parent) must be told via onPause.\n const isFirstSrcRenderRef = React.useRef(true);\n React.useEffect(() => {\n if (isFirstSrcRenderRef.current) {\n isFirstSrcRenderRef.current = false;\n return;\n }\n setCurrentTime(0);\n setMediaDuration(undefined);\n setPeaks(generateFallbackPeaks(src, RAW_PEAK_COUNT));\n if (playingRef.current) {\n if (!isControlledRef.current) setInternalPlaying(false);\n onPauseRef.current?.();\n }\n }, [src]);\n\n // Decode the audio to derive real waveform amplitudes, falling back to a\n // deterministic placeholder on any failure (network, CORS, unsupported format).\n React.useEffect(() => {\n let cancelled = false;\n const abortController = new AbortController();\n\n decodeAudioPeaks(src, abortController.signal)\n .then((decodedPeaks) => {\n if (!cancelled) setPeaks(decodedPeaks);\n })\n .catch(() => {\n if (!cancelled) setPeaks(generateFallbackPeaks(src, RAW_PEAK_COUNT));\n });\n\n return () => {\n cancelled = true;\n abortController.abort();\n };\n }, [src]);\n\n // Sync the controlled/uncontrolled `playing` state to the media element.\n React.useEffect(() => {\n const audio = audioRef.current;\n if (!audio) return;\n if (playing) {\n audio.play().catch(() => {\n if (!isControlled) setInternalPlaying(false);\n onPauseRef.current?.();\n });\n } else {\n audio.pause();\n }\n }, [playing, isControlled]);\n\n const handleToggle = () => {\n const next = !playing;\n if (!isControlled) setInternalPlaying(next);\n if (next) onPlay?.();\n else onPause?.();\n };\n\n const seekTo = React.useCallback(\n (time: number) => {\n if (displayDuration === undefined) return;\n const clamped = Math.min(Math.max(time, 0), displayDuration);\n setCurrentTime(clamped);\n const audio = audioRef.current;\n if (audio) audio.currentTime = clamped;\n },\n [displayDuration],\n );\n\n const seekFromClientX = React.useCallback(\n (clientX: number) => {\n const track = trackRef.current;\n if (!track || displayDuration === undefined) return;\n const rect = track.getBoundingClientRect();\n if (rect.width <= 0) return;\n const fraction = Math.min(Math.max((clientX - rect.left) / rect.width, 0), 1);\n seekTo(fraction * displayDuration);\n },\n [displayDuration, seekTo],\n );\n\n // Track drag outside the element via window listeners rather than pointer\n // capture, which some environments (and jsdom) don't fully implement.\n React.useEffect(() => {\n if (!isDragging) return;\n const handleWindowPointerMove = (event: PointerEvent) => seekFromClientX(event.clientX);\n const handleWindowPointerUp = () => setIsDragging(false);\n window.addEventListener(\"pointermove\", handleWindowPointerMove);\n window.addEventListener(\"pointerup\", handleWindowPointerUp);\n return () => {\n window.removeEventListener(\"pointermove\", handleWindowPointerMove);\n window.removeEventListener(\"pointerup\", handleWindowPointerUp);\n };\n }, [isDragging, seekFromClientX]);\n\n const handlePointerDown = (event: React.PointerEvent<HTMLDivElement>) => {\n seekFromClientX(event.clientX);\n setIsDragging(true);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (displayDuration === undefined) return;\n switch (event.key) {\n case \"ArrowRight\":\n case \"ArrowUp\":\n event.preventDefault();\n seekTo(currentTime + SEEK_STEP_SECONDS);\n break;\n case \"ArrowLeft\":\n case \"ArrowDown\":\n event.preventDefault();\n seekTo(currentTime - SEEK_STEP_SECONDS);\n break;\n case \"PageUp\":\n event.preventDefault();\n seekTo(currentTime + SEEK_STEP_LARGE_SECONDS);\n break;\n case \"PageDown\":\n event.preventDefault();\n seekTo(currentTime - SEEK_STEP_LARGE_SECONDS);\n break;\n case \"Home\":\n event.preventDefault();\n seekTo(0);\n break;\n case \"End\":\n event.preventDefault();\n seekTo(displayDuration);\n break;\n default:\n break;\n }\n };\n\n const totalLabel = formatTime(displayDuration);\n // Zero-padded to the total's length so the two timestamps always occupy the same width\n // (seconds are already two digits, so this only ever extends the minutes field).\n const elapsedLabel = formatTime(currentTime).padStart(totalLabel.length, \"0\");\n\n const bars = resamplePeaks(peaks, barCount);\n const progressFraction =\n displayDuration && displayDuration > 0\n ? Math.min(Math.max(currentTime / displayDuration, 0), 1)\n : 0;\n const playedBarCount = hasStarted ? Math.round(progressFraction * bars.length) : bars.length;\n const barData = bars.map((amplitude, index) => {\n const isPlayed = index < playedBarCount;\n return {\n heightPx: MIN_BAR_HEIGHT_PX + amplitude * (MAX_BAR_HEIGHT_PX - MIN_BAR_HEIGHT_PX),\n className: cn(\n \"w-1 shrink-0 rounded-3xs bg-messages-waveform-default\",\n \"motion-safe:transition-opacity motion-safe:duration-150 motion-safe:ease-in-out\",\n isPlayed ? \"opacity-100\" : \"opacity-50\",\n ),\n };\n });\n\n return (\n <div\n ref={ref}\n data-size={size}\n className={cn(\"flex w-full items-center gap-3\", className)}\n {...props}\n >\n <button\n type=\"button\"\n onClick={handleToggle}\n aria-label={playing ? \"Pause\" : \"Play\"}\n className={cn(\n \"flex size-8 shrink-0 items-center justify-center rounded-full\",\n \"bg-buttons-secondary-default text-icons-primary backdrop-blur-[40px]\",\n \"motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-in-out\",\n \"hover:bg-buttons-secondary-hover\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n )}\n >\n {playing ? <PauseIcon size={16} filled /> : <PlayIcon size={16} filled />}\n </button>\n\n <div className=\"flex min-w-0 flex-1 items-center gap-3\">\n <div\n ref={trackRef}\n role=\"slider\"\n tabIndex={0}\n aria-label=\"Seek\"\n aria-orientation=\"horizontal\"\n aria-valuemin={0}\n aria-valuemax={displayDuration}\n aria-valuenow={Math.round(currentTime)}\n aria-valuetext={\n displayDuration !== undefined\n ? `${formatTime(currentTime)} of ${formatTime(displayDuration)}`\n : formatTime(currentTime)\n }\n onPointerDown={handlePointerDown}\n onKeyDown={handleKeyDown}\n className={cn(\n \"flex h-10 min-w-0 flex-1 cursor-pointer touch-none select-none items-center gap-1 overflow-hidden\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n )}\n >\n {barData.map((bar, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: bars are a fixed-count, non-reorderable list\n <span key={index} className={bar.className} style={{ height: bar.heightPx }} />\n ))}\n </div>\n\n {/* Both slots always render, the second one merely hidden before playback, so the\n timer keeps one width and the waveform never reflows. The first slot shows the\n total until playback starts, and the two labels are equal width, so the timestamp\n sits in the same place in either state. */}\n <span className=\"typography-body-small-14px-semibold flex shrink-0 items-center gap-0.5 whitespace-nowrap tabular-nums\">\n <span className=\"text-content-primary\">{hasStarted ? elapsedLabel : totalLabel}</span>\n <span className={cn(\"text-content-secondary\", !hasStarted && \"invisible\")}>\n /{totalLabel}\n </span>\n </span>\n </div>\n\n {/* biome-ignore lint/a11y/useMediaCaption: this is a UI sound clip (voice note / short recording), not spoken/narrated content requiring captions. */}\n <audio\n ref={audioRef}\n src={src}\n preload=\"metadata\"\n className=\"hidden\"\n onLoadedMetadata={(event) => {\n const { duration: nativeDuration } = event.currentTarget;\n setMediaDuration(Number.isFinite(nativeDuration) ? nativeDuration : undefined);\n }}\n onTimeUpdate={(event) => {\n if (isDragging) return;\n setCurrentTime(event.currentTarget.currentTime);\n }}\n onEnded={() => {\n setCurrentTime(0);\n if (!isControlled) setInternalPlaying(false);\n onEnded?.();\n }}\n />\n </div>\n );\n },\n);\n\nAudioPlayer.displayName = \"AudioPlayer\";\n"],"names":[],"mappings":";;;;;;;;AAcA,MAAM,eAAe;AAErB,MAAM,aAAa;AAEnB,MAAM,oBAAoB;AAE1B,MAAM,oBAAoB;AAE1B,MAAM,oBAAoB;AAE1B,MAAM,oBAAoB;AAE1B,MAAM,0BAA0B;AAiDzB,MAAM,cAAc,MAAM;AAAA,EAC/B,CACE;AAAA,IACE;AAA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}
|
|
@@ -6,45 +6,45 @@ const VARIANTS = {
|
|
|
6
6
|
16: {
|
|
7
7
|
outlined: [
|
|
8
8
|
{
|
|
9
|
-
d: "M7.
|
|
9
|
+
d: "M7.971 10.581c-.66 0-1.32-.253-1.826-.753a2.587 2.587 0 0 1 0-3.653 2.587 2.587 0 0 1 3.653 0 2.587 2.587 0 0 1 0 3.653 2.57 2.57 0 0 1-1.827.753m0-4.166a1.58 1.58 0 0 0-1.12.46 1.594 1.594 0 0 0 0 2.24c.62.613 1.62.613 2.24 0a1.581 1.581 0 0 0-1.12-2.7"
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
|
-
d: "M9.
|
|
12
|
+
d: "M9.991 15.168c-.413 0-.82-.16-1.126-.467l-.494-.493a.594.594 0 0 0-.826-.007l-.507.48a1.59 1.59 0 0 1-1.6.36l-.487-.16a1.58 1.58 0 0 1-1.086-1.507v-.7a.58.58 0 0 0-.58-.586l-.7-.014a1.58 1.58 0 0 1-1.387-.88l-.227-.46a1.58 1.58 0 0 1 .3-1.833l.494-.493a.594.594 0 0 0 .006-.827l-.486-.506a1.58 1.58 0 0 1-.36-1.607l.16-.487c.22-.653.82-1.086 1.506-1.086h.7a.58.58 0 0 0 .587-.58l.013-.7a1.58 1.58 0 0 1 .88-1.387l.46-.227a1.58 1.58 0 0 1 1.834.3l.493.494a.594.594 0 0 0 .827.006l.506-.486a1.6 1.6 0 0 1 1.607-.36l.487.16a1.59 1.59 0 0 1 1.086 1.506v.7c0 .327.254.587.58.594l.7.013a1.57 1.57 0 0 1 1.387.88l.227.46a1.58 1.58 0 0 1-.3 1.833l-.494.494a.594.594 0 0 0-.006.826l.486.507c.407.427.547 1.04.36 1.6l-.16.486a1.58 1.58 0 0 1-1.506 1.087h-.7a.58.58 0 0 0-.587.58l-.013.7a1.57 1.57 0 0 1-.88 1.387l-.46.226a1.6 1.6 0 0 1-.714.167zm-2.033-2.127c.407 0 .82.153 1.127.46l.493.494a.59.59 0 0 0 .68.113l.46-.227c.193-.1.32-.293.327-.513l.013-.7c.02-.86.733-1.554 1.587-1.554h.7c.253 0 .48-.16.56-.406l.16-.487a.59.59 0 0 0-.134-.593l-.486-.507c-.594-.62-.58-1.62.026-2.226l.494-.494a.59.59 0 0 0 .113-.68l-.227-.46a.6.6 0 0 0-.513-.326l-.7-.014a1.6 1.6 0 0 1-1.553-1.593v-.7c0-.253-.16-.48-.407-.56l-.487-.16a.59.59 0 0 0-.593.133l-.507.48c-.62.594-1.62.58-2.226-.026l-.494-.494a.59.59 0 0 0-.68-.113l-.46.227a.6.6 0 0 0-.326.513l-.014.7a1.597 1.597 0 0 1-1.586 1.553h-.7c-.254 0-.48.16-.56.407l-.16.487a.59.59 0 0 0 .133.593l.487.507c.593.62.58 1.62-.027 2.226l-.493.494a.59.59 0 0 0-.114.68l.227.46c.1.193.293.32.513.326l.7.014c.86.02 1.554.733 1.554 1.586v.7c0 .253.16.48.406.56l.487.16c.207.067.44.02.593-.133l.507-.48c.307-.293.7-.44 1.1-.44z"
|
|
13
13
|
}
|
|
14
14
|
],
|
|
15
15
|
filled: [
|
|
16
16
|
{
|
|
17
|
-
d: "
|
|
17
|
+
d: "M13.846 8.716a1.095 1.095 0 0 1 .013-1.526l.494-.494c.333-.333.413-.84.206-1.26l-.226-.46a1.09 1.09 0 0 0-.954-.6l-.7-.013a1.093 1.093 0 0 1-1.066-1.093v-.7c0-.467-.3-.887-.747-1.034l-.487-.16a1.1 1.1 0 0 0-1.1.247l-.506.487c-.427.413-1.107.4-1.527-.014L6.753 1.603a1.1 1.1 0 0 0-1.26-.207l-.46.227c-.36.18-.594.547-.607.953l-.013.7A1.093 1.093 0 0 1 3.32 4.343h-.7c-.466 0-.886.3-1.033.747l-.16.486c-.127.38-.033.807.247 1.1l.48.507c.413.427.4 1.107-.014 1.527L1.647 9.203c-.333.333-.413.84-.207 1.26l.227.46c.18.36.547.593.953.6l.7.013a1.09 1.09 0 0 1 1.067 1.094v.7c0 .466.3.886.747 1.033l.486.16c.387.127.807.033 1.1-.247l.507-.486a1.095 1.095 0 0 1 1.527.02l.493.493c.333.333.84.413 1.26.207L10.966 14.283c.36-.18.593-.547.6-.953l.013-.7a1.09 1.09 0 0 1 1.094-1.067h.7c.466 0 .886-.3 1.033-.747l.16-.486a1.09 1.09 0 0 0-.247-1.1l-.486-.507zm-4.367.707a2.084 2.084 0 1 1-2.946-2.949A2.084 2.084 0 0 1 9.48 9.423"
|
|
18
18
|
}
|
|
19
19
|
]
|
|
20
20
|
},
|
|
21
21
|
24: {
|
|
22
22
|
outlined: [
|
|
23
23
|
{
|
|
24
|
-
d: "
|
|
24
|
+
d: "M12.005 15.93c-.99 0-1.98-.38-2.74-1.13a3.88 3.88 0 0 1 0-5.48 3.88 3.88 0 0 1 5.48 0 3.88 3.88 0 0 1 0 5.48c-.76.76-1.75 1.13-2.74 1.13m0-6.25c-.61 0-1.22.23-1.68.69a2.39 2.39 0 0 0 0 3.36c.93.92 2.43.92 3.36 0a2.372 2.372 0 0 0-1.68-4.05"
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
|
-
d: "
|
|
27
|
+
d: "M15.035 22.81c-.62 0-1.23-.24-1.69-.7l-.74-.74a.89.89 0 0 0-1.24-.01l-.76.72c-.64.61-1.56.82-2.4.54l-.73-.24a2.375 2.375 0 0 1-1.63-2.26v-1.05c0-.49-.38-.88-.87-.88l-1.05-.02c-.89-.02-1.68-.52-2.08-1.32l-.34-.69c-.46-.92-.28-2.03.45-2.75l.74-.74a.89.89 0 0 0 .01-1.24l-.73-.76c-.62-.64-.82-1.56-.54-2.41l.24-.73c.33-.98 1.23-1.63 2.26-1.63h1.05c.49 0 .88-.38.88-.87l.02-1.05c.02-.89.53-1.69 1.32-2.08l.69-.34c.92-.46 2.03-.28 2.75.45l.74.74c.34.34.89.34 1.24.01l.76-.73c.64-.61 1.56-.82 2.41-.54l.73.24c.98.33 1.63 1.24 1.63 2.26v1.05c0 .49.38.88.87.89l1.05.02c.89.02 1.69.52 2.08 1.32l.34.69c.46.92.28 2.03-.45 2.75l-.74.74a.89.89 0 0 0-.01 1.24l.73.76c.61.64.82 1.56.54 2.4l-.24.73c-.33.98-1.23 1.63-2.26 1.63h-1.05c-.49 0-.88.38-.88.87l-.02 1.05c-.02.89-.52 1.69-1.32 2.08l-.69.34c-.34.17-.71.25-1.07.25zm-3.05-3.19c.61 0 1.23.23 1.69.69l.74.74c.27.27.68.34 1.02.17l.69-.34c.29-.15.48-.44.49-.77l.02-1.05c.03-1.29 1.1-2.33 2.38-2.33h1.05c.38 0 .72-.24.84-.61l.24-.73c.1-.31.03-.65-.2-.89l-.73-.76c-.89-.93-.87-2.43.04-3.34l.74-.74c.27-.27.34-.68.17-1.02l-.34-.69a.9.9 0 0 0-.77-.49l-1.05-.02a2.4 2.4 0 0 1-2.33-2.39v-1.05a.88.88 0 0 0-.61-.84l-.73-.24a.89.89 0 0 0-.89.2l-.76.72c-.93.89-2.43.87-3.34-.04l-.74-.74a.88.88 0 0 0-1.02-.17l-.69.34c-.29.15-.48.44-.49.77l-.02 1.05a2.395 2.395 0 0 1-2.38 2.33h-1.05a.88.88 0 0 0-.84.61l-.24.73c-.1.31-.03.66.2.89l.73.76c.89.93.87 2.43-.04 3.34l-.74.74c-.27.27-.34.68-.17 1.02l.34.69c.15.29.44.48.77.49l1.05.02c1.29.03 2.33 1.1 2.33 2.38v1.05c0 .38.24.72.61.84l.73.24c.31.1.66.03.89-.2l.76-.72c.46-.44 1.05-.66 1.65-.66z"
|
|
28
28
|
}
|
|
29
29
|
],
|
|
30
30
|
filled: [
|
|
31
31
|
{
|
|
32
|
-
d: "
|
|
32
|
+
d: "M20.77 13.145c-.62-.64-.6-1.66.02-2.29l.74-.74c.5-.5.62-1.26.31-1.89l-.34-.69a1.63 1.63 0 0 0-1.43-.9l-1.05-.02a1.64 1.64 0 0 1-1.6-1.64V3.925c0-.7-.45-1.33-1.12-1.55l-.73-.24a1.64 1.64 0 0 0-1.65.37l-.76.73c-.64.62-1.66.6-2.29-.02L10.13 2.475c-.5-.5-1.26-.62-1.89-.31l-.69.34c-.54.27-.89.82-.91 1.43l-.02 1.05c-.02.89-.75 1.6-1.64 1.6H3.93c-.7 0-1.33.45-1.55 1.12l-.24.73c-.19.57-.05 1.21.37 1.65l.72.76c.62.64.6 1.66-.02 2.29l-.74.74c-.5.5-.62 1.26-.31 1.89l.34.69c.27.54.82.89 1.43.9l1.05.02c.89.02 1.6.74 1.6 1.64v1.05c0 .7.45 1.33 1.12 1.55l.73.24c.58.19 1.21.05 1.65-.37l.76-.73c.64-.61 1.66-.6 2.29.03l.74.74c.5.5 1.26.62 1.89.31l.69-.34c.54-.27.89-.82.9-1.43l.02-1.05c.02-.89.74-1.6 1.64-1.6h1.05c.7 0 1.33-.45 1.55-1.12l.24-.73c.19-.58.05-1.21-.37-1.65l-.73-.76zm-6.55 1.06a3.126 3.126 0 0 1-4.42-4.42 3.126 3.126 0 0 1 4.42 4.42"
|
|
33
33
|
}
|
|
34
34
|
]
|
|
35
35
|
},
|
|
36
36
|
32: {
|
|
37
37
|
outlined: [
|
|
38
38
|
{
|
|
39
|
-
d: "
|
|
39
|
+
d: "M16.007 21.162a5.2 5.2 0 0 1-3.653-1.506 5.174 5.174 0 0 1 0-7.307 5.174 5.174 0 0 1 7.307 0 5.174 5.174 0 0 1 0 7.307 5.14 5.14 0 0 1-3.654 1.506m0-8.333c-.813 0-1.626.307-2.24.92a3.187 3.187 0 0 0 0 4.48 3.187 3.187 0 0 0 4.48 0 3.158 3.158 0 0 0-2.24-5.4"
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
|
-
d: "
|
|
42
|
+
d: "M20.048 30.336a3.18 3.18 0 0 1-2.254-.934l-.987-.986a1.187 1.187 0 0 0-1.653-.014l-1.013.96a3.18 3.18 0 0 1-3.2.72l-.974-.32a3.17 3.17 0 0 1-2.173-3.013v-1.4c0-.653-.507-1.173-1.16-1.173l-1.4-.027a3.16 3.16 0 0 1-2.773-1.76l-.454-.92a3.16 3.16 0 0 1 .6-3.667l.987-.986a1.19 1.19 0 0 0 .013-1.654l-.973-1.013a3.17 3.17 0 0 1-.72-3.213l.32-.974a3.17 3.17 0 0 1 3.013-2.173h1.4c.654 0 1.174-.507 1.174-1.16l.026-1.4A3.17 3.17 0 0 1 9.607 2.456l.92-.454a3.16 3.16 0 0 1 3.667.6l.987.987a1.187 1.187 0 0 0 1.653.013l1.014-.973a3.19 3.19 0 0 1 3.213-.72l.973.32a3.18 3.18 0 0 1 2.174 3.013v1.4c0 .654.506 1.174 1.16 1.187l1.4.027a3.14 3.14 0 0 1 2.773 1.76l.453.92a3.16 3.16 0 0 1-.6 3.666l-.986.987a1.187 1.187 0 0 0-.014 1.653l.974 1.014a3.18 3.18 0 0 1 .72 3.2l-.32.973a3.17 3.17 0 0 1-3.014 2.173h-1.4c-.653 0-1.173.507-1.173 1.16l-.027 1.4a3.14 3.14 0 0 1-1.76 2.774l-.92.453a3.2 3.2 0 0 1-1.427.333zm-4.067-4.254c.813 0 1.64.307 2.253.92l.987.987c.36.36.906.453 1.36.227l.92-.454c.387-.2.64-.586.653-1.026l.027-1.4a3.194 3.194 0 0 1 3.173-3.107h1.4c.507 0 .96-.32 1.12-.813l.32-.974a1.18 1.18 0 0 0-.267-1.186l-.973-1.014c-1.187-1.24-1.16-3.24.053-4.453l.987-.987c.36-.36.453-.906.227-1.36l-.454-.92c-.2-.386-.586-.64-1.026-.653l-1.4-.027a3.197 3.197 0 0 1-3.107-3.186v-1.4c0-.507-.32-.96-.813-1.12l-.974-.32a1.18 1.18 0 0 0-1.186.266l-1.014.96c-1.24 1.187-3.24 1.16-4.453-.053l-.987-.987a1.18 1.18 0 0 0-1.36-.226l-.92.453c-.386.2-.64.587-.653 1.027l-.027 1.4a3.194 3.194 0 0 1-3.173 3.106h-1.4c-.507 0-.96.32-1.12.814l-.32.973c-.133.413-.04.88.267 1.187l.973 1.013c1.187 1.24 1.16 3.24-.053 4.453l-.987.987a1.18 1.18 0 0 0-.227 1.36l.454.92c.2.387.586.64 1.026.653l1.4.027a3.194 3.194 0 0 1 3.107 3.173v1.4c0 .507.32.96.813 1.12l.974.32c.413.134.88.04 1.186-.266l1.014-.96a3.16 3.16 0 0 1 2.2-.88z"
|
|
43
43
|
}
|
|
44
44
|
],
|
|
45
45
|
filled: [
|
|
46
46
|
{
|
|
47
|
-
d: "
|
|
47
|
+
d: "M27.6 17.527c-.827-.854-.8-2.214.027-3.054l.986-.986c.667-.667.827-1.68.414-2.52l-.454-.92a2.17 2.17 0 0 0-1.906-1.2l-1.4-.027a2.186 2.186 0 0 1-2.134-2.187v-1.4c0-.933-.6-1.773-1.493-2.066l-.973-.32a2.19 2.19 0 0 0-2.2.493l-1.014.973c-.853.827-2.213.8-3.053-.026L13.413 3.3a2.19 2.19 0 0 0-2.52-.413l-.92.453A2.21 2.21 0 0 0 8.76 5.247l-.027 1.4A2.186 2.186 0 0 1 6.547 8.78h-1.4c-.934 0-1.774.6-2.067 1.493l-.32.974a2.2 2.2 0 0 0 .493 2.2l.96 1.013c.827.853.8 2.213-.026 3.053l-.987.987a2.19 2.19 0 0 0-.413 2.52l.453.92a2.17 2.17 0 0 0 1.907 1.2l1.4.027a2.177 2.177 0 0 1 2.133 2.186v1.4c0 .934.6 1.774 1.493 2.067l.974.32a2.19 2.19 0 0 0 2.2-.493l1.013-.974a2.19 2.19 0 0 1 3.053.04l.987.987a2.19 2.19 0 0 0 2.52.413l.92-.453a2.17 2.17 0 0 0 1.2-1.907l.027-1.4a2.177 2.177 0 0 1 2.186-2.133h1.4c.934 0 1.774-.6 2.067-1.493l.32-.974a2.19 2.19 0 0 0-.493-2.2l-.974-1.013zm-8.733 1.413a4.168 4.168 0 0 1-5.894-5.893 4.17 4.17 0 0 1 5.894 0 4.17 4.17 0 0 1 0 5.893"
|
|
48
48
|
}
|
|
49
49
|
]
|
|
50
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CogIcon.mjs","sources":["../../../src/components/Icons/CogIcon.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: \"M7.168 9.748c-.66 0-1.32-.253-1.826-.753a2.587 2.587 0 0 1 0-3.653 2.587 2.587 0 0 1 3.653 0 2.587 2.587 0 0 1 0 3.653 2.57 2.57 0 0 1-1.827.753m0-4.166a1.58 1.58 0 0 0-1.12.46 1.594 1.594 0 0 0 0 2.24c.62.613 1.62.613 2.24 0a1.581 1.581 0 0 0-1.12-2.7\",\n },\n {\n d: \"M9.188 14.335c-.413 0-.82-.16-1.126-.467l-.494-.493a.594.594 0 0 0-.826-.007l-.507.48a1.59 1.59 0 0 1-1.6.36l-.487-.16a1.58 1.58 0 0 1-1.086-1.507v-.7a.58.58 0 0 0-.58-.586l-.7-.014a1.58 1.58 0 0 1-1.387-.88l-.227-.46a1.58 1.58 0 0 1 .3-1.833l.494-.493a.594.594 0 0 0 .006-.827l-.486-.506a1.58 1.58 0 0 1-.36-1.607l.16-.487c.22-.653.82-1.086 1.506-1.086h.7a.58.58 0 0 0 .587-.58l.013-.7a1.58 1.58 0 0 1 .88-1.387l.46-.227a1.58 1.58 0 0 1 1.834.3l.493.494a.594.594 0 0 0 .827.006l.506-.486a1.6 1.6 0 0 1 1.607-.36l.487.16a1.59 1.59 0 0 1 1.086 1.506v.7c0 .327.254.587.58.594l.7.013a1.57 1.57 0 0 1 1.387.88l.227.46a1.58 1.58 0 0 1-.3 1.833l-.494.494a.594.594 0 0 0-.006.826l.486.507c.407.427.547 1.04.36 1.6l-.16.486a1.58 1.58 0 0 1-1.506 1.087h-.7a.58.58 0 0 0-.587.58l-.013.7a1.57 1.57 0 0 1-.88 1.387l-.46.226a1.6 1.6 0 0 1-.714.167zm-2.033-2.127c.407 0 .82.153 1.127.46l.493.494a.59.59 0 0 0 .68.113l.46-.227c.193-.1.32-.293.327-.513l.013-.7c.02-.86.733-1.554 1.587-1.554h.7c.253 0 .48-.16.56-.406l.16-.487a.59.59 0 0 0-.134-.593l-.486-.507c-.594-.62-.58-1.62.026-2.226l.494-.494a.59.59 0 0 0 .113-.68l-.227-.46a.6.6 0 0 0-.513-.326l-.7-.014a1.6 1.6 0 0 1-1.553-1.593v-.7c0-.253-.16-.48-.407-.56l-.487-.16a.59.59 0 0 0-.593.133l-.507.48c-.62.594-1.62.58-2.226-.026l-.494-.494a.59.59 0 0 0-.68-.113l-.46.227a.6.6 0 0 0-.326.513l-.014.7a1.597 1.597 0 0 1-1.586 1.553h-.7c-.254 0-.48.16-.56.407l-.16.487a.59.59 0 0 0 .133.593l.487.507c.593.62.58 1.62-.027 2.226l-.493.494a.59.59 0 0 0-.114.68l.227.46c.1.193.293.32.513.326l.7.014c.86.02 1.554.733 1.554 1.586v.7c0 .253.16.48.406.56l.487.16c.207.067.44.02.593-.133l.507-.48c.307-.293.7-.44 1.1-.44z\",\n },\n ],\n filled: [\n {\n d: \"M12.52 7.433a1.095 1.095 0 0 1 .013-1.526l.494-.494c.333-.333.413-.84.206-1.26l-.226-.46a1.09 1.09 0 0 0-.954-.6l-.7-.013a1.093 1.093 0 0 1-1.066-1.093v-.7c0-.467-.3-.887-.747-1.034l-.487-.16a1.1 1.1 0 0 0-1.1.247l-.506.487c-.427.413-1.107.4-1.527-.014L5.427.32a1.1 1.1 0 0 0-1.26-.207l-.46.227c-.36.18-.594.547-.607.953l-.013.7A1.093 1.093 0 0 1 1.993 3.06h-.7c-.466 0-.886.3-1.033.747l-.16.486c-.127.38-.033.807.247 1.1l.48.507c.413.427.4 1.107-.014 1.527L.32 7.92c-.333.333-.413.84-.207 1.26l.227.46c.18.36.547.593.953.6l.7.013a1.09 1.09 0 0 1 1.067 1.094v.7c0 .466.3.886.747 1.033l.486.16c.387.127.807.033 1.1-.247l.507-.486a1.095 1.095 0 0 1 1.527.02l.493.493c.333.333.84.413 1.26.207L9.64 13c.36-.18.593-.547.6-.953l.013-.7a1.09 1.09 0 0 1 1.094-1.067h.7c.466 0 .886-.3 1.033-.747l.16-.486a1.09 1.09 0 0 0-.247-1.1l-.486-.507zm-4.367.707a2.084 2.084 0 1 1-2.946-2.949A2.084 2.084 0 0 1 8.153 8.14\",\n },\n ],\n },\n 24: {\n outlined: [\n {\n d: \"M10.752 14.622c-.99 0-1.98-.38-2.74-1.13a3.88 3.88 0 0 1 0-5.48 3.88 3.88 0 0 1 5.48 0 3.88 3.88 0 0 1 0 5.48c-.76.76-1.75 1.13-2.74 1.13m0-6.25c-.61 0-1.22.23-1.68.69a2.39 2.39 0 0 0 0 3.36c.93.92 2.43.92 3.36 0a2.372 2.372 0 0 0-1.68-4.05\",\n },\n {\n d: \"M13.782 21.502c-.62 0-1.23-.24-1.69-.7l-.74-.74a.89.89 0 0 0-1.24-.01l-.76.72c-.64.61-1.56.82-2.4.54l-.73-.24a2.375 2.375 0 0 1-1.63-2.26v-1.05c0-.49-.38-.88-.87-.88l-1.05-.02c-.89-.02-1.68-.52-2.08-1.32l-.34-.69c-.46-.92-.28-2.03.45-2.75l.74-.74a.89.89 0 0 0 .01-1.24l-.73-.76c-.62-.64-.82-1.56-.54-2.41l.24-.73c.33-.98 1.23-1.63 2.26-1.63h1.05c.49 0 .88-.38.88-.87l.02-1.05c.02-.89.53-1.69 1.32-2.08l.69-.34c.92-.46 2.03-.28 2.75.45l.74.74c.34.34.89.34 1.24.01l.76-.73c.64-.61 1.56-.82 2.41-.54l.73.24c.98.33 1.63 1.24 1.63 2.26v1.05c0 .49.38.88.87.89l1.05.02c.89.02 1.69.52 2.08 1.32l.34.69c.46.92.28 2.03-.45 2.75l-.74.74a.89.89 0 0 0-.01 1.24l.73.76c.61.64.82 1.56.54 2.4l-.24.73c-.33.98-1.23 1.63-2.26 1.63h-1.05c-.49 0-.88.38-.88.87l-.02 1.05c-.02.89-.52 1.69-1.32 2.08l-.69.34c-.34.17-.71.25-1.07.25zm-3.05-3.19c.61 0 1.23.23 1.69.69l.74.74c.27.27.68.34 1.02.17l.69-.34c.29-.15.48-.44.49-.77l.02-1.05c.03-1.29 1.1-2.33 2.38-2.33h1.05c.38 0 .72-.24.84-.61l.24-.73c.1-.31.03-.65-.2-.89l-.73-.76c-.89-.93-.87-2.43.04-3.34l.74-.74c.27-.27.34-.68.17-1.02l-.34-.69a.9.9 0 0 0-.77-.49l-1.05-.02a2.4 2.4 0 0 1-2.33-2.39v-1.05a.88.88 0 0 0-.61-.84l-.73-.24a.89.89 0 0 0-.89.2l-.76.72c-.93.89-2.43.87-3.34-.04l-.74-.74a.88.88 0 0 0-1.02-.17l-.69.34c-.29.15-.48.44-.49.77l-.02 1.05a2.395 2.395 0 0 1-2.38 2.33h-1.05a.88.88 0 0 0-.84.61l-.24.73c-.1.31-.03.66.2.89l.73.76c.89.93.87 2.43-.04 3.34l-.74.74c-.27.27-.34.68-.17 1.02l.34.69c.15.29.44.48.77.49l1.05.02c1.29.03 2.33 1.1 2.33 2.38v1.05c0 .38.24.72.61.84l.73.24c.31.1.66.03.89-.2l.76-.72c.46-.44 1.05-.66 1.65-.66z\",\n },\n ],\n filled: [\n {\n d: \"M18.78 11.15c-.62-.64-.6-1.66.02-2.29l.74-.74c.5-.5.62-1.26.31-1.89l-.34-.69a1.63 1.63 0 0 0-1.43-.9l-1.05-.02a1.64 1.64 0 0 1-1.6-1.64V1.93c0-.7-.45-1.33-1.12-1.55l-.73-.24a1.64 1.64 0 0 0-1.65.37l-.76.73c-.64.62-1.66.6-2.29-.02L8.14.48c-.5-.5-1.26-.62-1.89-.31l-.69.34c-.54.27-.89.82-.91 1.43l-.02 1.05c-.02.89-.75 1.6-1.64 1.6H1.94c-.7 0-1.33.45-1.55 1.12l-.24.73c-.19.57-.05 1.21.37 1.65l.72.76c.62.64.6 1.66-.02 2.29l-.74.74c-.5.5-.62 1.26-.31 1.89l.34.69c.27.54.82.89 1.43.9l1.05.02c.89.02 1.6.74 1.6 1.64v1.05c0 .7.45 1.33 1.12 1.55l.73.24c.58.19 1.21.05 1.65-.37l.76-.73c.64-.61 1.66-.6 2.29.03l.74.74c.5.5 1.26.62 1.89.31l.69-.34c.54-.27.89-.82.9-1.43l.02-1.05c.02-.89.74-1.6 1.64-1.6h1.05c.7 0 1.33-.45 1.55-1.12l.24-.73c.19-.58.05-1.21-.37-1.65l-.73-.76zm-6.55 1.06a3.126 3.126 0 0 1-4.42-4.42 3.126 3.126 0 0 1 4.42 4.42\",\n },\n ],\n },\n 32: {\n outlined: [\n {\n d: \"M14.336 19.496a5.2 5.2 0 0 1-3.653-1.506 5.174 5.174 0 0 1 0-7.307 5.174 5.174 0 0 1 7.307 0 5.174 5.174 0 0 1 0 7.307 5.14 5.14 0 0 1-3.654 1.506m0-8.333c-.813 0-1.626.307-2.24.92a3.187 3.187 0 0 0 0 4.48 3.187 3.187 0 0 0 4.48 0 3.158 3.158 0 0 0-2.24-5.4\",\n },\n {\n d: \"M18.377 28.67a3.18 3.18 0 0 1-2.254-.934l-.987-.986a1.187 1.187 0 0 0-1.653-.014l-1.013.96a3.18 3.18 0 0 1-3.2.72l-.974-.32a3.17 3.17 0 0 1-2.173-3.013v-1.4c0-.653-.507-1.173-1.16-1.173l-1.4-.027a3.16 3.16 0 0 1-2.773-1.76l-.454-.92a3.16 3.16 0 0 1 .6-3.667l.987-.986a1.19 1.19 0 0 0 .013-1.654l-.973-1.013a3.17 3.17 0 0 1-.72-3.213l.32-.974a3.17 3.17 0 0 1 3.013-2.173h1.4c.654 0 1.174-.507 1.174-1.16l.026-1.4A3.17 3.17 0 0 1 7.936.79l.92-.454a3.16 3.16 0 0 1 3.667.6l.987.987a1.187 1.187 0 0 0 1.653.013l1.014-.973a3.19 3.19 0 0 1 3.213-.72l.973.32a3.18 3.18 0 0 1 2.174 3.013v1.4c0 .654.506 1.174 1.16 1.187l1.4.027a3.14 3.14 0 0 1 2.773 1.76l.453.92a3.16 3.16 0 0 1-.6 3.666l-.986.987a1.187 1.187 0 0 0-.014 1.653l.974 1.014a3.18 3.18 0 0 1 .72 3.2l-.32.973a3.17 3.17 0 0 1-3.014 2.173h-1.4c-.653 0-1.173.507-1.173 1.16l-.027 1.4a3.14 3.14 0 0 1-1.76 2.774l-.92.453a3.2 3.2 0 0 1-1.427.333zm-4.067-4.254c.813 0 1.64.307 2.253.92l.987.987c.36.36.906.453 1.36.227l.92-.454c.387-.2.64-.586.653-1.026l.027-1.4a3.194 3.194 0 0 1 3.173-3.107h1.4c.507 0 .96-.32 1.12-.813l.32-.974a1.18 1.18 0 0 0-.267-1.186l-.973-1.014c-1.187-1.24-1.16-3.24.053-4.453l.987-.987c.36-.36.453-.906.227-1.36l-.454-.92c-.2-.386-.586-.64-1.026-.653l-1.4-.027a3.197 3.197 0 0 1-3.107-3.186v-1.4c0-.507-.32-.96-.813-1.12l-.974-.32a1.18 1.18 0 0 0-1.186.266l-1.014.96c-1.24 1.187-3.24 1.16-4.453-.053l-.987-.987a1.18 1.18 0 0 0-1.36-.226l-.92.453c-.386.2-.64.587-.653 1.027l-.027 1.4a3.194 3.194 0 0 1-3.173 3.106h-1.4c-.507 0-.96.32-1.12.814l-.32.973c-.133.413-.04.88.267 1.187l.973 1.013c1.187 1.24 1.16 3.24-.053 4.453l-.987.987a1.18 1.18 0 0 0-.227 1.36l.454.92c.2.387.586.64 1.026.653l1.4.027a3.194 3.194 0 0 1 3.107 3.173v1.4c0 .507.32.96.813 1.12l.974.32c.413.134.88.04 1.186-.266l1.014-.96a3.16 3.16 0 0 1 2.2-.88z\",\n },\n ],\n filled: [\n {\n d: \"M25.04 14.867c-.827-.854-.8-2.214.027-3.054l.986-.986c.667-.667.827-1.68.414-2.52l-.454-.92a2.17 2.17 0 0 0-1.906-1.2l-1.4-.027a2.186 2.186 0 0 1-2.134-2.187v-1.4c0-.933-.6-1.773-1.493-2.066l-.973-.32a2.19 2.19 0 0 0-2.2.493l-1.014.973c-.853.827-2.213.8-3.053-.026L10.853.64a2.19 2.19 0 0 0-2.52-.413l-.92.453A2.21 2.21 0 0 0 6.2 2.587l-.027 1.4A2.186 2.186 0 0 1 3.987 6.12h-1.4c-.934 0-1.774.6-2.067 1.493l-.32.974a2.2 2.2 0 0 0 .493 2.2l.96 1.013c.827.853.8 2.213-.026 3.053l-.987.987a2.19 2.19 0 0 0-.413 2.52l.453.92a2.17 2.17 0 0 0 1.907 1.2l1.4.027a2.177 2.177 0 0 1 2.133 2.186v1.4c0 .934.6 1.774 1.493 2.067l.974.32a2.19 2.19 0 0 0 2.2-.493l1.013-.974a2.19 2.19 0 0 1 3.053.04l.987.987a2.19 2.19 0 0 0 2.52.413l.92-.453a2.17 2.17 0 0 0 1.2-1.907l.027-1.4a2.177 2.177 0 0 1 2.186-2.133h1.4c.934 0 1.774-.6 2.067-1.493l.32-.974a2.19 2.19 0 0 0-.493-2.2l-.974-1.013zm-8.733 1.413a4.168 4.168 0 0 1-5.894-5.893 4.17 4.17 0 0 1 5.894 0 4.17 4.17 0 0 1 0 5.893\",\n },\n ],\n },\n};\n\n/** Props for {@link CogIcon}. See {@link BaseIconProps} for the shared shape. */\nexport type CogIconProps = BaseIconProps;\n\n/**\n * Cog icon. Renders at sizes 16, 24, or 32 px with outlined and filled variants.\n *\n * @example\n * ```tsx\n * <CogIcon size={24} filled />\n * ```\n */\nexport const CogIcon = React.forwardRef<SVGSVGElement, CogIconProps>((props, ref) => (\n <BaseIcon ref={ref} variants={VARIANTS} {...props} />\n));\n\nCogIcon.displayName = \"CogIcon\";\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,UAAU,MAAM,WAAwC,CAAC,OAAO,QAC3E,oBAAC,UAAA,EAAS,KAAU,UAAU,UAAW,GAAG,OAAO,CACpD;AAED,QAAQ,cAAc;"}
|
|
1
|
+
{"version":3,"file":"CogIcon.mjs","sources":["../../../src/components/Icons/CogIcon.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: \"M7.971 10.581c-.66 0-1.32-.253-1.826-.753a2.587 2.587 0 0 1 0-3.653 2.587 2.587 0 0 1 3.653 0 2.587 2.587 0 0 1 0 3.653 2.57 2.57 0 0 1-1.827.753m0-4.166a1.58 1.58 0 0 0-1.12.46 1.594 1.594 0 0 0 0 2.24c.62.613 1.62.613 2.24 0a1.581 1.581 0 0 0-1.12-2.7\",\n },\n {\n d: \"M9.991 15.168c-.413 0-.82-.16-1.126-.467l-.494-.493a.594.594 0 0 0-.826-.007l-.507.48a1.59 1.59 0 0 1-1.6.36l-.487-.16a1.58 1.58 0 0 1-1.086-1.507v-.7a.58.58 0 0 0-.58-.586l-.7-.014a1.58 1.58 0 0 1-1.387-.88l-.227-.46a1.58 1.58 0 0 1 .3-1.833l.494-.493a.594.594 0 0 0 .006-.827l-.486-.506a1.58 1.58 0 0 1-.36-1.607l.16-.487c.22-.653.82-1.086 1.506-1.086h.7a.58.58 0 0 0 .587-.58l.013-.7a1.58 1.58 0 0 1 .88-1.387l.46-.227a1.58 1.58 0 0 1 1.834.3l.493.494a.594.594 0 0 0 .827.006l.506-.486a1.6 1.6 0 0 1 1.607-.36l.487.16a1.59 1.59 0 0 1 1.086 1.506v.7c0 .327.254.587.58.594l.7.013a1.57 1.57 0 0 1 1.387.88l.227.46a1.58 1.58 0 0 1-.3 1.833l-.494.494a.594.594 0 0 0-.006.826l.486.507c.407.427.547 1.04.36 1.6l-.16.486a1.58 1.58 0 0 1-1.506 1.087h-.7a.58.58 0 0 0-.587.58l-.013.7a1.57 1.57 0 0 1-.88 1.387l-.46.226a1.6 1.6 0 0 1-.714.167zm-2.033-2.127c.407 0 .82.153 1.127.46l.493.494a.59.59 0 0 0 .68.113l.46-.227c.193-.1.32-.293.327-.513l.013-.7c.02-.86.733-1.554 1.587-1.554h.7c.253 0 .48-.16.56-.406l.16-.487a.59.59 0 0 0-.134-.593l-.486-.507c-.594-.62-.58-1.62.026-2.226l.494-.494a.59.59 0 0 0 .113-.68l-.227-.46a.6.6 0 0 0-.513-.326l-.7-.014a1.6 1.6 0 0 1-1.553-1.593v-.7c0-.253-.16-.48-.407-.56l-.487-.16a.59.59 0 0 0-.593.133l-.507.48c-.62.594-1.62.58-2.226-.026l-.494-.494a.59.59 0 0 0-.68-.113l-.46.227a.6.6 0 0 0-.326.513l-.014.7a1.597 1.597 0 0 1-1.586 1.553h-.7c-.254 0-.48.16-.56.407l-.16.487a.59.59 0 0 0 .133.593l.487.507c.593.62.58 1.62-.027 2.226l-.493.494a.59.59 0 0 0-.114.68l.227.46c.1.193.293.32.513.326l.7.014c.86.02 1.554.733 1.554 1.586v.7c0 .253.16.48.406.56l.487.16c.207.067.44.02.593-.133l.507-.48c.307-.293.7-.44 1.1-.44z\",\n },\n ],\n filled: [\n {\n d: \"M13.846 8.716a1.095 1.095 0 0 1 .013-1.526l.494-.494c.333-.333.413-.84.206-1.26l-.226-.46a1.09 1.09 0 0 0-.954-.6l-.7-.013a1.093 1.093 0 0 1-1.066-1.093v-.7c0-.467-.3-.887-.747-1.034l-.487-.16a1.1 1.1 0 0 0-1.1.247l-.506.487c-.427.413-1.107.4-1.527-.014L6.753 1.603a1.1 1.1 0 0 0-1.26-.207l-.46.227c-.36.18-.594.547-.607.953l-.013.7A1.093 1.093 0 0 1 3.32 4.343h-.7c-.466 0-.886.3-1.033.747l-.16.486c-.127.38-.033.807.247 1.1l.48.507c.413.427.4 1.107-.014 1.527L1.647 9.203c-.333.333-.413.84-.207 1.26l.227.46c.18.36.547.593.953.6l.7.013a1.09 1.09 0 0 1 1.067 1.094v.7c0 .466.3.886.747 1.033l.486.16c.387.127.807.033 1.1-.247l.507-.486a1.095 1.095 0 0 1 1.527.02l.493.493c.333.333.84.413 1.26.207L10.966 14.283c.36-.18.593-.547.6-.953l.013-.7a1.09 1.09 0 0 1 1.094-1.067h.7c.466 0 .886-.3 1.033-.747l.16-.486a1.09 1.09 0 0 0-.247-1.1l-.486-.507zm-4.367.707a2.084 2.084 0 1 1-2.946-2.949A2.084 2.084 0 0 1 9.48 9.423\",\n },\n ],\n },\n 24: {\n outlined: [\n {\n d: \"M12.005 15.93c-.99 0-1.98-.38-2.74-1.13a3.88 3.88 0 0 1 0-5.48 3.88 3.88 0 0 1 5.48 0 3.88 3.88 0 0 1 0 5.48c-.76.76-1.75 1.13-2.74 1.13m0-6.25c-.61 0-1.22.23-1.68.69a2.39 2.39 0 0 0 0 3.36c.93.92 2.43.92 3.36 0a2.372 2.372 0 0 0-1.68-4.05\",\n },\n {\n d: \"M15.035 22.81c-.62 0-1.23-.24-1.69-.7l-.74-.74a.89.89 0 0 0-1.24-.01l-.76.72c-.64.61-1.56.82-2.4.54l-.73-.24a2.375 2.375 0 0 1-1.63-2.26v-1.05c0-.49-.38-.88-.87-.88l-1.05-.02c-.89-.02-1.68-.52-2.08-1.32l-.34-.69c-.46-.92-.28-2.03.45-2.75l.74-.74a.89.89 0 0 0 .01-1.24l-.73-.76c-.62-.64-.82-1.56-.54-2.41l.24-.73c.33-.98 1.23-1.63 2.26-1.63h1.05c.49 0 .88-.38.88-.87l.02-1.05c.02-.89.53-1.69 1.32-2.08l.69-.34c.92-.46 2.03-.28 2.75.45l.74.74c.34.34.89.34 1.24.01l.76-.73c.64-.61 1.56-.82 2.41-.54l.73.24c.98.33 1.63 1.24 1.63 2.26v1.05c0 .49.38.88.87.89l1.05.02c.89.02 1.69.52 2.08 1.32l.34.69c.46.92.28 2.03-.45 2.75l-.74.74a.89.89 0 0 0-.01 1.24l.73.76c.61.64.82 1.56.54 2.4l-.24.73c-.33.98-1.23 1.63-2.26 1.63h-1.05c-.49 0-.88.38-.88.87l-.02 1.05c-.02.89-.52 1.69-1.32 2.08l-.69.34c-.34.17-.71.25-1.07.25zm-3.05-3.19c.61 0 1.23.23 1.69.69l.74.74c.27.27.68.34 1.02.17l.69-.34c.29-.15.48-.44.49-.77l.02-1.05c.03-1.29 1.1-2.33 2.38-2.33h1.05c.38 0 .72-.24.84-.61l.24-.73c.1-.31.03-.65-.2-.89l-.73-.76c-.89-.93-.87-2.43.04-3.34l.74-.74c.27-.27.34-.68.17-1.02l-.34-.69a.9.9 0 0 0-.77-.49l-1.05-.02a2.4 2.4 0 0 1-2.33-2.39v-1.05a.88.88 0 0 0-.61-.84l-.73-.24a.89.89 0 0 0-.89.2l-.76.72c-.93.89-2.43.87-3.34-.04l-.74-.74a.88.88 0 0 0-1.02-.17l-.69.34c-.29.15-.48.44-.49.77l-.02 1.05a2.395 2.395 0 0 1-2.38 2.33h-1.05a.88.88 0 0 0-.84.61l-.24.73c-.1.31-.03.66.2.89l.73.76c.89.93.87 2.43-.04 3.34l-.74.74c-.27.27-.34.68-.17 1.02l.34.69c.15.29.44.48.77.49l1.05.02c1.29.03 2.33 1.1 2.33 2.38v1.05c0 .38.24.72.61.84l.73.24c.31.1.66.03.89-.2l.76-.72c.46-.44 1.05-.66 1.65-.66z\",\n },\n ],\n filled: [\n {\n d: \"M20.77 13.145c-.62-.64-.6-1.66.02-2.29l.74-.74c.5-.5.62-1.26.31-1.89l-.34-.69a1.63 1.63 0 0 0-1.43-.9l-1.05-.02a1.64 1.64 0 0 1-1.6-1.64V3.925c0-.7-.45-1.33-1.12-1.55l-.73-.24a1.64 1.64 0 0 0-1.65.37l-.76.73c-.64.62-1.66.6-2.29-.02L10.13 2.475c-.5-.5-1.26-.62-1.89-.31l-.69.34c-.54.27-.89.82-.91 1.43l-.02 1.05c-.02.89-.75 1.6-1.64 1.6H3.93c-.7 0-1.33.45-1.55 1.12l-.24.73c-.19.57-.05 1.21.37 1.65l.72.76c.62.64.6 1.66-.02 2.29l-.74.74c-.5.5-.62 1.26-.31 1.89l.34.69c.27.54.82.89 1.43.9l1.05.02c.89.02 1.6.74 1.6 1.64v1.05c0 .7.45 1.33 1.12 1.55l.73.24c.58.19 1.21.05 1.65-.37l.76-.73c.64-.61 1.66-.6 2.29.03l.74.74c.5.5 1.26.62 1.89.31l.69-.34c.54-.27.89-.82.9-1.43l.02-1.05c.02-.89.74-1.6 1.64-1.6h1.05c.7 0 1.33-.45 1.55-1.12l.24-.73c.19-.58.05-1.21-.37-1.65l-.73-.76zm-6.55 1.06a3.126 3.126 0 0 1-4.42-4.42 3.126 3.126 0 0 1 4.42 4.42\",\n },\n ],\n },\n 32: {\n outlined: [\n {\n d: \"M16.007 21.162a5.2 5.2 0 0 1-3.653-1.506 5.174 5.174 0 0 1 0-7.307 5.174 5.174 0 0 1 7.307 0 5.174 5.174 0 0 1 0 7.307 5.14 5.14 0 0 1-3.654 1.506m0-8.333c-.813 0-1.626.307-2.24.92a3.187 3.187 0 0 0 0 4.48 3.187 3.187 0 0 0 4.48 0 3.158 3.158 0 0 0-2.24-5.4\",\n },\n {\n d: \"M20.048 30.336a3.18 3.18 0 0 1-2.254-.934l-.987-.986a1.187 1.187 0 0 0-1.653-.014l-1.013.96a3.18 3.18 0 0 1-3.2.72l-.974-.32a3.17 3.17 0 0 1-2.173-3.013v-1.4c0-.653-.507-1.173-1.16-1.173l-1.4-.027a3.16 3.16 0 0 1-2.773-1.76l-.454-.92a3.16 3.16 0 0 1 .6-3.667l.987-.986a1.19 1.19 0 0 0 .013-1.654l-.973-1.013a3.17 3.17 0 0 1-.72-3.213l.32-.974a3.17 3.17 0 0 1 3.013-2.173h1.4c.654 0 1.174-.507 1.174-1.16l.026-1.4A3.17 3.17 0 0 1 9.607 2.456l.92-.454a3.16 3.16 0 0 1 3.667.6l.987.987a1.187 1.187 0 0 0 1.653.013l1.014-.973a3.19 3.19 0 0 1 3.213-.72l.973.32a3.18 3.18 0 0 1 2.174 3.013v1.4c0 .654.506 1.174 1.16 1.187l1.4.027a3.14 3.14 0 0 1 2.773 1.76l.453.92a3.16 3.16 0 0 1-.6 3.666l-.986.987a1.187 1.187 0 0 0-.014 1.653l.974 1.014a3.18 3.18 0 0 1 .72 3.2l-.32.973a3.17 3.17 0 0 1-3.014 2.173h-1.4c-.653 0-1.173.507-1.173 1.16l-.027 1.4a3.14 3.14 0 0 1-1.76 2.774l-.92.453a3.2 3.2 0 0 1-1.427.333zm-4.067-4.254c.813 0 1.64.307 2.253.92l.987.987c.36.36.906.453 1.36.227l.92-.454c.387-.2.64-.586.653-1.026l.027-1.4a3.194 3.194 0 0 1 3.173-3.107h1.4c.507 0 .96-.32 1.12-.813l.32-.974a1.18 1.18 0 0 0-.267-1.186l-.973-1.014c-1.187-1.24-1.16-3.24.053-4.453l.987-.987c.36-.36.453-.906.227-1.36l-.454-.92c-.2-.386-.586-.64-1.026-.653l-1.4-.027a3.197 3.197 0 0 1-3.107-3.186v-1.4c0-.507-.32-.96-.813-1.12l-.974-.32a1.18 1.18 0 0 0-1.186.266l-1.014.96c-1.24 1.187-3.24 1.16-4.453-.053l-.987-.987a1.18 1.18 0 0 0-1.36-.226l-.92.453c-.386.2-.64.587-.653 1.027l-.027 1.4a3.194 3.194 0 0 1-3.173 3.106h-1.4c-.507 0-.96.32-1.12.814l-.32.973c-.133.413-.04.88.267 1.187l.973 1.013c1.187 1.24 1.16 3.24-.053 4.453l-.987.987a1.18 1.18 0 0 0-.227 1.36l.454.92c.2.387.586.64 1.026.653l1.4.027a3.194 3.194 0 0 1 3.107 3.173v1.4c0 .507.32.96.813 1.12l.974.32c.413.134.88.04 1.186-.266l1.014-.96a3.16 3.16 0 0 1 2.2-.88z\",\n },\n ],\n filled: [\n {\n d: \"M27.6 17.527c-.827-.854-.8-2.214.027-3.054l.986-.986c.667-.667.827-1.68.414-2.52l-.454-.92a2.17 2.17 0 0 0-1.906-1.2l-1.4-.027a2.186 2.186 0 0 1-2.134-2.187v-1.4c0-.933-.6-1.773-1.493-2.066l-.973-.32a2.19 2.19 0 0 0-2.2.493l-1.014.973c-.853.827-2.213.8-3.053-.026L13.413 3.3a2.19 2.19 0 0 0-2.52-.413l-.92.453A2.21 2.21 0 0 0 8.76 5.247l-.027 1.4A2.186 2.186 0 0 1 6.547 8.78h-1.4c-.934 0-1.774.6-2.067 1.493l-.32.974a2.2 2.2 0 0 0 .493 2.2l.96 1.013c.827.853.8 2.213-.026 3.053l-.987.987a2.19 2.19 0 0 0-.413 2.52l.453.92a2.17 2.17 0 0 0 1.907 1.2l1.4.027a2.177 2.177 0 0 1 2.133 2.186v1.4c0 .934.6 1.774 1.493 2.067l.974.32a2.19 2.19 0 0 0 2.2-.493l1.013-.974a2.19 2.19 0 0 1 3.053.04l.987.987a2.19 2.19 0 0 0 2.52.413l.92-.453a2.17 2.17 0 0 0 1.2-1.907l.027-1.4a2.177 2.177 0 0 1 2.186-2.133h1.4c.934 0 1.774-.6 2.067-1.493l.32-.974a2.19 2.19 0 0 0-.493-2.2l-.974-1.013zm-8.733 1.413a4.168 4.168 0 0 1-5.894-5.893 4.17 4.17 0 0 1 5.894 0 4.17 4.17 0 0 1 0 5.893\",\n },\n ],\n },\n};\n\n/** Props for {@link CogIcon}. See {@link BaseIconProps} for the shared shape. */\nexport type CogIconProps = BaseIconProps;\n\n/**\n * Cog icon. Renders at sizes 16, 24, or 32 px with outlined and filled variants.\n *\n * @example\n * ```tsx\n * <CogIcon size={24} filled />\n * ```\n */\nexport const CogIcon = React.forwardRef<SVGSVGElement, CogIconProps>((props, ref) => (\n <BaseIcon ref={ref} variants={VARIANTS} {...props} />\n));\n\nCogIcon.displayName = \"CogIcon\";\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,UAAU,MAAM,WAAwC,CAAC,OAAO,QAC3E,oBAAC,UAAA,EAAS,KAAU,UAAU,UAAW,GAAG,OAAO,CACpD;AAED,QAAQ,cAAc;"}
|
|
@@ -35,6 +35,7 @@ const Select = React.forwardRef(
|
|
|
35
35
|
label,
|
|
36
36
|
helperText,
|
|
37
37
|
size = "48",
|
|
38
|
+
variant = "default",
|
|
38
39
|
error = false,
|
|
39
40
|
errorMessage,
|
|
40
41
|
placeholder,
|
|
@@ -52,6 +53,7 @@ const Select = React.forwardRef(
|
|
|
52
53
|
const triggerId = id ?? generatedId;
|
|
53
54
|
const helperTextId = `${triggerId}-helper`;
|
|
54
55
|
const bottomText = error && errorMessage ? errorMessage : helperText;
|
|
56
|
+
const isFilled = variant === "filled";
|
|
55
57
|
return /* @__PURE__ */ jsx(SelectContext.Provider, { value: { size, error, disabled }, children: /* @__PURE__ */ jsxs(
|
|
56
58
|
"div",
|
|
57
59
|
{
|
|
@@ -78,13 +80,14 @@ const Select = React.forwardRef(
|
|
|
78
80
|
"aria-describedby": bottomText ? helperTextId : void 0,
|
|
79
81
|
"aria-invalid": error || void 0,
|
|
80
82
|
className: cn(
|
|
81
|
-
"flex w-full cursor-pointer items-center
|
|
83
|
+
"flex w-full cursor-pointer items-center rounded-sm border outline-none focus-visible:shadow-focus-ring motion-safe:transition-colors",
|
|
82
84
|
TRIGGER_HEIGHT[size],
|
|
83
|
-
TRIGGER_PADDING_X[size],
|
|
85
|
+
isFilled ? "px-2" : TRIGGER_PADDING_X[size],
|
|
84
86
|
TRIGGER_GAP[size],
|
|
85
87
|
TRIGGER_TYPOGRAPHY[size],
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
isFilled ? "justify-center bg-background-secondary text-content-tertiary" : "justify-between bg-inputs-inputs-primary",
|
|
89
|
+
error ? "border-error-content" : isFilled ? "border-transparent" : "border-border-primary",
|
|
90
|
+
!disabled && !error && (isFilled ? "hover:bg-neutral-alphas-100 data-[state=open]:bg-neutral-alphas-100" : "hover:border-neutral-alphas-400 data-[state=open]:border-neutral-alphas-400"),
|
|
88
91
|
disabled && "cursor-not-allowed opacity-50"
|
|
89
92
|
),
|
|
90
93
|
children: [
|
|
@@ -97,9 +100,18 @@ const Select = React.forwardRef(
|
|
|
97
100
|
children: leftIcon
|
|
98
101
|
}
|
|
99
102
|
),
|
|
100
|
-
/* @__PURE__ */ jsx(
|
|
103
|
+
/* @__PURE__ */ jsx(
|
|
104
|
+
"span",
|
|
105
|
+
{
|
|
106
|
+
className: cn(
|
|
107
|
+
"min-w-0 flex-1 truncate [&>[data-placeholder]]:text-content-tertiary",
|
|
108
|
+
isFilled ? "text-center text-content-tertiary" : "text-left text-content-primary"
|
|
109
|
+
),
|
|
110
|
+
children: /* @__PURE__ */ jsx(SelectPrimitive.Value, { placeholder })
|
|
111
|
+
}
|
|
112
|
+
)
|
|
101
113
|
] }),
|
|
102
|
-
/* @__PURE__ */ jsx(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx(ChevronDownIcon, {}) })
|
|
114
|
+
/* @__PURE__ */ jsx(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx(ChevronDownIcon, { size: isFilled ? 16 : 24, className: "shrink-0" }) })
|
|
103
115
|
]
|
|
104
116
|
}
|
|
105
117
|
),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.mjs","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import * as SelectPrimitive from \"@radix-ui/react-select\";\nimport * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { FLOATING_CONTENT_COLLISION_PADDING } from \"@/utils/floatingContentCollisionPadding\";\nimport { CheckIcon } from \"../Icons/CheckIcon\";\nimport { ChevronDownIcon } from \"../Icons/ChevronDownIcon\";\n\n/** Select field height in pixels. */\nexport type SelectSize = \"48\" | \"40\" | \"32\";\n\ntype SelectContextValue = {\n size: SelectSize;\n error: boolean;\n disabled?: boolean;\n};\n\nconst SelectContext = React.createContext<SelectContextValue>({\n size: \"48\",\n error: false,\n});\n\nconst TRIGGER_HEIGHT: Record<SelectSize, string> = {\n \"48\": \"h-12\",\n \"40\": \"h-10\",\n \"32\": \"h-8\",\n};\n\nconst TRIGGER_PADDING_X: Record<SelectSize, string> = {\n \"48\": \"px-4\",\n \"40\": \"px-4\",\n \"32\": \"px-3\",\n};\n\nconst TRIGGER_GAP: Record<SelectSize, string> = {\n \"48\": \"gap-3\",\n \"40\": \"gap-3\",\n \"32\": \"gap-2\",\n};\n\nconst TRIGGER_TYPOGRAPHY: Record<SelectSize, string> = {\n \"48\": \"typography-body-default-16px-regular\",\n \"40\": \"typography-body-default-16px-regular\",\n \"32\": \"typography-body-small-14px-regular\",\n};\n\nexport interface SelectProps extends Omit<SelectPrimitive.SelectProps, \"dir\"> {\n /** Label text displayed above the trigger. Also used as the accessible name. */\n label?: string;\n /** Accessible name applied directly to the trigger button when no visible `label` is provided. */\n \"aria-label\"?: string;\n /** ID of an external element that labels the trigger button. */\n \"aria-labelledby\"?: string;\n /** Helper text displayed below the trigger. Replaced by `errorMessage` when `error` is `true`. */\n helperText?: string;\n /** Height of the select field in pixels. @default \"48\" */\n size?: SelectSize;\n /** Whether the field is in an error state. @default false */\n error?: boolean;\n /** Error message displayed below the trigger. Shown instead of `helperText` when `error` is `true`. */\n errorMessage?: string;\n /** Placeholder shown when no value is selected. */\n placeholder?: string;\n /** Icon element displayed at the left side of the trigger. */\n leftIcon?: React.ReactNode;\n /** Whether the field stretches to fill its container width. @default false */\n fullWidth?: boolean;\n /** Wraps the `className` of the outermost container div. */\n className?: string;\n /** HTML `id` applied to the trigger button. Auto-generated if omitted. */\n id?: string;\n}\n\n/**\n * A select field with optional label, helper/error text, and an icon slot,\n * built on Radix UI Select for full accessibility and keyboard navigation.\n *\n * Pair with {@link SelectContent} and {@link SelectItem} to provide options.\n *\n * @example\n * ```tsx\n * <Select label=\"Country\" placeholder=\"Select a country\">\n * <SelectContent>\n * <SelectItem value=\"us\">United States</SelectItem>\n * <SelectItem value=\"uk\">United Kingdom</SelectItem>\n * </SelectContent>\n * </Select>\n * ```\n */\nexport const Select = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Trigger>,\n SelectProps\n>(\n (\n {\n label,\n helperText,\n size = \"48\",\n error = false,\n errorMessage,\n placeholder,\n leftIcon,\n fullWidth = false,\n className,\n id,\n disabled,\n children,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n ...props\n },\n ref,\n ) => {\n const generatedId = React.useId();\n const triggerId = id ?? generatedId;\n const helperTextId = `${triggerId}-helper`;\n const bottomText = error && errorMessage ? errorMessage : helperText;\n\n return (\n <SelectContext.Provider value={{ size, error, disabled }}>\n <div\n className={cn(\"flex flex-col\", fullWidth && \"w-full\", className)}\n data-disabled={disabled ? \"\" : undefined}\n data-error={error ? \"\" : undefined}\n >\n {label && (\n <label\n htmlFor={triggerId}\n className=\"typography-description-12px-semibold pb-2 text-content-primary\"\n >\n {label}\n </label>\n )}\n\n <SelectPrimitive.Root disabled={disabled} {...props}>\n <SelectPrimitive.Trigger\n ref={ref}\n id={triggerId}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={bottomText ? helperTextId : undefined}\n aria-invalid={error || undefined}\n className={cn(\n \"flex w-full cursor-pointer items-center justify-between rounded-sm border bg-inputs-inputs-primary outline-none focus-visible:shadow-focus-ring motion-safe:transition-colors\",\n TRIGGER_HEIGHT[size],\n TRIGGER_PADDING_X[size],\n TRIGGER_GAP[size],\n TRIGGER_TYPOGRAPHY[size],\n error ? \"border-error-content\" : \"border-border-primary\",\n !disabled &&\n !error &&\n \"hover:border-neutral-alphas-400 data-[state=open]:border-neutral-alphas-400\",\n disabled && \"cursor-not-allowed opacity-50\",\n )}\n >\n <div className=\"flex min-w-0 items-center gap-2\">\n {leftIcon && (\n <span\n className=\"flex size-5 shrink-0 items-center justify-center text-content-secondary\"\n data-testid=\"left-icon\"\n >\n {leftIcon}\n </span>\n )}\n <span className=\"min-w-0 flex-1 truncate text-left text-content-primary [&>[data-placeholder]]:text-content-tertiary\">\n <SelectPrimitive.Value placeholder={placeholder} />\n </span>\n </div>\n\n <SelectPrimitive.Icon asChild>\n <ChevronDownIcon />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n\n {children}\n </SelectPrimitive.Root>\n\n {bottomText && (\n <p\n id={helperTextId}\n className={cn(\n \"typography-description-12px-regular px-2 pt-1 pb-0.5\",\n error ? \"text-error-content\" : \"text-content-secondary\",\n )}\n >\n {bottomText}\n </p>\n )}\n </div>\n </SelectContext.Provider>\n );\n },\n);\n\nSelect.displayName = \"Select\";\n\nexport interface SelectContentProps\n extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> {}\n\n/**\n * The dropdown panel rendered inside a portal. Place {@link SelectItem} elements\n * (and optionally {@link SelectGroup} / {@link SelectLabel}) as children.\n */\nexport const SelectContent = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Content>,\n SelectContentProps\n>(\n (\n {\n className,\n children,\n position = \"popper\",\n sideOffset = 4,\n collisionPadding = FLOATING_CONTENT_COLLISION_PADDING,\n style,\n ...props\n },\n ref,\n ) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\n position={position}\n sideOffset={sideOffset}\n collisionPadding={collisionPadding}\n style={{ zIndex: \"var(--fanvue-ui-portal-z-index, 50)\", ...style }}\n className={cn(\n \"relative w-max min-w-(--radix-select-trigger-width) max-w-(--radix-select-content-available-width) overflow-hidden rounded-sm border border-neutral-alphas-200 bg-background-primary text-content-primary shadow-[0_4px_16px_rgba(0,0,0,0.10)]\",\n \"data-[state=closed]:animate-out data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n \"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95\",\n \"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2\",\n className,\n )}\n {...props}\n >\n <SelectPrimitive.Viewport className=\"max-h-[var(--radix-select-content-available-height)] overflow-y-auto p-1\">\n {children}\n </SelectPrimitive.Viewport>\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n ),\n);\n\nSelectContent.displayName = \"SelectContent\";\n\n/** Dropdown row height in pixels, matching the V2 Menu Item spec. */\nexport type SelectItemSize = \"40\" | \"32\";\n\nconst ITEM_SIZE_CLASSES: Record<SelectItemSize, string> = {\n \"40\": \"min-h-10 py-2 typography-body-default-16px-regular\",\n \"32\": \"min-h-8 py-[7px] typography-body-small-14px-regular\",\n};\n\nconst ITEM_DESCRIPTION_TYPOGRAPHY: Record<SelectItemSize, string> = {\n \"40\": \"typography-body-small-14px-regular\",\n \"32\": \"typography-description-12px-regular\",\n};\n\nexport interface SelectItemProps\n extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item> {\n /** Row height. Defaults to the parent {@link Select} size (`48`/`40` → `40`, `32` → `32`). */\n size?: SelectItemSize;\n /** Icon (or other node) rendered before the label. Ignored when {@link SelectItemProps.avatar} is set. */\n leadingIcon?: React.ReactNode;\n /**\n * Leading avatar rendered in place of {@link SelectItemProps.leadingIcon}, for rows\n * representing a person or account. Pass an `Avatar` sized to `24`. Takes precedence over `leadingIcon`.\n */\n avatar?: React.ReactNode;\n /** Optional secondary text rendered on a second line below the label. */\n description?: React.ReactNode;\n}\n\n/**\n * Whether a `ReactNode` will actually render. Excludes `null`/`undefined` and\n * booleans so short-circuit props (e.g. `description={cond && \"…\"}`) don't flip\n * the item into a two-line/avatar layout when they resolve to `false`.\n */\nfunction isRenderableNode(node: React.ReactNode): boolean {\n return node !== null && node !== undefined && typeof node !== \"boolean\";\n}\n\n/**\n * An individual option inside {@link SelectContent}, following the V2 Menu Item spec.\n *\n * Supports a leading icon or avatar, an optional two-line layout via `description`,\n * and the standard hover / selected / disabled states. The selected row is marked\n * with a trailing check indicator.\n *\n * @example\n * ```tsx\n * <SelectItem value=\"jane\" avatar={<Avatar size={24} fallback=\"JD\" />} description=\"Product designer\">\n * Jane Doe\n * </SelectItem>\n * ```\n */\nexport const SelectItem = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Item>,\n SelectItemProps\n>(({ className, children, size, leadingIcon, avatar, description, ...props }, ref) => {\n const { size: triggerSize } = React.useContext(SelectContext);\n const itemSize: SelectItemSize = size ?? (triggerSize === \"32\" ? \"32\" : \"40\");\n const hasDescription = isRenderableNode(description);\n const hasAvatar = isRenderableNode(avatar);\n const hasLeadingIcon = isRenderableNode(leadingIcon);\n\n return (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"group relative flex w-full cursor-pointer select-none gap-2 rounded-xs px-3 text-content-primary outline-none\",\n hasDescription ? \"items-start\" : \"items-center\",\n ITEM_SIZE_CLASSES[itemSize],\n hasAvatar && !hasDescription && itemSize === \"32\" && \"py-1\",\n \"focus:bg-neutral-alphas-50 data-highlighted:bg-neutral-alphas-50\",\n \"data-disabled:pointer-events-none data-disabled:text-content-disabled\",\n className,\n )}\n {...props}\n >\n {hasAvatar ? (\n <span className=\"shrink-0\">{avatar}</span>\n ) : (\n hasLeadingIcon &&\n (hasDescription ? (\n <span className=\"flex shrink-0 items-center pt-0.5 [&>svg]:size-4\">{leadingIcon}</span>\n ) : (\n <span className=\"flex shrink-0 items-center [&>svg]:size-4\">{leadingIcon}</span>\n ))\n )}\n\n {hasDescription ? (\n <span className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <span className=\"truncate\">\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </span>\n <span\n className={cn(\n \"truncate text-content-secondary group-data-[disabled]:text-content-disabled\",\n ITEM_DESCRIPTION_TYPOGRAPHY[itemSize],\n )}\n >\n {description}\n </span>\n </span>\n ) : (\n <span className=\"min-w-0 flex-1 truncate\">\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </span>\n )}\n\n <SelectPrimitive.ItemIndicator\n className={cn(\n \"ml-auto flex size-4 shrink-0 items-center justify-center\",\n hasDescription && \"self-start\",\n )}\n >\n <CheckIcon className=\"size-4 text-content-primary group-data-[disabled]:text-content-disabled\" />\n </SelectPrimitive.ItemIndicator>\n </SelectPrimitive.Item>\n );\n});\n\nSelectItem.displayName = \"SelectItem\";\n\n/** Props for {@link SelectGroup}. */\nexport type SelectGroupProps = React.ComponentPropsWithoutRef<typeof SelectPrimitive.Group>;\n\n/**\n * Groups related {@link SelectItem} elements under a {@link SelectLabel}.\n */\nexport const SelectGroup = SelectPrimitive.Group;\nSelectGroup.displayName = \"SelectGroup\";\n\nexport interface SelectLabelProps\n extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label> {}\n\n/**\n * A non-interactive label shown above a {@link SelectGroup}.\n */\nexport const SelectLabel = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Label>,\n SelectLabelProps\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n className={cn(\n \"typography-description-12px-semibold px-3 py-1.5 text-content-secondary\",\n className,\n )}\n {...props}\n />\n));\n\nSelectLabel.displayName = \"SelectLabel\";\n\nexport interface SelectSeparatorProps\n extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator> {}\n\n/** A horizontal rule that visually separates groups in {@link SelectContent}. */\nexport const SelectSeparator = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Separator>,\n SelectSeparatorProps\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-neutral-alphas-200\", className)}\n {...props}\n />\n));\n\nSelectSeparator.displayName = \"SelectSeparator\";\n"],"names":[],"mappings":";;;;;;;;AAgBA,MAAM,gBAAgB,MAAM,cAAkC;AAAA,EAC5D,MAAM;AAAA,EACN,OAAO;AACT,CAAC;AAED,MAAM,iBAA6C;AAAA,EACjD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,oBAAgD;AAAA,EACpD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,cAA0C;AAAA,EAC9C,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,qBAAiD;AAAA,EACrD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AA6CO,MAAM,SAAS,MAAM;AAAA,EAI1B,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA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,UAAC,gBAAgB;AAAA,UAAhB;AAAA,YACC,WAAW;AAAA,cACT;AAAA,cACA,kBAAkB;AAAA,YAAA;AAAA,YAGpB,UAAA,oBAAC,WAAA,EAAU,WAAU,0EAAA,CAA0E;AAAA,UAAA;AAAA,QAAA;AAAA,MACjG;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;AAED,WAAW,cAAc;AAQlB,MAAM,cAAc,gBAAgB;AAC3C,YAAY,cAAc;AAQnB,MAAM,cAAc,MAAM,WAG/B,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAC1B;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,EAAA;AACN,CACD;AAED,YAAY,cAAc;AAMnB,MAAM,kBAAkB,MAAM,WAGnC,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAC1B;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAW,GAAG,yCAAyC,SAAS;AAAA,IAC/D,GAAG;AAAA,EAAA;AACN,CACD;AAED,gBAAgB,cAAc;"}
|
|
1
|
+
{"version":3,"file":"Select.mjs","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import * as SelectPrimitive from \"@radix-ui/react-select\";\nimport * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { FLOATING_CONTENT_COLLISION_PADDING } from \"@/utils/floatingContentCollisionPadding\";\nimport { CheckIcon } from \"../Icons/CheckIcon\";\nimport { ChevronDownIcon } from \"../Icons/ChevronDownIcon\";\n\n/** Select field height in pixels. */\nexport type SelectSize = \"48\" | \"40\" | \"32\";\n\n/**\n * Trigger surface. `\"default\"` is the bordered input field; `\"filled\"` is the\n * V2 Table Tab Actions pill: a `background-secondary` fill with no border and a\n * centred `content-tertiary` label, for filters that sit beside a table or chart.\n */\nexport type SelectVariant = \"default\" | \"filled\";\n\ntype SelectContextValue = {\n size: SelectSize;\n error: boolean;\n disabled?: boolean;\n};\n\nconst SelectContext = React.createContext<SelectContextValue>({\n size: \"48\",\n error: false,\n});\n\nconst TRIGGER_HEIGHT: Record<SelectSize, string> = {\n \"48\": \"h-12\",\n \"40\": \"h-10\",\n \"32\": \"h-8\",\n};\n\nconst TRIGGER_PADDING_X: Record<SelectSize, string> = {\n \"48\": \"px-4\",\n \"40\": \"px-4\",\n \"32\": \"px-3\",\n};\n\nconst TRIGGER_GAP: Record<SelectSize, string> = {\n \"48\": \"gap-3\",\n \"40\": \"gap-3\",\n \"32\": \"gap-2\",\n};\n\nconst TRIGGER_TYPOGRAPHY: Record<SelectSize, string> = {\n \"48\": \"typography-body-default-16px-regular\",\n \"40\": \"typography-body-default-16px-regular\",\n \"32\": \"typography-body-small-14px-regular\",\n};\n\nexport interface SelectProps extends Omit<SelectPrimitive.SelectProps, \"dir\"> {\n /** Label text displayed above the trigger. Also used as the accessible name. */\n label?: string;\n /** Accessible name applied directly to the trigger button when no visible `label` is provided. */\n \"aria-label\"?: string;\n /** ID of an external element that labels the trigger button. */\n \"aria-labelledby\"?: string;\n /** Helper text displayed below the trigger. Replaced by `errorMessage` when `error` is `true`. */\n helperText?: string;\n /** Height of the select field in pixels. @default \"48\" */\n size?: SelectSize;\n /** Trigger surface. See {@link SelectVariant}. @default \"default\" */\n variant?: SelectVariant;\n /** Whether the field is in an error state. @default false */\n error?: boolean;\n /** Error message displayed below the trigger. Shown instead of `helperText` when `error` is `true`. */\n errorMessage?: string;\n /** Placeholder shown when no value is selected. */\n placeholder?: string;\n /** Icon element displayed at the left side of the trigger. */\n leftIcon?: React.ReactNode;\n /** Whether the field stretches to fill its container width. @default false */\n fullWidth?: boolean;\n /** Wraps the `className` of the outermost container div. */\n className?: string;\n /** HTML `id` applied to the trigger button. Auto-generated if omitted. */\n id?: string;\n}\n\n/**\n * A select field with optional label, helper/error text, and an icon slot,\n * built on Radix UI Select for full accessibility and keyboard navigation.\n *\n * Pair with {@link SelectContent} and {@link SelectItem} to provide options.\n *\n * @example\n * ```tsx\n * <Select label=\"Country\" placeholder=\"Select a country\">\n * <SelectContent>\n * <SelectItem value=\"us\">United States</SelectItem>\n * <SelectItem value=\"uk\">United Kingdom</SelectItem>\n * </SelectContent>\n * </Select>\n * ```\n */\nexport const Select = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Trigger>,\n SelectProps\n>(\n (\n {\n label,\n helperText,\n size = \"48\",\n variant = \"default\",\n error = false,\n errorMessage,\n placeholder,\n leftIcon,\n fullWidth = false,\n className,\n id,\n disabled,\n children,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n ...props\n },\n ref,\n ) => {\n const generatedId = React.useId();\n const triggerId = id ?? generatedId;\n const helperTextId = `${triggerId}-helper`;\n const bottomText = error && errorMessage ? errorMessage : helperText;\n const isFilled = variant === \"filled\";\n\n return (\n <SelectContext.Provider value={{ size, error, disabled }}>\n <div\n className={cn(\"flex flex-col\", fullWidth && \"w-full\", className)}\n data-disabled={disabled ? \"\" : undefined}\n data-error={error ? \"\" : undefined}\n >\n {label && (\n <label\n htmlFor={triggerId}\n className=\"typography-description-12px-semibold pb-2 text-content-primary\"\n >\n {label}\n </label>\n )}\n\n <SelectPrimitive.Root disabled={disabled} {...props}>\n <SelectPrimitive.Trigger\n ref={ref}\n id={triggerId}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={bottomText ? helperTextId : undefined}\n aria-invalid={error || undefined}\n className={cn(\n \"flex w-full cursor-pointer items-center rounded-sm border outline-none focus-visible:shadow-focus-ring motion-safe:transition-colors\",\n TRIGGER_HEIGHT[size],\n isFilled ? \"px-2\" : TRIGGER_PADDING_X[size],\n TRIGGER_GAP[size],\n TRIGGER_TYPOGRAPHY[size],\n isFilled\n ? \"justify-center bg-background-secondary text-content-tertiary\"\n : \"justify-between bg-inputs-inputs-primary\",\n error\n ? \"border-error-content\"\n : isFilled\n ? \"border-transparent\"\n : \"border-border-primary\",\n !disabled &&\n !error &&\n (isFilled\n ? \"hover:bg-neutral-alphas-100 data-[state=open]:bg-neutral-alphas-100\"\n : \"hover:border-neutral-alphas-400 data-[state=open]:border-neutral-alphas-400\"),\n disabled && \"cursor-not-allowed opacity-50\",\n )}\n >\n <div className=\"flex min-w-0 items-center gap-2\">\n {leftIcon && (\n <span\n className=\"flex size-5 shrink-0 items-center justify-center text-content-secondary\"\n data-testid=\"left-icon\"\n >\n {leftIcon}\n </span>\n )}\n <span\n className={cn(\n \"min-w-0 flex-1 truncate [&>[data-placeholder]]:text-content-tertiary\",\n isFilled\n ? \"text-center text-content-tertiary\"\n : \"text-left text-content-primary\",\n )}\n >\n <SelectPrimitive.Value placeholder={placeholder} />\n </span>\n </div>\n\n <SelectPrimitive.Icon asChild>\n <ChevronDownIcon size={isFilled ? 16 : 24} className=\"shrink-0\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n\n {children}\n </SelectPrimitive.Root>\n\n {bottomText && (\n <p\n id={helperTextId}\n className={cn(\n \"typography-description-12px-regular px-2 pt-1 pb-0.5\",\n error ? \"text-error-content\" : \"text-content-secondary\",\n )}\n >\n {bottomText}\n </p>\n )}\n </div>\n </SelectContext.Provider>\n );\n },\n);\n\nSelect.displayName = \"Select\";\n\nexport interface SelectContentProps\n extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> {}\n\n/**\n * The dropdown panel rendered inside a portal. Place {@link SelectItem} elements\n * (and optionally {@link SelectGroup} / {@link SelectLabel}) as children.\n */\nexport const SelectContent = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Content>,\n SelectContentProps\n>(\n (\n {\n className,\n children,\n position = \"popper\",\n sideOffset = 4,\n collisionPadding = FLOATING_CONTENT_COLLISION_PADDING,\n style,\n ...props\n },\n ref,\n ) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\n position={position}\n sideOffset={sideOffset}\n collisionPadding={collisionPadding}\n style={{ zIndex: \"var(--fanvue-ui-portal-z-index, 50)\", ...style }}\n className={cn(\n \"relative w-max min-w-(--radix-select-trigger-width) max-w-(--radix-select-content-available-width) overflow-hidden rounded-sm border border-neutral-alphas-200 bg-background-primary text-content-primary shadow-[0_4px_16px_rgba(0,0,0,0.10)]\",\n \"data-[state=closed]:animate-out data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n \"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95\",\n \"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2\",\n className,\n )}\n {...props}\n >\n <SelectPrimitive.Viewport className=\"max-h-[var(--radix-select-content-available-height)] overflow-y-auto p-1\">\n {children}\n </SelectPrimitive.Viewport>\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n ),\n);\n\nSelectContent.displayName = \"SelectContent\";\n\n/** Dropdown row height in pixels, matching the V2 Menu Item spec. */\nexport type SelectItemSize = \"40\" | \"32\";\n\nconst ITEM_SIZE_CLASSES: Record<SelectItemSize, string> = {\n \"40\": \"min-h-10 py-2 typography-body-default-16px-regular\",\n \"32\": \"min-h-8 py-[7px] typography-body-small-14px-regular\",\n};\n\nconst ITEM_DESCRIPTION_TYPOGRAPHY: Record<SelectItemSize, string> = {\n \"40\": \"typography-body-small-14px-regular\",\n \"32\": \"typography-description-12px-regular\",\n};\n\nexport interface SelectItemProps\n extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item> {\n /** Row height. Defaults to the parent {@link Select} size (`48`/`40` → `40`, `32` → `32`). */\n size?: SelectItemSize;\n /** Icon (or other node) rendered before the label. Ignored when {@link SelectItemProps.avatar} is set. */\n leadingIcon?: React.ReactNode;\n /**\n * Leading avatar rendered in place of {@link SelectItemProps.leadingIcon}, for rows\n * representing a person or account. Pass an `Avatar` sized to `24`. Takes precedence over `leadingIcon`.\n */\n avatar?: React.ReactNode;\n /** Optional secondary text rendered on a second line below the label. */\n description?: React.ReactNode;\n}\n\n/**\n * Whether a `ReactNode` will actually render. Excludes `null`/`undefined` and\n * booleans so short-circuit props (e.g. `description={cond && \"…\"}`) don't flip\n * the item into a two-line/avatar layout when they resolve to `false`.\n */\nfunction isRenderableNode(node: React.ReactNode): boolean {\n return node !== null && node !== undefined && typeof node !== \"boolean\";\n}\n\n/**\n * An individual option inside {@link SelectContent}, following the V2 Menu Item spec.\n *\n * Supports a leading icon or avatar, an optional two-line layout via `description`,\n * and the standard hover / selected / disabled states. The selected row is marked\n * with a trailing check indicator.\n *\n * @example\n * ```tsx\n * <SelectItem value=\"jane\" avatar={<Avatar size={24} fallback=\"JD\" />} description=\"Product designer\">\n * Jane Doe\n * </SelectItem>\n * ```\n */\nexport const SelectItem = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Item>,\n SelectItemProps\n>(({ className, children, size, leadingIcon, avatar, description, ...props }, ref) => {\n const { size: triggerSize } = React.useContext(SelectContext);\n const itemSize: SelectItemSize = size ?? (triggerSize === \"32\" ? \"32\" : \"40\");\n const hasDescription = isRenderableNode(description);\n const hasAvatar = isRenderableNode(avatar);\n const hasLeadingIcon = isRenderableNode(leadingIcon);\n\n return (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"group relative flex w-full cursor-pointer select-none gap-2 rounded-xs px-3 text-content-primary outline-none\",\n hasDescription ? \"items-start\" : \"items-center\",\n ITEM_SIZE_CLASSES[itemSize],\n hasAvatar && !hasDescription && itemSize === \"32\" && \"py-1\",\n \"focus:bg-neutral-alphas-50 data-highlighted:bg-neutral-alphas-50\",\n \"data-disabled:pointer-events-none data-disabled:text-content-disabled\",\n className,\n )}\n {...props}\n >\n {hasAvatar ? (\n <span className=\"shrink-0\">{avatar}</span>\n ) : (\n hasLeadingIcon &&\n (hasDescription ? (\n <span className=\"flex shrink-0 items-center pt-0.5 [&>svg]:size-4\">{leadingIcon}</span>\n ) : (\n <span className=\"flex shrink-0 items-center [&>svg]:size-4\">{leadingIcon}</span>\n ))\n )}\n\n {hasDescription ? (\n <span className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <span className=\"truncate\">\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </span>\n <span\n className={cn(\n \"truncate text-content-secondary group-data-[disabled]:text-content-disabled\",\n ITEM_DESCRIPTION_TYPOGRAPHY[itemSize],\n )}\n >\n {description}\n </span>\n </span>\n ) : (\n <span className=\"min-w-0 flex-1 truncate\">\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </span>\n )}\n\n <SelectPrimitive.ItemIndicator\n className={cn(\n \"ml-auto flex size-4 shrink-0 items-center justify-center\",\n hasDescription && \"self-start\",\n )}\n >\n <CheckIcon className=\"size-4 text-content-primary group-data-[disabled]:text-content-disabled\" />\n </SelectPrimitive.ItemIndicator>\n </SelectPrimitive.Item>\n );\n});\n\nSelectItem.displayName = \"SelectItem\";\n\n/** Props for {@link SelectGroup}. */\nexport type SelectGroupProps = React.ComponentPropsWithoutRef<typeof SelectPrimitive.Group>;\n\n/**\n * Groups related {@link SelectItem} elements under a {@link SelectLabel}.\n */\nexport const SelectGroup = SelectPrimitive.Group;\nSelectGroup.displayName = \"SelectGroup\";\n\nexport interface SelectLabelProps\n extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label> {}\n\n/**\n * A non-interactive label shown above a {@link SelectGroup}.\n */\nexport const SelectLabel = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Label>,\n SelectLabelProps\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n className={cn(\n \"typography-description-12px-semibold px-3 py-1.5 text-content-secondary\",\n className,\n )}\n {...props}\n />\n));\n\nSelectLabel.displayName = \"SelectLabel\";\n\nexport interface SelectSeparatorProps\n extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator> {}\n\n/** A horizontal rule that visually separates groups in {@link SelectContent}. */\nexport const SelectSeparator = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Separator>,\n SelectSeparatorProps\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-neutral-alphas-200\", className)}\n {...props}\n />\n));\n\nSelectSeparator.displayName = \"SelectSeparator\";\n"],"names":[],"mappings":";;;;;;;;AAuBA,MAAM,gBAAgB,MAAM,cAAkC;AAAA,EAC5D,MAAM;AAAA,EACN,OAAO;AACT,CAAC;AAED,MAAM,iBAA6C;AAAA,EACjD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,oBAAgD;AAAA,EACpD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,cAA0C;AAAA,EAC9C,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,qBAAiD;AAAA,EACrD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AA+CO,MAAM,SAAS,MAAM;AAAA,EAI1B,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,UAAU;AAAA,IACV,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd,mBAAmB;AAAA,IACnB,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,cAAc,MAAM,MAAA;AAC1B,UAAM,YAAY,MAAM;AACxB,UAAM,eAAe,GAAG,SAAS;AACjC,UAAM,aAAa,SAAS,eAAe,eAAe;AAC1D,UAAM,WAAW,YAAY;AAE7B,WACE,oBAAC,cAAc,UAAd,EAAuB,OAAO,EAAE,MAAM,OAAO,YAC5C,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW,GAAG,iBAAiB,aAAa,UAAU,SAAS;AAAA,QAC/D,iBAAe,WAAW,KAAK;AAAA,QAC/B,cAAY,QAAQ,KAAK;AAAA,QAExB,UAAA;AAAA,UA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AQlB,MAAM,cAAc,gBAAgB;AAC3C,YAAY,cAAc;AAQnB,MAAM,cAAc,MAAM,WAG/B,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAC1B;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,EAAA;AACN,CACD;AAED,YAAY,cAAc;AAMnB,MAAM,kBAAkB,MAAM,WAGnC,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAC1B;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAW,GAAG,yCAAyC,SAAS;AAAA,IAC/D,GAAG;AAAA,EAAA;AACN,CACD;AAED,gBAAgB,cAAc;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5355,6 +5355,8 @@ export declare interface SelectProps extends Omit<SelectPrimitive.SelectProps, "
|
|
|
5355
5355
|
helperText?: string;
|
|
5356
5356
|
/** Height of the select field in pixels. @default "48" */
|
|
5357
5357
|
size?: SelectSize;
|
|
5358
|
+
/** Trigger surface. See {@link SelectVariant}. @default "default" */
|
|
5359
|
+
variant?: SelectVariant;
|
|
5358
5360
|
/** Whether the field is in an error state. @default false */
|
|
5359
5361
|
error?: boolean;
|
|
5360
5362
|
/** Error message displayed below the trigger. Shown instead of `helperText` when `error` is `true`. */
|
|
@@ -5380,6 +5382,13 @@ export declare interface SelectSeparatorProps extends React_2.ComponentPropsWith
|
|
|
5380
5382
|
/** Select field height in pixels. */
|
|
5381
5383
|
export declare type SelectSize = "48" | "40" | "32";
|
|
5382
5384
|
|
|
5385
|
+
/**
|
|
5386
|
+
* Trigger surface. `"default"` is the bordered input field; `"filled"` is the
|
|
5387
|
+
* V2 Table Tab Actions pill: a `background-secondary` fill with no border and a
|
|
5388
|
+
* centred `content-tertiary` label, for filters that sit beside a table or chart.
|
|
5389
|
+
*/
|
|
5390
|
+
export declare type SelectVariant = "default" | "filled";
|
|
5391
|
+
|
|
5383
5392
|
/**
|
|
5384
5393
|
* Send icon. Renders at sizes 16, 24, or 32 px with outlined and filled variants.
|
|
5385
5394
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fanvue/ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.35.0",
|
|
4
4
|
"description": "React component library built with Tailwind CSS for Fanvue ecosystem",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org",
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
"size-limit": "12.0.0",
|
|
183
183
|
"storybook": "10.2.13",
|
|
184
184
|
"style-dictionary": "4.2.0",
|
|
185
|
-
"svgo": "4.0
|
|
185
|
+
"svgo": "4.1.0",
|
|
186
186
|
"tailwindcss": "4.1.18",
|
|
187
187
|
"typescript": "5.9.3",
|
|
188
188
|
"vite": "7.3.5",
|
|
@@ -208,7 +208,7 @@
|
|
|
208
208
|
"qs": ">=6.15.2",
|
|
209
209
|
"esbuild": ">=0.28.1",
|
|
210
210
|
"vite": "^7.3.5",
|
|
211
|
-
"js-yaml": "^4.3.
|
|
211
|
+
"js-yaml": "^4.3.2",
|
|
212
212
|
"@babel/core": ">=7.29.6"
|
|
213
213
|
}
|
|
214
214
|
},
|