@okam/stack-ui 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/components/fields/ComboBox/interface.d.ts +6 -0
- package/components/fields/ListBox/interface.d.ts +1 -1
- package/components/fields/SearchField/interface.d.ts +9 -2
- package/components/fields/TextArea/attributes.d.ts +1 -0
- package/components/fields/TextInputField/attributes.d.ts +1 -0
- package/index.d.ts +1 -0
- package/index119.js +1 -1
- package/index119.mjs +1 -1
- package/index12.js +1 -1
- package/index12.mjs +6 -6
- package/index122.js +1 -1
- package/index122.mjs +22 -22
- package/index127.js +1 -1
- package/index127.mjs +10 -10
- package/index131.js +1 -1
- package/index131.mjs +1 -1
- package/index133.js +1 -1
- package/index133.mjs +11 -14
- package/index134.js +1 -1
- package/index134.mjs +12 -7
- package/index135.js +1 -1
- package/index135.mjs +14 -7
- package/index136.js +1 -1
- package/index136.mjs +6 -15
- package/index137.js +1 -1
- package/index137.mjs +7 -31
- package/index138.js +1 -2
- package/index138.mjs +15 -8
- package/index139.js +1 -2
- package/index139.mjs +30 -9
- package/index140.js +2 -1
- package/index140.mjs +8 -23
- package/index141.js +1 -1
- package/index141.mjs +8 -45
- package/index142.js +1 -1
- package/index142.mjs +24 -52
- package/index143.js +2 -6
- package/index143.mjs +45 -92
- package/index144.js +1 -1
- package/index144.mjs +52 -70
- package/index145.js +6 -1
- package/index145.mjs +82 -29
- package/index146.js +1 -51
- package/index146.mjs +65 -86
- package/index147.js +1 -64
- package/index147.mjs +33 -220
- package/index148.js +51 -10
- package/index148.mjs +85 -65
- package/index149.js +64 -1
- package/index149.mjs +214 -31
- package/index150.js +10 -1
- package/index150.mjs +68 -10
- package/index151.js +1 -6
- package/index151.mjs +42 -46
- package/index152.js +1 -5
- package/index152.mjs +10 -85
- package/index153.js +7 -1
- package/index153.mjs +50 -6
- package/index154.js +4 -11
- package/index154.mjs +78 -30
- package/index155.js +1 -1
- package/index155.mjs +6 -96
- package/index156.js +12 -1
- package/index156.mjs +39 -12
- package/index157.js +1 -1
- package/index157.mjs +96 -8
- package/index158.js +1 -1
- package/index158.mjs +13 -29
- package/index159.js +1 -1
- package/index159.mjs +7 -12
- package/index160.js +1 -7
- package/index160.mjs +23 -13
- package/index161.js +1 -15
- package/index161.mjs +9 -67
- package/index162.js +7 -1
- package/index162.mjs +22 -6
- package/index163.js +15 -9
- package/index163.mjs +68 -12
- package/index164.js +1 -41
- package/index164.mjs +7 -106
- package/index165.js +9 -47
- package/index165.mjs +13 -100
- package/index166.js +40 -15
- package/index166.mjs +100 -19
- package/index167.js +45 -18
- package/index167.mjs +85 -59
- package/index168.js +16 -1
- package/index168.mjs +20 -37
- package/index169.js +20 -1
- package/index169.mjs +76 -12
- package/index17.js +1 -1
- package/index17.mjs +14 -14
- package/index170.js +1 -1
- package/index170.mjs +41 -10
- package/index171.js +1 -1
- package/index171.mjs +11 -6
- package/index172.js +1 -2
- package/index172.mjs +6 -47
- package/index173.js +2 -0
- package/index173.mjs +50 -0
- package/index174.js +1 -0
- package/index174.mjs +13 -0
- package/index18.js +1 -1
- package/index18.mjs +7 -7
- package/index2.js +1 -1
- package/index2.mjs +4 -4
- package/index26.js +1 -1
- package/index26.mjs +15 -15
- package/index27.js +1 -1
- package/index27.mjs +15 -15
- package/index32.js +1 -1
- package/index32.mjs +105 -85
- package/index35.js +1 -1
- package/index35.mjs +14 -14
- package/index38.js +1 -1
- package/index38.mjs +115 -107
- package/index39.js +1 -1
- package/index39.mjs +11 -11
- package/index43.js +1 -1
- package/index43.mjs +55 -52
- package/index46.js +1 -1
- package/index46.mjs +86 -87
- package/index47.js +1 -1
- package/index47.mjs +110 -111
- package/index48.js +1 -1
- package/index48.mjs +3 -3
- package/index52.js +1 -1
- package/index52.mjs +1 -1
- package/index53.js +1 -1
- package/index53.mjs +1 -1
- package/index54.js +1 -1
- package/index54.mjs +3 -3
- package/index56.js +1 -1
- package/index56.mjs +33 -32
- package/index66.js +1 -1
- package/index66.mjs +1 -1
- package/index68.js +1 -1
- package/index68.mjs +11 -11
- package/index72.js +1 -1
- package/index72.mjs +13 -13
- package/index76.js +1 -1
- package/index76.mjs +1 -1
- package/index8.js +1 -1
- package/index8.mjs +30 -30
- package/index91.js +1 -1
- package/index91.mjs +50 -49
- package/package.json +2 -2
- package/theme/Search/index.d.ts +2 -1
package/index32.mjs
CHANGED
|
@@ -1,114 +1,134 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as t, jsxs as
|
|
3
|
-
import { isEmpty as
|
|
4
|
-
import { useRef as s,
|
|
5
|
-
import { useFilter as
|
|
2
|
+
import { jsx as t, jsxs as h } from "react/jsx-runtime";
|
|
3
|
+
import { isEmpty as ce } from "radashi";
|
|
4
|
+
import { useRef as s, useEffect as pe, useCallback as me, useMemo as fe } from "react";
|
|
5
|
+
import { useFilter as he, useComboBox as de } from "react-aria";
|
|
6
6
|
import "react-hook-form";
|
|
7
|
-
import { useComboBoxState as
|
|
8
|
-
import { useDebounce as
|
|
9
|
-
import
|
|
10
|
-
import { Box as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { Popover as
|
|
15
|
-
import { Typography as
|
|
16
|
-
import { ControlledListBox as
|
|
17
|
-
import
|
|
18
|
-
function
|
|
7
|
+
import { useComboBoxState as Re } from "react-stately";
|
|
8
|
+
import { useDebounce as be } from "./index78.mjs";
|
|
9
|
+
import Pe from "./index88.mjs";
|
|
10
|
+
import { Box as y, BoxWithForwardRef as xe } from "./index7.mjs";
|
|
11
|
+
import Be from "./index48.mjs";
|
|
12
|
+
import Ce from "./index93.mjs";
|
|
13
|
+
import ge from "./index99.mjs";
|
|
14
|
+
import { Popover as Ie } from "./index56.mjs";
|
|
15
|
+
import { Typography as S } from "./index74.mjs";
|
|
16
|
+
import { ControlledListBox as ke } from "./index38.mjs";
|
|
17
|
+
import ve from "./index127.mjs";
|
|
18
|
+
function Ke(l) {
|
|
19
19
|
const {
|
|
20
|
-
children:
|
|
21
|
-
hookFormRef:
|
|
22
|
-
errorMessage:
|
|
23
|
-
themeName:
|
|
24
|
-
tokens:
|
|
25
|
-
customTheme:
|
|
26
|
-
label:
|
|
27
|
-
icon:
|
|
28
|
-
closeIcon:
|
|
29
|
-
isDisabled:
|
|
30
|
-
isRequired:
|
|
31
|
-
isReadOnly:
|
|
32
|
-
defaultFilter:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
20
|
+
children: V,
|
|
21
|
+
hookFormRef: d,
|
|
22
|
+
errorMessage: R,
|
|
23
|
+
themeName: o = "comboBox",
|
|
24
|
+
tokens: b,
|
|
25
|
+
customTheme: $,
|
|
26
|
+
label: P,
|
|
27
|
+
icon: F = /* @__PURE__ */ t(Ce, {}),
|
|
28
|
+
closeIcon: M = /* @__PURE__ */ t(ge, {}),
|
|
29
|
+
isDisabled: D = !1,
|
|
30
|
+
isRequired: E = !1,
|
|
31
|
+
isReadOnly: T = !1,
|
|
32
|
+
defaultFilter: w,
|
|
33
|
+
onInputChange: a,
|
|
34
|
+
onSelectionChange: O,
|
|
35
|
+
inputRef: W,
|
|
36
|
+
buttonRef: j,
|
|
37
|
+
popoverRef: z,
|
|
38
|
+
listBoxRef: A,
|
|
39
|
+
debounceDelay: L = 200,
|
|
40
|
+
isNonModal: x = !0
|
|
41
|
+
} = l, q = s(null), c = W ?? q, K = s(null), B = j ?? K, G = s(null), C = z ?? G, H = s(null), g = A ?? H, i = s(null), { contains: J } = he({ sensitivity: "base" }), Q = w ?? J, p = l.inputValue !== void 0, e = Re({
|
|
42
|
+
...l,
|
|
43
|
+
defaultFilter: Q,
|
|
44
|
+
onInputChange: p ? a : void 0,
|
|
45
|
+
onSelectionChange: O
|
|
46
|
+
}), I = be(e.inputValue, L);
|
|
47
|
+
pe(() => {
|
|
48
|
+
p || a?.(I);
|
|
49
|
+
}, [I, p, a]);
|
|
50
|
+
const { inputProps: U, listBoxProps: X, labelProps: Y, buttonProps: Z, errorMessageProps: _, isInvalid: k } = de(
|
|
51
|
+
{ ...l, inputRef: c, buttonRef: B, popoverRef: C, listBoxRef: g },
|
|
52
|
+
e
|
|
53
|
+
), {
|
|
54
|
+
onPress: ee,
|
|
55
|
+
onPressStart: v,
|
|
56
|
+
onPressEnd: Ne,
|
|
57
|
+
onPressChange: ye,
|
|
58
|
+
preventFocusOnPress: oe,
|
|
59
|
+
...te
|
|
60
|
+
} = Z, { isOpen: u, selectedItem: m, selectionManager: ne } = e, { isFocused: re, isSelectAll: se, isEmpty: le } = ne, f = !ce(e.inputValue), N = !le, n = {
|
|
61
|
+
...b,
|
|
62
|
+
isInvalid: k,
|
|
63
|
+
isOpen: u,
|
|
64
|
+
isFocused: re,
|
|
65
|
+
hasValue: f,
|
|
66
|
+
hasSelectedItem: N,
|
|
67
|
+
isSelectAll: se,
|
|
68
|
+
isReadOnly: T,
|
|
69
|
+
isDisabled: D,
|
|
70
|
+
isRequired: E
|
|
71
|
+
}, ie = me(
|
|
59
72
|
(r) => {
|
|
60
|
-
r != null && (
|
|
73
|
+
r != null && (d?.(r), c.current = r);
|
|
61
74
|
},
|
|
62
|
-
[
|
|
63
|
-
),
|
|
64
|
-
return /* @__PURE__ */
|
|
65
|
-
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
/* @__PURE__ */ t("input", { ...
|
|
75
|
+
[d, c]
|
|
76
|
+
), ue = fe(() => m != null && !u ? m.rendered : e.inputValue, [m, e.inputValue, u]), ae = Pe(`${o}.input`, b);
|
|
77
|
+
return /* @__PURE__ */ h(y, { themeName: `${o}.wrapper`, tokens: n, customTheme: $, children: [
|
|
78
|
+
P != null && /* @__PURE__ */ t(S, { ...Y, as: "label", themeName: `${o}.label`, tokens: n, children: P }),
|
|
79
|
+
/* @__PURE__ */ h(y, { themeName: `${o}.container`, children: [
|
|
80
|
+
/* @__PURE__ */ h(xe, { ref: i, themeName: `${o}.inputWrapper`, tokens: n, children: [
|
|
81
|
+
/* @__PURE__ */ t("input", { ...U, ref: ie, value: ue, className: ae }),
|
|
69
82
|
/* @__PURE__ */ t(
|
|
70
|
-
|
|
83
|
+
ve,
|
|
71
84
|
{
|
|
72
|
-
state:
|
|
73
|
-
themeName: `${
|
|
85
|
+
state: e,
|
|
86
|
+
themeName: `${o}.button`,
|
|
74
87
|
tokens: n,
|
|
75
|
-
...
|
|
76
|
-
|
|
88
|
+
...te,
|
|
89
|
+
preventFocusOnPress: oe,
|
|
90
|
+
ref: B,
|
|
77
91
|
handlePress: (r) => {
|
|
78
|
-
|
|
92
|
+
if (f || N) {
|
|
93
|
+
e.setSelectedKey(null), e.selectionManager.clearSelection(), e.setInputValue("");
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
v != null ? v(r) : ee?.(r);
|
|
79
97
|
},
|
|
80
|
-
children: /* @__PURE__ */ t(
|
|
98
|
+
children: /* @__PURE__ */ t(Be, { themeName: `${o}.icon`, tokens: n, icon: f ? M : F })
|
|
81
99
|
}
|
|
82
100
|
)
|
|
83
101
|
] }),
|
|
84
|
-
|
|
85
|
-
|
|
102
|
+
u && i.current != null && e.collection.size > 0 && /* @__PURE__ */ t(
|
|
103
|
+
Ie,
|
|
86
104
|
{
|
|
87
|
-
themeName: `${
|
|
105
|
+
themeName: `${o}.popover`,
|
|
88
106
|
tokens: n,
|
|
89
|
-
state:
|
|
90
|
-
triggerRef:
|
|
107
|
+
state: e,
|
|
108
|
+
triggerRef: i,
|
|
91
109
|
placement: "bottom",
|
|
92
|
-
sizeRef:
|
|
93
|
-
popoverRef:
|
|
110
|
+
sizeRef: i,
|
|
111
|
+
popoverRef: C,
|
|
112
|
+
isNonModal: x,
|
|
94
113
|
autoFocus: !1,
|
|
114
|
+
contain: !x,
|
|
95
115
|
children: /* @__PURE__ */ t(
|
|
96
|
-
|
|
116
|
+
ke,
|
|
97
117
|
{
|
|
98
|
-
...
|
|
99
|
-
themeName: `${
|
|
118
|
+
...X,
|
|
119
|
+
themeName: `${o}.list`,
|
|
100
120
|
tokens: n,
|
|
101
|
-
state:
|
|
102
|
-
ref:
|
|
103
|
-
children:
|
|
121
|
+
state: e,
|
|
122
|
+
ref: g,
|
|
123
|
+
children: V
|
|
104
124
|
}
|
|
105
125
|
)
|
|
106
126
|
}
|
|
107
127
|
),
|
|
108
|
-
|
|
128
|
+
k && R != null && /* @__PURE__ */ t(S, { tokens: n, themeName: `${o}.errorMessage`, ..._, children: R })
|
|
109
129
|
] })
|
|
110
130
|
] });
|
|
111
131
|
}
|
|
112
132
|
export {
|
|
113
|
-
|
|
133
|
+
Ke as default
|
|
114
134
|
};
|
package/index35.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react"),r=require("react-aria"),i=require("./index7.js");function p({themeName:o="datePicker",tokens:s,...t}){const a=u.useRef(null),{state:n,children:c}={...t},{popoverProps:l,underlayProps:d}=r.usePopover({...t,popoverRef:a},n);return e.jsx(r.Overlay,{children:e.jsxs(i.Box,{themeName:`${o}.calendarPopoverWrapper`,tokens:s,children:[e.jsx(i.Box,{themeName:`${o}.calendarUnderlay`,tokens:s,...d}),e.jsxs(i.BoxWithForwardRef,{themeName:`${o}.calendarPopover`,tokens:s,...l,ref:a,children:[e.jsx(r.DismissButton,{onDismiss:n.close}),c,e.jsx(r.DismissButton,{onDismiss:n.close})]})]})})}exports.CalendarPopover=p;
|
package/index35.mjs
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { usePopover as
|
|
5
|
-
import { Box as
|
|
6
|
-
function B({ themeName:
|
|
7
|
-
const i =
|
|
2
|
+
import { jsx as r, jsxs as p } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as d } from "react";
|
|
4
|
+
import { usePopover as f, Overlay as u, DismissButton as a } from "react-aria";
|
|
5
|
+
import { Box as l, BoxWithForwardRef as v } from "./index7.mjs";
|
|
6
|
+
function B({ themeName: o = "datePicker", tokens: e, ...n }) {
|
|
7
|
+
const i = d(null), { state: s, children: c } = { ...n }, { popoverProps: t, underlayProps: m } = f(
|
|
8
8
|
{
|
|
9
9
|
...n,
|
|
10
10
|
popoverRef: i
|
|
11
11
|
},
|
|
12
|
-
|
|
12
|
+
s
|
|
13
13
|
);
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */ r(
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
/* @__PURE__ */ r(
|
|
18
|
-
|
|
19
|
-
/* @__PURE__ */ r(
|
|
14
|
+
return /* @__PURE__ */ r(u, { children: /* @__PURE__ */ p(l, { themeName: `${o}.calendarPopoverWrapper`, tokens: e, children: [
|
|
15
|
+
/* @__PURE__ */ r(l, { themeName: `${o}.calendarUnderlay`, tokens: e, ...m }),
|
|
16
|
+
/* @__PURE__ */ p(v, { themeName: `${o}.calendarPopover`, tokens: e, ...t, ref: i, children: [
|
|
17
|
+
/* @__PURE__ */ r(a, { onDismiss: s.close }),
|
|
18
|
+
c,
|
|
19
|
+
/* @__PURE__ */ r(a, { onDismiss: s.close })
|
|
20
20
|
] })
|
|
21
|
-
] });
|
|
21
|
+
] }) });
|
|
22
22
|
}
|
|
23
23
|
export {
|
|
24
24
|
B as CalendarPopover
|
package/index38.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),O=require("radashi"),E=require("react"),M=require("react-aria"),v=require("react-hook-form"),H=require("react-stately"),A=require("./index89.js"),N=require("./index7.js"),I=require("./index8.js"),S=require("./index74.js"),K=require("./index40.js"),V=require("./index39.js"),W={item:K,section:V};function k({ref:e,...o}){const{state:r,themeName:c="listBox",tokens:m,customTheme:b,label:d,escapeKeyBehavior:h="clearSelection",linkElementType:R=I.Anchor,isDisabled:n=!1,isRequired:C=!1,isInvalid:L=!1,isError:x=!1,errorMessage:f,disabledKeys:y,fieldRef:q,...B}=o,g=r.collection.getKeys(),a=t=>{if(t!=null){if(q?.(t),e==null)return;typeof e=="function"?e(t):typeof e=="object"&&(e.current=t)}},{listBoxProps:j,labelProps:i}=M.useListBox({...B,escapeKeyBehavior:h,label:d,disabledKeys:n?g:y},r,a),l={...m,isDisabled:n,isRequired:C,isInvalid:L};return s.jsxs(N.Box,{themeName:`${c}.wrapper`,tokens:l,customTheme:b,children:[d!=null&&s.jsx(S.Typography,{...i,themeName:`${c}.label`,tokens:l,children:d}),s.jsx(N.BoxWithForwardRef,{ref:e,as:"ul",...j,themeName:`${c}.list`,tokens:l,children:Array.from(r.collection,t=>{const{key:F}=t,u=t.type??"item",p=W[u]??K;return s.jsx(p,{[u]:t,state:r,tokens:{...m,type:u},themeName:`${c}.${u}`,linkElementType:R},F)})}),x&&f!=null&&s.jsx(S.Typography,{themeName:`${c}.errorMessage`,tokens:{...l,isError:x},children:f})]})}k.displayName="ControlledListBox";function Q(e){const o=H.useListState(e),r=E.useRef(null);return s.jsx(k,{...e,state:o,ref:r})}function $({ref:e,...o}){const{name:r,rules:c,isRequired:m,isDisabled:b,tokens:d,selectionMode:h="single",errorMessage:R,...n}=o,{control:C,setValue:L,watch:x,getValues:f}=v.useFormContext(),{selectedKeys:y=x(r),defaultSelectedKeys:q=f(r)}=n,{t:B}=A.useTranslation(),g=E.useRef(null),a={required:m?B("FORM.ERROR.REQUIRED")??"required":!1,disabled:b,...c},j=H.useListState({...n,selectionMode:h,selectedKeys:y,children:o.children,onSelectionChange:i=>{n.onSelectionChange?.(i),L(r,i,{shouldDirty:!0,shouldTouch:!0}),g.current?.(i)}});return s.jsx(v.Controller,{...n,defaultValue:q,name:r,control:C,rules:a,disabled:a?.disabled,render:({field:i,fieldState:l})=>{const{ref:t,onChange:F,...u}=i;g.current=F;const p=!O.isEmpty(l.error),T={isDisabled:i.disabled??!1,isRequired:a?.required===!0||a?.required==="required",isInvalid:l.invalid,isError:p},{isError:_,...D}=T,P={...d,...D};return s.jsx(k,{...M.mergeProps(n,u,T),state:j,tokens:P,isError:p,selectionMode:h,selectedKeys:y,defaultSelectedKeys:q,errorMessage:R??l.error?.message,ref:e})}})}$.displayName="ControlledReactHookFormListBox";function U(e){const o=E.useRef(null);return s.jsx($,{...e,ref:o})}exports.ControlledListBox=k;exports.ControlledReactHookFormListBox=$;exports.ListBox=Q;exports.ReactHookFormListBox=U;
|
package/index38.mjs
CHANGED
|
@@ -1,130 +1,138 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { isEmpty as
|
|
4
|
-
import { useRef as
|
|
5
|
-
import { useListBox as
|
|
6
|
-
import { useFormContext as
|
|
7
|
-
import { useListState as
|
|
8
|
-
import { useTranslation as
|
|
9
|
-
import { Box as
|
|
10
|
-
import { Anchor as
|
|
11
|
-
import { Typography as
|
|
2
|
+
import { jsxs as P, jsx as l } from "react/jsx-runtime";
|
|
3
|
+
import { isEmpty as S } from "radashi";
|
|
4
|
+
import { useRef as F } from "react";
|
|
5
|
+
import { useListBox as j, mergeProps as H } from "react-aria";
|
|
6
|
+
import { useFormContext as I, Controller as V } from "react-hook-form";
|
|
7
|
+
import { useListState as K } from "react-stately";
|
|
8
|
+
import { useTranslation as A } from "./index89.mjs";
|
|
9
|
+
import { Box as W, BoxWithForwardRef as Q } from "./index7.mjs";
|
|
10
|
+
import { Anchor as U } from "./index8.mjs";
|
|
11
|
+
import { Typography as T } from "./index74.mjs";
|
|
12
12
|
import M from "./index40.mjs";
|
|
13
|
-
import
|
|
14
|
-
const
|
|
13
|
+
import _ from "./index39.mjs";
|
|
14
|
+
const w = {
|
|
15
15
|
item: M,
|
|
16
|
-
section:
|
|
16
|
+
section: _
|
|
17
17
|
};
|
|
18
|
-
function
|
|
18
|
+
function N({ ref: e, ...t }) {
|
|
19
19
|
const {
|
|
20
|
-
|
|
20
|
+
state: r,
|
|
21
|
+
themeName: a = "listBox",
|
|
21
22
|
tokens: u,
|
|
22
|
-
customTheme:
|
|
23
|
-
label:
|
|
24
|
-
escapeKeyBehavior:
|
|
25
|
-
linkElementType:
|
|
26
|
-
isDisabled:
|
|
27
|
-
isRequired:
|
|
28
|
-
isInvalid:
|
|
23
|
+
customTheme: x,
|
|
24
|
+
label: d,
|
|
25
|
+
escapeKeyBehavior: f = "clearSelection",
|
|
26
|
+
linkElementType: C = U,
|
|
27
|
+
isDisabled: s = !1,
|
|
28
|
+
isRequired: E = !1,
|
|
29
|
+
isInvalid: R = !1,
|
|
29
30
|
isError: p = !1,
|
|
30
|
-
errorMessage:
|
|
31
|
-
disabledKeys:
|
|
32
|
-
fieldRef:
|
|
33
|
-
...
|
|
34
|
-
} =
|
|
35
|
-
if (
|
|
36
|
-
if (
|
|
31
|
+
errorMessage: h,
|
|
32
|
+
disabledKeys: y,
|
|
33
|
+
fieldRef: g,
|
|
34
|
+
...B
|
|
35
|
+
} = t, k = r.collection.getKeys(), c = (o) => {
|
|
36
|
+
if (o != null) {
|
|
37
|
+
if (g?.(o), e == null)
|
|
37
38
|
return;
|
|
38
|
-
typeof e == "function" ? e(
|
|
39
|
+
typeof e == "function" ? e(o) : typeof e == "object" && (e.current = o);
|
|
39
40
|
}
|
|
40
|
-
}, { listBoxProps:
|
|
41
|
+
}, { listBoxProps: L, labelProps: n } = j(
|
|
41
42
|
{
|
|
42
|
-
...
|
|
43
|
-
escapeKeyBehavior:
|
|
44
|
-
label:
|
|
45
|
-
disabledKeys:
|
|
43
|
+
...B,
|
|
44
|
+
escapeKeyBehavior: f,
|
|
45
|
+
label: d,
|
|
46
|
+
disabledKeys: s ? k : y
|
|
46
47
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
),
|
|
48
|
+
r,
|
|
49
|
+
c
|
|
50
|
+
), i = {
|
|
50
51
|
...u,
|
|
51
|
-
isDisabled:
|
|
52
|
-
isRequired:
|
|
53
|
-
isInvalid:
|
|
54
|
-
isError: p
|
|
52
|
+
isDisabled: s,
|
|
53
|
+
isRequired: E,
|
|
54
|
+
isInvalid: R
|
|
55
55
|
};
|
|
56
|
-
return /* @__PURE__ */
|
|
57
|
-
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
|
|
56
|
+
return /* @__PURE__ */ P(W, { themeName: `${a}.wrapper`, tokens: i, customTheme: x, children: [
|
|
57
|
+
d != null && /* @__PURE__ */ l(T, { ...n, themeName: `${a}.label`, tokens: i, children: d }),
|
|
58
|
+
/* @__PURE__ */ l(
|
|
59
|
+
Q,
|
|
60
60
|
{
|
|
61
61
|
ref: e,
|
|
62
62
|
as: "ul",
|
|
63
|
-
...
|
|
64
|
-
themeName: `${
|
|
65
|
-
tokens:
|
|
66
|
-
children:
|
|
67
|
-
const { key:
|
|
68
|
-
return /* @__PURE__ */
|
|
69
|
-
|
|
63
|
+
...L,
|
|
64
|
+
themeName: `${a}.list`,
|
|
65
|
+
tokens: i,
|
|
66
|
+
children: Array.from(r.collection, (o) => {
|
|
67
|
+
const { key: q } = o, m = o.type ?? "item", b = w[m] ?? M;
|
|
68
|
+
return /* @__PURE__ */ l(
|
|
69
|
+
b,
|
|
70
70
|
{
|
|
71
|
-
[
|
|
72
|
-
state:
|
|
73
|
-
tokens: { ...u, type:
|
|
74
|
-
themeName: `${
|
|
75
|
-
linkElementType:
|
|
71
|
+
[m]: o,
|
|
72
|
+
state: r,
|
|
73
|
+
tokens: { ...u, type: m },
|
|
74
|
+
themeName: `${a}.${m}`,
|
|
75
|
+
linkElementType: C
|
|
76
76
|
},
|
|
77
|
-
|
|
77
|
+
q
|
|
78
78
|
);
|
|
79
79
|
})
|
|
80
80
|
}
|
|
81
81
|
),
|
|
82
|
-
p &&
|
|
82
|
+
p && h != null && /* @__PURE__ */ l(T, { themeName: `${a}.errorMessage`, tokens: { ...i, isError: p }, children: h })
|
|
83
83
|
] });
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
function
|
|
87
|
-
const
|
|
88
|
-
return /* @__PURE__ */
|
|
85
|
+
N.displayName = "ControlledListBox";
|
|
86
|
+
function le(e) {
|
|
87
|
+
const t = K(e), r = F(null);
|
|
88
|
+
return /* @__PURE__ */ l(N, { ...e, state: t, ref: r });
|
|
89
89
|
}
|
|
90
|
-
function
|
|
91
|
-
const { name:
|
|
92
|
-
required:
|
|
93
|
-
disabled:
|
|
94
|
-
...
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
90
|
+
function $({ ref: e, ...t }) {
|
|
91
|
+
const { name: r, rules: a, isRequired: u, isDisabled: x, tokens: d, selectionMode: f = "single", errorMessage: C, ...s } = t, { control: E, setValue: R, watch: p, getValues: h } = I(), { selectedKeys: y = p(r), defaultSelectedKeys: g = h(r) } = s, { t: B } = A(), k = F(null), c = {
|
|
92
|
+
required: u ? B("FORM.ERROR.REQUIRED") ?? "required" : !1,
|
|
93
|
+
disabled: x,
|
|
94
|
+
...a
|
|
95
|
+
}, L = K({
|
|
96
|
+
...s,
|
|
97
|
+
selectionMode: f,
|
|
98
|
+
selectedKeys: y,
|
|
99
|
+
children: t.children,
|
|
100
|
+
onSelectionChange: (n) => {
|
|
101
|
+
s.onSelectionChange?.(n), R(r, n, { shouldDirty: !0, shouldTouch: !0 }), k.current?.(n);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
return /* @__PURE__ */ l(
|
|
105
|
+
V,
|
|
98
106
|
{
|
|
99
|
-
...
|
|
100
|
-
defaultValue:
|
|
101
|
-
name:
|
|
102
|
-
control:
|
|
103
|
-
rules:
|
|
104
|
-
disabled:
|
|
105
|
-
render: ({ field:
|
|
106
|
-
const { ref:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
107
|
+
...s,
|
|
108
|
+
defaultValue: g,
|
|
109
|
+
name: r,
|
|
110
|
+
control: E,
|
|
111
|
+
rules: c,
|
|
112
|
+
disabled: c?.disabled,
|
|
113
|
+
render: ({ field: n, fieldState: i }) => {
|
|
114
|
+
const { ref: o, onChange: q, ...m } = n;
|
|
115
|
+
k.current = q;
|
|
116
|
+
const b = !S(i.error), v = {
|
|
117
|
+
isDisabled: n.disabled ?? !1,
|
|
118
|
+
isRequired: c?.required === !0 || c?.required === "required",
|
|
119
|
+
isInvalid: i.invalid,
|
|
120
|
+
isError: b
|
|
121
|
+
}, { isError: z, ...D } = v, O = {
|
|
122
|
+
...d,
|
|
123
|
+
...D
|
|
114
124
|
};
|
|
115
|
-
return /* @__PURE__ */
|
|
116
|
-
|
|
125
|
+
return /* @__PURE__ */ l(
|
|
126
|
+
N,
|
|
117
127
|
{
|
|
118
|
-
...
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
defaultSelectedKeys: h,
|
|
127
|
-
errorMessage: f ?? d.error?.message,
|
|
128
|
+
...H(s, m, v),
|
|
129
|
+
state: L,
|
|
130
|
+
tokens: O,
|
|
131
|
+
isError: b,
|
|
132
|
+
selectionMode: f,
|
|
133
|
+
selectedKeys: y,
|
|
134
|
+
defaultSelectedKeys: g,
|
|
135
|
+
errorMessage: C ?? i.error?.message,
|
|
128
136
|
ref: e
|
|
129
137
|
}
|
|
130
138
|
);
|
|
@@ -132,14 +140,14 @@ function T({ ref: e, ...r }) {
|
|
|
132
140
|
}
|
|
133
141
|
);
|
|
134
142
|
}
|
|
135
|
-
|
|
136
|
-
function
|
|
137
|
-
const
|
|
138
|
-
return /* @__PURE__ */
|
|
143
|
+
$.displayName = "ControlledReactHookFormListBox";
|
|
144
|
+
function ae(e) {
|
|
145
|
+
const t = F(null);
|
|
146
|
+
return /* @__PURE__ */ l($, { ...e, ref: t });
|
|
139
147
|
}
|
|
140
148
|
export {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
149
|
+
N as ControlledListBox,
|
|
150
|
+
$ as ControlledReactHookFormListBox,
|
|
151
|
+
le as ListBox,
|
|
152
|
+
ae as ReactHookFormListBox
|
|
145
153
|
};
|
package/index39.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";const o=require("react/jsx-runtime")
|
|
2
|
+
"use strict";const o=require("react/jsx-runtime"),$=require("@react-aria/utils"),m=require("react-aria"),f=require("./index77.js"),u=require("./index7.js"),j=require("./index74.js"),B=require("./index40.js");function C({section:l,state:t,...s}){const{key:p,rendered:n,props:a,level:h,hasChildNodes:x,type:d}=l,{themeName:e="listBox.section",tokens:r,as:g="li",customTheme:P,...q}=f.mergeDefaultComponentProps(s,a),i={...r,type:d,level:h.toString(),hasChildNodes:x},{itemProps:k,headingProps:y,groupProps:N}=m.useListBoxSection(s);return o.jsxs(u.Box,{as:g,themeName:`${e}.wrapper`,tokens:i,...m.mergeProps($.filterDOMProps(q),k),customTheme:P,children:[!!n&&o.jsx(j.Typography,{themeName:`${e}.heading`,tokens:r,...y,children:n}),o.jsx(u.Box,{as:"ul",themeName:`${e}.group`,tokens:i,...N,children:Array.from(t.collection.getChildren?.(p)??[],c=>o.jsx(B,{item:c,state:t,tokens:r,themeName:`${e}.item`},c.key))})]})}module.exports=C;
|
package/index39.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
2
|
+
import { jsxs as N, jsx as r } from "react/jsx-runtime";
|
|
3
3
|
import { filterDOMProps as B } from "@react-aria/utils";
|
|
4
4
|
import { useListBoxSection as $, mergeProps as C } from "react-aria";
|
|
5
5
|
import { mergeDefaultComponentProps as S } from "./index77.mjs";
|
|
6
6
|
import { Box as p } from "./index7.mjs";
|
|
7
7
|
import { Typography as T } from "./index74.mjs";
|
|
8
8
|
import j from "./index40.mjs";
|
|
9
|
-
function
|
|
9
|
+
function b({
|
|
10
10
|
section: l,
|
|
11
|
-
state:
|
|
11
|
+
state: t,
|
|
12
12
|
...m
|
|
13
13
|
}) {
|
|
14
|
-
const { key: c, rendered: s, props: a, level: h, hasChildNodes:
|
|
14
|
+
const { key: c, rendered: s, props: a, level: h, hasChildNodes: f, type: d } = l, {
|
|
15
15
|
themeName: e = "listBox.section",
|
|
16
16
|
tokens: o,
|
|
17
17
|
as: g = "li",
|
|
@@ -19,11 +19,11 @@ function q({
|
|
|
19
19
|
...x
|
|
20
20
|
} = S(m, a), i = {
|
|
21
21
|
...o,
|
|
22
|
-
type:
|
|
22
|
+
type: d,
|
|
23
23
|
level: h.toString(),
|
|
24
|
-
hasChildNodes:
|
|
25
|
-
}, { itemProps: P, headingProps: k, groupProps:
|
|
26
|
-
return /* @__PURE__ */
|
|
24
|
+
hasChildNodes: f
|
|
25
|
+
}, { itemProps: P, headingProps: k, groupProps: y } = $(m);
|
|
26
|
+
return /* @__PURE__ */ N(
|
|
27
27
|
p,
|
|
28
28
|
{
|
|
29
29
|
as: g,
|
|
@@ -32,12 +32,12 @@ function q({
|
|
|
32
32
|
...C(B(x), P),
|
|
33
33
|
customTheme: u,
|
|
34
34
|
children: [
|
|
35
|
-
!!s && /* @__PURE__ */
|
|
36
|
-
/* @__PURE__ */
|
|
35
|
+
!!s && /* @__PURE__ */ r(T, { themeName: `${e}.heading`, tokens: o, ...k, children: s }),
|
|
36
|
+
/* @__PURE__ */ r(p, { as: "ul", themeName: `${e}.group`, tokens: i, ...y, children: Array.from(t.collection.getChildren?.(c) ?? [], (n) => /* @__PURE__ */ r(j, { item: n, state: t, tokens: o, themeName: `${e}.item` }, n.key)) })
|
|
37
37
|
]
|
|
38
38
|
}
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
41
|
export {
|
|
42
|
-
|
|
42
|
+
b as default
|
|
43
43
|
};
|
package/index43.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";const e=require("react/jsx-runtime"),m=require("react"),
|
|
2
|
+
"use strict";const e=require("react/jsx-runtime"),m=require("react"),C=require("react-aria"),v=require("react-stately"),w=require("./index88.js"),A=require("./index90.js"),c=require("./index7.js"),T=require("./index8.js"),F=require("./index99.js"),M=require("./index130.js"),I=require("./index74.js");function Q({value:a,clearButtonProps:r,isDisabled:o,tokens:s,themeName:i}){return a===""?e.jsx(c.Box,{as:"span",themeName:`${i}.icon`,tokens:s,"aria-hidden":"true",children:e.jsx(M,{width:"16",height:"16"})}):e.jsx(T.Button,{...r,isDisabled:o,handlePress:r.onPress,tokens:{...s,isIconOnly:!0,buttonStyle:"hollow"},themeName:`${i}.button`,children:e.jsx(F,{width:"16",height:"16"})})}function R(a){const{setUserSearchQuery:r}=A.useUserQueryValHook(),{label:o,themeName:s="search",tokens:i,customTheme:b,disabled:p,errorMessage:u,placeholder:j,renderAction:q,isDisabled:k}=a,t=k||p,d={...a,isDisabled:t},l=v.useSearchFieldState(d),x=m.useRef(null),{labelProps:$,inputProps:h,errorMessageProps:f,clearButtonProps:g}=C.useSearchField(d,l,x),N=m.useCallback(D=>{r(l.value),h.onChange?.(D)},[r,l.value,h]),S=u!=null,n={...i,isError:S,isDisabled:t??!1},y=w(`${s}.input`,n,b),P=q??Q,B={value:l.value,clearButtonProps:g,isDisabled:t??!1,tokens:n,themeName:s??"search"};return e.jsxs(c.Box,{themeName:`${s}.wrapper`,tokens:n,"aria-disabled":t??!1,children:[o!=null&&e.jsx(c.Box,{...$,as:"label",themeName:`${s}.label`,tokens:n,children:o}),e.jsxs(c.Box,{themeName:`${s}.container`,tokens:n,children:[e.jsx("input",{ref:x,...h,onChange:N,placeholder:j,className:y,disabled:t}),e.jsx(P,{...B})]}),u!=null&&e.jsx(I.Typography,{themeName:`${s}.errorMessage`,tokens:n,...f,children:u})]})}module.exports=R;
|