@fanvue/ui 3.29.0 → 3.31.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.
Files changed (32) hide show
  1. package/dist/cjs/components/AiButton/AiButton.cjs +8 -6
  2. package/dist/cjs/components/AiButton/AiButton.cjs.map +1 -1
  3. package/dist/cjs/components/Button/Button.cjs +1 -1
  4. package/dist/cjs/components/Button/Button.cjs.map +1 -1
  5. package/dist/cjs/components/ChatMessage/ChatMessage.cjs +1 -1
  6. package/dist/cjs/components/ChatMessage/ChatMessage.cjs.map +1 -1
  7. package/dist/cjs/components/DatePicker/DatePicker.cjs +1 -1
  8. package/dist/cjs/components/DatePicker/DatePicker.cjs.map +1 -1
  9. package/dist/cjs/components/SegmentedControl/SegmentedControl.cjs +21 -6
  10. package/dist/cjs/components/SegmentedControl/SegmentedControl.cjs.map +1 -1
  11. package/dist/cjs/components/SwitchButton/SwitchButton.cjs +97 -0
  12. package/dist/cjs/components/SwitchButton/SwitchButton.cjs.map +1 -0
  13. package/dist/cjs/index.cjs +2 -0
  14. package/dist/cjs/index.cjs.map +1 -1
  15. package/dist/components/AiButton/AiButton.mjs +8 -6
  16. package/dist/components/AiButton/AiButton.mjs.map +1 -1
  17. package/dist/components/Button/Button.mjs +1 -1
  18. package/dist/components/Button/Button.mjs.map +1 -1
  19. package/dist/components/ChatMessage/ChatMessage.mjs +1 -1
  20. package/dist/components/ChatMessage/ChatMessage.mjs.map +1 -1
  21. package/dist/components/DatePicker/DatePicker.mjs +1 -1
  22. package/dist/components/DatePicker/DatePicker.mjs.map +1 -1
  23. package/dist/components/SegmentedControl/SegmentedControl.mjs +21 -6
  24. package/dist/components/SegmentedControl/SegmentedControl.mjs.map +1 -1
  25. package/dist/components/SwitchButton/SwitchButton.mjs +80 -0
  26. package/dist/components/SwitchButton/SwitchButton.mjs.map +1 -0
  27. package/dist/index.d.ts +121 -6
  28. package/dist/index.mjs +2 -0
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/styles/base.css +42 -0
  31. package/dist/styles/theme.css +283 -64
  32. package/package.json +4 -1
package/dist/index.d.ts CHANGED
@@ -153,6 +153,10 @@ export declare type AI2IconProps = BaseIconProps;
153
153
  * Honours `prefers-reduced-motion`: the shimmer and flicker are dropped and the
154
154
  * label renders in its settled state.
155
155
  *
156
+ * Set `idleShimmer={false}` when several `AiButton`s sit side by side, so an
157
+ * idle one sits still and the shimmer reads as "this one is genuinely busy"
158
+ * rather than "any of these could be clicked".
159
+ *
156
160
  * @example
157
161
  * ```tsx
158
162
  * <AiButton label="Analyse" activeLabel="Analysing" active={isPending} onClick={run} />
@@ -168,6 +172,12 @@ export declare interface AiButtonProps extends Omit<React_2.ButtonHTMLAttributes
168
172
  activeLabel?: string;
169
173
  /** Swap to {@link activeLabel} and keep the shimmer running. @default false */
170
174
  active?: boolean;
175
+ /**
176
+ * Shimmer and flicker while enabled and idle, inviting a click. Turn off when
177
+ * several `AiButton`s sit side by side, so an idle one sits still and only the
178
+ * `active` one reads as busy. @default true
179
+ */
180
+ idleShimmer?: boolean;
171
181
  /** @default "32" */
172
182
  size?: AiButtonSize;
173
183
  /** Replace the leading AI glyph. */
@@ -4945,13 +4955,13 @@ export declare type SearchIconProps = BaseIconProps;
4945
4955
  * />
4946
4956
  * ```
4947
4957
  *
