alif-ui 2.0.0-alpha.11 → 2.0.0-alpha.13
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/Backdrop/Backdrop.js +1 -1
- package/dist/components/Popover/PopoverDropdown/PopoverDropdown.js +20 -17
- package/dist/components/Popover/PopoverTrigger/PopoverTrigger.js +2 -2
- package/dist/providers/Localization/localization.js +7 -4
- package/dist/providers/Localization/useTranslation/useTranslation.js +6 -6
- package/dist/src/lib/components/Backdrop/Backdrop.d.ts.map +1 -1
- package/dist/src/lib/components/Popover/Popover.d.ts +1 -1
- package/dist/src/lib/components/Popover/PopoverDropdown/PopoverDropdown.d.ts +1 -1
- package/dist/src/lib/components/Popover/PopoverDropdown/PopoverDropdown.d.ts.map +1 -1
- package/dist/src/lib/components/Popover/PopoverTrigger/PopoverTrigger.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
|
@@ -11,7 +11,7 @@ import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
|
11
11
|
//#region src/lib/components/Backdrop/Backdrop.tsx
|
|
12
12
|
var d = ({ isOpen: d, onClose: f, children: p, closeOnClickOutside: m = !0, className: h, zIndex: g, transitionProps: _, ...v }) => {
|
|
13
13
|
let y = r(d), b = (e) => {
|
|
14
|
-
e.target === e.currentTarget && m && f();
|
|
14
|
+
e.stopPropagation(), e.target === e.currentTarget && m && f();
|
|
15
15
|
};
|
|
16
16
|
return c(() => {
|
|
17
17
|
let e = (e) => {
|
|
@@ -4,36 +4,39 @@ import { usePopoverContext as n } from "../Popover.context.js";
|
|
|
4
4
|
import { PopoverArrow as r } from "./PopoverArrow.js";
|
|
5
5
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
6
|
//#region src/lib/components/Popover/PopoverDropdown/PopoverDropdown.tsx
|
|
7
|
-
var o = ({ children: o, className: s, style: c,
|
|
8
|
-
let { isOpen:
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
if (!
|
|
7
|
+
var o = ({ children: o, className: s, style: c, onClick: l, ...u }) => {
|
|
8
|
+
let { isOpen: d, isOpenControlled: f, placement: p, setPopoverRefState: m, zIndex: h, width: g, withArrow: _, arrowPlacement: v, triggerRefState: y, transitionProps: b, isFixed: x, delayedClose: S, delayedOpen: C, triggerType: w } = n(), T = w === "hover" || w === "click-hover", E = () => {
|
|
9
|
+
T && C();
|
|
10
|
+
}, D = (e) => {
|
|
11
|
+
if (!T) return;
|
|
12
12
|
let t = e.relatedTarget;
|
|
13
|
-
t instanceof Node &&
|
|
13
|
+
t instanceof Node && y?.contains(t) || S();
|
|
14
|
+
}, O = (e) => {
|
|
15
|
+
e.stopPropagation(), l?.(e);
|
|
14
16
|
};
|
|
15
17
|
return /* @__PURE__ */ i(e, {
|
|
16
|
-
isFixed:
|
|
18
|
+
isFixed: x,
|
|
17
19
|
placement: {
|
|
18
|
-
...
|
|
19
|
-
zIndex:
|
|
20
|
+
...p,
|
|
21
|
+
zIndex: h
|
|
20
22
|
},
|
|
21
23
|
children: /* @__PURE__ */ i(t, {
|
|
22
|
-
mounted:
|
|
23
|
-
...
|
|
24
|
+
mounted: f || d,
|
|
25
|
+
...b,
|
|
24
26
|
children: (e) => /* @__PURE__ */ a("div", {
|
|
25
27
|
"data-popover-dropdown": !0,
|
|
26
28
|
style: {
|
|
27
29
|
...e,
|
|
28
30
|
...c,
|
|
29
|
-
width:
|
|
31
|
+
width: g === "trigger" ? y?.getBoundingClientRect().width : g
|
|
30
32
|
},
|
|
31
33
|
className: s,
|
|
32
|
-
ref:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
ref: m,
|
|
35
|
+
onClick: O,
|
|
36
|
+
onMouseEnter: E,
|
|
37
|
+
onMouseLeave: D,
|
|
38
|
+
...u,
|
|
39
|
+
children: [_ && /* @__PURE__ */ i(r, { ...v }), o]
|
|
37
40
|
})
|
|
38
41
|
})
|
|
39
42
|
});
|
|
@@ -21,8 +21,8 @@ var a = ({ children: a, className: o, ...s }) => {
|
|
|
21
21
|
t instanceof Node && h?.contains(t) || f();
|
|
22
22
|
},
|
|
23
23
|
className: e(r.popoverTrigger, o),
|
|
24
|
-
onClick: () => {
|
|
25
|
-
m
|
|
24
|
+
onClick: (e) => {
|
|
25
|
+
e.stopPropagation(), !m && (p === "click" || p === "click-hover") && l();
|
|
26
26
|
},
|
|
27
27
|
...s,
|
|
28
28
|
children: a
|
|
@@ -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":"Backdrop.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/Backdrop/Backdrop.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAOjD,eAAO,MAAM,QAAQ,GAAI,kGAStB,aAAa,
|
|
1
|
+
{"version":3,"file":"Backdrop.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/Backdrop/Backdrop.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAOjD,eAAO,MAAM,QAAQ,GAAI,kGAStB,aAAa,4CAoDf,CAAC"}
|
|
@@ -2,6 +2,6 @@ import { PopoverProps } from './Popover.types';
|
|
|
2
2
|
export declare const Popover: {
|
|
3
3
|
({ children, offset, position, isOpen: isOpenControlled, onChange, onClose, withArrow, width, zIndex, isFixed, transitionProps, triggerType, disabled, }: PopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
Trigger: ({ children, className, ...props }: import('./PopoverTrigger/PopoverTrigger.types').PopoverTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
Dropdown: ({ children, className, style, ...restProps }: import('./PopoverDropdown/PopoverDropdown.types').PopoverDropdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
Dropdown: ({ children, className, style, onClick, ...restProps }: import('./PopoverDropdown/PopoverDropdown.types').PopoverDropdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
};
|
|
7
7
|
//# sourceMappingURL=Popover.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PopoverDropdownProps } from './PopoverDropdown.types';
|
|
2
|
-
export declare const PopoverDropdown: ({ children, className, style, ...restProps }: PopoverDropdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const PopoverDropdown: ({ children, className, style, onClick, ...restProps }: PopoverDropdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=PopoverDropdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopoverDropdown.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/Popover/PopoverDropdown/PopoverDropdown.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAI/D,eAAO,MAAM,eAAe,GAAI,
|
|
1
|
+
{"version":3,"file":"PopoverDropdown.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/Popover/PopoverDropdown/PopoverDropdown.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAI/D,eAAO,MAAM,eAAe,GAAI,uDAM7B,oBAAoB,4CAuEtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopoverTrigger.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/Popover/PopoverTrigger/PopoverTrigger.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAI7D,eAAO,MAAM,cAAc,GAAI,mCAI5B,mBAAmB,
|
|
1
|
+
{"version":3,"file":"PopoverTrigger.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/Popover/PopoverTrigger/PopoverTrigger.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAI7D,eAAO,MAAM,cAAc,GAAI,mCAI5B,mBAAmB,4CAkDrB,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"}
|