@heymantle/litho 0.0.9 → 0.0.12

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.
Files changed (97) hide show
  1. package/dist/cjs/components/Banner.js +6 -1
  2. package/dist/cjs/components/Button.js +33 -4
  3. package/dist/cjs/components/ButtonGroup.js +19 -4
  4. package/dist/cjs/components/Card.js +39 -3
  5. package/dist/cjs/components/Checkbox.js +13 -2
  6. package/dist/cjs/components/ChoiceList.js +3 -2
  7. package/dist/cjs/components/Code.js +227 -0
  8. package/dist/cjs/components/Filters.js +1 -1
  9. package/dist/cjs/components/Frame.js +2 -2
  10. package/dist/cjs/components/Layout.js +16 -4
  11. package/dist/cjs/components/Link.js +35 -4
  12. package/dist/cjs/components/Modal.js +4 -0
  13. package/dist/cjs/components/Page.js +5 -2
  14. package/dist/cjs/components/Pane.js +669 -84
  15. package/dist/cjs/components/ResourceList.js +2 -2
  16. package/dist/cjs/components/TabNavigation.js +300 -0
  17. package/dist/cjs/components/TextField.js +3 -0
  18. package/dist/cjs/components/Tip.js +3 -0
  19. package/dist/cjs/components/Tooltip.js +12 -13
  20. package/dist/cjs/index.js +4 -0
  21. package/dist/cjs/stories/Checkbox.stories.js +172 -1
  22. package/dist/cjs/stories/Pane.stories.js +352 -3
  23. package/dist/cjs/utilities/useBodyScrollLock.js +63 -0
  24. package/dist/cjs/utilities/useKeyboardAction.js +19 -0
  25. package/dist/cjs/utilities/useLocalStorage.js +126 -0
  26. package/dist/cjs/utilities/useMobile.js +92 -0
  27. package/dist/cjs/utilities/usePaneState.js +340 -0
  28. package/dist/cjs/utilities/useTabStorage.js +325 -0
  29. package/dist/esm/components/Banner.js +7 -2
  30. package/dist/esm/components/Button.js +33 -4
  31. package/dist/esm/components/ButtonGroup.js +19 -4
  32. package/dist/esm/components/Card.js +39 -3
  33. package/dist/esm/components/Checkbox.js +13 -2
  34. package/dist/esm/components/ChoiceList.js +3 -2
  35. package/dist/esm/components/Code.js +212 -0
  36. package/dist/esm/components/Filters.js +2 -2
  37. package/dist/esm/components/Frame.js +2 -2
  38. package/dist/esm/components/Layout.js +16 -4
  39. package/dist/esm/components/Link.js +31 -5
  40. package/dist/esm/components/Modal.js +4 -0
  41. package/dist/esm/components/Page.js +5 -2
  42. package/dist/esm/components/Pane.js +619 -83
  43. package/dist/esm/components/ResourceList.js +2 -2
  44. package/dist/esm/components/TabNavigation.js +285 -0
  45. package/dist/esm/components/TextField.js +4 -1
  46. package/dist/esm/components/Tip.js +4 -1
  47. package/dist/esm/components/Tooltip.js +12 -13
  48. package/dist/esm/index.js +1 -0
  49. package/dist/esm/stories/Checkbox.stories.js +166 -1
  50. package/dist/esm/stories/Pane.stories.js +346 -3
  51. package/dist/esm/utilities/useBodyScrollLock.js +53 -0
  52. package/dist/esm/utilities/useKeyboardAction.js +25 -0
  53. package/dist/esm/utilities/useLocalStorage.js +115 -0
  54. package/dist/esm/utilities/useMobile.js +79 -0
  55. package/dist/esm/utilities/usePaneState.js +334 -0
  56. package/dist/esm/utilities/useTabStorage.js +311 -0
  57. package/dist/types/components/Banner.d.ts.map +1 -1
  58. package/dist/types/components/Button.d.ts +2 -2
  59. package/dist/types/components/Button.d.ts.map +1 -1
  60. package/dist/types/components/ButtonGroup.d.ts.map +1 -1
  61. package/dist/types/components/Card.d.ts +34 -1
  62. package/dist/types/components/Card.d.ts.map +1 -1
  63. package/dist/types/components/Checkbox.d.ts +11 -2
  64. package/dist/types/components/Checkbox.d.ts.map +1 -1
  65. package/dist/types/components/Code.d.ts +28 -0
  66. package/dist/types/components/Code.d.ts.map +1 -0
  67. package/dist/types/components/Filters.d.ts.map +1 -1
  68. package/dist/types/components/Layout.d.ts +2 -0
  69. package/dist/types/components/Layout.d.ts.map +1 -1
  70. package/dist/types/components/Link.d.ts +4 -0
  71. package/dist/types/components/Link.d.ts.map +1 -1
  72. package/dist/types/components/Modal.d.ts +2 -0
  73. package/dist/types/components/Modal.d.ts.map +1 -1
  74. package/dist/types/components/Page.d.ts.map +1 -1
  75. package/dist/types/components/Pane.d.ts +2 -0
  76. package/dist/types/components/Pane.d.ts.map +1 -1
  77. package/dist/types/components/TabNavigation.d.ts +3 -0
  78. package/dist/types/components/TabNavigation.d.ts.map +1 -0
  79. package/dist/types/components/TextField.d.ts.map +1 -1
  80. package/dist/types/components/Tip.d.ts.map +1 -1
  81. package/dist/types/components/Tooltip.d.ts +2 -0
  82. package/dist/types/components/Tooltip.d.ts.map +1 -1
  83. package/dist/types/index.d.ts +1 -0
  84. package/dist/types/utilities/useBodyScrollLock.d.ts +12 -0
  85. package/dist/types/utilities/useBodyScrollLock.d.ts.map +1 -0
  86. package/dist/types/utilities/useKeyboardAction.d.ts +2 -0
  87. package/dist/types/utilities/useKeyboardAction.d.ts.map +1 -0
  88. package/dist/types/utilities/useLocalStorage.d.ts +13 -0
  89. package/dist/types/utilities/useLocalStorage.d.ts.map +1 -0
  90. package/dist/types/utilities/useMobile.d.ts +9 -0
  91. package/dist/types/utilities/useMobile.d.ts.map +1 -0
  92. package/dist/types/utilities/usePaneState.d.ts +2 -0
  93. package/dist/types/utilities/usePaneState.d.ts.map +1 -0
  94. package/dist/types/utilities/useTabStorage.d.ts +8 -0
  95. package/dist/types/utilities/useTabStorage.d.ts.map +1 -0
  96. package/index.css +77 -6
  97. package/package.json +1 -1
