@geneui/components 3.0.0-next-fa49982-25032025 → 3.0.0-next-40cb9fb-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/Popover.js +1 -1
- package/Radio.js +57 -0
- package/components/atoms/Popover/Popover.d.ts +19 -10
- package/components/atoms/Popover/PopoverBody.d.ts +12 -1
- package/components/atoms/Popover/index.d.ts +1 -1
- package/components/atoms/Radio/Radio.d.ts +78 -0
- package/components/atoms/Radio/index.d.ts +1 -0
- package/{index-5a59c1ea.js → index-787461ac.js} +25 -12
- package/index.d.ts +1 -0
- package/index.js +2 -1
- 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/Popover.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { P as Popover, a as PopoverBody, b as PopoverFooter, c as PopoverFooterActions } from './index-
|
|
1
|
+
export { P as Popover, a as PopoverBody, b as PopoverFooter, c as PopoverFooterActions } from './index-787461ac.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import './floating-ui.react-0485e4db.js';
|
|
4
4
|
import 'react-dom';
|
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 };
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import { Dispatch,
|
|
1
|
+
import React, { Dispatch, ReactNode, SetStateAction } from "react";
|
|
2
|
+
import { ReferenceType } from "@floating-ui/react";
|
|
2
3
|
import "./Popover.scss";
|
|
3
4
|
type Positions = "bottom" | "bottom-start" | "bottom-end" | "left-end" | "left" | "left-start" | "right-end" | "right" | "right-start" | "top" | "top-start" | "top-end" | "auto";
|
|
4
5
|
export declare const correctPosition: Record<string, Positions>;
|
|
5
6
|
export type StaticSides = "bottom" | "left" | "right" | "top";
|
|
6
7
|
export declare const staticSides: Record<string, StaticSides>;
|
|
8
|
+
export interface IPopoverRef {
|
|
9
|
+
referenceElement: React.MutableRefObject<ReferenceType | null>;
|
|
10
|
+
floatingElement: React.MutableRefObject<ReferenceType | null>;
|
|
11
|
+
}
|
|
7
12
|
export interface IPopoverProps {
|
|
8
13
|
/**
|
|
9
14
|
* Whether the popover is open initially. Defaults value is `false`.
|
|
10
15
|
*/
|
|
11
|
-
|
|
16
|
+
defaultOpen?: boolean;
|
|
12
17
|
/**
|
|
13
18
|
* Define width and height of the popover.<br>
|
|
14
|
-
* Possible values: <code> xLarge | large | medium | small </code>
|
|
19
|
+
* Possible values: <code> xLarge | large | medium | small | mobile </code>
|
|
15
20
|
*/
|
|
16
21
|
size?: "xLarge" | "large" | "medium" | "small" | "mobile";
|
|
17
22
|
/**
|
|
@@ -24,13 +29,9 @@ export interface IPopoverProps {
|
|
|
24
29
|
*/
|
|
25
30
|
position?: keyof typeof correctPosition;
|
|
26
31
|
/**
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
|
-
padding?: number;
|
|
30
|
-
/**
|
|
31
|
-
* If `true`, the popover is always visible.
|
|
32
|
+
* Margin between the popover and its target element.
|
|
32
33
|
*/
|
|
33
|
-
|
|
34
|
+
margin?: number;
|
|
34
35
|
/**
|
|
35
36
|
* Function to update popover props dynamically.
|
|
36
37
|
*/
|
|
@@ -53,6 +54,14 @@ export interface IPopoverProps {
|
|
|
53
54
|
* You are, however, supplied with nudgedLeft and nudgedTop values, so you may choose to handle content overflow as you wish.
|
|
54
55
|
*/
|
|
55
56
|
disableReposition?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* A callback function that is called when the popover needs to be closed.
|
|
59
|
+
*/
|
|
60
|
+
onClose?: () => void;
|
|
61
|
+
/**
|
|
62
|
+
* Use `open` prop to control open state. By default, open is controls by component.
|
|
63
|
+
*/
|
|
64
|
+
open?: boolean;
|
|
56
65
|
}
|
|
57
66
|
/**
|
|
58
67
|
Popover displays additional content or information in an overlay box.
|
|
@@ -60,5 +69,5 @@ export interface IPopoverProps {
|
|
|
60
69
|
such as a click or hover. Unlike tooltips, popovers can contain more
|
|
61
70
|
complex and interactive content, including text, images, and form elements.
|
|
62
71
|
*/
|
|
63
|
-
declare const Popover:
|
|
72
|
+
declare const Popover: React.ForwardRefExoticComponent<IPopoverProps & React.RefAttributes<IPopoverRef>>;
|
|
64
73
|
export default Popover;
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
import { FC, PropsWithChildren } from "react";
|
|
2
|
-
|
|
2
|
+
interface IPopoverBodyProps extends PropsWithChildren {
|
|
3
|
+
/**
|
|
4
|
+
* Additional class for the parent element.
|
|
5
|
+
* This prop should be used to set placement properties for the element relative to its parent using BEM conventions.
|
|
6
|
+
*/
|
|
7
|
+
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* By default the PopoverBody has <code>--guit-ref-spacing-large</code> padding.
|
|
10
|
+
*/
|
|
11
|
+
withPadding?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const PopoverBody: FC<IPopoverBodyProps>;
|
|
3
14
|
export default PopoverBody;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { IPopoverProps, default as Popover } from "./Popover";
|
|
1
|
+
export { IPopoverProps, IPopoverRef, default as Popover } from "./Popover";
|
|
2
2
|
export { default as PopoverBody } from "./PopoverBody";
|
|
3
3
|
export { default as PopoverFooter } from "./PopoverFooter";
|
|
4
4
|
export { default as PopoverFooterActions } from "./PopoverFooterActions";
|
|
@@ -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";
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import React__default, { useRef, useCallback, useEffect, useState, useContext, useLayoutEffect } from 'react';
|
|
1
|
+
import React__default, { useRef, useCallback, useEffect, forwardRef, useState, useContext, useImperativeHandle, useLayoutEffect } from 'react';
|
|
2
2
|
import { u as useFloating, p as platform, o as offset, f as flip, a as arrow, s as shift, b as autoUpdate, c as useDismiss, d as useClick, e as useRole, g as useInteractions, F as FloatingPortal } from './floating-ui.react-0485e4db.js';
|
|
3
3
|
import { S as SvgInfoOutlined } from './InfoOutlined-fc7d9afa.js';
|
|
4
4
|
import { S as SvgX } from './X-9c317d18.js';
|
|
5
5
|
import { s as styleInject } from './style-inject.es-746bb8ed.js';
|
|
6
6
|
import { a as GeneUIDesignSystemContext } from './index-ae180991.js';
|
|
7
7
|
import Button from './Button.js';
|
|
8
|
+
import { c as classNames } from './index-ce02421b.js';
|
|
8
9
|
|
|
9
|
-
var css_248z = ".popover{background-color:var(--guit-sem-color-background-neutral-1-nudge);border-top-left-radius:var(--guit-ref-radius-2xsmall);border-top-right-radius:var(--guit-ref-radius-2xsmall);filter:drop-shadow(var(--guit-sem-shadow-floating-2-position-x-1) var(--guit-sem-shadow-floating-2-position-y-1) var(--guit-sem-shadow-floating-2-blur-1) var(--guit-sem-color-floating-2-rgba-1)) drop-shadow(var(--guit-sem-shadow-floating-2-position-x-2) var(--guit-sem-shadow-floating-2-position-y-2) var(--guit-sem-shadow-floating-2-blur-2) var(--guit-sem-color-floating-2-rgba-2))}.popover:not(.popover_size_mobile){border-bottom-left-radius:var(--guit-ref-radius-2xsmall);border-bottom-right-radius:var(--guit-ref-radius-2xsmall)}.popover:not(.popover_size_mobile) .popover__arrow{position:absolute}.popover:not(.popover_size_mobile) .popover__arrowPath{fill:var(--guit-sem-color-background-neutral-1-nudge)}.popover_position_top .popover__arrow{transform:rotate(180deg)}.popover_position_bottom .popover__arrow{transform:rotate(0deg)}.popover_position_left .popover__arrow{transform:rotate(90deg)}.popover_position_right .popover__arrow{transform:rotate(-90deg)}.popover_size_xLarge{width:72rem}.popover_size_xLarge .popover__body{height:15.4rem}.popover_size_xLarge .popover__footer{height:6.4rem}.popover_size_large{width:48rem}.popover_size_medium{width:36rem}.popover_size_large .popover__body,.popover_size_medium .popover__body{height:17.2rem}.popover_size_large .popover__footer,.popover_size_medium .popover__footer{height:5.6rem}.popover_size_small{width:24rem}.popover_size_small .popover__body{height:8.8rem}.popover_size_small .popover__footer{height:5.6rem}.popover_size_mobile{min-width:32rem;width:100%}.popover_size_mobile .popover__body{height:17.2rem}.popover_size_mobile .popover__footer{height:6.4rem}.popover__header{border-bottom:var(--guit-ref-border-width-thin) var(--guit-ref-border-style-solid) var(--guit-sem-color-border-neutral-2);height:4.8rem;justify-content:space-between;padding-inline:var(--guit-ref-spacing-large)}.popover__header,.popover__title{align-items:center;column-gap:var(--guit-ref-spacing-xsmall);display:flex}.popover__title{color:var(--guit-sem-color-foreground-neutral-2);flex:1;overflow:hidden}.popover__title_icon{flex:0 0 auto}.popover__title_text{font-family:var(--guit-sem-font-label-medium-default-semibold-font-family);font-size:var(--guit-sem-font-label-medium-default-semibold-font-size);font-weight:var(--guit-sem-font-label-medium-default-semibold-font-weight);line-height:var(--guit-sem-font-label-medium-default-semibold-line-height)}.popover__close{flex:0 0 auto}.
|
|
10
|
+
var css_248z = ".popover{background-color:var(--guit-sem-color-background-neutral-1-nudge);border-top-left-radius:var(--guit-ref-radius-2xsmall);border-top-right-radius:var(--guit-ref-radius-2xsmall);filter:drop-shadow(var(--guit-sem-shadow-floating-2-position-x-1) var(--guit-sem-shadow-floating-2-position-y-1) var(--guit-sem-shadow-floating-2-blur-1) var(--guit-sem-color-floating-2-rgba-1)) drop-shadow(var(--guit-sem-shadow-floating-2-position-x-2) var(--guit-sem-shadow-floating-2-position-y-2) var(--guit-sem-shadow-floating-2-blur-2) var(--guit-sem-color-floating-2-rgba-2))}.popover:not(.popover_size_mobile){border-bottom-left-radius:var(--guit-ref-radius-2xsmall);border-bottom-right-radius:var(--guit-ref-radius-2xsmall)}.popover:not(.popover_size_mobile) .popover__arrow{position:absolute}.popover:not(.popover_size_mobile) .popover__arrowPath{fill:var(--guit-sem-color-background-neutral-1-nudge)}.popover_position_top .popover__arrow{transform:rotate(180deg)}.popover_position_bottom .popover__arrow{transform:rotate(0deg)}.popover_position_left .popover__arrow{transform:rotate(90deg)}.popover_position_right .popover__arrow{transform:rotate(-90deg)}.popover_size_xLarge{width:72rem}.popover_size_xLarge .popover__body{height:15.4rem}.popover_size_xLarge .popover__footer{height:6.4rem}.popover_size_large{width:48rem}.popover_size_medium{width:36rem}.popover_size_large .popover__body,.popover_size_medium .popover__body{height:17.2rem}.popover_size_large .popover__footer,.popover_size_medium .popover__footer{height:5.6rem}.popover_size_small{width:24rem}.popover_size_small .popover__body{height:8.8rem}.popover_size_small .popover__footer{height:5.6rem}.popover_size_mobile{min-width:32rem;width:100%}.popover_size_mobile .popover__body{height:17.2rem}.popover_size_mobile .popover__footer{height:6.4rem}.popover__header{border-bottom:var(--guit-ref-border-width-thin) var(--guit-ref-border-style-solid) var(--guit-sem-color-border-neutral-2);height:4.8rem;justify-content:space-between;padding-inline:var(--guit-ref-spacing-large)}.popover__header,.popover__title{align-items:center;column-gap:var(--guit-ref-spacing-xsmall);display:flex}.popover__title{color:var(--guit-sem-color-foreground-neutral-2);flex:1;overflow:hidden}.popover__title_icon{flex:0 0 auto}.popover__title_text{font-family:var(--guit-sem-font-label-medium-default-semibold-font-family);font-size:var(--guit-sem-font-label-medium-default-semibold-font-size);font-weight:var(--guit-sem-font-label-medium-default-semibold-font-weight);line-height:var(--guit-sem-font-label-medium-default-semibold-line-height)}.popover__close{flex:0 0 auto}.popover__body_withPadding{padding-block:var(--guit-ref-spacing-large);padding-inline:var(--guit-ref-spacing-large)}.popover__content{height:100%;width:100%}.popover__footer{border-top:var(--guit-ref-border-width-thin) var(--guit-ref-border-style-solid) var(--guit-sem-color-border-neutral-2);justify-content:space-between;padding-block:var(--guit-ref-spacing-large);padding-inline:var(--guit-ref-spacing-large)}.popover__footer,.popover__footer_buttons{align-items:center;column-gap:var(--guit-ref-spacing-xsmall);display:flex}.popover__footer_buttons{margin-inline-start:auto}";
|
|
10
11
|
styleInject(css_248z);
|
|
11
12
|
|
|
12
13
|
const SCROLL_LOCK_CLASS = "scroll-lock";
|
|
@@ -183,9 +184,9 @@ const staticSides = {
|
|
|
183
184
|
such as a click or hover. Unlike tooltips, popovers can contain more
|
|
184
185
|
complex and interactive content, including text, images, and form elements.
|
|
185
186
|
*/
|
|
186
|
-
const Popover = ({ size = "medium", position = "bottom-center",
|
|
187
|
+
const Popover = forwardRef(({ size = "medium", position = "bottom-center", margin = 10, defaultOpen = false, setProps, title, withArrow = true, children, disableReposition = false, onClose, open }, popoverRef) => {
|
|
187
188
|
const { lock: lockBodyScroll, unlock: unlockBodyScroll } = useScrollLock(document.body);
|
|
188
|
-
const [popoverOpened, setPopoverOpened] = useState(
|
|
189
|
+
const [popoverOpened, setPopoverOpened] = useState(defaultOpen);
|
|
189
190
|
const { geneUIProviderRef } = useContext(GeneUIDesignSystemContext);
|
|
190
191
|
const [currentPosition, setCurrentPosition] = useState(correctPosition[position]);
|
|
191
192
|
const arrowRef = useRef(null);
|
|
@@ -196,7 +197,7 @@ const Popover = ({ size = "medium", position = "bottom-center", padding = 10, is
|
|
|
196
197
|
placement: currentPosition,
|
|
197
198
|
platform: Object.assign(Object.assign({}, platform), { isRTL: () => false }),
|
|
198
199
|
middleware: [
|
|
199
|
-
offset(
|
|
200
|
+
offset(margin),
|
|
200
201
|
flip({
|
|
201
202
|
mainAxis: position !== "auto" && !disableReposition,
|
|
202
203
|
fallbackAxisSideDirection: "none",
|
|
@@ -216,6 +217,17 @@ const Popover = ({ size = "medium", position = "bottom-center", padding = 10, is
|
|
|
216
217
|
],
|
|
217
218
|
whileElementsMounted: autoUpdate
|
|
218
219
|
});
|
|
220
|
+
useImperativeHandle(popoverRef, () => {
|
|
221
|
+
return {
|
|
222
|
+
referenceElement: refs.reference,
|
|
223
|
+
floatingElement: refs.floating
|
|
224
|
+
};
|
|
225
|
+
}, []);
|
|
226
|
+
useEffect(() => {
|
|
227
|
+
if (!popoverOpened && onClose) {
|
|
228
|
+
onClose();
|
|
229
|
+
}
|
|
230
|
+
}, [popoverOpened]);
|
|
219
231
|
useDismiss(context, {
|
|
220
232
|
outsidePressEvent: "click"
|
|
221
233
|
});
|
|
@@ -225,8 +237,9 @@ const Popover = ({ size = "medium", position = "bottom-center", padding = 10, is
|
|
|
225
237
|
const role = useRole(context);
|
|
226
238
|
const { getReferenceProps, getFloatingProps } = useInteractions([click, role]);
|
|
227
239
|
useEffect(() => {
|
|
228
|
-
|
|
229
|
-
|
|
240
|
+
const internalControl = open === undefined ? getReferenceProps() : {};
|
|
241
|
+
setProps(Object.assign({ ref: refs.setReference }, internalControl));
|
|
242
|
+
}, [setProps, getReferenceProps, open, refs.setReference]);
|
|
230
243
|
const [currentDirection] = placement.split("-");
|
|
231
244
|
const offsetFromEdge = 8;
|
|
232
245
|
const middlewareArrowData = middlewareData.arrow;
|
|
@@ -241,7 +254,7 @@ const Popover = ({ size = "medium", position = "bottom-center", padding = 10, is
|
|
|
241
254
|
bottom: "0"
|
|
242
255
|
}
|
|
243
256
|
: floatingStyles;
|
|
244
|
-
const isShowPopover =
|
|
257
|
+
const isShowPopover = open || popoverOpened;
|
|
245
258
|
useEffect(() => {
|
|
246
259
|
if (size === "mobile" && isShowPopover) {
|
|
247
260
|
lockBodyScroll();
|
|
@@ -306,7 +319,7 @@ const Popover = ({ size = "medium", position = "bottom-center", padding = 10, is
|
|
|
306
319
|
clearInterval(checkInterval);
|
|
307
320
|
leastOverlap = Infinity;
|
|
308
321
|
};
|
|
309
|
-
}, [popoverOpened, refs.floating.current, placement,
|
|
322
|
+
}, [popoverOpened, refs.floating.current, placement, position, currentPosition]);
|
|
310
323
|
const arrowOffsetFromEdge = 5;
|
|
311
324
|
return (React__default.createElement(React__default.Fragment, null, isShowPopover && (React__default.createElement(FloatingPortal, { root: geneUIProviderRef.current },
|
|
312
325
|
React__default.createElement("div", Object.assign({ style: styles, className: `popover popover_size_${size} popover_position_${currentDirection}`, ref: refs.setFloating }, getFloatingProps()),
|
|
@@ -321,10 +334,10 @@ const Popover = ({ size = "medium", position = "bottom-center", padding = 10, is
|
|
|
321
334
|
React__default.createElement("span", { className: "popover__title_text ellipsis-text" }, title)),
|
|
322
335
|
React__default.createElement(Button, { Icon: SvgX, size: "small", appearance: "secondary", displayType: "text", className: "popover__close", onClick: () => setPopoverOpened(false) }))),
|
|
323
336
|
children))))));
|
|
324
|
-
};
|
|
337
|
+
});
|
|
325
338
|
|
|
326
|
-
const PopoverBody = ({ children }) => {
|
|
327
|
-
return (React__default.createElement("div", { className: "popover__body" },
|
|
339
|
+
const PopoverBody = ({ children, withPadding = true, className }) => {
|
|
340
|
+
return (React__default.createElement("div", { className: classNames("popover__body", { popover__body_withPadding: withPadding }, className) },
|
|
328
341
|
React__default.createElement("div", { className: "popover__content" },
|
|
329
342
|
children,
|
|
330
343
|
" ")));
|
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,8 +6,9 @@ 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
|
-
export { P as Popover, a as PopoverBody, b as PopoverFooter, c as PopoverFooterActions, u as useScrollLock } from './index-
|
|
11
|
+
export { P as Popover, a as PopoverBody, b as PopoverFooter, c as PopoverFooterActions, u as useScrollLock } from './index-787461ac.js';
|
|
11
12
|
export { default as Badge } from './Badge.js';
|
|
12
13
|
export { default as Scrollbar } from './Scrollbar.js';
|
|
13
14
|
export { Col, Grid, Row } from './Grid.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-40cb9fb-26032025",
|
|
5
5
|
"author": "SoftConstruct",
|
|
6
6
|
"homepage": "https://github.com/softconstruct/gene-ui-components#readme",
|
|
7
7
|
"repository": {
|