@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
|
@@ -84,9 +84,57 @@ var gradientOverlayStyles = tv({
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
|
+
var containerStyles = tv({
|
|
88
|
+
base: "w-2 h-2 rounded-full relative overflow-hidden bg-tint-2 flex-shrink-0",
|
|
89
|
+
variants: {
|
|
90
|
+
readStatus: {
|
|
91
|
+
full: ""
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
defaultVariants: {
|
|
95
|
+
readStatus: "read"
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
var readStatusStyles = tv({
|
|
99
|
+
base: "absolute w-full h-full",
|
|
100
|
+
variants: {
|
|
101
|
+
readStatus: {
|
|
102
|
+
read: "",
|
|
103
|
+
partiallyRead: "bg-brand-saturated",
|
|
104
|
+
unread: "bg-brand-saturated"
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
defaultVariants: {
|
|
108
|
+
readStatus: "read"
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
// Small read status indicator for tabs
|
|
112
|
+
function TabReadStatusIndicator(param) {
|
|
113
|
+
var readStatus = param.readStatus;
|
|
114
|
+
if (!readStatus || !readStatus.status) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
var status = readStatus.status;
|
|
118
|
+
// Don't show indicator for read threads
|
|
119
|
+
if (status === "read") {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
var containerClasses = containerStyles({
|
|
123
|
+
readStatus: status
|
|
124
|
+
});
|
|
125
|
+
var readStatusClasses = readStatusStyles({
|
|
126
|
+
readStatus: status
|
|
127
|
+
});
|
|
128
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
129
|
+
className: containerClasses,
|
|
130
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
131
|
+
className: readStatusClasses
|
|
132
|
+
})
|
|
133
|
+
});
|
|
134
|
+
}
|
|
87
135
|
// Component to handle truncation detection and tooltip
|
|
88
136
|
function TabTitle(param) {
|
|
89
|
-
var title = param.title, isActive = param.isActive, tabContainerRef = param.tabContainerRef;
|
|
137
|
+
var title = param.title, isActive = param.isActive, tabContainerRef = param.tabContainerRef, readStatus = param.readStatus;
|
|
90
138
|
var _useState = _sliced_to_array(useState(false), 2), shouldShowTooltip = _useState[0], setShouldShowTooltip = _useState[1];
|
|
91
139
|
useLayoutEffect(function() {
|
|
92
140
|
if (!title || !(tabContainerRef === null || tabContainerRef === void 0 ? void 0 : tabContainerRef.current)) {
|
|
@@ -123,16 +171,21 @@ function TabTitle(param) {
|
|
|
123
171
|
title,
|
|
124
172
|
tabContainerRef
|
|
125
173
|
]);
|
|
126
|
-
var textElement = /*#__PURE__*/
|
|
127
|
-
className: "overflow-hidden",
|
|
128
|
-
children:
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
174
|
+
var textElement = /*#__PURE__*/ _jsxs("div", {
|
|
175
|
+
className: "overflow-hidden flex items-center gap-1.5 min-w-0",
|
|
176
|
+
children: [
|
|
177
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
178
|
+
variant: "bodyXs",
|
|
179
|
+
className: "".concat(textStyles({
|
|
180
|
+
isActive: isActive
|
|
181
|
+
}), " min-w-0 flex-1"),
|
|
182
|
+
clampLines: 1,
|
|
183
|
+
children: title
|
|
132
184
|
}),
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
185
|
+
readStatus && /*#__PURE__*/ _jsx(TabReadStatusIndicator, {
|
|
186
|
+
readStatus: readStatus
|
|
187
|
+
})
|
|
188
|
+
]
|
|
136
189
|
});
|
|
137
190
|
// Only show tooltip if text is likely truncated based on character count vs tab width
|
|
138
191
|
if (shouldShowTooltip) {
|
|
@@ -251,7 +304,8 @@ function TabNavigation() {
|
|
|
251
304
|
}) : /*#__PURE__*/ _jsx(TabTitle, {
|
|
252
305
|
title: tab.title,
|
|
253
306
|
isActive: isActive,
|
|
254
|
-
tabContainerRef: tabRef
|
|
307
|
+
tabContainerRef: tabRef,
|
|
308
|
+
readStatus: tab.readStatus
|
|
255
309
|
}),
|
|
256
310
|
/*#__PURE__*/ _jsx("div", {
|
|
257
311
|
className: "".concat(gradientOverlayStyles({
|
|
@@ -160,6 +160,7 @@ import Text from "./Text.js";
|
|
|
160
160
|
import Tooltip from "./Tooltip.js";
|
|
161
161
|
import { styles } from "../styles/Table.js";
|
|
162
162
|
import { SelectionType } from "../utilities/useIndexResourceState.js";
|
|
163
|
+
import { useMobile } from "../utilities/useMobile.js";
|
|
163
164
|
import { useMounted } from "../utilities/useMounted.js";
|
|
164
165
|
import useTableScrollState from "../utilities/useTableScrollState.js";
|
|
165
166
|
var TableContext = /*#__PURE__*/ createContext({});
|
|
@@ -447,6 +448,8 @@ var TableWrapperContext = /*#__PURE__*/ createContext({});
|
|
|
447
448
|
var alignment = cellAlignment[indexAdjusted];
|
|
448
449
|
var isSortable = sortable && sortable.length > 0 && sortable[indexAdjusted];
|
|
449
450
|
var sortIndex = selectable ? indexAdjusted - 1 : indexAdjusted;
|
|
451
|
+
// Check if this cell is covered by a fixed overlay
|
|
452
|
+
var isCovered = !fixed && !reverseColumns && (fixedFirstColumns > 0 && indexAdjusted < fixedFirstColumns || fixedLastColumns > 0 && indexAdjusted >= headings.length - fixedLastColumns);
|
|
450
453
|
var sortContent = isSortable ? /*#__PURE__*/ _jsx("div", {
|
|
451
454
|
className: "min-h-5 ".concat(sort.index === sortIndex ? "opacity-100" : "opacity-0 group-hover:opacity-100"),
|
|
452
455
|
children: /*#__PURE__*/ _jsx(Icon, {
|
|
@@ -481,6 +484,7 @@ var TableWrapperContext = /*#__PURE__*/ createContext({});
|
|
|
481
484
|
].includes(alignment) && sortContent
|
|
482
485
|
]
|
|
483
486
|
});
|
|
487
|
+
var hasTooltip = (heading.tooltip || heading.tooltipContent) && !isCovered;
|
|
484
488
|
return /*#__PURE__*/ _jsx(HeadingCell, {
|
|
485
489
|
className: styles.headingStyles({
|
|
486
490
|
hidden: hideCell,
|
|
@@ -498,7 +502,7 @@ var TableWrapperContext = /*#__PURE__*/ createContext({});
|
|
|
498
502
|
className: styles.headingLabelContainerStyles({
|
|
499
503
|
alignment: alignment
|
|
500
504
|
}),
|
|
501
|
-
children: heading.hidden ? null :
|
|
505
|
+
children: heading.hidden ? null : hasTooltip ? /*#__PURE__*/ _jsx(Tooltip, {
|
|
502
506
|
content: heading.tooltip || heading.tooltipContent,
|
|
503
507
|
preferredPosition: "above",
|
|
504
508
|
children: labelContent
|
|
@@ -614,12 +618,16 @@ var TableWrapperContext = /*#__PURE__*/ createContext({});
|
|
|
614
618
|
value: {
|
|
615
619
|
columnsToRender: columnsToRender,
|
|
616
620
|
reverseColumns: reverseColumns,
|
|
617
|
-
hideCellsOnMobile: hideCellsOnMobile
|
|
621
|
+
hideCellsOnMobile: hideCellsOnMobile,
|
|
622
|
+
isFixedOverlay: fixed,
|
|
623
|
+
fixedFirstColumns: fixedFirstColumns,
|
|
624
|
+
fixedLastColumns: fixedLastColumns
|
|
618
625
|
},
|
|
619
626
|
children: /*#__PURE__*/ _jsxs("table", {
|
|
620
627
|
className: styles.tableStyles(),
|
|
621
628
|
children: [
|
|
622
629
|
hasHeadings && renderHeadings({
|
|
630
|
+
fixed: fixed,
|
|
623
631
|
hidden: true,
|
|
624
632
|
columnsToRender: columnsToRender,
|
|
625
633
|
reverseColumns: reverseColumns,
|
|
@@ -752,7 +760,8 @@ var TableWrapperContext = /*#__PURE__*/ createContext({});
|
|
|
752
760
|
increasedTableDensity: increasedTableDensity,
|
|
753
761
|
tableContainerRef: tableContainerRef,
|
|
754
762
|
cellAlignment: cellAlignment,
|
|
755
|
-
noBodyCellPadding: noBodyCellPadding
|
|
763
|
+
noBodyCellPadding: noBodyCellPadding,
|
|
764
|
+
columnWidths: columnWidths
|
|
756
765
|
},
|
|
757
766
|
children: /*#__PURE__*/ _jsxs("div", {
|
|
758
767
|
"data-id": idRef.current,
|
|
@@ -803,8 +812,7 @@ var TableWrapperContext = /*#__PURE__*/ createContext({});
|
|
|
803
812
|
children: renderTable({
|
|
804
813
|
classes: "relative overflow-hidden",
|
|
805
814
|
fixed: true,
|
|
806
|
-
columnsToRender: fixedFirstColumns
|
|
807
|
-
hideCellsOnMobile: true
|
|
815
|
+
columnsToRender: fixedFirstColumns
|
|
808
816
|
})
|
|
809
817
|
}) : /*#__PURE__*/ _jsx("div", {
|
|
810
818
|
className: styles.overflowShadowStyles({
|
|
@@ -822,8 +830,7 @@ var TableWrapperContext = /*#__PURE__*/ createContext({});
|
|
|
822
830
|
classes: "relative overflow-hidden",
|
|
823
831
|
fixed: true,
|
|
824
832
|
columnsToRender: fixedLastColumns,
|
|
825
|
-
reverseColumns: true
|
|
826
|
-
hideCellsOnMobile: true
|
|
833
|
+
reverseColumns: true
|
|
827
834
|
})
|
|
828
835
|
}) : /*#__PURE__*/ _jsx("div", {
|
|
829
836
|
className: styles.overflowShadowStyles({
|
|
@@ -968,8 +975,11 @@ Table.Row.displayName = "Table.Row";
|
|
|
968
975
|
*/ function Cell(param) {
|
|
969
976
|
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;
|
|
970
977
|
var _useContext = useContext(TableContext), cellAlignment = _useContext.cellAlignment, increasedTableDensity = _useContext.increasedTableDensity, selectable = _useContext.selectable, noBodyCellPadding = _useContext.noBodyCellPadding;
|
|
971
|
-
var _useContext1 = useContext(TableWrapperContext), hideCellsOnMobile = _useContext1.hideCellsOnMobile, reverseColumns = _useContext1.reverseColumns, columnsToRender = _useContext1.columnsToRender;
|
|
978
|
+
var _useContext1 = useContext(TableWrapperContext), hideCellsOnMobile = _useContext1.hideCellsOnMobile, reverseColumns = _useContext1.reverseColumns, columnsToRender = _useContext1.columnsToRender, isFixedOverlay = _useContext1.isFixedOverlay, fixedFirstColumns = _useContext1.fixedFirstColumns, fixedLastColumns = _useContext1.fixedLastColumns;
|
|
979
|
+
var isMobile = useMobile();
|
|
972
980
|
var columnCount = (cellAlignment === null || cellAlignment === void 0 ? void 0 : cellAlignment.length) || 0;
|
|
981
|
+
// Use state instead of ref so changes trigger re-render
|
|
982
|
+
var _useState = _sliced_to_array(useState(-1), 2), cellIndex = _useState[0], setCellIndex = _useState[1];
|
|
973
983
|
var cellIndexRef = useRef(null);
|
|
974
984
|
var setCellRef = useCallback(function(node) {
|
|
975
985
|
if (!node || cellIndexRef.current !== null) return;
|
|
@@ -977,16 +987,21 @@ Table.Row.displayName = "Table.Row";
|
|
|
977
987
|
if ((parentRow === null || parentRow === void 0 ? void 0 : parentRow.tagName) === "TR") {
|
|
978
988
|
var totalCells = parentRow.children.length;
|
|
979
989
|
var index = node.cellIndex;
|
|
980
|
-
|
|
990
|
+
var calculatedIndex = reverseColumns ? totalCells - columnsToRender + index - (totalCells - columnCount) : index;
|
|
991
|
+
cellIndexRef.current = calculatedIndex;
|
|
992
|
+
setCellIndex(calculatedIndex);
|
|
981
993
|
}
|
|
982
994
|
}, [
|
|
983
995
|
reverseColumns,
|
|
984
996
|
columnsToRender,
|
|
985
997
|
columnCount
|
|
986
998
|
]);
|
|
987
|
-
var _cellIndexRef_current;
|
|
988
|
-
var cellIndex = (_cellIndexRef_current = cellIndexRef.current) !== null && _cellIndexRef_current !== void 0 ? _cellIndexRef_current : -1;
|
|
989
999
|
var alignment = (cellAlignment === null || cellAlignment === void 0 ? void 0 : cellAlignment[cellIndex]) || _alignment;
|
|
1000
|
+
// Check if this cell is covered by a fixed overlay
|
|
1001
|
+
// When cellIndex is unknown (-1), conservatively assume the cell might be covered
|
|
1002
|
+
// if there are any fixed columns. This prevents duplicate popovers during the
|
|
1003
|
+
// brief window between initial render and when cellIndex is calculated.
|
|
1004
|
+
var isCoveredByFixedOverlay = !isFixedOverlay && !reverseColumns && (cellIndex === -1 ? fixedFirstColumns > 0 || fixedLastColumns > 0 : fixedFirstColumns > 0 && cellIndex < fixedFirstColumns || fixedLastColumns > 0 && cellIndex >= columnCount - fixedLastColumns);
|
|
990
1005
|
return /*#__PURE__*/ _jsx("td", {
|
|
991
1006
|
ref: setCellRef,
|
|
992
1007
|
className: styles.cellStyles({
|
|
@@ -997,6 +1012,7 @@ Table.Row.displayName = "Table.Row";
|
|
|
997
1012
|
tableIsSelectable: selectable,
|
|
998
1013
|
noBodyCellPadding: noBodyCellPadding
|
|
999
1014
|
}),
|
|
1015
|
+
inert: !isMobile && isCoveredByFixedOverlay || undefined,
|
|
1000
1016
|
children: /*#__PURE__*/ _jsx("div", {
|
|
1001
1017
|
className: styles.cellContentStyles({
|
|
1002
1018
|
alignment: alignment
|
|
@@ -106,6 +106,7 @@ import Icon from "./Icon.js";
|
|
|
106
106
|
import Popover from "./Popover.js";
|
|
107
107
|
import { CaretDownMinor, CaretUpMinor } from "@shopify/polaris-icons";
|
|
108
108
|
import * as PolarisIcons from "@shopify/polaris-icons";
|
|
109
|
+
import Badge from "./Badge.js";
|
|
109
110
|
var styles = tv({
|
|
110
111
|
base: "Litho-Tabs flex overflow-x-hidden whitespace-nowrap",
|
|
111
112
|
variants: {
|
|
@@ -140,6 +141,8 @@ var containerStyles = tv({
|
|
|
140
141
|
* @param {boolean} [props.padded=true] - If true, applies padding to the Tabs container.
|
|
141
142
|
* @param {boolean} [props.borderBottom=true] - If true, applies a bottom border to the Tabs container.
|
|
142
143
|
* @param {boolean} [props.simpleTabs=false] - If true, simplifies the styling for the selected tab.
|
|
144
|
+
* @param {number} [props.badgeCount] - The number of badges to display for the tab.
|
|
145
|
+
* @param {string} [props.badgeStatus="default"] - The status of the badge.
|
|
143
146
|
* @returns {JSX.Element} The Tabs component.
|
|
144
147
|
*/ function Tabs() {
|
|
145
148
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
@@ -253,6 +256,8 @@ var containerStyles = tv({
|
|
|
253
256
|
fullWidth: fullWidth,
|
|
254
257
|
hidden: tab.hidden,
|
|
255
258
|
simple: simpleTabs,
|
|
259
|
+
badgeCount: tab.badgeCount,
|
|
260
|
+
badgeStatus: tab.badgeStatus,
|
|
256
261
|
children: tab.content
|
|
257
262
|
}, "tab-".concat(tab.originalIndex));
|
|
258
263
|
})
|
|
@@ -345,9 +350,30 @@ var tabStyles = tv({
|
|
|
345
350
|
}
|
|
346
351
|
]
|
|
347
352
|
});
|
|
348
|
-
|
|
353
|
+
/**
|
|
354
|
+
* Individual tab item component used within the Tabs component.
|
|
355
|
+
*
|
|
356
|
+
* @param {Object} props - Component props.
|
|
357
|
+
* @param {string} [props.id] - Unique identifier for the tab, used to generate the DOM element ID.
|
|
358
|
+
* @param {boolean} [props.active] - Whether the tab's disclosure popover is currently active/open.
|
|
359
|
+
* @param {boolean} [props.selected] - Whether this tab is currently selected.
|
|
360
|
+
* @param {number} [props.index] - The index position of this tab in the tabs array.
|
|
361
|
+
* @param {string|React.ReactNode} [props.icon] - Icon to display. Can be a Polaris icon name string or a custom React node.
|
|
362
|
+
* @param {Function} [props.onSelect] - Callback fired when the tab is selected, receives the tab's index.
|
|
363
|
+
* @param {Function} [props.onClick] - Custom click handler that overrides the default onSelect behavior.
|
|
364
|
+
* @param {React.ReactNode} [props.children] - The content/label to display inside the tab.
|
|
365
|
+
* @param {boolean} [props.fullWidth] - Whether the tab should expand to fill available space.
|
|
366
|
+
* @param {boolean} [props.hidden] - Whether the tab should be visually hidden (used for overflow handling).
|
|
367
|
+
* @param {boolean} [props.simple] - Whether to use simplified styling (no background, column layout).
|
|
368
|
+
* @param {boolean} [props.disclosure=false] - Whether to show a disclosure caret icon when selected.
|
|
369
|
+
* @param {boolean} [props.alwaysShowDisclosureIcon=false] - Whether to always show the disclosure icon regardless of selection state.
|
|
370
|
+
* @param {boolean} [props.disabled=false] - Whether the tab is disabled.
|
|
371
|
+
* @param {string} [props.badgeStatus="default"] - The status variant of the badge (e.g., "default", "success", "warning").
|
|
372
|
+
* @param {number} [props.badgeCount] - If provided (>= 0), displays a badge with this count.
|
|
373
|
+
* @returns {JSX.Element} The Tab component.
|
|
374
|
+
*/ function Tab() {
|
|
349
375
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
350
|
-
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;
|
|
376
|
+
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;
|
|
351
377
|
var polarisIcon = typeof icon === "string" ? PolarisIcons[icon] : PolarisIcons[icon === null || icon === void 0 ? void 0 : icon.displayName];
|
|
352
378
|
var showDisclosure = disclosure && (selected || alwaysShowDisclosureIcon);
|
|
353
379
|
var tabClasses = tabStyles({
|
|
@@ -388,6 +414,11 @@ function Tab() {
|
|
|
388
414
|
color: selected && simple ? "default" : selected ? "active" : "subdued",
|
|
389
415
|
size: simple ? "lg" : undefined
|
|
390
416
|
})
|
|
417
|
+
}),
|
|
418
|
+
badgeCount >= 0 && /*#__PURE__*/ _jsx(Badge, {
|
|
419
|
+
status: badgeStatus,
|
|
420
|
+
className: "ml-1",
|
|
421
|
+
children: badgeCount
|
|
391
422
|
})
|
|
392
423
|
]
|
|
393
424
|
});
|
|
@@ -226,10 +226,11 @@ var clearButtonStyles = tv({
|
|
|
226
226
|
* @param {Function} [props.onKeyDown] - Handler for key down.
|
|
227
227
|
* @param {ReactNode} [props.tooltip] - Tooltip content for the label.
|
|
228
228
|
* @param {string} [props.className] - Additional CSS classes.
|
|
229
|
+
* @param {boolean} [props.disableFocusStyles=false] - Whether to disable focused styles when the input is focused.
|
|
229
230
|
* @returns {JSX.Element} The rendered TextField component.
|
|
230
231
|
*/ function TextField() {
|
|
231
232
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
232
|
-
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;
|
|
233
|
+
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;
|
|
233
234
|
var suffix = maxLength && showCharacterCount ? "".concat(value.length, " / ").concat(maxLength) : _suffix;
|
|
234
235
|
var _internalRef = useRef(null);
|
|
235
236
|
var inputRef = _inputRef || _internalRef;
|
|
@@ -288,7 +289,7 @@ var clearButtonStyles = tv({
|
|
|
288
289
|
var classes = styles({
|
|
289
290
|
disabled: Boolean(disabled || readOnly),
|
|
290
291
|
hasError: hasError,
|
|
291
|
-
focused: Boolean(focused && !readOnly),
|
|
292
|
+
focused: Boolean(focused && !readOnly && !disableFocusStyles),
|
|
292
293
|
subdued: subdued,
|
|
293
294
|
transparent: transparent
|
|
294
295
|
});
|
|
@@ -511,6 +512,7 @@ var clearButtonStyles = tv({
|
|
|
511
512
|
insight: labelAction.insight,
|
|
512
513
|
icon: labelAction.insight ? MagicMajor : undefined,
|
|
513
514
|
color: labelAction.insight ? "insight" : undefined,
|
|
515
|
+
disabled: labelAction.disabled,
|
|
514
516
|
removeUnderline: true,
|
|
515
517
|
children: labelAction.content
|
|
516
518
|
})
|