nuxt-ui-tools 1.19.0 → 1.20.1

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 (23) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/form/components/page/form-page-section.vue +14 -0
  3. package/dist/runtime/form/fields/auto-complete/component.vue +2 -0
  4. package/dist/runtime/form/fields/select/component.vue +5 -0
  5. package/dist/runtime/form/types/page.d.ts +7 -0
  6. package/dist/runtime/form/types/ui.d.ts +2 -0
  7. package/dist/runtime/form/utils/options.d.ts +6 -0
  8. package/dist/runtime/form/utils/options.js +7 -0
  9. package/dist/runtime/form/utils/page.js +1 -0
  10. package/dist/runtime/spreadsheet/components/internal/spreadsheet-import-column-row.d.vue.ts +2 -2
  11. package/dist/runtime/spreadsheet/components/internal/spreadsheet-import-column-row.vue.d.ts +2 -2
  12. package/dist/runtime/table/components/filters/tags/boolean-filter-tag.d.vue.ts +2 -2
  13. package/dist/runtime/table/components/filters/tags/boolean-filter-tag.vue.d.ts +2 -2
  14. package/dist/runtime/table/components/filters/tags/date-filter-tag.d.vue.ts +2 -2
  15. package/dist/runtime/table/components/filters/tags/date-filter-tag.vue.d.ts +2 -2
  16. package/dist/runtime/table/components/filters/tags/number-filter-tag.d.vue.ts +2 -2
  17. package/dist/runtime/table/components/filters/tags/number-filter-tag.vue.d.ts +2 -2
  18. package/dist/runtime/table/components/filters/tags/option-filter-tag.d.vue.ts +2 -2
  19. package/dist/runtime/table/components/filters/tags/option-filter-tag.vue.d.ts +2 -2
  20. package/dist/runtime/table/components/filters/tags/text-filter-tag.d.vue.ts +2 -2
  21. package/dist/runtime/table/components/filters/tags/text-filter-tag.vue.d.ts +2 -2
  22. package/dist/runtime/table/utils/data-list-ui.d.ts +1 -1
  23. package/package.json +1 -1
package/dist/module.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "configKey": "nuxtUiTools",
6
6
  "docs": "https://ui.nuxt.com/docs/getting-started/installation/nuxt",
7
7
  "name": "nuxt-ui-tools",
