@elevasis/ui 2.3.1 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,6 @@
1
- import { useAppearance } from './chunk-QJ2KCHKX.js';
2
- import { subshellNavItemIconSize, sidebarIconSize, sidebarIconStroke, sidebarIconInnerSize, sidebarGroupChevronSize } from './chunk-DT3QYZVU.js';
3
- import { UnstyledButton, Stack, Group, Text, Box, ThemeIcon, Center, Container, Collapse } from '@mantine/core';
1
+ import { subshellNavItemIconSize, sidebarIconSize, sidebarIconStroke, sidebarIconInnerSize } from './chunk-DT3QYZVU.js';
2
+ import { UnstyledButton, Stack, Group, Text, Box, ThemeIcon } from '@mantine/core';
4
3
  import { jsx, jsxs } from 'react/jsx-runtime';
5
- import { IconChevronDown, IconChevronRight } from '@tabler/icons-react';
6
4
 
7
5
  var activeColor = "var(--color-primary)";
8
6
  var defaultColor = "var(--color-text-subtle)";
@@ -154,118 +152,5 @@ var SubshellSidebarSection = ({
154
152
  }
155
153
  );
156
154
  };
157
- function SubshellLoader() {
158
- const { loader } = useAppearance();
159
- return /* @__PURE__ */ jsx(Center, { mih: "calc(100vh - 70px)", children: loader });
160
- }
161
- var PageContainer = ({ children }) => {
162
- return (
163
- // Add padding to the top of the container to adjust for the topbar height
164
- /* @__PURE__ */ jsx(Container, { size: "xl", p: 0, w: "100%", children: /* @__PURE__ */ jsx(Stack, { gap: "lg", children }) })
165
- );
166
- };
167
- var activeColor2 = "var(--color-primary)";
168
- var defaultTextColor = "var(--color-text)";
169
- var subtleColor = "var(--color-text-subtle)";
170
- var activeBg2 = `color-mix(in srgb, ${activeColor2} 10%, transparent)`;
171
- var CollapsibleSidebarGroup = ({
172
- icon: Icon,
173
- label,
174
- isExpanded,
175
- onToggle,
176
- isActive = false,
177
- badge,
178
- children,
179
- onLabelClick,
180
- emptyMessage = "No items",
181
- isEmpty = false,
182
- isLoading = false,
183
- loadingComponent
184
- }) => {
185
- const showActiveStyle = !isExpanded && isActive;
186
- const iconColor = showActiveStyle ? activeColor2 : subtleColor;
187
- const textColor = showActiveStyle ? activeColor2 : defaultTextColor;
188
- const fontWeight = showActiveStyle ? 600 : 500;
189
- const handleLabelClick = (e) => {
190
- if (onLabelClick) {
191
- e.stopPropagation();
192
- onLabelClick();
193
- }
194
- };
195
- return /* @__PURE__ */ jsxs(Box, { children: [
196
- /* @__PURE__ */ jsx(
197
- UnstyledButton,
198
- {
199
- onClick: onToggle,
200
- style: {
201
- display: "flex",
202
- alignItems: "center",
203
- width: "100%",
204
- padding: "var(--mantine-spacing-xs)",
205
- color: textColor,
206
- backgroundColor: showActiveStyle ? activeBg2 : "transparent",
207
- transition: `all var(--duration-fast) var(--easing)`,
208
- cursor: "pointer",
209
- overflow: "hidden"
210
- },
211
- onMouseEnter: (e) => {
212
- if (!showActiveStyle) {
213
- e.currentTarget.style.backgroundColor = "var(--color-surface-hover)";
214
- }
215
- },
216
- onMouseLeave: (e) => {
217
- if (!showActiveStyle) {
218
- e.currentTarget.style.backgroundColor = "transparent";
219
- }
220
- },
221
- children: /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", style: { width: "100%" }, children: [
222
- /* @__PURE__ */ jsx(Box, { style: { flexShrink: 0, color: iconColor }, children: isExpanded ? /* @__PURE__ */ jsx(IconChevronDown, { size: sidebarGroupChevronSize }) : /* @__PURE__ */ jsx(IconChevronRight, { size: sidebarGroupChevronSize }) }),
223
- /* @__PURE__ */ jsx(
224
- Box,
225
- {
226
- style: { flexShrink: 0, color: iconColor, cursor: onLabelClick ? "pointer" : "inherit" },
227
- onClick: onLabelClick ? handleLabelClick : void 0,
228
- children: /* @__PURE__ */ jsx(Icon, { size: sidebarIconInnerSize, color: activeColor2 })
229
- }
230
- ),
231
- /* @__PURE__ */ jsx(
232
- Text,
233
- {
234
- size: "sm",
235
- fw: fontWeight,
236
- style: {
237
- fontFamily: "var(--elevasis-font-family-subtitle)",
238
- color: textColor,
239
- transition: `color var(--duration-fast) var(--easing)`,
240
- overflow: "hidden",
241
- textOverflow: "ellipsis",
242
- whiteSpace: "nowrap",
243
- flex: 1,
244
- cursor: onLabelClick ? "pointer" : "inherit"
245
- },
246
- onClick: onLabelClick ? handleLabelClick : void 0,
247
- children: label
248
- }
249
- ),
250
- badge && /* @__PURE__ */ jsx(Box, { style: { flexShrink: 0 }, children: badge })
251
- ] })
252
- }
253
- ),
254
- /* @__PURE__ */ jsx(Collapse, { in: isExpanded, children: /* @__PURE__ */ jsx(
255
- Stack,
256
- {
257
- gap: 0,
258
- mt: "xs",
259
- ml: "xs",
260
- style: {
261
- borderLeft: `1px solid color-mix(in srgb, var(--color-primary) 40%, transparent)`,
262
- marginLeft: "calc(var(--mantine-spacing-xs) + 6px)",
263
- paddingLeft: "calc(var(--mantine-spacing-xs) - 2px)"
264
- },
265
- children: isLoading ? loadingComponent : isEmpty ? /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", style: { padding: "6px 8px" }, children: emptyMessage }) : children
266
- }
267
- ) })
268
- ] });
269
- };
270
155
 
271
- export { CollapsibleSidebarGroup, PageContainer, SubshellLoader, SubshellNavItem, SubshellSidebarSection };
156
+ export { SubshellNavItem, SubshellSidebarSection };