@geneui/components 3.0.0-next-fa49982-25032025 → 3.0.0-next-6c2658b-26032025
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/Checkbox.js +1 -1
- package/Radio.js +57 -0
- package/components/atoms/Radio/Radio.d.ts +78 -0
- package/components/atoms/Radio/index.d.ts +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +1 -1
package/Checkbox.js
CHANGED
|
@@ -53,7 +53,7 @@ var SvgMinus = function SvgMinus(_ref) {
|
|
|
53
53
|
}));
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
var css_248z = ".checkbox{display:inline-flex;flex-direction:column;max-width:100%;min-width:0}.checkbox__input{appearance:none;background:none;border:none;border-radius:var(--guit-ref-radius-4xsmall);height:100%;left:0;position:absolute;top:0;width:100%;z-index:-1}.checkbox__input:checked+.checkbox__imitation,.checkbox__input:indeterminate+.checkbox__imitation{background-color:var(--guit-sem-color-background-selected-2);border-color:var(--guit-sem-color-background-selected-2)}.checkbox__input:checked+.checkbox__imitation:hover,.checkbox__input:indeterminate+.checkbox__imitation:hover{background-color:var(--guit-sem-color-background-selected-2-hover);border-color:var(--guit-sem-color-background-selected-2-hover)}.checkbox__input:checked+.checkbox__imitation:active,.checkbox__input:indeterminate+.checkbox__imitation:active{background-color:var(--guit-sem-color-background-selected-2-pressed);border-color:var(--guit-sem-color-background-selected-2-pressed)}.checkbox__input:checked+.checkbox__imitation .checkbox__icon,.checkbox__input:indeterminate+.checkbox__imitation .checkbox__icon{opacity:1}.checkbox__label{display:flex;max-width:-moz-fit-content;max-width:fit-content}.checkbox__imitationHolder{align-items:center;display:flex;flex:0 0 auto;height:var(--guit-sem-dimension-height-small);
|
|
56
|
+
var css_248z = ".checkbox{display:inline-flex;flex-direction:column;max-width:100%;min-width:0}.checkbox__input{appearance:none;background:none;border:none;border-radius:var(--guit-ref-radius-4xsmall);height:100%;left:0;position:absolute;top:0;width:100%;z-index:-1}.checkbox__input:checked+.checkbox__imitation,.checkbox__input:indeterminate+.checkbox__imitation{background-color:var(--guit-sem-color-background-selected-2);border-color:var(--guit-sem-color-background-selected-2)}.checkbox__input:checked+.checkbox__imitation:hover,.checkbox__input:indeterminate+.checkbox__imitation:hover{background-color:var(--guit-sem-color-background-selected-2-hover);border-color:var(--guit-sem-color-background-selected-2-hover)}.checkbox__input:checked+.checkbox__imitation:active,.checkbox__input:indeterminate+.checkbox__imitation:active{background-color:var(--guit-sem-color-background-selected-2-pressed);border-color:var(--guit-sem-color-background-selected-2-pressed)}.checkbox__input:checked+.checkbox__imitation .checkbox__icon,.checkbox__input:indeterminate+.checkbox__imitation .checkbox__icon{opacity:1}.checkbox__label{display:flex;max-width:-moz-fit-content;max-width:fit-content}.checkbox__imitationHolder{align-items:center;display:flex;flex:0 0 auto;justify-content:center}.checkbox__imitationHolder:only-child{height:var(--guit-sem-dimension-height-small);width:var(--guit-sem-dimension-width-small)}.checkbox__imitationHolder .checkbox__input:not(:checked,:indeterminate)+.checkbox__imitation:hover{background-color:var(--guit-sem-color-background-transparent-1-hover)}.checkbox__imitationHolder .checkbox__input:not(:checked,:indeterminate)+.checkbox__imitation:active{background-color:var(--guit-sem-color-background-transparent-1-pressed)}.checkbox__imitationHolderInner{align-items:center;display:flex;flex:0 0 auto;height:var(--guit-sem-dimension-height-xsmall);justify-content:center;position:relative;width:var(--guit-sem-dimension-width-xsmall)}.checkbox__imitation{border:var(--guit-ref-border-width-thin) solid var(--guit-sem-color-border-neutral-3);border-radius:var(--guit-ref-radius-4xsmall);height:100%;width:100%}.checkbox__icon{color:var(--guit-sem-color-foreground-inverse);left:0;opacity:0;position:absolute;top:0}.checkbox__infoContainer{display:flex}.checkbox:not(.checkbox_labelTop){gap:var(--guit-ref-spacing-3xsmall)}.checkbox:not(.checkbox_labelTop) .checkbox__infoContainer{padding-inline-start:var(--guit-ref-spacing-3xlarge)}.checkbox:not(.checkbox_labelTop) .checkbox__label{gap:var(--guit-ref-spacing-medium)}.checkbox_labelTop{gap:var(--guit-ref-spacing-3xsmall)}.checkbox_labelTop .checkbox__label{align-items:flex-start;flex-direction:column-reverse;gap:var(--guit-ref-spacing-3xsmall)}.checkbox_error .checkbox__imitationHolder .checkbox__imitationHolderInner .checkbox__imitation{border-color:var(--guit-sem-color-border-error)}.checkbox_disabled{pointer-events:none;-webkit-user-select:none;user-select:none}.checkbox_disabled .checkbox__imitationHolder .checkbox__imitationHolderInner .checkbox__imitation{background-color:var(--guit-sem-color-background-disabled);border-color:var(--guit-sem-color-border-disabled-1)}.checkbox_disabled .checkbox__imitationHolder .checkbox__imitationHolderInner .checkbox__imitation .checkbox__icon{color:var(--guit-sem-color-foreground-disabled)}.checkbox_disabled .checkbox__input:not(:checked,:indeterminate)+.checkbox__imitation{background-color:var(--guit-sem-color-background-transparent-1)}.checkbox_readOnly{pointer-events:none}.checkbox_readOnly .checkbox__imitationHolder .checkbox__imitationHolderInner .checkbox__imitation{background-color:var(--guit-sem-color-background-neutral-3);border-color:#0000}.checkbox_readOnly .checkbox__imitationHolder .checkbox__imitationHolderInner .checkbox__imitation .checkbox__icon{color:var(--guit-sem-color-foreground-neutral-1)}.checkbox_readOnly .checkbox__input:not(:checked,:indeterminate)+.checkbox__imitation{border-color:var(--guit-sem-color-border-neutral-2)}";
|
|
57
57
|
styleInject(css_248z);
|
|
58
58
|
|
|
59
59
|
/**
|
package/Radio.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React__default, { useState, useEffect } from 'react';
|
|
2
|
+
import { c as classNames } from './index-ce02421b.js';
|
|
3
|
+
import { S as SvgCircleFilled } from './CircleFilled-19a9ec62.js';
|
|
4
|
+
import HelperText from './HelperText.js';
|
|
5
|
+
import Label from './Label.js';
|
|
6
|
+
import { s as styleInject } from './style-inject.es-746bb8ed.js';
|
|
7
|
+
import './ActivityRecent-b88e2ba8.js';
|
|
8
|
+
import './Error-e14cf0e1.js';
|
|
9
|
+
import './TriangleAlert-14d7e83c.js';
|
|
10
|
+
import './Tooltip.js';
|
|
11
|
+
import './floating-ui.react-0485e4db.js';
|
|
12
|
+
import 'react-dom';
|
|
13
|
+
import './index-ae180991.js';
|
|
14
|
+
import './useDebounceCallback-999deae7.js';
|
|
15
|
+
import './useEllipsisDetection-dfe1a9d3.js';
|
|
16
|
+
import './Info.js';
|
|
17
|
+
import './InfoOutlined-fc7d9afa.js';
|
|
18
|
+
|
|
19
|
+
var css_248z = ".radio{display:inline-flex;flex-direction:column;max-width:100%;min-width:0}.radio__input{appearance:none;background:none;border:none;border-radius:inherit;height:100%;left:0;position:absolute;top:0;width:100%;z-index:-1}.radio__input:checked+.radio__imitation{border-color:var(--guit-sem-color-background-selected-2);color:var(--guit-sem-color-background-selected-2)}.radio__input:checked+.radio__imitation:hover{border-color:var(--guit-sem-color-background-selected-2-hover);color:var(--guit-sem-color-background-selected-2-hover)}.radio__input:checked+.radio__imitation:active{border-color:var(--guit-sem-color-background-selected-2-pressed);color:var(--guit-sem-color-background-selected-2-pressed)}.radio__input:checked+.radio__imitation .radio__icon{color:inherit;opacity:1}.radio__label{display:flex}.radio__imitationHolder{align-items:center;border-radius:50%;display:flex;flex:0 0 auto;justify-content:center}.radio__imitationHolder:only-child{height:var(--guit-sem-dimension-height-small);width:var(--guit-sem-dimension-width-small)}.radio__imitationHolder .radio__input:not(:checked)+.radio__imitation:hover{background-color:var(--guit-sem-color-background-transparent-1-hover)}.radio__imitationHolder .radio__input:not(:checked)+.radio__imitation:active{background-color:var(--guit-sem-color-background-transparent-1-pressed)}.radio__imitationHolderInner{border-radius:inherit;flex:0 0 auto;height:var(--guit-sem-dimension-height-xsmall);position:relative;width:var(--guit-sem-dimension-width-xsmall)}.radio__imitation,.radio__imitationHolderInner{align-items:center;display:flex;justify-content:center}.radio__imitation{border:var(--guit-ref-border-width-thin) solid var(--guit-sem-color-border-neutral-3);border-radius:inherit;height:100%;overflow:hidden;width:100%}.radio__icon{color:var(--guit-sem-color-foreground-inverse);flex:0 0 auto;opacity:0}.radio__infoContainer{display:flex}.radio:not(.radio_labelTop){gap:var(--guit-ref-spacing-3xsmall)}.radio:not(.radio_labelTop) .radio__infoContainer{padding-inline-start:var(--guit-ref-spacing-3xlarge)}.radio:not(.radio_labelTop) .radio__label{gap:var(--guit-ref-spacing-medium)}.radio_labelTop,.radio_labelTop .radio__label{gap:var(--guit-ref-spacing-3xsmall)}.radio_labelTop .radio__label{align-items:flex-start;flex-direction:column-reverse}.radio_error .radio__imitationHolder .radio__imitationHolderInner .radio__imitation{border-color:var(--guit-sem-color-border-error)}.radio_disabled{pointer-events:none;-webkit-user-select:none;user-select:none}.radio_disabled .radio__imitationHolder .radio__imitationHolderInner .radio__imitation{border-color:var(--guit-sem-color-border-disabled-1)}.radio_disabled .radio__imitationHolder .radio__imitationHolderInner .radio__imitation .radio__icon{color:var(--guit-sem-color-background-disabled)}.radio_disabled .radio__input:not(:checked)+.radio__imitation{border-color:var(--guit-sem-color-border-disabled-1)}.radio_readOnly{pointer-events:none}.radio_readOnly .radio__imitationHolder .radio__imitationHolderInner .radio__imitation{background-color:var(--guit-sem-color-background-neutral-3);border-color:#0000}.radio_readOnly .radio__imitationHolder .radio__imitationHolderInner .radio__imitation .radio__icon{color:var(--guit-sem-color-foreground-neutral-1)}.radio_readOnly .radio__input:not(:checked)+.radio__imitation{border-color:var(--guit-sem-color-border-neutral-2)}";
|
|
20
|
+
styleInject(css_248z);
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
The radio component allows users to select one or more options from a set of choices. Each radio can be either checked or unchecked, indicating a binary state. Radios are commonly used in forms, settings, and lists where a user needs to select a single option from multiple options.
|
|
24
|
+
*/
|
|
25
|
+
const Radio = (props) => {
|
|
26
|
+
const { label, required, infoText, disabled, helperText, readOnly, type = "rest", direction = "horizontal ", autoFocus, onChange, onFocus, onBlur, name, checked, defaultChecked, className, value } = props;
|
|
27
|
+
const isControlled = "checked" in props;
|
|
28
|
+
const [checkedState, setCheckedState] = useState(defaultChecked || false);
|
|
29
|
+
const onChangeHandler = (e) => {
|
|
30
|
+
if (!isControlled) {
|
|
31
|
+
setCheckedState(e.target.checked);
|
|
32
|
+
}
|
|
33
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
34
|
+
};
|
|
35
|
+
const onFocusHandler = (e) => onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
36
|
+
const onBlurHandler = (e) => onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (isControlled) {
|
|
39
|
+
setCheckedState(!!checked);
|
|
40
|
+
}
|
|
41
|
+
}, [checked, isControlled]);
|
|
42
|
+
return (React__default.createElement("div", Object.assign({ className: classNames("radio ", `radio_${type}`, {
|
|
43
|
+
radio_disabled: disabled,
|
|
44
|
+
radio_readOnly: readOnly,
|
|
45
|
+
radio_labelTop: direction === "vertical"
|
|
46
|
+
}, className) }, ((disabled || readOnly) && { tabIndex: -1 })),
|
|
47
|
+
React__default.createElement(Label, { labelText: label, className: "radio__label", required: required, infoText: infoText, disabled: disabled, readOnly: readOnly },
|
|
48
|
+
React__default.createElement("span", { className: "radio__imitationHolder" },
|
|
49
|
+
React__default.createElement("span", { className: "radio__imitationHolderInner" },
|
|
50
|
+
React__default.createElement("input", Object.assign({ type: "radio", className: "radio__input", onChange: onChangeHandler, onFocus: onFocusHandler, onBlur: onBlurHandler, checked: checkedState, value: value, name: name }, (autoFocus && { autoFocus }), ((disabled || readOnly) && { tabIndex: -1 }))),
|
|
51
|
+
React__default.createElement("span", { className: "radio__imitation" },
|
|
52
|
+
React__default.createElement(SvgCircleFilled, { className: "radio__icon" }))))),
|
|
53
|
+
helperText && (React__default.createElement("div", { className: "radio__infoContainer" },
|
|
54
|
+
React__default.createElement(HelperText, { text: helperText, isDisabled: disabled, type: type })))));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export { Radio as default };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ChangeEvent, FC, FocusEvent } from "react";
|
|
2
|
+
import "./Radio.scss";
|
|
3
|
+
interface IRadioProps {
|
|
4
|
+
/**
|
|
5
|
+
* The text displayed as the label for the radio, describing its purpose or function.
|
|
6
|
+
*/
|
|
7
|
+
label?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Toggles the label's and HelperText position between above or beside the radio.
|
|
10
|
+
* Possible values: `horizontal | vertical`
|
|
11
|
+
*/
|
|
12
|
+
direction?: "horizontal " | "vertical";
|
|
13
|
+
/**
|
|
14
|
+
* Specifies whether the radio is mandatory for completing a form.
|
|
15
|
+
*/
|
|
16
|
+
required?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Disables the radio, preventing it from being interacted with.
|
|
19
|
+
*/
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Displays the radio as read-only, where users cannot modify its value.
|
|
23
|
+
*/
|
|
24
|
+
readOnly?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Manages the checked state of the radio in a controlled way.
|
|
27
|
+
*/
|
|
28
|
+
checked?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Automatically focuses the radio when the component mounts.
|
|
31
|
+
*/
|
|
32
|
+
autoFocus?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Extra information displayed with the tooltip for clarity or guidance.
|
|
35
|
+
*/
|
|
36
|
+
infoText?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Helper text to provide context or explain any errors, warnings related to the radio.
|
|
39
|
+
*/
|
|
40
|
+
helperText?: string;
|
|
41
|
+
/**
|
|
42
|
+
* The initial state of the radio was checked before user interaction. This prop does not make the component controlled.
|
|
43
|
+
*/
|
|
44
|
+
defaultChecked?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Determines the radios appearance based on its status.<br>
|
|
47
|
+
* Possible values: `rest | warning | error`
|
|
48
|
+
*/
|
|
49
|
+
type?: "rest" | "warning" | "error";
|
|
50
|
+
/**
|
|
51
|
+
* HTML name attribute for the input element.<br>
|
|
52
|
+
* A unique identifier for the radio within a form.
|
|
53
|
+
*/
|
|
54
|
+
name: string;
|
|
55
|
+
/**
|
|
56
|
+
* Fires when the user changes the radio state. Provides the change event as a callback's argument.
|
|
57
|
+
*/
|
|
58
|
+
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Event handler for when the radio input element loses focus. Provides the focus event as a callback's argument.
|
|
61
|
+
*/
|
|
62
|
+
onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
63
|
+
/**
|
|
64
|
+
* Event handler for when the radio input element receives focus. Provides the focus event as a callback's argument.
|
|
65
|
+
*/
|
|
66
|
+
onFocus?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Additional class for the parent element.
|
|
69
|
+
* This prop should be used to set placement properties for the element relative to its parent using BEM conventions.
|
|
70
|
+
*/
|
|
71
|
+
className?: string;
|
|
72
|
+
/**
|
|
73
|
+
* The value of the component that will be returned in the onChange event.
|
|
74
|
+
* */
|
|
75
|
+
value: string;
|
|
76
|
+
}
|
|
77
|
+
declare const Radio: FC<IRadioProps>;
|
|
78
|
+
export { IRadioProps, Radio as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { IRadioProps, default } from "./Radio";
|
package/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { default as Pill, IPillProps } from "./components/atoms/Pill";
|
|
|
6
6
|
export { default as Divider, IDividerProps } from "./components/atoms/Divider";
|
|
7
7
|
export { default as Info, IInfoProps } from "./components/atoms/Info";
|
|
8
8
|
export { default as Button, IButtonProps } from "./components/atoms/Button";
|
|
9
|
+
export { default as Radio } from "./components/atoms/Radio";
|
|
9
10
|
export { default as Text, ITextProps } from "./components/atoms/Text";
|
|
10
11
|
export { Popover, PopoverBody, PopoverFooter, PopoverFooterActions, IPopoverProps } from "./components/atoms/Popover";
|
|
11
12
|
export { default as Badge, IBadgeProps } from "./components/atoms/Badge";
|
package/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export { default as Pill } from './Pill.js';
|
|
|
6
6
|
export { default as Divider } from './Divider.js';
|
|
7
7
|
export { default as Info } from './Info.js';
|
|
8
8
|
export { default as Button } from './Button.js';
|
|
9
|
+
export { default as Radio } from './Radio.js';
|
|
9
10
|
export { default as Text } from './Text.js';
|
|
10
11
|
export { P as Popover, a as PopoverBody, b as PopoverFooter, c as PopoverFooterActions, u as useScrollLock } from './index-5a59c1ea.js';
|
|
11
12
|
export { default as Badge } from './Badge.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geneui/components",
|
|
3
3
|
"description": "The Gene UI components library designed for BI tools",
|
|
4
|
-
"version": "3.0.0-next-
|
|
4
|
+
"version": "3.0.0-next-6c2658b-26032025",
|
|
5
5
|
"author": "SoftConstruct",
|
|
6
6
|
"homepage": "https://github.com/softconstruct/gene-ui-components#readme",
|
|
7
7
|
"repository": {
|