@aircall/blocks 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Badge, Button, CounterBadge, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, SidebarProvider, TabsList, useSidebar } from "@aircall/ds";
2
2
  import * as React$1 from "react";
3
- import * as react_jsx_runtime4 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
  import { VariantProps } from "class-variance-authority";
5
5
  import * as _tanstack_react_form0 from "@tanstack/react-form";
6
6
  import { DeepKeys, DeepKeysOfType, DeepValue, FieldAsyncValidateOrFn, FieldListeners, FieldValidateOrFn, FieldValidators } from "@tanstack/react-form";
@@ -119,7 +119,7 @@ declare function ChatbotResponseBlock({
119
119
  sources,
120
120
  onFeedback,
121
121
  className
122
- }: ChatbotResponseBlockProps): react_jsx_runtime4.JSX.Element;
122
+ }: ChatbotResponseBlockProps): react_jsx_runtime0.JSX.Element;
123
123
  //#endregion
124
124
  //#region src/components/chatbot-response-loading.d.ts
125
125
  interface ChatbotResponseLoadingProps {
@@ -146,7 +146,7 @@ interface ChatbotResponseLoadingProps {
146
146
  declare function ChatbotResponseLoading({
147
147
  text,
148
148
  className
149
- }: ChatbotResponseLoadingProps): react_jsx_runtime4.JSX.Element;
149
+ }: ChatbotResponseLoadingProps): react_jsx_runtime0.JSX.Element;
150
150
  //#endregion
151
151
  //#region src/components/chatbot-page.d.ts
152
152
  declare const ChatbotPage: React$1.ForwardRefExoticComponent<ChatbotPageProps & React$1.RefAttributes<HTMLDivElement>>;
@@ -322,7 +322,7 @@ declare function ChatbotPanelHeader({
322
322
  onClose,
323
323
  className,
324
324
  ...props
325
- }: ChatbotPanelHeaderProps): react_jsx_runtime4.JSX.Element;
325
+ }: ChatbotPanelHeaderProps): react_jsx_runtime0.JSX.Element;
326
326
  //#endregion
327
327
  //#region src/components/chatbot-sidebar.d.ts
328
328
  interface ChatbotSidebarConversation {
@@ -425,7 +425,7 @@ declare function ChatbotInput({
425
425
  activeConversationId,
426
426
  onSelectConversation,
427
427
  ...textareaProps
428
- }: ChatbotInputProps): react_jsx_runtime4.JSX.Element;
428
+ }: ChatbotInputProps): react_jsx_runtime0.JSX.Element;
429
429
  //#endregion
430
430
  //#region src/components/copy-button.d.ts
431
431
  declare const CopyButton: React$1.ForwardRefExoticComponent<Omit<CopyButtonProps, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
@@ -461,7 +461,7 @@ type ChatbotPanelSuggestionProps = Omit<React.ComponentProps<typeof Button>, 'va
461
461
  declare function ChatbotPanelSuggestion({
462
462
  className,
463
463
  ...props
464
- }: ChatbotPanelSuggestionProps): react_jsx_runtime4.JSX.Element;
464
+ }: ChatbotPanelSuggestionProps): react_jsx_runtime0.JSX.Element;
465
465
  //#endregion
466
466
  //#region src/components/chatbot-user-message.d.ts
467
467
  type ChatbotUserMessageProps = React.ComponentProps<'div'>;
@@ -469,7 +469,7 @@ declare function ChatbotUserMessage({
469
469
  className,
470
470
  children,
471
471
  ...props
472
- }: ChatbotUserMessageProps): react_jsx_runtime4.JSX.Element;
472
+ }: ChatbotUserMessageProps): react_jsx_runtime0.JSX.Element;
473
473
  //#endregion
474
474
  //#region src/components/dashboard-standalone-page.d.ts
475
475
  declare const DashboardStandalonePage: React$1.ForwardRefExoticComponent<Omit<DashboardStandalonePageProps, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
@@ -626,6 +626,68 @@ declare namespace RoleBadge {
626
626
  type Props = RoleBadgeProps;
627
627
  }
628
628
  //#endregion
