@uxf/ui 1.0.0-beta.8 → 1.0.0-beta.81
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/_private-utils/get-provider-config.d.ts +2 -0
- package/_private-utils/get-provider-config.js +8 -0
- package/avatar/avatar.d.ts +5 -0
- package/avatar/avatar.js +14 -0
- package/avatar/avatar.stories.d.ts +7 -0
- package/avatar/avatar.stories.js +21 -0
- package/avatar/index.d.ts +1 -0
- package/avatar/index.js +5 -0
- package/avatar-file-input/avatar-file-input.d.ts +32 -0
- package/avatar-file-input/avatar-file-input.js +69 -0
- package/avatar-file-input/avatar-file-input.stories.d.ts +7 -0
- package/avatar-file-input/avatar-file-input.stories.js +30 -0
- package/avatar-file-input/index.d.ts +1 -0
- package/{storybook → avatar-file-input}/index.js +1 -2
- package/badge/badge.d.ts +7 -0
- package/badge/badge.js +15 -0
- package/badge/badge.stories.d.ts +7 -0
- package/badge/badge.stories.js +39 -0
- package/badge/index.d.ts +1 -0
- package/badge/index.js +5 -0
- package/badge/theme.d.ts +5 -0
- package/badge/theme.js +2 -0
- package/button/button.d.ts +13 -13
- package/button/button.js +16 -12
- package/button/button.stories.d.ts +14 -0
- package/button/button.stories.js +68 -0
- package/button/index.d.ts +1 -2
- package/button/index.js +1 -8
- package/button/theme.d.ts +5 -2
- package/button/theme.js +0 -1
- package/checkbox/checkbox.d.ts +9 -0
- package/checkbox/checkbox.js +24 -0
- package/checkbox/checkbox.stories.d.ts +7 -0
- package/checkbox/checkbox.stories.js +57 -0
- package/checkbox/index.d.ts +1 -0
- package/checkbox/index.js +17 -0
- package/checkbox-button/checkbox-button.d.ts +8 -0
- package/checkbox-button/checkbox-button.js +21 -0
- package/checkbox-button/checkbox-button.stories.d.ts +7 -0
- package/checkbox-button/checkbox-button.stories.js +57 -0
- package/checkbox-button/index.d.ts +1 -0
- package/checkbox-button/index.js +17 -0
- package/checkbox-input/checkbox-input.d.ts +2 -0
- package/checkbox-input/checkbox-input.js +12 -0
- package/checkbox-input/checkbox-input.stories.d.ts +7 -0
- package/checkbox-input/checkbox-input.stories.js +17 -0
- package/checkbox-input/index.d.ts +1 -0
- package/checkbox-input/index.js +17 -0
- package/chip/chip.d.ts +7 -0
- package/chip/chip.js +14 -0
- package/chip/chip.stories.d.ts +7 -0
- package/chip/chip.stories.js +22 -0
- package/chip/index.d.ts +1 -0
- package/chip/index.js +5 -0
- package/chip/theme.d.ts +5 -0
- package/chip/theme.js +2 -0
- package/color-radio-group/color-radio-group.d.ts +18 -0
- package/color-radio-group/color-radio-group.js +47 -0
- package/color-radio-group/color-radio-group.stories.d.ts +7 -0
- package/color-radio-group/color-radio-group.stories.js +79 -0
- package/color-radio-group/color-radio.d.ts +8 -0
- package/color-radio-group/color-radio.js +22 -0
- package/color-radio-group/index.d.ts +1 -0
- package/color-radio-group/index.js +17 -0
- package/combobox/combobox.d.ts +25 -0
- package/combobox/combobox.js +63 -0
- package/combobox/combobox.stories.d.ts +9 -0
- package/combobox/combobox.stories.js +67 -0
- package/combobox/index.d.ts +1 -0
- package/combobox/index.js +17 -0
- package/config/icons-config.d.ts +2 -0
- package/config/icons-config.js +5 -0
- package/config/icons.d.ts +77 -0
- package/config/icons.js +20 -0
- package/content/content-schema.d.ts +3 -0
- package/content/content-schema.js +2 -0
- package/content/types.d.ts +27 -0
- package/content/types.js +2 -0
- package/context/context.d.ts +12 -0
- package/context/context.js +5 -0
- package/context/index.d.ts +3 -0
- package/context/index.js +19 -0
- package/context/provider.d.ts +8 -0
- package/context/provider.js +10 -0
- package/context/use-component-context.d.ts +3 -0
- package/context/use-component-context.js +13 -0
- package/css/avatar-file-input.css +7 -0
- package/css/avatar.css +15 -0
- package/css/badge.css +23 -0
- package/css/button.css +200 -0
- package/css/button.old.css +231 -0
- package/css/checkbox-button.css +98 -0
- package/css/checkbox-input.css +3 -0
- package/css/checkbox.css +102 -0
- package/css/chip.css +37 -0
- package/css/color-radio-group.css +21 -0
- package/css/color-radio.css +21 -0
- package/css/combobox.css +102 -0
- package/css/component-structure-analyzer.css +31 -0
- package/css/date-picker-input.css +133 -0
- package/css/date-picker.css +90 -0
- package/css/dropdown.css +24 -0
- package/css/error-message.css +3 -0
- package/css/flash-messages.css +20 -0
- package/css/form-control.css +7 -0
- package/css/icon.css +7 -0
- package/css/input-basic.css +18 -0
- package/css/input.css +193 -0
- package/css/label.css +15 -0
- package/css/layout.css +47 -0
- package/css/list-item.css +29 -0
- package/css/pagination.css +27 -0
- package/css/radio-group.css +160 -0
- package/css/radio.css +89 -0
- package/css/raster-image.css +15 -0
- package/css/select.css +66 -0
- package/css/tabs.css +131 -0
- package/css/text-link.css +12 -0
- package/css/textarea.css +118 -0
- package/css/time-picker-input.css +133 -0
- package/css/time-picker.css +27 -0
- package/css/toggle.css +80 -0
- package/date-picker-input/date-picker-day.d.ts +8 -0
- package/date-picker-input/date-picker-day.js +63 -0
- package/date-picker-input/date-picker-decade.d.ts +6 -0
- package/date-picker-input/date-picker-decade.js +68 -0
- package/date-picker-input/date-picker-input.d.ts +21 -0
- package/date-picker-input/date-picker-input.js +60 -0
- package/date-picker-input/date-picker-input.stories.d.ts +7 -0
- package/date-picker-input/date-picker-input.stories.js +45 -0
- package/date-picker-input/date-picker-month.d.ts +7 -0
- package/date-picker-input/date-picker-month.js +63 -0
- package/date-picker-input/date-picker-provider.d.ts +8 -0
- package/date-picker-input/date-picker-provider.js +26 -0
- package/date-picker-input/date-picker-year.d.ts +7 -0
- package/date-picker-input/date-picker-year.js +72 -0
- package/date-picker-input/date-picker.d.ts +3 -0
- package/date-picker-input/date-picker.js +53 -0
- package/date-picker-input/index.d.ts +3 -0
- package/date-picker-input/index.js +19 -0
- package/date-picker-input/types.d.ts +5 -0
- package/date-picker-input/types.js +2 -0
- package/dropdown/dropdown.d.ts +11 -0
- package/dropdown/dropdown.js +27 -0
- package/dropdown/dropdown.stories.d.ts +10 -0
- package/dropdown/dropdown.stories.js +30 -0
- package/dropdown/index.d.ts +1 -0
- package/dropdown/index.js +17 -0
- package/error-message/error-message.d.ts +7 -0
- package/error-message/error-message.js +11 -0
- package/error-message/error-message.stories.d.ts +8 -0
- package/error-message/error-message.stories.js +17 -0
- package/error-message/index.d.ts +1 -0
- package/error-message/index.js +17 -0
- package/flash-messages/flash-message.d.ts +16 -0
- package/flash-messages/flash-message.js +46 -0
- package/flash-messages/flash-messages-service.d.ts +5 -0
- package/flash-messages/flash-messages-service.js +15 -0
- package/flash-messages/flash-messages.d.ts +8 -0
- package/flash-messages/flash-messages.js +55 -0
- package/flash-messages/flash-messages.stories.d.ts +7 -0
- package/flash-messages/flash-messages.stories.js +31 -0
- package/flash-messages/theme.d.ts +4 -0
- package/flash-messages/theme.js +2 -0
- package/form-control/form-control.d.ts +13 -0
- package/form-control/form-control.js +19 -0
- package/form-control/form-control.stories.d.ts +12 -0
- package/form-control/form-control.stories.js +25 -0
- package/form-control/index.d.ts +1 -0
- package/form-control/index.js +17 -0
- package/hooks/use-dropdown.d.ts +2 -0
- package/hooks/use-dropdown.js +28 -0
- package/hooks/use-input-submit.d.ts +4 -0
- package/hooks/use-input-submit.js +40 -0
- package/icon/icon.d.ts +17 -0
- package/icon/icon.js +38 -0
- package/icon/icon.stories.d.ts +18 -0
- package/icon/icon.stories.js +53 -0
- package/icon/index.d.ts +1 -0
- package/icon/index.js +17 -0
- package/icon/theme.d.ts +2 -0
- package/icon/theme.js +2 -0
- package/icon/types.d.ts +2 -0
- package/icon/types.js +2 -0
- package/image-gallery/components/close-button.d.ts +6 -0
- package/image-gallery/components/close-button.js +12 -0
- package/image-gallery/components/dot.d.ts +6 -0
- package/image-gallery/components/dot.js +12 -0
- package/image-gallery/components/gallery.d.ts +11 -0
- package/image-gallery/components/gallery.js +71 -0
- package/image-gallery/components/next-button.d.ts +6 -0
- package/image-gallery/components/next-button.js +12 -0
- package/image-gallery/components/previous-button.d.ts +6 -0
- package/image-gallery/components/previous-button.js +12 -0
- package/image-gallery/context.d.ts +10 -0
- package/image-gallery/context.js +12 -0
- package/image-gallery/image-gallery.d.ts +6 -0
- package/image-gallery/image-gallery.js +55 -0
- package/image-gallery/image-gallery.stories.d.ts +13 -0
- package/image-gallery/image-gallery.stories.js +26 -0
- package/image-gallery/image.d.ts +4 -0
- package/image-gallery/image.js +14 -0
- package/image-gallery/index.d.ts +4 -0
- package/image-gallery/index.js +26 -0
- package/image-gallery/types.d.ts +7 -0
- package/image-gallery/types.js +2 -0
- package/image-gallery/use-image.d.ts +2 -0
- package/image-gallery/use-image.js +16 -0
- package/input/index.d.ts +12 -0
- package/input/index.js +16 -0
- package/input/input-element.d.ts +21 -0
- package/input/input-element.js +11 -0
- package/input/input-left-addon.d.ts +9 -0
- package/input/input-left-addon.js +12 -0
- package/input/input-left-element.d.ts +9 -0
- package/input/input-left-element.js +12 -0
- package/input/input-right-addon.d.ts +8 -0
- package/input/input-right-addon.js +12 -0
- package/input/input-right-element.d.ts +9 -0
- package/input/input-right-element.js +12 -0
- package/input/input.d.ts +8 -0
- package/input/input.js +65 -0
- package/input/input.stories.d.ts +14 -0
- package/input/input.stories.js +83 -0
- package/input/theme.d.ts +7 -0
- package/input/theme.js +2 -0
- package/label/index.d.ts +1 -0
- package/label/index.js +17 -0
- package/label/label.d.ts +12 -0
- package/label/label.js +14 -0
- package/label/label.stories.d.ts +7 -0
- package/label/label.stories.js +17 -0
- package/layout/index.d.ts +1 -0
- package/layout/index.js +17 -0
- package/layout/layout.d.ts +9 -0
- package/layout/layout.js +60 -0
- package/layout/layout.stories.d.ts +8 -0
- package/layout/layout.stories.js +21 -0
- package/layout/uxf-logo.d.ts +6 -0
- package/layout/uxf-logo.js +13 -0
- package/list-item/index.d.ts +1 -0
- package/list-item/index.js +5 -0
- package/list-item/list-item.d.ts +8 -0
- package/list-item/list-item.js +24 -0
- package/list-item/list-item.stories.d.ts +7 -0
- package/list-item/list-item.stories.js +32 -0
- package/package.json +17 -36
- package/pagination/pagination.d.ts +7 -0
- package/pagination/pagination.js +49 -0
- package/pagination/pagination.stories.d.ts +7 -0
- package/pagination/pagination.stories.js +47 -0
- package/radio/index.d.ts +1 -0
- package/radio/index.js +17 -0
- package/radio/radio.d.ts +6 -0
- package/radio/radio.js +15 -0
- package/radio/radio.stories.d.ts +7 -0
- package/radio/radio.stories.js +42 -0
- package/radio-group/index.d.ts +1 -0
- package/radio-group/index.js +17 -0
- package/radio-group/radio-group.d.ts +22 -0
- package/radio-group/radio-group.js +48 -0
- package/radio-group/radio-group.stories.d.ts +7 -0
- package/radio-group/radio-group.stories.js +57 -0
- package/radio-group/theme.d.ts +5 -0
- package/radio-group/theme.js +2 -0
- package/raster-image/index.d.ts +1 -0
- package/raster-image/index.js +17 -0
- package/raster-image/raster-image.d.ts +16 -0
- package/raster-image/raster-image.js +21 -0
- package/raster-image/raster-image.stories.d.ts +7 -0
- package/raster-image/raster-image.stories.js +17 -0
- package/select/index.d.ts +1 -0
- package/select/index.js +17 -0
- package/select/select.d.ts +25 -0
- package/select/select.js +60 -0
- package/select/select.stories.d.ts +9 -0
- package/select/select.stories.js +72 -0
- package/tabs/index.d.ts +1 -0
- package/tabs/index.js +5 -0
- package/tabs/tabs.d.ts +19 -0
- package/tabs/tabs.js +68 -0
- package/tabs/tabs.stories.d.ts +11 -0
- package/tabs/tabs.stories.js +48 -0
- package/text-input/index.d.ts +1 -0
- package/text-input/index.js +17 -0
- package/text-input/text-input.d.ts +31 -0
- package/text-input/text-input.js +57 -0
- package/text-input/text-input.stories.d.ts +8 -0
- package/text-input/text-input.stories.js +56 -0
- package/text-link/index.d.ts +1 -0
- package/text-link/index.js +5 -0
- package/text-link/text-link.d.ts +5 -0
- package/text-link/text-link.js +19 -0
- package/text-link/text-link.stories.d.ts +7 -0
- package/text-link/text-link.stories.js +24 -0
- package/textarea/index.d.ts +1 -0
- package/textarea/index.js +17 -0
- package/textarea/textarea.d.ts +18 -0
- package/textarea/textarea.js +81 -0
- package/textarea/textarea.stories.d.ts +7 -0
- package/textarea/textarea.stories.js +44 -0
- package/time-picker-input/index.d.ts +2 -0
- package/time-picker-input/index.js +18 -0
- package/time-picker-input/time-picker-hour.d.ts +5 -0
- package/time-picker-input/time-picker-hour.js +47 -0
- package/time-picker-input/time-picker-hours.d.ts +2 -0
- package/time-picker-input/time-picker-hours.js +14 -0
- package/time-picker-input/time-picker-input.d.ts +22 -0
- package/time-picker-input/time-picker-input.js +64 -0
- package/time-picker-input/time-picker-input.stories.d.ts +7 -0
- package/time-picker-input/time-picker-input.stories.js +45 -0
- package/time-picker-input/time-picker-minute.d.ts +5 -0
- package/time-picker-input/time-picker-minute.js +47 -0
- package/time-picker-input/time-picker-minutes.d.ts +2 -0
- package/time-picker-input/time-picker-minutes.js +14 -0
- package/time-picker-input/time-picker.d.ts +8 -0
- package/time-picker-input/time-picker.js +69 -0
- package/toggle/index.d.ts +1 -0
- package/toggle/index.js +17 -0
- package/toggle/theme.d.ts +4 -0
- package/toggle/theme.js +2 -0
- package/toggle/toggle.d.ts +12 -0
- package/toggle/toggle.js +19 -0
- package/toggle/toggle.stories.d.ts +7 -0
- package/toggle/toggle.stories.js +52 -0
- package/types/form-control-props.d.ts +24 -0
- package/types/form-control-props.js +2 -0
- package/types/index.d.ts +1 -0
- package/types/index.js +17 -0
- package/utils/action.d.ts +2 -0
- package/utils/action.js +11 -0
- package/utils/component-structure-analyzer.d.ts +6 -0
- package/utils/component-structure-analyzer.js +10 -0
- package/utils/icons-config.js +73 -0
- package/utils/image.d.ts +9 -0
- package/utils/image.js +30 -0
- package/utils/is-light-background.d.ts +2 -0
- package/utils/is-light-background.js +11 -0
- package/utils/localized-dayjs.d.ts +2 -0
- package/utils/localized-dayjs.js +34 -0
- package/utils/storybook-config.d.ts +19 -0
- package/{storybook → utils}/storybook-config.js +7 -6
- package/utils/tailwind-config.js +163 -0
- package/stories/button.stories.tsx +0 -73
- package/storybook/index.d.ts +0 -1
- package/storybook/storybook-config.d.ts +0 -21
- package/tailwindui/button.css +0 -51
- package/types.d.ts +0 -3
- package/types.js +0 -3
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./form-control"), exports);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useDropdown = void 0;
|
|
4
|
+
const react_dom_1 = require("@floating-ui/react-dom");
|
|
5
|
+
function useDropdown(placement, matchWidth = false) {
|
|
6
|
+
return (0, react_dom_1.useFloating)({
|
|
7
|
+
placement,
|
|
8
|
+
middleware: [
|
|
9
|
+
(0, react_dom_1.flip)(),
|
|
10
|
+
(0, react_dom_1.shift)(),
|
|
11
|
+
(0, react_dom_1.size)({
|
|
12
|
+
apply({ availableHeight, availableWidth, elements, strategy, x, y }) {
|
|
13
|
+
Object.assign(elements.floating.style, {
|
|
14
|
+
left: x + "px",
|
|
15
|
+
maxHeight: Math.max(50, availableHeight) + "px",
|
|
16
|
+
maxWidth: matchWidth ? availableWidth + "px" : undefined,
|
|
17
|
+
position: strategy,
|
|
18
|
+
top: y + "px",
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
}),
|
|
22
|
+
],
|
|
23
|
+
whileElementsMounted: (reference, floating, update) => (0, react_dom_1.autoUpdate)(reference, floating, update, {
|
|
24
|
+
elementResize: typeof ResizeObserver !== "undefined",
|
|
25
|
+
}),
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
exports.useDropdown = useDropdown;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useInputSubmit = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
function childrenHasFocus(node) {
|
|
6
|
+
node.childNodes.forEach((child) => {
|
|
7
|
+
if (document.activeElement === child) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
function submitResolver(type, node) {
|
|
14
|
+
switch (type) {
|
|
15
|
+
case "checkbox":
|
|
16
|
+
return document.activeElement === node.firstChild;
|
|
17
|
+
case "radio-group":
|
|
18
|
+
return childrenHasFocus(node);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function useInputSubmit(ref, type, disabled) {
|
|
22
|
+
(0, react_1.useEffect)(() => {
|
|
23
|
+
const node = ref.current;
|
|
24
|
+
if (!node || disabled) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const handleSubmit = (e) => {
|
|
28
|
+
var _a;
|
|
29
|
+
if (e instanceof KeyboardEvent && e.key === "Enter" && submitResolver(type, node)) {
|
|
30
|
+
const closestForm = (_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.closest("form");
|
|
31
|
+
if (closestForm) {
|
|
32
|
+
closestForm.dispatchEvent(new Event("submit", { bubbles: true, cancelable: true }));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
node.addEventListener("keydown", handleSubmit);
|
|
37
|
+
return () => node.removeEventListener("keydown", handleSubmit);
|
|
38
|
+
}, [disabled, ref, type]);
|
|
39
|
+
}
|
|
40
|
+
exports.useInputSubmit = useInputSubmit;
|
package/icon/icon.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { CSSProperties } from "react";
|
|
2
|
+
import { IconName } from "./types";
|
|
3
|
+
declare type NameOrComponentType = {
|
|
4
|
+
name: IconName;
|
|
5
|
+
Component?: never;
|
|
6
|
+
} | {
|
|
7
|
+
name?: never;
|
|
8
|
+
Component: any;
|
|
9
|
+
};
|
|
10
|
+
export declare type IconProps = {
|
|
11
|
+
className?: string;
|
|
12
|
+
mode?: "meet" | "slice";
|
|
13
|
+
size?: number;
|
|
14
|
+
style?: Partial<CSSProperties>;
|
|
15
|
+
} & NameOrComponentType;
|
|
16
|
+
export declare const Icon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
|
|
17
|
+
export {};
|
package/icon/icon.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Icon = void 0;
|
|
7
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
8
|
+
const forwardRef_1 = require("@uxf/core/utils/forwardRef");
|
|
9
|
+
const rem_1 = require("@uxf/styles/units/rem");
|
|
10
|
+
const react_1 = __importDefault(require("react"));
|
|
11
|
+
const context_1 = require("../context");
|
|
12
|
+
exports.Icon = (0, forwardRef_1.forwardRef)("Icon", (props, ref) => {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
const componentContext = (0, context_1.useComponentContext)("icon");
|
|
15
|
+
const CustomComponent = props.Component;
|
|
16
|
+
const className = (0, cx_1.cx)("uxf-icon", props.className);
|
|
17
|
+
const preserveAspectRatio = `xMidYMid ${(_a = props.mode) !== null && _a !== void 0 ? _a : "meet"}`;
|
|
18
|
+
const style = props.size
|
|
19
|
+
? {
|
|
20
|
+
"--i-h": (0, rem_1.rem)(props.size),
|
|
21
|
+
"--i-w": (0, rem_1.rem)(props.size),
|
|
22
|
+
...((_b = props.style) !== null && _b !== void 0 ? _b : {}),
|
|
23
|
+
}
|
|
24
|
+
: props.style;
|
|
25
|
+
if (CustomComponent) {
|
|
26
|
+
return (react_1.default.createElement(CustomComponent, { className: className, preserveAspectRatio: preserveAspectRatio, ref: ref, role: "img", style: style }));
|
|
27
|
+
}
|
|
28
|
+
if (props.name && props.name in componentContext.iconsConfig) {
|
|
29
|
+
const icon = componentContext.iconsConfig[props.name];
|
|
30
|
+
return (react_1.default.createElement("svg", { className: className, preserveAspectRatio: preserveAspectRatio, ref: ref, role: "img", style: style, viewBox: `0 0 ${icon.w} ${icon.h}` },
|
|
31
|
+
react_1.default.createElement("use", { xlinkHref: `${componentContext.spriteFilePath}#icon-sprite--${props.name}` })));
|
|
32
|
+
}
|
|
33
|
+
// eslint-disable-next-line no-console
|
|
34
|
+
console.warn(`Icon "${props.name}" not found.`);
|
|
35
|
+
return (react_1.default.createElement("span", { title: `icon "${props.name}" not found` },
|
|
36
|
+
react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 320 512", width: props.size, height: props.size },
|
|
37
|
+
react_1.default.createElement("path", { d: "M144 416c-17.67 0-32 14.33-32 32s14.33 32.01 32 32.01s32-14.34 32-32.01S161.7 416 144 416zM211.2 32H104C46.66 32 0 78.66 0 136v16C0 165.3 10.75 176 24 176S48 165.3 48 152v-16c0-30.88 25.12-56 56-56h107.2C244.7 80 272 107.3 272 140.8c0 22.66-12.44 43.27-32.5 53.81L167 232.8C137.1 248 120 277.9 120 310.6V328c0 13.25 10.75 24.01 24 24.01S168 341.3 168 328V310.6c0-14.89 8.188-28.47 21.38-35.41l72.47-38.14C297.7 218.2 320 181.3 320 140.8C320 80.81 271.2 32 211.2 32z" }))));
|
|
38
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="mdx" />
|
|
2
|
+
import React from "react";
|
|
3
|
+
import Docs from "./icon.docs.mdx";
|
|
4
|
+
declare const _default: {
|
|
5
|
+
title: string;
|
|
6
|
+
component: React.ForwardRefExoticComponent<import("./icon").IconProps & React.RefAttributes<SVGSVGElement>>;
|
|
7
|
+
parameters: {
|
|
8
|
+
docs: {
|
|
9
|
+
page: typeof Docs;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
14
|
+
export declare function AllIcons(): JSX.Element;
|
|
15
|
+
export declare function ColorAndSizes(): JSX.Element;
|
|
16
|
+
export declare function CustomComponent(): JSX.Element;
|
|
17
|
+
export declare function SpriteIcon(): JSX.Element;
|
|
18
|
+
export declare function SpriteIconNotExists(): JSX.Element;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SpriteIconNotExists = exports.SpriteIcon = exports.CustomComponent = exports.ColorAndSizes = exports.AllIcons = void 0;
|
|
7
|
+
const icon_1 = require("./icon");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const context_1 = require("../context");
|
|
10
|
+
const icon_docs_mdx_1 = __importDefault(require("./icon.docs.mdx"));
|
|
11
|
+
exports.default = {
|
|
12
|
+
title: "UI/Icon",
|
|
13
|
+
component: icon_1.Icon,
|
|
14
|
+
parameters: {
|
|
15
|
+
docs: {
|
|
16
|
+
page: icon_docs_mdx_1.default,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
function AllIcons() {
|
|
21
|
+
const iconContext = (0, context_1.useComponentContext)("icon");
|
|
22
|
+
return (react_1.default.createElement("div", { className: "flex flex-row flex-wrap" }, Object.keys(iconContext.iconsConfig).map((iconName) => (react_1.default.createElement("div", { key: iconName, className: "flex h-28 w-28 flex-col items-center justify-center gap-3" },
|
|
23
|
+
react_1.default.createElement(icon_1.Icon, { name: iconName, size: 24 }),
|
|
24
|
+
react_1.default.createElement("div", { className: "text-gray-400" },
|
|
25
|
+
react_1.default.createElement("small", null, iconName)))))));
|
|
26
|
+
}
|
|
27
|
+
exports.AllIcons = AllIcons;
|
|
28
|
+
function ColorAndSizes() {
|
|
29
|
+
return (react_1.default.createElement("div", { className: "flex flex-row flex-wrap gap-4" },
|
|
30
|
+
react_1.default.createElement(icon_1.Icon, { name: "camera", size: 12 }),
|
|
31
|
+
react_1.default.createElement(icon_1.Icon, { name: "camera", size: 16 }),
|
|
32
|
+
react_1.default.createElement(icon_1.Icon, { name: "camera", size: 20 }),
|
|
33
|
+
react_1.default.createElement(icon_1.Icon, { name: "camera", size: 12, className: "text-primary-600" }),
|
|
34
|
+
react_1.default.createElement(icon_1.Icon, { name: "camera", size: 16, className: "text-orange-600" }),
|
|
35
|
+
react_1.default.createElement(icon_1.Icon, { name: "camera", size: 20, className: "text-green-600" })));
|
|
36
|
+
}
|
|
37
|
+
exports.ColorAndSizes = ColorAndSizes;
|
|
38
|
+
function CustomComponent() {
|
|
39
|
+
const SvgIcon = (props) => {
|
|
40
|
+
return (react_1.default.createElement("svg", { viewBox: "0 0 29.65 40", ...props },
|
|
41
|
+
react_1.default.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M0 14.83C0 6.61 6.61 0 14.83 0c8.11 0 14.83 6.61 14.83 14.83 0 8.64-8.85 19.41-14.83 25.17C8.75 34.24 0 23.47 0 14.83zm9.28 0c0-3.09 2.45-5.55 5.55-5.55 2.99 0 5.44 2.45 5.44 5.55 0 2.99-2.45 5.44-5.44 5.44-3.1 0-5.55-2.46-5.55-5.44z", clipRule: "evenodd" })));
|
|
42
|
+
};
|
|
43
|
+
return react_1.default.createElement(icon_1.Icon, { Component: SvgIcon, size: 16 });
|
|
44
|
+
}
|
|
45
|
+
exports.CustomComponent = CustomComponent;
|
|
46
|
+
function SpriteIcon() {
|
|
47
|
+
return react_1.default.createElement(icon_1.Icon, { name: "camera", size: 16 });
|
|
48
|
+
}
|
|
49
|
+
exports.SpriteIcon = SpriteIcon;
|
|
50
|
+
function SpriteIconNotExists() {
|
|
51
|
+
return react_1.default.createElement(icon_1.Icon, { name: "not-exists", size: 16 });
|
|
52
|
+
}
|
|
53
|
+
exports.SpriteIconNotExists = SpriteIconNotExists;
|
package/icon/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./icon";
|
package/icon/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./icon"), exports);
|
package/icon/theme.d.ts
ADDED
package/icon/theme.js
ADDED
package/icon/types.d.ts
ADDED
package/icon/types.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const icon_1 = require("../../icon");
|
|
8
|
+
function CloseButton(props) {
|
|
9
|
+
return (react_1.default.createElement("button", { className: "bg-black bg-opacity-50 p-5", onClick: () => props.onClick() },
|
|
10
|
+
react_1.default.createElement(icon_1.Icon, { className: "h-6 w-6 text-white", name: "xmarkLarge" })));
|
|
11
|
+
}
|
|
12
|
+
exports.default = CloseButton;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
function Dot(props) {
|
|
9
|
+
const className = (0, cx_1.cx)("h-2 w-2 rounded-full", props.active ? "bg-gray-500" : "bg-white");
|
|
10
|
+
return react_1.default.createElement("div", { className: className });
|
|
11
|
+
}
|
|
12
|
+
exports.default = Dot;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ImageGalleryImageProps } from "../types";
|
|
3
|
+
interface GalleryProps {
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onNext: () => void;
|
|
6
|
+
onPrevious: () => void;
|
|
7
|
+
imageIndex: number;
|
|
8
|
+
images: ImageGalleryImageProps[];
|
|
9
|
+
}
|
|
10
|
+
declare function Gallery(props: GalleryProps): JSX.Element;
|
|
11
|
+
export default Gallery;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const close_button_1 = __importDefault(require("./close-button"));
|
|
30
|
+
const previous_button_1 = __importDefault(require("./previous-button"));
|
|
31
|
+
const next_button_1 = __importDefault(require("./next-button"));
|
|
32
|
+
const dot_1 = __importDefault(require("./dot"));
|
|
33
|
+
const react_1 = __importStar(require("react"));
|
|
34
|
+
const resizer_1 = require("@uxf/core/utils/resizer");
|
|
35
|
+
function Gallery(props) {
|
|
36
|
+
var _a;
|
|
37
|
+
(0, react_1.useEffect)(() => {
|
|
38
|
+
const onKeyDown = (event) => {
|
|
39
|
+
switch (event.key) {
|
|
40
|
+
case "ArrowRight":
|
|
41
|
+
props.onNext();
|
|
42
|
+
break;
|
|
43
|
+
case "ArrowLeft":
|
|
44
|
+
props.onPrevious();
|
|
45
|
+
break;
|
|
46
|
+
case "Escape":
|
|
47
|
+
props.onClose();
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
document.body.style.overflow = "hidden";
|
|
52
|
+
window.addEventListener("keydown", onKeyDown);
|
|
53
|
+
return () => {
|
|
54
|
+
document.body.style.overflow = "auto";
|
|
55
|
+
window.removeEventListener("keydown", onKeyDown);
|
|
56
|
+
};
|
|
57
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
|
+
}, []);
|
|
59
|
+
const imageSrc = props.images[props.imageIndex].src;
|
|
60
|
+
return (react_1.default.createElement("div", { className: "fixed inset-0 top-0 bottom-0 z-50 flex flex-col bg-black bg-opacity-75 transition-opacity" },
|
|
61
|
+
react_1.default.createElement("div", { className: "flex justify-end" },
|
|
62
|
+
react_1.default.createElement(close_button_1.default, { onClick: props.onClose })),
|
|
63
|
+
react_1.default.createElement("div", { className: "container mx-auto flex h-full flex-1 flex-col" },
|
|
64
|
+
react_1.default.createElement("div", { className: "relative flex flex-1 items-center justify-center" },
|
|
65
|
+
react_1.default.createElement("img", { alt: "", className: "absolute left-0 right-0 top-0 h-full w-full object-contain", src: typeof imageSrc === "string" ? imageSrc : (_a = (0, resizer_1.resizerImageUrl)(imageSrc)) !== null && _a !== void 0 ? _a : "" }),
|
|
66
|
+
react_1.default.createElement("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-between p-2" },
|
|
67
|
+
react_1.default.createElement(previous_button_1.default, { onClick: props.onPrevious }),
|
|
68
|
+
react_1.default.createElement(next_button_1.default, { onClick: props.onNext })))),
|
|
69
|
+
react_1.default.createElement("div", { className: "row mx-auto flex space-x-2 p-4" }, props.images.map((image, index) => (react_1.default.createElement(dot_1.default, { key: typeof image.src === "string" ? image.src : image.src.uuid, active: index === props.imageIndex }))))));
|
|
70
|
+
}
|
|
71
|
+
exports.default = Gallery;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const icon_1 = require("../../icon");
|
|
8
|
+
function NextButton(props) {
|
|
9
|
+
return (react_1.default.createElement("button", { className: "pointer-events-auto rounded-full bg-black bg-opacity-50 p-3", onClick: props.onClick },
|
|
10
|
+
react_1.default.createElement(icon_1.Icon, { className: "h-8 w-8 text-white", name: "chevronRight" })));
|
|
11
|
+
}
|
|
12
|
+
exports.default = NextButton;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const icon_1 = require("../../icon");
|
|
8
|
+
function PreviousButton(props) {
|
|
9
|
+
return (react_1.default.createElement("button", { className: "pointer-events-auto rounded-full bg-black bg-opacity-50 p-3", onClick: props.onClick },
|
|
10
|
+
react_1.default.createElement(icon_1.Icon, { className: "h-8 w-8 text-white", name: "chevronLeft" })));
|
|
11
|
+
}
|
|
12
|
+
exports.default = PreviousButton;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ImageGalleryImageProps } from "./types";
|
|
3
|
+
declare type ContextType = {
|
|
4
|
+
registerImage: (props: ImageGalleryImageProps) => void;
|
|
5
|
+
unregisterImage: (props: ImageGalleryImageProps) => void;
|
|
6
|
+
openGallery: (props: ImageGalleryImageProps) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const ImageGalleryProvider: import("react").Provider<ContextType>;
|
|
9
|
+
export declare const useImageGalleryContext: () => ContextType;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useImageGalleryContext = exports.ImageGalleryProvider = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const ImageGalleryContext = (0, react_1.createContext)({
|
|
6
|
+
registerImage: () => null,
|
|
7
|
+
unregisterImage: () => null,
|
|
8
|
+
openGallery: () => null,
|
|
9
|
+
});
|
|
10
|
+
exports.ImageGalleryProvider = ImageGalleryContext.Provider;
|
|
11
|
+
const useImageGalleryContext = () => (0, react_1.useContext)(ImageGalleryContext);
|
|
12
|
+
exports.useImageGalleryContext = useImageGalleryContext;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
30
|
+
const context_1 = require("./context");
|
|
31
|
+
const gallery_1 = __importDefault(require("./components/gallery"));
|
|
32
|
+
function ImageGallery(props) {
|
|
33
|
+
const [images, setImages] = (0, react_1.useState)([]);
|
|
34
|
+
const [imageIndex, setImageIndex] = (0, react_1.useState)(null);
|
|
35
|
+
const registerImage = (0, react_1.useCallback)((image) => setImages((v) => [...v, image]), []);
|
|
36
|
+
const unregisterImage = (0, react_1.useCallback)((image) => setImages((v) => v.filter((u) => u.src !== image.src)), []);
|
|
37
|
+
const openGallery = (0, react_1.useCallback)((image) => setImageIndex(images.findIndex((i) => i.src === image.src)), [images]);
|
|
38
|
+
const onPrevious = (0, react_1.useCallback)(() => {
|
|
39
|
+
setImageIndex((v) => (v === null ? null : v - 1));
|
|
40
|
+
}, []);
|
|
41
|
+
const onNext = (0, react_1.useCallback)(() => {
|
|
42
|
+
setImageIndex((v) => (v === null ? null : v + 1));
|
|
43
|
+
}, []);
|
|
44
|
+
// modulo bug https://stackoverflow.com/a/4467559
|
|
45
|
+
const moduloImageIndex = imageIndex === null
|
|
46
|
+
? null
|
|
47
|
+
: imageIndex < 0
|
|
48
|
+
? ((imageIndex % images.length) + images.length) % images.length
|
|
49
|
+
: imageIndex % images.length;
|
|
50
|
+
const contextValue = { registerImage, unregisterImage, openGallery };
|
|
51
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
52
|
+
react_1.default.createElement(context_1.ImageGalleryProvider, { value: contextValue }, props.children),
|
|
53
|
+
typeof moduloImageIndex === "number" && (react_1.default.createElement(gallery_1.default, { onClose: () => setImageIndex(null), onNext: onNext, onPrevious: onPrevious, imageIndex: moduloImageIndex, images: images }))));
|
|
54
|
+
}
|
|
55
|
+
exports.default = ImageGallery;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import ImageGallery from "./image-gallery";
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof ImageGallery;
|
|
6
|
+
parameters: {
|
|
7
|
+
actions: {
|
|
8
|
+
argTypesRegex: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
|
13
|
+
export declare function Default(): JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Default = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const image_gallery_1 = __importDefault(require("./image-gallery"));
|
|
9
|
+
const image_1 = __importDefault(require("./image"));
|
|
10
|
+
exports.default = {
|
|
11
|
+
title: "Lab/ImageGallery",
|
|
12
|
+
component: image_gallery_1.default,
|
|
13
|
+
parameters: { actions: { argTypesRegex: "^on.*" } },
|
|
14
|
+
};
|
|
15
|
+
const images = [
|
|
16
|
+
"https://opentopo.app/hero_image.jpeg",
|
|
17
|
+
"https://opentopo.app/generated/area-18/d/9/d9033d93-ea48-4f66-b0c1-6045c091b326_1024_1024_c.jpg",
|
|
18
|
+
"https://opentopo.app/generated/area-16/f/4/f4a4ca79-ea9e-44d1-a4ec-3c8ccfbcc218_1024_1024_c.jpg",
|
|
19
|
+
"https://opentopo.app/generated/area-1/8/b/8b84e378-1f55-4ce7-b750-b504091cb833_1024_1024_c.jpg",
|
|
20
|
+
"https://opentopo.app/generated/area-2/e/7/e7ec532b-20c2-407e-9305-fa7cfb71f01f_1024_1024_c.jpg",
|
|
21
|
+
];
|
|
22
|
+
function Default() {
|
|
23
|
+
return (react_1.default.createElement(image_gallery_1.default, null,
|
|
24
|
+
react_1.default.createElement("div", { className: "flex-direction flex gap-2" }, images.map((src) => (react_1.default.createElement(image_1.default, { key: typeof src === "string" ? src : src.uuid, src: src, className: "h-56 w-56 cursor-pointer object-cover transition-transform hover:scale-105" }))))));
|
|
25
|
+
}
|
|
26
|
+
exports.Default = Default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const use_image_1 = require("./use-image");
|
|
8
|
+
const resizer_1 = require("@uxf/core/utils/resizer");
|
|
9
|
+
function Image(props) {
|
|
10
|
+
var _a;
|
|
11
|
+
const openGallery = (0, use_image_1.useImage)(props);
|
|
12
|
+
return (react_1.default.createElement("img", { src: typeof props.src === "string" ? props.src : (_a = (0, resizer_1.resizerImageUrl)(props.src)) !== null && _a !== void 0 ? _a : "", alt: props.alt, title: props.title, className: props.className, onClick: openGallery }));
|
|
13
|
+
}
|
|
14
|
+
exports.default = Image;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.ImageGallery = exports.Image = void 0;
|
|
21
|
+
var image_1 = require("./image");
|
|
22
|
+
Object.defineProperty(exports, "Image", { enumerable: true, get: function () { return __importDefault(image_1).default; } });
|
|
23
|
+
var image_gallery_1 = require("./image-gallery");
|
|
24
|
+
Object.defineProperty(exports, "ImageGallery", { enumerable: true, get: function () { return __importDefault(image_gallery_1).default; } });
|
|
25
|
+
__exportStar(require("./use-image"), exports);
|
|
26
|
+
__exportStar(require("./types"), exports);
|