@payfit/unity-components 3.23.15 → 3.23.17

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 (49) hide show
  1. package/dist/esm/ai-kit.js +19 -9
  2. package/dist/esm/core/components/radio-button-group/parts/RadioButton.js +9 -9
  3. package/dist/esm/core/components/select-list/SelectList.context.d.ts +9 -0
  4. package/dist/esm/core/components/select-list/SelectList.context.js +11 -0
  5. package/dist/esm/core/components/select-list/SelectList.d.ts +18 -3
  6. package/dist/esm/core/components/select-list/SelectList.js +71 -62
  7. package/dist/esm/core/components/select-list/hooks/useSelectedFirstSorting.js +11 -4
  8. package/dist/esm/core/components/select-list/parts/SelectListOption.d.ts +15 -0
  9. package/dist/esm/core/components/select-list/parts/SelectListOption.js +74 -35
  10. package/dist/esm/core/components/select-list/parts/SelectedItemsSection.d.ts +3 -1
  11. package/dist/esm/core/components/select-list/parts/SelectedItemsSection.js +17 -21
  12. package/dist/esm/core/index.js +62 -62
  13. package/dist/esm/index.js +62 -62
  14. package/dist/esm/modules/ai-kit/components/ai-structured-input/AIStructuredInput.context.d.ts +30 -0
  15. package/dist/esm/modules/ai-kit/components/ai-structured-input/AIStructuredInput.context.js +5 -0
  16. package/dist/esm/modules/ai-kit/components/ai-structured-input/AIStructuredInput.d.ts +46 -0
  17. package/dist/esm/modules/ai-kit/components/ai-structured-input/AIStructuredInput.js +122 -0
  18. package/dist/esm/modules/ai-kit/components/ai-structured-input/form/TanstackAIStructuredInputAnswersField.d.ts +48 -0
  19. package/dist/esm/modules/ai-kit/components/ai-structured-input/form/TanstackAIStructuredInputAnswersField.js +62 -0
  20. package/dist/esm/modules/ai-kit/components/ai-structured-input/form/TanstackAIStructuredInputForm.d.ts +5 -0
  21. package/dist/esm/modules/ai-kit/components/ai-structured-input/form/TanstackAIStructuredInputForm.js +21 -0
  22. package/dist/esm/modules/ai-kit/components/ai-structured-input/hooks/use-ai-structured-input-navigation.d.ts +89 -0
  23. package/dist/esm/modules/ai-kit/components/ai-structured-input/hooks/use-ai-structured-input-navigation.js +39 -0
  24. package/dist/esm/modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputActions.d.ts +25 -0
  25. package/dist/esm/modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputActions.js +14 -0
  26. package/dist/esm/modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputAnswer.d.ts +15 -0
  27. package/dist/esm/modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputAnswer.js +50 -0
  28. package/dist/esm/modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputAnswers.context.d.ts +8 -0
  29. package/dist/esm/modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputAnswers.context.js +8 -0
  30. package/dist/esm/modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputAnswers.d.ts +73 -0
  31. package/dist/esm/modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputAnswers.js +30 -0
  32. package/dist/esm/modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputContent.d.ts +24 -0
  33. package/dist/esm/modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputContent.js +13 -0
  34. package/dist/esm/modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputFreeTextAnswer.d.ts +28 -0
  35. package/dist/esm/modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputFreeTextAnswer.js +125 -0
  36. package/dist/esm/modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputHeader.d.ts +43 -0
  37. package/dist/esm/modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputHeader.js +42 -0
  38. package/dist/esm/modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputStep.d.ts +43 -0
  39. package/dist/esm/modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputStep.js +14 -0
  40. package/dist/esm/modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputStepTitle.d.ts +43 -0
  41. package/dist/esm/modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputStepTitle.js +78 -0
  42. package/dist/esm/modules/ai-kit/hooks/use-ai-kit-form.d.ts +198 -1
  43. package/dist/esm/modules/ai-kit/hooks/use-ai-kit-form.js +11 -5
  44. package/dist/esm/modules/ai-kit/index.d.ts +12 -0
  45. package/i18n/en-GB.json +10 -1
  46. package/i18n/es-ES.json +10 -1
  47. package/i18n/fr-FR.json +10 -1
  48. package/package.json +6 -6
  49. package/src/agent-references/component-catalog.json +24 -0
@@ -17,12 +17,22 @@ import { AIComposerActions as g } from "./modules/ai-kit/components/ai-composer/
17
17
  import { AIComposerAlert as _ } from "./modules/ai-kit/components/ai-composer/parts/AIComposerAlert.js";
18
18
  import { AIComposerSubmitAction as v } from "./modules/ai-kit/components/ai-composer/parts/AIComposerSubmitAction.js";
19
19
  import { AIComposerTextArea as y } from "./modules/ai-kit/components/ai-composer/parts/AIComposerTextArea.js";
