@uxf/ui 1.0.0-beta.93 → 1.0.0-beta.95
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/color-radio-group/color-radio-group.d.ts +2 -3
- package/color-radio-group/color-radio.d.ts +2 -3
- package/color-radio-group/color-radio.js +3 -3
- package/combobox/combobox.d.ts +1 -1
- package/css/multi-combobox.css +1 -1
- package/css/typography.css +51 -0
- package/date-picker-input/date-picker-input.js +20 -20
- package/hooks/use-dropdown.d.ts +2 -2
- package/hooks/use-dropdown.js +6 -6
- package/image-gallery/components/gallery.js +5 -5
- package/image-gallery/image-gallery.stories.js +1 -1
- package/mutli-combobox/multi-combobox.d.ts +1 -1
- package/package.json +5 -4
- package/raster-image/raster-image.d.ts +1 -1
- package/raster-image/raster-image.js +19 -7
- package/raster-image/raster-image.stories.d.ts +1 -1
- package/select/select.d.ts +1 -1
- package/time-picker-input/time-picker-input.d.ts +1 -1
- package/time-picker-input/time-picker-input.js +23 -23
- package/tw-tokens/tw-box-shadow.d.ts +1 -0
- package/tw-tokens/tw-box-shadow.js +1 -0
- package/tw-tokens/tw-font-size.d.ts +13 -0
- package/tw-tokens/tw-font-size.js +13 -0
- package/types/color.d.ts +1 -0
- package/types/color.js +2 -0
- package/types/index.d.ts +1 -0
- package/types/index.js +1 -0
- package/typography/typography.spec.d.ts +1 -0
- package/typography/typography.spec.js +21 -0
- package/typography/typography.stories.d.ts +7 -0
- package/typography/typography.stories.js +28 -0
- package/utils/tailwind-config.js +15 -0
- package/utils/image.d.ts +0 -19
- package/utils/image.js +0 -104
- package/utils/is-light-background.d.ts +0 -2
- package/utils/is-light-background.js +0 -11
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { CSSProperties, ReactNode } from "react";
|
|
2
|
-
import { FormControlProps } from "../types";
|
|
3
|
-
|
|
4
|
-
export declare type ColorRadioGroupOptionValue = HexCodeString;
|
|
2
|
+
import { FormControlProps, HexColor } from "../types";
|
|
3
|
+
export declare type ColorRadioGroupOptionValue = HexColor;
|
|
5
4
|
export interface ColorRadioGroupOption {
|
|
6
5
|
label: string;
|
|
7
6
|
value: ColorRadioGroupOptionValue;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { FormControlProps } from "../types";
|
|
3
|
-
import { HexCodeString } from "../utils/is-light-background";
|
|
2
|
+
import { FormControlProps, HexColor } from "../types";
|
|
4
3
|
export interface ColorRadioProps extends FormControlProps<boolean> {
|
|
5
|
-
color:
|
|
4
|
+
color: HexColor;
|
|
6
5
|
colorLabel: string;
|
|
7
6
|
}
|
|
8
7
|
export declare const ColorRadio: React.ForwardRefExoticComponent<ColorRadioProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.ColorRadio = void 0;
|
|
7
7
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
8
8
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
9
|
-
const react_1 = __importDefault(require("react"));
|
|
10
9
|
const forwardRef_1 = require("@uxf/core/utils/forwardRef");
|
|
11
|
-
const
|
|
10
|
+
const color2k_1 = require("color2k");
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
12
|
function CheckIcon() {
|
|
13
13
|
return (react_1.default.createElement("svg", { fill: "none", viewBox: "0 0 16 16" },
|
|
14
14
|
react_1.default.createElement("path", { d: "M13.333 4 6 11.333 2.667 8", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2" })));
|
|
@@ -17,6 +17,6 @@ exports.ColorRadio = (0, forwardRef_1.forwardRef)("ColorRadio", (props, ref) =>
|
|
|
17
17
|
const colorRadioStyle = { "--bg-color": props.color };
|
|
18
18
|
return (react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-color-radio", props.value && classes_1.CLASSES.IS_SELECTED), onClick: () => { var _a; return (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, !props.value); }, ref: ref, style: colorRadioStyle },
|
|
19
19
|
react_1.default.createElement("span", { className: "uxf-color-radio__label" }, props.colorLabel),
|
|
20
|
-
react_1.default.createElement("span", { className: `uxf-color-radio__icon ${(0,
|
|
20
|
+
react_1.default.createElement("span", { className: `uxf-color-radio__icon ${(0, color2k_1.readableColorIsBlack)(props.color) ? "uxf-color-radio__icon--dark" : ""}` },
|
|
21
21
|
react_1.default.createElement(CheckIcon, null))));
|
|
22
22
|
});
|
package/combobox/combobox.d.ts
CHANGED
package/css/multi-combobox.css
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
&__button {
|
|
5
5
|
@apply relative flex flex-row w-full cursor-default flex-wrap items-center rounded-lg pl-4 pr-8 pb-2 text-left
|
|
6
|
-
|
|
6
|
+
outline-none before:absolute before:inset-0 before:pointer-events-none before:border before:rounded-lg;
|
|
7
7
|
|
|
8
8
|
.uxf-icon {
|
|
9
9
|
@apply absolute top-3 right-4 h-4;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
.uxf-typo-h1 {
|
|
2
|
+
@apply text-desktopH1 font-bold;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.uxf-typo-h2 {
|
|
6
|
+
@apply text-desktopH2 font-bold;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.uxf-typo-h3 {
|
|
10
|
+
@apply text-desktopH3 font-bold;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.uxf-typo-h4 {
|
|
14
|
+
@apply text-desktopH4 font-bold;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.uxf-typo-h5 {
|
|
18
|
+
@apply text-desktopH5 font-bold;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.uxf-typo-h6 {
|
|
22
|
+
@apply text-desktopH6 font-bold;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.uxf-typo-body {
|
|
26
|
+
@apply text-body;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.uxf-typo-body2 {
|
|
30
|
+
@apply text-body2;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.uxf-typo-button {
|
|
34
|
+
@apply text-body font-bold;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.uxf-typo-caption {
|
|
38
|
+
@apply text-caption;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.uxf-typo-medium {
|
|
42
|
+
@apply text-medium font-medium;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.uxf-typo-medium2 {
|
|
46
|
+
@apply text-medium2 font-medium;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.uxf-typo-overline {
|
|
50
|
+
@apply text-overline font-bold;
|
|
51
|
+
}
|
|
@@ -27,20 +27,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.DatePickerInput = void 0;
|
|
30
|
-
const
|
|
31
|
-
const
|
|
30
|
+
const react_1 = require("@floating-ui/react");
|
|
31
|
+
const react_2 = require("@headlessui/react");
|
|
32
32
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
33
33
|
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
34
34
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
35
35
|
const forwardRef_1 = require("@uxf/core/utils/forwardRef");
|
|
36
36
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
37
|
-
const
|
|
37
|
+
const react_3 = __importStar(require("react"));
|
|
38
38
|
const form_control_1 = require("../form-control");
|
|
39
39
|
const date_picker_provider_1 = require("./date-picker-provider");
|
|
40
40
|
exports.DatePickerInput = (0, forwardRef_1.forwardRef)("DatePickerInput", (props, ref) => {
|
|
41
41
|
var _a;
|
|
42
|
-
const [isFocused, setIsFocused] = (0,
|
|
43
|
-
const generatedId = (0,
|
|
42
|
+
const [isFocused, setIsFocused] = (0, react_3.useState)(false);
|
|
43
|
+
const generatedId = (0, react_3.useId)();
|
|
44
44
|
const id = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
|
|
45
45
|
const errorId = props.isInvalid ? `${id}--error-message` : undefined;
|
|
46
46
|
const rootClassName = (0, cx_1.cx)("uxf-date-picker-input", isFocused && classes_1.CLASSES.IS_FOCUSED, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.isInvalid && classes_1.CLASSES.IS_INVALID, props.leftElement && "uxf-date-picker-input--has-left-element", props.rightElement && "uxf-date-picker-input--has-right-element", props.isRequired && classes_1.CLASSES.IS_REQUIRED, props.isReadOnly && classes_1.CLASSES.IS_READONLY);
|
|
@@ -54,13 +54,13 @@ exports.DatePickerInput = (0, forwardRef_1.forwardRef)("DatePickerInput", (props
|
|
|
54
54
|
setIsFocused(false);
|
|
55
55
|
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
56
56
|
};
|
|
57
|
-
const floatingDatePicker = (0,
|
|
57
|
+
const floatingDatePicker = (0, react_1.useFloating)({
|
|
58
58
|
placement: "bottom",
|
|
59
59
|
middleware: [
|
|
60
|
-
(0,
|
|
61
|
-
(0,
|
|
62
|
-
(0,
|
|
63
|
-
(0,
|
|
60
|
+
(0, react_1.offset)(8),
|
|
61
|
+
(0, react_1.flip)(),
|
|
62
|
+
(0, react_1.shift)(),
|
|
63
|
+
(0, react_1.size)({
|
|
64
64
|
apply({ availableHeight, availableWidth, elements, strategy, x, y }) {
|
|
65
65
|
Object.assign(elements.floating.style, {
|
|
66
66
|
left: x + "px",
|
|
@@ -72,17 +72,17 @@ exports.DatePickerInput = (0, forwardRef_1.forwardRef)("DatePickerInput", (props
|
|
|
72
72
|
},
|
|
73
73
|
}),
|
|
74
74
|
],
|
|
75
|
-
whileElementsMounted: (reference, floating, update) => (0,
|
|
75
|
+
whileElementsMounted: (reference, floating, update) => (0, react_1.autoUpdate)(reference, floating, update, {
|
|
76
76
|
elementResize: typeof ResizeObserver !== "undefined",
|
|
77
77
|
}),
|
|
78
78
|
});
|
|
79
|
-
const stableRef = (0,
|
|
80
|
-
return (
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
!props.isDisabled && !props.isReadOnly && (
|
|
87
|
-
|
|
79
|
+
const stableRef = (0, react_3.useMemo)(() => (0, composeRefs_1.composeRefs)(ref, floatingDatePicker.reference), [ref, floatingDatePicker.reference]);
|
|
80
|
+
return (react_3.default.createElement(form_control_1.FormControl, { className: rootClassName, errorId: errorId, form: props.form, helperText: props.helperText, hiddenLabel: props.hiddenLabel, inputId: id, isRequired: props.isRequired, label: props.label },
|
|
81
|
+
react_3.default.createElement(react_2.Popover, { className: "relative" },
|
|
82
|
+
react_3.default.createElement(react_2.Popover.Button, { as: "div", className: "uxf-date-picker-input__wrapper", ref: stableRef },
|
|
83
|
+
react_3.default.createElement("span", { className: "uxf-date-picker-input__left-element" }, props.leftElement),
|
|
84
|
+
react_3.default.createElement("input", { "aria-describedby": errorId, "aria-errormessage": props.error && errorId ? `${errorId}__error-message` : undefined, "aria-invalid": !!props.error, "aria-live": "polite", autoComplete: "off", className: "uxf-date-picker-input__element", disabled: props.isDisabled, form: props.form, id: id, inputMode: "none", name: props.name, onBlur: onBlur, onChange: () => props.onChange, onFocus: onFocus, placeholder: "Vyberte datum...", readOnly: props.isReadOnly, ref: ref, required: props.isRequired, tabIndex: props.isReadOnly ? -1 : undefined, value: props.value ? (0, dayjs_1.default)(props.value).format("l") : "" }),
|
|
85
|
+
react_3.default.createElement("span", { className: "uxf-date-picker-input__right-element" }, props.rightElement)),
|
|
86
|
+
!props.isDisabled && !props.isReadOnly && (react_3.default.createElement(react_2.Transition, { as: react_3.Fragment, enter: "transition duration-200 ease-out", enterFrom: "origin-top scale-50 opacity-0", enterTo: "origin-top scale-100 opacity-100", leave: "transition duration-200 ease-out", leaveFrom: "origin-top scale-50 opacity-100", leaveTo: "origin-top scale-0 opacity-0" },
|
|
87
|
+
react_3.default.createElement(react_2.Popover.Panel, { className: "uxf-date-picker-input__popover", ref: floatingDatePicker.floating, static: true }, ({ close }) => (react_3.default.createElement(date_picker_provider_1.DatePickerProvider, { closePopoverHandler: close, onChange: props.onChange, selectedDate: props.value }))))))));
|
|
88
88
|
});
|
package/hooks/use-dropdown.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Placement } from "@floating-ui/react
|
|
2
|
-
export declare function useDropdown(placement: Placement, matchWidth?: boolean): import("@floating-ui/react
|
|
1
|
+
import { Placement } from "@floating-ui/react";
|
|
2
|
+
export declare function useDropdown(placement: Placement, matchWidth?: boolean): import("@floating-ui/react").UseFloatingReturn<import("@floating-ui/react").ReferenceType>;
|
package/hooks/use-dropdown.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useDropdown = void 0;
|
|
4
|
-
const
|
|
4
|
+
const react_1 = require("@floating-ui/react");
|
|
5
5
|
function useDropdown(placement, matchWidth = false) {
|
|
6
|
-
return (0,
|
|
6
|
+
return (0, react_1.useFloating)({
|
|
7
7
|
placement,
|
|
8
8
|
middleware: [
|
|
9
|
-
(0,
|
|
10
|
-
(0,
|
|
11
|
-
(0,
|
|
9
|
+
(0, react_1.flip)(),
|
|
10
|
+
(0, react_1.shift)(),
|
|
11
|
+
(0, react_1.size)({
|
|
12
12
|
apply({ availableHeight, availableWidth, elements, strategy, x, y }) {
|
|
13
13
|
Object.assign(elements.floating.style, {
|
|
14
14
|
left: x + "px",
|
|
@@ -22,7 +22,7 @@ function useDropdown(placement, matchWidth = false) {
|
|
|
22
22
|
},
|
|
23
23
|
}),
|
|
24
24
|
],
|
|
25
|
-
whileElementsMounted: (reference, floating, update) => (0,
|
|
25
|
+
whileElementsMounted: (reference, floating, update) => (0, react_1.autoUpdate)(reference, floating, update, {
|
|
26
26
|
elementResize: typeof ResizeObserver !== "undefined",
|
|
27
27
|
}),
|
|
28
28
|
});
|
|
@@ -26,13 +26,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const image_1 = require("
|
|
29
|
+
const image_1 = require("@uxf/core/utils/image");
|
|
30
|
+
const resizer_1 = require("@uxf/core/utils/resizer");
|
|
31
|
+
const react_1 = __importStar(require("react"));
|
|
30
32
|
const close_button_1 = __importDefault(require("./close-button"));
|
|
31
|
-
const previous_button_1 = __importDefault(require("./previous-button"));
|
|
32
|
-
const next_button_1 = __importDefault(require("./next-button"));
|
|
33
33
|
const dot_1 = __importDefault(require("./dot"));
|
|
34
|
-
const
|
|
35
|
-
const
|
|
34
|
+
const next_button_1 = __importDefault(require("./next-button"));
|
|
35
|
+
const previous_button_1 = __importDefault(require("./previous-button"));
|
|
36
36
|
function Gallery(props) {
|
|
37
37
|
var _a;
|
|
38
38
|
(0, react_1.useEffect)(() => {
|
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Default = void 0;
|
|
7
|
+
const image_1 = require("@uxf/core/utils/image");
|
|
7
8
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const image_1 = require("../utils/image");
|
|
9
9
|
const image_2 = __importDefault(require("./image"));
|
|
10
10
|
const image_gallery_1 = __importDefault(require("./image-gallery"));
|
|
11
11
|
exports.default = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/ui",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.95",
|
|
4
4
|
"description": "",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
"author": "UX Fans s.r.o",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@floating-ui/react
|
|
16
|
+
"@floating-ui/react": "^0.17.0",
|
|
17
17
|
"@headlessui/react": "^1.7.7",
|
|
18
|
-
"@uxf/core": "^4.
|
|
18
|
+
"@uxf/core": "^4.3.0",
|
|
19
19
|
"@uxf/datepicker": "^1.2.0",
|
|
20
|
-
"@uxf/styles": "^2.1.
|
|
20
|
+
"@uxf/styles": "^2.1.2",
|
|
21
|
+
"color2k": "^2.0.1",
|
|
21
22
|
"dayjs": "^1.11.7",
|
|
22
23
|
"jump.js": "^1.0.2"
|
|
23
24
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Quality } from "@uxf/core/utils/image";
|
|
1
2
|
import { ImageSource, ResizerImageProps } from "@uxf/core/utils/resizer";
|
|
2
3
|
import { FC, ImgHTMLAttributes, ReactNode } from "react";
|
|
3
|
-
import { Quality } from "../utils/image";
|
|
4
4
|
declare type ImgProps = ImgHTMLAttributes<HTMLImageElement>;
|
|
5
5
|
declare type Props = {
|
|
6
6
|
alt: string;
|
|
@@ -5,31 +5,43 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.RasterImage = void 0;
|
|
7
7
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
8
|
+
const image_1 = require("@uxf/core/utils/image");
|
|
8
9
|
const resizer_1 = require("@uxf/core/utils/resizer");
|
|
9
10
|
const react_1 = __importDefault(require("react"));
|
|
10
11
|
const context_1 = require("../context");
|
|
11
|
-
const image_1 = require("../utils/image");
|
|
12
12
|
const RasterImage = (props) => {
|
|
13
13
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
14
14
|
const componentContext = (0, context_1.useComponentContext)("rasterImage");
|
|
15
15
|
const className = [
|
|
16
|
+
"uxf-raster-image",
|
|
16
17
|
props.mode === "contain" && "uxf-raster-image--contain",
|
|
17
18
|
props.mode === "cover" && "uxf-raster-image--cover",
|
|
18
19
|
props.className,
|
|
19
20
|
];
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
...((_d = props.options) !== null && _d !== void 0 ? _d : {}),
|
|
21
|
+
const resizerSrc = (0, resizer_1.resizerImageUrl)(props.src, (_a = props.width) !== null && _a !== void 0 ? _a : "auto", (_b = props.height) !== null && _b !== void 0 ? _b : "auto", {
|
|
22
|
+
...((_c = props.options) !== null && _c !== void 0 ? _c : {}),
|
|
23
23
|
quality: (0, image_1.getImgQuality)(props.quality, "original"),
|
|
24
24
|
});
|
|
25
25
|
if (!resizerSrc) {
|
|
26
|
-
return
|
|
26
|
+
return react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-raster-image--no-image", ...className) }, props.noImageContent);
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
const imgClassName = [
|
|
29
|
+
"uxf-raster-image__img",
|
|
30
|
+
props.mode === "contain" && "uxf-raster-image__img--contain",
|
|
31
|
+
props.mode === "cover" && "uxf-raster-image__img--cover",
|
|
32
|
+
props.imgClassName,
|
|
33
|
+
];
|
|
34
|
+
const svgUrl = props.src && (0, image_1.getSvgImgUrl)(props.src);
|
|
35
|
+
if (svgUrl === "svg") {
|
|
36
|
+
return (react_1.default.createElement("picture", { className: (0, cx_1.cx)(className) },
|
|
37
|
+
react_1.default.createElement("img", { alt: props.alt, className: (0, cx_1.cx)(imgClassName), height: props.height, loading: props.loading, src: svgUrl, width: props.width })));
|
|
38
|
+
}
|
|
39
|
+
const breakpoints = ["0em", ...Object.values((_d = props.breakpoints) !== null && _d !== void 0 ? _d : componentContext.breakpoints)];
|
|
40
|
+
return (react_1.default.createElement("picture", { className: (0, cx_1.cx)(className) }, (_f = (_e = props.widths) === null || _e === void 0 ? void 0 : _e.map((w, i) => i < breakpoints.length && (react_1.default.createElement(image_1.ImgSources, { breakpointIndex: i, breakpoints: breakpoints, height: props.heights && props.heights[i]
|
|
29
41
|
? props.heights[i]
|
|
30
42
|
: props.width && props.height
|
|
31
43
|
? Math.ceil((props.height / props.width) * w)
|
|
32
44
|
: "auto", key: w, options: props.options, quality: props.quality, src: props.src, width: w }))).reverse()) !== null && _f !== void 0 ? _f : (react_1.default.createElement(image_1.ImgSources, { height: (_g = props.height) !== null && _g !== void 0 ? _g : "auto", options: props.options, quality: props.quality, src: props.src, width: (_h = props.width) !== null && _h !== void 0 ? _h : "auto" })),
|
|
33
|
-
react_1.default.createElement("img", { alt: props.alt, className: (0, cx_1.cx)(
|
|
45
|
+
react_1.default.createElement("img", { alt: props.alt, className: (0, cx_1.cx)(imgClassName), height: props.height, loading: props.loading, src: resizerSrc, width: props.width })));
|
|
34
46
|
};
|
|
35
47
|
exports.RasterImage = RasterImage;
|
|
@@ -11,7 +11,7 @@ declare const _default: {
|
|
|
11
11
|
mode?: "contain" | "cover" | "responsive" | undefined;
|
|
12
12
|
noImageContent?: React.ReactNode;
|
|
13
13
|
options?: Omit<import("@uxf/core/utils/resizer").ResizerImageProps, "quality" | "toFormat"> | undefined;
|
|
14
|
-
quality?: import("
|
|
14
|
+
quality?: import("@uxf/core/utils/image").Quality | undefined;
|
|
15
15
|
role?: React.AriaRole | undefined;
|
|
16
16
|
src: import("@uxf/core/utils/resizer").ImageSource | null | undefined;
|
|
17
17
|
widths?: number[] | undefined;
|
package/select/select.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { TimeType } from "@uxf/datepicker/hooks/use-time-picker";
|
|
1
2
|
import React, { ReactNode } from "react";
|
|
2
3
|
import { InputProps } from "../input/input";
|
|
3
4
|
import { FormControlProps } from "../types";
|
|
4
|
-
import { TimeType } from "@uxf/datepicker/hooks/use-time-picker";
|
|
5
5
|
export interface TimePickerInputProps extends Omit<FormControlProps<TimeType | null>, "value">, Pick<InputProps, "size" | "variant"> {
|
|
6
6
|
className?: string;
|
|
7
7
|
defaultValue?: string;
|
|
@@ -24,19 +24,19 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.TimePickerInput = void 0;
|
|
27
|
+
const react_1 = require("@floating-ui/react");
|
|
28
|
+
const react_2 = require("@headlessui/react");
|
|
27
29
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
30
|
+
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
28
31
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
29
|
-
const react_1 = __importStar(require("react"));
|
|
30
|
-
const form_control_1 = require("../form-control");
|
|
31
32
|
const forwardRef_1 = require("@uxf/core/utils/forwardRef");
|
|
32
|
-
const
|
|
33
|
+
const react_3 = __importStar(require("react"));
|
|
34
|
+
const form_control_1 = require("../form-control");
|
|
33
35
|
const time_picker_1 = require("./time-picker");
|
|
34
|
-
const react_dom_1 = require("@floating-ui/react-dom");
|
|
35
|
-
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
36
36
|
exports.TimePickerInput = (0, forwardRef_1.forwardRef)("TimePickerInput", (props, ref) => {
|
|
37
37
|
var _a;
|
|
38
|
-
const [isFocused, setIsFocused] = (0,
|
|
39
|
-
const generatedId = (0,
|
|
38
|
+
const [isFocused, setIsFocused] = (0, react_3.useState)(false);
|
|
39
|
+
const generatedId = (0, react_3.useId)();
|
|
40
40
|
const id = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
|
|
41
41
|
const errorId = props.isInvalid ? `${id}--error-message` : undefined;
|
|
42
42
|
const rootClassName = (0, cx_1.cx)("uxf-time-picker-input", isFocused && classes_1.CLASSES.IS_FOCUSED, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.isInvalid && classes_1.CLASSES.IS_INVALID, props.leftElement && "uxf-time-picker-input--has-left-element", props.rightElement && "uxf-time-picker-input--has-right-element", props.isRequired && classes_1.CLASSES.IS_REQUIRED, props.isReadOnly && classes_1.CLASSES.IS_READONLY);
|
|
@@ -50,13 +50,13 @@ exports.TimePickerInput = (0, forwardRef_1.forwardRef)("TimePickerInput", (props
|
|
|
50
50
|
setIsFocused(false);
|
|
51
51
|
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
52
52
|
};
|
|
53
|
-
const floatingTimePicker = (0,
|
|
53
|
+
const floatingTimePicker = (0, react_1.useFloating)({
|
|
54
54
|
placement: "bottom",
|
|
55
55
|
middleware: [
|
|
56
|
-
(0,
|
|
57
|
-
(0,
|
|
58
|
-
(0,
|
|
59
|
-
(0,
|
|
56
|
+
(0, react_1.offset)(8),
|
|
57
|
+
(0, react_1.flip)(),
|
|
58
|
+
(0, react_1.shift)(),
|
|
59
|
+
(0, react_1.size)({
|
|
60
60
|
apply({ availableHeight, availableWidth, elements, strategy, x, y }) {
|
|
61
61
|
Object.assign(elements.floating.style, {
|
|
62
62
|
left: x + "px",
|
|
@@ -68,22 +68,22 @@ exports.TimePickerInput = (0, forwardRef_1.forwardRef)("TimePickerInput", (props
|
|
|
68
68
|
},
|
|
69
69
|
}),
|
|
70
70
|
],
|
|
71
|
-
whileElementsMounted: (reference, floating, update) => (0,
|
|
71
|
+
whileElementsMounted: (reference, floating, update) => (0, react_1.autoUpdate)(reference, floating, update, {
|
|
72
72
|
elementResize: typeof ResizeObserver !== "undefined",
|
|
73
73
|
}),
|
|
74
74
|
});
|
|
75
|
-
const stableRef = (0,
|
|
76
|
-
return (
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
const stableRef = (0, react_3.useMemo)(() => (0, composeRefs_1.composeRefs)(ref, floatingTimePicker.reference), [ref, floatingTimePicker.reference]);
|
|
76
|
+
return (react_3.default.createElement(form_control_1.FormControl, { className: rootClassName, errorId: errorId, form: props.form, helperText: props.helperText, hiddenLabel: props.hiddenLabel, inputId: id, isRequired: props.isRequired, label: props.label },
|
|
77
|
+
react_3.default.createElement(react_2.Popover, { className: "relative" },
|
|
78
|
+
react_3.default.createElement(react_2.Popover.Button, { as: "div", className: "uxf-time-picker-input__wrapper", ref: stableRef },
|
|
79
|
+
react_3.default.createElement("span", { className: "uxf-time-picker-input__left-element" }, props.leftElement),
|
|
80
|
+
react_3.default.createElement("input", { "aria-describedby": errorId, "aria-errormessage": props.error && errorId ? `${errorId}__error-message` : undefined, "aria-invalid": !!props.error, "aria-live": "polite", autoComplete: "off", className: "uxf-time-picker-input__element", disabled: props.isDisabled, form: props.form, id: id, inputMode: "text", name: props.name, onBlur: onBlur, onChange: () => props.onChange, onFocus: onFocus, placeholder: "Vyberte \u010Das...", readOnly: props.isReadOnly, ref: ref, required: props.isRequired, tabIndex: props.isReadOnly ? -1 : undefined, value: props.value
|
|
81
81
|
? `${props.value.hour}:${props.value.minute < 10 ? "0" + props.value.minute : props.value.minute}`
|
|
82
82
|
: "" }),
|
|
83
|
-
|
|
84
|
-
!props.isDisabled && !props.isReadOnly && (
|
|
85
|
-
|
|
83
|
+
react_3.default.createElement("span", { className: "uxf-time-picker-input__right-element" }, props.rightElement)),
|
|
84
|
+
!props.isDisabled && !props.isReadOnly && (react_3.default.createElement(react_2.Transition, { as: react_3.Fragment, enter: "transition duration-200 ease-out", enterFrom: "origin-top scale-50 opacity-0", enterTo: "origin-top scale-100 opacity-100", leave: "transition duration-200 ease-out", leaveFrom: "origin-top scale-50 opacity-100", leaveTo: "origin-top scale-0 opacity-0" },
|
|
85
|
+
react_3.default.createElement(react_2.Popover.Panel, { className: "uxf-time-picker-input__popover", ref: floatingTimePicker.floating, static: true }, ({ close }) => {
|
|
86
86
|
var _a;
|
|
87
|
-
return props.onChange ? (
|
|
87
|
+
return props.onChange ? (react_3.default.createElement(time_picker_1.TimePicker, { closePopoverHandler: close, onChange: props.onChange, selectedTime: (_a = props.value) !== null && _a !== void 0 ? _a : null })) : (react_3.default.createElement(react_3.default.Fragment, null));
|
|
88
88
|
}))))));
|
|
89
89
|
});
|
|
@@ -38,5 +38,18 @@ export declare const twFontSize: {
|
|
|
38
38
|
"9xl": (string | {
|
|
39
39
|
lineHeight: string;
|
|
40
40
|
})[];
|
|
41
|
+
desktopH1: (string | number)[];
|
|
42
|
+
desktopH2: (string | number)[];
|
|
43
|
+
desktopH3: (string | number)[];
|
|
44
|
+
desktopH4: (string | number)[];
|
|
45
|
+
desktopH5: (string | number)[];
|
|
46
|
+
desktopH6: (string | number)[];
|
|
47
|
+
body: (string | number)[];
|
|
48
|
+
body2: (string | number)[];
|
|
49
|
+
button: (string | number)[];
|
|
50
|
+
caption: (string | number)[];
|
|
51
|
+
medium: (string | number)[];
|
|
52
|
+
medium2: (string | number)[];
|
|
53
|
+
overline: (string | number)[];
|
|
41
54
|
};
|
|
42
55
|
export declare type TwFontSize = typeof twFontSize;
|
|
@@ -16,4 +16,17 @@ exports.twFontSize = {
|
|
|
16
16
|
"7xl": ["4.5rem", { lineHeight: "1" }],
|
|
17
17
|
"8xl": ["6rem", { lineHeight: "1" }],
|
|
18
18
|
"9xl": ["8rem", { lineHeight: "1" }],
|
|
19
|
+
desktopH1: ["6rem", 1.1666666666666667],
|
|
20
|
+
desktopH2: ["3.75rem", 1.2],
|
|
21
|
+
desktopH3: ["3rem", 1.3333333333333333],
|
|
22
|
+
desktopH4: ["2.125rem", 1.1764705882352942],
|
|
23
|
+
desktopH5: ["1.5rem", 1.3333333333333333],
|
|
24
|
+
desktopH6: ["1rem", 1.375],
|
|
25
|
+
body: ["1rem", 1.5],
|
|
26
|
+
body2: ["0.875rem", 1.4285714285714286],
|
|
27
|
+
button: ["1rem", 1.5],
|
|
28
|
+
caption: ["0.75rem", 1.3333333333333333],
|
|
29
|
+
medium: ["1rem", 1.5],
|
|
30
|
+
medium2: ["0.875rem", 1.4285714285714286],
|
|
31
|
+
overline: ["0.625rem", 1.6],
|
|
19
32
|
};
|
package/types/color.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type HexColor = `#${string}`;
|
package/types/color.js
ADDED
package/types/index.d.ts
CHANGED
package/types/index.js
CHANGED
|
@@ -14,4 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./color"), exports);
|
|
17
18
|
__exportStar(require("./form-control-props"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
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 snap_test_1 = require("../utils/snap-test");
|
|
8
|
+
(0, snap_test_1.snapTest)("render basic", react_1.default.createElement(react_1.default.Fragment, null,
|
|
9
|
+
react_1.default.createElement("h1", { className: "uxf-typo-h1" }, ".uxf-typo-h1"),
|
|
10
|
+
react_1.default.createElement("h2", { className: "uxf-typo-h2" }, ".uxf-typo-h2"),
|
|
11
|
+
react_1.default.createElement("h3", { className: "uxf-typo-h3" }, ".uxf-typo-h3"),
|
|
12
|
+
react_1.default.createElement("h4", { className: "uxf-typo-h4" }, ".uxf-typo-h4"),
|
|
13
|
+
react_1.default.createElement("h5", { className: "uxf-typo-h5" }, ".uxf-typo-h5"),
|
|
14
|
+
react_1.default.createElement("h6", { className: "uxf-typo-h6" }, ".uxf.typo-h6"),
|
|
15
|
+
react_1.default.createElement("p", { className: "uxf-typo-body" }, ".uxf-typo-body"),
|
|
16
|
+
react_1.default.createElement("p", { className: "uxf-typo-body2" }, ".uxf-typo-body2"),
|
|
17
|
+
react_1.default.createElement("p", { className: "uxf-typo-button" }, ".uxf-typo-button"),
|
|
18
|
+
react_1.default.createElement("p", { className: "uxf-typo-caption" }, ".uxf-typo-caption"),
|
|
19
|
+
react_1.default.createElement("p", { className: "uxf-typo-medium" }, ".uxf-typo-medium"),
|
|
20
|
+
react_1.default.createElement("p", { className: "uxf-typo-medium2" }, ".uxf-typo-medium2"),
|
|
21
|
+
react_1.default.createElement("p", { className: "uxf-typo-overline" }, ".uxf-typo-overline")));
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
exports.default = {
|
|
9
|
+
title: "UI/Typography",
|
|
10
|
+
component: null,
|
|
11
|
+
};
|
|
12
|
+
function Default() {
|
|
13
|
+
return (react_1.default.createElement("div", { className: "space-y-4" },
|
|
14
|
+
react_1.default.createElement("h1", { className: "uxf-typo-h1" }, ".uxf-typo-h1"),
|
|
15
|
+
react_1.default.createElement("h2", { className: "uxf-typo-h2" }, ".uxf-typo-h2"),
|
|
16
|
+
react_1.default.createElement("h3", { className: "uxf-typo-h3" }, ".uxf-typo-h3"),
|
|
17
|
+
react_1.default.createElement("h4", { className: "uxf-typo-h4" }, ".uxf-typo-h4"),
|
|
18
|
+
react_1.default.createElement("h5", { className: "uxf-typo-h5" }, ".uxf-typo-h5"),
|
|
19
|
+
react_1.default.createElement("h6", { className: "uxf-typo-h6" }, ".uxf.typo-h6"),
|
|
20
|
+
react_1.default.createElement("p", { className: "uxf-typo-body" }, ".uxf-typo-body"),
|
|
21
|
+
react_1.default.createElement("p", { className: "uxf-typo-body2" }, ".uxf-typo-body2"),
|
|
22
|
+
react_1.default.createElement("p", { className: "uxf-typo-button" }, ".uxf-typo-button"),
|
|
23
|
+
react_1.default.createElement("p", { className: "uxf-typo-caption" }, ".uxf-typo-caption"),
|
|
24
|
+
react_1.default.createElement("p", { className: "uxf-typo-medium" }, ".uxf-typo-medium"),
|
|
25
|
+
react_1.default.createElement("p", { className: "uxf-typo-medium2" }, ".uxf-typo-medium2"),
|
|
26
|
+
react_1.default.createElement("p", { className: "uxf-typo-overline" }, ".uxf-typo-overline")));
|
|
27
|
+
}
|
|
28
|
+
exports.Default = Default;
|
package/utils/tailwind-config.js
CHANGED
|
@@ -99,6 +99,21 @@ module.exports = {
|
|
|
99
99
|
boxShadow: {
|
|
100
100
|
paper: "0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06)",
|
|
101
101
|
},
|
|
102
|
+
fontSize: {
|
|
103
|
+
desktopH1: [rem(96), 112 / 96],
|
|
104
|
+
desktopH2: [rem(60), 72 / 60],
|
|
105
|
+
desktopH3: [rem(48), 64 / 48],
|
|
106
|
+
desktopH4: [rem(34), 40 / 34],
|
|
107
|
+
desktopH5: [rem(24), 32 / 24],
|
|
108
|
+
desktopH6: [rem(16), 22 / 16],
|
|
109
|
+
body: [rem(16), 24 / 16],
|
|
110
|
+
body2: [rem(14), 20 / 14],
|
|
111
|
+
button: [rem(16), 24 / 16],
|
|
112
|
+
caption: [rem(12), 16 / 12],
|
|
113
|
+
medium: [rem(16), 24 / 16],
|
|
114
|
+
medium2: [rem(14), 20 / 14],
|
|
115
|
+
overline: [rem(10), 16 / 10],
|
|
116
|
+
},
|
|
102
117
|
spacing: {
|
|
103
118
|
inherit: "inherit",
|
|
104
119
|
},
|
package/utils/image.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ImageSource, ResizerImageProps } from "@uxf/core/utils/resizer";
|
|
2
|
-
import { FC } from "react";
|
|
3
|
-
export declare type Dimension = number | "auto";
|
|
4
|
-
export declare type Format = "avif" | "webp" | "original";
|
|
5
|
-
export declare type Quality = number | Record<Format, number>;
|
|
6
|
-
export declare function getImgQuality(quality: Quality | undefined, format: Format): number | undefined;
|
|
7
|
-
export declare function getImgUniqueIdentifier(src: ImageSource): string | undefined;
|
|
8
|
-
export declare function getImgSrcSet(src?: ImageSource, width?: Dimension, height?: Dimension, options?: ResizerImageProps): string | undefined;
|
|
9
|
-
interface ImageSourcesProps {
|
|
10
|
-
breakpointIndex?: number;
|
|
11
|
-
breakpoints?: string[];
|
|
12
|
-
height: Dimension;
|
|
13
|
-
options?: Omit<ResizerImageProps, "quality" | "toFormat">;
|
|
14
|
-
quality?: Quality;
|
|
15
|
-
src: ImageSource;
|
|
16
|
-
width: Dimension;
|
|
17
|
-
}
|
|
18
|
-
export declare const ImgSources: FC<ImageSourcesProps>;
|
|
19
|
-
export {};
|
package/utils/image.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
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.ImgSources = exports.getImgSrcSet = exports.getImgUniqueIdentifier = exports.getImgQuality = void 0;
|
|
7
|
-
const resizer_1 = require("@uxf/core/utils/resizer");
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
function toFileResponse(src) {
|
|
10
|
-
return typeof src !== "string" && "uuid" in src ? src : undefined;
|
|
11
|
-
}
|
|
12
|
-
function toStaticImageData(src) {
|
|
13
|
-
return typeof src !== "string" && "src" in src ? src : undefined;
|
|
14
|
-
}
|
|
15
|
-
function getImgExtension(src) {
|
|
16
|
-
const ext = src.slice(src.lastIndexOf(".") + 1);
|
|
17
|
-
return ext.length > 1 ? ext : undefined;
|
|
18
|
-
}
|
|
19
|
-
function getImgQuality(quality, format) {
|
|
20
|
-
return typeof quality === "number" ? quality : quality ? quality[format] : undefined;
|
|
21
|
-
}
|
|
22
|
-
exports.getImgQuality = getImgQuality;
|
|
23
|
-
function getImgUniqueIdentifier(src) {
|
|
24
|
-
var _a;
|
|
25
|
-
const fileResponse = toFileResponse(src);
|
|
26
|
-
const staticImageData = toStaticImageData(src);
|
|
27
|
-
return typeof src === "string" ? src : (_a = fileResponse === null || fileResponse === void 0 ? void 0 : fileResponse.uuid) !== null && _a !== void 0 ? _a : staticImageData === null || staticImageData === void 0 ? void 0 : staticImageData.src;
|
|
28
|
-
}
|
|
29
|
-
exports.getImgUniqueIdentifier = getImgUniqueIdentifier;
|
|
30
|
-
const HIDPI_SIZES = [3, 2, 1];
|
|
31
|
-
function getImgSrcSet(src, width, height, options = {}) {
|
|
32
|
-
if (!src) {
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
let toFormat;
|
|
36
|
-
let h = height !== null && height !== void 0 ? height : "auto";
|
|
37
|
-
let w = width !== null && width !== void 0 ? width : "auto";
|
|
38
|
-
if (typeof src === "string") {
|
|
39
|
-
const extension = getImgExtension(src);
|
|
40
|
-
if (extension === "svg") {
|
|
41
|
-
return undefined;
|
|
42
|
-
}
|
|
43
|
-
toFormat = extension;
|
|
44
|
-
}
|
|
45
|
-
const fileResponse = toFileResponse(src);
|
|
46
|
-
if (fileResponse) {
|
|
47
|
-
if (!fileResponse.uuid || fileResponse.extension === "svg") {
|
|
48
|
-
return undefined;
|
|
49
|
-
}
|
|
50
|
-
toFormat = fileResponse.extension;
|
|
51
|
-
}
|
|
52
|
-
const staticImageData = toStaticImageData(src);
|
|
53
|
-
if (staticImageData) {
|
|
54
|
-
const extension = getImgExtension(staticImageData.src);
|
|
55
|
-
if (!staticImageData.src || extension === "svg") {
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
toFormat = extension;
|
|
59
|
-
h = h || staticImageData.height;
|
|
60
|
-
w = w || staticImageData.width;
|
|
61
|
-
}
|
|
62
|
-
if (typeof h === "number" || typeof w === "number") {
|
|
63
|
-
return HIDPI_SIZES.map((size) => (0, resizer_1.resizerImageUrl)(src, w * size, h * size, {
|
|
64
|
-
toFormat,
|
|
65
|
-
...options,
|
|
66
|
-
}) + (size > 1 ? ` ${size}x` : "")).join(", ");
|
|
67
|
-
}
|
|
68
|
-
return (0, resizer_1.resizerImageUrl)(src, w, h, { toFormat, ...options });
|
|
69
|
-
}
|
|
70
|
-
exports.getImgSrcSet = getImgSrcSet;
|
|
71
|
-
const ImgSources = (props) => {
|
|
72
|
-
var _a, _b, _c;
|
|
73
|
-
if (!props.src || (typeof props.src === "string" && getImgExtension(props.src) === "svg")) {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
const fileResponse = toFileResponse(props.src);
|
|
77
|
-
if (fileResponse && (!fileResponse.uuid || fileResponse.extension === "svg")) {
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
const staticImageData = toStaticImageData(props.src);
|
|
81
|
-
if (staticImageData && (!staticImageData.src || getImgExtension(staticImageData.src))) {
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
let media;
|
|
85
|
-
if (props.breakpoints && props.breakpointIndex) {
|
|
86
|
-
media = `(min-width: ${props.breakpoints[props.breakpointIndex]})`;
|
|
87
|
-
}
|
|
88
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
89
|
-
react_1.default.createElement("source", { media: media, srcSet: getImgSrcSet(props.src, props.width, props.height, {
|
|
90
|
-
...((_a = props.options) !== null && _a !== void 0 ? _a : {}),
|
|
91
|
-
quality: getImgQuality(props.quality, "avif"),
|
|
92
|
-
toFormat: "avif",
|
|
93
|
-
}), type: "image/avif" }),
|
|
94
|
-
react_1.default.createElement("source", { media: media, srcSet: getImgSrcSet(props.src, props.width, props.height, {
|
|
95
|
-
...((_b = props.options) !== null && _b !== void 0 ? _b : {}),
|
|
96
|
-
quality: getImgQuality(props.quality, "webp"),
|
|
97
|
-
toFormat: "webp",
|
|
98
|
-
}), type: "image/webp" }),
|
|
99
|
-
react_1.default.createElement("source", { media: media, srcSet: getImgSrcSet(props.src, props.width, props.height, {
|
|
100
|
-
...((_c = props.options) !== null && _c !== void 0 ? _c : {}),
|
|
101
|
-
quality: getImgQuality(props.quality, "original"),
|
|
102
|
-
}) })));
|
|
103
|
-
};
|
|
104
|
-
exports.ImgSources = ImgSources;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isLightBackground = void 0;
|
|
4
|
-
function isLightBackground(bgColor) {
|
|
5
|
-
const color = bgColor.substring(1, 7);
|
|
6
|
-
const r = parseInt(color.substring(0, 2), 16); // hexToR
|
|
7
|
-
const g = parseInt(color.substring(2, 4), 16); // hexToG
|
|
8
|
-
const b = parseInt(color.substring(4, 6), 16); // hexToB
|
|
9
|
-
return r * 0.299 + g * 0.587 + b * 0.114 > 146;
|
|
10
|
-
}
|
|
11
|
-
exports.isLightBackground = isLightBackground;
|