@lazar-ui/kit 0.5.2 → 0.6.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 (106) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/Actions-CEIXfLKN.mjs +26 -0
  3. package/dist/Actions.css +1 -0
  4. package/dist/ActiveFilters-BJojmc-d.mjs +29 -0
  5. package/dist/ActiveFilters.css +1 -0
  6. package/dist/Button-BN85EtaZ.mjs +52 -0
  7. package/dist/Button.css +1 -1
  8. package/dist/Cell-BPBvEyeL.mjs +21 -0
  9. package/dist/Cell.css +1 -0
  10. package/dist/Checkbox-Chfzm1Z9.mjs +46 -0
  11. package/dist/Checkbox.css +1 -0
  12. package/dist/Content-ru2X8iBx.mjs +13 -0
  13. package/dist/Content.css +1 -0
  14. package/dist/Group-DyDpeqOP.mjs +16 -0
  15. package/dist/Group.css +1 -0
  16. package/dist/Header-Clhgyr0J.mjs +29 -0
  17. package/dist/Header.css +1 -0
  18. package/dist/Heading-CL47Fqe7.mjs +30 -0
  19. package/dist/Heading.css +1 -0
  20. package/dist/InputBase-BHZWQT9-.mjs +46 -0
  21. package/dist/Item-JbyvZy05.mjs +66 -0
  22. package/dist/Item.css +1 -0
  23. package/dist/Panel-Q06TIYep.mjs +12 -0
  24. package/dist/Provider-CBfZpO45.mjs +12 -0
  25. package/dist/Row-C-3TXoDz.mjs +15 -0
  26. package/dist/Row.css +1 -0
  27. package/dist/Tab-CR0KvVaA.mjs +39 -0
  28. package/dist/Tab.css +1 -0
  29. package/dist/Text-DiOqZt8E.mjs +49 -0
  30. package/dist/Text.css +1 -0
  31. package/dist/Title-aOeFD24v.mjs +13 -0
  32. package/dist/Title.css +1 -0
  33. package/dist/Toolbar-BJQy4qFI.mjs +11 -0
  34. package/dist/Toolbar.css +1 -0
  35. package/dist/Trigger-C_4De6l1.mjs +11 -0
  36. package/dist/accordion.js +1 -1
  37. package/dist/actions.d.ts +13 -0
  38. package/dist/actions.js +4 -0
  39. package/dist/active-filters.d.ts +35 -0
  40. package/dist/active-filters.js +4 -0
  41. package/dist/breadcrumbs.js +1 -1
  42. package/dist/button.js +1 -1
  43. package/dist/cell.d.ts +20 -0
  44. package/dist/cell.js +4 -0
  45. package/dist/checkbox.d.ts +10 -35
  46. package/dist/checkbox.js +2 -40
  47. package/dist/content.d.ts +8 -0
  48. package/dist/content.js +4 -0
  49. package/dist/context.d.ts +44 -0
  50. package/dist/context.js +7 -0
  51. package/dist/dialog.css +1 -1
  52. package/dist/dialog.js +37 -44
  53. package/dist/drawer.css +1 -1
  54. package/dist/drawer.js +72 -93
  55. package/dist/empty-state.css +1 -1
  56. package/dist/empty-state.js +29 -48
  57. package/dist/enums-BnuDYTua.mjs +4 -0
  58. package/dist/enums-CiPhZomh.mjs +6 -0
  59. package/dist/enums-DUZMBQDd.mjs +7 -0
  60. package/dist/{getComponentSlots-DwAYUFNk.mjs → getComponentSlots-DD4iju8N.mjs} +1 -1
  61. package/dist/group.d.ts +12 -0
  62. package/dist/group.js +4 -0
  63. package/dist/header.d.ts +21 -0
  64. package/dist/header.js +4 -0
  65. package/dist/heading.d.ts +55 -0
  66. package/dist/heading.js +7 -0
  67. package/dist/input-base.d.ts +29 -0
  68. package/dist/input-base.js +4 -0
  69. package/dist/input.js +86 -124
  70. package/dist/isValidReactNode-D1buElhX.mjs +17 -0
  71. package/dist/item.d.ts +16 -0
  72. package/dist/item.js +4 -0
  73. package/dist/menu.css +1 -1
  74. package/dist/menu.js +46 -103
  75. package/dist/pagination.js +48 -60
  76. package/dist/panel.d.ts +9 -0
  77. package/dist/panel.js +4 -0
  78. package/dist/radio.css +1 -1
  79. package/dist/radio.js +42 -98
  80. package/dist/row.d.ts +12 -0
  81. package/dist/row.js +4 -0
  82. package/dist/tab.d.ts +30 -0
  83. package/dist/tab.js +4 -0
  84. package/dist/table.css +1 -1
  85. package/dist/table.js +25 -74
  86. package/dist/tabs.css +1 -1
  87. package/dist/tabs.js +30 -72
  88. package/dist/text.d.ts +74 -0
  89. package/dist/text.js +8 -0
  90. package/dist/title.d.ts +8 -0
  91. package/dist/title.js +4 -0
  92. package/dist/toolbar.d.ts +20 -0
  93. package/dist/toolbar.js +4 -0
  94. package/dist/trigger.d.ts +8 -0
  95. package/dist/trigger.js +4 -0
  96. package/dist/typography.d.ts +90 -40
  97. package/dist/typography.js +4 -38
  98. package/dist/useTabsContext-DdF09jQq.mjs +11 -0
  99. package/dist/utils.d.ts +2 -55
  100. package/dist/utils.js +14 -15
  101. package/package.json +1 -1
  102. package/dist/Button-jq8mFP6t.mjs +0 -52
  103. package/dist/checkbox.css +0 -1
  104. package/dist/isValidReactNode-CmYwTWCE.mjs +0 -18
  105. package/dist/typography.css +0 -1
  106. /package/dist/{input.css → InputBase.css} +0 -0
