@payfit/unity-components 2.5.7 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/esm/components/empty-state/EmptyState.d.ts +48 -0
  2. package/dist/esm/components/empty-state/EmptyState.js +25 -0
  3. package/dist/esm/components/empty-state/EmptyState.variants.d.ts +59 -0
  4. package/dist/esm/components/empty-state/EmptyState.variants.js +24 -0
  5. package/dist/esm/components/empty-state/parts/EmptyStateActions.d.ts +39 -0
  6. package/dist/esm/components/empty-state/parts/EmptyStateActions.js +17 -0
  7. package/dist/esm/components/empty-state/parts/EmptyStateContent.d.ts +40 -0
  8. package/dist/esm/components/empty-state/parts/EmptyStateContent.js +21 -0
  9. package/dist/esm/components/empty-state/parts/EmptyStateIcon.d.ts +41 -0
  10. package/dist/esm/components/empty-state/parts/EmptyStateIcon.js +14 -0
  11. package/dist/esm/components/empty-state/presets/EmptyStateGetStarted.d.ts +41 -0
  12. package/dist/esm/components/empty-state/presets/EmptyStateGetStarted.js +28 -0
  13. package/dist/esm/components/empty-state/presets/EmptyStateGoodJob.d.ts +29 -0
  14. package/dist/esm/components/empty-state/presets/EmptyStateGoodJob.js +55 -0
  15. package/dist/esm/components/empty-state/presets/EmptyStateNoSearchResults.d.ts +38 -0
  16. package/dist/esm/components/empty-state/presets/EmptyStateNoSearchResults.js +28 -0
  17. package/dist/esm/components/empty-state/presets/EmptyStateUpgradeRequired.d.ts +37 -0
  18. package/dist/esm/components/empty-state/presets/EmptyStateUpgradeRequired.js +28 -0
  19. package/dist/esm/components/empty-state/presets/EmptyStateUseDesktop.d.ts +28 -0
  20. package/dist/esm/components/empty-state/presets/EmptyStateUseDesktop.js +26 -0
  21. package/dist/esm/components/empty-state/presets/EmptyStateWaitingForData.d.ts +38 -0
  22. package/dist/esm/components/empty-state/presets/EmptyStateWaitingForData.js +28 -0
  23. package/dist/esm/components/inline-field/InlineField.js +15 -6
  24. package/dist/esm/components/inline-field-group/InlineFieldGroup.context.d.ts +12 -0
  25. package/dist/esm/components/inline-field-group/InlineFieldGroup.d.ts +39 -0
  26. package/dist/esm/components/inline-field-group/InlineFieldGroup.js +119 -93
  27. package/dist/esm/components/inline-field-group/parts/InlineFieldGroupActions.d.ts +24 -0
  28. package/dist/esm/components/inline-field-group/parts/InlineFieldGroupActions.js +158 -0
  29. package/dist/esm/components/inline-field-group/parts/InlineFieldGroupHeader.d.ts +11 -35
  30. package/dist/esm/components/inline-field-group/parts/InlineFieldGroupHeader.js +27 -94
  31. package/dist/esm/components/select/Select.d.ts +4 -0
  32. package/dist/esm/components/select/Select.js +30 -28
  33. package/dist/esm/components/select/TanstackSelect.js +24 -17
  34. package/dist/esm/components/select/parts/SelectButton.d.ts +13 -2
  35. package/dist/esm/components/select/parts/SelectButton.js +50 -48
  36. package/dist/esm/components/select-field/TanstackSelectField.js +22 -20
  37. package/dist/esm/index.d.ts +10 -0
  38. package/dist/esm/index.js +431 -411
  39. package/i18n/en-GB.json +9 -0
  40. package/i18n/es-ES.json +9 -0
  41. package/i18n/fr-FR.json +9 -0
  42. package/package.json +7 -7
