@bjj/nuxt-layer-shadcn-ui 0.15.10 → 0.15.11

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,2 +1,3 @@
1
1
  @import './z-index.css';
2
- @import './overlay.css';
2
+ @import './overlay.css';
3
+ @import './menu-icon.css';
@@ -0,0 +1,40 @@
1
+ /* =========================================================================
2
+ * Menu row icons — foreground step
3
+ * -------------------------------------------------------------------------
4
+ * An icon inside a menu row is muted relative to the row's own label:
5
+ * label `--foreground`, icon `--foreground-muted` — the step the trailing
6
+ * icons already used.
7
+ *
8
+ * The vendored shadcn rows declare this themselves, but through a class name
9
+ * whose quoting survives neither Tailwind's scanner nor the DOM, so the rule
10
+ * never matches; those files are regenerated rather than edited, so the step
11
+ * is restored here instead.
12
+ *
13
+ * Unlayered CSS outranks the whole Tailwind utilities layer, which is what
14
+ * makes this win without `!important` — and also means no utility can
15
+ * override it: the only way out is the `:not()` guard below, or another
16
+ * unlayered rule.
17
+ *
18
+ * A row that carries a status color opts its icons back out, so they follow
19
+ * the label the way they do without any rule at all.
20
+ *
21
+ * Two consequences worth knowing before touching a menu row:
22
+ * - The rule takes over every svg in the row, including icons inside nested
23
+ * components that would otherwise inherit their own color. Such an icon
24
+ * needs an explicit `text-*` class to keep it.
25
+ * - `[class*='text-']` matches a substring, so `text-xs` and the like opt an
26
+ * icon out just as `text-primary` does.
27
+ * ========================================================================= */
28
+
29
+ [data-slot='dropdown-menu-item'] svg:not([class*='text-']),
30
+ [data-slot='dropdown-menu-checkbox-item'] svg:not([class*='text-']),
31
+ [data-slot='dropdown-menu-radio-item'] svg:not([class*='text-']),
32
+ [data-slot='dropdown-menu-sub-trigger'] svg:not([class*='text-']),
33
+ [data-slot='dropdown-menu-label'] svg:not([class*='text-']) {
34
+ color: var(--foreground-muted);
35
+ }
36
+
37
+ [data-slot='dropdown-menu-item'][data-status-color] svg:not([class*='text-']),
38
+ [data-slot='dropdown-menu-sub-trigger'][data-status-color] svg:not([class*='text-']) {
39
+ color: inherit;
40
+ }
@@ -14,6 +14,7 @@ import type {
14
14
  DropdownActionItem,
15
15
  DropdownCustomActionItem,
16
16
  DropdownItem,
17
+ DropdownItemColor,
17
18
  } from './types'
18
19
 
19
20
  const actionColorVariants = cva('', {
@@ -59,6 +60,11 @@ defineProps<{
59
60
  menus: DropdownItem[]
60
61
  }>()
61
62
 
63
+ // Marks rows the stylesheet must leave alone, so their icons keep following
64
+ // the label's status color instead of taking the muted step.
65
+ const statusColor = (color?: DropdownItemColor) =>
66
+ color && color !== 'default' ? color : undefined
67
+
62
68
  const ctx = inject(dropdownContextKey)
63
69
 
64
70
  const handleItemAction = (
@@ -102,6 +108,7 @@ const handleItemAction = (
102
108
  <DropdownMenuItem
103
109
  v-else-if="menu.type === 'custom-action'"
104
110
  :disabled="menu.disabled"
111
+ :data-status-color="statusColor(menu.color)"
105
112
  :class="cn(actionColorVariants({ color: menu.color }), menu.class)"
106
113
  @click="handleItemAction(menu, $event)"
107
114
  >
@@ -119,6 +126,7 @@ const handleItemAction = (
119
126
  <DropdownMenuSub v-else-if="menu.subMenus?.length">
120
127
  <DropdownMenuSubTrigger
121
128
  :disabled="menu.disabled"
129
+ :data-status-color="statusColor(menu.color)"
122
130
  :class="cn(actionColorVariants({ color: menu.color }), menu.class)"
123
131
  >
124
132
  <ItemContent :item="menu" />
@@ -137,6 +145,7 @@ const handleItemAction = (
137
145
  v-else
138
146
  :disabled="menu.disabled"
139
147
  :asChild="!!menu.href"
148
+ :data-status-color="statusColor(menu.color)"
140
149
  :class="cn(actionColorVariants({ color: menu.color }), menu.class)"
141
150
  @click="handleItemAction(menu, $event)"
142
151
  >
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bjj/nuxt-layer-shadcn-ui",
3
- "version": "0.15.10",
3
+ "version": "0.15.11",
4
4
  "description": "Nuxt layer providing shadcn-vue based UI components",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
@@ -42,5 +42,5 @@
42
42
  "vue-i18n": "^11",
43
43
  "vue-router": "^4 || ^5"
44
44
  },
45
- "gitHead": "39c9c2db384e58e3aa40c299e32bd75f0c2ec653"
45
+ "gitHead": "407e501d5ee2dcbde1afd91db36c51e994416e29"
46
46
  }