alif-ui 1.15.2 → 1.15.4
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/alif-ui.css +1 -1
- package/dist/components/ListItem/ListItem.d.ts +3 -2
- package/dist/components/ListItem/ListItem.d.ts.map +1 -1
- package/dist/components/ListItem/ListItem.js +91 -84
- package/dist/components/ListItem/ListItem.types.d.ts +9 -0
- package/dist/components/ListItem/ListItem.types.d.ts.map +1 -1
- package/dist/components/ListItem/ListItem.utils.d.ts +1 -0
- package/dist/components/ListItem/ListItem.utils.d.ts.map +1 -1
- package/dist/components/ListItem/ListItem.utils.js +20 -19
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.js +116 -101
- package/dist/components/Select/useSelectNavigation.d.ts +28 -0
- package/dist/components/Select/useSelectNavigation.d.ts.map +1 -0
- package/dist/components/Select/useSelectNavigation.js +58 -0
- package/dist/components/SelectMultiple/SelectMultiple.d.ts.map +1 -1
- package/dist/components/SelectMultiple/SelectMultiple.js +185 -161
- package/dist/components/Timeline/Timeline.context.d.ts +1 -1
- package/dist/components/Timeline/Timeline.context.d.ts.map +1 -1
- package/dist/components/Timeline/Timeline.js +1 -1
- package/dist/components/Timeline/Timeline.types.d.ts +3 -1
- package/dist/components/Timeline/Timeline.types.d.ts.map +1 -1
- package/dist/components/Timeline/TimelineItem/TimelineItem.js +8 -8
- package/dist/providers/Localization/localization.d.ts +2 -1
- package/dist/providers/Localization/localization.d.ts.map +1 -1
- package/dist/providers/Localization/localization.js +24 -21
- package/dist/providers/Localization/useTranslation/useTranslation.d.ts +1 -1
- package/dist/providers/Localization/useTranslation/useTranslation.d.ts.map +1 -1
- package/dist/providers/Localization/useTranslation/useTranslation.js +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useState as y } from "react";
|
|
2
|
+
import { getListItemOptionId as k } from "../ListItem/ListItem.utils.js";
|
|
3
|
+
const M = ({
|
|
4
|
+
id: g,
|
|
5
|
+
options: i,
|
|
6
|
+
isOpen: r,
|
|
7
|
+
searchValue: s,
|
|
8
|
+
selectedIndex: b = -1,
|
|
9
|
+
onOpen: m,
|
|
10
|
+
onSelect: D
|
|
11
|
+
}) => {
|
|
12
|
+
const [l, c] = y({ searchValue: s, index: -1 });
|
|
13
|
+
!r && l.index !== -1 && c({ searchValue: s, index: -1 });
|
|
14
|
+
const n = r && l.searchValue === s && l.index < i.length ? l.index : -1, d = `${g}-listbox`, v = (t) => k(d, t), x = (t) => document.getElementById(v(t)), f = (t) => !!i[t] && !i[t].isDisabled && !!x(t), u = (t) => {
|
|
15
|
+
var o;
|
|
16
|
+
c({ searchValue: s, index: t }), (o = x(t)) == null || o.scrollIntoView({ block: "nearest" });
|
|
17
|
+
}, p = (t) => {
|
|
18
|
+
if (n === -1 && f(b)) {
|
|
19
|
+
u(b);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const o = i.length;
|
|
23
|
+
let e = n === -1 && t === -1 ? o : n;
|
|
24
|
+
for (let a = 0; a < o; a++)
|
|
25
|
+
if (e = (e + t + o) % o, f(e)) return u(e);
|
|
26
|
+
}, w = (t) => {
|
|
27
|
+
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
28
|
+
t.preventDefault(), r ? p(t.key === "ArrowDown" ? 1 : -1) : m();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const o = i[n];
|
|
32
|
+
t.key === "Enter" && r && o && !o.isDisabled && (t.preventDefault(), D(o.value, o));
|
|
33
|
+
}, I = (t) => {
|
|
34
|
+
var a;
|
|
35
|
+
const o = t.target.closest(
|
|
36
|
+
"[data-option-index]"
|
|
37
|
+
), e = Number((o == null ? void 0 : o.dataset.optionIndex) ?? -1);
|
|
38
|
+
e === -1 || e === n || (a = i[e]) != null && a.isDisabled || c({ searchValue: s, index: e });
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
handleKeyDown: w,
|
|
42
|
+
comboboxProps: {
|
|
43
|
+
role: "combobox",
|
|
44
|
+
"aria-expanded": r,
|
|
45
|
+
"aria-controls": d,
|
|
46
|
+
"aria-activedescendant": n === -1 ? void 0 : v(n)
|
|
47
|
+
},
|
|
48
|
+
listProps: {
|
|
49
|
+
id: d,
|
|
50
|
+
role: "listbox",
|
|
51
|
+
activeIndex: n,
|
|
52
|
+
onMouseMove: I
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
M as useSelectNavigation
|
|
58
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMultiple.d.ts","sourceRoot":"","sources":["../../../src/lib/components/SelectMultiple/SelectMultiple.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIN,aAAa,EAOb,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"SelectMultiple.d.ts","sourceRoot":"","sources":["../../../src/lib/components/SelectMultiple/SelectMultiple.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIN,aAAa,EAOb,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAqQ7D,eAAO,MAAM,cAAc,0EAEtB,WAAW,CAAC"}
|
|
@@ -1,195 +1,219 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { classNames as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import { jsxs as B, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ft, useRef as A, useState as T, useImperativeHandle as pt, useId as dt, useMemo as b, useEffect as gt } from "react";
|
|
3
|
+
import { classNames as g } from "../../utils/class-names.js";
|
|
4
|
+
import { closeEscape as _t } from "../../utils/close-escape.js";
|
|
5
|
+
import { ListItemBase as vt } from "../ListItem/ListItem.js";
|
|
6
|
+
import { InputBaseWrapper as ht } from "../Field/InputBaseWrapper/InputBaseWrapper.js";
|
|
7
|
+
import { InputBase as wt } from "../Field/InputBase/InputBase.js";
|
|
8
|
+
import { isObjectValue as bt } from "../Select/Select.utils.js";
|
|
9
|
+
import { useSelectNavigation as It } from "../Select/useSelectNavigation.js";
|
|
10
|
+
import { Popover as L } from "../Popover/Popover.js";
|
|
11
|
+
import { Tag as kt } from "../Tag/Tag.js";
|
|
12
|
+
import { Hinter as Nt } from "../Hinter/Hinter.js";
|
|
13
|
+
import { OutlineNavigationChevronDownSmall as Dt } from "../../icons/components/OutlineNavigationChevronDownSmall.js";
|
|
14
|
+
const Ot = "_root_bn1kg_1", Vt = "_listItem_bn1kg_6", Ct = "_hint_bn1kg_11", xt = "_tags_bn1kg_15", Bt = "_tag_bn1kg_15", Lt = "_inputBase_bn1kg_28", Mt = "_fullWidth_bn1kg_32", Pt = "_disabled_bn1kg_36", Rt = "_chevron_bn1kg_40", Wt = "_chevronActive_bn1kg_44", s = {
|
|
15
|
+
root: Ot,
|
|
16
|
+
listItem: Vt,
|
|
17
|
+
hint: Ct,
|
|
18
|
+
tags: xt,
|
|
19
|
+
tag: Bt,
|
|
20
|
+
inputBase: Lt,
|
|
21
|
+
fullWidth: Mt,
|
|
22
|
+
disabled: Pt,
|
|
23
|
+
chevron: Rt,
|
|
24
|
+
chevronActive: Wt
|
|
25
|
+
}, jt = ({
|
|
26
|
+
onChange: _,
|
|
25
27
|
values: e,
|
|
26
|
-
label:
|
|
27
|
-
placeholder:
|
|
28
|
-
hasError:
|
|
28
|
+
label: H,
|
|
29
|
+
placeholder: K,
|
|
30
|
+
hasError: M,
|
|
29
31
|
onSearch: n,
|
|
30
|
-
onSearchList:
|
|
31
|
-
className:
|
|
32
|
+
onSearchList: z,
|
|
33
|
+
className: E,
|
|
32
34
|
style: q,
|
|
33
|
-
id:
|
|
34
|
-
name:
|
|
35
|
-
searchValue:
|
|
36
|
-
searchPlaceholder:
|
|
37
|
-
customNoOptionsText:
|
|
38
|
-
isCenteredContent:
|
|
39
|
-
itemClassName:
|
|
40
|
-
hasSearch:
|
|
41
|
-
disabled:
|
|
42
|
-
keepLabel:
|
|
43
|
-
options:
|
|
44
|
-
proportions:
|
|
45
|
-
isStayOpenAfterSelection:
|
|
46
|
-
isClearTextAfterSelection:
|
|
35
|
+
id: F,
|
|
36
|
+
name: G,
|
|
37
|
+
searchValue: J,
|
|
38
|
+
searchPlaceholder: P,
|
|
39
|
+
customNoOptionsText: Q,
|
|
40
|
+
isCenteredContent: U,
|
|
41
|
+
itemClassName: X,
|
|
42
|
+
hasSearch: Y,
|
|
43
|
+
disabled: m,
|
|
44
|
+
keepLabel: R,
|
|
45
|
+
options: f = [],
|
|
46
|
+
proportions: I = "m",
|
|
47
|
+
isStayOpenAfterSelection: Z = !0,
|
|
48
|
+
isClearTextAfterSelection: $ = !1,
|
|
47
49
|
fullWidth: k = !0,
|
|
48
50
|
filterable: N = !0,
|
|
49
|
-
isLoading:
|
|
50
|
-
onBlur:
|
|
51
|
-
disableClientFilter:
|
|
52
|
-
...
|
|
53
|
-
},
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
const
|
|
51
|
+
isLoading: S,
|
|
52
|
+
onBlur: tt,
|
|
53
|
+
disableClientFilter: W,
|
|
54
|
+
...et
|
|
55
|
+
}, st) => {
|
|
56
|
+
const v = A(null), p = A(null), [c, a] = T(!1), [d, h] = T("");
|
|
57
|
+
pt(st, () => v.current);
|
|
58
|
+
const nt = dt(), D = F || nt, ot = g(
|
|
57
59
|
k && s.fullWidth,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
), r =
|
|
61
|
-
() => !e.length || e.length > 0 &&
|
|
60
|
+
m && s.disabled,
|
|
61
|
+
E
|
|
62
|
+
), r = b(
|
|
63
|
+
() => !e.length || e.length > 0 && bt(e[0]),
|
|
62
64
|
[e]
|
|
63
|
-
), i =
|
|
64
|
-
(t) => t.label.toLowerCase().includes(
|
|
65
|
-
), [
|
|
65
|
+
), i = b(() => r ? e.map((t) => t.value) : e, [e, r]), rt = b(() => r ? e : f.filter((t) => i.includes(t.value)), [r, f, i, e]), O = b(() => !N || W ? f : f.filter(
|
|
66
|
+
(t) => t.label.toLowerCase().includes(d.toLowerCase())
|
|
67
|
+
), [W, N, f, d]), it = (t) => {
|
|
66
68
|
const o = t.target.value;
|
|
67
|
-
h(o), n == null || n(o),
|
|
68
|
-
},
|
|
69
|
-
var
|
|
69
|
+
h(o), n == null || n(o), a(!0);
|
|
70
|
+
}, j = (t, o) => {
|
|
71
|
+
var u;
|
|
70
72
|
if (i.includes(t)) {
|
|
71
|
-
const V = i.filter((
|
|
72
|
-
|
|
73
|
+
const V = i.filter((x) => x !== t), C = r ? e.filter((x) => x.value !== t) : void 0;
|
|
74
|
+
_(V, C);
|
|
73
75
|
} else {
|
|
74
76
|
const V = [...i, t], C = r ? [...e, o] : void 0;
|
|
75
|
-
|
|
77
|
+
_(V, C);
|
|
76
78
|
}
|
|
77
|
-
(
|
|
78
|
-
},
|
|
79
|
-
const o = i.filter((
|
|
80
|
-
|
|
81
|
-
}, lt = () => {
|
|
82
|
-
g([], []), h(""), n == null || n(""), p(!1);
|
|
79
|
+
(u = v.current) == null || u.focus(), $ && (h(""), n == null || n("")), a(Z);
|
|
80
|
+
}, lt = (t) => {
|
|
81
|
+
const o = i.filter((u) => u !== t), w = r ? e.filter((u) => u.value !== t) : void 0;
|
|
82
|
+
_(o, w);
|
|
83
83
|
}, ct = () => {
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
84
|
+
_([], []), h(""), n == null || n(""), a(!1);
|
|
85
|
+
}, y = () => {
|
|
86
|
+
a(!1), n == null || n(""), h(""), p.current && (p.current.scrollLeft = 0);
|
|
87
|
+
}, { handleKeyDown: at, comboboxProps: ut, listProps: mt } = It({
|
|
88
|
+
id: D,
|
|
89
|
+
options: O,
|
|
90
|
+
isOpen: c,
|
|
91
|
+
searchValue: d,
|
|
92
|
+
onOpen: () => a(!0),
|
|
93
|
+
onSelect: j
|
|
94
|
+
});
|
|
95
|
+
return gt(() => {
|
|
96
|
+
p.current && (p.current.scrollLeft = c ? 1e6 : 0);
|
|
97
|
+
}, [O, e, c]), /* @__PURE__ */ B(L, { isOpen: c, width: "trigger", onClose: y, children: [
|
|
98
|
+
/* @__PURE__ */ B(
|
|
99
|
+
L.Trigger,
|
|
100
|
+
{
|
|
101
|
+
className: ot,
|
|
102
|
+
style: q,
|
|
103
|
+
onBlur: tt,
|
|
104
|
+
onKeyDown: (t) => {
|
|
105
|
+
at(t), _t(t, y);
|
|
106
|
+
},
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ l(
|
|
109
|
+
ht,
|
|
110
110
|
{
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
bordered: !0,
|
|
112
|
+
fullWidth: !0,
|
|
113
|
+
keepLabelFixed: c && !R,
|
|
114
|
+
keepLabel: R,
|
|
115
|
+
value: d || e.length > 0 ? "filled" : "",
|
|
116
|
+
id: D,
|
|
117
|
+
name: G,
|
|
118
|
+
label: H,
|
|
119
|
+
placeholder: K,
|
|
120
|
+
hasError: M,
|
|
121
|
+
proportions: I,
|
|
122
|
+
disabled: m,
|
|
123
|
+
onClear: ct,
|
|
124
|
+
onClick: () => a((t) => !t),
|
|
125
|
+
inputRef: v,
|
|
126
|
+
rightIcon: /* @__PURE__ */ l(
|
|
127
|
+
Dt,
|
|
128
|
+
{
|
|
129
|
+
onMouseDown: (t) => t.preventDefault(),
|
|
130
|
+
className: g(
|
|
131
|
+
s.chevron,
|
|
132
|
+
c && s.chevronActive
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
),
|
|
136
|
+
children: /* @__PURE__ */ B(
|
|
137
|
+
"div",
|
|
138
|
+
{
|
|
139
|
+
className: g(s.root, s.tags),
|
|
140
|
+
ref: p,
|
|
141
|
+
onMouseDown: (t) => t.preventDefault(),
|
|
142
|
+
children: [
|
|
143
|
+
rt.map((t, o) => /* @__PURE__ */ l(
|
|
144
|
+
kt,
|
|
145
|
+
{
|
|
146
|
+
variant: "primary",
|
|
147
|
+
size: I === "l" ? "s" : "xs",
|
|
148
|
+
onClick: (w) => w.stopPropagation(),
|
|
149
|
+
onClose: () => lt(t.value),
|
|
150
|
+
className: s.tag,
|
|
151
|
+
disabled: m,
|
|
152
|
+
children: t.label
|
|
153
|
+
},
|
|
154
|
+
o
|
|
155
|
+
)),
|
|
156
|
+
N && /* @__PURE__ */ l(
|
|
157
|
+
wt,
|
|
158
|
+
{
|
|
159
|
+
id: D,
|
|
160
|
+
ref: v,
|
|
161
|
+
value: d,
|
|
162
|
+
placeholder: P,
|
|
163
|
+
onChange: it,
|
|
164
|
+
...ut,
|
|
165
|
+
"aria-autocomplete": "list",
|
|
166
|
+
className: s.inputBase,
|
|
167
|
+
disabled: m,
|
|
168
|
+
onMouseDown: (t) => t.stopPropagation()
|
|
169
|
+
}
|
|
170
|
+
)
|
|
171
|
+
]
|
|
172
|
+
}
|
|
115
173
|
)
|
|
116
174
|
}
|
|
117
175
|
),
|
|
118
|
-
|
|
119
|
-
|
|
176
|
+
/* @__PURE__ */ l(
|
|
177
|
+
Nt,
|
|
120
178
|
{
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
nt.map((t, o) => /* @__PURE__ */ l(
|
|
126
|
-
_t,
|
|
127
|
-
{
|
|
128
|
-
variant: "primary",
|
|
129
|
-
size: b === "l" ? "s" : "xs",
|
|
130
|
-
onClick: (w) => w.stopPropagation(),
|
|
131
|
-
onClose: () => it(t.value),
|
|
132
|
-
className: s.tag,
|
|
133
|
-
disabled: a,
|
|
134
|
-
children: t.label
|
|
135
|
-
},
|
|
136
|
-
o
|
|
137
|
-
)),
|
|
138
|
-
N && /* @__PURE__ */ l(
|
|
139
|
-
dt,
|
|
140
|
-
{
|
|
141
|
-
id: W,
|
|
142
|
-
ref: _,
|
|
143
|
-
value: v,
|
|
144
|
-
placeholder: B,
|
|
145
|
-
onChange: ot,
|
|
146
|
-
className: s.inputBase,
|
|
147
|
-
disabled: a,
|
|
148
|
-
onMouseDown: (t) => t.stopPropagation()
|
|
149
|
-
}
|
|
150
|
-
)
|
|
151
|
-
]
|
|
179
|
+
...et,
|
|
180
|
+
hasError: M,
|
|
181
|
+
className: g(s.root, s.hint),
|
|
182
|
+
disabled: m
|
|
152
183
|
}
|
|
153
184
|
)
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
vt,
|
|
158
|
-
{
|
|
159
|
-
...S,
|
|
160
|
-
hasError: L,
|
|
161
|
-
className: d(s.root, s.hint),
|
|
162
|
-
disabled: a
|
|
163
|
-
}
|
|
164
|
-
)
|
|
165
|
-
] }),
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
),
|
|
166
188
|
/* @__PURE__ */ l(
|
|
167
|
-
|
|
189
|
+
L.Dropdown,
|
|
168
190
|
{
|
|
169
|
-
className:
|
|
191
|
+
className: g(s.dropdown, k && s.fullWidth),
|
|
170
192
|
children: /* @__PURE__ */ l(
|
|
171
|
-
|
|
193
|
+
vt,
|
|
172
194
|
{
|
|
173
|
-
|
|
195
|
+
...mt,
|
|
196
|
+
"aria-multiselectable": !0,
|
|
197
|
+
isLoading: S,
|
|
174
198
|
values: i,
|
|
175
199
|
className: s.listItem,
|
|
176
|
-
onChangeList:
|
|
177
|
-
options:
|
|
200
|
+
onChangeList: j,
|
|
201
|
+
options: O,
|
|
178
202
|
fullWidth: k,
|
|
179
|
-
proportions:
|
|
180
|
-
searchPlaceholder:
|
|
181
|
-
searchValue:
|
|
182
|
-
itemClassName:
|
|
183
|
-
isCenteredContent:
|
|
184
|
-
customNoOptionsText:
|
|
185
|
-
onSearch:
|
|
186
|
-
hasSearch:
|
|
203
|
+
proportions: I === "l" ? "l" : "m",
|
|
204
|
+
searchPlaceholder: P,
|
|
205
|
+
searchValue: J,
|
|
206
|
+
itemClassName: X,
|
|
207
|
+
isCenteredContent: U,
|
|
208
|
+
customNoOptionsText: Q,
|
|
209
|
+
onSearch: z,
|
|
210
|
+
hasSearch: Y
|
|
187
211
|
}
|
|
188
212
|
)
|
|
189
213
|
}
|
|
190
214
|
)
|
|
191
215
|
] });
|
|
192
|
-
},
|
|
216
|
+
}, Xt = ft(jt);
|
|
193
217
|
export {
|
|
194
|
-
|
|
218
|
+
Xt as SelectMultiple
|
|
195
219
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timeline.context.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Timeline/Timeline.context.ts"],"names":[],"mappings":";AAEA,MAAM,WAAW,eAAe;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Timeline.context.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Timeline/Timeline.context.ts"],"names":[],"mappings":";AAEA,MAAM,WAAW,eAAe;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;CACF;AAED,eAAO,MAAO,uBAAuB;;;+CAAE,kBAAkB,uBAGvD,CAAC"}
|
|
@@ -10,8 +10,10 @@ export interface TimelineProps {
|
|
|
10
10
|
children?: ReactNode;
|
|
11
11
|
/**
|
|
12
12
|
* Indicates the currently active timeline step.
|
|
13
|
+
* Pass `null` (or any negative number) when no step is active yet —
|
|
14
|
+
* every item is then rendered as `inactive`.
|
|
13
15
|
**/
|
|
14
|
-
active?: number;
|
|
16
|
+
active?: number | null;
|
|
15
17
|
/**
|
|
16
18
|
* Adjusts the flex grow ratio between opposite content and content.
|
|
17
19
|
* **Important**: This prop only has an effect when the timeline is vertical (horizontal = false).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timeline.types.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Timeline/Timeline.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,WAAW,aAAa;IAC7B;;QAEI;IACJ,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB
|
|
1
|
+
{"version":3,"file":"Timeline.types.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Timeline/Timeline.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,WAAW,aAAa;IAC7B;;QAEI;IACJ,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;;QAII;IACJ,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvB;;;OAGG;IACH,YAAY,CAAC,EAAE;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;CACF;AAED,MAAM,MAAM,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;AACzD,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC"}
|
|
@@ -2,28 +2,28 @@ import { jsxs as a, jsx as i } from "react/jsx-runtime";
|
|
|
2
2
|
import { Children as v } from "react";
|
|
3
3
|
import { classNames as o } from "../../../utils/class-names.js";
|
|
4
4
|
import { s as t, T as N } from "../../../TimelineBullet-CpAQu1IW.js";
|
|
5
|
-
import { findChildByType as c, getTimelineItemStyles as
|
|
6
|
-
import { useTimelineContext as
|
|
5
|
+
import { findChildByType as c, getTimelineItemStyles as g } from "./TimelineItem.utils.js";
|
|
6
|
+
import { useTimelineContext as x } from "../Timeline.context.js";
|
|
7
7
|
import { getStatus as j, getOrder as z } from "../Timeline.utils.js";
|
|
8
8
|
import { TimelineOppositeContent as A } from "../TimelineOppositeContent/TimelineOppositeContent.js";
|
|
9
9
|
import { TimelineContent as B } from "../TimelineContent/TimelineContent.js";
|
|
10
|
-
const
|
|
10
|
+
const F = ({
|
|
11
11
|
children: p,
|
|
12
12
|
bullet: d,
|
|
13
13
|
tabIndex: n = 0
|
|
14
14
|
}) => {
|
|
15
|
-
const { horizontal: s, active: f, countChildren: r } =
|
|
15
|
+
const { horizontal: s, active: f, countChildren: r } = x(), C = f ?? -1, h = o(
|
|
16
16
|
t.root,
|
|
17
17
|
s && t.horizontal
|
|
18
18
|
), l = v.toArray(p), T = c(
|
|
19
19
|
l,
|
|
20
20
|
A
|
|
21
|
-
), y = c(l, B), e = j(
|
|
21
|
+
), y = c(l, B), e = j(C, n), m = z(n, r), u = m === "last" || r === 1;
|
|
22
22
|
return /* @__PURE__ */ a(
|
|
23
23
|
"li",
|
|
24
24
|
{
|
|
25
|
-
style:
|
|
26
|
-
className:
|
|
25
|
+
style: g(s, m),
|
|
26
|
+
className: h,
|
|
27
27
|
children: [
|
|
28
28
|
T,
|
|
29
29
|
/* @__PURE__ */ a("div", { className: t.lineContainer, children: [
|
|
@@ -49,5 +49,5 @@ const E = ({
|
|
|
49
49
|
);
|
|
50
50
|
};
|
|
51
51
|
export {
|
|
52
|
-
|
|
52
|
+
F as TimelineItem
|
|
53
53
|
};
|
|
@@ -6,7 +6,8 @@ declare class Localization {
|
|
|
6
6
|
constructor();
|
|
7
7
|
init(): Promise<void>;
|
|
8
8
|
load(locale: string): Promise<void>;
|
|
9
|
-
t(key: string): string;
|
|
9
|
+
t(key: string, params?: Record<string, string | number>): string;
|
|
10
|
+
private interpolate;
|
|
10
11
|
}
|
|
11
12
|
export declare const localization: Localization;
|
|
12
13
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localization.d.ts","sourceRoot":"","sources":["../../../src/lib/providers/Localization/localization.ts"],"names":[],"mappings":"AAGA,cAAM,YAAY;IAEjB,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,MAAM,CAA0B;IAExC,OAAO,CAAC,KAAK,CAA2B;IACxC,OAAO,CAAC,KAAK,CAAS;;IAShB,IAAI;IAMJ,IAAI,CAAC,MAAM,EAAE,MAAM;IA6BzB,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"localization.d.ts","sourceRoot":"","sources":["../../../src/lib/providers/Localization/localization.ts"],"names":[],"mappings":"AAGA,cAAM,YAAY;IAEjB,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,MAAM,CAA0B;IAExC,OAAO,CAAC,KAAK,CAA2B;IACxC,OAAO,CAAC,KAAK,CAAS;;IAShB,IAAI;IAMJ,IAAI,CAAC,MAAM,EAAE,MAAM;IA6BzB,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM;IAkBhE,OAAO,CAAC,WAAW;CAQnB;AAED,eAAO,MAAM,YAAY,cAAqB,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { getDefaultLocale as
|
|
5
|
-
const
|
|
6
|
-
class
|
|
1
|
+
var a = Object.defineProperty;
|
|
2
|
+
var c = (e, t, s) => t in e ? a(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
|
|
3
|
+
var o = (e, t, s) => c(e, typeof t != "symbol" ? t + "" : t, s);
|
|
4
|
+
import { getDefaultLocale as l } from "../AlifProvider/AlifProvider.utils.js";
|
|
5
|
+
const h = l();
|
|
6
|
+
class f {
|
|
7
7
|
constructor() {
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
o(this, "translations", {});
|
|
10
|
+
o(this, "locale", h);
|
|
11
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
o(this, "cache", {});
|
|
13
|
+
o(this, "ready", !1);
|
|
14
14
|
if (typeof window < "u") {
|
|
15
15
|
const t = localStorage.getItem("locale");
|
|
16
16
|
t && (this.locale = t);
|
|
@@ -31,25 +31,28 @@ class h {
|
|
|
31
31
|
console.error(`Failed to fetch locale ${t}: ${s.status}`), this.translations = {};
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
const
|
|
35
|
-
this.cache[t] =
|
|
34
|
+
const n = await s.json();
|
|
35
|
+
this.cache[t] = n, this.translations = n, this.locale = t;
|
|
36
36
|
} catch (s) {
|
|
37
37
|
console.error(`Failed to load ${t} translations`, s), this.translations = {};
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
t(t) {
|
|
42
|
-
const
|
|
43
|
-
let
|
|
44
|
-
for (const
|
|
45
|
-
if (
|
|
46
|
-
|
|
41
|
+
t(t, s) {
|
|
42
|
+
const n = t.split(".");
|
|
43
|
+
let i = this.translations;
|
|
44
|
+
for (const r of n)
|
|
45
|
+
if (i && typeof i == "object" && r in i)
|
|
46
|
+
i = i[r];
|
|
47
47
|
else
|
|
48
48
|
return t;
|
|
49
|
-
return typeof
|
|
49
|
+
return typeof i != "string" ? t : s ? this.interpolate(i, s) : i;
|
|
50
|
+
}
|
|
51
|
+
interpolate(t, s) {
|
|
52
|
+
return t.replace(/\{\{\s*(\w+)\s*\}\}/g, (n, i) => i in s ? String(s[i]) : n);
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
|
-
const
|
|
55
|
+
const p = new f();
|
|
53
56
|
export {
|
|
54
|
-
|
|
57
|
+
p as localization
|
|
55
58
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Locale } from '../../AlifProvider/AlifProvider.types';
|
|
2
2
|
export declare const useTranslation: () => {
|
|
3
|
-
t: (key: string) => string;
|
|
3
|
+
t: (key: string, params?: Record<string, string | number>) => string;
|
|
4
4
|
language: Locale;
|
|
5
5
|
changeLanguage: (nextLocale: Locale | ((prev: Locale) => Locale)) => Promise<void>;
|
|
6
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTranslation.d.ts","sourceRoot":"","sources":["../../../../src/lib/providers/Localization/useTranslation/useTranslation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAE/D,eAAO,MAAM,cAAc;aAaV,MAAM;;
|
|
1
|
+
{"version":3,"file":"useTranslation.d.ts","sourceRoot":"","sources":["../../../../src/lib/providers/Localization/useTranslation/useTranslation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAE/D,eAAO,MAAM,cAAc;aAaV,MAAM,WAAW,OAAO,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;;kDATlC,MAAM,KAAK,MAAM;CAY/C,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useAlifProviderContext as c } from "../../AlifProvider/AlifProvider.context.js";
|
|
2
2
|
import { localization as n } from "../localization.js";
|
|
3
3
|
const g = () => {
|
|
4
|
-
const { locale:
|
|
5
|
-
return { t: (o) => n.t(o), language:
|
|
6
|
-
const
|
|
7
|
-
await n.load(
|
|
4
|
+
const { locale: a, setLocale: e } = c();
|
|
5
|
+
return { t: (o, t) => n.t(o, t), language: a, changeLanguage: async (o) => {
|
|
6
|
+
const t = typeof o == "function" ? o(a) : o;
|
|
7
|
+
await n.load(t), e(t);
|
|
8
8
|
} };
|
|
9
9
|
};
|
|
10
10
|
export {
|