@@ -0,0 +1,158 @@
1
+ import { jsxs as c, Fragment as y, jsx as i } from "react/jsx-runtime";
2
+ import { useContext as E, useMemo as G } from "react";
3
+ import { uyTv as S } from "@payfit/unity-themes";
4
+ import { useStore as A } from "@tanstack/react-form";
5
+ import { useIntl as B } from "react-intl";
6
+ import { useFormContext as j } from "../../../hooks/tanstack-form-context.js";
7
+ import { useBreakpointListener as k } from "../../../hooks/use-breakpoint-listener.js";
8
+ import { Button as n } from "../../button/Button.js";
9
+ import { InlineFieldGroupContext as V } from "../InlineFieldGroup.context.js";
10
+ const O = S({
11
+ slots: {
12
+ container: "",
13
+ button: ""
14
+ },
15
+ variants: {
16
+ orientation: {
17
+ horizontal: {
18
+ container: "uy:flex uy:gap-100 uy:items-center"
19
+ },
20
+ vertical: {
21
+ container: "uy:flex uy:flex-col uy:gap-100 uy:w-full",
22
+ button: "uy:w-full"
23
+ }
24
+ }
25
+ },
26
+ defaultVariants: {
27
+ orientation: "horizontal"
28
+ }
29
+ });
30
+ function R({
31
+ orientation: b = "horizontal",
32
+ customActions: g
33
+ }) {
34
+ const o = B(), m = E(V), f = k(), p = f === "xs" || f === "sm";
35
+ if (!m)
36
+ throw new Error(
37
+ "InlineFieldGroupActions must be used within InlineFieldGroup"
38
+ );
39
+ const {
40
+ mode: v,
41
+ enterEditMode: x,
42
+ exitEditMode: s,
43
+ editViewId: h,
44
+ isLoading: e,
45
+ editButtonRef: M,
46
+ editLabel: P,
47
+ saveLabel: z,
48
+ cancelLabel: D,
49
+ onEditPress: I,
50
+ onSavePress: r,
51
+ onCancelPress: a
52
+ } = m, L = j(), { isDirty: l } = A(L.store, (C) => ({
53
+ isDirty: C.isDirty
54
+ })), { container: F, button: t } = O({ orientation: b }), N = P || o.formatMessage({
55
+ id: "unity:component:inline-field-group:edit",
56
+ defaultMessage: "Edit"
57
+ }), d = z || o.formatMessage({
58
+ id: "unity:component:inline-field-group:save",
59
+ defaultMessage: "Save"
60
+ }), u = D || o.formatMessage({
61
+ id: "unity:component:inline-field-group:cancel",
62
+ defaultMessage: "Cancel"
63
+ }), w = G(() => p ? /* @__PURE__ */ c(y, { children: [
64
+ /* @__PURE__ */ i(
65
+ n,
66
+ {
67
+ variant: "primary",
68
+ size: "default",
69
+ isDisabled: !l || e,
70
+ isLoading: e,
71
+ type: "submit",
72
+ onPress: () => {
73
+ r?.();
74
+ },
75
+ className: t(),
76
+ children: d
77
+ }
78
+ ),
79
+ /* @__PURE__ */ i(
80
+ n,
81
+ {
82
+ variant: "secondary",
83
+ size: "default",
84
+ onPress: () => {
85
+ a?.(), s();
86
+ },
87
+ isDisabled: e,
88
+ type: "button",
89
+ className: t(),
90
+ children: u
91
+ }
92
+ )
93
+ ] }) : /* @__PURE__ */ c(y, { children: [
94
+ /* @__PURE__ */ i(
95
+ n,
96
+ {
97
+ variant: "secondary",
98
+ size: "default",
99
+ onPress: () => {
100
+ a?.(), s();
101
+ },
102
+ isDisabled: e,
103
+ type: "button",
104
+ className: t(),
105
+ children: u
106
+ }
107
+ ),
108
+ /* @__PURE__ */ i(
109
+ n,
110
+ {
111
+ variant: "primary",
112
+ size: "default",
113
+ isDisabled: !l || e,
114
+ isLoading: e,
115
+ type: "submit",
116
+ onPress: () => {
117
+ r?.();
118
+ },
119
+ className: t(),
120
+ children: d
121
+ }
122
+ )
123
+ ] }), [
124
+ t,
125
+ u,
126
+ d,
127
+ s,
128
+ l,
129
+ e,
130
+ p,
131
+ a,
132
+ r
133
+ ]);
134
+ return /* @__PURE__ */ c("div", { className: F(), role: "group", children: [
135
+ g,
136
+ v === "read" ? /* @__PURE__ */ i(
137
+ n,
138
+ {
139
+ ref: M,
140
+ variant: "secondary",
141
+ size: "default",
142
+ onPress: () => {
143
+ I?.(), x();
144
+ },
145
+ isDisabled: e,
146
+ prefixIcon: "PencilSimpleOutlined",
147
+ "aria-expanded": !1,
148
+ "aria-controls": h,
149
+ className: t(),
150
+ children: N
151
+ }
152
+ ) : w
153
+ ] });
154
+ }
155
+ R.displayName = "InlineFieldGroupActions";
156
+ export {
157
+ R as InlineFieldGroupActions
158
+ };
@@ -6,42 +6,14 @@ export interface InlineFieldGroupHeaderProps {
6
6
  */
7
7
  title: ReactNode;
8
8
  /**
9
- * Custom label for the edit button.
10
- * @default "Edit" (translated)
9
+ * Optional subtitle to display below the title.
11
10
  */
12
- editLabel?: string;
13
- /**
14
- * Custom label for the save button.
15
- * @default "Save" (translated)
16
- */
17
- saveLabel?: string;
18
- /**
19
- * Custom label for the cancel button.
20
- * @default "Cancel" (translated)
21
- */
22
- cancelLabel?: string;
11
+ subtitle?: ReactNode;
23
12
  /**
24
13
  * Additional custom actions to render alongside the default buttons.
25
14
  * These will be displayed between the title and the edit/save/cancel buttons.
26
15
  */
27
16
  customActions?: ReactNode;
28
- /**
29
- * Optional callback fired when the edit button is clicked.
30
- * This is called before entering edit mode and is useful for analytics or side effects.
31
- */
32
- onEditPress?: () => void;
33
- /**
34
- * Optional callback fired when the save button is clicked.
35
- * This is called before form submission and is useful for analytics or side effects.
36
- * Note: Form submission is handled via the form's onSubmit configuration.
37
- */
38
- onSavePress?: () => void;
39
- /**
40
- * Optional callback fired when the cancel button is clicked.
41
- * This is called before canceling and is useful for analytics or side effects.
42
- * The form will be reset and edit mode exited automatically.
43
- */
44
- onCancelPress?: () => void;
45
17
  }
