@uxf/ui 1.0.0-beta.90 → 1.0.0-beta.91
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/avatar.spec.js +2 -9
- package/button/button.stories.js +1 -1
- package/checkbox/checkbox.d.ts +3 -0
- package/checkbox/checkbox.js +3 -9
- package/checkbox/checkbox.spec.d.ts +1 -0
- package/checkbox/checkbox.spec.js +11 -0
- package/checkbox/checkbox.stories.js +7 -20
- package/checkbox-button/checkbox-button.js +2 -5
- package/{text-input/test-input.spec.d.ts → checkbox-button/checkbox-button.spec.d.ts} +0 -0
- package/checkbox-button/checkbox-button.spec.js +10 -0
- package/checkbox-visual/checkbox-visual.d.ts +9 -0
- package/checkbox-visual/checkbox-visual.js +17 -0
- package/checkbox-visual/checkbox-visual.stories.d.ts +7 -0
- package/checkbox-visual/checkbox-visual.stories.js +44 -0
- package/checkbox-visual/index.d.ts +1 -0
- package/checkbox-visual/index.js +17 -0
- package/checkbox-visual/theme.d.ts +4 -0
- package/checkbox-visual/theme.js +2 -0
- package/css/button.css +33 -13
- package/css/checkbox-button.css +1 -1
- package/css/checkbox.css +47 -7
- package/css/combobox.css +5 -3
- package/css/dropdown.css +1 -1
- package/css/input.css +10 -4
- package/css/label.css +1 -1
- package/css/radio-group.css +1 -1
- package/css/radio.css +18 -2
- package/css/select.css +4 -2
- package/css/textarea.css +3 -4
- package/dropdown/dropdown.stories.js +1 -1
- package/flash-messages/flash-messages.stories.js +1 -1
- package/hooks/use-dropdown.js +1 -1
- package/package.json +1 -1
- package/radio/radio.d.ts +3 -0
- package/radio/radio.js +2 -1
- package/radio/radio.spec.d.ts +1 -0
- package/radio/radio.spec.js +10 -0
- package/radio/radio.stories.js +19 -26
- package/radio/theme.d.ts +4 -0
- package/radio/theme.js +2 -0
- package/radio-group/radio-group.d.ts +2 -0
- package/radio-group/radio-group.js +3 -2
- package/radio-group/radio-group.spec.d.ts +1 -0
- package/radio-group/radio-group.spec.js +24 -0
- package/radio-group/radio-group.stories.js +2 -1
- package/select/select.stories.js +9 -0
- package/text-input/text-input.spec.d.ts +1 -0
- package/text-input/text-input.spec.js +9 -0
- package/utils/snap-test.d.ts +2 -0
- package/utils/snap-test.js +17 -0
- package/utils/tailwind-config.js +7 -0
- package/text-input/test-input.spec.js +0 -12
package/avatar/avatar.spec.js
CHANGED
|
@@ -4,13 +4,6 @@ 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 react_test_renderer_1 = require("react-test-renderer");
|
|
8
7
|
const avatar_1 = require("./avatar");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
expect(tree).toMatchSnapshot();
|
|
12
|
-
});
|
|
13
|
-
it("render with className", () => {
|
|
14
|
-
const tree = (0, react_test_renderer_1.create)(react_1.default.createElement(avatar_1.Avatar, { src: "/image.jpg" })).toJSON();
|
|
15
|
-
expect(tree).toMatchSnapshot();
|
|
16
|
-
});
|
|
8
|
+
const snap_test_1 = require("../utils/snap-test");
|
|
9
|
+
(0, snap_test_1.snapTest)("render basic", react_1.default.createElement(avatar_1.Avatar, { src: "/image.jpg" }));
|
package/button/button.stories.js
CHANGED
|
@@ -53,7 +53,7 @@ function Default() {
|
|
|
53
53
|
", Size:",
|
|
54
54
|
" ",
|
|
55
55
|
react_1.default.createElement("span", { className: "font-semibold" }, size)),
|
|
56
|
-
react_1.default.createElement("div", { className: "flex flex-row gap-2" },
|
|
56
|
+
react_1.default.createElement("div", { className: "flex flex-row items-start gap-2" },
|
|
57
57
|
react_1.default.createElement(button_1.Button, { color: color, onClick: () => void null, size: size, variant: variant }, "Default"),
|
|
58
58
|
react_1.default.createElement(button_1.Button, { color: color, loading: true, onClick: () => void null, size: size, variant: variant }, "Loading"),
|
|
59
59
|
react_1.default.createElement(button_1.Button, { color: color, disabled: true, onClick: () => void null, size: size, variant: variant }, "Disabled"),
|
package/checkbox/checkbox.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import React, { CSSProperties, ReactNode } from "react";
|
|
2
2
|
import { FormControlProps } from "../types";
|
|
3
|
+
import { CheckboxSizes } from "../checkbox-visual/theme";
|
|
4
|
+
export declare type CheckboxSize = keyof CheckboxSizes;
|
|
3
5
|
export interface CheckboxProps extends FormControlProps<boolean> {
|
|
4
6
|
className?: string;
|
|
5
7
|
indeterminate?: boolean;
|
|
6
8
|
label: ReactNode;
|
|
9
|
+
size?: CheckboxSize;
|
|
7
10
|
style?: Partial<CSSProperties>;
|
|
8
11
|
}
|
|
9
12
|
export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLButtonElement>>;
|
package/checkbox/checkbox.js
CHANGED
|
@@ -6,19 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.Checkbox = void 0;
|
|
7
7
|
const react_1 = require("@headlessui/react");
|
|
8
8
|
const react_2 = __importDefault(require("react"));
|
|
9
|
-
const cx_1 = require("@uxf/core/utils/cx");
|
|
10
|
-
const classes_1 = require("@uxf/core/constants/classes");
|
|
11
9
|
const forwardRef_1 = require("@uxf/core/utils/forwardRef");
|
|
12
|
-
|
|
13
|
-
return (react_2.default.createElement("svg", { fill: "none", viewBox: "0 0 16 16" },
|
|
14
|
-
react_2.default.createElement("path", { d: "M13.333 4 6 11.333 2.667 8", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2" })));
|
|
15
|
-
}
|
|
10
|
+
const checkbox_visual_1 = require("../checkbox-visual");
|
|
16
11
|
exports.Checkbox = (0, forwardRef_1.forwardRef)("Checkbox", (props, ref) => {
|
|
17
12
|
var _a;
|
|
18
13
|
return (react_2.default.createElement(react_1.Switch.Group, null,
|
|
19
14
|
react_2.default.createElement("div", { className: `uxf-checkbox__wrapper ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` },
|
|
20
|
-
react_2.default.createElement(react_1.Switch, { checked: props.value, className:
|
|
21
|
-
react_2.default.createElement(
|
|
22
|
-
react_2.default.createElement(CheckIcon, null))),
|
|
15
|
+
react_2.default.createElement(react_1.Switch, { checked: props.value, className: "uxf-checkbox-visual-wrapper", disabled: props.isDisabled, name: props.name, onChange: props.onChange, ref: ref, style: props.style },
|
|
16
|
+
react_2.default.createElement(checkbox_visual_1.CheckboxVisual, { indeterminate: props.indeterminate, isDisabled: props.isDisabled, isInvalid: props.isInvalid, isReadOnly: props.isReadOnly, isRequired: props.isRequired, size: props.size, value: props.value })),
|
|
23
17
|
react_2.default.createElement(react_1.Switch.Label, { className: "uxf-checkbox__label" }, props.label))));
|
|
24
18
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const checkbox_1 = require("./checkbox");
|
|
8
|
+
const snap_test_1 = require("../utils/snap-test");
|
|
9
|
+
(0, snap_test_1.snapTest)("render basic", react_1.default.createElement(checkbox_1.Checkbox, { label: "label", onChange: () => void null }));
|
|
10
|
+
(0, snap_test_1.snapTest)("render disabled", react_1.default.createElement(checkbox_1.Checkbox, { isDisabled: true, label: "label", onChange: () => void null }));
|
|
11
|
+
(0, snap_test_1.snapTest)("render size lg", react_1.default.createElement(checkbox_1.Checkbox, { size: "lg", label: "label", onChange: () => void null }));
|
|
@@ -32,26 +32,13 @@ exports.default = {
|
|
|
32
32
|
};
|
|
33
33
|
function Default() {
|
|
34
34
|
const [checked, setChecked] = (0, react_1.useState)(true);
|
|
35
|
+
const checkboxes = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
36
|
+
react_1.default.createElement(index_1.Checkbox, { label: "Opravdu?", onChange: () => setChecked((prev) => !prev), value: checked }),
|
|
37
|
+
react_1.default.createElement(index_1.Checkbox, { label: "Opravdu?", isDisabled: true, onChange: () => setChecked((prev) => !prev), value: checked }),
|
|
38
|
+
react_1.default.createElement(index_1.Checkbox, { label: "Opravdu?", isInvalid: true, onChange: () => setChecked((prev) => !prev), value: checked }),
|
|
39
|
+
react_1.default.createElement(index_1.Checkbox, { label: "Opravdu? (size lg)", onChange: () => setChecked((prev) => !prev), value: checked, size: "lg" })));
|
|
35
40
|
return (react_1.default.createElement("div", { className: "flex" },
|
|
36
|
-
react_1.default.createElement("div", { className: "light flex flex-col gap-4 p-20" },
|
|
37
|
-
|
|
38
|
-
setChecked((prev) => !prev);
|
|
39
|
-
}, value: checked }),
|
|
40
|
-
react_1.default.createElement(index_1.Checkbox, { label: "Opravdu?", isDisabled: true, onChange: () => {
|
|
41
|
-
setChecked((prev) => !prev);
|
|
42
|
-
}, value: checked }),
|
|
43
|
-
react_1.default.createElement(index_1.Checkbox, { label: "Opravdu?", isInvalid: true, onChange: () => {
|
|
44
|
-
setChecked((prev) => !prev);
|
|
45
|
-
}, value: checked })),
|
|
46
|
-
react_1.default.createElement("div", { className: "dark flex flex-col gap-4 bg-gray-900 p-20" },
|
|
47
|
-
react_1.default.createElement(index_1.Checkbox, { label: "Opravdu?", onChange: () => {
|
|
48
|
-
setChecked((prev) => !prev);
|
|
49
|
-
}, value: checked }),
|
|
50
|
-
react_1.default.createElement(index_1.Checkbox, { label: "Opravdu?", isDisabled: true, onChange: () => {
|
|
51
|
-
setChecked((prev) => !prev);
|
|
52
|
-
}, value: checked }),
|
|
53
|
-
react_1.default.createElement(index_1.Checkbox, { label: "Opravdu?", isInvalid: true, onChange: () => {
|
|
54
|
-
setChecked((prev) => !prev);
|
|
55
|
-
}, value: checked }))));
|
|
41
|
+
react_1.default.createElement("div", { className: "light flex flex-col gap-4 p-20" }, checkboxes),
|
|
42
|
+
react_1.default.createElement("div", { className: "dark flex flex-col gap-4 bg-gray-900 p-20" }, checkboxes)));
|
|
56
43
|
}
|
|
57
44
|
exports.Default = Default;
|
|
@@ -9,13 +9,10 @@ const react_2 = __importDefault(require("react"));
|
|
|
9
9
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
10
10
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
11
11
|
const forwardRef_1 = require("@uxf/core/utils/forwardRef");
|
|
12
|
-
|
|
13
|
-
return (react_2.default.createElement("svg", { fill: "none", viewBox: "0 0 16 16" },
|
|
14
|
-
react_2.default.createElement("path", { d: "M13.333 4 6 11.333 2.667 8", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2" })));
|
|
15
|
-
}
|
|
12
|
+
const icon_1 = require("../icon");
|
|
16
13
|
exports.CheckboxButton = (0, forwardRef_1.forwardRef)("CheckboxButton", (props, ref) => {
|
|
17
14
|
return (react_2.default.createElement(react_1.Switch, { checked: props.value, className: (0, cx_1.cx)("uxf-checkbox-button", props.className, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.value && classes_1.CLASSES.IS_SELECTED), disabled: props.isDisabled, name: props.name, onChange: props.onChange, ref: ref, style: props.style },
|
|
18
15
|
react_2.default.createElement("span", { className: "uxf-checkbox-button__label" }, props.label),
|
|
19
16
|
react_2.default.createElement("span", { className: "uxf-checkbox-button__icon" },
|
|
20
|
-
react_2.default.createElement(
|
|
17
|
+
react_2.default.createElement(icon_1.Icon, { name: "check" }))));
|
|
21
18
|
});
|
|
File without changes
|
|
@@ -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
|
+
const snap_test_1 = require("../utils/snap-test");
|
|
8
|
+
const checkbox_button_1 = require("./checkbox-button");
|
|
9
|
+
(0, snap_test_1.snapTest)("render basic", react_1.default.createElement(checkbox_button_1.CheckboxButton, { label: "label", onChange: () => void null }));
|
|
10
|
+
(0, snap_test_1.snapTest)("render disabled", react_1.default.createElement(checkbox_button_1.CheckboxButton, { label: "label", isDisabled: true, onChange: () => void null }));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FormControlProps } from "../types";
|
|
3
|
+
import { CheckboxSizes } from "./theme";
|
|
4
|
+
export declare type CheckboxSize = keyof CheckboxSizes;
|
|
5
|
+
export interface CheckboxVisualProps extends FormControlProps<boolean> {
|
|
6
|
+
indeterminate?: boolean;
|
|
7
|
+
size?: CheckboxSize;
|
|
8
|
+
}
|
|
9
|
+
export declare const CheckboxVisual: React.ForwardRefExoticComponent<CheckboxVisualProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -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.CheckboxVisual = void 0;
|
|
7
|
+
const classes_1 = require("@uxf/core/constants/classes");
|
|
8
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
9
|
+
const react_1 = __importDefault(require("react"));
|
|
10
|
+
const forwardRef_1 = require("@uxf/core/utils/forwardRef");
|
|
11
|
+
const icon_1 = require("../icon");
|
|
12
|
+
exports.CheckboxVisual = (0, forwardRef_1.forwardRef)("CheckboxVisual", (props, ref) => {
|
|
13
|
+
var _a;
|
|
14
|
+
return (react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-checkbox", `uxf-checkbox--size-${(_a = props.size) !== null && _a !== void 0 ? _a : "default"}`, props.indeterminate && classes_1.CLASSES.IS_INDETERMINATE, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.value && classes_1.CLASSES.IS_SELECTED), onClick: () => { var _a; return (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, !props.value); }, ref: ref },
|
|
15
|
+
react_1.default.createElement("span", { className: "uxf-checkbox__icon" },
|
|
16
|
+
react_1.default.createElement(icon_1.Icon, { name: "check" }))));
|
|
17
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: React.ForwardRefExoticComponent<import("./checkbox-visual").CheckboxVisualProps & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
7
|
+
export declare function Default(): JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
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/CheckboxVisual",
|
|
31
|
+
component: index_1.CheckboxVisual,
|
|
32
|
+
};
|
|
33
|
+
function Default() {
|
|
34
|
+
const [checked, setChecked] = (0, react_1.useState)(true);
|
|
35
|
+
const checkboxes = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
36
|
+
react_1.default.createElement(index_1.CheckboxVisual, { onChange: () => setChecked((prev) => !prev), value: checked }),
|
|
37
|
+
react_1.default.createElement(index_1.CheckboxVisual, { isDisabled: true, onChange: () => setChecked((prev) => !prev), value: checked }),
|
|
38
|
+
react_1.default.createElement(index_1.CheckboxVisual, { isInvalid: true, onChange: () => setChecked((prev) => !prev), value: checked }),
|
|
39
|
+
react_1.default.createElement(index_1.CheckboxVisual, { onChange: () => setChecked((prev) => !prev), value: checked, size: "lg" })));
|
|
40
|
+
return (react_1.default.createElement("div", { className: "flex" },
|
|
41
|
+
react_1.default.createElement("div", { className: "light flex flex-col gap-4 p-20" }, checkboxes),
|
|
42
|
+
react_1.default.createElement("div", { className: "dark flex flex-col gap-4 bg-gray-900 p-20" }, checkboxes)));
|
|
43
|
+
}
|
|
44
|
+
exports.Default = Default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./checkbox-visual";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./checkbox-visual"), exports);
|
package/css/button.css
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
.uxf-button {
|
|
8
8
|
@apply inline-flex items-center justify-center rounded-md font-medium shadow-sm
|
|
9
|
-
focus:outline-none focus:ring-2 focus:ring-offset-2;
|
|
9
|
+
focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors;
|
|
10
10
|
|
|
11
11
|
.uxf-icon {
|
|
12
12
|
@apply h-6;
|
|
@@ -54,7 +54,9 @@
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
&--size-xs {
|
|
57
|
-
|
|
57
|
+
height: theme("inputSize.xs");
|
|
58
|
+
|
|
59
|
+
@apply px-2.5 text-xs rounded;
|
|
58
60
|
|
|
59
61
|
&.is-loading::after {
|
|
60
62
|
height: 14px;
|
|
@@ -62,16 +64,20 @@
|
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
&.uxf-button--icon-button {
|
|
65
|
-
|
|
67
|
+
width: theme("inputSize.xs");
|
|
68
|
+
|
|
69
|
+
@apply p-0;
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
.uxf-icon {
|
|
69
|
-
@apply h-4;
|
|
73
|
+
@apply h-4 w-4;
|
|
70
74
|
}
|
|
71
75
|
}
|
|
72
76
|
|
|
73
77
|
&--size-sm {
|
|
74
|
-
|
|
78
|
+
height: theme("inputSize.sm");
|
|
79
|
+
|
|
80
|
+
@apply px-3 text-sm leading-4;
|
|
75
81
|
|
|
76
82
|
&.is-loading::after {
|
|
77
83
|
height: 16px;
|
|
@@ -79,35 +85,49 @@
|
|
|
79
85
|
}
|
|
80
86
|
|
|
81
87
|
&.uxf-button--icon-button {
|
|
82
|
-
|
|
88
|
+
width: theme("inputSize.sm");
|
|
89
|
+
|
|
90
|
+
@apply p-0;
|
|
83
91
|
}
|
|
84
92
|
|
|
85
93
|
.uxf-icon {
|
|
86
|
-
@apply h-4;
|
|
94
|
+
@apply h-4 w-4;
|
|
87
95
|
}
|
|
88
96
|
}
|
|
89
97
|
|
|
90
98
|
&--size-default {
|
|
91
|
-
|
|
99
|
+
height: theme("inputSize.default");
|
|
100
|
+
|
|
101
|
+
@apply px-4 text-sm;
|
|
92
102
|
|
|
93
103
|
&.uxf-button--icon-button {
|
|
94
|
-
|
|
104
|
+
width: theme("inputSize.default");
|
|
105
|
+
|
|
106
|
+
@apply p-0;
|
|
95
107
|
}
|
|
96
108
|
}
|
|
97
109
|
|
|
98
110
|
&--size-lg {
|
|
99
|
-
|
|
111
|
+
height: theme("inputSize.lg");
|
|
112
|
+
|
|
113
|
+
@apply px-4 text-base;
|
|
100
114
|
|
|
101
115
|
&.uxf-button--icon-button {
|
|
102
|
-
|
|
116
|
+
width: theme("inputSize.lg");
|
|
117
|
+
|
|
118
|
+
@apply p-0;
|
|
103
119
|
}
|
|
104
120
|
}
|
|
105
121
|
|
|
106
122
|
&--size-xl {
|
|
107
|
-
|
|
123
|
+
height: theme("inputSize.xl");
|
|
124
|
+
|
|
125
|
+
@apply px-6 text-base;
|
|
108
126
|
|
|
109
127
|
&.uxf-button--icon-button {
|
|
110
|
-
|
|
128
|
+
width: theme("inputSize.xl");
|
|
129
|
+
|
|
130
|
+
@apply p-0;
|
|
111
131
|
}
|
|
112
132
|
}
|
|
113
133
|
|
package/css/checkbox-button.css
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
before:transition focus-visible:ring-offset-2 focus-visible:ring-2;
|
|
5
5
|
|
|
6
6
|
&__icon {
|
|
7
|
-
@apply w-5 h-5 p-
|
|
7
|
+
@apply w-5 h-5 p-1 bg-white text-transparent rounded relative before:absolute before:inset-0 before:border
|
|
8
8
|
before:rounded before:transition;
|
|
9
9
|
}
|
|
10
10
|
|
package/css/checkbox.css
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
|
+
.uxf-checkbox-visual-wrapper {
|
|
2
|
+
@apply outline-none leading-none rounded relative
|
|
3
|
+
before:absolute before:leading-none before:-inset-[3px] before:rounded-md focus-visible:before:border-2;
|
|
4
|
+
|
|
5
|
+
:root .light & {
|
|
6
|
+
@apply focus-visible:before:border-primary-500;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
:root .dark & {
|
|
10
|
+
@apply focus-visible:before:border-primary-500;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
1
14
|
.uxf-checkbox {
|
|
2
|
-
@apply shrink-0
|
|
3
|
-
focus-visible:ring-offset-2 focus-visible:ring-2;
|
|
15
|
+
@apply shrink-0 flex items-center justify-center rounded transition outline-none border;
|
|
4
16
|
|
|
5
17
|
&__wrapper {
|
|
6
18
|
@apply flex items-center justify-between space-x-3;
|
|
@@ -19,7 +31,7 @@
|
|
|
19
31
|
}
|
|
20
32
|
|
|
21
33
|
&__icon {
|
|
22
|
-
@apply
|
|
34
|
+
@apply hidden;
|
|
23
35
|
}
|
|
24
36
|
|
|
25
37
|
&.is-selected {
|
|
@@ -28,11 +40,27 @@
|
|
|
28
40
|
}
|
|
29
41
|
}
|
|
30
42
|
|
|
43
|
+
&--size-default {
|
|
44
|
+
@apply h-4 w-4;
|
|
45
|
+
|
|
46
|
+
.uxf-checkbox__icon {
|
|
47
|
+
@apply w-2.5 h-2.5;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&--size-lg {
|
|
52
|
+
@apply h-6 w-6;
|
|
53
|
+
|
|
54
|
+
.uxf-checkbox__icon {
|
|
55
|
+
@apply w-4 h-4;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
31
59
|
:root .light & {
|
|
32
|
-
@apply border-gray-400
|
|
60
|
+
@apply border-gray-400;
|
|
33
61
|
|
|
34
62
|
&.is-selected {
|
|
35
|
-
@apply bg-primary-500 border-
|
|
63
|
+
@apply bg-primary-500 border-transparent;
|
|
36
64
|
|
|
37
65
|
.uxf-checkbox__icon {
|
|
38
66
|
@apply text-white;
|
|
@@ -51,6 +79,12 @@
|
|
|
51
79
|
}
|
|
52
80
|
}
|
|
53
81
|
|
|
82
|
+
&.is-readonly {
|
|
83
|
+
&.is-selected {
|
|
84
|
+
@apply bg-primary-500/60;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
54
88
|
&.is-invalid {
|
|
55
89
|
@apply border-red-600;
|
|
56
90
|
|
|
@@ -65,10 +99,10 @@
|
|
|
65
99
|
}
|
|
66
100
|
|
|
67
101
|
:root .dark & {
|
|
68
|
-
@apply border-gray-400
|
|
102
|
+
@apply border-gray-400;
|
|
69
103
|
|
|
70
104
|
&.is-selected {
|
|
71
|
-
@apply bg-primary-500 border-
|
|
105
|
+
@apply bg-primary-500 border-transparent;
|
|
72
106
|
|
|
73
107
|
.uxf-checkbox__icon {
|
|
74
108
|
@apply text-white;
|
|
@@ -87,6 +121,12 @@
|
|
|
87
121
|
}
|
|
88
122
|
}
|
|
89
123
|
|
|
124
|
+
&.is-readonly {
|
|
125
|
+
&.is-selected {
|
|
126
|
+
@apply bg-primary-500/60;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
90
130
|
&.is-invalid {
|
|
91
131
|
@apply border-red-600;
|
|
92
132
|
|
package/css/combobox.css
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
.uxf-combobox {
|
|
2
|
-
@apply relative;
|
|
2
|
+
@apply relative shadow-sm;
|
|
3
3
|
|
|
4
4
|
&__button {
|
|
5
|
-
|
|
5
|
+
height: theme("inputSize.default");
|
|
6
|
+
|
|
7
|
+
@apply relative flex w-full cursor-default flex-row items-center rounded-lg px-4 text-left
|
|
6
8
|
outline-none before:absolute before:inset-0 before:pointer-events-none before:border before:rounded-lg;
|
|
7
9
|
|
|
8
10
|
.uxf-icon {
|
|
9
|
-
@apply h-
|
|
11
|
+
@apply h-3;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
:root .light & {
|
package/css/dropdown.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.uxf-dropdown {
|
|
2
|
-
@apply absolute z-10
|
|
2
|
+
@apply absolute z-10 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black
|
|
3
3
|
ring-opacity-5 focus:outline-none sm:text-sm;
|
|
4
4
|
|
|
5
5
|
&--bottom {
|
package/css/input.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.uxf-input {
|
|
2
|
-
@apply rounded-md bg-white;
|
|
2
|
+
@apply rounded-md bg-white shadow-sm;
|
|
3
3
|
|
|
4
4
|
:root .light & {
|
|
5
5
|
@apply bg-white text-gray-900;
|
|
@@ -63,20 +63,26 @@
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
&--size-small {
|
|
66
|
+
height: theme("inputSize.sm");
|
|
67
|
+
|
|
66
68
|
.uxf-input__wrapper {
|
|
67
|
-
@apply
|
|
69
|
+
@apply text-sm;
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
&--size-default {
|
|
74
|
+
height: theme("inputSize.default");
|
|
75
|
+
|
|
72
76
|
.uxf-input__wrapper {
|
|
73
|
-
@apply
|
|
77
|
+
@apply text-base;
|
|
74
78
|
}
|
|
75
79
|
}
|
|
76
80
|
|
|
77
81
|
&--size-large {
|
|
82
|
+
height: theme("inputSize.lg");
|
|
83
|
+
|
|
78
84
|
.uxf-input__wrapper {
|
|
79
|
-
@apply
|
|
85
|
+
@apply text-lg;
|
|
80
86
|
}
|
|
81
87
|
}
|
|
82
88
|
|
package/css/label.css
CHANGED
package/css/radio-group.css
CHANGED
package/css/radio.css
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
.uxf-radio {
|
|
2
|
-
@apply flex shrink-0 items-center justify-center
|
|
2
|
+
@apply flex shrink-0 items-center justify-center border rounded-full transition focus-visible:ring-2;
|
|
3
3
|
|
|
4
4
|
&__label {
|
|
5
5
|
@apply sr-only;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
&__inner {
|
|
9
|
-
@apply rounded-full
|
|
9
|
+
@apply rounded-full opacity-0 transition;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
&.is-selected {
|
|
@@ -15,6 +15,22 @@
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
&--size-default {
|
|
19
|
+
@apply h-4 w-4;
|
|
20
|
+
|
|
21
|
+
.uxf-radio__inner {
|
|
22
|
+
@apply w-1.5 h-1.5;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&--size-lg {
|
|
27
|
+
@apply h-6 w-6;
|
|
28
|
+
|
|
29
|
+
.uxf-radio__inner {
|
|
30
|
+
@apply w-2.5 h-2.5;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
18
34
|
:root .light & {
|
|
19
35
|
@apply border-gray-400 focus-visible:ring-primary-500;
|
|
20
36
|
|
package/css/select.css
CHANGED
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
@apply relative;
|
|
3
3
|
|
|
4
4
|
&__button {
|
|
5
|
-
|
|
5
|
+
height: theme("inputSize.default");
|
|
6
|
+
|
|
7
|
+
@apply relative flex w-full cursor-default flex-row items-center rounded-lg px-4 text-left shadow-sm
|
|
6
8
|
outline-none focus-visible:ring-2 before:absolute before:inset-0 before:pointer-events-none before:border
|
|
7
9
|
before:rounded-lg;
|
|
8
10
|
|
|
9
11
|
.uxf-icon {
|
|
10
|
-
@apply h-
|
|
12
|
+
@apply h-3;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
:root .light & {
|
package/css/textarea.css
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
.uxf-textarea {
|
|
2
2
|
&__wrapper {
|
|
3
|
-
@apply rounded-md text-base
|
|
4
|
-
border p-2;
|
|
3
|
+
@apply rounded-md text-base border p-2 shadow-sm;
|
|
5
4
|
|
|
6
5
|
:root .light & {
|
|
7
|
-
@apply
|
|
6
|
+
@apply text-gray-900 border-gray-200;
|
|
8
7
|
}
|
|
9
8
|
|
|
10
9
|
:root .dark & {
|
|
11
|
-
@apply
|
|
10
|
+
@apply text-gray-300 border-gray-700;
|
|
12
11
|
}
|
|
13
12
|
}
|
|
14
13
|
|
|
@@ -21,7 +21,7 @@ const testDropdownItems = [
|
|
|
21
21
|
function Default() {
|
|
22
22
|
const storyDropdown = (react_2.default.createElement(react_2.default.Fragment, null,
|
|
23
23
|
react_2.default.createElement(react_1.Menu, { as: "div", className: "relative" },
|
|
24
|
-
react_2.default.createElement(react_1.Menu.Button, { as: button_1.Button, title: "Test" }, "Click me"),
|
|
24
|
+
react_2.default.createElement(react_1.Menu.Button, { as: button_1.Button, color: "success", title: "Test" }, "Click me"),
|
|
25
25
|
react_2.default.createElement(react_1.Menu.Items, { as: index_1.Dropdown.Items }, testDropdownItems.map((item) => (react_2.default.createElement(react_1.Menu.Item, { key: item.id }, ({ active }) => (react_2.default.createElement(index_1.Dropdown.Item, { className: `first-letter:uppercase ${active ? classes_1.CLASSES.IS_ACTIVE : ""}` }, item.title)))))))));
|
|
26
26
|
return (react_2.default.createElement("div", { className: "flex" },
|
|
27
27
|
react_2.default.createElement("div", { className: "light grow gap-4 p-4" }, storyDropdown),
|
|
@@ -22,7 +22,7 @@ function Default() {
|
|
|
22
22
|
}) }, "Click to fire Flash message"),
|
|
23
23
|
react_1.default.createElement(button_1.Button, { onClick: () => (0, flash_messages_service_1.flashMessage)({
|
|
24
24
|
message: (react_1.default.createElement("div", { className: "flex items-center space-x-4" },
|
|
25
|
-
react_1.default.createElement(icon_1.Icon, { name: "
|
|
25
|
+
react_1.default.createElement(icon_1.Icon, { name: "xmarkLarge", size: 24 }),
|
|
26
26
|
react_1.default.createElement("span", null, "Seems like an error occurred :)"))),
|
|
27
27
|
autoDismiss: false,
|
|
28
28
|
variant: "error",
|
package/hooks/use-dropdown.js
CHANGED
|
@@ -12,7 +12,7 @@ function useDropdown(placement, matchWidth = false) {
|
|
|
12
12
|
apply({ availableHeight, availableWidth, elements, strategy, x, y }) {
|
|
13
13
|
Object.assign(elements.floating.style, {
|
|
14
14
|
left: x + "px",
|
|
15
|
-
maxHeight: Math.
|
|
15
|
+
maxHeight: Math.min(240, availableHeight) + "px",
|
|
16
16
|
maxWidth: matchWidth
|
|
17
17
|
? Math.min(availableWidth, elements.reference.getBoundingClientRect().width) + "px"
|
|
18
18
|
: availableWidth,
|
package/package.json
CHANGED
package/radio/radio.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { FormControlProps } from "../types";
|
|
3
|
+
import { RadioSizes } from "./theme";
|
|
4
|
+
export declare type RadioSize = keyof RadioSizes;
|
|
3
5
|
export interface RadioProps extends FormControlProps<boolean> {
|
|
4
6
|
label: string;
|
|
7
|
+
size?: RadioSize;
|
|
5
8
|
}
|
|
6
9
|
export declare const Radio: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLDivElement>>;
|
package/radio/radio.js
CHANGED
|
@@ -9,7 +9,8 @@ const cx_1 = require("@uxf/core/utils/cx");
|
|
|
9
9
|
const react_1 = __importDefault(require("react"));
|
|
10
10
|
const forwardRef_1 = require("@uxf/core/utils/forwardRef");
|
|
11
11
|
exports.Radio = (0, forwardRef_1.forwardRef)("Radio", (props, ref) => {
|
|
12
|
-
|
|
12
|
+
var _a;
|
|
13
|
+
return (react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-radio", `uxf-radio--size-${(_a = props.size) !== null && _a !== void 0 ? _a : "default"}`, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.value && classes_1.CLASSES.IS_SELECTED), onClick: () => { var _a; return (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, !props.value); }, ref: ref },
|
|
13
14
|
react_1.default.createElement("span", { className: "uxf-radio__label" }, props.label),
|
|
14
15
|
react_1.default.createElement("div", { className: "uxf-radio__inner" })));
|
|
15
16
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
+
const snap_test_1 = require("../utils/snap-test");
|
|
8
|
+
const radio_1 = require("./radio");
|
|
9
|
+
(0, snap_test_1.snapTest)("render basic", react_1.default.createElement(radio_1.Radio, { label: "label", onChange: () => void null }));
|
|
10
|
+
(0, snap_test_1.snapTest)("render disabled", react_1.default.createElement(radio_1.Radio, { label: "label", isDisabled: true, onChange: () => void null }));
|
package/radio/radio.stories.js
CHANGED
|
@@ -11,32 +11,25 @@ exports.default = {
|
|
|
11
11
|
component: index_1.Radio,
|
|
12
12
|
};
|
|
13
13
|
function Default() {
|
|
14
|
+
const radios = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
15
|
+
react_1.default.createElement("div", { className: "mt-4 mb-2 font-semibold" }, "Default"),
|
|
16
|
+
react_1.default.createElement("div", { className: "flex flex-row gap-4" },
|
|
17
|
+
react_1.default.createElement(index_1.Radio, { value: false, label: "Vyber" }),
|
|
18
|
+
react_1.default.createElement(index_1.Radio, { value: true, label: "Vyber" })),
|
|
19
|
+
react_1.default.createElement("div", { className: "mt-4 mb-2 font-semibold" }, "Invalid"),
|
|
20
|
+
react_1.default.createElement("div", { className: "flex flex-row gap-4" },
|
|
21
|
+
react_1.default.createElement(index_1.Radio, { value: false, label: "Vyber", isInvalid: true }),
|
|
22
|
+
react_1.default.createElement(index_1.Radio, { value: true, label: "Vyber", isInvalid: true })),
|
|
23
|
+
react_1.default.createElement("div", { className: "mt-4 mb-2 font-semibold" }, "Disabled"),
|
|
24
|
+
react_1.default.createElement("div", { className: "flex flex-row gap-4" },
|
|
25
|
+
react_1.default.createElement(index_1.Radio, { value: false, label: "Vyber", isDisabled: true }),
|
|
26
|
+
react_1.default.createElement(index_1.Radio, { value: true, label: "Vyber", isDisabled: true })),
|
|
27
|
+
react_1.default.createElement("div", { className: "mt-4 mb-2 font-semibold" }, "size lg"),
|
|
28
|
+
react_1.default.createElement("div", { className: "flex flex-row gap-4" },
|
|
29
|
+
react_1.default.createElement(index_1.Radio, { value: false, label: "Vyber", size: "lg" }),
|
|
30
|
+
react_1.default.createElement(index_1.Radio, { value: true, label: "Vyber", size: "lg" }))));
|
|
14
31
|
return (react_1.default.createElement("div", { className: "flex" },
|
|
15
|
-
react_1.default.createElement("div", { className: "light p-20" },
|
|
16
|
-
|
|
17
|
-
react_1.default.createElement("div", { className: "flex flex-row gap-4" },
|
|
18
|
-
react_1.default.createElement(index_1.Radio, { value: false, label: "Vyber" }),
|
|
19
|
-
react_1.default.createElement(index_1.Radio, { value: true, label: "Vyber" })),
|
|
20
|
-
react_1.default.createElement("div", { className: "mt-4 mb-2 font-semibold" }, "Invalid"),
|
|
21
|
-
react_1.default.createElement("div", { className: "flex flex-row gap-4" },
|
|
22
|
-
react_1.default.createElement(index_1.Radio, { value: false, label: "Vyber", isInvalid: true }),
|
|
23
|
-
react_1.default.createElement(index_1.Radio, { value: true, label: "Vyber", isInvalid: true })),
|
|
24
|
-
react_1.default.createElement("div", { className: "mt-4 mb-2 font-semibold" }, "Disabled"),
|
|
25
|
-
react_1.default.createElement("div", { className: "flex flex-row gap-4" },
|
|
26
|
-
react_1.default.createElement(index_1.Radio, { value: false, label: "Vyber", isDisabled: true }),
|
|
27
|
-
react_1.default.createElement(index_1.Radio, { value: true, label: "Vyber", isDisabled: true }))),
|
|
28
|
-
react_1.default.createElement("div", { className: "dark bg-gray-900 p-20" },
|
|
29
|
-
react_1.default.createElement("div", { className: "mt-4 mb-2 font-semibold text-white" }, "Default"),
|
|
30
|
-
react_1.default.createElement("div", { className: "flex flex-row gap-4" },
|
|
31
|
-
react_1.default.createElement(index_1.Radio, { value: false, label: "Vyber" }),
|
|
32
|
-
react_1.default.createElement(index_1.Radio, { value: true, label: "Vyber" })),
|
|
33
|
-
react_1.default.createElement("div", { className: "mt-4 mb-2 font-semibold text-white" }, "Invalid"),
|
|
34
|
-
react_1.default.createElement("div", { className: "flex flex-row gap-4" },
|
|
35
|
-
react_1.default.createElement(index_1.Radio, { value: false, label: "Vyber", isInvalid: true }),
|
|
36
|
-
react_1.default.createElement(index_1.Radio, { value: true, label: "Vyber", isInvalid: true })),
|
|
37
|
-
react_1.default.createElement("div", { className: "mt-4 mb-2 font-semibold text-white" }, "Disabled"),
|
|
38
|
-
react_1.default.createElement("div", { className: "flex flex-row gap-4" },
|
|
39
|
-
react_1.default.createElement(index_1.Radio, { value: false, label: "Vyber", isDisabled: true }),
|
|
40
|
-
react_1.default.createElement(index_1.Radio, { value: true, label: "Vyber", isDisabled: true })))));
|
|
32
|
+
react_1.default.createElement("div", { className: "light p-20 " }, radios),
|
|
33
|
+
react_1.default.createElement("div", { className: "dark bg-gray-900 p-20 text-white" }, radios)));
|
|
41
34
|
}
|
|
42
35
|
exports.Default = Default;
|
package/radio/theme.d.ts
ADDED
package/radio/theme.js
ADDED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { CSSProperties, ReactNode } from "react";
|
|
2
|
+
import { RadioSize } from "../radio";
|
|
2
3
|
import { FormControlProps } from "../types";
|
|
3
4
|
import { RadioGroupVariants } from "./theme";
|
|
4
5
|
export declare type RadioGroupVariant = keyof RadioGroupVariants;
|
|
@@ -16,6 +17,7 @@ export interface RadioGroupProps extends FormControlProps<RadioGroupOptionValue
|
|
|
16
17
|
id: string;
|
|
17
18
|
label: string;
|
|
18
19
|
options: RadioGroupOption[];
|
|
20
|
+
radioSize?: RadioSize;
|
|
19
21
|
style?: CSSProperties;
|
|
20
22
|
variant?: RadioGroupVariant;
|
|
21
23
|
}
|
|
@@ -33,16 +33,17 @@ const use_input_submit_1 = require("../hooks/use-input-submit");
|
|
|
33
33
|
const label_1 = require("../label");
|
|
34
34
|
const radio_1 = require("../radio");
|
|
35
35
|
exports.RadioGroup = (0, forwardRef_1.forwardRef)("RadioGroup", (props, ref) => {
|
|
36
|
-
var _a;
|
|
36
|
+
var _a, _b;
|
|
37
37
|
const innerRef = (0, react_2.useRef)(null);
|
|
38
38
|
(0, use_input_submit_1.useInputSubmit)(innerRef, "radio-group", props.isDisabled);
|
|
39
39
|
const errorId = props.isInvalid ? `${props.id}--errormessage` : undefined;
|
|
40
40
|
const variant = (_a = props.variant) !== null && _a !== void 0 ? _a : "list";
|
|
41
|
+
const radioSize = (_b = props.radioSize) !== null && _b !== void 0 ? _b : "default";
|
|
41
42
|
const rootClassName = (0, cx_1.cx)("uxf-radio-group", `uxf-radio-group--${variant}`, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.isInvalid && classes_1.CLASSES.IS_INVALID, props.className);
|
|
42
43
|
return (react_2.default.createElement(react_1.RadioGroup, { className: rootClassName, disabled: props.isDisabled, id: props.id, onChange: props.onChange, style: props.style, value: props.value },
|
|
43
44
|
react_2.default.createElement(react_1.RadioGroup.Label, { as: label_1.Label, className: "uxf-radio-group__label", isHidden: props.hiddenLabel, ref: ref }, props.label),
|
|
44
45
|
react_2.default.createElement("div", { className: "uxf-radio-group__options-wrapper" }, props.options.map((option) => (react_2.default.createElement(react_1.RadioGroup.Option, { className: (0, cx_1.cx)("uxf-radio-group__option", props.isDisabled && classes_1.CLASSES.IS_DISABLED), disabled: option.disabled, key: option.value.toString(), value: option.value }, (o) => (react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-radio-group__option__wrapper", o.checked && classes_1.CLASSES.IS_SELECTED) },
|
|
45
46
|
react_2.default.createElement("span", { className: "uxf-radio-group__option__label" }, option.label),
|
|
46
|
-
react_2.default.createElement(radio_1.Radio, { isDisabled: props.isDisabled || o.disabled, isInvalid: props.isInvalid, label: option.label, ref: o.checked ? innerRef : undefined, value: o.checked }))))))),
|
|
47
|
+
react_2.default.createElement(radio_1.Radio, { isDisabled: props.isDisabled || o.disabled, isInvalid: props.isInvalid, label: option.label, ref: o.checked ? innerRef : undefined, size: radioSize, value: o.checked }))))))),
|
|
47
48
|
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))));
|
|
48
49
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const snap_test_1 = require("../utils/snap-test");
|
|
8
|
+
const radio_group_1 = require("./radio-group");
|
|
9
|
+
const options = [
|
|
10
|
+
{
|
|
11
|
+
value: "1",
|
|
12
|
+
label: "Radio one",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
value: "2",
|
|
16
|
+
label: "Radio two",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
value: "3",
|
|
20
|
+
label: "Radio three-sixty",
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
(0, snap_test_1.snapTest)("render basic", react_1.default.createElement(radio_group_1.RadioGroup, { id: "basic", options: options, label: "label", onChange: () => void null }));
|
|
24
|
+
(0, snap_test_1.snapTest)("render disabled", react_1.default.createElement(radio_group_1.RadioGroup, { id: "disabled", options: options, label: "label", isDisabled: true, onChange: () => void null }));
|
|
@@ -49,7 +49,8 @@ function Default() {
|
|
|
49
49
|
const testRadioGroups = (react_1.default.createElement("div", { className: "space-y-10" },
|
|
50
50
|
react_1.default.createElement(index_1.RadioGroup, { id: "radiogroup", label: "Light Radio group", onChange: (v) => setValue(v), options: options, value: value }),
|
|
51
51
|
react_1.default.createElement(index_1.RadioGroup, { id: "radiogroup", label: "Radio group variant radio button", onChange: (v) => setValue(v), options: options, value: value, variant: "radioButton" }),
|
|
52
|
-
react_1.default.createElement(index_1.RadioGroup, { hiddenLabel: true, id: "radiogroup", label: "Radio group variant row with hidden label", onChange: (v) => setValue(v), options: options, value: value, variant: "row" })
|
|
52
|
+
react_1.default.createElement(index_1.RadioGroup, { hiddenLabel: true, id: "radiogroup", label: "Radio group variant row with hidden label", onChange: (v) => setValue(v), options: options, value: value, variant: "row" }),
|
|
53
|
+
react_1.default.createElement(index_1.RadioGroup, { id: "radiogroup", label: "Radio group variant row, radioSize lg", onChange: (v) => setValue(v), options: options, value: value, variant: "row", radioSize: "lg" })));
|
|
53
54
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
54
55
|
react_1.default.createElement("div", { className: "light rounded bg-white p-8" }, testRadioGroups),
|
|
55
56
|
react_1.default.createElement("div", { className: "dark rounded bg-gray-900 p-8 text-white" }, testRadioGroups)));
|
package/select/select.stories.js
CHANGED
|
@@ -38,6 +38,15 @@ const options = [
|
|
|
38
38
|
{ id: "one", label: "Option one" },
|
|
39
39
|
{ id: "two", label: "Option two" },
|
|
40
40
|
{ id: "three", label: "Option three" },
|
|
41
|
+
{ id: "three", label: "Option three" },
|
|
42
|
+
{ id: "three", label: "Option three" },
|
|
43
|
+
{ id: "three", label: "Option three" },
|
|
44
|
+
{ id: "three", label: "Option three" },
|
|
45
|
+
{ id: "three", label: "Option three" },
|
|
46
|
+
{ id: "three", label: "Option three" },
|
|
47
|
+
{ id: "three", label: "Option three" },
|
|
48
|
+
{ id: "three", label: "Option three" },
|
|
49
|
+
{ id: "three", label: "Option three" },
|
|
41
50
|
];
|
|
42
51
|
function Default() {
|
|
43
52
|
const [value, setValue] = (0, react_1.useState)();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const text_input_1 = require("./text-input");
|
|
8
|
+
const snap_test_1 = require("../utils/snap-test");
|
|
9
|
+
(0, snap_test_1.snapTest)("render basic", react_1.default.createElement(text_input_1.TextInput, { helperText: "helper text", label: "label", leftAddon: "left addon", rightAddon: "right addon", leftElement: "left element", rightElement: "right element" }));
|
|
@@ -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.snapTest = void 0;
|
|
7
|
+
const react_test_renderer_1 = require("react-test-renderer");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const context_1 = require("../context");
|
|
10
|
+
const get_provider_config_1 = require("../_private-utils/get-provider-config");
|
|
11
|
+
const snapTest = (name, component) => {
|
|
12
|
+
it(name, () => {
|
|
13
|
+
const tree = (0, react_test_renderer_1.create)(react_1.default.createElement(context_1.UiContextProvider, { value: (0, get_provider_config_1.getProviderConfig)() }, component)).toJSON();
|
|
14
|
+
expect(tree).toMatchSnapshot();
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
exports.snapTest = snapTest;
|
package/utils/tailwind-config.js
CHANGED
|
@@ -1,12 +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
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const react_test_renderer_1 = require("react-test-renderer");
|
|
8
|
-
const text_input_1 = require("./text-input");
|
|
9
|
-
it("render basic", () => {
|
|
10
|
-
const tree = (0, react_test_renderer_1.create)(react_1.default.createElement(text_input_1.TextInput, { helperText: "helper text", label: "label", leftAddon: "left addon", rightAddon: "right addon", leftElement: "left element", rightElement: "right element" })).toJSON();
|
|
11
|
-
expect(tree).toMatchSnapshot();
|
|
12
|
-
});
|