colibri-ui 0.8.97 → 0.8.99
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/Accordion/index.js +4 -2
- package/Accordion/index.props.d.ts +2 -1
- package/Avatar/index.js +2 -5
- package/Avatar/index.props.d.ts +2 -1
- package/Badge/Control/index.props.d.ts +2 -1
- package/Badge/index.js +1 -2
- package/Button/index.js +0 -1
- package/Checkbox/index.js +4 -2
- package/Checkbox/index.props.d.ts +2 -1
- package/Chip/index.js +2 -4
- package/Chip/index.props.d.ts +2 -2
- package/ColorPicker/ColorPicker.d.ts +1 -1
- package/ColorPicker/ColorPicker.js +4 -2
- package/ColorPicker/index.props.d.ts +2 -1
- package/Counter/index.js +4 -2
- package/Counter/index.props.d.ts +2 -1
- package/Datepicker/index.d.ts +1 -1
- package/Datepicker/index.js +5 -3
- package/Datepicker/index.props.d.ts +2 -1
- package/DotsLoader/index.js +5 -2
- package/DotsLoader/index.props.d.ts +2 -1
- package/Dropdown/index.js +2 -2
- package/Dropdown/index.props.d.ts +2 -1
- package/Grid/index.js +3 -1
- package/Grid/index.props.d.ts +2 -1
- package/InputRadio/index.js +3 -3
- package/InputRadio/index.props.d.ts +2 -2
- package/Menu/components/MenuItem/index.js +0 -1
- package/Menu/components/MenuItem/index.props.d.ts +2 -1
- package/Menu/index.d.ts +1 -1
- package/Menu/index.js +4 -2
- package/Menu/index.props.d.ts +2 -1
- package/Modal/index.js +3 -1
- package/Modal/index.props.d.ts +2 -1
- package/MultiSelect/index.js +3 -1
- package/NavigationMenu/NavigationMenu.d.ts +3 -0
- package/NavigationMenu/NavigationMenu.js +170 -0
- package/NavigationMenu/NavigationMenu.module.css +67 -0
- package/NavigationMenu/components/MoreMenu/MoreMenu.module.css +19 -0
- package/NavigationMenu/components/MoreMenu/index.d.ts +16 -0
- package/NavigationMenu/components/MoreMenu/index.js +155 -0
- package/NavigationMenu/components/NavigationLink/NavigationLink.module.css +59 -0
- package/NavigationMenu/components/NavigationLink/index.d.ts +16 -0
- package/NavigationMenu/components/NavigationLink/index.js +51 -0
- package/NavigationMenu/helpers.d.ts +9 -0
- package/NavigationMenu/helpers.js +20 -0
- package/NavigationMenu/index.d.ts +2 -0
- package/NavigationMenu/index.js +7 -0
- package/NavigationMenu/index.props.d.ts +40 -0
- package/NavigationMenu/package.json +9 -0
- package/NavigationMenu/splitItems.d.ts +30 -0
- package/NavigationMenu/splitItems.js +54 -0
- package/NavigationMenu/useOverflowSplit.d.ts +25 -0
- package/NavigationMenu/useOverflowSplit.js +63 -0
- package/RadioGroup/Radio.js +2 -2
- package/RadioGroup/index.js +1 -1
- package/RadioGroup/index.props.d.ts +1 -1
- package/Select/index.d.ts +1 -1
- package/Select/index.js +4 -3
- package/Separator/index.js +6 -4
- package/Separator/index.props.d.ts +2 -1
- package/Skeleton/index.js +6 -2
- package/Skeleton/index.props.d.ts +3 -2
- package/Status/index.d.ts +1 -1
- package/Status/index.js +3 -1
- package/Status/index.props.d.ts +2 -1
- package/TextArea/index.js +0 -1
- package/Theme/index.d.ts +8 -0
- package/Theme/themes/buenos_aires.d.ts +4 -0
- package/Theme/themes/buenos_aires.js +4 -0
- package/Theme/themes/jaipur.d.ts +4 -0
- package/Theme/themes/jaipur.js +4 -0
- package/TimeSelect/index.js +3 -1
- package/Tooltip/index.js +3 -1
- package/Tooltip/index.props.d.ts +2 -1
- package/base/FormField/index.d.ts +1 -1
- package/base/FormField/index.js +4 -2
- package/base/FormField/index.props.d.ts +2 -1
- package/esm/Accordion/index.js +4 -2
- package/esm/Accordion/index.props.d.ts +2 -1
- package/esm/Avatar/index.js +2 -5
- package/esm/Avatar/index.props.d.ts +2 -1
- package/esm/Badge/Control/index.props.d.ts +2 -1
- package/esm/Badge/index.js +1 -2
- package/esm/Button/index.js +0 -1
- package/esm/Checkbox/index.js +4 -2
- package/esm/Checkbox/index.props.d.ts +2 -1
- package/esm/Chip/index.js +2 -4
- package/esm/Chip/index.props.d.ts +2 -2
- package/esm/ColorPicker/ColorPicker.d.ts +1 -1
- package/esm/ColorPicker/ColorPicker.js +4 -2
- package/esm/ColorPicker/index.props.d.ts +2 -1
- package/esm/Counter/index.js +4 -2
- package/esm/Counter/index.props.d.ts +2 -1
- package/esm/Datepicker/index.d.ts +1 -1
- package/esm/Datepicker/index.js +5 -3
- package/esm/Datepicker/index.props.d.ts +2 -1
- package/esm/DotsLoader/index.js +5 -2
- package/esm/DotsLoader/index.props.d.ts +2 -1
- package/esm/Dropdown/index.js +2 -2
- package/esm/Dropdown/index.props.d.ts +2 -1
- package/esm/Grid/index.js +3 -1
- package/esm/Grid/index.props.d.ts +2 -1
- package/esm/InputRadio/index.js +3 -3
- package/esm/InputRadio/index.props.d.ts +2 -2
- package/esm/Menu/components/MenuItem/index.js +0 -1
- package/esm/Menu/components/MenuItem/index.props.d.ts +2 -1
- package/esm/Menu/index.d.ts +1 -1
- package/esm/Menu/index.js +4 -2
- package/esm/Menu/index.props.d.ts +2 -1
- package/esm/Modal/index.js +3 -1
- package/esm/Modal/index.props.d.ts +2 -1
- package/esm/MultiSelect/index.js +3 -1
- package/esm/NavigationMenu/NavigationMenu.d.ts +3 -0
- package/esm/NavigationMenu/NavigationMenu.js +162 -0
- package/esm/NavigationMenu/NavigationMenu.module.css +67 -0
- package/esm/NavigationMenu/components/MoreMenu/MoreMenu.module.css +19 -0
- package/esm/NavigationMenu/components/MoreMenu/index.d.ts +16 -0
- package/esm/NavigationMenu/components/MoreMenu/index.js +147 -0
- package/esm/NavigationMenu/components/NavigationLink/NavigationLink.module.css +59 -0
- package/esm/NavigationMenu/components/NavigationLink/index.d.ts +16 -0
- package/esm/NavigationMenu/components/NavigationLink/index.js +41 -0
- package/esm/NavigationMenu/helpers.d.ts +9 -0
- package/esm/NavigationMenu/helpers.js +15 -0
- package/esm/NavigationMenu/index.d.ts +2 -0
- package/esm/NavigationMenu/index.js +1 -0
- package/esm/NavigationMenu/index.props.d.ts +40 -0
- package/esm/NavigationMenu/splitItems.d.ts +30 -0
- package/esm/NavigationMenu/splitItems.js +51 -0
- package/esm/NavigationMenu/useOverflowSplit.d.ts +25 -0
- package/esm/NavigationMenu/useOverflowSplit.js +61 -0
- package/esm/RadioGroup/Radio.js +2 -2
- package/esm/RadioGroup/index.js +1 -1
- package/esm/RadioGroup/index.props.d.ts +1 -1
- package/esm/Select/index.d.ts +1 -1
- package/esm/Select/index.js +4 -3
- package/esm/Separator/index.js +6 -4
- package/esm/Separator/index.props.d.ts +2 -1
- package/esm/Skeleton/index.js +6 -2
- package/esm/Skeleton/index.props.d.ts +3 -2
- package/esm/Status/index.d.ts +1 -1
- package/esm/Status/index.js +3 -1
- package/esm/Status/index.props.d.ts +2 -1
- package/esm/TextArea/index.js +0 -1
- package/esm/Theme/index.d.ts +8 -0
- package/esm/Theme/themes/buenos_aires.d.ts +4 -0
- package/esm/Theme/themes/buenos_aires.js +4 -0
- package/esm/Theme/themes/jaipur.d.ts +4 -0
- package/esm/Theme/themes/jaipur.js +4 -0
- package/esm/TimeSelect/index.js +3 -1
- package/esm/Tooltip/index.js +3 -1
- package/esm/Tooltip/index.props.d.ts +2 -1
- package/esm/base/FormField/index.d.ts +1 -1
- package/esm/base/FormField/index.js +4 -2
- package/esm/base/FormField/index.props.d.ts +2 -1
- package/esm/helpers/testId.d.ts +18 -0
- package/esm/index.d.ts +3 -0
- package/esm/index.js +1 -0
- package/esm/theme_ba_variables.css +4 -0
- package/esm/theme_jaipur_variables.css +4 -0
- package/helpers/testId.d.ts +18 -0
- package/index.d.ts +3 -0
- package/index.js +3 -0
- package/package.json +1 -1
- package/theme_ba_variables.css +4 -0
- package/theme_jaipur_variables.css +4 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface SplitInput {
|
|
2
|
+
itemWidths: number[];
|
|
3
|
+
/** Pinned items are always visible and go after the main items. */
|
|
4
|
+
pinnedWidths: number[];
|
|
5
|
+
moreWidth: number;
|
|
6
|
+
containerWidth: number;
|
|
7
|
+
/** CSS gap between items. */
|
|
8
|
+
gap: number;
|
|
9
|
+
/** Index of the active item or -1. */
|
|
10
|
+
activeIndex: number;
|
|
11
|
+
/** "More" is needed anyway, for example for `moreItems`. */
|
|
12
|
+
forceMore: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface SplitResult {
|
|
15
|
+
/** Indexes of the items left in the row, in the original order. */
|
|
16
|
+
visible: number[];
|
|
17
|
+
/** Indexes of the items moved to "More", in the original order. */
|
|
18
|
+
hidden: number[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Splits items into the row and "More".
|
|
22
|
+
*
|
|
23
|
+
* Items go from left to right while they fit; the first one that does not fit
|
|
24
|
+
* and all after it move to "More". Space for the active item is reserved
|
|
25
|
+
* first, so it stays in the row and its neighbours move instead. Every element
|
|
26
|
+
* costs its width plus gap; the budget has one extra gap because N elements
|
|
27
|
+
* have N − 1 gaps.
|
|
28
|
+
*/
|
|
29
|
+
export declare const splitItems: ({ itemWidths, pinnedWidths, moreWidth, containerWidth, gap, activeIndex, forceMore, }: SplitInput) => SplitResult;
|
|
30
|
+
export declare const isSameSplit: (a: SplitResult, b: SplitResult) => boolean;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const sum = list => list.reduce((acc, n) => acc + n, 0);
|
|
4
|
+
/**
|
|
5
|
+
* Splits items into the row and "More".
|
|
6
|
+
*
|
|
7
|
+
* Items go from left to right while they fit; the first one that does not fit
|
|
8
|
+
* and all after it move to "More". Space for the active item is reserved
|
|
9
|
+
* first, so it stays in the row and its neighbours move instead. Every element
|
|
10
|
+
* costs its width plus gap; the budget has one extra gap because N elements
|
|
11
|
+
* have N − 1 gaps.
|
|
12
|
+
*/
|
|
13
|
+
const splitItems = ({
|
|
14
|
+
itemWidths,
|
|
15
|
+
pinnedWidths,
|
|
16
|
+
moreWidth,
|
|
17
|
+
containerWidth,
|
|
18
|
+
gap,
|
|
19
|
+
activeIndex,
|
|
20
|
+
forceMore
|
|
21
|
+
}) => {
|
|
22
|
+
const all = itemWidths.map((_, index) => index);
|
|
23
|
+
const cost = width => width + gap;
|
|
24
|
+
const pinnedCost = sum(pinnedWidths.map(cost));
|
|
25
|
+
if (!forceMore && sum(itemWidths.map(cost)) + pinnedCost <= containerWidth + gap) {
|
|
26
|
+
return {
|
|
27
|
+
visible: all,
|
|
28
|
+
hidden: []
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const hasActive = activeIndex >= 0 && activeIndex < itemWidths.length;
|
|
32
|
+
let budget = containerWidth + gap - pinnedCost - cost(moreWidth);
|
|
33
|
+
if (hasActive) budget -= cost(itemWidths[activeIndex]);
|
|
34
|
+
const visible = [];
|
|
35
|
+
for (let index = 0; index < itemWidths.length; index++) {
|
|
36
|
+
if (index === activeIndex) continue;
|
|
37
|
+
if (cost(itemWidths[index]) > budget) break;
|
|
38
|
+
budget -= cost(itemWidths[index]);
|
|
39
|
+
visible.push(index);
|
|
40
|
+
}
|
|
41
|
+
if (hasActive) {
|
|
42
|
+
visible.push(activeIndex);
|
|
43
|
+
visible.sort((a, b) => a - b);
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
visible,
|
|
47
|
+
hidden: all.filter(index => !visible.includes(index))
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
const isSameList = (a, b) => a.length === b.length && a.every((index, position) => index === b[position]);
|
|
51
|
+
const isSameSplit = (a, b) => isSameList(a.visible, b.visible) && isSameList(a.hidden, b.hidden);
|
|
52
|
+
|
|
53
|
+
exports.isSameSplit = isSameSplit;
|
|
54
|
+
exports.splitItems = splitItems;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { SplitResult } from "./splitItems";
|
|
2
|
+
interface Options {
|
|
3
|
+
itemCount: number;
|
|
4
|
+
pinnedCount: number;
|
|
5
|
+
activeIndex: number;
|
|
6
|
+
forceMore: boolean;
|
|
7
|
+
/** Changes with the item labels to recalculate. */
|
|
8
|
+
contentKey: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Measures the items and splits them into the row and "More".
|
|
12
|
+
*
|
|
13
|
+
* Widths come from a hidden measurer that always renders every item, so the
|
|
14
|
+
* items inside "More" are measured too, for example after a web font loads.
|
|
15
|
+
* ResizeObserver watches the container, the measurer and the "More" trigger.
|
|
16
|
+
* Before the first measurement, and on the server, `split` is `null`.
|
|
17
|
+
*/
|
|
18
|
+
export declare const useOverflowSplit: ({ itemCount, pinnedCount, activeIndex, forceMore, contentKey, }: Options) => {
|
|
19
|
+
split: SplitResult | null;
|
|
20
|
+
containerRef: import("react").RefObject<HTMLElement | null>;
|
|
21
|
+
listRef: import("react").RefObject<HTMLUListElement | null>;
|
|
22
|
+
measurerRef: import("react").RefObject<HTMLDivElement | null>;
|
|
23
|
+
moreRef: import("react").RefObject<HTMLLIElement | null>;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var helpers = require('./helpers.js');
|
|
5
|
+
var splitItems = require('./splitItems.js');
|
|
6
|
+
|
|
7
|
+
const getWidth = element => element ? element.getBoundingClientRect().width : 0;
|
|
8
|
+
/**
|
|
9
|
+
* Measures the items and splits them into the row and "More".
|
|
10
|
+
*
|
|
11
|
+
* Widths come from a hidden measurer that always renders every item, so the
|
|
12
|
+
* items inside "More" are measured too, for example after a web font loads.
|
|
13
|
+
* ResizeObserver watches the container, the measurer and the "More" trigger.
|
|
14
|
+
* Before the first measurement, and on the server, `split` is `null`.
|
|
15
|
+
*/
|
|
16
|
+
const useOverflowSplit = ({
|
|
17
|
+
itemCount,
|
|
18
|
+
pinnedCount,
|
|
19
|
+
activeIndex,
|
|
20
|
+
forceMore,
|
|
21
|
+
contentKey
|
|
22
|
+
}) => {
|
|
23
|
+
const containerRef = React.useRef(null);
|
|
24
|
+
const listRef = React.useRef(null);
|
|
25
|
+
const measurerRef = React.useRef(null);
|
|
26
|
+
const moreRef = React.useRef(null);
|
|
27
|
+
const [split, setSplit] = React.useState(null);
|
|
28
|
+
helpers.useIsomorphicLayoutEffect(() => {
|
|
29
|
+
const container = containerRef.current;
|
|
30
|
+
const measurer = measurerRef.current;
|
|
31
|
+
if (!container || !measurer) return undefined;
|
|
32
|
+
const recalculate = () => {
|
|
33
|
+
const widths = Array.from(measurer.children, getWidth);
|
|
34
|
+
const gap = listRef.current ? parseFloat(getComputedStyle(listRef.current).columnGap) || 0 : 0;
|
|
35
|
+
const next = splitItems.splitItems({
|
|
36
|
+
itemWidths: widths.slice(0, itemCount),
|
|
37
|
+
pinnedWidths: widths.slice(itemCount, itemCount + pinnedCount),
|
|
38
|
+
moreWidth: getWidth(moreRef.current),
|
|
39
|
+
containerWidth: getWidth(container),
|
|
40
|
+
gap,
|
|
41
|
+
activeIndex,
|
|
42
|
+
forceMore
|
|
43
|
+
});
|
|
44
|
+
setSplit(prev => prev && splitItems.isSameSplit(prev, next) ? prev : next);
|
|
45
|
+
};
|
|
46
|
+
recalculate();
|
|
47
|
+
if (typeof ResizeObserver === "undefined") return undefined;
|
|
48
|
+
const observer = new ResizeObserver(recalculate);
|
|
49
|
+
observer.observe(container);
|
|
50
|
+
observer.observe(measurer);
|
|
51
|
+
if (moreRef.current) observer.observe(moreRef.current);
|
|
52
|
+
return () => observer.disconnect();
|
|
53
|
+
}, [itemCount, pinnedCount, activeIndex, forceMore, contentKey]);
|
|
54
|
+
return {
|
|
55
|
+
split,
|
|
56
|
+
containerRef,
|
|
57
|
+
listRef,
|
|
58
|
+
measurerRef,
|
|
59
|
+
moreRef
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports.useOverflowSplit = useOverflowSplit;
|
package/RadioGroup/Radio.js
CHANGED
|
@@ -20,7 +20,7 @@ const Radio = ({
|
|
|
20
20
|
onMouseEnter,
|
|
21
21
|
className,
|
|
22
22
|
disabled = false,
|
|
23
|
-
testId
|
|
23
|
+
"data-testid": testId
|
|
24
24
|
}) => (/*#__PURE__*/React__default.default.createElement(index.InputRadio, {
|
|
25
25
|
id: id,
|
|
26
26
|
value: value,
|
|
@@ -34,7 +34,7 @@ const Radio = ({
|
|
|
34
34
|
name: name,
|
|
35
35
|
className: className,
|
|
36
36
|
disabled: disabled,
|
|
37
|
-
testid: testId
|
|
37
|
+
"data-testid": testId
|
|
38
38
|
}));
|
|
39
39
|
|
|
40
40
|
exports.Radio = Radio;
|
package/RadioGroup/index.js
CHANGED
package/Select/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { JSX } from "react";
|
|
2
2
|
import type { SelectProps } from "./index.props";
|
|
3
|
-
export declare const Select: <T extends string>({ options, value, name, zIndex, fontSize, label, hint, hasError, required, placeholder, disabled, size, fullWidth, customInputRoot, className, onChange, "aria-label": ariaLabel, }: SelectProps<T>) => JSX.Element;
|
|
3
|
+
export declare const Select: <T extends string>({ options, value, name, zIndex, fontSize, label, hint, hasError, required, placeholder, disabled, size, fullWidth, customInputRoot, className, onChange, "aria-label": ariaLabel, "data-testid": testId, }: SelectProps<T>) => JSX.Element;
|
package/Select/index.js
CHANGED
|
@@ -32,7 +32,8 @@ const Select = ({
|
|
|
32
32
|
customInputRoot,
|
|
33
33
|
className,
|
|
34
34
|
onChange,
|
|
35
|
-
"aria-label": ariaLabel
|
|
35
|
+
"aria-label": ariaLabel,
|
|
36
|
+
"data-testid": testId
|
|
36
37
|
}) => {
|
|
37
38
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
38
39
|
const id = React.useId();
|
|
@@ -56,6 +57,7 @@ const Select = ({
|
|
|
56
57
|
}) => selected)) === null || _a === void 0 ? void 0 : _a.label;
|
|
57
58
|
}, [preparedOptions]);
|
|
58
59
|
return /*#__PURE__*/React__default.default.createElement(index.FormField, {
|
|
60
|
+
"data-testid": testId,
|
|
59
61
|
className: clsx__default.default(styles__default.default["form-field"], {
|
|
60
62
|
[styles__default.default["full-width"]]: Boolean(fullWidth)
|
|
61
63
|
}, className),
|
|
@@ -104,8 +106,7 @@ const Select = ({
|
|
|
104
106
|
disabled: Boolean(disabled)
|
|
105
107
|
}, /*#__PURE__*/React__default.default.createElement("div", {
|
|
106
108
|
id: valueId,
|
|
107
|
-
className: styles__default.default["base-input"]
|
|
108
|
-
"data-testid": "base-input"
|
|
109
|
+
className: styles__default.default["base-input"]
|
|
109
110
|
}, preparedLabel !== null && preparedLabel !== void 0 ? preparedLabel : (/*#__PURE__*/React__default.default.createElement("span", {
|
|
110
111
|
className: styles__default.default.placeholder
|
|
111
112
|
}, placeholder))), /*#__PURE__*/React__default.default.createElement("input", {
|
package/Separator/index.js
CHANGED
|
@@ -11,9 +11,11 @@ var clsx__default = /*#__PURE__*/_interopDefault(clsx);
|
|
|
11
11
|
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
12
12
|
|
|
13
13
|
const Separator = ({
|
|
14
|
-
className
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
className,
|
|
15
|
+
"data-testid": testId
|
|
16
|
+
}) => /*#__PURE__*/React__default.default.createElement("div", {
|
|
17
|
+
className: clsx__default.default(styles__default.default.root, className),
|
|
18
|
+
"data-testid": testId
|
|
19
|
+
});
|
|
18
20
|
|
|
19
21
|
exports.Separator = Separator;
|
package/Skeleton/index.js
CHANGED
|
@@ -15,9 +15,11 @@ const SkeletonRect = ({
|
|
|
15
15
|
className,
|
|
16
16
|
width,
|
|
17
17
|
height,
|
|
18
|
-
radius = "sm"
|
|
18
|
+
radius = "sm",
|
|
19
|
+
"data-testid": testId
|
|
19
20
|
}) => (/*#__PURE__*/React__default.default.createElement("div", {
|
|
20
21
|
className: clsx__default.default(styles__default.default.rect, className),
|
|
22
|
+
"data-testid": testId,
|
|
21
23
|
style: {
|
|
22
24
|
width: toRemLength(width),
|
|
23
25
|
height: toRemLength(height),
|
|
@@ -27,9 +29,11 @@ const SkeletonRect = ({
|
|
|
27
29
|
const SkeletonText = ({
|
|
28
30
|
className,
|
|
29
31
|
width,
|
|
30
|
-
size
|
|
32
|
+
size,
|
|
33
|
+
"data-testid": testId
|
|
31
34
|
}) => (/*#__PURE__*/React__default.default.createElement("div", {
|
|
32
35
|
className: clsx__default.default(styles__default.default.text, className),
|
|
36
|
+
"data-testid": testId,
|
|
33
37
|
style: {
|
|
34
38
|
width: toRemLength(width),
|
|
35
39
|
height: toRemLength(size)
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import type { TestIdProps } from "../helpers/testId";
|
|
2
|
+
export type TextProps = TestIdProps & {
|
|
2
3
|
className?: string;
|
|
3
4
|
width?: number | string;
|
|
4
5
|
size?: number | string;
|
|
5
6
|
};
|
|
6
|
-
export type RectProps = {
|
|
7
|
+
export type RectProps = TestIdProps & {
|
|
7
8
|
className?: string;
|
|
8
9
|
width?: number | string;
|
|
9
10
|
height?: number | string;
|
package/Status/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { PropsWithChildren } from "react";
|
|
3
3
|
import type { StatusProps } from "./index.props";
|
|
4
|
-
export declare const Status: ({ className, indicator, showIndicator, tag: Component, children, type, }: PropsWithChildren<StatusProps>) => React.JSX.Element;
|
|
4
|
+
export declare const Status: ({ className, indicator, showIndicator, tag: Component, children, type, "data-testid": testId, }: PropsWithChildren<StatusProps>) => React.JSX.Element;
|
package/Status/index.js
CHANGED
|
@@ -16,8 +16,10 @@ const Status = ({
|
|
|
16
16
|
showIndicator = true,
|
|
17
17
|
tag: Component = "span",
|
|
18
18
|
children,
|
|
19
|
-
type
|
|
19
|
+
type,
|
|
20
|
+
"data-testid": testId
|
|
20
21
|
}) => (/*#__PURE__*/React__default.default.createElement(Component, {
|
|
22
|
+
"data-testid": testId,
|
|
21
23
|
className: clsx__default.default(styles__default.default.root, {
|
|
22
24
|
[styles__default.default[`root_${type}`]]: Boolean(type)
|
|
23
25
|
}, className)
|
package/Status/index.props.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
import type { TestIdProps } from "../helpers/testId";
|
|
2
3
|
export type StatusTag = "span" | "div";
|
|
3
4
|
export declare enum STATUS_TYPE {
|
|
4
5
|
SUCCESS = "success",
|
|
@@ -6,7 +7,7 @@ export declare enum STATUS_TYPE {
|
|
|
6
7
|
INFO = "info",
|
|
7
8
|
WARNING = "warning"
|
|
8
9
|
}
|
|
9
|
-
export type StatusProps = {
|
|
10
|
+
export type StatusProps = TestIdProps & {
|
|
10
11
|
className?: string;
|
|
11
12
|
indicator?: ReactNode;
|
|
12
13
|
showIndicator?: boolean;
|
package/TextArea/index.js
CHANGED
|
@@ -53,7 +53,6 @@ const TextArea = _a => {
|
|
|
53
53
|
hasError: hasError
|
|
54
54
|
}, /*#__PURE__*/React__default.default.createElement(TextareaAutosize__default.default, Object.assign({
|
|
55
55
|
ref: inputRef,
|
|
56
|
-
"data-testid": "textarea",
|
|
57
56
|
disabled: disabled,
|
|
58
57
|
minRows: minRows,
|
|
59
58
|
maxRows: maxRows,
|
package/Theme/index.d.ts
CHANGED
|
@@ -692,7 +692,11 @@ export declare const THEMES: {
|
|
|
692
692
|
"component-pagination-bg-current": string;
|
|
693
693
|
"component-pagination-bg-hover": string;
|
|
694
694
|
"component-pagination-focus-ring": string;
|
|
695
|
+
"component-navigation-item-text": string;
|
|
696
|
+
"component-navigation-item-text-selected": string;
|
|
697
|
+
"component-navigation-item-bg-hover": string;
|
|
695
698
|
"component-navigation-item-bg-selected": string;
|
|
699
|
+
"component-navigation-item-focus-ring": string;
|
|
696
700
|
"component-chip-bg-selected": string;
|
|
697
701
|
"component-chip-bg-selected-strong": string;
|
|
698
702
|
"palette-black": string;
|
|
@@ -1536,7 +1540,11 @@ export declare const THEMES: {
|
|
|
1536
1540
|
"component-pagination-bg-current": string;
|
|
1537
1541
|
"component-pagination-bg-hover": string;
|
|
1538
1542
|
"component-pagination-focus-ring": string;
|
|
1543
|
+
"component-navigation-item-text": string;
|
|
1544
|
+
"component-navigation-item-text-selected": string;
|
|
1545
|
+
"component-navigation-item-bg-hover": string;
|
|
1539
1546
|
"component-navigation-item-bg-selected": string;
|
|
1547
|
+
"component-navigation-item-focus-ring": string;
|
|
1540
1548
|
"component-chip-bg-selected": string;
|
|
1541
1549
|
"component-chip-bg-selected-strong": string;
|
|
1542
1550
|
"palette-black": string;
|
|
@@ -613,7 +613,11 @@ declare const _default: {
|
|
|
613
613
|
"component-pagination-bg-current": string;
|
|
614
614
|
"component-pagination-bg-hover": string;
|
|
615
615
|
"component-pagination-focus-ring": string;
|
|
616
|
+
"component-navigation-item-text": string;
|
|
617
|
+
"component-navigation-item-text-selected": string;
|
|
618
|
+
"component-navigation-item-bg-hover": string;
|
|
616
619
|
"component-navigation-item-bg-selected": string;
|
|
620
|
+
"component-navigation-item-focus-ring": string;
|
|
617
621
|
"component-chip-bg-selected": string;
|
|
618
622
|
"component-chip-bg-selected-strong": string;
|
|
619
623
|
"palette-black": string;
|
|
@@ -619,7 +619,11 @@ var THEME_BA = {
|
|
|
619
619
|
"component-pagination-bg-current": theme_buenos_aires.default.BRAND_BA_FOREST,
|
|
620
620
|
"component-pagination-bg-hover": theme_buenos_aires.default.NEUTRAL_BA_100,
|
|
621
621
|
"component-pagination-focus-ring": theme_buenos_aires.default.BRAND_BA_LIME,
|
|
622
|
+
"component-navigation-item-text": theme_buenos_aires.default.BRAND_BA_FOREST,
|
|
623
|
+
"component-navigation-item-text-selected": theme_buenos_aires.default.BRAND_BA_LIME,
|
|
624
|
+
"component-navigation-item-bg-hover": theme_buenos_aires.default.NEUTRAL_BA_100,
|
|
622
625
|
"component-navigation-item-bg-selected": theme_buenos_aires.default.BRAND_BA_FOREST,
|
|
626
|
+
"component-navigation-item-focus-ring": theme_buenos_aires.default.BRAND_BA_LIME,
|
|
623
627
|
"component-chip-bg-selected": theme_buenos_aires.default.BRAND_BA_FOREST,
|
|
624
628
|
"component-chip-bg-selected-strong": theme_buenos_aires.default.BRAND_BA_LIME,
|
|
625
629
|
"palette-black": theme_buenos_aires.default.BRAND_BA_FOREST,
|
package/Theme/themes/jaipur.d.ts
CHANGED
|
@@ -613,7 +613,11 @@ declare const _default: {
|
|
|
613
613
|
"component-pagination-bg-current": string;
|
|
614
614
|
"component-pagination-bg-hover": string;
|
|
615
615
|
"component-pagination-focus-ring": string;
|
|
616
|
+
"component-navigation-item-text": string;
|
|
617
|
+
"component-navigation-item-text-selected": string;
|
|
618
|
+
"component-navigation-item-bg-hover": string;
|
|
616
619
|
"component-navigation-item-bg-selected": string;
|
|
620
|
+
"component-navigation-item-focus-ring": string;
|
|
617
621
|
"component-chip-bg-selected": string;
|
|
618
622
|
"component-chip-bg-selected-strong": string;
|
|
619
623
|
"palette-black": string;
|
package/Theme/themes/jaipur.js
CHANGED
|
@@ -619,7 +619,11 @@ var theme_jaipur = {
|
|
|
619
619
|
"component-pagination-bg-current": theme_jaipur$1.default.BRAND_JP_EGGPLANT,
|
|
620
620
|
"component-pagination-bg-hover": theme_jaipur$1.default.NEUTRAL_JP_100,
|
|
621
621
|
"component-pagination-focus-ring": theme_jaipur$1.default.BRAND_JP_PINK,
|
|
622
|
+
"component-navigation-item-text": theme_jaipur$1.default.BRAND_JP_EGGPLANT,
|
|
623
|
+
"component-navigation-item-text-selected": theme_jaipur$1.default.BRAND_JP_PINK,
|
|
624
|
+
"component-navigation-item-bg-hover": theme_jaipur$1.default.NEUTRAL_JP_100,
|
|
622
625
|
"component-navigation-item-bg-selected": theme_jaipur$1.default.BRAND_JP_EGGPLANT,
|
|
626
|
+
"component-navigation-item-focus-ring": theme_jaipur$1.default.BRAND_JP_PINK,
|
|
623
627
|
"component-chip-bg-selected": theme_jaipur$1.default.BRAND_JP_EGGPLANT,
|
|
624
628
|
"component-chip-bg-selected-strong": theme_jaipur$1.default.BRAND_JP_PINK,
|
|
625
629
|
"palette-black": theme_jaipur$1.default.BRAND_JP_EGGPLANT,
|
package/TimeSelect/index.js
CHANGED
|
@@ -29,7 +29,8 @@ const TimeSelect = ({
|
|
|
29
29
|
zIndex,
|
|
30
30
|
hasError,
|
|
31
31
|
hint,
|
|
32
|
-
"aria-label": ariaLabel
|
|
32
|
+
"aria-label": ariaLabel,
|
|
33
|
+
"data-testid": testId
|
|
33
34
|
}) => {
|
|
34
35
|
const baseOptions = React.useMemo(() => helpers.generateSuggest(interval).map(item => ({
|
|
35
36
|
value: item.time,
|
|
@@ -45,6 +46,7 @@ const TimeSelect = ({
|
|
|
45
46
|
}), [baseOptions, currentDate, selectedDate, allowedTimeRange, interval]);
|
|
46
47
|
return /*#__PURE__*/React__default.default.createElement(index$1.Select, {
|
|
47
48
|
"aria-label": ariaLabel,
|
|
49
|
+
"data-testid": testId,
|
|
48
50
|
className: className,
|
|
49
51
|
customInputRoot: customInputRoot,
|
|
50
52
|
fontSize: fontSize,
|
package/Tooltip/index.js
CHANGED
|
@@ -18,7 +18,8 @@ const Tooltip = ({
|
|
|
18
18
|
withTail = false,
|
|
19
19
|
placement = "bottom",
|
|
20
20
|
strategy = "absolute",
|
|
21
|
-
className
|
|
21
|
+
className,
|
|
22
|
+
"data-testid": testId
|
|
22
23
|
}) => {
|
|
23
24
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
24
25
|
const arrowRef = React.useRef(null);
|
|
@@ -66,6 +67,7 @@ const Tooltip = ({
|
|
|
66
67
|
ref: refs.setFloating
|
|
67
68
|
}, getFloatingProps(), {
|
|
68
69
|
className: clsx__default.default(styles__default.default.tooltip, className),
|
|
70
|
+
"data-testid": testId,
|
|
69
71
|
style: Object.assign(Object.assign({}, floatingStyles), {
|
|
70
72
|
zIndex
|
|
71
73
|
})
|
package/Tooltip/index.props.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Placement, Strategy } from "@floating-ui/react";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
|
-
|
|
3
|
+
import type { PopupTestIdProps } from "../helpers/testId";
|
|
4
|
+
export type TooltipProps = PopupTestIdProps & {
|
|
4
5
|
content: ReactNode;
|
|
5
6
|
zIndex?: number;
|
|
6
7
|
placement?: Placement;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { FormFieldProps } from "./index.props";
|
|
3
|
-
export declare const FormField: ({ label, hint, children, hasError, hintId, htmlFor, labelId, required, className, ref, }: FormFieldProps) => React.JSX.Element;
|
|
3
|
+
export declare const FormField: ({ label, hint, children, hasError, hintId, htmlFor, labelId, required, className, ref, "data-testid": testId, }: FormFieldProps) => React.JSX.Element;
|
package/base/FormField/index.js
CHANGED
|
@@ -21,10 +21,12 @@ const FormField = ({
|
|
|
21
21
|
labelId,
|
|
22
22
|
required,
|
|
23
23
|
className,
|
|
24
|
-
ref
|
|
24
|
+
ref,
|
|
25
|
+
"data-testid": testId
|
|
25
26
|
}) => (/*#__PURE__*/React__default.default.createElement("div", {
|
|
26
27
|
className: clsx__default.default(styles__default.default.container, className),
|
|
27
|
-
ref: ref
|
|
28
|
+
ref: ref,
|
|
29
|
+
"data-testid": testId
|
|
28
30
|
}, label && (/*#__PURE__*/React__default.default.createElement(index.Typography, {
|
|
29
31
|
className: clsx__default.default(styles__default.default.label, {
|
|
30
32
|
[styles__default.default.label_required]: Boolean(required)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { PropsWithChildren } from "react";
|
|
3
|
-
|
|
3
|
+
import type { TestIdProps } from "../../helpers/testId";
|
|
4
|
+
export type FormFieldProps = PropsWithChildren<TestIdProps & {
|
|
4
5
|
className?: string;
|
|
5
6
|
hasError?: boolean;
|
|
6
7
|
hint?: ReactNode;
|
package/esm/Accordion/index.js
CHANGED
|
@@ -11,7 +11,8 @@ const Accordion = ({
|
|
|
11
11
|
children,
|
|
12
12
|
className,
|
|
13
13
|
tabIndex,
|
|
14
|
-
defaultOpen = false
|
|
14
|
+
defaultOpen = false,
|
|
15
|
+
"data-testid": testId
|
|
15
16
|
}) => {
|
|
16
17
|
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
17
18
|
const contentRef = useRef(null);
|
|
@@ -35,7 +36,8 @@ const Accordion = ({
|
|
|
35
36
|
return () => observer.disconnect();
|
|
36
37
|
}, [isOpen]);
|
|
37
38
|
return /*#__PURE__*/React.createElement("div", {
|
|
38
|
-
className: clsx(styles.root, className)
|
|
39
|
+
className: clsx(styles.root, className),
|
|
40
|
+
"data-testid": testId
|
|
39
41
|
}, /*#__PURE__*/React.createElement("div", {
|
|
40
42
|
className: styles.header
|
|
41
43
|
}, /*#__PURE__*/React.createElement("button", {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PropsWithChildren, ReactNode } from "react";
|
|
2
|
-
|
|
2
|
+
import type { TestIdProps } from "../helpers/testId";
|
|
3
|
+
export type AccordionProps = PropsWithChildren<TestIdProps & {
|
|
3
4
|
title: ReactNode;
|
|
4
5
|
className?: string;
|
|
5
6
|
boldTitle?: boolean;
|
package/esm/Avatar/index.js
CHANGED
|
@@ -84,7 +84,6 @@ const Avatar = /*#__PURE__*/memo(props => {
|
|
|
84
84
|
})
|
|
85
85
|
}, onClick && roleProps), /*#__PURE__*/React.createElement("img", Object.assign({
|
|
86
86
|
ref: ref,
|
|
87
|
-
"data-testid": "avatar",
|
|
88
87
|
alt: alt,
|
|
89
88
|
src: src,
|
|
90
89
|
className: clsx(styles.avatar, {
|
|
@@ -94,8 +93,7 @@ const Avatar = /*#__PURE__*/memo(props => {
|
|
|
94
93
|
}
|
|
95
94
|
if (hasInitials) {
|
|
96
95
|
return /*#__PURE__*/React.createElement("span", Object.assign({
|
|
97
|
-
ref: ref
|
|
98
|
-
"data-testid": "avatar"
|
|
96
|
+
ref: ref
|
|
99
97
|
}, roleProps, {
|
|
100
98
|
className: clsx(styles["avatar-initials"], {
|
|
101
99
|
[styles["avatar-bordered"]]: Boolean(bordered),
|
|
@@ -106,8 +104,7 @@ const Avatar = /*#__PURE__*/memo(props => {
|
|
|
106
104
|
}, initials.trim().slice(0, 2)));
|
|
107
105
|
}
|
|
108
106
|
return /*#__PURE__*/React.createElement("span", Object.assign({
|
|
109
|
-
ref: ref
|
|
110
|
-
"data-testid": "avatar"
|
|
107
|
+
ref: ref
|
|
111
108
|
}, roleProps, {
|
|
112
109
|
className: clsx(styles["avatar-stub"], {
|
|
113
110
|
[styles["avatar-bordered"]]: Boolean(bordered),
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { AvatarSize } from "./constants";
|
|
2
|
+
import type { TestIdProps } from "../helpers/testId";
|
|
2
3
|
export declare enum AccountType {
|
|
3
4
|
Person = "person",
|
|
4
5
|
Organization = "org"
|
|
5
6
|
}
|
|
6
|
-
export type AvatarProps = {
|
|
7
|
+
export type AvatarProps = TestIdProps & {
|
|
7
8
|
accountType?: AccountType;
|
|
8
9
|
alt?: string;
|
|
9
10
|
size?: AvatarSize;
|
package/esm/Badge/index.js
CHANGED
|
@@ -24,8 +24,7 @@ const Badge = _a => {
|
|
|
24
24
|
className: clsx(styles.root, {
|
|
25
25
|
[styles[`root_direction_${direction}`]]: Boolean(direction),
|
|
26
26
|
[styles["root_invisible"]]: Boolean(invisible)
|
|
27
|
-
}, className)
|
|
28
|
-
"data-testid": "badge"
|
|
27
|
+
}, className)
|
|
29
28
|
}, displayValue)));
|
|
30
29
|
};
|
|
31
30
|
|
package/esm/Button/index.js
CHANGED
|
@@ -30,7 +30,6 @@ const Button = _a => {
|
|
|
30
30
|
[styles[`variant_${variant}_disabled`]]: Boolean(disabled)
|
|
31
31
|
}, className),
|
|
32
32
|
disabled: disabled,
|
|
33
|
-
"data-testid": "button",
|
|
34
33
|
type: type || "button"
|
|
35
34
|
}, props), icon && /*#__PURE__*/React.createElement("span", {
|
|
36
35
|
className: styles.icon
|
package/esm/Checkbox/index.js
CHANGED
|
@@ -16,9 +16,11 @@ const Checkbox = ({
|
|
|
16
16
|
variant = "primary",
|
|
17
17
|
className,
|
|
18
18
|
disabled,
|
|
19
|
-
hasError
|
|
19
|
+
hasError,
|
|
20
|
+
"data-testid": testId
|
|
20
21
|
}) => (/*#__PURE__*/React.createElement("div", {
|
|
21
|
-
className: styles.root
|
|
22
|
+
className: styles.root,
|
|
23
|
+
"data-testid": testId
|
|
22
24
|
}, /*#__PURE__*/React.createElement("label", {
|
|
23
25
|
className: styles.label,
|
|
24
26
|
htmlFor: id
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { FocusEvent, ChangeEvent, ReactNode } from "react";
|
|
2
|
-
|
|
2
|
+
import type { TestIdProps } from "../helpers/testId";
|
|
3
|
+
export interface CheckboxProps extends TestIdProps {
|
|
3
4
|
checked?: boolean;
|
|
4
5
|
className?: string;
|
|
5
6
|
disabled?: boolean;
|