@pibit.ai/cure-design-system 0.5.12 → 0.6.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.
Files changed (61) hide show
  1. package/dist/applications/date-picker/calendar-value.d.ts +4 -0
  2. package/dist/applications/date-picker/calendar-value.d.ts.map +1 -0
  3. package/dist/applications/date-picker/calendar-value.js +6 -0
  4. package/dist/applications/date-picker/calendar.d.ts.map +1 -1
  5. package/dist/applications/date-picker/calendar.js +130 -124
  6. package/dist/applications/date-picker/date-time-calendar.d.ts.map +1 -1
  7. package/dist/applications/date-picker/date-time-calendar.js +56 -55
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +161 -157
  11. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.js +6 -6
  12. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.js +5 -5
  13. package/dist/node_modules/framer-motion/dist/es/utils/use-composed-ref.js +3 -3
  14. package/dist/node_modules/{@react-stately/data/dist → react-stately/dist/private/data}/useListData.js +61 -64
  15. package/dist/primitives/avatar/avatar.d.ts +46 -28
  16. package/dist/primitives/avatar/avatar.d.ts.map +1 -1
  17. package/dist/primitives/avatar/avatar.js +114 -39
  18. package/dist/primitives/avatar/base-components/avatar-online-indicator.d.ts +8 -0
  19. package/dist/primitives/avatar/base-components/avatar-online-indicator.d.ts.map +1 -0
  20. package/dist/primitives/avatar/base-components/avatar-online-indicator.js +29 -0
  21. package/dist/primitives/avatar/base-components/index.d.ts +3 -0
  22. package/dist/primitives/avatar/base-components/index.d.ts.map +1 -0
  23. package/dist/primitives/avatar/base-components/verified-tick.d.ts +7 -0
  24. package/dist/primitives/avatar/base-components/verified-tick.d.ts.map +1 -0
  25. package/dist/primitives/avatar/base-components/verified-tick.js +41 -0
  26. package/dist/primitives/dropdown/dropdown.d.ts +2 -2
  27. package/dist/primitives/input/input.d.ts.map +1 -1
  28. package/dist/primitives/input/input.js +9 -1
  29. package/dist/primitives/select/SearchInput.d.ts +7 -7
  30. package/dist/primitives/select/SearchInput.d.ts.map +1 -1
  31. package/dist/primitives/select/__tests__/multi-select-utils.test.d.ts +2 -0
  32. package/dist/primitives/select/__tests__/multi-select-utils.test.d.ts.map +1 -0
  33. package/dist/primitives/select/combobox.d.ts +1 -2
  34. package/dist/primitives/select/combobox.d.ts.map +1 -1
  35. package/dist/primitives/select/index.d.ts +3 -1
  36. package/dist/primitives/select/index.d.ts.map +1 -1
  37. package/dist/primitives/select/multi-select-utils.d.ts +7 -0
  38. package/dist/primitives/select/multi-select-utils.d.ts.map +1 -0
  39. package/dist/primitives/select/multi-select-utils.js +17 -0
  40. package/dist/primitives/select/multi-select.d.ts +17 -4
  41. package/dist/primitives/select/multi-select.d.ts.map +1 -1
  42. package/dist/primitives/select/multi-select.js +631 -237
  43. package/dist/primitives/select/searchable-select.d.ts +26 -4
  44. package/dist/primitives/select/searchable-select.d.ts.map +1 -1
  45. package/dist/primitives/select/searchable-select.js +292 -189
  46. package/dist/primitives/select/select-checkbox.d.ts +6 -0
  47. package/dist/primitives/select/select-checkbox.d.ts.map +1 -0
  48. package/dist/primitives/select/select-checkbox.js +62 -0
  49. package/dist/primitives/select/select-item.d.ts +3 -1
  50. package/dist/primitives/select/select-item.d.ts.map +1 -1
  51. package/dist/primitives/select/select-item.js +95 -77
  52. package/dist/primitives/select/select-native.d.ts +21 -2
  53. package/dist/primitives/select/select-native.d.ts.map +1 -1
  54. package/dist/primitives/select/select-native.js +88 -0
  55. package/dist/primitives/select/select-shared.d.ts +1 -0
  56. package/dist/primitives/select/select-shared.d.ts.map +1 -1
  57. package/dist/primitives/select/select.d.ts +12 -2
  58. package/dist/primitives/select/select.d.ts.map +1 -1
  59. package/dist/primitives/select/select.js +207 -152
  60. package/dist/styles/components.css +1 -1
  61. package/package.json +4 -4
