@pibit.ai/cure-design-system 0.3.18 → 0.3.21

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 (47) hide show
  1. package/README.md +1 -0
  2. package/dist/applications/schedule-calendar/index.d.ts +4 -0
  3. package/dist/applications/schedule-calendar/index.d.ts.map +1 -0
  4. package/dist/applications/schedule-calendar/schedule-calendar.d.ts +3 -0
  5. package/dist/applications/schedule-calendar/schedule-calendar.d.ts.map +1 -0
  6. package/dist/applications/schedule-calendar/schedule-calendar.js +204 -0
  7. package/dist/applications/schedule-calendar/types.d.ts +56 -0
  8. package/dist/applications/schedule-calendar/types.d.ts.map +1 -0
  9. package/dist/applications/schedule-calendar/types.js +40 -0
  10. package/dist/applications/schedule-calendar/utils.d.ts +31 -0
  11. package/dist/applications/schedule-calendar/utils.d.ts.map +1 -0
  12. package/dist/applications/schedule-calendar/utils.js +171 -0
  13. package/dist/applications/schedule-calendar/utils.test.d.ts +2 -0
  14. package/dist/applications/schedule-calendar/utils.test.d.ts.map +1 -0
  15. package/dist/index.d.ts +2 -0
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +113 -101
  18. package/dist/patterns/table/TableWrapper.d.ts.map +1 -1
  19. package/dist/patterns/table/TableWrapper.js +776 -661
  20. package/dist/patterns/table/table.d.ts.map +1 -1
  21. package/dist/patterns/table/table.js +44 -43
  22. package/dist/patterns/table/toolbar/AlignDropdown.js +14 -14
  23. package/dist/patterns/table/toolbar/ColumnHeaderMenu.d.ts +9 -0
  24. package/dist/patterns/table/toolbar/ColumnHeaderMenu.d.ts.map +1 -1
  25. package/dist/patterns/table/toolbar/ColumnHeaderMenu.js +115 -81
  26. package/dist/patterns/table/toolbar/SummaryFooter.d.ts.map +1 -1
  27. package/dist/patterns/table/toolbar/SummaryFooter.js +34 -27
  28. package/dist/patterns/table/toolbar/index.d.ts +1 -1
  29. package/dist/patterns/table/toolbar/index.d.ts.map +1 -1
  30. package/dist/patterns/table/toolbar/tableToolbarHelpers.js +1 -1
  31. package/dist/primitives/select/searchable-select.d.ts +5 -3
  32. package/dist/primitives/select/searchable-select.d.ts.map +1 -1
  33. package/dist/primitives/select/searchable-select.js +196 -177
  34. package/dist/primitives/select/select-item.d.ts.map +1 -1
  35. package/dist/primitives/select/select-item.js +70 -54
  36. package/dist/primitives/select/select.d.ts +7 -2
  37. package/dist/primitives/select/select.d.ts.map +1 -1
  38. package/dist/primitives/select/select.js +161 -137
  39. package/dist/primitives/snackbar/index.d.ts +2 -0
  40. package/dist/primitives/snackbar/index.d.ts.map +1 -0
  41. package/dist/primitives/snackbar/snackbar.d.ts +27 -0
  42. package/dist/primitives/snackbar/snackbar.d.ts.map +1 -0
  43. package/dist/primitives/snackbar/snackbar.js +107 -0
  44. package/dist/primitives/tooltip/ellipsis-content.d.ts.map +1 -1
  45. package/dist/primitives/tooltip/ellipsis-content.js +46 -43
  46. package/dist/styles/components.css +1 -1
  47. package/package.json +4 -1
