@payfit/unity-components 2.7.0 → 2.7.1
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.
|
@@ -20,6 +20,23 @@ export interface SelectProps<T extends object> extends Omit<AriaSelectProps<T>,
|
|
|
20
20
|
placement?: Extract<AriaPopoverProps['placement'], 'top' | 'bottom'>;
|
|
21
21
|
/** The aria-label for the search input when isSearchable is true */
|
|
22
22
|
searchInputAriaLabel?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Custom content to render when the listbox has no options to display.
|
|
25
|
+
* This can occur when `items` is empty or when search filtering returns no results.
|
|
26
|
+
* If not provided, the listbox will appear empty.
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* <Select
|
|
30
|
+
* items={[]}
|
|
31
|
+
* renderEmptyState={
|
|
32
|
+
* <EmptyStateNoSearchResults description="No options available" />
|
|
33
|
+
* }
|
|
34
|
+
* >
|
|
35
|
+
* {item => <SelectOption>{item.name}</SelectOption>}
|
|
36
|
+
* </Select>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
renderEmptyState?: ReactNode | (() => ReactNode);
|
|
23
40
|
/** Custom render function to format the selected value display */
|
|
24
41
|
renderValue?: (value: Node<T>) => ReactNode;
|
|
25
42
|
}
|
|
@@ -1,95 +1,115 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as C, useState as F } from "react";
|
|
3
|
-
import { uyTv as
|
|
4
|
-
import { useFilter as
|
|
5
|
-
import { useIntl as
|
|
6
|
-
import { SearchInput as
|
|
7
|
-
import { SelectButton as
|
|
8
|
-
const
|
|
1
|
+
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as C, useState as F, useMemo as I } from "react";
|
|
3
|
+
import { uyTv as A } from "@payfit/unity-themes";
|
|
4
|
+
import { useFilter as T, Select as U, Popover as V, Autocomplete as $, Virtualizer as f, ListLayout as y, ListBox as m } from "react-aria-components";
|
|
5
|
+
import { useIntl as k } from "react-intl";
|
|
6
|
+
import { SearchInput as q } from "./parts/SearchInput.js";
|
|
7
|
+
import { SelectButton as G } from "./parts/SelectButton.js";
|
|
8
|
+
const H = A({
|
|
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
|
-
}),
|
|
15
|
-
children:
|
|
16
|
-
items:
|
|
17
|
-
placeholder:
|
|
18
|
-
isDisabled:
|
|
19
|
-
isInvalid:
|
|
20
|
-
isReadOnly:
|
|
21
|
-
value:
|
|
22
|
-
defaultValue:
|
|
23
|
-
onChange:
|
|
24
|
-
isSearchable:
|
|
25
|
-
onBlur:
|
|
26
|
-
placement:
|
|
27
|
-
searchInputAriaLabel:
|
|
14
|
+
}), J = ({
|
|
15
|
+
children: r,
|
|
16
|
+
items: t,
|
|
17
|
+
placeholder: s,
|
|
18
|
+
isDisabled: l,
|
|
19
|
+
isInvalid: n,
|
|
20
|
+
isReadOnly: i,
|
|
21
|
+
value: a,
|
|
22
|
+
defaultValue: b,
|
|
23
|
+
onChange: u,
|
|
24
|
+
isSearchable: h = !1,
|
|
25
|
+
onBlur: v,
|
|
26
|
+
placement: x,
|
|
27
|
+
searchInputAriaLabel: g,
|
|
28
|
+
renderEmptyState: o,
|
|
28
29
|
renderValue: S,
|
|
29
|
-
...
|
|
30
|
-
},
|
|
31
|
-
const
|
|
32
|
-
value:
|
|
33
|
-
onChange:
|
|
34
|
-
} : { defaultValue:
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
...w
|
|
31
|
+
}, N) => {
|
|
32
|
+
const O = k(), [L, M] = F(!1), { contains: P } = T({ sensitivity: "base" }), { base: j, popover: z, listbox: c } = H(), B = a !== void 0 || u !== void 0 ? {
|
|
33
|
+
value: a,
|
|
34
|
+
onChange: u
|
|
35
|
+
} : { defaultValue: b }, p = I(() => {
|
|
36
|
+
if (o !== void 0)
|
|
37
|
+
return typeof o == "function" ? o : () => o;
|
|
38
|
+
}, [o]);
|
|
39
|
+
return /* @__PURE__ */ d(
|
|
40
|
+
U,
|
|
37
41
|
{
|
|
38
|
-
onOpenChange:
|
|
39
|
-
...
|
|
40
|
-
ref:
|
|
41
|
-
className:
|
|
42
|
-
placeholder:
|
|
43
|
-
isDisabled:
|
|
44
|
-
isInvalid:
|
|
45
|
-
onBlur:
|
|
42
|
+
onOpenChange: M,
|
|
43
|
+
...w,
|
|
44
|
+
ref: N,
|
|
45
|
+
className: j(),
|
|
46
|
+
placeholder: l ? void 0 : s,
|
|
47
|
+
isDisabled: l || i,
|
|
48
|
+
isInvalid: n,
|
|
49
|
+
onBlur: v,
|
|
46
50
|
...B,
|
|
47
51
|
children: [
|
|
48
52
|
/* @__PURE__ */ e(
|
|
49
|
-
|
|
53
|
+
G,
|
|
50
54
|
{
|
|
51
|
-
isDisabled:
|
|
52
|
-
isInvalid:
|
|
53
|
-
isReadOnly:
|
|
54
|
-
isOpen:
|
|
55
|
+
isDisabled: l,
|
|
56
|
+
isInvalid: n,
|
|
57
|
+
isReadOnly: i,
|
|
58
|
+
isOpen: L,
|
|
55
59
|
renderValue: S
|
|
56
60
|
}
|
|
57
61
|
),
|
|
58
62
|
/* @__PURE__ */ e(
|
|
59
|
-
|
|
63
|
+
V,
|
|
60
64
|
{
|
|
61
65
|
offset: 1,
|
|
62
66
|
containerPadding: 8,
|
|
63
|
-
className:
|
|
64
|
-
placement:
|
|
65
|
-
children:
|
|
67
|
+
className: z(),
|
|
68
|
+
placement: x,
|
|
69
|
+
children: h ? /* @__PURE__ */ d($, { filter: P, children: [
|
|
66
70
|
/* @__PURE__ */ e(
|
|
67
|
-
|
|
71
|
+
q,
|
|
68
72
|
{
|
|
69
|
-
"aria-label":
|
|
73
|
+
"aria-label": g ?? O.formatMessage({
|
|
70
74
|
id: "unity:component:select:search:label",
|
|
71
75
|
defaultMessage: "Search options"
|
|
72
76
|
})
|
|
73
77
|
}
|
|
74
78
|
),
|
|
75
79
|
/* @__PURE__ */ e(
|
|
76
|
-
|
|
80
|
+
f,
|
|
77
81
|
{
|
|
78
|
-
layout:
|
|
82
|
+
layout: y,
|
|
79
83
|
layoutOptions: {
|
|
80
84
|
padding: 8
|
|
81
85
|
},
|
|
82
|
-
children: /* @__PURE__ */ e(
|
|
86
|
+
children: /* @__PURE__ */ e(
|
|
87
|
+
m,
|
|
88
|
+
{
|
|
89
|
+
items: t,
|
|
90
|
+
className: c(),
|
|
91
|
+
renderEmptyState: p,
|
|
92
|
+
children: r
|
|
93
|
+
}
|
|
94
|
+
)
|
|
83
95
|
}
|
|
84
96
|
)
|
|
85
97
|
] }) : /* @__PURE__ */ e(
|
|
86
|
-
|
|
98
|
+
f,
|
|
87
99
|
{
|
|
88
|
-
layout:
|
|
100
|
+
layout: y,
|
|
89
101
|
layoutOptions: {
|
|
90
102
|
padding: 8
|
|
91
103
|
},
|
|
92
|
-
children: /* @__PURE__ */ e(
|
|
104
|
+
children: /* @__PURE__ */ e(
|
|
105
|
+
m,
|
|
106
|
+
{
|
|
107
|
+
items: t,
|
|
108
|
+
className: c(),
|
|
109
|
+
renderEmptyState: p,
|
|
110
|
+
children: r
|
|
111
|
+
}
|
|
112
|
+
)
|
|
93
113
|
}
|
|
94
114
|
)
|
|
95
115
|
}
|
|
@@ -97,10 +117,10 @@ const k = I({
|
|
|
97
117
|
]
|
|
98
118
|
}
|
|
99
119
|
);
|
|
100
|
-
},
|
|
101
|
-
return
|
|
120
|
+
}, K = C(function(t, s) {
|
|
121
|
+
return J(t, s);
|
|
102
122
|
});
|
|
103
|
-
|
|
123
|
+
K.displayName = "Select";
|
|
104
124
|
export {
|
|
105
|
-
|
|
125
|
+
K as Select
|
|
106
126
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payfit/unity-components",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"module": "./dist/esm/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@hookform/devtools": "4.4.0",
|
|
43
43
|
"@hookform/resolvers": "5.2.1",
|
|
44
44
|
"@internationalized/date": "3.11.0",
|
|
45
|
-
"@payfit/unity-illustrations": "2.7.
|
|
45
|
+
"@payfit/unity-illustrations": "2.7.1",
|
|
46
46
|
"@radix-ui/react-avatar": "1.1.11",
|
|
47
47
|
"@radix-ui/react-slot": "1.2.4",
|
|
48
48
|
"@react-aria/interactions": "3.27.0",
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"@hookform/devtools": "^4",
|
|
74
|
-
"@payfit/unity-icons": "2.7.
|
|
75
|
-
"@payfit/unity-themes": "2.7.
|
|
74
|
+
"@payfit/unity-icons": "2.7.1",
|
|
75
|
+
"@payfit/unity-themes": "2.7.1",
|
|
76
76
|
"@storybook/react-vite": "^10.2.2",
|
|
77
77
|
"@tanstack/react-query": "^5",
|
|
78
78
|
"@tanstack/react-router": "^1.131",
|
|
@@ -91,9 +91,9 @@
|
|
|
91
91
|
"@payfit/hr-apps-tsconfigs": "0.0.0-use.local",
|
|
92
92
|
"@payfit/storybook-addon-console-errors": "0.0.0-use.local",
|
|
93
93
|
"@payfit/storybook-config": "0.0.0-use.local",
|
|
94
|
-
"@payfit/unity-icons": "2.7.
|
|
95
|
-
"@payfit/unity-illustrations": "2.7.
|
|
96
|
-
"@payfit/unity-themes": "2.7.
|
|
94
|
+
"@payfit/unity-icons": "2.7.1",
|
|
95
|
+
"@payfit/unity-illustrations": "2.7.1",
|
|
96
|
+
"@payfit/unity-themes": "2.7.1",
|
|
97
97
|
"@payfit/vite-configs": "0.0.0-use.local",
|
|
98
98
|
"@storybook/addon-a11y": "10.2.7",
|
|
99
99
|
"@storybook/addon-docs": "10.2.7",
|