629
+ //#region src/components/score-badge.d.ts
630
+ /**
631
+ * The fixed semantic score palette. Each tone maps to a DS `Badge` `color` +
632
+ * `tone` pair, so every ScoreBadge stays on the design-system palette (dark-mode
633
+ * + contrast handled by `Badge`). The colors are not consumer-customisable — only
634
+ * the band boundaries are (see {@link ScoreThresholds}).
635
+ */
636
+ type ScoreTone = 'success' | 'success-alt' | 'warning' | 'destructive' | 'destructive-strong' | 'muted';
637
+ /** A single color band: a value at or above `from` (and below the next band) renders with `tone`. */
638
+ type ScoreThreshold = {
639
+ /** Inclusive lower bound of the band. */from: number; /** Which semantic {@link ScoreTone} the band paints. */
640
+ tone: ScoreTone;
641
+ };
642
+ /** An ordered set of color bands mapping a numeric score to a {@link ScoreTone}. */
643
+ type ScoreThresholds = ScoreThreshold[];
644
+ /** How a {@link ScoreBadge} formats its number: a bare number or a percentage. */
645
+ type ScoreKind = 'number' | 'percent';
646
+ /**
647
+ * The default color bands, from the Figma ScoreBadge spec (0–100 scale):
648
+ * `≥85` excellent, `70–84` good, `50–69` fair, `20–49` poor, `<20` very poor.
649
+ */
650
+ declare const PERCENTAGE_THRESHOLDS: ScoreThresholds;
651
+ type ScoreBadgeProps = Omit<React$1.ComponentProps<typeof Badge>, 'color' | 'tone' | 'children'> & {
652
+ /**
653
+ * The numeric score. Drives both the pill color (via `thresholds`) and the
654
+ * displayed number. `null`/`undefined` or a non-finite value (`NaN`/`±Infinity`)
655
+ * renders a muted `"--"`. Finite out-of-range values render as-is (not clamped).
656
+ */
657
+ value?: number | null;
658
+ /**
659
+ * How the value is formatted — a bare number, or a `%` percentage (0–100 scale).
660
+ * @default 'number'
661
+ */
662
+ kind?: ScoreKind;
663
+ /**
664
+ * Color bands mapping the value to a tone.
665
+ * @default PERCENTAGE_THRESHOLDS
666
+ */
667
+ thresholds?: ScoreThresholds;
668
+ /**
669
+ * Extra `Intl.NumberFormat` options merged over the per-kind defaults — e.g.
670
+ * `{ maximumFractionDigits: 0 }` for no decimals, `{ signDisplay: 'always' }`.
671
+ * For `kind='percent'` the value is scaled to a 0–1 fraction, so don't override `style`.
672
+ */
673
+ formatOptions?: Intl.NumberFormatOptions;
674
+ };
675
+ declare namespace ScoreBadge {
676
+ type Props = ScoreBadgeProps;
677
+ }
678
+ /**
679
+ * A score pill. Composes DS `Badge`: derives its color from `value` against
680
+ * `thresholds` and renders the value, locale-formatted per `kind`.
681
+ *
682
+ * @example
683
+ * ```tsx
684
+ * <ScoreBadge value={90.66666} /> // "90.7"
685
+ * <ScoreBadge value={90.66666} kind="percent" /> // "90.7%"
686
+ * <ScoreBadge value={4} thresholds={CSAT} formatOptions={{ maximumFractionDigits: 0 }} /> // "4"
687
+ * ```
688
+ */
689
+ declare const ScoreBadge: React$1.ForwardRefExoticComponent<Omit<ScoreBadgeProps, "ref"> & React$1.RefAttributes<HTMLSpanElement>>;
690
+ //#endregion
629
691
  //#region src/components/chatbot-panel-trigger.d.ts
630
692
  type ChatbotPanelTriggerProps = Omit<React$1.ComponentProps<typeof Button>, 'variant' | 'size' | 'disabled'> & {
631
693
  /** The copy revealed when the trigger expands (hover / focus / pressed). */children?: React$1.ReactNode; /** Leading icon. Defaults to the Aircall logo mark. */
@@ -644,7 +706,7 @@ declare function ChatbotPanelTrigger({
644
706
  icon,
645
707
  className,
646
708
  ...buttonProps
647
- }: ChatbotPanelTriggerProps): react_jsx_runtime4.JSX.Element;
709
+ }: ChatbotPanelTriggerProps): react_jsx_runtime0.JSX.Element;
648
710
  //#endregion
649
711
  //#region src/components/chatbot-expand-suggestion.d.ts
650
712
  interface ChatbotExpandSuggestionCategory {
@@ -750,7 +812,7 @@ declare function ChatbotPanel({
750
812
  style,
751
813
  children,
752
814
  ...props
753
- }: ChatbotPanelProps): react_jsx_runtime4.JSX.Element;
815
+ }: ChatbotPanelProps): react_jsx_runtime0.JSX.Element;
754
816
  //#endregion
755
817
  //#region src/hooks/use-copy-to-clipboard.d.ts
756
818
  interface UseCopyToClipboardOptions {
@@ -787,7 +849,7 @@ declare function CardSaveBar({
787
849
  submitLabel,
788
850
  savingLabel,
789
851
  resetLabel
790
- }: CardSaveBarProps): react_jsx_runtime4.JSX.Element;
852
+ }: CardSaveBarProps): react_jsx_runtime0.JSX.Element;
791
853
  //#endregion
792
854
  //#region src/components/submit-button.d.ts
793
855
  /**
@@ -811,7 +873,7 @@ declare function SubmitButton({
811
873
  loadingLabel,
812
874
  className,
813
875
  ...buttonProps
814
- }: SubmitButtonProps): react_jsx_runtime4.JSX.Element;
876
+ }: SubmitButtonProps): react_jsx_runtime0.JSX.Element;
815
877
  //#endregion
816
878
  //#region src/form/use-form.d.ts
817
879
  /**
@@ -1473,7 +1535,7 @@ declare function FormFieldShell({
1473
1535
  orientation,
1474
1536
  controlPosition,
1475
1537
  controlVariant
1476
- }: FormFieldShellProps): react_jsx_runtime4.JSX.Element;
1538
+ }: FormFieldShellProps): react_jsx_runtime0.JSX.Element;
1477
1539
  /**
1478
1540
  * Precisely-typed view of the bound field handed to a wrapper's `children`.
1479
1541
  * `TData` is `DeepValue<TFormData, TName>` — so `value` and `handleChange` are the field's
@@ -1597,7 +1659,7 @@ type FormFieldBaseProps<TData, TControl> = {
1597
1659
  * Field-name/value/validator typing is enforced at each wrapper's boundary; this just renders
1598
1660
  * the AppField + shared shell. `TData`/`TControl` carry the precise field + bundle shapes through.
1599
1661
  */
1600
- declare function FormFieldBase<TData, TControl>(props: FormFieldBaseProps<TData, TControl>): react_jsx_runtime4.JSX.Element;
1662
+ declare function FormFieldBase<TData, TControl>(props: FormFieldBaseProps<TData, TControl>): react_jsx_runtime0.JSX.Element;
1601
1663
  //#endregion
1602
1664
  //#region src/components/form-select-field.d.ts
1603
1665
  /**
@@ -1643,7 +1705,7 @@ type FormSelectFieldProps<TForm extends BoundForm, TName extends DeepKeysOfType<
1643
1705
  * )}
1644
1706
  * </FormSelectField>
1645
1707
  */
