vueless 0.0.825-beta.113 → 0.0.825-beta.115

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/bin/constants.js CHANGED
@@ -12,6 +12,7 @@ export default {
12
12
  rounding: 8,
13
13
  unstyled: false,
14
14
  colorMode: "auto",
15
+ disabledOpacity: 50,
15
16
 
16
17
  /**
17
18
  * Light theme CSS variable settings.
package/constants.js CHANGED
@@ -33,6 +33,7 @@ export const OUTLINE_INCREMENT = 1; /* pixels */
33
33
  export const DEFAULT_ROUNDING = 8; /* pixels */
34
34
  export const ROUNDING_DECREMENT = 4; /* pixels */
35
35
  export const ROUNDING_INCREMENT = 6; /* pixels */
36
+ export const DEFAULT_DISABLED_OPACITY = 50; /* presents */
36
37
 
37
38
  /* Vueless supported color shades */
38
39
  export const PRIMARY_COLORS = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.825-beta.113",
3
+ "version": "0.0.825-beta.115",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
package/tailwind.css CHANGED
@@ -24,6 +24,10 @@
24
24
  body {
25
25
  @apply antialiased text-(--vl-text) bg-(--vl-bg) scheme-light dark:scheme-dark;
26
26
  }
27
+
28
+ [type='checkbox']:checked {
29
+ @apply !bg-none;
30
+ }
27
31
  }
28
32
 
29
33
  /* ------ Tailwind theme settings ------ */
