@uxf/ui 1.0.0-beta.4 → 1.0.0-beta.41
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/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/avatar-file-input/index.js +8 -0
- package/button/button.d.ts +13 -13
- package/button/button.js +15 -12
- package/button/button.stories.d.ts +7 -0
- package/button/button.stories.js +52 -0
- package/button/index.d.ts +1 -1
- package/button/index.js +1 -2
- package/button/theme.d.ts +7 -4
- package/button/theme.js +0 -1
- package/checkbox/checkbox.d.ts +12 -0
- package/checkbox/checkbox.js +23 -0
- package/checkbox/checkbox.stories.d.ts +8 -0
- package/checkbox/checkbox.stories.js +40 -0
- package/checkbox/index.d.ts +1 -0
- package/checkbox/index.js +8 -0
- package/checkbox-input/checkbox-input.d.ts +3 -0
- package/checkbox-input/checkbox-input.js +10 -0
- package/checkbox-input/checkbox-input.stories.d.ts +8 -0
- package/checkbox-input/checkbox-input.stories.js +17 -0
- package/checkbox-input/index.d.ts +1 -0
- package/checkbox-input/index.js +8 -0
- package/combobox/combobox.d.ts +21 -0
- package/combobox/combobox.js +57 -0
- package/combobox/combobox.stories.d.ts +9 -0
- package/combobox/combobox.stories.js +63 -0
- package/combobox/index.d.ts +1 -0
- package/combobox/index.js +8 -0
- package/dropdown/dropdown.d.ts +10 -0
- package/dropdown/dropdown.js +27 -0
- package/dropdown/index.d.ts +1 -0
- package/dropdown/index.js +5 -0
- package/error-message/error-message.d.ts +7 -0
- package/error-message/error-message.js +10 -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 +8 -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 +13 -0
- package/form-control/form-control.stories.js +23 -0
- package/form-control/index.d.ts +1 -0
- package/{theme → form-control}/index.js +1 -3
- package/hooks/use-dropdown.d.ts +7 -0
- package/hooks/use-dropdown.js +37 -0
- package/hooks/use-fix-android-on-focus.d.ts +2 -0
- package/hooks/use-fix-android-on-focus.js +31 -0
- package/hooks/use-input-submit.d.ts +4 -0
- package/hooks/use-input-submit.js +44 -0
- package/hooks/use-latest.d.ts +2 -0
- package/hooks/use-latest.js +12 -0
- package/icon/camera-icon.d.ts +3 -0
- package/icon/camera-icon.js +11 -0
- package/icon/chevron-down-icon.d.ts +3 -0
- package/icon/chevron-down-icon.js +11 -0
- package/icon/chevron-up-icon.d.ts +3 -0
- package/icon/chevron-up-icon.js +11 -0
- package/icon/icon.d.ts +17 -0
- package/icon/icon.js +25 -0
- package/icon/icon.stories.d.ts +7 -0
- package/icon/icon.stories.js +70 -0
- package/icon/index.d.ts +5 -0
- package/icon/index.js +16 -0
- package/icon/pin-icon.d.ts +3 -0
- package/icon/pin-icon.js +11 -0
- package/icon/theme.d.ts +3 -0
- package/icon/theme.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/icon-chevron-left.d.ts +3 -0
- package/image-gallery/components/icon-chevron-left.js +11 -0
- package/image-gallery/components/icon-chevron-right.d.ts +3 -0
- package/image-gallery/components/icon-chevron-right.js +11 -0
- package/image-gallery/components/icon-close.d.ts +3 -0
- package/image-gallery/components/icon-close.js +11 -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 +13 -0
- package/input/index.js +19 -0
- package/input/input-element.d.ts +11 -0
- package/input/input-element.js +11 -0
- package/input/input-left-addon.d.ts +6 -0
- package/input/input-left-addon.js +10 -0
- package/input/input-left-element.d.ts +6 -0
- package/input/input-left-element.js +10 -0
- package/input/input-right-addon.d.ts +6 -0
- package/input/input-right-addon.js +10 -0
- package/input/input-right-element.d.ts +6 -0
- package/input/input-right-element.js +10 -0
- package/input/input.d.ts +8 -0
- package/input/input.js +63 -0
- package/input/input.stories.d.ts +14 -0
- package/input/input.stories.js +71 -0
- package/input/theme.d.ts +6 -0
- package/input/theme.js +2 -0
- package/label/index.d.ts +1 -0
- package/label/index.js +8 -0
- package/label/label.d.ts +11 -0
- package/label/label.js +13 -0
- package/label/label.stories.d.ts +7 -0
- package/label/label.stories.js +17 -0
- package/package.json +16 -34
- package/radio/index.d.ts +1 -0
- package/radio/index.js +8 -0
- package/radio/radio.d.ts +5 -0
- package/radio/radio.js +14 -0
- package/radio/radio.stories.d.ts +7 -0
- package/radio/radio.stories.js +28 -0
- package/radio-group/index.d.ts +1 -0
- package/radio-group/index.js +8 -0
- package/radio-group/radio-group.d.ts +25 -0
- package/radio-group/radio-group.js +45 -0
- package/radio-group/radio-group.stories.d.ts +7 -0
- package/radio-group/radio-group.stories.js +52 -0
- package/raster-image/index.d.ts +1 -0
- package/raster-image/index.js +8 -0
- package/raster-image/raster-image.d.ts +16 -0
- package/raster-image/raster-image.js +19 -0
- package/raster-image/raster-image.stories.d.ts +8 -0
- package/raster-image/raster-image.stories.js +17 -0
- package/select/index.d.ts +1 -0
- package/select/index.js +8 -0
- package/select/select.d.ts +20 -0
- package/select/select.js +57 -0
- package/select/select.stories.d.ts +9 -0
- package/select/select.stories.js +67 -0
- package/text-input/index.d.ts +1 -0
- package/text-input/index.js +17 -0
- package/text-input/text-input.d.ts +23 -0
- package/text-input/text-input.js +57 -0
- package/text-input/text-input.stories.d.ts +9 -0
- package/text-input/text-input.stories.js +51 -0
- package/textarea/index.d.ts +1 -0
- package/textarea/index.js +8 -0
- package/textarea/textarea.d.ts +26 -0
- package/textarea/textarea.js +75 -0
- package/textarea/textarea.stories.d.ts +7 -0
- package/textarea/textarea.stories.js +32 -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/cx.d.ts +3 -0
- package/utils/cx.js +54 -0
- package/utils/forwardRef.d.ts +12 -0
- package/utils/forwardRef.js +10 -0
- package/utils/image.d.ts +9 -0
- package/utils/image.js +30 -0
- package/utils/rem.d.ts +1 -0
- package/utils/rem.js +5 -0
- package/utils/storybook-config.d.ts +19 -0
- package/utils/storybook-config.js +47 -0
- package/theme/index.d.ts +0 -2
- package/theme/theme-context.d.ts +0 -10
- package/theme/theme-context.js +0 -59
- package/theme/theme.d.ts +0 -14
- package/theme/theme.js +0 -3
- package/types.d.ts +0 -3
- package/types.js +0 -3
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, { CSSProperties, FocusEventHandler } from "react";
|
|
2
|
+
interface FileResponse {
|
|
3
|
+
extension: string;
|
|
4
|
+
id: number;
|
|
5
|
+
name: string;
|
|
6
|
+
namespace?: string | null;
|
|
7
|
+
uuid: string;
|
|
8
|
+
}
|
|
9
|
+
export declare type AvatarFileInputChangeEventHandler = (file: FileResponse | null) => Promise<void>;
|
|
10
|
+
export declare type AvatarFileInputUploadHandler = (file: File, namespace?: string) => Promise<FileResponse>;
|
|
11
|
+
export interface AvatarFileInputProps {
|
|
12
|
+
className?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
error?: string;
|
|
15
|
+
form?: string;
|
|
16
|
+
id: string;
|
|
17
|
+
invalid?: boolean;
|
|
18
|
+
label: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
onBlur?: FocusEventHandler<HTMLInputElement>;
|
|
21
|
+
onChange: AvatarFileInputChangeEventHandler;
|
|
22
|
+
onFocus?: FocusEventHandler<HTMLInputElement>;
|
|
23
|
+
onUploadError: (err: unknown) => void;
|
|
24
|
+
readOnly?: boolean;
|
|
25
|
+
required?: boolean;
|
|
26
|
+
style?: CSSProperties;
|
|
27
|
+
uploadHandler: AvatarFileInputUploadHandler;
|
|
28
|
+
value?: FileResponse | null | undefined;
|
|
29
|
+
namespace?: "default" | "user-files";
|
|
30
|
+
}
|
|
31
|
+
declare const _default: React.ForwardRefExoticComponent<AvatarFileInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
32
|
+
export default _default;
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
const classes_1 = require("@uxf/core/constants/classes");
|
|
27
|
+
const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
28
|
+
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
29
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const forwardRef_1 = require("../utils/forwardRef");
|
|
32
|
+
const error_message_1 = require("../error-message");
|
|
33
|
+
const raster_image_1 = require("../raster-image");
|
|
34
|
+
const icon_1 = require("../icon");
|
|
35
|
+
function AvatarFileInput(props, ref) {
|
|
36
|
+
const innerRef = (0, react_1.useRef)(null);
|
|
37
|
+
const input = (0, useInputFocus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
38
|
+
const errorId = props.invalid && props.id ? `${props.id}--errormessage` : undefined;
|
|
39
|
+
const [uploading, setUploading] = (0, react_1.useState)(false);
|
|
40
|
+
const _onChange = (0, react_1.useCallback)(async (e) => {
|
|
41
|
+
var _a;
|
|
42
|
+
e.persist();
|
|
43
|
+
const files = (_a = e.target.files) !== null && _a !== void 0 ? _a : [];
|
|
44
|
+
if (files.length === 1) {
|
|
45
|
+
const file = files[0];
|
|
46
|
+
try {
|
|
47
|
+
setUploading(true);
|
|
48
|
+
const response = await props.uploadHandler(file);
|
|
49
|
+
await props.onChange(response);
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
props.onUploadError(err);
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
setUploading(false);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}, [props]);
|
|
59
|
+
return (react_1.default.createElement("div", { className: `_form-field ${props.className || ""}`, style: props.style },
|
|
60
|
+
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
|
+
react_1.default.createElement("label", { className: "sr-only", htmlFor: props.id }, props.label),
|
|
62
|
+
react_1.default.createElement("div", { className: "rounded-inherit relative flex h-full w-full flex-col items-center justify-center" },
|
|
63
|
+
react_1.default.createElement(icon_1.Icon, { Component: icon_1.CameraIcon, size: 36, className: "text-gray-800" }),
|
|
64
|
+
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)("rounded-inherit absolute left-0 top-0 block h-full w-full object-cover", uploading && "opacity-0"), height: 96, src: props.value, width: 96 })),
|
|
66
|
+
react_1.default.createElement("input", { accept: "image/*", "aria-describedby": errorId, "aria-invalid": props.invalid, className: "input-reset rounded-inherit absolute left-0 top-0 h-full w-full cursor-pointer 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
|
+
props.invalid && props.error && react_1.default.createElement(error_message_1.ErrorMessage, { id: errorId }, props.error)));
|
|
68
|
+
}
|
|
69
|
+
exports.default = (0, forwardRef_1.forwardRef)("AvatarFileInput", AvatarFileInput);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: React.ForwardRefExoticComponent<import("./avatar-file-input").AvatarFileInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
7
|
+
export declare function Default(): JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
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 index_1 = require("./index");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
exports.default = {
|
|
10
|
+
title: "UI/AvatarFileInput",
|
|
11
|
+
component: index_1.AvatarFileInput,
|
|
12
|
+
};
|
|
13
|
+
function Default() {
|
|
14
|
+
return (react_1.default.createElement("div", { className: "space-y-2" },
|
|
15
|
+
react_1.default.createElement(index_1.AvatarFileInput, { id: "afi", label: "Vyberte Avatar", onChange: (value) => {
|
|
16
|
+
return new Promise(() => {
|
|
17
|
+
// eslint-disable-next-line no-console
|
|
18
|
+
console.log("Changed:", value);
|
|
19
|
+
});
|
|
20
|
+
}, onUploadError: () => {
|
|
21
|
+
// eslint-disable-next-line no-console
|
|
22
|
+
console.log("Upload error");
|
|
23
|
+
}, uploadHandler: () => {
|
|
24
|
+
return new Promise(() => {
|
|
25
|
+
// eslint-disable-next-line no-console
|
|
26
|
+
console.log("Upload handler");
|
|
27
|
+
});
|
|
28
|
+
} })));
|
|
29
|
+
}
|
|
30
|
+
exports.Default = Default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as AvatarFileInput } from "./avatar-file-input";
|
|
@@ -0,0 +1,8 @@
|
|
|
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.AvatarFileInput = void 0;
|
|
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; } });
|
package/button/button.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ButtonColors, ButtonSizes, ButtonVariants } from "@uxf/ui/button";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import React, { AnchorHTMLAttributes } from "react";
|
|
2
|
+
import { ButtonColors, ButtonSizes, ButtonVariants } from "@uxf/ui/button/theme";
|
|
3
|
+
import { UseAnchorProps } from "@uxf/core/hooks/useAnchorProps";
|
|
4
|
+
export declare type ButtonVariant = keyof ButtonVariants;
|
|
5
|
+
export declare type ButtonSize = keyof ButtonSizes;
|
|
6
|
+
export declare type ButtonColor = keyof ButtonColors;
|
|
7
|
+
export interface ButtonProps extends AnchorHTMLAttributes<HTMLAnchorElement>, UseAnchorProps {
|
|
8
|
+
variant?: ButtonVariant;
|
|
9
|
+
color?: ButtonColor;
|
|
10
|
+
size?: ButtonSize;
|
|
11
|
+
isFullWidth?: boolean;
|
|
12
12
|
}
|
|
13
|
-
declare
|
|
14
|
-
export default
|
|
13
|
+
declare const _default: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
14
|
+
export default _default;
|
package/button/button.js
CHANGED
|
@@ -3,17 +3,20 @@ 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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
8
|
+
const forwardRef_1 = require("../utils/forwardRef");
|
|
9
|
+
const useAnchorProps_1 = require("@uxf/core/hooks/useAnchorProps");
|
|
10
|
+
const classes_1 = require("@uxf/core/constants/classes");
|
|
11
|
+
function Button(props, ref) {
|
|
10
12
|
var _a, _b, _c;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const className = (0, cx_1.cx)("uxf-button", `uxf-button--color-${(_a = props.color) !== null && _a !== void 0 ? _a : "default"}`, `uxf-button--size-${(_b = props.size) !== null && _b !== void 0 ? _b : "default"}`, `uxf-button--variant-${(_c = props.variant) !== null && _c !== void 0 ? _c : "default"}`, props.disabled && classes_1.CLASSES.IS_DISABLED, props.loading && "is-loading", props.isFullWidth && "uxf-button--full-width");
|
|
14
|
+
const anchorProps = (0, useAnchorProps_1.useAnchorProps)({
|
|
15
|
+
...props,
|
|
16
|
+
className,
|
|
17
|
+
});
|
|
18
|
+
return (react_1.default.createElement("a", { ref: ref, ...anchorProps, className: className },
|
|
19
|
+
typeof props.children === "string" ? (react_1.default.createElement("span", { className: "uxf-button__text" }, props.children)) : (props.children),
|
|
20
|
+
react_1.default.createElement("div", { className: "loader" })));
|
|
17
21
|
}
|
|
18
|
-
exports.default = Button;
|
|
19
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnV0dG9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2J1dHRvbi9idXR0b24udHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsZ0RBQXlDO0FBQ3pDLHVDQUF5QztBQUV6Qyx5Q0FBd0M7QUFheEMsU0FBUyxNQUFNLENBQUMsS0FBa0I7O0lBQ2hDLElBQU0sS0FBSyxHQUFHLElBQUEsZ0JBQVEsR0FBRSxDQUFDLE1BQU0sQ0FBQztJQUVoQyxJQUFNLFNBQVMsR0FBRyxJQUFBLE9BQUUsRUFDbEIsUUFBUSxFQUNSLEtBQUssQ0FBQyxLQUFLLENBQUMsTUFBQSxLQUFLLENBQUMsS0FBSyxtQ0FBSSxLQUFLLENBQUMsWUFBWSxDQUFDLEVBQzlDLEtBQUssQ0FBQyxJQUFJLENBQUMsTUFBQSxLQUFLLENBQUMsSUFBSSxtQ0FBSSxLQUFLLENBQUMsV0FBVyxDQUFDLEVBQzNDLEtBQUssQ0FBQyxPQUFPLENBQUMsTUFBQSxLQUFLLENBQUMsT0FBTyxtQ0FBSSxLQUFLLENBQUMsY0FBYyxDQUFDLEVBQ3BELEtBQUssQ0FBQyxRQUFRLElBQUksS0FBSyxDQUFDLFFBQVEsQ0FDakMsQ0FBQztJQUVGLE9BQU8sQ0FDTCwwQ0FBUSxJQUFJLEVBQUMsUUFBUSxFQUFDLFNBQVMsRUFBRSxTQUFTO1FBQ3ZDLEtBQUssQ0FBQyxjQUFjO1FBQ3BCLEtBQUssQ0FBQyxRQUFRO1FBQ2QsS0FBSyxDQUFDLFlBQVksQ0FDWixDQUNWLENBQUM7QUFDSixDQUFDO0FBRUQsa0JBQWUsTUFBTSxDQUFDIn0=
|
|
22
|
+
exports.default = (0, forwardRef_1.forwardRef)("Button", Button);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: React.ForwardRefExoticComponent<import("@uxf/ui/button").ButtonProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
7
|
+
export declare function Default(): JSX.Element;
|
|
@@ -0,0 +1,52 @@
|
|
|
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 react_1 = __importStar(require("react"));
|
|
28
|
+
const button_1 = require("@uxf/ui/button");
|
|
29
|
+
const storybook_config_1 = require("@uxf/ui/utils/storybook-config");
|
|
30
|
+
exports.default = {
|
|
31
|
+
title: "UI/Button",
|
|
32
|
+
component: button_1.Button,
|
|
33
|
+
};
|
|
34
|
+
function Default() {
|
|
35
|
+
const config = (0, storybook_config_1.useStorybookConfig)("Button");
|
|
36
|
+
return (react_1.default.createElement("div", { className: "space-y-2" }, 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
|
+
react_1.default.createElement("div", { className: "mb-2 text-sm" },
|
|
38
|
+
"Variant: ",
|
|
39
|
+
react_1.default.createElement("span", { className: "font-semibold" }, variant),
|
|
40
|
+
", Color:",
|
|
41
|
+
" ",
|
|
42
|
+
react_1.default.createElement("span", { className: "font-semibold" }, color),
|
|
43
|
+
", Size:",
|
|
44
|
+
" ",
|
|
45
|
+
react_1.default.createElement("span", { className: "font-semibold" }, size)),
|
|
46
|
+
react_1.default.createElement("div", { className: "mb-2 flex flex-row gap-2" },
|
|
47
|
+
react_1.default.createElement(button_1.Button, { variant: variant, color: color, size: size }, "Default"),
|
|
48
|
+
react_1.default.createElement(button_1.Button, { variant: variant, color: color, size: size, loading: true }, "Loading"),
|
|
49
|
+
react_1.default.createElement(button_1.Button, { variant: variant, color: color, size: size, disabled: true }, "Disabled")),
|
|
50
|
+
react_1.default.createElement(button_1.Button, { variant: variant, color: color, size: size, isFullWidth: true }, "Full width"))))))))))));
|
|
51
|
+
}
|
|
52
|
+
exports.Default = Default;
|
package/button/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as Button } from "@uxf/ui/button/button";
|
|
2
|
-
export * from "@uxf/ui/button/
|
|
2
|
+
export * from "@uxf/ui/button/button";
|
package/button/index.js
CHANGED
|
@@ -20,5 +20,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
20
20
|
exports.Button = void 0;
|
|
21
21
|
var button_1 = require("@uxf/ui/button/button");
|
|
22
22
|
Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return __importDefault(button_1).default; } });
|
|
23
|
-
__exportStar(require("@uxf/ui/button/
|
|
24
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYnV0dG9uL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsZ0RBQTBEO0FBQWpELGlIQUFBLE9BQU8sT0FBVTtBQUMxQix1REFBcUMifQ==
|
|
23
|
+
__exportStar(require("@uxf/ui/button/button"), exports);
|
package/button/theme.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
export interface ButtonVariants {
|
|
2
2
|
outlined: true;
|
|
3
|
-
|
|
3
|
+
default: true;
|
|
4
4
|
}
|
|
5
5
|
export interface ButtonSizes {
|
|
6
6
|
xs: true;
|
|
7
7
|
sm: true;
|
|
8
|
-
|
|
8
|
+
default: true;
|
|
9
9
|
lg: true;
|
|
10
10
|
xl: true;
|
|
11
11
|
}
|
|
12
12
|
export interface ButtonColors {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
default: true;
|
|
14
|
+
white: true;
|
|
15
|
+
success: true;
|
|
16
|
+
warning: true;
|
|
17
|
+
error: true;
|
|
15
18
|
}
|
package/button/theme.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGhlbWUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYnV0dG9uL3RoZW1lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CSSProperties } from "react";
|
|
2
|
+
interface Props {
|
|
3
|
+
className?: string;
|
|
4
|
+
checked: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
intermediate?: boolean;
|
|
7
|
+
label: string;
|
|
8
|
+
onChange: (checked: boolean) => void;
|
|
9
|
+
style?: Partial<CSSProperties>;
|
|
10
|
+
}
|
|
11
|
+
declare function Checkbox(props: Props): JSX.Element;
|
|
12
|
+
export default Checkbox;
|
|
@@ -0,0 +1,23 @@
|
|
|
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 = require("@headlessui/react");
|
|
7
|
+
const react_2 = __importDefault(require("react"));
|
|
8
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
9
|
+
const classes_1 = require("@uxf/core/constants/classes");
|
|
10
|
+
function CheckIcon() {
|
|
11
|
+
return (react_2.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 448 512", style: { height: "24" } },
|
|
12
|
+
react_2.default.createElement("path", { d: "M211.8 339.8C200.9 350.7 183.1 350.7 172.2 339.8L108.2 275.8C97.27 264.9 97.27 247.1 108.2 236.2C119.1 225.3 136.9 225.3 147.8 236.2L192 280.4L300.2 172.2C311.1 161.3 328.9 161.3 339.8 172.2C350.7 183.1 350.7 200.9 339.8 211.8L211.8 339.8zM0 96C0 60.65 28.65 32 64 32H384C419.3 32 448 60.65 448 96V416C448 451.3 419.3 480 384 480H64C28.65 480 0 451.3 0 416V96zM48 96V416C48 424.8 55.16 432 64 432H384C392.8 432 400 424.8 400 416V96C400 87.16 392.8 80 384 80H64C55.16 80 48 87.16 48 96z" })));
|
|
13
|
+
}
|
|
14
|
+
function SquareIcon() {
|
|
15
|
+
return (react_2.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 448 512", style: { height: "24" } },
|
|
16
|
+
react_2.default.createElement("path", { d: "M384 32C419.3 32 448 60.65 448 96V416C448 451.3 419.3 480 384 480H64C28.65 480 0 451.3 0 416V96C0 60.65 28.65 32 64 32H384zM384 80H64C55.16 80 48 87.16 48 96V416C48 424.8 55.16 432 64 432H384C392.8 432 400 424.8 400 416V96C400 87.16 392.8 80 384 80z" })));
|
|
17
|
+
}
|
|
18
|
+
function Checkbox(props) {
|
|
19
|
+
return (react_2.default.createElement(react_1.Switch, { checked: props.checked, className: (0, cx_1.cx)(props.checked && classes_1.CLASSES.IS_SELECTED, props.disabled && classes_1.CLASSES.IS_DISABLED, "uxf-checkbox", props.className), disabled: props.disabled, onChange: props.onChange, style: props.style },
|
|
20
|
+
react_2.default.createElement("span", { className: "sr-only" }, props.label),
|
|
21
|
+
props.checked ? react_2.default.createElement(CheckIcon, null) : react_2.default.createElement(SquareIcon, null)));
|
|
22
|
+
}
|
|
23
|
+
exports.default = Checkbox;
|
|
@@ -0,0 +1,40 @@
|
|
|
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/Checkbox",
|
|
31
|
+
component: index_1.Checkbox,
|
|
32
|
+
};
|
|
33
|
+
function Default() {
|
|
34
|
+
const [checked, setChecked] = (0, react_1.useState)(true);
|
|
35
|
+
return (react_1.default.createElement("div", { className: "space-y-2" },
|
|
36
|
+
react_1.default.createElement(index_1.Checkbox, { label: "Opravdu?", onChange: () => {
|
|
37
|
+
setChecked(!checked);
|
|
38
|
+
}, checked: checked })));
|
|
39
|
+
}
|
|
40
|
+
exports.Default = Default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Checkbox } from "./checkbox";
|
|
@@ -0,0 +1,8 @@
|
|
|
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.Checkbox = void 0;
|
|
7
|
+
var checkbox_1 = require("./checkbox");
|
|
8
|
+
Object.defineProperty(exports, "Checkbox", { enumerable: true, get: function () { return __importDefault(checkbox_1).default; } });
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
function CheckboxInput() {
|
|
8
|
+
return react_1.default.createElement("div", { className: "uxf-checkbox-input" }, "xx");
|
|
9
|
+
}
|
|
10
|
+
exports.default = CheckboxInput;
|
|
@@ -0,0 +1,17 @@
|
|
|
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 index_1 = require("./index");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
exports.default = {
|
|
10
|
+
title: "UI/CheckboxInput",
|
|
11
|
+
component: index_1.CheckboxInput,
|
|
12
|
+
};
|
|
13
|
+
function Default() {
|
|
14
|
+
return (react_1.default.createElement("div", { className: "space-y-2" },
|
|
15
|
+
react_1.default.createElement(index_1.CheckboxInput, null)));
|
|
16
|
+
}
|
|
17
|
+
exports.Default = Default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CheckboxInput } from "./checkbox-input";
|
|
@@ -0,0 +1,8 @@
|
|
|
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.CheckboxInput = void 0;
|
|
7
|
+
var checkbox_input_1 = require("./checkbox-input");
|
|
8
|
+
Object.defineProperty(exports, "CheckboxInput", { enumerable: true, get: function () { return __importDefault(checkbox_input_1).default; } });
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import { FormControlProps } from "../types";
|
|
3
|
+
export declare type ComboboxValue = number | string;
|
|
4
|
+
export declare type ComboboxOption<T = ComboboxValue> = {
|
|
5
|
+
id: T;
|
|
6
|
+
label: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export interface ComboboxProps<Value = ComboboxValue, Option = ComboboxOption<Value>> extends FormControlProps<Value | null> {
|
|
10
|
+
id: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
helperText?: ReactNode;
|
|
13
|
+
label: string;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
options: Option[];
|
|
16
|
+
error?: string;
|
|
17
|
+
keyExtractor?: (option: Option) => string | number;
|
|
18
|
+
renderOption?: (option: Option) => ReactNode;
|
|
19
|
+
}
|
|
20
|
+
declare const _default: React.ForwardRefExoticComponent<ComboboxProps<ComboboxValue, ComboboxOption<ComboboxValue>> & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
const react_1 = require("@headlessui/react");
|
|
27
|
+
const use_dropdown_1 = require("../hooks/use-dropdown");
|
|
28
|
+
const classes_1 = require("@uxf/core/constants/classes");
|
|
29
|
+
const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
30
|
+
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
31
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
32
|
+
const react_2 = __importStar(require("react"));
|
|
33
|
+
const label_1 = require("../label");
|
|
34
|
+
const forwardRef_1 = require("@uxf/ui/utils/forwardRef");
|
|
35
|
+
const icon_1 = require("../icon");
|
|
36
|
+
const slugify_1 = require("@uxf/core/utils/slugify");
|
|
37
|
+
function Combobox(props, ref) {
|
|
38
|
+
const [query, setQuery] = (0, react_2.useState)("");
|
|
39
|
+
const selectedOption = props.options.find((option) => option.id === props.value);
|
|
40
|
+
const filteredData = query === "" ? props.options : props.options.filter((item) => (0, slugify_1.slugify)(item.label).includes((0, slugify_1.slugify)(query)));
|
|
41
|
+
const innerRef = (0, react_2.useRef)(null);
|
|
42
|
+
const input = (0, useInputFocus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
43
|
+
const dropdown = (0, use_dropdown_1.useDropdown)("bottom", true);
|
|
44
|
+
const stableRef = (0, react_2.useMemo)(() => (0, composeRefs_1.composeRefs)(innerRef, ref, dropdown.reference), [ref, dropdown.reference]);
|
|
45
|
+
const errorId = props.isInvalid ? `${props.id}--error-message` : undefined;
|
|
46
|
+
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 && "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,
|
|
47
|
+
react_2.default.createElement(react_1.Combobox.Label, { as: label_1.Label, onClick: props.isDisabled || props.isReadOnly ? undefined : input.focus }, props.label),
|
|
48
|
+
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), onBlur: input.onBlur, onFocus: input.onFocus, tabIndex: props.isDisabled || props.isReadOnly ? undefined : 0, ref: stableRef, "aria-invalid": props.isInvalid, "aria-describedby": errorId },
|
|
49
|
+
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" }),
|
|
50
|
+
renderProps.open ? (react_2.default.createElement(icon_1.Icon, { Component: icon_1.ChevronUpIcon, size: 12 })) : (react_2.default.createElement(icon_1.Icon, { Component: icon_1.ChevronDownIcon, size: 12 }))),
|
|
51
|
+
props.helperText && (react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-helper-text", props.isInvalid && classes_1.CLASSES.IS_INVALID) }, props.helperText)),
|
|
52
|
+
react_2.default.createElement(react_1.Combobox.Options, { className: "uxf-dropdown", ref: dropdown.floating, style: dropdown.style }, filteredData.map((option) => {
|
|
53
|
+
var _a, _b, _c, _d;
|
|
54
|
+
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));
|
|
55
|
+
}))))));
|
|
56
|
+
}
|
|
57
|
+
exports.default = (0, forwardRef_1.forwardRef)("Combobox", Combobox);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComboboxValue } from "./combobox";
|
|
2
|
+
import React from "react";
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: React.ForwardRefExoticComponent<import("./combobox").ComboboxProps<ComboboxValue, import("./combobox").ComboboxOption<ComboboxValue>> & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
|
8
|
+
export declare function Default(): JSX.Element;
|
|
9
|
+
export declare function ComponentStructure(): JSX.Element;
|