1646
- declare function FormSelectField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], string>>(props: FormSelectFieldProps<TForm, TName>): react_jsx_runtime4.JSX.Element;
1708
+ declare function FormSelectField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], string>>(props: FormSelectFieldProps<TForm, TName>): react_jsx_runtime0.JSX.Element;
1647
1709
  //#endregion
1648
1710
  //#region src/components/form-input-field.d.ts
1649
1711
  /**
@@ -1677,7 +1739,7 @@ type FormInputFieldProps<TForm extends BoundForm, TName extends DeepKeysOfType<T
1677
1739
  * {(field, { inputProps }) => <Input {...inputProps} type="email" placeholder="you@co.com" />}
1678
1740
  * </FormInputField>
1679
1741
  */
1680
- declare function FormInputField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], string>>(props: FormInputFieldProps<TForm, TName>): react_jsx_runtime4.JSX.Element;
1742
+ declare function FormInputField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], string>>(props: FormInputFieldProps<TForm, TName>): react_jsx_runtime0.JSX.Element;
1681
1743
  //#endregion
1682
1744
  //#region src/components/form-combobox-field.d.ts
1683
1745
  /**
@@ -1724,7 +1786,7 @@ type FormComboboxFieldProps<TForm extends BoundForm, TName extends DeepKeysOfTyp
1724
1786
  * )}
1725
1787
  * </FormComboboxField>
1726
1788
  */
1727
- declare function FormComboboxField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], string>>(props: FormComboboxFieldProps<TForm, TName>): react_jsx_runtime4.JSX.Element;
1789
+ declare function FormComboboxField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], string>>(props: FormComboboxFieldProps<TForm, TName>): react_jsx_runtime0.JSX.Element;
1728
1790
  //#endregion
1729
1791
  //#region src/components/form-multi-combobox-field.d.ts
1730
1792
  /**
@@ -1765,7 +1827,7 @@ type FormMultiComboboxFieldProps<TForm extends BoundForm, TName extends DeepKeys
1765
1827
  * )}
1766
1828
  * </FormMultiComboboxField>
1767
1829
  */
1768
- declare function FormMultiComboboxField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], string[]>>(props: FormMultiComboboxFieldProps<TForm, TName>): react_jsx_runtime4.JSX.Element;
1830
+ declare function FormMultiComboboxField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], string[]>>(props: FormMultiComboboxFieldProps<TForm, TName>): react_jsx_runtime0.JSX.Element;
1769
1831
  //#endregion
1770
1832
  //#region src/components/form-array-field.d.ts
1771
1833
  /**
@@ -1839,7 +1901,7 @@ type FormArrayFieldProps<TForm extends BoundForm, TName extends DeepKeysOfType<T
1839
1901
  * )}
1840
1902
  * </FormArrayField>
1841
1903
  */
1842
- declare function FormArrayField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], unknown[]>>(props: FormArrayFieldProps<TForm, TName>): react_jsx_runtime4.JSX.Element;
1904
+ declare function FormArrayField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], unknown[]>>(props: FormArrayFieldProps<TForm, TName>): react_jsx_runtime0.JSX.Element;
1843
1905
  //#endregion
1844
1906
  //#region src/components/form-textarea-field.d.ts
1845
1907
  /**
@@ -1873,7 +1935,7 @@ type FormTextareaFieldProps<TForm extends BoundForm, TName extends DeepKeysOfTyp
1873
1935
  * {(field, { textareaProps }) => <Textarea {...textareaProps} rows={4} />}
1874
1936
  * </FormTextareaField>
1875
1937
  */
1876
- declare function FormTextareaField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], string>>(props: FormTextareaFieldProps<TForm, TName>): react_jsx_runtime4.JSX.Element;
1938
+ declare function FormTextareaField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], string>>(props: FormTextareaFieldProps<TForm, TName>): react_jsx_runtime0.JSX.Element;
1877
1939
  //#endregion
1878
1940
  //#region src/components/form-radio-group-field.d.ts
1879
1941
  /**
@@ -1914,7 +1976,7 @@ type FormRadioGroupFieldProps<TForm extends BoundForm, TName extends DeepKeysOfT
1914
1976
  * )}
1915
1977
  * </FormRadioGroupField>
1916
1978
  */
1917
- declare function FormRadioGroupField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], string>>(props: FormRadioGroupFieldProps<TForm, TName>): react_jsx_runtime4.JSX.Element;
1979
+ declare function FormRadioGroupField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], string>>(props: FormRadioGroupFieldProps<TForm, TName>): react_jsx_runtime0.JSX.Element;
1918
1980
  //#endregion
1919
1981
  //#region src/components/form-otp-field.d.ts
1920
1982
  /**
@@ -1949,7 +2011,7 @@ type FormOTPFieldProps<TForm extends BoundForm, TName extends DeepKeysOfType<TFo
1949
2011
  * {(field, { otpProps }) => <InputOTP maxLength={6} {...otpProps}>{slots}</InputOTP>}
1950
2012
  * </FormOTPField>
1951
2013
  */
1952
- declare function FormOTPField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], string>>(props: FormOTPFieldProps<TForm, TName>): react_jsx_runtime4.JSX.Element;
2014
+ declare function FormOTPField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], string>>(props: FormOTPFieldProps<TForm, TName>): react_jsx_runtime0.JSX.Element;
1953
2015
  //#endregion
1954
2016
  //#region src/components/form-switch-field.d.ts
1955
2017
  /**
@@ -1986,7 +2048,7 @@ type FormSwitchFieldProps<TForm extends BoundForm, TName extends DeepKeysOfType<
1986
2048
  * {(field, { switchProps }) => <Switch {...switchProps} />}
1987
2049
  * </FormSwitchField>
1988
2050
  */
