@yuno-payments/dashboard-design-system 0.0.170 → 0.0.172

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 (161) hide show
  1. package/dist/components/atoms/access-denied-alert/access-denied-alert.d.ts +16 -0
  2. package/dist/components/atoms/accordion/accordion.d.ts +66 -0
  3. package/dist/components/atoms/alert/alert.d.ts +26 -1
  4. package/dist/components/atoms/alert/alert.js +9 -8
  5. package/dist/components/atoms/avatar/avatar-group.d.ts +28 -0
  6. package/dist/components/atoms/avatar/avatar.d.ts +25 -0
  7. package/dist/components/atoms/avatar/avatar.js +9 -9
  8. package/dist/components/atoms/badge/badge.d.ts +30 -2
  9. package/dist/components/atoms/badge/badge.js +27 -11
  10. package/dist/components/atoms/button/button.d.ts +44 -0
  11. package/dist/components/atoms/card/card.d.ts +137 -3
  12. package/dist/components/atoms/card/card.js +56 -28
  13. package/dist/components/atoms/checkbox/checkbox.d.ts +38 -2
  14. package/dist/components/atoms/checkbox/checkbox.js +61 -27
  15. package/dist/components/atoms/combobox/combobox.d.ts +18 -0
  16. package/dist/components/atoms/combobox/combobox.js +41 -41
  17. package/dist/components/atoms/combobox/types.d.ts +90 -1
  18. package/dist/components/atoms/currency-field/currency-field.d.ts +38 -0
  19. package/dist/components/atoms/currency-field/currency-field.js +22 -19
  20. package/dist/components/atoms/date-picker/date-picker.d.ts +15 -0
  21. package/dist/components/atoms/date-range-picker/date-range-picker.d.ts +15 -0
  22. package/dist/components/atoms/dots-menu/dots-menu.d.ts +16 -0
  23. package/dist/components/atoms/dots-menu/dots-menu.js +8 -8
  24. package/dist/components/atoms/dots-menu/dots-menu.types.d.ts +52 -0
  25. package/dist/components/atoms/dropdown-menu/dropdown-menu.d.ts +50 -0
  26. package/dist/components/atoms/field/field.d.ts +55 -0
  27. package/dist/components/atoms/field/field.js +53 -46
  28. package/dist/components/atoms/filter/filter-date-range.d.ts +12 -2
  29. package/dist/components/atoms/filter/filter-date-range.js +203 -168
  30. package/dist/components/atoms/filter/filter.d.ts +6 -0
  31. package/dist/components/atoms/filter/filter.js +91 -76
  32. package/dist/components/atoms/filter/index.d.ts +1 -1
  33. package/dist/components/atoms/filter-dropdown/filter-dropdown.d.ts +208 -2
  34. package/dist/components/atoms/filter-dropdown/filter-dropdown.js +214 -160
  35. package/dist/components/atoms/icon/aida-logo.d.ts +3 -0
  36. package/dist/components/atoms/icon/aida-logo.js +64 -0
  37. package/dist/components/atoms/icon/icon-list.d.ts +5 -0
  38. package/dist/components/atoms/icon/icon-list.js +394 -384
  39. package/dist/components/atoms/icon/icon.d.ts +29 -0
  40. package/dist/components/atoms/index.d.ts +3 -2
  41. package/dist/components/atoms/label/index.d.ts +1 -1
  42. package/dist/components/atoms/label/label.d.ts +11 -0
  43. package/dist/components/atoms/label/label.js +28 -0
  44. package/dist/components/atoms/link/link.d.ts +20 -0
  45. package/dist/components/atoms/loading/index.d.ts +1 -0
  46. package/dist/components/atoms/loading/loading.d.ts +39 -0
  47. package/dist/components/atoms/loading/loading.js +37 -0
  48. package/dist/components/atoms/multi-select/multi-select.d.ts +1 -1
  49. package/dist/components/atoms/multi-select/multi-select.js +6 -6
  50. package/dist/components/atoms/multi-values-field/multi-values-field.d.ts +16 -0
  51. package/dist/components/atoms/multi-values-field/multi-values-field.js +109 -87
  52. package/dist/components/atoms/multi-values-field/multi-values-field.types.d.ts +81 -0
  53. package/dist/components/atoms/otp-field/otp-field.d.ts +32 -0
  54. package/dist/components/atoms/password-field/password-field.d.ts +23 -0
  55. package/dist/components/atoms/password-field/password-field.js +1 -1
  56. package/dist/components/atoms/progress/progress.d.ts +15 -0
  57. package/dist/components/atoms/protected-field/protected-field.d.ts +10 -0
  58. package/dist/components/atoms/protected-field/protected-field.types.d.ts +14 -0
  59. package/dist/components/atoms/radio-group/radio-group-option.js +11 -11
  60. package/dist/components/atoms/radio-group/radio-group.d.ts +50 -1
  61. package/dist/components/atoms/radio-group/radio-group.js +13 -12
  62. package/dist/components/atoms/search-field/search-field.d.ts +14 -0
  63. package/dist/components/atoms/search-field/search-field.js +17 -17
  64. package/dist/components/atoms/search-field/search-field.types.d.ts +57 -0
  65. package/dist/components/atoms/select/index.d.ts +2 -0
  66. package/dist/components/atoms/select/search-select.d.ts +22 -0
  67. package/dist/components/atoms/select/search-select.js +201 -0
  68. package/dist/components/atoms/select/select.d.ts +83 -1
  69. package/dist/components/atoms/select/select.js +21 -21
  70. package/dist/components/atoms/separator/separator.d.ts +17 -0
  71. package/dist/components/atoms/skeleton/index.d.ts +9 -0
  72. package/dist/components/atoms/switch/switch.d.ts +56 -2
  73. package/dist/components/atoms/switch/switch.js +64 -32
  74. package/dist/components/atoms/tabs/index.d.ts +16 -0
  75. package/dist/components/atoms/textarea/textarea.d.ts +32 -0
  76. package/dist/components/atoms/textarea/textarea.js +1 -1
  77. package/dist/components/atoms/time-picker/time-picker.d.ts +73 -2
  78. package/dist/components/atoms/time-picker/time-picker.js +218 -3
  79. package/dist/components/atoms/toaster/index.d.ts +15 -0
  80. package/dist/components/atoms/toggle-group/toggle-group.d.ts +26 -1
  81. package/dist/components/atoms/toggle-group/toggle-group.js +15 -14
  82. package/dist/components/atoms/tooltip/tooltip.d.ts +53 -2
  83. package/dist/components/atoms/typography/typography.d.ts +18 -0
  84. package/dist/components/molecules/breadcrumb/breadcrumb.d.ts +50 -0
  85. package/dist/components/molecules/breadcrumb/breadcrumb.js +17 -17
  86. package/dist/components/molecules/dialog-content/dialog-content.d.ts +16 -0
  87. package/dist/components/molecules/dialog-footer/dialog-footer.d.ts +20 -0
  88. package/dist/components/molecules/dialog-header/dialog-header.d.ts +31 -0
  89. package/dist/components/molecules/empty/empty-icon.js +6 -6
  90. package/dist/components/molecules/empty/empty.d.ts +16 -1
  91. package/dist/components/molecules/empty/empty.js +37 -34
  92. package/dist/components/molecules/highlight-banner/highlight-banner.d.ts +17 -0
  93. package/dist/components/molecules/pagination/pagination.d.ts +49 -0
  94. package/dist/components/organisms/data-table/components/cells/data-table-list-cell.d.ts +41 -0
  95. package/dist/components/organisms/data-table/components/column-header/data-table-column-header-content.js +1 -1
  96. package/dist/components/organisms/data-table/components/column-header/data-table-column-header-menu.js +18 -18
  97. package/dist/components/organisms/data-table/components/column-header/data-table-column-header.d.ts +18 -0
  98. package/dist/components/organisms/data-table/components/column-header/data-table-column-header.js +10 -10
  99. package/dist/components/organisms/data-table/components/data-table-body.d.ts +18 -0
  100. package/dist/components/organisms/data-table/components/data-table-header.d.ts +12 -0
  101. package/dist/components/organisms/data-table/components/data-table-header.js +7 -7
  102. package/dist/components/organisms/data-table/components/states/data-table-loading.d.ts +24 -0
  103. package/dist/components/organisms/data-table/components/states/data-table-loading.js +6 -6
  104. package/dist/components/organisms/data-table/data-table.d.ts +133 -4
  105. package/dist/components/organisms/data-table/data-table.js +132 -100
  106. package/dist/components/organisms/data-table/data-table.types.d.ts +35 -26
  107. package/dist/components/organisms/data-table/hooks/use-data-table-columns.js +57 -41
  108. package/dist/components/organisms/data-table/hooks/use-data-table-state.d.ts +8 -2
  109. package/dist/components/organisms/data-table/hooks/use-data-table-state.js +82 -47
  110. package/dist/components/organisms/data-table/utils/data-table-constants.d.ts +8 -2
  111. package/dist/components/organisms/data-table/utils/data-table-constants.js +16 -10
  112. package/dist/components/organisms/data-table/utils/data-table-styles.d.ts +1652 -0
  113. package/dist/components/organisms/data-table/utils/data-table-styles.js +29 -14
  114. package/dist/components/organisms/dialog/dialog.d.ts +67 -1
  115. package/dist/components/organisms/dialog/dialog.js +78 -61
  116. package/dist/components/organisms/index.d.ts +2 -0
  117. package/dist/components/organisms/sheet/sheet.d.ts +69 -0
  118. package/dist/components/organisms/sheet/sheet.js +34 -33
  119. package/dist/components/organisms/tutorial/index.d.ts +2 -0
  120. package/dist/components/organisms/tutorial/tutorial.d.ts +16 -0
  121. package/dist/components/organisms/tutorial/tutorial.js +114 -0
  122. package/dist/components/organisms/tutorial/tutorial.types.d.ts +15 -0
  123. package/dist/hooks/index.d.ts +3 -0
  124. package/dist/hooks/use-body-scroll-lock.d.ts +13 -0
  125. package/dist/hooks/use-escape-key.d.ts +14 -0
  126. package/dist/hooks/use-media-query.d.ts +20 -0
  127. package/dist/hooks/use-media-query.js +21 -0
  128. package/dist/index.css +1 -1
  129. package/dist/index.d.ts +2 -0
  130. package/dist/index.js +173 -162
  131. package/dist/lib/notification-alert.d.ts +42 -0
  132. package/dist/lib/notification-alert.js +75 -0
  133. package/dist/node_modules/@phosphor-icons/react/dist/csr/File.es.js +8 -0
  134. package/dist/node_modules/@phosphor-icons/react/dist/csr/Microphone.es.js +8 -0
  135. package/dist/node_modules/@phosphor-icons/react/dist/csr/Stop.es.js +8 -0
  136. package/dist/node_modules/@phosphor-icons/react/dist/csr/Table.es.js +8 -0
  137. package/dist/node_modules/@phosphor-icons/react/dist/defs/File.es.js +30 -0
  138. package/dist/node_modules/@phosphor-icons/react/dist/defs/Microphone.es.js +36 -0
  139. package/dist/node_modules/@phosphor-icons/react/dist/defs/Stop.es.js +36 -0
  140. package/dist/node_modules/@phosphor-icons/react/dist/defs/Table.es.js +30 -0
  141. package/dist/vendor/shadcn/avatar.js +19 -19
  142. package/dist/vendor/shadcn/badge.js +15 -15
  143. package/dist/vendor/shadcn/card.js +7 -7
  144. package/dist/vendor/shadcn/date-picker.d.ts +2 -2
  145. package/dist/vendor/shadcn/date-picker.js +1 -1
  146. package/dist/vendor/shadcn/date-range-picker.d.ts +2 -2
  147. package/dist/vendor/shadcn/date-range-picker.js +1 -1
  148. package/dist/vendor/shadcn/dialog.js +2 -2
  149. package/dist/vendor/shadcn/input-group.js +17 -17
  150. package/dist/vendor/shadcn/input.js +7 -7
  151. package/dist/vendor/shadcn/popover.js +1 -1
  152. package/dist/vendor/shadcn/select.js +2 -2
  153. package/dist/vendor/shadcn/sonner.d.ts +26 -1
  154. package/dist/vendor/shadcn/sonner.js +12 -8
  155. package/dist/vendor/shadcn/table.js +30 -30
  156. package/dist/vendor/shadcn/textarea.js +9 -9
  157. package/dist/vendor/shadcn/time-picker.d.ts +1 -2
  158. package/dist/vendor/shadcn/time-picker.js +17 -23
  159. package/dist/vendor/shadcn/toggle.js +13 -13
  160. package/dist/vendor/shadcn/tooltip.js +25 -15
  161. package/package.json +1 -1
