@tcn/ui 0.0.1 → 0.0.2
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/dist/drawer_bottom.css +1 -1
- package/dist/drawer_end.css +1 -1
- package/dist/drawer_start.css +1 -1
- package/dist/drawer_top.css +1 -1
- package/dist/form/index.d.ts +6 -0
- package/dist/form/index.d.ts.map +1 -1
- package/dist/form/index.js +16 -4
- package/dist/form/index.js.map +1 -1
- package/dist/h_body.css +1 -0
- package/dist/inputs/phone_number_input/phone_number_input.d.ts.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_input.js +60 -51
- package/dist/inputs/phone_number_input/phone_number_input.js.map +1 -1
- package/dist/layouts/body/h_body.d.ts +6 -0
- package/dist/layouts/body/h_body.d.ts.map +1 -0
- package/dist/layouts/body/h_body.js +20 -0
- package/dist/layouts/body/h_body.js.map +1 -0
- package/dist/layouts/body/v_body.d.ts +6 -0
- package/dist/layouts/body/v_body.d.ts.map +1 -0
- package/dist/layouts/body/v_body.js +20 -0
- package/dist/layouts/body/v_body.js.map +1 -0
- package/dist/layouts/index.d.ts +2 -4
- package/dist/layouts/index.d.ts.map +1 -1
- package/dist/layouts/index.js +20 -24
- package/dist/layouts/index.js.map +1 -1
- package/dist/overlay/index.d.ts +6 -0
- package/dist/overlay/index.d.ts.map +1 -0
- package/dist/overlay/index.js +14 -0
- package/dist/overlay/index.js.map +1 -0
- package/dist/surfaces/drawers/drawer_bottom/drawer_bottom.d.ts.map +1 -0
- package/dist/{layouts → surfaces}/drawers/drawer_bottom/drawer_bottom.js +1 -1
- package/dist/surfaces/drawers/drawer_bottom/drawer_bottom.js.map +1 -0
- package/dist/surfaces/drawers/drawer_end/drawer_end.d.ts.map +1 -0
- package/dist/{layouts → surfaces}/drawers/drawer_end/drawer_end.js +2 -2
- package/dist/surfaces/drawers/drawer_end/drawer_end.js.map +1 -0
- package/dist/surfaces/drawers/drawer_start/drawer_start.d.ts.map +1 -0
- package/dist/{layouts → surfaces}/drawers/drawer_start/drawer_start.js +1 -1
- package/dist/surfaces/drawers/drawer_start/drawer_start.js.map +1 -0
- package/dist/surfaces/drawers/drawer_top/drawer_top.d.ts.map +1 -0
- package/dist/{layouts → surfaces}/drawers/drawer_top/drawer_top.js +1 -1
- package/dist/surfaces/drawers/drawer_top/drawer_top.js.map +1 -0
- package/dist/surfaces/index.d.ts +4 -0
- package/dist/surfaces/index.d.ts.map +1 -1
- package/dist/surfaces/index.js +20 -12
- package/dist/surfaces/index.js.map +1 -1
- package/dist/v_body.css +1 -0
- package/package.json +1 -1
- package/src/form/index.ts +6 -0
- package/src/inputs/phone_number_input/phone_number_input.tsx +9 -4
- package/src/layouts/body/h_body.module.css +4 -0
- package/src/layouts/body/h_body.tsx +22 -0
- package/src/layouts/body/v_body.module.css +4 -0
- package/src/layouts/body/v_body.tsx +22 -0
- package/src/layouts/index.ts +2 -4
- package/src/overlay/index.ts +5 -0
- package/src/surfaces/index.ts +4 -0
- package/dist/layouts/drawers/drawer_bottom/drawer_bottom.d.ts.map +0 -1
- package/dist/layouts/drawers/drawer_bottom/drawer_bottom.js.map +0 -1
- package/dist/layouts/drawers/drawer_end/drawer_end.d.ts.map +0 -1
- package/dist/layouts/drawers/drawer_end/drawer_end.js.map +0 -1
- package/dist/layouts/drawers/drawer_start/drawer_start.d.ts.map +0 -1
- package/dist/layouts/drawers/drawer_start/drawer_start.js.map +0 -1
- package/dist/layouts/drawers/drawer_top/drawer_top.d.ts.map +0 -1
- package/dist/layouts/drawers/drawer_top/drawer_top.js.map +0 -1
- /package/dist/{layouts → surfaces}/drawers/drawer_bottom/drawer_bottom.d.ts +0 -0
- /package/dist/{layouts → surfaces}/drawers/drawer_end/drawer_end.d.ts +0 -0
- /package/dist/{layouts → surfaces}/drawers/drawer_start/drawer_start.d.ts +0 -0
- /package/dist/{layouts → surfaces}/drawers/drawer_top/drawer_top.d.ts +0 -0
- /package/src/{layouts → surfaces}/drawers/__stories__/drawers.stories.tsx +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_bottom/drawer_bottom.module.css +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_bottom/drawer_bottom.tsx +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_end/drawer_end.module.css +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_end/drawer_end.tsx +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_start/drawer_start.module.css +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_start/drawer_start.tsx +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_top/drawer_top.module.css +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_top/drawer_top.tsx +0 -0
package/dist/drawer_bottom.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._drawerBottom_9359033{background-color:var(--background-color-primary)}
|
package/dist/drawer_end.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._drawerEnd_39acb27{background-color:var(--background-color-primary)}
|
package/dist/drawer_start.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._drawerStart_3abbf56{background-color:var(--background-color-primary)}
|
package/dist/drawer_top.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._drawerBottom_7a0635a{background-color:var(--background-color-primary)}
|
package/dist/form/index.d.ts
CHANGED
|
@@ -3,4 +3,10 @@ export * from './field_presenters/field_presenter.js';
|
|
|
3
3
|
export * from './field_presenters/options_field_presenter.js';
|
|
4
4
|
export * from './field_set/field_set.js';
|
|
5
5
|
export * from './form_field.js';
|
|
6
|
+
export * from './field/v_field/v_field.js';
|
|
7
|
+
export * from './field/h_field/h_field.js';
|
|
8
|
+
export * from './field/field.js';
|
|
9
|
+
export * from './field/common/field_header.js';
|
|
10
|
+
export * from './field/common/field_label.js';
|
|
11
|
+
export * from './field/common/field_description.js';
|
|
6
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/form/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/form/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,uCAAuC,CAAC;AACtD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/form/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,uCAAuC,CAAC;AACtD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC"}
|
package/dist/form/index.js
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
import { FormField as o } from "./form_field.js";
|
|
2
2
|
import { FieldPresenter as i } from "./field_presenters/field_presenter.js";
|
|
3
|
-
import { OptionsFieldPresenter as
|
|
4
|
-
import { FieldSet as
|
|
3
|
+
import { OptionsFieldPresenter as d } from "./field_presenters/options_field_presenter.js";
|
|
4
|
+
import { FieldSet as m } from "./field_set/field_set.js";
|
|
5
|
+
import { VField as f } from "./field/v_field/v_field.js";
|
|
6
|
+
import { HField as n } from "./field/h_field/h_field.js";
|
|
7
|
+
import { Field as a } from "./field/field.js";
|
|
8
|
+
import { FieldHeader as P } from "./field/common/field_header.js";
|
|
9
|
+
import { FieldLabel as c } from "./field/common/field_label.js";
|
|
10
|
+
import { FieldDescription as L } from "./field/common/field_description.js";
|
|
5
11
|
export {
|
|
12
|
+
a as Field,
|
|
13
|
+
L as FieldDescription,
|
|
14
|
+
P as FieldHeader,
|
|
15
|
+
c as FieldLabel,
|
|
6
16
|
i as FieldPresenter,
|
|
7
|
-
|
|
17
|
+
m as FieldSet,
|
|
8
18
|
o as FormField,
|
|
9
|
-
|
|
19
|
+
n as HField,
|
|
20
|
+
d as OptionsFieldPresenter,
|
|
21
|
+
f as VField
|
|
10
22
|
};
|
|
11
23
|
//# sourceMappingURL=index.js.map
|
package/dist/form/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
package/dist/h_body.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._h-body_d56f4f1{gap:var(--gap-medium);padding:var(--padding-medium)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone_number_input.d.ts","sourceRoot":"","sources":["../../../src/inputs/phone_number_input/phone_number_input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEnE,OAAO,KAQN,MAAM,OAAO,CAAC;AAUf,OAAO,EAAU,WAAW,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"phone_number_input.d.ts","sourceRoot":"","sources":["../../../src/inputs/phone_number_input/phone_number_input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEnE,OAAO,KAQN,MAAM,OAAO,CAAC;AAUf,OAAO,EAAU,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAuF3D,MAAM,WAAW,qBACf,SAAQ,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,UAAU,CAAC;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,gBAAgB,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAChD,mBAAmB,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAClD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC;CAChF;AAED,eAAO,MAAM,gBAAgB,2FAsN3B,CAAC"}
|
|
@@ -22,17 +22,28 @@ import '../../phone_number_input.css';const me = "_phone-number-input_5c4483d",
|
|
|
22
22
|
value: o.code,
|
|
23
23
|
keywords: o.keywords
|
|
24
24
|
}));
|
|
25
|
-
O.sort((o,
|
|
25
|
+
O.sort((o, n) => parseInt(o.value) - parseInt(n.value));
|
|
26
26
|
const x = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map();
|
|
27
27
|
E.forEach((o) => {
|
|
28
28
|
h.set(o.code, o), x.has(o.prefix) ? x.get(o.prefix)?.push(o) : x.set(o.prefix, [o]);
|
|
29
29
|
});
|
|
30
30
|
function be(o) {
|
|
31
31
|
if (o != null) {
|
|
32
|
-
const
|
|
33
|
-
return o.forEach((
|
|
34
|
-
t
|
|
35
|
-
}), O.filter((
|
|
32
|
+
const n = {};
|
|
33
|
+
return o.forEach((t) => {
|
|
34
|
+
n[t] = !0;
|
|
35
|
+
}), O.filter((t) => !!n[t.value]).map((t) => /* @__PURE__ */ c(
|
|
36
|
+
L,
|
|
37
|
+
{
|
|
38
|
+
value: t.value,
|
|
39
|
+
label: t.selectedLabel,
|
|
40
|
+
keywords: t.keywords,
|
|
41
|
+
children: t.optionLabel
|
|
42
|
+
},
|
|
43
|
+
t.value
|
|
44
|
+
));
|
|
45
|
+
} else
|
|
46
|
+
return O.map((n) => /* @__PURE__ */ c(
|
|
36
47
|
L,
|
|
37
48
|
{
|
|
38
49
|
value: n.value,
|
|
@@ -40,27 +51,25 @@ function be(o) {
|
|
|
40
51
|
keywords: n.keywords,
|
|
41
52
|
children: n.optionLabel
|
|
42
53
|
},
|
|
43
|
-
|
|
54
|
+
n.value
|
|
44
55
|
));
|
|
45
|
-
} else
|
|
46
|
-
return O.map((t, n) => /* @__PURE__ */ c(L, { value: t.value, label: t.selectedLabel, keywords: t.keywords, children: t.optionLabel }, n));
|
|
47
56
|
}
|
|
48
|
-
function I(o,
|
|
49
|
-
for (let
|
|
50
|
-
const g = o.slice(0,
|
|
57
|
+
function I(o, n, t) {
|
|
58
|
+
for (let p = 5; p > 1; p--) {
|
|
59
|
+
const g = o.slice(0, p), m = x.get(g);
|
|
51
60
|
if (m != null) {
|
|
52
61
|
const s = m.find(
|
|
53
|
-
(f) => f.code ===
|
|
62
|
+
(f) => f.code === n
|
|
54
63
|
);
|
|
55
64
|
return s ?? m[0];
|
|
56
65
|
}
|
|
57
66
|
}
|
|
58
|
-
return h.get(
|
|
67
|
+
return h.get(t.toUpperCase()) || h.get("US");
|
|
59
68
|
}
|
|
60
69
|
const Re = ee.forwardRef(function({
|
|
61
|
-
value:
|
|
62
|
-
defaultCountry:
|
|
63
|
-
onChange:
|
|
70
|
+
value: n = "",
|
|
71
|
+
defaultCountry: t = "US",
|
|
72
|
+
onChange: p,
|
|
64
73
|
countrySelectRef: g,
|
|
65
74
|
phoneNumberInputRef: m,
|
|
66
75
|
disabled: s = !1,
|
|
@@ -68,75 +77,75 @@ const Re = ee.forwardRef(function({
|
|
|
68
77
|
children: V,
|
|
69
78
|
...W
|
|
70
79
|
}, q) {
|
|
71
|
-
const P = oe(
|
|
80
|
+
const P = oe(n), [R, S] = l(
|
|
72
81
|
null
|
|
73
|
-
), $ = R != null, [i, B] = l(
|
|
74
|
-
|
|
82
|
+
), $ = R != null, [i, B] = l(t), v = I(
|
|
83
|
+
n,
|
|
75
84
|
i,
|
|
76
|
-
|
|
85
|
+
t
|
|
77
86
|
), [b, M] = l(() => {
|
|
78
|
-
const e =
|
|
87
|
+
const e = n.split(v.prefix)[1];
|
|
79
88
|
return e == null ? "" : w(e);
|
|
80
|
-
}),
|
|
89
|
+
}), C = H(() => ne.toArray(V).filter(
|
|
81
90
|
(e) => te(e) && e.type === L
|
|
82
|
-
), [V]),
|
|
91
|
+
), [V]), F = C.length > 0, [U, d] = l(v.code), [D, k] = l([
|
|
83
92
|
...E[0].masks
|
|
84
93
|
]), G = H(() => be(f), [f]);
|
|
85
94
|
function J(e) {
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
95
|
+
const r = h.get(e);
|
|
96
|
+
if (r == null || (d(r.code), k([...r.masks]), B(r.code), b == null))
|
|
88
97
|
return;
|
|
89
|
-
const
|
|
90
|
-
P.current =
|
|
98
|
+
const u = `${r.prefix}${w(b)}`;
|
|
99
|
+
P.current = u, p && p(u);
|
|
91
100
|
}
|
|
92
101
|
T(() => {
|
|
93
102
|
const e = I(
|
|
94
|
-
|
|
103
|
+
n,
|
|
95
104
|
i,
|
|
96
|
-
|
|
105
|
+
t
|
|
97
106
|
);
|
|
98
107
|
d(e.code), k([...e.masks]), B(e.code);
|
|
99
|
-
}, [
|
|
108
|
+
}, [n, i, t]);
|
|
100
109
|
function K(e) {
|
|
101
|
-
const
|
|
102
|
-
P.current = N, b !== e && M(e),
|
|
110
|
+
const r = h.get(U)?.prefix, u = w(e), N = r + u;
|
|
111
|
+
P.current = N, b !== e && M(e), p && p(N);
|
|
103
112
|
}
|
|
104
113
|
function Q(e) {
|
|
105
114
|
S($ ? null : e.currentTarget);
|
|
106
115
|
}
|
|
107
|
-
function
|
|
116
|
+
function j() {
|
|
108
117
|
S(null);
|
|
109
118
|
}
|
|
110
119
|
function X(e) {
|
|
111
|
-
_(e),
|
|
120
|
+
_(e), j();
|
|
112
121
|
}
|
|
113
122
|
function Y(e) {
|
|
114
123
|
if (e.startsWith("+")) {
|
|
115
|
-
const
|
|
124
|
+
const r = I(
|
|
116
125
|
e,
|
|
117
126
|
i,
|
|
118
|
-
|
|
127
|
+
t
|
|
119
128
|
);
|
|
120
|
-
d(
|
|
121
|
-
const
|
|
122
|
-
return M(
|
|
129
|
+
d(r.code), k([...r.masks]);
|
|
130
|
+
const u = e.split(r.prefix)[1];
|
|
131
|
+
return M(u), u;
|
|
123
132
|
}
|
|
124
133
|
return e;
|
|
125
134
|
}
|
|
126
135
|
const _ = re(
|
|
127
136
|
(e) => {
|
|
128
|
-
const
|
|
137
|
+
const r = P.current, u = I(
|
|
129
138
|
e,
|
|
130
139
|
i,
|
|
131
|
-
|
|
132
|
-
), N = e.split(
|
|
133
|
-
d(
|
|
140
|
+
t
|
|
141
|
+
), N = e.split(u.prefix)[1];
|
|
142
|
+
d(u.code), k([...u.masks]), B(u.code), r !== e && (M(N), p && p(e));
|
|
134
143
|
},
|
|
135
|
-
[
|
|
144
|
+
[t, i, p]
|
|
136
145
|
);
|
|
137
146
|
return T(() => {
|
|
138
|
-
_(
|
|
139
|
-
}, [
|
|
147
|
+
_(n);
|
|
148
|
+
}, [n, _]), /* @__PURE__ */ z(
|
|
140
149
|
A,
|
|
141
150
|
{
|
|
142
151
|
ref: q,
|
|
@@ -153,7 +162,7 @@ const Re = ee.forwardRef(function({
|
|
|
153
162
|
),
|
|
154
163
|
ref: g,
|
|
155
164
|
width: "auto",
|
|
156
|
-
value:
|
|
165
|
+
value: U,
|
|
157
166
|
onChange: J,
|
|
158
167
|
disabled: s,
|
|
159
168
|
"data-is-disabled": s,
|
|
@@ -169,12 +178,12 @@ const Re = ee.forwardRef(function({
|
|
|
169
178
|
onChange: K,
|
|
170
179
|
disabled: s,
|
|
171
180
|
"data-is-disabled": s,
|
|
172
|
-
"data-has-phone-book":
|
|
181
|
+
"data-has-phone-book": F,
|
|
173
182
|
className: y(a["phone-number-input"], "phone-number-input"),
|
|
174
183
|
preparePasteValue: Y
|
|
175
184
|
}
|
|
176
185
|
) }),
|
|
177
|
-
|
|
186
|
+
F && /* @__PURE__ */ z(Z, { children: [
|
|
178
187
|
/* @__PURE__ */ c(
|
|
179
188
|
ue,
|
|
180
189
|
{
|
|
@@ -193,9 +202,9 @@ const Re = ee.forwardRef(function({
|
|
|
193
202
|
{
|
|
194
203
|
anchorElement: R,
|
|
195
204
|
onOptionSelect: X,
|
|
196
|
-
onClose:
|
|
205
|
+
onClose: j,
|
|
197
206
|
noSuggestionMessage: "No phone numbers found",
|
|
198
|
-
children:
|
|
207
|
+
children: C
|
|
199
208
|
}
|
|
200
209
|
)
|
|
201
210
|
] })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone_number_input.js","sources":["../../../src/inputs/phone_number_input/phone_number_input.tsx"],"sourcesContent":["import { HStack, type HStackProps } from '../../stacks/h_stack.js';\nimport classNames from 'classnames';\nimport React, {\n useCallback,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n Children,\n isValidElement,\n} from 'react';\nimport { SlimButton } from '../../actions/index.js';\nimport { Select } from '../select/select.js';\nimport { MaskInput } from '../mask_input/mask_input.js';\nimport {\n CountryPhoneInformation,\n countriesPhoneInformation,\n} from './countries_phone_information.js';\nimport styles from './phone_number_input.module.css';\nimport { NotebookIcon } from '@tcn/icons/notebook_icon.js';\nimport { Option, OptionProps } from '../options/option.js';\nimport { SuggestionList } from '../suggestions/suggestion_list.js';\nimport { stripNonNumericAfterCountryCode } from './utils.js';\n\nconst countryList = countriesPhoneInformation.map(i => ({\n name: i.name,\n selectedLabel: i.prefix,\n optionLabel: `${i.prefix} (${i.code}) ${i.unicodeFlag}`,\n value: i.code,\n keywords: i.keywords,\n}));\n\ncountryList.sort((a, b) => parseInt(a.value) - parseInt(b.value));\n\nconst countryPrefixMap: Map<string, CountryPhoneInformation[]> = new Map();\nconst countryCodeMap: Map<string, CountryPhoneInformation> = new Map();\ncountriesPhoneInformation.forEach(i => {\n countryCodeMap.set(i.code, i);\n if (countryPrefixMap.has(i.prefix)) {\n countryPrefixMap.get(i.prefix)?.push(i);\n } else {\n countryPrefixMap.set(i.prefix, [i]);\n }\n});\n\nfunction createCountryOptions(allowedCountryCodes?: string[]) {\n if (allowedCountryCodes != null) {\n const allowedMap: Record<string, boolean> = {};\n allowedCountryCodes.forEach(c => {\n allowedMap[c] = true;\n });\n return countryList\n .filter(c => Boolean(allowedMap[c.value]))\n .map((i, index) => {\n return (\n <Option\n key={index}\n value={i.value}\n label={i.selectedLabel}\n keywords={i.keywords}\n >\n {i.optionLabel}\n </Option>\n );\n });\n } else {\n return countryList.map((i, index) => {\n return (\n <Option key={index} value={i.value} label={i.selectedLabel} keywords={i.keywords}>\n {i.optionLabel}\n </Option>\n );\n });\n }\n}\n\nfunction getCountryCodeFromValue(\n value: string,\n previousCountry: string,\n defaultCountry: string\n) {\n for (let x = 5; x > 1; x--) {\n const prefix = value.slice(0, x);\n const countriesInformation = countryPrefixMap.get(prefix);\n\n if (countriesInformation != null) {\n const countryInformation = countriesInformation.find(\n c => c.code === previousCountry\n );\n\n if (countryInformation != null) {\n return countryInformation;\n } else {\n return countriesInformation[0];\n }\n }\n }\n\n return (countryCodeMap.get(defaultCountry.toUpperCase()) ||\n countryCodeMap.get('US')) as CountryPhoneInformation;\n}\n\nexport interface PhoneNumberInputProps\n extends Omit<HStackProps, 'onChange' | 'children'> {\n value?: string;\n defaultCountry?: string;\n onChange?: (value: string) => void;\n countrySelectRef?: React.Ref<HTMLButtonElement>;\n phoneNumberInputRef?: React.Ref<HTMLInputElement>;\n disabled?: boolean;\n allowedCountryCodes?: string[];\n children?: React.ReactElement<OptionProps> | React.ReactElement<OptionProps>[];\n}\n\nexport const PhoneNumberInput = React.forwardRef(function PhoneNumberInput(\n {\n value = '',\n defaultCountry = 'US',\n onChange,\n countrySelectRef: countryRef,\n phoneNumberInputRef: numberRef,\n disabled = false,\n allowedCountryCodes,\n children,\n ...props\n }: PhoneNumberInputProps,\n ref: React.Ref<HTMLElement>\n) {\n const lastOutputValueRef = useRef(value);\n const [phoneBookElement, setPhoneBookElement] = useState<HTMLButtonElement | null>(\n null\n );\n const isPhoneBookOpen = phoneBookElement != null;\n const [selectedCountry, setSelectedCountry] = useState(defaultCountry);\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n const [phoneNumber, setPhoneNumber] = useState(() => {\n const phoneNumber = value.split(countryInformation.prefix)[1];\n\n return phoneNumber == null ? '' : stripNonNumericAfterCountryCode(phoneNumber);\n });\n\n // Extract valid Option components from children\n const phoneBookOptions = useMemo(() => {\n return Children.toArray(children).filter(\n (child): child is React.ReactElement<OptionProps> =>\n isValidElement(child) && child.type === Option\n );\n }, [children]);\n\n const showPhoneBook = phoneBookOptions.length > 0;\n const [countryCode, setCountryCode] = useState(countryInformation.code);\n const [currentMasks, setCurrentMasks] = useState([\n ...countriesPhoneInformation[0].masks,\n ]);\n\n const countryOptions = useMemo(() => {\n return createCountryOptions(allowedCountryCodes);\n }, [allowedCountryCodes]);\n\n function changeCountry(countryCodeValue: string) {\n const countryInformation = countryCodeMap.get(countryCodeValue);\n\n if (countryInformation == null) {\n return;\n }\n\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n setSelectedCountry(countryInformation.code);\n\n if (phoneNumber == null) {\n return;\n }\n\n const value = `${countryInformation.prefix}${stripNonNumericAfterCountryCode(phoneNumber)}`;\n lastOutputValueRef.current = value;\n onChange && onChange(value);\n }\n\n useLayoutEffect(() => {\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n setSelectedCountry(countryInformation.code);\n }, [value, selectedCountry, defaultCountry]);\n\n function transformValue(newPhoneNumber: string) {\n const countryPrefix = countryCodeMap.get(countryCode)?.prefix;\n const lineNumber = stripNonNumericAfterCountryCode(newPhoneNumber);\n const outputValue = countryPrefix + lineNumber;\n\n lastOutputValueRef.current = outputValue;\n phoneNumber !== newPhoneNumber && setPhoneNumber(newPhoneNumber);\n onChange && onChange(outputValue);\n }\n\n function togglePhoneBook(e: React.MouseEvent<HTMLButtonElement>) {\n if (isPhoneBookOpen) {\n setPhoneBookElement(null);\n } else {\n setPhoneBookElement(e.currentTarget);\n }\n }\n\n function closePhoneBook() {\n setPhoneBookElement(null);\n }\n\n function handlePhoneBookOptionSelect(value: string) {\n // Update the phone number with the selected value\n updatePhoneNumber(value);\n closePhoneBook();\n }\n\n function preparePasteValue(value: string) {\n if (value.startsWith('+')) {\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n\n const phoneNumber = value.split(countryInformation.prefix)[1];\n setPhoneNumber(phoneNumber);\n\n return phoneNumber;\n }\n\n return value;\n }\n\n const updatePhoneNumber = useCallback(\n (value: string) => {\n const oldValue = lastOutputValueRef.current;\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n const phoneNumber = value.split(countryInformation.prefix)[1];\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n setSelectedCountry(countryInformation.code);\n\n if (oldValue !== value) {\n setPhoneNumber(phoneNumber);\n onChange && onChange(value);\n }\n },\n [defaultCountry, selectedCountry, onChange]\n );\n\n useLayoutEffect(() => {\n updatePhoneNumber(value);\n }, [value, updatePhoneNumber]);\n\n return (\n <HStack\n ref={ref}\n className={classNames(styles['phone-number-input'], 'phone-number-input')}\n height=\"auto\"\n {...props}\n >\n <Select\n className={classNames(\n styles['phone-number-input-select'],\n 'phone-number-input-select'\n )}\n ref={countryRef}\n width=\"auto\"\n value={countryCode}\n onChange={changeCountry}\n disabled={disabled}\n data-is-disabled={disabled}\n >\n {countryOptions}\n </Select>\n <HStack width=\"flex\" className={styles['phone-number-input-container']}>\n <MaskInput\n ref={numberRef}\n value={phoneNumber}\n mask={currentMasks}\n onChange={transformValue}\n disabled={disabled}\n data-is-disabled={disabled}\n data-has-phone-book={showPhoneBook}\n className={classNames(styles['phone-number-input'], 'phone-number-input')}\n preparePasteValue={preparePasteValue}\n />\n </HStack>\n {showPhoneBook && (\n <>\n <SlimButton\n disabled={disabled}\n className={classNames(\n styles['phone-number-input-phone-book'],\n 'phone-number-input-phone-book'\n )}\n onClick={togglePhoneBook}\n size=\"md\"\n >\n <NotebookIcon size=\"md\" />\n </SlimButton>\n\n {isPhoneBookOpen && (\n <SuggestionList\n anchorElement={phoneBookElement}\n onOptionSelect={handlePhoneBookOptionSelect}\n onClose={closePhoneBook}\n noSuggestionMessage=\"No phone numbers found\"\n >\n {phoneBookOptions}\n </SuggestionList>\n )}\n </>\n )}\n </HStack>\n );\n});\n"],"names":["countryList","countriesPhoneInformation","i","a","b","countryPrefixMap","countryCodeMap","createCountryOptions","allowedCountryCodes","allowedMap","c","index","jsx","Option","getCountryCodeFromValue","value","previousCountry","defaultCountry","x","prefix","countriesInformation","countryInformation","PhoneNumberInput","React","onChange","countryRef","numberRef","disabled","children","props","ref","lastOutputValueRef","useRef","phoneBookElement","setPhoneBookElement","useState","isPhoneBookOpen","selectedCountry","setSelectedCountry","phoneNumber","setPhoneNumber","stripNonNumericAfterCountryCode","phoneBookOptions","useMemo","Children","child","isValidElement","showPhoneBook","countryCode","setCountryCode","currentMasks","setCurrentMasks","countryOptions","changeCountry","countryCodeValue","useLayoutEffect","transformValue","newPhoneNumber","countryPrefix","lineNumber","outputValue","togglePhoneBook","closePhoneBook","handlePhoneBookOptionSelect","updatePhoneNumber","preparePasteValue","useCallback","oldValue","jsxs","HStack","classNames","styles","Select","MaskInput","Fragment","SlimButton","NotebookIcon","SuggestionList"],"mappings":";;;;;;;;;;;;;;;;;0ZAwBMA,IAAcC,EAA0B,IAAI,CAAAC,OAAM;AAAA,EACtD,MAAMA,EAAE;AAAA,EACR,eAAeA,EAAE;AAAA,EACjB,aAAa,GAAGA,EAAE,MAAM,KAAKA,EAAE,IAAI,KAAKA,EAAE,WAAW;AAAA,EACrD,OAA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AUK;AAAA,YACV,UAAA1B;AAAA,YACA,oBAAkBA;AAAA,YAEjB,UAAAyB;AAAA,UAAA;AAAA,QAAA;AAAA,0BAEFiB,GAAA,EAAO,OAAM,QAAO,WAAWE,EAAO,8BAA8B,GACnE,UAAA,gBAAA3D;AAAA,UAAC6D;AAAA,UAAA;AAAA,YACC,KAAK/C;AAAA,YACL,OAAOa;AAAA,YACP,MAAMW;AAAA,YACN,UAAUM;AAAA,YACV,UAAA7B;AAAA,YACA,oBAAkBA;AAAA,YAClB,uBAAqBoB;AAAA,YACrB,WAAWuB,EAAWC,EAAO,oBAAoB,GAAG,oBAAoB;AAAA,YACxE,mBAAAN;AAAA,UAAA;AAAA,QAAA,GAEJ;AAAA,QACClB,KACC,gBAAAqB,EAAAM,GAAA,EACE,UAAA;AAAA,UAAA,gBAAA9D;AAAA,YAAC+D;AAAA,YAAA;AAAA,cACC,UAAAhD;AAAA,cACA,WAAW2C;AAAA,gBACTC,EAAO,+BAA+B;AAAA,gBACtC;AAAA,cAAA;AAAA,cAEF,SAASV;AAAA,cACT,MAAK;AAAA,cAEL,UAAA,gBAAAjD,EAACgE,IAAA,EAAa,MAAK,KAAA,CAAK;AAAA,YAAA;AAAA,UAAA;AAAA,UAGzBxC,KACC,gBAAAxB;AAAA,YAACiE;AAAA,YAAA;AAAA,cACC,eAAe5C;AAAA,cACf,gBAAgB8B;AAAA,cAChB,SAASD;AAAA,cACT,qBAAoB;AAAA,cAEnB,UAAApB;AAAA,YAAA;AAAA,UAAA;AAAA,QACH,EAAA,CAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
|
|
1
|
+
{"version":3,"file":"phone_number_input.js","sources":["../../../src/inputs/phone_number_input/phone_number_input.tsx"],"sourcesContent":["import { HStack, type HStackProps } from '../../stacks/h_stack.js';\nimport classNames from 'classnames';\nimport React, {\n useCallback,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n Children,\n isValidElement,\n} from 'react';\nimport { SlimButton } from '../../actions/index.js';\nimport { Select } from '../select/select.js';\nimport { MaskInput } from '../mask_input/mask_input.js';\nimport {\n CountryPhoneInformation,\n countriesPhoneInformation,\n} from './countries_phone_information.js';\nimport styles from './phone_number_input.module.css';\nimport { NotebookIcon } from '@tcn/icons/notebook_icon.js';\nimport { Option, OptionProps } from '../options/option.js';\nimport { SuggestionList } from '../suggestions/suggestion_list.js';\nimport { stripNonNumericAfterCountryCode } from './utils.js';\n\nconst countryList = countriesPhoneInformation.map(i => ({\n name: i.name,\n selectedLabel: i.prefix,\n optionLabel: `${i.prefix} (${i.code}) ${i.unicodeFlag}`,\n value: i.code,\n keywords: i.keywords,\n}));\n\ncountryList.sort((a, b) => parseInt(a.value) - parseInt(b.value));\n\nconst countryPrefixMap: Map<string, CountryPhoneInformation[]> = new Map();\nconst countryCodeMap: Map<string, CountryPhoneInformation> = new Map();\ncountriesPhoneInformation.forEach(i => {\n countryCodeMap.set(i.code, i);\n if (countryPrefixMap.has(i.prefix)) {\n countryPrefixMap.get(i.prefix)?.push(i);\n } else {\n countryPrefixMap.set(i.prefix, [i]);\n }\n});\n\nfunction createCountryOptions(allowedCountryCodes?: string[]) {\n if (allowedCountryCodes != null) {\n const allowedMap: Record<string, boolean> = {};\n allowedCountryCodes.forEach(c => {\n allowedMap[c] = true;\n });\n return countryList\n .filter(c => Boolean(allowedMap[c.value]))\n .map(i => {\n return (\n <Option\n key={i.value}\n value={i.value}\n label={i.selectedLabel}\n keywords={i.keywords}\n >\n {i.optionLabel}\n </Option>\n );\n });\n } else {\n return countryList.map(i => {\n return (\n <Option\n key={i.value}\n value={i.value}\n label={i.selectedLabel}\n keywords={i.keywords}\n >\n {i.optionLabel}\n </Option>\n );\n });\n }\n}\n\nfunction getCountryCodeFromValue(\n value: string,\n previousCountry: string,\n defaultCountry: string\n) {\n for (let x = 5; x > 1; x--) {\n const prefix = value.slice(0, x);\n const countriesInformation = countryPrefixMap.get(prefix);\n\n if (countriesInformation != null) {\n const countryInformation = countriesInformation.find(\n c => c.code === previousCountry\n );\n\n if (countryInformation != null) {\n return countryInformation;\n } else {\n return countriesInformation[0];\n }\n }\n }\n\n return (countryCodeMap.get(defaultCountry.toUpperCase()) ||\n countryCodeMap.get('US')) as CountryPhoneInformation;\n}\n\nexport interface PhoneNumberInputProps\n extends Omit<HStackProps, 'onChange' | 'children'> {\n value?: string;\n defaultCountry?: string;\n onChange?: (value: string) => void;\n countrySelectRef?: React.Ref<HTMLButtonElement>;\n phoneNumberInputRef?: React.Ref<HTMLInputElement>;\n disabled?: boolean;\n allowedCountryCodes?: string[];\n children?: React.ReactElement<OptionProps> | React.ReactElement<OptionProps>[];\n}\n\nexport const PhoneNumberInput = React.forwardRef(function PhoneNumberInput(\n {\n value = '',\n defaultCountry = 'US',\n onChange,\n countrySelectRef: countryRef,\n phoneNumberInputRef: numberRef,\n disabled = false,\n allowedCountryCodes,\n children,\n ...props\n }: PhoneNumberInputProps,\n ref: React.Ref<HTMLElement>\n) {\n const lastOutputValueRef = useRef(value);\n const [phoneBookElement, setPhoneBookElement] = useState<HTMLButtonElement | null>(\n null\n );\n const isPhoneBookOpen = phoneBookElement != null;\n const [selectedCountry, setSelectedCountry] = useState(defaultCountry);\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n const [phoneNumber, setPhoneNumber] = useState(() => {\n const phoneNumber = value.split(countryInformation.prefix)[1];\n\n return phoneNumber == null ? '' : stripNonNumericAfterCountryCode(phoneNumber);\n });\n\n // Extract valid Option components from children\n const phoneBookOptions = useMemo(() => {\n return Children.toArray(children).filter(\n (child): child is React.ReactElement<OptionProps> =>\n isValidElement(child) && child.type === Option\n );\n }, [children]);\n\n const showPhoneBook = phoneBookOptions.length > 0;\n const [countryCode, setCountryCode] = useState(countryInformation.code);\n const [currentMasks, setCurrentMasks] = useState([\n ...countriesPhoneInformation[0].masks,\n ]);\n\n const countryOptions = useMemo(() => {\n return createCountryOptions(allowedCountryCodes);\n }, [allowedCountryCodes]);\n\n function changeCountry(countryCodeValue: string) {\n const countryInformation = countryCodeMap.get(countryCodeValue);\n\n if (countryInformation == null) {\n return;\n }\n\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n setSelectedCountry(countryInformation.code);\n\n if (phoneNumber == null) {\n return;\n }\n\n const value = `${countryInformation.prefix}${stripNonNumericAfterCountryCode(phoneNumber)}`;\n lastOutputValueRef.current = value;\n onChange && onChange(value);\n }\n\n useLayoutEffect(() => {\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n setSelectedCountry(countryInformation.code);\n }, [value, selectedCountry, defaultCountry]);\n\n function transformValue(newPhoneNumber: string) {\n const countryPrefix = countryCodeMap.get(countryCode)?.prefix;\n const lineNumber = stripNonNumericAfterCountryCode(newPhoneNumber);\n const outputValue = countryPrefix + lineNumber;\n\n lastOutputValueRef.current = outputValue;\n phoneNumber !== newPhoneNumber && setPhoneNumber(newPhoneNumber);\n onChange && onChange(outputValue);\n }\n\n function togglePhoneBook(e: React.MouseEvent<HTMLButtonElement>) {\n if (isPhoneBookOpen) {\n setPhoneBookElement(null);\n } else {\n setPhoneBookElement(e.currentTarget);\n }\n }\n\n function closePhoneBook() {\n setPhoneBookElement(null);\n }\n\n function handlePhoneBookOptionSelect(value: string) {\n // Update the phone number with the selected value\n updatePhoneNumber(value);\n closePhoneBook();\n }\n\n function preparePasteValue(value: string) {\n if (value.startsWith('+')) {\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n\n const phoneNumber = value.split(countryInformation.prefix)[1];\n setPhoneNumber(phoneNumber);\n\n return phoneNumber;\n }\n\n return value;\n }\n\n const updatePhoneNumber = useCallback(\n (value: string) => {\n const oldValue = lastOutputValueRef.current;\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n const phoneNumber = value.split(countryInformation.prefix)[1];\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n setSelectedCountry(countryInformation.code);\n\n if (oldValue !== value) {\n setPhoneNumber(phoneNumber);\n onChange && onChange(value);\n }\n },\n [defaultCountry, selectedCountry, onChange]\n );\n\n useLayoutEffect(() => {\n updatePhoneNumber(value);\n }, [value, updatePhoneNumber]);\n\n return (\n <HStack\n ref={ref}\n className={classNames(styles['phone-number-input'], 'phone-number-input')}\n height=\"auto\"\n {...props}\n >\n <Select\n className={classNames(\n styles['phone-number-input-select'],\n 'phone-number-input-select'\n )}\n ref={countryRef}\n width=\"auto\"\n value={countryCode}\n onChange={changeCountry}\n disabled={disabled}\n data-is-disabled={disabled}\n >\n {countryOptions}\n </Select>\n <HStack width=\"flex\" className={styles['phone-number-input-container']}>\n <MaskInput\n ref={numberRef}\n value={phoneNumber}\n mask={currentMasks}\n onChange={transformValue}\n disabled={disabled}\n data-is-disabled={disabled}\n data-has-phone-book={showPhoneBook}\n className={classNames(styles['phone-number-input'], 'phone-number-input')}\n preparePasteValue={preparePasteValue}\n />\n </HStack>\n {showPhoneBook && (\n <>\n <SlimButton\n disabled={disabled}\n className={classNames(\n styles['phone-number-input-phone-book'],\n 'phone-number-input-phone-book'\n )}\n onClick={togglePhoneBook}\n size=\"md\"\n >\n <NotebookIcon size=\"md\" />\n </SlimButton>\n\n {isPhoneBookOpen && (\n <SuggestionList\n anchorElement={phoneBookElement}\n onOptionSelect={handlePhoneBookOptionSelect}\n onClose={closePhoneBook}\n noSuggestionMessage=\"No phone numbers found\"\n >\n {phoneBookOptions}\n </SuggestionList>\n )}\n </>\n )}\n </HStack>\n );\n});\n"],"names":["countryList","countriesPhoneInformation","i","a","b","countryPrefixMap","countryCodeMap","createCountryOptions","allowedCountryCodes","allowedMap","c","jsx","Option","getCountryCodeFromValue","value","previousCountry","defaultCountry","x","prefix","countriesInformation","countryInformation","PhoneNumberInput","React","onChange","countryRef","numberRef","disabled","children","props","ref","lastOutputValueRef","useRef","phoneBookElement","setPhoneBookElement","useState","isPhoneBookOpen","selectedCountry","setSelectedCountry","phoneNumber","setPhoneNumber","stripNonNumericAfterCountryCode","phoneBookOptions","useMemo","Children","child","isValidElement","showPhoneBook","countryCode","setCountryCode","currentMasks","setCurrentMasks","countryOptions","changeCountry","countryCodeValue","useLayoutEffect","transformValue","newPhoneNumber","countryPrefix","lineNumber","outputValue","togglePhoneBook","closePhoneBook","handlePhoneBookOptionSelect","updatePhoneNumber","preparePasteValue","useCallback","oldValue","jsxs","HStack","classNames","styles","Select","MaskInput","Fragment","SlimButton","NotebookIcon","SuggestionList"],"mappings":";;;;;;;;;;;;;;;;;0ZAwBMA,IAAcC,EAA0B,IAAI,CAAAC,OAAM;AAAA,EACtD,MAAMA,EAAE;AAAA,EACR,eAAeA,EAAE;AAAA,EACjB,aAAa,GAAGA,EAAE,MAAM,KAAKA,EAAE,IAAI,KAAKA,EAAE,WAAW;AAAA,EACrD,OAAOA,EAAE;AAAA,EACT,UAAUA,EAAE;AACd,EAAE;AAEFF,EAAY,KAAK,CAACG,GAAGC,MAAM,SAASD,EAAE,KAAK,IAAI,SAASC,EAAE,KAAK,CAAC;AAEhE,MAAMC,wBAA+D,IAAA,GAC/DC,wBAA2D,IAAA;AACjEL,EAA0B,QAAQ,CAAAC,MAAK;AACrC,EAAAI,EAAe,IAAIJ,EAAE,MAAMA,CAAC,GACxBG,EAAiB,IAAIH,EAAE,MAAM,IAC/BG,EAAiB,IAAIH,EAAE,MAAM,GAAG,KAAKA,CAAC,IAEtCG,EAAiB,IAAIH,EAAE,QAAQ,CAACA,CAAC,CAAC;AAEtC,CAAC;AAED,SAASK,GAAqBC,GAAgC;AAC5D,MAAIA,KAAuB,MAAM;AAC/B,UAAMC,IAAsC,CAAA;AAC5C,WAAAD,EAAoB,QAAQ,CAAAE,MAAK;AAC/B,MAAAD,EAAWC,CAAC,IAAI;AAAA,IAClB,CAAC,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AAA;AAAA,cACC,UAAAhD;AAAA,cACA,WAAW2C;AAAA,gBACTC,EAAO,+BAA+B;AAAA,gBACtC;AAAA,cAAA;AAAA,cAEF,SAASV;AAAA,cACT,MAAK;AAAA,cAEL,UAAA,gBAAAjD,EAACgE,IAAA,EAAa,MAAK,KAAA,CAAK;AAAA,YAAA;AAAA,UAAA;AAAA,UAGzBxC,KACC,gBAAAxB;AAAA,YAACiE;AAAA,YAAA;AAAA,cACC,eAAe5C;AAAA,cACf,gBAAgB8B;AAAA,cAChB,SAASD;AAAA,cACT,qBAAoB;AAAA,cAEnB,UAAApB;AAAA,YAAA;AAAA,UAAA;AAAA,QACH,EAAA,CAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HStackProps } from '../../stacks/h_stack.js';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
export interface HBodyProps extends Omit<HStackProps, 'as'> {
|
|
4
|
+
}
|
|
5
|
+
export declare const HBody: React.ForwardRefExoticComponent<HBodyProps & React.RefAttributes<HTMLElement>>;
|
|
6
|
+
//# sourceMappingURL=h_body.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"h_body.d.ts","sourceRoot":"","sources":["../../../src/layouts/body/h_body.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC;CAAG;AAE9D,eAAO,MAAM,KAAK,gFAchB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { HStack as m } from "../../stacks/h_stack.js";
|
|
3
|
+
import c from "react";
|
|
4
|
+
import f from "classnames";
|
|
5
|
+
import '../../h_body.css';const y = "_h-body_d56f4f1", a = { "h-body": y }, p = c.forwardRef(function({ children: o, className: t, ...r }, s) {
|
|
6
|
+
return /* @__PURE__ */ d(
|
|
7
|
+
m,
|
|
8
|
+
{
|
|
9
|
+
ref: s,
|
|
10
|
+
as: "section",
|
|
11
|
+
className: f(a["h-body"], t, "h-body", "body"),
|
|
12
|
+
...r,
|
|
13
|
+
children: o
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
});
|
|
17
|
+
export {
|
|
18
|
+
p as HBody
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=h_body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"h_body.js","sources":["../../../src/layouts/body/h_body.tsx"],"sourcesContent":["import { HStack, type HStackProps } from '../../stacks/h_stack.js';\nimport React from 'react';\nimport classNames from 'classnames';\nimport styles from './h_body.module.css';\n\nexport interface HBodyProps extends Omit<HStackProps, 'as'> {}\n\nexport const HBody = React.forwardRef<HTMLElement, HBodyProps>(function HBody(\n { children, className, ...props }: HBodyProps,\n ref\n) {\n return (\n <HStack\n ref={ref}\n as=\"section\"\n className={classNames(styles['h-body'], className, 'h-body', 'body')}\n {...props}\n >\n {children}\n </HStack>\n );\n});\n"],"names":["HBody","React","children","className","props","ref","jsx","HStack","classNames","styles"],"mappings":";;;;kDAOaA,IAAQC,EAAM,WAAoC,SAC7D,EAAE,UAAAC,GAAU,WAAAC,GAAW,GAAGC,EAAA,GAC1BC,GACA;AACA,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAF;AAAA,MACA,IAAG;AAAA,MACH,WAAWG,EAAWC,EAAO,QAAQ,GAAGN,GAAW,UAAU,MAAM;AAAA,MAClE,GAAGC;AAAA,MAEH,UAAAF;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { VStackProps } from '../../stacks/v_stack.js';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
export interface VBodyProps extends Omit<VStackProps, 'as'> {
|
|
4
|
+
}
|
|
5
|
+
export declare const VBody: React.ForwardRefExoticComponent<VBodyProps & React.RefAttributes<HTMLElement>>;
|
|
6
|
+
//# sourceMappingURL=v_body.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v_body.d.ts","sourceRoot":"","sources":["../../../src/layouts/body/v_body.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC;CAAG;AAE9D,eAAO,MAAM,KAAK,gFAchB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { VStack as m } from "../../stacks/v_stack.js";
|
|
3
|
+
import c from "react";
|
|
4
|
+
import y from "classnames";
|
|
5
|
+
import '../../v_body.css';const a = "_v-body_d8f1917", e = { "v-body": a }, v = c.forwardRef(function({ children: o, className: t, ...r }, s) {
|
|
6
|
+
return /* @__PURE__ */ d(
|
|
7
|
+
m,
|
|
8
|
+
{
|
|
9
|
+
ref: s,
|
|
10
|
+
as: "section",
|
|
11
|
+
className: y(e["v-body"], t, "v-body", "body"),
|
|
12
|
+
...r,
|
|
13
|
+
children: o
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
});
|
|
17
|
+
export {
|
|
18
|
+
v as VBody
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=v_body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v_body.js","sources":["../../../src/layouts/body/v_body.tsx"],"sourcesContent":["import { VStack, type VStackProps } from '../../stacks/v_stack.js';\nimport React from 'react';\nimport classNames from 'classnames';\nimport styles from './v_body.module.css';\n\nexport interface VBodyProps extends Omit<VStackProps, 'as'> {}\n\nexport const VBody = React.forwardRef<HTMLElement, VBodyProps>(function VBody(\n { children, className, ...props }: VBodyProps,\n ref\n) {\n return (\n <VStack\n ref={ref}\n as=\"section\"\n className={classNames(styles['v-body'], className, 'v-body', 'body')}\n {...props}\n >\n {children}\n </VStack>\n );\n});\n"],"names":["VBody","React","children","className","props","ref","jsx","VStack","classNames","styles"],"mappings":";;;;kDAOaA,IAAQC,EAAM,WAAoC,SAC7D,EAAE,UAAAC,GAAU,WAAAC,GAAW,GAAGC,EAAA,GAC1BC,GACA;AACA,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAF;AAAA,MACA,IAAG;AAAA,MACH,WAAWG,EAAWC,EAAO,QAAQ,GAAGN,GAAW,UAAU,MAAM;AAAA,MAClE,GAAGC;AAAA,MAEH,UAAAF;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
|
package/dist/layouts/index.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
export * from './column/column.js';
|
|
2
2
|
export * from './divider/divider.js';
|
|
3
|
-
export * from './drawers/drawer_bottom/drawer_bottom.js';
|
|
4
|
-
export * from './drawers/drawer_top/drawer_top.js';
|
|
5
|
-
export * from './drawers/drawer_start/drawer_start.js';
|
|
6
|
-
export * from './drawers/drawer_end/drawer_end.js';
|
|
7
3
|
export * from './footer/footer.js';
|
|
8
4
|
export * from './grid/grid.js';
|
|
9
5
|
export * from './header/header.js';
|
|
@@ -12,4 +8,6 @@ export * from './list/list.js';
|
|
|
12
8
|
export * from './list/section_header.js';
|
|
13
9
|
export * from './sidebar_end/sidebar_end.js';
|
|
14
10
|
export * from './sidebar_start/sidebar_start.js';
|
|
11
|
+
export * from './body/h_body.js';
|
|
12
|
+
export * from './body/v_body.js';
|
|
15
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layouts/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layouts/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
|
package/dist/layouts/index.js
CHANGED
|
@@ -1,31 +1,27 @@
|
|
|
1
1
|
import { Column as e } from "./column/column.js";
|
|
2
2
|
import { Divider as m } from "./divider/divider.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { SidebarEnd as G } from "./sidebar_end/sidebar_end.js";
|
|
14
|
-
import { SidebarStart as L } from "./sidebar_start/sidebar_start.js";
|
|
3
|
+
import { Footer as p } from "./footer/footer.js";
|
|
4
|
+
import { Grid as d } from "./grid/grid.js";
|
|
5
|
+
import { Header as a } from "./header/header.js";
|
|
6
|
+
import { Item as n } from "./list/item.js";
|
|
7
|
+
import { List as b } from "./list/list.js";
|
|
8
|
+
import { SectionHeader as B } from "./list/section_header.js";
|
|
9
|
+
import { SidebarEnd as l } from "./sidebar_end/sidebar_end.js";
|
|
10
|
+
import { SidebarStart as u } from "./sidebar_start/sidebar_start.js";
|
|
11
|
+
import { HBody as C } from "./body/h_body.js";
|
|
12
|
+
import { VBody as E } from "./body/v_body.js";
|
|
15
13
|
export {
|
|
16
14
|
e as Column,
|
|
17
15
|
m as Divider,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
a as
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
G as SidebarEnd,
|
|
29
|
-
L as SidebarStart
|
|
16
|
+
p as Footer,
|
|
17
|
+
d as Grid,
|
|
18
|
+
C as HBody,
|
|
19
|
+
a as Header,
|
|
20
|
+
n as Item,
|
|
21
|
+
b as List,
|
|
22
|
+
B as SectionHeader,
|
|
23
|
+
l as SidebarEnd,
|
|
24
|
+
u as SidebarStart,
|
|
25
|
+
E as VBody
|
|
30
26
|
};
|
|
31
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/overlay/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { P as e } from "../portal-qqIp4SIl.js";
|
|
2
|
+
import { ContextMenu as p } from "./context_menu/context_menu.js";
|
|
3
|
+
import { Menu as x, MenuItem as f } from "./menu/menu.js";
|
|
4
|
+
import { Tooltip as u } from "./tooltip/tooltip.js";
|
|
5
|
+
import { Popper as P } from "./popper/popper.js";
|
|
6
|
+
export {
|
|
7
|
+
p as ContextMenu,
|
|
8
|
+
x as Menu,
|
|
9
|
+
f as MenuItem,
|
|
10
|
+
P as Popper,
|
|
11
|
+
e as Portal,
|
|
12
|
+
u as Tooltip
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer_bottom.d.ts","sourceRoot":"","sources":["../../../../src/surfaces/drawers/drawer_bottom/drawer_bottom.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,UAAU,CAAC;IAC7E,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,YAAY,uFAaxB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as a } from "react/jsx-runtime";
|
|
|
2
2
|
import { VStack as e } from "../../../stacks/v_stack.js";
|
|
3
3
|
import s from "classnames";
|
|
4
4
|
import c from "react";
|
|
5
|
-
import '../../../drawer_bottom.css';const f = "
|
|
5
|
+
import '../../../drawer_bottom.css';const f = "_drawerBottom_9359033", n = { drawerBottom: f }, l = c.forwardRef(
|
|
6
6
|
function({ children: o, className: t, ...r }, m) {
|
|
7
7
|
return /* @__PURE__ */ a(
|
|
8
8
|
e,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer_bottom.js","sources":["../../../../src/surfaces/drawers/drawer_bottom/drawer_bottom.tsx"],"sourcesContent":["import { VStack, type VStackProps } from '../../../stacks/v_stack.js';\nimport classNames from 'classnames';\nimport React from 'react';\nimport styles from './drawer_bottom.module.css';\n\nexport interface DrawerBottomProps extends Omit<VStackProps, 'as' | 'children'> {\n children?: React.ReactNode;\n}\n\nexport const DrawerBottom = React.forwardRef<HTMLElement, DrawerBottomProps>(\n function DrawerBottom({ children, className, ...props }: DrawerBottomProps, ref) {\n return (\n <VStack\n ref={ref}\n as=\"section\"\n className={classNames(styles.drawerBottom, className, 'drawer-bottom')}\n {...props}\n >\n {children}\n </VStack>\n );\n }\n);\n"],"names":["DrawerBottom","React","children","className","props","ref","jsx","VStack","classNames","styles"],"mappings":";;;;4DASaA,IAAeC,EAAM;AAAA,EAChC,SAAsB,EAAE,UAAAC,GAAU,WAAAC,GAAW,GAAGC,EAAA,GAA4BC,GAAK;AAC/E,WACE,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,KAAAF;AAAA,QACA,IAAG;AAAA,QACH,WAAWG,EAAWC,EAAO,cAAcN,GAAW,eAAe;AAAA,QACpE,GAAGC;AAAA,QAEH,UAAAF;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer_end.d.ts","sourceRoot":"","sources":["../../../../src/surfaces/drawers/drawer_end/drawer_end.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,UAAU,CAAC;IAC1E,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,SAAS,oFAcpB,CAAC"}
|
|
@@ -2,13 +2,13 @@ import { jsx as t } from "react/jsx-runtime";
|
|
|
2
2
|
import { VStack as n } from "../../../stacks/v_stack.js";
|
|
3
3
|
import s from "classnames";
|
|
4
4
|
import d from "react";
|
|
5
|
-
import '../../../drawer_end.css';const
|
|
5
|
+
import '../../../drawer_end.css';const c = "_drawerEnd_39acb27", m = { drawerEnd: c }, l = d.forwardRef(function({ children: r, className: a, ...o }, e) {
|
|
6
6
|
return /* @__PURE__ */ t(
|
|
7
7
|
n,
|
|
8
8
|
{
|
|
9
9
|
ref: e,
|
|
10
10
|
as: "section",
|
|
11
|
-
className: s(
|
|
11
|
+
className: s(m.drawerEnd, a, "drawerEnd"),
|
|
12
12
|
...o,
|
|
13
13
|
children: r
|
|
14
14
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer_end.js","sources":["../../../../src/surfaces/drawers/drawer_end/drawer_end.tsx"],"sourcesContent":["import { VStack, type VStackProps } from '../../../stacks/v_stack.js';\nimport classNames from 'classnames';\nimport React from 'react';\nimport styles from './drawer_end.module.css';\n\nexport interface DrawerEndProps extends Omit<VStackProps, 'as' | 'children'> {\n children?: React.ReactNode;\n}\n\nexport const DrawerEnd = React.forwardRef<HTMLElement, DrawerEndProps>(function DrawerEnd(\n { children, className, ...props }: DrawerEndProps,\n ref\n) {\n return (\n <VStack\n ref={ref}\n as=\"section\"\n className={classNames(styles.drawerEnd, className, 'drawerEnd')}\n {...props}\n >\n {children}\n </VStack>\n );\n});\n"],"names":["DrawerEnd","React","children","className","props","ref","jsx","VStack","classNames","styles"],"mappings":";;;;sDASaA,IAAYC,EAAM,WAAwC,SACrE,EAAE,UAAAC,GAAU,WAAAC,GAAW,GAAGC,EAAA,GAC1BC,GACA;AACA,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAF;AAAA,MACA,IAAG;AAAA,MACH,WAAWG,EAAWC,EAAO,WAAWN,GAAW,WAAW;AAAA,MAC7D,GAAGC;AAAA,MAEH,UAAAF;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer_start.d.ts","sourceRoot":"","sources":["../../../../src/surfaces/drawers/drawer_start/drawer_start.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,UAAU,CAAC;IAC5E,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,WAAW,sFAavB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as e } from "react/jsx-runtime";
|
|
|
2
2
|
import { VStack as s } from "../../../stacks/v_stack.js";
|
|
3
3
|
import m from "classnames";
|
|
4
4
|
import c from "react";
|
|
5
|
-
import '../../../drawer_start.css';const f = "
|
|
5
|
+
import '../../../drawer_start.css';const f = "_drawerStart_3abbf56", n = { drawerStart: f }, l = c.forwardRef(
|
|
6
6
|
function({ children: r, className: t, ...a }, o) {
|
|
7
7
|
return /* @__PURE__ */ e(
|
|
8
8
|
s,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer_start.js","sources":["../../../../src/surfaces/drawers/drawer_start/drawer_start.tsx"],"sourcesContent":["import { VStack, type VStackProps } from '../../../stacks/v_stack.js';\nimport classNames from 'classnames';\nimport React from 'react';\nimport styles from './drawer_start.module.css';\n\nexport interface DrawerStartProps extends Omit<VStackProps, 'as' | 'children'> {\n children?: React.ReactNode;\n}\n\nexport const DrawerStart = React.forwardRef<HTMLElement, DrawerStartProps>(\n function DrawerStart({ children, className, ...props }: DrawerStartProps, ref) {\n return (\n <VStack\n ref={ref}\n as=\"section\"\n className={classNames(styles.drawerStart, className, 'drawerStart')}\n {...props}\n >\n {children}\n </VStack>\n );\n }\n);\n"],"names":["DrawerStart","React","children","className","props","ref","jsx","VStack","classNames","styles"],"mappings":";;;;0DASaA,IAAcC,EAAM;AAAA,EAC/B,SAAqB,EAAE,UAAAC,GAAU,WAAAC,GAAW,GAAGC,EAAA,GAA2BC,GAAK;AAC7E,WACE,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,KAAAF;AAAA,QACA,IAAG;AAAA,QACH,WAAWG,EAAWC,EAAO,aAAaN,GAAW,aAAa;AAAA,QACjE,GAAGC;AAAA,QAEH,UAAAF;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer_top.d.ts","sourceRoot":"","sources":["../../../../src/surfaces/drawers/drawer_top/drawer_top.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,UAAU,CAAC;IAC1E,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,SAAS,oFAcpB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as e } from "react/jsx-runtime";
|
|
|
2
2
|
import { VStack as s } from "../../../stacks/v_stack.js";
|
|
3
3
|
import m from "classnames";
|
|
4
4
|
import c from "react";
|
|
5
|
-
import '../../../drawer_top.css';const p = "
|
|
5
|
+
import '../../../drawer_top.css';const p = "_drawerBottom_7a0635a", f = { drawerBottom: p }, l = c.forwardRef(function({ children: r, className: o, ...t }, a) {
|
|
6
6
|
return /* @__PURE__ */ e(
|
|
7
7
|
s,
|
|
8
8
|
{
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer_top.js","sources":["../../../../src/surfaces/drawers/drawer_top/drawer_top.tsx"],"sourcesContent":["import { VStack, type VStackProps } from '../../../stacks/v_stack.js';\nimport classNames from 'classnames';\nimport React from 'react';\nimport styles from './drawer_top.module.css';\n\nexport interface DrawerTopProps extends Omit<VStackProps, 'as' | 'children'> {\n children?: React.ReactNode;\n}\n\nexport const DrawerTop = React.forwardRef<HTMLElement, DrawerTopProps>(function DrawerTop(\n { children, className, ...props }: DrawerTopProps,\n ref\n) {\n return (\n <VStack\n ref={ref}\n as=\"section\"\n className={classNames(styles.drawerTop, className, 'drawerTop')}\n {...props}\n >\n {children}\n </VStack>\n );\n});\n"],"names":["DrawerTop","React","children","className","props","ref","jsx","VStack","classNames","styles"],"mappings":";;;;4DASaA,IAAYC,EAAM,WAAwC,SACrE,EAAE,UAAAC,GAAU,WAAAC,GAAW,GAAGC,EAAA,GAC1BC,GACA;AACA,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAF;AAAA,MACA,IAAG;AAAA,MACH,WAAWG,EAAWC,EAAO,WAAWN,GAAW,WAAW;AAAA,MAC7D,GAAGC;AAAA,MAEH,UAAAF;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
|
package/dist/surfaces/index.d.ts
CHANGED
|
@@ -8,4 +8,8 @@ export * from './panel/h_panel.js';
|
|
|
8
8
|
export * from './panel/v_panel.js';
|
|
9
9
|
export * from './popover/popover.js';
|
|
10
10
|
export * from './window/window.js';
|
|
11
|
+
export * from './drawers/drawer_bottom/drawer_bottom.js';
|
|
12
|
+
export * from './drawers/drawer_top/drawer_top.js';
|
|
13
|
+
export * from './drawers/drawer_start/drawer_start.js';
|
|
14
|
+
export * from './drawers/drawer_end/drawer_end.js';
|
|
11
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/surfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/surfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0CAA0C,CAAC;AACzD,cAAc,oCAAoC,CAAC;AACnD,cAAc,wCAAwC,CAAC;AACvD,cAAc,oCAAoC,CAAC"}
|
package/dist/surfaces/index.js
CHANGED
|
@@ -1,23 +1,31 @@
|
|
|
1
1
|
import { Alert as e } from "./alert/alert.js";
|
|
2
2
|
import { Card as m } from "./card/card.js";
|
|
3
|
-
import { Confirm as
|
|
3
|
+
import { Confirm as f } from "./confirm/confirm.js";
|
|
4
4
|
import { Modal as a } from "./modal/modal.js";
|
|
5
|
-
import { HPage as
|
|
5
|
+
import { HPage as w } from "./page/h_page.js";
|
|
6
6
|
import { VPage as d } from "./page/v_page.js";
|
|
7
|
-
import { HPanel as
|
|
8
|
-
import { VPanel as
|
|
9
|
-
import { Popover as
|
|
10
|
-
import { Window as
|
|
7
|
+
import { HPanel as D } from "./panel/h_panel.js";
|
|
8
|
+
import { VPanel as i } from "./panel/v_panel.js";
|
|
9
|
+
import { Popover as H } from "./popover/popover.js";
|
|
10
|
+
import { Window as v } from "./window/window.js";
|
|
11
|
+
import { DrawerBottom as B } from "./drawers/drawer_bottom/drawer_bottom.js";
|
|
12
|
+
import { DrawerTop as M } from "./drawers/drawer_top/drawer_top.js";
|
|
13
|
+
import { DrawerStart as T } from "./drawers/drawer_start/drawer_start.js";
|
|
14
|
+
import { DrawerEnd as b } from "./drawers/drawer_end/drawer_end.js";
|
|
11
15
|
export {
|
|
12
16
|
e as Alert,
|
|
13
17
|
m as Card,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
f as Confirm,
|
|
19
|
+
B as DrawerBottom,
|
|
20
|
+
b as DrawerEnd,
|
|
21
|
+
T as DrawerStart,
|
|
22
|
+
M as DrawerTop,
|
|
23
|
+
w as HPage,
|
|
24
|
+
D as HPanel,
|
|
17
25
|
a as Modal,
|
|
18
|
-
|
|
26
|
+
H as Popover,
|
|
19
27
|
d as VPage,
|
|
20
|
-
|
|
21
|
-
|
|
28
|
+
i as VPanel,
|
|
29
|
+
v as Window
|
|
22
30
|
};
|
|
23
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
|
package/dist/v_body.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._v-body_d8f1917{gap:var(--gap-medium);padding:var(--padding-medium)}
|
package/package.json
CHANGED
package/src/form/index.ts
CHANGED
|
@@ -3,3 +3,9 @@ export * from './field_presenters/field_presenter.js';
|
|
|
3
3
|
export * from './field_presenters/options_field_presenter.js';
|
|
4
4
|
export * from './field_set/field_set.js';
|
|
5
5
|
export * from './form_field.js';
|
|
6
|
+
export * from './field/v_field/v_field.js';
|
|
7
|
+
export * from './field/h_field/h_field.js';
|
|
8
|
+
export * from './field/field.js';
|
|
9
|
+
export * from './field/common/field_header.js';
|
|
10
|
+
export * from './field/common/field_label.js';
|
|
11
|
+
export * from './field/common/field_description.js';
|
|
@@ -51,10 +51,10 @@ function createCountryOptions(allowedCountryCodes?: string[]) {
|
|
|
51
51
|
});
|
|
52
52
|
return countryList
|
|
53
53
|
.filter(c => Boolean(allowedMap[c.value]))
|
|
54
|
-
.map(
|
|
54
|
+
.map(i => {
|
|
55
55
|
return (
|
|
56
56
|
<Option
|
|
57
|
-
key={
|
|
57
|
+
key={i.value}
|
|
58
58
|
value={i.value}
|
|
59
59
|
label={i.selectedLabel}
|
|
60
60
|
keywords={i.keywords}
|
|
@@ -64,9 +64,14 @@ function createCountryOptions(allowedCountryCodes?: string[]) {
|
|
|
64
64
|
);
|
|
65
65
|
});
|
|
66
66
|
} else {
|
|
67
|
-
return countryList.map(
|
|
67
|
+
return countryList.map(i => {
|
|
68
68
|
return (
|
|
69
|
-
<Option
|
|
69
|
+
<Option
|
|
70
|
+
key={i.value}
|
|
71
|
+
value={i.value}
|
|
72
|
+
label={i.selectedLabel}
|
|
73
|
+
keywords={i.keywords}
|
|
74
|
+
>
|
|
70
75
|
{i.optionLabel}
|
|
71
76
|
</Option>
|
|
72
77
|
);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { HStack, type HStackProps } from '../../stacks/h_stack.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import styles from './h_body.module.css';
|
|
5
|
+
|
|
6
|
+
export interface HBodyProps extends Omit<HStackProps, 'as'> {}
|
|
7
|
+
|
|
8
|
+
export const HBody = React.forwardRef<HTMLElement, HBodyProps>(function HBody(
|
|
9
|
+
{ children, className, ...props }: HBodyProps,
|
|
10
|
+
ref
|
|
11
|
+
) {
|
|
12
|
+
return (
|
|
13
|
+
<HStack
|
|
14
|
+
ref={ref}
|
|
15
|
+
as="section"
|
|
16
|
+
className={classNames(styles['h-body'], className, 'h-body', 'body')}
|
|
17
|
+
{...props}
|
|
18
|
+
>
|
|
19
|
+
{children}
|
|
20
|
+
</HStack>
|
|
21
|
+
);
|
|
22
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { VStack, type VStackProps } from '../../stacks/v_stack.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import styles from './v_body.module.css';
|
|
5
|
+
|
|
6
|
+
export interface VBodyProps extends Omit<VStackProps, 'as'> {}
|
|
7
|
+
|
|
8
|
+
export const VBody = React.forwardRef<HTMLElement, VBodyProps>(function VBody(
|
|
9
|
+
{ children, className, ...props }: VBodyProps,
|
|
10
|
+
ref
|
|
11
|
+
) {
|
|
12
|
+
return (
|
|
13
|
+
<VStack
|
|
14
|
+
ref={ref}
|
|
15
|
+
as="section"
|
|
16
|
+
className={classNames(styles['v-body'], className, 'v-body', 'body')}
|
|
17
|
+
{...props}
|
|
18
|
+
>
|
|
19
|
+
{children}
|
|
20
|
+
</VStack>
|
|
21
|
+
);
|
|
22
|
+
});
|
package/src/layouts/index.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
export * from './column/column.js';
|
|
2
2
|
export * from './divider/divider.js';
|
|
3
|
-
export * from './drawers/drawer_bottom/drawer_bottom.js';
|
|
4
|
-
export * from './drawers/drawer_top/drawer_top.js';
|
|
5
|
-
export * from './drawers/drawer_start/drawer_start.js';
|
|
6
|
-
export * from './drawers/drawer_end/drawer_end.js';
|
|
7
3
|
export * from './footer/footer.js';
|
|
8
4
|
export * from './grid/grid.js';
|
|
9
5
|
export * from './header/header.js';
|
|
@@ -12,3 +8,5 @@ export * from './list/list.js';
|
|
|
12
8
|
export * from './list/section_header.js';
|
|
13
9
|
export * from './sidebar_end/sidebar_end.js';
|
|
14
10
|
export * from './sidebar_start/sidebar_start.js';
|
|
11
|
+
export * from './body/h_body.js';
|
|
12
|
+
export * from './body/v_body.js';
|
package/src/surfaces/index.ts
CHANGED
|
@@ -8,3 +8,7 @@ export * from './panel/h_panel.js';
|
|
|
8
8
|
export * from './panel/v_panel.js';
|
|
9
9
|
export * from './popover/popover.js';
|
|
10
10
|
export * from './window/window.js';
|
|
11
|
+
export * from './drawers/drawer_bottom/drawer_bottom.js';
|
|
12
|
+
export * from './drawers/drawer_top/drawer_top.js';
|
|
13
|
+
export * from './drawers/drawer_start/drawer_start.js';
|
|
14
|
+
export * from './drawers/drawer_end/drawer_end.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"drawer_bottom.d.ts","sourceRoot":"","sources":["../../../../src/layouts/drawers/drawer_bottom/drawer_bottom.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,UAAU,CAAC;IAC7E,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,YAAY,uFAaxB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"drawer_bottom.js","sources":["../../../../src/layouts/drawers/drawer_bottom/drawer_bottom.tsx"],"sourcesContent":["import { VStack, type VStackProps } from '../../../stacks/v_stack.js';\nimport classNames from 'classnames';\nimport React from 'react';\nimport styles from './drawer_bottom.module.css';\n\nexport interface DrawerBottomProps extends Omit<VStackProps, 'as' | 'children'> {\n children?: React.ReactNode;\n}\n\nexport const DrawerBottom = React.forwardRef<HTMLElement, DrawerBottomProps>(\n function DrawerBottom({ children, className, ...props }: DrawerBottomProps, ref) {\n return (\n <VStack\n ref={ref}\n as=\"section\"\n className={classNames(styles.drawerBottom, className, 'drawer-bottom')}\n {...props}\n >\n {children}\n </VStack>\n );\n }\n);\n"],"names":["DrawerBottom","React","children","className","props","ref","jsx","VStack","classNames","styles"],"mappings":";;;;4DASaA,IAAeC,EAAM;AAAA,EAChC,SAAsB,EAAE,UAAAC,GAAU,WAAAC,GAAW,GAAGC,EAAA,GAA4BC,GAAK;AAC/E,WACE,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,KAAAF;AAAA,QACA,IAAG;AAAA,QACH,WAAWG,EAAWC,EAAO,cAAcN,GAAW,eAAe;AAAA,QACpE,GAAGC;AAAA,QAEH,UAAAF;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"drawer_end.d.ts","sourceRoot":"","sources":["../../../../src/layouts/drawers/drawer_end/drawer_end.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,UAAU,CAAC;IAC1E,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,SAAS,oFAcpB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"drawer_end.js","sources":["../../../../src/layouts/drawers/drawer_end/drawer_end.tsx"],"sourcesContent":["import { VStack, type VStackProps } from '../../../stacks/v_stack.js';\nimport classNames from 'classnames';\nimport React from 'react';\nimport styles from './drawer_end.module.css';\n\nexport interface DrawerEndProps extends Omit<VStackProps, 'as' | 'children'> {\n children?: React.ReactNode;\n}\n\nexport const DrawerEnd = React.forwardRef<HTMLElement, DrawerEndProps>(function DrawerEnd(\n { children, className, ...props }: DrawerEndProps,\n ref\n) {\n return (\n <VStack\n ref={ref}\n as=\"section\"\n className={classNames(styles.drawerEnd, className, 'drawerEnd')}\n {...props}\n >\n {children}\n </VStack>\n );\n});\n"],"names":["DrawerEnd","React","children","className","props","ref","jsx","VStack","classNames","styles"],"mappings":";;;;sDASaA,IAAYC,EAAM,WAAwC,SACrE,EAAE,UAAAC,GAAU,WAAAC,GAAW,GAAGC,EAAA,GAC1BC,GACA;AACA,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAF;AAAA,MACA,IAAG;AAAA,MACH,WAAWG,EAAWC,EAAO,WAAWN,GAAW,WAAW;AAAA,MAC7D,GAAGC;AAAA,MAEH,UAAAF;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"drawer_start.d.ts","sourceRoot":"","sources":["../../../../src/layouts/drawers/drawer_start/drawer_start.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,UAAU,CAAC;IAC5E,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,WAAW,sFAavB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"drawer_start.js","sources":["../../../../src/layouts/drawers/drawer_start/drawer_start.tsx"],"sourcesContent":["import { VStack, type VStackProps } from '../../../stacks/v_stack.js';\nimport classNames from 'classnames';\nimport React from 'react';\nimport styles from './drawer_start.module.css';\n\nexport interface DrawerStartProps extends Omit<VStackProps, 'as' | 'children'> {\n children?: React.ReactNode;\n}\n\nexport const DrawerStart = React.forwardRef<HTMLElement, DrawerStartProps>(\n function DrawerStart({ children, className, ...props }: DrawerStartProps, ref) {\n return (\n <VStack\n ref={ref}\n as=\"section\"\n className={classNames(styles.drawerStart, className, 'drawerStart')}\n {...props}\n >\n {children}\n </VStack>\n );\n }\n);\n"],"names":["DrawerStart","React","children","className","props","ref","jsx","VStack","classNames","styles"],"mappings":";;;;0DASaA,IAAcC,EAAM;AAAA,EAC/B,SAAqB,EAAE,UAAAC,GAAU,WAAAC,GAAW,GAAGC,EAAA,GAA2BC,GAAK;AAC7E,WACE,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,KAAAF;AAAA,QACA,IAAG;AAAA,QACH,WAAWG,EAAWC,EAAO,aAAaN,GAAW,aAAa;AAAA,QACjE,GAAGC;AAAA,QAEH,UAAAF;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"drawer_top.d.ts","sourceRoot":"","sources":["../../../../src/layouts/drawers/drawer_top/drawer_top.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,UAAU,CAAC;IAC1E,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,SAAS,oFAcpB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"drawer_top.js","sources":["../../../../src/layouts/drawers/drawer_top/drawer_top.tsx"],"sourcesContent":["import { VStack, type VStackProps } from '../../../stacks/v_stack.js';\nimport classNames from 'classnames';\nimport React from 'react';\nimport styles from './drawer_top.module.css';\n\nexport interface DrawerTopProps extends Omit<VStackProps, 'as' | 'children'> {\n children?: React.ReactNode;\n}\n\nexport const DrawerTop = React.forwardRef<HTMLElement, DrawerTopProps>(function DrawerTop(\n { children, className, ...props }: DrawerTopProps,\n ref\n) {\n return (\n <VStack\n ref={ref}\n as=\"section\"\n className={classNames(styles.drawerTop, className, 'drawerTop')}\n {...props}\n >\n {children}\n </VStack>\n );\n});\n"],"names":["DrawerTop","React","children","className","props","ref","jsx","VStack","classNames","styles"],"mappings":";;;;4DASaA,IAAYC,EAAM,WAAwC,SACrE,EAAE,UAAAC,GAAU,WAAAC,GAAW,GAAGC,EAAA,GAC1BC,GACA;AACA,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAF;AAAA,MACA,IAAG;AAAA,MACH,WAAWG,EAAWC,EAAO,WAAWN,GAAW,WAAW;AAAA,MAC7D,GAAGC;AAAA,MAEH,UAAAF;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|