1989
- declare function FormSwitchField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], boolean>>(props: FormSwitchFieldProps<TForm, TName>): react_jsx_runtime4.JSX.Element;
2051
+ declare function FormSwitchField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], boolean>>(props: FormSwitchFieldProps<TForm, TName>): react_jsx_runtime0.JSX.Element;
1990
2052
  //#endregion
1991
2053
  //#region src/components/form-numeric-field.d.ts
1992
2054
  /**
@@ -2020,7 +2082,7 @@ type FormNumericFieldProps<TForm extends BoundForm, TName extends DeepKeysOfType
2020
2082
  * {(field, { numericProps }) => <NumericInput {...numericProps} />}
2021
2083
  * </FormNumericField>
2022
2084
  */
2023
- declare function FormNumericField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], number>>(props: FormNumericFieldProps<TForm, TName>): react_jsx_runtime4.JSX.Element;
2085
+ declare function FormNumericField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], number>>(props: FormNumericFieldProps<TForm, TName>): react_jsx_runtime0.JSX.Element;
2024
2086
  //#endregion
2025
2087
  //#region src/components/form-slider-field.d.ts
2026
2088
  /**
@@ -2060,7 +2122,7 @@ type FormSliderFieldProps<TForm extends BoundForm, TName extends DeepKeysOfType<
2060
2122
  * {(field, { sliderProps }) => <Slider min={0} max={100} step={1} {...sliderProps} />}
2061
2123
  * </FormSliderField>
2062
2124
  */
2063
- declare function FormSliderField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], number>>(props: FormSliderFieldProps<TForm, TName>): react_jsx_runtime4.JSX.Element;
2125
+ declare function FormSliderField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], number>>(props: FormSliderFieldProps<TForm, TName>): react_jsx_runtime0.JSX.Element;
2064
2126
  //#endregion
2065
2127
  //#region src/components/form-toggle-group-field.d.ts
2066
2128
  /**
@@ -2101,7 +2163,7 @@ type FormToggleGroupFieldProps<TForm extends BoundForm, TName extends DeepKeysOf
2101
2163
  * )}
2102
2164
  * </FormToggleGroupField>
2103
2165
  */
2104
- declare function FormToggleGroupField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], string | null>>(props: FormToggleGroupFieldProps<TForm, TName>): react_jsx_runtime4.JSX.Element;
2166
+ declare function FormToggleGroupField<TForm extends BoundForm, TName extends DeepKeysOfType<TForm['state']['values'], string | null>>(props: FormToggleGroupFieldProps<TForm, TName>): react_jsx_runtime0.JSX.Element;
2105
2167
  //#endregion
2106
2168
  //#region src/form/field-errors.d.ts
