nuxt-ui-tools 1.20.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.
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.20.0",
8
+ "version": "1.20.1",
9
9
  "builder": {
10
10
  "@nuxt/module-builder": "1.0.3",
11
11
  "unbuild": "unknown"
@@ -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]",
@@ -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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-ui-tools",
3
- "version": "1.20.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",