20
- import { useAIKitFieldContext as b, useAIKitFormContext as x } from "./modules/ai-kit/hooks/ai-kit-form-context.js";
21
- import { aiKitForm as S, useAIKitForm as C } from "./modules/ai-kit/hooks/use-ai-kit-form.js";
22
- import { AIChatEventFeedback as w } from "./modules/ai-kit/components/aichat-event-feedback/AIChatEventFeedback.js";
23
- import { AIOutcomeCardIcon as T } from "./modules/ai-kit/components/ai-outcome-card/parts/AIOutcomeCardIcon.js";
24
- import { AIOutcomeCardTitle as E } from "./modules/ai-kit/components/ai-outcome-card/parts/AIOutcomeCardTitle.js";
25
- import { AIOutcomeCardDescription as D } from "./modules/ai-kit/components/ai-outcome-card/parts/AIOutcomeCardDescription.js";
26
- import { AIOutcomeCardActions as O } from "./modules/ai-kit/components/ai-outcome-card/parts/AIOutcomeCardActions.js";
27
- import { AIOutcomeCardAction as k } from "./modules/ai-kit/components/ai-outcome-card/parts/AIOutcomeCardAction.js";
28
- export { r as AIButton, w as AIChatEventFeedback, m as AIComposer, h as AIComposerAction, g as AIComposerActions, _ as AIComposerAlert, f as AIComposerAttachment, p as AIComposerAttachmentsGroup, v as AIComposerSubmitAction, y as AIComposerTextArea, k as AIOutcomeCardAction, O as AIOutcomeCardActions, D as AIOutcomeCardDescription, T as AIOutcomeCardIcon, E as AIOutcomeCardTitle, i as AIProposalCard, l as AIProposalCardActions, c as AIProposalCardContent, a as AIProposalCardHeader, o as AIProposalCardSubtitle, s as AIProposalCardTitle, d as AITriggerButton, u as PayfitAIBrand, e as RawAIOutcomeCard, t as aiGradientEffect, n as aiGradientSurfaceEffect, S as aiKitForm, b as useAIKitFieldContext, C as useAIKitForm, x as useAIKitFormContext };
20
+ import { AIStructuredInputStep as b } from "./modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputStep.js";
21
+ import { AIStructuredInput as x } from "./modules/ai-kit/components/ai-structured-input/AIStructuredInput.js";
22
+ import { AIStructuredInputAnswers as S } from "./modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputAnswers.js";
23
+ import { AIStructuredInputAnswer as C } from "./modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputAnswer.js";
24
+ import { AIStructuredInputFreeTextAnswer as w } from "./modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputFreeTextAnswer.js";
25
+ import { AIStructuredInputStepTitle as T } from "./modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputStepTitle.js";
26
+ import { useAIStructuredInputNavigation as E } from "./modules/ai-kit/components/ai-structured-input/hooks/use-ai-structured-input-navigation.js";
27
+ import { useAIKitFieldContext as D, useAIKitFormContext as O } from "./modules/ai-kit/hooks/ai-kit-form-context.js";
28
+ import { aiKitForm as k, useAIKitForm as A } from "./modules/ai-kit/hooks/use-ai-kit-form.js";
29
+ import { AIChatEventFeedback as j } from "./modules/ai-kit/components/aichat-event-feedback/AIChatEventFeedback.js";
30
+ import { AIOutcomeCardIcon as M } from "./modules/ai-kit/components/ai-outcome-card/parts/AIOutcomeCardIcon.js";
31
+ import { AIOutcomeCardTitle as N } from "./modules/ai-kit/components/ai-outcome-card/parts/AIOutcomeCardTitle.js";
32
+ import { AIOutcomeCardDescription as P } from "./modules/ai-kit/components/ai-outcome-card/parts/AIOutcomeCardDescription.js";
33
+ import { AIOutcomeCardActions as F } from "./modules/ai-kit/components/ai-outcome-card/parts/AIOutcomeCardActions.js";
34
+ import { AIOutcomeCardAction as I } from "./modules/ai-kit/components/ai-outcome-card/parts/AIOutcomeCardAction.js";
35
+ import { AIStructuredInputContent as L } from "./modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputContent.js";
36
+ import { AIStructuredInputActions as R } from "./modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputActions.js";
37
+ import { AIStructuredInputHeader as z } from "./modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputHeader.js";
38
+ export { r as AIButton, j as AIChatEventFeedback, m as AIComposer, h as AIComposerAction, g as AIComposerActions, _ as AIComposerAlert, f as AIComposerAttachment, p as AIComposerAttachmentsGroup, v as AIComposerSubmitAction, y as AIComposerTextArea, I as AIOutcomeCardAction, F as AIOutcomeCardActions, P as AIOutcomeCardDescription, M as AIOutcomeCardIcon, N as AIOutcomeCardTitle, i as AIProposalCard, l as AIProposalCardActions, c as AIProposalCardContent, a as AIProposalCardHeader, o as AIProposalCardSubtitle, s as AIProposalCardTitle, x as AIStructuredInput, R as AIStructuredInputActions, C as AIStructuredInputAnswer, S as AIStructuredInputAnswers, L as AIStructuredInputContent, w as AIStructuredInputFreeTextAnswer, z as AIStructuredInputHeader, b as AIStructuredInputStep, T as AIStructuredInputStepTitle, d as AITriggerButton, u as PayfitAIBrand, e as RawAIOutcomeCard, t as aiGradientEffect, n as aiGradientSurfaceEffect, k as aiKitForm, D as useAIKitFieldContext, A as useAIKitForm, O as useAIKitFormContext, E as useAIStructuredInputNavigation };
@@ -1,7 +1,7 @@
1
1
  import { Text as e } from "../../text/Text.js";