4948
- * @example Icon + label with the brand-green pill (e.g. the Home/Agent nav switch)
4958
+ * @example Icon + label, with the AI treatment on the Agent segment (the Home/Agent nav switch)
4949
4959
  * ```tsx
4950
4960
  * <SegmentedControl
4951
4961
  * appearance="brand"
4952
4962
  * options={[
4953
4963
  * { label: "Home", value: "home", icon: <HomeIcon size={16} /> },
4954
- * { label: "Agent", value: "agent", icon: <AIIcon size={16} /> },
4964
+ * { label: "Agent", value: "agent", icon: <AIIcon size={16} />, ai: true },
4955
4965
  * ]}
4956
4966
  * value={mode}
4957
4967
  * onChange={setMode}
@@ -4982,7 +4992,7 @@ export declare type SearchIconProps = BaseIconProps;
4982
4992
  * collapsedIcon={<RepeatIcon size={16} />}
4983
4993
  * options={[
4984
4994
  * { label: "Home", value: "home", icon: <HomeIcon size={16} /> },
4985
- * { label: "Agent", value: "agent", icon: <AIIcon size={16} filled /> },
4995
+ * { label: "Agent", value: "agent", icon: <AIIcon size={16} filled />, ai: true },
4986
4996
  * ]}
4987
4997
  * value={mode}
4988
4998
  * onChange={setMode}
@@ -4997,9 +5007,10 @@ export declare const SegmentedControl: React_2.ForwardRefExoticComponent<Segment
4997
5007
  * - `"pill"`: the container has a muted background and the selected segment shows a filled pill (default).
4998
5008
  * - `"plain"`: no container or selected-pill background; segments are bare content and selection is
4999
5009
  * communicated by color alone. Designed for icon-only toggles (e.g. a list/grid view switch).
5000
- * - `"brand"`: like `"pill"`, but segments render their `icon` alongside the visible `label` and the
5001
- * selected segment uses the brand-green pill. Designed for prominent toggles such as the
5002
- * Home/Agent navigation switch.
5010
+ * - `"brand"`: like `"pill"`, but segments render their `icon` alongside the visible `label`.
5011
+ * A selected segment takes the neutral selected pill, except the one marked `ai`, which takes the
5012
+ * AI fill and gradient stroke. Designed for prominent toggles such as the Home/Agent navigation
5013
+ * switch.
5003
5014
  */
5004
5015
  export declare type SegmentedControlAppearance = "pill" | "plain" | "brand";
5005
5016
 
@@ -5022,6 +5033,18 @@ export declare interface SegmentedControlOption {
5022
5033
  * otherwise shows the selected option's icon alone.
5023
5034
  */
5024
5035
  icon?: React_2.ReactNode;
5036
+ /**
5037
+ * Marks this segment as the AI one, so that when it is selected it takes the AI treatment — the
5038
+ * translucent `Buttons/AI/Default` fill and the `Buttons/AI` gradient stroke — instead of the
5039
+ * neutral selected pill every other segment gets.
5040
+ *
5041
+ * Set it on the Agent side of a Manage/Agent switch. Without it the AI treatment would follow
5042
+ * whichever segment happened to be selected, putting a brand stroke on segments that should not
5043
+ * carry one. Only meaningful in the `brand` appearance, and only while the control is expanded —
5044
+ * collapsed, the toggle stays the neutral switch affordance whichever option is selected.
5045
+ * @default false
5046
+ */
5047
+ ai?: boolean;
5025
5048
  }
5026
5049
 
5027
5050
  export declare interface SegmentedControlProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, "onChange"> {
@@ -5561,6 +5584,98 @@ export declare type SupportIconProps = BaseIconProps;
5561
5584
  */
5562
5585
  export declare const Switch: React_2.ForwardRefExoticComponent<SwitchProps & React_2.RefAttributes<HTMLButtonElement>>;
5563
5586
 
5587
+ /**
5588
+ * A labelled pill that switches one feature or mode on and off, for settings
5589
+ * panels, filter bars and tool options. Unlike {@link Switch} it names the thing
5590
+ * it controls, which suits contexts where the action needs spelling out.
5591
+ *
5592
+ * Rendered as a `<button>` carrying `aria-pressed` — the ARIA toggle-button
5593
+ * pattern — so it flips on click and on Enter or Space, and exposes
5594
+ * `data-state="on" | "off"` for styling. Supports controlled (`pressed`) and
5595
+ * uncontrolled (`defaultPressed`) usage. The visible `label` is the accessible
5596
+ * name, so no `aria-label` is needed.
5597
+ *
5598
+ * For two or three mutually exclusive options, reach for {@link SegmentedControl}
5599
+ * instead: this button is independently on or off, not a choice between options.
5600
+ *
5601
+ * @example
5602
+ * ```tsx
5603
+ * <SwitchButton label="Hide sold out" pressed={hidden} onPressedChange={setHidden} />
5604
+ * ```
5605
+ *
5606
+ * @example Independent icon flags, available on the default variant only
5607
+ * ```tsx
5608
+ * <SwitchButton size="40" label="Add filter" showLeftIcon showRightIcon />
5609
+ * ```
5610
+ *
5611
+ * @example The AI variant, whose sparkle is fixed
5612
+ * ```tsx
5613
+ * <SwitchButton variant="ai" label="Smart replies" defaultPressed />
5614
+ * ```
5615
+ */
5616
+ export declare const SwitchButton: React_2.ForwardRefExoticComponent<SwitchButtonProps & React_2.RefAttributes<HTMLButtonElement>>;
5617
+
5618
+ /**
5619
+ * Props for the `"ai"` variant. Its leading sparkle is fixed and it has no
5620
+ * trailing slot, so neither icon prop is available here.
5621
+ */
5622
+ export declare interface SwitchButtonAiProps extends SwitchButtonBaseProps {
5623
+ /** Visual treatment. */
5624
+ variant: "ai";
5625
+ /** Unavailable on `"ai"` — the leading sparkle is always shown and cannot be swapped. */
5626
+ showLeftIcon?: never;
5627
+ /** Unavailable on `"ai"` — this variant has no trailing icon slot. */
5628
+ showRightIcon?: never;
5629
+ /** Unavailable on `"ai"` — the leading sparkle is fixed. */
5630
+ leftIcon?: never;
5631
+ /** Unavailable on `"ai"` — this variant has no trailing icon slot. */
5632
+ rightIcon?: never;
5633
+ }
5634
+
5635
+ declare interface SwitchButtonBaseProps extends Omit<React_2.ButtonHTMLAttributes<HTMLButtonElement>, "type" | "children"> {
5636
+ /** Visible text label, which is also the accessible name. */
5637
+ label: string;
5638
+ /** Height of the button in pixels. @default "32" */
5639
+ size?: SwitchButtonSize;
5640
+ /** On/off state for controlled usage. Pair with `onPressedChange`. */
5641
+ pressed?: boolean;
5642
+ /** Initial on/off state for uncontrolled usage. @default false */
5643
+ defaultPressed?: boolean;
5644
+ /** Fired with the next state each time the button flips. */
5645
+ onPressedChange?: (pressed: boolean) => void;
5646
+ /** Native button behaviour. @default "button" */
5647
+ type?: "button" | "submit" | "reset";
5648
+ }
5649
+
5650
+ /**
5651
+ * Props for the `"default"` variant, the only one with icon slots. The two are
5652
+ * independent: pass either, neither, or both.
5653
+ */
5654
+ export declare interface SwitchButtonDefaultProps extends SwitchButtonBaseProps {
5655
+ /** Visual treatment. @default "default" */
5656
+ variant?: "default";
5657
+ /** Show an icon before the label. @default false */
5658
+ showLeftIcon?: boolean;
5659
+ /** Show an icon after the label. @default false */
5660
+ showRightIcon?: boolean;
5661
+ /** Icon rendered before the label when `showLeftIcon` is set. @default `<AddIcon size={16} />` */
5662
+ leftIcon?: React_2.ReactNode;
5663
+ /** Icon rendered after the label when `showRightIcon` is set. @default `<AddIcon size={16} />` */
5664
+ rightIcon?: React_2.ReactNode;
5665
+ }
5666
+
5667
+ /**
5668
+ * Props for {@link SwitchButton}. A discriminated union on `variant`, so the icon
5669
+ * slots only type-check on the `"default"` variant.
5670
+ */
5671
+ export declare type SwitchButtonProps = SwitchButtonDefaultProps | SwitchButtonAiProps;
5672
+
5673
+ /** Height of the button in pixels. Matches {@link Button}'s scale. */
5674
+ export declare type SwitchButtonSize = "24" | "32" | "40";
5675
+
5676
+ /** Visual treatment of the button. */
5677
+ export declare type SwitchButtonVariant = "default" | "ai";
5678
+
5564
5679
  /**
5565
5680
  * A labelled switch field with optional helper text and info tooltip. Composes
5566
5681
  * the {@link Switch} component with a `<label>` and description.
package/dist/index.mjs CHANGED
@@ -247,6 +247,7 @@ import { Stepper } from "./components/Stepper/Stepper.mjs";
247
247
  import { StepperStep } from "./components/Stepper/StepperStep.mjs";
248
248
  import { SubscribeButton } from "./components/SubscribeButton/SubscribeButton.mjs";
249
249
  import { Switch } from "./components/Switch/Switch.mjs";
250
+ import { SwitchButton } from "./components/SwitchButton/SwitchButton.mjs";
250
251
  import { SwitchField } from "./components/SwitchField/SwitchField.mjs";
251
252
  import { SwitchToggle } from "./components/SwitchToggle/SwitchToggle.mjs";
252
253
  import { Table, TableBody, TableCard, TableCell, TableCellContent, TableCellGroup, TableFooter, TableHead, TableHeader, TableLineClamp, TableMediaThumbnail, TablePillProgressLayout, TableProgressTrack, TableRow, TableRowsPerPageSelect, TableScrollArea, TableSortLabel, TableStackedText, TableStatusDot, TableToolbar } from "./components/Table/Table.mjs";
@@ -533,6 +534,7 @@ export {
533
534
  Support2Icon,
534
535
  SupportIcon,
535
536
  Switch,
537
+ SwitchButton,
536
538
  SwitchField,
537
539
  SwitchToggle,
538
540
  Table,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -155,6 +155,48 @@
155
155
  initial-value: 50%;
156
156
  }
157
157
 
158
+ /*
159
+ * AI treatment for a single segment of a `brand` SegmentedControl — the Agent
160
+ * side of the Manage/Agent navigation switch.
161
+ *
162
+ * Draws the `Buttons/AI/Stroke-Start` -> `Stroke-End` gradient stroke as a masked
163
+ * 1px ring on `::before`. A real `border` would reflow the segment, and Tailwind's
164
+ * `ring-*` utilities cannot hold a gradient. `z-index: -1` against
165
+ * `isolation: isolate` keeps the ring above the segment's own fill and below its
166
+ * icon and label. Both stops are tokens, so light and dark follow the theme
167
+ * without a second rule.
168
+ *
169
+ * The fill is left to a `bg-*` utility on the element so it stays visible to
170
+ * tailwind-merge and can be overridden per consumer.
171
+ */
172
+ @utility fv-ai-stroke {
173
+ position: relative;
174
+ isolation: isolate;
175
+
176
+ &::before {
177
+ content: "";
178
+ position: absolute;
179
+ inset: 0;
180
+ z-index: -1;
181
+ border-radius: inherit;
182
+ padding: 1px;
183
+ pointer-events: none;
184
+ background: linear-gradient(
185
+ 250.3deg,
186
+ var(--color-buttons-ai-stroke-start) -9%,
187
+ var(--color-buttons-ai-stroke-end) 110%
188
+ );
189
+ -webkit-mask:
190
+ linear-gradient(#000 0 0) content-box,
191
+ linear-gradient(#000 0 0);
192
+ -webkit-mask-composite: xor;
193
+ mask:
194
+ linear-gradient(#000 0 0) content-box,
195
+ linear-gradient(#000 0 0);
196
+ mask-composite: exclude;
197
+ }
198
+ }
199
+
158
200
  /*
159
201
  * AiButton surface. The lit rim and the sheen are pseudo-elements rather than
160
202
  * box-shadows on the button so they can be masked and brightened independently