46
18
  /**
47
19
  * InlineFieldGroupHeader renders the title and contextual action buttons for an InlineFieldGroup.
@@ -69,14 +41,18 @@ export interface InlineFieldGroupHeaderProps {
69
41
  * ```
70
42
  * @example Custom button labels and actions
71
43
  * ```tsx
72
- * <form.InlineFieldGroupHeader
73
- * title="Contact Information"
44
+ * <form.InlineFieldGroup
74
45
  * editLabel="Modify"
75
46
  * saveLabel="Confirm"
76
47
  * cancelLabel="Discard"
77
- * customActions={<Button onPress={handleDelete}>Delete</Button>}
78
48
  * onSavePress={() => trackAnalytics('save_clicked')}
79
- * />
49
+ * >
50
+ * <form.InlineFieldGroupHeader
51
+ * title="Contact Information"
52
+ * customActions={<Button onPress={handleDelete}>Delete</Button>}
53
+ * />
54
+ * ...
55
+ * </form.InlineFieldGroup>
80
56
  * ```
81
57
  * @remarks
82
58
  * - Must be used as a child of InlineFieldGroup
@@ -89,7 +65,7 @@ export interface InlineFieldGroupHeaderProps {
89
65
  * @see Source code in {@link https://github.com/PayFit/hr-apps/tree/master/libs/shared/unity/components/src/components/inline-field-group GitHub}
90
66
  * @see Developer docs in {@link https://unity-components.payfit.io/?path=/docs/forms-reference-inlinefieldgroup--docs unity-components.payfit.io}
91
67
  */