2
- import { Flex as t } from "../../flex/Flex.js";
3
- import { RadioButtonHelper as n } from "./RadioButtonHelper.js";
4
- import { RadioIndicator as r } from "./RadioIndicator.js";
2
+ import { RadioIndicator as t } from "./RadioIndicator.js";
3
+ import { Flex as n } from "../../flex/Flex.js";
4
+ import { RadioButtonHelper as r } from "./RadioButtonHelper.js";
5
5
  import { forwardRef as i, useContext as a } from "react";
6
6
  import { uyTv as o } from "@payfit/unity-themes";
7
7
  import { jsx as s, jsxs as c } from "react/jsx-runtime";
@@ -30,7 +30,7 @@ var f = o({ slots: {
30
30
  ]
31
31
  } }), p = i(({ children: i, value: o, isDisabled: p, helperText: m, ...h }, g) => {
32
32
  let { base: _, label: v, container: y, radio: b } = f(), x = a(d), S = x?.isReadOnly ? "readonly" : x?.isDisabled || p ? "disabled" : x?.isInvalid ? "invalid" : "enabled";
33
- return /* @__PURE__ */ c(t, {
33
+ return /* @__PURE__ */ c(n, {
34
34
  direction: "col",
35
35
  gap: "50",
36
36
  className: y(),
@@ -39,11 +39,11 @@ var f = o({ slots: {
39
39
  value: o,
40
40
  isDisabled: p,
41
41
  className: "uy:contents",
42
- children: ({ isSelected: t }) => /* @__PURE__ */ c(l, {
42
+ children: ({ isSelected: n }) => /* @__PURE__ */ c(l, {
43
43
  ref: g,
44
44
  className: () => _(),
45
- children: [/* @__PURE__ */ s(r, {
46
- isSelected: t,
45
+ children: [/* @__PURE__ */ s(t, {
46
+ isSelected: n,
47
47
  state: S,
48
48
  className: b()
49
49
  }), /* @__PURE__ */ s(e, {
@@ -52,9 +52,9 @@ var f = o({ slots: {
52
52
  children: i
53
53
  })]
54
54
  })
55
- }), m ? /* @__PURE__ */ s(n, { children: m }) : null]
55
+ }), m ? /* @__PURE__ */ s(r, { children: m }) : null]
56
56
  });
57
57
  });
58
58
  p.displayName = "RadioButton";
59
59
  //#endregion
60
- export { p as RadioButton, r as RadioIndicator, f as radioButton };
60
+ export { p as RadioButton, t as RadioIndicator, f as radioButton };
@@ -0,0 +1,9 @@
1
+ export type SelectListIndicatorPosition = 'start' | 'end';
2
+ export type SelectListSelectionMode = 'single' | 'multiple';
3
+ interface SelectListContextValue {
4
+ selectionMode: SelectListSelectionMode;
5
+ indicatorPosition: SelectListIndicatorPosition;
6
+ }
7
+ export declare const SelectListContextProvider: import('react').Provider<SelectListContextValue>;
8
+ export declare function useSelectListContext(): SelectListContextValue;
9
+ export {};
@@ -0,0 +1,11 @@
1
+ import { createContext as e, useContext as t } from "react";
2
+ //#region src/core/components/select-list/SelectList.context.tsx
3
+ var n = e({
4
+ selectionMode: "multiple",
5
+ indicatorPosition: "start"
6
+ }), r = n.Provider;
7
+ function i() {
8
+ return t(n);
9
+ }
10
+ //#endregion
11
+ export { r as SelectListContextProvider, i as useSelectListContext };
@@ -1,10 +1,11 @@
1
1
  import { JSX, Ref } from 'react';
2
2
  import { ListBoxProps as AriaListBoxProps } from 'react-aria-components/ListBox';
3
+ import { SelectListSelectionMode, SelectListIndicatorPosition } from './SelectList.context.js';
3
4
  /**
4
5
  * Props for the SelectList component.
5
6
  * @template TType - The type of items in the list
6
7
  */
7
- export interface SelectListProps<TType extends object = object> extends Omit<AriaListBoxProps<TType>, 'className' | 'style' | 'selectedKeys' | 'onSelectionChange' | 'children'> {
8
+ export interface SelectListProps<TType extends object = object> extends Omit<AriaListBoxProps<TType>, 'className' | 'style' | 'selectedKeys' | 'onSelectionChange' | 'children' | 'selectionMode'> {
8
9
  /**
9
10
  * An iterable data structure containing items to render in the list.
10
11
  */
@@ -22,6 +23,12 @@ export interface SelectListProps<TType extends object = object> extends Omit<Ari
22
23
  * @param keys - The new selection as a `Selection` type (Set of keys or "all")
23
24
  */
24
25
  onChange: AriaListBoxProps<TType>['onSelectionChange'];
26
+ /**
27
+ * The type of selection allowed in the list. Omission currently defaults to `multiple`.
28
+ * In Unity v4, this prop will be required and will have no default.
29
+ * @default 'multiple'
30
+ */
31
+ selectionMode?: SelectListSelectionMode;
25
32
  /**
26
33
  * Controls whether to display a search input at the top of the list. Set to `true` to always show the search bar, or `false` to never show it. When undefined, the search bar appears automatically when there are 10 or more items.
27
34
  * @default undefined - Auto-shows when items >= 10
@@ -42,6 +49,8 @@ export interface SelectListProps<TType extends object = object> extends Omit<Ari
42
49
  * Additional CSS classes to apply to the list container. Use this to customize height or other container styles.
43
50
  */
44
51
  className?: string;
52
+ /** Additional CSS classes to apply to the outer list wrapper. */
53
+ wrapperClassName?: string;
45
54
  /**
46
55
  * Enables selected-first sorting, which moves selected items into a dedicated section at the top of the list. Selected items can be deselected directly from this section.
47
56
  * @default false
@@ -52,6 +61,11 @@ export interface SelectListProps<TType extends object = object> extends Omit<Ari
52
61
  * @default "Selected"
53
62
  */
54
63
  selectedSectionLabel?: string;
64
+ /**
65
+ * Controls where the selection indicator is rendered in each option.
66
+ * @default 'start'
67
+ */
68
+ indicatorPosition?: SelectListIndicatorPosition;
55
69
  /**
56
70
  *
57
71
  */
@@ -65,7 +79,7 @@ type SelectListComponent = {
65
79
  };
66
80
  /**
67
81
  * Provides a high-performance, accessible list for selecting items with built-in virtualization, search, and sorting capabilities.
68
- * Use this component to allow users to select one or multiple items from a list of options. The component automatically handles large datasets through virtualization, provides built-in search functionality when needed, and can optionally organize selected items into a dedicated section at the top for better visibility.
82
+ * Use this component to allow users to select one or multiple items from a list of options. The component automatically handles large datasets through virtualization, provides built-in search functionality when needed, and can optionally organize selected items into a dedicated section at the top for better visibility. Single selection displays radio indicators, multiple selection displays checkbox indicators, and `indicatorPosition` controls where each indicator appears.
69
83
  * @param {SelectListProps} props - Regular props from React Aria's ListBox, plus selection, search, and sorting configuration
70
84
  * @example
71
85
  * ```tsx
@@ -92,11 +106,12 @@ type SelectListComponent = {
92
106
  * ```
93
107
  * @remarks
94
108
  * - List items are automatically virtualized for optimal performance with large datasets (hundreds or thousands of items)
95
- * - Search bar appears automatically when the list contains 10 or more items, or can be controlled via the `showSearch` prop
109
+ * - Search bar appears automatically when the list contains 10 or more items; explicitly setting `showSearch` to `false` disables it
96
110
  * - Set `sortSelectedFirst` to `true` to move selected items into a dedicated section at the top of the list
97
111
  * - The component requires the dynamic API pattern: provide both `items` array and a render function as `children`
98
112
  * - Selection state is fully controlled via the `value` and `onChange` props following React's controlled component pattern
99
113
  * - Supports both flat item lists and grouped sections using `SelectListOptGroup`
114
+ * - Use `wrapperClassName` to adjust the outer wrapper when the list is embedded in another component surface.
100
115
  * @see {@link SelectListProps} for all available props
101
116
  * @see Source code in {@link https://github.com/PayFit/hr-apps/tree/master/libs/shared/unity/components/src/core/components/select-list GitHub}
102
117
  * @see Design specs in {@link https://www.figma.com/design/poaMyU7abAgL9VRhx4ygyy/Unity-DS-%3E-Components-Library Figma}
@@ -1,18 +1,19 @@
1
- import { VIRTUALIZATION_CONFIG as e } from "./constants.js";
2
- import { useControlledSelection as t } from "./hooks/useControlledSelection.js";
3
- import { useSelectedFirstSorting as n } from "./hooks/useSelectedFirstSorting.js";
4
- import { SelectedItemsSection as r } from "./parts/SelectedItemsSection.js";
5
- import { SelectListEmptyState as i } from "./parts/SelectListEmptyState.js";
6
- import { SelectListSearchInput as a } from "./parts/SelectListSearchInput.js";
7
- import { forwardRef as o, useMemo as s } from "react";
8
- import { uyTv as c } from "@payfit/unity-themes";
9
- import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
10
- import { Separator as f } from "react-aria-components/Separator";
11
- import { Collection as p, ListBox as m } from "react-aria-components/ListBox";
12
- import { Autocomplete as h, useFilter as g } from "react-aria-components/Autocomplete";
13
- import { Virtualizer as _ } from "react-aria-components/Virtualizer";
1
+ import { SelectListContextProvider as e } from "./SelectList.context.js";
2
+ import { VIRTUALIZATION_CONFIG as t } from "./constants.js";
3
+ import { useControlledSelection as n } from "./hooks/useControlledSelection.js";
4
+ import { useSelectedFirstSorting as r } from "./hooks/useSelectedFirstSorting.js";
5
+ import { SelectedItemsSection as i } from "./parts/SelectedItemsSection.js";
6
+ import { SelectListEmptyState as a } from "./parts/SelectListEmptyState.js";
7
+ import { SelectListSearchInput as o } from "./parts/SelectListSearchInput.js";
8
+ import { forwardRef as s, useMemo as c } from "react";
9
+ import { uyTv as l } from "@payfit/unity-themes";
10
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
11
+ import { Separator as p } from "react-aria-components/Separator";
12
+ import { Collection as m, ListBox as h } from "react-aria-components/ListBox";
13
+ import { Autocomplete as g, useFilter as _ } from "react-aria-components/Autocomplete";
14
+ import { Virtualizer as v } from "react-aria-components/Virtualizer";
14
15
  //#region src/core/components/select-list/SelectList.tsx
15
- var v = c({ slots: {
16
+ var y = l({ slots: {
16
17
  wrapper: "uy:bg-surface-neutral uy:p-100 uy:overscroll-contain",
17
18
  base: "uy:flex uy:w-full uy:gap-100 uy:h-500 uy:border uy:border-solid uy:rounded-75 uy:py-100 uy:border-border-form-enabled uy:bg-surface-form-enabled uy:px-150 uy:typography-body uy:focus-within:outline-none uy:focus-within:ring-2 uy:focus-within:ring-utility-focus-ring uy:focus-within:ring-offset-2 uy:active:border-border-form-active",
18
19
  inputContainer: "uy:sticky uy:top-0 uy:bg-surface-neutral",
@@ -20,56 +21,64 @@ var v = c({ slots: {
20
21
  list: "uy:overflow-y-auto uy:mt-100 uy:max-h-[300px]",
21
22
  selectedListBox: "uy:bg-surface-neutral uy:border-b uy:border-border-neutral uy:py-100 uy:data-[empty=true]:border-0 uy:data-[is-last=true]:border-0 uy:data-[is-last=true]:py-0"
22
23
  } });
23
- function y({ items: o, children: c, value: y, onChange: b, className: x, showSearch: S = !1, searchPlaceholder: C, searchAutoFocus: w = !1, sortSelectedFirst: T = !1, selectedSectionLabel: E = "Selected", ...D }, O) {
24
- let { contains: k } = g({ sensitivity: "base" }), { wrapper: A, inputContainer: j, list: M, separator: N, selectedListBox: P } = v(), [F, I] = t(y, b), L = s(() => (Array.isArray(o) ? o.length : Array.from(o).length) >= 10 || S, [o, S]), R = n(o, F, T), z = s(() => R.remainingItems ? !R.remainingItems[Symbol.iterator]().next().done : !1, [R.remainingItems]), B = /* @__PURE__ */ u(r, {
25
- items: R.selectedItems,
26
- selectedKeys: F,
27
- onSelectionChange: I,
28
- selectionMode: D.selectionMode,
29
- selectionBehavior: D.selectionBehavior,
30
- label: E,
31
- className: P(),
32
- "data-is-last": !z
33
- }), V = /* @__PURE__ */ u(m, {
34
- ...D,
35
- autoFocus: L && w ? !1 : D.autoFocus,
36
- className: M({ className: x }),
37
- items: R.remainingItems,
38
- selectedKeys: F,
39
- onSelectionChange: I,
40
- renderEmptyState: i,
41
- children: /* @__PURE__ */ u(p, {
42
- items: R.remainingItems,
43
- children: c
24
+ function b({ items: s, children: l, value: b, onChange: x, className: S, wrapperClassName: C, showSearch: w, searchPlaceholder: T, searchAutoFocus: E = !1, sortSelectedFirst: D = !1, selectedSectionLabel: O = "Selected", selectionMode: k = "multiple", indicatorPosition: A = "start", ...j }, M) {
25
+ let { contains: N } = _({ sensitivity: "base" }), { wrapper: P, inputContainer: F, list: I, separator: L, selectedListBox: R } = y(), [z, B] = n(b, x), V = c(() => w === void 0 ? (Array.isArray(s) ? s.length : Array.from(s).length) >= 10 : w, [s, w]), H = r(s, z, D), U = c(() => H.remainingItems ? !H.remainingItems[Symbol.iterator]().next().done : !1, [H.remainingItems]), W = /* @__PURE__ */ d(i, {
26
+ items: H.selectedItems,
27
+ selectedKeys: z,
28
+ onSelectionChange: B,
29
+ selectionMode: k,
30
+ selectionBehavior: j.selectionBehavior,
31
+ label: O,
32
+ className: R(),
33
+ "data-is-last": !U,
34
+ children: l
35
+ }), G = /* @__PURE__ */ d(h, {
36
+ ...j,
37
+ selectionMode: k,
38
+ autoFocus: V && E ? !1 : j.autoFocus,
39
+ className: I({ className: S }),
40
+ items: H.remainingItems,
41
+ selectedKeys: z,
42
+ onSelectionChange: B,
43
+ renderEmptyState: a,
44
+ children: /* @__PURE__ */ d(m, {
45
+ items: H.remainingItems,
46
+ children: l
44
47
  })
45
48
  });
46
- return /* @__PURE__ */ u("div", {
47
- ref: O,
48
- className: A(),
49
- children: L ? /* @__PURE__ */ d(h, {
50
- filter: k,
51
- children: [
52
- /* @__PURE__ */ d("div", {
53
- className: j(),
54
- "data-dd-privacy": "mask",
55
- children: [/* @__PURE__ */ u(a, {
56
- placeholder: C,
57
- autoFocus: w
58
- }), /* @__PURE__ */ u(f, { className: N() })]
59
- }),
60
- B,
61
- z && /* @__PURE__ */ u(_, {
62
- ...e,
63
- children: V
64
- })
65
- ]
66
- }) : /* @__PURE__ */ d(l, { children: [B, z && /* @__PURE__ */ u(_, {
67
- ...e,
68
- children: V
69
- })] })
49
+ return /* @__PURE__ */ d(e, {
50
+ value: {
51
+ selectionMode: k,
52
+ indicatorPosition: A
53
+ },
54
+ children: /* @__PURE__ */ d("div", {
55
+ ref: M,
56
+ className: P({ className: C }),
57
+ children: V ? /* @__PURE__ */ f(g, {
58
+ filter: N,
59
+ children: [
60
+ /* @__PURE__ */ f("div", {
61
+ className: F(),
62
+ "data-dd-privacy": "mask",
63
+ children: [/* @__PURE__ */ d(o, {
64
+ placeholder: T,
65
+ autoFocus: E
66
+ }), /* @__PURE__ */ d(p, { className: L() })]
67
+ }),
68
+ W,
69
+ U && /* @__PURE__ */ d(v, {
70
+ ...t,
71
+ children: G
72
+ })
73
+ ]
74
+ }) : /* @__PURE__ */ f(u, { children: [W, U && /* @__PURE__ */ d(v, {
75
+ ...t,
76
+ children: G
77
+ })] })
78
+ })
70
79
  });
71
80
  }
72
- var b = o(y);
73
- b.displayName = "SelectList";
81
+ var x = s(b);
82
+ x.displayName = "SelectList";
74
83
  //#endregion
75
- export { b as SelectList };
84
+ export { x as SelectList };
@@ -8,14 +8,21 @@ function i(i, a, o) {
8
8
  selectedItems: [],
9
9
  remainingItems: i
10
10
  };
11
- if (e(i)) {
12
- let e = n(i, s);
11
+ let r = Array.from(i);
12
+ if (e(r)) {
13
+ let e = n(r, s), t = new Set(e.selectedItems.map((e) => e.id));
13
14
  return {
14
- selectedItems: e.selectedItems,
15
+ selectedItems: r.map((e) => {
16
+ let n = e;
17
+ return {
18
+ ...n,
19
+ children: n.children.filter((e) => t.has(e.id))
20
+ };
21
+ }).filter((e) => e.children.length > 0),
15
22
  remainingItems: e.remainingSections
16
23
  };
17
24
  } else {
18
- let e = t(i, s);
25
+ let e = t(r, s);
19
26
  return {
20
27
  selectedItems: e.selectedItems,
21
28
  remainingItems: e.remainingItems
@@ -5,6 +5,8 @@ import { ListBoxItemProps } from 'react-aria-components/ListBox';
5
5
  * @template TType - The type of the item this option represents
6
6
  */
7
7
  export interface SelectListOptionProps<TType extends object> extends Omit<ListBoxItemProps<TType>, 'ref' | 'className' | 'style'> {
8
+ /** Adds or overrides styles on the option container. */
9
+ className?: string;
8
10
  /**
9
11
  * The content to display for this option. Typically a text label or rich content.
10
12
  */
@@ -18,6 +20,19 @@ export interface SelectListOptionProps<TType extends object> extends Omit<ListBo
18
20
  * Supplementary text displayed below the main option label. Use this to provide additional context or description about the option.
19
21
  */
20
22
  helperText?: string;
23
+ /**
24
+ * Content displayed before the option label, after a start-position indicator.
25
+ */
26
+ prefixElement?: ReactNode;
27
+ /**
28
+ * Content displayed after the option label and before an end-position indicator.
29
+ */
30
+ suffixElement?: ReactNode;
31
+ /**
32
+ * Applies a presentational hint to the option without changing its selection or focus state.
33
+ * @default false
34
+ */
35
+ isHinted?: boolean;
21
36
  }
22
37
  export declare const SelectListOption: <T extends object>(props: SelectListOptionProps<T> & {
23
38
  ref?: React.ForwardedRef<HTMLDivElement>;
@@ -1,11 +1,13 @@
1
1
  import e from "../../../hooks/use-id.js";
2
2
  import { CheckboxIndicator as t } from "../../checkbox/parts/CheckboxIndicator.js";
3
- import { forwardRef as n } from "react";
4
- import { uyTv as r } from "@payfit/unity-themes";
5
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
- import { ListBoxItem as o } from "react-aria-components/ListBox";
3
+ import { RadioIndicator as n } from "../../radio-button-group/parts/RadioIndicator.js";
4
+ import { useSelectListContext as r } from "../SelectList.context.js";
5
+ import { forwardRef as i } from "react";
6
+ import { uyMerge as a, uyTv as o } from "@payfit/unity-themes";
7
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
8
+ import { ListBoxItem as l } from "react-aria-components/ListBox";
7
9
  //#region src/core/components/select-list/parts/SelectListOption.tsx
8
- var s = r({
10
+ var u = o({
9
11
  slots: {
10
12
  base: [
11
13
  "uy:flex uy:flex-col uy:transition",
@@ -15,42 +17,79 @@ var s = r({
15
17
  "uy:active:bg-surface-neutral-pressed",
16
18
  "uy:data-[focus-visible]:outline uy:data-[focus-visible]:outline-2 uy:data-[focus-visible]:outline-utility-focus-ring uy:data-[focus-visible]:-outline-offset-2"
17
19
  ],
18
- label: "uy:inline-flex uy:items-center uy:gap-100 uy:text-content-neutral uy:typography-body",
20
+ label: "uy:flex uy:items-center uy:gap-100 uy:text-content-neutral uy:typography-body",
21
+ content: "uy:flex uy:min-w-0 uy:flex-1 uy:flex-col",
22
+ optionLabel: "uy:min-w-0 uy:flex-1",
19
23
  helperText: "uy:inline-block uy:typography-body uy:text-content-neutral-low uy:pl-300"
20
24
  },
21
- variants: { isDisabled: {
22
- true: {
23
- base: "uy:cursor-not-allowed!",
24
- label: "uy:text-content-neutral-disabled"
25
+ variants: {
26
+ isDisabled: {
27
+ true: {
28
+ base: "uy:cursor-not-allowed!",
29
+ label: "uy:text-content-neutral-disabled"
30
+ },
31
+ false: { base: "" }
25
32
  },
26
- false: { base: "" }
27
- } }
33
+ isHinted: {
34
+ true: { base: "uy:data-[hinted=true]:bg-surface-neutral-hover" },
35
+ false: { base: "" }
36
+ }
37
+ }
28
38
  });
29
- function c({ children: n, isDisabled: r = !1, textValue: c, helperText: l, ...u }, d) {
30
- let f = e(), { base: p, label: m, helperText: h } = s({ isDisabled: r });
31
- return /* @__PURE__ */ i(o, {
39
+ function d({ children: i, isDisabled: o = !1, textValue: d, helperText: f, prefixElement: p, suffixElement: m, isHinted: h = !1, className: g, ..._ }, v) {
40
+ let y = e(), { selectionMode: b, indicatorPosition: x } = r(), { base: S, label: C, content: w, optionLabel: T, helperText: E } = u({
41
+ isDisabled: o,
42
+ isHinted: h
43
+ }), D = (e) => b === "multiple" ? /* @__PURE__ */ s("span", {
44
+ "aria-hidden": "true",
45
+ "data-unity-slot": "selection-indicator",
46
+ "data-indicator": "checkbox",
47
+ children: /* @__PURE__ */ s(t, {
48
+ isSelected: e,
49
+ isDisabled: o
50
+ })
51
+ }) : b === "single" ? /* @__PURE__ */ s("span", {
52
+ "aria-hidden": "true",
53
+ "data-unity-slot": "selection-indicator",
54
+ "data-indicator": "radio",
55
+ children: /* @__PURE__ */ s(n, {
56
+ isSelected: e,
57
+ state: o ? "disabled" : "enabled"
58
+ })
59
+ }) : null;
60
+ return /* @__PURE__ */ s(l, {
32
61
  "data-dd-privacy": "mask",
33
- ...u,
34
- className: p(),
35
- textValue: c ?? n,
36
- "aria-describedby": l ? `${f}-helper-text` : void 0,
37
- children: ({ isSelected: e }) => /* @__PURE__ */ a("div", {
38
- ref: d,
39
- children: [/* @__PURE__ */ a("div", {
40
- className: m(),
41
- children: [/* @__PURE__ */ i(t, {
42
- isSelected: e,
43
- isDisabled: r
44
- }), n]
45
- }), l && /* @__PURE__ */ i("span", {
46
- id: `${f}-helper-text`,
47
- className: h(),
48
- children: l
49
- })]
62
+ ..._,
63
+ className: a(S(), g),
64
+ "data-hinted": h || void 0,
65
+ textValue: d ?? i,
66
+ "aria-describedby": f ? `${y}-helper-text` : void 0,
67
+ children: ({ isSelected: e }) => /* @__PURE__ */ s("div", {
68
+ ref: v,
69
+ children: /* @__PURE__ */ c("div", {
70
+ className: C(),
71
+ children: [
72
+ x === "start" && D(e),
73
+ p,
74
+ /* @__PURE__ */ c("div", {
75
+ className: w(),
76
+ children: [/* @__PURE__ */ s("span", {
77
+ className: T(),
78
+ children: i
79
+ }), f && /* @__PURE__ */ s("span", {
80
+ id: `${y}-helper-text`,
81
+ className: E(),
82
+ children: f
83
+ })]
84
+ }),
85
+ m,
86
+ x === "end" && D(e)
87
+ ]
88
+ })
50
89
  })
51
90
  });
52
91
  }
53
- c.displayName = "SelectListOption";
54
- var l = n(c);
92
+ d.displayName = "SelectListOption";
93
+ var f = i(d);
55
94
  //#endregion
56
- export { l as SelectListOption };
95
+ export { f as SelectListOption };
@@ -1,6 +1,7 @@
1
1
  import { SelectionBehavior } from '@react-types/shared';
2
2
  import { Key } from 'react-aria-components/Breadcrumbs';
3
3
  import { Selection, SelectionMode } from 'react-aria-components/GridList';
4
+ import { ReactElement } from 'react';
4
5
  interface SelectableItem {
5
6
  id: Key;
6
7
  label: string;
@@ -35,6 +36,7 @@ export interface SelectedItemsSectionProps<TType extends SelectableItem> {
35
36
  * CSS class for the ListBox
36
37
  */
37
38
  className: string;
39
+ children: (item: TType) => ReactElement;
38
40
  }
39
41
  /**
40
42
  * Displays selected items in a dedicated section at the top of the list.
@@ -51,5 +53,5 @@ export interface SelectedItemsSectionProps<TType extends SelectableItem> {
51
53
  * />
52
54
  * ```
53
55
  */
54
- export declare function SelectedItemsSection<TType extends SelectableItem>({ items, selectedKeys, onSelectionChange, selectionMode, selectionBehavior, label, className, ...rest }: SelectedItemsSectionProps<TType>): import('react/jsx-runtime').JSX.Element | null;
56
+ export declare function SelectedItemsSection<TType extends SelectableItem>({ items, selectedKeys, onSelectionChange, selectionMode, selectionBehavior, label, className, children, ...rest }: SelectedItemsSectionProps<TType>): import('react/jsx-runtime').JSX.Element | null;
55
57
  export {};
@@ -1,30 +1,26 @@
1
- import { SelectListOption as e } from "./SelectListOption.js";
2
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
- import { Collection as r, Header as i, ListBox as a } from "react-aria-components/ListBox";
1
+ import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
+ import { Collection as n, Header as r, ListBox as i } from "react-aria-components/ListBox";
4
3
  //#region src/core/components/select-list/parts/SelectedItemsSection.tsx
5
- function o({ items: o, selectedKeys: s, onSelectionChange: c, selectionMode: l, selectionBehavior: u, label: d, className: f, ...p }) {
6
- return o.length === 0 ? null : /* @__PURE__ */ n("div", { children: [/* @__PURE__ */ t(i, {
4
+ function a({ items: a, selectedKeys: o, onSelectionChange: s, selectionMode: c, selectionBehavior: l, label: u, className: d, children: f, ...p }) {
5
+ return a.length === 0 ? null : /* @__PURE__ */ t("div", { children: [/* @__PURE__ */ e(r, {
7
6
  className: "uy:sr-only",
8
- children: d
9
- }), /* @__PURE__ */ t(a, {
10
- "aria-label": d,
11
- className: f,
12
- items: o,
13
- selectedKeys: s,
14
- onSelectionChange: c,
15
- selectionMode: l,
16
- selectionBehavior: u,
7
+ children: u
8
+ }), /* @__PURE__ */ e(i, {
9
+ "aria-label": u,
10
+ className: d,
11
+ items: a,
12
+ selectedKeys: o,
13
+ onSelectionChange: s,
14
+ selectionMode: c,
15
+ selectionBehavior: l,
17
16
  escapeKeyBehavior: "none",
18
17
  shouldFocusWrap: !1,
19
18
  ...p,
20
- children: /* @__PURE__ */ t(r, {
21
- items: o,
22
- children: (n) => /* @__PURE__ */ t(e, {
23
- id: n.id,
24
- children: n.label
25
- })
19
+ children: /* @__PURE__ */ e(n, {
20
+ items: a,
21
+ children: f
26
22
  })
27
23
  })] });
28
24
  }
29
25
  //#endregion
30
- export { o as SelectedItemsSection };
26
+ export { a as SelectedItemsSection };