@aivenio/aquarium 0.0.1 → 1.0.0
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/dist/_variables.scss +2 -1
- package/dist/_variables_timescale.scss +2 -1
- package/dist/atoms.cjs +1 -0
- package/dist/atoms.mjs +1 -0
- package/dist/src/common/Section/Section.d.ts +14 -0
- package/dist/src/common/Section/Section.js +46 -0
- package/dist/src/common/Typography/Typography.d.ts +1 -1
- package/dist/src/components/Box/Box.d.ts +1 -1
- package/dist/src/components/DataTable/DataTable.js +7 -4
- package/dist/src/components/List/List.d.ts +1 -1
- package/dist/src/components/MultiInput/MultiInput.d.ts +2 -1
- package/dist/src/components/MultiInput/MultiInput.js +3 -3
- package/dist/src/components/Pagination/usePagination.d.ts +42 -0
- package/dist/src/components/Pagination/usePagination.js +34 -0
- package/dist/src/components/Section/Section.d.ts +13 -0
- package/dist/src/components/Section/Section.js +31 -0
- package/dist/src/components/index.d.ts +2 -1
- package/dist/src/components/index.js +3 -2
- package/dist/styles.css +12 -11
- package/dist/styles_timescaledb.css +12 -11
- package/dist/system.cjs +291 -341
- package/dist/system.mjs +286 -337
- package/dist/tailwind.config.js +1 -1
- package/dist/tailwind.theme.json +1 -0
- package/dist/tsconfig.module.tsbuildinfo +1 -1
- package/dist/types/tailwindGenerated.d.ts +1 -1
- package/package.json +2 -2
- package/dist/src/components/Positioner/Positioner.d.ts +0 -21
- package/dist/src/components/Positioner/Positioner.js +0 -97
package/dist/system.cjs
CHANGED
@@ -1301,7 +1301,6 @@ __export(system_exports, {
|
|
1301
1301
|
Popover: () => Popover2,
|
1302
1302
|
PopoverDialog: () => PopoverDialog2,
|
1303
1303
|
Portal: () => Portal,
|
1304
|
-
Positioner: () => Positioner,
|
1305
1304
|
PositionerPlacement: () => PositionerPlacement,
|
1306
1305
|
PrimaryButton: () => PrimaryButton,
|
1307
1306
|
PrimaryDropdownButton: () => PrimaryDropdownButton,
|
@@ -1312,6 +1311,7 @@ __export(system_exports, {
|
|
1312
1311
|
SecondaryButton: () => SecondaryButton,
|
1313
1312
|
SecondaryDropdownButton: () => SecondaryDropdownButton,
|
1314
1313
|
SecondaryGhostButton: () => SecondaryGhostButton,
|
1314
|
+
Section: () => Section3,
|
1315
1315
|
SegmentedControl: () => SegmentedControl,
|
1316
1316
|
SegmentedControlGroup: () => SegmentedControlGroup,
|
1317
1317
|
Select: () => Select2,
|
@@ -1354,6 +1354,7 @@ __export(system_exports, {
|
|
1354
1354
|
isOutOfBounds: () => isOutOfBounds,
|
1355
1355
|
placementOrder: () => placementOrder,
|
1356
1356
|
theme: () => import_resolveTheme2.theme,
|
1357
|
+
usePagination: () => usePagination,
|
1357
1358
|
usePopoverContext: () => usePopoverContext,
|
1358
1359
|
useScrollTarget: () => useScrollTarget,
|
1359
1360
|
useTableSelect: () => useTableSelect,
|
@@ -1425,7 +1426,6 @@ __export(components_exports, {
|
|
1425
1426
|
Popover: () => Popover2,
|
1426
1427
|
PopoverDialog: () => PopoverDialog2,
|
1427
1428
|
Portal: () => Portal,
|
1428
|
-
Positioner: () => Positioner,
|
1429
1429
|
PrimaryButton: () => PrimaryButton,
|
1430
1430
|
PrimaryDropdownButton: () => PrimaryDropdownButton,
|
1431
1431
|
ProgressBar: () => ProgressBar2,
|
@@ -1435,6 +1435,7 @@ __export(components_exports, {
|
|
1435
1435
|
SecondaryButton: () => SecondaryButton,
|
1436
1436
|
SecondaryDropdownButton: () => SecondaryDropdownButton,
|
1437
1437
|
SecondaryGhostButton: () => SecondaryGhostButton,
|
1438
|
+
Section: () => Section3,
|
1438
1439
|
SegmentedControl: () => SegmentedControl,
|
1439
1440
|
SegmentedControlGroup: () => SegmentedControlGroup,
|
1440
1441
|
Select: () => Select2,
|
@@ -1459,6 +1460,7 @@ __export(components_exports, {
|
|
1459
1460
|
asPopoverButton: () => asPopoverButton,
|
1460
1461
|
asTabItem: () => asTabItem,
|
1461
1462
|
createTabsComponent: () => createTabsComponent,
|
1463
|
+
usePagination: () => usePagination,
|
1462
1464
|
usePopoverContext: () => usePopoverContext,
|
1463
1465
|
useScrollTarget: () => useScrollTarget,
|
1464
1466
|
useTableSelect: () => useTableSelect,
|
@@ -2119,6 +2121,7 @@ var tailwind_theme_default = {
|
|
2119
2121
|
"grey-20": "#d2d2d6",
|
2120
2122
|
transparent: "transparent",
|
2121
2123
|
white: "white",
|
2124
|
+
black: "black",
|
2122
2125
|
current: "currentColor",
|
2123
2126
|
"navyBlue-100": "#30375E"
|
2124
2127
|
},
|
@@ -4633,27 +4636,31 @@ var DataTable = ({
|
|
4633
4636
|
key: column.headerName,
|
4634
4637
|
style: { width: column.width }
|
4635
4638
|
}, column.headerName)
|
4636
|
-
)), /* @__PURE__ */ import_react47.default.createElement(Table2.Body, null,
|
4637
|
-
|
4638
|
-
|
4639
|
-
|
4640
|
-
|
4641
|
-
|
4642
|
-
|
4643
|
-
|
4644
|
-
|
4645
|
-
|
4646
|
-
|
4647
|
-
|
4648
|
-
|
4649
|
-
|
4650
|
-
|
4651
|
-
|
4652
|
-
|
4653
|
-
|
4654
|
-
|
4655
|
-
|
4656
|
-
|
4639
|
+
)), /* @__PURE__ */ import_react47.default.createElement(Table2.Body, null, /* @__PURE__ */ import_react47.default.createElement(List, {
|
4640
|
+
items: (0, import_orderBy2.default)(rows, [sort?.key], [toSortDirection(sort?.direction)]),
|
4641
|
+
renderItem: (row) => /* @__PURE__ */ import_react47.default.createElement(Table2.Row, {
|
4642
|
+
key: row.id
|
4643
|
+
}, /* @__PURE__ */ import_react47.default.createElement(List, {
|
4644
|
+
items: columns,
|
4645
|
+
renderItem: (column, index) => isFieldColumn(column) ? /* @__PURE__ */ import_react47.default.createElement(Table2.Cell, {
|
4646
|
+
key: column.field,
|
4647
|
+
align: isNumberColumn(column) ? "right" : "left"
|
4648
|
+
}, row[column.field]) : isStatusColumn(column) ? /* @__PURE__ */ import_react47.default.createElement(Table2.Cell, {
|
4649
|
+
key: column.headerName
|
4650
|
+
}, /* @__PURE__ */ import_react47.default.createElement(StatusChip, {
|
4651
|
+
dense: true,
|
4652
|
+
...column.status(row, index, rows)
|
4653
|
+
})) : isActionColumn(column) ? /* @__PURE__ */ import_react47.default.createElement(Table2.Cell, {
|
4654
|
+
align: "right",
|
4655
|
+
key: column.headerName
|
4656
|
+
}, /* @__PURE__ */ import_react47.default.createElement(SecondaryButton, {
|
4657
|
+
dense: true,
|
4658
|
+
...renameProperty("text", "children", column.action(row, index, rows))
|
4659
|
+
})) : /* @__PURE__ */ import_react47.default.createElement(Table2.Cell, {
|
4660
|
+
key: column.headerName
|
4661
|
+
}, column.UNSAFE_render(row, index, rows))
|
4662
|
+
}))
|
4663
|
+
})));
|
4657
4664
|
};
|
4658
4665
|
|
4659
4666
|
// src/components/Dialog/Dialog.tsx
|
@@ -5960,6 +5967,7 @@ var MultiInputBase = ({
|
|
5960
5967
|
itemToString = (val) => String(val),
|
5961
5968
|
createItem = (val) => val,
|
5962
5969
|
onChange,
|
5970
|
+
onInputChange,
|
5963
5971
|
isItemValid,
|
5964
5972
|
disabled = false,
|
5965
5973
|
readOnly = false,
|
@@ -6062,6 +6070,7 @@ var MultiInputBase = ({
|
|
6062
6070
|
name,
|
6063
6071
|
type,
|
6064
6072
|
...props,
|
6073
|
+
onChange: onInputChange,
|
6065
6074
|
autoFocus,
|
6066
6075
|
disabled,
|
6067
6076
|
readOnly,
|
@@ -6821,264 +6830,13 @@ PopoverDialog2.Prompt = Prompt;
|
|
6821
6830
|
var import_react_dom = require("react-dom");
|
6822
6831
|
var Portal = ({ children, to }) => (0, import_react_dom.createPortal)(children, to);
|
6823
6832
|
|
6824
|
-
// src/components/Positioner/Positioner.tsx
|
6825
|
-
var import_react74 = __toESM(require("react"));
|
6826
|
-
|
6827
|
-
// src/utils/positioner.ts
|
6828
|
-
var import_clamp2 = __toESM(require("lodash/clamp"));
|
6829
|
-
var PositionerPlacement = /* @__PURE__ */ ((PositionerPlacement2) => {
|
6830
|
-
PositionerPlacement2["top"] = "top";
|
6831
|
-
PositionerPlacement2["left"] = "left";
|
6832
|
-
PositionerPlacement2["bottom"] = "bottom";
|
6833
|
-
PositionerPlacement2["right"] = "right";
|
6834
|
-
PositionerPlacement2["topLeft"] = "top-left";
|
6835
|
-
PositionerPlacement2["topRight"] = "top-right";
|
6836
|
-
PositionerPlacement2["bottomLeft"] = "bottom-left";
|
6837
|
-
PositionerPlacement2["bottomRight"] = "bottom-right";
|
6838
|
-
return PositionerPlacement2;
|
6839
|
-
})(PositionerPlacement || {});
|
6840
|
-
var placementOrder = [
|
6841
|
-
"top" /* top */,
|
6842
|
-
"top-left" /* topLeft */,
|
6843
|
-
"top-right" /* topRight */,
|
6844
|
-
"right" /* right */,
|
6845
|
-
"bottom" /* bottom */,
|
6846
|
-
"bottom-left" /* bottomLeft */,
|
6847
|
-
"bottom-right" /* bottomRight */,
|
6848
|
-
"left" /* left */
|
6849
|
-
];
|
6850
|
-
var POSITIONER_MOUNT_ELEMENT_ID = "positioner-root";
|
6851
|
-
function createMountPointElement() {
|
6852
|
-
const mountElement = document.createElement("div");
|
6853
|
-
mountElement.id = POSITIONER_MOUNT_ELEMENT_ID;
|
6854
|
-
return mountElement;
|
6855
|
-
}
|
6856
|
-
function calcBottomPosition(triggerRect, contentRect, padding) {
|
6857
|
-
return {
|
6858
|
-
x: triggerRect.left - (contentRect.width / 2 - triggerRect.width / 2),
|
6859
|
-
y: triggerRect.top + triggerRect.height + padding
|
6860
|
-
};
|
6861
|
-
}
|
6862
|
-
function calcTopPosition(triggerRect, contentRect, padding) {
|
6863
|
-
return {
|
6864
|
-
x: triggerRect.left - (contentRect.width / 2 - triggerRect.width / 2),
|
6865
|
-
y: triggerRect.top - contentRect.height - padding
|
6866
|
-
};
|
6867
|
-
}
|
6868
|
-
function calcLeftPosition(triggerRect, contentRect, padding) {
|
6869
|
-
return {
|
6870
|
-
x: triggerRect.left - contentRect.width - padding,
|
6871
|
-
y: triggerRect.top - (contentRect.height / 2 - triggerRect.height / 2)
|
6872
|
-
};
|
6873
|
-
}
|
6874
|
-
function calcRightPosition(triggerRect, contentRect, padding) {
|
6875
|
-
return {
|
6876
|
-
x: triggerRect.left + triggerRect.width + padding,
|
6877
|
-
y: triggerRect.top - (contentRect.height / 2 - triggerRect.height / 2)
|
6878
|
-
};
|
6879
|
-
}
|
6880
|
-
function calcBottomLeftPosition(triggerRect, contentRect, padding) {
|
6881
|
-
return {
|
6882
|
-
x: triggerRect.left - contentRect.width - padding,
|
6883
|
-
y: triggerRect.top + triggerRect.height + padding
|
6884
|
-
};
|
6885
|
-
}
|
6886
|
-
function calcBottomRightPosition(triggerRect, contentRect, padding) {
|
6887
|
-
return {
|
6888
|
-
x: triggerRect.left + triggerRect.width + padding,
|
6889
|
-
y: triggerRect.top + triggerRect.height + padding
|
6890
|
-
};
|
6891
|
-
}
|
6892
|
-
function calcTopLeftPosition(triggerRect, contentRect, padding) {
|
6893
|
-
return {
|
6894
|
-
x: triggerRect.left - contentRect.width - padding,
|
6895
|
-
y: triggerRect.top - contentRect.height - padding
|
6896
|
-
};
|
6897
|
-
}
|
6898
|
-
function calcTopRightPosition(triggerRect, contentRect, padding) {
|
6899
|
-
return {
|
6900
|
-
x: triggerRect.left + triggerRect.width + padding,
|
6901
|
-
y: triggerRect.top - contentRect.height - padding
|
6902
|
-
};
|
6903
|
-
}
|
6904
|
-
var positionCalcFuncs = {
|
6905
|
-
["top" /* top */]: calcTopPosition,
|
6906
|
-
["top-left" /* topLeft */]: calcTopLeftPosition,
|
6907
|
-
["top-right" /* topRight */]: calcTopRightPosition,
|
6908
|
-
["bottom" /* bottom */]: calcBottomPosition,
|
6909
|
-
["bottom-left" /* bottomLeft */]: calcBottomLeftPosition,
|
6910
|
-
["bottom-right" /* bottomRight */]: calcBottomRightPosition,
|
6911
|
-
["left" /* left */]: calcLeftPosition,
|
6912
|
-
["right" /* right */]: calcRightPosition
|
6913
|
-
};
|
6914
|
-
function isOutOfBounds(position) {
|
6915
|
-
return position.x < 0 || position.x > window.innerWidth;
|
6916
|
-
}
|
6917
|
-
function calcPosition(triggerRect, contentRect, placement, padding) {
|
6918
|
-
return positionCalcFuncs[placement](triggerRect, contentRect, padding);
|
6919
|
-
}
|
6920
|
-
function calcBestPosition(triggerRect, contentRect, placement, padding) {
|
6921
|
-
let attempts = 0;
|
6922
|
-
return function _calcBestPosition(triggerRect2, contentRect2, placement2, padding2) {
|
6923
|
-
attempts++;
|
6924
|
-
const position = calcPosition(triggerRect2, contentRect2, placement2, padding2);
|
6925
|
-
const hasAttemptsLeft = attempts < placementOrder.length;
|
6926
|
-
if (isOutOfBounds(position) && hasAttemptsLeft) {
|
6927
|
-
const nextPlacementAttempt = placementOrder[placementOrder.findIndex((p) => placement2 === p) + 1] || placementOrder[0];
|
6928
|
-
return _calcBestPosition(triggerRect2, contentRect2, nextPlacementAttempt, padding2);
|
6929
|
-
} else {
|
6930
|
-
return {
|
6931
|
-
x: (0, import_clamp2.default)(position.x + window.scrollX, 0, window.innerWidth),
|
6932
|
-
y: position.y + window.scrollY
|
6933
|
-
};
|
6934
|
-
}
|
6935
|
-
}(triggerRect, contentRect, placement, padding);
|
6936
|
-
}
|
6937
|
-
|
6938
|
-
// src/components/Positioner/Positioner.tsx
|
6939
|
-
var Positioner = ({
|
6940
|
-
children,
|
6941
|
-
content,
|
6942
|
-
autoAdjust = false,
|
6943
|
-
animate = false,
|
6944
|
-
trigger = "click",
|
6945
|
-
placement = "bottom" /* bottom */,
|
6946
|
-
onClose,
|
6947
|
-
padding = 5,
|
6948
|
-
allowClosingManually = false,
|
6949
|
-
stayVisibleOnHover = false,
|
6950
|
-
fullWidth = false,
|
6951
|
-
tabIndex = 0
|
6952
|
-
}) => {
|
6953
|
-
const [isOpen, setOpen] = import_react74.default.useState(false);
|
6954
|
-
const triggerRef = import_react74.default.useRef(null);
|
6955
|
-
const timeoutId = import_react74.default.useRef();
|
6956
|
-
import_react74.default.useEffect(() => {
|
6957
|
-
return () => {
|
6958
|
-
timeoutId.current && clearTimeout(timeoutId.current);
|
6959
|
-
window.document.body.removeEventListener("mouseover", handleMouseOver);
|
6960
|
-
};
|
6961
|
-
}, []);
|
6962
|
-
const handleTriggerKeyDown = (event) => event.key === "Enter" && showContent(!isOpen);
|
6963
|
-
const handleTriggerClick = () => {
|
6964
|
-
showContent(!isOpen);
|
6965
|
-
};
|
6966
|
-
const handleMouseOver = (event) => {
|
6967
|
-
if (!triggerRef.current?.contains(event.target)) {
|
6968
|
-
showContent(false);
|
6969
|
-
window.document.body.removeEventListener("mouseover", handleMouseOver);
|
6970
|
-
}
|
6971
|
-
};
|
6972
|
-
const showContent = (value, shouldDelay = false) => {
|
6973
|
-
timeoutId.current && clearTimeout(timeoutId.current);
|
6974
|
-
shouldDelay ? timeoutId.current = setTimeout(() => setOpen(value), 300) : setOpen(value);
|
6975
|
-
if (!value) {
|
6976
|
-
onClose?.({ triggerRef });
|
6977
|
-
}
|
6978
|
-
};
|
6979
|
-
const handleTriggerMouseEnter = () => {
|
6980
|
-
if (!stayVisibleOnHover) {
|
6981
|
-
window.document.body.addEventListener("mouseover", handleMouseOver);
|
6982
|
-
}
|
6983
|
-
showContent(true, true);
|
6984
|
-
};
|
6985
|
-
const handleTriggerMouseLeave = () => showContent(false, stayVisibleOnHover);
|
6986
|
-
const handleOutsideClick = import_react74.default.useCallback((event) => {
|
6987
|
-
const { target } = event;
|
6988
|
-
if (target !== window && !triggerRef?.current?.contains(target)) {
|
6989
|
-
showContent(false);
|
6990
|
-
}
|
6991
|
-
}, []);
|
6992
|
-
const handleESCPress = import_react74.default.useCallback(() => showContent(false), []);
|
6993
|
-
const handleSetOpen = import_react74.default.useCallback((value) => showContent(value), []);
|
6994
|
-
return /* @__PURE__ */ import_react74.default.createElement("div", {
|
6995
|
-
className: tw("inline-block", {
|
6996
|
-
"w-full": fullWidth
|
6997
|
-
}),
|
6998
|
-
ref: triggerRef,
|
6999
|
-
onClick: trigger === "click" ? handleTriggerClick : void 0,
|
7000
|
-
onKeyDown: handleTriggerKeyDown,
|
7001
|
-
onMouseEnter: trigger === "hover" ? handleTriggerMouseEnter : void 0,
|
7002
|
-
onMouseLeave: stayVisibleOnHover ? handleTriggerMouseLeave : void 0,
|
7003
|
-
tabIndex,
|
7004
|
-
"data-testid": "positioner",
|
7005
|
-
id: content.props.triggerId,
|
7006
|
-
"aria-haspopup": isOpen,
|
7007
|
-
"aria-expanded": isOpen,
|
7008
|
-
"aria-controls": content.props.contentId
|
7009
|
-
}, children, isOpen && /* @__PURE__ */ import_react74.default.createElement(Positioned, {
|
7010
|
-
triggerRect: triggerRef.current?.getBoundingClientRect() || { x: 0, y: 0 },
|
7011
|
-
animate,
|
7012
|
-
autoAdjust,
|
7013
|
-
onOutsideClick: handleOutsideClick,
|
7014
|
-
onESCPress: handleESCPress,
|
7015
|
-
placement,
|
7016
|
-
padding,
|
7017
|
-
setOpen: handleSetOpen,
|
7018
|
-
stayVisibleOnHover
|
7019
|
-
}, allowClosingManually ? import_react74.default.cloneElement(content, { setClose: () => showContent(false) }) : content));
|
7020
|
-
};
|
7021
|
-
var Positioned = ({
|
7022
|
-
children,
|
7023
|
-
onOutsideClick,
|
7024
|
-
onESCPress,
|
7025
|
-
autoAdjust = false,
|
7026
|
-
animate = false,
|
7027
|
-
triggerRect,
|
7028
|
-
placement = "bottom" /* bottom */,
|
7029
|
-
padding = 5,
|
7030
|
-
setOpen = () => void 0,
|
7031
|
-
stayVisibleOnHover = false
|
7032
|
-
}) => {
|
7033
|
-
const [position, setPosition] = import_react74.default.useState({ x: 0, y: 0 });
|
7034
|
-
const contentRef = import_react74.default.useRef(null);
|
7035
|
-
const mountElementRef = import_react74.default.useRef(createMountPointElement());
|
7036
|
-
const handleBodyClick = (event) => !contentRef.current?.contains(event.target) && onOutsideClick(event);
|
7037
|
-
const handleWindowKeyUp = (event) => event.key === "Escape" && onESCPress();
|
7038
|
-
const handleSetOpen = (event, value) => {
|
7039
|
-
event.stopPropagation();
|
7040
|
-
setOpen(value);
|
7041
|
-
};
|
7042
|
-
import_react74.default.useEffect(() => {
|
7043
|
-
window.document.body.addEventListener("click", handleBodyClick);
|
7044
|
-
window.addEventListener("keyup", handleWindowKeyUp);
|
7045
|
-
document.body.appendChild(mountElementRef.current);
|
7046
|
-
if (contentRef.current) {
|
7047
|
-
setPosition(
|
7048
|
-
autoAdjust ? calcBestPosition(triggerRect, contentRef.current.getBoundingClientRect(), placement, padding) : calcPosition(triggerRect, contentRef.current.getBoundingClientRect(), placement, padding)
|
7049
|
-
);
|
7050
|
-
}
|
7051
|
-
return () => {
|
7052
|
-
document.body.removeChild(mountElementRef.current);
|
7053
|
-
window.document.body.removeEventListener("click", handleBodyClick);
|
7054
|
-
window.removeEventListener("keyup", handleWindowKeyUp);
|
7055
|
-
};
|
7056
|
-
}, []);
|
7057
|
-
return /* @__PURE__ */ import_react74.default.createElement(Portal, {
|
7058
|
-
to: mountElementRef.current
|
7059
|
-
}, /* @__PURE__ */ import_react74.default.createElement("div", {
|
7060
|
-
tabIndex: -1,
|
7061
|
-
onClick: (event) => event.stopPropagation(),
|
7062
|
-
ref: contentRef,
|
7063
|
-
style: {
|
7064
|
-
transform: `translate(${position.x}px, ${position.y}px)`
|
7065
|
-
},
|
7066
|
-
className: tw("absolute top-0 left-0", {
|
7067
|
-
"animate-positioner-fade-in": animate
|
7068
|
-
}),
|
7069
|
-
"data-testid": "positioned",
|
7070
|
-
...stayVisibleOnHover && { onMouseEnter: (e) => handleSetOpen(e, true) },
|
7071
|
-
...stayVisibleOnHover && { onMouseLeave: (e) => handleSetOpen(e, false) }
|
7072
|
-
}, children));
|
7073
|
-
};
|
7074
|
-
|
7075
6833
|
// src/components/ProgressBar/ProgressBar.tsx
|
7076
|
-
var
|
6834
|
+
var import_react75 = __toESM(require("react"));
|
7077
6835
|
|
7078
6836
|
// src/common/ProgressBar/ProgressBar.tsx
|
7079
|
-
var
|
7080
|
-
var
|
7081
|
-
var ProgressBar = ({ children, className, ...rest }) => /* @__PURE__ */
|
6837
|
+
var import_react74 = __toESM(require("react"));
|
6838
|
+
var import_clamp2 = __toESM(require("lodash/clamp"));
|
6839
|
+
var ProgressBar = ({ children, className, ...rest }) => /* @__PURE__ */ import_react74.default.createElement("div", {
|
7082
6840
|
...rest,
|
7083
6841
|
className: classNames(
|
7084
6842
|
tw("relative flex items-center w-full bg-grey-0 h-2 rounded-full overflow-hidden"),
|
@@ -7092,8 +6850,8 @@ var STATUS_COLORS = {
|
|
7092
6850
|
error: tw("bg-error-70")
|
7093
6851
|
};
|
7094
6852
|
ProgressBar.Indicator = ({ min, max, value, "aria-label": ariaLabel, status, className, ...rest }) => {
|
7095
|
-
const completedPercentage = (0,
|
7096
|
-
return /* @__PURE__ */
|
6853
|
+
const completedPercentage = (0, import_clamp2.default)((value - min) / (max - min) * 100, 0, 100);
|
6854
|
+
return /* @__PURE__ */ import_react74.default.createElement("div", {
|
7097
6855
|
...rest,
|
7098
6856
|
className: classNames(
|
7099
6857
|
tw("h-2 rounded-full transition-all ease-in-out delay-150"),
|
@@ -7108,12 +6866,12 @@ ProgressBar.Indicator = ({ min, max, value, "aria-label": ariaLabel, status, cla
|
|
7108
6866
|
"aria-valuemax": max
|
7109
6867
|
});
|
7110
6868
|
};
|
7111
|
-
ProgressBar.Labels = ({ children, startLabel, endLabel, className, ...rest }) => /* @__PURE__ */
|
6869
|
+
ProgressBar.Labels = ({ children, startLabel, endLabel, className, ...rest }) => /* @__PURE__ */ import_react74.default.createElement("div", {
|
7112
6870
|
className: classNames(tw("flex flex-row"), className)
|
7113
|
-
}, /* @__PURE__ */
|
6871
|
+
}, /* @__PURE__ */ import_react74.default.createElement("span", {
|
7114
6872
|
...rest,
|
7115
6873
|
className: tw("grow text-grey-70 typography-caption-default")
|
7116
|
-
}, startLabel), /* @__PURE__ */
|
6874
|
+
}, startLabel), /* @__PURE__ */ import_react74.default.createElement("span", {
|
7117
6875
|
...rest,
|
7118
6876
|
className: tw("grow text-grey-70 typography-caption-default text-right")
|
7119
6877
|
}, endLabel));
|
@@ -7131,7 +6889,7 @@ var ProgressBar2 = (props) => {
|
|
7131
6889
|
if (min > max) {
|
7132
6890
|
throw new Error("`min` value provided to `ProgressBar` is greater than `max` value.");
|
7133
6891
|
}
|
7134
|
-
const progress = /* @__PURE__ */
|
6892
|
+
const progress = /* @__PURE__ */ import_react75.default.createElement(ProgressBar, null, /* @__PURE__ */ import_react75.default.createElement(ProgressBar.Indicator, {
|
7135
6893
|
status: value === max ? completedStatus : progresStatus,
|
7136
6894
|
min,
|
7137
6895
|
max,
|
@@ -7141,20 +6899,20 @@ var ProgressBar2 = (props) => {
|
|
7141
6899
|
if (props.dense) {
|
7142
6900
|
return progress;
|
7143
6901
|
}
|
7144
|
-
return /* @__PURE__ */
|
6902
|
+
return /* @__PURE__ */ import_react75.default.createElement("div", null, progress, /* @__PURE__ */ import_react75.default.createElement(ProgressBar.Labels, {
|
7145
6903
|
className: tw("py-2"),
|
7146
6904
|
startLabel: props.startLabel,
|
7147
6905
|
endLabel: props.endLabel
|
7148
6906
|
}));
|
7149
6907
|
};
|
7150
|
-
ProgressBar2.Skeleton = () => /* @__PURE__ */
|
6908
|
+
ProgressBar2.Skeleton = () => /* @__PURE__ */ import_react75.default.createElement(Skeleton, {
|
7151
6909
|
height: 4,
|
7152
6910
|
display: "block"
|
7153
6911
|
});
|
7154
6912
|
|
7155
6913
|
// src/components/RadioButton/RadioButton.tsx
|
7156
|
-
var
|
7157
|
-
var RadioButton2 =
|
6914
|
+
var import_react76 = __toESM(require("react"));
|
6915
|
+
var RadioButton2 = import_react76.default.forwardRef(
|
7158
6916
|
({
|
7159
6917
|
name,
|
7160
6918
|
id,
|
@@ -7168,11 +6926,11 @@ var RadioButton2 = import_react77.default.forwardRef(
|
|
7168
6926
|
"aria-label": ariaLabel,
|
7169
6927
|
...props
|
7170
6928
|
}, ref) => {
|
7171
|
-
const [checked, setChecked] =
|
6929
|
+
const [checked, setChecked] = import_react76.default.useState(_checked ?? defaultChecked ?? false);
|
7172
6930
|
if (_checked !== void 0 && checked !== _checked) {
|
7173
6931
|
setChecked(_checked);
|
7174
6932
|
}
|
7175
|
-
return !readOnly || checked ? /* @__PURE__ */
|
6933
|
+
return !readOnly || checked ? /* @__PURE__ */ import_react76.default.createElement(ControlLabel, {
|
7176
6934
|
htmlFor: id,
|
7177
6935
|
label: children,
|
7178
6936
|
"aria-label": ariaLabel,
|
@@ -7180,7 +6938,7 @@ var RadioButton2 = import_react77.default.forwardRef(
|
|
7180
6938
|
readOnly,
|
7181
6939
|
disabled,
|
7182
6940
|
style: { gap: "0 8px" }
|
7183
|
-
}, !readOnly && /* @__PURE__ */
|
6941
|
+
}, !readOnly && /* @__PURE__ */ import_react76.default.createElement(RadioButton, {
|
7184
6942
|
id,
|
7185
6943
|
ref,
|
7186
6944
|
name,
|
@@ -7195,22 +6953,22 @@ var RadioButton2 = import_react77.default.forwardRef(
|
|
7195
6953
|
})) : null;
|
7196
6954
|
}
|
7197
6955
|
);
|
7198
|
-
var RadioButtonSkeleton = () => /* @__PURE__ */
|
6956
|
+
var RadioButtonSkeleton = () => /* @__PURE__ */ import_react76.default.createElement("div", {
|
7199
6957
|
className: tw("flex gap-3")
|
7200
|
-
}, /* @__PURE__ */
|
6958
|
+
}, /* @__PURE__ */ import_react76.default.createElement(Skeleton, {
|
7201
6959
|
height: 20,
|
7202
6960
|
width: 20
|
7203
|
-
}), /* @__PURE__ */
|
6961
|
+
}), /* @__PURE__ */ import_react76.default.createElement(Skeleton, {
|
7204
6962
|
height: 20,
|
7205
6963
|
width: 150
|
7206
6964
|
}));
|
7207
6965
|
RadioButton2.Skeleton = RadioButtonSkeleton;
|
7208
6966
|
|
7209
6967
|
// src/components/RadioButtonGroup/RadioButtonGroup.tsx
|
7210
|
-
var
|
6968
|
+
var import_react77 = __toESM(require("react"));
|
7211
6969
|
var import_uniqueId8 = __toESM(require("lodash/uniqueId"));
|
7212
6970
|
var isRadioButton = (c) => {
|
7213
|
-
return
|
6971
|
+
return import_react77.default.isValidElement(c) && c.type === RadioButton2;
|
7214
6972
|
};
|
7215
6973
|
var RadioButtonGroup = ({
|
7216
6974
|
name,
|
@@ -7223,7 +6981,7 @@ var RadioButtonGroup = ({
|
|
7223
6981
|
children,
|
7224
6982
|
...props
|
7225
6983
|
}) => {
|
7226
|
-
const [value, setValue] =
|
6984
|
+
const [value, setValue] = import_react77.default.useState(_value ?? defaultValue ?? "");
|
7227
6985
|
const errorMessageId = (0, import_uniqueId8.default)();
|
7228
6986
|
const errorProps = props.valid === false ? { "aria-invalid": true, "aria-describedby": errorMessageId } : {};
|
7229
6987
|
const labelControlProps = getLabelControlProps(props);
|
@@ -7234,13 +6992,13 @@ var RadioButtonGroup = ({
|
|
7234
6992
|
setValue(e.target.value);
|
7235
6993
|
onChange?.(e.target.value);
|
7236
6994
|
};
|
7237
|
-
const content =
|
6995
|
+
const content = import_react77.default.Children.map(children, (c) => {
|
7238
6996
|
if (!isRadioButton(c)) {
|
7239
6997
|
return null;
|
7240
6998
|
}
|
7241
6999
|
const defaultChecked = defaultValue === void 0 ? void 0 : c.props.value === defaultValue;
|
7242
7000
|
const checked = value === void 0 ? void 0 : c.props.value === value;
|
7243
|
-
return
|
7001
|
+
return import_react77.default.cloneElement(c, {
|
7244
7002
|
name,
|
7245
7003
|
defaultChecked: c.props.defaultChecked ?? defaultChecked,
|
7246
7004
|
checked: c.props.checked ?? checked,
|
@@ -7249,13 +7007,13 @@ var RadioButtonGroup = ({
|
|
7249
7007
|
readOnly
|
7250
7008
|
});
|
7251
7009
|
});
|
7252
|
-
return /* @__PURE__ */
|
7010
|
+
return /* @__PURE__ */ import_react77.default.createElement(LabelControl, {
|
7253
7011
|
fieldset: true,
|
7254
7012
|
...labelControlProps,
|
7255
7013
|
...errorProps
|
7256
|
-
}, cols && /* @__PURE__ */
|
7014
|
+
}, cols && /* @__PURE__ */ import_react77.default.createElement(InputGroup, {
|
7257
7015
|
cols
|
7258
|
-
}, content), !cols && /* @__PURE__ */
|
7016
|
+
}, content), !cols && /* @__PURE__ */ import_react77.default.createElement(Flexbox, {
|
7259
7017
|
direction,
|
7260
7018
|
alignItems: "flex-start",
|
7261
7019
|
colGap: "8",
|
@@ -7264,19 +7022,64 @@ var RadioButtonGroup = ({
|
|
7264
7022
|
}, content));
|
7265
7023
|
};
|
7266
7024
|
var RadioButtonGroupSkeleton = ({ direction = "row", options = 2 }) => {
|
7267
|
-
return /* @__PURE__ */
|
7025
|
+
return /* @__PURE__ */ import_react77.default.createElement(LabelControl.Skeleton, null, /* @__PURE__ */ import_react77.default.createElement("div", {
|
7268
7026
|
className: tw("flex flex-wrap", {
|
7269
7027
|
"flex-row gap-8": direction === "row",
|
7270
7028
|
"flex-col gap-2": direction === "column"
|
7271
7029
|
})
|
7272
|
-
}, Array.from({ length: options }).map((_, key) => /* @__PURE__ */
|
7030
|
+
}, Array.from({ length: options }).map((_, key) => /* @__PURE__ */ import_react77.default.createElement(RadioButton2.Skeleton, {
|
7273
7031
|
key
|
7274
7032
|
}))));
|
7275
7033
|
};
|
7276
7034
|
RadioButtonGroup.Skeleton = RadioButtonGroupSkeleton;
|
7277
7035
|
|
7278
|
-
// src/components/
|
7036
|
+
// src/components/Section/Section.tsx
|
7279
7037
|
var import_react79 = __toESM(require("react"));
|
7038
|
+
|
7039
|
+
// src/common/Section/Section.tsx
|
7040
|
+
var import_react78 = __toESM(require("react"));
|
7041
|
+
var Section2 = ({ children, ...rest }) => /* @__PURE__ */ import_react78.default.createElement(Box, {
|
7042
|
+
borderColor: "grey-5",
|
7043
|
+
borderWidth: "1px",
|
7044
|
+
...rest
|
7045
|
+
}, children);
|
7046
|
+
Section2.Header = ({ children, className, ...rest }) => /* @__PURE__ */ import_react78.default.createElement("div", {
|
7047
|
+
...rest,
|
7048
|
+
className: classNames(tw("px-6 py-5 flex gap-5 justify-between items-center"), className)
|
7049
|
+
}, children);
|
7050
|
+
Section2.TitleContainer = ({ children, className, ...rest }) => /* @__PURE__ */ import_react78.default.createElement("div", {
|
7051
|
+
...rest,
|
7052
|
+
className: classNames(tw("flex flex-col grow gap-2"), className)
|
7053
|
+
}, children);
|
7054
|
+
Section2.Title = ({ children, ...rest }) => /* @__PURE__ */ import_react78.default.createElement(Typography2.Subheading, {
|
7055
|
+
...rest,
|
7056
|
+
color: "black"
|
7057
|
+
}, children);
|
7058
|
+
Section2.Subtitle = ({ children, ...rest }) => /* @__PURE__ */ import_react78.default.createElement(Typography2.SmallText, {
|
7059
|
+
...rest,
|
7060
|
+
color: "grey-70"
|
7061
|
+
}, children);
|
7062
|
+
Section2.Actions = ({ children, className, ...rest }) => /* @__PURE__ */ import_react78.default.createElement("div", {
|
7063
|
+
...rest,
|
7064
|
+
className: classNames(tw("flex gap-4 justify-end"), className)
|
7065
|
+
}, children);
|
7066
|
+
Section2.Body = ({ children, className, ...rest }) => /* @__PURE__ */ import_react78.default.createElement("div", {
|
7067
|
+
...rest,
|
7068
|
+
className: classNames(tw("p-6"), className)
|
7069
|
+
}, /* @__PURE__ */ import_react78.default.createElement(Typography, {
|
7070
|
+
htmlTag: "div",
|
7071
|
+
color: "grey-70"
|
7072
|
+
}, children));
|
7073
|
+
|
7074
|
+
// src/components/Section/Section.tsx
|
7075
|
+
var import_castArray4 = __toESM(require("lodash/castArray"));
|
7076
|
+
var Section3 = ({ title, subtitle, actions, children }) => /* @__PURE__ */ import_react79.default.createElement(Section2, null, /* @__PURE__ */ import_react79.default.createElement(Section2.Header, null, /* @__PURE__ */ import_react79.default.createElement(Section2.TitleContainer, null, /* @__PURE__ */ import_react79.default.createElement(Section2.Title, null, title), /* @__PURE__ */ import_react79.default.createElement(Section2.Subtitle, null, subtitle)), /* @__PURE__ */ import_react79.default.createElement(Section2.Actions, null, actions && (0, import_castArray4.default)(actions).filter(Boolean).map(({ text, ...action }) => /* @__PURE__ */ import_react79.default.createElement(SecondaryButton, {
|
7077
|
+
key: text,
|
7078
|
+
...action
|
7079
|
+
}, text)))), /* @__PURE__ */ import_react79.default.createElement(Divider2, null), /* @__PURE__ */ import_react79.default.createElement(Section2.Body, null, children));
|
7080
|
+
|
7081
|
+
// src/components/SegmentedControl/SegmentedControl.tsx
|
7082
|
+
var import_react80 = __toESM(require("react"));
|
7280
7083
|
var SegmentedControl = ({
|
7281
7084
|
children,
|
7282
7085
|
value,
|
@@ -7285,7 +7088,7 @@ var SegmentedControl = ({
|
|
7285
7088
|
selected = false,
|
7286
7089
|
className,
|
7287
7090
|
...rest
|
7288
|
-
}) => /* @__PURE__ */
|
7091
|
+
}) => /* @__PURE__ */ import_react80.default.createElement("button", {
|
7289
7092
|
type: "button",
|
7290
7093
|
...rest,
|
7291
7094
|
className: classNames(
|
@@ -7308,12 +7111,12 @@ var SegmentedControlGroup = ({
|
|
7308
7111
|
"border border-grey-20 text-grey-50": variant === "outlined",
|
7309
7112
|
"bg-grey-0": variant === "raised"
|
7310
7113
|
});
|
7311
|
-
return /* @__PURE__ */
|
7114
|
+
return /* @__PURE__ */ import_react80.default.createElement("div", {
|
7312
7115
|
...rest,
|
7313
7116
|
className: classNames(classes, className)
|
7314
|
-
},
|
7117
|
+
}, import_react80.default.Children.map(
|
7315
7118
|
children,
|
7316
|
-
(child) =>
|
7119
|
+
(child) => import_react80.default.cloneElement(child, {
|
7317
7120
|
dense,
|
7318
7121
|
variant,
|
7319
7122
|
onClick: () => onChange(child.props.value),
|
@@ -7351,8 +7154,8 @@ var getCommonClassNames = (dense, selected) => tw(
|
|
7351
7154
|
);
|
7352
7155
|
|
7353
7156
|
// src/components/Switch/Switch.tsx
|
7354
|
-
var
|
7355
|
-
var Switch =
|
7157
|
+
var import_react81 = __toESM(require("react"));
|
7158
|
+
var Switch = import_react81.default.forwardRef(
|
7356
7159
|
({
|
7357
7160
|
id,
|
7358
7161
|
name,
|
@@ -7366,11 +7169,11 @@ var Switch = import_react80.default.forwardRef(
|
|
7366
7169
|
"aria-label": ariaLabel,
|
7367
7170
|
...props
|
7368
7171
|
}, ref) => {
|
7369
|
-
const [checked, setChecked] =
|
7172
|
+
const [checked, setChecked] = import_react81.default.useState(_checked ?? defaultChecked ?? false);
|
7370
7173
|
if (_checked !== void 0 && checked !== _checked) {
|
7371
7174
|
setChecked(_checked);
|
7372
7175
|
}
|
7373
|
-
return !readOnly || checked ? /* @__PURE__ */
|
7176
|
+
return !readOnly || checked ? /* @__PURE__ */ import_react81.default.createElement(ControlLabel, {
|
7374
7177
|
htmlFor: id,
|
7375
7178
|
label: children,
|
7376
7179
|
"aria-label": ariaLabel,
|
@@ -7378,7 +7181,7 @@ var Switch = import_react80.default.forwardRef(
|
|
7378
7181
|
readOnly,
|
7379
7182
|
disabled,
|
7380
7183
|
style: { gap: "0 8px" }
|
7381
|
-
}, !readOnly && /* @__PURE__ */
|
7184
|
+
}, !readOnly && /* @__PURE__ */ import_react81.default.createElement(Box, {
|
7382
7185
|
component: "span",
|
7383
7186
|
display: "inline-flex",
|
7384
7187
|
justifyContent: "center",
|
@@ -7389,7 +7192,7 @@ var Switch = import_react80.default.forwardRef(
|
|
7389
7192
|
"text-grey-100 cursor-pointer": !disabled
|
7390
7193
|
})
|
7391
7194
|
)
|
7392
|
-
}, /* @__PURE__ */
|
7195
|
+
}, /* @__PURE__ */ import_react81.default.createElement("input", {
|
7393
7196
|
id,
|
7394
7197
|
ref,
|
7395
7198
|
type: "checkbox",
|
@@ -7403,7 +7206,7 @@ var Switch = import_react80.default.forwardRef(
|
|
7403
7206
|
className: tw("appearance-none peer"),
|
7404
7207
|
readOnly,
|
7405
7208
|
disabled
|
7406
|
-
}), /* @__PURE__ */
|
7209
|
+
}), /* @__PURE__ */ import_react81.default.createElement("span", {
|
7407
7210
|
className: tw(
|
7408
7211
|
"rounded-full inline-block w-[34px] h-[20px] transition duration-300 peer-focus:border border-info-70",
|
7409
7212
|
{
|
@@ -7413,7 +7216,7 @@ var Switch = import_react80.default.forwardRef(
|
|
7413
7216
|
"opacity-40": disabled && checked
|
7414
7217
|
}
|
7415
7218
|
)
|
7416
|
-
}), /* @__PURE__ */
|
7219
|
+
}), /* @__PURE__ */ import_react81.default.createElement("span", {
|
7417
7220
|
style: {
|
7418
7221
|
right: checked ? "20px" : void 0,
|
7419
7222
|
left: checked ? void 0 : "4px"
|
@@ -7426,19 +7229,19 @@ var Switch = import_react80.default.forwardRef(
|
|
7426
7229
|
}))) : null;
|
7427
7230
|
}
|
7428
7231
|
);
|
7429
|
-
var SwitchSkeleton = () => /* @__PURE__ */
|
7232
|
+
var SwitchSkeleton = () => /* @__PURE__ */ import_react81.default.createElement("div", {
|
7430
7233
|
className: tw("flex gap-3")
|
7431
|
-
}, /* @__PURE__ */
|
7234
|
+
}, /* @__PURE__ */ import_react81.default.createElement(Skeleton, {
|
7432
7235
|
height: 20,
|
7433
7236
|
width: 35
|
7434
|
-
}), /* @__PURE__ */
|
7237
|
+
}), /* @__PURE__ */ import_react81.default.createElement(Skeleton, {
|
7435
7238
|
height: 20,
|
7436
7239
|
width: 150
|
7437
7240
|
}));
|
7438
7241
|
Switch.Skeleton = SwitchSkeleton;
|
7439
7242
|
|
7440
7243
|
// src/components/SwitchGroup/SwitchGroup.tsx
|
7441
|
-
var
|
7244
|
+
var import_react82 = __toESM(require("react"));
|
7442
7245
|
var import_uniqueId9 = __toESM(require("lodash/uniqueId"));
|
7443
7246
|
var SwitchGroup = ({
|
7444
7247
|
value,
|
@@ -7449,7 +7252,7 @@ var SwitchGroup = ({
|
|
7449
7252
|
children,
|
7450
7253
|
...props
|
7451
7254
|
}) => {
|
7452
|
-
const [selectedItems, setSelectedItems] = (0,
|
7255
|
+
const [selectedItems, setSelectedItems] = (0, import_react82.useState)(value ?? defaultValue ?? []);
|
7453
7256
|
if (value !== void 0 && value !== selectedItems) {
|
7454
7257
|
setSelectedItems(value);
|
7455
7258
|
}
|
@@ -7462,20 +7265,20 @@ var SwitchGroup = ({
|
|
7462
7265
|
setSelectedItems(updated);
|
7463
7266
|
onChange?.(updated);
|
7464
7267
|
};
|
7465
|
-
return /* @__PURE__ */
|
7268
|
+
return /* @__PURE__ */ import_react82.default.createElement(LabelControl, {
|
7466
7269
|
fieldset: true,
|
7467
7270
|
...labelControlProps,
|
7468
7271
|
...errorProps
|
7469
|
-
}, /* @__PURE__ */
|
7272
|
+
}, /* @__PURE__ */ import_react82.default.createElement(InputGroup, {
|
7470
7273
|
cols
|
7471
|
-
},
|
7274
|
+
}, import_react82.default.Children.map(children, (c) => {
|
7472
7275
|
if (!isComponentType(c, Switch)) {
|
7473
7276
|
return null;
|
7474
7277
|
}
|
7475
7278
|
const str = c.props.value?.toString();
|
7476
7279
|
const defaultChecked = defaultValue === void 0 ? void 0 : str !== void 0 && defaultValue.includes(str);
|
7477
7280
|
const checked = value === void 0 ? void 0 : str !== void 0 && value.includes(str);
|
7478
|
-
return
|
7281
|
+
return import_react82.default.cloneElement(c, {
|
7479
7282
|
defaultChecked: c.props.defaultChecked ?? defaultChecked,
|
7480
7283
|
checked: c.props.checked ?? checked,
|
7481
7284
|
onChange: c.props.onChange ?? handleChange,
|
@@ -7485,17 +7288,17 @@ var SwitchGroup = ({
|
|
7485
7288
|
})));
|
7486
7289
|
};
|
7487
7290
|
var SwitchGroupSkeleton = ({ options = 2 }) => {
|
7488
|
-
return /* @__PURE__ */
|
7291
|
+
return /* @__PURE__ */ import_react82.default.createElement(LabelControl.Skeleton, null, /* @__PURE__ */ import_react82.default.createElement("div", {
|
7489
7292
|
className: tw("flex flex-wrap flex-col gap-2")
|
7490
|
-
}, Array.from({ length: options }).map((_, key) => /* @__PURE__ */
|
7293
|
+
}, Array.from({ length: options }).map((_, key) => /* @__PURE__ */ import_react82.default.createElement(Switch.Skeleton, {
|
7491
7294
|
key
|
7492
7295
|
}))));
|
7493
7296
|
};
|
7494
7297
|
SwitchGroup.Skeleton = SwitchGroupSkeleton;
|
7495
7298
|
|
7496
7299
|
// src/components/TagLabel/TagLabel.tsx
|
7497
|
-
var
|
7498
|
-
var TagLabel = ({ title, dense = false, ...rest }) => /* @__PURE__ */
|
7300
|
+
var import_react83 = __toESM(require("react"));
|
7301
|
+
var TagLabel = ({ title, dense = false, ...rest }) => /* @__PURE__ */ import_react83.default.createElement("span", {
|
7499
7302
|
...rest,
|
7500
7303
|
className: tw("rounded-full text-white bg-primary-70", {
|
7501
7304
|
"py-2 px-4 typography-caption-default": !dense,
|
@@ -7504,35 +7307,35 @@ var TagLabel = ({ title, dense = false, ...rest }) => /* @__PURE__ */ import_rea
|
|
7504
7307
|
}, title);
|
7505
7308
|
|
7506
7309
|
// src/components/Textarea/Textarea.tsx
|
7507
|
-
var
|
7310
|
+
var import_react84 = __toESM(require("react"));
|
7508
7311
|
var import_uniqueId10 = __toESM(require("lodash/uniqueId"));
|
7509
7312
|
var import_toString2 = __toESM(require("lodash/toString"));
|
7510
7313
|
var import_omit16 = __toESM(require("lodash/omit"));
|
7511
|
-
var TextareaBase =
|
7512
|
-
({ readOnly = false, valid = true, ...props }, ref) => /* @__PURE__ */
|
7314
|
+
var TextareaBase = import_react84.default.forwardRef(
|
7315
|
+
({ readOnly = false, valid = true, ...props }, ref) => /* @__PURE__ */ import_react84.default.createElement("textarea", {
|
7513
7316
|
ref,
|
7514
7317
|
...props,
|
7515
7318
|
readOnly,
|
7516
7319
|
className: classNames(getCommonInputStyles({ readOnly, valid }), props.className)
|
7517
7320
|
})
|
7518
7321
|
);
|
7519
|
-
TextareaBase.Skeleton = () => /* @__PURE__ */
|
7322
|
+
TextareaBase.Skeleton = () => /* @__PURE__ */ import_react84.default.createElement(Skeleton, {
|
7520
7323
|
height: 58
|
7521
7324
|
});
|
7522
|
-
var Textarea =
|
7523
|
-
const [value, setValue] = (0,
|
7524
|
-
const id = (0,
|
7325
|
+
var Textarea = import_react84.default.forwardRef((props, ref) => {
|
7326
|
+
const [value, setValue] = (0, import_react84.useState)(props.value ?? props.defaultValue ?? "");
|
7327
|
+
const id = (0, import_react84.useRef)(props.id ?? `textarea-${(0, import_uniqueId10.default)()}`);
|
7525
7328
|
const errorMessageId = (0, import_uniqueId10.default)();
|
7526
7329
|
const errorProps = props.valid === false ? { "aria-invalid": true, "aria-describedby": errorMessageId } : {};
|
7527
7330
|
const { "data-testid": dataTestId, ...labelControlProps } = getLabelControlProps(props);
|
7528
7331
|
const baseProps = (0, import_omit16.default)(props, Object.keys(labelControlProps));
|
7529
|
-
return /* @__PURE__ */
|
7332
|
+
return /* @__PURE__ */ import_react84.default.createElement(LabelControl, {
|
7530
7333
|
id: `${id.current}-label`,
|
7531
7334
|
htmlFor: id.current,
|
7532
7335
|
messageId: errorMessageId,
|
7533
7336
|
length: value !== void 0 ? (0, import_toString2.default)(value).length : void 0,
|
7534
7337
|
...labelControlProps
|
7535
|
-
}, /* @__PURE__ */
|
7338
|
+
}, /* @__PURE__ */ import_react84.default.createElement(TextareaBase, {
|
7536
7339
|
ref,
|
7537
7340
|
...baseProps,
|
7538
7341
|
...errorProps,
|
@@ -7548,12 +7351,158 @@ var Textarea = import_react83.default.forwardRef((props, ref) => {
|
|
7548
7351
|
valid: props.valid
|
7549
7352
|
}));
|
7550
7353
|
});
|
7551
|
-
var TextAreaSkeleton = () => /* @__PURE__ */
|
7354
|
+
var TextAreaSkeleton = () => /* @__PURE__ */ import_react84.default.createElement(LabelControl.Skeleton, null, /* @__PURE__ */ import_react84.default.createElement(TextareaBase.Skeleton, null));
|
7552
7355
|
Textarea.Skeleton = TextAreaSkeleton;
|
7553
7356
|
|
7357
|
+
// src/components/Pagination/usePagination.tsx
|
7358
|
+
var import_react85 = require("react");
|
7359
|
+
var initialState = {
|
7360
|
+
currentPage: 1,
|
7361
|
+
pageSize: 10
|
7362
|
+
};
|
7363
|
+
var getPageIndex = (currentPage, pageSize) => currentPage === 0 ? 0 : (currentPage - 1) * pageSize;
|
7364
|
+
var usePagination = (items, options) => {
|
7365
|
+
const [currentPage, setCurrentPage] = (0, import_react85.useState)(options?.initialPage || initialState.currentPage);
|
7366
|
+
const [pageSize, setPageSize] = (0, import_react85.useState)(options?.initialPageSize || initialState.pageSize);
|
7367
|
+
const totalPages = items.length > 0 ? Math.ceil(items.length / pageSize) : 1;
|
7368
|
+
const hasPreviousPage = currentPage > 1;
|
7369
|
+
const hasNextPage = currentPage < totalPages;
|
7370
|
+
const pageIndex = getPageIndex(currentPage, pageSize);
|
7371
|
+
const onPageSizeChange = (pageSize2) => {
|
7372
|
+
setPageSize(pageSize2);
|
7373
|
+
setCurrentPage(options?.initialPage || initialState.currentPage);
|
7374
|
+
};
|
7375
|
+
(0, import_react85.useEffect)(() => {
|
7376
|
+
setCurrentPage(options?.initialPage || initialState.currentPage);
|
7377
|
+
}, [items.length]);
|
7378
|
+
return [
|
7379
|
+
items.slice(pageIndex, Math.min(pageIndex + pageSize, items.length)),
|
7380
|
+
{
|
7381
|
+
currentPage,
|
7382
|
+
totalPages,
|
7383
|
+
pageSize,
|
7384
|
+
hasPreviousPage,
|
7385
|
+
hasNextPage,
|
7386
|
+
onPageChange: setCurrentPage,
|
7387
|
+
onPageSizeChange
|
7388
|
+
}
|
7389
|
+
];
|
7390
|
+
};
|
7391
|
+
|
7554
7392
|
// src/components/index.ts
|
7555
7393
|
var SelectItem = Select.Item;
|
7556
7394
|
|
7395
|
+
// src/utils/positioner.ts
|
7396
|
+
var import_clamp3 = __toESM(require("lodash/clamp"));
|
7397
|
+
var PositionerPlacement = /* @__PURE__ */ ((PositionerPlacement2) => {
|
7398
|
+
PositionerPlacement2["top"] = "top";
|
7399
|
+
PositionerPlacement2["left"] = "left";
|
7400
|
+
PositionerPlacement2["bottom"] = "bottom";
|
7401
|
+
PositionerPlacement2["right"] = "right";
|
7402
|
+
PositionerPlacement2["topLeft"] = "top-left";
|
7403
|
+
PositionerPlacement2["topRight"] = "top-right";
|
7404
|
+
PositionerPlacement2["bottomLeft"] = "bottom-left";
|
7405
|
+
PositionerPlacement2["bottomRight"] = "bottom-right";
|
7406
|
+
return PositionerPlacement2;
|
7407
|
+
})(PositionerPlacement || {});
|
7408
|
+
var placementOrder = [
|
7409
|
+
"top" /* top */,
|
7410
|
+
"top-left" /* topLeft */,
|
7411
|
+
"top-right" /* topRight */,
|
7412
|
+
"right" /* right */,
|
7413
|
+
"bottom" /* bottom */,
|
7414
|
+
"bottom-left" /* bottomLeft */,
|
7415
|
+
"bottom-right" /* bottomRight */,
|
7416
|
+
"left" /* left */
|
7417
|
+
];
|
7418
|
+
var POSITIONER_MOUNT_ELEMENT_ID = "positioner-root";
|
7419
|
+
function createMountPointElement() {
|
7420
|
+
const mountElement = document.createElement("div");
|
7421
|
+
mountElement.id = POSITIONER_MOUNT_ELEMENT_ID;
|
7422
|
+
return mountElement;
|
7423
|
+
}
|
7424
|
+
function calcBottomPosition(triggerRect, contentRect, padding) {
|
7425
|
+
return {
|
7426
|
+
x: triggerRect.left - (contentRect.width / 2 - triggerRect.width / 2),
|
7427
|
+
y: triggerRect.top + triggerRect.height + padding
|
7428
|
+
};
|
7429
|
+
}
|
7430
|
+
function calcTopPosition(triggerRect, contentRect, padding) {
|
7431
|
+
return {
|
7432
|
+
x: triggerRect.left - (contentRect.width / 2 - triggerRect.width / 2),
|
7433
|
+
y: triggerRect.top - contentRect.height - padding
|
7434
|
+
};
|
7435
|
+
}
|
7436
|
+
function calcLeftPosition(triggerRect, contentRect, padding) {
|
7437
|
+
return {
|
7438
|
+
x: triggerRect.left - contentRect.width - padding,
|
7439
|
+
y: triggerRect.top - (contentRect.height / 2 - triggerRect.height / 2)
|
7440
|
+
};
|
7441
|
+
}
|
7442
|
+
function calcRightPosition(triggerRect, contentRect, padding) {
|
7443
|
+
return {
|
7444
|
+
x: triggerRect.left + triggerRect.width + padding,
|
7445
|
+
y: triggerRect.top - (contentRect.height / 2 - triggerRect.height / 2)
|
7446
|
+
};
|
7447
|
+
}
|
7448
|
+
function calcBottomLeftPosition(triggerRect, contentRect, padding) {
|
7449
|
+
return {
|
7450
|
+
x: triggerRect.left - contentRect.width - padding,
|
7451
|
+
y: triggerRect.top + triggerRect.height + padding
|
7452
|
+
};
|
7453
|
+
}
|
7454
|
+
function calcBottomRightPosition(triggerRect, contentRect, padding) {
|
7455
|
+
return {
|
7456
|
+
x: triggerRect.left + triggerRect.width + padding,
|
7457
|
+
y: triggerRect.top + triggerRect.height + padding
|
7458
|
+
};
|
7459
|
+
}
|
7460
|
+
function calcTopLeftPosition(triggerRect, contentRect, padding) {
|
7461
|
+
return {
|
7462
|
+
x: triggerRect.left - contentRect.width - padding,
|
7463
|
+
y: triggerRect.top - contentRect.height - padding
|
7464
|
+
};
|
7465
|
+
}
|
7466
|
+
function calcTopRightPosition(triggerRect, contentRect, padding) {
|
7467
|
+
return {
|
7468
|
+
x: triggerRect.left + triggerRect.width + padding,
|
7469
|
+
y: triggerRect.top - contentRect.height - padding
|
7470
|
+
};
|
7471
|
+
}
|
7472
|
+
var positionCalcFuncs = {
|
7473
|
+
["top" /* top */]: calcTopPosition,
|
7474
|
+
["top-left" /* topLeft */]: calcTopLeftPosition,
|
7475
|
+
["top-right" /* topRight */]: calcTopRightPosition,
|
7476
|
+
["bottom" /* bottom */]: calcBottomPosition,
|
7477
|
+
["bottom-left" /* bottomLeft */]: calcBottomLeftPosition,
|
7478
|
+
["bottom-right" /* bottomRight */]: calcBottomRightPosition,
|
7479
|
+
["left" /* left */]: calcLeftPosition,
|
7480
|
+
["right" /* right */]: calcRightPosition
|
7481
|
+
};
|
7482
|
+
function isOutOfBounds(position) {
|
7483
|
+
return position.x < 0 || position.x > window.innerWidth;
|
7484
|
+
}
|
7485
|
+
function calcPosition(triggerRect, contentRect, placement, padding) {
|
7486
|
+
return positionCalcFuncs[placement](triggerRect, contentRect, padding);
|
7487
|
+
}
|
7488
|
+
function calcBestPosition(triggerRect, contentRect, placement, padding) {
|
7489
|
+
let attempts = 0;
|
7490
|
+
return function _calcBestPosition(triggerRect2, contentRect2, placement2, padding2) {
|
7491
|
+
attempts++;
|
7492
|
+
const position = calcPosition(triggerRect2, contentRect2, placement2, padding2);
|
7493
|
+
const hasAttemptsLeft = attempts < placementOrder.length;
|
7494
|
+
if (isOutOfBounds(position) && hasAttemptsLeft) {
|
7495
|
+
const nextPlacementAttempt = placementOrder[placementOrder.findIndex((p) => placement2 === p) + 1] || placementOrder[0];
|
7496
|
+
return _calcBestPosition(triggerRect2, contentRect2, nextPlacementAttempt, padding2);
|
7497
|
+
} else {
|
7498
|
+
return {
|
7499
|
+
x: (0, import_clamp3.default)(position.x + window.scrollX, 0, window.innerWidth),
|
7500
|
+
y: position.y + window.scrollY
|
7501
|
+
};
|
7502
|
+
}
|
7503
|
+
}(triggerRect, contentRect, placement, padding);
|
7504
|
+
}
|
7505
|
+
|
7557
7506
|
// src/system.ts
|
7558
7507
|
var system_default = {
|
7559
7508
|
...components_exports,
|
@@ -7626,7 +7575,6 @@ var system_default = {
|
|
7626
7575
|
Popover,
|
7627
7576
|
PopoverDialog,
|
7628
7577
|
Portal,
|
7629
|
-
Positioner,
|
7630
7578
|
PositionerPlacement,
|
7631
7579
|
PrimaryButton,
|
7632
7580
|
PrimaryDropdownButton,
|
@@ -7637,6 +7585,7 @@ var system_default = {
|
|
7637
7585
|
SecondaryButton,
|
7638
7586
|
SecondaryDropdownButton,
|
7639
7587
|
SecondaryGhostButton,
|
7588
|
+
Section,
|
7640
7589
|
SegmentedControl,
|
7641
7590
|
SegmentedControlGroup,
|
7642
7591
|
Select,
|
@@ -7678,6 +7627,7 @@ var system_default = {
|
|
7678
7627
|
isOutOfBounds,
|
7679
7628
|
placementOrder,
|
7680
7629
|
theme,
|
7630
|
+
usePagination,
|
7681
7631
|
usePopoverContext,
|
7682
7632
|
useScrollTarget,
|
7683
7633
|
useTableSelect,
|