92
- export declare function InlineFieldGroupHeader({ title, editLabel, saveLabel, cancelLabel, customActions, onEditPress, onSavePress, onCancelPress, }: InlineFieldGroupHeaderProps): import("react/jsx-runtime").JSX.Element;
68
+ export declare function InlineFieldGroupHeader({ title, subtitle, customActions, }: InlineFieldGroupHeaderProps): import("react/jsx-runtime").JSX.Element;
93
69
  export declare namespace InlineFieldGroupHeader {
94
70
  var displayName: string;
95
71
  }
@@ -1,106 +1,39 @@
1
- import { jsxs as n, jsx as e, Fragment as N } from "react/jsx-runtime";
2
- import { useContext as L } from "react";
3
- import { uyTv as P } from "@payfit/unity-themes";
4
- import { useStore as S } from "@tanstack/react-form";
5
- import { useIntl as j } from "react-intl";
6
- import { useFormContext as z } from "../../../hooks/tanstack-form-context.js";
7
- import { Button as o } from "../../button/Button.js";
8
- import { Text as H } from "../../text/Text.js";
9
- import { InlineFieldGroupContext as B } from "../InlineFieldGroup.context.js";
10
- const T = P({
1
+ import { jsxs as e, jsx as r } from "react/jsx-runtime";
2
+ import { useContext as d } from "react";
3
+ import { uyTv as m } from "@payfit/unity-themes";
4
+ import { useBreakpointListener as f } from "../../../hooks/use-breakpoint-listener.js";
5
+ import { Text as i } from "../../text/Text.js";
6
+ import { InlineFieldGroupContext as y } from "../InlineFieldGroup.context.js";
7
+ import { InlineFieldGroupActions as h } from "./InlineFieldGroupActions.js";
8
+ const x = m({
11
9
  slots: {
12
- base: "uy:flex uy:items-center uy:justify-between uy:w-full",
13
- titleContainer: "uy:flex uy:flex-col uy:gap-0 uy:flex-1",
14
- actions: "uy:flex uy:gap-100 uy:items-center"
10
+ base: "uy:flex uy:items-center uy:justify-between uy:w-full uy:gap-300",
11
+ titleContainer: "uy:flex uy:flex-col uy:gap-100 uy:flex-1"
15
12
  }
16
13
  });
17
- function A({
18
- title: a,
19
- editLabel: s,
20
- saveLabel: l,
21
- cancelLabel: d,
22
- customActions: u,
23
- onEditPress: c,
24
- onSavePress: m,
25
- onCancelPress: f
14
+ function I({
15
+ title: l,
16
+ subtitle: t,
17
+ customActions: s
26
18
  }) {
27
- const i = j(), r = L(B);
28
- if (!r)
19
+ const o = d(y), n = f(), a = n !== "xs" && n !== "sm";
20
+ if (!o)
29
21
  throw new Error(
30
22
  "InlineFieldGroupHeader must be used within InlineFieldGroup"
31
23
  );
32
- const {
33
- mode: p,
34
- enterEditMode: y,
35
- exitEditMode: x,
36
- headerId: g,
37
- editViewId: h,
38
- isLoading: t,
39
- editButtonRef: b
40
- } = r, v = z(), { isDirty: I } = S(v.store, (G) => ({
41
- isDirty: G.isDirty
42
- })), { base: C, titleContainer: M, actions: F } = T(), w = s || i.formatMessage({
43
- id: "unity:component:inline-field-group:edit",
44
- defaultMessage: "Edit"
45
- }), D = l || i.formatMessage({
46
- id: "unity:component:inline-field-group:save",
47
- defaultMessage: "Save"
48
- }), E = d || i.formatMessage({
49
- id: "unity:component:inline-field-group:cancel",
50
- defaultMessage: "Cancel"
51
- });
52
- return /* @__PURE__ */ n("header", { className: C(), children: [
53
- /* @__PURE__ */ e("div", { className: M(), children: /* @__PURE__ */ e(H, { id: g, variant: "h3", color: "content.neutral", children: a }) }),
54
- /* @__PURE__ */ n("div", { className: F(), role: "group", children: [
55
- u,
56
- p === "read" ? /* @__PURE__ */ e(
57
- o,
58
- {
59
- ref: b,
60
- variant: "secondary",
61
- size: "default",
62
- onPress: () => {
63
- c?.(), y();
64
- },
65
- isDisabled: t,
66
- prefixIcon: "PencilSimpleOutlined",
67
- "aria-expanded": !1,
68
- "aria-controls": h,
69
- children: w
70
- }
71
- ) : /* @__PURE__ */ n(N, { children: [
72
- /* @__PURE__ */ e(
73
- o,
74
- {
75
- variant: "secondary",
76
- size: "default",
77
- onPress: () => {
78
- f?.(), x();
79
- },
80
- isDisabled: t,
81
- type: "button",
82
- children: E
83
- }
84
- ),
85
- /* @__PURE__ */ e(
86
- o,
87
- {
88
- variant: "primary",
89
- size: "default",
90
- isDisabled: !I || t,
91
- isLoading: t,
92
- type: "submit",
93
- onPress: () => {
94
- m?.();
95
- },
96
- children: D
97
- }
98
- )
99
- ] })
24
+ const { headerId: u } = o, { base: c, titleContainer: p } = x();
25
+ return /* @__PURE__ */ e("header", { className: c(), children: [
26
+ /* @__PURE__ */ e("hgroup", { className: p(), children: [
27
+ /* @__PURE__ */ r(i, { id: u, variant: "h3", color: "content.neutral", children: l }),
28
+ t && /* @__PURE__ */ r(i, { variant: "subtitle", color: "content.neutral", children: t })
29
+ ] }),
30
+ /* @__PURE__ */ e("div", { className: "uy:flex uy:gap-100 uy:items-center", role: "group", children: [
31
+ s,
32
+ a && /* @__PURE__ */ r(h, { orientation: "horizontal" })
100
33
  ] })
101
34
  ] });
102
35
  }
103
- A.displayName = "InlineFieldGroupHeader";
36
+ I.displayName = "InlineFieldGroupHeader";
104
37
  export {
105
- A as InlineFieldGroupHeader
38
+ I as InlineFieldGroupHeader
106
39
  };
@@ -1,3 +1,4 @@
1
+ import { Node } from '@react-types/shared';
1
2
  import { ForwardedRef, JSX, ReactNode } from 'react';
2
3
  import { PopoverProps as AriaPopoverProps, SelectProps as AriaSelectProps } from 'react-aria-components';
3
4
  export interface SelectProps<T extends object> extends Omit<AriaSelectProps<T>, 'children' | 'label' | 'style' | 'className' | 'value' | 'defaultValue' | 'onChange' | 'selectionMode'> {
@@ -17,7 +18,10 @@ export interface SelectProps<T extends object> extends Omit<AriaSelectProps<T>,
17
18
  isSearchable?: boolean;
18
19
  /** The placement of the popover */
19
20
  placement?: Extract<AriaPopoverProps['placement'], 'top' | 'bottom'>;
21
+ /** The aria-label for the search input when isSearchable is true */
20
22
  searchInputAriaLabel?: string;
23
+ /** Custom render function to format the selected value display */
24
+ renderValue?: (value: Node<T>) => ReactNode;
21
25
  }
22
26
  type SelectComponent = (<TItems extends object>(props: SelectProps<TItems> & {
23
27
  ref?: ForwardedRef<HTMLDivElement>;
@@ -1,17 +1,17 @@
1
1
  import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
- import { forwardRef as B, useState as C } from "react";
3
- import { uyTv as F } from "@payfit/unity-themes";
4
- import { useFilter as I, Select as M, Popover as z, Autocomplete as A, Virtualizer as p, ListLayout as d, ListBox as y } from "react-aria-components";
5
- import { useIntl as T } from "react-intl";
6
- import { SearchInput as U } from "./parts/SearchInput.js";
7
- import { SelectButton as V } from "./parts/SelectButton.js";
8
- const $ = F({
2
+ import { forwardRef as C, useState as F } from "react";
3
+ import { uyTv as I } from "@payfit/unity-themes";
4
+ import { useFilter as M, Select as z, Popover as A, Autocomplete as T, Virtualizer as p, ListLayout as d, ListBox as y } from "react-aria-components";
5
+ import { useIntl as U } from "react-intl";
6
+ import { SearchInput as V } from "./parts/SearchInput.js";
7
+ import { SelectButton as $ } from "./parts/SelectButton.js";
8
+ const k = I({
9
9
  slots: {
10
10
  base: "uy:flex uy:flex-col uy:gap-100 uy:w-full",
11
11
  popover: "uy:rounded-100 uy:sm:rounded-75 uy:border uy:border-solid uy:border-border-neutral uy:w-[var(--trigger-width)] uy:bg-surface-neutral uy:shadow-300",
12
12
  listbox: "uy:overflow-y-auto uy:max-h-[296px] uy:pt-100 uy:pb-100"
13
13
  }
14
- }), k = ({
14
+ }), q = ({
15
15
  children: t,
16
16
  items: o,
17
17
  placeholder: r,
@@ -25,46 +25,48 @@ const $ = F({
25
25
  onBlur: b,
26
26
  placement: h,
27
27
  searchInputAriaLabel: x,
28
- ...S
29
- }, g) => {
30
- const v = T(), [w, N] = C(!1), { contains: O } = I({ sensitivity: "base" }), { base: L, popover: P, listbox: u } = $(), j = n !== void 0 || i !== void 0 ? {
28
+ renderValue: S,
29
+ ...g
30
+ }, v) => {
31
+ const w = U(), [N, O] = F(!1), { contains: L } = M({ sensitivity: "base" }), { base: P, popover: j, listbox: u } = k(), B = n !== void 0 || i !== void 0 ? {
31
32
  value: n,
32
33
  onChange: i
33
34
  } : { defaultValue: m };
34
35
  return /* @__PURE__ */ c(
35
- M,
36
+ z,
36
37
  {
37
- onOpenChange: N,
38
- ...S,
39
- ref: g,
40
- className: L(),
38
+ onOpenChange: O,
39
+ ...g,
40
+ ref: v,
41
+ className: P(),
41
42
  placeholder: s ? void 0 : r,
42
43
  isDisabled: s || a,
43
44
  isInvalid: l,
44
45
  onBlur: b,
45
- ...j,
46
+ ...B,
46
47
  children: [
47
48
  /* @__PURE__ */ e(
48
- V,
49
+ $,
49
50
  {
50
51
  isDisabled: s,
51
52
  isInvalid: l,
52
53
  isReadOnly: a,
53
- isOpen: w
54
+ isOpen: N,
55
+ renderValue: S
54
56
  }
55
57
  ),
56
58
  /* @__PURE__ */ e(
57
- z,
59
+ A,
58
60
  {
59
61
  offset: 1,
60
62
  containerPadding: 8,
61
- className: P(),
63
+ className: j(),
62
64
  placement: h,
63
- children: f ? /* @__PURE__ */ c(A, { filter: O, children: [
65
+ children: f ? /* @__PURE__ */ c(T, { filter: L, children: [
64
66
  /* @__PURE__ */ e(
65
- U,
67
+ V,
66
68
  {
67
- "aria-label": x ?? v.formatMessage({
69
+ "aria-label": x ?? w.formatMessage({
68
70
  id: "unity:component:select:search:label",
69
71
  defaultMessage: "Search options"
70
72
  })
@@ -95,10 +97,10 @@ const $ = F({
95
97
  ]
96
98
  }
97
99
  );
98
- }, q = B(function(o, r) {
99
- return k(o, r);
100
+ }, E = C(function(o, r) {
101
+ return q(o, r);
100
102
  });
101
- q.displayName = "Select";
103
+ E.displayName = "Select";
102
104
  export {
103
- q as Select
105
+ E as Select
104
106
  };
@@ -1,15 +1,21 @@
1
- import { jsx as d } from "react/jsx-runtime";
2
- import { forwardRef as m } from "react";
3
- import { useFieldContext as f } from "../../hooks/tanstack-form-context.js";
4
- import { useFieldA11yContext as u } from "../form-field/TanstackFormField.context.js";
5
- import { Select as p } from "./Select.js";
6
- const b = ({ onBlur: o, isReadOnly: a, isDisabled: l, ...r }, s) => {
7
- const e = f(), t = u(), c = e.state.meta.isTouched && !e.state.meta.isValid, i = [t.helperTextId, t.feedbackTextId].filter(Boolean).join(" ");
8
- return /* @__PURE__ */ d(
9
- p,
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { forwardRef as f } from "react";
3
+ import { useFieldContext as u } from "../../hooks/tanstack-form-context.js";
4
+ import { useFieldA11yContext as p } from "../form-field/TanstackFormField.context.js";
5
+ import { Select as b } from "./Select.js";
6
+ const h = ({
7
+ onBlur: o,
8
+ isReadOnly: a,
9
+ isDisabled: l,
10
+ renderValue: r,
11
+ ...s
12
+ }, c) => {
13
+ const e = u(), t = p(), d = e.state.meta.isTouched && !e.state.meta.isValid, i = [t.helperTextId, t.feedbackTextId].filter(Boolean).join(" ");
14
+ return /* @__PURE__ */ m(
15
+ b,
10
16
  {
11
- ...r,
12
- ref: s,
17
+ ...s,
18
+ ref: c,
13
19
  value: e.state.value ?? "",
14
20
  onChange: (n) => {
15
21
  e.handleChange(n);
@@ -19,16 +25,17 @@ const b = ({ onBlur: o, isReadOnly: a, isDisabled: l, ...r }, s) => {
19
25
  },
20
26
  isReadOnly: a,
21
27
  isDisabled: l,
22
- isInvalid: c,
28
+ isInvalid: d,
23
29
  "aria-labelledby": t.labelId,
24
30
  "aria-describedby": i.length > 0 ? i : void 0,
25
- "aria-details": t.contextualLinkId
31
+ "aria-details": t.contextualLinkId,
32
+ renderValue: r
26
33
  }
27
34
  );
28
- }, h = m(function(a, l) {
29
- return b(a, l);
35
+ }, x = f(function(a, l) {
36
+ return h(a, l);
30
37
  });
31
- h.displayName = "TanstackSelect";
38
+ x.displayName = "TanstackSelect";
32
39
  export {
33
- h as TanstackSelect
40
+ x as TanstackSelect
34
41
  };
@@ -1,8 +1,19 @@
1
- export interface SelectButtonProps {
1
+ import { Node } from '@react-types/shared';
2
+ import { ReactNode } from 'react';
3
+ export interface SelectButtonProps<T extends object> {
4
+ /** Whether the button is disabled */
2
5
  isDisabled?: boolean;
6
+ /** Whether the button is in an invalid state */
3
7
  isInvalid?: boolean;
8
+ /** Whether the button is read-only */
4
9
  isReadOnly?: boolean;
10
+ /** Whether the select popover is currently open */
5
11
  isOpen: boolean;
12
+ /** Custom render function to format the selected value display */
13
+ renderValue?: (selectedItem: Node<T>) => ReactNode;
6
14
  }
7
- declare const SelectButton: import('react').ForwardRefExoticComponent<SelectButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
15
+ declare const SelectButton: {
16
+ <T extends object>({ isDisabled, isInvalid, isReadOnly, isOpen, renderValue, }: SelectButtonProps<T>): import("react/jsx-runtime").JSX.Element;
17
+ displayName: string;
18
+ };
8
19
  export { SelectButton };