@konstructio/ui 0.1.2-alpha.55 → 0.1.2-alpha.57

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 (56) hide show
  1. package/dist/assets/icons/components/BookOpen.d.ts +3 -0
  2. package/dist/assets/icons/components/BookOpen.js +32 -0
  3. package/dist/assets/icons/components/DollarSign.d.ts +3 -0
  4. package/dist/assets/icons/components/DollarSign.js +30 -0
  5. package/dist/assets/icons/components/LightBulb.d.ts +3 -0
  6. package/dist/assets/icons/components/LightBulb.js +43 -0
  7. package/dist/assets/icons/components/index.d.ts +3 -0
  8. package/dist/assets/icons/components/index.js +114 -108
  9. package/dist/assets/icons/index.js +114 -108
  10. package/dist/components/Autocomplete/Autocomplete.js +41 -40
  11. package/dist/components/Autocomplete/Autocomplete.types.d.ts +2 -0
  12. package/dist/components/ButtonGroup/ButtonGroup.js +111 -91
  13. package/dist/components/ButtonGroup/ButtonGroup.types.d.ts +2 -0
  14. package/dist/components/ButtonGroup/ButtonGroup.variants.d.ts +5 -4
  15. package/dist/components/ButtonGroup/ButtonGroup.variants.js +33 -25
  16. package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.js +97 -246
  17. package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.types.d.ts +2 -2
  18. package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.variants.d.ts +2 -4
  19. package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.variants.js +22 -20
  20. package/dist/components/Checkbox/Checkbox.js +152 -144
  21. package/dist/components/Checkbox/Checkbox.types.d.ts +2 -0
  22. package/dist/components/Counter/Counter.js +43 -42
  23. package/dist/components/Counter/Counter.types.d.ts +2 -0
  24. package/dist/components/DateRangePicker/DateRangePicker.js +94 -93
  25. package/dist/components/DateRangePicker/DateRangePicker.types.d.ts +2 -0
  26. package/dist/components/DateRangePicker/components/CalendarPanel/components/IndependentModeCalendar/IndependentModeCalendar.js +1 -1
  27. package/dist/components/DateRangePicker/components/CalendarPanel/components/TogetherModeCalendar/TogetherModeCalendar.js +1 -1
  28. package/dist/components/ImageUpload/ImageUpload.d.ts +1 -1
  29. package/dist/components/ImageUpload/ImageUpload.js +51 -50
  30. package/dist/components/ImageUpload/ImageUpload.types.d.ts +2 -0
  31. package/dist/components/Input/Input.js +72 -58
  32. package/dist/components/Input/Input.types.d.ts +4 -0
  33. package/dist/components/MultiSelectDropdown/MultiSelectDropdown.types.d.ts +2 -0
  34. package/dist/components/MultiSelectDropdown/components/Wrapper/Wrapper.js +40 -39
  35. package/dist/components/PhoneNumberInput/PhoneNumberInput.types.d.ts +2 -0
  36. package/dist/components/PhoneNumberInput/components/Wrapper.js +164 -163
  37. package/dist/components/PhoneNumberInput/contexts/phone-number.provider.js +172 -116
  38. package/dist/components/Range/Range.js +26 -24
  39. package/dist/components/Range/Range.types.d.ts +2 -0
  40. package/dist/components/Select/Select.types.d.ts +1 -0
  41. package/dist/components/Select/Select.variants.js +2 -1
  42. package/dist/components/Select/components/Wrapper.js +74 -73
  43. package/dist/components/Slider/Slider.js +30 -20
  44. package/dist/components/Slider/Slider.types.d.ts +2 -0
  45. package/dist/components/Switch/Switch.js +89 -87
  46. package/dist/components/Switch/Switch.types.d.ts +2 -0
  47. package/dist/components/TagSelect/TagSelect.types.d.ts +2 -0
  48. package/dist/components/TagSelect/components/Wrapper/Wrapper.js +47 -46
  49. package/dist/components/TextArea/TextArea.js +27 -26
  50. package/dist/components/TextArea/TextArea.types.d.ts +2 -0
  51. package/dist/icons.d.ts +1 -1
  52. package/dist/icons.js +114 -108
  53. package/dist/package.json +17 -17
  54. package/dist/{proxy-i19-YB39.js → proxy-BhEKW5n7.js} +1903 -1757
  55. package/dist/styles.css +1 -1
  56. package/package.json +17 -17
