@heymantle/litho 0.0.10 → 0.0.13
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/cjs/components/Banner.js +6 -1
- package/dist/cjs/components/Button.js +33 -4
- package/dist/cjs/components/ButtonGroup.js +19 -4
- package/dist/cjs/components/Card.js +39 -3
- package/dist/cjs/components/ChoiceList.js +3 -2
- package/dist/cjs/components/Code.js +227 -0
- package/dist/cjs/components/Filters.js +1 -1
- package/dist/cjs/components/Frame.js +2 -2
- package/dist/cjs/components/Layout.js +16 -4
- package/dist/cjs/components/Link.js +35 -4
- package/dist/cjs/components/Modal.js +4 -0
- package/dist/cjs/components/Page.js +5 -2
- package/dist/cjs/components/Pane.js +669 -84
- package/dist/cjs/components/ResourceList.js +2 -2
- package/dist/cjs/components/TabNavigation.js +300 -0
- package/dist/cjs/components/TextField.js +3 -0
- package/dist/cjs/components/Tip.js +3 -0
- package/dist/cjs/components/Tooltip.js +12 -13
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/stories/Pane.stories.js +352 -3
- package/dist/cjs/utilities/useBodyScrollLock.js +63 -0
- package/dist/cjs/utilities/useKeyboardAction.js +19 -0
- package/dist/cjs/utilities/useLocalStorage.js +126 -0
- package/dist/cjs/utilities/useMobile.js +92 -0
- package/dist/cjs/utilities/usePaneState.js +340 -0
- package/dist/cjs/utilities/useTabStorage.js +325 -0
- package/dist/esm/components/Banner.js +7 -2
- package/dist/esm/components/Button.js +33 -4
- package/dist/esm/components/ButtonGroup.js +19 -4
- package/dist/esm/components/Card.js +39 -3
- package/dist/esm/components/ChoiceList.js +3 -2
- package/dist/esm/components/Code.js +212 -0
- package/dist/esm/components/Filters.js +2 -2
- package/dist/esm/components/Frame.js +2 -2
- package/dist/esm/components/Layout.js +16 -4
- package/dist/esm/components/Link.js +31 -5
- package/dist/esm/components/Modal.js +4 -0
- package/dist/esm/components/Page.js +5 -2
- package/dist/esm/components/Pane.js +619 -83
- package/dist/esm/components/ResourceList.js +2 -2
- package/dist/esm/components/TabNavigation.js +285 -0
- package/dist/esm/components/TextField.js +4 -1
- package/dist/esm/components/Tip.js +4 -1
- package/dist/esm/components/Tooltip.js +12 -13
- package/dist/esm/index.js +1 -0
- package/dist/esm/stories/Pane.stories.js +346 -3
- package/dist/esm/utilities/useBodyScrollLock.js +53 -0
- package/dist/esm/utilities/useKeyboardAction.js +25 -0
- package/dist/esm/utilities/useLocalStorage.js +115 -0
- package/dist/esm/utilities/useMobile.js +79 -0
- package/dist/esm/utilities/usePaneState.js +334 -0
- package/dist/esm/utilities/useTabStorage.js +311 -0
- package/dist/types/components/Banner.d.ts.map +1 -1
- package/dist/types/components/Button.d.ts +2 -2
- package/dist/types/components/Button.d.ts.map +1 -1
- package/dist/types/components/ButtonGroup.d.ts.map +1 -1
- package/dist/types/components/Card.d.ts +34 -1
- package/dist/types/components/Card.d.ts.map +1 -1
- package/dist/types/components/Code.d.ts +28 -0
- package/dist/types/components/Code.d.ts.map +1 -0
- package/dist/types/components/Filters.d.ts.map +1 -1
- package/dist/types/components/Layout.d.ts +2 -0
- package/dist/types/components/Layout.d.ts.map +1 -1
- package/dist/types/components/Link.d.ts +4 -0
- package/dist/types/components/Link.d.ts.map +1 -1
- package/dist/types/components/Modal.d.ts +2 -0
- package/dist/types/components/Modal.d.ts.map +1 -1
- package/dist/types/components/Page.d.ts.map +1 -1
- package/dist/types/components/Pane.d.ts +2 -0
- package/dist/types/components/Pane.d.ts.map +1 -1
- package/dist/types/components/TabNavigation.d.ts +3 -0
- package/dist/types/components/TabNavigation.d.ts.map +1 -0
- package/dist/types/components/TextField.d.ts.map +1 -1
- package/dist/types/components/Tip.d.ts.map +1 -1
- package/dist/types/components/Tooltip.d.ts +2 -0
- package/dist/types/components/Tooltip.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/utilities/useBodyScrollLock.d.ts +12 -0
- package/dist/types/utilities/useBodyScrollLock.d.ts.map +1 -0
- package/dist/types/utilities/useKeyboardAction.d.ts +2 -0
- package/dist/types/utilities/useKeyboardAction.d.ts.map +1 -0
- package/dist/types/utilities/useLocalStorage.d.ts +13 -0
- package/dist/types/utilities/useLocalStorage.d.ts.map +1 -0
- package/dist/types/utilities/useMobile.d.ts +9 -0
- package/dist/types/utilities/useMobile.d.ts.map +1 -0
- package/dist/types/utilities/usePaneState.d.ts +2 -0
- package/dist/types/utilities/usePaneState.d.ts.map +1 -0
- package/dist/types/utilities/useTabStorage.d.ts +8 -0
- package/dist/types/utilities/useTabStorage.d.ts.map +1 -0
- package/index.css +77 -6
- package/package.json +2 -2
|
@@ -10,6 +10,12 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
var _jsxruntime = require("react/jsx-runtime");
|
|
12
12
|
var _tailwindvariants = require("tailwind-variants");
|
|
13
|
+
var _Icon = /*#__PURE__*/ _interop_require_default(require("./Icon"));
|
|
14
|
+
function _interop_require_default(obj) {
|
|
15
|
+
return obj && obj.__esModule ? obj : {
|
|
16
|
+
default: obj
|
|
17
|
+
};
|
|
18
|
+
}
|
|
13
19
|
var styles = (0, _tailwindvariants.tv)({
|
|
14
20
|
base: "Litho-Link cursor-pointer hover:underline",
|
|
15
21
|
variants: {
|
|
@@ -27,6 +33,10 @@ var styles = (0, _tailwindvariants.tv)({
|
|
|
27
33
|
disabled: {
|
|
28
34
|
true: "text-lowest hover:text-lowest cursor-default hover:no-underline",
|
|
29
35
|
false: ""
|
|
36
|
+
},
|
|
37
|
+
hasIcon: {
|
|
38
|
+
true: "inline-flex items-center gap-1",
|
|
39
|
+
false: ""
|
|
30
40
|
}
|
|
31
41
|
},
|
|
32
42
|
compoundVariants: [
|
|
@@ -72,6 +82,12 @@ var styles = (0, _tailwindvariants.tv)({
|
|
|
72
82
|
color: "highlight",
|
|
73
83
|
className: "text-highlight-alt-fg dark:text-highlight-alt-fg-dark"
|
|
74
84
|
},
|
|
85
|
+
{
|
|
86
|
+
disabled: false,
|
|
87
|
+
monochrome: false,
|
|
88
|
+
color: "insight",
|
|
89
|
+
className: "text-insight-text dark:text-insight-text"
|
|
90
|
+
},
|
|
75
91
|
{
|
|
76
92
|
disabled: false,
|
|
77
93
|
monochrome: false,
|
|
@@ -95,6 +111,7 @@ var styles = (0, _tailwindvariants.tv)({
|
|
|
95
111
|
* @param {React.ReactNode} props.children - Content to display within the link.
|
|
96
112
|
* @param {Function} [props.onClick] - Optional click event handler for the link.
|
|
97
113
|
* @param {boolean} [props.external=false] - If true, opens the link in a new tab.
|
|
114
|
+
* @param {boolean} [props.insight=false] - If true, set the color and iconColor to insight
|
|
98
115
|
* @param {string} [props.target] - Optional target attribute for specifying where to open the link.
|
|
99
116
|
* @param {string} [props.id] - Optional id attribute for the link.
|
|
100
117
|
* @param {boolean} [props.monochrome=false] - If true, applies monochrome color scheme.
|
|
@@ -103,19 +120,24 @@ var styles = (0, _tailwindvariants.tv)({
|
|
|
103
120
|
* @param {string} [props.dataPrimaryLink] - Optional data attribute for custom tracking.
|
|
104
121
|
* @param {Function} [props.onMouseEnter] - Optional mouse enter event handler for the link.
|
|
105
122
|
* @param {Function} [props.onMouseLeave] - Optional mouse leave event handler for the link.
|
|
123
|
+
* @param {React.ReactNode} [props.icon] - Optional icon to display within the link.
|
|
106
124
|
*
|
|
107
125
|
* @returns {JSX.Element} Rendered link element.
|
|
108
126
|
*/ function Link() {
|
|
109
127
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
110
|
-
var url = props.url, children = props.children, onClick = props.onClick, external = props.external, target = props.target, _props_bold = props.bold, bold = _props_bold === void 0 ? false : _props_bold, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled, id = props.id, monochrome = props.monochrome, removeUnderline = props.removeUnderline, accessibilityLabel = props.accessibilityLabel, dataPrimaryLink = props.dataPrimaryLink,
|
|
128
|
+
var url = props.url, children = props.children, onClick = props.onClick, external = props.external, target = props.target, _props_bold = props.bold, bold = _props_bold === void 0 ? false : _props_bold, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled, _props_insight = props.insight, insight = _props_insight === void 0 ? false : _props_insight, id = props.id, monochrome = props.monochrome, removeUnderline = props.removeUnderline, accessibilityLabel = props.accessibilityLabel, dataPrimaryLink = props.dataPrimaryLink, _color = props.color, className = props.className, onMouseEnter = props.onMouseEnter, onMouseLeave = props.onMouseLeave, icon = props.icon, _iconColor = props.iconColor, _props_iconSize = props.iconSize, iconSize = _props_iconSize === void 0 ? "sm" : _props_iconSize;
|
|
129
|
+
var hasIcon = icon !== undefined;
|
|
130
|
+
var color = insight ? "insight" : _color;
|
|
131
|
+
var iconColor = insight ? "insight" : _iconColor;
|
|
111
132
|
var classes = styles({
|
|
112
133
|
monochrome: monochrome,
|
|
113
134
|
removeUnderline: removeUnderline,
|
|
114
135
|
bold: bold,
|
|
115
136
|
disabled: disabled,
|
|
116
|
-
color: color
|
|
137
|
+
color: color,
|
|
138
|
+
hasIcon: hasIcon
|
|
117
139
|
});
|
|
118
|
-
return /*#__PURE__*/ (0, _jsxruntime.
|
|
140
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)("a", {
|
|
119
141
|
href: disabled ? undefined : url,
|
|
120
142
|
className: "".concat(classes).concat(className ? " ".concat(className) : ""),
|
|
121
143
|
onClick: disabled ? undefined : onClick,
|
|
@@ -125,7 +147,16 @@ var styles = (0, _tailwindvariants.tv)({
|
|
|
125
147
|
"data-primary-link": dataPrimaryLink,
|
|
126
148
|
onMouseEnter: onMouseEnter,
|
|
127
149
|
onMouseLeave: onMouseLeave,
|
|
128
|
-
children:
|
|
150
|
+
children: [
|
|
151
|
+
icon && /*#__PURE__*/ (0, _jsxruntime.jsx)(_Icon.default, {
|
|
152
|
+
source: icon,
|
|
153
|
+
color: iconColor,
|
|
154
|
+
size: iconSize
|
|
155
|
+
}),
|
|
156
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
|
|
157
|
+
children: children
|
|
158
|
+
})
|
|
159
|
+
]
|
|
129
160
|
});
|
|
130
161
|
}
|
|
131
162
|
Link.displayName = "Link";
|
|
@@ -28,6 +28,7 @@ var _Spinner = /*#__PURE__*/ _interop_require_default(require("./Spinner"));
|
|
|
28
28
|
var _Text = /*#__PURE__*/ _interop_require_default(require("./Text"));
|
|
29
29
|
var _Tooltip = /*#__PURE__*/ _interop_require_default(require("./Tooltip"));
|
|
30
30
|
var _Frame = require("./Frame");
|
|
31
|
+
var _useBodyScrollLock = require("../utilities/useBodyScrollLock");
|
|
31
32
|
function _array_like_to_array(arr, len) {
|
|
32
33
|
if (len == null || len > arr.length) len = arr.length;
|
|
33
34
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -198,6 +199,7 @@ var sectionStyles = (0, _tailwindvariants.tv)({
|
|
|
198
199
|
* @param {string} [props.size="default"] - The size of the modal (default, large, or full).
|
|
199
200
|
* @param {React.ReactNode} [props.leftAccessory] - Left accessory content in the footer.
|
|
200
201
|
* @param {boolean} [props.hideCloseButton=false] - Whether to hide the close button.
|
|
202
|
+
* @param {Function} [props.backAction] - Callback function for the back button. When provided, displays a back button next to the title.
|
|
201
203
|
* @param {number} [props.zIndexOverride=1000] - The z-index of the modal.
|
|
202
204
|
* @param {boolean} [props.autoFocusFirstInput=true] - Whether to focus the first input when the modal opens.
|
|
203
205
|
* @param {string} [props.bodyClassName] - Additional CSS classes to apply to the modal body.
|
|
@@ -228,6 +230,8 @@ var sectionStyles = (0, _tailwindvariants.tv)({
|
|
|
228
230
|
document.body.removeChild(div);
|
|
229
231
|
};
|
|
230
232
|
}, []);
|
|
233
|
+
// Lock body scroll when modal is open
|
|
234
|
+
(0, _useBodyScrollLock.useBodyScrollLock)(open);
|
|
231
235
|
(0, _react.useEffect)(function() {
|
|
232
236
|
setModalIsOpen(open);
|
|
233
237
|
if (!open || !onClose) return;
|
|
@@ -420,8 +420,9 @@ var contentStyles = (0, _tailwindvariants.tv)({
|
|
|
420
420
|
return closePopover(index);
|
|
421
421
|
},
|
|
422
422
|
activator: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Button.default, {
|
|
423
|
-
plain:
|
|
423
|
+
plain: !action.insight,
|
|
424
424
|
disclosure: true,
|
|
425
|
+
insight: action.insight,
|
|
425
426
|
icon: action.icon,
|
|
426
427
|
onClick: function() {
|
|
427
428
|
return togglePopover(index);
|
|
@@ -437,7 +438,7 @@ var contentStyles = (0, _tailwindvariants.tv)({
|
|
|
437
438
|
}, index);
|
|
438
439
|
}
|
|
439
440
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_Button.default, {
|
|
440
|
-
plain: !action.destructive,
|
|
441
|
+
plain: !action.destructive && !action.insight,
|
|
441
442
|
onClick: action.onAction || action.onClick,
|
|
442
443
|
disabled: action.disabled,
|
|
443
444
|
icon: action.icon,
|
|
@@ -445,7 +446,9 @@ var contentStyles = (0, _tailwindvariants.tv)({
|
|
|
445
446
|
external: action.external,
|
|
446
447
|
url: action.url,
|
|
447
448
|
destructive: action.destructive,
|
|
449
|
+
insight: action.insight,
|
|
448
450
|
tooltip: action.tooltip,
|
|
451
|
+
className: action.insight ? "mx-0.5" : "",
|
|
449
452
|
children: action.content
|
|
450
453
|
}, index);
|
|
451
454
|
})
|