alif-ui 2.0.0-alpha.12 → 2.0.0-alpha.14
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/components/Dates/InputDatePicker/InputDatePicker.js +18 -18
- package/dist/components/Dates/PickerInput/PickerInput.js +41 -38
- package/dist/providers/Localization/localization.js +7 -4
- package/dist/providers/Localization/useTranslation/useTranslation.js +6 -6
- package/dist/src/lib/components/Dates/PickerInput/PickerInput.d.ts.map +1 -1
- package/dist/src/lib/providers/Localization/localization.d.ts +2 -1
- package/dist/src/lib/providers/Localization/localization.d.ts.map +1 -1
- package/dist/src/lib/providers/Localization/useTranslation/useTranslation.d.ts +2 -2
- package/dist/src/lib/providers/Localization/useTranslation/useTranslation.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -16,6 +16,23 @@ var _ = ({ value: _, isRange: v, withTime: y, onChange: b, onBlur: x, onClear: S
|
|
|
16
16
|
B(i(e.target.value, V));
|
|
17
17
|
}, W = () => {
|
|
18
18
|
B(""), b(null), S?.();
|
|
19
|
+
}, G = (e) => {
|
|
20
|
+
let t = d(e.target.value, v), n = (e) => T?.some((t) => r.isSameDay(t, e)) ?? !1, i = (e) => r.isOutOfRange(e, C, w) || n(e);
|
|
21
|
+
if (!t) {
|
|
22
|
+
W(), x?.(e);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (v && Array.isArray(t)) {
|
|
26
|
+
let [n, r] = t;
|
|
27
|
+
i(n) || i(r) ? W() : (b(t), H(t)), x?.(e);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (!v && t instanceof Date) if (i(t)) W();
|
|
31
|
+
else {
|
|
32
|
+
let e = y ? u(t, E, D, O, k) : t;
|
|
33
|
+
b(e), H(e);
|
|
34
|
+
}
|
|
35
|
+
x?.(e);
|
|
19
36
|
};
|
|
20
37
|
return p(() => {
|
|
21
38
|
H(_);
|
|
@@ -25,24 +42,6 @@ var _ = ({ value: _, isRange: v, withTime: y, onChange: b, onBlur: x, onClear: S
|
|
|
25
42
|
onClose: () => R(!1),
|
|
26
43
|
position: "bottom-start",
|
|
27
44
|
children: [/* @__PURE__ */ h(n.Trigger, {
|
|
28
|
-
onBlur: (e) => {
|
|
29
|
-
let t = d(e.target.value, v), n = (e) => T?.some((t) => r.isSameDay(t, e)) ?? !1, i = (e) => r.isOutOfRange(e, C, w) || n(e);
|
|
30
|
-
if (!t) {
|
|
31
|
-
W(), x?.(e);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (v && Array.isArray(t)) {
|
|
35
|
-
let [n, r] = t;
|
|
36
|
-
i(n) || i(r) ? W() : (b(t), H(t)), x?.(e);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
if (!v && t instanceof Date) if (i(t)) W();
|
|
40
|
-
else {
|
|
41
|
-
let e = y ? u(t, E, D, O, k) : t;
|
|
42
|
-
b(e), H(e);
|
|
43
|
-
}
|
|
44
|
-
x?.(e);
|
|
45
|
-
},
|
|
46
45
|
className: M,
|
|
47
46
|
style: {
|
|
48
47
|
width: "100%",
|
|
@@ -53,6 +52,7 @@ var _ = ({ value: _, isRange: v, withTime: y, onChange: b, onBlur: x, onClear: S
|
|
|
53
52
|
value: z,
|
|
54
53
|
mask: V,
|
|
55
54
|
onChange: U,
|
|
55
|
+
onBlur: G,
|
|
56
56
|
onClear: S ? W : void 0,
|
|
57
57
|
onFieldClick: () => R((e) => !e),
|
|
58
58
|
rightIcon: P
|
|
@@ -1,46 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import i from "
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
1
|
+
import { resolveTypography as e } from "../../../utils/typography.js";
|
|
2
|
+
import { classNames as t } from "../../../utils/class-names.js";
|
|
3
|
+
import { syncRefs as n } from "../../../utils/sync-refs.js";
|
|
4
|
+
import { useComponentId as r } from "../../../hooks/useComponentId/useComponentId.js";
|
|
5
|
+
import { InputBaseWrapper as i } from "../../Field/InputBaseWrapper/InputBaseWrapper.js";
|
|
6
|
+
import { InputBase as a } from "../../Field/InputBase/InputBase.js";
|
|
7
|
+
import o from "../../../lib/components/Dates/PickerInput/PickerInput.module.js";
|
|
8
|
+
import { useRef as s } from "react";
|
|
9
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
10
|
//#region src/lib/components/Dates/PickerInput/PickerInput.tsx
|
|
9
|
-
var
|
|
10
|
-
let
|
|
11
|
-
return /* @__PURE__ */
|
|
12
|
-
label:
|
|
13
|
-
onClear:
|
|
14
|
-
leftIcon:
|
|
15
|
-
rightIcon:
|
|
16
|
-
id:
|
|
17
|
-
size:
|
|
11
|
+
var u = ({ id: u, label: d, onClear: f, leftIcon: p, rightIcon: m, hasError: h, value: g, className: _, disabled: v, style: y, fullWidth: b = !0, size: x = "m", onFieldClick: S, ref: C, hintLeftSection: w, hintRightSection: T, mask: E, ...D }) => {
|
|
12
|
+
let O = s(null), k = r(u), A = (e, t) => e.length >= t.length ? e : e + t?.slice(e.length);
|
|
13
|
+
return /* @__PURE__ */ c(i, {
|
|
14
|
+
label: d,
|
|
15
|
+
onClear: f,
|
|
16
|
+
leftIcon: p,
|
|
17
|
+
rightIcon: m,
|
|
18
|
+
id: k,
|
|
19
|
+
size: x,
|
|
18
20
|
keepLabel: !0,
|
|
19
21
|
bordered: !0,
|
|
20
|
-
inputRef:
|
|
21
|
-
hasError:
|
|
22
|
-
disabled:
|
|
23
|
-
value:
|
|
24
|
-
fullWidth:
|
|
25
|
-
className:
|
|
26
|
-
style:
|
|
27
|
-
onClick:
|
|
28
|
-
hintLeftSection:
|
|
29
|
-
hintRightSection:
|
|
30
|
-
children: /* @__PURE__ */
|
|
31
|
-
className:
|
|
32
|
-
children: [/* @__PURE__ */
|
|
33
|
-
id:
|
|
34
|
-
ref:
|
|
35
|
-
value:
|
|
36
|
-
disabled:
|
|
37
|
-
...
|
|
38
|
-
}),
|
|
39
|
-
|
|
40
|
-
|
|
22
|
+
inputRef: O,
|
|
23
|
+
hasError: h,
|
|
24
|
+
disabled: v,
|
|
25
|
+
value: g,
|
|
26
|
+
fullWidth: b,
|
|
27
|
+
className: _,
|
|
28
|
+
style: y,
|
|
29
|
+
onClick: S,
|
|
30
|
+
hintLeftSection: w,
|
|
31
|
+
hintRightSection: T,
|
|
32
|
+
children: /* @__PURE__ */ l("div", {
|
|
33
|
+
className: o.wrapper,
|
|
34
|
+
children: [/* @__PURE__ */ c(a, {
|
|
35
|
+
id: k,
|
|
36
|
+
ref: n(O, C),
|
|
37
|
+
value: g,
|
|
38
|
+
disabled: v,
|
|
39
|
+
...D
|
|
40
|
+
}), E && /* @__PURE__ */ c("span", {
|
|
41
|
+
style: e("body", "m"),
|
|
42
|
+
className: t(o.mask, "uiFont"),
|
|
43
|
+
children: A(g, E)
|
|
41
44
|
})]
|
|
42
45
|
})
|
|
43
46
|
});
|
|
44
47
|
};
|
|
45
48
|
//#endregion
|
|
46
|
-
export {
|
|
49
|
+
export { u as PickerInput };
|
|
@@ -40,11 +40,14 @@ var t = e(), n = [
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
t(e) {
|
|
44
|
-
let
|
|
45
|
-
for (let
|
|
43
|
+
t(e, t) {
|
|
44
|
+
let n = e.split("."), r = this.translations;
|
|
45
|
+
for (let t of n) if (r && typeof r == "object" && t in r) r = r[t];
|
|
46
46
|
else return e;
|
|
47
|
-
return typeof
|
|
47
|
+
return typeof r == "string" ? t ? this.interpolate(r, t) : r : e;
|
|
48
|
+
}
|
|
49
|
+
interpolate(e, t) {
|
|
50
|
+
return e.replace(/\{\{\s*(\w+)\s*\}\}/g, (e, n) => n in t ? String(t[n]) : e);
|
|
48
51
|
}
|
|
49
52
|
}();
|
|
50
53
|
//#endregion
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { useAlifProviderContext as e } from "../../AlifProvider/AlifProvider.context.js";
|
|
2
2
|
import { localization as t } from "../localization.js";
|
|
3
3
|
//#region src/lib/providers/Localization/useTranslation/useTranslation.ts
|
|
4
|
-
var n = () => {
|
|
5
|
-
let { locale:
|
|
4
|
+
var n = (n) => {
|
|
5
|
+
let { locale: r, setLocale: i } = e();
|
|
6
6
|
return {
|
|
7
|
-
t: (e) => t.t(e),
|
|
8
|
-
language:
|
|
7
|
+
t: (e, r) => t.t(n ? `${n}.${e}` : e, r),
|
|
8
|
+
language: r,
|
|
9
9
|
changeLanguage: async (e) => {
|
|
10
|
-
let
|
|
11
|
-
await t.load(
|
|
10
|
+
let n = typeof e == "function" ? e(r) : e;
|
|
11
|
+
await t.load(n), i(n);
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PickerInput.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/Dates/PickerInput/PickerInput.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAKvD,eAAO,MAAM,WAAW,GAAI,iLAmBzB,gBAAgB,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"PickerInput.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/Dates/PickerInput/PickerInput.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAKvD,eAAO,MAAM,WAAW,GAAI,iLAmBzB,gBAAgB,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,4CAkDtC,CAAC"}
|
|
@@ -7,7 +7,8 @@ declare class Localization {
|
|
|
7
7
|
constructor();
|
|
8
8
|
init(loader: TranslationsLoader): Promise<void>;
|
|
9
9
|
load(locale: string): Promise<void>;
|
|
10
|
-
t(key: string): string;
|
|
10
|
+
t(key: string, params?: Record<string, string | number>): string;
|
|
11
|
+
private interpolate;
|
|
11
12
|
}
|
|
12
13
|
export declare const localization: Localization;
|
|
13
14
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localization.d.ts","sourceRoot":"","sources":["../../../../../src/lib/providers/Localization/localization.ts"],"names":[],"mappings":"AAMA,KAAK,kBAAkB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;AAE3E,cAAM,YAAY;IAEjB,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,MAAM,CAA0B;IAExC,OAAO,CAAC,KAAK,CAA2B;IACxC,OAAO,CAAC,MAAM,CAAmC;;IAS3C,IAAI,CAAC,MAAM,EAAE,kBAAkB;IAK/B,IAAI,CAAC,MAAM,EAAE,MAAM;IAkCzB,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"localization.d.ts","sourceRoot":"","sources":["../../../../../src/lib/providers/Localization/localization.ts"],"names":[],"mappings":"AAMA,KAAK,kBAAkB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;AAE3E,cAAM,YAAY;IAEjB,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,MAAM,CAA0B;IAExC,OAAO,CAAC,KAAK,CAA2B;IACxC,OAAO,CAAC,MAAM,CAAmC;;IAS3C,IAAI,CAAC,MAAM,EAAE,kBAAkB;IAK/B,IAAI,CAAC,MAAM,EAAE,MAAM;IAkCzB,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAkBvD,OAAO,CAAC,WAAW;CAQnB;AAED,eAAO,MAAM,YAAY,cAAqB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Locale } from '../../AlifProvider/AlifProvider.types';
|
|
2
|
-
export declare const useTranslation: () => {
|
|
3
|
-
t: (key: string) => string;
|
|
2
|
+
export declare const useTranslation: (keyPrefix?: 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;
|
|
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,GAAI,YAAY,MAAM;aAahC,MAAM,WAAW,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;;iCATnD,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CAahD,CAAC"}
|