vueless 0.0.771 → 0.0.773

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.
@@ -1,7 +1,8 @@
1
+ import tippy from "tippy.js";
1
2
  import { merge } from "lodash-es";
2
3
 
3
4
  import { vuelessConfig } from "../../utils/ui.ts";
4
- import { isSSR } from "../../utils/helper.ts";
5
+ import { isCSR, isSSR } from "../../utils/helper.ts";
5
6
 
6
7
  import type { DefaultProps } from "tippy.js";
7
8
  import type {
@@ -12,13 +13,20 @@ import type {
12
13
 
13
14
  let settings: Partial<DefaultProps> = {};
14
15
 
15
- const defaultSettings = {
16
- arrow: true,
17
- theme: "light",
18
- animation: "shift-away",
19
- };
16
+ if (isCSR) {
17
+ import("tippy.js/dist/tippy.css");
18
+ import("tippy.js/themes/light.css");
19
+ import("tippy.js/animations/shift-away.css");
20
+
21
+ const defaultSettings = {
22
+ arrow: true,
23
+ theme: "light",
24
+ animation: "shift-away",
25
+ };
20
26
 
21
- settings = merge(defaultSettings, vuelessConfig.directives?.tooltip || {}) as DefaultProps;
27
+ settings = merge(defaultSettings, vuelessConfig.directives?.tooltip || {}) as DefaultProps;
28
+ tippy.setDefaultProps(settings);
29
+ }
22
30
 
23
31
  function onMounted(el: TippyTargetElement, bindings: DirectiveBindingContent): void;
24
32
  function onMounted(el: TippyTargetElement, bindings: DirectiveBindingProps): void;
@@ -28,29 +36,19 @@ function onMounted(
28
36
  ): void {
29
37
  if (isSSR) return;
30
38
 
31
- (async () => {
32
- await import("tippy.js/dist/tippy.css");
33
- await import("tippy.js/themes/light.css");
34
- await import("tippy.js/animations/shift-away.css");
35
-
36
- const { default: tippy } = await import("tippy.js");
37
-
38
- tippy.setDefaultProps(settings);
39
+ if (typeof bindings.value === "string" && bindings.value.length) {
40
+ tippy(el, merge(settings, { content: bindings.value }));
39
41
 
40
- if (typeof bindings.value === "string" && String(bindings.value).length) {
41
- tippy(el, merge(settings, { content: bindings.value }));
42
-
43
- return;
44
- }
42
+ return;
43
+ }
45
44
 
46
- if (
47
- typeof bindings.value === "object" &&
48
- bindings.value.content &&
49
- String(bindings.value.content).length
50
- ) {
51
- tippy(el, merge(settings, bindings.value || {}));
52
- }
53
- })();
45
+ if (
46
+ typeof bindings.value !== "string" &&
47
+ bindings.value.content &&
48
+ String(bindings.value.content).length
49
+ ) {
50
+ tippy(el, merge(settings, bindings.value || {}));
51
+ }
54
52
  }
55
53
 
56
54
  function onUpdated(el: TippyTargetElement, bindings: DirectiveBindingContent): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.771",
3
+ "version": "0.0.773",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
package/plugin-vite.js CHANGED
@@ -66,7 +66,12 @@ export const Vueless = function (options = {}) {
66
66
  "process.env": {},
67
67
  },
68
68
  optimizeDeps: {
69
- include: [...(!isVuelessEnv ? ["vueless/preset-tailwind"] : [])],
69
+ include: [
70
+ ...(!isVuelessEnv ? ["vueless/preset-tailwind"] : []),
71
+ ...(!isVuelessEnv
72
+ ? ["vueless/directives/tooltip/vTooltip.ts"]
73
+ : ["./src/directives/tooltip/vTooltip.ts"]),
74
+ ],
70
75
  },
71
76
  }),
72
77
 
