@uxf/ui 1.0.0-beta.41 → 1.0.0-beta.43
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.js +3 -3
- package/button/button.d.ts +2 -2
- package/button/button.js +6 -6
- package/checkbox/checkbox.js +5 -5
- package/combobox/combobox.d.ts +4 -5
- package/combobox/combobox.js +11 -8
- package/combobox/combobox.stories.js +1 -1
- package/dropdown/dropdown.js +6 -6
- package/form-control/form-control.d.ts +7 -8
- package/form-control/form-control.js +7 -7
- package/form-control/form-control.stories.d.ts +2 -3
- package/hooks/use-input-submit.d.ts +1 -1
- package/hooks/use-input-submit.js +2 -6
- package/icon/camera-icon.js +1 -1
- package/icon/chevron-down-icon.js +1 -1
- package/icon/chevron-up-icon.js +1 -1
- package/icon/icon.d.ts +2 -1
- package/icon/icon.js +12 -12
- package/icon/pin-icon.js +1 -1
- package/image-gallery/components/icon-chevron-left.js +1 -1
- package/image-gallery/components/icon-chevron-right.js +1 -1
- package/image-gallery/components/icon-close.js +1 -1
- package/input/input-element.d.ts +4 -3
- package/input/input-element.js +3 -3
- package/label/label.d.ts +2 -2
- package/label/label.js +5 -4
- package/package.json +4 -6
- package/radio/radio.js +2 -2
- package/radio-group/radio-group.js +11 -11
- package/select/select.d.ts +4 -4
- package/select/select.js +6 -6
- package/text-input/text-input.d.ts +6 -6
- package/text-input/text-input.js +6 -6
- package/text-input/text-input.stories.d.ts +2 -3
- package/textarea/textarea.d.ts +6 -14
- package/textarea/textarea.js +28 -22
- package/textarea/textarea.stories.js +2 -2
- package/utils/{forwardRef.d.ts → forward-ref.d.ts} +0 -0
- package/utils/{forwardRef.js → forward-ref.js} +0 -0
- package/utils/sr-only-mixin.d.ts +2 -0
- package/utils/sr-only-mixin.js +14 -0
- package/hooks/use-fix-android-on-focus.d.ts +0 -2
- package/hooks/use-fix-android-on-focus.js +0 -31
|
@@ -28,10 +28,10 @@ const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
|
28
28
|
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
29
29
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
30
30
|
const react_1 = __importStar(require("react"));
|
|
31
|
-
const forwardRef_1 = require("../utils/forwardRef");
|
|
32
31
|
const error_message_1 = require("../error-message");
|
|
33
|
-
const raster_image_1 = require("../raster-image");
|
|
34
32
|
const icon_1 = require("../icon");
|
|
33
|
+
const raster_image_1 = require("../raster-image");
|
|
34
|
+
const forward_ref_1 = require("../utils/forward-ref");
|
|
35
35
|
function AvatarFileInput(props, ref) {
|
|
36
36
|
const innerRef = (0, react_1.useRef)(null);
|
|
37
37
|
const input = (0, useInputFocus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
@@ -66,4 +66,4 @@ function AvatarFileInput(props, ref) {
|
|
|
66
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
67
|
props.invalid && props.error && react_1.default.createElement(error_message_1.ErrorMessage, { id: errorId }, props.error)));
|
|
68
68
|
}
|
|
69
|
-
exports.default = (0,
|
|
69
|
+
exports.default = (0, forward_ref_1.forwardRef)("AvatarFileInput", AvatarFileInput);
|
package/button/button.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { AnchorHTMLAttributes } from "react";
|
|
2
|
-
import { ButtonColors, ButtonSizes, ButtonVariants } from "@uxf/ui/button/theme";
|
|
3
1
|
import { UseAnchorProps } from "@uxf/core/hooks/useAnchorProps";
|
|
2
|
+
import { ButtonColors, ButtonSizes, ButtonVariants } from "@uxf/ui/button/theme";
|
|
3
|
+
import React, { AnchorHTMLAttributes } from "react";
|
|
4
4
|
export declare type ButtonVariant = keyof ButtonVariants;
|
|
5
5
|
export declare type ButtonSize = keyof ButtonSizes;
|
|
6
6
|
export declare type ButtonColor = keyof ButtonColors;
|
package/button/button.js
CHANGED
|
@@ -3,14 +3,14 @@ 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
|
-
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
6
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
7
|
+
const useAnchorProps_1 = require("@uxf/core/hooks/useAnchorProps");
|
|
8
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
9
|
+
const react_1 = __importDefault(require("react"));
|
|
10
|
+
const forward_ref_1 = require("../utils/forward-ref");
|
|
11
11
|
function Button(props, ref) {
|
|
12
12
|
var _a, _b, _c;
|
|
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 &&
|
|
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 && classes_1.CLASSES.IS_LOADING, props.isFullWidth && "uxf-button--full-width");
|
|
14
14
|
const anchorProps = (0, useAnchorProps_1.useAnchorProps)({
|
|
15
15
|
...props,
|
|
16
16
|
className,
|
|
@@ -19,4 +19,4 @@ function Button(props, ref) {
|
|
|
19
19
|
typeof props.children === "string" ? (react_1.default.createElement("span", { className: "uxf-button__text" }, props.children)) : (props.children),
|
|
20
20
|
react_1.default.createElement("div", { className: "loader" })));
|
|
21
21
|
}
|
|
22
|
-
exports.default = (0,
|
|
22
|
+
exports.default = (0, forward_ref_1.forwardRef)("Button", Button);
|
package/checkbox/checkbox.js
CHANGED
|
@@ -8,16 +8,16 @@ const react_2 = __importDefault(require("react"));
|
|
|
8
8
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
9
9
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
10
10
|
function CheckIcon() {
|
|
11
|
-
return (react_2.default.createElement("svg", {
|
|
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" })));
|
|
11
|
+
return (react_2.default.createElement("svg", { viewBox: "0 0 448 512", style: { height: 24 } },
|
|
12
|
+
react_2.default.createElement("path", { fill: "currentColor", 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
13
|
}
|
|
14
14
|
function SquareIcon() {
|
|
15
|
-
return (react_2.default.createElement("svg", {
|
|
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" })));
|
|
15
|
+
return (react_2.default.createElement("svg", { viewBox: "0 0 448 512", style: { height: 24 } },
|
|
16
|
+
react_2.default.createElement("path", { fill: "currentColor", 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
17
|
}
|
|
18
18
|
function Checkbox(props) {
|
|
19
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: "
|
|
20
|
+
react_2.default.createElement("span", { className: "uxf-checkbox__label" }, props.label),
|
|
21
21
|
props.checked ? react_2.default.createElement(CheckIcon, null) : react_2.default.createElement(SquareIcon, null)));
|
|
22
22
|
}
|
|
23
23
|
exports.default = Checkbox;
|
package/combobox/combobox.d.ts
CHANGED
|
@@ -2,19 +2,18 @@ import React, { ReactNode } from "react";
|
|
|
2
2
|
import { FormControlProps } from "../types";
|
|
3
3
|
export declare type ComboboxValue = number | string;
|
|
4
4
|
export declare type ComboboxOption<T = ComboboxValue> = {
|
|
5
|
+
disabled?: boolean;
|
|
5
6
|
id: T;
|
|
6
7
|
label: string;
|
|
7
|
-
disabled?: boolean;
|
|
8
8
|
};
|
|
9
9
|
export interface ComboboxProps<Value = ComboboxValue, Option = ComboboxOption<Value>> extends FormControlProps<Value | null> {
|
|
10
|
-
id: string;
|
|
11
10
|
className?: string;
|
|
12
11
|
helperText?: ReactNode;
|
|
12
|
+
id?: string;
|
|
13
|
+
keyExtractor?: (option: Option) => string | number;
|
|
13
14
|
label: string;
|
|
14
|
-
placeholder?: string;
|
|
15
15
|
options: Option[];
|
|
16
|
-
|
|
17
|
-
keyExtractor?: (option: Option) => string | number;
|
|
16
|
+
placeholder?: string;
|
|
18
17
|
renderOption?: (option: Option) => ReactNode;
|
|
19
18
|
}
|
|
20
19
|
declare const _default: React.ForwardRefExoticComponent<ComboboxProps<ComboboxValue, ComboboxOption<ComboboxValue>> & React.RefAttributes<HTMLDivElement>>;
|
package/combobox/combobox.js
CHANGED
|
@@ -24,34 +24,37 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
const react_1 = require("@headlessui/react");
|
|
27
|
-
const use_dropdown_1 = require("../hooks/use-dropdown");
|
|
28
27
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
29
28
|
const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
30
29
|
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
31
30
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
31
|
+
const slugify_1 = require("@uxf/core/utils/slugify");
|
|
32
32
|
const react_2 = __importStar(require("react"));
|
|
33
|
-
const
|
|
34
|
-
const forwardRef_1 = require("@uxf/ui/utils/forwardRef");
|
|
33
|
+
const use_dropdown_1 = require("../hooks/use-dropdown");
|
|
35
34
|
const icon_1 = require("../icon");
|
|
36
|
-
const
|
|
35
|
+
const label_1 = require("../label");
|
|
36
|
+
const forward_ref_1 = require("../utils/forward-ref");
|
|
37
37
|
function Combobox(props, ref) {
|
|
38
|
+
var _a;
|
|
39
|
+
const generatedId = (0, react_2.useId)();
|
|
40
|
+
const id = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
|
|
38
41
|
const [query, setQuery] = (0, react_2.useState)("");
|
|
39
42
|
const selectedOption = props.options.find((option) => option.id === props.value);
|
|
40
43
|
const filteredData = query === "" ? props.options : props.options.filter((item) => (0, slugify_1.slugify)(item.label).includes((0, slugify_1.slugify)(query)));
|
|
41
44
|
const innerRef = (0, react_2.useRef)(null);
|
|
45
|
+
const errorId = props.isInvalid ? `${id}--error-message` : undefined;
|
|
42
46
|
const input = (0, useInputFocus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
43
47
|
const dropdown = (0, use_dropdown_1.useDropdown)("bottom", true);
|
|
44
48
|
const stableRef = (0, react_2.useMemo)(() => (0, composeRefs_1.composeRefs)(innerRef, ref, dropdown.reference), [ref, dropdown.reference]);
|
|
45
|
-
|
|
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,
|
|
49
|
+
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,
|
|
47
50
|
react_2.default.createElement(react_1.Combobox.Label, { as: label_1.Label, onClick: props.isDisabled || props.isReadOnly ? undefined : input.focus }, props.label),
|
|
48
51
|
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
52
|
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
53
|
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)),
|
|
54
|
+
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)),
|
|
52
55
|
react_2.default.createElement(react_1.Combobox.Options, { className: "uxf-dropdown", ref: dropdown.floating, style: dropdown.style }, filteredData.map((option) => {
|
|
53
56
|
var _a, _b, _c, _d;
|
|
54
57
|
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
58
|
}))))));
|
|
56
59
|
}
|
|
57
|
-
exports.default = (0,
|
|
60
|
+
exports.default = (0, forward_ref_1.forwardRef)("Combobox", Combobox);
|
|
@@ -49,7 +49,7 @@ function Default() {
|
|
|
49
49
|
return (react_1.default.createElement("div", { className: "space-y-8" },
|
|
50
50
|
react_1.default.createElement(index_1.Combobox, { id: "combobox-1", name: "combobox", label: "Combobox", options: options, onChange: handleChange, value: value }),
|
|
51
51
|
react_1.default.createElement(index_1.Combobox, { id: "combobox-1", name: "combobox", label: "Combobox with helper text", options: options, onChange: handleChange, value: value, helperText: "Start typing to see options..." }),
|
|
52
|
-
react_1.default.createElement(index_1.Combobox, { id: "combobox-1", name: "combobox", label: "Combobox invalid", options: options, onChange: handleChange, value: value, helperText: "
|
|
52
|
+
react_1.default.createElement(index_1.Combobox, { id: "combobox-1", name: "combobox", label: "Combobox invalid", options: options, onChange: handleChange, value: value, helperText: "Error message", isInvalid: true, isRequired: true })));
|
|
53
53
|
}
|
|
54
54
|
exports.Default = Default;
|
|
55
55
|
function ComponentStructure() {
|
package/dropdown/dropdown.js
CHANGED
|
@@ -5,23 +5,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Dropdown = void 0;
|
|
7
7
|
const useAnchorProps_1 = require("@uxf/core/hooks/useAnchorProps");
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const forwardRef_1 = require("@uxf/ui/utils/forwardRef");
|
|
10
8
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
9
|
+
const react_1 = __importDefault(require("react"));
|
|
10
|
+
const forward_ref_1 = require("../utils/forward-ref");
|
|
11
11
|
function Item(props, ref) {
|
|
12
12
|
// eslint-disable-next-line react/destructuring-assignment
|
|
13
13
|
const { children, className, ...restProps } = props;
|
|
14
14
|
const anchorProps = (0, useAnchorProps_1.useAnchorProps)({
|
|
15
|
-
className: `uxf-
|
|
15
|
+
className: `uxf-dropdown__item ${className || ""}`,
|
|
16
16
|
role: "menuitem",
|
|
17
17
|
...restProps,
|
|
18
18
|
});
|
|
19
19
|
return (react_1.default.createElement("a", { ref: ref, ...anchorProps }, children));
|
|
20
20
|
}
|
|
21
21
|
function Items(props, ref) {
|
|
22
|
-
return (react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-
|
|
22
|
+
return (react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-dropdown__items", props.className), ref: ref, role: props.role }, props.children));
|
|
23
23
|
}
|
|
24
24
|
exports.Dropdown = {
|
|
25
|
-
Item: (0,
|
|
26
|
-
Items: (0,
|
|
25
|
+
Item: (0, forward_ref_1.forwardRef)("Item.", Item),
|
|
26
|
+
Items: (0, forward_ref_1.forwardRef)("Items", Items),
|
|
27
27
|
};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from "react";
|
|
2
|
-
interface FormControlProps {
|
|
1
|
+
import React, { ReactElement, ReactNode } from "react";
|
|
2
|
+
export interface FormControlProps {
|
|
3
|
+
children?: ReactElement;
|
|
4
|
+
className?: string;
|
|
5
|
+
errorId?: string;
|
|
3
6
|
form?: string;
|
|
7
|
+
helperText?: ReactNode;
|
|
4
8
|
inputId: string;
|
|
5
|
-
errorId?: string;
|
|
6
9
|
isRequired?: boolean;
|
|
7
|
-
className?: string;
|
|
8
10
|
label?: ReactNode;
|
|
9
|
-
helperText?: ReactNode;
|
|
10
|
-
children?: ReactElement;
|
|
11
11
|
}
|
|
12
|
-
export declare
|
|
13
|
-
export {};
|
|
12
|
+
export declare const FormControl: React.ForwardRefExoticComponent<FormControlProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -4,16 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.FormControl = void 0;
|
|
7
|
+
const classes_1 = require("@uxf/core/constants/classes");
|
|
8
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
7
9
|
const react_1 = __importDefault(require("react"));
|
|
8
10
|
const label_1 = require("../label");
|
|
9
|
-
const
|
|
10
|
-
const classes_1 = require("@uxf/core/constants/classes");
|
|
11
|
+
const forward_ref_1 = require("../utils/forward-ref");
|
|
11
12
|
// TODO - tohle asi ještě nějak předělám (ten interface je trochu nelogickej)
|
|
12
|
-
|
|
13
|
+
exports.FormControl = (0, forward_ref_1.forwardRef)("FormControl", (props, ref) => {
|
|
13
14
|
const helperTextClassName = (0, cx_1.cx)("uxf-helper-text", props.errorId && classes_1.CLASSES.IS_INVALID);
|
|
14
|
-
return (react_1.default.createElement("div", { className: props.className },
|
|
15
|
+
return (react_1.default.createElement("div", { className: props.className, ref: ref },
|
|
15
16
|
react_1.default.createElement(label_1.Label, { isRequired: props.isRequired, htmlFor: props.inputId, form: props.form }, props.label),
|
|
16
17
|
props.children,
|
|
17
|
-
react_1.default.createElement("div", { className: helperTextClassName }, props.helperText)));
|
|
18
|
-
}
|
|
19
|
-
exports.FormControl = FormControl;
|
|
18
|
+
props.helperText && (react_1.default.createElement("div", { className: helperTextClassName, id: props.errorId }, props.helperText))));
|
|
19
|
+
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import { FormControl } from "./form-control";
|
|
1
|
+
import React from "react";
|
|
3
2
|
declare const _default: {
|
|
4
3
|
title: string;
|
|
5
|
-
component:
|
|
4
|
+
component: React.ForwardRefExoticComponent<import("./form-control").FormControlProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
5
|
parameters: {
|
|
7
6
|
actions: {
|
|
8
7
|
argTypesRegex: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { RefObject } from "react";
|
|
2
|
-
declare type SubmitResolverType = "checkbox" | "radio-group"
|
|
2
|
+
declare type SubmitResolverType = "checkbox" | "radio-group";
|
|
3
3
|
export declare function useInputSubmit<T extends HTMLElement>(ref: RefObject<T>, type: SubmitResolverType, disabled: boolean | undefined): void;
|
|
4
4
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useInputSubmit = void 0;
|
|
4
|
-
const use_latest_1 = require("./use-latest");
|
|
5
4
|
const react_1 = require("react");
|
|
6
5
|
function childrenHasFocus(node) {
|
|
7
6
|
node.childNodes.forEach((child) => {
|
|
@@ -17,12 +16,9 @@ function submitResolver(type, node) {
|
|
|
17
16
|
return document.activeElement === node.firstChild;
|
|
18
17
|
case "radio-group":
|
|
19
18
|
return childrenHasFocus(node);
|
|
20
|
-
case "text-input":
|
|
21
|
-
return document.activeElement === node;
|
|
22
19
|
}
|
|
23
20
|
}
|
|
24
21
|
function useInputSubmit(ref, type, disabled) {
|
|
25
|
-
const latestType = (0, use_latest_1.useLatest)(type);
|
|
26
22
|
(0, react_1.useEffect)(() => {
|
|
27
23
|
const node = ref.current;
|
|
28
24
|
if (!node || disabled) {
|
|
@@ -30,7 +26,7 @@ function useInputSubmit(ref, type, disabled) {
|
|
|
30
26
|
}
|
|
31
27
|
const handleSubmit = (e) => {
|
|
32
28
|
var _a;
|
|
33
|
-
if (e instanceof KeyboardEvent && e.key === "Enter" && submitResolver(
|
|
29
|
+
if (e instanceof KeyboardEvent && e.key === "Enter" && submitResolver(type, node)) {
|
|
34
30
|
const closestForm = (_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.closest("form");
|
|
35
31
|
if (closestForm) {
|
|
36
32
|
closestForm.dispatchEvent(new Event("submit", { bubbles: true, cancelable: true }));
|
|
@@ -39,6 +35,6 @@ function useInputSubmit(ref, type, disabled) {
|
|
|
39
35
|
};
|
|
40
36
|
node.addEventListener("keydown", handleSubmit);
|
|
41
37
|
return () => node.removeEventListener("keydown", handleSubmit);
|
|
42
|
-
}, [disabled,
|
|
38
|
+
}, [disabled, ref, type]);
|
|
43
39
|
}
|
|
44
40
|
exports.useInputSubmit = useInputSubmit;
|
package/icon/camera-icon.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
function CameraIcon(props) {
|
|
8
|
-
return (react_1.default.createElement("svg", {
|
|
8
|
+
return (react_1.default.createElement("svg", { viewBox: "0 0 512 512", ...props },
|
|
9
9
|
react_1.default.createElement("path", { fill: "currentColor", d: "M144 288C144 226.1 194.1 176 256 176C317.9 176 368 226.1 368 288C368 349.9 317.9 400 256 400C194.1 400 144 349.9 144 288zM256 224C220.7 224 192 252.7 192 288C192 323.3 220.7 352 256 352C291.3 352 320 323.3 320 288C320 252.7 291.3 224 256 224zM362.9 64.82L373.3 96H448C483.3 96 512 124.7 512 160V416C512 451.3 483.3 480 448 480H64C28.65 480 0 451.3 0 416V160C0 124.7 28.65 96 64 96H138.7L149.1 64.82C155.6 45.22 173.9 32 194.6 32H317.4C338.1 32 356.4 45.22 362.9 64.82H362.9zM64 144C55.16 144 48 151.2 48 160V416C48 424.8 55.16 432 64 432H448C456.8 432 464 424.8 464 416V160C464 151.2 456.8 144 448 144H338.7L317.4 80H194.6L173.3 144H64z" })));
|
|
10
10
|
}
|
|
11
11
|
exports.default = CameraIcon;
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
function ChevronDownIcon(props) {
|
|
8
|
-
return (react_1.default.createElement("svg", {
|
|
8
|
+
return (react_1.default.createElement("svg", { viewBox: "0 0 512 512", ...props },
|
|
9
9
|
react_1.default.createElement("path", { fill: "currentColor", d: "M256 429.3l22.6-22.6 192-192L493.3 192 448 146.7l-22.6 22.6L256 338.7 86.6 169.4 64 146.7 18.7 192l22.6 22.6 192 192L256 429.3z" })));
|
|
10
10
|
}
|
|
11
11
|
exports.default = ChevronDownIcon;
|
package/icon/chevron-up-icon.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
function ChevronUpIcon(props) {
|
|
8
|
-
return (react_1.default.createElement("svg", {
|
|
8
|
+
return (react_1.default.createElement("svg", { viewBox: "0 0 512 512", ...props },
|
|
9
9
|
react_1.default.createElement("path", { fill: "currentColor", d: "M256 82.7l22.6 22.6 192 192L493.3 320 448 365.3l-22.6-22.6L256 173.3 86.6 342.6 64 365.3 18.7 320l22.6-22.6 192-192L256 82.7z" })));
|
|
10
10
|
}
|
|
11
11
|
exports.default = ChevronUpIcon;
|
package/icon/icon.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { IconsSet } from "@uxf/ui/icon/theme";
|
|
2
|
+
import React, { CSSProperties } from "react";
|
|
3
3
|
export declare type IconName = keyof IconsSet;
|
|
4
4
|
declare type NameOrComponentType = {
|
|
5
5
|
name: IconName;
|
|
@@ -12,6 +12,7 @@ export declare type IconProps = {
|
|
|
12
12
|
className?: string;
|
|
13
13
|
mode?: "meet" | "slice";
|
|
14
14
|
size?: number;
|
|
15
|
+
style?: Partial<CSSProperties>;
|
|
15
16
|
} & NameOrComponentType;
|
|
16
17
|
declare const _default: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
|
|
17
18
|
export default _default;
|
package/icon/icon.js
CHANGED
|
@@ -4,22 +4,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const rem_1 = require("../utils/rem");
|
|
8
|
-
const forwardRef_1 = require("../utils/forwardRef");
|
|
9
7
|
const cx_1 = require("../utils/cx");
|
|
8
|
+
const forward_ref_1 = require("../utils/forward-ref");
|
|
9
|
+
const rem_1 = require("../utils/rem");
|
|
10
10
|
function Icon(props, ref) {
|
|
11
|
-
var _a;
|
|
11
|
+
var _a, _b;
|
|
12
12
|
const CustomComponent = props.Component;
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"--i-h": (0, rem_1.rem)(props.size),
|
|
18
|
-
"--i-w": (0, rem_1.rem)(props.size),
|
|
19
|
-
} })) : (react_1.default.createElement("svg", { className: _className, preserveAspectRatio: _preserveAspectRatio, ref: ref, role: "img", style: {
|
|
13
|
+
const className = (0, cx_1.cx)("uxf-icon", props.className);
|
|
14
|
+
const preserveAspectRatio = `xMidYMid ${(_a = props.mode) !== null && _a !== void 0 ? _a : "meet"}`;
|
|
15
|
+
const style = props.size
|
|
16
|
+
? {
|
|
20
17
|
"--i-h": (0, rem_1.rem)(props.size),
|
|
21
18
|
"--i-w": (0, rem_1.rem)(props.size),
|
|
22
|
-
|
|
19
|
+
...((_b = props.style) !== null && _b !== void 0 ? _b : {}),
|
|
20
|
+
}
|
|
21
|
+
: props.style;
|
|
22
|
+
return CustomComponent ? (react_1.default.createElement(CustomComponent, { className: className, preserveAspectRatio: preserveAspectRatio, ref: ref, role: "img", style: style })) : (react_1.default.createElement("svg", { className: className, preserveAspectRatio: preserveAspectRatio, ref: ref, role: "img", style: style },
|
|
23
23
|
react_1.default.createElement("use", { xlinkHref: `/icons-generated/_icon-sprite.svg#icon-sprite--${props.name}` })));
|
|
24
24
|
}
|
|
25
|
-
exports.default = (0,
|
|
25
|
+
exports.default = (0, forward_ref_1.forwardRef)("Icon", Icon);
|
package/icon/pin-icon.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
function PinIcon(props) {
|
|
8
|
-
return (react_1.default.createElement("svg", {
|
|
8
|
+
return (react_1.default.createElement("svg", { viewBox: "0 0 29.65 40", ...props },
|
|
9
9
|
react_1.default.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M0 14.83C0 6.61 6.61 0 14.83 0c8.11 0 14.83 6.61 14.83 14.83 0 8.64-8.85 19.41-14.83 25.17C8.75 34.24 0 23.47 0 14.83zm9.28 0c0-3.09 2.45-5.55 5.55-5.55 2.99 0 5.44 2.45 5.44 5.55 0 2.99-2.45 5.44-5.44 5.44-3.1 0-5.55-2.46-5.55-5.44z", clipRule: "evenodd" })));
|
|
10
10
|
}
|
|
11
11
|
exports.default = PinIcon;
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
function IconChevronLeft() {
|
|
8
|
-
return (react_1.default.createElement("svg", {
|
|
8
|
+
return (react_1.default.createElement("svg", { className: "h-10 w-10 text-white", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2 },
|
|
9
9
|
react_1.default.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 19l-7-7 7-7" })));
|
|
10
10
|
}
|
|
11
11
|
exports.default = IconChevronLeft;
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
function IconChevronRight() {
|
|
8
|
-
return (react_1.default.createElement("svg", {
|
|
8
|
+
return (react_1.default.createElement("svg", { className: "h-10 w-10 text-white", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2 },
|
|
9
9
|
react_1.default.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5l7 7-7 7" })));
|
|
10
10
|
}
|
|
11
11
|
exports.default = IconChevronRight;
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
function IconClose() {
|
|
8
|
-
return (react_1.default.createElement("svg", {
|
|
8
|
+
return (react_1.default.createElement("svg", { fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, className: "h-10 w-10 text-white" },
|
|
9
9
|
react_1.default.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })));
|
|
10
10
|
}
|
|
11
11
|
exports.default = IconClose;
|
package/input/input-element.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { FormControlProps } from "@uxf/ui/types/form-control-props";
|
|
2
|
+
import React from "react";
|
|
3
3
|
export interface InputElementProps extends FormControlProps<string> {
|
|
4
|
-
id?: string;
|
|
5
|
-
placeholder?: string;
|
|
6
4
|
"aria-describedby"?: string;
|
|
7
5
|
"aria-invalid"?: boolean;
|
|
6
|
+
form?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
placeholder?: string;
|
|
8
9
|
type?: "email" | "number" | "password" | "tel" | "text" | "url";
|
|
9
10
|
}
|
|
10
11
|
declare const _default: React.ForwardRefExoticComponent<InputElementProps & React.RefAttributes<HTMLInputElement>>;
|
package/input/input-element.js
CHANGED
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const
|
|
7
|
+
const forward_ref_1 = require("../utils/forward-ref");
|
|
8
8
|
function InputElement(props, ref) {
|
|
9
|
-
return (react_1.default.createElement("input", {
|
|
9
|
+
return (react_1.default.createElement("input", { "aria-describedby": props["aria-describedby"], "aria-invalid": props.isInvalid, className: "uxf-input__element", disabled: props.isDisabled, form: props.form, id: props.id, onBlur: props.onBlur, onChange: (event) => { var _a; return (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, event.target.value, event); }, onFocus: props.onFocus, placeholder: props.placeholder, readOnly: props.isReadOnly, ref: ref, type: props.type, value: props.value }));
|
|
10
10
|
}
|
|
11
|
-
exports.default = (0,
|
|
11
|
+
exports.default = (0, forward_ref_1.forwardRef)("InputElement", InputElement);
|
package/label/label.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import React, { MouseEventHandler, ReactNode } from "react";
|
|
|
2
2
|
export interface LabelProps {
|
|
3
3
|
children?: ReactNode;
|
|
4
4
|
className?: string;
|
|
5
|
-
htmlFor?: string;
|
|
6
5
|
form?: string;
|
|
7
|
-
|
|
6
|
+
htmlFor?: string;
|
|
8
7
|
isRequired?: boolean;
|
|
8
|
+
onClick?: MouseEventHandler<HTMLLabelElement>;
|
|
9
9
|
}
|
|
10
10
|
declare const _default: React.ForwardRefExoticComponent<LabelProps & React.RefAttributes<HTMLLabelElement>>;
|
|
11
11
|
export default _default;
|
package/label/label.js
CHANGED
|
@@ -3,11 +3,12 @@ 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
|
-
const
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
6
|
+
const classes_1 = require("@uxf/core/constants/classes");
|
|
8
7
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const forward_ref_1 = require("../utils/forward-ref");
|
|
9
10
|
function Label(props, ref) {
|
|
10
|
-
const className = (0, cx_1.cx)("uxf-label", props.isRequired &&
|
|
11
|
+
const className = (0, cx_1.cx)("uxf-label", props.isRequired && classes_1.CLASSES.IS_REQUIRED, props.className);
|
|
11
12
|
return (react_1.default.createElement("label", { className: className, ref: ref, htmlFor: props.htmlFor, form: props.form, onClick: props.onClick }, props.children));
|
|
12
13
|
}
|
|
13
|
-
exports.default = (0,
|
|
14
|
+
exports.default = (0, forward_ref_1.forwardRef)("Label", Label);
|
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.43",
|
|
4
4
|
"description": "",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -15,12 +15,10 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@floating-ui/react-dom": "^0.6.0",
|
|
17
17
|
"@headlessui/react": "^1.6.6",
|
|
18
|
-
"@uxf/core": "^
|
|
19
|
-
"jump.js": "^1.0.2"
|
|
20
|
-
"ua-parser-js": "^1.0.2"
|
|
18
|
+
"@uxf/core": "^3.0.0",
|
|
19
|
+
"jump.js": "^1.0.2"
|
|
21
20
|
},
|
|
22
21
|
"devDependencies": {
|
|
23
|
-
"@types/jump.js": "^1.0.4"
|
|
24
|
-
"@types/ua-parser-js": "^0.7.36"
|
|
22
|
+
"@types/jump.js": "^1.0.4"
|
|
25
23
|
}
|
|
26
24
|
}
|
package/radio/radio.js
CHANGED
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
7
7
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const
|
|
9
|
+
const forward_ref_1 = require("../utils/forward-ref");
|
|
10
10
|
function Radio(props, ref) {
|
|
11
11
|
return (react_1.default.createElement("div", { ref: ref, className: (0, cx_1.cx)("uxf-radio", props.value && classes_1.CLASSES.IS_SELECTED, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isReadOnly && classes_1.CLASSES.IS_READONLY), onClick: () => { var _a; return (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, !props.value); } },
|
|
12
12
|
react_1.default.createElement("div", { className: "uxf-radio__inner" })));
|
|
13
13
|
}
|
|
14
|
-
exports.default = (0,
|
|
14
|
+
exports.default = (0, forward_ref_1.forwardRef)("Radio", Radio);
|
|
@@ -23,23 +23,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const react_1 =
|
|
27
|
-
const forwardRef_1 = require("../utils/forwardRef");
|
|
28
|
-
const react_2 = require("@headlessui/react");
|
|
26
|
+
const react_1 = require("@headlessui/react");
|
|
29
27
|
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
30
|
-
const
|
|
31
|
-
const radio_1 = require("../radio");
|
|
28
|
+
const react_2 = __importStar(require("react"));
|
|
32
29
|
const error_message_1 = require("../error-message");
|
|
33
30
|
const use_input_submit_1 = require("../hooks/use-input-submit");
|
|
31
|
+
const label_1 = require("../label");
|
|
32
|
+
const radio_1 = require("../radio");
|
|
33
|
+
const forward_ref_1 = require("../utils/forward-ref");
|
|
34
34
|
function RadioGroup(props, ref) {
|
|
35
35
|
// eslint-disable-next-line react/destructuring-assignment
|
|
36
36
|
const { className, disabled, error, forceColumn, hiddenLabel, id, invalid, label, onBlur, onChange, onFocus, options, style, value, } = props;
|
|
37
|
-
const innerRef = (0,
|
|
37
|
+
const innerRef = (0, react_2.useRef)(null);
|
|
38
38
|
(0, use_input_submit_1.useInputSubmit)(innerRef, "radio-group", disabled);
|
|
39
39
|
const errorId = invalid ? `${id}--errormessage` : undefined;
|
|
40
|
-
return (
|
|
41
|
-
!hiddenLabel && (
|
|
42
|
-
|
|
43
|
-
invalid && error &&
|
|
40
|
+
return (react_2.default.createElement(react_1.RadioGroup, { className: `_form-field ${className || ""}`, disabled: disabled, id: id, value: value, onChange: onChange, style: style },
|
|
41
|
+
!hiddenLabel && (react_2.default.createElement(react_1.RadioGroup.Label, { as: label_1.Label, className: "uxf-radio-group__label" }, label)),
|
|
42
|
+
react_2.default.createElement("div", { className: `flex ${forceColumn ? "flex-col" : "flex-wrap items-center"} focus-visible:ring-gray-dark outline-none focus-visible:ring-2`, onBlur: onBlur, onFocus: onFocus, ref: (0, composeRefs_1.composeRefs)(innerRef, ref), tabIndex: disabled ? -1 : 0 }, options.map((option) => (react_2.default.createElement(react_1.RadioGroup.Option, { as: react_2.Fragment, disabled: option.disabled, key: option.value.toString(), value: option.value }, (o) => react_2.default.createElement(radio_1.Radio, { value: o.checked, isDisabled: disabled || o.disabled, isInvalid: invalid }))))),
|
|
43
|
+
invalid && error && react_2.default.createElement(error_message_1.ErrorMessage, { id: errorId }, error)));
|
|
44
44
|
}
|
|
45
|
-
exports.default = (0,
|
|
45
|
+
exports.default = (0, forward_ref_1.forwardRef)("RadioGroup", RadioGroup);
|
package/select/select.d.ts
CHANGED
|
@@ -2,18 +2,18 @@ import React, { ReactNode } from "react";
|
|
|
2
2
|
import { FormControlProps } from "../types";
|
|
3
3
|
export declare type SelectValue = number | string;
|
|
4
4
|
export declare type SelectOption<T = SelectValue> = {
|
|
5
|
+
disabled?: boolean;
|
|
5
6
|
id: T;
|
|
6
7
|
label: ReactNode;
|
|
7
|
-
disabled?: boolean;
|
|
8
8
|
};
|
|
9
9
|
export interface SelectProps<Value = SelectValue, Option = SelectOption<Value>> extends FormControlProps<Value | null> {
|
|
10
|
-
id?: string;
|
|
11
10
|
className?: string;
|
|
12
11
|
helperText?: ReactNode;
|
|
12
|
+
id?: string;
|
|
13
|
+
keyExtractor?: (option: Option) => string | number;
|
|
13
14
|
label?: ReactNode;
|
|
14
|
-
placeholder?: ReactNode;
|
|
15
15
|
options: Option[];
|
|
16
|
-
|
|
16
|
+
placeholder?: string;
|
|
17
17
|
renderOption?: (option: Option) => ReactNode;
|
|
18
18
|
}
|
|
19
19
|
declare const _default: React.ForwardRefExoticComponent<SelectProps<SelectValue, SelectOption<SelectValue>> & React.RefAttributes<HTMLDivElement>>;
|
package/select/select.js
CHANGED
|
@@ -24,15 +24,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
const react_1 = require("@headlessui/react");
|
|
27
|
-
const use_dropdown_1 = require("../hooks/use-dropdown");
|
|
28
27
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
29
28
|
const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
30
29
|
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
31
30
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
32
31
|
const react_2 = __importStar(require("react"));
|
|
33
|
-
const
|
|
34
|
-
const forwardRef_1 = require("@uxf/ui/utils/forwardRef");
|
|
32
|
+
const use_dropdown_1 = require("../hooks/use-dropdown");
|
|
35
33
|
const icon_1 = require("../icon");
|
|
34
|
+
const label_1 = require("../label");
|
|
35
|
+
const forward_ref_1 = require("../utils/forward-ref");
|
|
36
36
|
function Select(props, ref) {
|
|
37
37
|
var _a;
|
|
38
38
|
const generatedId = (0, react_2.useId)();
|
|
@@ -43,15 +43,15 @@ function Select(props, ref) {
|
|
|
43
43
|
const input = (0, useInputFocus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
44
44
|
const dropdown = (0, use_dropdown_1.useDropdown)("bottom", true);
|
|
45
45
|
const stableRef = (0, react_2.useMemo)(() => (0, composeRefs_1.composeRefs)(innerRef, ref, dropdown.reference), [ref, dropdown.reference]);
|
|
46
|
-
return (react_2.default.createElement(react_1.Listbox, { as: "div", className: (0, cx_1.cx)("uxf-select", props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isRequired &&
|
|
46
|
+
return (react_2.default.createElement(react_1.Listbox, { as: "div", className: (0, cx_1.cx)("uxf-select", 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,
|
|
47
47
|
react_2.default.createElement(react_1.Listbox.Label, { as: label_1.Label, onClick: props.isDisabled || props.isReadOnly ? undefined : input.focus }, props.label),
|
|
48
48
|
react_2.default.createElement(react_1.Listbox.Button, { as: "div", className: (0, cx_1.cx)("uxf-select__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
49
|
react_2.default.createElement("div", { className: "uxf-select__button-text" }, (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) || props.placeholder),
|
|
50
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)),
|
|
51
|
+
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)),
|
|
52
52
|
react_2.default.createElement(react_1.Listbox.Options, { ref: dropdown.floating, style: dropdown.style, className: "uxf-dropdown" }, props.options.map((option) => {
|
|
53
53
|
var _a, _b, _c, _d;
|
|
54
54
|
return (react_2.default.createElement(react_1.Listbox.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
55
|
}))))));
|
|
56
56
|
}
|
|
57
|
-
exports.default = (0,
|
|
57
|
+
exports.default = (0, forward_ref_1.forwardRef)("Select", Select);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FormControlProps } from "@uxf/ui/types";
|
|
2
|
-
import { ReactNode } from "react";
|
|
2
|
+
import React, { ReactNode } from "react";
|
|
3
3
|
import { InputProps } from "@uxf/ui/input/input";
|
|
4
4
|
declare type EnterKeyHint = "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
|
|
5
5
|
declare type InputMode = "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
|
|
@@ -8,16 +8,16 @@ export interface TextInputProps extends FormControlProps<string>, Pick<InputProp
|
|
|
8
8
|
className?: string;
|
|
9
9
|
enterKeyHint?: EnterKeyHint;
|
|
10
10
|
form?: string;
|
|
11
|
+
helperText?: ReactNode;
|
|
11
12
|
id?: string;
|
|
12
13
|
inputMode?: InputMode;
|
|
13
14
|
label?: ReactNode;
|
|
14
|
-
helperText?: ReactNode;
|
|
15
|
-
placeholder?: string;
|
|
16
|
-
leftElement?: ReactNode;
|
|
17
|
-
rightElement?: ReactNode;
|
|
18
15
|
leftAddon?: ReactNode;
|
|
16
|
+
leftElement?: ReactNode;
|
|
17
|
+
placeholder?: string;
|
|
19
18
|
rightAddon?: ReactNode;
|
|
19
|
+
rightElement?: ReactNode;
|
|
20
20
|
type?: "email" | "number" | "password" | "tel" | "text" | "url";
|
|
21
21
|
}
|
|
22
|
-
export declare
|
|
22
|
+
export declare const TextInput: React.ForwardRefExoticComponent<TextInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
23
23
|
export {};
|
package/text-input/text-input.js
CHANGED
|
@@ -29,13 +29,14 @@ const react_1 = __importStar(require("react"));
|
|
|
29
29
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
30
30
|
const form_control_1 = require("../form-control");
|
|
31
31
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
32
|
-
|
|
32
|
+
const forward_ref_1 = require("../utils/forward-ref");
|
|
33
|
+
exports.TextInput = (0, forward_ref_1.forwardRef)("TextInput", (props, ref) => {
|
|
33
34
|
var _a;
|
|
34
35
|
const [isFocused, setIsFocused] = (0, react_1.useState)(false);
|
|
35
36
|
const generatedId = (0, react_1.useId)();
|
|
36
37
|
const id = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
|
|
37
38
|
const errorId = props.isInvalid ? `${id}--error-message` : undefined;
|
|
38
|
-
const rootClassName = (0, cx_1.cx)("uxf-text-input",
|
|
39
|
+
const rootClassName = (0, cx_1.cx)("uxf-text-input", isFocused && classes_1.CLASSES.IS_FOCUSED, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isRequired && classes_1.CLASSES.IS_REQUIRED);
|
|
39
40
|
const onFocus = (e) => {
|
|
40
41
|
var _a;
|
|
41
42
|
setIsFocused(true);
|
|
@@ -46,12 +47,11 @@ function TextInput(props) {
|
|
|
46
47
|
setIsFocused(false);
|
|
47
48
|
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
48
49
|
};
|
|
49
|
-
return (react_1.default.createElement(form_control_1.FormControl, {
|
|
50
|
+
return (react_1.default.createElement(form_control_1.FormControl, { className: rootClassName, errorId: errorId, form: props.form, helperText: props.helperText, inputId: id, isRequired: props.isRequired, label: props.label },
|
|
50
51
|
react_1.default.createElement(input_1.Input, { size: props.size, variant: props.variant },
|
|
51
52
|
props.leftAddon && react_1.default.createElement(input_1.Input.LeftAddon, null, props.leftAddon),
|
|
52
53
|
props.leftElement && react_1.default.createElement(input_1.Input.LeftElement, null, props.leftElement),
|
|
53
|
-
react_1.default.createElement(input_1.Input.Element, {
|
|
54
|
+
react_1.default.createElement(input_1.Input.Element, { "aria-describedby": errorId, form: props.form, id: id, isDisabled: props.isDisabled, isInvalid: props.isInvalid, isReadOnly: props.isReadOnly, isRequired: props.isRequired, name: props.name, onBlur: onBlur, onChange: props.onChange, onFocus: onFocus, placeholder: props.placeholder, ref: ref, type: props.type, value: props.value }),
|
|
54
55
|
props.rightElement && react_1.default.createElement(input_1.Input.RightElement, null, props.rightElement),
|
|
55
56
|
props.rightAddon && react_1.default.createElement(input_1.Input.RightAddon, null, props.rightAddon))));
|
|
56
|
-
}
|
|
57
|
-
exports.TextInput = TextInput;
|
|
57
|
+
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import { TextInput } from "@uxf/ui/text-input";
|
|
1
|
+
import React from "react";
|
|
3
2
|
declare const _default: {
|
|
4
3
|
title: string;
|
|
5
|
-
component:
|
|
4
|
+
component: React.ForwardRefExoticComponent<import("@uxf/ui/text-input").TextInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
6
5
|
};
|
|
7
6
|
export default _default;
|
|
8
7
|
export declare function Full(): JSX.Element;
|
package/textarea/textarea.d.ts
CHANGED
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import { FormControlProps } from "../types";
|
|
3
|
+
export interface TextareaProps extends FormControlProps<string, HTMLTextAreaElement> {
|
|
3
4
|
autoComplete?: string;
|
|
4
5
|
className?: string;
|
|
5
|
-
disabled?: boolean;
|
|
6
6
|
disableAutoHeight?: boolean;
|
|
7
|
-
error?: string;
|
|
8
7
|
form?: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
label
|
|
8
|
+
helperText?: ReactNode;
|
|
9
|
+
id?: string;
|
|
10
|
+
label?: ReactNode;
|
|
12
11
|
maxLength?: number | undefined;
|
|
13
12
|
minLength?: number | undefined;
|
|
14
13
|
name?: string;
|
|
15
|
-
onBlur?: FocusEventHandler<HTMLTextAreaElement>;
|
|
16
|
-
onChange: ChangeEventHandler<HTMLTextAreaElement>;
|
|
17
|
-
onFocus?: FocusEventHandler<HTMLTextAreaElement>;
|
|
18
14
|
placeholder?: string;
|
|
19
|
-
readOnly?: boolean;
|
|
20
|
-
required?: boolean;
|
|
21
15
|
rows?: number;
|
|
22
|
-
style?: CSSProperties;
|
|
23
|
-
value?: string | null;
|
|
24
16
|
}
|
|
25
17
|
declare const _default: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
26
18
|
export default _default;
|
package/textarea/textarea.js
CHANGED
|
@@ -23,16 +23,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const react_1 = __importStar(require("react"));
|
|
27
|
-
const forwardRef_1 = require("../utils/forwardRef");
|
|
28
|
-
const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
29
|
-
const label_1 = require("../label");
|
|
30
|
-
const cx_1 = require("@uxf/core/utils/cx");
|
|
31
|
-
const error_message_1 = require("../error-message");
|
|
32
|
-
const use_fix_android_on_focus_1 = require("../hooks/use-fix-android-on-focus");
|
|
33
|
-
const use_latest_1 = require("../hooks/use-latest");
|
|
34
26
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
35
27
|
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
28
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
30
|
+
const form_control_1 = require("../form-control");
|
|
31
|
+
const use_latest_1 = require("../hooks/use-latest");
|
|
32
|
+
const forward_ref_1 = require("../utils/forward-ref");
|
|
36
33
|
function autoHeightHandler(element, rows = 4) {
|
|
37
34
|
element.style.height = "auto";
|
|
38
35
|
if (rows > 1) {
|
|
@@ -45,16 +42,27 @@ function autoHeightHandler(element, rows = 4) {
|
|
|
45
42
|
}
|
|
46
43
|
const EVENTS = ["input", "cut", "paste", "drop"];
|
|
47
44
|
function Textarea(props, ref) {
|
|
48
|
-
|
|
49
|
-
const { autoComplete, className, disabled, disableAutoHeight, error, form, id, invalid, label, maxLength, minLength, name, onBlur, onChange, onFocus, placeholder, readOnly, required, rows, style, value, } = props;
|
|
45
|
+
var _a;
|
|
50
46
|
const innerRef = (0, react_1.useRef)(null);
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
const
|
|
47
|
+
const [isFocused, setIsFocused] = (0, react_1.useState)(false);
|
|
48
|
+
const generatedId = (0, react_1.useId)();
|
|
49
|
+
const id = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
|
|
50
|
+
const errorId = props.isInvalid ? `${id}--error-message` : undefined;
|
|
51
|
+
const rootClassName = (0, cx_1.cx)("uxf-textarea", isFocused && classes_1.CLASSES.IS_FOCUSED, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isRequired && classes_1.CLASSES.IS_REQUIRED);
|
|
52
|
+
const onFocus = (e) => {
|
|
53
|
+
var _a;
|
|
54
|
+
setIsFocused(true);
|
|
55
|
+
(_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
56
|
+
};
|
|
57
|
+
const onBlur = (e) => {
|
|
58
|
+
var _a;
|
|
59
|
+
setIsFocused(false);
|
|
60
|
+
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
61
|
+
};
|
|
62
|
+
const latestRows = (0, use_latest_1.useLatest)(props.rows);
|
|
55
63
|
(0, react_1.useEffect)(() => {
|
|
56
64
|
const node = innerRef.current;
|
|
57
|
-
if (!node || disableAutoHeight) {
|
|
65
|
+
if (!node || props.disableAutoHeight) {
|
|
58
66
|
return;
|
|
59
67
|
}
|
|
60
68
|
const handler = () => autoHeightHandler(node, latestRows.current);
|
|
@@ -65,11 +73,9 @@ function Textarea(props, ref) {
|
|
|
65
73
|
EVENTS.map((e) => node.removeEventListener(e, handler));
|
|
66
74
|
window.removeEventListener("resize", handler);
|
|
67
75
|
};
|
|
68
|
-
}, [disableAutoHeight, latestRows]);
|
|
69
|
-
return (react_1.default.createElement(
|
|
70
|
-
react_1.default.createElement(
|
|
71
|
-
|
|
72
|
-
react_1.default.createElement("textarea", { "aria-describedby": errorId, "aria-invalid": invalid, autoComplete: autoComplete, className: "uxf-textarea-textarea", disabled: disabled, form: form, id: id, maxLength: maxLength, minLength: minLength, name: name, onBlur: input.onBlur, onChange: onChange, onFocus: fixedOnFocus, placeholder: placeholder, readOnly: readOnly, ref: (0, composeRefs_1.composeRefs)(innerRef, ref), required: required, value: value !== null && value !== void 0 ? value : undefined })),
|
|
73
|
-
invalid && error && react_1.default.createElement(error_message_1.ErrorMessage, { id: errorId }, error)));
|
|
76
|
+
}, [props.disableAutoHeight, latestRows]);
|
|
77
|
+
return (react_1.default.createElement(form_control_1.FormControl, { className: rootClassName, errorId: errorId, form: props.form, helperText: props.helperText, inputId: id, isRequired: props.isRequired, label: props.label },
|
|
78
|
+
react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-textarea__wrapper", isFocused && classes_1.CLASSES.IS_FOCUSED, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isReadOnly && classes_1.CLASSES.IS_READONLY), onClick: () => { var _a; return (_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.focus(); } },
|
|
79
|
+
react_1.default.createElement("textarea", { "aria-describedby": errorId, "aria-invalid": props.isInvalid, autoComplete: props.autoComplete, className: "uxf-textarea__element", disabled: props.isDisabled, form: props.form, id: id, maxLength: props.maxLength, minLength: props.minLength, name: props.name, onBlur: onBlur, onChange: (event) => { var _a; return (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, event.target.value, event); }, onFocus: onFocus, placeholder: props.placeholder, readOnly: props.isReadOnly, ref: (0, composeRefs_1.composeRefs)(innerRef, ref), required: props.isRequired, value: props.value }))));
|
|
74
80
|
}
|
|
75
|
-
exports.default = (0,
|
|
81
|
+
exports.default = (0, forward_ref_1.forwardRef)("Textarea", Textarea);
|
|
@@ -16,11 +16,11 @@ function Default() {
|
|
|
16
16
|
// eslint-disable-next-line no-console
|
|
17
17
|
console.log("textarea onChange");
|
|
18
18
|
}, placeholder: "Placeholder text...." }),
|
|
19
|
-
react_1.default.createElement(index_1.Textarea, { id: "textarea-readonly", label: "Readonly",
|
|
19
|
+
react_1.default.createElement(index_1.Textarea, { id: "textarea-readonly", label: "Readonly", isReadOnly: true, onChange: () => {
|
|
20
20
|
// eslint-disable-next-line no-console
|
|
21
21
|
console.log("textarea OnChange");
|
|
22
22
|
} }),
|
|
23
|
-
react_1.default.createElement(index_1.Textarea, {
|
|
23
|
+
react_1.default.createElement(index_1.Textarea, { isDisabled: true, id: "textarea-disabled", label: "Textarea disabled", onChange: () => {
|
|
24
24
|
// eslint-disable-next-line no-console
|
|
25
25
|
console.log("textarea OnChange");
|
|
26
26
|
} }),
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.srOnlyMixin = void 0;
|
|
4
|
+
exports.srOnlyMixin = {
|
|
5
|
+
borderWidth: "0",
|
|
6
|
+
clip: "rect(0, 0, 0, 0)",
|
|
7
|
+
height: "1px",
|
|
8
|
+
margin: "-1px",
|
|
9
|
+
overflow: "hidden",
|
|
10
|
+
padding: "0",
|
|
11
|
+
position: "absolute",
|
|
12
|
+
whiteSpace: "nowrap",
|
|
13
|
+
width: "1px",
|
|
14
|
+
};
|
|
@@ -1,31 +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.useFixAndroidOnFocus = void 0;
|
|
7
|
-
const jump_js_1 = __importDefault(require("jump.js"));
|
|
8
|
-
const react_1 = require("react");
|
|
9
|
-
const ua_parser_js_1 = __importDefault(require("ua-parser-js"));
|
|
10
|
-
function useFixAndroidOnFocus(onFocus) {
|
|
11
|
-
return (0, react_1.useCallback)((e) => {
|
|
12
|
-
const ua = typeof navigator !== "undefined" && navigator.userAgent;
|
|
13
|
-
if (ua && window.visualViewport) {
|
|
14
|
-
const uaParser = new ua_parser_js_1.default(ua);
|
|
15
|
-
if (uaParser.getOS().name === "Android" && uaParser.getEngine().name === "Blink") {
|
|
16
|
-
const target = e.target;
|
|
17
|
-
const rect = target.getBoundingClientRect();
|
|
18
|
-
if (rect.top < 60 || window.visualViewport.height - rect.bottom < 140) {
|
|
19
|
-
(0, jump_js_1.default)(rect.y, {
|
|
20
|
-
duration: 0,
|
|
21
|
-
offset: -60,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (onFocus) {
|
|
27
|
-
onFocus(e);
|
|
28
|
-
}
|
|
29
|
-
}, [onFocus]);
|
|
30
|
-
}
|
|
31
|
-
exports.useFixAndroidOnFocus = useFixAndroidOnFocus;
|