2107
2169
  /**
@@ -2149,7 +2211,7 @@ declare function SaveBar({
2149
2211
  savingLabel,
2150
2212
  resetLabel,
2151
2213
  className
2152
- }: SaveBarProps): react_jsx_runtime4.JSX.Element;
2214
+ }: SaveBarProps): react_jsx_runtime0.JSX.Element;
2153
2215
  //#endregion
2154
2216
  //#region src/components/dashboard-sidebar-nav.d.ts
2155
2217
  type DashboardSidebarNavSubmenuSeparator = {
@@ -2233,7 +2295,7 @@ type DashboardSidebarNavProps = {
2233
2295
  declare function DashboardSidebarNav({
2234
2296
  groups,
2235
2297
  renderLink
2236
- }: DashboardSidebarNavProps): react_jsx_runtime4.JSX.Element;
2298
+ }: DashboardSidebarNavProps): react_jsx_runtime0.JSX.Element;
2237
2299
  //#endregion
2238
2300
  //#region src/components/dashboard-sidebar.d.ts
2239
2301
  declare const DashboardSidebarProvider: React$1.ForwardRefExoticComponent<Omit<DashboardSidebarProviderProps, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
@@ -2333,4 +2395,4 @@ declare namespace DashboardSidebarSubmenuSeparator {
2333
2395
  type Props = DashboardSidebarSubmenuSeparatorProps;
2334
2396
  }
2335
2397
  //#endregion
2336
- export { type ArrayField, type ArrayItem, BetaBadge, type BoundForm, CardSaveBar, type CardSaveBarProps, ChatbotExpandSuggestion, type ChatbotExpandSuggestionProps, ChatbotInput, type ChatbotInputProps, type ChatbotInputSuggestion, ChatbotPage, ChatbotPageBody, type ChatbotPageBodyProps, ChatbotPageContent, type ChatbotPageContentProps, ChatbotPageConversation, type ChatbotPageConversationProps, ChatbotPageFooter, type ChatbotPageFooterProps, ChatbotPageHeading, type ChatbotPageHeadingProps, ChatbotPageInputBar, type ChatbotPageInputBarProps, type ChatbotPageProps, ChatbotPanel, ChatbotPanelHeader, type ChatbotPanelHeaderProps, type ChatbotPanelProps, ChatbotPanelSuggestion, type ChatbotPanelSuggestionItem, type ChatbotPanelSuggestionProps, ChatbotPanelTrigger, type ChatbotPanelTriggerProps, ChatbotResponseBlock, type ChatbotResponseBlockFeedback, type ChatbotResponseBlockProps, ChatbotResponseLoading, type ChatbotResponseLoadingProps, ChatbotSidebar, type ChatbotSidebarConversation, ChatbotUserMessage, type ChatbotUserMessageProps, type ComboboxControl, ComingSoonDescription, ComingSoonEmptyState, ComingSoonMedia, ComingSoonTitle, CommonForm, CopyButton, CopyButtonIcon, CopyButtonLabel, DashboardPage, DashboardPageBanner, DashboardPageContent, DashboardPageHeader, DashboardPageHeaderAction, DashboardPageHeaderActions, DashboardPageHeaderDescription, DashboardPageHeaderNav, DashboardPageHeaderNavBack, DashboardPageHeaderPrefix, DashboardPageHeaderSubtitle, DashboardPageHeaderTitle, DashboardPageHeaderTitleGroup, DashboardPageMain, DashboardPageTabs, DashboardSidebar, DashboardSidebarContent, DashboardSidebarFooter, DashboardSidebarGroup, DashboardSidebarGroupLabel, DashboardSidebarHeader, DashboardSidebarMenu, DashboardSidebarMenuBadge, DashboardSidebarMenuButton, DashboardSidebarMenuItem, DashboardSidebarNav, type DashboardSidebarNavGroup, type DashboardSidebarNavItem, type DashboardSidebarNavItemAction, type DashboardSidebarNavItemLink, type DashboardSidebarNavItemSubmenu, type DashboardSidebarNavSubmenuItem, DashboardSidebarProvider, DashboardSidebarSubmenu, DashboardSidebarSubmenuItem, DashboardSidebarSubmenuSeparator, DashboardSidebarTrigger, DashboardStandalonePage, DashboardStandalonePageAction, DashboardStandalonePageActions, DashboardStandalonePageContent, DashboardStandalonePageDescription, DashboardStandalonePageHeader, DashboardStandalonePageMain, DashboardStandalonePageTitle, DeprecatedBadge, EmptyState, EmptyStateActions, EmptyStateButton, EmptyStateDescription, EmptyStateExternalLink, EmptyStateHeader, EmptyStateMedia, EmptyStateTitle, type FieldBindingProps, FormArrayField, type FormArrayFieldProps, FormComboboxField, type FormComboboxFieldProps, FormFieldBase, FormFieldShell, type FormFieldShellProps, type FormFieldValidators, FormInputField, type FormInputFieldProps, FormMultiComboboxField, type FormMultiComboboxFieldProps, FormNumericField, type FormNumericFieldProps, FormOTPField, type FormOTPFieldProps, FormRadioGroupField, type FormRadioGroupFieldProps, FormSelectField, type FormSelectFieldProps, FormSliderField, type FormSliderFieldProps, FormSwitchField, type FormSwitchFieldProps, FormTextareaField, type FormTextareaFieldProps, FormToggleGroupField, type FormToggleGroupFieldProps, type InputControl, type MultiComboboxControl, type NecessityProps, NewBadge, NoDataDescription, NoDataEmptyState, NoDataMedia, NoDataTitle, NoSupportDescription, NoSupportEmptyState, NoSupportMedia, NoSupportTitle, NotFoundDescription, NotFoundEmptyState, NotFoundMedia, NotFoundTitle, type NumericControl, type OTPControl, ProfessionalBadge, type RadioGroupControl, RestrictedAccessDescription, RestrictedAccessEmptyState, RestrictedAccessMedia, RestrictedAccessTitle, RoleBadge, type RoleBadgeRole, SaveBar, type SaveBarProps, type SelectControl, type SliderControl, SubmitButton, type SubmitButtonProps, type SwitchControl, type TextareaControl, type ToggleGroupControl, TrialBadge, type TypedField, UnknownErrorDescription, UnknownErrorEmptyState, UnknownErrorMedia, UnknownErrorTitle, fieldContext, formContext, toFieldErrors, useCopyToClipboard, useSidebar as useDashboardSidebar, useFieldContext, useForm, useFormContext, withFieldGroup, withForm };
2398
+ export { type ArrayField, type ArrayItem, BetaBadge, type BoundForm, CardSaveBar, type CardSaveBarProps, ChatbotExpandSuggestion, type ChatbotExpandSuggestionProps, ChatbotInput, type ChatbotInputProps, type ChatbotInputSuggestion, ChatbotPage, ChatbotPageBody, type ChatbotPageBodyProps, ChatbotPageContent, type ChatbotPageContentProps, ChatbotPageConversation, type ChatbotPageConversationProps, ChatbotPageFooter, type ChatbotPageFooterProps, ChatbotPageHeading, type ChatbotPageHeadingProps, ChatbotPageInputBar, type ChatbotPageInputBarProps, type ChatbotPageProps, ChatbotPanel, ChatbotPanelHeader, type ChatbotPanelHeaderProps, type ChatbotPanelProps, ChatbotPanelSuggestion, type ChatbotPanelSuggestionItem, type ChatbotPanelSuggestionProps, ChatbotPanelTrigger, type ChatbotPanelTriggerProps, ChatbotResponseBlock, type ChatbotResponseBlockFeedback, type ChatbotResponseBlockProps, ChatbotResponseLoading, type ChatbotResponseLoadingProps, ChatbotSidebar, type ChatbotSidebarConversation, ChatbotUserMessage, type ChatbotUserMessageProps, type ComboboxControl, ComingSoonDescription, ComingSoonEmptyState, ComingSoonMedia, ComingSoonTitle, CommonForm, CopyButton, CopyButtonIcon, CopyButtonLabel, DashboardPage, DashboardPageBanner, DashboardPageContent, DashboardPageHeader, DashboardPageHeaderAction, DashboardPageHeaderActions, DashboardPageHeaderDescription, DashboardPageHeaderNav, DashboardPageHeaderNavBack, DashboardPageHeaderPrefix, DashboardPageHeaderSubtitle, DashboardPageHeaderTitle, DashboardPageHeaderTitleGroup, DashboardPageMain, DashboardPageTabs, DashboardSidebar, DashboardSidebarContent, DashboardSidebarFooter, DashboardSidebarGroup, DashboardSidebarGroupLabel, DashboardSidebarHeader, DashboardSidebarMenu, DashboardSidebarMenuBadge, DashboardSidebarMenuButton, DashboardSidebarMenuItem, DashboardSidebarNav, type DashboardSidebarNavGroup, type DashboardSidebarNavItem, type DashboardSidebarNavItemAction, type DashboardSidebarNavItemLink, type DashboardSidebarNavItemSubmenu, type DashboardSidebarNavSubmenuItem, DashboardSidebarProvider, DashboardSidebarSubmenu, DashboardSidebarSubmenuItem, DashboardSidebarSubmenuSeparator, DashboardSidebarTrigger, DashboardStandalonePage, DashboardStandalonePageAction, DashboardStandalonePageActions, DashboardStandalonePageContent, DashboardStandalonePageDescription, DashboardStandalonePageHeader, DashboardStandalonePageMain, DashboardStandalonePageTitle, DeprecatedBadge, EmptyState, EmptyStateActions, EmptyStateButton, EmptyStateDescription, EmptyStateExternalLink, EmptyStateHeader, EmptyStateMedia, EmptyStateTitle, type FieldBindingProps, FormArrayField, type FormArrayFieldProps, FormComboboxField, type FormComboboxFieldProps, FormFieldBase, FormFieldShell, type FormFieldShellProps, type FormFieldValidators, FormInputField, type FormInputFieldProps, FormMultiComboboxField, type FormMultiComboboxFieldProps, FormNumericField, type FormNumericFieldProps, FormOTPField, type FormOTPFieldProps, FormRadioGroupField, type FormRadioGroupFieldProps, FormSelectField, type FormSelectFieldProps, FormSliderField, type FormSliderFieldProps, FormSwitchField, type FormSwitchFieldProps, FormTextareaField, type FormTextareaFieldProps, FormToggleGroupField, type FormToggleGroupFieldProps, type InputControl, type MultiComboboxControl, type NecessityProps, NewBadge, NoDataDescription, NoDataEmptyState, NoDataMedia, NoDataTitle, NoSupportDescription, NoSupportEmptyState, NoSupportMedia, NoSupportTitle, NotFoundDescription, NotFoundEmptyState, NotFoundMedia, NotFoundTitle, type NumericControl, type OTPControl, PERCENTAGE_THRESHOLDS, ProfessionalBadge, type RadioGroupControl, RestrictedAccessDescription, RestrictedAccessEmptyState, RestrictedAccessMedia, RestrictedAccessTitle, RoleBadge, type RoleBadgeRole, SaveBar, type SaveBarProps, ScoreBadge, type ScoreKind, type ScoreThreshold, type ScoreThresholds, type ScoreTone, type SelectControl, type SliderControl, SubmitButton, type SubmitButtonProps, type SwitchControl, type TextareaControl, type ToggleGroupControl, TrialBadge, type TypedField, UnknownErrorDescription, UnknownErrorEmptyState, UnknownErrorMedia, UnknownErrorTitle, fieldContext, formContext, toFieldErrors, useCopyToClipboard, useSidebar as useDashboardSidebar, useFieldContext, useForm, useFormContext, withFieldGroup, withForm };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Anchor, Badge, Button, CounterBadge, DropdownMenu, DropdownMenuAddon, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, Field, FieldContent, FieldDescription, FieldError, FieldLabel, FieldLabelAside, FieldLabelInfo, FieldLabelRow, HoverCard, HoverCardContent, HoverCardTrigger, InputGroup, InputGroupButton, InputGroupTextarea, Item, ItemActions, ItemContent, ItemGroup, ItemMedia, ItemTitle, Popover, PopoverContent, PopoverTrigger, Separator, Sidebar, SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarMenuAction, SidebarMenuButton, SidebarMenuItem, SidebarProvider, Spinner, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, TabsList, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipTrigger, cn, registerI18nNamespace, useDsTranslation, useSidebar } from "@aircall/ds";
1
+ import { Anchor, Badge, Button, CounterBadge, DropdownMenu, DropdownMenuAddon, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, Field, FieldContent, FieldDescription, FieldError, FieldLabel, FieldLabelAside, FieldLabelInfo, FieldLabelRow, HoverCard, HoverCardContent, HoverCardTrigger, InputGroup, InputGroupButton, InputGroupTextarea, Item, ItemActions, ItemContent, ItemGroup, ItemMedia, ItemTitle, Popover, PopoverContent, PopoverTrigger, Separator, Sidebar, SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarMenuAction, SidebarMenuButton, SidebarMenuItem, SidebarProvider, Spinner, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, TabsList, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipTrigger, cn, registerI18nNamespace, useDsLocale, useDsTranslation, useSidebar } from "@aircall/ds";
2
2
  import * as React from "react";
3
3
  import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
4
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -2062,6 +2062,123 @@ const RoleBadge = React.forwardRef((componentProps, forwardRef) => {
2062
2062
  });
2063
2063
  RoleBadge.displayName = "RoleBadge";
2064
2064
 
2065
+ //#endregion
2066
+ //#region src/components/score-badge.tsx
2067
+ const SCORE_TONE_BADGE = {
2068
+ success: {
2069
+ color: "green",
2070
+ tone: "medium-light"
2071
+ },
2072
+ "success-alt": {
2073
+ color: "green",
2074
+ tone: "light"
2075
+ },
2076
+ warning: {
2077
+ color: "yellow",
2078
+ tone: "light"
2079
+ },
2080
+ destructive: {
2081
+ color: "red",
2082
+ tone: "light"
2083
+ },
2084
+ "destructive-strong": {
2085
+ color: "red",
2086
+ tone: "medium-light"
2087
+ },
2088
+ muted: {
2089
+ color: "charcoal",
2090
+ tone: "medium-light"
2091
+ }
2092
+ };
2093
+ /**
2094
+ * The default color bands, from the Figma ScoreBadge spec (0–100 scale):
2095
+ * `≥85` excellent, `70–84` good, `50–69` fair, `20–49` poor, `<20` very poor.
2096
+ */
2097
+ const PERCENTAGE_THRESHOLDS = [
2098
+ {
2099
+ from: 85,
2100
+ tone: "success"
2101
+ },
2102
+ {
2103
+ from: 70,
2104
+ tone: "success-alt"
2105
+ },
2106
+ {
2107
+ from: 50,
2108
+ tone: "warning"
2109
+ },
2110
+ {
2111
+ from: 20,
2112
+ tone: "destructive"
2113
+ },
2114
+ {
2115
+ from: 0,
2116
+ tone: "destructive-strong"
2117
+ }
2118
+ ];
2119
+ /** Highest band whose `from` is ≤ value wins; a value below every band → muted. */
2120
+ function resolveTone(value, thresholds) {
2121
+ return [...thresholds].sort((a, b) => b.from - a.from).find((t) => value >= t.from)?.tone ?? "muted";
2122
+ }
2123
+ /**
2124
+ * Format a numeric score for display in the given locale (via `Intl.NumberFormat`),
2125
+ * and report the value rounded to the *same* precision.
2126
+ * - `number`: the value as-is — at most one decimal, trailing zeros dropped
2127
+ * (`en`: `90.66666 → "90.7"`, `4 → "4"`; `fr`: `90,7`).
2128
+ * - `percent`: a 0–100 score shown with a `%` suffix (`90.66666 → "90.7%"`; `fr`: `90,7 %`).
2129
+ *
2130
+ * `formatOptions` are merged over the per-kind defaults — e.g.
2131
+ * `{ maximumFractionDigits: 0 }` to drop decimals, `{ minimumFractionDigits: 2 }` for more.
2132
+ *
2133
+ * `rounded` is the value rounded to the displayed precision; the pill color is
2134
+ * resolved from it (not the raw value) so the color always matches the shown
2135
+ * number — e.g. `3.6` displayed as `"4"` is colored as a 4, not a 3.6.
2136
+ */
2137
+ function formatScore(value, kind, locale, formatOptions) {
2138
+ const options = kind === "percent" ? {
2139
+ style: "percent",
2140
+ maximumFractionDigits: 1,
2141
+ ...formatOptions
2142
+ } : {
2143
+ maximumFractionDigits: 1,
2144
+ ...formatOptions
2145
+ };
2146
+ const formatter = new Intl.NumberFormat(locale, options);
2147
+ const digits = formatter.resolvedOptions().maximumFractionDigits ?? 0;
2148
+ return {
2149
+ label: formatter.format(kind === "percent" ? value / 100 : value),
2150
+ rounded: Number(value.toFixed(digits))
2151
+ };
2152
+ }
2153
+ /**
2154
+ * A score pill. Composes DS `Badge`: derives its color from `value` against
2155
+ * `thresholds` and renders the value, locale-formatted per `kind`.
2156
+ *
2157
+ * @example
2158
+ * ```tsx
2159
+ * <ScoreBadge value={90.66666} /> // "90.7"
2160
+ * <ScoreBadge value={90.66666} kind="percent" /> // "90.7%"
2161
+ * <ScoreBadge value={4} thresholds={CSAT} formatOptions={{ maximumFractionDigits: 0 }} /> // "4"
2162
+ * ```
2163
+ */
2164
+ const ScoreBadge = React.forwardRef((componentProps, forwardRef) => {
2165
+ const { value, kind = "number", thresholds = PERCENTAGE_THRESHOLDS, formatOptions, className, ...props } = componentProps;
2166
+ const locale = useDsLocale();
2167
+ const score = value != null && Number.isFinite(value) ? value : null;
2168
+ const formatted = score === null ? null : formatScore(score, kind, locale, formatOptions);
2169
+ const { color, tone: badgeTone } = SCORE_TONE_BADGE[formatted === null ? "muted" : resolveTone(formatted.rounded, thresholds)];
2170
+ return /* @__PURE__ */ jsx(Badge, {
2171
+ ref: forwardRef,
2172
+ "data-slot": "score-badge",
2173
+ color,
2174
+ tone: badgeTone,
2175
+ className: cn("tabular-nums", className),
2176
+ ...props,
2177
+ children: formatted === null ? "--" : formatted.label
2178
+ });
2179
+ });
2180
+ ScoreBadge.displayName = "ScoreBadge";
2181
+
2065
2182
  //#endregion