package/types.ts CHANGED
@@ -131,6 +131,11 @@ export interface ThemeConfig {
131
131
  */
132
132
  outlineLg?: number;
133
133
 
134
+ /**
135
+ * Default components opacity for disabled state (in percents).
136
+ */
137
+ disabledOpacity?: number;
138
+
134
139
  /**
135
140
  * Default color mode.
136
141
  */
@@ -20,31 +20,31 @@ export default /*tw*/ {
20
20
  text-inverted bg-{color}
21
21
  hover:bg-{color}-lifted
22
22
  active:bg-{color}-accented
23
- disabled:!bg-{color}/75
23
+ disabled:!text-inverted/(--vl-disabled-opacity) disabled:!bg-{color}/(--vl-disabled-opacity)
24
24
  `,
25
25
  outlined: `
26
26
  text-{color} border-{color}
27
27
  hover:text-{color}-lifted hover:border-{color}-lifted hover:bg-{color}-lifted/10
28
28
  active:text-{color}-accented active:border-{color}-accented active:bg-{color}-accented/15
29
- disabled:!text-{color}/75 disabled:!bg-{color}/5 disabled:!border-{color}/75
29
+ disabled:!text-{color}/(--vl-disabled-opacity) disabled:!bg-{color}/5 disabled:!border-{color}/(--vl-disabled-opacity)
30
30
  `,
31
31
  subtle: `
32
32
  text-{color} bg-{color}/5 border-{color}/15
33
33
  hover:text-{color}-lifted hover:bg-{color}-lifted/10
34
34
  active:text-{color}-accented active:bg-{color}-accented/15
35
- disabled:!text-{color}/75 disabled:!bg-{color}/5 disabled:!border-{color}/10
35
+ disabled:!text-{color}/(--vl-disabled-opacity) disabled:!bg-{color}/5 disabled:!border-{color}/10
36
36
  `,
37
37
  soft: `
38
38
  text-{color} bg-{color}/5
39
39
  hover:text-{color}-lifted hover:bg-{color}-lifted/10
40
40
  active:text-{color}-accented active:bg-{color}-accented/15
41
- disabled:!text-{color}/75 disabled:!bg-{color}/5
41
+ disabled:!text-{color}/(--vl-disabled-opacity) disabled:!bg-{color}/5
42
42
  `,
43
43
  ghost: `
44
44
  text-{color}
45
45
  hover:text-{color}-lifted hover:bg-{color}-lifted/10
46
46
  active:text-{color}-accented active:bg-{color}-accented/15
47
- disabled:!text-{color}/75 disabled:!bg-transparent
47
+ disabled:!text-{color}/(--vl-disabled-opacity) disabled:!bg-transparent
48
48
  `,
49
49
  },
50
50
  round: {
@@ -29,7 +29,7 @@ export default /*tw*/ {
29
29
  true: "decoration-dotted hover:decoration-dotted",
30
30
  },
31
31
  disabled: {
32
- true: "!text-{color}/75 !no-underline cursor-not-allowed",
32
+ true: "!text-{color}/(--vl-disabled-opacity) !no-underline cursor-not-allowed",
33
33
  },
34
34
  block: {
35
35
  true: "w-full",
@@ -24,7 +24,7 @@ export default {
24
24
  title: "Buttons & Links / Link",
25
25
  component: ULink,
26
26
  args: {
27
- label: "Learn more",
27
+ label: "View in GitHub",
28
28
  },
29
29
  argTypes: {
30
30
  ...getArgTypes(ULink.__name),
@@ -64,7 +64,7 @@ export const Default = DefaultTemplate.bind({});
64
64
  Default.args = {};
65
65
 
66
66
  export const Sizes = EnumVariantTemplate.bind({});
67
- Sizes.args = { enum: "size", label: "{enumValue}" };
67
+ Sizes.args = { enum: "size" };
68
68
 
69
69
  export const Colors = EnumVariantTemplate.bind({});
70
70
  Colors.args = { enum: "color", label: "{enumValue}" };
@@ -145,7 +145,7 @@ export const DefaultSlot = DefaultTemplate.bind({});
145
145
  DefaultSlot.args = {
146
146
  slotTemplate: `
147
147
  <template #default>
148
- <UButton label="Learn more" />
148
+ <UButton label="View on GitHub" />
149
149
  </template>
150
150
  `,
151
151
  };
@@ -132,8 +132,6 @@ function toggleOverflow() {
132
132
 
133
133
  if (element) {
134
134
  element.style.overflow = "hidden";
135
-
136
- return;
137
135
  }
138
136
 
139
137
  document.body.style.overflow = "auto";
@@ -10,7 +10,7 @@ export default /*tw*/ {
10
10
  focus:ring-0 focus:ring-offset-0
11
11
  focus-visible:outline-{color} focus-visible:outline-medium focus-visible:outline-offset-2 focus-visible:transition
12
12
  disabled:border-default disabled:bg-lifted disabled:cursor-not-allowed
13
- disabled:checked:bg-{color}/75 disabled:checked:border-transparent
13
+ disabled:checked:bg-{color}/(--vl-disabled-opacity) disabled:checked:border-transparent
14
14
  `,
15
15
  variants: {
16
16
  size: {
@@ -35,7 +35,7 @@ export default /*tw*/ {
35
35
  lg: "size-6",
36
36
  },
37
37
  disabled: {
38
- true: "!bg-{color}/75 cursor-not-allowed",
38
+ true: "!bg-{color}/(--vl-disabled-opacity) cursor-not-allowed",
39
39
  },
40
40
  },
41
41
  },
@@ -25,7 +25,7 @@ export default {
25
25
  modelValue: "",
26
26
  colors: /*tw*/ {
27
27
  grayscale: "bg-grayscale",
28
- neutral: "bg-neutral",
28
+ neutral: "bg-neutral-600",
29
29
  red: "bg-red-600",
30
30
  orange: "bg-orange-600",
31
31
  amber: "bg-amber-600",
@@ -9,7 +9,7 @@ export default /*tw*/ {
9
9
  listItem: "group/item block mb-px last:mb-0",
10
10
  option: {
11
11
  base: `
12
- rounded-small px-2 py-2 flex items-center align-middle whitespace-nowrap cursor-pointer
12
+ rounded-small px-2 py-2 flex gap-2 items-center align-middle whitespace-nowrap cursor-pointer
13
13
  font-normal !leading-snug
14
14
  hover:bg-{color}/5 active:bg-{color}/10
15
15
  overflow-hidden text-ellipsis text-default
@@ -11,7 +11,7 @@ export default /*tw*/ {
11
11
  focus:ring-0 focus:ring-offset-0
12
12
  focus-visible:outline-{color} focus-visible:outline-medium focus-visible:outline-offset-2 focus-visible:transition
13
13
  disabled:border-default disabled:bg-lifted disabled:cursor-not-allowed
14
- disabled:checked:bg-{color}/75 disabled:checked:border-transparent
14
+ disabled:checked:bg-{color}/(--vl-disabled-opacity) disabled:checked:border-transparent
15
15
 
16
16
  `,
17
17
  variants: {
@@ -49,7 +49,7 @@ const switchLabel = computed(() => {
49
49
  });
50
50
 
51
51
  const iconColor = computed(() => {
52
- return checkedValue.value ? props.color : "grayscale";
52
+ return checkedValue.value ? props.color : "inherit";
53
53
  });
54
54
 
55
55
  const toggleIconName = computed(() => {
@@ -17,7 +17,7 @@ export default /*tw*/ {
17
17
  },
18
18
  checked: {
19
19
  true: "bg-{color} hover:bg-{color}-lifted active:bg-{color}-accented",
20
- false: "bg-neutral/25 hover:bg-neutral/50 active:bg-neutral/75",
20
+ false: "bg-accented",
21
21
  },
22
22
  disabled: {
23
23
  true: "pointer-events-none",
@@ -27,8 +27,8 @@ export default /*tw*/ {
27
27
  { toggleLabel: true, size: "sm", class: "w-10" },
28
28
  { toggleLabel: true, size: "md", class: "w-12" },
29
29
  { toggleLabel: true, size: "lg", class: "w-14" },
30
- { disabled: true, checked: false, class: "bg-neutral/50" },
31
- { disabled: true, checked: true, class: "bg-{color}/50" },
30
+ { disabled: true, checked: false, class: "bg-accented/(--vl-disabled-opacity)" },
31
+ { disabled: true, checked: true, class: "bg-{color}/(--vl-disabled-opacity)" },
32
32
  ],
33
33
  },
34
34
  input: "sr-only",
@@ -51,9 +51,9 @@ export default /*tw*/ {
51
51
  base: "{UIcon}",
52
52
  defaults: {
53
53
  size: {
54
- sm: "2xs",
55
- md: "xs",
56
- lg: "sm",
54
+ sm: "3xs",
55
+ md: "2xs",
56
+ lg: "xs",
57
57
  },
58
58
  },
59
59
  },
@@ -70,7 +70,7 @@ export default /*tw*/ {
70
70
  {
71
71
  toggleLabel: false,
72
72
  checked: false,
73
- class: "bg-neutral/25 hover:bg-neutral/50 active:bg-neutral/75",
73
+ class: "bg-accented",
74
74
  },
75
75
  ],
76
76
  },
@@ -28,7 +28,7 @@ export default /*tw*/ {
28
28
  true: "cursor-pointer hover:text-{color}-lifted active:text-{color}-accented",
29
29
  },
30
30
  disabled: {
31
- true: "text-{color}/75 cursor-not-allowed",
31
+ true: "text-{color}/(--vl-disabled-opacity) cursor-not-allowed",
32
32
  },
33
33
  },
34
34
  },
@@ -11,7 +11,7 @@ export default /*tw*/ {
11
11
  },
12
12
  },
13
13
  emptyIconWrapper: {
14
- base: "rounded-full bg-neutral-accented/5",
14
+ base: "rounded-full bg-inverted/5",
15
15
  variants: {
16
16
  size: {
17
17
  sm: "p-4",
package/utils/theme.ts CHANGED
@@ -31,6 +31,7 @@ import {
31
31
  DEFAULT_TEXT,
32
32
  TEXT_INCREMENT,
33
33
  TEXT_DECREMENT,
34
+ DEFAULT_DISABLED_OPACITY,
34
35
  } from "../constants.js";
35
36
  import type { Config, NeutralColors, PrimaryColors, VuelessCssVariables } from "../types.ts";
36
37
  import { ColorMode } from "../types.ts";
@@ -48,6 +49,7 @@ declare interface RootCSSVariableOptions {
48
49
  textSm: number;
49
50
  text: number;
50
51
  textLg: number;
52
+ disabledOpacity: number;
51
53
  lightTheme: Partial<VuelessCssVariables>;
52
54
  darkTheme: Partial<VuelessCssVariables>;
53
55
  }
@@ -148,6 +150,10 @@ export function setTheme(config: Config = {}, isCachedAutoMode?: boolean) {
148
150
  // eslint-disable-next-line vue/max-len, prettier/prettier
149
151
  setColorMode((config.colorMode || cachedColorMode || vuelessConfig.colorMode || ColorMode.Light) as ColorMode, isCachedAutoMode);
150
152
 
153
+ const disabledOpacity = getDisabledOpacity(
154
+ config.disabledOpacity ?? vuelessConfig.disabledOpacity,
155
+ );
156
+
151
157
  const { roundingSm, rounding, roundingLg } = getRoundings(
152
158
  config.roundingSm ?? vuelessConfig.roundingSm,
153
159
  config.rounding ?? cachedRounding ?? vuelessConfig.rounding,
@@ -246,6 +252,7 @@ export function setTheme(config: Config = {}, isCachedAutoMode?: boolean) {
246
252
  textSm,
247
253
  text,
248
254
  textLg,
255
+ disabledOpacity,
249
256
  lightTheme,
250
257
  darkTheme,
251
258
  });
@@ -317,6 +324,14 @@ function getRoundings(sm?: string | number, md?: string | number, lg?: string |
317
324
  };
318
325
  }
319
326
 
327
+ /**
328
+ * Retrieve disabled opacity value.
329
+ * @return number - opacity value.
330
+ */
331
+ function getDisabledOpacity(opacity?: number) {
332
+ return Math.max(0, opacity ?? DEFAULT_DISABLED_OPACITY);
333
+ }
334
+
320
335
  /**
321
336
  * Generate and apply Vueless CSS variables.
322
337
  * @return string - Vueless CSS variables string.
@@ -335,6 +350,7 @@ function setRootCSSVariables(options: RootCSSVariableOptions) {
335
350
  textSm,
336
351
  text,
337
352
  textLg,
353
+ disabledOpacity,
338
354
  lightTheme,
339
355
  darkTheme,
340
356
  } = options;
@@ -342,16 +358,17 @@ function setRootCSSVariables(options: RootCSSVariableOptions) {
342
358
  let darkVariables: Partial<VuelessCssVariables> = {};
343
359
 
344
360
  let variables: Partial<VuelessCssVariables> = {
345
- "--vl-rounding-sm": `${Number(roundingSm) / PX_IN_REM}rem`,
346
- "--vl-rounding-md": `${Number(rounding) / PX_IN_REM}rem`,
347
- "--vl-rounding-lg": `${Number(roundingLg) / PX_IN_REM}rem`,
361
+ "--vl-rounding-sm": `${roundingSm / PX_IN_REM}rem`,
362
+ "--vl-rounding-md": `${rounding / PX_IN_REM}rem`,
363
+ "--vl-rounding-lg": `${roundingLg / PX_IN_REM}rem`,
348
364
  "--vl-outline-sm": `${outlineSm}px`,
349
365
  "--vl-outline-md": `${outline}px`,
350
366
  "--vl-outline-lg": `${outlineLg}px`,
351
- "--vl-text-xs": `${Number(textXs) / PX_IN_REM}rem`,
352
- "--vl-text-sm": `${Number(textSm) / PX_IN_REM}rem`,
353
- "--vl-text-md": `${Number(text) / PX_IN_REM}rem`,
354
- "--vl-text-lg": `${Number(textLg) / PX_IN_REM}rem`,
367
+ "--vl-text-xs": `${textXs / PX_IN_REM}rem`,
368
+ "--vl-text-sm": `${textSm / PX_IN_REM}rem`,
369
+ "--vl-text-md": `${text / PX_IN_REM}rem`,
370
+ "--vl-text-lg": `${textLg / PX_IN_REM}rem`,
371
+ "--vl-disabled-opacity": `${disabledOpacity}%`,
355
372
  };
356
373
 
357
374
  for (const shade of COLOR_SHADES) {