@studiolxd/brand 41.1.0 → 43.0.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 +118 -0
- package/dist/_shared/datepicker.js +75 -78
- package/dist/_types/atoms/AsyncMultiSelect/AsyncMultiSelect.d.ts +28 -5
- package/dist/_types/atoms/AsyncSelect/AsyncSelect.d.ts +26 -6
- package/dist/_types/atoms/InputPhone/InputPhone.d.ts +15 -4
- package/dist/_types/atoms/MultiSelect/MultiSelect.d.ts +20 -1
- package/dist/_types/atoms/NumberInput/NumberInput.d.ts +14 -4
- package/dist/_types/atoms/OtpInput/OtpInput.d.ts +15 -4
- package/dist/_types/atoms/Select/Select.d.ts +18 -1
- package/dist/_types/atoms/TimeSelect/TimeSelect.d.ts +34 -6
- package/dist/_types/messages/BrandMessages.d.ts +31 -1
- package/dist/_types/messages/index.d.ts +1 -1
- package/dist/_types/molecules/Calendar/Calendar.d.ts +44 -13
- package/dist/_types/molecules/DatePicker/DatePicker.d.ts +56 -26
- package/dist/_types/molecules/DatePicker/dateMask.d.ts +9 -2
- package/dist/_types/molecules/DateTimeField/DateTimeField.d.ts +12 -12
- package/dist/_types/molecules/DocsSearch/DocsSearch.d.ts +31 -12
- package/dist/_types/molecules/FilterBar/FilterBar.d.ts +10 -1
- package/dist/_types/molecules/InputField/InputField.d.ts +16 -2
- package/dist/_types/molecules/MultiSelectField/MultiSelectField.d.ts +9 -1
- package/dist/_types/molecules/PasswordField/PasswordField.d.ts +22 -2
- package/dist/_types/molecules/SearchForm/SearchForm.d.ts +18 -6
- package/dist/_types/molecules/SelectField/SelectField.d.ts +5 -0
- package/dist/_types/molecules/TimeField/TimeField.d.ts +9 -2
- package/dist/_types/molecules/_shared/calendarGrid.d.ts +6 -2
- package/dist/async-multi-select.js +50 -49
- package/dist/async-select.js +89 -88
- package/dist/calendar.js +87 -86
- package/dist/docs-search.js +38 -37
- package/dist/filter-bar.css +1 -1
- package/dist/filter-bar.js +19 -17
- package/dist/input-field.js +66 -65
- package/dist/input-phone.js +39 -38
- package/dist/multi-select.js +109 -108
- package/dist/number-input.js +61 -60
- package/dist/otp-input.js +86 -85
- package/dist/password-field.js +46 -45
- package/dist/search-form.js +35 -34
- package/dist/select.js +75 -71
- package/dist/time-select.js +57 -56
- package/package.json +1 -1
package/dist/input-phone.js
CHANGED
|
@@ -1,72 +1,73 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import './input-phone.css';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
3
|
+
import { n as e } from "./_shared/brandmessagescontext.js";
|
|
4
|
+
import { Icon as t } from "./icon.js";
|
|
5
|
+
import { forwardRef as n, useMemo as r } from "react";
|
|
6
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
|
+
import { Select as o } from "@base-ui/react/select";
|
|
8
|
+
import s, { getCountryCallingCode as c } from "react-phone-number-input";
|
|
8
9
|
//#region src/stories/atoms/InputPhone/InputPhone.tsx
|
|
9
|
-
function
|
|
10
|
-
let
|
|
11
|
-
return /* @__PURE__ */
|
|
12
|
-
value:
|
|
13
|
-
onValueChange: (e) =>
|
|
14
|
-
disabled:
|
|
15
|
-
children: [/* @__PURE__ */
|
|
10
|
+
function l({ value: n, onChange: r, options: s, disabled: l, size: u = "md", countryLabel: d, internationalLabel: f = "🌐", container: p }) {
|
|
11
|
+
let m = e("inputPhone"), h = "__intl__", g = (e) => e ?? h, _ = (e) => e === h ? void 0 : e, v = u === "sm" ? "xs" : u === "lg" ? "md" : "sm", y = ["input-phone__country-content", u === "md" ? "" : `input-phone__country-content--${u}`].filter(Boolean).join(" ");
|
|
12
|
+
return /* @__PURE__ */ a(o.Root, {
|
|
13
|
+
value: g(n),
|
|
14
|
+
onValueChange: (e) => r(_(e)),
|
|
15
|
+
disabled: l,
|
|
16
|
+
children: [/* @__PURE__ */ a(o.Trigger, {
|
|
16
17
|
className: "input-phone__country",
|
|
17
|
-
"aria-label":
|
|
18
|
-
children: [/* @__PURE__ */
|
|
18
|
+
"aria-label": m("country", d),
|
|
19
|
+
children: [/* @__PURE__ */ i(o.Value, { children: n ? `+${c(n)}` : f }), /* @__PURE__ */ i(t, {
|
|
19
20
|
name: "chevron",
|
|
20
21
|
className: "input-phone__country-icon",
|
|
21
|
-
size:
|
|
22
|
+
size: v
|
|
22
23
|
})]
|
|
23
|
-
}), /* @__PURE__ */
|
|
24
|
-
container:
|
|
25
|
-
children: /* @__PURE__ */
|
|
24
|
+
}), /* @__PURE__ */ i(o.Portal, {
|
|
25
|
+
container: p,
|
|
26
|
+
children: /* @__PURE__ */ i(o.Positioner, {
|
|
26
27
|
className: "input-phone__country-positioner",
|
|
27
28
|
side: "bottom",
|
|
28
29
|
align: "start",
|
|
29
30
|
alignItemWithTrigger: !1,
|
|
30
|
-
children: /* @__PURE__ */
|
|
31
|
-
className:
|
|
32
|
-
children:
|
|
33
|
-
value:
|
|
31
|
+
children: /* @__PURE__ */ i(o.Popup, {
|
|
32
|
+
className: y,
|
|
33
|
+
children: s.map(({ value: e, label: t }) => /* @__PURE__ */ i(o.Item, {
|
|
34
|
+
value: g(e),
|
|
34
35
|
className: "input-phone__country-item",
|
|
35
|
-
children: /* @__PURE__ */
|
|
36
|
-
},
|
|
36
|
+
children: /* @__PURE__ */ i(o.ItemText, { children: t })
|
|
37
|
+
}, g(e)))
|
|
37
38
|
})
|
|
38
39
|
})
|
|
39
40
|
})]
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
|
-
var
|
|
43
|
-
return /* @__PURE__ */
|
|
43
|
+
var u = n(function({ value: e, defaultCountry: t = "ES", placeholder: a, disabled: o, error: c = !1, size: u = "md", id: f, name: p, describedBy: m, "aria-describedby": h, "aria-label": g, autoComplete: _, required: v, readOnly: y, onChange: b, onBlur: x, onFocus: S, countryLabel: C, internationalLabel: w, container: T }, E) {
|
|
44
|
+
return /* @__PURE__ */ i(s, {
|
|
44
45
|
className: [
|
|
45
46
|
"input-phone",
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
c ? "input-phone--error" : "",
|
|
48
|
+
u === "md" ? "" : `input-phone--${u}`
|
|
48
49
|
].filter(Boolean).join(" "),
|
|
49
50
|
value: e,
|
|
50
|
-
defaultCountry:
|
|
51
|
+
defaultCountry: t,
|
|
51
52
|
placeholder: a,
|
|
52
|
-
disabled:
|
|
53
|
+
disabled: o,
|
|
53
54
|
readOnly: y,
|
|
54
55
|
required: v,
|
|
55
56
|
autoComplete: _,
|
|
56
57
|
id: f,
|
|
57
58
|
name: p,
|
|
58
|
-
inputComponent:
|
|
59
|
-
return /* @__PURE__ */
|
|
59
|
+
inputComponent: r(() => n(function(e, t) {
|
|
60
|
+
return /* @__PURE__ */ i("input", {
|
|
60
61
|
...e,
|
|
61
62
|
ref: (e) => {
|
|
62
|
-
|
|
63
|
+
d(t, e), d(E, e);
|
|
63
64
|
},
|
|
64
65
|
className: "input-phone__number"
|
|
65
66
|
});
|
|
66
67
|
}), [E]),
|
|
67
|
-
countrySelectComponent:
|
|
68
|
+
countrySelectComponent: l,
|
|
68
69
|
countrySelectProps: {
|
|
69
|
-
size:
|
|
70
|
+
size: u,
|
|
70
71
|
countryLabel: C,
|
|
71
72
|
internationalLabel: w,
|
|
72
73
|
container: T
|
|
@@ -77,12 +78,12 @@ var l = t(function({ value: e, defaultCountry: i = "ES", placeholder: a, disable
|
|
|
77
78
|
numberInputProps: {
|
|
78
79
|
"aria-describedby": h ?? m,
|
|
79
80
|
"aria-label": g,
|
|
80
|
-
"aria-invalid":
|
|
81
|
+
"aria-invalid": c || void 0
|
|
81
82
|
}
|
|
82
83
|
});
|
|
83
84
|
});
|
|
84
|
-
function
|
|
85
|
+
function d(e, t) {
|
|
85
86
|
typeof e == "function" ? e(t) : e && (e.current = t);
|
|
86
87
|
}
|
|
87
88
|
//#endregion
|
|
88
|
-
export {
|
|
89
|
+
export { u as InputPhone };
|
package/dist/multi-select.js
CHANGED
|
@@ -1,166 +1,167 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import './multi-select.css';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { n as e } from "./_shared/brandmessagescontext.js";
|
|
4
|
+
import { Icon as t } from "./icon.js";
|
|
5
|
+
import { forwardRef as n, useEffect as r, useId as i, useRef as a, useState as o } from "react";
|
|
6
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
import { Popover as l } from "@base-ui/react/popover";
|
|
7
8
|
//#region src/stories/atoms/MultiSelect/MultiSelect.tsx
|
|
8
|
-
function
|
|
9
|
+
function u(e, t) {
|
|
9
10
|
typeof e == "function" ? e(t) : e && (e.current = t);
|
|
10
11
|
}
|
|
11
|
-
var
|
|
12
|
-
let [
|
|
13
|
-
function
|
|
14
|
-
let t =
|
|
15
|
-
|
|
12
|
+
var d = 500, f = n(function({ options: n, value: f, defaultValue: p = [], placeholder: m, disabled: h, readOnly: g, size: _ = "md", onValueChange: v, id: y, name: b, error: x = !1, onBlur: S, className: C, "aria-label": w, "aria-labelledby": T, "aria-describedby": E, removeLabel: D, container: O }, k) {
|
|
13
|
+
let A = e("multiSelect"), [j, M] = o(!1), [N, P] = o(p), [F, I] = o(-1), L = a(null), R = a(null), z = i(), B = i(), V = a(""), H = a(0), U = f === void 0 ? N : f, W = (e) => `${B}-opt-${e}`;
|
|
14
|
+
function G(e) {
|
|
15
|
+
let t = U.includes(e) ? U.filter((t) => t !== e) : [...U, e];
|
|
16
|
+
f === void 0 && P(t), v?.(t);
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
-
|
|
18
|
+
function K(e) {
|
|
19
|
+
h || g || (M(!0), I(n.length === 0 ? -1 : e));
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
-
|
|
21
|
+
function q() {
|
|
22
|
+
M(!1), I(-1), V.current = "";
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
+
function J(e, t) {
|
|
24
25
|
if (!e) {
|
|
25
26
|
if (t.reason === "outside-press") {
|
|
26
27
|
let e = t.event?.target;
|
|
27
|
-
if (e instanceof Node &&
|
|
28
|
+
if (e instanceof Node && L.current?.contains(e)) return;
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
+
q();
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
|
-
function
|
|
33
|
-
if (
|
|
34
|
-
let
|
|
35
|
-
|
|
36
|
-
let i = r.length === 1 ?
|
|
37
|
-
for (let e = 0; e <
|
|
38
|
-
let
|
|
39
|
-
if (t
|
|
40
|
-
|
|
33
|
+
function Y(e) {
|
|
34
|
+
if (n.length === 0) return;
|
|
35
|
+
let t = Date.now(), r = t - H.current > d ? e : V.current + e;
|
|
36
|
+
V.current = r, H.current = t;
|
|
37
|
+
let i = r.length === 1 ? F + 1 : Math.max(F, 0), a = r.toLowerCase();
|
|
38
|
+
for (let e = 0; e < n.length; e++) {
|
|
39
|
+
let t = (i + e) % n.length;
|
|
40
|
+
if (n[t].label.toLowerCase().startsWith(a)) {
|
|
41
|
+
I(t), j || M(!0);
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
|
-
function
|
|
46
|
-
if (
|
|
47
|
-
let
|
|
48
|
-
if (e.key === "ArrowDown") e.preventDefault(),
|
|
49
|
-
else if (e.key === "ArrowUp") e.preventDefault(),
|
|
50
|
-
else if (e.key === "Home") e.preventDefault(),
|
|
51
|
-
else if (e.key === "End") e.preventDefault(),
|
|
52
|
-
else if (e.key === "Enter" || e.key === " ") e.preventDefault(),
|
|
46
|
+
function X(e) {
|
|
47
|
+
if (h || g) return;
|
|
48
|
+
let t = n.length - 1;
|
|
49
|
+
if (e.key === "ArrowDown") e.preventDefault(), j ? I((e) => Math.min(e + 1, t)) : K(0);
|
|
50
|
+
else if (e.key === "ArrowUp") e.preventDefault(), j ? I((e) => Math.max(e - 1, 0)) : K(t);
|
|
51
|
+
else if (e.key === "Home") e.preventDefault(), j ? I(n.length === 0 ? -1 : 0) : K(0);
|
|
52
|
+
else if (e.key === "End") e.preventDefault(), j ? I(t) : K(t);
|
|
53
|
+
else if (e.key === "Enter" || e.key === " ") e.preventDefault(), j ? F >= 0 && F < n.length && G(n[F].value) : K(0);
|
|
53
54
|
else if (e.key === "Escape") {
|
|
54
|
-
if (!
|
|
55
|
-
e.preventDefault(),
|
|
56
|
-
} else e.key === "Tab" ?
|
|
55
|
+
if (!j) return;
|
|
56
|
+
e.preventDefault(), q();
|
|
57
|
+
} else e.key === "Tab" ? j && q() : e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && (e.preventDefault(), Y(e.key));
|
|
57
58
|
}
|
|
58
|
-
function
|
|
59
|
-
|
|
59
|
+
function Z(e) {
|
|
60
|
+
h || g || e.target instanceof Element && e.target.closest(".multi-select__pill-remove") || (e.preventDefault(), R.current?.focus(), j ? q() : K(0));
|
|
60
61
|
}
|
|
61
|
-
|
|
62
|
-
!
|
|
62
|
+
r(() => {
|
|
63
|
+
!j || F < 0 || document.getElementById(W(F))?.scrollIntoView({ block: "nearest" });
|
|
63
64
|
}, [
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
j,
|
|
66
|
+
F,
|
|
67
|
+
B
|
|
67
68
|
]);
|
|
68
|
-
let
|
|
69
|
+
let Q = [
|
|
69
70
|
"multi-select",
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
].filter(Boolean).join(" "),
|
|
75
|
-
return /* @__PURE__ */
|
|
76
|
-
open:
|
|
77
|
-
onOpenChange:
|
|
78
|
-
children: [/* @__PURE__ */
|
|
79
|
-
ref:
|
|
80
|
-
className:
|
|
81
|
-
"data-popup-open":
|
|
82
|
-
onPointerDown:
|
|
71
|
+
_ === "md" ? "" : `multi-select--${_}`,
|
|
72
|
+
h ? "multi-select--disabled" : "",
|
|
73
|
+
x ? "multi-select--error" : "",
|
|
74
|
+
C ?? ""
|
|
75
|
+
].filter(Boolean).join(" "), $ = ["multi-select__content", _ === "md" ? "" : `multi-select__content--${_}`].filter(Boolean).join(" ");
|
|
76
|
+
return /* @__PURE__ */ c(l.Root, {
|
|
77
|
+
open: j,
|
|
78
|
+
onOpenChange: J,
|
|
79
|
+
children: [/* @__PURE__ */ c("div", {
|
|
80
|
+
ref: L,
|
|
81
|
+
className: Q,
|
|
82
|
+
"data-popup-open": j || void 0,
|
|
83
|
+
onPointerDown: Z,
|
|
83
84
|
children: [
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ c("div", {
|
|
85
86
|
className: "multi-select__values",
|
|
86
|
-
children: [
|
|
87
|
-
let r =
|
|
88
|
-
return r ? /* @__PURE__ */
|
|
87
|
+
children: [U.map((e) => {
|
|
88
|
+
let r = n.find((t) => t.value === e);
|
|
89
|
+
return r ? /* @__PURE__ */ c("span", {
|
|
89
90
|
className: "multi-select__pill",
|
|
90
|
-
children: [/* @__PURE__ */
|
|
91
|
+
children: [/* @__PURE__ */ s("span", {
|
|
91
92
|
className: "multi-select__pill-label",
|
|
92
93
|
children: r.label
|
|
93
|
-
}), !
|
|
94
|
+
}), !h && !g && /* @__PURE__ */ s("button", {
|
|
94
95
|
type: "button",
|
|
95
96
|
className: "multi-select__pill-remove",
|
|
96
|
-
"aria-label":
|
|
97
|
+
"aria-label": A("remove", D)(r.label),
|
|
97
98
|
tabIndex: -1,
|
|
98
|
-
onClick: (
|
|
99
|
-
|
|
99
|
+
onClick: (t) => {
|
|
100
|
+
t.stopPropagation(), G(e), R.current?.focus();
|
|
100
101
|
},
|
|
101
|
-
children: /* @__PURE__ */
|
|
102
|
+
children: /* @__PURE__ */ s(t, {
|
|
102
103
|
name: "close",
|
|
103
104
|
size: "xs"
|
|
104
105
|
})
|
|
105
106
|
})]
|
|
106
|
-
},
|
|
107
|
-
}), /* @__PURE__ */
|
|
107
|
+
}, e) : null;
|
|
108
|
+
}), /* @__PURE__ */ s("div", {
|
|
108
109
|
ref: (e) => {
|
|
109
|
-
|
|
110
|
+
R.current = e, u(k, e);
|
|
110
111
|
},
|
|
111
112
|
className: "multi-select__combobox",
|
|
112
|
-
tabIndex:
|
|
113
|
+
tabIndex: h ? -1 : 0,
|
|
113
114
|
role: "combobox",
|
|
114
|
-
"aria-expanded":
|
|
115
|
+
"aria-expanded": j,
|
|
115
116
|
"aria-haspopup": "listbox",
|
|
116
|
-
"aria-controls":
|
|
117
|
-
"aria-activedescendant":
|
|
118
|
-
"aria-label":
|
|
119
|
-
"aria-labelledby":
|
|
120
|
-
"aria-describedby":
|
|
121
|
-
"aria-invalid":
|
|
122
|
-
"aria-disabled":
|
|
123
|
-
"aria-readonly":
|
|
124
|
-
id:
|
|
125
|
-
onKeyDown:
|
|
126
|
-
onBlur:
|
|
127
|
-
children:
|
|
117
|
+
"aria-controls": j ? z : void 0,
|
|
118
|
+
"aria-activedescendant": j && F >= 0 ? W(F) : void 0,
|
|
119
|
+
"aria-label": T ? void 0 : w ?? A("placeholder", m),
|
|
120
|
+
"aria-labelledby": T,
|
|
121
|
+
"aria-describedby": E,
|
|
122
|
+
"aria-invalid": x || void 0,
|
|
123
|
+
"aria-disabled": h || void 0,
|
|
124
|
+
"aria-readonly": g || void 0,
|
|
125
|
+
id: y,
|
|
126
|
+
onKeyDown: X,
|
|
127
|
+
onBlur: S,
|
|
128
|
+
children: U.length === 0 && /* @__PURE__ */ s("span", {
|
|
128
129
|
className: "multi-select__placeholder",
|
|
129
|
-
children:
|
|
130
|
+
children: A("placeholder", m)
|
|
130
131
|
})
|
|
131
132
|
})]
|
|
132
133
|
}),
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
+
/* @__PURE__ */ s(t, {
|
|
134
135
|
name: "chevron",
|
|
135
136
|
className: "multi-select__icon",
|
|
136
|
-
size:
|
|
137
|
+
size: _ === "sm" ? "xs" : _ === "lg" ? "md" : "sm"
|
|
137
138
|
}),
|
|
138
|
-
|
|
139
|
+
b && U.map((e) => /* @__PURE__ */ s("input", {
|
|
139
140
|
type: "hidden",
|
|
140
|
-
name:
|
|
141
|
+
name: b,
|
|
141
142
|
value: e
|
|
142
143
|
}, e))
|
|
143
144
|
]
|
|
144
|
-
}), /* @__PURE__ */
|
|
145
|
-
container:
|
|
146
|
-
children: /* @__PURE__ */
|
|
145
|
+
}), /* @__PURE__ */ s(l.Portal, {
|
|
146
|
+
container: O,
|
|
147
|
+
children: /* @__PURE__ */ s(l.Positioner, {
|
|
147
148
|
className: "multi-select__positioner",
|
|
148
|
-
anchor:
|
|
149
|
+
anchor: L,
|
|
149
150
|
align: "start",
|
|
150
151
|
sideOffset: -1,
|
|
151
|
-
children: /* @__PURE__ */
|
|
152
|
-
className:
|
|
152
|
+
children: /* @__PURE__ */ s(l.Popup, {
|
|
153
|
+
className: $,
|
|
153
154
|
initialFocus: !1,
|
|
154
155
|
finalFocus: !1,
|
|
155
|
-
children: /* @__PURE__ */
|
|
156
|
+
children: /* @__PURE__ */ s("div", {
|
|
156
157
|
role: "listbox",
|
|
157
158
|
"aria-multiselectable": "true",
|
|
158
|
-
"aria-label":
|
|
159
|
-
id:
|
|
160
|
-
children:
|
|
161
|
-
let n =
|
|
162
|
-
return /* @__PURE__ */
|
|
163
|
-
id:
|
|
159
|
+
"aria-label": w ?? m,
|
|
160
|
+
id: z,
|
|
161
|
+
children: n.map((e, t) => {
|
|
162
|
+
let n = U.includes(e.value), r = F === t;
|
|
163
|
+
return /* @__PURE__ */ c("div", {
|
|
164
|
+
id: W(t),
|
|
164
165
|
role: "option",
|
|
165
166
|
"aria-selected": n,
|
|
166
167
|
"aria-label": e["aria-label"] ?? e.label,
|
|
@@ -173,13 +174,13 @@ var u = 500, d = t(function({ options: t, value: d, defaultValue: f = [], placeh
|
|
|
173
174
|
e.preventDefault(), e.stopPropagation();
|
|
174
175
|
},
|
|
175
176
|
onClick: () => {
|
|
176
|
-
|
|
177
|
+
G(e.value), I(t), R.current?.focus();
|
|
177
178
|
},
|
|
178
|
-
children: [/* @__PURE__ */
|
|
179
|
+
children: [/* @__PURE__ */ s("span", {
|
|
179
180
|
className: "multi-select__item-check",
|
|
180
181
|
"aria-hidden": "true",
|
|
181
|
-
children: /* @__PURE__ */
|
|
182
|
-
}), /* @__PURE__ */
|
|
182
|
+
children: /* @__PURE__ */ s("span", { className: "multi-select__item-check-mark" })
|
|
183
|
+
}), /* @__PURE__ */ s("span", { children: e.label })]
|
|
183
184
|
}, e.value);
|
|
184
185
|
})
|
|
185
186
|
})
|
|
@@ -189,4 +190,4 @@ var u = 500, d = t(function({ options: t, value: d, defaultValue: f = [], placeh
|
|
|
189
190
|
});
|
|
190
191
|
});
|
|
191
192
|
//#endregion
|
|
192
|
-
export {
|
|
193
|
+
export { f as MultiSelect };
|
package/dist/number-input.js
CHANGED
|
@@ -1,83 +1,84 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import './number-input.css';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { n as e } from "./_shared/brandmessagescontext.js";
|
|
4
|
+
import { Icon as t } from "./icon.js";
|
|
5
|
+
import { forwardRef as n, useCallback as r, useState as i } from "react";
|
|
6
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
7
|
//#region src/stories/atoms/NumberInput/NumberInput.tsx
|
|
7
|
-
var
|
|
8
|
-
let
|
|
8
|
+
var s = n(function({ value: n, defaultValue: s = 0, min: c, max: l, step: u = 1, decimal: d = !1, disabled: f = !1, readOnly: p = !1, size: m = "md", error: h = !1, id: g, name: _, describedBy: v, ariaLabel: y, decrementLabel: b, incrementLabel: x, className: S, onChange: C, onBlur: w, onFocus: T, ...E }, D) {
|
|
9
|
+
let O = e("numberInput"), k = n !== void 0, [A, j] = i(s), [M, N] = i(!1), [P, F] = i(null), I = k ? n : A, L = P === null ? String(I) : P, R = r((e) => {
|
|
9
10
|
let t = e;
|
|
10
|
-
return
|
|
11
|
-
}, [
|
|
12
|
-
let t =
|
|
13
|
-
|
|
11
|
+
return c !== void 0 && (t = Math.max(c, t)), l !== void 0 && (t = Math.min(l, t)), t;
|
|
12
|
+
}, [c, l]), z = r((e) => {
|
|
13
|
+
let t = R(e);
|
|
14
|
+
k || j(t), C?.(t);
|
|
14
15
|
}, [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
]),
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
}, B = (e) => {
|
|
23
|
-
let t = e.target.value;
|
|
24
|
-
N(t);
|
|
25
|
-
let n = u ? t.replace(",", ".") : t, r = parseFloat(n);
|
|
26
|
-
isNaN(r) || L(r);
|
|
27
|
-
}, V = (e) => {
|
|
28
|
-
j(!0), w?.(e);
|
|
16
|
+
R,
|
|
17
|
+
k,
|
|
18
|
+
C
|
|
19
|
+
]), B = () => {
|
|
20
|
+
f || p || (F(null), z(I - u));
|
|
21
|
+
}, V = () => {
|
|
22
|
+
f || p || (F(null), z(I + u));
|
|
29
23
|
}, H = (e) => {
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
let t = e.target.value;
|
|
25
|
+
F(t);
|
|
26
|
+
let n = d ? t.replace(",", ".") : t, r = parseFloat(n);
|
|
27
|
+
isNaN(r) || z(r);
|
|
28
|
+
}, U = (e) => {
|
|
29
|
+
N(!0), T?.(e);
|
|
30
|
+
}, W = (e) => {
|
|
31
|
+
N(!1), F(null), w?.(e);
|
|
32
|
+
}, G = [
|
|
32
33
|
"number-input",
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
].filter(Boolean).join(" "),
|
|
39
|
-
return /* @__PURE__ */
|
|
40
|
-
className:
|
|
34
|
+
m === "md" ? "" : `number-input--${m}`,
|
|
35
|
+
h ? "number-input--error" : "",
|
|
36
|
+
f ? "number-input--disabled" : "",
|
|
37
|
+
M ? "number-input--focused" : "",
|
|
38
|
+
S ?? ""
|
|
39
|
+
].filter(Boolean).join(" "), K = f || p || c !== void 0 && I <= c, q = f || p || l !== void 0 && I >= l;
|
|
40
|
+
return /* @__PURE__ */ o("div", {
|
|
41
|
+
className: G,
|
|
41
42
|
children: [
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */ a("button", {
|
|
43
44
|
className: "number-input__btn number-input__btn--decrement",
|
|
44
45
|
type: "button",
|
|
45
|
-
onClick:
|
|
46
|
-
disabled:
|
|
47
|
-
"aria-label":
|
|
46
|
+
onClick: B,
|
|
47
|
+
disabled: K,
|
|
48
|
+
"aria-label": O("decrement", b),
|
|
48
49
|
tabIndex: -1,
|
|
49
|
-
children: /* @__PURE__ */
|
|
50
|
+
children: /* @__PURE__ */ a(t, {
|
|
50
51
|
name: "minus",
|
|
51
52
|
size: "sm"
|
|
52
53
|
})
|
|
53
54
|
}),
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
-
ref:
|
|
55
|
+
/* @__PURE__ */ a("input", {
|
|
56
|
+
ref: D,
|
|
56
57
|
className: "number-input__field",
|
|
57
58
|
type: "text",
|
|
58
|
-
inputMode:
|
|
59
|
-
pattern:
|
|
60
|
-
"aria-invalid":
|
|
61
|
-
"aria-describedby":
|
|
62
|
-
"aria-label":
|
|
63
|
-
...
|
|
64
|
-
id:
|
|
65
|
-
name:
|
|
66
|
-
value:
|
|
67
|
-
disabled:
|
|
68
|
-
readOnly:
|
|
69
|
-
onChange:
|
|
70
|
-
onFocus:
|
|
71
|
-
onBlur:
|
|
59
|
+
inputMode: d ? "decimal" : "numeric",
|
|
60
|
+
pattern: d ? "[0-9]*[.,]?[0-9]*" : "[0-9]*",
|
|
61
|
+
"aria-invalid": h || void 0,
|
|
62
|
+
"aria-describedby": v,
|
|
63
|
+
"aria-label": y,
|
|
64
|
+
...E,
|
|
65
|
+
id: g,
|
|
66
|
+
name: _,
|
|
67
|
+
value: L,
|
|
68
|
+
disabled: f,
|
|
69
|
+
readOnly: p,
|
|
70
|
+
onChange: H,
|
|
71
|
+
onFocus: U,
|
|
72
|
+
onBlur: W
|
|
72
73
|
}),
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */ a("button", {
|
|
74
75
|
className: "number-input__btn number-input__btn--increment",
|
|
75
76
|
type: "button",
|
|
76
|
-
onClick:
|
|
77
|
-
disabled:
|
|
78
|
-
"aria-label":
|
|
77
|
+
onClick: V,
|
|
78
|
+
disabled: q,
|
|
79
|
+
"aria-label": O("increment", x),
|
|
79
80
|
tabIndex: -1,
|
|
80
|
-
children: /* @__PURE__ */
|
|
81
|
+
children: /* @__PURE__ */ a(t, {
|
|
81
82
|
name: "plus",
|
|
82
83
|
size: "sm"
|
|
83
84
|
})
|
|
@@ -86,4 +87,4 @@ var o = t(function({ value: t, defaultValue: o = 0, min: s, max: c, step: l = 1,
|
|
|
86
87
|
});
|
|
87
88
|
});
|
|
88
89
|
//#endregion
|
|
89
|
-
export {
|
|
90
|
+
export { s as NumberInput };
|