@heymantle/litho 0.0.13 → 0.0.15
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/README.md +52 -0
- package/dist/cjs/components/Card.js +1 -1
- package/dist/cjs/components/Disclosure.js +46 -15
- package/dist/cjs/components/DropZone.js +93 -37
- package/dist/cjs/components/Layout.js +4 -2
- package/dist/cjs/components/Modal.js +14 -3
- package/dist/cjs/components/Navigation.js +4 -3
- package/dist/cjs/components/Popover.js +58 -13
- package/dist/cjs/components/Select.js +4 -0
- package/dist/cjs/components/TabNavigation.js +65 -11
- package/dist/cjs/components/Table.js +27 -11
- package/dist/cjs/components/Tabs.js +33 -2
- package/dist/cjs/components/TextField.js +4 -2
- package/dist/cjs/components/ToastNotification.js +368 -0
- package/dist/cjs/components/ToastProvider.js +342 -0
- package/dist/cjs/index.js +11 -0
- package/dist/cjs/playwright.config.js +114 -0
- package/dist/cjs/styles/Table.js +2 -7
- package/dist/cjs/tests/visual/stories.spec.js +637 -0
- package/dist/cjs/utilities/dates.js +7 -7
- package/dist/esm/components/Card.js +1 -1
- package/dist/esm/components/Disclosure.js +36 -5
- package/dist/esm/components/DropZone.js +94 -38
- package/dist/esm/components/Layout.js +4 -2
- package/dist/esm/components/Modal.js +14 -3
- package/dist/esm/components/Navigation.js +4 -3
- package/dist/esm/components/Popover.js +58 -13
- package/dist/esm/components/Select.js +5 -1
- package/dist/esm/components/TabNavigation.js +65 -11
- package/dist/esm/components/Table.js +27 -11
- package/dist/esm/components/Tabs.js +33 -2
- package/dist/esm/components/TextField.js +4 -2
- package/dist/esm/components/ToastNotification.js +353 -0
- package/dist/esm/components/ToastProvider.js +336 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/playwright.config.js +104 -0
- package/dist/esm/styles/Table.js +2 -7
- package/dist/esm/tests/visual/stories.spec.js +633 -0
- package/dist/esm/utilities/dates.js +7 -7
- package/dist/types/components/Disclosure.d.ts.map +1 -1
- package/dist/types/components/DropZone.d.ts +2 -0
- package/dist/types/components/DropZone.d.ts.map +1 -1
- package/dist/types/components/Layout.d.ts.map +1 -1
- package/dist/types/components/Modal.d.ts.map +1 -1
- package/dist/types/components/Navigation.d.ts +1 -0
- package/dist/types/components/Navigation.d.ts.map +1 -1
- package/dist/types/components/Popover.d.ts +2 -0
- package/dist/types/components/Popover.d.ts.map +1 -1
- package/dist/types/components/Select.d.ts.map +1 -1
- package/dist/types/components/TabNavigation.d.ts.map +1 -1
- package/dist/types/components/Table.d.ts.map +1 -1
- package/dist/types/components/Tabs.d.ts +45 -1
- package/dist/types/components/Tabs.d.ts.map +1 -1
- package/dist/types/components/TextField.d.ts +2 -0
- package/dist/types/components/TextField.d.ts.map +1 -1
- package/dist/types/components/ToastNotification.d.ts +36 -0
- package/dist/types/components/ToastNotification.d.ts.map +1 -0
- package/dist/types/components/ToastProvider.d.ts +21 -0
- package/dist/types/components/ToastProvider.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/styles/Table.d.ts.map +1 -1
- package/index.css +3 -0
- package/package.json +12 -3
|
@@ -99,9 +99,57 @@ var gradientOverlayStyles = (0, _tailwindvariants.tv)({
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
|
+
var containerStyles = (0, _tailwindvariants.tv)({
|
|
103
|
+
base: "w-2 h-2 rounded-full relative overflow-hidden bg-tint-2 flex-shrink-0",
|
|
104
|
+
variants: {
|
|
105
|
+
readStatus: {
|
|
106
|
+
full: ""
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
defaultVariants: {
|
|
110
|
+
readStatus: "read"
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
var readStatusStyles = (0, _tailwindvariants.tv)({
|
|
114
|
+
base: "absolute w-full h-full",
|
|
115
|
+
variants: {
|
|
116
|
+
readStatus: {
|
|
117
|
+
read: "",
|
|
118
|
+
partiallyRead: "bg-brand-saturated",
|
|
119
|
+
unread: "bg-brand-saturated"
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
defaultVariants: {
|
|
123
|
+
readStatus: "read"
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
// Small read status indicator for tabs
|
|
127
|
+
function TabReadStatusIndicator(param) {
|
|
128
|
+
var readStatus = param.readStatus;
|
|
129
|
+
if (!readStatus || !readStatus.status) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
var status = readStatus.status;
|
|
133
|
+
// Don't show indicator for read threads
|
|
134
|
+
if (status === "read") {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
var containerClasses = containerStyles({
|
|
138
|
+
readStatus: status
|
|
139
|
+
});
|
|
140
|
+
var readStatusClasses = readStatusStyles({
|
|
141
|
+
readStatus: status
|
|
142
|
+
});
|
|
143
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
144
|
+
className: containerClasses,
|
|
145
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
146
|
+
className: readStatusClasses
|
|
147
|
+
})
|
|
148
|
+
});
|
|
149
|
+
}
|
|
102
150
|
// Component to handle truncation detection and tooltip
|
|
103
151
|
function TabTitle(param) {
|
|
104
|
-
var title = param.title, isActive = param.isActive, tabContainerRef = param.tabContainerRef;
|
|
152
|
+
var title = param.title, isActive = param.isActive, tabContainerRef = param.tabContainerRef, readStatus = param.readStatus;
|
|
105
153
|
var _useState = _sliced_to_array((0, _react.useState)(false), 2), shouldShowTooltip = _useState[0], setShouldShowTooltip = _useState[1];
|
|
106
154
|
(0, _react.useLayoutEffect)(function() {
|
|
107
155
|
if (!title || !(tabContainerRef === null || tabContainerRef === void 0 ? void 0 : tabContainerRef.current)) {
|
|
@@ -138,16 +186,21 @@ function TabTitle(param) {
|
|
|
138
186
|
title,
|
|
139
187
|
tabContainerRef
|
|
140
188
|
]);
|
|
141
|
-
var textElement = /*#__PURE__*/ (0, _jsxruntime.
|
|
142
|
-
className: "overflow-hidden",
|
|
143
|
-
children:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
189
|
+
var textElement = /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
190
|
+
className: "overflow-hidden flex items-center gap-1.5 min-w-0",
|
|
191
|
+
children: [
|
|
192
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_Text.default, {
|
|
193
|
+
variant: "bodyXs",
|
|
194
|
+
className: "".concat(textStyles({
|
|
195
|
+
isActive: isActive
|
|
196
|
+
}), " min-w-0 flex-1"),
|
|
197
|
+
clampLines: 1,
|
|
198
|
+
children: title
|
|
147
199
|
}),
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
200
|
+
readStatus && /*#__PURE__*/ (0, _jsxruntime.jsx)(TabReadStatusIndicator, {
|
|
201
|
+
readStatus: readStatus
|
|
202
|
+
})
|
|
203
|
+
]
|
|
151
204
|
});
|
|
152
205
|
// Only show tooltip if text is likely truncated based on character count vs tab width
|
|
153
206
|
if (shouldShowTooltip) {
|
|
@@ -266,7 +319,8 @@ function TabNavigation() {
|
|
|
266
319
|
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(TabTitle, {
|
|
267
320
|
title: tab.title,
|
|
268
321
|
isActive: isActive,
|
|
269
|
-
tabContainerRef: tabRef
|
|
322
|
+
tabContainerRef: tabRef,
|
|
323
|
+
readStatus: tab.readStatus
|
|
270
324
|
}),
|
|
271
325
|
/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
272
326
|
className: "".concat(gradientOverlayStyles({
|
|
@@ -28,6 +28,7 @@ var _Text = /*#__PURE__*/ _interop_require_default(require("./Text"));
|
|
|
28
28
|
var _Tooltip = /*#__PURE__*/ _interop_require_default(require("./Tooltip"));
|
|
29
29
|
var _Table = require("../styles/Table");
|
|
30
30
|
var _useIndexResourceState = require("../utilities/useIndexResourceState");
|
|
31
|
+
var _useMobile = require("../utilities/useMobile");
|
|
31
32
|
var _useMounted = require("../utilities/useMounted");
|
|
32
33
|
var _useTableScrollState = /*#__PURE__*/ _interop_require_default(require("../utilities/useTableScrollState"));
|
|
33
34
|
function _array_like_to_array(arr, len) {
|
|
@@ -502,6 +503,8 @@ var TableWrapperContext = /*#__PURE__*/ (0, _react.createContext)({});
|
|
|
502
503
|
var alignment = cellAlignment[indexAdjusted];
|
|
503
504
|
var isSortable = sortable && sortable.length > 0 && sortable[indexAdjusted];
|
|
504
505
|
var sortIndex = selectable ? indexAdjusted - 1 : indexAdjusted;
|
|
506
|
+
// Check if this cell is covered by a fixed overlay
|
|
507
|
+
var isCovered = !fixed && !reverseColumns && (fixedFirstColumns > 0 && indexAdjusted < fixedFirstColumns || fixedLastColumns > 0 && indexAdjusted >= headings.length - fixedLastColumns);
|
|
505
508
|
var sortContent = isSortable ? /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
506
509
|
className: "min-h-5 ".concat(sort.index === sortIndex ? "opacity-100" : "opacity-0 group-hover:opacity-100"),
|
|
507
510
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Icon.default, {
|
|
@@ -536,6 +539,7 @@ var TableWrapperContext = /*#__PURE__*/ (0, _react.createContext)({});
|
|
|
536
539
|
].includes(alignment) && sortContent
|
|
537
540
|
]
|
|
538
541
|
});
|
|
542
|
+
var hasTooltip = (heading.tooltip || heading.tooltipContent) && !isCovered;
|
|
539
543
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(HeadingCell, {
|
|
540
544
|
className: _Table.styles.headingStyles({
|
|
541
545
|
hidden: hideCell,
|
|
@@ -553,7 +557,7 @@ var TableWrapperContext = /*#__PURE__*/ (0, _react.createContext)({});
|
|
|
553
557
|
className: _Table.styles.headingLabelContainerStyles({
|
|
554
558
|
alignment: alignment
|
|
555
559
|
}),
|
|
556
|
-
children: heading.hidden ? null :
|
|
560
|
+
children: heading.hidden ? null : hasTooltip ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_Tooltip.default, {
|
|
557
561
|
content: heading.tooltip || heading.tooltipContent,
|
|
558
562
|
preferredPosition: "above",
|
|
559
563
|
children: labelContent
|
|
@@ -669,12 +673,16 @@ var TableWrapperContext = /*#__PURE__*/ (0, _react.createContext)({});
|
|
|
669
673
|
value: {
|
|
670
674
|
columnsToRender: columnsToRender,
|
|
671
675
|
reverseColumns: reverseColumns,
|
|
672
|
-
hideCellsOnMobile: hideCellsOnMobile
|
|
676
|
+
hideCellsOnMobile: hideCellsOnMobile,
|
|
677
|
+
isFixedOverlay: fixed,
|
|
678
|
+
fixedFirstColumns: fixedFirstColumns,
|
|
679
|
+
fixedLastColumns: fixedLastColumns
|
|
673
680
|
},
|
|
674
681
|
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)("table", {
|
|
675
682
|
className: _Table.styles.tableStyles(),
|
|
676
683
|
children: [
|
|
677
684
|
hasHeadings && renderHeadings({
|
|
685
|
+
fixed: fixed,
|
|
678
686
|
hidden: true,
|
|
679
687
|
columnsToRender: columnsToRender,
|
|
680
688
|
reverseColumns: reverseColumns,
|
|
@@ -807,7 +815,8 @@ var TableWrapperContext = /*#__PURE__*/ (0, _react.createContext)({});
|
|
|
807
815
|
increasedTableDensity: increasedTableDensity,
|
|
808
816
|
tableContainerRef: tableContainerRef,
|
|
809
817
|
cellAlignment: cellAlignment,
|
|
810
|
-
noBodyCellPadding: noBodyCellPadding
|
|
818
|
+
noBodyCellPadding: noBodyCellPadding,
|
|
819
|
+
columnWidths: columnWidths
|
|
811
820
|
},
|
|
812
821
|
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
813
822
|
"data-id": idRef.current,
|
|
@@ -858,8 +867,7 @@ var TableWrapperContext = /*#__PURE__*/ (0, _react.createContext)({});
|
|
|
858
867
|
children: renderTable({
|
|
859
868
|
classes: "relative overflow-hidden",
|
|
860
869
|
fixed: true,
|
|
861
|
-
columnsToRender: fixedFirstColumns
|
|
862
|
-
hideCellsOnMobile: true
|
|
870
|
+
columnsToRender: fixedFirstColumns
|
|
863
871
|
})
|
|
864
872
|
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
865
873
|
className: _Table.styles.overflowShadowStyles({
|
|
@@ -877,8 +885,7 @@ var TableWrapperContext = /*#__PURE__*/ (0, _react.createContext)({});
|
|
|
877
885
|
classes: "relative overflow-hidden",
|
|
878
886
|
fixed: true,
|
|
879
887
|
columnsToRender: fixedLastColumns,
|
|
880
|
-
reverseColumns: true
|
|
881
|
-
hideCellsOnMobile: true
|
|
888
|
+
reverseColumns: true
|
|
882
889
|
})
|
|
883
890
|
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
884
891
|
className: _Table.styles.overflowShadowStyles({
|
|
@@ -1023,8 +1030,11 @@ Table.Row.displayName = "Table.Row";
|
|
|
1023
1030
|
*/ function Cell(param) {
|
|
1024
1031
|
var tmp = param.alignment, _alignment = tmp === void 0 ? "start" : tmp, children = param.children, _param_selectionCell = param.selectionCell, selectionCell = _param_selectionCell === void 0 ? false : _param_selectionCell;
|
|
1025
1032
|
var _useContext = (0, _react.useContext)(TableContext), cellAlignment = _useContext.cellAlignment, increasedTableDensity = _useContext.increasedTableDensity, selectable = _useContext.selectable, noBodyCellPadding = _useContext.noBodyCellPadding;
|
|
1026
|
-
var _useContext1 = (0, _react.useContext)(TableWrapperContext), hideCellsOnMobile = _useContext1.hideCellsOnMobile, reverseColumns = _useContext1.reverseColumns, columnsToRender = _useContext1.columnsToRender;
|
|
1033
|
+
var _useContext1 = (0, _react.useContext)(TableWrapperContext), hideCellsOnMobile = _useContext1.hideCellsOnMobile, reverseColumns = _useContext1.reverseColumns, columnsToRender = _useContext1.columnsToRender, isFixedOverlay = _useContext1.isFixedOverlay, fixedFirstColumns = _useContext1.fixedFirstColumns, fixedLastColumns = _useContext1.fixedLastColumns;
|
|
1034
|
+
var isMobile = (0, _useMobile.useMobile)();
|
|
1027
1035
|
var columnCount = (cellAlignment === null || cellAlignment === void 0 ? void 0 : cellAlignment.length) || 0;
|
|
1036
|
+
// Use state instead of ref so changes trigger re-render
|
|
1037
|
+
var _useState = _sliced_to_array((0, _react.useState)(-1), 2), cellIndex = _useState[0], setCellIndex = _useState[1];
|
|
1028
1038
|
var cellIndexRef = (0, _react.useRef)(null);
|
|
1029
1039
|
var setCellRef = (0, _react.useCallback)(function(node) {
|
|
1030
1040
|
if (!node || cellIndexRef.current !== null) return;
|
|
@@ -1032,16 +1042,21 @@ Table.Row.displayName = "Table.Row";
|
|
|
1032
1042
|
if ((parentRow === null || parentRow === void 0 ? void 0 : parentRow.tagName) === "TR") {
|
|
1033
1043
|
var totalCells = parentRow.children.length;
|
|
1034
1044
|
var index = node.cellIndex;
|
|
1035
|
-
|
|
1045
|
+
var calculatedIndex = reverseColumns ? totalCells - columnsToRender + index - (totalCells - columnCount) : index;
|
|
1046
|
+
cellIndexRef.current = calculatedIndex;
|
|
1047
|
+
setCellIndex(calculatedIndex);
|
|
1036
1048
|
}
|
|
1037
1049
|
}, [
|
|
1038
1050
|
reverseColumns,
|
|
1039
1051
|
columnsToRender,
|
|
1040
1052
|
columnCount
|
|
1041
1053
|
]);
|
|
1042
|
-
var _cellIndexRef_current;
|
|
1043
|
-
var cellIndex = (_cellIndexRef_current = cellIndexRef.current) !== null && _cellIndexRef_current !== void 0 ? _cellIndexRef_current : -1;
|
|
1044
1054
|
var alignment = (cellAlignment === null || cellAlignment === void 0 ? void 0 : cellAlignment[cellIndex]) || _alignment;
|
|
1055
|
+
// Check if this cell is covered by a fixed overlay
|
|
1056
|
+
// When cellIndex is unknown (-1), conservatively assume the cell might be covered
|
|
1057
|
+
// if there are any fixed columns. This prevents duplicate popovers during the
|
|
1058
|
+
// brief window between initial render and when cellIndex is calculated.
|
|
1059
|
+
var isCoveredByFixedOverlay = !isFixedOverlay && !reverseColumns && (cellIndex === -1 ? fixedFirstColumns > 0 || fixedLastColumns > 0 : fixedFirstColumns > 0 && cellIndex < fixedFirstColumns || fixedLastColumns > 0 && cellIndex >= columnCount - fixedLastColumns);
|
|
1045
1060
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)("td", {
|
|
1046
1061
|
ref: setCellRef,
|
|
1047
1062
|
className: _Table.styles.cellStyles({
|
|
@@ -1052,6 +1067,7 @@ Table.Row.displayName = "Table.Row";
|
|
|
1052
1067
|
tableIsSelectable: selectable,
|
|
1053
1068
|
noBodyCellPadding: noBodyCellPadding
|
|
1054
1069
|
}),
|
|
1070
|
+
inert: !isMobile && isCoveredByFixedOverlay || undefined,
|
|
1055
1071
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
1056
1072
|
className: _Table.styles.cellContentStyles({
|
|
1057
1073
|
alignment: alignment
|
|
@@ -17,6 +17,7 @@ var _ActionList = /*#__PURE__*/ _interop_require_default(require("./ActionList")
|
|
|
17
17
|
var _Icon = /*#__PURE__*/ _interop_require_default(require("./Icon"));
|
|
18
18
|
var _Popover = /*#__PURE__*/ _interop_require_default(require("./Popover"));
|
|
19
19
|
var _polarisicons = /*#__PURE__*/ _interop_require_wildcard(require("@shopify/polaris-icons"));
|
|
20
|
+
var _Badge = /*#__PURE__*/ _interop_require_default(require("./Badge"));
|
|
20
21
|
function _array_like_to_array(arr, len) {
|
|
21
22
|
if (len == null || len > arr.length) len = arr.length;
|
|
22
23
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -195,6 +196,8 @@ var containerStyles = (0, _tailwindvariants.tv)({
|
|
|
195
196
|
* @param {boolean} [props.padded=true] - If true, applies padding to the Tabs container.
|
|
196
197
|
* @param {boolean} [props.borderBottom=true] - If true, applies a bottom border to the Tabs container.
|
|
197
198
|
* @param {boolean} [props.simpleTabs=false] - If true, simplifies the styling for the selected tab.
|
|
199
|
+
* @param {number} [props.badgeCount] - The number of badges to display for the tab.
|
|
200
|
+
* @param {string} [props.badgeStatus="default"] - The status of the badge.
|
|
198
201
|
* @returns {JSX.Element} The Tabs component.
|
|
199
202
|
*/ function Tabs() {
|
|
200
203
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
@@ -308,6 +311,8 @@ var containerStyles = (0, _tailwindvariants.tv)({
|
|
|
308
311
|
fullWidth: fullWidth,
|
|
309
312
|
hidden: tab.hidden,
|
|
310
313
|
simple: simpleTabs,
|
|
314
|
+
badgeCount: tab.badgeCount,
|
|
315
|
+
badgeStatus: tab.badgeStatus,
|
|
311
316
|
children: tab.content
|
|
312
317
|
}, "tab-".concat(tab.originalIndex));
|
|
313
318
|
})
|
|
@@ -400,9 +405,30 @@ var tabStyles = (0, _tailwindvariants.tv)({
|
|
|
400
405
|
}
|
|
401
406
|
]
|
|
402
407
|
});
|
|
403
|
-
|
|
408
|
+
/**
|
|
409
|
+
* Individual tab item component used within the Tabs component.
|
|
410
|
+
*
|
|
411
|
+
* @param {Object} props - Component props.
|
|
412
|
+
* @param {string} [props.id] - Unique identifier for the tab, used to generate the DOM element ID.
|
|
413
|
+
* @param {boolean} [props.active] - Whether the tab's disclosure popover is currently active/open.
|
|
414
|
+
* @param {boolean} [props.selected] - Whether this tab is currently selected.
|
|
415
|
+
* @param {number} [props.index] - The index position of this tab in the tabs array.
|
|
416
|
+
* @param {string|React.ReactNode} [props.icon] - Icon to display. Can be a Polaris icon name string or a custom React node.
|
|
417
|
+
* @param {Function} [props.onSelect] - Callback fired when the tab is selected, receives the tab's index.
|
|
418
|
+
* @param {Function} [props.onClick] - Custom click handler that overrides the default onSelect behavior.
|
|
419
|
+
* @param {React.ReactNode} [props.children] - The content/label to display inside the tab.
|
|
420
|
+
* @param {boolean} [props.fullWidth] - Whether the tab should expand to fill available space.
|
|
421
|
+
* @param {boolean} [props.hidden] - Whether the tab should be visually hidden (used for overflow handling).
|
|
422
|
+
* @param {boolean} [props.simple] - Whether to use simplified styling (no background, column layout).
|
|
423
|
+
* @param {boolean} [props.disclosure=false] - Whether to show a disclosure caret icon when selected.
|
|
424
|
+
* @param {boolean} [props.alwaysShowDisclosureIcon=false] - Whether to always show the disclosure icon regardless of selection state.
|
|
425
|
+
* @param {boolean} [props.disabled=false] - Whether the tab is disabled.
|
|
426
|
+
* @param {string} [props.badgeStatus="default"] - The status variant of the badge (e.g., "default", "success", "warning").
|
|
427
|
+
* @param {number} [props.badgeCount] - If provided (>= 0), displays a badge with this count.
|
|
428
|
+
* @returns {JSX.Element} The Tab component.
|
|
429
|
+
*/ function Tab() {
|
|
404
430
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
405
|
-
var id = props.id, active = props.active, selected = props.selected, index = props.index, icon = props.icon, onSelect = props.onSelect, onClick = props.onClick, children = props.children, fullWidth = props.fullWidth, hidden = props.hidden, simple = props.simple, _props_disclosure = props.disclosure, disclosure = _props_disclosure === void 0 ? false : _props_disclosure, _props_alwaysShowDisclosureIcon = props.alwaysShowDisclosureIcon, alwaysShowDisclosureIcon = _props_alwaysShowDisclosureIcon === void 0 ? false : _props_alwaysShowDisclosureIcon, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled;
|
|
431
|
+
var id = props.id, active = props.active, selected = props.selected, index = props.index, icon = props.icon, onSelect = props.onSelect, onClick = props.onClick, children = props.children, fullWidth = props.fullWidth, hidden = props.hidden, simple = props.simple, _props_disclosure = props.disclosure, disclosure = _props_disclosure === void 0 ? false : _props_disclosure, _props_alwaysShowDisclosureIcon = props.alwaysShowDisclosureIcon, alwaysShowDisclosureIcon = _props_alwaysShowDisclosureIcon === void 0 ? false : _props_alwaysShowDisclosureIcon, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled, _props_badgeStatus = props.badgeStatus, badgeStatus = _props_badgeStatus === void 0 ? "default" : _props_badgeStatus, badgeCount = props.badgeCount;
|
|
406
432
|
var polarisIcon = typeof icon === "string" ? _polarisicons[icon] : _polarisicons[icon === null || icon === void 0 ? void 0 : icon.displayName];
|
|
407
433
|
var showDisclosure = disclosure && (selected || alwaysShowDisclosureIcon);
|
|
408
434
|
var tabClasses = tabStyles({
|
|
@@ -443,6 +469,11 @@ function Tab() {
|
|
|
443
469
|
color: selected && simple ? "default" : selected ? "active" : "subdued",
|
|
444
470
|
size: simple ? "lg" : undefined
|
|
445
471
|
})
|
|
472
|
+
}),
|
|
473
|
+
badgeCount >= 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(_Badge.default, {
|
|
474
|
+
status: badgeStatus,
|
|
475
|
+
className: "ml-1",
|
|
476
|
+
children: badgeCount
|
|
446
477
|
})
|
|
447
478
|
]
|
|
448
479
|
});
|
|
@@ -282,10 +282,11 @@ var clearButtonStyles = (0, _tailwindvariants.tv)({
|
|
|
282
282
|
* @param {Function} [props.onKeyDown] - Handler for key down.
|
|
283
283
|
* @param {ReactNode} [props.tooltip] - Tooltip content for the label.
|
|
284
284
|
* @param {string} [props.className] - Additional CSS classes.
|
|
285
|
+
* @param {boolean} [props.disableFocusStyles=false] - Whether to disable focused styles when the input is focused.
|
|
285
286
|
* @returns {JSX.Element} The rendered TextField component.
|
|
286
287
|
*/ function TextField() {
|
|
287
288
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
288
|
-
var prefix = props.prefix, _suffix = props.suffix, placeholder = props.placeholder, _props_value = props.value, value = _props_value === void 0 ? "" : _props_value, helpText = props.helpText, label = props.label, _props_labelVariant = props.labelVariant, labelVariant = _props_labelVariant === void 0 ? "bodyMd" : _props_labelVariant, labelAction = props.labelAction, labelHidden = props.labelHidden, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled, clearButton = props.clearButton, readOnly = props.readOnly, autoFocus = props.autoFocus, _focused = props.focused, _props_multiline = props.multiline, multiline = _props_multiline === void 0 ? 1 : _props_multiline, _props_autoGrow = props.autoGrow, autoGrow = _props_autoGrow === void 0 ? false : _props_autoGrow, maxHeight = props.maxHeight, error = props.error, connectedRight = props.connectedRight, connectedLeft = props.connectedLeft, _props_type = props.type, type = _props_type === void 0 ? "text" : _props_type, _props_subdued = props.subdued, subdued = _props_subdued === void 0 ? false : _props_subdued, name = props.name, _id = props.id, role = props.role, step = props.step, _props_largeStep = props.largeStep, largeStep = _props_largeStep === void 0 ? 10 : _props_largeStep, autoComplete = props.autoComplete, max = props.max, maxLength = props.maxLength, min = props.min, minLength = props.minLength, _props_showCharacterCount = props.showCharacterCount, showCharacterCount = _props_showCharacterCount === void 0 ? false : _props_showCharacterCount, pattern = props.pattern, spellCheck = props.spellCheck, ariaOwns = props.ariaOwns, ariaControls = props.ariaControls, ariaExpanded = props.ariaExpanded, ariaActiveDescendant = props.ariaActiveDescendant, ariaAutocomplete = props.ariaAutocomplete, _props_align = props.align, align = _props_align === void 0 ? "left" : _props_align, requiredIndicator = props.requiredIndicator, selectTextOnFocus = props.selectTextOnFocus, onClearButtonClick = props.onClearButtonClick, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, tooltip = props.tooltip, className = props.className, _inputRef = props.inputRef, icon = props.icon, _props_transparent = props.transparent, transparent = _props_transparent === void 0 ? false : _props_transparent, _props_showNumberSteppers = props.showNumberSteppers, showNumberSteppers = _props_showNumberSteppers === void 0 ? true : _props_showNumberSteppers, onKeyDown = props.onKeyDown;
|
|
289
|
+
var prefix = props.prefix, _suffix = props.suffix, placeholder = props.placeholder, _props_value = props.value, value = _props_value === void 0 ? "" : _props_value, helpText = props.helpText, label = props.label, _props_labelVariant = props.labelVariant, labelVariant = _props_labelVariant === void 0 ? "bodyMd" : _props_labelVariant, labelAction = props.labelAction, labelHidden = props.labelHidden, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled, clearButton = props.clearButton, readOnly = props.readOnly, autoFocus = props.autoFocus, _focused = props.focused, _props_multiline = props.multiline, multiline = _props_multiline === void 0 ? 1 : _props_multiline, _props_autoGrow = props.autoGrow, autoGrow = _props_autoGrow === void 0 ? false : _props_autoGrow, maxHeight = props.maxHeight, error = props.error, connectedRight = props.connectedRight, connectedLeft = props.connectedLeft, _props_type = props.type, type = _props_type === void 0 ? "text" : _props_type, _props_subdued = props.subdued, subdued = _props_subdued === void 0 ? false : _props_subdued, name = props.name, _id = props.id, role = props.role, step = props.step, _props_largeStep = props.largeStep, largeStep = _props_largeStep === void 0 ? 10 : _props_largeStep, autoComplete = props.autoComplete, max = props.max, maxLength = props.maxLength, min = props.min, minLength = props.minLength, _props_showCharacterCount = props.showCharacterCount, showCharacterCount = _props_showCharacterCount === void 0 ? false : _props_showCharacterCount, pattern = props.pattern, spellCheck = props.spellCheck, ariaOwns = props.ariaOwns, ariaControls = props.ariaControls, ariaExpanded = props.ariaExpanded, ariaActiveDescendant = props.ariaActiveDescendant, ariaAutocomplete = props.ariaAutocomplete, _props_align = props.align, align = _props_align === void 0 ? "left" : _props_align, requiredIndicator = props.requiredIndicator, selectTextOnFocus = props.selectTextOnFocus, onClearButtonClick = props.onClearButtonClick, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, tooltip = props.tooltip, className = props.className, _inputRef = props.inputRef, icon = props.icon, _props_transparent = props.transparent, transparent = _props_transparent === void 0 ? false : _props_transparent, _props_showNumberSteppers = props.showNumberSteppers, showNumberSteppers = _props_showNumberSteppers === void 0 ? true : _props_showNumberSteppers, onKeyDown = props.onKeyDown, _props_disableFocusStyles = props.disableFocusStyles, disableFocusStyles = _props_disableFocusStyles === void 0 ? false : _props_disableFocusStyles;
|
|
289
290
|
var suffix = maxLength && showCharacterCount ? "".concat(value.length, " / ").concat(maxLength) : _suffix;
|
|
290
291
|
var _internalRef = (0, _react.useRef)(null);
|
|
291
292
|
var inputRef = _inputRef || _internalRef;
|
|
@@ -344,7 +345,7 @@ var clearButtonStyles = (0, _tailwindvariants.tv)({
|
|
|
344
345
|
var classes = styles({
|
|
345
346
|
disabled: Boolean(disabled || readOnly),
|
|
346
347
|
hasError: hasError,
|
|
347
|
-
focused: Boolean(focused && !readOnly),
|
|
348
|
+
focused: Boolean(focused && !readOnly && !disableFocusStyles),
|
|
348
349
|
subdued: subdued,
|
|
349
350
|
transparent: transparent
|
|
350
351
|
});
|
|
@@ -567,6 +568,7 @@ var clearButtonStyles = (0, _tailwindvariants.tv)({
|
|
|
567
568
|
insight: labelAction.insight,
|
|
568
569
|
icon: labelAction.insight ? _polarisicons.MagicMajor : undefined,
|
|
569
570
|
color: labelAction.insight ? "insight" : undefined,
|
|
571
|
+
disabled: labelAction.disabled,
|
|
570
572
|
removeUnderline: true,
|
|
571
573
|
children: labelAction.content
|
|
572
574
|
})
|