@iris-ui-kit/vue 0.2.13 → 0.2.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/dist/admin.js CHANGED
@@ -1,4 +1,4 @@
1
- export { IrisAdminBreadcrumb, IrisAdminLayout, IrisAdminTabs, IrisNavMenu, createAdminPreferences, createTabsNav, filterNavByAccess, findNavNode, findNavPath, firstLeaf, flattenNav, isBranch, isClosable, localStorageAdminPreferencesStorage, nodeAllowsRoles, useAdminPreferences, useAdminShell, useTabsNav, visibleNav } from './chunk-QC4D52TG.js';
1
+ export { IrisAdminBreadcrumb, IrisAdminLayout, IrisAdminTabs, IrisNavMenu, createAdminPreferences, createTabsNav, filterNavByAccess, findNavNode, findNavPath, firstLeaf, flattenNav, isBranch, isClosable, localStorageAdminPreferencesStorage, nodeAllowsRoles, useAdminPreferences, useAdminShell, useTabsNav, visibleNav } from './chunk-KIEJL6C6.js';
2
2
  import './chunk-3FJUCHCC.js';
3
3
  import './chunk-TQB5LVOH.js';
4
4
  import './chunk-F77KIPOH.js';
@@ -388,8 +388,8 @@ declare const IrisSortable: vue.DefineComponent<vue.ExtractPropTypes<{
388
388
  }>, {
389
389
  style: Record<string, string | number>;
390
390
  orientation: "vertical" | "horizontal";
391
- disabled: boolean;
392
391
  class: string;
392
+ disabled: boolean;
393
393
  onReorder: (next: unknown[]) => void;
394
394
  getKey: (item: unknown, index: number) => string;
395
395
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
@@ -388,8 +388,8 @@ declare const IrisSortable: vue.DefineComponent<vue.ExtractPropTypes<{
388
388
  }>, {
389
389
  style: Record<string, string | number>;
390
390
  orientation: "vertical" | "horizontal";
391
- disabled: boolean;
392
391
  class: string;
392
+ disabled: boolean;
393
393
  onReorder: (next: unknown[]) => void;
394
394
  getKey: (item: unknown, index: number) => string;
395
395
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
@@ -71,16 +71,229 @@ var IrisIcon = defineComponent({
71
71
  // src/admin/styles.ts
72
72
  var __NAV_MENU_STYLE_ID = "iris-nav-menu-styles";
73
73
  var CSS = `
74
+ :where(.iris-nav-menu) {
75
+ --iris-nav-indent-step: 16px;
76
+ --iris-nav-item-padding-inline: 10px;
77
+ --iris-nav-item-padding-block: 8px;
78
+ --iris-nav-item-border-radius: var(--iris-radius-md, 6px);
79
+ --iris-nav-item-hover: var(--iris-surface-hover, var(--iris-surface));
80
+ --iris-nav-item-height: 34px;
81
+ display: flex;
82
+ flex-direction: column;
83
+ align-items: stretch;
84
+ gap: 2px;
85
+ width: 100%;
86
+ }
87
+
88
+ :where(.iris-nav-menu--horizontal) {
89
+ flex-direction: row;
90
+ align-items: center;
91
+ width: auto;
92
+ }
93
+
94
+ :where(.iris-nav-menu-group) {
95
+ position: relative;
96
+ }
97
+
98
+ :where(.iris-nav-menu-item) {
99
+ appearance: none;
100
+ box-sizing: border-box;
101
+ display: flex;
102
+ flex: 0 1 auto;
103
+ align-items: center;
104
+ width: 100%;
105
+ min-height: var(--iris-nav-item-height);
106
+ border: none;
107
+ border-radius: var(--iris-nav-item-border-radius);
108
+ background: transparent;
109
+ color: var(--iris-foreground, var(--iris-color-text, var(--iris-foreground)));
110
+ font: inherit;
111
+ font-size: 14px;
112
+ line-height: 1.2;
113
+ font-weight: 400;
114
+ text-align: start;
115
+ cursor: pointer;
116
+ opacity: 1;
117
+ margin: 0;
118
+ gap: 10px;
119
+ padding-block: var(--iris-nav-item-padding-block);
120
+ padding-inline: var(--iris-nav-item-padding-inline);
121
+ text-overflow: ellipsis;
122
+ white-space: nowrap;
123
+ }
124
+
125
+ :where(.iris-nav-menu--horizontal .iris-nav-menu-item) {
126
+ width: auto;
127
+ padding-inline-start: var(--iris-nav-item-padding-inline);
128
+ }
129
+
130
+ :where(.iris-nav-menu-item[data-depth='0']) {
131
+ --iris-nav-item-padding-inline-start: 10px;
132
+ }
133
+
134
+ :where(.iris-nav-menu-item[data-depth='1']) {
135
+ --iris-nav-item-padding-inline-start: calc(12px + var(--iris-nav-indent-step));
136
+ }
137
+
138
+ :where(.iris-nav-menu-item[data-depth='2']) {
139
+ --iris-nav-item-padding-inline-start: calc(12px + var(--iris-nav-indent-step) * 2);
140
+ }
141
+
142
+ :where(.iris-nav-menu-item[data-depth='3']) {
143
+ --iris-nav-item-padding-inline-start: calc(12px + var(--iris-nav-indent-step) * 3);
144
+ }
145
+
146
+ :where(.iris-nav-menu-item[data-depth='4']) {
147
+ --iris-nav-item-padding-inline-start: calc(12px + var(--iris-nav-indent-step) * 4);
148
+ }
149
+
150
+ :where(.iris-nav-menu-item[data-depth='5']) {
151
+ --iris-nav-item-padding-inline-start: calc(12px + var(--iris-nav-indent-step) * 5);
152
+ }
153
+
154
+ :where(.iris-nav-menu-item[data-depth='6']) {
155
+ --iris-nav-item-padding-inline-start: calc(12px + var(--iris-nav-indent-step) * 6);
156
+ }
157
+
158
+ :where(.iris-nav-menu-item[data-depth='7']) {
159
+ --iris-nav-item-padding-inline-start: calc(12px + var(--iris-nav-indent-step) * 7);
160
+ }
161
+
162
+ :where(.iris-nav-menu-item[data-depth='8']) {
163
+ --iris-nav-item-padding-inline-start: calc(12px + var(--iris-nav-indent-step) * 8);
164
+ }
165
+
166
+ :where(.iris-nav-menu-item[data-depth='9']) {
167
+ --iris-nav-item-padding-inline-start: calc(12px + var(--iris-nav-indent-step) * 9);
168
+ }
169
+
170
+ :where(.iris-nav-menu--vertical .iris-nav-menu-item[data-depth]) {
171
+ padding-inline-start: var(--iris-nav-item-padding-inline-start);
172
+ }
173
+
174
+ :where(.iris-nav-menu-item:hover),
175
+ :where(.iris-nav-menu-item.is-hovered):not([disabled], .is-disabled) {
176
+ background: var(--iris-nav-item-hover);
177
+ }
178
+
179
+ :where(.iris-nav-menu-item[data-active='true']) {
180
+ background: var(--iris-primary);
181
+ color: var(--iris-primary-foreground, #fff);
182
+ font-weight: 600;
183
+ }
184
+
185
+ :where(.iris-nav-menu-item[data-active-trail='true']) {
186
+ color: var(--iris-primary);
187
+ font-weight: 600;
188
+ }
189
+
190
+ :where(.iris-nav-menu-item[disabled], .iris-nav-menu-item.is-disabled) {
191
+ cursor: not-allowed;
192
+ opacity: 0.5;
193
+ }
194
+
195
+ :where(.iris-nav-menu-item:focus-visible) {
196
+ outline: 2px solid var(--iris-ring, var(--iris-primary));
197
+ outline-offset: 1px;
198
+ }
199
+
200
+ :where(.iris-nav-menu-label) {
201
+ flex: 0 1 auto;
202
+ min-width: 0;
203
+ overflow: hidden;
204
+ text-overflow: ellipsis;
205
+ }
206
+
207
+ :where(.iris-nav-menu-badge) {
208
+ margin-inline-start: 6px;
209
+ font-size: 11px;
210
+ line-height: 1;
211
+ padding: 2px 6px;
212
+ border-radius: 999px;
213
+ background: var(--iris-danger, #e5484d);
214
+ color: #fff;
215
+ flex: 0 0 auto;
216
+ }
217
+
74
218
  :where(.iris-nav-menu-arrow) {
75
219
  flex: 0 0 auto;
76
220
  opacity: 0.6;
77
221
  transform: rotate(0deg);
78
222
  transform-origin: center;
79
223
  transition: transform 160ms ease;
224
+ margin-inline-start: auto;
80
225
  }
81
- :where(.iris-nav-menu-arrow[data-reversed="true"]) {
226
+
227
+ :where(.iris-nav-menu-arrow[data-reversed='true']) {
82
228
  transform: rotate(180deg);
83
229
  }
230
+
231
+ :where(.iris-nav-menu-fallback-icon) {
232
+ display: inline-flex;
233
+ width: 20px;
234
+ height: 20px;
235
+ align-items: center;
236
+ justify-content: center;
237
+ font-weight: 700;
238
+ }
239
+
240
+ :where(.iris-nav-menu-item.is-disabled) .iris-nav-menu-label {
241
+ opacity: 0.75;
242
+ }
243
+
244
+ :where(.iris-nav-menu-group--depth-0 > .iris-nav-menu-children) {
245
+ display: none;
246
+ }
247
+
248
+ :where(.iris-nav-menu-group--depth-1 > .iris-nav-menu-children),
249
+ :where(.iris-nav-menu-group--depth-2 > .iris-nav-menu-children),
250
+ :where(.iris-nav-menu-group--depth-3 > .iris-nav-menu-children),
251
+ :where(.iris-nav-menu-group--depth-4 > .iris-nav-menu-children),
252
+ :where(.iris-nav-menu-group--depth-5 > .iris-nav-menu-children),
253
+ :where(.iris-nav-menu-group--depth-6 > .iris-nav-menu-children),
254
+ :where(.iris-nav-menu-group--depth-7 > .iris-nav-menu-children),
255
+ :where(.iris-nav-menu-group--depth-8 > .iris-nav-menu-children),
256
+ :where(.iris-nav-menu-group--depth-9 > .iris-nav-menu-children),
257
+ :where(.iris-nav-menu-group > .iris-nav-menu-children) {
258
+ display: none;
259
+ }
260
+
261
+ :where(.iris-nav-menu-group[data-open='true'] > .iris-nav-menu-children) {
262
+ display: block;
263
+ }
264
+
265
+ :where(.iris-nav-menu--horizontal .iris-nav-menu-group > .iris-nav-menu-children) {
266
+ position: absolute;
267
+ min-width: 220px;
268
+ padding: 6px;
269
+ border: 1px solid var(--iris-border);
270
+ border-radius: var(--iris-radius-md, 6px);
271
+ background: var(--iris-surface);
272
+ box-shadow: var(--iris-shadow-md);
273
+ }
274
+
275
+ :where(.iris-nav-menu--horizontal .iris-nav-menu-group[data-depth='0'] > .iris-nav-menu-children) {
276
+ inset-block-start: 100%;
277
+ inset-inline-start: 0;
278
+ z-index: 60;
279
+ }
280
+
281
+ :where(.iris-nav-menu--horizontal .iris-nav-menu-group[data-depth]:not([data-depth='0']) > .iris-nav-menu-children) {
282
+ inset-block-start: 0;
283
+ inset-inline-start: 100%;
284
+ z-index: 61;
285
+ }
286
+
287
+ :where(.iris-nav-menu--collapsed .iris-nav-menu-item) {
288
+ justify-content: center;
289
+ padding-inline-start: var(--iris-nav-item-padding-inline);
290
+ }
291
+
292
+ :where(.iris-nav-menu-item.is-collapsed) {
293
+ justify-content: center;
294
+ padding-inline: var(--iris-nav-item-padding-inline);
295
+ }
296
+
84
297
  @media (prefers-reduced-motion: reduce) {
85
298
  :where(.iris-nav-menu-arrow) {
86
299
  transition: none;
@@ -194,49 +407,25 @@ var IrisNavMenu = defineComponent({
194
407
  if (hoveredAtDepth) return hoveredAtDepth === key;
195
408
  return interactionKeyAtDepth(focusedBranches.value, depth) === key;
196
409
  };
197
- const itemStyle = (opts) => {
198
- const bg = opts.active ? "var(--iris-primary)" : opts.hovered && !opts.disabled ? "var(--iris-surface-hover, var(--iris-surface))" : "transparent";
199
- return {
200
- display: "flex",
201
- alignItems: "center",
202
- gap: "10px",
203
- width: props.orientation === "horizontal" && opts.depth === 0 ? "auto" : "100%",
204
- boxSizing: "border-box",
205
- border: "none",
206
- borderRadius: "var(--iris-radius-md, 6px)",
207
- background: bg,
208
- color: opts.active ? "var(--iris-primary-foreground, #fff)" : opts.trail ? "var(--iris-primary)" : "var(--iris-foreground)",
209
- font: "inherit",
210
- fontSize: "14px",
211
- fontWeight: opts.active || opts.trail ? "600" : "400",
212
- textAlign: "start",
213
- cursor: opts.disabled ? "not-allowed" : "pointer",
214
- opacity: opts.disabled ? "0.5" : "1",
215
- padding: props.collapsed ? "10px" : "8px 10px",
216
- paddingInlineStart: props.collapsed || props.orientation === "horizontal" ? "10px" : `${12 + opts.depth * 16}px`,
217
- justifyContent: props.collapsed ? "center" : "flex-start"
218
- };
410
+ const itemClass = (opts) => {
411
+ const depth = Math.min(9, opts.depth);
412
+ return [
413
+ "iris-nav-menu-item",
414
+ `iris-nav-menu-item--depth-${depth}`,
415
+ `iris-nav-menu-item--${opts.branch ? "branch" : "leaf"}`,
416
+ opts.active ? "is-active" : void 0,
417
+ opts.trail ? "is-trail" : void 0,
418
+ opts.hovered ? "is-hovered" : void 0,
419
+ opts.open ? "is-open" : void 0,
420
+ opts.disabled ? "is-disabled" : void 0
421
+ ].filter(Boolean);
219
422
  };
220
- const hoverHandlers = (key) => ({
221
- onMouseenter: () => hovered.value = key,
222
- onMouseleave: () => {
223
- if (hovered.value === key) hovered.value = null;
224
- }
225
- });
226
423
  const iconNode = (node, size = 18) => node.icon ? h(IrisIcon, { name: node.icon, size }) : null;
227
424
  const badgeNode = (node) => node.badge !== void 0 && node.badge !== "" && !props.collapsed ? h(
228
425
  "span",
229
426
  {
230
- "data-iris-nav-badge": "",
231
- style: {
232
- marginInlineStart: "auto",
233
- fontSize: "11px",
234
- lineHeight: "1",
235
- padding: "2px 6px",
236
- borderRadius: "999px",
237
- background: "var(--iris-danger, #e5484d)",
238
- color: "#fff"
239
- }
427
+ class: "iris-nav-menu-badge",
428
+ "data-iris-nav-badge": ""
240
429
  },
241
430
  String(node.badge)
242
431
  ) : null;
@@ -248,25 +437,38 @@ var IrisNavMenu = defineComponent({
248
437
  {
249
438
  key: node.key,
250
439
  type: "button",
440
+ class: [
441
+ ...itemClass({
442
+ depth: 0,
443
+ active,
444
+ trail: false,
445
+ hovered: hovered.value === node.key,
446
+ open: false,
447
+ disabled: !!node.disabled,
448
+ branch
449
+ }),
450
+ "is-collapsed"
451
+ ],
251
452
  "data-iris-nav-item": "",
252
453
  "data-key": node.key,
253
454
  "data-active": active ? "true" : void 0,
254
455
  "data-branch": branch ? "true" : void 0,
456
+ "data-hovered": hovered.value === node.key ? "true" : void 0,
255
457
  disabled: node.disabled,
256
458
  title: node.title,
257
459
  "aria-label": branch ? `${node.title} (section)` : node.title,
258
460
  "aria-current": active && !branch ? "page" : void 0,
259
- style: itemStyle({
260
- depth: 0,
261
- active,
262
- trail: false,
263
- hovered: hovered.value === node.key,
264
- disabled: !!node.disabled
265
- }),
266
- ...hoverHandlers(node.key),
461
+ onMouseenter: () => {
462
+ if (!node.disabled) hovered.value = node.key;
463
+ },
464
+ onMouseleave: () => {
465
+ if (hovered.value === node.key) hovered.value = null;
466
+ },
267
467
  onClick: () => select(branch ? firstLeaf(node) : node)
268
468
  },
269
- [iconNode(node, 20) ?? h("span", { style: { fontWeight: "700" } }, node.title.charAt(0))]
469
+ [
470
+ iconNode(node, 20) ?? h("span", { class: "iris-nav-menu-fallback-icon" }, node.title.charAt(0))
471
+ ]
270
472
  );
271
473
  });
272
474
  const renderItem = (node, depth) => {
@@ -281,24 +483,33 @@ var IrisNavMenu = defineComponent({
281
483
  "button",
282
484
  {
283
485
  type: "button",
486
+ class: itemClass({
487
+ depth,
488
+ active,
489
+ trail,
490
+ hovered: hovered.value === node.key,
491
+ open: branch ? shown : false,
492
+ disabled: !!node.disabled,
493
+ branch
494
+ }),
284
495
  "data-iris-nav-item": "",
285
496
  "data-key": node.key,
286
497
  "data-branch": branch ? "true" : void 0,
287
498
  "data-active": active ? "true" : void 0,
288
499
  "data-active-trail": trail ? "true" : void 0,
289
500
  "data-open": branch && shown ? "true" : void 0,
501
+ "data-hovered": hovered.value === node.key ? "true" : void 0,
290
502
  "data-depth": String(depth),
503
+ "data-orientation": props.orientation,
291
504
  disabled: node.disabled,
292
505
  "aria-expanded": branch ? shown ? "true" : "false" : void 0,
293
506
  "aria-current": active ? "page" : void 0,
294
- style: itemStyle({
295
- depth,
296
- active,
297
- trail,
298
- hovered: hovered.value === node.key,
299
- disabled: !!node.disabled
300
- }),
301
- ...hoverHandlers(node.key),
507
+ onMouseenter: () => {
508
+ if (!node.disabled) hovered.value = node.key;
509
+ },
510
+ onMouseleave: () => {
511
+ if (hovered.value === node.key) hovered.value = null;
512
+ },
302
513
  onClick: () => branch ? toggle(node.key) : select(node)
303
514
  },
304
515
  [
@@ -306,12 +517,7 @@ var IrisNavMenu = defineComponent({
306
517
  h(
307
518
  "span",
308
519
  {
309
- style: {
310
- flex: branch ? "1" : "0 1 auto",
311
- overflow: "hidden",
312
- textOverflow: "ellipsis",
313
- whiteSpace: "nowrap"
314
- }
520
+ class: "iris-nav-menu-label"
315
521
  },
316
522
  node.title
317
523
  ),
@@ -320,16 +526,18 @@ var IrisNavMenu = defineComponent({
320
526
  name: horizontal && depth === 0 ? "chevron-down" : "chevron-right",
321
527
  size: 16,
322
528
  class: "iris-nav-menu-arrow",
323
- "data-reversed": arrowReversed ? "true" : void 0,
324
- style: { marginInlineStart: badgeNode(node) ? "6px" : "auto" }
529
+ "data-reversed": arrowReversed ? "true" : void 0
325
530
  }) : null
326
531
  ]
327
532
  );
328
- const groupStyle = horizontal && branch ? { position: "relative" } : void 0;
329
533
  if (!branch || !horizontal && !open)
330
534
  return h(
331
535
  "div",
332
- { key: node.key, "data-iris-nav-group": branch ? "" : void 0, style: groupStyle },
536
+ {
537
+ key: node.key,
538
+ "data-iris-nav-group": branch ? "" : void 0,
539
+ class: ["iris-nav-menu-group", `iris-nav-menu-group--depth-${Math.min(9, depth)}`]
540
+ },
333
541
  [row]
334
542
  );
335
543
  return h(
@@ -338,7 +546,11 @@ var IrisNavMenu = defineComponent({
338
546
  key: node.key,
339
547
  "data-iris-nav-group": "",
340
548
  "data-open": shown ? "true" : void 0,
341
- style: groupStyle,
549
+ "data-depth": String(depth),
550
+ class: [
551
+ "iris-nav-menu-group",
552
+ `iris-nav-menu-group--depth-${Math.min(9, depth)}`
553
+ ],
342
554
  ...horizontal ? {
343
555
  onMouseenter: () => setBranchInteraction(hoveredBranches, node.key, true),
344
556
  onMouseleave: () => setBranchInteraction(hoveredBranches, node.key, false),
@@ -357,22 +569,10 @@ var IrisNavMenu = defineComponent({
357
569
  h(
358
570
  "div",
359
571
  {
572
+ class: "iris-nav-menu-children",
360
573
  "data-iris-nav-children": "",
361
574
  role: "group",
362
- "aria-hidden": horizontal && !shown ? "true" : void 0,
363
- style: horizontal ? {
364
- display: shown ? "block" : "none",
365
- position: "absolute",
366
- insetBlockStart: depth === 0 ? "100%" : "0",
367
- insetInlineStart: depth === 0 ? "0" : "100%",
368
- zIndex: depth === 0 ? "60" : "61",
369
- minWidth: "220px",
370
- padding: "6px",
371
- border: "1px solid var(--iris-border)",
372
- borderRadius: "var(--iris-radius-md, 6px)",
373
- background: "var(--iris-surface)",
374
- boxShadow: "var(--iris-shadow-md)"
375
- } : void 0
575
+ "aria-hidden": horizontal && !shown ? "true" : void 0
376
576
  },
377
577
  (node.children ?? []).map((child) => renderItem(child, depth + 1))
378
578
  )
@@ -426,22 +626,22 @@ var IrisNavMenu = defineComponent({
426
626
  }
427
627
  }
428
628
  };
629
+ const menuClass = [
630
+ "iris-nav-menu",
631
+ `iris-nav-menu--${props.orientation}`,
632
+ props.collapsed ? "iris-nav-menu--collapsed" : "iris-nav-menu--expanded"
633
+ ];
429
634
  return () => h(
430
635
  "nav",
431
636
  {
432
637
  ...attrs,
638
+ class: [...menuClass, attrs.class],
433
639
  "data-iris-nav-menu": "",
434
640
  "data-collapsed": props.collapsed ? "true" : void 0,
435
641
  "data-orientation": props.orientation,
436
642
  "aria-label": props.ariaLabel ?? t("admin.nav"),
437
643
  onKeydown,
438
- style: {
439
- display: "flex",
440
- flexDirection: props.orientation === "horizontal" ? "row" : "column",
441
- alignItems: props.orientation === "horizontal" ? "center" : void 0,
442
- gap: "2px",
443
- ...attrs.style ?? {}
444
- }
644
+ style: attrs.style
445
645
  },
446
646
  props.collapsed ? renderCollapsed() : tree.value.map((node) => renderItem(node, 0))
447
647
  );
@@ -1593,5 +1793,5 @@ function useAdminPreferences(preferences, hydrate = true) {
1593
1793
  }
1594
1794
 
1595
1795
  export { DropdownContextKey, IrisAdminBreadcrumb, IrisAdminLayout, IrisAdminTabs, IrisBreadcrumb, IrisBreadcrumbItem, IrisDropdown, IrisDropdownItem, IrisDropdownMenu, IrisDropdownSeparator, IrisDropdownTrigger, IrisIcon, IrisNavMenu, useAdminPreferences, useAdminShell, useTabsNav };
1596
- //# sourceMappingURL=chunk-QC4D52TG.js.map
1597
- //# sourceMappingURL=chunk-QC4D52TG.js.map
1796
+ //# sourceMappingURL=chunk-KIEJL6C6.js.map
1797
+ //# sourceMappingURL=chunk-KIEJL6C6.js.map