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.
Files changed (29) hide show
  1. package/dist/alif-ui.css +1 -1
  2. package/dist/components/ListItem/ListItem.d.ts +3 -2
  3. package/dist/components/ListItem/ListItem.d.ts.map +1 -1
  4. package/dist/components/ListItem/ListItem.js +91 -84
  5. package/dist/components/ListItem/ListItem.types.d.ts +9 -0
  6. package/dist/components/ListItem/ListItem.types.d.ts.map +1 -1
  7. package/dist/components/ListItem/ListItem.utils.d.ts +1 -0
  8. package/dist/components/ListItem/ListItem.utils.d.ts.map +1 -1
  9. package/dist/components/ListItem/ListItem.utils.js +20 -19
  10. package/dist/components/Select/Select.d.ts.map +1 -1
  11. package/dist/components/Select/Select.js +116 -101
  12. package/dist/components/Select/useSelectNavigation.d.ts +28 -0
  13. package/dist/components/Select/useSelectNavigation.d.ts.map +1 -0
  14. package/dist/components/Select/useSelectNavigation.js +58 -0
  15. package/dist/components/SelectMultiple/SelectMultiple.d.ts.map +1 -1
  16. package/dist/components/SelectMultiple/SelectMultiple.js +185 -161
  17. package/dist/components/Timeline/Timeline.context.d.ts +1 -1
  18. package/dist/components/Timeline/Timeline.context.d.ts.map +1 -1
  19. package/dist/components/Timeline/Timeline.js +1 -1
  20. package/dist/components/Timeline/Timeline.types.d.ts +3 -1
  21. package/dist/components/Timeline/Timeline.types.d.ts.map +1 -1
  22. package/dist/components/Timeline/TimelineItem/TimelineItem.js +8 -8
  23. package/dist/providers/Localization/localization.d.ts +2 -1
  24. package/dist/providers/Localization/localization.d.ts.map +1 -1
  25. package/dist/providers/Localization/localization.js +24 -21
  26. package/dist/providers/Localization/useTranslation/useTranslation.d.ts +1 -1
  27. package/dist/providers/Localization/useTranslation/useTranslation.d.ts.map +1 -1
  28. package/dist/providers/Localization/useTranslation/useTranslation.js +4 -4
  29. 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;AA8O7D,eAAO,MAAM,cAAc,0EAEtB,WAAW,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 D, jsx as l } from "react/jsx-runtime";
2
- import { forwardRef as at, useRef as A, useState as P, useImperativeHandle as ut, useId as ft, useMemo as I, useEffect as mt } from "react";
3
- import { classNames as d } from "../../utils/class-names.js";
4
- import { InputBaseWrapper as pt } from "../Field/InputBaseWrapper/InputBaseWrapper.js";
5
- import { InputBase as dt } from "../Field/InputBase/InputBase.js";
6
- import { isObjectValue as gt } from "../Select/Select.utils.js";
7
- import { Popover as x } from "../Popover/Popover.js";
8
- import { Tag as _t } from "../Tag/Tag.js";
9
- import { Hinter as vt } from "../Hinter/Hinter.js";
10
- import { ListItem as ht } from "../ListItem/ListItem.js";
11
- import { OutlineNavigationChevronDownSmall as wt } from "../../icons/components/OutlineNavigationChevronDownSmall.js";
12
- const It = "_root_bn1kg_1", bt = "_listItem_bn1kg_6", kt = "_hint_bn1kg_11", Nt = "_tags_bn1kg_15", Vt = "_tag_bn1kg_15", Ct = "_inputBase_bn1kg_28", Ot = "_fullWidth_bn1kg_32", Dt = "_disabled_bn1kg_36", xt = "_chevron_bn1kg_40", Lt = "_chevronActive_bn1kg_44", s = {
13
- root: It,
14
- listItem: bt,
15
- hint: kt,
16
- tags: Nt,
17
- tag: Vt,
18
- inputBase: Ct,
19
- fullWidth: Ot,
20
- disabled: Dt,
21
- chevron: xt,
22
- chevronActive: Lt
23
- }, Bt = ({
24
- onChange: g,
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: T,
27
- placeholder: y,
28
- hasError: L,
28
+ label: H,
29
+ placeholder: K,
30
+ hasError: M,
29
31
  onSearch: n,
30
- onSearchList: H,
31
- className: z,
32
+ onSearchList: z,
33
+ className: E,
32
34
  style: q,
33
- id: E,
34
- name: F,
35
- searchValue: G,
36
- searchPlaceholder: B,
37
- customNoOptionsText: J,
38
- isCenteredContent: K,
39
- itemClassName: Q,
40
- hasSearch: U,
41
- disabled: a,
42
- keepLabel: M,
43
- options: u = [],
44
- proportions: b = "m",
45
- isStayOpenAfterSelection: X = !0,
46
- isClearTextAfterSelection: Y = !1,
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: Z,
50
- onBlur: $,
51
- disableClientFilter: R,
52
- ...S
53
- }, tt) => {
54
- const _ = A(null), f = A(null), [m, p] = P(!1), [v, h] = P("");
55
- ut(tt, () => _.current);
56
- const et = ft(), W = E || et, st = d(
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
- a && s.disabled,
59
- z
60
- ), r = I(
61
- () => !e.length || e.length > 0 && gt(e[0]),
60
+ m && s.disabled,
61
+ E
62
+ ), r = b(
63
+ () => !e.length || e.length > 0 && bt(e[0]),
62
64
  [e]
63
- ), i = I(() => r ? e.map((t) => t.value) : e, [e, r]), nt = I(() => r ? e : u.filter((t) => i.includes(t.value)), [r, u, i, e]), j = I(() => !N || R ? u : u.filter(
64
- (t) => t.label.toLowerCase().includes(v.toLowerCase())
65
- ), [R, N, u, v]), ot = (t) => {
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), p(!0);
68
- }, rt = (t, o) => {
69
- var c;
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((O) => O !== t), C = r ? e.filter((O) => O.value !== t) : void 0;
72
- g(V, C);
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
- g(V, C);
77
+ _(V, C);
76
78
  }
