@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/calendar.js
CHANGED
|
@@ -1,121 +1,122 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import './calendar.css';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { n as e } from "./_shared/brandmessagescontext.js";
|
|
4
|
+
import { a as t, c as n, i as r, l as i, n as a, o, r as ee, s as te, t as ne } from "./_shared/calendargrid.js";
|
|
5
|
+
import { useCallback as s, useEffect as c, useId as l, useRef as u, useState as d } from "react";
|
|
6
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
6
7
|
//#region src/stories/molecules/Calendar/Calendar.tsx
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
return Math.floor(e /
|
|
8
|
+
var m = 12, h = 4;
|
|
9
|
+
function g(e) {
|
|
10
|
+
return Math.floor(e / m) * m;
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
-
let [
|
|
13
|
-
|
|
14
|
-
}, [
|
|
12
|
+
function _({ value: _, onChange: re, defaultMonth: ie, month: v, onMonthChange: y, navigable: b = !0, disabledDates: x, minDate: S, maxDate: C, locale: w = "es-ES", previousMonthLabel: ae, nextMonthLabel: oe, previousYearsLabel: T, nextYearsLabel: E, yearGridLabel: D, gridLabel: O, size: k = "md", className: A }) {
|
|
13
|
+
let j = e("calendar"), [se, ce] = d(() => v ?? ie ?? (_ instanceof Date ? _ : /* @__PURE__ */ new Date())), M = v ?? se, N = s((e) => {
|
|
14
|
+
ce(e), y?.(e);
|
|
15
|
+
}, [y]), P = /* @__PURE__ */ new Date(), le = s((e) => S && e < S || C && e > C ? !0 : Array.isArray(x) ? x.some((t) => r(t, e)) : typeof x == "function" ? x(e) : !1, [
|
|
15
16
|
x,
|
|
16
17
|
S,
|
|
17
18
|
C
|
|
18
|
-
]),
|
|
19
|
-
month:
|
|
20
|
-
onMonthChange:
|
|
21
|
-
selected:
|
|
19
|
+
]), F = i({
|
|
20
|
+
month: M,
|
|
21
|
+
onMonthChange: N,
|
|
22
|
+
selected: _ ?? null,
|
|
22
23
|
minDate: S,
|
|
23
24
|
maxDate: C
|
|
24
|
-
}), [
|
|
25
|
-
let e =
|
|
26
|
-
|
|
27
|
-
}, [
|
|
28
|
-
|
|
29
|
-
}, []),
|
|
30
|
-
|
|
25
|
+
}), [I, L] = d("days"), [R, z] = d(() => g(M.getFullYear())), [B, V] = d(() => M.getFullYear()), H = u(null), U = u(/* @__PURE__ */ new Map()), W = u(null), ue = s(() => {
|
|
26
|
+
let e = M.getFullYear();
|
|
27
|
+
z(g(e)), V(e), W.current = "year", L("years");
|
|
28
|
+
}, [M]), G = s(() => {
|
|
29
|
+
W.current = "title", L("days");
|
|
30
|
+
}, []), de = s((e) => {
|
|
31
|
+
N(new Date(e, M.getMonth(), 1)), G();
|
|
31
32
|
}, [
|
|
32
33
|
G,
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
M,
|
|
35
|
+
N
|
|
35
36
|
]);
|
|
36
37
|
c(() => {
|
|
37
|
-
if (!
|
|
38
|
-
let e =
|
|
39
|
-
|
|
40
|
-
}, [
|
|
41
|
-
let
|
|
38
|
+
if (!W.current) return;
|
|
39
|
+
let e = W.current;
|
|
40
|
+
W.current = null, e === "title" ? H.current?.focus() : U.current.get(B)?.focus();
|
|
41
|
+
}, [I, B]);
|
|
42
|
+
let fe = k === "sm" ? "xs" : k === "lg" ? "md" : "sm", pe = new Intl.DateTimeFormat(w, {
|
|
42
43
|
month: "long",
|
|
43
44
|
year: "numeric"
|
|
44
|
-
}).format(
|
|
45
|
+
}).format(M), me = new Intl.DateTimeFormat(w, { year: "numeric" }), K = (e) => me.format(new Date(e, 0, 1)), he = Array.from({ length: m }, (e, t) => R + t), ge = `${K(R)}–${K(R + m - 1)}`, _e = new Intl.DateTimeFormat(w, {
|
|
45
46
|
weekday: "long",
|
|
46
47
|
day: "numeric",
|
|
47
48
|
month: "long",
|
|
48
49
|
year: "numeric"
|
|
49
|
-
}),
|
|
50
|
-
(e <
|
|
51
|
-
},
|
|
50
|
+
}), ve = ee(w, "narrow"), ye = ne(a(M)), q = n(M, -1), J = n(M, 1), be = S ? !t(q, S) && q < S : !1, xe = C ? !t(J, C) && J > C : !1, Se = (e) => (S ? e < S.getFullYear() : !1) || (C ? e > C.getFullYear() : !1), Ce = S ? R - 1 < S.getFullYear() : !1, we = C ? R + m > C.getFullYear() : !1, Y = I === "years", X = B >= R && B <= R + m - 1 ? B : R, Te = (e) => {
|
|
51
|
+
(e < R || e > R + m - 1) && z(g(e)), W.current = "year", V(e);
|
|
52
|
+
}, Z = (e) => {
|
|
52
53
|
let t = null;
|
|
53
54
|
switch (e.key) {
|
|
54
55
|
case "ArrowLeft":
|
|
55
|
-
t =
|
|
56
|
+
t = X - 1;
|
|
56
57
|
break;
|
|
57
58
|
case "ArrowRight":
|
|
58
|
-
t =
|
|
59
|
+
t = X + 1;
|
|
59
60
|
break;
|
|
60
61
|
case "ArrowUp":
|
|
61
|
-
t =
|
|
62
|
+
t = X - h;
|
|
62
63
|
break;
|
|
63
64
|
case "ArrowDown":
|
|
64
|
-
t =
|
|
65
|
+
t = X + h;
|
|
65
66
|
break;
|
|
66
67
|
case "Home":
|
|
67
|
-
t =
|
|
68
|
+
t = R;
|
|
68
69
|
break;
|
|
69
70
|
case "End":
|
|
70
|
-
t =
|
|
71
|
+
t = R + m - 1;
|
|
71
72
|
break;
|
|
72
73
|
case "PageUp":
|
|
73
|
-
t =
|
|
74
|
+
t = X - m;
|
|
74
75
|
break;
|
|
75
76
|
case "PageDown":
|
|
76
|
-
t =
|
|
77
|
+
t = X + m;
|
|
77
78
|
break;
|
|
78
79
|
case "Escape":
|
|
79
80
|
e.preventDefault(), G();
|
|
80
81
|
return;
|
|
81
82
|
default: return;
|
|
82
83
|
}
|
|
83
|
-
e.preventDefault(),
|
|
84
|
-
}, Q =
|
|
85
|
-
return /* @__PURE__ */
|
|
84
|
+
e.preventDefault(), Te(t);
|
|
85
|
+
}, Q = l(), $ = Y ? `${Q}-calendar-title-${R}` : `${Q}-calendar-title-${M.getFullYear()}-${M.getMonth()}`;
|
|
86
|
+
return /* @__PURE__ */ p("div", {
|
|
86
87
|
className: [
|
|
87
88
|
"calendar",
|
|
88
|
-
`calendar--${
|
|
89
|
-
|
|
89
|
+
`calendar--${k}`,
|
|
90
|
+
A
|
|
90
91
|
].filter(Boolean).join(" "),
|
|
91
|
-
children: [
|
|
92
|
+
children: [o({
|
|
92
93
|
block: "calendar",
|
|
93
|
-
title:
|
|
94
|
+
title: Y ? ge : pe,
|
|
94
95
|
titleId: $,
|
|
95
|
-
navigable:
|
|
96
|
-
previousLabel:
|
|
97
|
-
nextLabel:
|
|
98
|
-
prevDisabled:
|
|
99
|
-
nextDisabled:
|
|
100
|
-
onPrev:
|
|
101
|
-
onNext:
|
|
102
|
-
chevronSize:
|
|
103
|
-
onTitleClick:
|
|
104
|
-
titleExpanded:
|
|
105
|
-
titleRef:
|
|
106
|
-
}),
|
|
96
|
+
navigable: b,
|
|
97
|
+
previousLabel: b ? Y ? j("previousYears", T) : j("previousMonth", ae) : void 0,
|
|
98
|
+
nextLabel: b ? Y ? j("nextYears", E) : j("nextMonth", oe) : void 0,
|
|
99
|
+
prevDisabled: Y ? Ce : be,
|
|
100
|
+
nextDisabled: Y ? we : xe,
|
|
101
|
+
onPrev: Y ? () => z(R - m) : () => N(q),
|
|
102
|
+
onNext: Y ? () => z(R + m) : () => N(J),
|
|
103
|
+
chevronSize: fe,
|
|
104
|
+
onTitleClick: Y ? G : ue,
|
|
105
|
+
titleExpanded: Y,
|
|
106
|
+
titleRef: H
|
|
107
|
+
}), Y ? /* @__PURE__ */ f("div", {
|
|
107
108
|
className: "calendar__years",
|
|
108
109
|
role: "grid",
|
|
109
|
-
"aria-label":
|
|
110
|
-
onKeyDown:
|
|
111
|
-
children: Array.from({ length:
|
|
110
|
+
"aria-label": j("yearGrid", D),
|
|
111
|
+
onKeyDown: Z,
|
|
112
|
+
children: Array.from({ length: m / h }, (e, t) => /* @__PURE__ */ f("div", {
|
|
112
113
|
role: "row",
|
|
113
114
|
className: "calendar__row",
|
|
114
|
-
children:
|
|
115
|
-
let t =
|
|
116
|
-
return /* @__PURE__ */
|
|
115
|
+
children: he.slice(t * h, t * h + h).map((e) => {
|
|
116
|
+
let t = Se(e), n = e === P.getFullYear(), r = _ instanceof Date ? _.getFullYear() === e : !1;
|
|
117
|
+
return /* @__PURE__ */ f("button", {
|
|
117
118
|
ref: (t) => {
|
|
118
|
-
t ?
|
|
119
|
+
t ? U.current.set(e, t) : U.current.delete(e);
|
|
119
120
|
},
|
|
120
121
|
type: "button",
|
|
121
122
|
role: "gridcell",
|
|
@@ -128,45 +129,45 @@ function g({ value: g, onChange: _, defaultMonth: v, month: y, onMonthChange: b,
|
|
|
128
129
|
"aria-selected": r,
|
|
129
130
|
"aria-disabled": t ? "true" : void 0,
|
|
130
131
|
"aria-current": n ? "date" : void 0,
|
|
131
|
-
tabIndex: e ===
|
|
132
|
-
onFocus: () =>
|
|
133
|
-
onClick: t ? void 0 : () =>
|
|
132
|
+
tabIndex: e === X ? 0 : -1,
|
|
133
|
+
onFocus: () => V(e),
|
|
134
|
+
onClick: t ? void 0 : () => de(e),
|
|
134
135
|
children: K(e)
|
|
135
136
|
}, e);
|
|
136
137
|
})
|
|
137
138
|
}, t))
|
|
138
|
-
}) : /* @__PURE__ */
|
|
139
|
+
}) : /* @__PURE__ */ p("div", {
|
|
139
140
|
className: "calendar__grid",
|
|
140
141
|
role: "grid",
|
|
141
|
-
"aria-label":
|
|
142
|
-
"aria-labelledby":
|
|
143
|
-
onKeyDown:
|
|
144
|
-
children: [
|
|
142
|
+
"aria-label": O,
|
|
143
|
+
"aria-labelledby": O ? void 0 : $,
|
|
144
|
+
onKeyDown: F.onKeyDown,
|
|
145
|
+
children: [te({
|
|
145
146
|
block: "calendar",
|
|
146
|
-
weekdays:
|
|
147
|
-
}),
|
|
147
|
+
weekdays: ve
|
|
148
|
+
}), ye.map((e, t) => /* @__PURE__ */ f("div", {
|
|
148
149
|
role: "row",
|
|
149
150
|
className: "calendar__row",
|
|
150
151
|
children: e.map(({ date: e, outside: t }) => {
|
|
151
|
-
let
|
|
152
|
+
let n = le(e), i = r(e, P), a = _ instanceof Date ? r(e, _) : !1, o = [
|
|
152
153
|
"calendar__day",
|
|
153
154
|
t && "calendar__day--outside",
|
|
154
155
|
i && "calendar__day--today",
|
|
155
156
|
a && "calendar__day--selected",
|
|
156
|
-
|
|
157
|
+
n && "calendar__day--disabled"
|
|
157
158
|
].filter(Boolean).join(" ");
|
|
158
|
-
return /* @__PURE__ */
|
|
159
|
-
ref:
|
|
159
|
+
return /* @__PURE__ */ f("button", {
|
|
160
|
+
ref: F.cellRef(e),
|
|
160
161
|
type: "button",
|
|
161
162
|
role: "gridcell",
|
|
162
163
|
className: o,
|
|
163
|
-
"aria-label":
|
|
164
|
+
"aria-label": _e.format(e),
|
|
164
165
|
"aria-selected": a,
|
|
165
|
-
"aria-disabled":
|
|
166
|
+
"aria-disabled": n ? "true" : void 0,
|
|
166
167
|
"aria-current": i ? "date" : void 0,
|
|
167
|
-
tabIndex:
|
|
168
|
-
onFocus: () =>
|
|
169
|
-
onClick:
|
|
168
|
+
tabIndex: F.isTabbable(e) ? 0 : -1,
|
|
169
|
+
onFocus: () => F.onCellFocus(e),
|
|
170
|
+
onClick: n ? void 0 : () => re?.(e),
|
|
170
171
|
children: e.getDate()
|
|
171
172
|
}, e.toISOString());
|
|
172
173
|
})
|
|
@@ -175,4 +176,4 @@ function g({ value: g, onChange: _, defaultMonth: v, month: y, onMonthChange: b,
|
|
|
175
176
|
});
|
|
176
177
|
}
|
|
177
178
|
//#endregion
|
|
178
|
-
export {
|
|
179
|
+
export { _ as Calendar };
|
package/dist/docs-search.js
CHANGED
|
@@ -1,60 +1,61 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import './docs-search.css';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { n as e } from "./_shared/brandmessagescontext.js";
|
|
4
|
+
import { Spinner as t } from "./spinner.js";
|
|
5
|
+
import { InputField as n } from "./input-field.js";
|
|
5
6
|
import "react";
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { Autocomplete as
|
|
7
|
+
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
8
|
+
import { Autocomplete as o } from "@base-ui/react/autocomplete";
|
|
8
9
|
//#region src/stories/molecules/DocsSearch/DocsSearch.tsx
|
|
9
|
-
function
|
|
10
|
-
return /* @__PURE__ */
|
|
10
|
+
function s(e) {
|
|
11
|
+
return /* @__PURE__ */ i("a", { ...e });
|
|
11
12
|
}
|
|
12
|
-
function
|
|
13
|
-
let
|
|
14
|
-
return /* @__PURE__ */
|
|
13
|
+
function c({ id: c = "docs-search", query: l, onQueryChange: u, results: d, loading: f = !1, label: p, labelHidden: m, placeholder: h, clearable: g = !0, clearLabel: _, resultsLabel: v, emptyLabel: y, loadingLabel: b, size: x, renderLink: S = s, onSelect: C, className: w }) {
|
|
14
|
+
let T = e("docsSearch"), E = l.trim() !== "" && d.length === 0 ? f ? T("loading", b) : T("empty", y) : null;
|
|
15
|
+
return /* @__PURE__ */ i(o.Root, {
|
|
15
16
|
inline: !0,
|
|
16
17
|
open: !0,
|
|
17
|
-
items:
|
|
18
|
+
items: d,
|
|
18
19
|
filter: null,
|
|
19
|
-
value:
|
|
20
|
-
onValueChange:
|
|
21
|
-
children: /* @__PURE__ */
|
|
22
|
-
className: ["docs-search",
|
|
20
|
+
value: l,
|
|
21
|
+
onValueChange: u,
|
|
22
|
+
children: /* @__PURE__ */ a("div", {
|
|
23
|
+
className: ["docs-search", w].filter(Boolean).join(" "),
|
|
23
24
|
children: [
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
id:
|
|
26
|
-
render: /* @__PURE__ */
|
|
27
|
-
id:
|
|
28
|
-
label:
|
|
29
|
-
labelHidden:
|
|
25
|
+
/* @__PURE__ */ i(o.Input, {
|
|
26
|
+
id: c,
|
|
27
|
+
render: /* @__PURE__ */ i(n, {
|
|
28
|
+
id: c,
|
|
29
|
+
label: T("label", p),
|
|
30
|
+
labelHidden: m,
|
|
30
31
|
kind: "search",
|
|
31
|
-
clearable:
|
|
32
|
-
clearLabel:
|
|
33
|
-
placeholder:
|
|
34
|
-
...
|
|
32
|
+
clearable: g,
|
|
33
|
+
..._ === void 0 ? {} : { clearLabel: _ },
|
|
34
|
+
placeholder: T("placeholder", h),
|
|
35
|
+
...x ? { size: x } : {}
|
|
35
36
|
})
|
|
36
37
|
}),
|
|
37
|
-
/* @__PURE__ */
|
|
38
|
+
/* @__PURE__ */ i(o.List, {
|
|
38
39
|
className: "docs-search__results",
|
|
39
|
-
"aria-label":
|
|
40
|
-
children: (e) => /* @__PURE__ */
|
|
40
|
+
"aria-label": T("results", v),
|
|
41
|
+
children: (e) => /* @__PURE__ */ i(o.Item, {
|
|
41
42
|
value: e,
|
|
42
43
|
className: "docs-search__result",
|
|
43
|
-
onClick: () =>
|
|
44
|
-
render: (t) =>
|
|
44
|
+
onClick: () => C?.(e),
|
|
45
|
+
render: (t) => S({
|
|
45
46
|
...t,
|
|
46
47
|
href: e.href,
|
|
47
48
|
className: t.className ?? "docs-search__result",
|
|
48
|
-
children: /* @__PURE__ */
|
|
49
|
-
e.product && /* @__PURE__ */
|
|
49
|
+
children: /* @__PURE__ */ a(r, { children: [
|
|
50
|
+
e.product && /* @__PURE__ */ i("span", {
|
|
50
51
|
className: "docs-search__result-product",
|
|
51
52
|
children: e.product
|
|
52
53
|
}),
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
+
/* @__PURE__ */ i("span", {
|
|
54
55
|
className: "docs-search__result-title",
|
|
55
56
|
children: e.title
|
|
56
57
|
}),
|
|
57
|
-
e.excerpt && /* @__PURE__ */
|
|
58
|
+
e.excerpt && /* @__PURE__ */ i("span", {
|
|
58
59
|
className: "docs-search__result-excerpt",
|
|
59
60
|
children: e.excerpt
|
|
60
61
|
})
|
|
@@ -62,17 +63,17 @@ function s({ id: s = "docs-search", query: c, onQueryChange: l, results: u, load
|
|
|
62
63
|
})
|
|
63
64
|
}, e.href)
|
|
64
65
|
}),
|
|
65
|
-
|
|
66
|
+
E && /* @__PURE__ */ a("p", {
|
|
66
67
|
className: "docs-search__status",
|
|
67
68
|
role: "status",
|
|
68
|
-
children: [
|
|
69
|
+
children: [f && /* @__PURE__ */ i(t, {
|
|
69
70
|
size: "sm",
|
|
70
71
|
"aria-hidden": !0
|
|
71
|
-
}),
|
|
72
|
+
}), E]
|
|
72
73
|
})
|
|
73
74
|
]
|
|
74
75
|
})
|
|
75
76
|
});
|
|
76
77
|
}
|
|
77
78
|
//#endregion
|
|
78
|
-
export {
|
|
79
|
+
export { c as DocsSearch };
|
package/dist/filter-bar.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.filter-bar{gap:var(--filter-bar-gap);flex-direction:column;display:flex}.filter-bar__search{inline-size:100%}.filter-bar__row{
|
|
1
|
+
.filter-bar{gap:var(--filter-bar-gap);flex-direction:column;display:flex}.filter-bar__search{inline-size:100%}.filter-bar__row{column-gap:var(--filter-bar-column-gap);row-gap:var(--filter-bar-row-gap);grid-template-columns:1fr;display:grid}.filter-bar__filters{display:contents}.filter-bar__filter{min-inline-size:0}.filter-bar__actions{align-items:stretch;gap:var(--filter-bar-actions-gap);flex-direction:column;min-inline-size:0;display:flex}.filter-bar__actions>*{inline-size:100%}@media (width>=768px){.filter-bar__row{grid-template-columns:repeat(auto-fill, minmax(min(var(--filter-bar-column-min-inline-size), 100%), 1fr))}.filter-bar__actions{flex-flow:wrap;align-items:center}.filter-bar__actions>*{inline-size:auto}:is(.filter-bar__row:has(.label:not(.visually-hidden)) .filter-bar__filter:not(:has(.label:not(.visually-hidden))),.filter-bar__row:has(.label:not(.visually-hidden))>.filter-bar__actions){align-self:start;padding-block-start:var(--filter-bar-label-offset)}.filter-bar__row:has(.label:not(.visually-hidden)) .filter-bar__filter:not(:has(.label:not(.visually-hidden))){block-size:calc(var(--filter-bar-label-offset) + var(--filter-bar-control-block-size));flex-direction:column;justify-content:center;display:flex}.filter-bar__row:has(.label:not(.visually-hidden))>.filter-bar__actions{min-block-size:calc(var(--filter-bar-label-offset) + var(--filter-bar-control-block-size))}}
|
package/dist/filter-bar.js
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import './filter-bar.css';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
3
|
+
import { n as e } from "./_shared/brandmessagescontext.js";
|
|
4
|
+
import { Children as t } from "react";
|
|
5
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
6
|
//#region src/stories/molecules/FilterBar/FilterBar.tsx
|
|
5
|
-
function
|
|
6
|
-
let
|
|
7
|
-
return /* @__PURE__ */
|
|
8
|
-
className: ["filter-bar",
|
|
7
|
+
function i({ search: i, children: a, actions: o, ariaLabel: s, className: c, ...l }) {
|
|
8
|
+
let u = e("filterBar"), d = t.toArray(a);
|
|
9
|
+
return /* @__PURE__ */ r("div", {
|
|
10
|
+
className: ["filter-bar", c].filter(Boolean).join(" "),
|
|
9
11
|
role: "search",
|
|
10
|
-
"aria-label":
|
|
11
|
-
...
|
|
12
|
-
children: [
|
|
12
|
+
"aria-label": u("label", s),
|
|
13
|
+
...l,
|
|
14
|
+
children: [i && /* @__PURE__ */ n("div", {
|
|
13
15
|
className: "filter-bar__search",
|
|
14
|
-
children:
|
|
15
|
-
}), (
|
|
16
|
+
children: i
|
|
17
|
+
}), (d.length > 0 || o) && /* @__PURE__ */ r("div", {
|
|
16
18
|
className: "filter-bar__row",
|
|
17
|
-
children: [
|
|
19
|
+
children: [d.length > 0 && /* @__PURE__ */ n("div", {
|
|
18
20
|
className: "filter-bar__filters",
|
|
19
|
-
children:
|
|
21
|
+
children: d.map((e, t) => /* @__PURE__ */ n("div", {
|
|
20
22
|
className: "filter-bar__filter",
|
|
21
23
|
children: e
|
|
22
|
-
},
|
|
23
|
-
}),
|
|
24
|
+
}, t))
|
|
25
|
+
}), o && /* @__PURE__ */ n("div", {
|
|
24
26
|
className: "filter-bar__actions",
|
|
25
|
-
children:
|
|
27
|
+
children: o
|
|
26
28
|
})]
|
|
27
29
|
})]
|
|
28
30
|
});
|
|
29
31
|
}
|
|
30
32
|
//#endregion
|
|
31
|
-
export {
|
|
33
|
+
export { i as FilterBar };
|
package/dist/input-field.js
CHANGED
|
@@ -1,100 +1,101 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import './input-field.css';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
3
|
+
import { n as e } from "./_shared/brandmessagescontext.js";
|
|
4
|
+
import { Icon as t } from "./icon.js";
|
|
5
|
+
import { n } from "./_shared/form-size.js";
|
|
6
|
+
import { ErrorText as r } from "./error-text.js";
|
|
7
|
+
import { Input as i } from "./input.js";
|
|
8
|
+
import { Label as a } from "./label.js";
|
|
9
|
+
import { n as o } from "./_shared/field-labels.js";
|
|
10
|
+
import { forwardRef as s, useImperativeHandle as c, useRef as l, useState as u } from "react";
|
|
11
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
11
12
|
//#region src/stories/molecules/InputField/InputField.tsx
|
|
12
|
-
var
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
].filter(Boolean).join(" ") || void 0,
|
|
18
|
-
|
|
19
|
-
let [
|
|
20
|
-
function
|
|
21
|
-
|
|
13
|
+
var p = s(function({ id: s, label: p, labelHidden: m, name: h, type: g, kind: _ = "text", clearable: v = !1, clearLabel: y, onClear: b, placeholder: x, value: S, defaultValue: C, disabled: w, readOnly: T, size: E, error: D = !1, errorMessage: O, helperText: k, onChange: A, onBlur: j, onFocus: M, className: N, ...P }, F) {
|
|
14
|
+
let I = e("inputField"), L = o(m), R = n(E), z = O ? `${s}-error` : void 0, B = k ? `${s}-helper` : void 0, V = [
|
|
15
|
+
z,
|
|
16
|
+
B,
|
|
17
|
+
P["aria-describedby"]
|
|
18
|
+
].filter(Boolean).join(" ") || void 0, H = D || !!O, U = _ === "search", W = l(null);
|
|
19
|
+
c(F, () => W.current);
|
|
20
|
+
let [G, K] = u(() => (C ?? "") !== ""), q = U && v && (S === void 0 ? G : S !== "") && !w && !T;
|
|
21
|
+
function J(e) {
|
|
22
|
+
S === void 0 && K(e.target.value !== ""), A?.(e);
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
-
let e =
|
|
25
|
-
e && ((Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set)?.call(e, ""), e.dispatchEvent(new Event("input", { bubbles: !0 })),
|
|
24
|
+
function Y() {
|
|
25
|
+
let e = W.current;
|
|
26
|
+
e && ((Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set)?.call(e, ""), e.dispatchEvent(new Event("input", { bubbles: !0 })), K(!1), e.focus(), b?.());
|
|
26
27
|
}
|
|
27
|
-
let
|
|
28
|
-
ref:
|
|
29
|
-
...
|
|
28
|
+
let X = /* @__PURE__ */ d(i, {
|
|
29
|
+
ref: W,
|
|
30
|
+
...U ? {
|
|
30
31
|
type: "text",
|
|
31
32
|
autoComplete: "off",
|
|
32
33
|
enterKeyHint: "search"
|
|
33
|
-
} : { type:
|
|
34
|
-
...
|
|
35
|
-
id:
|
|
36
|
-
name:
|
|
37
|
-
placeholder:
|
|
38
|
-
value:
|
|
39
|
-
defaultValue:
|
|
40
|
-
disabled:
|
|
41
|
-
readOnly:
|
|
42
|
-
size:
|
|
43
|
-
error:
|
|
44
|
-
"aria-describedby":
|
|
45
|
-
onChange:
|
|
46
|
-
onBlur:
|
|
47
|
-
onFocus:
|
|
34
|
+
} : { type: g },
|
|
35
|
+
...P,
|
|
36
|
+
id: s,
|
|
37
|
+
name: h,
|
|
38
|
+
placeholder: x ?? (L ? p : void 0),
|
|
39
|
+
value: S,
|
|
40
|
+
defaultValue: C,
|
|
41
|
+
disabled: w,
|
|
42
|
+
readOnly: T,
|
|
43
|
+
size: R,
|
|
44
|
+
error: H,
|
|
45
|
+
"aria-describedby": V,
|
|
46
|
+
onChange: J,
|
|
47
|
+
onBlur: j,
|
|
48
|
+
onFocus: M
|
|
48
49
|
});
|
|
49
|
-
return /* @__PURE__ */
|
|
50
|
-
className: ["input-field",
|
|
50
|
+
return /* @__PURE__ */ f("div", {
|
|
51
|
+
className: ["input-field", N].filter(Boolean).join(" "),
|
|
51
52
|
children: [
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
htmlFor:
|
|
54
|
-
hidden:
|
|
55
|
-
size:
|
|
56
|
-
children:
|
|
53
|
+
/* @__PURE__ */ d(a, {
|
|
54
|
+
htmlFor: s,
|
|
55
|
+
hidden: L,
|
|
56
|
+
size: R,
|
|
57
|
+
children: p
|
|
57
58
|
}),
|
|
58
|
-
|
|
59
|
+
U ? /* @__PURE__ */ f("div", {
|
|
59
60
|
className: [
|
|
60
61
|
"input-field__search",
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
R === "md" ? "" : `input-field__search--${R}`,
|
|
63
|
+
v ? "input-field__search--clearable" : ""
|
|
63
64
|
].filter(Boolean).join(" "),
|
|
64
65
|
children: [
|
|
65
|
-
/* @__PURE__ */
|
|
66
|
+
/* @__PURE__ */ d("span", {
|
|
66
67
|
className: "input-field__search-icon",
|
|
67
68
|
"aria-hidden": "true",
|
|
68
|
-
children: /* @__PURE__ */
|
|
69
|
+
children: /* @__PURE__ */ d(t, {
|
|
69
70
|
name: "search",
|
|
70
71
|
className: "input-field__search-glyph"
|
|
71
72
|
})
|
|
72
73
|
}),
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
X,
|
|
75
|
+
q && /* @__PURE__ */ d("button", {
|
|
75
76
|
type: "button",
|
|
76
77
|
className: "input-field__clear",
|
|
77
|
-
"aria-label":
|
|
78
|
-
"aria-controls":
|
|
79
|
-
onClick:
|
|
80
|
-
children: /* @__PURE__ */
|
|
78
|
+
"aria-label": I("clear", y),
|
|
79
|
+
"aria-controls": s,
|
|
80
|
+
onClick: Y,
|
|
81
|
+
children: /* @__PURE__ */ d(t, {
|
|
81
82
|
name: "close",
|
|
82
83
|
className: "input-field__search-glyph"
|
|
83
84
|
})
|
|
84
85
|
})
|
|
85
86
|
]
|
|
86
|
-
}) :
|
|
87
|
-
|
|
88
|
-
id:
|
|
89
|
-
children:
|
|
87
|
+
}) : X,
|
|
88
|
+
O && /* @__PURE__ */ d(r, {
|
|
89
|
+
id: z,
|
|
90
|
+
children: O
|
|
90
91
|
}),
|
|
91
|
-
|
|
92
|
-
id:
|
|
92
|
+
k && /* @__PURE__ */ d("span", {
|
|
93
|
+
id: B,
|
|
93
94
|
className: "input-field__helper",
|
|
94
|
-
children:
|
|
95
|
+
children: k
|
|
95
96
|
})
|
|
96
97
|
]
|
|
97
98
|
});
|
|
98
99
|
});
|
|
99
100
|
//#endregion
|
|
100
|
-
export {
|
|
101
|
+
export { p as InputField };
|