asheeui 0.6.14 → 0.7.0
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/README.md +1 -14
- package/dist/AsheeUIProvider.js +22 -24
- package/dist/components/accordion/Accordion.js +79 -173
- package/dist/components/accordion/accordion-config.js +12 -13
- package/dist/components/accordion/accordion-styles.js +21 -24
- package/dist/components/autocomplete/Autocomplete.js +78 -136
- package/dist/components/autocomplete/autocomplete-config.js +7 -12
- package/dist/components/button/Button.d.ts +29 -1
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/button/Button.js +47 -108
- package/dist/components/button/button-config.js +16 -17
- package/dist/components/button/button-styles.js +10 -11
- package/dist/components/card/Card.d.ts +36 -16
- package/dist/components/card/Card.d.ts.map +1 -1
- package/dist/components/card/Card.js +115 -205
- package/dist/components/card/card-config.js +24 -21
- package/dist/components/card/card-styles.js +19 -22
- package/dist/components/carousel/Carousel.js +123 -248
- package/dist/components/carousel/carousel-config.js +24 -25
- package/dist/components/carousel/carousel-styles.js +14 -16
- package/dist/components/chip/Chip.js +84 -191
- package/dist/components/chip/chip-config.js +13 -14
- package/dist/components/chip/chip-styles.js +22 -26
- package/dist/components/date-picker/Calendar.d.ts +3 -3
- package/dist/components/date-picker/Calendar.d.ts.map +1 -1
- package/dist/components/date-picker/Calendar.js +141 -222
- package/dist/components/date-picker/DatePicker.d.ts +5 -5
- package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/components/date-picker/DatePicker.js +122 -220
- package/dist/components/date-picker/TimeSpinner.js +58 -82
- package/dist/components/date-picker/date-picker-config.d.ts +4 -4
- package/dist/components/date-picker/date-picker-config.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker-config.js +10 -11
- package/dist/components/date-picker/date-picker-styles.js +44 -45
- package/dist/components/date-picker/date-picker.helpers.d.ts +4 -4
- package/dist/components/date-picker/date-picker.helpers.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker.helpers.js +74 -102
- package/dist/components/drawer/Drawer.d.ts +26 -8
- package/dist/components/drawer/Drawer.d.ts.map +1 -1
- package/dist/components/drawer/Drawer.js +54 -131
- package/dist/components/drawer/drawer-config.js +14 -15
- package/dist/components/drawer/drawer-styles.js +38 -42
- package/dist/components/field/FieldShell.js +49 -56
- package/dist/components/field/field-config.js +17 -18
- package/dist/components/field/field-styles.js +8 -8
- package/dist/components/image/Image.d.ts +7 -7
- package/dist/components/image/Image.d.ts.map +1 -1
- package/dist/components/image/Image.js +65 -132
- package/dist/components/image/image-config.js +17 -18
- package/dist/components/image/image-styles.js +14 -15
- package/dist/components/input/Input.js +65 -150
- package/dist/components/input/PasswordInput.js +30 -49
- package/dist/components/input/input-config.js +7 -7
- package/dist/components/input/input-styles.js +9 -10
- package/dist/components/keyboard/KeyboardContext.js +10 -11
- package/dist/components/keyboard/KeyboardProvider.js +100 -181
- package/dist/components/keyboard/OnScreenKeyboard.d.ts.map +1 -1
- package/dist/components/keyboard/OnScreenKeyboard.js +159 -166
- package/dist/components/keyboard/keyboard-config.js +59 -57
- package/dist/components/keyboard/keyboard-styles.js +10 -11
- package/dist/components/keyboard/use-keyboard-field.js +29 -21
- package/dist/components/link/Link.js +47 -137
- package/dist/components/link/link-config.js +14 -15
- package/dist/components/link/link-styles.js +25 -29
- package/dist/components/marquee/Marquee.js +55 -144
- package/dist/components/marquee/marquee-config.js +18 -19
- package/dist/components/marquee/marquee-styles.js +13 -15
- package/dist/components/modal/Modal.d.ts +26 -10
- package/dist/components/modal/Modal.d.ts.map +1 -1
- package/dist/components/modal/Modal.js +56 -136
- package/dist/components/modal/modal-config.js +15 -16
- package/dist/components/modal/modal-styles.js +13 -14
- package/dist/components/multi-select/MultiSelect.d.ts +18 -2
- package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
- package/dist/components/multi-select/MultiSelect.js +149 -283
- package/dist/components/multi-select/multi-select-config.d.ts +23 -18
- package/dist/components/multi-select/multi-select-config.d.ts.map +1 -1
- package/dist/components/multi-select/multi-select-config.js +18 -21
- package/dist/components/multi-select/multi-select-styles.js +17 -20
- package/dist/components/radio/Radio.js +43 -80
- package/dist/components/radio/RadioGroup.js +57 -155
- package/dist/components/radio/radio-config.js +15 -16
- package/dist/components/radio/radio-context.js +6 -6
- package/dist/components/radio/radio-styles.js +55 -60
- package/dist/components/resizable-screen/ResizableScreen.js +87 -177
- package/dist/components/resizable-screen/resizable-screen-config.js +16 -17
- package/dist/components/select/Select.d.ts +3 -2
- package/dist/components/select/Select.d.ts.map +1 -1
- package/dist/components/select/Select.js +97 -195
- package/dist/components/select/select-config.js +8 -9
- package/dist/components/select/select-styles.js +5 -5
- package/dist/components/select-menu/SelectMenu.d.ts.map +1 -1
- package/dist/components/select-menu/SelectMenu.js +102 -196
- package/dist/components/select-menu/select-menu-config.js +12 -12
- package/dist/components/select-menu/use-select-floating.d.ts +11 -1
- package/dist/components/select-menu/use-select-floating.d.ts.map +1 -1
- package/dist/components/select-menu/use-select-floating.js +41 -48
- package/dist/components/sidebar/Sidebar.d.ts +43 -22
- package/dist/components/sidebar/Sidebar.d.ts.map +1 -1
- package/dist/components/sidebar/Sidebar.js +146 -331
- package/dist/components/sidebar/sidebar-config.d.ts +98 -31
- package/dist/components/sidebar/sidebar-config.d.ts.map +1 -1
- package/dist/components/sidebar/sidebar-config.js +47 -33
- package/dist/components/sidebar/sidebar-styles.js +27 -32
- package/dist/components/spinner/spinner-config.js +12 -13
- package/dist/components/spinner/spinner-styles.js +13 -14
- package/dist/components/spinner/spinner.js +39 -82
- package/dist/components/switch/Switch.js +62 -154
- package/dist/components/switch/switch-config.js +11 -12
- package/dist/components/switch/switch-styles.js +14 -16
- package/dist/components/table/Table.js +64 -186
- package/dist/components/table/table-config.js +17 -18
- package/dist/components/table/table-styles.js +48 -52
- package/dist/components/tabs/Tabs.d.ts +16 -8
- package/dist/components/tabs/Tabs.d.ts.map +1 -1
- package/dist/components/tabs/Tabs.js +93 -208
- package/dist/components/tabs/tabs-config.d.ts +42 -20
- package/dist/components/tabs/tabs-config.d.ts.map +1 -1
- package/dist/components/tabs/tabs-config.js +26 -18
- package/dist/components/tabs/tabs-styles.js +15 -17
- package/dist/components/textarea/Textarea.js +52 -138
- package/dist/components/textarea/textarea-config.js +10 -11
- package/dist/components/textarea/textarea-styles.js +9 -10
- package/dist/components/toast/ToastContext.js +22 -26
- package/dist/components/toast/ToastItem.js +82 -144
- package/dist/components/toast/ToastProvider.d.ts.map +1 -1
- package/dist/components/toast/ToastProvider.js +128 -190
- package/dist/components/toast/toast-config.js +23 -24
- package/dist/components/toast/toast-styles.js +50 -55
- package/dist/components/toast/use-pausable-timeout.js +17 -13
- package/dist/components/tooltip/Tooltip.d.ts +5 -0
- package/dist/components/tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/Tooltip.js +68 -158
- package/dist/components/tooltip/tooltip-config.d.ts +25 -0
- package/dist/components/tooltip/tooltip-config.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip-config.js +26 -22
- package/dist/components/tooltip/tooltip-styles.js +15 -17
- package/dist/config/default-config.js +11 -34
- package/dist/config/resolve-color.js +23 -23
- package/dist/config/resolve-config.d.ts.map +1 -1
- package/dist/config/resolve-config.js +14 -12
- package/dist/icons/ArrowLeftIcon.js +16 -19
- package/dist/icons/CalendarIcon.js +43 -24
- package/dist/icons/CheckIcon.js +16 -19
- package/dist/icons/ChevronDownIcon.js +15 -21
- package/dist/icons/ChevronLeftIcon.js +16 -19
- package/dist/icons/ChevronRightIcon.js +16 -19
- package/dist/icons/ChevronUpIcon.js +16 -19
- package/dist/icons/ClearIcon.js +26 -22
- package/dist/icons/ClockIcon.js +20 -22
- package/dist/icons/CloseIcon.js +26 -22
- package/dist/icons/ErrorIcon.js +16 -19
- package/dist/icons/ExternalLinkIcon.js +25 -23
- package/dist/icons/EyeIcon.js +20 -22
- package/dist/icons/EyeOffIcon.js +21 -22
- package/dist/icons/InfoIcon.js +16 -19
- package/dist/icons/SearchIcon.js +25 -22
- package/dist/icons/WarningIcon.js +16 -19
- package/dist/index.js +65 -163
- package/dist/libs/context.js +10 -13
- package/dist/libs/index.js +1 -0
- package/dist/libs/registry.js +10 -12
- package/dist/libs/use-floating-z-index.d.ts +32 -0
- package/dist/libs/use-floating-z-index.d.ts.map +1 -0
- package/dist/libs/use-floating-z-index.js +16 -0
- package/dist/libs/use-isomorphic-layout-effect.js +5 -5
- package/dist/scripts/AsheeThemeScript.js +35 -44
- package/dist/shared/radius.d.ts.map +1 -1
- package/dist/shared/radius.js +12 -13
- package/dist/shared/variant.js +46 -134
- package/dist/theme/color.js +28 -28
- package/dist/theme/controller.d.ts.map +1 -1
- package/dist/theme/controller.js +65 -178
- package/dist/theme/useTheme.js +13 -44
- package/dist/utils/cn.js +7 -7
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/merge-object.js +13 -14
- package/dist/utils/resolve-token.js +11 -14
- package/dist/utils/stacking.d.ts +76 -0
- package/dist/utils/stacking.d.ts.map +1 -0
- package/dist/utils/stacking.js +34 -0
- package/package.json +12 -11
|
@@ -1,46 +1,42 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
//#region src/components/drawer/drawer-styles.ts
|
|
3
|
+
var e = {
|
|
4
|
+
sm: "w-80",
|
|
5
|
+
md: "w-[28rem]",
|
|
6
|
+
lg: "w-[36rem]",
|
|
7
|
+
full: "w-screen"
|
|
7
8
|
}, t = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
sm: "h-80",
|
|
10
|
+
md: "h-[28rem]",
|
|
11
|
+
lg: "h-[36rem]",
|
|
12
|
+
full: "h-screen"
|
|
13
|
+
}, n = {
|
|
14
|
+
right: "justify-end items-stretch",
|
|
15
|
+
left: "justify-start items-stretch",
|
|
16
|
+
top: "flex-col justify-start items-stretch",
|
|
17
|
+
bottom: "flex-col justify-end items-stretch"
|
|
17
18
|
}, r = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
export {
|
|
41
|
-
s as DRAWER_ANIMATION_STATE,
|
|
42
|
-
r as DRAWER_BORDER_PLACEMENT_CLASS,
|
|
43
|
-
o as DRAWER_CONTAINER_PLACEMENT_CLASS,
|
|
44
|
-
t as DRAWER_HEIGHT_CLASS,
|
|
45
|
-
e as DRAWER_WIDTH_CLASS
|
|
19
|
+
right: "border-l",
|
|
20
|
+
left: "border-r",
|
|
21
|
+
top: "border-b",
|
|
22
|
+
bottom: "border-t"
|
|
23
|
+
}, i = {
|
|
24
|
+
right: {
|
|
25
|
+
closed: "drawer-slide-right-closed",
|
|
26
|
+
open: "drawer-slide-right-open"
|
|
27
|
+
},
|
|
28
|
+
left: {
|
|
29
|
+
closed: "drawer-slide-left-closed",
|
|
30
|
+
open: "drawer-slide-left-open"
|
|
31
|
+
},
|
|
32
|
+
top: {
|
|
33
|
+
closed: "drawer-slide-top-closed",
|
|
34
|
+
open: "drawer-slide-top-open"
|
|
35
|
+
},
|
|
36
|
+
bottom: {
|
|
37
|
+
closed: "drawer-slide-bottom-closed",
|
|
38
|
+
open: "drawer-slide-bottom-open"
|
|
39
|
+
}
|
|
46
40
|
};
|
|
41
|
+
//#endregion
|
|
42
|
+
export { i as DRAWER_ANIMATION_STATE, r as DRAWER_BORDER_PLACEMENT_CLASS, n as DRAWER_CONTAINER_PLACEMENT_CLASS, t as DRAWER_HEIGHT_CLASS, e as DRAWER_WIDTH_CLASS };
|
|
@@ -1,59 +1,52 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { Spinner as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
import { cn as e } from "../../utils/cn.js";
|
|
3
|
+
import { Spinner as t } from "../spinner/spinner.js";
|
|
4
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/field/FieldShell.tsx
|
|
6
|
+
var i = {
|
|
7
|
+
left: "text-left",
|
|
8
|
+
center: "text-center",
|
|
9
|
+
right: "text-right"
|
|
10
|
+
}, a = {
|
|
11
|
+
default: "text-foreground",
|
|
12
|
+
error: "text-danger",
|
|
13
|
+
warning: "text-warning",
|
|
14
|
+
success: "text-success"
|
|
14
15
|
};
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
id: d,
|
|
50
|
-
role: s === "error" ? "alert" : void 0,
|
|
51
|
-
className: t("text-sm", g[s]),
|
|
52
|
-
children: l
|
|
53
|
-
}
|
|
54
|
-
)
|
|
55
|
-
] });
|
|
16
|
+
function o({ id: o, label: s, labelAlign: c = "left", description: l, descriptionId: u, message: d, messageId: f, status: p = "default", required: m, isLoading: h, children: g }) {
|
|
17
|
+
return /* @__PURE__ */ r("div", {
|
|
18
|
+
className: "flex flex-col gap-1.5",
|
|
19
|
+
children: [
|
|
20
|
+
s && /* @__PURE__ */ n("label", {
|
|
21
|
+
htmlFor: o,
|
|
22
|
+
className: e("text-sm font-medium text-foreground", i[c]),
|
|
23
|
+
children: /* @__PURE__ */ r("span", {
|
|
24
|
+
className: "inline-flex items-center gap-1.5",
|
|
25
|
+
children: [
|
|
26
|
+
s,
|
|
27
|
+
m && /* @__PURE__ */ n("span", {
|
|
28
|
+
"aria-hidden": "true",
|
|
29
|
+
className: "text-danger",
|
|
30
|
+
children: "*"
|
|
31
|
+
}),
|
|
32
|
+
h && /* @__PURE__ */ n(t, { size: "sm" })
|
|
33
|
+
]
|
|
34
|
+
})
|
|
35
|
+
}),
|
|
36
|
+
l && /* @__PURE__ */ n("p", {
|
|
37
|
+
id: u,
|
|
38
|
+
className: e("text-sm text-foreground/60"),
|
|
39
|
+
children: l
|
|
40
|
+
}),
|
|
41
|
+
g,
|
|
42
|
+
d && /* @__PURE__ */ n("p", {
|
|
43
|
+
id: f,
|
|
44
|
+
role: p === "error" ? "alert" : void 0,
|
|
45
|
+
className: e("text-sm", a[p]),
|
|
46
|
+
children: d
|
|
47
|
+
})
|
|
48
|
+
]
|
|
49
|
+
});
|
|
56
50
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
};
|
|
51
|
+
//#endregion
|
|
52
|
+
export { o as FieldShell };
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { registerComponentDefaults as e } from "../../libs/registry.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
e("field", l);
|
|
18
|
-
export {
|
|
19
|
-
i as FALLBACK_FIELD_CONFIG,
|
|
20
|
-
l as defaultFieldConfig
|
|
3
|
+
//#region src/components/field/field-config.ts
|
|
4
|
+
var t = {
|
|
5
|
+
size: "md",
|
|
6
|
+
labelAlign: "left",
|
|
7
|
+
fullWidth: !1,
|
|
8
|
+
variant: "bordered"
|
|
9
|
+
}, n = {
|
|
10
|
+
size: "md",
|
|
11
|
+
radius: "md",
|
|
12
|
+
variant: "bordered",
|
|
13
|
+
color: "primary",
|
|
14
|
+
labelAlign: "left",
|
|
15
|
+
fullWidth: !1,
|
|
16
|
+
status: "default"
|
|
21
17
|
};
|
|
18
|
+
e("field", t);
|
|
19
|
+
//#endregion
|
|
20
|
+
export { n as FALLBACK_FIELD_CONFIG, t as defaultFieldConfig };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
r as FIELD_STATUS_BORDER_CLASS
|
|
2
|
+
//#region src/components/field/field-styles.ts
|
|
3
|
+
var e = {
|
|
4
|
+
default: "",
|
|
5
|
+
error: "border-danger focus-visible:border-danger focus-visible:ring-danger/20",
|
|
6
|
+
warning: "border-warning focus-visible:border-warning focus-visible:ring-warning/20",
|
|
7
|
+
success: "border-success focus-visible:border-success focus-visible:ring-success/20"
|
|
10
8
|
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { e as FIELD_STATUS_BORDER_CLASS };
|
|
@@ -15,16 +15,16 @@ export interface ImageProps extends BaseImageProps {
|
|
|
15
15
|
* (e.g. `next/image`).
|
|
16
16
|
* When provided, the component renders this instead of img.
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
component?: ElementType;
|
|
19
19
|
/**
|
|
20
20
|
* Additional props to pass to the custom image component
|
|
21
21
|
* (e.g. `{ priority: true, sizes: "..." }`).
|
|
22
22
|
*
|
|
23
|
-
* If `
|
|
23
|
+
* If `component` is set and neither `width`/`height` nor `fill`
|
|
24
24
|
* are provided here, `fill: true` is applied automatically since
|
|
25
25
|
* this component is container/ratio driven.
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
props?: Record<string, unknown>;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* An image element with ratio locking, object-fit control, radius
|
|
@@ -50,8 +50,8 @@ export interface ImageProps extends BaseImageProps {
|
|
|
50
50
|
* @param props.fallbackSrc - Error fallback source.
|
|
51
51
|
* @param props.showSkeleton - Loading placeholder. Defaults to true.
|
|
52
52
|
* @param props.className - Extra classes for the image element.
|
|
53
|
-
* @param props.
|
|
54
|
-
* @param props.
|
|
53
|
+
* @param props.component - Custom image component.
|
|
54
|
+
* @param props.props - Props forwarded to the image component.
|
|
55
55
|
* @param props.src - The image source URL.
|
|
56
56
|
* @param props.onLoad - Callback fired when the image loads.
|
|
57
57
|
* @param props.onError - Callback fired when the image fails to load.
|
|
@@ -82,8 +82,8 @@ export interface ImageProps extends BaseImageProps {
|
|
|
82
82
|
* <Image
|
|
83
83
|
* src="/hero.png"
|
|
84
84
|
* alt="Hero image"
|
|
85
|
-
*
|
|
86
|
-
*
|
|
85
|
+
* component={NextImage}
|
|
86
|
+
* props={{ priority: true, sizes: "100vw" }}
|
|
87
87
|
* />
|
|
88
88
|
* ```
|
|
89
89
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../src/components/image/Image.tsx"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,iBAAiB,EAKvB,MAAM,OAAO,CAAC;AASf,OAAO,EAEL,KAAK,WAAW,EAGjB,MAAM,gBAAgB,CAAC;AAGxB,KAAK,cAAc,GAAG,WAAW,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../src/components/image/Image.tsx"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,iBAAiB,EAKvB,MAAM,OAAO,CAAC;AASf,OAAO,EAEL,KAAK,WAAW,EAGjB,MAAM,gBAAgB,CAAC;AAGxB,KAAK,cAAc,GAAG,WAAW,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,SAAS,CAAC,EAAE,WAAW,CAAC;IAExB;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,eAAO,MAAM,KAAK,yGAsNjB,CAAC"}
|
|
@@ -1,134 +1,67 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import { useAsheeConfig as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn as e } from "../../utils/cn.js";
|
|
4
|
+
import { useAsheeConfig as t } from "../../libs/context.js";
|
|
5
|
+
import { RADIUS_CLASS as n } from "../../shared/radius.js";
|
|
6
|
+
import { resolveCascade as r, resolveClassKey as i, resolveRadiusKey as a } from "../../utils/resolve-token.js";
|
|
7
|
+
import { FALLBACK_IMAGE_CONFIG as o } from "./image-config.js";
|
|
8
|
+
import { IMAGE_FIT_CLASS as s, IMAGE_RATIO_CLASS as c } from "./image-styles.js";
|
|
9
|
+
import { forwardRef as l, useEffect as u, useRef as d, useState as f } from "react";
|
|
10
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
11
|
+
//#region src/components/image/Image.tsx
|
|
12
|
+
function h(e) {
|
|
13
|
+
return typeof e == "string" && e.trim().length > 0;
|
|
12
14
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
void 0,
|
|
67
|
-
i.loading
|
|
68
|
-
), W = o(
|
|
69
|
-
E,
|
|
70
|
-
e == null ? void 0 : e.showSkeleton,
|
|
71
|
-
void 0,
|
|
72
|
-
i.showSkeleton
|
|
73
|
-
), $ = v(
|
|
74
|
-
T,
|
|
75
|
-
nt,
|
|
76
|
-
i.fit
|
|
77
|
-
), g = v(
|
|
78
|
-
V,
|
|
79
|
-
lt,
|
|
80
|
-
i.ratio
|
|
81
|
-
), m = v(
|
|
82
|
-
D,
|
|
83
|
-
at,
|
|
84
|
-
i.radius
|
|
85
|
-
), q = S || "img", y = !!S, H = F(n), J = (t == null ? void 0 : t.width) !== void 0 || (t == null ? void 0 : t.height) !== void 0 || (t == null ? void 0 : t.fill) !== void 0, Q = y && !J ? { fill: !0, sizes: "100%" } : {}, X = I(
|
|
86
|
-
"h-full w-full transition-opacity duration-300",
|
|
87
|
-
$,
|
|
88
|
-
R ? "opacity-100" : "opacity-0",
|
|
89
|
-
m,
|
|
90
|
-
b
|
|
91
|
-
);
|
|
92
|
-
let c = { ...t ?? {} };
|
|
93
|
-
if (y) {
|
|
94
|
-
const s = (t == null ? void 0 : t.loading) === "lazy", p = (t == null ? void 0 : t.priority) === !0;
|
|
95
|
-
(s || p) && console.warn(
|
|
96
|
-
`[Image] ${s ? '`loading="lazy"`' : "`priority={true}`"} with custom image component may cause rendering issues. Consider using \`loading="eager"\` and removing \`priority\` for this image.`
|
|
97
|
-
), c = {
|
|
98
|
-
...c,
|
|
99
|
-
loading: "eager",
|
|
100
|
-
// Remove priority if present to avoid conflicts
|
|
101
|
-
...c.priority !== void 0 && { priority: !1 }
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
const Y = {
|
|
105
|
-
src: n,
|
|
106
|
-
alt: l,
|
|
107
|
-
loading: U,
|
|
108
|
-
onLoad: k,
|
|
109
|
-
onError: B,
|
|
110
|
-
className: X,
|
|
111
|
-
ref: O,
|
|
112
|
-
...Q,
|
|
113
|
-
...j,
|
|
114
|
-
...c
|
|
115
|
-
}, Z = !y || H;
|
|
116
|
-
return /* @__PURE__ */ P("span", { className: I("relative block w-full", g, m), children: [
|
|
117
|
-
W && !R && /* @__PURE__ */ _(
|
|
118
|
-
"span",
|
|
119
|
-
{
|
|
120
|
-
"aria-hidden": "true",
|
|
121
|
-
className: I(
|
|
122
|
-
"absolute inset-0 animate-pulse bg-border/40",
|
|
123
|
-
m
|
|
124
|
-
)
|
|
125
|
-
}
|
|
126
|
-
),
|
|
127
|
-
Z && /* @__PURE__ */ _(q, { ...Y }, n)
|
|
128
|
-
] });
|
|
129
|
-
}
|
|
130
|
-
);
|
|
131
|
-
dt.displayName = "Image";
|
|
132
|
-
export {
|
|
133
|
-
dt as Image
|
|
134
|
-
};
|
|
15
|
+
var g = l(({ alt: l, fit: g, ratio: _, radius: v, fallbackSrc: y, showSkeleton: ee, loading: b, src: x, className: S, onLoad: C, onError: w, component: T, props: E, ...D }, O) => {
|
|
16
|
+
let k = t(), A = k.components?.image, [j, M] = f(!1), [N, P] = f(x), F = d(null);
|
|
17
|
+
u(() => {
|
|
18
|
+
P(x), M(!1);
|
|
19
|
+
}, [x]), u(() => {
|
|
20
|
+
let e = F.current;
|
|
21
|
+
e?.complete && e.naturalWidth > 0 && M(!0);
|
|
22
|
+
}, [N]);
|
|
23
|
+
let I = (e) => {
|
|
24
|
+
M(!0), C?.(e);
|
|
25
|
+
}, L = (e) => {
|
|
26
|
+
if (h(y) && N !== y) {
|
|
27
|
+
P(y);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
M(!0), w?.(e);
|
|
31
|
+
}, R = (e) => {
|
|
32
|
+
F.current = e, typeof O == "function" ? O(e) : O && (O.current = e);
|
|
33
|
+
}, z = r(g, A?.fit, void 0, o.fit), B = r(_, A?.ratio, void 0, o.ratio), V = a(v, A?.radius, k.defaultRadius, o.radius), H = r(b, A?.loading, void 0, o.loading), U = r(ee, A?.showSkeleton, void 0, o.showSkeleton), W = i(z, s, o.fit), G = i(B, c, o.ratio), K = i(V, n, o.radius), q = T || "img", J = !!T, Y = h(N), X = E?.width !== void 0 || E?.height !== void 0 || E?.fill !== void 0, Z = J && !X ? {
|
|
34
|
+
fill: !0,
|
|
35
|
+
sizes: "100%"
|
|
36
|
+
} : {}, Q = e("h-full w-full transition-opacity duration-300", W, j ? "opacity-100" : "opacity-0", K, S), $ = { ...E ?? {} };
|
|
37
|
+
if (J) {
|
|
38
|
+
let e = E?.loading === "lazy", t = E?.priority === !0;
|
|
39
|
+
(e || t) && console.warn(`[Image] ${e ? "`loading=\"lazy\"`" : "`priority={true}`"} with custom image component may cause rendering issues. Consider using \`loading="eager"\` and removing \`priority\` for this image.`), $ = {
|
|
40
|
+
...$,
|
|
41
|
+
loading: "eager",
|
|
42
|
+
...$.priority !== void 0 && { priority: !1 }
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
let te = {
|
|
46
|
+
src: N,
|
|
47
|
+
alt: l,
|
|
48
|
+
loading: H,
|
|
49
|
+
onLoad: I,
|
|
50
|
+
onError: L,
|
|
51
|
+
className: Q,
|
|
52
|
+
ref: R,
|
|
53
|
+
...Z,
|
|
54
|
+
...D,
|
|
55
|
+
...$
|
|
56
|
+
}, ne = !J || Y;
|
|
57
|
+
return /* @__PURE__ */ m("span", {
|
|
58
|
+
className: e("relative block w-full", G, K),
|
|
59
|
+
children: [U && !j && /* @__PURE__ */ p("span", {
|
|
60
|
+
"aria-hidden": "true",
|
|
61
|
+
className: e("absolute inset-0 animate-pulse bg-border/40", K)
|
|
62
|
+
}), ne && /* @__PURE__ */ p(q, { ...te }, N)]
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
g.displayName = "Image";
|
|
66
|
+
//#endregion
|
|
67
|
+
export { g as Image };
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { registerComponentDefaults as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
o("image", t);
|
|
17
|
-
export {
|
|
18
|
-
a as FALLBACK_IMAGE_CONFIG,
|
|
19
|
-
t as defaultImageConfig
|
|
2
|
+
import { registerComponentDefaults as e } from "../../libs/registry.js";
|
|
3
|
+
//#region src/components/image/image-config.ts
|
|
4
|
+
var t = {
|
|
5
|
+
fit: "cover",
|
|
6
|
+
ratio: "auto",
|
|
7
|
+
radius: "md",
|
|
8
|
+
loading: "lazy",
|
|
9
|
+
showSkeleton: !0
|
|
10
|
+
}, n = {
|
|
11
|
+
fit: "cover",
|
|
12
|
+
ratio: "auto",
|
|
13
|
+
radius: "md",
|
|
14
|
+
loading: "lazy",
|
|
15
|
+
showSkeleton: !0
|
|
20
16
|
};
|
|
17
|
+
e("image", t);
|
|
18
|
+
//#endregion
|
|
19
|
+
export { n as FALLBACK_IMAGE_CONFIG, t as defaultImageConfig };
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
e as IMAGE_FIT_CLASS,
|
|
16
|
-
o as IMAGE_RATIO_CLASS
|
|
2
|
+
//#region src/components/image/image-styles.ts
|
|
3
|
+
var e = {
|
|
4
|
+
cover: "object-cover",
|
|
5
|
+
contain: "object-contain",
|
|
6
|
+
fill: "object-fill",
|
|
7
|
+
none: "object-none",
|
|
8
|
+
"scale-down": "object-scale-down"
|
|
9
|
+
}, t = {
|
|
10
|
+
auto: "",
|
|
11
|
+
square: "aspect-square",
|
|
12
|
+
video: "aspect-video",
|
|
13
|
+
portrait: "aspect-[3/4]"
|
|
17
14
|
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { e as IMAGE_FIT_CLASS, t as IMAGE_RATIO_CLASS };
|