@geneui/components 3.0.0-next-e4a45f6-19012026 → 3.0.0-next-9f2ce92-09022026
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 +2 -20
- package/CheckboxGroup.js +1 -0
- package/CounterField-f877af71.js +4 -0
- package/CounterField.js +138 -0
- package/InteractiveCard.js +1 -0
- package/Minus-c3ff7a21.js +23 -0
- package/Navigation.js +2 -20
- package/Pagination.js +6 -6
- package/Plus-f0726053.js +23 -0
- package/SegmentedControl.js +1 -0
- package/components/molecules/CounterField/CounterField.d.ts +101 -0
- package/components/molecules/CounterField/index.d.ts +1 -0
- package/helpers/clampValue.d.ts +20 -0
- package/helpers/index.d.ts +1 -0
- package/index.d.ts +1 -0
- package/index.js +4 -0
- package/package.json +1 -1
package/Checkbox.js
CHANGED
|
@@ -2,10 +2,11 @@ import React__default, { useRef, useMemo, useState, useEffect } from 'react';
|
|
|
2
2
|
import { c as classNames } from './index-ce02421b.js';
|
|
3
3
|
import { n as nanoid } from './index-15303b91.js';
|
|
4
4
|
import { S as SvgCheckMark } from './CheckMark-34798545.js';
|
|
5
|
-
import {
|
|
5
|
+
import { S as SvgMinus } from './Minus-c3ff7a21.js';
|
|
6
6
|
import HelperText from './HelperText.js';
|
|
7
7
|
import Label from './Label.js';
|
|
8
8
|
import './Checkbox-97cbe910.js';
|
|
9
|
+
import './ActivityRecent-b88e2ba8.js';
|
|
9
10
|
import './ErrorFilled-f4226310.js';
|
|
10
11
|
import './TriangleAlert-ba250f4c.js';
|
|
11
12
|
import './Text.js';
|
|
@@ -22,25 +23,6 @@ import './useDebounceCallback-999deae7.js';
|
|
|
22
23
|
import './useDeviceInfo-8340f573.js';
|
|
23
24
|
import './useEllipsisDetection-c5f9b175.js';
|
|
24
25
|
|
|
25
|
-
var _excluded = ["size", "color"];
|
|
26
|
-
var SvgMinus = function SvgMinus(_ref) {
|
|
27
|
-
var _ref$size = _ref.size,
|
|
28
|
-
size = _ref$size === void 0 ? 24 : _ref$size,
|
|
29
|
-
_ref$color = _ref.color,
|
|
30
|
-
color = _ref$color === void 0 ? "currentColor" : _ref$color,
|
|
31
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
-
return /*#__PURE__*/React__default.createElement("svg", _extends({
|
|
33
|
-
width: size,
|
|
34
|
-
height: size,
|
|
35
|
-
viewBox: "0 0 24 24",
|
|
36
|
-
fill: color,
|
|
37
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
38
|
-
}, props), /*#__PURE__*/React__default.createElement("path", {
|
|
39
|
-
d: "M20.153 12.75h-16.306a.905.905 0 0 1-.599-.22.71.71 0 0 1-.248-.53c0-.199.09-.39.248-.53a.905.905 0 0 1 .599-.22h16.306c.225 0 .44.079.599.22a.71.71 0 0 1 .248.53.71.71 0 0 1-.248.53.905.905 0 0 1-.599.22Z",
|
|
40
|
-
fill: color
|
|
41
|
-
}));
|
|
42
|
-
};
|
|
43
|
-
|
|
44
26
|
/**
|
|
45
27
|
* 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.
|
|
46
28
|
*/
|
package/CheckboxGroup.js
CHANGED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { s as styleInject } from './style-inject.es-746bb8ed.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = ".counterField{display:flex;flex-direction:column;gap:var(--guit-ref-spacing-3xsmall)}.counterField__inputContainer{display:flex}.counterField__inputContainer,.counterField__inputContainer_size_large,.counterField__inputContainer_size_medium{gap:var(--guit-ref-spacing-xsmall)}.counterField__inputContainer_size_small{gap:var(--guit-ref-spacing-3xsmall)}.counterField__input_size_large,.counterField__input_size_medium{width:var(--guit-ref-sizing-4xlarge)}.counterField__input_size_small{width:6rem}";
|
|
4
|
+
styleInject(css_248z);
|
package/CounterField.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import React__default, { useState, useRef, useMemo } from 'react';
|
|
2
|
+
import { c as classNames } from './index-ce02421b.js';
|
|
3
|
+
import { n as nanoid } from './index-15303b91.js';
|
|
4
|
+
import { S as SvgMinus } from './Minus-c3ff7a21.js';
|
|
5
|
+
import { S as SvgPlus } from './Plus-f0726053.js';
|
|
6
|
+
import Button from './Button.js';
|
|
7
|
+
import HelperText from './HelperText.js';
|
|
8
|
+
import Label from './Label.js';
|
|
9
|
+
import { T as TextField } from './index-36803db8.js';
|
|
10
|
+
import './CounterField-f877af71.js';
|
|
11
|
+
import './ActivityRecent-b88e2ba8.js';
|
|
12
|
+
import './Loader.js';
|
|
13
|
+
import './style-inject.es-746bb8ed.js';
|
|
14
|
+
import './ErrorFilled-f4226310.js';
|
|
15
|
+
import './TriangleAlert-ba250f4c.js';
|
|
16
|
+
import './Text.js';
|
|
17
|
+
import './Info.js';
|
|
18
|
+
import './Info-0f0741e0.js';
|
|
19
|
+
import './Tooltip.js';
|
|
20
|
+
import './floating-ui.react-a6c3b969.js';
|
|
21
|
+
import 'react-dom';
|
|
22
|
+
import './index-a2688a52.js';
|
|
23
|
+
import './index-00cd8fab.js';
|
|
24
|
+
import './useWindowSize-6faa0d0f.js';
|
|
25
|
+
import './useDebounceCallback-999deae7.js';
|
|
26
|
+
import './useDeviceInfo-8340f573.js';
|
|
27
|
+
import './useEllipsisDetection-c5f9b175.js';
|
|
28
|
+
import './X-20da3b4a.js';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Clamps a numeric value to be within the specified minimum and maximum bounds.
|
|
32
|
+
* If the value is undefined, returns an empty string.
|
|
33
|
+
* If the value is not a finite number, returns the original value as a string.
|
|
34
|
+
*
|
|
35
|
+
* @param value - The value to clamp (can be a number or string representation of a number)
|
|
36
|
+
* @param min - The minimum allowed value (optional)
|
|
37
|
+
* @param max - The maximum allowed value (optional)
|
|
38
|
+
* @returns A string representation of the clamped value, or empty string if value is undefined
|
|
39
|
+
* @example
|
|
40
|
+
* clampValue(50, 0, 100) // "50"
|
|
41
|
+
* clampValue(150, 0, 100) // "100"
|
|
42
|
+
* clampValue(-10, 0, 100) // "0"
|
|
43
|
+
* clampValue(50, 0) // "50"
|
|
44
|
+
* clampValue(50, undefined, 100) // "50"
|
|
45
|
+
* clampValue(undefined) // ""
|
|
46
|
+
* clampValue("abc") // "abc" (non-finite, returns as-is)
|
|
47
|
+
*/
|
|
48
|
+
const clampValue = (value, min, max) => {
|
|
49
|
+
if (value === undefined)
|
|
50
|
+
return "";
|
|
51
|
+
const numericValue = Number(value);
|
|
52
|
+
if (!Number.isFinite(numericValue))
|
|
53
|
+
return String(value);
|
|
54
|
+
let clamped = numericValue;
|
|
55
|
+
if (min !== undefined && clamped < min) {
|
|
56
|
+
clamped = min;
|
|
57
|
+
}
|
|
58
|
+
if (max !== undefined && clamped > max) {
|
|
59
|
+
clamped = max;
|
|
60
|
+
}
|
|
61
|
+
return String(clamped);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The Counter Field component is an input field designed to increment or decrement a numerical value.
|
|
66
|
+
* It typically includes buttons for increasing or decreasing the count and can be configured to accept user input directly.
|
|
67
|
+
*/
|
|
68
|
+
const CounterField = ({ label, infoText, required, disabled, readOnly, helperText, ariaLabelIncrement = "Increment value", ariaLabelDecrement = "Decrement value", status = "rest", value, defaultValue = 0, id, onChange, onInputBlur, onInputFocus, step = 1, min, max, size = "medium", className, autoFocus }) => {
|
|
69
|
+
const isControlled = value !== undefined;
|
|
70
|
+
const [internalStringValue, setInternalStringValue] = useState(() => !isControlled ? clampValue(defaultValue, min, max) : "");
|
|
71
|
+
const hasClampedControlledValue = useRef(false);
|
|
72
|
+
const getCurrentStringValue = () => {
|
|
73
|
+
if (isControlled) {
|
|
74
|
+
if (!hasClampedControlledValue.current) {
|
|
75
|
+
hasClampedControlledValue.current = true;
|
|
76
|
+
return clampValue(value, min, max);
|
|
77
|
+
}
|
|
78
|
+
return String(value !== null && value !== void 0 ? value : "");
|
|
79
|
+
}
|
|
80
|
+
return internalStringValue;
|
|
81
|
+
};
|
|
82
|
+
const currentStringValue = getCurrentStringValue();
|
|
83
|
+
const numericValue = Number(currentStringValue);
|
|
84
|
+
const validNumericValue = Number.isFinite(numericValue) ? numericValue : 0;
|
|
85
|
+
const handleValueChange = (stepValue, event) => {
|
|
86
|
+
const nextValue = validNumericValue + stepValue;
|
|
87
|
+
let clampedValue = nextValue;
|
|
88
|
+
if (stepValue > 0 && max !== undefined) {
|
|
89
|
+
clampedValue = Math.min(nextValue, max);
|
|
90
|
+
}
|
|
91
|
+
else if (stepValue < 0 && min !== undefined) {
|
|
92
|
+
clampedValue = Math.max(nextValue, min);
|
|
93
|
+
}
|
|
94
|
+
const nextValueString = String(clampedValue);
|
|
95
|
+
if (!isControlled) {
|
|
96
|
+
setInternalStringValue(nextValueString);
|
|
97
|
+
}
|
|
98
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(nextValueString, event);
|
|
99
|
+
};
|
|
100
|
+
const handleInputChange = (event) => {
|
|
101
|
+
const inputValue = event.target.value;
|
|
102
|
+
if (!isControlled) {
|
|
103
|
+
setInternalStringValue(inputValue);
|
|
104
|
+
}
|
|
105
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(inputValue, event);
|
|
106
|
+
};
|
|
107
|
+
const handleButtonClick = (event, type) => handleValueChange(type === "increment" ? step : -step, event);
|
|
108
|
+
const inputId = useMemo(() => id || `default-id-${nanoid()}`, [id]);
|
|
109
|
+
const onFocusHandler = (e) => onInputFocus === null || onInputFocus === void 0 ? void 0 : onInputFocus(e);
|
|
110
|
+
const onBlurHandler = (e) => {
|
|
111
|
+
const inputValue = e.target.value;
|
|
112
|
+
const clampedValueString = clampValue(inputValue, min, max);
|
|
113
|
+
if (clampedValueString !== inputValue) {
|
|
114
|
+
if (!isControlled) {
|
|
115
|
+
setInternalStringValue(clampedValueString);
|
|
116
|
+
}
|
|
117
|
+
const syntheticEvent = Object.assign(Object.assign({}, e), { target: Object.assign(Object.assign({}, e.target), { value: clampedValueString }) });
|
|
118
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(clampedValueString, syntheticEvent);
|
|
119
|
+
}
|
|
120
|
+
onInputBlur === null || onInputBlur === void 0 ? void 0 : onInputBlur(e);
|
|
121
|
+
};
|
|
122
|
+
const buttonsDisabled = useMemo(() => {
|
|
123
|
+
const baseDisabled = disabled || readOnly;
|
|
124
|
+
return {
|
|
125
|
+
increment: baseDisabled || (max !== undefined && validNumericValue >= max),
|
|
126
|
+
decrement: baseDisabled || (min !== undefined && validNumericValue <= min)
|
|
127
|
+
};
|
|
128
|
+
}, [disabled, readOnly, max, min, validNumericValue]);
|
|
129
|
+
return (React__default.createElement("div", { className: classNames("counterField", className), "aria-required": required, "aria-invalid": status === "error" },
|
|
130
|
+
React__default.createElement(Label, { text: label, required: required, disabled: disabled, readOnly: readOnly, infoText: infoText, size: size === "large" ? "medium" : size, labelFor: inputId }),
|
|
131
|
+
React__default.createElement("div", { className: classNames("counterField__inputContainer", `counterField__inputContainer_size_${size}`) },
|
|
132
|
+
React__default.createElement(Button, { appearance: "secondary", className: "counterField__button", layout: "fill", size: size, Icon: SvgMinus, disabled: buttonsDisabled.decrement, "aria-label": ariaLabelDecrement, onClick: (event) => handleButtonClick(event, "decrement") }),
|
|
133
|
+
React__default.createElement(TextField, { id: inputId, type: "number", autoComplete: "off", onBlur: onBlurHandler, onFocus: onFocusHandler, onChange: handleInputChange, className: classNames("counterField__input", `counterField__input_size_${size}`), size: size, value: currentStringValue, disabled: disabled, readOnly: readOnly, status: status, autoFocus: autoFocus }),
|
|
134
|
+
React__default.createElement(Button, { appearance: "secondary", className: "counterField__button", layout: "fill", size: size, Icon: SvgPlus, disabled: buttonsDisabled.increment, "aria-label": ariaLabelIncrement, onClick: (event) => handleButtonClick(event, "increment") })),
|
|
135
|
+
helperText && (React__default.createElement(HelperText, { text: helperText, disabled: disabled, status: status, className: "counterField__helperText" }))));
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export { CounterField as default };
|
package/InteractiveCard.js
CHANGED
|
@@ -24,6 +24,7 @@ import './CircleFilled-19a9ec62.js';
|
|
|
24
24
|
import './Pill-37549eff.js';
|
|
25
25
|
import './index-15303b91.js';
|
|
26
26
|
import './CheckMark-34798545.js';
|
|
27
|
+
import './Minus-c3ff7a21.js';
|
|
27
28
|
import './HelperText.js';
|
|
28
29
|
import './ErrorFilled-f4226310.js';
|
|
29
30
|
import './TriangleAlert-ba250f4c.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { _ as _objectWithoutProperties, a as _extends } from './ActivityRecent-b88e2ba8.js';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
|
|
4
|
+
var _excluded = ["size", "color"];
|
|
5
|
+
var SvgMinus = function SvgMinus(_ref) {
|
|
6
|
+
var _ref$size = _ref.size,
|
|
7
|
+
size = _ref$size === void 0 ? 24 : _ref$size,
|
|
8
|
+
_ref$color = _ref.color,
|
|
9
|
+
color = _ref$color === void 0 ? "currentColor" : _ref$color,
|
|
10
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
11
|
+
return /*#__PURE__*/React__default.createElement("svg", _extends({
|
|
12
|
+
width: size,
|
|
13
|
+
height: size,
|
|
14
|
+
viewBox: "0 0 24 24",
|
|
15
|
+
fill: color,
|
|
16
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
17
|
+
}, props), /*#__PURE__*/React__default.createElement("path", {
|
|
18
|
+
d: "M20.153 12.75h-16.306a.905.905 0 0 1-.599-.22.71.71 0 0 1-.248-.53c0-.199.09-.39.248-.53a.905.905 0 0 1 .599-.22h16.306c.225 0 .44.079.599.22a.71.71 0 0 1 .248.53.71.71 0 0 1-.248.53.905.905 0 0 1-.599.22Z",
|
|
19
|
+
fill: color
|
|
20
|
+
}));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { SvgMinus as S };
|
package/Navigation.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _ as __rest } from './tslib.es6-f211516f.js';
|
|
2
2
|
import React__default, { useState, useRef, useEffect, isValidElement, cloneElement, useLayoutEffect, Fragment, useContext } from 'react';
|
|
3
3
|
import { c as classNames } from './index-ce02421b.js';
|
|
4
|
-
import {
|
|
4
|
+
import { S as SvgPlus } from './Plus-f0726053.js';
|
|
5
5
|
import { S as SvgThreeDotsHorizontal } from './ThreeDotsHorizontal-479c2b4b.js';
|
|
6
6
|
import { S as SvgX } from './X-20da3b4a.js';
|
|
7
7
|
import Button from './Button.js';
|
|
@@ -17,6 +17,7 @@ import { S as Spreadsheet } from './index-43d85235.js';
|
|
|
17
17
|
import './Navigation-20f87966.js';
|
|
18
18
|
import { a as GeneUIDesignSystemContext } from './index-00cd8fab.js';
|
|
19
19
|
import { u as useWindowSize } from './useWindowSize-6faa0d0f.js';
|
|
20
|
+
import './ActivityRecent-b88e2ba8.js';
|
|
20
21
|
import './Loader.js';
|
|
21
22
|
import './style-inject.es-746bb8ed.js';
|
|
22
23
|
import './floating-ui.react-a6c3b969.js';
|
|
@@ -31,25 +32,6 @@ import './Divider.js';
|
|
|
31
32
|
import './Divider-047dfad9.js';
|
|
32
33
|
import './useDeviceInfo-8340f573.js';
|
|
33
34
|
|
|
34
|
-
var _excluded = ["size", "color"];
|
|
35
|
-
var SvgPlus = function SvgPlus(_ref) {
|
|
36
|
-
var _ref$size = _ref.size,
|
|
37
|
-
size = _ref$size === void 0 ? 24 : _ref$size,
|
|
38
|
-
_ref$color = _ref.color,
|
|
39
|
-
color = _ref$color === void 0 ? "currentColor" : _ref$color,
|
|
40
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
41
|
-
return /*#__PURE__*/React__default.createElement("svg", _extends({
|
|
42
|
-
width: size,
|
|
43
|
-
height: size,
|
|
44
|
-
viewBox: "0 0 24 24",
|
|
45
|
-
fill: color,
|
|
46
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
47
|
-
}, props), /*#__PURE__*/React__default.createElement("path", {
|
|
48
|
-
d: "m11.883 3.007.117-.007a1 1 0 0 1 .993.883l.007.117v7h7a1 1 0 0 1 .993.883l.007.117a1 1 0 0 1-.883.993l-.117.007h-7v7a1 1 0 0 1-.883.993l-.117.007a1 1 0 0 1-.993-.883l-.007-.117v-7h-7a1 1 0 0 1-.993-.883l-.007-.117a1 1 0 0 1 .883-.993l.117-.007h7v-7a1 1 0 0 1 .883-.993l.117-.007-.117.007Z",
|
|
49
|
-
fill: color
|
|
50
|
-
}));
|
|
51
|
-
};
|
|
52
|
-
|
|
53
35
|
const NavigationItem = ({ title, children, onClick, disabled, selected, depth, Icon, path, render }) => {
|
|
54
36
|
const [isNavItemOpen, setIsNavItemOpen] = useState(false);
|
|
55
37
|
const textRef = useRef(null);
|
package/Pagination.js
CHANGED
|
@@ -65,12 +65,6 @@ var SvgChevronDoubleRight = function SvgChevronDoubleRight(_ref) {
|
|
|
65
65
|
}));
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
const PaginationButton = ({ onClick, Icon, disabled }) => {
|
|
69
|
-
const [isHovered, setIsHovered] = useState(false);
|
|
70
|
-
return (React__default.createElement("div", { onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false) },
|
|
71
|
-
React__default.createElement(Button, { disabled: disabled, onClick: onClick, onBlur: () => setIsHovered(false), onFocus: () => setIsHovered(true), Icon: isHovered ? Icon : SvgThreeDotsHorizontal, appearance: "secondary", layout: "text" })));
|
|
72
|
-
};
|
|
73
|
-
|
|
74
68
|
/**
|
|
75
69
|
* Validates if a string contains only digits (0-9)
|
|
76
70
|
* Allows empty string
|
|
@@ -83,6 +77,12 @@ const PaginationButton = ({ onClick, Icon, disabled }) => {
|
|
|
83
77
|
*/
|
|
84
78
|
const allowOnlyDigits = (value) => DIGITS_ONLY.test(value);
|
|
85
79
|
|
|
80
|
+
const PaginationButton = ({ onClick, Icon, disabled }) => {
|
|
81
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
82
|
+
return (React__default.createElement("div", { onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false) },
|
|
83
|
+
React__default.createElement(Button, { disabled: disabled, onClick: onClick, onBlur: () => setIsHovered(false), onFocus: () => setIsHovered(true), Icon: isHovered ? Icon : SvgThreeDotsHorizontal, appearance: "secondary", layout: "text" })));
|
|
84
|
+
};
|
|
85
|
+
|
|
86
86
|
/**
|
|
87
87
|
* Helper function to generate the array of page numbers to be displayed.
|
|
88
88
|
* It ensures the current page is centered when possible and handles edge cases.
|
package/Plus-f0726053.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { _ as _objectWithoutProperties, a as _extends } from './ActivityRecent-b88e2ba8.js';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
|
|
4
|
+
var _excluded = ["size", "color"];
|
|
5
|
+
var SvgPlus = function SvgPlus(_ref) {
|
|
6
|
+
var _ref$size = _ref.size,
|
|
7
|
+
size = _ref$size === void 0 ? 24 : _ref$size,
|
|
8
|
+
_ref$color = _ref.color,
|
|
9
|
+
color = _ref$color === void 0 ? "currentColor" : _ref$color,
|
|
10
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
11
|
+
return /*#__PURE__*/React__default.createElement("svg", _extends({
|
|
12
|
+
width: size,
|
|
13
|
+
height: size,
|
|
14
|
+
viewBox: "0 0 24 24",
|
|
15
|
+
fill: color,
|
|
16
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
17
|
+
}, props), /*#__PURE__*/React__default.createElement("path", {
|
|
18
|
+
d: "m11.883 3.007.117-.007a1 1 0 0 1 .993.883l.007.117v7h7a1 1 0 0 1 .993.883l.007.117a1 1 0 0 1-.883.993l-.117.007h-7v7a1 1 0 0 1-.883.993l-.117.007a1 1 0 0 1-.993-.883l-.007-.117v-7h-7a1 1 0 0 1-.993-.883l-.007-.117a1 1 0 0 1 .883-.993l.117-.007h7v-7a1 1 0 0 1 .883-.993l.117-.007-.117.007Z",
|
|
19
|
+
fill: color
|
|
20
|
+
}));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { SvgPlus as S };
|
package/SegmentedControl.js
CHANGED
|
@@ -49,6 +49,7 @@ import './Banner-09cf6dea.js';
|
|
|
49
49
|
import './TagGroup-ab4b6ca3.js';
|
|
50
50
|
import './DataCard-3601ca38.js';
|
|
51
51
|
import './RadioGroup-73d4e527.js';
|
|
52
|
+
import './CounterField-f877af71.js';
|
|
52
53
|
import './CheckboxGroup-44463bd2.js';
|
|
53
54
|
import './Accordion-3e20a13f.js';
|
|
54
55
|
import './InteractiveCard-05c16126.js';
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { ChangeEvent, FC, FocusEvent, MouseEvent } from "react";
|
|
2
|
+
import "./CounterField.scss";
|
|
3
|
+
interface ICounterFieldProps {
|
|
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 value of the counter (controlled).
|
|
11
|
+
* This is what will be returned in onChange and stored as the selected value.<br>
|
|
12
|
+
* Possible values: `number | string`
|
|
13
|
+
*/
|
|
14
|
+
value?: number | string;
|
|
15
|
+
/**
|
|
16
|
+
* The initial value of the counter (uncontrolled).
|
|
17
|
+
*/
|
|
18
|
+
defaultValue?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Disables the counter field, preventing it from being interacted with.
|
|
21
|
+
*/
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Displays the counter field as read-only, where users cannot modify its value.
|
|
25
|
+
*/
|
|
26
|
+
readOnly?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The amount by which the value increases or decreases.
|
|
29
|
+
*/
|
|
30
|
+
step?: number;
|
|
31
|
+
/**
|
|
32
|
+
* The minimum value allowed for the counter.
|
|
33
|
+
* The decrement button will be disabled when the value reaches or is below this minimum.
|
|
34
|
+
*/
|
|
35
|
+
min?: number;
|
|
36
|
+
/**
|
|
37
|
+
* The maximum value allowed for the counter.
|
|
38
|
+
* The increment button will be disabled when the value reaches or exceeds this maximum.
|
|
39
|
+
*/
|
|
40
|
+
max?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Size of the component.<br> Possible values: `small | medium | large`
|
|
43
|
+
*/
|
|
44
|
+
size?: "small" | "medium" | "large";
|
|
45
|
+
/**
|
|
46
|
+
* The status/validation state of the component.<br> Possible values: `rest | warning | error`
|
|
47
|
+
*/
|
|
48
|
+
status?: "rest" | "warning" | "error";
|
|
49
|
+
/**
|
|
50
|
+
* The main label for the counter field.
|
|
51
|
+
*/
|
|
52
|
+
label?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Additional descriptive text that appears alongside the `label`, typically displayed as a tooltip.
|
|
55
|
+
*/
|
|
56
|
+
infoText?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Helper text that appears below the counter field.
|
|
59
|
+
*/
|
|
60
|
+
helperText?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Indicates that the field is required.
|
|
63
|
+
*/
|
|
64
|
+
required?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* The aria label for the increment button.
|
|
67
|
+
*/
|
|
68
|
+
ariaLabelIncrement?: string;
|
|
69
|
+
/**
|
|
70
|
+
* The aria label for the decrement button.
|
|
71
|
+
*/
|
|
72
|
+
ariaLabelDecrement?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Fires when the user changes the counter value (via buttons or input).
|
|
75
|
+
* Receives the raw input string value - parent can convert to number if needed.
|
|
76
|
+
*/
|
|
77
|
+
onChange?: (value: string, event: ChangeEvent<HTMLInputElement> | MouseEvent<HTMLButtonElement>) => void;
|
|
78
|
+
/**
|
|
79
|
+
* Fires when the input field loses focus.
|
|
80
|
+
*/
|
|
81
|
+
onInputBlur?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
82
|
+
/**
|
|
83
|
+
* Fires when the input field receives focus.
|
|
84
|
+
*/
|
|
85
|
+
onInputFocus?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
86
|
+
/**
|
|
87
|
+
* If true, the input element will automatically receive focus when the component mounts.
|
|
88
|
+
* Default value is `false`.
|
|
89
|
+
*/
|
|
90
|
+
autoFocus?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* `HTML` `id` attribute for the `input` element
|
|
93
|
+
*/
|
|
94
|
+
id?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The Counter Field component is an input field designed to increment or decrement a numerical value.
|
|
98
|
+
* It typically includes buttons for increasing or decreasing the count and can be configured to accept user input directly.
|
|
99
|
+
*/
|
|
100
|
+
declare const CounterField: FC<ICounterFieldProps>;
|
|
101
|
+
export { ICounterFieldProps, CounterField as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ICounterFieldProps, default } from "./CounterField";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clamps a numeric value to be within the specified minimum and maximum bounds.
|
|
3
|
+
* If the value is undefined, returns an empty string.
|
|
4
|
+
* If the value is not a finite number, returns the original value as a string.
|
|
5
|
+
*
|
|
6
|
+
* @param value - The value to clamp (can be a number or string representation of a number)
|
|
7
|
+
* @param min - The minimum allowed value (optional)
|
|
8
|
+
* @param max - The maximum allowed value (optional)
|
|
9
|
+
* @returns A string representation of the clamped value, or empty string if value is undefined
|
|
10
|
+
* @example
|
|
11
|
+
* clampValue(50, 0, 100) // "50"
|
|
12
|
+
* clampValue(150, 0, 100) // "100"
|
|
13
|
+
* clampValue(-10, 0, 100) // "0"
|
|
14
|
+
* clampValue(50, 0) // "50"
|
|
15
|
+
* clampValue(50, undefined, 100) // "50"
|
|
16
|
+
* clampValue(undefined) // ""
|
|
17
|
+
* clampValue("abc") // "abc" (non-finite, returns as-is)
|
|
18
|
+
*/
|
|
19
|
+
declare const clampValue: (value?: number | string, min?: number, max?: number) => string;
|
|
20
|
+
export default clampValue;
|
package/helpers/index.d.ts
CHANGED
package/index.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export { default as Banner, IBannerProps } from "./components/molecules/Banner";
|
|
|
45
45
|
export { default as TagGroup, ITagGroupProps } from "./components/molecules/TagGroup";
|
|
46
46
|
export { default as DataCard, IDataCardProps } from "./components/molecules/DataCard";
|
|
47
47
|
export { default as RadioGroup, IRadioGroupProps, IRadioOption } from "./components/molecules/RadioGroup";
|
|
48
|
+
export { default as CounterField, ICounterFieldProps } from "./components/molecules/CounterField";
|
|
48
49
|
export { default as CheckboxGroup, ICheckboxGroupProps, ICheckboxOption } from "./components/molecules/CheckboxGroup";
|
|
49
50
|
export { SegmentedControl, ISegmentedControlProps, SegmentedControlButton, ISegmentedControlButtonProps } from "@components/molecules/SegmentedControl";
|
|
50
51
|
export { Accordion, AccordionItem, IAccordionProps, IAccordionItemProps } from "./components/molecules/Accordion";
|
package/index.js
CHANGED
|
@@ -51,6 +51,7 @@ export { default as Banner } from './Banner.js';
|
|
|
51
51
|
export { default as TagGroup } from './TagGroup.js';
|
|
52
52
|
export { default as DataCard } from './DataCard.js';
|
|
53
53
|
export { default as RadioGroup } from './RadioGroup.js';
|
|
54
|
+
export { default as CounterField } from './CounterField.js';
|
|
54
55
|
export { default as CheckboxGroup } from './CheckboxGroup.js';
|
|
55
56
|
export { SegmentedControl, SegmentedControlButton } from './SegmentedControl.js';
|
|
56
57
|
export { AccordionItem } from './Accordion.js';
|
|
@@ -98,7 +99,9 @@ import './QRCode-4620857a.js';
|
|
|
98
99
|
import './tslib.es6-f211516f.js';
|
|
99
100
|
import './index-15303b91.js';
|
|
100
101
|
import './ThreeDotsHorizontal-479c2b4b.js';
|
|
102
|
+
import './Plus-f0726053.js';
|
|
101
103
|
import './Navigation-20f87966.js';
|
|
104
|
+
import './Minus-c3ff7a21.js';
|
|
102
105
|
import './Checkbox-97cbe910.js';
|
|
103
106
|
import './Radio-deba611e.js';
|
|
104
107
|
import './Profile-e9e508cb.js';
|
|
@@ -111,6 +114,7 @@ import './ChevronDown-ee53f094.js';
|
|
|
111
114
|
import './TagGroup-ab4b6ca3.js';
|
|
112
115
|
import './DataCard-3601ca38.js';
|
|
113
116
|
import './RadioGroup-73d4e527.js';
|
|
117
|
+
import './CounterField-f877af71.js';
|
|
114
118
|
import './CheckboxGroup-44463bd2.js';
|
|
115
119
|
import './InteractiveCard-05c16126.js';
|
|
116
120
|
import './GlobalHeader-e3be2af9.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-9f2ce92-09022026",
|
|
5
5
|
"author": "SoftConstruct",
|
|
6
6
|
"homepage": "https://github.com/softconstruct/gene-ui-components#readme",
|
|
7
7
|
"repository": {
|