package/dist/input.js CHANGED
@@ -1,59 +1,21 @@
1
- import { jsxs as v, jsx as i } from "react/jsx-runtime";
2
- import z from "clsx";
3
- import { useState as N, useCallback as _ } from "react";
4
- import { g as S } from "./getVariantClassName-DoCNtwBw.mjs";
1
+ import { I as f, D as m, s as S } from "./InputBase-BHZWQT9-.mjs";
2
+ import { jsx as u } from "react/jsx-runtime";
3
+ import { useState as I, useCallback as d } from "react";
5
4
  import { I as Y } from "./Icon-DUCBChX2.mjs";
6
- import { u as A } from "./useLocale-CJh-krrY.mjs";
7
- import './input.css';const m = {
8
- INPUT: "Input",
9
- INPUT_DATE: "InputDate",
10
- INPUT_EMAIL: "InputEmail",
11
- INPUT_NUMBER: "InputNumber",
12
- INPUT_PASSWORD: "InputPassword",
13
- INPUT_PHONE: "InputPhone"
14
- }, E = "_root_8a405_17", U = "_invalid_8a405_36", C = "_disabled_8a405_42", B = "_sizeSm_8a405_56", L = "_sizeMd_8a405_60", k = "_sizeLg_8a405_64", x = "_control_8a405_68", O = "_before_8a405_100", $ = "_after_8a405_101", H = "_togglePassword_8a405_109", p = {
15
- root: E,
16
- invalid: U,
17
- disabled: C,
18
- sizeSm: B,
19
- sizeMd: L,
20
- sizeLg: k,
21
- control: x,
22
- before: O,
23
- after: $,
24
- togglePassword: H
25
- }, f = (s) => {
26
- const { ref: e, invalid: t = !1, size: o = "md", before: r, after: n, className: a, onChange: l, onBlur: c, onFocus: u, ...d } = s, g = z(
27
- p.root,
28
- S("size", o, p),
29
- {
30
- [p.disabled]: d.disabled === !0,
31
- [p.invalid]: t
32
- },
33
- a
34
- ), I = (h) => {
35
- l?.(h.target.value);
36
- };
37
- return /* @__PURE__ */ v("div", { className: g, children: [
38
- r && /* @__PURE__ */ i("span", { className: p.before, children: r }),
39
- /* @__PURE__ */ i("input", { ref: e, className: p.control, onChange: I, onBlur: c, onFocus: u, ...d }),
40
- n && /* @__PURE__ */ i("span", { className: p.after, children: n })
41
- ] });
42
- };
43
- f.displayName = m.INPUT;
44
- const R = 8;
45
- function j(s, e) {
46
- const t = s.replace(/\D/g, "").slice(0, R);
47
- if (!t)
5
+ import { u as B } from "./useLocale-CJh-krrY.mjs";
6
+ const _ = 8;
7
+ function k(t, e) {
8
+ const s = t.replace(/\D/g, "").slice(0, _);
9
+ if (!s)
48
10
  return "";
49
- const o = e.replace(/[A-Z]/g, "").charAt(0), r = F(e);
11
+ const o = e.replace(/[A-Z]/g, "").charAt(0), a = v(e);
50
12
  let n = "";
51
- for (let a = 0; a < t.length; a++)
52
- r.has(a) && (n += o), n += t[a];
13
+ for (let r = 0; r < s.length; r++)
14
+ a.has(r) && (n += o), n += s[r];
53
15
  return n;
54
16
  }
55
- function F(s) {
56
- switch (s) {
17
+ function v(t) {
18
+ switch (t) {
57
19
  case "DD/MM/YYYY":
58
20
  case "MM/DD/YYYY":
59
21
  case "DD.MM.YYYY":
@@ -65,147 +27,147 @@ function F(s) {
65
27
  return /* @__PURE__ */ new Set([2, 4]);
66
28
  }
67
29
  }
68
- function V(s) {
69
- const e = s.replace(/\D/g, "").slice(0, 11);
30
+ function E(t) {
31
+ const e = t.replace(/\D/g, "").slice(0, 11);
70
32
  if (!e)
71
33
  return "";
72
- let t = "+7";
73
- return e.length > 1 && (t += ` (${e.slice(1, 4)}`), e.length >= 4 && (t += `) ${e.slice(4, 7)}`), e.length >= 7 && (t += `-${e.slice(7, 9)}`), e.length >= 9 && (t += `-${e.slice(9, 11)}`), t;
34
+ let s = "+7";
35
+ return e.length > 1 && (s += ` (${e.slice(1, 4)}`), e.length >= 4 && (s += `) ${e.slice(4, 7)}`), e.length >= 7 && (s += `-${e.slice(7, 9)}`), e.length >= 9 && (s += `-${e.slice(9, 11)}`), s;
74
36
  }
75
- const W = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
76
- function Z(s, e) {
37
+ const T = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
38
+ function C(t, e) {
77
39
  const o = e.replace(/[A-Z]/g, "").charAt(0);
78
40
  if (!o)
79
41
  return !1;
80
- const r = s.split(o);
81
- if (r.length !== 3)
42
+ const a = t.split(o);
43
+ if (a.length !== 3)
82
44
  return !1;
83
- const [n, a, l] = r;
84
- if (!n || !a || !l)
45
+ const [n, r, l] = a;
46
+ if (!n || !r || !l)
85
47
  return !1;
86
- let c = 0, u = 0, d = 0;
48
+ let i = 0, c = 0, p = 0;
87
49
  switch (e) {
88
50
  case "DD/MM/YYYY":
89
51
  case "DD.MM.YYYY":
90
- c = parseInt(n, 10), u = parseInt(a, 10), d = parseInt(l, 10);
52
+ i = parseInt(n, 10), c = parseInt(r, 10), p = parseInt(l, 10);
91
53
  break;
92
54
  case "MM/DD/YYYY":
93
55
  case "MM.DD.YYYY":
94
- u = parseInt(n, 10), c = parseInt(a, 10), d = parseInt(l, 10);
56
+ c = parseInt(n, 10), i = parseInt(r, 10), p = parseInt(l, 10);
95
57
  break;
96
58
  case "YYYY-MM-DD":
97
- c = parseInt(l, 10), u = parseInt(a, 10), d = parseInt(n, 10);
59
+ i = parseInt(l, 10), c = parseInt(r, 10), p = parseInt(n, 10);
98
60
  break;
99
61
  default:
100
62
  return !1;
101
63
  }
102
- if (u < 1 || u > 12 || d < 1)
64
+ if (c < 1 || c > 12 || p < 1)
103
65
  return !1;
104
- const I = u === 2 && G(d) ? 29 : W[u] ?? 0;
105
- return c >= 1 && c <= I;
66
+ const D = c === 2 && x(p) ? 29 : T[c] ?? 0;
67
+ return i >= 1 && i <= D;
106
68
  }
107
- function G(s) {
108
- return s % 4 === 0 && s % 100 !== 0 || s % 400 === 0;
69
+ function x(t) {
70
+ return t % 4 === 0 && t % 100 !== 0 || t % 400 === 0;
109
71
  }
110
- function X(s) {
111
- return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s);
72
+ function L(t) {
73
+ return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t);
112
74
  }
113
- const M = (s) => {
114
- const { ref: e, format: t, before: o, value: r, onChange: n, onBlur: a, invalid: l, ...c } = s, [u, d] = N(!1), g = _(
115
- (D) => {
116
- const T = j(D, t);
117
- n?.(T);
75
+ const g = (t) => {
76
+ const { ref: e, format: s, before: o, value: a, onChange: n, onBlur: r, invalid: l, ...i } = t, [c, p] = I(!1), M = d(
77
+ (h) => {
78
+ const A = k(h, s);
79
+ n?.(A);
118
80
  },
119
- [t, n]
120
- ), I = _(
121
- (D) => {
122
- d(!0), a?.(D);
81
+ [s, n]
82
+ ), D = d(
83
+ (h) => {
84
+ p(!0), r?.(h);
123
85
  },
124
- [a]
125
- ), h = l || u && typeof r == "string" && r.length > 0 && !Z(r, t);
126
- return /* @__PURE__ */ i(
86
+ [r]
87
+ ), P = l || c && typeof a == "string" && a.length > 0 && !C(a, s);
88
+ return /* @__PURE__ */ u(
127
89
  f,
128
90
  {
129
91
  ref: e,
130
92
  type: "text",
131
93
  inputMode: "numeric",
132
- before: o ?? /* @__PURE__ */ i(Y, { name: "calendar", size: 16 }),
94
+ before: o ?? /* @__PURE__ */ u(Y, { name: "calendar", size: 16 }),
133
95
  maxLength: 10,
134
- value: r,
135
- onChange: g,
136
- onBlur: I,
137
- invalid: h,
138
- ...c
96
+ value: a,
97
+ onChange: M,
98
+ onBlur: D,
99
+ invalid: P,
100
+ ...i
139
101
  }
140
102
  );
141
103
  };
142
- M.displayName = m.INPUT_DATE;
143
- const b = (s) => {
144
- const { ref: e, before: t, onBlur: o, invalid: r, ...n } = s, [a, l] = N(!1), c = _(
145
- (d) => {
146
- l(!0), o?.(d);
104
+ g.displayName = m.INPUT_DATE;
105
+ const b = (t) => {
106
+ const { ref: e, before: s, onBlur: o, invalid: a, ...n } = t, [r, l] = I(!1), i = d(
107
+ (p) => {
108
+ l(!0), o?.(p);
147
109
  },
148
110
  [o]
149
- ), u = r || a && n.value != null && !X(n.value);
150
- return /* @__PURE__ */ i(
111
+ ), c = a || r && n.value != null && !L(n.value);
112
+ return /* @__PURE__ */ u(
151
113
  f,
152
114
  {
153
115
  ref: e,
154
116
  type: "email",
155
- before: t ?? /* @__PURE__ */ i(Y, { name: "mail", size: 16 }),
156
- invalid: u,
157
- onBlur: c,
117
+ before: s ?? /* @__PURE__ */ u(Y, { name: "mail", size: 16 }),
118
+ invalid: c,
119
+ onBlur: i,
158
120
  ...n
159
121
  }
160
122
  );
161
123
  };
162
124
  b.displayName = m.INPUT_EMAIL;
163
- const P = (s) => {
164
- const { ref: e, ...t } = s;
165
- return /* @__PURE__ */ i(f, { ref: e, type: "number", inputMode: "numeric", ...t });
125
+ const w = (t) => {
126
+ const { ref: e, ...s } = t;
127
+ return /* @__PURE__ */ u(f, { ref: e, type: "number", inputMode: "numeric", ...s });
166
128
  };
167
- P.displayName = m.INPUT_NUMBER;
168
- const w = (s) => {
169
- const { ref: e, after: t, ...o } = s, r = A(), [n, a] = N(!1), l = _(() => a((c) => !c), []);
170
- return /* @__PURE__ */ i(
129
+ w.displayName = m.INPUT_NUMBER;
130
+ const y = (t) => {
131
+ const { ref: e, after: s, ...o } = t, a = B(), [n, r] = I(!1), l = d(() => r((i) => !i), []);
132
+ return /* @__PURE__ */ u(
171
133
  f,
172
134
  {
173
135
  ref: e,
174
136
  type: n ? "text" : "password",
175
- after: t ?? /* @__PURE__ */ i(
137
+ after: s ?? /* @__PURE__ */ u(
176
138
  "button",
177
139
  {
178
140
  type: "button",
179
- className: p.togglePassword,
141
+ className: S.togglePassword,
180
142
  onClick: l,
181
143
  tabIndex: -1,
182
- "aria-label": n ? r.Input.Password.passwordHide : r.Input.Password.passwordShow,
183
- children: n ? /* @__PURE__ */ i(Y, { name: "eye-off", size: 16 }) : /* @__PURE__ */ i(Y, { name: "eye", size: 16 })
144
+ "aria-label": n ? a.Input.Password.passwordHide : a.Input.Password.passwordShow,
145
+ children: n ? /* @__PURE__ */ u(Y, { name: "eye-off", size: 16 }) : /* @__PURE__ */ u(Y, { name: "eye", size: 16 })
184
146
  }
185
147
  ),
186
148
  ...o
187
149
  }
188
150
  );
189
151
  };
190
- w.displayName = m.INPUT_PASSWORD;
191
- const y = (s) => {
192
- const { ref: e, before: t, onChange: o, ...r } = s, n = _(
193
- (a) => {
194
- const l = V(a);
152
+ y.displayName = m.INPUT_PASSWORD;
153
+ const N = (t) => {
154
+ const { ref: e, before: s, onChange: o, ...a } = t, n = d(
155
+ (r) => {
156
+ const l = E(r);
195
157
  o?.(l);
196
158
  },
197
159
  [o]
198
160
  );
199
- return /* @__PURE__ */ i(f, { ref: e, type: "tel", before: t ?? /* @__PURE__ */ i(Y, { name: "phone", size: 16 }), onChange: n, ...r });
161
+ return /* @__PURE__ */ u(f, { ref: e, type: "tel", before: s ?? /* @__PURE__ */ u(Y, { name: "phone", size: 16 }), onChange: n, ...a });
200
162
  };
201
- y.displayName = m.INPUT_PHONE;
202
- const te = Object.assign(f, {
203
- Date: M,
163
+ N.displayName = m.INPUT_PHONE;
164
+ const j = Object.assign(f, {
165
+ Date: g,
204
166
  Email: b,
205
- Number: P,
206
- Password: w,
207
- Phone: y
167
+ Number: w,
168
+ Password: y,
169
+ Phone: N
208
170
  });
209
171
  export {
210
- te as Input
172
+ j as Input
211
173
  };
@@ -0,0 +1,17 @@
1
+ import { isValidElement as y } from "react";
2
+ const c = (t) => t.type ? typeof t.type == "string" ? t.type : "displayName" in t.type ? t.type.displayName : t.type.name : "", r = (t, i) => t === i, n = (t, i, o = !0) => {
3
+ const s = Array.isArray(t);
4
+ let a = !1;
5
+ if (y(i)) {
6
+ const e = c(i);
7
+ s ? a = t.some((p) => r(p, e)) : a = r(t, e);
8
+ }
9
+ if (!a && o) {
10
+ let e = t;
11
+ s && (e = t.join(", ")), console.warn("Invalid React node. Node should be an instance of %s", e);
12
+ }
13
+ return a;
14
+ };
15
+ export {
16
+ n as i
17
+ };
package/dist/item.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { default as default_2 } from 'react';
2
+
3
+ export declare interface IItemProps extends TNativeInputProps, default_2.PropsWithChildren {
4
+ /** The value of the radio button. Required for group integration. */
5
+ value: string;
6
+ /** Description text displayed below the option label. */
7
+ description?: default_2.ReactNode;
8
+ /** Ref to the native input element. */
9
+ ref?: default_2.Ref<HTMLInputElement>;
10
+ }
11
+
12
+ export declare const Item: default_2.FC<IItemProps>;
13
+
14
+ declare type TNativeInputProps = Omit<default_2.InputHTMLAttributes<HTMLInputElement>, 'type' | 'name' | 'checked' | 'size' | 'className'>;
15
+
16
+ export { }
package/dist/item.js ADDED
@@ -0,0 +1,4 @@
1
+ import { I as o } from "./Item-JbyvZy05.mjs";
2
+ export {
3
+ o as Item
4
+ };
package/dist/menu.css CHANGED
@@ -1 +1 @@
1
- ._root_15rud_1{align-items:center;border-radius:var(--dropdown-item-radius);cursor:pointer;display:flex;font-size:var(--dropdown-item-font-size);gap:var(--dropdown-item-gap);outline:none;padding:var(--dropdown-item-padding-y) var(--dropdown-item-padding-x);transition:background-color .1s ease;-webkit-user-select:none;user-select:none}._root_15rud_1:hover{background:var(--lui-color-background-secondary)}._root_15rud_1:focus-visible{background:var(--lui-color-background-secondary)}._root_15rud_1._disabled_15rud_19{color:var(--lui-color-text-disabled);cursor:not-allowed}._root_15rud_1._disabled_15rud_19:hover{background:transparent}._checkbox_15rud_27{align-items:center;border:1.5px solid var(--lui-color-border-primary);border-radius:var(--lui-radius-1);display:inline-flex;flex-shrink:0;height:16px;justify-content:center;transition:all .1s ease;width:16px}._checkbox_15rud_27._checked_15rud_38{background:var(--lui-color-background-brand);border-color:var(--lui-color-background-brand);color:var(--lui-color-text-on-brand)}._label_15rud_44{flex:1;overflow:hidden;text-overflow:ellipsis}:root{--dropdown-min-width: 160px;--dropdown-item-padding-x: var(--lui-space-3);--dropdown-item-padding-y: var(--lui-space-2);--dropdown-item-gap: var(--lui-space-2);--dropdown-item-radius: var(--lui-radius-1);--dropdown-item-font-size: var(--lui-font-size-sm);--dropdown-item-icon-size: 16px;--dropdown-separator-margin: var(--lui-space-1) var(--lui-space-2);--dropdown-group-label-padding: var(--lui-space-2) var(--lui-space-3);--dropdown-group-label-font-size: var(--lui-font-size-xs)}._root_1h0xj_14{min-width:var(--dropdown-min-width);padding:var(--lui-space-1)}._root_dtqrm_1{padding-bottom:var(--lui-space-1);padding-top:var(--lui-space-1)}._root_dtqrm_1+._root_dtqrm_1{border-top:1px solid var(--lui-color-border-primary)}._label_dtqrm_9{color:var(--lui-color-text-tertiary);font-size:var(--dropdown-group-label-font-size);font-weight:var(--lui-font-weight-medium);padding:var(--dropdown-group-label-padding);text-transform:uppercase}._root_5s7ps_1{align-items:center;border-radius:var(--dropdown-item-radius);cursor:pointer;display:flex;font-size:var(--dropdown-item-font-size);gap:var(--dropdown-item-gap);outline:none;padding:var(--dropdown-item-padding-y) var(--dropdown-item-padding-x);transition:background-color .1s ease;-webkit-user-select:none;user-select:none}._root_5s7ps_1:hover{background:var(--lui-color-background-secondary)}._root_5s7ps_1:focus-visible{background:var(--lui-color-background-secondary)}._root_5s7ps_1._disabled_5s7ps_19{color:var(--lui-color-text-disabled);cursor:not-allowed}._root_5s7ps_1._disabled_5s7ps_19:hover{background:transparent}._root_5s7ps_1._danger_5s7ps_26{color:var(--lui-color-background-error)}._root_5s7ps_1._danger_5s7ps_26:hover{background:color-mix(in sRGB,var(--lui-color-background-error) 8%,transparent)}._icon_5s7ps_33{align-items:center;color:var(--lui-color-text-tertiary);display:inline-flex;flex-shrink:0;height:var(--dropdown-item-icon-size);justify-content:center;width:var(--dropdown-item-icon-size)}._label_5s7ps_43{flex:1;overflow:hidden;text-overflow:ellipsis}._root_16pgq_1{background:var(--lui-color-border-primary);border:none;height:1px;margin:var(--dropdown-separator-margin)}
1
+ ._root_5s7ps_1{align-items:center;border-radius:var(--dropdown-item-radius);cursor:pointer;display:flex;font-size:var(--dropdown-item-font-size);gap:var(--dropdown-item-gap);outline:none;padding:var(--dropdown-item-padding-y) var(--dropdown-item-padding-x);transition:background-color .1s ease;-webkit-user-select:none;user-select:none}._root_5s7ps_1:hover{background:var(--lui-color-background-secondary)}._root_5s7ps_1:focus-visible{background:var(--lui-color-background-secondary)}._root_5s7ps_1._disabled_5s7ps_19{color:var(--lui-color-text-disabled);cursor:not-allowed}._root_5s7ps_1._disabled_5s7ps_19:hover{background:transparent}._root_5s7ps_1._danger_5s7ps_26{color:var(--lui-color-background-error)}._root_5s7ps_1._danger_5s7ps_26:hover{background:color-mix(in sRGB,var(--lui-color-background-error) 8%,transparent)}._icon_5s7ps_33{align-items:center;color:var(--lui-color-text-tertiary);display:inline-flex;flex-shrink:0;height:var(--dropdown-item-icon-size);justify-content:center;width:var(--dropdown-item-icon-size)}._label_5s7ps_43{flex:1;overflow:hidden;text-overflow:ellipsis}._root_16pgq_1{background:var(--lui-color-border-primary);border:none;height:1px;margin:var(--dropdown-separator-margin)}
package/dist/menu.js CHANGED
@@ -1,117 +1,60 @@
1
- import { jsxs as h, jsx as t } from "react/jsx-runtime";
2
- import p from "clsx";
3
- import { I as u } from "./Icon-DUCBChX2.mjs";
4
- import { usePopoverContext as N, Popover as k } from "./popover.js";
5
- import O from "react";
6
- import { i as y } from "./isValidReactNode-CmYwTWCE.mjs";
7
- import './menu.css';const g = () => {
8
- const { state: e } = N();
9
- return {
10
- close: () => {
11
- e.close();
12
- }
13
- };
14
- }, c = "Menu", A = "bottom start";
15
- var r = ((e) => (e.CHECKBOX = `${c}.Checkbox`, e.CONTENT = `${c}.Content`, e.GROUP = `${c}.Group`, e.ITEM = `${c}.Item`, e.SEPARATOR = `${c}.Separator`, e.TRIGGER = `${c}.Trigger`, e))(r || {});
16
- const G = "_root_15rud_1", P = "_disabled_15rud_19", M = "_checkbox_15rud_27", v = "_checked_15rud_38", B = "_label_15rud_44", _ = {
17
- root: G,
18
- disabled: P,
19
- checkbox: M,
20
- checked: v,
21
- label: B
22
- }, T = (e) => {
23
- const { checked: o, children: n, disabled: s = !1, onCheckedChange: a } = e, { close: l } = g(), d = p(
24
- _.root,
25
- s && _.disabled
26
- );
27
- return /* @__PURE__ */ h(
28
- "div",
29
- {
30
- "aria-checked": o,
31
- "aria-disabled": s,
32
- className: d,
33
- onClick: () => {
34
- s || (a && a(!o), l());
35
- },
36
- role: "menuitemcheckbox",
37
- tabIndex: s ? -1 : 0,
38
- children: [
39
- /* @__PURE__ */ t("span", { className: p(_.checkbox, o && _.checked), children: o && /* @__PURE__ */ t(u, { name: "check", size: 12, strokeWidth: 3 }) }),
40
- /* @__PURE__ */ t("span", { className: _.label, children: n })
41
- ]
42
- }
43
- );
44
- };
45
- T.displayName = r.CHECKBOX;
46
- const L = "_root_1h0xj_14", U = {
47
- root: L
48
- }, x = (e) => {
49
- const { children: o } = e;
50
- return /* @__PURE__ */ t(k.Content, { padding: !1, children: /* @__PURE__ */ t("div", { className: U.root, children: o }) });
1
+ import { u, C as f } from "./Checkbox-Chfzm1Z9.mjs";
2
+ import { C as N } from "./Content-ru2X8iBx.mjs";
3
+ import { jsx as s, jsxs as b } from "react/jsx-runtime";
4
+ import E from "react";
5
+ import { Popover as h } from "./popover.js";
6
+ import { i as T } from "./isValidReactNode-D1buElhX.mjs";
7
+ import { E as i, D as g, a as A } from "./enums-DUZMBQDd.mjs";
8
+ import { G as x } from "./Group-DyDpeqOP.mjs";
9
+ import I from "clsx";
10
+ import { I as M } from "./Icon-DUCBChX2.mjs";
11
+ import { T as P } from "./Trigger-C_4De6l1.mjs";
12
+ import './menu.css';const S = [i.TRIGGER, i.CONTENT], p = (c) => {
13
+ const { children: l, open: m, onOpenChange: o, placement: r = g } = c, t = (a) => T(S, a) ? a : null;
14
+ return /* @__PURE__ */ s(h, { open: m, onOpenChange: o, placement: r, children: E.Children.map(l, t) });
51
15
  };
52
- x.displayName = r.CONTENT;
53
- const j = [r.TRIGGER, r.CONTENT], f = (e) => {
54
- const { children: o, open: n, onOpenChange: s, placement: a = A } = e, l = (d) => y(j, d) ? d : null;
55
- return /* @__PURE__ */ t(k, { open: n, onOpenChange: s, placement: a, children: O.Children.map(o, l) });
56
- };
57
- f.displayName = c;
58
- const q = "_root_dtqrm_1", S = "_label_dtqrm_9", b = {
59
- root: q,
60
- label: S
61
- }, $ = (e) => {
62
- const { children: o, label: n } = e;
63
- return /* @__PURE__ */ h("div", { className: b.root, role: "group", children: [
64
- /* @__PURE__ */ t("div", { className: b.label, children: n }),
65
- o
66
- ] });
67
- };
68
- $.displayName = r.GROUP;
69
- const z = "_root_5s7ps_1", D = "_disabled_5s7ps_19", H = "_danger_5s7ps_26", K = "_icon_5s7ps_33", X = "_label_5s7ps_43", m = {
70
- root: z,
71
- disabled: D,
72
- danger: H,
73
- icon: K,
74
- label: X
75
- }, R = (e) => {
76
- const { children: o, danger: n = !1, disabled: s = !1, icon: a, onAction: l } = e, { close: d } = g(), C = p(
77
- m.root,
78
- n && m.danger,
79
- s && m.disabled
16
+ p.displayName = A;
17
+ const R = "_root_5s7ps_1", k = "_disabled_5s7ps_19", y = "_danger_5s7ps_26", G = "_icon_5s7ps_33", O = "_label_5s7ps_43", n = {
18
+ root: R,
19
+ disabled: k,
20
+ danger: y,
21
+ icon: G,
22
+ label: O
23
+ }, d = (c) => {
24
+ const { children: l, danger: m = !1, disabled: o = !1, icon: r, onAction: t } = c, { close: a } = u(), _ = I(
25
+ n.root,
26
+ m && n.danger,
27
+ o && n.disabled
80
28
  );
81
- return /* @__PURE__ */ h(
29
+ return /* @__PURE__ */ b(
82
30
  "div",
83
31
  {
84
- "aria-disabled": s,
85
- className: C,
32
+ "aria-disabled": o,
33
+ className: _,
86
34
  onClick: () => {
87
- s || (l && l(), d());
35
+ o || (t && t(), a());
88
36
  },
89
37
  role: "menuitem",
90
- tabIndex: s ? -1 : 0,
38
+ tabIndex: o ? -1 : 0,
91
39
  children: [
92
- a && /* @__PURE__ */ t("span", { className: m.icon, children: /* @__PURE__ */ t(u, { name: a, size: 16 }) }),
93
- /* @__PURE__ */ t("span", { className: m.label, children: o })
40
+ r && /* @__PURE__ */ s("span", { className: n.icon, children: /* @__PURE__ */ s(M, { name: r, size: 16 }) }),
41
+ /* @__PURE__ */ s("span", { className: n.label, children: l })
94
42
  ]
95
43
  }
96
44
  );
97
45
  };
98
- R.displayName = r.ITEM;
99
- const F = "_root_16pgq_1", V = {
100
- root: F
101
- }, E = () => /* @__PURE__ */ t("hr", { className: V.root });
102
- E.displayName = r.SEPARATOR;
103
- const I = (e) => {
104
- const { children: o } = e, { triggerRef: n, state: s } = N();
105
- return /* @__PURE__ */ t("span", { "aria-expanded": s.isOpen, "aria-haspopup": "true", onClick: () => s.toggle(), ref: n, children: o });
106
- };
107
- I.displayName = r.TRIGGER;
108
- const i = f;
109
- i.Checkbox = T;
110
- i.Content = x;
111
- i.Group = $;
112
- i.Item = R;
113
- i.Separator = E;
114
- i.Trigger = I;
46
+ d.displayName = i.ITEM;
47
+ const L = "_root_16pgq_1", v = {
48
+ root: L
49
+ }, C = () => /* @__PURE__ */ s("hr", { className: v.root });
50
+ C.displayName = i.SEPARATOR;
51
+ const e = p;
52
+ e.Checkbox = f;
53
+ e.Content = N;
54
+ e.Group = x;
55
+ e.Item = d;
56
+ e.Separator = C;
57
+ e.Trigger = P;
115
58
  export {
116
- i as Menu
59
+ e as Menu
117
60
  };
@@ -1,75 +1,63 @@
1
- import { jsx as c, jsxs as N } from "react/jsx-runtime";
2
- import { createContext as L, useContext as S, useMemo as y, useCallback as R } from "react";
3
- import f from "clsx";
4
- import { u as v } from "./useLocale-CJh-krrY.mjs";
5
- import { g as C } from "./getVariantClassName-DoCNtwBw.mjs";
6
- import { I as z } from "./Icon-DUCBChX2.mjs";
7
- import './pagination.css';const P = L(null), I = P.Provider, w = () => {
8
- const n = S(P);
9
- if (!n)
1
+ import { jsx as n, jsxs as N } from "react/jsx-runtime";
2
+ import { createContext as L, useContext as y, useMemo as M, useCallback as S } from "react";
3
+ import v from "clsx";
4
+ import { u as P } from "./useLocale-CJh-krrY.mjs";
5
+ import { g as h } from "./getVariantClassName-DoCNtwBw.mjs";
6
+ import { I as x } from "./Icon-DUCBChX2.mjs";
7
+ import { getPageRange as I } from "./utils.js";
8
+ import './pagination.css';const f = L(null), $ = f.Provider, w = () => {
9
+ const a = y(f);
10
+ if (!a)
10
11
  throw new Error("Pagination sub-component must be used within a Pagination");
11
- return n;
12
- }, $ = "_button_nl5gc_14", E = "_active_nl5gc_40", A = "_prevNext_nl5gc_44", j = "_sizeSm_nl5gc_49", k = "_sizeMd_nl5gc_55", B = "_sizeLg_nl5gc_61", _ = {
13
- button: $,
14
- active: E,
12
+ return a;
13
+ }, j = "_button_nl5gc_14", k = "_active_nl5gc_40", A = "_prevNext_nl5gc_44", D = "_sizeSm_nl5gc_49", E = "_sizeMd_nl5gc_55", R = "_sizeLg_nl5gc_61", d = {
14
+ button: j,
15
+ active: k,
15
16
  prevNext: A,
16
- sizeSm: j,
17
- sizeMd: k,
18
- sizeLg: B
19
- }, x = (n) => {
20
- const { page: e, type: a = "page", children: t } = n, { currentPage: l, totalPages: r, disabled: s, onChange: p, size: u } = w(), i = v(), g = e === l, o = s || e < 1 || e > r || g;
21
- let d, m;
22
- a === "prev" ? (d = i.Pagination.prev, m = t ?? /* @__PURE__ */ c(z, { name: "chevron-left", size: 14 })) : a === "next" ? (d = i.Pagination.next, m = t ?? /* @__PURE__ */ c(z, { name: "chevron-right", size: 14 })) : (d = i.Pagination.Item.page.replace("{page}", String(e)), m = t ?? e);
23
- const M = f(_.button, C("size", u, _), {
24
- [_.active]: g,
25
- [_.prevNext]: a !== "page"
17
+ sizeSm: D,
18
+ sizeMd: E,
19
+ sizeLg: R
20
+ }, b = (a) => {
21
+ const { page: e, type: i = "page", children: t } = a, { currentPage: g, totalPages: p, disabled: o, onChange: u, size: z } = w(), l = P(), c = e === g, s = o || e < 1 || e > p || c;
22
+ let r, _;
23
+ i === "prev" ? (r = l.Pagination.prev, _ = t ?? /* @__PURE__ */ n(x, { name: "chevron-left", size: 14 })) : i === "next" ? (r = l.Pagination.next, _ = t ?? /* @__PURE__ */ n(x, { name: "chevron-right", size: 14 })) : (r = l.Pagination.Item.page.replace("{page}", String(e)), _ = t ?? e);
24
+ const C = v(d.button, h("size", z, d), {
25
+ [d.active]: c,
26
+ [d.prevNext]: i !== "page"
26
27
  });
27
- return /* @__PURE__ */ c(
28
+ return /* @__PURE__ */ n(
28
29
  "button",
29
30
  {
30
- "aria-current": g ? "page" : void 0,
31
- "aria-label": d,
32
- className: M,
33
- disabled: o,
34
- onClick: () => p(e),
31
+ "aria-current": c ? "page" : void 0,
32
+ "aria-label": r,
33
+ className: C,
34
+ disabled: s,
35
+ onClick: () => u(e),
35
36
  type: "button",
36
- children: m
37
+ children: _
37
38
  }
38
39
  );
39
- }, D = "Pagination", b = (n, e) => Array.from({ length: e - n + 1 }, (a, t) => n + t), V = (n, e) => {
40
- if (e <= 7)
41
- return b(1, e);
42
- const l = Math.max(n - 1, 1), r = Math.min(n + 1, e), s = l > 2, p = r < e - 1;
43
- if (!s && p) {
44
- const i = Math.min(r + 1, e);
45
- return [...b(1, i), "ellipsis", e];
46
- }
47
- if (s && !p) {
48
- const i = Math.max(l - 1, 1);
49
- return [1, "ellipsis", ...b(i, e)];
50
- }
51
- return [1, "ellipsis", ...b(l, r), "ellipsis", e];
52
- }, Y = "_root_60eox_6", q = "_disabled_60eox_13", F = "_ellipsis_60eox_18", G = "_sizeSm_60eox_27", H = "_sizeMd_60eox_33", J = "_sizeLg_60eox_39", h = {
40
+ }, V = "Pagination", Y = "_root_60eox_6", q = "_disabled_60eox_13", B = "_ellipsis_60eox_18", F = "_sizeSm_60eox_27", G = "_sizeMd_60eox_33", H = "_sizeLg_60eox_39", m = {
53
41
  root: Y,
54
42
  disabled: q,
55
- ellipsis: F,
56
- sizeSm: G,
57
- sizeMd: H,
58
- sizeLg: J
59
- }, K = (n) => {
60
- const { disabled: e = !1, onChange: a, page: t, showPrevNext: l = !0, size: r = "md", totalPages: s } = n, p = v(), u = y(() => V(t, s), [t, s]), i = R(
61
- (o) => {
62
- e || o < 1 || o > s || a?.(o);
43
+ ellipsis: B,
44
+ sizeSm: F,
45
+ sizeMd: G,
46
+ sizeLg: H
47
+ }, J = (a) => {
48
+ const { disabled: e = !1, onChange: i, page: t, showPrevNext: g = !0, size: p = "md", totalPages: o } = a, u = P(), z = M(() => I(t, o), [t, o]), l = S(
49
+ (s) => {
50
+ e || s < 1 || s > o || i?.(s);
63
51
  },
64
- [e, a, s]
65
- ), g = f(h.root, C("size", r, h), { [h.disabled]: e });
66
- return /* @__PURE__ */ c(I, { value: { currentPage: t, disabled: e, onChange: i, size: r, totalPages: s }, children: /* @__PURE__ */ N("nav", { "aria-label": p.Pagination.label, className: g, children: [
67
- l && /* @__PURE__ */ c(x, { page: t - 1, type: "prev" }),
68
- u.map((o, d) => o === "ellipsis" ? /* @__PURE__ */ c("span", { "aria-hidden": "true", className: h.ellipsis, children: "…" }, `ellipsis-${d}`) : /* @__PURE__ */ c(x, { page: o, type: "page" }, o)),
69
- l && /* @__PURE__ */ c(x, { page: t + 1, type: "next" })
52
+ [e, i, o]
53
+ ), c = v(m.root, h("size", p, m), { [m.disabled]: e });
54
+ return /* @__PURE__ */ n($, { value: { currentPage: t, disabled: e, onChange: l, size: p, totalPages: o }, children: /* @__PURE__ */ N("nav", { "aria-label": u.Pagination.label, className: c, children: [
55
+ g && /* @__PURE__ */ n(b, { page: t - 1, type: "prev" }),
56
+ z.map((s, r) => s === "ellipsis" ? /* @__PURE__ */ n("span", { "aria-hidden": "true", className: m.ellipsis, children: "…" }, `ellipsis-${r}`) : /* @__PURE__ */ n(b, { page: s, type: "page" }, s)),
57
+ g && /* @__PURE__ */ n(b, { page: t + 1, type: "next" })
70
58
  ] }) });
71
59
  };
72
- K.displayName = D;
60
+ J.displayName = V;
73
61
  export {
74
- K as Pagination
62
+ J as Pagination
75
63
  };