@@ -9,6 +9,7 @@ export default /*tw*/ {
9
9
  focus:ring-0 focus:ring-offset-0
10
10
  focus-visible:outline-{color}-600 focus-visible:outline-dynamic focus-visible:outline-offset-2
11
11
  disabled:border-gray-300 disabled:bg-gray-100 disabled:cursor-not-allowed
12
+ disabled:checked:bg-gray-400 disabled:checked:border-transparent
12
13
  `,
13
14
  variants: {
14
15
  size: {
@@ -39,7 +40,7 @@ export default /*tw*/ {
39
40
  grayscale: "bg-gray-900 hover:bg-gray-800 active:bg-gray-700",
40
41
  },
41
42
  disabled: {
42
- true: "border-gray-400 bg-gray-400",
43
+ true: "!border-gray-400 !bg-gray-400 cursor-not-allowed",
43
44
  },
44
45
  },
45
46
  },
@@ -230,7 +230,7 @@ defineExpose({
230
230
  * Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
231
231
  */
232
232
  const mutatedProps = computed(() => ({
233
- error: Boolean(props.error),
233
+ error: Boolean(props.error) && !props.disabled,
234
234
  label: Boolean(props.label),
235
235
  /* component state, not a props */
236
236
  typePassword: Boolean(inputValue.value && !isShownPassword.value && isTypePassword.value),
@@ -1,7 +1,7 @@
1
1
  export default /*tw*/ {
2
2
  moneyInput: "{UInput}",
3
3
  defaults: {
4
- symbol: "$",
4
+ symbol: "",
5
5
  size: "md",
6
6
  minFractionDigits: 0,
7
7
  maxFractionDigits: 2,
@@ -20,6 +20,8 @@ interface UInputMoneyArgs extends Props {
20
20
  enum: "labelAlign" | "size";
21
21
  }
22
22
 
23
+ const argTypes = getArgTypes(UInputMoney.__name);
24
+
23
25
  export default {
24
26
  id: "3030",
25
27
  title: "Form Inputs & Controls / Input Money",
@@ -29,7 +31,12 @@ export default {
29
31
  modelValue: 245000.42,
30
32
  },
31
33
  argTypes: {
32
- ...getArgTypes(UInputMoney.__name),
34
+ ...argTypes,
35
+ valueType: {
36
+ ...argTypes?.valueType,
37
+ options: (argTypes?.valueType?.table?.type?.summary as string)?.split(" | "),
38
+ control: "select",
39
+ },
33
40
  },
34
41
  parameters: {
35
42
  docs: {
@@ -43,6 +43,10 @@ const wrapperElement = computed(() => {
43
43
  return wrapperRef.value;
44
44
  });
45
45
 
46
+ const isShownError = computed(() => {
47
+ return Boolean(props.error) && !props.disabled;
48
+ });
49
+
46
50
  function onClick(event: MouseEvent) {
47
51
  emit("click", event);
48
52
  }
@@ -66,7 +70,7 @@ defineExpose({
66
70
  * Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
67
71
  */
68
72
  const mutatedProps = computed(() => ({
69
- error: Boolean(props.error),
73
+ error: Boolean(props.error) && !props.disabled,
70
74
  }));
71
75
 
72
76
  const { getDataTest, wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs } = useUI<Config>(
@@ -107,14 +111,14 @@ const { getDataTest, wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs }
107
111
  </label>
108
112
 
109
113
  <div
110
- v-if="error"
114
+ v-if="isShownError"
111
115
  v-bind="descriptionAttrs"
112
116
  :data-test="getDataTest('error')"
113
117
  v-text="error"
114
118
  />
115
119
 
116
120
  <div
117
- v-if="description && !error"
121
+ v-if="description && !isShownError"
118
122
  v-bind="descriptionAttrs"
119
123
  :data-test="getDataTest('description')"
120
124
  v-text="description"
@@ -147,10 +151,15 @@ const { getDataTest, wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs }
147
151
  <slot />
148
152
  </div>
149
153
 
150
- <div v-if="error" v-bind="descriptionAttrs" :data-test="getDataTest('error')" v-text="error" />
154
+ <div
155
+ v-if="isShownError"
156
+ v-bind="descriptionAttrs"
157
+ :data-test="getDataTest('error')"
158
+ v-text="error"
159
+ />
151
160
 
152
161
  <div
153
- v-if="description && !error"
162
+ v-if="description && !isShownError"
154
163
  v-bind="descriptionAttrs"
155
164
  :data-test="getDataTest('description')"
156
165
  v-text="description"
@@ -14,9 +14,9 @@ export default /*tw*/ {
14
14
  },
15
15
  },
16
16
  compoundVariants: [
17
- { align: ["left", "right"], size: "sm", class: "gap-2.5" },
18
- { align: ["left", "right"], size: "md", class: "gap-3" },
19
- { align: ["left", "right"], size: "lg", class: "gap-3.5" },
17
+ { align: ["left", "right"], size: "sm", class: "gap-2" },
18
+ { align: ["left", "right"], size: "md", class: "gap-2.5" },
19
+ { align: ["left", "right"], size: "lg", class: "gap-3" },
20
20
  { align: ["left", "right"], centred: true, class: "items-center w-auto" },
21
21
  { align: "left", centred: true, class: "justify-end" },
22
22
  { align: "right", centred: true, class: "justify-start" },
@@ -53,7 +53,7 @@ export default /*tw*/ {
53
53
  { align: "topWithDesc", size: "sm", class: "-mt-px" },
54
54
  { align: "topWithDesc", size: "md", class: "" },
55
55
  { align: "topWithDesc", size: "lg", class: "mt-px" },
56
- { align: ["left", "right"], size: "sm", class: "-mt-px text-sm" },
56
+ { align: ["left", "right"], size: "sm", class: "-mt-0.5 text-sm" },
57
57
  { align: ["left", "right"], size: "md", class: "text-sm" },
58
58
  { align: ["left", "right"], size: "lg", class: "mt-px text-base" },
59
59
  { align: ["left", "right"], centred: false, class: "pt-1" },
@@ -409,7 +409,7 @@ defineExpose({
409
409
  * Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
410
410
  */
411
411
  const mutatedProps = computed(() => ({
412
- error: Boolean(props.error),
412
+ error: Boolean(props.error) && !props.disabled,
413
413
  label: Boolean(props.label),
414
414
  /* component state, not a props */
415
415
  selected: Boolean(selectedLabel.value),
@@ -186,7 +186,7 @@ defineExpose({
186
186
  * Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
187
187
  */
188
188
  const mutatedProps = computed(() => ({
189
- error: Boolean(props.error),
189
+ error: Boolean(props.error) && !props.disabled,
190
190
  label: Boolean(props.label),
191
191
  }));
192
192