vueless 0.0.723 → 0.0.725

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.723",
3
+ "version": "0.0.725",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -86,7 +86,7 @@ export function getFormattedValue(value: string | number, options: FormatOptions
86
86
  positiveOnly: false,
87
87
  });
88
88
 
89
- const [integer, fraction] = rawValue.split(rawDecimalMark);
89
+ const [integer, fraction = ""] = rawValue.split(rawDecimalMark);
90
90
  const bigInteger = intlNumber.format(BigInt(integer));
91
91
 
92
92
  const formattedFraction = fraction
@@ -28,7 +28,7 @@ const currencySymbolPosition = computed(() => {
28
28
  * Get element / nested component attributes for each config token ✨
29
29
  * Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
30
30
  */
31
- const { moneyNumberAttrs, symbolAttrs } = useUI<Config>(defaultConfig);
31
+ const { moneyAttrs, symbolAttrs } = useUI<Config>(defaultConfig);
32
32
  </script>
33
33
 
34
34
  <template>
@@ -42,17 +42,19 @@ const { moneyNumberAttrs, symbolAttrs } = useUI<Config>(defaultConfig);
42
42
  :max-fraction-digits="maxFractionDigits"
43
43
  :decimal-separator="decimalSeparator"
44
44
  :thousands-separator="thousandsSeparator"
45
- v-bind="moneyNumberAttrs"
45
+ v-bind="moneyAttrs"
46
46
  :data-test="dataTest"
47
47
  >
48
48
  <template #left>
49
49
  <!-- @slot Use it to add something before money amount. -->
50
50
  <slot name="left" />
51
+
51
52
  <span v-if="currencySymbolPosition.left && symbol" v-bind="symbolAttrs" v-text="symbol" />
52
53
  </template>
53
54
 
54
55
  <template #right>
55
56
  <span v-if="currencySymbolPosition.right && symbol" v-bind="symbolAttrs" v-text="symbol" />
57
+
56
58
  <!-- @slot Use it to add something after money amount. -->
57
59
  <slot name="right" />
58
60
  </template>
@@ -1,5 +1,5 @@
1
1
  export default /*tw*/ {
2
- moneyNumber: {
2
+ money: {
3
3
  base: "{UNumber}",
4
4
  variants: {
5
5
  planned: {
@@ -9,18 +9,6 @@ export default /*tw*/ {
9
9
  },
10
10
  symbol: {
11
11
  base: "text-{color}-600 mx-1",
12
- variants: {
13
- size: {
14
- xs: "text-xs",
15
- sm: "text-sm",
16
- md: "text-base",
17
- lg: "text-lg",
18
- xl: "text-xl",
19
- "2xl": "text-2xl",
20
- "3xl": "text-3xl",
21
- "4xl": "text-4xl",
22
- },
23
- },
24
12
  compoundVariants: [
25
13
  { symbolDivided: false, symbolAlign: "left", class: "mr-0" },
26
14
  { symbolDivided: false, symbolAlign: "right", class: "ml-0" },
@@ -49,24 +49,24 @@ const preparedNumber = computed(() => {
49
49
  * Get element / nested component attributes for each config token ✨
50
50
  * Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
51
51
  */
52
- const { numberAttrs, sumAttrs, mathSignAttrs, integerAttrs, decimalAttrs } =
52
+ const { wrapperAttrs, numberAttrs, mathSignAttrs, integerAttrs, fractionAttrs } =
53
53
  useUI<Config>(defaultConfig);
54
54
  </script>
55
55
 
56
56
  <template>
57
- <div v-bind="numberAttrs">
57
+ <div v-bind="wrapperAttrs">
58
58
  <!-- @slot Use it to add something before the number. -->
59
59
  <slot name="left" />
60
60
 
61
- <div v-bind="sumAttrs" :data-test="dataTest">
61
+ <div v-bind="numberAttrs" :data-test="dataTest">
62
62
  <span v-if="value" v-bind="mathSignAttrs" v-text="mathSign" />
63
63
 
64
64
  <span v-bind="integerAttrs" v-text="preparedNumber.integer" />
65
65
 
66
66
  <span
67
67
  v-if="maxFractionDigits > 0"
68
- v-bind="decimalAttrs"
69
- v-text="preparedNumber.decimalSeparator + preparedNumber.decimal"
68
+ v-bind="fractionAttrs"
69
+ v-text="preparedNumber.decimalSeparator + preparedNumber.fraction"
70
70
  />
71
71
  </div>
72
72
 
@@ -1,18 +1,6 @@
1
1
  export default /*tw*/ {
2
- number: {
2
+ wrapper: {
3
3
  base: "whitespace-nowrap flex items-center text-{color}-600",
4
- variants: {
5
- color: {
6
- white: "text-white",
7
- grayscale: "text-gray-900",
8
- },
9
- align: {
10
- left: "justify-start",
11
- right: "justify-end",
12
- },
13
- },
14
- },
15
- sum: {
16
4
  variants: {
17
5
  size: {
18
6
  xs: "text-xs",
@@ -24,11 +12,20 @@ export default /*tw*/ {
24
12
  "3xl": "text-3xl",
25
13
  "4xl": "text-4xl",
26
14
  },
15
+ color: {
16
+ white: "text-white",
17
+ grayscale: "text-gray-900",
18
+ },
19
+ align: {
20
+ left: "justify-start",
21
+ right: "justify-end",
22
+ },
27
23
  },
28
24
  },
25
+ number: "",
29
26
  mathSign: "",
30
27
  integer: "",
31
- decimal: "",
28
+ fraction: "",
32
29
  defaults: {
33
30
  color: "grayscale",
34
31
  size: "md",
@@ -28,25 +28,25 @@ export function separatedNumber(
28
28
  const formattedNumber =
29
29
  value !== undefined && value !== null ? Number(value).toLocaleString("en-US", options) : "0";
30
30
 
31
- let [integer, decimal = ""] = formattedNumber.split(".");
31
+ let [integer, fraction = ""] = formattedNumber.split(".");
32
32
 
33
33
  integer = integer.replace(/,/g, thousandsSeparator);
34
34
 
35
35
  if (!value && value !== 0) {
36
36
  integer = SINGLE_ZERO;
37
- decimal = DOUBLE_ZERO;
37
+ fraction = DOUBLE_ZERO;
38
38
  }
39
39
 
40
- if (decimal === "") {
40
+ if (fraction === "") {
41
41
  decimalSeparator = "";
42
42
  }
43
43
 
44
44
  if (minFractionDigits === 0 && maxFractionDigits === 0) {
45
45
  decimalSeparator = "";
46
- decimal = "";
47
- } else if (decimal.length < minFractionDigits) {
48
- decimal = decimal.padEnd(minFractionDigits, "0");
46
+ fraction = "";
47
+ } else if (fraction.length < minFractionDigits) {
48
+ fraction = fraction.padEnd(minFractionDigits, "0");
49
49
  }
50
50
 
51
- return { integer, decimal, decimalSeparator };
51
+ return { integer, fraction, decimalSeparator };
52
52
  }