@pequity/squirrel 6.0.11 → 6.0.13

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.
Files changed (78) hide show
  1. package/dist/cjs/chunks/index.js +2645 -0
  2. package/dist/cjs/chunks/p-btn.types.js +3 -0
  3. package/dist/cjs/chunks/p-info-icon.js +37 -0
  4. package/dist/cjs/chunks/p-select.js +2 -2
  5. package/dist/cjs/index.js +25 -33
  6. package/dist/cjs/inputClasses.js +127 -0
  7. package/dist/cjs/inputClassesMixin.js +23 -19
  8. package/dist/cjs/p-btn.js +56 -57
  9. package/dist/cjs/p-icon.js +6 -1
  10. package/dist/cjs/p-info-icon.js +2 -33
  11. package/dist/cjs/p-input-number.js +2 -2
  12. package/dist/cjs/p-input-search.js +3 -3
  13. package/dist/cjs/p-table-header-cell.js +2 -2
  14. package/dist/cjs/useInputClasses.js +19 -18
  15. package/dist/es/chunks/index.js +2646 -0
  16. package/dist/es/chunks/p-btn.types.js +4 -0
  17. package/dist/es/chunks/p-info-icon.js +38 -0
  18. package/dist/es/chunks/p-select.js +2 -2
  19. package/dist/es/index.js +74 -82
  20. package/dist/es/inputClasses.js +127 -0
  21. package/dist/es/inputClassesMixin.js +23 -19
  22. package/dist/es/p-btn.js +56 -57
  23. package/dist/es/p-icon.js +6 -1
  24. package/dist/es/p-info-icon.js +2 -33
  25. package/dist/es/p-input-number.js +2 -2
  26. package/dist/es/p-input-search.js +3 -3
  27. package/dist/es/p-table-header-cell.js +2 -2
  28. package/dist/es/useInputClasses.js +23 -22
  29. package/dist/squirrel/components/p-alert/p-alert.vue.d.ts +1 -1
  30. package/dist/squirrel/components/p-btn/p-btn.types.d.ts +2 -1
  31. package/dist/squirrel/components/p-btn/p-btn.vue.d.ts +395 -17
  32. package/dist/squirrel/components/p-drawer/p-drawer.vue.d.ts +5 -5
  33. package/dist/squirrel/components/p-dropdown-select/p-dropdown-select.vue.d.ts +30 -22
  34. package/dist/squirrel/components/p-icon/p-icon.types.d.ts +5 -0
  35. package/dist/squirrel/components/p-input/p-input.vue.d.ts +11 -7
  36. package/dist/squirrel/components/p-input-number/p-input-number.vue.d.ts +11 -7
  37. package/dist/squirrel/components/p-input-percent/p-input-percent.vue.d.ts +3 -3
  38. package/dist/squirrel/components/p-input-search/p-input-search.vue.d.ts +16 -12
  39. package/dist/squirrel/components/p-select/p-select.vue.d.ts +5 -5
  40. package/dist/squirrel/components/p-select-list/p-select-list.vue.d.ts +30 -22
  41. package/dist/squirrel/components/p-textarea/p-textarea.vue.d.ts +11 -7
  42. package/dist/squirrel/components/p-toggle/p-toggle.vue.d.ts +11 -7
  43. package/dist/squirrel/composables/useInputClasses.d.ts +3 -3
  44. package/dist/squirrel/index.d.ts +1 -0
  45. package/dist/squirrel/utils/index.d.ts +2 -2
  46. package/dist/squirrel/utils/inputClasses.d.ts +938 -0
  47. package/dist/squirrel/utils/inputClassesMixin.d.ts +12 -8
  48. package/dist/squirrel.css +23 -23
  49. package/package.json +24 -21
  50. package/squirrel/components/p-btn/p-btn.spec.js +1 -1
  51. package/squirrel/components/p-btn/p-btn.types.ts +3 -1
  52. package/squirrel/components/p-btn/p-btn.vue +60 -74
  53. package/squirrel/components/p-dropdown/p-dropdown.vue +2 -2
  54. package/squirrel/components/p-file-upload/p-file-upload.spec.js +3 -8
  55. package/squirrel/components/p-icon/p-icon.types.ts +5 -0
  56. package/squirrel/components/p-info-icon/p-info-icon.spec.js +3 -2
  57. package/squirrel/components/p-info-icon/p-info-icon.vue +3 -7
  58. package/squirrel/components/p-inline-date-picker/p-inline-date-picker.spec.js +3 -10
  59. package/squirrel/components/p-input/p-input.spec.js +3 -8
  60. package/squirrel/components/p-input-number/p-input-number.spec.js +15 -18
  61. package/squirrel/components/p-input-percent/p-input-percent.spec.js +3 -8
  62. package/squirrel/components/p-input-percent/p-input-percent.vue +3 -3
  63. package/squirrel/components/p-input-search/p-input-search.vue +4 -4
  64. package/squirrel/components/p-select/p-select.spec.js +27 -33
  65. package/squirrel/components/p-select/p-select.vue +4 -4
  66. package/squirrel/components/p-table-header-cell/p-table-header-cell.spec.js +6 -4
  67. package/squirrel/components/p-textarea/p-textarea.spec.js +3 -8
  68. package/squirrel/composables/useInputClasses.spec.js +138 -77
  69. package/squirrel/composables/useInputClasses.ts +25 -39
  70. package/squirrel/index.ts +1 -0
  71. package/squirrel/utils/index.ts +3 -36
  72. package/squirrel/utils/inputClasses.ts +128 -0
  73. package/squirrel/utils/inputClassesMixin.spec.js +153 -64
  74. package/squirrel/utils/inputClassesMixin.ts +26 -43
  75. package/dist/cjs/inputClassesShared.js +0 -76
  76. package/dist/es/inputClassesShared.js +0 -76
  77. package/dist/squirrel/utils/inputClassesShared.d.ts +0 -45
  78. package/squirrel/utils/inputClassesShared.ts +0 -75
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ const SIZES = ["sm", "md", "lg"];
3
+ exports.SIZES = SIZES;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ const vue = require("vue");
3
+ const pIcon_vue_vue_type_script_setup_true_lang = require("./p-icon.js");
4
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
5
+ ...{
6
+ name: "PInfoIcon"
7
+ },
8
+ __name: "p-info-icon",
9
+ props: {
10
+ text: { default: null }
11
+ },
12
+ setup(__props) {
13
+ return (_ctx, _cache) => {
14
+ const _component_VTooltip = vue.resolveComponent("VTooltip");
15
+ return vue.openBlock(), vue.createBlock(_component_VTooltip, {
16
+ "popper-triggers": ["hover"],
17
+ delay: { show: 750, hide: 0 },
18
+ disabled: !_ctx.$slots.default && !_ctx.text
19
+ }, {
20
+ popper: vue.withCtx(() => [
21
+ vue.renderSlot(_ctx.$slots, "default", {}, () => [
22
+ vue.createTextVNode(vue.toDisplayString(_ctx.text), 1)
23
+ ])
24
+ ]),
25
+ default: vue.withCtx(() => [
26
+ vue.createVNode(pIcon_vue_vue_type_script_setup_true_lang._sfc_main, {
27
+ icon: "info",
28
+ class: "block h-3 w-3",
29
+ width: "12"
30
+ })
31
+ ]),
32
+ _: 3
33
+ }, 8, ["disabled"]);
34
+ };
35
+ }
36
+ });
37
+ exports._sfc_main = _sfc_main;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  const vue = require("vue");
3
+ const pBtn_types = require("./p-btn.types.js");
3
4
  const useInputClasses = require("../useInputClasses.js");
