@geneui/components 3.0.0-next-f0c40b8-25112024 → 3.0.0-next-8abb102-14012025
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/Button.js +1 -1
- package/Checkbox.js +100 -0
- package/Divider.js +1 -1
- package/GeneUIProvider.js +2 -1
- package/HelperText.js +5 -5
- package/Label.js +8 -7
- package/Pill.js +3 -2
- package/ProgressBar.js +4 -3
- package/Scrollbar.js +3473 -0
- package/TextLink.js +1 -1
- package/components/atoms/HelperText/HelperText.d.ts +4 -9
- package/components/atoms/Label/Label.d.ts +5 -0
- package/components/atoms/Scrollbar/Scrollbar.d.ts +42 -0
- package/components/atoms/Scrollbar/index.d.ts +1 -0
- package/components/molecules/Checkbox/Checkbox.d.ts +80 -0
- package/components/molecules/Checkbox/index.d.ts +1 -0
- package/hooks/useDebounceCallback/useDebounceCallback.d.ts +4 -1
- package/index.d.ts +1 -0
- package/index.js +4 -1
- package/package.json +3 -2
- package/useDebounceCallback-999deae7.js +23 -0
- package/{useEllipsisDetection-46d712b6.js → useEllipsisDetection-e545ae62.js} +6 -17
package/TextLink.js
CHANGED
|
@@ -2,7 +2,7 @@ import React__default from 'react';
|
|
|
2
2
|
import { c as classNames } from './index-ce02421b.js';
|
|
3
3
|
import { s as styleInject } from './style-inject.es-746bb8ed.js';
|
|
4
4
|
|
|
5
|
-
var css_248z = ".textLink{border-radius:var(--guit-ref-radius-4xsmall);cursor:pointer;display:inline-flex;word-break:break-word}.textLink_underline .textLink__text{font-family:var(--guit-sem-font-body-medium-underline-medium-font-family);font-size:var(--guit-sem-font-body-medium-underline-medium-font-size);font-weight:var(--guit-sem-font-body-medium-underline-medium-font-weight);line-height:var(--guit-sem-font-body-medium-underline-medium-line-height);-webkit-text-decoration:var(--guit-sem-font-body-medium-underline-medium-text-decoration);text-decoration:var(--guit-sem-font-body-medium-underline-medium-text-decoration)}.textLink:not(.textLink_underline) .textLink__text{font-family:var(--guit-sem-font-body-medium-default-medium-font-family);font-size:var(--guit-sem-font-body-medium-default-medium-font-size);font-weight:var(--guit-sem-font-body-medium-default-medium-font-weight);line-height:var(--guit-sem-font-body-medium-default-medium-line-height)}.textLink_color_primary{color:var(--guit-sem-color-foreground-brand)}.textLink_color_primary:hover{color:var(--guit-sem-color-foreground-brand-hover)}.textLink_color_primary:active{color:var(--guit-sem-color-foreground-brand-pressed)}.textLink_color_secondary{color:var(--guit-sem-color-foreground-neutral-2)}.textLink_color_secondary:hover{color:var(--guit-sem-color-foreground-neutral-2-hover)}.textLink_color_secondary:active{color:var(--guit-sem-color-foreground-neutral-2-pressed)}.textLink_color_inverse{color:var(--guit-sem-color-foreground-inverse)}.textLink_color_inverse:hover{color:var(--guit-sem-color-foreground-inverse-hover)}.textLink_color_inverse:active{color:var(--guit-sem-color-foreground-inverse-pressed)}.textLink_disabled{pointer-events:none}.textLink_disabled:not(.textLink_color_inverse){color:var(--guit-sem-color-foreground-disabled)}.textLink_disabled.textLink_color_inverse{color:var(--guit-sem-color-foreground-inverse-disabled)}.textLink__text{color:inherit}.textLink__icon{flex:0 0 auto;vertical-align:middle}.textLink__icon_before{margin-inline-end:var(--guit-ref-spacing-3xsmall)}.textLink__icon_after{margin-inline-start:var(--guit-ref-spacing-3xsmall)}";
|
|
5
|
+
var css_248z = ".textLink{border-radius:var(--guit-ref-radius-4xsmall);cursor:pointer;display:inline-flex;word-break:break-word}.textLink_underline .textLink__text{font-family:var(--guit-sem-font-body-medium-underline-medium-font-family);font-size:var(--guit-sem-font-body-medium-underline-medium-font-size);font-weight:var(--guit-sem-font-body-medium-underline-medium-font-weight);line-height:var(--guit-sem-font-body-medium-underline-medium-line-height);-webkit-text-decoration:var(--guit-sem-font-body-medium-underline-medium-text-decoration);text-decoration:var(--guit-sem-font-body-medium-underline-medium-text-decoration)}.textLink:not(.textLink_underline) .textLink__text{font-family:var(--guit-sem-font-body-medium-default-medium-font-family);font-size:var(--guit-sem-font-body-medium-default-medium-font-size);font-weight:var(--guit-sem-font-body-medium-default-medium-font-weight);line-height:var(--guit-sem-font-body-medium-default-medium-line-height)}.textLink_color_primary{color:var(--guit-sem-color-foreground-brand)}.textLink_color_primary:hover{color:var(--guit-sem-color-foreground-brand-hover)}.textLink_color_primary:active{color:var(--guit-sem-color-foreground-brand-pressed)}.textLink_color_secondary{color:var(--guit-sem-color-foreground-neutral-2)}.textLink_color_secondary:hover{color:var(--guit-sem-color-foreground-neutral-2-hover)}.textLink_color_secondary:active{color:var(--guit-sem-color-foreground-neutral-2-pressed)}.textLink_color_inverse{color:var(--guit-sem-color-foreground-inverse)}.textLink_color_inverse:hover{color:var(--guit-sem-color-foreground-inverse-hover)}.textLink_color_inverse:active{color:var(--guit-sem-color-foreground-inverse-pressed)}.textLink_disabled{pointer-events:none}.textLink_disabled:not(.textLink_color_inverse){color:var(--guit-sem-color-foreground-disabled)}.textLink_disabled.textLink_color_inverse{color:var(--guit-sem-color-foreground-inverse-disabled)}.textLink__text{color:inherit}.textLink__icon{flex:0 0 auto;vertical-align:middle}.textLink__icon_before{-webkit-margin-end:var(--guit-ref-spacing-3xsmall);margin-inline-end:var(--guit-ref-spacing-3xsmall)}.textLink__icon_after{-webkit-margin-start:var(--guit-ref-spacing-3xsmall);margin-inline-start:var(--guit-ref-spacing-3xsmall)}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -9,10 +9,10 @@ interface IHelperTextProps {
|
|
|
9
9
|
size?: "medium" | "small";
|
|
10
10
|
/**
|
|
11
11
|
* Specifies the type of the helper text. <br>
|
|
12
|
-
* Possible values: `rest |
|
|
13
|
-
* `rest` for default information, `
|
|
12
|
+
* Possible values: `rest | error | warning`.
|
|
13
|
+
* `rest` for default information, `error` for error messages, or `warning` for cautions.
|
|
14
14
|
*/
|
|
15
|
-
type?: "rest" | "
|
|
15
|
+
type?: "rest" | "error" | "warning";
|
|
16
16
|
/**
|
|
17
17
|
* The actual text content to be displayed as helper text.
|
|
18
18
|
* This provides guidance or additional information related to the input field.
|
|
@@ -20,7 +20,7 @@ interface IHelperTextProps {
|
|
|
20
20
|
text: string;
|
|
21
21
|
/**
|
|
22
22
|
* Optional. Icon to be displayed alongside the helper text.
|
|
23
|
-
* If the `type` prop is set to `
|
|
23
|
+
* If the `type` prop is set to `error` or `warning`, a default icon will be used (ErrorAlertFill for `error` and WarningFill for `warning`) unless an `Icon` is explicitly provided.
|
|
24
24
|
* If `type` is `rest`, the provided `Icon` will be used (if supplied), otherwise no icon will be displayed.
|
|
25
25
|
* The size of the icon will automatically adjust based on the `size` prop (`small` or `medium`).
|
|
26
26
|
*/
|
|
@@ -30,11 +30,6 @@ interface IHelperTextProps {
|
|
|
30
30
|
* If `true`, the helper text will appear dimmed and non-interactive.
|
|
31
31
|
*/
|
|
32
32
|
isDisabled?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Indicates whether the component is in a loading state.
|
|
35
|
-
* When `true`, a loading skeleton is displayed instead of the actual helper text.
|
|
36
|
-
*/
|
|
37
|
-
isLoading?: boolean;
|
|
38
33
|
/**
|
|
39
34
|
* Additional class for the parent element.
|
|
40
35
|
* This prop should be used to set placement properties for the element relative to its parent using BEM conventions.
|
|
@@ -32,6 +32,11 @@ interface ILabelProps {
|
|
|
32
32
|
* When set to `true` a `skeleton` indicator will be shown instead of the `label` text.
|
|
33
33
|
*/
|
|
34
34
|
isLoading?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Indicates whether the `label` should be read-only.
|
|
37
|
+
* This prop will not make visual changes but sets `pointer-events: auto` to prevent triggering label click events.
|
|
38
|
+
*/
|
|
39
|
+
readOnly?: boolean;
|
|
35
40
|
/**
|
|
36
41
|
* Additional class for the parent element.
|
|
37
42
|
* This prop should be used to set placement properties for the element relative to its parent using BEM conventions.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { FC, UIEvent, ReactNode } from "react";
|
|
2
|
+
import "./Scrollbar.scss";
|
|
3
|
+
interface IScrollbarProps {
|
|
4
|
+
/**
|
|
5
|
+
* Additional class for the parent element.
|
|
6
|
+
* This prop should be used to set placement properties for the element relative to its parent using BEM conventions.
|
|
7
|
+
*/
|
|
8
|
+
className?: string;
|
|
9
|
+
/**
|
|
10
|
+
*The content to be rendered inside the scrollable area.
|
|
11
|
+
*/
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Automatically scrolls the container to a specific vertical position (in pixels).
|
|
15
|
+
*/
|
|
16
|
+
autoScrollTopTo?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Automatically scrolls the container to a specific horizontal position (in pixels).
|
|
19
|
+
*/
|
|
20
|
+
autoScrollLeftTo?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Callback function triggered during scroll events. Receives the scroll event as an argument.
|
|
23
|
+
*/
|
|
24
|
+
onScroll?: (e: UIEvent<HTMLDivElement>) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Custom height for the scrollable container.<br>
|
|
27
|
+
* Default is 100%.<br>
|
|
28
|
+
* Possible values: `any valid css value`
|
|
29
|
+
*/
|
|
30
|
+
customHeight?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Custom width for the scrollable container.<br>
|
|
33
|
+
* Default is 100%.<br>
|
|
34
|
+
* Possible values: `any valid css value`
|
|
35
|
+
*/
|
|
36
|
+
customWidth?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Scrollbar is a UI element that allows users to navigate through content that extends beyond the visible area of a container or window. It typically appears along the right side or bottom of the viewport, providing a draggable handle and directional arrows for vertical or horizontal scrolling, enabling users to access all available content.
|
|
40
|
+
*/
|
|
41
|
+
declare const Scrollbar: FC<IScrollbarProps>;
|
|
42
|
+
export { IScrollbarProps, Scrollbar as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { IScrollbarProps, default } from "./Scrollbar";
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ChangeEvent, FC, FocusEvent } from "react";
|
|
2
|
+
import "./Checkbox.scss";
|
|
3
|
+
interface ICheckboxProps {
|
|
4
|
+
/**
|
|
5
|
+
* The text displayed as the label for the checkbox, describing its purpose or function.
|
|
6
|
+
*/
|
|
7
|
+
label?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Toggles the label's and HelperText position between above or beside the checkbox.
|
|
10
|
+
*/
|
|
11
|
+
vertical?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Specifies whether the checkbox is mandatory for completing a form.
|
|
14
|
+
*/
|
|
15
|
+
required?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Disables the checkbox, preventing it from being interacted with.
|
|
18
|
+
*/
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Displays the checkbox as read-only, where users cannot modify its value.
|
|
22
|
+
*/
|
|
23
|
+
readOnly?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Activates a visual state indicating partial selection within a checkbox group.
|
|
26
|
+
*/
|
|
27
|
+
indeterminate?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Manages the checked state of the checkbox in a controlled way.
|
|
30
|
+
*/
|
|
31
|
+
checked?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Automatically focuses the checkbox when the component mounts.
|
|
34
|
+
*/
|
|
35
|
+
autoFocus?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Extra information displayed with the label for clarity or guidance.
|
|
38
|
+
*/
|
|
39
|
+
infoText?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Helper text to provide context or explain any errors, warnings related to the checkbox.
|
|
42
|
+
*/
|
|
43
|
+
helperText?: string;
|
|
44
|
+
/**
|
|
45
|
+
* The initial checked state of the checkbox before user interaction.
|
|
46
|
+
*/
|
|
47
|
+
defaultChecked?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Determines the checkboxes appearance based on its status.<br>
|
|
50
|
+
* Possible values: `rest | warning | error`
|
|
51
|
+
*/
|
|
52
|
+
type?: "rest" | "warning" | "error";
|
|
53
|
+
/**
|
|
54
|
+
* HTML name attribute for the input element.<br>
|
|
55
|
+
* A unique identifier for the checkbox within a form.
|
|
56
|
+
*/
|
|
57
|
+
name?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Fires when the user changes the checkbox state. Provides the change event as a callback's argument.
|
|
60
|
+
*/
|
|
61
|
+
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
62
|
+
/**
|
|
63
|
+
* Event handler for when the checkbox input element loses focus. Provides the focus event as a callback's argument.
|
|
64
|
+
*/
|
|
65
|
+
onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
66
|
+
/**
|
|
67
|
+
* Event handler for when the checkbox input element receives focus. Provides the focus event as a callback's argument.
|
|
68
|
+
*/
|
|
69
|
+
onFocus?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Additional class for the parent element.
|
|
72
|
+
* This prop should be used to set placement properties for the element relative to its parent using BEM conventions.
|
|
73
|
+
*/
|
|
74
|
+
className?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Checkbox component allows users to select one or more options from a set of choices. Each checkbox can be either checked or unchecked, indicating a binary state. Checkboxes are commonly used in forms, settings, and lists where multiple selections are needed.
|
|
78
|
+
*/
|
|
79
|
+
declare const Checkbox: FC<ICheckboxProps>;
|
|
80
|
+
export { ICheckboxProps, Checkbox as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ICheckboxProps, default } from "./Checkbox";
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
declare const useDebouncedCallback: <T extends (...args: unknown[]) => void>(func: T, wait?: number) =>
|
|
1
|
+
declare const useDebouncedCallback: <T extends (...args: unknown[]) => void>(func: T, wait?: number) => {
|
|
2
|
+
debouncedCallback: (...args: unknown[]) => void;
|
|
3
|
+
clearDebounce: () => void;
|
|
4
|
+
};
|
|
2
5
|
export default useDebouncedCallback;
|
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 Scrollbar } from "./components/atoms/Scrollbar";
|
|
9
10
|
export { default as Tooltip } from "./components/molecules/Tooltip";
|
|
10
11
|
export { default as ProgressBar } from "./components/molecules/ProgressBar";
|
|
11
12
|
export { default as GeneUIProvider, GeneUIDesignSystemContext, IGeneUIDesignSystemContext, IGeneUIProviderProps } from "./components/providers/GeneUIProvider";
|
package/index.js
CHANGED
|
@@ -6,12 +6,15 @@ 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 Scrollbar } from './Scrollbar.js';
|
|
9
10
|
export { default as Tooltip } from './Tooltip.js';
|
|
10
11
|
export { default as ProgressBar } from './ProgressBar.js';
|
|
11
12
|
export { GeneUIDesignSystemContext, default as GeneUIProvider } from './GeneUIProvider.js';
|
|
12
|
-
export { u as useDebounce
|
|
13
|
+
export { u as useDebounce } from './useDebounceCallback-999deae7.js';
|
|
14
|
+
export { u as useEllipsisDetection } from './useEllipsisDetection-e545ae62.js';
|
|
13
15
|
import 'react';
|
|
14
16
|
import './index-ce02421b.js';
|
|
15
17
|
import './ArrowLeft-b88e2ba8.js';
|
|
16
18
|
import './style-inject.es-746bb8ed.js';
|
|
19
|
+
import 'prop-types';
|
|
17
20
|
import 'react-dom';
|
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-8abb102-14012025",
|
|
5
5
|
"author": "SoftConstruct",
|
|
6
6
|
"homepage": "https://github.com/softconstruct/gene-ui-components#readme",
|
|
7
7
|
"repository": {
|
|
@@ -168,7 +168,8 @@
|
|
|
168
168
|
"@geneui/icons": "^1.0.4",
|
|
169
169
|
"@geneui/tokens": "^1.8.0-beta",
|
|
170
170
|
"classnames": "^2.3.2",
|
|
171
|
-
"react-is": "^17.0.2"
|
|
171
|
+
"react-is": "^17.0.2",
|
|
172
|
+
"react-scrollbars-custom": "^4.1.1"
|
|
172
173
|
},
|
|
173
174
|
"husky": {
|
|
174
175
|
"hooks": {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useRef, useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
const useDebouncedCallback = (func, wait) => {
|
|
4
|
+
const timeout = useRef(undefined);
|
|
5
|
+
const waitTime = wait === undefined ? 0 : wait;
|
|
6
|
+
const debouncedCallback = useCallback((...args) => {
|
|
7
|
+
const later = () => {
|
|
8
|
+
clearTimeout(timeout.current);
|
|
9
|
+
func(...args);
|
|
10
|
+
};
|
|
11
|
+
clearTimeout(timeout.current);
|
|
12
|
+
timeout.current = window.setTimeout(later, waitTime);
|
|
13
|
+
}, [func, waitTime]);
|
|
14
|
+
const clearDebounce = useCallback(() => {
|
|
15
|
+
if (timeout.current !== undefined) {
|
|
16
|
+
clearTimeout(timeout.current);
|
|
17
|
+
timeout.current = undefined;
|
|
18
|
+
}
|
|
19
|
+
}, []);
|
|
20
|
+
return { debouncedCallback, clearDebounce };
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { useDebouncedCallback as u };
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const useDebouncedCallback = (func, wait) => {
|
|
4
|
-
const timeout = useRef(undefined);
|
|
5
|
-
return useCallback((...args) => {
|
|
6
|
-
const later = () => {
|
|
7
|
-
clearTimeout(timeout.current);
|
|
8
|
-
func(...args);
|
|
9
|
-
};
|
|
10
|
-
clearTimeout(timeout.current);
|
|
11
|
-
timeout.current = window.setTimeout(later, wait);
|
|
12
|
-
}, [func, wait]);
|
|
13
|
-
};
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { u as useDebouncedCallback } from './useDebounceCallback-999deae7.js';
|
|
14
3
|
|
|
15
4
|
const EQUAL_HEIGHT_DIFF = 3;
|
|
16
5
|
const useEllipsisDetection = (ref, externalDependencies = []) => {
|
|
@@ -23,12 +12,12 @@ const useEllipsisDetection = (ref, externalDependencies = []) => {
|
|
|
23
12
|
setIsTruncated(scrollWidth > clientWidth || scrollHeight > clientHeight + EQUAL_HEIGHT_DIFF);
|
|
24
13
|
};
|
|
25
14
|
useEffect(() => handleResize(), [...externalDependencies]);
|
|
26
|
-
const
|
|
15
|
+
const { debouncedCallback } = useDebouncedCallback(handleResize, 100);
|
|
27
16
|
useEffect(() => {
|
|
28
|
-
window.addEventListener("resize",
|
|
29
|
-
return () => window.removeEventListener("resize",
|
|
17
|
+
window.addEventListener("resize", debouncedCallback);
|
|
18
|
+
return () => window.removeEventListener("resize", debouncedCallback);
|
|
30
19
|
}, [(_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.scrollWidth, (_b = ref === null || ref === void 0 ? void 0 : ref.current) === null || _b === void 0 ? void 0 : _b.clientWidth, (_c = ref === null || ref === void 0 ? void 0 : ref.current) === null || _c === void 0 ? void 0 : _c.scrollHeight, (_d = ref === null || ref === void 0 ? void 0 : ref.current) === null || _d === void 0 ? void 0 : _d.clientHeight]);
|
|
31
20
|
return isTruncated;
|
|
32
21
|
};
|
|
33
22
|
|
|
34
|
-
export { useEllipsisDetection as
|
|
23
|
+
export { useEllipsisDetection as u };
|