vueless 0.0.654 → 0.0.656

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/constants.js CHANGED
@@ -21,9 +21,7 @@ export const DEFAULT_RING = 4; /* pixels */
21
21
  export const DEFAULT_RING_OFFSET = 0; /* pixels */
22
22
  export const DEFAULT_RING_OFFSET_COLOR_LIGHT = "#ffffff"; // white
23
23
  export const DEFAULT_RING_OFFSET_COLOR_DARK = "#111827"; // gray-900
24
- export const DEFAULT_ROUNDING_SM = 4; /* pixels */
25
24
  export const DEFAULT_ROUNDING = 8; /* pixels */
26
- export const DEFAULT_ROUNDING_LG = 16; /* pixels */
27
25
 
28
26
  /* Vueless supported colors and shades */
29
27
  export const COLOR_SHADES = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.654",
3
+ "version": "0.0.656",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -11,9 +11,7 @@ import {
11
11
  GRAY_COLOR,
12
12
  COOL_COLOR,
13
13
  DARK_MODE_SELECTOR,
14
- DEFAULT_ROUNDING_SM,
15
14
  DEFAULT_ROUNDING,
16
- DEFAULT_ROUNDING_LG,
17
15
  DEFAULT_RING,
18
16
  DEFAULT_RING_OFFSET,
19
17
  DEFAULT_RING_OFFSET_COLOR_LIGHT,
@@ -109,9 +107,9 @@ export const vuelessTailwindConfig = {
109
107
  "var(--vl-ring)": globalSettings.ring || DEFAULT_RING,
110
108
  "var(--vl-ring-offset)": globalSettings.ringOffset || DEFAULT_RING_OFFSET,
111
109
  "var(--vl-ring-offset-color)": globalSettings.ringOffsetColorLight || DEFAULT_RING_OFFSET_COLOR_LIGHT,
112
- "var(--vl-rounding-sm)": globalSettings.roundingSm || DEFAULT_ROUNDING_SM,
110
+ "var(--vl-rounding-sm)": globalSettings.roundingSm || (globalSettings.ring || DEFAULT_ROUNDING) / 2,
113
111
  "var(--vl-rounding)": globalSettings.ring || DEFAULT_ROUNDING,
114
- "var(--vl-rounding-lg)": globalSettings.roundingLg || DEFAULT_ROUNDING_LG,
112
+ "var(--vl-rounding-lg)": globalSettings.roundingLg || (globalSettings.ring || DEFAULT_ROUNDING) * 2,
115
113
  ...getReplacementColors(GRAY_COLOR, globalSettings.gray || DEFAULT_GRAY_COLOR),
116
114
  ...getReplacementColors(BRAND_COLOR, globalSettings.brand || DEFAULT_BRAND_COLOR),
117
115
  /* eslint-enable prettier/prettier */
@@ -3,6 +3,7 @@ import { computed, ref } from "vue";
3
3
 
4
4
  import useUI from "../composables/useUI.ts";
5
5
  import { getDefaults } from "../utils/ui.ts";
6
+ import { hasSlotContent } from "../utils/helper.ts";
6
7
 
7
8
  import defaultConfig from "./config.ts";
8
9
  import { COMPONENT_NAME, PLACEMENT } from "./constants.ts";
@@ -87,8 +88,14 @@ const { wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs } = useUI<Confi
87
88
  </div>
88
89
 
89
90
  <!-- `v-bind` isn't assigned, because the div is system -->
90
- <div v-if="label || error || description">
91
- <label v-if="label" :for="props.for" v-bind="labelAttrs" :data-test="`${dataTest}-label`">
91
+ <div v-if="label || hasSlotContent($slots['label']) || error || description">
92
+ <label
93
+ v-if="label || hasSlotContent($slots['label'])"
94
+ ref="labelRef"
95
+ :for="props.for"
96
+ v-bind="labelAttrs"
97
+ :data-test="`${dataTest}-label`"
98
+ >
92
99
  <!--
93
100
  @slot Use this to add custom content instead of the label.
94
101
  @binding {string} label
@@ -113,7 +120,13 @@ const { wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs } = useUI<Confi
113
120
  </div>
114
121
 
115
122
  <div v-else v-bind="wrapperAttrs">
116
- <label v-if="label" :for="props.for" v-bind="labelAttrs" :data-test="`${dataTest}-label`">
123
+ <label
124
+ v-if="label || hasSlotContent($slots['label'])"
125
+ v-bind="labelAttrs"
126
+ ref="labelRef"
127
+ :for="props.for"
128
+ :data-test="`${dataTest}-label`"
129
+ >
117
130
  <!--
118
131
  @slot Use this to add custom content instead of the label.
119
132
  @binding {string} label
@@ -61,7 +61,7 @@ const slots = useSlots();
61
61
  const elementId = props.id || useId();
62
62
 
63
63
  const textareaRef = ref<HTMLTextAreaElement | null>(null);
64
- const labelComponentRef = ref<{ labelElement: HTMLElement | null } | null>(null);
64
+ const labelComponentRef = ref<InstanceType<typeof ULabel> | null>(null);
65
65
  const leftSlotWrapperRef = ref<HTMLElement | null>(null);
66
66
  const wrapperRef = ref<HTMLElement | null>(null);
67
67
 
package/utils/theme.ts CHANGED
@@ -9,9 +9,7 @@ import {
9
9
  GRAYSCALE_COLOR,
10
10
  DEFAULT_RING,
11
11
  DEFAULT_RING_OFFSET,
12
- DEFAULT_ROUNDING_SM,
13
12
  DEFAULT_ROUNDING,
14
- DEFAULT_ROUNDING_LG,
15
13
  DEFAULT_BRAND_COLOR,
16
14
  DEFAULT_GRAY_COLOR,
17
15
  DEFAULT_RING_OFFSET_COLOR_LIGHT,
@@ -102,9 +100,9 @@ export function setColorMode(colorMode: `${ColorMode}`) {
102
100
  export function setTheme(config: Config = {}) {
103
101
  setColorMode(vuelessConfig?.colorMode || config?.colorMode || ColorMode.Light);
104
102
 
105
- const roundingSm = config?.roundingSm ?? vuelessConfig?.roundingSm ?? DEFAULT_ROUNDING_SM;
106
103
  const rounding = config?.rounding ?? vuelessConfig.rounding ?? DEFAULT_ROUNDING;
107
- const roundingLg = config?.roundingLg ?? vuelessConfig?.roundingLg ?? DEFAULT_ROUNDING_LG;
104
+ const roundingSm = config?.roundingSm ?? vuelessConfig?.roundingSm ?? rounding / 2;
105
+ const roundingLg = config?.roundingLg ?? vuelessConfig?.roundingLg ?? rounding * 2;
108
106
  const isDarkMode = document.documentElement.classList.contains(DARK_MODE_SELECTOR);
109
107
 
110
108
  let brand: BrandColors | GrayColors | typeof GRAY_COLOR =