@@ -30,7 +30,7 @@ import Icon from "./Icon.js";
30
30
  import Label from "./Label.js";
31
31
  import RadioButton from "./RadioButton.js";
32
32
  import Text from "./Text.js";
33
- import VerticalStack from "./VerticalStack.js";
33
+ import Stack from "./Stack.js";
34
34
  import { CircleAlertMajor } from "@shopify/polaris-icons";
35
35
  var styles = tv({
36
36
  base: "Litho-ChoiceList flex flex-col gap-1"
@@ -84,7 +84,8 @@ var styles = tv({
84
84
  tooltip: tooltip,
85
85
  children: title
86
86
  }),
87
- /*#__PURE__*/ _jsx(VerticalStack, {
87
+ /*#__PURE__*/ _jsx(Stack, {
88
+ gap: "none",
88
89
  children: choices.map(function(choice, index) {
89
90
  return /*#__PURE__*/ _jsxs("div", {
90
91
  children: [
@@ -0,0 +1,212 @@
1
+ "use client";
2
+ function _array_like_to_array(arr, len) {
3
+ if (len == null || len > arr.length) len = arr.length;
4
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5
+ return arr2;
6
+ }
7
+ function _array_with_holes(arr) {
8
+ if (Array.isArray(arr)) return arr;
9
+ }
10
+ function _define_property(obj, key, value) {
11
+ if (key in obj) {
12
+ Object.defineProperty(obj, key, {
13
+ value: value,
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true
17
+ });
18
+ } else {
19
+ obj[key] = value;
20
+ }
21
+ return obj;
22
+ }
23
+ function _iterable_to_array_limit(arr, i) {
24
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
25
+ if (_i == null) return;
26
+ var _arr = [];
27
+ var _n = true;
28
+ var _d = false;
29
+ var _s, _e;
30
+ try {
31
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
32
+ _arr.push(_s.value);
33
+ if (i && _arr.length === i) break;
34
+ }
35
+ } catch (err) {
36
+ _d = true;
37
+ _e = err;
38
+ } finally{
39
+ try {
40
+ if (!_n && _i["return"] != null) _i["return"]();
41
+ } finally{
42
+ if (_d) throw _e;
43
+ }
44
+ }
45
+ return _arr;
46
+ }
47
+ function _non_iterable_rest() {
48
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
49
+ }
50
+ function _object_spread(target) {
51
+ for(var i = 1; i < arguments.length; i++){
52
+ var source = arguments[i] != null ? arguments[i] : {};
53
+ var ownKeys = Object.keys(source);
54
+ if (typeof Object.getOwnPropertySymbols === "function") {
55
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
56
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
57
+ }));
58
+ }
59
+ ownKeys.forEach(function(key) {
60
+ _define_property(target, key, source[key]);
61
+ });
62
+ }
63
+ return target;
64
+ }
65
+ function ownKeys(object, enumerableOnly) {
66
+ var keys = Object.keys(object);
67
+ if (Object.getOwnPropertySymbols) {
68
+ var symbols = Object.getOwnPropertySymbols(object);
69
+ if (enumerableOnly) {
70
+ symbols = symbols.filter(function(sym) {
71
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
72
+ });
73
+ }
74
+ keys.push.apply(keys, symbols);
75
+ }
76
+ return keys;
77
+ }
78
+ function _object_spread_props(target, source) {
79
+ source = source != null ? source : {};
80
+ if (Object.getOwnPropertyDescriptors) {
81
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
82
+ } else {
83
+ ownKeys(Object(source)).forEach(function(key) {
84
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
85
+ });
86
+ }
87
+ return target;
88
+ }
89
+ function _object_without_properties(source, excluded) {
90
+ if (source == null) return {};
91
+ var target = _object_without_properties_loose(source, excluded);
92
+ var key, i;
93
+ if (Object.getOwnPropertySymbols) {
94
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
95
+ for(i = 0; i < sourceSymbolKeys.length; i++){
96
+ key = sourceSymbolKeys[i];
97
+ if (excluded.indexOf(key) >= 0) continue;
98
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
99
+ target[key] = source[key];
100
+ }
101
+ }
102
+ return target;
103
+ }
104
+ function _object_without_properties_loose(source, excluded) {
105
+ if (source == null) return {};
106
+ var target = {};
107
+ var sourceKeys = Object.keys(source);
108
+ var key, i;
109
+ for(i = 0; i < sourceKeys.length; i++){
110
+ key = sourceKeys[i];
111
+ if (excluded.indexOf(key) >= 0) continue;
112
+ target[key] = source[key];
113
+ }
114
+ return target;
115
+ }
116
+ function _sliced_to_array(arr, i) {
117
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
118
+ }
119
+ function _unsupported_iterable_to_array(o, minLen) {
120
+ if (!o) return;
121
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
122
+ var n = Object.prototype.toString.call(o).slice(8, -1);
123
+ if (n === "Object" && o.constructor) n = o.constructor.name;
124
+ if (n === "Map" || n === "Set") return Array.from(n);
125
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
126
+ }
127
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
128
+ import { useState } from "react";
129
+ import { tv } from "tailwind-variants";
130
+ import { ClipboardMinor, ClipboardCheckFilledMajor } from "@shopify/polaris-icons";
131
+ import Button from "./Button.js";
132
+ var styles = tv({
133
+ base: "Litho-Code p-2.5 bg-surface-normal shadow-inset rounded-md font-mono text-xs overflow-x-auto whitespace-pre"
134
+ });
135
+ var containerStyles = tv({
136
+ base: "Litho-Code-container relative group"
137
+ });
138
+ /**
139
+ * A code component that renders code blocks with consistent styling.
140
+ *
141
+ * @param {Object} props - Properties to customize the code component.
142
+ * @param {string} [props.className] - Additional CSS class names.
143
+ * @param {Function} [props.onCopy] - Function to handle copy action.
144
+ * @param {React.ReactNode} props.children - The code content to be displayed.
145
+ * @returns {JSX.Element} Rendered code block with applied styles.
146
+ *
147
+ * @example
148
+ * <Code>
149
+ * {`const example = "code";`}
150
+ * </Code>
151
+ *
152
+ * @example
153
+ * <Code onCopy={() => {
154
+ * navigator.clipboard.writeText(children);
155
+ * }}>
156
+ * {`const example = "code";`}
157
+ * </Code>
158
+ */ function Code() {
159
+ var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
160
+ var className = props.className, onCopy = props.onCopy, children = props.children, rest = _object_without_properties(props, [
161
+ "className",
162
+ "onCopy",
163
+ "children"
164
+ ]);
165
+ var _useState = _sliced_to_array(useState(false), 2), copied = _useState[0], setCopied = _useState[1];
166
+ var classes = styles();
167
+ var containerClasses = containerStyles();
168
+ var getTextContent = function(node) {
169
+ var _node_props;
170
+ if (typeof node === "string") {
171
+ return node;
172
+ }
173
+ if (typeof node === "number") {
174
+ return String(node);
175
+ }
176
+ if (Array.isArray(node)) {
177
+ return node.map(getTextContent).join("");
178
+ }
179
+ if (node === null || node === void 0 ? void 0 : (_node_props = node.props) === null || _node_props === void 0 ? void 0 : _node_props.children) {
180
+ return getTextContent(node.props.children);
181
+ }
182
+ return "";
183
+ };
184
+ var handleCopy = function() {
185
+ if (onCopy) {
186
+ onCopy();
187
+ setCopied(true);
188
+ setTimeout(function() {
189
+ setCopied(false);
190
+ }, 2000);
191
+ }
192
+ };
193
+ return /*#__PURE__*/ _jsxs("div", {
194
+ className: containerClasses,
195
+ children: [
196
+ onCopy && /*#__PURE__*/ _jsx("div", {
197
+ className: "absolute top-1 right-1 z-10 opacity-0 group-hover:opacity-100 transition-opacity duration-200",
198
+ children: /*#__PURE__*/ _jsx(Button, {
199
+ size: "small",
200
+ icon: copied ? ClipboardCheckFilledMajor : ClipboardMinor,
201
+ onClick: handleCopy,
202
+ tooltip: copied ? undefined : "Copy to clipboard"
203
+ })
204
+ }),
205
+ /*#__PURE__*/ _jsx("pre", _object_spread_props(_object_spread({}, rest), {
206
+ className: "".concat(classes).concat(className ? " ".concat(className) : ""),
207
+ children: children
208
+ }))
209
+ ]
210
+ });
211
+ }
212
+ export default Code;
@@ -110,7 +110,7 @@ function _unsupported_iterable_to_array(o, minLen) {
110
110
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
111
111
  }
112
112
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
113
- import React, { useContext, useEffect, useRef, useState } from "react";
113
+ import React, { useEffect, useRef, useState } from "react";
114
114
  import { tv } from "tailwind-variants";
115
115
  import ActionList from "./ActionList.js";
116
116
  import Button from "./Button.js";
@@ -123,7 +123,7 @@ import Tooltip from "./Tooltip.js";
123
123
  import { CancelSmallMinor, CaretDownMinor, DeleteMinor, HorizontalDotsMinor, PlusMinor, SearchMajor, ChevronLeftMinor, ChevronRightMinor } from "@shopify/polaris-icons";
124
124
  import { useDarkMode } from "./AppProvider.js";
125
125
  var styles = tv({
126
- base: "Litho-Filters flex items-center",
126
+ base: "Litho-Filters flex items-center overflow-x-auto",
127
127
  variants: {
128
128
  showTextField: {
129
129
  true: "justify-between",
@@ -60,7 +60,7 @@ var frameStyles = tv({
60
60
  base: "Litho-Frame bg-surface-normal",
61
61
  variants: {
62
62
  paneIsOpen: {
63
- true: "md:mr-[var(--litho-pane-width)]"
63
+ true: "mr-[var(--litho-pane-collapsed-width)] sm:mr-0 md:mr-[var(--litho-pane-width)]"
64
64
  }
65
65
  },
66
66
  defaultVariants: {
@@ -71,7 +71,7 @@ var frameHeaderStyles = tv({
71
71
  base: "Litho-Frame-Header bg-surface-normal fixed left-0 right-0 top-0",
72
72
  variants: {
73
73
  paneIsOpen: {
74
- true: "md:mr-[var(--litho-pane-width)]"
74
+ true: "mr-[var(--litho-pane-width)] md:mr-[var(--litho-pane-width)]"
75
75
  }
76
76
  },
77
77
  defaultVariants: {
@@ -7,10 +7,14 @@ import Text from "./Text.js";
7
7
  import { useFrame } from "./Frame.js";
8
8
  export var LayoutContext = /*#__PURE__*/ createContext();
9
9
  var styles = tv({
10
- base: "Litho-Layout flex flex-col gap-4 w-full max-w-full",
10
+ base: "Litho-Layout flex gap-4 w-full max-w-full",
11
11
  variants: {
12
12
  hasSidebarSection: {
13
13
  true: ""
14
+ },
15
+ reverseOnMobile: {
16
+ true: "flex-col-reverse @lg:flex-row",
17
+ false: "flex-col"
14
18
  }
15
19
  },
16
20
  compoundVariants: [
@@ -23,11 +27,17 @@ var styles = tv({
23
27
  hasSidebarSection: true,
24
28
  embedded: true,
25
29
  className: "@lg-embed:flex-row @lg-embed:items-start @lg-embed:gap-5"
30
+ },
31
+ {
32
+ reverseOnMobile: true,
33
+ embedded: true,
34
+ className: "@lg-embed:flex-row"
26
35
  }
27
36
  ],
28
37
  defaultVariants: {
29
38
  hasSidebarSection: false,
30
- embedded: false
39
+ embedded: false,
40
+ reverseOnMobile: false
31
41
  }
32
42
  });
33
43
  /**
@@ -39,11 +49,12 @@ var styles = tv({
39
49
  *
40
50
  * @param {Object} props - Component props.
41
51
  * @param {React.ReactNode} props.children - The content to render inside the layout.
52
+ * @param {boolean} [props.reverseOnMobile] - If true, reverses the flex direction on mobile devices.
42
53
  * @returns {JSX.Element} The rendered layout component.
43
54
  */ function Layout() {
44
55
  var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
45
56
  var embedded = useFrame().embedded;
46
- var children = props.children;
57
+ var children = props.children, reverseOnMobile = props.reverseOnMobile;
47
58
  var analyzeChildren = function(children) {
48
59
  var depth = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
49
60
  if (depth > 3) return {
@@ -89,7 +100,8 @@ var styles = tv({
89
100
  var hasSidebarSection = sections.length > 0;
90
101
  var classes = styles({
91
102
  hasSidebarSection: hasSidebarSection,
92
- embedded: embedded
103
+ embedded: embedded,
104
+ reverseOnMobile: reverseOnMobile
93
105
  });
94
106
  var wrappedChildren = hasSection ? children : /*#__PURE__*/ _jsx(Layout.Section, {
95
107
  children: children
@@ -1,5 +1,6 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { tv } from "tailwind-variants";
3
+ import Icon from "./Icon.js";
3
4
  var styles = tv({
4
5
  base: "Litho-Link cursor-pointer hover:underline",
5
6
  variants: {
@@ -17,6 +18,10 @@ var styles = tv({
17
18
  disabled: {
18
19
  true: "text-lowest hover:text-lowest cursor-default hover:no-underline",
19
20
  false: ""
21
+ },
22
+ hasIcon: {
23
+ true: "inline-flex items-center gap-1",
24
+ false: ""
20
25
  }
21
26
  },
22
27
  compoundVariants: [
@@ -62,6 +67,12 @@ var styles = tv({
62
67
  color: "highlight",
63
68
  className: "text-highlight-alt-fg dark:text-highlight-alt-fg-dark"
64
69
  },
70
+ {
71
+ disabled: false,
72
+ monochrome: false,
73
+ color: "insight",
74
+ className: "text-insight-text dark:text-insight-text"
75
+ },
65
76
  {
66
77
  disabled: false,
67
78
  monochrome: false,
@@ -85,6 +96,7 @@ var styles = tv({
85
96
  * @param {React.ReactNode} props.children - Content to display within the link.
86
97
  * @param {Function} [props.onClick] - Optional click event handler for the link.
87
98
  * @param {boolean} [props.external=false] - If true, opens the link in a new tab.
99
+ * @param {boolean} [props.insight=false] - If true, set the color and iconColor to insight
88
100
  * @param {string} [props.target] - Optional target attribute for specifying where to open the link.
89
101
  * @param {string} [props.id] - Optional id attribute for the link.
90
102
  * @param {boolean} [props.monochrome=false] - If true, applies monochrome color scheme.
@@ -93,19 +105,24 @@ var styles = tv({
93
105
  * @param {string} [props.dataPrimaryLink] - Optional data attribute for custom tracking.
94
106
  * @param {Function} [props.onMouseEnter] - Optional mouse enter event handler for the link.
95
107
  * @param {Function} [props.onMouseLeave] - Optional mouse leave event handler for the link.
108
+ * @param {React.ReactNode} [props.icon] - Optional icon to display within the link.
96
109
  *
97
110
  * @returns {JSX.Element} Rendered link element.
98
111
  */ function Link() {
99
112
  var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
100
- 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, color = props.color, className = props.className, onMouseEnter = props.onMouseEnter, onMouseLeave = props.onMouseLeave;
113
+ 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;
114
+ var hasIcon = icon !== undefined;
115
+ var color = insight ? "insight" : _color;
116
+ var iconColor = insight ? "insight" : _iconColor;
101
117
  var classes = styles({
102
118
  monochrome: monochrome,
103
119
  removeUnderline: removeUnderline,
104
120
  bold: bold,
105
121
  disabled: disabled,
106
- color: color
122
+ color: color,
123
+ hasIcon: hasIcon
107
124
  });
108
- return /*#__PURE__*/ _jsx("a", {
125
+ return /*#__PURE__*/ _jsxs("a", {
109
126
  href: disabled ? undefined : url,
110
127
  className: "".concat(classes).concat(className ? " ".concat(className) : ""),
111
128
  onClick: disabled ? undefined : onClick,
@@ -115,7 +132,16 @@ var styles = tv({
115
132
  "data-primary-link": dataPrimaryLink,
116
133
  onMouseEnter: onMouseEnter,
117
134
  onMouseLeave: onMouseLeave,
118
- children: children
135
+ children: [
136
+ icon && /*#__PURE__*/ _jsx(Icon, {
137
+ source: icon,
138
+ color: iconColor,
139
+ size: iconSize
140
+ }),
141
+ /*#__PURE__*/ _jsx("span", {
142
+ children: children
143
+ })
144
+ ]
119
145
  });
120
146
  }
121
147
  ;
@@ -60,6 +60,7 @@ import Spinner from "./Spinner.js";
60
60
  import Text from "./Text.js";
61
61
  import Tooltip from "./Tooltip.js";
62
62
  import { useFrame } from "./Frame.js";
63
+ import { useBodyScrollLock } from "../utilities/useBodyScrollLock.js";
63
64
  export var ModalContext = /*#__PURE__*/ createContext(false);
64
65
  var containerStyles = tv({
65
66
  base: "Litho-ModalContainer fixed inset-0 block flex flex-col justify-end md:justify-center items-center pointer-events-none"
@@ -134,6 +135,7 @@ var sectionStyles = tv({
134
135
  * @param {string} [props.size="default"] - The size of the modal (default, large, or full).
135
136
  * @param {React.ReactNode} [props.leftAccessory] - Left accessory content in the footer.
136
137
  * @param {boolean} [props.hideCloseButton=false] - Whether to hide the close button.
138
+ * @param {Function} [props.backAction] - Callback function for the back button. When provided, displays a back button next to the title.
137
139
  * @param {number} [props.zIndexOverride=1000] - The z-index of the modal.
138
140
  * @param {boolean} [props.autoFocusFirstInput=true] - Whether to focus the first input when the modal opens.
139
141
  * @param {string} [props.bodyClassName] - Additional CSS classes to apply to the modal body.
@@ -164,6 +166,8 @@ var sectionStyles = tv({
164
166
  document.body.removeChild(div);
165
167
  };
166
168
  }, []);
169
+ // Lock body scroll when modal is open
170
+ useBodyScrollLock(open);
167
171
  useEffect(function() {
168
172
  setModalIsOpen(open);
169
173
  if (!open || !onClose) return;
@@ -364,8 +364,9 @@ var contentStyles = tv({
364
364
  return closePopover(index);
365
365
  },
366
366
  activator: /*#__PURE__*/ _jsx(Button, {
367
- plain: true,
367
+ plain: !action.insight,
368
368
  disclosure: true,
369
+ insight: action.insight,
369
370
  icon: action.icon,
370
371
  onClick: function() {
371
372
  return togglePopover(index);
@@ -381,7 +382,7 @@ var contentStyles = tv({
381
382
  }, index);
382
383
  }
383
384
  return /*#__PURE__*/ _jsx(Button, {
384
- plain: !action.destructive,
385
+ plain: !action.destructive && !action.insight,
385
386
  onClick: action.onAction || action.onClick,
386
387
  disabled: action.disabled,
387
388
  icon: action.icon,
@@ -389,7 +390,9 @@ var contentStyles = tv({
389
390
  external: action.external,
390
391
  url: action.url,
391
392
  destructive: action.destructive,
393
+ insight: action.insight,
392
394
  tooltip: action.tooltip,
395
+ className: action.insight ? "mx-0.5" : "",
393
396
  children: action.content
394
397
  }, index);
395
398
  })