@@ -1,52 +1,68 @@
1
- import { jsx as i, jsxs as f } from "react/jsx-runtime";
2
- import { useContext as w, isValidElement as v } from "react";
3
- import { Check as z } from "@untitledui/icons";
4
- import { ListBoxItem as C, Text as x } from "react-aria-components";
5
- import { Avatar as S } from "../avatar/avatar.js";
6
- import { SelectContext as D, fontSizes as u } from "./select.js";
7
- import { cx as n } from "../../utils/cn.js";
8
- import { isReactComponent as N } from "../../utils/is-react-component.js";
9
- const V = {
1
+ import { jsx as n, jsxs as p } from "react/jsx-runtime";
2
+ import { useContext as k, isValidElement as N } from "react";
3
+ import { Check as R } from "@untitledui/icons";
4
+ import { ListBoxItem as V, Text as w } from "react-aria-components";
5
+ import { Avatar as j } from "../avatar/avatar.js";
6
+ import { SelectContext as q, fontSizes as C } from "./select.js";
7
+ import { cx as l } from "../../utils/cn.js";
8
+ import { isReactComponent as A } from "../../utils/is-react-component.js";
9
+ const B = {
10
10
  sm: "p-2 pr-2.5",
11
11
  md: "p-2.5 pl-2",
12
12
  xs: "p-1.5"
13
- }, O = ({
14
- label: a,
15
- id: c,
16
- value: b,
17
- avatarUrl: s,
13
+ }, J = ({
14
+ label: d,
15
+ id: s,
16
+ value: v,
17
+ avatarUrl: m,
18
18
  supportingText: r,
19
- isDisabled: p,
20
- icon: t,
21
- className: d,
22
- children: o,
23
- textStyles: h,
24
- ...y
19
+ isDisabled: c,
20
+ icon: o,
21
+ className: u,
22
+ children: a,
23
+ textStyles: D,
24
+ ...t
25
25
  }) => {
26
- const { size: l } = w(D), m = a || (typeof o == "string" ? o : ""), g = r ? m + " " + r : m;
27
- return /* @__PURE__ */ i(
28
- C,
26
+ const { size: f, isDeselectable: P, selectedKey: b, onReselectCurrent: h } = k(q), y = P && b != null && s != null && String(s) === String(b), S = (e) => {
27
+ !y || c || (e.preventDefault(), e.stopPropagation());
28
+ }, g = (e) => {
29
+ !y || c || !h || ("preventDefault" in e && (e.preventDefault(), e.stopPropagation()), h());
30
+ }, x = d || (typeof a == "string" ? a : ""), z = r ? x + " " + r : x;
31
+ return /* @__PURE__ */ n(
32
+ V,
29
33
  {
30
- id: c,
31
- value: b ?? {
32
- id: c,
33
- label: m,
34
- avatarUrl: s,
34
+ id: s,
35
+ value: v ?? {
36
+ id: s,
37
+ label: x,
38
+ avatarUrl: m,
35
39
  supportingText: r,
36
- isDisabled: p,
37
- icon: t
40
+ isDisabled: c,
41
+ icon: o
38
42
  },
39
- textValue: g,
40
- isDisabled: p,
41
- ...y,
42
- className: (e) => n(
43
+ textValue: z,
44
+ isDisabled: c,
45
+ ...t,
46
+ onPointerDownCapture: (e) => {
47
+ var i;
48
+ (i = t.onPointerDownCapture) == null || i.call(t, e), S(e);
49
+ },
50
+ onPointerUpCapture: (e) => {
51
+ var i;
52
+ (i = t.onPointerUpCapture) == null || i.call(t, e), g(e);
53
+ },
54
+ onPress: (e) => {
55
+ var i;
56
+ (i = t.onPress) == null || i.call(t, e), e.pointerType === "keyboard" && g(e);
57
+ },
58
+ className: (e) => l(
43
59
  "w-full px-1.5 py-px outline-hidden",
44
- typeof d == "function" ? d(e) : d
60
+ typeof u == "function" ? u(e) : u
45
61
  ),
46
- children: (e) => /* @__PURE__ */ f(
62
+ children: (e) => /* @__PURE__ */ p(
47
63
  "div",
48
64
  {
49
- className: n(
65
+ className: l(
50
66
  "flex cursor-pointer items-center gap-2 rounded-md outline-hidden select-none hover:bg-primary_hover",
51
67
  e.isSelected && "bg-brand-primary text-brand-600 hover:bg-brand-primary hover:text-brand-600",
52
68
  e.isDisabled && "cursor-not-allowed",
@@ -55,42 +71,42 @@ const V = {
55
71
  "*:data-icon:size-5 *:data-icon:shrink-0 *:data-icon:text-fg-quaternary",
56
72
  e.isDisabled && "*:data-icon:text-fg-disabled",
57
73
  // @ts-ignore
58
- V[l]
74
+ B[f]
59
75
  ),
60
76
  children: [
61
- s ? /* @__PURE__ */ i(S, { "aria-hidden": "true", size: "sm", src: s, alt: a }) : N(t) ? /* @__PURE__ */ i(t, { "data-icon": !0, "aria-hidden": "true" }) : v(t) ? t : null,
62
- /* @__PURE__ */ f("div", { className: "flex w-full min-w-0 flex-1 flex-wrap gap-x-2", children: [
63
- /* @__PURE__ */ i(
64
- x,
77
+ m ? /* @__PURE__ */ n(j, { "aria-hidden": "true", size: "sm", src: m, alt: d }) : A(o) ? /* @__PURE__ */ n(o, { "data-icon": !0, "aria-hidden": "true" }) : N(o) ? o : null,
78
+ /* @__PURE__ */ p("div", { className: "flex w-full min-w-0 flex-1 flex-wrap gap-x-2", children: [
79
+ /* @__PURE__ */ n(
80
+ w,
65
81
  {
66
82
  slot: "label",
67
- className: n(
83
+ className: l(
68
84
  "truncate font-medium whitespace-nowrap text-primary",
69
85
  e.isDisabled && "text-disabled",
70
- h,
71
- u[l]
86
+ D,
87
+ C[f]
72
88
  ),
73
- children: a || (typeof o == "function" ? o(e) : o)
89
+ children: d || (typeof a == "function" ? a(e) : a)
74
90
  }
75
91
  ),
76
- r && /* @__PURE__ */ i(
77
- x,
92
+ r && /* @__PURE__ */ n(
93
+ w,
78
94
  {
79
95
  slot: "description",
80
- className: n(
96
+ className: l(
81
97
  "whitespace-nowrap text-tertiary",
82
- u[l],
98
+ C[f],
83
99
  e.isDisabled && "text-disabled"
84
100
  ),
85
101
  children: r
86
102
  }
87
103
  )
88
104
  ] }),
89
- e.isSelected && /* @__PURE__ */ i(
90
- z,
105
+ e.isSelected && /* @__PURE__ */ n(
106
+ R,
91
107
  {
92
108
  "aria-hidden": "true",
93
- className: n(
109
+ className: l(
94
110
  "ml-auto text-fg-brand-primary",
95
111
  e.isDisabled && "text-fg-disabled"
96
112
  ),
@@ -104,5 +120,5 @@ const V = {
104
120
  );
105
121
  };
106
122
  export {
107
- O as SelectItem
123
+ J as SelectItem
108
124
  };
@@ -1,5 +1,5 @@
1
1
  import { FC, ReactNode, RefAttributes } from 'react';
2
- import { SelectProps as AriaSelectProps } from 'react-aria-components';
2
+ import { Key, SelectProps as AriaSelectProps } from 'react-aria-components';
3
3
  import { ComboBox } from './combobox';
4
4
  import { SelectItem } from './select-item';
5
5
  import { SearchableSelect } from './searchable-select';
@@ -28,6 +28,8 @@ export interface SelectProps extends Omit<AriaSelectProps<SelectItemType>, "chil
28
28
  showChevron?: boolean;
29
29
  /** When true, shows a clear button when a value is selected. Clearing calls onSelectionChange(null). Default false. */
30
30
  isClearable?: boolean;
31
+ /** When true, clicking the already-selected option in the dropdown clears the selection. Default false. */
32
+ isDeselectable?: boolean;
31
33
  }
32
34
  export declare const sizes: {
33
35
  sm: {
@@ -50,8 +52,11 @@ export declare const fontSizes: {
50
52
  };
51
53
  export declare const SelectContext: import('react').Context<{
52
54
  size: "sm" | "md" | "lg";
55
+ isDeselectable?: boolean;
56
+ selectedKey?: Key | null;
57
+ onReselectCurrent?: () => void;
53
58
  }>;
54
- declare const Select: ({ placeholder, placeholderIcon, size, children, items, label, hint, tooltip, className, textStyles, showChevron, isClearable, ...rest }: SelectProps) => import("react/jsx-runtime").JSX.Element;
59
+ declare const Select: ({ placeholder, placeholderIcon, size, children, items, label, hint, tooltip, className, textStyles, showChevron, isClearable, isDeselectable, ...rest }: SelectProps) => import("react/jsx-runtime").JSX.Element;
55
60
  declare const _Select: typeof Select & {
56
61
  ComboBox: typeof ComboBox;
57
62
  Item: typeof SelectItem;
@@ -1 +1 @@
1
- {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/primitives/select/select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAO,aAAa,EAAE,MAAM,OAAO,CAAC;AAG/D,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAU5E,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIvD,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,EAAE,GAAG,SAAS,CAAC;CACvB,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,WACf,SACE,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,EAC3D,aAAa,CAAC,cAAc,CAAC,EAC7B,WAAW;IACb,KA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AAEnB,QAAA,MAAM,MAAM,GAAI,yJAeb,WAAW,4CA+Fb,CAAC;AAEF,QAAA,MAAM,OAAO,EAAa,OAAO,MAAM,GAAG;IACxC,QAAQ,EAAE,OAAO,QAAQ,CAAC;IAC1B,IAAI,EAAE,OAAO,UAAU,CAAC;IACxB,UAAU,EAAE,OAAO,gBAAgB,CAAC;CACrC,CAAC;AAKF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAC"}
@@ -1,119 +1,119 @@
1
- import { jsx as e, jsxs as f, Fragment as B } from "react/jsx-runtime";
2
- import { createContext as j, isValidElement as T } from "react";
3
- import { ChevronDown as V, XClose as _ } from "@untitledui/icons";
4
- import { Select as k, ListBox as R, Button as z, SelectValue as K } from "react-aria-components";
5
- import { Avatar as L } from "../avatar/avatar.js";
6
- import { HintText as P } from "../input/hint-text.js";
7
- import { Label as U } from "../input/label.js";
8
- import { ComboBox as $ } from "./combobox.js";
9
- import { Popover as A } from "./popover.js";
10
- import { SelectItem as E } from "./select-item.js";
11
- import { SearchableSelect as F } from "./searchable-select.js";
12
- import { cx as o } from "../../utils/cn.js";
13
- import { isReactComponent as H } from "../../utils/is-react-component.js";
14
- const X = {
1
+ import { jsx as e, jsxs as b, Fragment as K } from "react/jsx-runtime";
2
+ import { useRef as T, useCallback as j, createContext as V, isValidElement as _ } from "react";
3
+ import { ChevronDown as k, XClose as z } 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 A } from "../input/hint-text.js";
7
+ import { Label as E } from "../input/label.js";
8
+ import { ComboBox as F } from "./combobox.js";
9
+ import { Popover as H } from "./popover.js";
10
+ import { SelectItem as M } from "./select-item.js";
11
+ import { SearchableSelect as X } from "./searchable-select.js";
12
+ import { cx as i } from "../../utils/cn.js";
13
+ import { isReactComponent as G } from "../../utils/is-react-component.js";
14
+ const J = {
15
15
  sm: { root: "py-1.5 px-2 h-8", shortcut: "pr-2" },
16
16
  md: { root: "py-1.5 px-3 h-9", shortcut: "pr-2.5" },
17
17
  lg: { root: "py-2.5 px-3.5 h-11", shortcut: "pr-3" }
18
- }, G = {
18
+ }, Q = {
19
19
  sm: "rounded-md",
20
20
  md: "rounded-md",
21
21
  lg: "rounded-lg"
22
- }, b = {
22
+ }, w = {
23
23
  sm: "text-xs",
24
24
  md: "text-sm",
25
25
  lg: "text-md"
26
- }, S = {
26
+ }, R = {
27
27
  sm: "size-4",
28
28
  md: "size-4",
29
29
  lg: "size-5"
30
- }, J = {
30
+ }, W = {
31
31
  sm: "text-xs",
32
32
  md: "text-xs",
33
33
  lg: "text-sm"
34
- }, M = "relative flex w-full cursor-pointer items-center bg-primary ring-1 ring-secondary outline-hidden transition duration-100 ease-linear ring-inset", O = ({
35
- isOpen: x,
36
- isFocused: y,
37
- isDisabled: n,
38
- size: l,
39
- placeholder: a,
40
- placeholderIcon: d,
41
- ref: m,
42
- textStyles: h,
43
- showChevron: s = !0,
44
- isClearable: g = !1,
45
- onClear: c,
46
- selectedItem: u
34
+ }, 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 = ({
35
+ isOpen: y,
36
+ isFocused: B,
37
+ isDisabled: c,
38
+ size: n,
39
+ placeholder: u,
40
+ placeholderIcon: p,
41
+ ref: x,
42
+ textStyles: I,
43
+ showChevron: f = !0,
44
+ isClearable: N = !1,
45
+ onClear: a,
46
+ selectedItem: h
47
47
  }) => {
48
- const r = g && u && !n && c, i = /* @__PURE__ */ e(
49
- z,
48
+ const d = N && h && !c && a, g = /* @__PURE__ */ e(
49
+ P,
50
50
  {
51
- ref: m,
52
- className: o(
53
- M,
54
- G[l],
55
- (y || x) && "ring-1 ring-brand",
56
- n && "cursor-not-allowed bg-disabled_subtle text-disabled"
51
+ ref: x,
52
+ className: i(
53
+ Y,
54
+ Q[n],
55
+ (B || y) && "ring-1 ring-brand",
56
+ c && "cursor-not-allowed bg-disabled_subtle text-disabled"
57
57
  ),
58
58
  children: /* @__PURE__ */ e(
59
- K,
59
+ U,
60
60
  {
61
- className: o(
61
+ className: i(
62
62
  "flex h-max w-full items-center justify-start gap-2 truncate text-left align-middle",
63
63
  // Icon styles
64
64
  "*:data-icon:size-5 *:data-icon:shrink-0 *:data-icon:text-fg-quaternary in-disabled:*:data-icon:text-fg-disabled",
65
- X[l].root
65
+ J[n].root
66
66
  ),
67
- children: (t) => {
68
- var I, N, C, w, q;
69
- const p = ((I = t.selectedItem) == null ? void 0 : I.icon) || d;
70
- return /* @__PURE__ */ f(B, { children: [
71
- (N = t.selectedItem) != null && N.avatarUrl ? /* @__PURE__ */ e(
72
- L,
67
+ children: (r) => {
68
+ var o, m, s, v, S;
69
+ const t = ((o = r.selectedItem) == null ? void 0 : o.icon) || p;
70
+ return /* @__PURE__ */ b(K, { children: [
71
+ (m = r.selectedItem) != null && m.avatarUrl ? /* @__PURE__ */ e(
72
+ $,
73
73
  {
74
74
  size: "sm",
75
- src: t.selectedItem.avatarUrl,
76
- alt: t.selectedItem.label
75
+ src: r.selectedItem.avatarUrl,
76
+ alt: r.selectedItem.label
77
77
  }
78
- ) : H(p) ? /* @__PURE__ */ e(
79
- p,
78
+ ) : G(t) ? /* @__PURE__ */ e(
79
+ t,
80
80
  {
81
81
  "data-icon": !0,
82
82
  "aria-hidden": "true",
83
- className: S[l]
83
+ className: R[n]
84
84
  }
85
- ) : T(p) ? p : null,
86
- t.selectedItem ? /* @__PURE__ */ f("section", { className: "flex w-full gap-2 truncate", children: [
85
+ ) : _(t) ? t : null,
86
+ r.selectedItem ? /* @__PURE__ */ b("section", { className: "flex w-full gap-2 truncate", children: [
87
87
  /* @__PURE__ */ e(
88
88
  "p",
89
89
  {
90
- className: o(
90
+ className: i(
91
91
  "truncate font-medium text-primary",
92
- b[l],
93
- h
92
+ w[n],
93
+ I
94
94
  ),
95
- children: (C = t.selectedItem) == null ? void 0 : C.label
95
+ children: (s = r.selectedItem) == null ? void 0 : s.label
96
96
  }
97
97
  ),
98
- ((w = t.selectedItem) == null ? void 0 : w.supportingText) && /* @__PURE__ */ e("p", { className: o("text-tertiary", b[l]), children: (q = t.selectedItem) == null ? void 0 : q.supportingText })
98
+ ((v = r.selectedItem) == null ? void 0 : v.supportingText) && /* @__PURE__ */ e("p", { className: i("text-tertiary", w[n]), children: (S = r.selectedItem) == null ? void 0 : S.supportingText })
99
99
  ] }) : /* @__PURE__ */ e(
100
100
  "p",
101
101
  {
102
- className: o(
102
+ className: i(
103
103
  "text-placeholder_subtle",
104
- b[l],
105
- n && "text-disabled"
104
+ w[n],
105
+ c && "text-disabled"
106
106
  ),
107
- children: a
107
+ children: u
108
108
  }
109
109
  ),
110
- s && /* @__PURE__ */ e(
111
- V,
110
+ f && /* @__PURE__ */ e(
111
+ k,
112
112
  {
113
113
  "aria-hidden": "true",
114
- className: o(
114
+ className: i(
115
115
  "ml-auto shrink-0 text-fg-quaternary",
116
- S[l]
116
+ R[n]
117
117
  )
118
118
  }
119
119
  )
@@ -123,86 +123,110 @@ const X = {
123
123
  )
124
124
  }
125
125
  );
126
- return r ? /* @__PURE__ */ f("div", { className: "relative flex w-full items-stretch", children: [
127
- i,
126
+ return d ? /* @__PURE__ */ b("div", { className: "relative flex w-full items-stretch", children: [
127
+ g,
128
128
  /* @__PURE__ */ e(
129
129
  "button",
130
130
  {
131
131
  type: "button",
132
132
  tabIndex: -1,
133
133
  "aria-label": "Clear selection",
134
- onClick: () => c == null ? void 0 : c(),
135
- className: o(
134
+ onClick: () => a == null ? void 0 : a(),
135
+ className: i(
136
136
  "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"
137
137
  ),
138
- children: /* @__PURE__ */ e(_, { "aria-hidden": !0, className: S[l] })
138
+ children: /* @__PURE__ */ e(z, { "aria-hidden": !0, className: R[n] })
139
139
  }
140
140
  )
141
- ] }) : i;
142
- }, Q = j({
143
- size: "sm"
144
- }), W = ({
145
- placeholder: x = "Select",
146
- placeholderIcon: y,
147
- size: n = "sm",
148
- children: l,
149
- items: a,
150
- label: d,
151
- hint: m,
152
- tooltip: h,
153
- className: s,
154
- textStyles: g,
155
- showChevron: c = !0,
156
- isClearable: u = !1,
157
- ...r
158
- }) => /* @__PURE__ */ e(Q.Provider, { value: { size: n }, children: /* @__PURE__ */ e(
159
- k,
160
- {
161
- ...r,
162
- className: (i) => o(
163
- "flex flex-col gap-1.5",
164
- typeof s == "function" ? s(i) : s
165
- ),
166
- children: (i) => /* @__PURE__ */ f(B, { children: [
167
- d && /* @__PURE__ */ e(
168
- U,
169
- {
170
- isRequired: i.isRequired,
171
- tooltip: h,
172
- className: J[n],
173
- children: d
174
- }
175
- ),
176
- /* @__PURE__ */ e(
177
- O,
141
+ ] }) : g;
142
+ }, D = V({ size: "sm" }), ee = ({
143
+ placeholder: y = "Select",
144
+ placeholderIcon: B,
145
+ size: c = "sm",
146
+ children: n,
147
+ items: u,
148
+ label: p,
149
+ hint: x,
150
+ tooltip: I,
151
+ className: f,
152
+ textStyles: N,
153
+ showChevron: a = !0,
154
+ isClearable: h = !1,
155
+ isDeselectable: d = !1,
156
+ ...g
157
+ }) => {
158
+ const { selectedKey: r, onSelectionChange: t, ...o } = g, m = T(!1), s = r === void 0 ? void 0 : r == null || String(r) === "" ? null : r, v = j(() => {
159
+ var l;
160
+ !d || s == null || (m.current = !0, t == null || t(null), (l = o.onOpenChange) == null || l.call(o, !1), queueMicrotask(() => {
161
+ m.current = !1;
162
+ }));
163
+ }, [o.onOpenChange, d, t, s]), S = j(
164
+ (l) => {
165
+ if (m.current) return;
166
+ const C = l == null || String(l) === "" ? null : l;
167
+ t == null || t(C);
168
+ },
169
+ [t]
170
+ );
171
+ return /* @__PURE__ */ e(
172
+ D.Provider,
173
+ {
174
+ value: {
175
+ size: c,
176
+ isDeselectable: d,
177
+ selectedKey: s,
178
+ onReselectCurrent: d ? v : void 0
179
+ },
180
+ children: /* @__PURE__ */ e(
181
+ L,
178
182
  {
179
- ...i,
180
- size: n,
181
- placeholder: x,
182
- placeholderIcon: null,
183
- textStyles: g,
184
- showChevron: c,
185
- isClearable: u,
186
- onClear: u && r.onSelectionChange ? () => {
187
- var t;
188
- return (t = r.onSelectionChange) == null ? void 0 : t.call(r, null);
189
- } : void 0,
190
- selectedItem: r.selectedKey != null && a ? a.find(
191
- (t) => String(t.id) === String(r.selectedKey)
192
- ) ?? null : null
183
+ ...o,
184
+ selectedKey: s,
185
+ onSelectionChange: S,
186
+ className: (l) => i(
187
+ "flex flex-col gap-1.5",
188
+ typeof f == "function" ? f(l) : f
189
+ ),
190
+ children: (l) => /* @__PURE__ */ b(K, { children: [
191
+ p && /* @__PURE__ */ e(
192
+ E,
193
+ {
194
+ isRequired: l.isRequired,
195
+ tooltip: I,
196
+ className: W[c],
197
+ children: p
198
+ }
199
+ ),
200
+ /* @__PURE__ */ e(
201
+ Z,
202
+ {
203
+ ...l,
204
+ size: c,
205
+ placeholder: y,
206
+ placeholderIcon: null,
207
+ textStyles: N,
208
+ showChevron: a,
209
+ isClearable: h,
210
+ onClear: h && t ? () => t(null) : void 0,
211
+ selectedItem: s != null && u ? u.find(
212
+ (C) => String(C.id) === String(s)
213
+ ) ?? null : null
214
+ }
215
+ ),
216
+ /* @__PURE__ */ e(H, { size: c, className: i(o.popoverClassName), children: /* @__PURE__ */ e(O, { items: u, className: "size-full outline-hidden ", children: n }) }),
217
+ x && /* @__PURE__ */ e(A, { isInvalid: l.isInvalid, children: x })
218
+ ] })
193
219
  }
194
- ),
195
- /* @__PURE__ */ e(A, { size: n, className: o(r.popoverClassName), children: /* @__PURE__ */ e(R, { items: a, className: "size-full outline-hidden ", children: l }) }),
196
- m && /* @__PURE__ */ e(P, { isInvalid: i.isInvalid, children: m })
197
- ] })
198
- }
199
- ) }), v = W;
200
- v.ComboBox = $;
201
- v.Item = E;
202
- v.Searchable = F;
220
+ )
221
+ }
222
+ );
223
+ }, q = ee;
224
+ q.ComboBox = F;
225
+ q.Item = M;
226
+ q.Searchable = X;
203
227
  export {
204
- v as Select,
205
- Q as SelectContext,
206
- b as fontSizes,
207
- X as sizes
228
+ q as Select,
229
+ D as SelectContext,
230
+ w as fontSizes,
231
+ J as sizes
208
232
  };
@@ -0,0 +1,2 @@
1
+ export { Snackbar, type SnackbarProps } from './snackbar';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/snackbar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { FC, ReactNode } from 'react';
2
+ export interface SnackbarProps {
3
+ /** Main message text */
4
+ title: string;
5
+ /** Optional icon component or element. Defaults to InfoCircle. Pass `null` to hide. */
6
+ icon?: FC<{
7
+ className?: string;
8
+ size?: number;
9
+ }> | ReactNode | null;
10
+ /** Color of the snackbar */
11
+ color?: "default" | "success" | "error";
12
+ /** Action button label */
13
+ actionLabel?: string;
14
+ /** Icon component or element shown after the action label */
15
+ actionIcon?: FC<{
16
+ className?: string;
17
+ size?: number;
18
+ }> | ReactNode;
19
+ /** Called when the action button is clicked */
20
+ onAction?: () => void;
21
+ /** Called when the close button is clicked. If omitted, the close button is hidden. */
22
+ onClose?: () => void;
23
+ /** Additional className for the root element */
24
+ className?: string;
25
+ }
26
+ export declare const Snackbar: FC<SnackbarProps>;
27
+ //# sourceMappingURL=snackbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snackbar.d.ts","sourceRoot":"","sources":["../../../src/primitives/snackbar/snackbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQ3C,MAAM,WAAW,aAAa;IAC5B,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,uFAAuF;IACvF,IAAI,CAAC,EAAE,EAAE,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC;IACpE,4BAA4B;IAC5B,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IACxC,0BAA0B;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,EAAE,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,SAAS,CAAC;IACnE,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,uFAAuF;IACvF,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAgItC,CAAC"}