vueless 0.0.260 → 0.0.262

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.
@@ -18,6 +18,7 @@ export const DEFAULT_ROUNDING = 8; /* pixels */
18
18
  export const COLOR_SHADES = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
19
19
  export const GRAY_COLORS = ["slate", COOL_COLOR, "zinc", "neutral", "stone"];
20
20
  export const BRAND_COLORS = [
21
+ GRAYSCALE_COLOR,
21
22
  "red",
22
23
  "orange",
23
24
  "amber",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.260",
3
+ "version": "0.0.262",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -16,6 +16,7 @@ import {
16
16
  DEFAULT_BRAND_COLOR,
17
17
  DEFAULT_GRAY_COLOR,
18
18
  DARK_MODE_SELECTOR,
19
+ GRAY_COLORS,
19
20
  } from "../constants";
20
21
 
21
22
  /* Load Vueless config from the project root. */
@@ -261,44 +262,53 @@ export default class UIService {
261
262
  */
262
263
  setTheme = (config = {}) => {
263
264
  const isDarkMode = this.setDarkMode(config);
264
- const brand = config?.brand ?? vuelessConfig?.brand ?? DEFAULT_BRAND_COLOR;
265
- const gray = config?.gray ?? vuelessConfig?.gray ?? DEFAULT_GRAY_COLOR;
266
265
  const ring = config?.ring ?? vuelessConfig?.ring ?? DEFAULT_RING;
267
266
  const ringOffset = config?.ringOffset ?? vuelessConfig?.ringOffset ?? DEFAULT_RING_OFFSET;
268
267
  const rounding = config?.rounding ?? vuelessConfig?.rounding ?? DEFAULT_ROUNDING;
268
+ let brand = config?.brand ?? vuelessConfig?.brand ?? DEFAULT_BRAND_COLOR;
269
+ let gray = config?.gray ?? vuelessConfig?.gray ?? DEFAULT_GRAY_COLOR;
269
270
 
270
- // eslint-disable-next-line prettier/prettier, vue/max-len
271
- let brandColor = BRAND_COLORS.some((color) => color === brand) || brand === GRAYSCALE_COLOR ? brand : DEFAULT_BRAND_COLOR;
272
- let grayColor = BRAND_COLORS.some((color) => color === gray) ? gray : DEFAULT_GRAY_COLOR;
271
+ const isBrandColor = BRAND_COLORS.some((color) => color === brand);
272
+ const isGrayColor = GRAY_COLORS.some((color) => color === gray);
273
+
274
+ if (!isBrandColor) {
275
+ // eslint-disable-next-line no-console
276
+ console.log(`Brand color '${brand}' is incorrect.`);
277
+ }
278
+
279
+ if (!isGrayColor) {
280
+ // eslint-disable-next-line no-console
281
+ console.log(`Gray color '${gray}' is incorrect.`);
282
+ }
273
283
 
274
284
  // set default shade related to the selected mode
275
285
  const defaultBrandShade = isDarkMode ? 400 : 600;
276
286
  const defaultGrayShade = isDarkMode ? 400 : 600;
277
287
 
278
288
  // handling custom `cool` color
279
- if (grayColor === COOL_COLOR) {
280
- grayColor = GRAY_COLOR;
289
+ if (gray === COOL_COLOR) {
290
+ gray = GRAY_COLOR;
281
291
  }
282
292
 
283
293
  // handling custom `grayscale` color
284
- if (brandColor === GRAYSCALE_COLOR) {
285
- brandColor = grayColor;
294
+ if (brand === GRAYSCALE_COLOR) {
295
+ brand = gray;
286
296
  }
287
297
 
288
298
  const variables = {
289
299
  "--vl-ring": `${ring}px`,
290
300
  "--vl-ring-offset": `${ringOffset}px`,
291
301
  "--vl-rounding": `${Number(rounding) / this.PX_IN_REM}rem`,
292
- "--vl-color-gray-default": UIService.convertHexInRgb(colors[grayColor][defaultBrandShade]),
293
- "--vl-color-brand-default": UIService.convertHexInRgb(colors[brandColor][defaultGrayShade]),
302
+ "--vl-color-gray-default": UIService.convertHexInRgb(colors[gray][defaultBrandShade]),
303
+ "--vl-color-brand-default": UIService.convertHexInRgb(colors[brand][defaultGrayShade]),
294
304
  };
295
305
 
296
- for (const key in colors[grayColor]) {
297
- variables[`--vl-color-gray-${key}`] = UIService.convertHexInRgb(colors[grayColor][key]);
306
+ for (const key in colors[gray]) {
307
+ variables[`--vl-color-gray-${key}`] = UIService.convertHexInRgb(colors[gray][key]);
298
308
  }
299
309
 
300
- for (const key in colors[brandColor]) {
301
- variables[`--vl-color-brand-${key}`] = UIService.convertHexInRgb(colors[brandColor][key]);
310
+ for (const key in colors[brand]) {
311
+ variables[`--vl-color-brand-${key}`] = UIService.convertHexInRgb(colors[brand][key]);
302
312
  }
303
313
 
304
314
  const style = document.createElement("style");
@@ -6,7 +6,7 @@ export default /*tw*/ {
6
6
  border border-solid transition
7
7
  focus:ring-{color}-700/15 focus:ring-dynamic focus:ring-offset-dynamic
8
8
  focus-within:ring-{color}-700/15 focus-within:ring-dynamic focus-within:ring-offset-dynamic
9
- disabled:ring-0 disabled:cursor-not-allowed
9
+ disabled:ring-0 disabled:cursor-not-allowed cursor-pointer
10
10
  `,
11
11
  variants: {
12
12
  size: {
@@ -12,12 +12,12 @@ export default /*tw*/ {
12
12
  disabled: {
13
13
  true: "focus-within:ring-0 cursor-not-allowed",
14
14
  },
15
- block: {
16
- true: "w-full",
17
- },
18
15
  noRing: {
19
16
  true: "focus-within:ring-0 focus-within:ring-offset-0",
20
17
  },
18
+ block: {
19
+ true: "w-full",
20
+ },
21
21
  },
22
22
  },
23
23
  link: {
@@ -5,7 +5,7 @@ import defaultConfig from "../configs/default.config";
5
5
  import { computed } from "vue";
6
6
 
7
7
  export default function useAttrs(props, { isShownOptions }) {
8
- const { config, getAttrs, hasSlotContent, isSystemKey } = useUI(
8
+ const { config, getAttrs, hasSlotContent, isSystemKey, isCVA } = useUI(
9
9
  defaultConfig,
10
10
  () => props.config,
11
11
  );
@@ -15,15 +15,15 @@ export default function useAttrs(props, { isShownOptions }) {
15
15
  if (isSystemKey(key)) continue;
16
16
 
17
17
  const classes = computed(() => {
18
- const value = config.value[key];
18
+ let value = config.value[key];
19
19
 
20
- if (value.variants || value.compoundVariants) {
21
- return cva(value)({
20
+ if (isCVA(value)) {
21
+ value = cva(value)({
22
22
  ...props,
23
23
  });
24
24
  }
25
25
 
26
- return "";
26
+ return value;
27
27
  });
28
28
 
29
29
  attrs[`${key}Attrs`] = getAttrs(key, { classes });
@@ -5,7 +5,7 @@ import defaultConfig from "../configs/default.config";
5
5
  import { computed } from "vue";
6
6
 
7
7
  export default function useAttrs(props, { isShownOptions }) {
8
- const { config, getAttrs, hasSlotContent, isSystemKey } = useUI(
8
+ const { config, getAttrs, hasSlotContent, isSystemKey, isCVA } = useUI(
9
9
  defaultConfig,
10
10
  () => props.config,
11
11
  );
@@ -15,15 +15,15 @@ export default function useAttrs(props, { isShownOptions }) {
15
15
  if (isSystemKey(key)) continue;
16
16
 
17
17
  const classes = computed(() => {
18
- const value = config.value[key];
18
+ let value = config.value[key];
19
19
 
20
- if (value.variants || value.compoundVariants) {
21
- return cva(value)({
20
+ if (isCVA(value)) {
21
+ value = cva(value)({
22
22
  ...props,
23
23
  });
24
24
  }
25
25
 
26
- return "";
26
+ return value;
27
27
  });
28
28
 
29
29
  attrs[`${key}Attrs`] = getAttrs(key, { classes });
@@ -5,7 +5,7 @@ import defaultConfig from "../configs/default.config";
5
5
  import { computed } from "vue";
6
6
 
7
7
  export default function useAttrs(props, { isShownOptions }) {
8
- const { config, getAttrs, hasSlotContent, isSystemKey } = useUI(
8
+ const { config, getAttrs, hasSlotContent, isSystemKey, isCVA } = useUI(
9
9
  defaultConfig,
10
10
  () => props.config,
11
11
  );
@@ -15,15 +15,15 @@ export default function useAttrs(props, { isShownOptions }) {
15
15
  if (isSystemKey(key)) continue;
16
16
 
17
17
  const classes = computed(() => {
18
- const value = config.value[key];
18
+ let value = config.value[key];
19
19
 
20
- if (value.variants || value.compoundVariants) {
20
+ if (isCVA(value)) {
21
21
  return cva(value)({
22
22
  ...props,
23
23
  });
24
24
  }
25
25
 
26
- return "";
26
+ return value;
27
27
  });
28
28
 
29
29
  attrs[`${key}Attrs`] = getAttrs(key, { classes });
@@ -5,7 +5,7 @@ import defaultConfig from "../configs/default.config";
5
5
  import { computed } from "vue";
6
6
 
7
7
  export default function useAttrs(props) {
8
- const { config, getAttrs, hasSlotContent, isSystemKey } = useUI(
8
+ const { config, getAttrs, hasSlotContent, isSystemKey, isCVA } = useUI(
9
9
  defaultConfig,
10
10
  () => props.config,
11
11
  );
@@ -21,15 +21,15 @@ export default function useAttrs(props) {
21
21
  if (isSystemKey(key)) continue;
22
22
 
23
23
  const classes = computed(() => {
24
- const value = config.value[key];
24
+ let value = config.value[key];
25
25
 
26
- if (value.variants || value.compoundVariants) {
27
- return cva(value)({
26
+ if (isCVA(value)) {
27
+ value = cva(value)({
28
28
  ...props,
29
29
  });
30
30
  }
31
31
 
32
- return "";
32
+ return value;
33
33
  });
34
34
 
35
35
  attrs[`${key}Attrs`] = getAttrs(key, { classes });
@@ -39,7 +39,7 @@ export default function useAttrs(props) {
39
39
 
40
40
  attrs[`${key}Attrs`] = computed(() => ({
41
41
  ...subGroupLabelAttrs.value,
42
- class: cx([subGroupLabelAttrs.value.class, optionClasses.value]),
42
+ class: cx([optionClasses.value, subGroupLabelAttrs.value.class]),
43
43
  }));
44
44
  }
45
45
 
@@ -48,7 +48,7 @@ export default function useAttrs(props) {
48
48
 
49
49
  attrs[`${key}Attrs`] = computed(() => ({
50
50
  ...groupLabelAttrs.value,
51
- class: cx([groupLabelAttrs.value.class, optionClasses.value]),
51
+ class: cx([optionClasses.value, groupLabelAttrs.value.class]),
52
52
  }));
53
53
  }
54
54
  }
@@ -7,7 +7,7 @@ export default /*tw*/ {
7
7
  `,
8
8
  list: "m-1 inline-block list-none align-top w-full p-0 bg-white opacity-1 hover:transition",
9
9
  subGroupLabel: {
10
- base: "pointer-events-none bg-transparent !font-medium !leading-none !uppercase !text-gray-500/[85] pt-1",
10
+ base: "pointer-events-none bg-transparent font-medium leading-none uppercase text-gray-400 pt-2",
11
11
  variants: {
12
12
  size: {
13
13
  sm: "text-2xs",
@@ -17,12 +17,12 @@ export default /*tw*/ {
17
17
  },
18
18
  },
19
19
  groupLabel: {
20
- base: "pointer-events-none bg-transparent !font-medium !leading-none !uppercase !text-gray-500/[85] pt-6 group-first/item:pt-2",
20
+ base: "pointer-events-none bg-transparent font-medium leading-none uppercase text-gray-400 pt-4 pb-1 group-first/item:pt-2",
21
21
  variants: {
22
22
  size: {
23
- sm: "text-2xs pb-1 mt-4",
24
- md: "text-xs pb-1",
25
- lg: "text-sm pb-1 mt-4",
23
+ sm: "text-2xs",
24
+ md: "text-xs",
25
+ lg: "text-sm",
26
26
  },
27
27
  },
28
28
  },
@@ -51,12 +51,12 @@ export default /*tw*/ {
51
51
  disabled: false,
52
52
  },
53
53
  safelist: (colors) => [
54
- { pattern: `text-(${colors})-600` },
55
54
  { pattern: `bg-(${colors})-600` },
56
55
  { pattern: `bg-(${colors})-700`, variants: ["hover"] },
57
56
  { pattern: `bg-(${colors})-800`, variants: ["active"] },
58
57
  { pattern: `border-(${colors})-500`, variants: ["focus"] },
59
58
  { pattern: `border-(${colors})-800`, variants: ["active"] },
59
+ { pattern: `text-(${colors})-600`, variants: ["checked"] },
60
60
  { pattern: `ring-(${colors})-700`, variants: ["focus"] },
61
61
  ],
62
62
  };
@@ -81,7 +81,7 @@ const ValueTypesTemplate = (args) => ({
81
81
  />
82
82
  </UCheckboxGroup>
83
83
 
84
- <span class="font-normal text-gray-500/[85] text-xs pl-0 mt-1">
84
+ <span class="font-normal text-gray-400 text-xs pl-0 mt-1">
85
85
  {{ arrayValue }}
86
86
  </span>
87
87
  </div>
@@ -9,6 +9,9 @@ export default /*tw*/ {
9
9
  error: {
10
10
  true: "border-red-300 hover:border-red-400",
11
11
  },
12
+ disabled: {
13
+ true: "pointer-events-none bg-gray-100",
14
+ },
12
15
  },
13
16
  compoundVariants: [
14
17
  { labelAlign: "topInside", label: true, size: "sm", class: "pt-7" },
@@ -19,7 +22,7 @@ export default /*tw*/ {
19
22
  descriptionTop: "{UText} text-gray-700 mb-2",
20
23
  descriptionBottom: "{UText} text-gray-700 mt-2",
21
24
  contentWrapper: {
22
- base: "p-3 gap-6 w-full rounded-dynamic bg-brand-50 relative flex justify-between items-start",
25
+ base: "p-3 gap-6 flex justify-between items-start relative w-full rounded-dynamic bg-brand-50",
23
26
  variants: {
24
27
  multiple: {
25
28
  false: "items-center",
@@ -27,6 +30,9 @@ export default /*tw*/ {
27
30
  error: {
28
31
  true: "bg-red-50",
29
32
  },
33
+ disabled: {
34
+ true: "bg-gray-200",
35
+ },
30
36
  },
31
37
  },
32
38
  placeholder: {
@@ -39,7 +45,14 @@ export default /*tw*/ {
39
45
  },
40
46
  },
41
47
  },
42
- button: "{UButton} hover:cursor-pointer",
48
+ chooseFileButton: {
49
+ component: "{UButton}",
50
+ variants: {
51
+ disabled: {
52
+ true: "opacity-75",
53
+ },
54
+ },
55
+ },
43
56
  chooseFileIconName: "attach_file",
44
57
  clearButton: "{UButton}",
45
58
  clearIconName: "close",
@@ -47,7 +60,7 @@ export default /*tw*/ {
47
60
  removeItemIconName: "close",
48
61
  dropzoneWrapperHover: "border-gray-400 border-dashed",
49
62
  dropzoneWrapperError: "hover:border-red-400 border-dashed border-red-300",
50
- input: "sr-only pointer-events-none size-0 opacity-0",
63
+ input: "sr-only",
51
64
  buttonWrapper: "flex gap-3 items-center",
52
65
  fileList: "{UFiles} w-full",
53
66
  i18n: {
@@ -60,7 +73,8 @@ export default /*tw*/ {
60
73
  size: "md",
61
74
  labelAlign: "topInside",
62
75
  allowedFileTypes: [],
63
- multiple: false,
64
76
  maxFileSize: 0,
77
+ multiple: false,
78
+ disabled: false,
65
79
  },
66
80
  };
@@ -5,6 +5,7 @@
5
5
  :label="label"
6
6
  :error="error"
7
7
  :align="labelAlign"
8
+ :disabled="disabled"
8
9
  :description="description"
9
10
  v-bind="labelAttrs"
10
11
  >
@@ -23,7 +24,7 @@
23
24
  <UFiles :size="size" v-bind="fileListAttrs" :file-list="fileList">
24
25
  <template #right="{ file }">
25
26
  <UIcon
26
- v-if="props.multiple"
27
+ v-if="props.multiple && !disabled"
27
28
  pill
28
29
  internal
29
30
  interactive
@@ -40,14 +41,16 @@
40
41
  <template v-if="Array.isArray(currentFiles) || !currentFiles">
41
42
  <UButton
42
43
  filled
44
+ no-ring
43
45
  :for="id"
44
46
  tag="label"
45
47
  variant="thirdary"
46
48
  :size="buttonSize"
47
49
  :icon-right="config.chooseFileIconName"
48
50
  :label="currentLocale.uploadFile"
51
+ :disabled="disabled"
52
+ v-bind="chooseFileButtonAttrs"
49
53
  :data-cy="`${dataCy}-upload`"
50
- v-bind="buttonAttrs"
51
54
  />
52
55
 
53
56
  <input
@@ -62,12 +65,14 @@
62
65
  </template>
63
66
 
64
67
  <UButton
65
- v-if="isValue"
68
+ v-if="isValue && !disabled"
66
69
  pill
67
70
  square
68
71
  filled
72
+ no-ring
69
73
  variant="thirdary"
70
74
  :size="buttonSize"
75
+ :disabled="disabled"
71
76
  :icon-left="config.clearIconName"
72
77
  v-bind="clearButtonAttrs"
73
78
  :data-cy="`${dataCy}-clear`"
@@ -178,6 +183,14 @@ const props = defineProps({
178
183
  default: "",
179
184
  },
180
185
 
186
+ /**
187
+ * Disable the input.
188
+ */
189
+ disabled: {
190
+ type: Boolean,
191
+ default: UIService.get(defaultConfig, UInputFile).default.disabled,
192
+ },
193
+
181
194
  /**
182
195
  * Generates unique element id.
183
196
  * @ignore
@@ -225,7 +238,7 @@ const fileInputRef = ref(null);
225
238
  const {
226
239
  config,
227
240
  labelAttrs,
228
- buttonAttrs,
241
+ chooseFileButtonAttrs,
229
242
  dropzoneWrapperAttrs,
230
243
  descriptionTopAttrs,
231
244
  descriptionBottomAttrs,
@@ -27,9 +27,9 @@ export default /*tw*/ {
27
27
  disabled: false,
28
28
  },
29
29
  safelist: (colors) => [
30
- { pattern: `text-(${colors})-600` },
31
30
  { pattern: `border-(${colors})-500`, variants: ["focus"] },
32
31
  { pattern: `border-(${colors})-800`, variants: ["active"] },
32
+ { pattern: `text-(${colors})-600`, variants: ["checked"] },
33
33
  { pattern: `ring-(${colors})-700`, variants: ["focus"] },
34
34
  ],
35
35
  };
@@ -3,7 +3,7 @@ export default /*tw*/ {
3
3
  base: "",
4
4
  variants: {
5
5
  pill: {
6
- true: "rounded-full bg-{color}-500/5",
6
+ true: "rounded-full bg-{color}-600/5",
7
7
  },
8
8
  },
9
9
  compoundVariants: [
@@ -19,8 +19,8 @@ export default /*tw*/ {
19
19
  { pill: true, size: "3xl", class: "p-4" },
20
20
  { pill: true, size: "4xl", class: "p-5" },
21
21
  { pill: true, size: "5xl", class: "p-5" },
22
- { pill: true, color: "white", class: "bg-white" },
23
- { pill: true, color: "grayscale", class: "bg-gray-900" },
22
+ { pill: true, color: "white", class: "bg-white/5" },
23
+ { pill: true, color: "grayscale", class: "bg-gray-700/5" },
24
24
  ],
25
25
  },
26
26
  container: {
@@ -42,15 +42,15 @@ export default /*tw*/ {
42
42
  },
43
43
  variant: {
44
44
  light: "text-{color}-400",
45
- default: "text-{color}-500",
46
- dark: "text-{color}-700",
45
+ default: "text-{color}-600",
46
+ dark: "text-{color}-800",
47
47
  },
48
48
  color: {
49
49
  white: "text-white",
50
50
  grayscale: "text-gray-900",
51
51
  },
52
52
  interactive: {
53
- true: "cursor-pointer hover:opacity-50, active:opacity-50",
53
+ true: "cursor-pointer hover:opacity-50 active:opacity-50",
54
54
  },
55
55
  },
56
56
  },
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.260",
4
+ "version": "0.0.262",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -4312,6 +4312,15 @@
4312
4312
  },
4313
4313
  "default": "\"\""
4314
4314
  },
4315
+ {
4316
+ "name": "disabled",
4317
+ "description": "Disable the input.",
4318
+ "value": {
4319
+ "kind": "expression",
4320
+ "type": "boolean"
4321
+ },
4322
+ "default": "false"
4323
+ },
4315
4324
  {
4316
4325
  "name": "id",
4317
4326
  "description": "@ignore: Generates unique element id.",