@@ -5,12 +5,41 @@ import { TooltipProps } from '../tooltip/tooltip';
5
5
  declare const iconVariants: (props?: ({
6
6
  size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
7
7
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
8
+ /**
9
+ * Props for the Icon component
10
+ */
8
11
  interface IconProps extends Omit<PhosphorIconProps, "size">, VariantProps<typeof iconVariants> {
12
+ /**
13
+ * Name of the Phosphor icon to render
14
+ */
9
15
  name: IconName;
16
+ /**
17
+ * Icon weight/style
18
+ * @default "light"
19
+ */
10
20
  weight?: PhosphorIconWeight;
21
+ /**
22
+ * Additional CSS classes
23
+ */
11
24
  className?: string;
25
+ /**
26
+ * Optional tooltip text to display on hover
27
+ */
12
28
  tooltip?: string;
29
+ /**
30
+ * Additional props to pass to the Tooltip component
31
+ */
13
32
  tooltipProps?: Partial<TooltipProps>;
14
33
  }
34
+ /**
35
+ * Icon component using Phosphor Icons with size variants and optional tooltip.
36
+ *
37
+ * @example
38
+ * ```tsx
39
+ * <Icon name="User" size="md" />
40
+ * <Icon name="CheckCircle" size="lg" weight="fill" color="green" />
41
+ * <Icon name="Info" tooltip="More information" />
42
+ * ```
43
+ */
15
44
  declare const Icon: import('react').ForwardRefExoticComponent<Omit<IconProps, "ref"> & import('react').RefAttributes<SVGSVGElement>>;
16
45
  export { Icon, type IconProps };
@@ -10,7 +10,7 @@ export { CurrencyField, type CurrencyFieldProps } from './currency-field';
10
10
  export { DatePicker, type DatePickerProps } from './date-picker';
11
11
  export { DateRangePicker, type DateRangePickerProps, } from './date-range-picker';
12
12
  export { TimePicker, type TimePickerProps } from './time-picker';
13
- export { FilterButton, FilterTag, FilterSection, FilterCheckboxOption, FilterRadioOption, FilterContent, FilterDateRange, FilterDateRangeOption, type FilterButtonProps, type FilterTagProps, type FilterSectionProps, type FilterCheckboxOptionProps, type FilterRadioOptionProps, type FilterContentProps, type FilterDateRangeProps, type FilterDateRangeOptionProps, } from './filter';
13
+ export { FilterButton, FilterTag, FilterSection, FilterCheckboxOption, FilterRadioOption, FilterContent, FilterDateRange, FilterDateRangeOption, FilterDateRangeValue, type FilterButtonProps, type FilterTagProps, type FilterSectionProps, type FilterCheckboxOptionProps, type FilterRadioOptionProps, type FilterContentProps, type FilterDateRangeProps, type FilterDateRangeOptionProps, } from './filter';
14
14
  export { FilterDropdown, FilterMenu, FilterMenuItem, type FilterDropdownProps, type FilterConfig, type FilterMenuProps, type FilterMenuItemProps, } from './filter-dropdown';
15
15
  export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, type DropdownMenuProps, type DropdownMenuPortalProps, type DropdownMenuTriggerProps, type DropdownMenuContentProps, type DropdownMenuGroupProps, type DropdownMenuLabelProps, type DropdownMenuItemProps, type DropdownMenuCheckboxItemProps, type DropdownMenuRadioGroupProps, type DropdownMenuRadioItemProps, type DropdownMenuSeparatorProps, type DropdownMenuShortcutProps, type DropdownMenuSubProps, type DropdownMenuSubTriggerProps, type DropdownMenuSubContentProps, } from './dropdown-menu';
16
16
  export { DotsMenu, type DotsMenuProps, type DotsMenuAction, type DotsMenuOptions, } from './dots-menu';
@@ -18,7 +18,7 @@ export { ToggleGroup, ToggleGroupItem, type ToggleGroupProps, type ToggleGroupIt
18
18
  export { Tooltip, TooltipProvider, type TooltipProps, type TooltipProviderProps, } from './tooltip';
19
19
  export { Field, type FieldProps } from './field';
20
20
  export { NavLink, type NavLinkProps } from './nav-link';
21
- export { Select, type SelectProps, type SelectOption, type SelectOptionGroup, } from './select';
21
+ export { Select, SearchSelect, type SelectProps, type SelectOption, type SelectOptionGroup, type SearchSelectProps, } from './select';
22
22
  export { Combobox, type ComboboxProps, type ComboboxOption } from './combobox';
23
23
  export { Link, type LinkProps } from './link';
24
24
  export { MultiValuesField, type MultiValuesFieldProps, type TriggerKey, } from './multi-values-field';
@@ -32,6 +32,7 @@ export { Switch, type SwitchProps } from './switch';
32
32
  export { Textarea, type TextareaProps } from './textarea';
33
33
  export { Typography, type TypographyProps } from './typography';
34
34
  export { Icon, type IconProps, type IconName } from './icon';
35
+ export { Loading, type LoadingProps } from './loading';
35
36
  export { OTPField, type OTPFieldProps } from './otp-field';
36
37
  export { PasswordField, type PasswordFieldProps } from './password-field';
37
38
  export { ProtectedField, type ProtectedFieldProps } from './protected-field';
@@ -1 +1 @@
1
- export { Label } from '../../../vendor/shadcn/label';
1
+ export { Label } from './label';
@@ -0,0 +1,11 @@
1
+ import { Label as ShadcnLabel } from '../../../vendor/shadcn/label';
2
+ import { ComponentProps } from 'react';
3
+ interface LabelProps extends ComponentProps<typeof ShadcnLabel> {
4
+ info?: string;
5
+ className?: string;
6
+ }
7
+ declare const Label: {
8
+ ({ htmlFor, className, info, ...props }: LabelProps): import("react/jsx-runtime").JSX.Element;
9
+ displayName: string;
10
+ };
11
+ export { Label };
@@ -0,0 +1,28 @@
1
+ import { j as e } from "../../../_virtual/jsx-runtime.js";
2
+ import { cn as o } from "../../../lib/utils.js";
3
+ import { Label as a } from "../../../vendor/shadcn/label.js";
4
+ import "react";
5
+ import { Icon as i } from "../icon/icon.js";
6
+ const l = ({ htmlFor: r, className: t, info: s, ...m }) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
7
+ /* @__PURE__ */ e.jsx(
8
+ a,
9
+ {
10
+ htmlFor: r,
11
+ className: o("text-sm leading-[18.39px] cursor-pointer", t),
12
+ ...m
13
+ }
14
+ ),
15
+ s && /* @__PURE__ */ e.jsx(
16
+ i,
17
+ {
18
+ name: "Info",
19
+ size: "sm",
20
+ className: "text-muted-foreground",
21
+ tooltip: s
22
+ }
23
+ )
24
+ ] });
25
+ l.displayName = "Label";
26
+ export {
27
+ l as Label
28
+ };
@@ -1,7 +1,27 @@
1
1
  import { ComponentProps } from 'react';
