@uxf/ui 1.0.0-beta.57 → 1.0.0-beta.58
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.js +2 -1
- package/avatar-file-input/avatar-file-input.d.ts +2 -2
- package/avatar-file-input/avatar-file-input.js +8 -8
- package/avatar-file-input/index.d.ts +1 -1
- package/avatar-file-input/index.js +14 -5
- package/button/button.stories.js +8 -5
- package/button/theme.d.ts +2 -1
- package/checkbox/index.d.ts +1 -1
- package/checkbox/index.js +15 -3
- package/checkbox-input/checkbox-input.d.ts +2 -3
- package/checkbox-input/checkbox-input.js +5 -3
- package/checkbox-input/checkbox-input.stories.d.ts +2 -3
- package/checkbox-input/index.d.ts +1 -1
- package/checkbox-input/index.js +14 -5
- 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 +17 -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 +28 -0
- package/color-radio-group/index.d.ts +1 -0
- package/color-radio-group/index.js +5 -0
- package/combobox/combobox.d.ts +1 -2
- package/combobox/combobox.js +8 -7
- package/combobox/index.d.ts +1 -1
- package/combobox/index.js +14 -5
- package/config/icons-config.d.ts +2 -0
- package/config/icons-config.js +5 -0
- package/config/icons.d.ts +47 -0
- package/config/icons.js +14 -0
- package/css/button.css +171 -76
- package/css/chip.css +37 -0
- package/css/color-radio-group.css +26 -0
- package/css/color-radio.css +21 -0
- package/css/input.css +123 -68
- package/css/label.css +7 -0
- package/css/radio-group.css +41 -12
- package/css/radio.css +2 -2
- package/css/textarea.css +48 -10
- package/dropdown/dropdown.js +7 -7
- package/dropdown/index.d.ts +1 -1
- package/dropdown/index.js +15 -3
- package/error-message/error-message.d.ts +2 -2
- package/error-message/error-message.js +2 -1
- package/error-message/index.d.ts +1 -1
- package/error-message/index.js +14 -5
- package/form-control/form-control.js +2 -2
- package/hooks/use-dropdown.js +3 -1
- package/icon/icon.d.ts +2 -2
- package/icon/icon.js +11 -7
- package/icon/icon.stories.js +12 -8
- package/icon/index.d.ts +1 -5
- package/icon/index.js +14 -13
- package/icon/theme.d.ts +1 -2
- package/image-gallery/components/close-button.js +3 -3
- package/image-gallery/components/next-button.js +3 -3
- package/image-gallery/components/previous-button.js +3 -3
- package/input/index.d.ts +9 -10
- package/input/index.js +10 -13
- package/input/input-element.d.ts +2 -2
- package/input/input-element.js +5 -5
- package/input/input-left-addon.d.ts +3 -3
- package/input/input-left-addon.js +2 -1
- package/input/input-left-element.d.ts +3 -3
- package/input/input-left-element.js +2 -1
- package/input/input-right-addon.d.ts +2 -3
- package/input/input-right-addon.js +2 -1
- package/input/input-right-element.d.ts +3 -3
- package/input/input-right-element.js +2 -1
- package/input/input.d.ts +2 -2
- package/input/input.js +5 -4
- package/input/input.stories.d.ts +5 -5
- package/input/input.stories.js +13 -3
- package/label/index.d.ts +1 -1
- package/label/index.js +14 -5
- package/label/label.d.ts +1 -2
- package/label/label.js +4 -4
- package/package.json +3 -2
- package/radio/index.d.ts +1 -1
- package/radio/index.js +15 -3
- package/radio-group/index.d.ts +1 -1
- package/radio-group/index.js +15 -3
- package/radio-group/radio-group.js +2 -2
- package/radio-group/radio-group.stories.js +2 -2
- package/raster-image/index.d.ts +1 -1
- package/raster-image/index.js +14 -5
- package/raster-image/raster-image.d.ts +4 -4
- package/raster-image/raster-image.js +7 -5
- package/raster-image/raster-image.stories.d.ts +2 -3
- package/select/index.d.ts +1 -1
- package/select/index.js +14 -5
- package/select/select.d.ts +1 -2
- package/select/select.js +8 -7
- package/text-input/text-input.d.ts +1 -1
- package/text-input/text-input.js +4 -4
- package/text-input/text-input.stories.js +4 -1
- package/textarea/index.d.ts +1 -1
- package/textarea/index.js +14 -5
- package/textarea/textarea.d.ts +1 -2
- package/textarea/textarea.js +8 -8
- package/textarea/textarea.stories.js +32 -20
- package/toggle/index.d.ts +1 -1
- package/toggle/index.js +14 -5
- package/toggle/toggle.d.ts +2 -3
- package/toggle/toggle.js +7 -6
- package/toggle/toggle.stories.d.ts +2 -3
- package/utils/icons-config.js +43 -0
- package/utils/storybook-config.js +1 -1
- package/utils/tailwind-config.js +152 -0
- package/hooks/use-latest.d.ts +0 -2
- package/hooks/use-latest.js +0 -12
- package/icon/camera-icon.d.ts +0 -3
- package/icon/camera-icon.js +0 -11
- package/icon/chevron-down-icon.d.ts +0 -3
- package/icon/chevron-down-icon.js +0 -11
- package/icon/chevron-up-icon.d.ts +0 -3
- package/icon/chevron-up-icon.js +0 -11
- package/icon/pin-icon.d.ts +0 -3
- package/icon/pin-icon.js +0 -11
- package/image-gallery/components/icon-chevron-left.d.ts +0 -3
- package/image-gallery/components/icon-chevron-left.js +0 -11
- package/image-gallery/components/icon-chevron-right.d.ts +0 -3
- package/image-gallery/components/icon-chevron-right.js +0 -11
- package/image-gallery/components/icon-close.d.ts +0 -3
- package/image-gallery/components/icon-close.js +0 -11
- package/utils/cx.d.ts +0 -3
- package/utils/cx.js +0 -54
- package/utils/forward-ref.d.ts +0 -12
- package/utils/forward-ref.js +0 -10
- package/utils/rem.d.ts +0 -1
- package/utils/rem.js +0 -5
- package/utils/sr-only-mixin.d.ts +0 -2
- package/utils/sr-only-mixin.js +0 -14
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getProviderConfig = void 0;
|
|
4
|
+
const icons_1 = require("../config/icons");
|
|
4
5
|
const getProviderConfig = () => ({
|
|
5
|
-
icon: { spriteFilePath: "/icons-generated/_icon-sprite.svg", iconsConfig:
|
|
6
|
+
icon: { spriteFilePath: "/icons-generated/_icon-sprite.svg", iconsConfig: icons_1.ICONS },
|
|
6
7
|
});
|
|
7
8
|
exports.getProviderConfig = getProviderConfig;
|
|
@@ -28,5 +28,5 @@ export interface AvatarFileInputProps {
|
|
|
28
28
|
value?: FileResponse | null | undefined;
|
|
29
29
|
namespace?: "default" | "user-files";
|
|
30
30
|
}
|
|
31
|
-
declare const
|
|
32
|
-
export
|
|
31
|
+
export declare const AvatarFileInput: React.ForwardRefExoticComponent<AvatarFileInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
32
|
+
export {};
|
|
@@ -23,16 +23,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.AvatarFileInput = void 0;
|
|
26
27
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
27
28
|
const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
28
29
|
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
29
30
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
31
|
+
const forwardRef_1 = require("@uxf/core/utils/forwardRef");
|
|
30
32
|
const react_1 = __importStar(require("react"));
|
|
31
33
|
const error_message_1 = require("../error-message");
|
|
32
34
|
const icon_1 = require("../icon");
|
|
33
35
|
const raster_image_1 = require("../raster-image");
|
|
34
|
-
|
|
35
|
-
function AvatarFileInput(props, ref) {
|
|
36
|
+
exports.AvatarFileInput = (0, forwardRef_1.forwardRef)("AvatarFileInput", (props, ref) => {
|
|
36
37
|
const innerRef = (0, react_1.useRef)(null);
|
|
37
38
|
const input = (0, useInputFocus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
38
39
|
const errorId = props.invalid && props.id ? `${props.id}--errormessage` : undefined;
|
|
@@ -59,11 +60,10 @@ function AvatarFileInput(props, ref) {
|
|
|
59
60
|
return (react_1.default.createElement("div", { className: `_form-field ${props.className || ""}`, style: props.style },
|
|
60
61
|
react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-avatar-file-input", input.focused && classes_1.CLASSES.IS_FOCUSED, props.disabled && classes_1.CLASSES.IS_DISABLED, props.readOnly && classes_1.CLASSES.IS_READONLY, props.invalid && classes_1.CLASSES.IS_INVALID, props.value && "is-disabled:opacity-50") },
|
|
61
62
|
react_1.default.createElement("label", { className: "sr-only", htmlFor: props.id }, props.label),
|
|
62
|
-
react_1.default.createElement("div", { className: "
|
|
63
|
-
react_1.default.createElement(icon_1.Icon, {
|
|
63
|
+
react_1.default.createElement("div", { className: "relative flex h-full w-full flex-col items-center justify-center rounded-inherit" },
|
|
64
|
+
react_1.default.createElement(icon_1.Icon, { name: "camera", size: 36, className: "text-gray-800" }),
|
|
64
65
|
react_1.default.createElement("p", { className: "mt-1 text-xs text-gray-800" }, uploading ? "nahrávám..." : props.value ? "změnit foto" : "přidat foto")),
|
|
65
|
-
!!props.value && (react_1.default.createElement(raster_image_1.RasterImage, { alt: "", className: (0, cx_1.cx)("
|
|
66
|
-
react_1.default.createElement("input", { accept: "image/*", "aria-describedby": errorId, "aria-invalid": props.invalid, className: "input-reset
|
|
66
|
+
!!props.value && (react_1.default.createElement(raster_image_1.RasterImage, { alt: "", className: (0, cx_1.cx)("absolute left-0 top-0 block h-full w-full rounded-inherit object-cover", uploading && "opacity-0"), height: 96, src: props.value, width: 96 })),
|
|
67
|
+
react_1.default.createElement("input", { accept: "image/*", "aria-describedby": errorId, "aria-invalid": props.invalid, className: "input-reset absolute left-0 top-0 h-full w-full cursor-pointer rounded-inherit opacity-0", disabled: props.disabled, form: props.form, id: props.id, name: props.name, onBlur: input.onBlur, onChange: _onChange, onFocus: input.onFocus, readOnly: props.readOnly, ref: (0, composeRefs_1.composeRefs)(innerRef, ref), required: props.required, tabIndex: props.readOnly ? -1 : undefined, type: "file" })),
|
|
67
68
|
props.invalid && props.error && react_1.default.createElement(error_message_1.ErrorMessage, { id: errorId }, props.error)));
|
|
68
|
-
}
|
|
69
|
-
exports.default = (0, forward_ref_1.forwardRef)("AvatarFileInput", AvatarFileInput);
|
|
69
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./avatar-file-input";
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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);
|
|
4
15
|
};
|
|
5
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports
|
|
7
|
-
var avatar_file_input_1 = require("./avatar-file-input");
|
|
8
|
-
Object.defineProperty(exports, "AvatarFileInput", { enumerable: true, get: function () { return __importDefault(avatar_file_input_1).default; } });
|
|
17
|
+
__exportStar(require("./avatar-file-input"), exports);
|
package/button/button.stories.js
CHANGED
|
@@ -33,7 +33,7 @@ exports.default = {
|
|
|
33
33
|
};
|
|
34
34
|
function Default() {
|
|
35
35
|
const config = (0, storybook_config_1.useStorybookConfig)("Button");
|
|
36
|
-
|
|
36
|
+
const allButtons = (react_1.default.createElement(react_1.default.Fragment, null, config.variants.map((variant) => (react_1.default.createElement(react_1.Fragment, { key: variant }, config.colors.map((color) => (react_1.default.createElement(react_1.Fragment, { key: color }, config.sizes.map((size) => (react_1.default.createElement("div", { key: `${size}${color}${variant}`, className: "pb-4" },
|
|
37
37
|
react_1.default.createElement("div", { className: "mb-2 text-sm" },
|
|
38
38
|
"Variant: ",
|
|
39
39
|
react_1.default.createElement("span", { className: "font-semibold" }, variant),
|
|
@@ -44,9 +44,12 @@ function Default() {
|
|
|
44
44
|
" ",
|
|
45
45
|
react_1.default.createElement("span", { className: "font-semibold" }, size)),
|
|
46
46
|
react_1.default.createElement("div", { className: "mb-2 flex flex-row gap-2" },
|
|
47
|
-
react_1.default.createElement(button_1.Button, {
|
|
48
|
-
react_1.default.createElement(button_1.Button, {
|
|
49
|
-
react_1.default.createElement(button_1.Button, {
|
|
50
|
-
react_1.default.createElement(button_1.Button, {
|
|
47
|
+
react_1.default.createElement(button_1.Button, { color: color, onClick: () => void null, size: size, variant: variant }, "Default"),
|
|
48
|
+
react_1.default.createElement(button_1.Button, { color: color, loading: true, size: size, variant: variant }, "Loading"),
|
|
49
|
+
react_1.default.createElement(button_1.Button, { color: color, disabled: true, size: size, variant: variant }, "Disabled")),
|
|
50
|
+
react_1.default.createElement(button_1.Button, { color: color, isFullWidth: true, onClick: () => void null, size: size, variant: variant }, "Full width"))))))))))));
|
|
51
|
+
return (react_1.default.createElement("div", { className: "flex flex-col space-x-8 lg:flex-row" },
|
|
52
|
+
react_1.default.createElement("div", { className: "light space-y-2 rounded bg-white p-8" }, allButtons),
|
|
53
|
+
react_1.default.createElement("div", { className: "dark space-y-2 rounded bg-gray-900 p-8 text-white" }, allButtons)));
|
|
51
54
|
}
|
|
52
55
|
exports.Default = Default;
|
package/button/theme.d.ts
CHANGED
package/checkbox/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./checkbox";
|
package/checkbox/index.js
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
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
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports
|
|
4
|
-
var checkbox_1 = require("./checkbox");
|
|
5
|
-
Object.defineProperty(exports, "Checkbox", { enumerable: true, get: function () { return checkbox_1.Checkbox; } });
|
|
17
|
+
__exportStar(require("./checkbox"), exports);
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
declare
|
|
3
|
-
export default CheckboxInput;
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
export declare const CheckboxInput: FC;
|
|
@@ -3,8 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CheckboxInput = void 0;
|
|
6
7
|
const react_1 = __importDefault(require("react"));
|
|
7
|
-
|
|
8
|
+
const CheckboxInput = () => {
|
|
8
9
|
return react_1.default.createElement("div", { className: "uxf-checkbox-input" }, "xx");
|
|
9
|
-
}
|
|
10
|
-
exports.
|
|
10
|
+
};
|
|
11
|
+
exports.CheckboxInput = CheckboxInput;
|
|
12
|
+
exports.CheckboxInput.displayName = "CheckboxInput";
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import { CheckboxInput } from "./index";
|
|
1
|
+
import React from "react";
|
|
3
2
|
declare const _default: {
|
|
4
3
|
title: string;
|
|
5
|
-
component:
|
|
4
|
+
component: React.FC<{}>;
|
|
6
5
|
};
|
|
7
6
|
export default _default;
|
|
8
7
|
export declare function Default(): JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./checkbox-input";
|
package/checkbox-input/index.js
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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);
|
|
4
15
|
};
|
|
5
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports
|
|
7
|
-
var checkbox_input_1 = require("./checkbox-input");
|
|
8
|
-
Object.defineProperty(exports, "CheckboxInput", { enumerable: true, get: function () { return __importDefault(checkbox_input_1).default; } });
|
|
17
|
+
__exportStar(require("./checkbox-input"), exports);
|
package/chip/chip.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { HTMLAttributes } from "react";
|
|
2
|
+
import { ChipColors } from "@uxf/ui/chip/theme";
|
|
3
|
+
export declare type ChipColor = keyof ChipColors;
|
|
4
|
+
export interface ChipProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
color?: ChipColor;
|
|
6
|
+
}
|
|
7
|
+
export declare const Chip: React.ForwardRefExoticComponent<ChipProps & React.RefAttributes<HTMLDivElement>>;
|
package/chip/chip.js
ADDED
|
@@ -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
|
+
exports.Chip = void 0;
|
|
7
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const forwardRef_1 = require("@uxf/core/utils/forwardRef");
|
|
10
|
+
exports.Chip = (0, forwardRef_1.forwardRef)("Chip", (props, ref) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const chipClassName = (0, cx_1.cx)("uxf-chip", `uxf-chip--color-${(_a = props.color) !== null && _a !== void 0 ? _a : "success"}`, props.className);
|
|
13
|
+
return (react_1.default.createElement("div", { ref: ref, className: chipClassName }, typeof props.children === "string" ? (react_1.default.createElement("span", { className: "uxf-chip__text" }, props.children)) : (props.children)));
|
|
14
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
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 chip_1 = require("@uxf/ui/chip");
|
|
9
|
+
exports.default = {
|
|
10
|
+
title: "UI/Chip",
|
|
11
|
+
component: chip_1.Chip,
|
|
12
|
+
};
|
|
13
|
+
function Default() {
|
|
14
|
+
const allChips = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
15
|
+
react_1.default.createElement(chip_1.Chip, { color: "success" }, "Success"),
|
|
16
|
+
react_1.default.createElement(chip_1.Chip, { color: "warning" }, "Warning"),
|
|
17
|
+
react_1.default.createElement(chip_1.Chip, { color: "error" }, "Error")));
|
|
18
|
+
return (react_1.default.createElement("div", { className: "flex flex-col lg:flex-row" },
|
|
19
|
+
react_1.default.createElement("div", { className: "light space-x-4 rounded bg-white p-8" }, allChips),
|
|
20
|
+
react_1.default.createElement("div", { className: "dark space-x-4 rounded bg-gray-900 p-8 text-white" }, allChips)));
|
|
21
|
+
}
|
|
22
|
+
exports.Default = Default;
|
package/chip/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Chip } from "./chip";
|
package/chip/index.js
ADDED
package/chip/theme.d.ts
ADDED
package/chip/theme.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { CSSProperties } from "react";
|
|
2
|
+
import { FormControlProps } from "../types";
|
|
3
|
+
import { HexCodeString } from "./color-radio";
|
|
4
|
+
export declare type ColorRadioGroupOptionValue = HexCodeString;
|
|
5
|
+
export interface ColorRadioGroupOption {
|
|
6
|
+
label: string;
|
|
7
|
+
value: ColorRadioGroupOptionValue;
|
|
8
|
+
}
|
|
9
|
+
export interface ColorRadioGroupProps extends FormControlProps<ColorRadioGroupOptionValue | null> {
|
|
10
|
+
className?: string;
|
|
11
|
+
hiddenLabel?: boolean;
|
|
12
|
+
id: string;
|
|
13
|
+
label: string;
|
|
14
|
+
options: ColorRadioGroupOption[];
|
|
15
|
+
style?: CSSProperties;
|
|
16
|
+
}
|
|
17
|
+
export declare const ColorRadioGroup: React.ForwardRefExoticComponent<ColorRadioGroupProps & React.RefAttributes<HTMLLabelElement>>;
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ColorRadioGroup = void 0;
|
|
27
|
+
const react_1 = require("@headlessui/react");
|
|
28
|
+
const react_2 = __importStar(require("react"));
|
|
29
|
+
const use_input_submit_1 = require("../hooks/use-input-submit");
|
|
30
|
+
const label_1 = require("../label");
|
|
31
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
32
|
+
const classes_1 = require("@uxf/core/constants/classes");
|
|
33
|
+
const forwardRef_1 = require("@uxf/core/utils/forwardRef");
|
|
34
|
+
const color_radio_1 = require("./color-radio");
|
|
35
|
+
exports.ColorRadioGroup = (0, forwardRef_1.forwardRef)("ColorRadioGroup", (props, ref) => {
|
|
36
|
+
// eslint-disable-next-line react/destructuring-assignment
|
|
37
|
+
const { className, hiddenLabel, id, isDisabled, label, onChange, options, style, value } = props;
|
|
38
|
+
const innerRef = (0, react_2.useRef)(null);
|
|
39
|
+
(0, use_input_submit_1.useInputSubmit)(innerRef, "radio-group", isDisabled);
|
|
40
|
+
const rootClassName = (0, cx_1.cx)("uxf-color-radio-group-group", className);
|
|
41
|
+
return (react_2.default.createElement(react_1.RadioGroup, { className: rootClassName, id: id, onChange: onChange, style: style, value: value },
|
|
42
|
+
react_2.default.createElement(react_1.RadioGroup.Label, { as: label_1.Label, className: `uxf-color-radio-group__label ${hiddenLabel ? "uxf-color-radio-group-group__label--hidden" : ""}`, ref: ref }, label),
|
|
43
|
+
react_2.default.createElement("div", { className: "uxf-color-radio-group__options-wrapper" }, options.map((option) => {
|
|
44
|
+
const optionStyle = { "--option-color": option.value };
|
|
45
|
+
return (react_2.default.createElement(react_1.RadioGroup.Option, { className: (0, cx_1.cx)("uxf-color-radio-group__option", props.isDisabled && classes_1.CLASSES.IS_DISABLED), key: option.value.toString(), value: option.value, style: optionStyle }, (o) => (react_2.default.createElement(color_radio_1.ColorRadio, { isDisabled: isDisabled || o.disabled, colorLabel: option.label, color: option.value, ref: o.checked ? innerRef : undefined, value: o.checked }))));
|
|
46
|
+
}))));
|
|
47
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: React.ForwardRefExoticComponent<import("./color-radio-group").ColorRadioGroupProps & React.RefAttributes<HTMLLabelElement>>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
7
|
+
export declare function Default(): JSX.Element;
|
|
@@ -0,0 +1,79 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Default = void 0;
|
|
27
|
+
const index_1 = require("./index");
|
|
28
|
+
const react_1 = __importStar(require("react"));
|
|
29
|
+
exports.default = {
|
|
30
|
+
title: "UI/ColorRadioGroup",
|
|
31
|
+
component: index_1.ColorRadioGroup,
|
|
32
|
+
};
|
|
33
|
+
const options = [
|
|
34
|
+
{
|
|
35
|
+
value: "#ff0000",
|
|
36
|
+
label: "Red",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
value: "#00ff00",
|
|
40
|
+
label: "Green",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
value: "#ff00ff",
|
|
44
|
+
label: "Purple",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
value: "#000000",
|
|
48
|
+
label: "Red",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
value: "#ffff00",
|
|
52
|
+
label: "Green",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
value: "#00ffff",
|
|
56
|
+
label: "Purple",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
value: "#cccccc",
|
|
60
|
+
label: "Red",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
value: "#3b1298",
|
|
64
|
+
label: "Green",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
value: "#0000ff",
|
|
68
|
+
label: "Purple",
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
function Default() {
|
|
72
|
+
const [value, setValue] = (0, react_1.useState)(options[0].value);
|
|
73
|
+
return (react_1.default.createElement("div", { className: "flex" },
|
|
74
|
+
react_1.default.createElement("div", { className: "light w-1/2 p-20" },
|
|
75
|
+
react_1.default.createElement(index_1.ColorRadioGroup, { id: "radiogroup", label: "Light Color Radio group", onChange: (v) => setValue(v), options: options, value: value })),
|
|
76
|
+
react_1.default.createElement("div", { className: "dark w-1/2 bg-gray-900 p-20" },
|
|
77
|
+
react_1.default.createElement(index_1.ColorRadioGroup, { id: "radiogroup", label: "Dark Color Radio group", onChange: (v) => setValue(v), options: options, value: value }))));
|
|
78
|
+
}
|
|
79
|
+
exports.Default = Default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FormControlProps } from "../types";
|
|
3
|
+
export declare type HexCodeString = `#${string}`;
|
|
4
|
+
export interface ColorRadioProps extends FormControlProps<boolean> {
|
|
5
|
+
color: HexCodeString;
|
|
6
|
+
colorLabel: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const ColorRadio: React.ForwardRefExoticComponent<ColorRadioProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -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.ColorRadio = void 0;
|
|
7
|
+
const classes_1 = require("@uxf/core/constants/classes");
|
|
8
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
9
|
+
const react_1 = __importDefault(require("react"));
|
|
10
|
+
const forwardRef_1 = require("@uxf/core/utils/forwardRef");
|
|
11
|
+
function isLightBackground(bgColor) {
|
|
12
|
+
const color = bgColor.substring(1, 7);
|
|
13
|
+
const r = parseInt(color.substring(0, 2), 16); // hexToR
|
|
14
|
+
const g = parseInt(color.substring(2, 4), 16); // hexToG
|
|
15
|
+
const b = parseInt(color.substring(4, 6), 16); // hexToB
|
|
16
|
+
return r * 0.299 + g * 0.587 + b * 0.114 > 146;
|
|
17
|
+
}
|
|
18
|
+
function CheckIcon() {
|
|
19
|
+
return (react_1.default.createElement("svg", { fill: "none", viewBox: "0 0 16 16" },
|
|
20
|
+
react_1.default.createElement("path", { d: "M13.333 4 6 11.333 2.667 8", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2" })));
|
|
21
|
+
}
|
|
22
|
+
exports.ColorRadio = (0, forwardRef_1.forwardRef)("ColorRadio", (props, ref) => {
|
|
23
|
+
const colorRadioStyle = { "--bg-color": props.color };
|
|
24
|
+
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 },
|
|
25
|
+
react_1.default.createElement("span", { className: "uxf-color-radio__label" }, props.colorLabel),
|
|
26
|
+
react_1.default.createElement("span", { className: `uxf-color-radio__icon ${isLightBackground(props.color) ? "uxf-color-radio__icon--dark" : ""}` },
|
|
27
|
+
react_1.default.createElement(CheckIcon, null))));
|
|
28
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ColorRadioGroup } from "./color-radio-group";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ColorRadioGroup = void 0;
|
|
4
|
+
var color_radio_group_1 = require("./color-radio-group");
|
|
5
|
+
Object.defineProperty(exports, "ColorRadioGroup", { enumerable: true, get: function () { return color_radio_group_1.ColorRadioGroup; } });
|
package/combobox/combobox.d.ts
CHANGED
|
@@ -21,5 +21,4 @@ export interface ComboboxProps<Value = ComboboxValue, Option = ComboboxOption<Va
|
|
|
21
21
|
placeholder?: string;
|
|
22
22
|
renderOption?: (option: Option) => ReactNode;
|
|
23
23
|
}
|
|
24
|
-
declare const
|
|
25
|
-
export default _default;
|
|
24
|
+
export declare const Combobox: React.ForwardRefExoticComponent<ComboboxProps<ComboboxValue, ComboboxOption<ComboboxValue>> & React.RefAttributes<HTMLDivElement>>;
|
package/combobox/combobox.js
CHANGED
|
@@ -23,19 +23,20 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Combobox = void 0;
|
|
26
27
|
const react_1 = require("@headlessui/react");
|
|
27
28
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
28
29
|
const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
29
30
|
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
30
31
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
32
|
+
const forwardRef_1 = require("@uxf/core/utils/forwardRef");
|
|
31
33
|
const slugify_1 = require("@uxf/core/utils/slugify");
|
|
32
34
|
const react_2 = __importStar(require("react"));
|
|
33
35
|
const use_dropdown_1 = require("../hooks/use-dropdown");
|
|
34
36
|
const icon_1 = require("../icon");
|
|
35
37
|
const label_1 = require("../label");
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var _a, _b, _c;
|
|
38
|
+
exports.Combobox = (0, forwardRef_1.forwardRef)("Combobox", (props, ref) => {
|
|
39
|
+
var _a, _b, _c, _d;
|
|
39
40
|
const generatedId = (0, react_2.useId)();
|
|
40
41
|
const id = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
|
|
41
42
|
const [query, setQuery] = (0, react_2.useState)("");
|
|
@@ -47,16 +48,16 @@ function Combobox(props, ref) {
|
|
|
47
48
|
const dropdown = (0, use_dropdown_1.useDropdown)((_b = props.dropdownPlacement) !== null && _b !== void 0 ? _b : "bottom", true);
|
|
48
49
|
const stableRef = (0, react_2.useMemo)(() => (0, composeRefs_1.composeRefs)(innerRef, ref, dropdown.reference), [ref, dropdown.reference]);
|
|
49
50
|
const getIconClassName = (open) => (0, cx_1.cx)("uxf-select__button-icon", open && "is-open");
|
|
50
|
-
const
|
|
51
|
+
const iconName = (_c = props.iconName) !== null && _c !== void 0 ? _c : "caretDown";
|
|
52
|
+
const iconSize = (_d = props.iconSize) !== null && _d !== void 0 ? _d : 24;
|
|
51
53
|
return (react_2.default.createElement(react_1.Combobox, { as: "div", className: (0, cx_1.cx)("uxf-combobox", props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isRequired && classes_1.CLASSES.IS_REQUIRED, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.className), onChange: (v) => { var _a; return (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, v.id); }, value: selectedOption, disabled: props.isDisabled || props.isReadOnly }, (renderProps) => (react_2.default.createElement(react_2.default.Fragment, null,
|
|
52
54
|
react_2.default.createElement(react_1.Combobox.Label, { as: label_1.Label, onClick: props.isDisabled || props.isReadOnly ? undefined : input.focus }, props.label),
|
|
53
55
|
react_2.default.createElement(react_1.Combobox.Button, { as: "div", className: (0, cx_1.cx)("uxf-combobox__button", (renderProps.open || input.focused) && classes_1.CLASSES.IS_FOCUSED, renderProps.disabled && classes_1.CLASSES.IS_DISABLED, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isInvalid && classes_1.CLASSES.IS_INVALID, dropdown.placement === "bottom" && "is-open--bottom", dropdown.placement === "top" && "is-open--top", renderProps.open && "is-open"), onBlur: input.onBlur, onFocus: input.onFocus, tabIndex: props.isDisabled || props.isReadOnly ? undefined : 0, ref: stableRef, "aria-invalid": props.isInvalid, "aria-describedby": errorId },
|
|
54
56
|
react_2.default.createElement(react_1.Combobox.Input, { className: (0, cx_1.cx)("uxf-combobox__input"), displayValue: (item) => { var _a; return (_a = item === null || item === void 0 ? void 0 : item.label) !== null && _a !== void 0 ? _a : ""; }, onBlur: props.onBlur, onChange: (event) => setQuery(event.target.value), placeholder: props.placeholder, ref: stableRef, type: "text" }),
|
|
55
|
-
|
|
57
|
+
react_2.default.createElement(icon_1.Icon, { className: getIconClassName(renderProps.open), name: iconName, size: iconSize })),
|
|
56
58
|
react_2.default.createElement(react_1.Combobox.Options, { className: (0, cx_1.cx)("uxf-dropdown", dropdown.placement === "bottom" && "uxf-dropdown--bottom", dropdown.placement === "top" && "uxf-dropdown--top"), ref: dropdown.floating }, filteredData.map((option) => {
|
|
57
59
|
var _a, _b, _c, _d;
|
|
58
60
|
return (react_2.default.createElement(react_1.Combobox.Option, { key: (_b = (_a = props.keyExtractor) === null || _a === void 0 ? void 0 : _a.call(props, option)) !== null && _b !== void 0 ? _b : option.id, value: option, className: (optionState) => (0, cx_1.cx)("uxf-dropdown__item", optionState.active && classes_1.CLASSES.IS_ACTIVE, optionState.disabled && classes_1.CLASSES.IS_DISABLED, optionState.selected && classes_1.CLASSES.IS_SELECTED) }, (_d = (_c = props.renderOption) === null || _c === void 0 ? void 0 : _c.call(props, option)) !== null && _d !== void 0 ? _d : option.label));
|
|
59
61
|
})),
|
|
60
62
|
props.helperText && (react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-helper-text", props.isInvalid && classes_1.CLASSES.IS_INVALID), id: errorId }, props.helperText))))));
|
|
61
|
-
}
|
|
62
|
-
exports.default = (0, forward_ref_1.forwardRef)("Combobox", Combobox);
|
|
63
|
+
});
|
package/combobox/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./combobox";
|
package/combobox/index.js
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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);
|
|
4
15
|
};
|
|
5
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports
|
|
7
|
-
var combobox_1 = require("./combobox");
|
|
8
|
-
Object.defineProperty(exports, "Combobox", { enumerable: true, get: function () { return __importDefault(combobox_1).default; } });
|
|
17
|
+
__exportStar(require("./combobox"), exports);
|