77
- (c = _.current) == null || c.focus(), Y && (h(""), n == null || n("")), p(X);
78
- }, it = (t) => {
79
- const o = i.filter((c) => c !== t), w = r ? e.filter((c) => c.value !== t) : void 0;
80
- g(o, w);
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
- p(!1), n == null || n(""), h(""), f.current && (f.current.scrollLeft = 0);
85
- };
86
- return mt(() => {
87
- f.current && (f.current.scrollLeft = m ? 1e6 : 0);
88
- }, [j, e, m]), /* @__PURE__ */ D(x, { isOpen: m, width: "trigger", onClose: ct, children: [
89
- /* @__PURE__ */ D(x.Trigger, { className: st, style: q, onBlur: $, children: [
90
- /* @__PURE__ */ l(
91
- pt,
92
- {
93
- bordered: !0,
94
- fullWidth: !0,
95
- keepLabelFixed: m && !M,
96
- keepLabel: M,
97
- value: v || e.length > 0 ? "filled" : "",
98
- id: W,
99
- name: F,
100
- label: T,
101
- placeholder: y,
102
- hasError: L,
103
- proportions: b,
104
- disabled: a,
105
- onClear: lt,
106
- onClick: () => p((t) => !t),
107
- inputRef: _,
108
- rightIcon: /* @__PURE__ */ l(
109
- wt,
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
- onMouseDown: (t) => t.preventDefault(),
112
- className: d(
113
- s.chevron,
114
- m && s.chevronActive
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
- children: /* @__PURE__ */ D(
119
- "div",
176
+ /* @__PURE__ */ l(
177
+ Nt,
120
178
  {
121
- className: d(s.root, s.tags),
122
- ref: f,
123
- onMouseDown: (t) => t.preventDefault(),
124
- children: [
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
- /* @__PURE__ */ l(
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
- x.Dropdown,
189
+ L.Dropdown,
168
190
  {
169
- className: d(s.dropdown, k && s.fullWidth),
191
+ className: g(s.dropdown, k && s.fullWidth),
170
192
  children: /* @__PURE__ */ l(
171
- ht,
193
+ vt,
172
194
  {
173
- isLoading: Z,
195
+ ...mt,
196
+ "aria-multiselectable": !0,
197
+ isLoading: S,
174
198
  values: i,
175
199
  className: s.listItem,
176
- onChangeList: rt,
177
- options: j,
200
+ onChangeList: j,
201
+ options: O,
178
202
  fullWidth: k,
179
- proportions: b === "l" ? "l" : "m",
180
- searchPlaceholder: B,
181
- searchValue: G,
182
- itemClassName: Q,
183
- isCenteredContent: K,
184
- customNoOptionsText: J,
185
- onSearch: H,
186
- hasSearch: U
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
- }, Et = at(Bt);
216
+ }, Xt = ft(jt);
193
217
  export {
194
- Et as SelectMultiple
218
+ Xt as SelectMultiple
195
219
  };
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  export interface TimelineContext {
3
3
  horizontal: boolean;
4
- active: number;
4
+ active?: number | null;
5
5
  countChildren?: number;
6
6
  contentRatio?: {
7
7
  opposite?: number;
@@ -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;IACf,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"}
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,7 +10,7 @@ const x = "_root_18cyb_1", y = "_horizontal_18cyb_36", m = {
10
10
  horizontal: y
11
11
  }, o = ({
12
12
  horizontal: t = !1,
13
- active: l = 0,
13
+ active: l,
14
14
  children: n,
15
15
  contentRatio: s = { opposite: 1, main: 1 }
16
16
  }) => {
@@ -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;;QAEI;IACJ,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;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"}
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 x } from "./TimelineItem.utils.js";
6
- import { useTimelineContext as g } from "../Timeline.context.js";
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 E = ({
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 } = g(), h = Math.max(0, f), C = o(
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(h, n), m = z(n, r), u = m === "last" || r === 1;
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: x(s, m),
26
- className: C,
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
- E as TimelineItem
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;CAetB;AAED,eAAO,MAAM,YAAY,cAAqB,CAAC"}
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 e = Object.defineProperty;
2
- var r = (o, t, s) => t in o ? e(o, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : o[t] = s;
3
- var i = (o, t, s) => r(o, typeof t != "symbol" ? t + "" : t, s);
4
- import { getDefaultLocale as c } from "../AlifProvider/AlifProvider.utils.js";
5
- const l = c();
6
- class h {
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
- i(this, "translations", {});
10
- i(this, "locale", l);
9
+ o(this, "translations", {});
10
+ o(this, "locale", h);
11
11
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
- i(this, "cache", {});
13
- i(this, "ready", !1);
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 a = await s.json();
35
- this.cache[t] = a, this.translations = a, this.locale = 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 s = t.split(".");
43
- let a = this.translations;
44
- for (const n of s)
45
- if (a && typeof a == "object" && n in a)
46
- a = a[n];
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 a == "string" ? a : t;
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 u = new h();
55
+ const p = new f();
53
56
  export {
54
- u as localization
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;;kDATQ,MAAM,KAAK,MAAM;CAW/C,CAAC"}
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: t, setLocale: e } = c();
5
- return { t: (o) => n.t(o), language: t, changeLanguage: async (o) => {
6
- const a = typeof o == "function" ? o(t) : o;
7
- await n.load(a), e(a);
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 {