@falcondev-oss/nuxt-layers-base 0.41.0 → 0.41.2

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.
@@ -20,6 +20,7 @@ import {
20
20
  UDashboardSidebarCollapse,
21
21
  UDashboardToolbar,
22
22
  UNavigationMenu,
23
+ USeparator,
23
24
  } from '#components'
24
25
  import { toolbarToolsKey } from '../../composables/useToolbar'
25
26
  import { mergeSlotClass } from '../../utils/ui'
@@ -41,6 +42,7 @@ export default defineSetupComponent(
41
42
  }
42
43
  tools?: {
43
44
  items?: NavigationMenuItem[]
45
+ left?: boolean
44
46
  ui?: NavigationMenuProps['ui']
45
47
  }
46
48
  toolbarUi?: DashboardToolbarProps['ui']
@@ -85,6 +87,10 @@ export default defineSetupComponent(
85
87
  ...providedTools.value.map((tool) => toValue(tool)),
86
88
  ])
87
89
 
90
+ const toolsMenu = () => (
91
+ <UNavigationMenu items={toolItems.value} highlight ui={props.tools?.ui} />
92
+ )
93
+
88
94
  const navbarUi = computed<DashboardNavbarProps['ui']>(() => ({
89
95
  ...props.navbar?.ui,
90
96
  toggle: mergeSlotClass(props.navbar?.ui?.toggle, '-ml-1'),
@@ -152,33 +158,29 @@ export default defineSetupComponent(
152
158
  ? [
153
159
  <UDashboardToolbar
154
160
  ui={props.toolbarUi}
155
- class="bg-white *:first:-ml-2"
161
+ class={['bg-white', (props.tabs || props.tools?.left) && '*:first:-ml-2']}
156
162
  v-slots={vSlots(UDashboardToolbar, {
157
- left: () => [
158
- props.tabs ? (
159
- <UNavigationMenu
160
- items={props.tabs.items}
161
- highlight
162
- variant="link"
163
- ui={props.tabs.ui}
164
- />
165
- ) : (
166
- <UNavigationMenu
167
- items={toolItems.value}
168
- highlight
169
- ui={props.tools?.ui}
170
- />
171
- ),
172
- ],
173
- ...(props.tabs && {
174
- right: () => [
175
- <UNavigationMenu
176
- items={toolItems.value}
177
- highlight
178
- ui={props.tools?.ui}
179
- />,
163
+ ...((props.tabs || props.tools?.left) && {
164
+ left: () => [
165
+ ...(props.tabs
166
+ ? [
167
+ <UNavigationMenu
168
+ items={props.tabs.items}
169
+ highlight
170
+ variant="link"
171
+ ui={props.tabs.ui}
172
+ />,
173
+ ]
174
+ : []),
175
+ ...(props.tabs && props.tools?.left && toolItems.value.length > 0
176
+ ? [<USeparator orientation="vertical" class="h-7" />]
177
+ : []),
178
+ ...(props.tools?.left ? [toolsMenu()] : []),
180
179
  ],
181
180
  }),
181
+ ...(!props.tools?.left && {
182
+ right: () => [toolsMenu()],
183
+ }),
182
184
  })}
183
185
  />,
184
186
  ]
@@ -43,7 +43,7 @@ export default defineSetupComponent(
43
43
  ...forwarded.value.ui,
44
44
  body: mergeSlotClass(forwarded.value.ui?.body, 'p-0!'),
45
45
  }}
46
- class="ring-accented relative shadow-[0_-2px_3px_-1px_rgb(0_0_0/0.08)]"
46
+ class="relative shadow-[0_-2px_3px_-1px_rgb(0_0_0/0.08)]"
47
47
  v-slots={vSlots(UCard, omit(slots, ['ribbon']))}
48
48
  />
49
49
  ) : null}
@@ -0,0 +1,46 @@
1
+ import { Icon, UButton } from '#components'
2
+
3
+ export default defineSetupComponent(
4
+ (_: {
5
+ props: {
6
+ modelValue: boolean
7
+ label: string
8
+ icon: string
9
+ }
10
+ emits: { 'update:modelValue': (value: boolean) => void }
11
+ }) =>
12
+ options(_, {
13
+ name: 'UToggleButton',
14
+ props: ['modelValue', 'label', 'icon'],
15
+ emits: ['update:modelValue'],
16
+ setup:
17
+ (props, { emit }) =>
18
+ () => (
19
+ <UButton
20
+ color="neutral"
21
+ variant="soft"
22
+ class={['ring-accented px-1.5! ring', props.modelValue && 'bg-accented']}
23
+ aria-pressed={props.modelValue}
24
+ onClick={() => {
25
+ emit('update:modelValue', !props.modelValue)
26
+ }}
27
+ >
28
+ {{
29
+ leading: () => (
30
+ <span
31
+ class={[
32
+ 'flex size-5 items-center justify-center rounded-sm transition-colors',
33
+ props.modelValue
34
+ ? 'bg-primary text-inverted'
35
+ : 'ring-accented text-muted ring inset-ring-0',
36
+ ]}
37
+ >
38
+ <Icon name={props.icon} class="size-4" />
39
+ </span>
40
+ ),
41
+ default: () => props.label,
42
+ }}
43
+ </UButton>
44
+ ),
45
+ }),
46
+ )
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@falcondev-oss/nuxt-layers-base",
3
3
  "type": "module",
4
- "version": "0.41.0",
4
+ "version": "0.41.2",
5
5
  "description": "Nuxt layer with lots of useful helpers and @nuxt/ui components",
6
6
  "license": "MIT",
7
7
  "repository": {