@lazar-ui/kit 0.6.1 → 0.7.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.
- package/CHANGELOG.md +32 -0
- package/dist/accordion.css +1 -1
- package/dist/accordion.js +62 -23
- package/dist/dialog.css +1 -1
- package/dist/dialog.js +62 -44
- package/dist/drawer.css +1 -1
- package/dist/drawer.js +93 -72
- package/dist/heading.js +31 -5
- package/dist/input.js +124 -86
- package/dist/menu.css +1 -1
- package/dist/menu.js +81 -63
- package/dist/select.d.ts +45 -3
- package/dist/select.js +103 -81
- package/dist/separator.css +1 -0
- package/dist/separator.d.ts +21 -1
- package/dist/separator.js +22 -2
- package/dist/slider.css +1 -0
- package/dist/slider.d.ts +50 -0
- package/dist/slider.js +72 -0
- package/dist/table.css +1 -1
- package/dist/table.d.ts +4 -0
- package/dist/table.js +74 -25
- package/dist/tabs.css +1 -1
- package/dist/tabs.js +73 -34
- package/dist/text.d.ts +15 -15
- package/dist/text.js +48 -6
- package/dist/utils.d.ts +4 -4
- package/package.json +1 -1
- package/dist/Actions-Cii4AnwJ.mjs +0 -12
- package/dist/Actions.css +0 -1
- package/dist/ActiveFilters-BJojmc-d.mjs +0 -29
- package/dist/ActiveFilters.css +0 -1
- package/dist/Cell-BPBvEyeL.mjs +0 -21
- package/dist/Cell.css +0 -1
- package/dist/Content-1kg0isb_.mjs +0 -12
- package/dist/Content.css +0 -1
- package/dist/Context-BjkJbHVo.mjs +0 -6
- package/dist/Group-DyDpeqOP.mjs +0 -16
- package/dist/Group.css +0 -1
- package/dist/Header-Clhgyr0J.mjs +0 -29
- package/dist/Header.css +0 -1
- package/dist/Heading-CL47Fqe7.mjs +0 -30
- package/dist/InputBase-BHZWQT9-.mjs +0 -46
- package/dist/Item-CBYGbEHN.mjs +0 -47
- package/dist/Item.css +0 -1
- package/dist/Panel-B-LZtrGB.mjs +0 -11
- package/dist/Row-BfI8268z.mjs +0 -15
- package/dist/Row.css +0 -1
- package/dist/Separator-FETQ3gHZ.mjs +0 -9
- package/dist/Separator.css +0 -1
- package/dist/Tab-BfpR10OT.mjs +0 -38
- package/dist/Tab.css +0 -1
- package/dist/Text-DQPy-DZ5.mjs +0 -46
- package/dist/Title-xHMuJWGl.mjs +0 -12
- package/dist/Title.css +0 -1
- package/dist/Toolbar-BJQy4qFI.mjs +0 -11
- package/dist/Toolbar.css +0 -1
- package/dist/Trigger-C_4De6l1.mjs +0 -11
- package/dist/actions.d.ts +0 -13
- package/dist/actions.js +0 -4
- package/dist/active-filters.d.ts +0 -35
- package/dist/active-filters.js +0 -4
- package/dist/cell.d.ts +0 -20
- package/dist/cell.js +0 -4
- package/dist/content.d.ts +0 -8
- package/dist/content.js +0 -4
- package/dist/context.d.ts +0 -17
- package/dist/context.js +0 -5
- package/dist/enums-BnuDYTua.mjs +0 -4
- package/dist/enums-DUZMBQDd.mjs +0 -7
- package/dist/enums-DfSzOa3x.mjs +0 -4
- package/dist/enums-OoI2Qgqq.mjs +0 -14
- package/dist/group.d.ts +0 -12
- package/dist/group.js +0 -4
- package/dist/header.d.ts +0 -21
- package/dist/header.js +0 -4
- package/dist/input-base.d.ts +0 -29
- package/dist/input-base.js +0 -4
- package/dist/item.d.ts +0 -42
- package/dist/item.js +0 -4
- package/dist/panel.d.ts +0 -9
- package/dist/panel.js +0 -4
- package/dist/row.d.ts +0 -12
- package/dist/row.js +0 -4
- package/dist/tab.d.ts +0 -30
- package/dist/tab.js +0 -4
- package/dist/title.d.ts +0 -8
- package/dist/title.js +0 -4
- package/dist/toolbar.d.ts +0 -20
- package/dist/toolbar.js +0 -4
- package/dist/trigger.d.ts +0 -8
- package/dist/trigger.js +0 -4
- package/dist/typography.d.ts +0 -126
- package/dist/typography.js +0 -6
- /package/dist/{Heading.css → heading.css} +0 -0
- /package/dist/{InputBase.css → input.css} +0 -0
- /package/dist/{Text.css → text.css} +0 -0
package/dist/input.js
CHANGED
|
@@ -1,21 +1,59 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { useState as
|
|
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";
|
|
4
5
|
import { I as Y } from "./Icon-DUCBChX2.mjs";
|
|
5
|
-
import { u as
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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)
|
|
10
48
|
return "";
|
|
11
|
-
const o = e.replace(/[A-Z]/g, "").charAt(0),
|
|
49
|
+
const o = e.replace(/[A-Z]/g, "").charAt(0), r = F(e);
|
|
12
50
|
let n = "";
|
|
13
|
-
for (let
|
|
14
|
-
|
|
51
|
+
for (let a = 0; a < t.length; a++)
|
|
52
|
+
r.has(a) && (n += o), n += t[a];
|
|
15
53
|
return n;
|
|
16
54
|
}
|
|
17
|
-
function
|
|
18
|
-
switch (
|
|
55
|
+
function F(s) {
|
|
56
|
+
switch (s) {
|
|
19
57
|
case "DD/MM/YYYY":
|
|
20
58
|
case "MM/DD/YYYY":
|
|
21
59
|
case "DD.MM.YYYY":
|
|
@@ -27,147 +65,147 @@ function v(t) {
|
|
|
27
65
|
return /* @__PURE__ */ new Set([2, 4]);
|
|
28
66
|
}
|
|
29
67
|
}
|
|
30
|
-
function
|
|
31
|
-
const e =
|
|
68
|
+
function V(s) {
|
|
69
|
+
const e = s.replace(/\D/g, "").slice(0, 11);
|
|
32
70
|
if (!e)
|
|
33
71
|
return "";
|
|
34
|
-
let
|
|
35
|
-
return e.length > 1 && (
|
|
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;
|
|
36
74
|
}
|
|
37
|
-
const
|
|
38
|
-
function
|
|
75
|
+
const W = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
76
|
+
function Z(s, e) {
|
|
39
77
|
const o = e.replace(/[A-Z]/g, "").charAt(0);
|
|
40
78
|
if (!o)
|
|
41
79
|
return !1;
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
80
|
+
const r = s.split(o);
|
|
81
|
+
if (r.length !== 3)
|
|
44
82
|
return !1;
|
|
45
|
-
const [n,
|
|
46
|
-
if (!n || !
|
|
83
|
+
const [n, a, l] = r;
|
|
84
|
+
if (!n || !a || !l)
|
|
47
85
|
return !1;
|
|
48
|
-
let
|
|
86
|
+
let c = 0, u = 0, d = 0;
|
|
49
87
|
switch (e) {
|
|
50
88
|
case "DD/MM/YYYY":
|
|
51
89
|
case "DD.MM.YYYY":
|
|
52
|
-
|
|
90
|
+
c = parseInt(n, 10), u = parseInt(a, 10), d = parseInt(l, 10);
|
|
53
91
|
break;
|
|
54
92
|
case "MM/DD/YYYY":
|
|
55
93
|
case "MM.DD.YYYY":
|
|
56
|
-
|
|
94
|
+
u = parseInt(n, 10), c = parseInt(a, 10), d = parseInt(l, 10);
|
|
57
95
|
break;
|
|
58
96
|
case "YYYY-MM-DD":
|
|
59
|
-
|
|
97
|
+
c = parseInt(l, 10), u = parseInt(a, 10), d = parseInt(n, 10);
|
|
60
98
|
break;
|
|
61
99
|
default:
|
|
62
100
|
return !1;
|
|
63
101
|
}
|
|
64
|
-
if (
|
|
102
|
+
if (u < 1 || u > 12 || d < 1)
|
|
65
103
|
return !1;
|
|
66
|
-
const
|
|
67
|
-
return
|
|
104
|
+
const I = u === 2 && G(d) ? 29 : W[u] ?? 0;
|
|
105
|
+
return c >= 1 && c <= I;
|
|
68
106
|
}
|
|
69
|
-
function
|
|
70
|
-
return
|
|
107
|
+
function G(s) {
|
|
108
|
+
return s % 4 === 0 && s % 100 !== 0 || s % 400 === 0;
|
|
71
109
|
}
|
|
72
|
-
function
|
|
73
|
-
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(
|
|
110
|
+
function X(s) {
|
|
111
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s);
|
|
74
112
|
}
|
|
75
|
-
const
|
|
76
|
-
const { ref: e, format:
|
|
77
|
-
(
|
|
78
|
-
const
|
|
79
|
-
n?.(
|
|
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);
|
|
80
118
|
},
|
|
81
|
-
[
|
|
82
|
-
),
|
|
83
|
-
(
|
|
84
|
-
|
|
119
|
+
[t, n]
|
|
120
|
+
), I = _(
|
|
121
|
+
(D) => {
|
|
122
|
+
d(!0), a?.(D);
|
|
85
123
|
},
|
|
86
|
-
[
|
|
87
|
-
),
|
|
88
|
-
return /* @__PURE__ */
|
|
124
|
+
[a]
|
|
125
|
+
), h = l || u && typeof r == "string" && r.length > 0 && !Z(r, t);
|
|
126
|
+
return /* @__PURE__ */ i(
|
|
89
127
|
f,
|
|
90
128
|
{
|
|
91
129
|
ref: e,
|
|
92
130
|
type: "text",
|
|
93
131
|
inputMode: "numeric",
|
|
94
|
-
before: o ?? /* @__PURE__ */
|
|
132
|
+
before: o ?? /* @__PURE__ */ i(Y, { name: "calendar", size: 16 }),
|
|
95
133
|
maxLength: 10,
|
|
96
|
-
value:
|
|
97
|
-
onChange:
|
|
98
|
-
onBlur:
|
|
99
|
-
invalid:
|
|
100
|
-
...
|
|
134
|
+
value: r,
|
|
135
|
+
onChange: g,
|
|
136
|
+
onBlur: I,
|
|
137
|
+
invalid: h,
|
|
138
|
+
...c
|
|
101
139
|
}
|
|
102
140
|
);
|
|
103
141
|
};
|
|
104
|
-
|
|
105
|
-
const b = (
|
|
106
|
-
const { ref: e, before:
|
|
107
|
-
(
|
|
108
|
-
l(!0), o?.(
|
|
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);
|
|
109
147
|
},
|
|
110
148
|
[o]
|
|
111
|
-
),
|
|
112
|
-
return /* @__PURE__ */
|
|
149
|
+
), u = r || a && n.value != null && !X(n.value);
|
|
150
|
+
return /* @__PURE__ */ i(
|
|
113
151
|
f,
|
|
114
152
|
{
|
|
115
153
|
ref: e,
|
|
116
154
|
type: "email",
|
|
117
|
-
before:
|
|
118
|
-
invalid:
|
|
119
|
-
onBlur:
|
|
155
|
+
before: t ?? /* @__PURE__ */ i(Y, { name: "mail", size: 16 }),
|
|
156
|
+
invalid: u,
|
|
157
|
+
onBlur: c,
|
|
120
158
|
...n
|
|
121
159
|
}
|
|
122
160
|
);
|
|
123
161
|
};
|
|
124
162
|
b.displayName = m.INPUT_EMAIL;
|
|
125
|
-
const
|
|
126
|
-
const { ref: e, ...
|
|
127
|
-
return /* @__PURE__ */
|
|
163
|
+
const P = (s) => {
|
|
164
|
+
const { ref: e, ...t } = s;
|
|
165
|
+
return /* @__PURE__ */ i(f, { ref: e, type: "number", inputMode: "numeric", ...t });
|
|
128
166
|
};
|
|
129
|
-
|
|
130
|
-
const
|
|
131
|
-
const { ref: e, after:
|
|
132
|
-
return /* @__PURE__ */
|
|
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(
|
|
133
171
|
f,
|
|
134
172
|
{
|
|
135
173
|
ref: e,
|
|
136
174
|
type: n ? "text" : "password",
|
|
137
|
-
after:
|
|
175
|
+
after: t ?? /* @__PURE__ */ i(
|
|
138
176
|
"button",
|
|
139
177
|
{
|
|
140
178
|
type: "button",
|
|
141
|
-
className:
|
|
179
|
+
className: p.togglePassword,
|
|
142
180
|
onClick: l,
|
|
143
181
|
tabIndex: -1,
|
|
144
|
-
"aria-label": n ?
|
|
145
|
-
children: n ? /* @__PURE__ */
|
|
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 })
|
|
146
184
|
}
|
|
147
185
|
),
|
|
148
186
|
...o
|
|
149
187
|
}
|
|
150
188
|
);
|
|
151
189
|
};
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
const { ref: e, before:
|
|
155
|
-
(
|
|
156
|
-
const l =
|
|
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);
|
|
157
195
|
o?.(l);
|
|
158
196
|
},
|
|
159
197
|
[o]
|
|
160
198
|
);
|
|
161
|
-
return /* @__PURE__ */
|
|
199
|
+
return /* @__PURE__ */ i(f, { ref: e, type: "tel", before: t ?? /* @__PURE__ */ i(Y, { name: "phone", size: 16 }), onChange: n, ...r });
|
|
162
200
|
};
|
|
163
|
-
|
|
164
|
-
const
|
|
165
|
-
Date:
|
|
201
|
+
y.displayName = m.INPUT_PHONE;
|
|
202
|
+
const te = Object.assign(f, {
|
|
203
|
+
Date: M,
|
|
166
204
|
Email: b,
|
|
167
|
-
Number:
|
|
168
|
-
Password:
|
|
169
|
-
Phone:
|
|
205
|
+
Number: P,
|
|
206
|
+
Password: w,
|
|
207
|
+
Phone: y
|
|
170
208
|
});
|
|
171
209
|
export {
|
|
172
|
-
|
|
210
|
+
te as Input
|
|
173
211
|
};
|
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_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}
|
|
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)}
|
package/dist/menu.js
CHANGED
|
@@ -1,99 +1,117 @@
|
|
|
1
|
-
import { jsxs as h, jsx as
|
|
1
|
+
import { jsxs as h, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import p from "clsx";
|
|
3
|
-
import { I as
|
|
4
|
-
import { usePopoverContext as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
import { S as A } from "./Separator-FETQ3gHZ.mjs";
|
|
10
|
-
import { T as P } from "./Trigger-C_4De6l1.mjs";
|
|
11
|
-
import './menu.css';const u = () => {
|
|
12
|
-
const { state: s } = E();
|
|
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();
|
|
13
9
|
return {
|
|
14
10
|
close: () => {
|
|
15
|
-
|
|
11
|
+
e.close();
|
|
16
12
|
}
|
|
17
13
|
};
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
|
28
26
|
);
|
|
29
27
|
return /* @__PURE__ */ h(
|
|
30
28
|
"div",
|
|
31
29
|
{
|
|
32
30
|
"aria-checked": o,
|
|
33
|
-
"aria-disabled":
|
|
34
|
-
className:
|
|
31
|
+
"aria-disabled": s,
|
|
32
|
+
className: d,
|
|
35
33
|
onClick: () => {
|
|
36
|
-
|
|
34
|
+
s || (a && a(!o), l());
|
|
37
35
|
},
|
|
38
36
|
role: "menuitemcheckbox",
|
|
39
|
-
tabIndex:
|
|
37
|
+
tabIndex: s ? -1 : 0,
|
|
40
38
|
children: [
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
/* @__PURE__ */
|
|
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 })
|
|
43
41
|
]
|
|
44
42
|
}
|
|
45
43
|
);
|
|
46
44
|
};
|
|
47
|
-
|
|
48
|
-
const L = "_root_1h0xj_14",
|
|
45
|
+
T.displayName = r.CHECKBOX;
|
|
46
|
+
const L = "_root_1h0xj_14", U = {
|
|
49
47
|
root: L
|
|
50
|
-
},
|
|
51
|
-
const { children: o } =
|
|
52
|
-
return /* @__PURE__ */
|
|
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 }) });
|
|
53
51
|
};
|
|
54
|
-
|
|
55
|
-
const j = [
|
|
56
|
-
const { children: o, open:
|
|
57
|
-
return /* @__PURE__ */
|
|
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) });
|
|
58
56
|
};
|
|
59
|
-
f.displayName =
|
|
60
|
-
const
|
|
61
|
-
root:
|
|
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,
|
|
62
71
|
disabled: D,
|
|
63
|
-
danger:
|
|
64
|
-
icon:
|
|
65
|
-
label:
|
|
66
|
-
},
|
|
67
|
-
const { children: o, danger:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
|
71
80
|
);
|
|
72
81
|
return /* @__PURE__ */ h(
|
|
73
82
|
"div",
|
|
74
83
|
{
|
|
75
|
-
"aria-disabled":
|
|
76
|
-
className:
|
|
84
|
+
"aria-disabled": s,
|
|
85
|
+
className: C,
|
|
77
86
|
onClick: () => {
|
|
78
|
-
|
|
87
|
+
s || (l && l(), d());
|
|
79
88
|
},
|
|
80
89
|
role: "menuitem",
|
|
81
|
-
tabIndex:
|
|
90
|
+
tabIndex: s ? -1 : 0,
|
|
82
91
|
children: [
|
|
83
|
-
|
|
84
|
-
/* @__PURE__ */
|
|
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 })
|
|
85
94
|
]
|
|
86
95
|
}
|
|
87
96
|
);
|
|
88
97
|
};
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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;
|
|
97
115
|
export {
|
|
98
|
-
|
|
116
|
+
i as Menu
|
|
99
117
|
};
|
package/dist/select.d.ts
CHANGED
|
@@ -15,9 +15,23 @@ export declare interface ISelectOption {
|
|
|
15
15
|
disabled?: boolean;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
export declare interface ISelectOptionProps {
|
|
19
|
+
/** Option value. */
|
|
20
|
+
value: string;
|
|
21
|
+
/** Whether the option is disabled. */
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/** Option label (display text). */
|
|
24
|
+
children: default_2.ReactNode;
|
|
25
|
+
}
|
|
26
|
+
|
|
18
27
|
export declare interface ISelectProps {
|
|
19
|
-
/**
|
|
20
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Array of options to display in the dropdown.
|
|
30
|
+
*
|
|
31
|
+
* Use this for props-driven mode.
|
|
32
|
+
* For JSX composition mode, pass `<Select.Option>` children instead.
|
|
33
|
+
*/
|
|
34
|
+
options?: ISelectOption[];
|
|
21
35
|
/** Currently selected value(s). For single select — string, for multiple — string[]. */
|
|
22
36
|
value?: string | string[];
|
|
23
37
|
/** Callback when selection changes. */
|
|
@@ -34,8 +48,16 @@ export declare interface ISelectProps {
|
|
|
34
48
|
clearable?: boolean;
|
|
35
49
|
/** Whether the select is in an invalid state. */
|
|
36
50
|
invalid?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* JSX composition children.
|
|
53
|
+
* When provided with `<SelectOption>` elements, they are used
|
|
54
|
+
* as the option data source instead of the `options` prop.
|
|
55
|
+
*/
|
|
56
|
+
children?: default_2.ReactNode;
|
|
37
57
|
}
|
|
38
58
|
|
|
59
|
+
export declare const Select: TSelectCompoundComponent;
|
|
60
|
+
|
|
39
61
|
/**
|
|
40
62
|
* Select component. A dropdown selector built on top of Popover.
|
|
41
63
|
*
|
|
@@ -57,7 +79,27 @@ export declare interface ISelectProps {
|
|
|
57
79
|
* />
|
|
58
80
|
* ```
|
|
59
81
|
*/
|
|
60
|
-
|
|
82
|
+
declare const Select_2: default_2.FC<ISelectProps>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Select Option sub-component for JSX composition mode.
|
|
86
|
+
*
|
|
87
|
+
* Used as `<Select.Option>` child of `<Select>`.
|
|
88
|
+
* Acts as a data carrier — does not render any DOM itself.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```tsx
|
|
92
|
+
* <Select value={val} onChange={setVal}>
|
|
93
|
+
* <Select.Option value="1">Option 1</Select.Option>
|
|
94
|
+
* <Select.Option value="2" disabled>Option 2</Select.Option>
|
|
95
|
+
* </Select>
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
declare const SelectOption: default_2.FC<ISelectOptionProps>;
|
|
99
|
+
|
|
100
|
+
declare type TSelectCompoundComponent = typeof Select_2 & {
|
|
101
|
+
Option: typeof SelectOption;
|
|
102
|
+
};
|
|
61
103
|
|
|
62
104
|
export declare type TSelectSize = `${ESelectSize.SM | ESelectSize.MD | ESelectSize.LG}`;
|
|
63
105
|
|