4
- const inputClassesShared = require("../inputClassesShared.js");
5
5
  const _hoisted_1 = ["data-has-error"];
6
6
  const _hoisted_2 = ["value"];
7
7
  const _hoisted_3 = ["value"];
@@ -37,7 +37,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
37
37
  type: String,
38
38
  default: "md",
39
39
  validator(value) {
40
- return Object.keys(inputClassesShared.INPUT_SIZES).includes(value);
40
+ return pBtn_types.SIZES.includes(value);
41
41
  }
42
42
  },
43
43
  itemText: {
package/dist/cjs/index.js CHANGED
@@ -20,7 +20,7 @@ const vueToastification = require("vue-toastification");
20
20
  const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
21
21
  const pIcon = require("./p-icon.js");
22
22
  const pIcon_vue_vue_type_script_setup_true_lang = require("./chunks/p-icon.js");
23
- const pInfoIcon = require("./p-info-icon.js");
23
+ const pInfoIcon_vue_vue_type_script_setup_true_lang = require("./chunks/p-info-icon.js");
24
24
  const pInlineDatePicker_vue_vue_type_script_setup_true_lang = require("./chunks/p-inline-date-picker.js");
25
25
  const pInput = require("./p-input.js");
26
26
  const pInputNumber = require("./p-input-number.js");
@@ -55,16 +55,17 @@ const pTabs_vue_vue_type_script_setup_true_lang = require("./chunks/p-tabs.js");
55
55
  const pTextarea = require("./p-textarea.js");
56
56
  const pToggle = require("./p-toggle.js");
57
57
  const config = require("./config.js");
58
+ const pBtn_types = require("./chunks/p-btn.types.js");
58
59
  const currency = require("./currency.js");
59
60
  const dom = require("./dom.js");
60
61
  const inputClassesMixin = require("./inputClassesMixin.js");
61
- const inputClassesShared = require("./inputClassesShared.js");
62
62
  const listKeyboardNavigation = require("./listKeyboardNavigation.js");
63
63
  const number = require("./number.js");
64
64
  const object = require("./object.js");
65
65
  const pagination = require("./pagination.js");
66
66
  const sanitization = require("./sanitization.js");
67
67
  const tailwind = require("./tailwind.js");
68
+ const index = require("./chunks/index.js");
68
69
  const _imports_0$1 = "data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M5.8335%206.25016L10.0002%202.0835L14.1668%206.25016'%20stroke='%23767189'%20stroke-width='1.25'%20/%3e%3cpath%20d='M10%202.0835V13.7502'%20stroke='%23767189'%20stroke-width='1.25'%20/%3e%3cpath%20d='M2.91675%2015V18.3333H17.0834V15'%20stroke='%23767189'%20stroke-width='1.25'%20/%3e%3c/svg%3e";
69
70
  const _imports_1$1 = "data:image/svg+xml,%3csvg%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M33%2012H14V44H42V21L33%2012Z'%20stroke='%231A123B'%20stroke-width='3'%20/%3e%3cpath%20d='M9%2036H6V4H25L28%207'%20stroke='%231A123B'%20stroke-width='3'%20/%3e%3cpath%20d='M37%2030H19M28%2021V39'%20stroke='%231A123B'%20stroke-width='3'%20/%3e%3c/svg%3e";
70
71
  const _hoisted_1$3 = ["data-has-error"];
@@ -212,10 +213,10 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
212
213
  fileInputRef.value.value = "";
213
214
  }