2066
2183
  //#region src/components/chatbot-panel-trigger.tsx
2067
2184
  /**
@@ -3280,4 +3397,4 @@ function DashboardSidebarNav({ groups, renderLink }) {
3280
3397
  }
3281
3398
 
3282
3399
  //#endregion
3283
- export { BetaBadge, CardSaveBar, ChatbotExpandSuggestion, ChatbotInput, ChatbotPage, ChatbotPageBody, ChatbotPageContent, ChatbotPageConversation, ChatbotPageFooter, ChatbotPageHeading, ChatbotPageInputBar, ChatbotPanel, ChatbotPanelHeader, ChatbotPanelSuggestion, ChatbotPanelTrigger, ChatbotResponseBlock, ChatbotResponseLoading, ChatbotSidebar, ChatbotUserMessage, ComingSoonDescription, ComingSoonEmptyState, ComingSoonMedia, ComingSoonTitle, CommonForm, CopyButton, CopyButtonIcon, CopyButtonLabel, DashboardPage, DashboardPageBanner, DashboardPageContent, DashboardPageHeader, DashboardPageHeaderAction, DashboardPageHeaderActions, DashboardPageHeaderDescription, DashboardPageHeaderNav, DashboardPageHeaderNavBack, DashboardPageHeaderPrefix, DashboardPageHeaderSubtitle, DashboardPageHeaderTitle, DashboardPageHeaderTitleGroup, DashboardPageMain, DashboardPageTabs, DashboardSidebar, DashboardSidebarContent, DashboardSidebarFooter, DashboardSidebarGroup, DashboardSidebarGroupLabel, DashboardSidebarHeader, DashboardSidebarMenu, DashboardSidebarMenuBadge, DashboardSidebarMenuButton, DashboardSidebarMenuItem, DashboardSidebarNav, DashboardSidebarProvider, DashboardSidebarSubmenu, DashboardSidebarSubmenuItem, DashboardSidebarSubmenuSeparator, DashboardSidebarTrigger, DashboardStandalonePage, DashboardStandalonePageAction, DashboardStandalonePageActions, DashboardStandalonePageContent, DashboardStandalonePageDescription, DashboardStandalonePageHeader, DashboardStandalonePageMain, DashboardStandalonePageTitle, DeprecatedBadge, EmptyState, EmptyStateActions, EmptyStateButton, EmptyStateDescription, EmptyStateExternalLink, EmptyStateHeader, EmptyStateMedia, EmptyStateTitle, FormArrayField, FormComboboxField, FormFieldBase, FormFieldShell, FormInputField, FormMultiComboboxField, FormNumericField, FormOTPField, FormRadioGroupField, FormSelectField, FormSliderField, FormSwitchField, FormTextareaField, FormToggleGroupField, NewBadge, NoDataDescription, NoDataEmptyState, NoDataMedia, NoDataTitle, NoSupportDescription, NoSupportEmptyState, NoSupportMedia, NoSupportTitle, NotFoundDescription, NotFoundEmptyState, NotFoundMedia, NotFoundTitle, ProfessionalBadge, RestrictedAccessDescription, RestrictedAccessEmptyState, RestrictedAccessMedia, RestrictedAccessTitle, RoleBadge, SaveBar, SubmitButton, TrialBadge, UnknownErrorDescription, UnknownErrorEmptyState, UnknownErrorMedia, UnknownErrorTitle, fieldContext, formContext, toFieldErrors, useCopyToClipboard, useSidebar as useDashboardSidebar, useFieldContext, useForm, useFormContext, withFieldGroup, withForm };
3400
+ export { BetaBadge, CardSaveBar, ChatbotExpandSuggestion, ChatbotInput, ChatbotPage, ChatbotPageBody, ChatbotPageContent, ChatbotPageConversation, ChatbotPageFooter, ChatbotPageHeading, ChatbotPageInputBar, ChatbotPanel, ChatbotPanelHeader, ChatbotPanelSuggestion, ChatbotPanelTrigger, ChatbotResponseBlock, ChatbotResponseLoading, ChatbotSidebar, ChatbotUserMessage, ComingSoonDescription, ComingSoonEmptyState, ComingSoonMedia, ComingSoonTitle, CommonForm, CopyButton, CopyButtonIcon, CopyButtonLabel, DashboardPage, DashboardPageBanner, DashboardPageContent, DashboardPageHeader, DashboardPageHeaderAction, DashboardPageHeaderActions, DashboardPageHeaderDescription, DashboardPageHeaderNav, DashboardPageHeaderNavBack, DashboardPageHeaderPrefix, DashboardPageHeaderSubtitle, DashboardPageHeaderTitle, DashboardPageHeaderTitleGroup, DashboardPageMain, DashboardPageTabs, DashboardSidebar, DashboardSidebarContent, DashboardSidebarFooter, DashboardSidebarGroup, DashboardSidebarGroupLabel, DashboardSidebarHeader, DashboardSidebarMenu, DashboardSidebarMenuBadge, DashboardSidebarMenuButton, DashboardSidebarMenuItem, DashboardSidebarNav, DashboardSidebarProvider, DashboardSidebarSubmenu, DashboardSidebarSubmenuItem, DashboardSidebarSubmenuSeparator, DashboardSidebarTrigger, DashboardStandalonePage, DashboardStandalonePageAction, DashboardStandalonePageActions, DashboardStandalonePageContent, DashboardStandalonePageDescription, DashboardStandalonePageHeader, DashboardStandalonePageMain, DashboardStandalonePageTitle, DeprecatedBadge, EmptyState, EmptyStateActions, EmptyStateButton, EmptyStateDescription, EmptyStateExternalLink, EmptyStateHeader, EmptyStateMedia, EmptyStateTitle, FormArrayField, FormComboboxField, FormFieldBase, FormFieldShell, FormInputField, FormMultiComboboxField, FormNumericField, FormOTPField, FormRadioGroupField, FormSelectField, FormSliderField, FormSwitchField, FormTextareaField, FormToggleGroupField, NewBadge, NoDataDescription, NoDataEmptyState, NoDataMedia, NoDataTitle, NoSupportDescription, NoSupportEmptyState, NoSupportMedia, NoSupportTitle, NotFoundDescription, NotFoundEmptyState, NotFoundMedia, NotFoundTitle, PERCENTAGE_THRESHOLDS, ProfessionalBadge, RestrictedAccessDescription, RestrictedAccessEmptyState, RestrictedAccessMedia, RestrictedAccessTitle, RoleBadge, SaveBar, ScoreBadge, SubmitButton, TrialBadge, UnknownErrorDescription, UnknownErrorEmptyState, UnknownErrorMedia, UnknownErrorTitle, fieldContext, formContext, toFieldErrors, useCopyToClipboard, useSidebar as useDashboardSidebar, useFieldContext, useForm, useFormContext, withFieldGroup, withForm };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aircall/blocks",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "sideEffects": [
@@ -81,7 +81,7 @@
81
81
  "vite": "7.3.1",
82
82
  "vitest": "4.0.17",
83
83
  "zod": "4.4.3",
84
- "@aircall/ds": "0.20.0",
84
+ "@aircall/ds": "0.21.0",
85
85
  "@aircall/hooks": "0.5.1"
86
86
  },
87
87
  "keywords": [