2
+ /**
3
+ * Props for the Link component
4
+ */
2
5
  interface LinkProps extends ComponentProps<"a"> {
6
+ /**
7
+ * Whether to show underline decoration
8
+ * @default true
9
+ */
3
10
  underline?: boolean;
11
+ /**
12
+ * When true, renders as Slot to merge props with child element
13
+ * @default false
14
+ */
4
15
  asChild?: boolean;
5
16
  }
17
+ /**
18
+ * Styled anchor link component with optional underline.
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * <Link href="/about">About Us</Link>
23
+ * <Link href="/terms" underline={false}>Terms</Link>
24
+ * ```
25
+ */
6
26
  declare const Link: import('react').ForwardRefExoticComponent<Omit<LinkProps, "ref"> & import('react').RefAttributes<HTMLAnchorElement>>;
7
27
  export { Link, type LinkProps };
@@ -0,0 +1 @@
1
+ export { Loading, type LoadingProps } from './loading';
@@ -0,0 +1,39 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ import { IconWeight as PhosphorIconWeight } from '@phosphor-icons/react';
3
+ declare const loadingVariants: (props?: ({
4
+ size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
5
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
6
+ /**
7
+ * Props for the Loading component
8
+ */
9
+ interface LoadingProps extends VariantProps<typeof loadingVariants> {
10
+ /**
11
+ * Icon weight/style
12
+ * @default "light"
13
+ */
14
+ weight?: PhosphorIconWeight;
15
+ /**
16
+ * Custom color for the loading icon
17
+ */
18
+ color?: string;
19
+ /**
20
+ * Additional CSS classes
21
+ */
22
+ className?: string;
23
+ /**
24
+ * Whether the loading icon should be mirrored
25
+ */
26
+ mirrored?: boolean;
27
+ }
28
+ /**
29
+ * Loading component that displays an animated spinning icon.
30
+ *
31
+ * @example
32
+ * ```tsx
33
+ * <Loading size="md" />
34
+ * <Loading size="lg" color="#3b82f6" />
35
+ * <Loading weight="bold" className="text-primary" />
36
+ * ```
37
+ */
38
+ declare const Loading: import('react').ForwardRefExoticComponent<LoadingProps & import('react').RefAttributes<SVGSVGElement>>;
39
+ export { Loading, type LoadingProps };
@@ -0,0 +1,37 @@
1
+ import { j as n } from "../../../_virtual/jsx-runtime.js";
2
+ import { forwardRef as e } from "react";
3
+ import { cva as d } from "../../../node_modules/class-variance-authority/dist/index.js";
4
+ import { cn as f } from "../../../lib/utils.js";
5
+ import { Icon as l } from "../icon/icon.js";
6
+ const p = d("animate-spin", {
7
+ variants: {
8
+ size: {
9
+ xs: "",
10
+ sm: "",
11
+ md: "",
12
+ lg: "",
13
+ xl: ""
14
+ }
15
+ },
16
+ defaultVariants: {
17
+ size: "md"
18
+ }
19
+ }), c = e(
20
+ ({ size: a = "md", weight: o = "light", color: r, className: m, mirrored: i = !1, ...t }, s) => /* @__PURE__ */ n.jsx(
21
+ l,
22
+ {
23
+ ref: s,
24
+ name: "CircleNotch",
25
+ size: a,
26
+ weight: o,
27
+ color: r,
28
+ mirrored: i,
29
+ className: f(p({ size: a }), m),
30
+ ...t
31
+ }
32
+ )
33
+ );
34
+ c.displayName = "Loading";
35
+ export {
36
+ c as Loading
37
+ };
@@ -16,7 +16,7 @@ export interface MultiSelectProps {
16
16
  /**
17
17
  * Callback fired when selection changes
18
18
  */
19
- onValueChange?: (value: string[]) => void;
19
+ onChange?: (value: string[]) => void;
20
20
  /**
21
21
  * Placeholder text when no items are selected
22
22
  */
@@ -10,7 +10,7 @@ const D = c.forwardRef(
10
10
  ({
11
11
  options: m,
12
12
  value: s = [],
13
- onValueChange: l,
13
+ onChange: l,
14
14
  placeholder: b = "Select items...",
15
15
  searchPlaceholder: w = "Search...",
16
16
  emptyMessage: N = "No results found.",
@@ -23,10 +23,10 @@ const D = c.forwardRef(
23
23
  showBadges: x = !0,
24
24
  allowClear: y = !0
25
25
  }, k) => {
26
- const [h, S] = c.useState(!1), [p, L] = c.useState(""), P = (t) => {
26
+ const [h, S] = c.useState(!1), [p, V] = c.useState(""), L = (t) => {
27
27
  const r = s.includes(t) ? s.filter((d) => d !== t) : [...s, t];
28
28
  l?.(r);
29
- }, V = (t, r) => {
29
+ }, P = (t, r) => {
30
30
  r?.preventDefault(), r?.stopPropagation();
31
31
  const d = s.filter((R) => R !== t);
32
32
  l?.(d);
@@ -64,7 +64,7 @@ const D = c.forwardRef(
64
64
  {
65
65
  type: "button",
66
66
  className: "ml-1 rounded-full outline-hidden hover:bg-muted-foreground/20",
67
- onClick: (r) => V(t.value, r),
67
+ onClick: (r) => P(t.value, r),
68
68
  children: /* @__PURE__ */ e.jsx(g, { className: "h-3 w-3" })
69
69
  }
70
70
  )
@@ -120,7 +120,7 @@ const D = c.forwardRef(
120
120
  {
121
121
  placeholder: w,
122
122
  value: p,
123
- onValueChange: L
123
+ onValueChange: V
124
124
  }
125
125
  ),
126
126
  /* @__PURE__ */ e.jsx(I, { children: N }),
@@ -131,7 +131,7 @@ const D = c.forwardRef(
131
131
  {
132
132
  value: t.value,
133
133
  onSelect: () => {
134
- P(t.value);
134
+ L(t.value);
135
135
  },
136
136
  children: [
137
137
  /* @__PURE__ */ e.jsx(
@@ -1,3 +1,19 @@
1
1
  import { MultiValuesFieldProps } from './multi-values-field.types';
2
+ /**
3
+ * Multi-value input field for adding/removing multiple string values as badges.
4
+ * Features keyboard shortcuts, validation, duplicate detection, and max items limit.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * <MultiValuesField
9
+ * label="Email addresses"
10
+ * value={emails}
11
+ * onChange={setEmails}
12
+ * validate={(value) => /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(value) || "Invalid email"}
13
+ * maxItems={5}
14
+ * allowDuplicates={false}
15
+ * />
16
+ * ```
17
+ */
2
18
  declare const MultiValuesField: import('react').ForwardRefExoticComponent<MultiValuesFieldProps & import('react').RefAttributes<HTMLInputElement>>;
3
19
  export { MultiValuesField };
@@ -1,136 +1,158 @@
1
- import { j as n } from "../../../_virtual/jsx-runtime.js";
2
- import { forwardRef as q, useId as z, useState as g } from "react";
3
- import { cn as b } from "../../../lib/utils.js";
4
- import { Field as G, FieldLabel as H, FieldDescription as J, FieldError as K } from "../../../vendor/shadcn/field.js";
5
- import { Badge as O } from "../badge/badge.js";
6
- const Q = q(
1
+ import { j as r } from "../../../_virtual/jsx-runtime.js";
2
+ import { forwardRef as O, useId as Q, useState as b } from "react";
3
+ import { cn as y } from "../../../lib/utils.js";
4
+ import { Field as U, FieldLabel as W, FieldDescription as Y, FieldError as Z } from "../../../vendor/shadcn/field.js";
5
+ import { Badge as E } from "../badge/badge.js";
6
+ import { Icon as _ } from "../icon/icon.js";
7
+ const A = O(
7
8
  ({
8
9
  value: t = [],
9
- onChange: d,
10
+ onChange: p,
10
11
  label: w,
11
- description: c,
12
- error: y,
13
- placeholder: j = "Type and press Enter...",
14
- disabled: u = !1,
15
- id: v,
12
+ description: f,
13
+ error: k,
14
+ placeholder: v = "Type and press Enter...",
15
+ disabled: l = !1,
16
+ id: C,
16
17
  name: V,
17
- triggerKeys: p = ["Enter", "Tab", "Comma"],
18
+ triggerKeys: c = ["Enter", "Tab", "Comma", "Space"],
18
19
  addOnBlur: B = !0,
19
- allowDuplicates: D = !1,
20
- maxItems: f,
21
- validate: k,
22
- badgeVariant: I = "outline",
23
- orientation: N = "vertical",
24
- className: $
25
- }, C) => {
26
- const T = z(), o = v || T, m = !!y, [h, E] = g(""), [R, F] = g(!1), [x, i] = g(""), s = (e) => {
27
- const r = e.trim();
28
- if (r !== "") {
29
- if (f && t.length >= f) {
30
- i(`Maximum ${f} items allowed`);
20
+ allowDuplicates: I = !1,
21
+ maxItems: m,
22
+ validate: j,
23
+ badgeVariant: N = "outline",
24
+ orientation: $ = "vertical",
25
+ className: T,
26
+ deleteAll: a
27
+ }, R) => {
28
+ const M = Q(), o = C || M, h = !!k, [x, D] = b(""), [S, F] = b(!1), [g, i] = b(""), s = (e) => {
29
+ const n = e.trim();
30
+ if (n !== "") {
31
+ if (m && t.length >= m) {
32
+ i(`Maximum ${m} items allowed`);
31
33
  return;
32
34
  }
33
- if (!D && t.includes(r)) {
35
+ if (!I && t.includes(n)) {
34
36
  i("Duplicate values are not allowed");
35
37
  return;
36
38
  }
37
- if (k) {
38
- const l = k(r);
39
- if (l !== !0) {
39
+ if (j) {
40
+ const d = j(n);
41
+ if (d !== !0) {
40
42
  i(
41
- typeof l == "string" ? l : "Invalid value"
43
+ typeof d == "string" ? d : "Invalid value"
42
44
  );
43
45
  return;
44
46
  }
45
47
  }
46
- i(""), d([...t, r]), E("");
48
+ i(""), p([...t, n]), D("");
47
49
  }
48
- }, M = (e) => {
49
- d(t.filter((r) => r !== e)), i("");
50
50
  }, P = (e) => {
51
- const r = e.currentTarget.value;
52
- e.key === "Enter" && p.includes("Enter") ? (e.preventDefault(), s(r)) : e.key === "Tab" && p.includes("Tab") ? r.trim() !== "" && (e.preventDefault(), s(r)) : (e.key === "," || e.key === ",") && p.includes("Comma") ? (e.preventDefault(), s(r)) : e.key === "Backspace" && r === "" && t.length > 0 && d(t.slice(0, -1));
53
- }, A = (e) => {
54
- E(e.target.value), i("");
55
- }, L = () => {
51
+ p(t.filter((n) => n !== e)), i("");
52
+ }, L = (e) => {
53
+ const n = e.currentTarget.value;
54
+ e.key === "Enter" && c.includes("Enter") ? (e.preventDefault(), s(n)) : e.key === "Tab" && c.includes("Tab") ? n.trim() !== "" && (e.preventDefault(), s(n)) : (e.key === "," || e.key === ",") && c.includes("Comma") || e.key === " " && c.includes("Space") ? (e.preventDefault(), s(n)) : e.key === "Backspace" && n === "" && t.length > 0 && p(t.slice(0, -1));
55
+ }, X = (e) => {
56
+ D(e.target.value), i("");
57
+ }, q = () => {
56
58
  F(!0);
57
- }, S = () => {
58
- F(!1), B && h.trim() !== "" && s(h);
59
- }, X = (e, r) => {
60
- e.preventDefault(), e.stopPropagation(), M(r);
61
- }, a = y || x;
62
- return /* @__PURE__ */ n.jsxs(
63
- G,
59
+ }, z = () => {
60
+ F(!1), B && x.trim() !== "" && s(x);
61
+ }, G = (e, n) => {
62
+ e.preventDefault(), e.stopPropagation(), P(n);
63
+ }, H = () => {
64
+ l || !a?.onClick || a.onClick();
65
+ }, u = k || g;
66
+ return /* @__PURE__ */ r.jsxs(
67
+ U,
64
68
  {
65
- orientation: N,
66
- "data-invalid": m,
67
- className: b("w-full", $),
69
+ orientation: $,
70
+ "data-invalid": h,
71
+ className: y("w-full", T),
68
72
  children: [
69
- w && /* @__PURE__ */ n.jsx(H, { htmlFor: o, children: w }),
70
- /* @__PURE__ */ n.jsxs("div", { className: "flex flex-col gap-2 flex-1", children: [
71
- /* @__PURE__ */ n.jsxs(
73
+ w && /* @__PURE__ */ r.jsx(W, { htmlFor: o, children: w }),
74
+ /* @__PURE__ */ r.jsxs("div", { className: "flex flex-col gap-2 flex-1", children: [
75
+ /* @__PURE__ */ r.jsxs(
72
76
  "div",
73
77
  {
74
- className: b(
75
- "font-normal file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex min-h-9 w-full min-w-0 rounded-md border bg-white px-3 py-1.5 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 text-sm",
78
+ className: y(
79
+ "font-normal file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex min-h-9 w-full min-w-0 rounded-md border bg-background px-3 py-1.5 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 text-sm",
76
80
  "flex-wrap gap-1.5 items-center",
77
- R && "border-ring ring-ring/50 ring-[3px]",
78
- (m || x) && "border-destructive ring-destructive/20 dark:ring-destructive/40",
79
- u && "opacity-50 cursor-not-allowed"
81
+ S && "border-ring ring-ring/50 ring-[3px]",
82
+ (h || g) && "border-destructive ring-destructive/20 dark:ring-destructive/40",
83
+ l && "opacity-50 cursor-not-allowed"
80
84
  ),
81
85
  onClick: () => {
82
- u || document.getElementById(o)?.focus();
86
+ l || document.getElementById(o)?.focus();
83
87
  },
84
88
  children: [
85
- t.map((e, r) => /* @__PURE__ */ n.jsx(
86
- O,
87
- {
88
- variant: I,
89
- endIcon: "X",
90
- className: "m-0 cursor-pointer",
91
- onClick: (l) => X(l, e),
92
- endIconProps: {
93
- className: "cursor-pointer hover:text-destructive transition-colors"
94
- },
95
- children: e
96
- },
97
- `${e}-${r}`
98
- )),
99
- /* @__PURE__ */ n.jsx(
89
+ (() => {
90
+ const e = a && !l && t.length >= a.length;
91
+ return /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
92
+ e && /* @__PURE__ */ r.jsx(
93
+ "div",
94
+ {
95
+ onClick: (n) => {
96
+ n.preventDefault(), n.stopPropagation(), H();
97
+ },
98
+ children: /* @__PURE__ */ r.jsx(
99
+ E,
100
+ {
101
+ variant: "secondary",
102
+ className: "gap-1 cursor-pointer flex items-center",
103
+ children: a.label || "Delete all"
104
+ }
105
+ )
106
+ }
107
+ ),
108
+ t.map((n, d) => /* @__PURE__ */ r.jsxs(E, { variant: N, children: [
109
+ n,
110
+ /* @__PURE__ */ r.jsx(
111
+ "button",
112
+ {
113
+ type: "button",
114
+ onClick: (J) => G(J, n),
115
+ children: /* @__PURE__ */ r.jsx(_, { name: "X", className: "h-3 w-3" })
116
+ }
117
+ )
118
+ ] }, `${n}-${d}`))
119
+ ] });
120
+ })(),
121
+ /* @__PURE__ */ r.jsx(
100
122
  "input",
101
123
  {
102
- ref: C,
124
+ ref: R,
103
125
  id: o,
104
126
  name: V,
105
127
  type: "text",
106
- value: h,
107
- onChange: A,
108
- onKeyDown: P,
109
- onFocus: L,
110
- onBlur: S,
111
- placeholder: t.length === 0 ? j : "",
112
- disabled: u,
113
- className: b(
128
+ value: x,
129
+ onChange: X,
130
+ onKeyDown: L,
131
+ onFocus: q,
132
+ onBlur: z,
133
+ placeholder: t.length === 0 ? v : "",
134
+ disabled: l,
135
+ className: y(
114
136
  "flex-1 min-w-[120px] outline-none bg-transparent border-none shadow-none p-0 h-6",
115
137
  "placeholder:text-muted-foreground",
116
138
  "disabled:cursor-not-allowed"
117
139
  ),
118
- "aria-invalid": m || !!x,
119
- "aria-describedby": c || a ? `${o}-description` : void 0
140
+ "aria-invalid": h || !!g,
141
+ "aria-describedby": f || u ? `${o}-description` : void 0
120
142
  }
121
143
  )
122
144
  ]
123
145
  }
124
146
  ),
125
- c && !a && /* @__PURE__ */ n.jsx(J, { id: `${o}-description`, children: c }),
126
- a && /* @__PURE__ */ n.jsx(K, { id: `${o}-description`, children: a })
147
+ f && !u && /* @__PURE__ */ r.jsx(Y, { id: `${o}-description`, children: f }),
148
+ u && /* @__PURE__ */ r.jsx(Z, { id: `${o}-description`, children: u })
127
149
  ] })
128
150
  ]
129
151
  }
130
152
  );
131
153
  }
132
154
  );
133
- Q.displayName = "MultiValuesField";
155
+ A.displayName = "MultiValuesField";
134
156
  export {
135
- Q as MultiValuesField
157
+ A as MultiValuesField
136
158
  };
@@ -1,20 +1,101 @@
1
+ /**
2
+ * Keyboard keys that trigger adding a value
3
+ */
1
4
  export type TriggerKey = "Enter" | "Tab" | "Comma";
5
+ /**
6
+ * Props for the MultiValuesField component
7
+ */
2
8
  export interface MultiValuesFieldProps {
9
+ /**
10
+ * Current array of values
11
+ */
3
12
  value: string[];
13
+ /**
14
+ * Callback fired when the values array changes
15
+ */
4
16
  onChange: (values: string[]) => void;
17
+ /**
18
+ * Label text displayed above the input
19
+ */
5
20
  label?: string;
21
+ /**
22
+ * Helper text displayed below the input
23
+ */
6
24
  description?: string;
25
+ /**
26
+ * Error message displayed below the input
27
+ */
7
28
  error?: string;
29
+ /**
30
+ * Placeholder text for the input
31
+ * @default "Type and press Enter..."
32
+ */
8
33
  placeholder?: string;
34
+ /**
35
+ * Whether the field is disabled
36
+ * @default false
37
+ */
9
38
  disabled?: boolean;
39
+ /**
40
+ * HTML id attribute
41
+ */
10
42
  id?: string;
43
+ /**
44
+ * HTML name attribute
45
+ */
11
46
  name?: string;
47
+ /**
48
+ * Keys that trigger adding a new value
49
+ * @default ["Enter", "Tab", "Comma"]
50
+ */
12
51
  triggerKeys?: TriggerKey[];
52
+ /**
53
+ * Whether to add value when input loses focus
54
+ * @default true
55
+ */
13
56
  addOnBlur?: boolean;
57
+ /**
58
+ * Whether to allow duplicate values
59
+ * @default false
60
+ */
14
61
  allowDuplicates?: boolean;
62
+ /**
63
+ * Maximum number of values allowed
64
+ */
15
65
  maxItems?: number;
66
+ /**
67
+ * Validation function that returns true or an error message
68
+ */
16
69
  validate?: (value: string) => boolean | string;
70
+ /**
71
+ * Visual variant for the value badges
72
+ * @default "outline"
73
+ */
17
74
  badgeVariant?: "default" | "secondary" | "destructive" | "outline";
75
+ /**
76
+ * Layout orientation
77
+ * @default "vertical"
78
+ */
18
79
  orientation?: "vertical" | "horizontal";
80
+ /**
81
+ * Additional CSS classes
82
+ */
19
83
  className?: string;
84
+ /**
85
+ * Configuration for "Delete All" chip functionality
86
+ */
87
+ deleteAll?: {
88
+ /**
89
+ * Label for the delete all chip
90
+ */
91
+ label?: string;
92
+ /**
93
+ * Minimum number of selected items to show delete all
94
+ */
95
+ length: number;
96
+ /**
97
+ * Callback fired when delete all is clicked
98
+ */
99
+ onClick: () => void;
100
+ };
20
101
  }