214
215
  };
215
- const removeFile = (index) => {
216
- if (index in files.value) {
217
- const removedFile = files.value[index];
218
- files.value = files.value.filter((item, idx) => idx !== index);
216
+ const removeFile = (index2) => {
217
+ if (index2 in files.value) {
218
+ const removedFile = files.value[index2];
219
+ files.value = files.value.filter((item, idx) => idx !== index2);
219
220
  emit("file-removed", removedFile);
220
221
  }
221
222
  };
@@ -287,13 +288,13 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
287
288
  }, null, 40, _hoisted_8)
288
289
  ])) : vue.createCommentVNode("", true),
289
290
  vue.createElementVNode("div", _hoisted_9, [
290
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(files.value, (file, index) => {
291
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(files.value, (file, index2) => {
291
292
  return vue.openBlock(), vue.createElementBlock("div", {
292
- key: index,
293
+ key: index2,
293
294
  class: vue.normalizeClass([
294
295
  "flex cursor-default items-center justify-between",
295
- { "border-b border-dashed border-p-gray-30 pb-4": index !== files.value.length - 1 },
296
- { "mt-4": index !== 0 }
296
+ { "border-b border-dashed border-p-gray-30 pb-4": index2 !== files.value.length - 1 },
297
+ { "mt-4": index2 !== 0 }
297
298
  ]),
298
299
  onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
299
300
  }, ["stop"]))
@@ -304,7 +305,7 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
304
305
  }, vue.toDisplayString(file.name), 9, _hoisted_10),
305
306
  vue.createElementVNode("button", {
306
307
  class: "bg-file-upload-x-icon h-4 w-4 shrink-0 cursor-pointer",
307
- onClick: vue.withModifiers(($event) => removeFile(index), ["stop"])
308
+ onClick: vue.withModifiers(($event) => removeFile(index2), ["stop"])
308
309
  }, null, 8, _hoisted_11)
309
310
  ], 2);
310
311
  }), 128))
@@ -624,10 +625,10 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
624
625
  class: "truncate text-p-purple-60",
625
626
  title: vue.unref(string.toString)(vue.unref(getText)(row.index))
626
627
  }, [
627
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(text.splitStringForHighlight)(vue.unref(string.toString)(vue.unref(getText)(row.index)), vue.unref(search)), (str, index) => {
628
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(text.splitStringForHighlight)(vue.unref(string.toString)(vue.unref(getText)(row.index)), vue.unref(search)), (str, index2) => {
628
629
  return vue.openBlock(), vue.createElementBlock("span", {
629
- key: `${vue.unref(getValue)(row.index)}_${index}`,
630
- class: vue.normalizeClass({ "bg-p-blue-20": index === 1 })
630
+ key: `${vue.unref(getValue)(row.index)}_${index2}`,
631
+ class: vue.normalizeClass({ "bg-p-blue-20": index2 === 1 })
631
632
  }, vue.toDisplayString(str), 3);
632
633
  }), 128))
633
634
  ], 8, _hoisted_5$2)
@@ -715,9 +716,9 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
715
716
  ths
716
717
  });
717
718
  const tbodyElement = vue.ref(null);