8
- "version": "1.19.0",
8
+ "version": "1.20.1",
9
9
  "builder": {
10
10
  "@nuxt/module-builder": "1.0.3",
11
11
  "unbuild": "unknown"
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
2
  import UBadge from "@nuxt/ui/components/Badge.vue";
3
3
  import UButton from "@nuxt/ui/components/Button.vue";
4
+ import UIcon from "@nuxt/ui/components/Icon.vue";
4
5
  import { computed, onBeforeUnmount, onMounted, useId, useTemplateRef } from "vue";
5
6
  import { useUiToolsLocale } from "../../../i18n/use-locale";
6
7
  import { useFormGridLayout } from "../../composables/use-form-layout";
@@ -60,6 +61,19 @@ onBeforeUnmount(() => unregister?.());
60
61
  mergeFormUiClass('flex flex-wrap items-center gap-x-3 gap-y-1', pageUi?.sectionHeader)
61
62
  "
62
63
  >
64
+ <span
65
+ v-if="section.icon"
66
+ :class="
67
+ mergeFormUiClass(
68
+ 'grid size-8 shrink-0 place-items-center rounded-lg bg-elevated text-muted',
69
+ pageUi?.sectionIcon
70
+ )
71
+ "
72
+ aria-hidden="true"
73
+ data-form-page-section-icon
74
+ >
75
+ <UIcon :name="section.icon" class="size-4" />
76
+ </span>
63
77
  <h2
64
78
  :id="titleId"
65
79
  tabindex="-1"
@@ -10,6 +10,7 @@ import FormOptionSuffix from "../../components/utils/form-option-suffix.vue";
10
10
  import FormOptionValueOverlay from "../../components/utils/form-option-value-overlay.vue";
11
11
  import { useFieldControl } from "../../composables/use-field-control";
12
12
  import { useOptionMenu } from "../../composables/use-option-menu";
13
+ import { leadingVisualPadding } from "../../utils/options";
13
14
  import { isBoolean, isNumber, isString } from "../../utils/predicate";
14
15
  import { mergeFormUiClass } from "../../utils/ui";
15
16
  const props = defineProps({
@@ -61,6 +62,7 @@ const controlUi = computed(() => ({
61
62
  ...controlProps.value.ui,
62
63
  base: mergeFormUiClass(
63
64
  controlProps.value.ui?.base,
65
+ menu.leadingOption.value ? leadingVisualPadding(controlProps.value.size) : void 0,
64
66
  overlayActive.value ? "text-transparent" : void 0
65
67
  ),
66
68
  content: mergeFormUiClass(controlProps.value.ui?.content, interactionOwnerClass.value),
@@ -11,6 +11,7 @@ import FormOptionMenuFooter from "../../components/utils/form-option-menu-footer
11
11
  import FormOptionSuffix from "../../components/utils/form-option-suffix.vue";
12
12
  import { useFieldControl } from "../../composables/use-field-control";
13
13
  import { useOptionMenu } from "../../composables/use-option-menu";
14
+ import { leadingVisualPadding } from "../../utils/options";
14
15
  import { isBoolean, isNumber, isString } from "../../utils/predicate";
15
16
  import { mergeFormUiClass } from "../../utils/ui";
16
17
  const props = defineProps({
@@ -65,6 +66,10 @@ const menu = useOptionMenu({
65
66
  });
66
67
  const controlUi = computed(() => ({
67
68
  ...controlProps.value.ui,
69
+ base: mergeFormUiClass(
70
+ controlProps.value.ui?.base,
71
+ menu.leadingOption.value ? leadingVisualPadding(controlProps.value.size) : void 0
72
+ ),
68
73
  content: mergeFormUiClass(controlProps.value.ui?.content, interactionOwnerClass.value),
69
74
  itemDescription: mergeFormUiClass(
70
75
  menu.renderOption.value ? "hidden" : "text-[12.5px]",
@@ -40,6 +40,11 @@ export interface FormPageSection<TContext = NonNullable<unknown>, TFields extend
40
40
  label: FormText;
41
41
  /** Supporting copy next to the title. */
42
42
  description?: FormText;
43
+ /**
44
+ * Iconify icon drawn before the title, so each section of a long page reads at a glance
45
+ * (`'i-lucide-map-pin'` for an address). Style it with `ui.page.ui.sectionIcon`.
46
+ */
47
+ icon?: string;
43
48
  /**
44
49
  * Marks the section optional while nothing is entered in it, and leaves it out of the sections
45
50
  * left to complete. A section without a required field is optional already; set this when its
@@ -172,6 +177,8 @@ export interface FormPageSectionState {
172
177
  label: string;
173
178
  /** Resolved supporting copy. */
174
179
  description?: string;
180
+ /** Icon drawn before the title. */
181
+ icon?: string;
175
182
  /**
176
183
  * True when the section is declared optional, or declares nothing and has no required field
177
184
  * outside array items.
@@ -268,6 +268,8 @@ export interface FormPageUi {
268
268
  sectionSkeleton?: FormUiClass;
269
269
  section?: FormUiClass;
270
270
  sectionHeader?: FormUiClass;
271
+ /** Tile around the section `icon`, before the title. */
272
+ sectionIcon?: FormUiClass;
271
273
  sectionTitle?: FormUiClass;
272
274
  sectionDescription?: FormUiClass;
273
275
  /** The "Optional" badge of an optional section with nothing entered. */
@@ -12,6 +12,12 @@ export interface FormOptionKeys {
12
12
  export type { ResolvedFormOption } from '../types/index.js';
13
13
  /** The one visual an option draws before its label: its icon, else its avatar, else its chip. */
14
14
  export type OptionLeading = 'icon' | 'avatar' | 'chip';
15
+ /**
16
+ * Start padding of a select or auto-complete that draws the chosen option's visual in its leading
17
+ * slot. Nuxt UI decides that padding from the slot once, so a visual that appears after mount (a
18
+ * value picked later) would otherwise draw over the text.
19
+ */
20
+ export declare function leadingVisualPadding(size: unknown): "ps-10" | "ps-9" | "ps-8" | "ps-11" | "ps-7";
15
21
  export declare function resolveOptionLeading(option: ResolvedFormOption): OptionLeading | undefined;
16
22
  export declare function resolveOptionDescriptionIndent(option: ResolvedFormOption): string | undefined;
17
23
  export declare function normalizeOptionItem(option: FormValue, keys?: FormOptionKeys): ResolvedFormOption;
@@ -12,6 +12,13 @@ const CHIP_COLORS = [
12
12
  "error",
13
13
  "neutral"
14
14
  ];
15
+ const LEADING_PADDING = { lg: "ps-10", md: "ps-9", sm: "ps-8", xl: "ps-11", xs: "ps-7" };
16
+ export function leadingVisualPadding(size) {
17
+ return LEADING_PADDING[isLeadingSize(size) ? size : "md"];
18
+ }
19
+ function isLeadingSize(size) {
20
+ return isString(size) && Object.hasOwn(LEADING_PADDING, size);
21
+ }
15
22
  export function resolveOptionLeading(option) {
16
23
  if (option.icon) return "icon";
17
24
  if (option.avatar) return "avatar";
@@ -69,6 +69,7 @@ export function resolveFormPageSectionState(params) {
69
69
  return {
70
70
  description: resolveFormText(entry.section.description),
71
71
  dirty: dirtyPaths.length > 0,
72
+ icon: entry.section.icon,
72
73
  dirtyPaths,
73
74
  index: params.index,
74
75
  key: entry.section.key,
@@ -6,12 +6,12 @@ type __VLS_Props = {
6
6
  };
7
7
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
8
  reset: () => any;
9
- ignore: () => any;
10
9
  assign: (header: number) => any;
10
+ ignore: () => any;
11
11
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
12
  onReset?: (() => any) | undefined;
13
- onIgnore?: (() => any) | undefined;
14
13
  onAssign?: ((header: number) => any) | undefined;
14
+ onIgnore?: (() => any) | undefined;
15
15
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
16
  declare const _default: typeof __VLS_export;
17
17
  export default _default;
@@ -6,12 +6,12 @@ type __VLS_Props = {
6
6
  };
7
7
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
8
  reset: () => any;
9
- ignore: () => any;
10
9
  assign: (header: number) => any;
10
+ ignore: () => any;
11
11
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
12
  onReset?: (() => any) | undefined;
13
- onIgnore?: (() => any) | undefined;
14
13
  onAssign?: ((header: number) => any) | undefined;
14
+ onIgnore?: (() => any) | undefined;
15
15
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
16
  declare const _default: typeof __VLS_export;
17
17
  export default _default;
@@ -27,12 +27,12 @@ type __VLS_Slots = {} & {
27
27
  trigger?: (props: typeof __VLS_10) => any;
28
28
  };
29
29
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
30
- dismiss: () => any;
31
30
  back: () => any;
31
+ dismiss: () => any;
32
32
  sessionClosed: () => any;
33
33
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
34
- onDismiss?: (() => any) | undefined;
35
34
  onBack?: (() => any) | undefined;
35
+ onDismiss?: (() => any) | undefined;
36
36
  onSessionClosed?: (() => any) | undefined;
37
37
  }>, {
38
38
  header: boolean;
@@ -27,12 +27,12 @@ type __VLS_Slots = {} & {
27
27
  trigger?: (props: typeof __VLS_10) => any;
28
28
  };
29
29
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
30
- dismiss: () => any;
31
30
  back: () => any;
31
+ dismiss: () => any;
32
32
  sessionClosed: () => any;
33
33
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
34
- onDismiss?: (() => any) | undefined;
35
34
  onBack?: (() => any) | undefined;
35
+ onDismiss?: (() => any) | undefined;
36
36
  onSessionClosed?: (() => any) | undefined;
37
37
  }>, {
38
38
  header: boolean;
@@ -29,12 +29,12 @@ type __VLS_Slots = {} & {
29
29
  trigger?: (props: typeof __VLS_10) => any;
30
30
  };
31
31
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
32
- dismiss: () => any;
33
32
  back: () => any;
33
+ dismiss: () => any;
34
34
  sessionClosed: () => any;
35
35
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
36
- onDismiss?: (() => any) | undefined;
37
36
  onBack?: (() => any) | undefined;
37
+ onDismiss?: (() => any) | undefined;
38
38
  onSessionClosed?: (() => any) | undefined;
39
39
  }>, {
40
40
  header: boolean;
@@ -29,12 +29,12 @@ type __VLS_Slots = {} & {
29
29
  trigger?: (props: typeof __VLS_10) => any;
30
30
  };
31
31
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
32
- dismiss: () => any;
33
32
  back: () => any;
33
+ dismiss: () => any;
34
34
  sessionClosed: () => any;
35
35
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
36
- onDismiss?: (() => any) | undefined;
37
36
  onBack?: (() => any) | undefined;
37
+ onDismiss?: (() => any) | undefined;
38
38
  onSessionClosed?: (() => any) | undefined;
39
39
  }>, {
40
40
  header: boolean;
@@ -28,12 +28,12 @@ type __VLS_Slots = {} & {
28
28
  trigger?: (props: typeof __VLS_10) => any;
29
29
  };
30
30
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
31
- dismiss: () => any;
32
31
  back: () => any;
32
+ dismiss: () => any;
33
33
  sessionClosed: () => any;
34
34
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
35
- onDismiss?: (() => any) | undefined;
36
35
  onBack?: (() => any) | undefined;
36
+ onDismiss?: (() => any) | undefined;
37
37
  onSessionClosed?: (() => any) | undefined;
38
38
  }>, {
39
39
  header: boolean;
@@ -28,12 +28,12 @@ type __VLS_Slots = {} & {
28
28
  trigger?: (props: typeof __VLS_10) => any;
29
29
  };
30
30
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
31
- dismiss: () => any;
32
31
  back: () => any;
32
+ dismiss: () => any;
33
33
  sessionClosed: () => any;
34
34
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
35
- onDismiss?: (() => any) | undefined;
36
35
  onBack?: (() => any) | undefined;
36
+ onDismiss?: (() => any) | undefined;
37
37
  onSessionClosed?: (() => any) | undefined;
38
38
  }>, {
39
39
  header: boolean;
@@ -28,12 +28,12 @@ type __VLS_Slots = {} & {
28
28
  trigger?: (props: typeof __VLS_10) => any;
29
29
  };
30
30
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
31
- dismiss: () => any;
32
31
  back: () => any;
32
+ dismiss: () => any;
33
33
  sessionClosed: () => any;
34
34
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
35
- onDismiss?: (() => any) | undefined;
36
35
  onBack?: (() => any) | undefined;
36
+ onDismiss?: (() => any) | undefined;
37
37
  onSessionClosed?: (() => any) | undefined;
38
38
  }>, {
39
39
  header: boolean;
@@ -28,12 +28,12 @@ type __VLS_Slots = {} & {
28
28
  trigger?: (props: typeof __VLS_10) => any;
29
29
  };
30
30
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
31
- dismiss: () => any;
32
31
  back: () => any;
32
+ dismiss: () => any;
33
33
  sessionClosed: () => any;
34
34
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
35
- onDismiss?: (() => any) | undefined;
36
35
  onBack?: (() => any) | undefined;
36
+ onDismiss?: (() => any) | undefined;
37
37
  onSessionClosed?: (() => any) | undefined;
38
38
  }>, {
39
39
  header: boolean;
@@ -28,12 +28,12 @@ type __VLS_Slots = {} & {
28
28
  trigger?: (props: typeof __VLS_10) => any;
29
29
  };
30
30
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
31
- dismiss: () => any;
32
31
  back: () => any;
32
+ dismiss: () => any;
33
33
  sessionClosed: () => any;
34
34
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
35
- onDismiss?: (() => any) | undefined;
36
35
  onBack?: (() => any) | undefined;
36
+ onDismiss?: (() => any) | undefined;
37
37
  onSessionClosed?: (() => any) | undefined;
38
38
  }>, {
39
39
  header: boolean;
@@ -28,12 +28,12 @@ type __VLS_Slots = {} & {
28
28
  trigger?: (props: typeof __VLS_10) => any;
29
29
  };
30
30
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
31
- dismiss: () => any;
32
31
  back: () => any;
32
+ dismiss: () => any;
33
33
  sessionClosed: () => any;
34
34
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
35
- onDismiss?: (() => any) | undefined;
36
35
  onBack?: (() => any) | undefined;
36
+ onDismiss?: (() => any) | undefined;
37
37
  onSessionClosed?: (() => any) | undefined;
38
38
  }>, {
39
39
  header: boolean;
@@ -122,6 +122,6 @@ export declare function resolveDataListTableDensity(density: DataListDensity): {
122
122
  export declare function resolveDataListContentShellClass(options: {
123
123
  layout: 'table' | 'grid';
124
124
  surface: DataListContentSurface;
125
- }): "overflow-hidden" | "grid gap-5 overflow-hidden rounded-md border border-default bg-default" | "grid gap-5" | "overflow-hidden rounded-md border border-default bg-default";
125
+ }): "grid gap-5" | "overflow-hidden" | "grid gap-5 overflow-hidden rounded-md border border-default bg-default" | "overflow-hidden rounded-md border border-default bg-default";
126
126
  /** Merges application and root DataList defaults without losing nested UI slots. */
127
127
  export declare function mergeDataListUiConfig(appUi: DataListUiConfig | undefined, componentUi: DataListUiConfig | undefined, density?: DataListDensity, size?: DataListControlSize): DataListUiConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-ui-tools",
3
- "version": "1.19.0",
3
+ "version": "1.20.1",
4
4
  "description": "Nuxt module and runtime toolkit for UI-heavy Nuxt applications",
5
5
  "homepage": "https://github.com/ChronicStone/nuxt-ui-tools#readme",
6
6
  "bugs": "https://github.com/ChronicStone/nuxt-ui-tools/issues",