@@ -1,112 +1,133 @@
1
- import { jsx as e, jsxs as b, Fragment as K } from "react/jsx-runtime";
2
- import { useRef as T, useCallback as j, isValidElement as V } from "react";
3
- import { ChevronDown as _, XClose as k } from "@untitledui/icons";
4
- import { Select as L, ListBox as O, Button as P, SelectValue as U } from "react-aria-components";
5
- import { Avatar as $ } from "../avatar/avatar.js";
6
- import { HintText as z } from "../input/hint-text.js";
7
- import { Label as A } from "../input/label.js";
8
- import { ComboBox as E } from "./combobox.js";
9
- import { Popover as F } from "./popover.js";
10
- import { SelectItem as H } from "./select-item.js";
11
- import { SearchableSelect as M } from "./searchable-select.js";
12
- import { SelectContext as X, fontSizes as w, sizes as G } from "./select-shared.js";
13
- import { cx as s } from "../../utils/cn.js";
14
- import { isReactComponent as J } from "../../utils/is-react-component.js";
15
- const Q = {
1
+ import { jsx as e, jsxs as x, Fragment as z } from "react/jsx-runtime";
2
+ import { useRef as $, useCallback as j, isValidElement as F } from "react";
3
+ import { ChevronDown as H, XClose as M } from "@untitledui/icons";
4
+ import { Select as O, ListBox as X, Button as G, SelectValue as J, ButtonContext as Q } from "react-aria-components";
5
+ import { Avatar as W } from "../avatar/avatar.js";
6
+ import { HintText as Y } from "../input/hint-text.js";
7
+ import { Label as Z } from "../input/label.js";
8
+ import { createEllipsisContent as A } from "../tooltip/ellipsis-content.js";
9
+ import { ComboBox as D } from "./combobox.js";
10
+ import { Popover as ee } from "./popover.js";
11
+ import { SelectItem as te } from "./select-item.js";
12
+ import { SearchableSelect as re } from "./searchable-select.js";
13
+ import { SelectContext as le, fontSizes as T, sizes as ne } from "./select-shared.js";
14
+ import { cx as n } from "../../utils/cn.js";
15
+ import { isReactComponent as ie } from "../../utils/is-react-component.js";
16
+ const oe = {
16
17
  sm: "rounded-md",
17
18
  md: "rounded-md",
18
19
  lg: "rounded-lg"
19
- }, R = {
20
+ }, V = {
20
21
  sm: "size-4",
21
22
  md: "size-4",
22
23
  lg: "size-5"
23
- }, W = {
24
+ }, ae = {
24
25
  sm: "text-xs",
25
26
  md: "text-xs",
26
27
  lg: "text-sm"
27
- }, Y = "relative flex w-full cursor-pointer items-center bg-primary ring-1 ring-secondary outline-hidden transition duration-100 ease-linear ring-inset", Z = ({
28
- isOpen: I,
29
- isFocused: B,
28
+ }, ce = "relative flex w-full cursor-pointer items-center bg-primary ring-1 outline-hidden transition duration-100 ease-linear ring-inset", se = ({
29
+ isOpen: C,
30
+ isFocused: k,
30
31
  isDisabled: c,
31
- size: n,
32
- placeholder: m,
33
- placeholderIcon: p,
34
- ref: h,
35
- textStyles: y,
36
- showChevron: f = !0,
37
- isClearable: N = !1,
38
- onClear: a,
39
- selectedItem: x
32
+ isInvalid: R,
33
+ size: r,
34
+ placeholder: v,
35
+ placeholderIcon: S,
36
+ ref: q,
37
+ textStyles: h,
38
+ showChevron: b = !0,
39
+ isClearable: y = !1,
40
+ onClear: s,
41
+ selectedItem: u,
42
+ endAdornment: a
40
43
  }) => {
41
- const d = N && x && !c && a, g = /* @__PURE__ */ e(
42
- P,
44
+ const m = y && u && !c && s, P = m && a ? "pr-12" : m ? "pr-6" : a ? "pr-8" : void 0, I = /* @__PURE__ */ e(
45
+ G,
43
46
  {
44
- ref: h,
45
- className: s(
46
- Y,
47
- Q[n],
48
- (B || I) && "ring-1 ring-brand",
47
+ ref: q,
48
+ className: n(
49
+ ce,
50
+ oe[r],
51
+ R ? "ring-error" : k || C ? "ring-brand" : "ring-secondary",
49
52
  c && "cursor-not-allowed bg-disabled_subtle text-disabled"
50
53
  ),
51
54
  children: /* @__PURE__ */ e(
52
- U,
55
+ J,
53
56
  {
54
- className: s(
57
+ className: n(
55
58
  "flex h-max w-full items-center justify-start gap-2 truncate text-left align-middle",
56
59
  // Icon styles
57
60
  "*:data-icon:size-5 *:data-icon:shrink-0 *:data-icon:text-fg-quaternary in-disabled:*:data-icon:text-fg-disabled",
58
- G[n].root
61
+ ne[r].root
59
62
  ),
60
- children: (r) => {
61
- var o, u, i, v, S;
62
- const t = ((o = r.selectedItem) == null ? void 0 : o.icon) || p;
63
- return /* @__PURE__ */ b(K, { children: [
64
- (u = r.selectedItem) != null && u.avatarUrl ? /* @__PURE__ */ e(
65
- $,
63
+ children: (i) => {
64
+ var p, t, N, d, g;
65
+ const f = ((p = i.selectedItem) == null ? void 0 : p.icon) || S;
66
+ return /* @__PURE__ */ x(z, { children: [
67
+ (t = i.selectedItem) != null && t.avatarUrl ? /* @__PURE__ */ e(
68
+ W,
66
69
  {
67
- size: "sm",
68
- src: r.selectedItem.avatarUrl,
69
- alt: r.selectedItem.label
70
+ size: "xs",
71
+ src: i.selectedItem.avatarUrl,
72
+ alt: i.selectedItem.label
70
73
  }
71
- ) : J(t) ? /* @__PURE__ */ e(
72
- t,
74
+ ) : ie(f) ? /* @__PURE__ */ e(
75
+ f,
73
76
  {
74
77
  "data-icon": !0,
75
78
  "aria-hidden": "true",
76
- className: R[n]
79
+ className: V[r]
77
80
  }
78
- ) : V(t) ? t : null,
79
- r.selectedItem ? /* @__PURE__ */ b("section", { className: "flex w-full gap-2 truncate", children: [
80
- /* @__PURE__ */ e(
81
- "p",
82
- {
83
- className: s(
84
- "truncate font-medium text-primary",
85
- w[n],
86
- y
87
- ),
88
- children: (i = r.selectedItem) == null ? void 0 : i.label
89
- }
90
- ),
91
- ((v = r.selectedItem) == null ? void 0 : v.supportingText) && /* @__PURE__ */ e("p", { className: s("text-tertiary", w[n]), children: (S = r.selectedItem) == null ? void 0 : S.supportingText })
92
- ] }) : /* @__PURE__ */ e(
81
+ ) : F(f) ? f : null,
82
+ i.selectedItem ? /* @__PURE__ */ x(
83
+ "section",
84
+ {
85
+ className: n("flex w-full min-w-0 gap-2", P),
86
+ children: [
87
+ /* @__PURE__ */ e("span", { className: "min-w-0 flex-1", children: A(
88
+ ((N = i.selectedItem) == null ? void 0 : N.label) ?? "",
89
+ "min-w-0 w-full",
90
+ !1,
91
+ "start",
92
+ void 0,
93
+ void 0,
94
+ n(
95
+ "font-medium text-primary",
96
+ T[r],
97
+ h
98
+ ),
99
+ "z-[100001]"
100
+ ) }),
101
+ ((d = i.selectedItem) == null ? void 0 : d.supportingText) && /* @__PURE__ */ e(
102
+ "p",
103
+ {
104
+ className: n(
105
+ "min-w-0 truncate text-tertiary",
106
+ T[r]
107
+ ),
108
+ children: (g = i.selectedItem) == null ? void 0 : g.supportingText
109
+ }
110
+ )
111
+ ]
112
+ }
113
+ ) : /* @__PURE__ */ e(
93
114
  "p",
94
115
  {
95
- className: s(
116
+ className: n(
96
117
  "text-placeholder_subtle",
97
- w[n],
118
+ T[r],
98
119
  c && "text-disabled"
99
120
  ),
100
- children: m
121
+ children: v
101
122
  }
102
123
  ),
103
- f && /* @__PURE__ */ e(
104
- _,
124
+ b && /* @__PURE__ */ e(
125
+ H,
105
126
  {
106
127
  "aria-hidden": "true",
107
- className: s(
128
+ className: n(
108
129
  "ml-auto shrink-0 text-fg-quaternary",
109
- R[n]
130
+ V[r]
110
131
  )
111
132
  }
112
133
  )
@@ -116,126 +137,160 @@ const Q = {
116
137
  )
117
138
  }
118
139
  );
119
- return d ? /* @__PURE__ */ b("div", { className: "relative flex w-full items-stretch", children: [
120
- g,
121
- /* @__PURE__ */ e(
122
- "button",
140
+ return y || a ? /* @__PURE__ */ x("div", { className: "relative flex w-full items-stretch", children: [
141
+ I,
142
+ (m || a) && /* @__PURE__ */ x(
143
+ "div",
123
144
  {
124
- type: "button",
125
- tabIndex: -1,
126
- "aria-label": "Clear selection",
127
- onClick: () => a == null ? void 0 : a(),
128
- className: s(
129
- "absolute right-8 top-1/2 cursor-pointer flex -translate-y-1/2 items-center justify-center rounded-md p-1 text-fg-quaternary outline-hidden transition hover:bg-primary_hover focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-focus-ring"
145
+ className: n(
146
+ "absolute top-1/2 z-10 flex -translate-y-1/2 items-center gap-0.5",
147
+ b ? "right-8" : "right-1"
130
148
  ),
131
- children: /* @__PURE__ */ e(k, { "aria-hidden": !0, className: R[n] })
149
+ children: [
150
+ a ? /* @__PURE__ */ e(Q.Provider, { value: null, children: a }) : null,
151
+ m ? /* @__PURE__ */ e(
152
+ "button",
153
+ {
154
+ type: "button",
155
+ tabIndex: -1,
156
+ "aria-label": "Clear selection",
157
+ onClick: () => s == null ? void 0 : s(),
158
+ className: "flex cursor-pointer items-center justify-center rounded-md p-1 text-fg-quaternary outline-hidden transition hover:bg-primary_hover focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-focus-ring",
159
+ children: /* @__PURE__ */ e(M, { "aria-hidden": !0, className: V[r] })
160
+ }
161
+ ) : null
162
+ ]
132
163
  }
133
164
  )
134
- ] }) : g;
135
- }, D = ({
136
- placeholder: I = "Select",
137
- placeholderIcon: B,
165
+ ] }) : I;
166
+ }, de = ({
167
+ placeholder: C = "Select",
168
+ placeholderIcon: k,
138
169
  size: c = "sm",
139
- children: n,
140
- items: m,
141
- label: p,
142
- hint: h,
143
- tooltip: y,
144
- className: f,
145
- textStyles: N,
146
- showChevron: a = !0,
147
- isClearable: x = !1,
148
- isDeselectable: d = !1,
149
- ...g
170
+ children: R,
171
+ items: r,
172
+ label: v,
173
+ hint: S,
174
+ tooltip: q,
175
+ className: h,
176
+ textStyles: b,
177
+ showChevron: y = !0,
178
+ isClearable: s = !1,
179
+ isDeselectable: u = !1,
180
+ footer: a,
181
+ listBoxClassName: m,
182
+ popoverPlacement: P,
183
+ popoverContainerPadding: I,
184
+ endAdornment: i,
185
+ ...f
150
186
  }) => {
151
187
  const {
152
- selectedKey: r,
188
+ selectedKey: p,
153
189
  onSelectionChange: t,
154
- ...o
155
- } = g, u = T(!1), i = r === void 0 ? void 0 : r == null || String(r) === "" ? null : r, v = j(() => {
156
- var l;
157
- !d || i == null || (u.current = !0, t == null || t(null), (l = o.onOpenChange) == null || l.call(o, !1), queueMicrotask(() => {
158
- u.current = !1;
190
+ isRequired: N,
191
+ onOpenChange: d,
192
+ ...g
193
+ } = f, B = $(!1), o = p == null || String(p) === "" ? null : p, K = j(
194
+ (l) => {
195
+ d == null || d(l);
196
+ },
197
+ [d]
198
+ ), L = j(() => {
199
+ !u || o == null || (B.current = !0, t == null || t(null), K(!1), queueMicrotask(() => {
200
+ B.current = !1;
159
201
  }));
160
- }, [
161
- o.onOpenChange,
162
- d,
163
- t,
164
- i
165
- ]), S = j(
202
+ }, [K, u, t, o]), E = j(
166
203
  (l) => {
167
- if (u.current) return;
168
- const C = l == null || String(l) === "" ? null : l;
169
- t == null || t(C);
204
+ if (B.current) return;
205
+ const w = l == null || String(l) === "" ? null : l, U = o == null || String(o) === "" ? null : o;
206
+ String(w ?? "") !== String(U ?? "") && (t == null || t(w));
170
207
  },
171
- [t]
208
+ [t, o]
172
209
  );
173
210
  return /* @__PURE__ */ e(
174
- X.Provider,
211
+ le.Provider,
175
212
  {
176
213
  value: {
177
214
  size: c,
178
- isDeselectable: d,
179
- selectedKey: i,
180
- onReselectCurrent: d ? v : void 0
215
+ isDeselectable: u,
216
+ selectedKey: o,
217
+ onReselectCurrent: u ? L : void 0
181
218
  },
182
219
  children: /* @__PURE__ */ e(
183
- L,
220
+ O,
184
221
  {
185
- ...o,
186
- selectedKey: i,
187
- onSelectionChange: S,
188
- className: (l) => s(
222
+ ...g,
223
+ isRequired: N,
224
+ selectedKey: o,
225
+ onOpenChange: K,
226
+ onSelectionChange: E,
227
+ className: (l) => n(
189
228
  "flex flex-col gap-1.5",
190
- typeof f == "function" ? f(l) : f
229
+ typeof h == "function" ? h(l) : h
191
230
  ),
192
- children: (l) => /* @__PURE__ */ b(K, { children: [
193
- p && /* @__PURE__ */ e(
194
- A,
231
+ children: (l) => /* @__PURE__ */ x(z, { children: [
232
+ v && /* @__PURE__ */ e(
233
+ Z,
195
234
  {
196
235
  isRequired: l.isRequired,
197
- tooltip: y,
198
- className: W[c],
199
- children: p
236
+ tooltip: q,
237
+ className: ae[c],
238
+ children: v
200
239
  }
201
240
  ),
202
241
  /* @__PURE__ */ e(
203
- Z,
242
+ se,
204
243
  {
205
244
  ...l,
206
245
  size: c,
207
- placeholder: I,
246
+ placeholder: C,
208
247
  placeholderIcon: null,
209
- textStyles: N,
210
- showChevron: a,
211
- isClearable: x,
212
- onClear: x && t ? () => t(null) : void 0,
213
- selectedItem: i != null && m ? m.find(
214
- (C) => String(C.id) === String(i)
248
+ textStyles: b,
249
+ showChevron: y,
250
+ isClearable: s,
251
+ onClear: s && t ? () => t(null) : void 0,
252
+ endAdornment: i,
253
+ selectedItem: o != null && r ? r.find(
254
+ (w) => String(w.id) === String(o)
215
255
  ) ?? null : null
216
256
  }
217
257
  ),
218
- /* @__PURE__ */ e(
219
- F,
258
+ /* @__PURE__ */ x(
259
+ ee,
220
260
  {
221
261
  size: c,
222
- className: s(o.popoverClassName),
223
- children: /* @__PURE__ */ e(O, { items: m, className: "size-full outline-hidden ", children: n })
262
+ placement: P,
263
+ containerPadding: I,
264
+ className: n("flex flex-col", g.popoverClassName),
265
+ children: [
266
+ /* @__PURE__ */ e(
267
+ X,
268
+ {
269
+ items: r,
270
+ className: n(
271
+ "size-full min-h-0 outline-hidden",
272
+ m
273
+ ),
274
+ children: R
275
+ }
276
+ ),
277
+ a && /* @__PURE__ */ e("div", { className: "relative border-t border-tertiary bg-primary p-1.5", children: a })
278
+ ]
224
279
  }
225
280
  ),
226
- h && /* @__PURE__ */ e(z, { isInvalid: l.isInvalid, children: h })
281
+ S && /* @__PURE__ */ e(Y, { isInvalid: l.isInvalid, children: S })
227
282
  ] })
228
283
  }
229
284
  )
230
285
  }
231
286
  );
232
- }, q = D;
233
- q.ComboBox = E;
234
- q.Item = H;
235
- q.Searchable = M;
287
+ }, _ = de;
288
+ _.ComboBox = D;
289
+ _.Item = te;
290
+ _.Searchable = re;
236
291
  export {
237
- q as Select,
238
- X as SelectContext,
239
- w as fontSizes,
240
- G as sizes
292
+ _ as Select,
293
+ le as SelectContext,
294
+ T as fontSizes,
295
+ ne as sizes
241
296
  };