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