718
- const updateThsRefs = (el, index) => {
719
+ const updateThsRefs = (el, index2) => {
719
720
  if (el instanceof Element) {
720
- ths.value[index] = el;
721
+ ths.value[index2] = el;
721
722
  }
722
723
  };
723
724
  const emitScroll = (e) => {
@@ -968,7 +969,7 @@ exports.PDropdownSelect = pDropdownSelect_vue_vue_type_script_setup_true_lang._s
968
969
  exports.useInputClasses = useInputClasses.useInputClasses;
969
970
  exports.P_ICON_ALIASES = pIcon.P_ICON_ALIASES;
970
971
  exports.PIcon = pIcon_vue_vue_type_script_setup_true_lang._sfc_main;
971
- exports.PInfoIcon = pInfoIcon;
972
+ exports.PInfoIcon = pInfoIcon_vue_vue_type_script_setup_true_lang._sfc_main;
972
973
  exports.PInlineDatePicker = pInlineDatePicker_vue_vue_type_script_setup_true_lang._sfc_main;
973
974
  exports.PInput = pInput;
974
975
  exports.PInputNumber = pInputNumber;
@@ -1006,27 +1007,12 @@ exports.PTabs = pTabs_vue_vue_type_script_setup_true_lang._sfc_main;
1006
1007
  exports.PTextarea = pTextarea;
1007
1008
  exports.PToggle = pToggle;
1008
1009
  exports.squirrelTailwindConfig = config.squirrelTailwindConfig;
1010
+ exports.SIZES = pBtn_types.SIZES;
1009
1011
  exports.CURRENCY_INPUT_DEFAULTS = currency.CURRENCY_INPUT_DEFAULTS;
1010
1012
  exports.getNextActiveElement = dom.getNextActiveElement;
1011
1013
  exports.isElement = dom.isElement;
1012
1014
  exports.isVisible = dom.isVisible;
1013
1015
  exports.inputClassesMixin = inputClassesMixin;
1014
- exports.ERROR_MSG = inputClassesShared.ERROR_MSG;
1015
- exports.INPUT_BASE = inputClassesShared.INPUT_BASE;
1016
- exports.INPUT_ERROR = inputClassesShared.INPUT_ERROR;
1017
- exports.INPUT_NORMAL = inputClassesShared.INPUT_NORMAL;
1018
- exports.INPUT_SIZES = inputClassesShared.INPUT_SIZES;
1019
- exports.LABEL_BASE = inputClassesShared.LABEL_BASE;
1020
- exports.LABEL_REQUIRED = inputClassesShared.LABEL_REQUIRED;
1021
- exports.LABEL_SIZES = inputClassesShared.LABEL_SIZES;
1022
- exports.SELECT_ARROW = inputClassesShared.SELECT_ARROW;
1023
- exports.SELECT_BASE = inputClassesShared.SELECT_BASE;
1024
- exports.SELECT_SIZES = inputClassesShared.SELECT_SIZES;
1025
- exports.SPACING_LEFT = inputClassesShared.SPACING_LEFT;
1026
- exports.SPACING_PREFIX = inputClassesShared.SPACING_PREFIX;
1027
- exports.SPACING_RIGHT = inputClassesShared.SPACING_RIGHT;
1028
- exports.SPACING_SUFFIX = inputClassesShared.SPACING_SUFFIX;
1029
- exports.TEXTAREA_BASE = inputClassesShared.TEXTAREA_BASE;
1030
1016
  exports.setupListKeyboardNavigation = listKeyboardNavigation.setupListKeyboardNavigation;
1031
1017
  exports.toNumberOrNull = number.toNumberOrNull;
1032
1018
  exports.isObject = object.isObject;
@@ -1035,6 +1021,12 @@ exports.sanitizeUrl = sanitization.sanitizeUrl;
1035
1021
  exports.getColor = tailwind.getColor;
1036
1022
  exports.getColorDeep = tailwind.getColorDeep;
1037
1023
  exports.getScreen = tailwind.getScreen;
1024
+ exports.cn = index.M;
1025
+ exports.cnBase = index.N;
1026
+ exports.createTV = index.fe;
1027
+ exports.defaultConfig = index.ie;
1028
+ exports.tv = index.ce;
1029
+ exports.voidEmpty = index.x;
1038
1030
  exports.PFileUpload = pFileUpload;
1039
1031
  exports.PSelectList = _sfc_main$2;
1040
1032
  exports.PTable = pTable;
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const index = require("./chunks/index.js");
4
+ const inputClasses = index.ce({
5
+ slots: {
6
+ input: "w-full rounded border-0 bg-surface text-night ring-1 ring-inset ring-p-gray-30 placeholder:text-p-gray-40 hover:ring-primary focus:outline-none focus:ring-2 focus:ring-primary disabled:cursor-default disabled:bg-p-blue-10 disabled:ring-p-gray-30 disabled:hover:ring-p-gray-30",
7
+ label: "mb-1 block font-medium",
8
+ errorMessage: "mt-1 text-xs text-on-error"
9
+ },
10
+ variants: {
11
+ size: {
12
+ sm: {
13
+ input: "h-8 pl-3 pr-3 text-sm",
14
+ label: "text-xs"
15
+ },
16
+ md: {
17
+ input: "h-10 pl-4 pr-4 text-base",
18
+ label: "text-sm"
19
+ },
20
+ lg: {
21
+ input: "h-12 pl-5 pr-5 text-lg",
22
+ label: "text-base"
23
+ }
24
+ },
25
+ prefix: {
26
+ true: "pl-8"
27
+ },
28
+ suffix: {
29
+ true: "pr-6"
30
+ },
31
+ required: {
32
+ true: {
33
+ label: `after:text-on-error after:content-["_*"]`
34
+ }
35
+ },
36
+ error: {
37
+ true: {
38
+ input: "ring-on-error hover:ring-on-error focus:ring-on-error"
39
+ }
40
+ },
41
+ rounded: {
42
+ true: "rounded-full"
43
+ }
44
+ },
45
+ compoundVariants: [
46
+ {
47
+ size: "sm",
48
+ prefix: true,
49
+ class: {
50
+ input: "pl-6"
51
+ }
52
+ },
53
+ {
54
+ size: "md",
55
+ prefix: true,
56
+ class: {
57
+ input: "pl-8"
58
+ }
59
+ },
60
+ {
61
+ size: "lg",
62
+ prefix: true,
63
+ class: {
64
+ input: "pl-12"
65
+ }
66
+ },
67
+ {
68
+ size: "sm",
69
+ suffix: true,
70
+ class: {
71
+ input: "pr-6"
72
+ }
73
+ },
74
+ {
75
+ size: "md",
76
+ suffix: true,
77
+ class: {
78
+ input: "pr-8"
79
+ }
80
+ },
81
+ {
82
+ size: "lg",
83
+ suffix: true,
84
+ class: {
85
+ input: "pr-12"
86
+ }
87
+ }
88
+ ],
89
+ defaultVariants: {
90
+ size: "md"
91
+ }
92
+ });
93
+ const textareaClasses = index.ce({
94
+ extend: inputClasses,
95
+ slots: {
96
+ input: "resize-y overflow-auto px-3 py-3"
97
+ },
98
+ variants: {
99
+ size: {
100
+ md: {
101
+ input: "h-auto"
102
+ }
103
+ }
104
+ }
105
+ });
106
+ const selectClasses = index.ce({
107
+ extend: inputClasses,
108
+ slots: {
109
+ input: "squirrel-bg-chevron-down appearance-none truncate bg-no-repeat"
110
+ },
111
+ variants: {
112
+ size: {
113
+ sm: {
114
+ input: "bg-[right_0.675rem_center] pr-8"
115
+ },
116
+ md: {
117
+ input: "bg-[right_1rem_center] pr-10"
118
+ },
119
+ lg: {
120
+ input: "bg-[right_1.25rem_center] pr-12"
121
+ }
122
+ }
123
+ }
124
+ });
125
+ exports.inputClasses = inputClasses;
126
+ exports.selectClasses = selectClasses;
127
+ exports.textareaClasses = textareaClasses;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
- const inputClassesShared = require("./inputClassesShared.js");
2
+ const pBtn_types = require("./chunks/p-btn.types.js");
3
+ const inputClasses = require("./inputClasses.js");
3
4
  const vue = require("vue");
4
5
  const inputClassesMixin = vue.defineComponent({
5
6
  props: {
@@ -7,7 +8,7 @@ const inputClassesMixin = vue.defineComponent({
7
8
  type: String,
8
9
  default: "md",
9
10
  validator(value) {
10
- return Object.keys(inputClassesShared.INPUT_SIZES).includes(value);
11
+ return pBtn_types.SIZES.includes(value);
11
12
  }
12
13
  },
13
14
  errorMsg: {
@@ -23,31 +24,34 @@ const inputClassesMixin = vue.defineComponent({
23
24
  default: false
24
25
  }
25
26
  },
26
- data() {
27
- return {
28
- errorMsgClasses: inputClassesShared.ERROR_MSG
29
- };
30
- },
31
27
  computed: {
28
+ allClasses() {
29
+ const { input, label, errorMessage } = inputClasses.inputClasses({
30
+ size: this.size,
31
+ prefix: !!this.$slots.prefix,
32
+ suffix: !!this.$slots.suffix,
33
+ required: this.required,
34
+ error: !!this.errorMsg,
35
+ rounded: this.rounded
36
+ });
37
+ return { input: input(), label: label(), errorMessage: errorMessage() };
38
+ },
32
39
  inputClasses() {
33
- const base = `${inputClassesShared.INPUT_BASE} ${inputClassesShared.INPUT_SIZES[this.size]}`;
34
- const spacingLeft = this.$slots.prefix ? inputClassesShared.SPACING_PREFIX[this.size] : inputClassesShared.SPACING_LEFT[this.size];
35
- const spacingRight = this.$slots.suffix ? inputClassesShared.SPACING_SUFFIX[this.size] : inputClassesShared.SPACING_RIGHT[this.size];
36
- const res = `${base} ${spacingLeft} ${spacingRight} ${this.errorMsg ? inputClassesShared.INPUT_ERROR : inputClassesShared.INPUT_NORMAL}${this.rounded ? " rounded-full" : ""}`;
37
- return res;
40
+ return this.allClasses.input;
38
41
  },
39
42
  labelClasses() {
40
- const base = `${inputClassesShared.LABEL_BASE} ${inputClassesShared.LABEL_SIZES[this.size]}`;
41
- const res = this.required ? `${base} ${inputClassesShared.LABEL_REQUIRED}` : base;
42
- return res;
43
+ return this.allClasses.label;
44
+ },
45
+ errorMsgClasses() {
46
+ return this.allClasses.errorMessage;
43
47
  },
44
48
  selectClasses() {
45
- const res = `${this.inputClasses.replace(` ${inputClassesShared.SPACING_RIGHT[this.size]}`, "")} ${inputClassesShared.SELECT_BASE} ${inputClassesShared.SELECT_ARROW} ${inputClassesShared.SELECT_SIZES[this.size]}`;
46
- return res;
49
+ const { input } = inputClasses.selectClasses({ size: this.size, required: this.required, error: !!this.errorMsg });
50
+ return input();
47
51
  },
48
52
  textareaClasses() {
49
- const res = `${this.inputClasses} ${inputClassesShared.TEXTAREA_BASE}`;
50
- return res;
53
+ const { input } = inputClasses.textareaClasses({ required: this.required, error: !!this.errorMsg });
54
+ return input();
51
55
  }
52
56
  }
53
57
  });
package/dist/cjs/p-btn.js CHANGED
@@ -1,58 +1,60 @@
1
1
  "use strict";
2
+ const pBtn_types = require("./chunks/p-btn.types.js");
2
3
  const pRingLoader_vue_vue_type_script_setup_true_lang = require("./chunks/p-ring-loader.js");
3
4
  const link = require("./link.js");
4
5
  const sanitization = require("./sanitization.js");
6
+ const index = require("./chunks/index.js");
5
7
  const vue = require("vue");
6
8
  const vueRouter = require("vue-router");
7
9
  const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
8
- const BUTTON_TYPES = {
9
- PRIMARY: "primary",
10
- SECONDARY: "secondary",
11
- PRIMARY_OUTLINE: "primary-outline",
12
- SECONDARY_OUTLINE: "secondary-outline",
13
- SECONDARY_OUTLINE_BLUE: "secondary-outline-blue",
14
- ERROR: "error",
15
- SUCCESS: "success",
16
- PRIMARY_LINK: "primary-link",
17
- SECONDARY_GHOST: "secondary-ghost",
18
- SECONDARY_GHOST_DARK: "secondary-ghost-dark"
10
+ const btnClasses = {
11
+ slots: {
12
+ button: "relative inline-block rounded font-medium outline-none disabled:pointer-events-none disabled:cursor-default disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:cursor-default aria-disabled:opacity-50",
13
+ loader: "absolute bottom-0 left-0 right-0 top-0 flex items-center justify-center font-medium"
14
+ },
15
+ variants: {
16
+ type: {
17
+ primary: {
18
+ button: "bg-primary text-surface hover:bg-accent active:bg-p-blue-80",
19
+ loader: "text-surface"
20
+ },
21
+ secondary: {
22
+ button: "bg-p-gray-20 hover:bg-p-gray-30 active:bg-p-gray-40",
23
+ loader: "text-p-purple-60"
24
+ },
25
+ "primary-outline": {
26
+ button: "bg-p-blue-10 text-p-purple-60 ring-1 ring-inset ring-p-purple-60 hover:bg-p-gray-20",
27
+ loader: "text-p-purple-60"
28
+ },
29
+ "secondary-outline": {
30
+ button: "bg-surface text-p-purple-60 ring-1 ring-inset ring-p-gray-30 hover:bg-p-blue-10 aria-selected:bg-p-blue-10",
31
+ loader: "text-p-purple-60"
32
+ },
33
+ "secondary-outline-blue": {
34
+ button: "bg-surface text-p-purple-60 ring-1 ring-inset ring-p-gray-30 hover:bg-p-blue-10 aria-selected:bg-p-blue-15 aria-selected:text-p-blue-60",
35
+ loader: "text-p-purple-60"
36
+ },
37
+ error: { button: "bg-p-red-40 text-white hover:bg-p-red-50", loader: "text-white" },
38
+ success: { button: "bg-p-green-40 text-white hover:bg-p-green-50", loader: "text-white" },
39
+ "primary-link": { button: "bg-transparent text-primary underline hover:text-accent", loader: "text-p-blue-60" },
40
+ "secondary-ghost": { button: "text-on-surface hover:bg-p-gray-20", loader: "text-p-purple-60" },
41
+ "secondary-ghost-dark": { button: "text-white hover:bg-p-purple-50", loader: "text-p-blue-15" }
42
+ },
43
+ size: {
44
+ sm: { button: "px-2 py-1 text-sm" },
45
+ md: { button: "px-6 py-2 text-base" },
46
+ lg: { button: "px-6 py-2.5 text-lg" }
47
+ }
48
+ },
49
+ defaultVariants: {
50
+ type: "primary",
51
+ size: "md"
52
+ }
19
53
  };
54
+ const btn = index.ce(btnClasses);
55
+ const BUTTON_TYPES = Object.keys(btnClasses.variants.type);
20
56
  const BUTTON_NATIVE_TYPES = ["button", "submit", "reset"];
21
- const DEFAULT_CLASSES = `relative inline-block outline-none disabled:opacity-50 disabled:cursor-default disabled:pointer-events-none aria-disabled:opacity-50 aria-disabled:cursor-default aria-disabled:pointer-events-none`;
22
- const BUTTON_CLASSES = {
23
- [BUTTON_TYPES.PRIMARY]: "text-surface bg-primary hover:bg-accent active:bg-p-blue-80",
24
- [BUTTON_TYPES.SECONDARY]: "bg-p-gray-20 hover:bg-p-gray-30 active:bg-p-gray-40",
25
- [BUTTON_TYPES.PRIMARY_OUTLINE]: "text-p-purple-60 bg-p-blue-10 ring-1 ring-inset ring-p-purple-60 hover:bg-p-gray-20",
26
- [BUTTON_TYPES.SECONDARY_OUTLINE]: "text-p-purple-60 bg-surface ring-1 ring-inset ring-p-gray-30 hover:bg-p-blue-10 aria-selected:bg-p-blue-10",
27
- [BUTTON_TYPES.SECONDARY_OUTLINE_BLUE]: "text-p-purple-60 bg-surface ring-1 ring-inset ring-p-gray-30 hover:bg-p-blue-10 aria-selected:bg-p-blue-15 aria-selected:text-p-blue-60",
28
- [BUTTON_TYPES.ERROR]: "text-white bg-p-red-40 hover:bg-p-red-50",
29
- [BUTTON_TYPES.SUCCESS]: "text-white bg-p-green-40 hover:bg-p-green-50",
30
- [BUTTON_TYPES.PRIMARY_LINK]: "text-primary bg-transparent hover:text-accent underline",
31
- [BUTTON_TYPES.SECONDARY_GHOST]: "text-on-surface hover:bg-p-gray-20",
32
- [BUTTON_TYPES.SECONDARY_GHOST_DARK]: "text-white hover:bg-p-purple-50"
33
- };
34
- const BUTTON_SIZES = {
35
- sm: "py-1 px-2 rounded font-medium text-sm",
36
- md: "py-2 px-6 rounded font-medium text-base",
37
- lg: "py-3 px-6 rounded font-medium text-lg"
38
- };
39
- const LOADER_SIZES = {
40
- sm: 24,
41
- md: 30,
42
- lg: 40
43
- };
44
- const LOADER_COLORS = {
45
- [BUTTON_TYPES.PRIMARY]: "var(--color-p-blue-15)",
46
- [BUTTON_TYPES.SECONDARY]: "var(--color-p-purple-60)",
47
- [BUTTON_TYPES.PRIMARY_OUTLINE]: "var(--color-p-blue-60)",
48
- [BUTTON_TYPES.SECONDARY_OUTLINE]: "var(--color-p-purple-60)",
49
- [BUTTON_TYPES.SECONDARY_OUTLINE_BLUE]: "var(--color-p-purple-60)",
50
- [BUTTON_TYPES.ERROR]: "var(--color-p-blue-15)",
51
- [BUTTON_TYPES.SUCCESS]: "var(--color-p-blue-15)",
52
- [BUTTON_TYPES.PRIMARY_LINK]: "var(--color-p-blue-60)",
53
- [BUTTON_TYPES.SECONDARY_GHOST]: "var(--color-p-purple-60)",
54
- [BUTTON_TYPES.SECONDARY_GHOST_DARK]: "var(--color-p-blue-15)"
55
- };
57
+ const LOADER_SIZES = { sm: 24, md: 30, lg: 40 };
56
58
  const _sfc_main = vue.defineComponent({
57
59
  name: "PBtn",
58
60
  components: {
@@ -68,7 +70,7 @@ const _sfc_main = vue.defineComponent({
68
70
  type: String,
69
71
  default: "primary",
70
72
  validator(value) {
71
- return Object.values(BUTTON_TYPES).includes(value);
73
+ return BUTTON_TYPES.includes(value);
72
74
  }
73
75
  },
74
76
  /**
@@ -88,7 +90,7 @@ const _sfc_main = vue.defineComponent({
88
90
  type: String,
89
91
  default: "md",
90
92
  validator(value) {
91
- return Object.keys(BUTTON_SIZES).includes(value);
93
+ return pBtn_types.SIZES.includes(value);
92
94
  }
93
95
  },
94
96
  /**
@@ -116,13 +118,11 @@ const _sfc_main = vue.defineComponent({
116
118
  },
117
119
  computed: {
118
120
  classes() {
119
- return `${DEFAULT_CLASSES} ${BUTTON_SIZES[this.size]} ${BUTTON_CLASSES[this.type]}`;
121
+ const { button, loader } = btn({ type: this.type, size: this.size });
122
+ return { button: button(), loader: loader() };
120
123
  },
121
124
  loaderSize() {
122
125
  return Number(`${LOADER_SIZES[this.size]}`);
123
- },
124
- loaderColor() {
125
- return LOADER_COLORS[this.type];
126
126
  }
127
127
  },
128
128
  methods: {
@@ -136,7 +136,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
136
136
  return typeof _ctx.to === "string" && _ctx.isExternalLink(_ctx.to) ? (vue.openBlock(), vue.createElementBlock("a", vue.mergeProps({ key: 0 }, _ctx.$attrs, {
137
137
  href: _ctx.sanitizeUrl(_ctx.to),
138
138
  target: "_blank",
139
- class: _ctx.classes,
139
+ class: _ctx.classes.button,
140
140
  disabled: !!_ctx.$attrs.disabled ? true : null,
141
141
  "aria-disabled": !!_ctx.$attrs.disabled
142
142
  }), [
@@ -146,7 +146,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
146
146
  type: _ctx.to ? null : _ctx.nativeType,
147
147
  to: _ctx.to ? _ctx.to : null,
148
148
  "aria-selected": _ctx.selected,
149
- class: _ctx.classes
149
+ class: _ctx.classes.button
150
150
  }, _ctx.$attrs, {
151
151
  disabled: !!_ctx.$attrs.disabled || _ctx.loading ? true : null,
152
152
  "aria-disabled": _ctx.$attrs.disabled
@@ -159,10 +159,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
159
159
  ], 2),
160
160
  _ctx.loading ? (vue.openBlock(), vue.createBlock(_component_PRingLoader, {
161
161
  key: 0,
162
- color: _ctx.loaderColor,
163
162
  size: _ctx.loaderSize,
164
- class: "absolute bottom-0 left-0 right-0 top-0 flex items-center justify-center"
165
- }, null, 8, ["color", "size"])) : vue.createCommentVNode("", true)
163
+ class: vue.normalizeClass(_ctx.classes.loader)
164
+ }, null, 8, ["size", "class"])) : vue.createCommentVNode("", true)
166
165
  ]),
167
166
  _: 3
168
167
  }, 16, ["type", "to", "aria-selected", "class", "disabled", "aria-disabled"]));
@@ -29,6 +29,11 @@ const P_ICON_ALIASES = {
29
29
  more: "lineicons:more-alt",
30
30
  filters: "mage:filter",
31
31
  "bar-chart": "material-symbols:bar-chart-4-bars-rounded",
32
- list: "material-symbols:format-list-bulleted"
32
+ list: "material-symbols:format-list-bulleted",
33
+ formula: "fluent:math-formula-20-filled",
34
+ refresh: "ri:loop-left-line",
35
+ download: "tdesign:download",
36
+ upload: "tdesign:upload",
37
+ info: "streamline:information-circle"
33
38
  };
34
39
  exports.P_ICON_ALIASES = P_ICON_ALIASES;
@@ -1,34 +1,3 @@
1
1
  "use strict";
2
- const vue = require("vue");
3
- const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
4
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
5
- ...{
6
- name: "PInfoIcon"
7
- },
8
- __name: "p-info-icon",
9
- props: {
10
- text: { default: null }
11
- },
12
- setup(__props) {
13
- return (_ctx, _cache) => {
14
- const _component_VTooltip = vue.resolveComponent("VTooltip");
15
- return vue.openBlock(), vue.createBlock(_component_VTooltip, {
16
- "popper-triggers": ["hover"],
17
- delay: { show: 750, hide: 0 },
18
- disabled: !_ctx.$slots.default && !_ctx.text
19
- }, {
20
- popper: vue.withCtx(() => [
21
- vue.renderSlot(_ctx.$slots, "default", {}, () => [
22
- vue.createTextVNode(vue.toDisplayString(_ctx.text), 1)
23
- ], true)
24
- ]),
25
- default: vue.withCtx(() => [
26
- _cache[0] || (_cache[0] = vue.createElementVNode("i", { class: "bg-info-circle-icon block h-3 w-3" }, null, -1))
27
- ]),
28
- _: 3
29
- }, 8, ["disabled"]);
30
- };
31
- }
32
- });
33
- const PInfoIcon = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-804e74f5"]]);
34
- module.exports = PInfoIcon;
2
+ const pInfoIcon_vue_vue_type_script_setup_true_lang = require("./chunks/p-info-icon.js");
3
+ module.exports = pInfoIcon_vue_vue_type_script_setup_true_lang._sfc_main;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const pInfoIcon = require("./p-info-icon.js");
2
+ const pInfoIcon_vue_vue_type_script_setup_true_lang = require("./chunks/p-info-icon.js");
3
3
  const inputClassesMixin = require("./inputClassesMixin.js");
4
4
  const number = require("./number.js");
5
5
  const lodashEs = require("lodash-es");
@@ -22,7 +22,7 @@ const ALL_OPTIONS = [
22
22
  const _sfc_main = vue.defineComponent({
23
23
  name: "PInputNumber",
24
24
  components: {
25
- PInfoIcon: pInfoIcon
25
+ PInfoIcon: pInfoIcon_vue_vue_type_script_setup_true_lang._sfc_main
26
26
  },
27
27
  mixins: [inputClassesMixin],
28
28
  inheritAttrs: false,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
+ const pBtn_types = require("./chunks/p-btn.types.js");
2
3
  const pInput = require("./p-input.js");
3
- const inputClassesShared = require("./inputClassesShared.js");
4
4
  const vue = require("vue");
5
5
  const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
6
6
  const _sfc_main = vue.defineComponent({
@@ -18,7 +18,7 @@ const _sfc_main = vue.defineComponent({
18
18
  type: String,
19
19
  default: "md",
20
20
  validator(value) {
21
- return Object.keys(inputClassesShared.INPUT_SIZES).includes(value);
21
+ return pBtn_types.SIZES.includes(value);
22
22
  }
23
23
  },
24
24
  showEnterIcon: {
@@ -108,5 +108,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
108
108
  _: 1
109
109
  }, 16, ["modelValue", "size", "onKeydown"]);
110
110
  }
111
- const PInputSearch = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-2674242c"]]);
111
+ const PInputSearch = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-78b7a6f8"]]);
112
112
  module.exports = PInputSearch;