@@ -1,263 +1,114 @@
1
- import { jsx as x, Fragment as X, jsxs as E } from "react/jsx-runtime";
2
- import * as N from "react";
3
- import { useId as D, useRef as I, useContext as O, useInsertionEffect as _, useMemo as k, Children as F, isValidElement as q, useState as H, memo as J } from "react";
4
- import { cn as v } from "../../../../utils/index.js";
5
- import { buttonGroupPillVariants as Q, buttonGroupLabelVariants as K, buttonGroupDescriptionVariants as Z, buttonGroupItemContentVariants as S, buttonGroupItemVariants as ee } from "./ButtonGroupItem.variants.js";
6
- import { M as te, i as T, u as W, P as ne, a as se, b as re, L as oe, m as j } from "../../../../proxy-i19-YB39.js";
7
- function A(e, s) {
8
- if (typeof e == "function")
9
- return e(s);
10
- e != null && (e.current = s);
11
- }
12
- function ie(...e) {
13
- return (s) => {
14
- let t = !1;
15
- const r = e.map((i) => {
16
- const o = A(i, s);
17
- return !t && typeof o == "function" && (t = !0), o;
18
- });
19
- if (t)
20
- return () => {
21
- for (let i = 0; i < r.length; i++) {
22
- const o = r[i];
23
- typeof o == "function" ? o() : A(e[i], null);
24
- }
25
- };
26
- };
27
- }
28
- function ae(...e) {
29
- return N.useCallback(ie(...e), e);
30
- }
31
- class ce extends N.Component {
32
- getSnapshotBeforeUpdate(s) {
33
- const t = this.props.childRef.current;
34
- if (t && s.isPresent && !this.props.isPresent) {
35
- const r = t.offsetParent, i = T(r) && r.offsetWidth || 0, o = T(r) && r.offsetHeight || 0, n = this.props.sizeRef.current;
36
- n.height = t.offsetHeight || 0, n.width = t.offsetWidth || 0, n.top = t.offsetTop, n.left = t.offsetLeft, n.right = i - n.width - n.left, n.bottom = o - n.height - n.top;
37
- }
38
- return null;
39
- }
40
- /**
41
- * Required with getSnapshotBeforeUpdate to stop React complaining.
42
- */
43
- componentDidUpdate() {
44
- }
45
- render() {
46
- return this.props.children;
47
- }
48
- }
49
- function le({ children: e, isPresent: s, anchorX: t, anchorY: r, root: i }) {
50
- const o = D(), n = I(null), m = I({
51
- width: 0,
52
- height: 0,
53
- top: 0,
54
- left: 0,
55
- right: 0,
56
- bottom: 0
57
- }), { nonce: h } = O(te), b = e.props?.ref ?? e?.ref, l = ae(n, b);
58
- return _(() => {
59
- const { width: u, height: a, top: f, left: d, right: C, bottom: g } = m.current;
60
- if (s || !n.current || !u || !a)
61
- return;
62
- const P = t === "left" ? `left: ${d}` : `right: ${C}`, $ = r === "bottom" ? `bottom: ${g}` : `top: ${f}`;
63
- n.current.dataset.motionPopId = o;
64
- const w = document.createElement("style");
65
- h && (w.nonce = h);
66
- const p = i ?? document.head;
67
- return p.appendChild(w), w.sheet && w.sheet.insertRule(`
68
- [data-motion-pop-id="${o}"] {
69
- position: absolute !important;
70
- width: ${u}px !important;
71
- height: ${a}px !important;
72
- ${P}px !important;
73
- ${$}px !important;
74
- }
75
- `), () => {
76
- p.contains(w) && p.removeChild(w);
77
- };
78
- }, [s]), x(ce, { isPresent: s, childRef: n, sizeRef: m, children: N.cloneElement(e, { ref: l }) });
79
- }
80
- const ue = ({ children: e, initial: s, isPresent: t, onExitComplete: r, custom: i, presenceAffectsLayout: o, mode: n, anchorX: m, anchorY: h, root: b }) => {
81
- const l = W(fe), u = D();
82
- let a = !0, f = k(() => (a = !1, {
83
- id: u,
84
- initial: s,
85
- isPresent: t,
86
- custom: i,
87
- onExitComplete: (d) => {
88
- l.set(d, !0);
89
- for (const C of l.values())
90
- if (!C)
91
- return;
92
- r && r();
93
- },
94
- register: (d) => (l.set(d, !1), () => l.delete(d))
95
- }), [t, l, r]);
96
- return o && a && (f = { ...f }), k(() => {
97
- l.forEach((d, C) => l.set(C, !1));
98
- }, [t]), N.useEffect(() => {
99
- !t && !l.size && r && r();
100
- }, [t]), n === "popLayout" && (e = x(le, { isPresent: t, anchorX: m, anchorY: h, root: b, children: e })), x(ne.Provider, { value: f, children: e });
101
- };
102
- function fe() {
103
- return /* @__PURE__ */ new Map();
104
- }
105
- const L = (e) => e.key || "";
106
- function B(e) {
107
- const s = [];
108
- return F.forEach(e, (t) => {
109
- q(t) && s.push(t);
110
- }), s;
111
- }
112
- const de = ({ children: e, custom: s, initial: t = !0, onExitComplete: r, presenceAffectsLayout: i = !0, mode: o = "sync", propagate: n = !1, anchorX: m = "left", anchorY: h = "top", root: b }) => {
113
- const [l, u] = se(n), a = k(() => B(e), [e]), f = n && !l ? [] : a.map(L), d = I(!0), C = I(a), g = W(() => /* @__PURE__ */ new Map()), P = I(/* @__PURE__ */ new Set()), [$, w] = H(a), [p, V] = H(a);
114
- re(() => {
115
- d.current = !1, C.current = a;
116
- for (let y = 0; y < p.length; y++) {
117
- const c = L(p[y]);
118
- f.includes(c) ? (g.delete(c), P.current.delete(c)) : g.get(c) !== !0 && g.set(c, !1);
119
- }
120
- }, [p, f.length, f.join("-")]);
121
- const G = [];
122
- if (a !== $) {
123
- let y = [...a];
124
- for (let c = 0; c < p.length; c++) {
125
- const R = p[c], M = L(R);
126
- f.includes(M) || (y.splice(c, 0, R), G.push(R));
127
- }
128
- return o === "wait" && G.length && (y = G), V(B(y)), w(a), null;
129
- }
130
- process.env.NODE_ENV !== "production" && o === "wait" && p.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
131
- const { forceRender: Y } = O(oe);
132
- return x(X, { children: p.map((y) => {
133
- const c = L(y), R = n && !l ? !1 : a === p || f.includes(c), M = () => {
134
- if (P.current.has(c))
135
- return;
136
- if (P.current.add(c), g.has(c))
137
- g.set(c, !0);
138
- else
139
- return;
140
- let z = !0;
141
- g.forEach((U) => {
142
- U || (z = !1);
143
- }), z && (Y?.(), V(C.current), n && u?.(), r && r());
144
- };
145
- return x(ue, { isPresent: R, initial: !d.current || t ? void 0 : !1, custom: s, presenceAffectsLayout: i, mode: o, root: b, onExitComplete: R ? void 0 : M, anchorX: m, anchorY: h, children: y }, c);
146
- }) });
147
- }, pe = (e, s) => s === "none" ? e ? "inset(0 0 0 0)" : "inset(0 100% 0 0)" : e ? "inset(0 0 0 0)" : s === "right" ? "inset(0 0 0 100%)" : "inset(0 100% 0 0)", he = J(
1
+ import { jsx as s, jsxs as a } from "react/jsx-runtime";
2
+ import { memo as x } from "react";
3
+ import { cn as t } from "../../../../utils/index.js";
4
+ import { buttonGroupLabelVariants as o, buttonGroupDescriptionVariants as I, buttonGroupItemContentVariants as L, buttonGroupItemVariants as g } from "./ButtonGroupItem.variants.js";
5
+ import { m as V } from "../../../../proxy-BhEKW5n7.js";
6
+ const w = (r, n) => n === "none" ? r ? "inset(0 0 0 0)" : "inset(0 100% 0 0)" : r ? "inset(0 0 0 0)" : n === "right" ? "inset(0 0 0 100%)" : "inset(0 100% 0 0)", j = x(
148
7
  ({
149
- animationDirection: e,
150
- className: s,
151
- contentClassName: t,
152
- descriptionClassName: r,
153
- duration: i = 0.3,
154
- hasDescription: o,
155
- index: n,
156
- isDisabled: m,
157
- isSelected: h,
158
- labelClassName: b,
159
- layoutId: l,
160
- option: u,
161
- pillClassName: a,
162
- value: f,
163
- onKeyDown: d,
164
- onSelect: C
165
- }) => /* @__PURE__ */ E(
8
+ animationDirection: r,
9
+ className: n,
10
+ contentClassName: u,
11
+ descriptionClassName: d,
12
+ duration: p = 0.3,
13
+ hasDescription: h,
14
+ index: c,
15
+ isDisabled: l,
16
+ isFirst: b,
17
+ isLast: f,
18
+ isSelected: i,
19
+ labelClassName: m,
20
+ option: e,
21
+ value: y,
22
+ onKeyDown: N,
23
+ onSelect: v
24
+ }) => /* @__PURE__ */ s(
166
25
  "button",
167
26
  {
168
27
  type: "button",
169
28
  role: "radio",
170
- "aria-checked": h,
171
- "data-value": u.value,
172
- disabled: m,
173
- tabIndex: h || n === 0 ? 0 : -1,
174
- onClick: () => !m && C(f),
175
- onKeyDown: (g) => d(g, n),
176
- className: v(
177
- ee({ disabled: m }),
29
+ "aria-checked": i,
30
+ "data-value": e.value,
31
+ disabled: l,
32
+ tabIndex: i || c === 0 ? 0 : -1,
33
+ onClick: () => !l && v(y),
34
+ onKeyDown: (G) => N(G, c),
35
+ className: t(
36
+ g({ disabled: l, isFirst: b, isLast: f }),
178
37
  "relative",
179
- s
38
+ n
180
39
  ),
181
- children: [
182
- /* @__PURE__ */ x(de, { mode: "popLayout", initial: !1, children: h && /* @__PURE__ */ x(
183
- j.div,
184
- {
185
- layoutId: l,
186
- className: v(Q(), a),
187
- transition: {
188
- type: "tween",
189
- ease: "easeInOut",
190
- duration: i
191
- }
192
- }
193
- ) }),
194
- /* @__PURE__ */ E(
195
- "div",
196
- {
197
- className: v(
198
- S({ hasDescription: o }),
199
- "relative z-10",
200
- t
201
- ),
202
- children: [
203
- /* @__PURE__ */ E("span", { className: "relative", children: [
204
- /* @__PURE__ */ E(
205
- "span",
206
- {
207
- className: v(
208
- K({ selected: !1 }),
209
- b
210
- ),
211
- children: [
212
- u.icon,
213
- u.label
214
- ]
215
- }
216
- ),
217
- /* @__PURE__ */ E(
218
- j.span,
219
- {
220
- className: v(
221
- K({ selected: !0 }),
222
- "absolute inset-0",
223
- b
224
- ),
225
- "aria-hidden": "true",
226
- initial: !1,
227
- animate: {
228
- clipPath: pe(h, e)
229
- },
230
- transition: {
231
- type: "tween",
232
- ease: "easeInOut",
233
- duration: i
234
- },
235
- children: [
236
- u.icon,
237
- u.label
238
- ]
239
- }
240
- )
241
- ] }),
242
- u.description && /* @__PURE__ */ x(
40
+ children: /* @__PURE__ */ a(
41
+ "div",
42
+ {
43
+ className: t(
44
+ L({ hasDescription: h }),
45
+ "relative",
46
+ u
47
+ ),
48
+ children: [
49
+ /* @__PURE__ */ a("span", { className: "relative w-full", children: [
50
+ /* @__PURE__ */ a(
243
51
  "span",
244
52
  {
245
- className: v(
246
- Z(),
247
- r
53
+ className: t(
54
+ o({ selected: !1 }),
55
+ m
248
56
  ),
249
- children: u.description
57
+ children: [
58
+ /* @__PURE__ */ a("span", { className: "flex items-center gap-2", children: [
59
+ e.icon,
60
+ e.label
61
+ ] }),
62
+ e.secondaryLabel && /* @__PURE__ */ s("span", { children: e.secondaryLabel })
63
+ ]
64
+ }
65
+ ),
66
+ /* @__PURE__ */ a(
67
+ V.span,
68
+ {
69
+ className: t(
70
+ o({ selected: !0 }),
71
+ "absolute inset-0",
72
+ m
73
+ ),
74
+ "aria-hidden": "true",
75
+ initial: !1,
76
+ animate: {
77
+ clipPath: w(i, r)
78
+ },
79
+ transition: {
80
+ type: "tween",
81
+ ease: "linear",
82
+ duration: p
83
+ },
84
+ children: [
85
+ /* @__PURE__ */ a("span", { className: "flex items-center gap-2", children: [
86
+ e.icon,
87
+ e.label
88
+ ] }),
89
+ e.secondaryLabel && /* @__PURE__ */ s("span", { children: e.secondaryLabel })
90
+ ]
250
91
  }
251
92
  )
252
- ]
253
- }
254
- )
255
- ]
93
+ ] }),
94
+ e.description && /* @__PURE__ */ s(
95
+ "span",
96
+ {
97
+ className: t(
98
+ I(),
99
+ d
100
+ ),
101
+ children: e.description
102
+ }
103
+ )
104
+ ]
105
+ }
106
+ )
256
107
  },
257
- u.value
108
+ e.value
258
109
  )
259
110
  );
260
- he.displayName = "KonstructButtonGroupItem";
111
+ j.displayName = "KonstructButtonGroupItem";
261
112
  export {
262
- he as ButtonGroupItem
113
+ j as ButtonGroupItem
263
114
  };
@@ -10,11 +10,11 @@ export type Props = {
10
10
  hasDescription: boolean;
11
11
  index: number;
12
12
  isDisabled: boolean;
13
+ isFirst: boolean;
14
+ isLast: boolean;
13
15
  isSelected: boolean;
14
16
  labelClassName?: string;
15
- layoutId: string;
16
17
  option: ButtonGroupOption;
17
- pillClassName?: string;
18
18
  value: string;
19
19
  onKeyDown: (event: KeyboardEvent<HTMLButtonElement>, index: number) => void;
20
20
  onSelect: (value: string) => void;
@@ -3,11 +3,9 @@
3
3
  */
4
4
  export declare const buttonGroupItemVariants: (props?: ({
5
5
  disabled?: boolean | null | undefined;
6
+ isFirst?: boolean | null | undefined;
7
+ isLast?: boolean | null | undefined;
6
8
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
7
- /**
8
- * Animated pill background (selected state indicator)
9
- */
10
- export declare const buttonGroupPillVariants: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
11
9
  /**
12
10
  * Inner content container (the content layer above the pill)
13
11
  */
@@ -1,5 +1,5 @@
1
1
  import { c as t } from "../../../../index-D29mdTf5.js";
2
- const r = t(
2
+ const s = t(
3
3
  [
4
4
  "flex",
5
5
  "flex-1",
@@ -11,11 +11,7 @@ const r = t(
11
11
  "border-metal-700",
12
12
  "border-t",
13
13
  "border-b",
14
- "bg-metal-900",
15
- "first:border-l",
16
- "first:rounded-l-lg",
17
- "last:border-r",
18
- "last:rounded-r-lg",
14
+ "bg-transparent",
19
15
  "focus:outline-none",
20
16
  "focus-visible:ring-2",
21
17
  "focus-visible:ring-aurora-500",
@@ -26,18 +22,23 @@ const r = t(
26
22
  disabled: {
27
23
  true: "pointer-events-none opacity-50",
28
24
  false: ""
25
+ },
26
+ isFirst: {
27
+ true: "border-l rounded-l-lg",
28
+ false: ""
29
+ },
30
+ isLast: {
31
+ true: "border-r rounded-r-lg",
32
+ false: ""
29
33
  }
30
34
  },
31
35
  defaultVariants: {
32
- disabled: !1
36
+ disabled: !1,
37
+ isFirst: !1,
38
+ isLast: !1
33
39
  }
34
40
  }
35
- ), s = t([
36
- "absolute",
37
- "inset-2",
38
- "bg-metal-800",
39
- "rounded-lg"
40
- ]), a = t(
41
+ ), r = t(
41
42
  ["flex", "flex-col", "flex-1", "rounded-lg", "px-4", "py-2"],
42
43
  {
43
44
  variants: {
@@ -50,7 +51,7 @@ const r = t(
50
51
  hasDescription: !1
51
52
  }
52
53
  }
53
- ), n = t(
54
+ ), a = t(
54
55
  [
55
56
  "text-sm",
56
57
  "font-medium",
@@ -59,6 +60,8 @@ const r = t(
59
60
  "flex",
60
61
  "items-center",
61
62
  "gap-2",
63
+ "w-full",
64
+ "justify-between",
62
65
  "transition-colors",
63
66
  "ease-in-out"
64
67
  ],
@@ -73,7 +76,7 @@ const r = t(
73
76
  selected: !1
74
77
  }
75
78
  }
76
- ), o = t([
79
+ ), n = t([
77
80
  "text-sm",
78
81
  "font-normal",
79
82
  "leading-5",
@@ -81,9 +84,8 @@ const r = t(
81
84
  "text-metal-300"
82
85
  ]);
83
86
  export {
84
- o as buttonGroupDescriptionVariants,
85
- a as buttonGroupItemContentVariants,
86
- r as buttonGroupItemVariants,
87
- n as buttonGroupLabelVariants,
88
- s as buttonGroupPillVariants
87
+ n as buttonGroupDescriptionVariants,
88
+ r as buttonGroupItemContentVariants,
89
+ s as buttonGroupItemVariants,
90
+ a as buttonGroupLabelVariants
89
91
  };