@pequity/squirrel 6.0.12 → 6.0.14

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 (69) 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-select.js +2 -2
  4. package/dist/cjs/index.js +49 -52
  5. package/dist/cjs/inputClasses.js +129 -0
  6. package/dist/cjs/inputClassesMixin.js +23 -19
  7. package/dist/cjs/p-btn.js +56 -57
  8. package/dist/cjs/p-input-search.js +3 -3
  9. package/dist/cjs/useInputClasses.js +19 -18
  10. package/dist/es/chunks/index.js +2646 -0
  11. package/dist/es/chunks/p-btn.types.js +4 -0
  12. package/dist/es/chunks/p-select.js +2 -2
  13. package/dist/es/index.js +75 -78
  14. package/dist/es/inputClasses.js +129 -0
  15. package/dist/es/inputClassesMixin.js +23 -19
  16. package/dist/es/p-btn.js +56 -57
  17. package/dist/es/p-input-search.js +3 -3
  18. package/dist/es/useInputClasses.js +23 -22
  19. package/dist/squirrel/components/p-btn/p-btn.types.d.ts +2 -1
  20. package/dist/squirrel/components/p-btn/p-btn.vue.d.ts +395 -17
  21. package/dist/squirrel/components/p-dropdown-select/p-dropdown-select.vue.d.ts +30 -22
  22. package/dist/squirrel/components/p-input/p-input.vue.d.ts +11 -7
  23. package/dist/squirrel/components/p-input-number/p-input-number.vue.d.ts +11 -7
  24. package/dist/squirrel/components/p-input-percent/p-input-percent.vue.d.ts +3 -3
  25. package/dist/squirrel/components/p-input-search/p-input-search.vue.d.ts +16 -12
  26. package/dist/squirrel/components/p-select/p-select.vue.d.ts +5 -5
  27. package/dist/squirrel/components/p-select-list/p-select-list.vue.d.ts +30 -22
  28. package/dist/squirrel/components/p-table-header-cell/p-table-header-cell.vue.d.ts +1 -1
  29. package/dist/squirrel/components/p-textarea/p-textarea.vue.d.ts +11 -7
  30. package/dist/squirrel/components/p-toggle/p-toggle.vue.d.ts +11 -7
  31. package/dist/squirrel/composables/useInputClasses.d.ts +3 -3
  32. package/dist/squirrel/index.d.ts +1 -0
  33. package/dist/squirrel/utils/index.d.ts +2 -2
  34. package/dist/squirrel/utils/inputClasses.d.ts +988 -0
  35. package/dist/squirrel/utils/inputClassesMixin.d.ts +12 -8
  36. package/dist/squirrel.css +15 -22
  37. package/package.json +22 -19
  38. package/squirrel/assets/squirrel.css +1 -1
  39. package/squirrel/components/p-action-bar/p-action-bar.stories.js +1 -2
  40. package/squirrel/components/p-btn/p-btn.spec.js +1 -1
  41. package/squirrel/components/p-btn/p-btn.types.ts +3 -1
  42. package/squirrel/components/p-btn/p-btn.vue +60 -74
  43. package/squirrel/components/p-file-upload/p-file-upload.spec.js +3 -8
  44. package/squirrel/components/p-file-upload/p-file-upload.vue +6 -16
  45. package/squirrel/components/p-inline-date-picker/p-inline-date-picker.spec.js +3 -10
  46. package/squirrel/components/p-input/p-input.spec.js +3 -8
  47. package/squirrel/components/p-input-number/p-input-number.spec.js +15 -18
  48. package/squirrel/components/p-input-percent/p-input-percent.spec.js +3 -8
  49. package/squirrel/components/p-input-percent/p-input-percent.vue +3 -3
  50. package/squirrel/components/p-input-search/p-input-search.vue +4 -4
  51. package/squirrel/components/p-select/p-select.spec.js +28 -34
  52. package/squirrel/components/p-select/p-select.vue +4 -4
  53. package/squirrel/components/p-tabs/p-tabs.stories.js +2 -2
  54. package/squirrel/components/p-textarea/p-textarea.spec.js +3 -8
  55. package/squirrel/composables/useInputClasses.spec.js +138 -77
  56. package/squirrel/composables/useInputClasses.ts +25 -39
  57. package/squirrel/index.ts +1 -0
  58. package/squirrel/utils/index.ts +3 -36
  59. package/squirrel/utils/inputClasses.ts +130 -0
  60. package/squirrel/utils/inputClassesMixin.spec.js +153 -64
  61. package/squirrel/utils/inputClassesMixin.ts +26 -43
  62. package/dist/cjs/inputClassesShared.js +0 -76
  63. package/dist/es/inputClassesShared.js +0 -76
  64. package/dist/squirrel/utils/inputClassesShared.d.ts +0 -45
  65. package/squirrel/assets/file-upload-drag-over-icon.svg +0 -5
  66. package/squirrel/assets/file-upload-upload-icon.svg +0 -5
  67. package/squirrel/assets/file-upload-x-icon-hover.svg +0 -8
  68. package/squirrel/assets/file-upload-x-icon.svg +0 -8
  69. package/squirrel/utils/inputClassesShared.ts +0 -75
@@ -0,0 +1,4 @@
1
+ const SIZES = ["sm", "md", "lg"];
2
+ export {
3
+ SIZES as S
4
+ };
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, useAttrs, computed, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, renderSlot, createElementVNode, withDirectives, createCommentVNode, toDisplayString, mergeProps, Fragment, renderList, vShow } from "vue";
2
+ import { S as SIZES } from "./p-btn.types.js";
2
3
  import { useInputClasses } from "../useInputClasses.js";
3
- import { INPUT_SIZES } from "../inputClassesShared.js";
4
4
  const _hoisted_1 = ["data-has-error"];
5
5
  const _hoisted_2 = ["value"];
6
6
  const _hoisted_3 = ["value"];
@@ -36,7 +36,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
36
36
  type: String,
37
37
  default: "md",
38
38
  validator(value) {
39
- return Object.keys(INPUT_SIZES).includes(value);
39
+ return SIZES.includes(value);
40
40
  }
41
41
  },
42
42
  itemText: {
package/dist/es/index.js CHANGED
@@ -9,33 +9,32 @@ import { default as default7 } from "./p-close-btn.js";
9
9
  import { _ as _3 } from "./chunks/p-date-picker.js";
10
10
  import { default as default8 } from "./p-drawer.js";
11
11
  import { default as default9 } from "./p-dropdown.js";
12
- import { _ as _imports_0$2 } from "./chunks/p-dropdown-select.js";
12
+ import { _ as _imports_0$1 } from "./chunks/p-dropdown-select.js";
13
13
  import { a } from "./chunks/p-dropdown-select.js";
14
- import { defineComponent, shallowRef, ref, computed, onMounted, createElementBlock, openBlock, normalizeClass, createCommentVNode, createElementVNode, withDirectives, unref, toDisplayString, withModifiers, createTextVNode, Fragment, renderList, vShow, useAttrs, resolveDirective, normalizeStyle, createVNode, isRef, renderSlot, provide, onBeforeUnmount, watch, mergeProps, toHandlers } from "vue";
14
+ import { defineComponent, shallowRef, ref, computed, onMounted, createElementBlock, openBlock, normalizeClass, createCommentVNode, createElementVNode, withDirectives, unref, toDisplayString, withModifiers, createVNode, createTextVNode, Fragment, renderList, vShow, useAttrs, resolveDirective, normalizeStyle, isRef, renderSlot, provide, onBeforeUnmount, watch, mergeProps, toHandlers } from "vue";
15
15
  import { formatBytes, getFileExtension } from "./p-file-upload.js";
16
+ import { _ as _sfc_main$4 } from "./chunks/p-icon.js";
16
17
  import { useInputClasses } from "./useInputClasses.js";
17
18
  import { uniq, kebabCase } from "lodash-es";
18
19
  import { useToast } from "vue-toastification";
19
- import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
20
20
  import { P_ICON_ALIASES } from "./p-icon.js";
21
- import { _ as _4 } from "./chunks/p-icon.js";
22
- import { _ as _5 } from "./chunks/p-info-icon.js";
23
- import { _ as _6 } from "./chunks/p-inline-date-picker.js";
21
+ import { _ as _4 } from "./chunks/p-info-icon.js";
22
+ import { _ as _5 } from "./chunks/p-inline-date-picker.js";
24
23
  import { default as default10 } from "./p-input.js";
25
24
  import { default as default11 } from "./p-input-number.js";
26
- import { _ as _7 } from "./chunks/p-input-percent.js";
25
+ import { _ as _6 } from "./chunks/p-input-percent.js";
27
26
  import PInputSearch from "./p-input-search.js";
28
- import { _ as _8 } from "./chunks/p-link.js";
27
+ import { _ as _7 } from "./chunks/p-link.js";
29
28
  import { default as default12 } from "./p-loading.js";
30
29
  import { usePLoading } from "./usePLoading.js";
31
30
  import { default as default13 } from "./p-modal.js";
32
31
  import { usePModal } from "./usePModal.js";
33
- import { _ as _9 } from "./chunks/p-pagination.js";
34
- import { _ as _10 } from "./chunks/p-pagination-info.js";
32
+ import { _ as _8 } from "./chunks/p-pagination.js";
33
+ import { _ as _9 } from "./chunks/p-pagination-info.js";
35
34
  import { default as default14 } from "./p-progress-bar.js";
36
- import { _ as _11 } from "./chunks/p-ring-loader.js";
37
- import { _ as _12 } from "./chunks/p-select.js";
38
- import { _ as _13 } from "./chunks/p-select-btn.js";
35
+ import { _ as _10 } from "./chunks/p-ring-loader.js";
36
+ import { _ as _11 } from "./chunks/p-select.js";
37
+ import { _ as _12 } from "./chunks/p-select-btn.js";
39
38
  import { SIZES } from "./p-select-list.js";
40
39
  import { useSelectList } from "./useSelectList.js";
41
40
  import { toString } from "./string.js";
@@ -46,27 +45,27 @@ import { colsInjectionKey, isFirstColFixedInjectionKey, isLastColFixedInjectionK
46
45
  import { MIN_WIDTH_COL_RESIZE } from "./p-table.js";
47
46
  import { usePTableColResize } from "./usePTableColResize.js";
48
47
  import PTableHeaderCell from "./p-table-header-cell.js";
48
+ import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
49
49
  import { usePTableRowVirtualizer } from "./usePTableRowVirtualizer.js";
50
50
  import { default as default17 } from "./p-table-filter-icon.js";
51
- import { _ as _14 } from "./chunks/p-table-loader.js";
51
+ import { _ as _13 } from "./chunks/p-table-loader.js";
52
52
  import { SORTING_TYPES } from "./p-table-sort.js";
53
53
  import { default as default18 } from "./p-table-td.js";
54
- import { _ as _15 } from "./chunks/p-tabs.js";
54
+ import { _ as _14 } from "./chunks/p-tabs.js";
55
55
  import { default as default19 } from "./p-textarea.js";
56
56
  import { default as default20 } from "./p-toggle.js";
57
57
  import { squirrelTailwindConfig } from "./config.js";
58
+ import { S } from "./chunks/p-btn.types.js";
58
59
  import { CURRENCY_INPUT_DEFAULTS } from "./currency.js";
59
60
  import { getNextActiveElement, isElement, isVisible } from "./dom.js";
60
61
  import { default as default21 } from "./inputClassesMixin.js";
61
- import { ERROR_MSG, INPUT_BASE, INPUT_ERROR, INPUT_NORMAL, INPUT_SIZES, LABEL_BASE, LABEL_REQUIRED, LABEL_SIZES, SELECT_ARROW, SELECT_BASE, SELECT_SIZES, SPACING_LEFT, SPACING_PREFIX, SPACING_RIGHT, SPACING_SUFFIX, TEXTAREA_BASE } from "./inputClassesShared.js";
62
62
  import { setupListKeyboardNavigation } from "./listKeyboardNavigation.js";
63
63
  import { toNumberOrNull } from "./number.js";
64
64
  import { isObject } from "./object.js";
65
65
  import { createPagingRange } from "./pagination.js";
66
66
  import { sanitizeUrl } from "./sanitization.js";
67
67
  import { getColor, getColorDeep, getScreen } from "./tailwind.js";
68
- 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
- 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";
68
+ import { M, N, f, i, c, x } from "./chunks/index.js";
70
69
  const _hoisted_1$3 = ["data-has-error"];
71
70
  const _hoisted_2$3 = {
72
71
  key: 0,
@@ -165,8 +164,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
165
164
  });
166
165
  const validateFiles = (filesToUpload) => {
167
166
  const res = [];
168
- for (let i = 0; i < filesToUpload.length; i++) {
169
- const file = filesToUpload[i];
167
+ for (let i2 = 0; i2 < filesToUpload.length; i2++) {
168
+ const file = filesToUpload[i2];
170
169
  const fileName = file.name || file.url;
171
170
  if (res.length + files.value.length >= props.maxNumberOfFiles) {
172
171
  toast.error(`You can only upload a maximum of ${props.maxNumberOfFiles} ${fileWord.value}.`);
@@ -198,11 +197,11 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
198
197
  };
199
198
  const uploadFile = (e) => {
200
199
  var _a, _b;
201
- const f = ((_a = e.target) == null ? void 0 : _a.files) || ((_b = e.dataTransfer) == null ? void 0 : _b.files);
202
- if (!f) {
200
+ const f2 = ((_a = e.target) == null ? void 0 : _a.files) || ((_b = e.dataTransfer) == null ? void 0 : _b.files);
201
+ if (!f2) {
203
202
  return;
204
203
  }
205
- const validatedFiles = props.fileTypes ? validateFiles(Array.from(f)) : f;
204
+ const validatedFiles = props.fileTypes ? validateFiles(Array.from(f2)) : f2;
206
205
  files.value = props.multiple ? [...files.value, ...validatedFiles] : validatedFiles;
207
206
  emit("file-added", validatedFiles);
208
207
  };
@@ -258,19 +257,21 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
258
257
  }, [
259
258
  !maxFilesReached.value ? (openBlock(), createElementBlock("div", _hoisted_2$3, [
260
259
  !isDraggingOver.value ? (openBlock(), createElementBlock("div", _hoisted_3$3, [
261
- _cache[4] || (_cache[4] = createElementVNode("img", {
262
- src: _imports_0$1,
263
- class: "h-8 w-8"
264
- }, null, -1)),
260
+ createVNode(_sfc_main$4, {
261
+ icon: "upload",
262
+ width: "32",
263
+ class: "text-p-gray-50"
264
+ }),
265
265
  createElementVNode("div", _hoisted_4$3, [
266
266
  _cache[3] || (_cache[3] = createTextVNode(" Drag or ")),
267
267
  createElementVNode("span", _hoisted_5$3, "select " + toDisplayString(fileWord.value), 1)
268
268
  ])
269
269
  ])) : (openBlock(), createElementBlock("div", _hoisted_6$3, [
270
- _cache[5] || (_cache[5] = createElementVNode("img", {
271
- src: _imports_1$1,
272
- class: "h-8 w-8"
273
- }, null, -1)),
270
+ createVNode(_sfc_main$4, {
271
+ icon: "tdesign:drag-drop",
272
+ width: "32",
273
+ class: "text-primary"
274
+ }),
274
275
  createElementVNode("div", _hoisted_7, "Drop " + toDisplayString(fileWord.value), 1)
275
276
  ])),
276
277
  createElementVNode("input", {
@@ -303,9 +304,15 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
303
304
  title: file.name
304
305
  }, toDisplayString(file.name), 9, _hoisted_10),
305
306
  createElementVNode("button", {
306
- class: "bg-file-upload-x-icon h-4 w-4 shrink-0 cursor-pointer",
307
+ class: "h-5 shrink-0 cursor-pointer overflow-hidden",
307
308
  onClick: withModifiers(($event) => removeFile(index), ["stop"])
308
- }, null, 8, _hoisted_11)
309
+ }, [
310
+ createVNode(_sfc_main$4, {
311
+ icon: "weui:close2-outlined",
312
+ width: "20",
313
+ class: "text-p-gray-60 hover:text-on-error"
314
+ })
315
+ ], 8, _hoisted_11)
309
316
  ], 2);
310
317
  }), 128))
311
318
  ])
@@ -320,7 +327,6 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
320
327
  };
321
328
  }
322
329
  });
323
- const pFileUpload = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-216025be"]]);
324
330
  const _hoisted_1$2 = ["data-has-error"];
325
331
  const _hoisted_2$2 = { class: "text-p-purple-60" };
326
332
  const _hoisted_3$2 = { class: "flex flex-row" };
@@ -329,7 +335,7 @@ const _hoisted_5$2 = ["title"];
329
335
  const _hoisted_6$2 = {
330
336
  key: 0,
331
337
  class: "ml-auto fill-p-purple-60 pl-2",
332
- src: _imports_0$2
338
+ src: _imports_0$1
333
339
  };
334
340
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
335
341
  ...{
@@ -723,17 +729,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
723
729
  const emitScroll = (e) => {
724
730
  emit("scroll", e);
725
731
  };
726
- const thDivClasses = (i) => {
732
+ const thDivClasses = (i2) => {
727
733
  const res = ["relative", "py-2"];
728
734
  res.push("border-b border-p-gray-30");
729
- if (i === 0 && props.isFirstColFixed || i === props.cols.length - 1 && props.isLastColFixed) {
735
+ if (i2 === 0 && props.isFirstColFixed || i2 === props.cols.length - 1 && props.isLastColFixed) {
730
736
  res.push("th-shadow px-4");
731
737
  } else {
732
738
  !props.colsResizable ? res.push("px-2") : res.push("pl-2 pr-4");
733
739
  }
734
740
  return res;
735
741
  };
736
- const thSubheaderClasses = (i) => {
742
+ const thSubheaderClasses = (i2) => {
737
743
  const res = [
738
744
  "flex",
739
745
  "h-6",
@@ -746,7 +752,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
746
752
  "font-medium",
747
753
  "text-p-gray-40"
748
754
  ];
749
- if (i === 0 && props.isFirstColFixed || i === props.cols.length - 1 && props.isLastColFixed) {
755
+ if (i2 === 0 && props.isFirstColFixed || i2 === props.cols.length - 1 && props.isLastColFixed) {
750
756
  res.push("th-shadow");
751
757
  }
752
758
  return res;
@@ -805,10 +811,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
805
811
  }, toHandlers(_ctx.colsResizable ? { mousemove: unref(colResize) } : {}, true)), [
806
812
  createElementVNode("thead", null, [
807
813
  createElementVNode("tr", null, [
808
- (openBlock(true), createElementBlock(Fragment, null, renderList(props.cols, (col, i) => {
814
+ (openBlock(true), createElementBlock(Fragment, null, renderList(props.cols, (col, i2) => {
809
815
  return openBlock(), createElementBlock("th", mergeProps({
810
816
  ref_for: true,
811
- ref: (el) => updateThsRefs(el, i),
817
+ ref: (el) => updateThsRefs(el, i2),
812
818
  key: col.id,
813
819
  "data-col-id": col.id
814
820
  }, col.thAttrs, {
@@ -816,7 +822,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
816
822
  class: "bg-surface"
817
823
  }), [
818
824
  createElementVNode("div", {
819
- class: normalizeClass(thDivClasses(i)),
825
+ class: normalizeClass(thDivClasses(i2)),
820
826
  style: normalizeStyle(bgColorStyle(col))
821
827
  }, [
822
828
  createElementVNode("div", _hoisted_2$1, [
@@ -826,24 +832,24 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
826
832
  "filter-active": col.filterActive,
827
833
  "show-filter-icon": col.filterable || col.sortable,
828
834
  "tooltip-text": col.tooltip,
829
- class: [{ "pl-2": i === 1 && _ctx.isFirstColFixed, "pr-2": i === _ctx.cols.length && _ctx.isLastColFixed }, "grow"],
835
+ class: [{ "pl-2": i2 === 1 && _ctx.isFirstColFixed, "pr-2": i2 === _ctx.cols.length && _ctx.isLastColFixed }, "grow"],
830
836
  "text-color": headerCellTextColor(col),
831
837
  ref_for: true
832
838
  }, col.headerCellAttrs, {
833
839
  onClickFilterIcon: ($event) => _ctx.$emit("click-filter-icon", $event, col)
834
840
  }), null, 16, ["text", "filter-active", "show-filter-icon", "tooltip-text", "class", "text-color", "onClickFilterIcon"])
835
841
  ]),
836
- _ctx.colsResizable && i !== 0 && !(i === _ctx.cols.length - 1 && _ctx.isLastColFixed) ? (openBlock(), createElementBlock("div", {
842
+ _ctx.colsResizable && i2 !== 0 && !(i2 === _ctx.cols.length - 1 && _ctx.isLastColFixed) ? (openBlock(), createElementBlock("div", {
837
843
  key: 0,
838
- class: normalizeClass(["absolute bottom-2 right-0 z-110 h-5 w-2 cursor-col-resize after:absolute after:bottom-0 after:z-110 after:block after:h-full after:w-2 after:cursor-col-resize after:border-r-2 after:border-dashed after:border-p-gray-30", i === _ctx.cols.length - 1 ? "after:right-0.5" : "after:right-0"]),
844
+ class: normalizeClass(["absolute bottom-2 right-0 z-110 h-5 w-2 cursor-col-resize after:absolute after:bottom-0 after:z-110 after:block after:h-full after:w-2 after:cursor-col-resize after:border-r-2 after:border-dashed after:border-p-gray-30", i2 === _ctx.cols.length - 1 ? "after:right-0.5" : "after:right-0"]),
839
845
  "data-resize-handle": "",
840
- onMousedown: ($event) => unref(colResizeStart)($event, i),
841
- onDblclick: ($event) => unref(colResizeFitToData)(i)
846
+ onMousedown: ($event) => unref(colResizeStart)($event, i2),
847
+ onDblclick: ($event) => unref(colResizeFitToData)(i2)
842
848
  }, null, 42, _hoisted_3$1)) : createCommentVNode("", true)
843
849
  ], 6),
844
850
  _ctx.subheader ? (openBlock(), createElementBlock("div", {
845
851
  key: 0,
846
- class: normalizeClass(thSubheaderClasses(i))
852
+ class: normalizeClass(thSubheaderClasses(i2))
847
853
  }, [
848
854
  renderSlot(_ctx.$slots, `subheader-cell-${unref(kebabCase)(col.name)}`, {}, void 0, true)
849
855
  ], 2)) : createCommentVNode("", true)
@@ -955,14 +961,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
955
961
  const pTableSort = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
956
962
  export {
957
963
  CURRENCY_INPUT_DEFAULTS,
958
- ERROR_MSG,
959
- INPUT_BASE,
960
- INPUT_ERROR,
961
- INPUT_NORMAL,
962
- INPUT_SIZES,
963
- LABEL_BASE,
964
- LABEL_REQUIRED,
965
- LABEL_SIZES,
966
964
  MIN_WIDTH_COL_RESIZE,
967
965
  _ as PActionBar,
968
966
  default2 as PAlert,
@@ -976,47 +974,44 @@ export {
976
974
  default8 as PDrawer,
977
975
  default9 as PDropdown,
978
976
  a as PDropdownSelect,
979
- pFileUpload as PFileUpload,
977
+ _sfc_main$3 as PFileUpload,
980
978
  default17 as PFilterIcon,
981
- _4 as PIcon,
982
- _5 as PInfoIcon,
983
- _6 as PInlineDatePicker,
979
+ _sfc_main$4 as PIcon,
980
+ _4 as PInfoIcon,
981
+ _5 as PInlineDatePicker,
984
982
  default10 as PInput,
985
983
  default11 as PInputNumber,
986
- _7 as PInputPercent,
984
+ _6 as PInputPercent,
987
985
  PInputSearch,
988
- _8 as PLink,
986
+ _7 as PLink,
989
987
  default12 as PLoading,
990
988
  default13 as PModal,
991
- _9 as PPagination,
992
- _10 as PPaginationInfo,
989
+ _8 as PPagination,
990
+ _9 as PPaginationInfo,
993
991
  default14 as PProgressBar,
994
- _11 as PRingLoader,
995
- _12 as PSelect,
996
- _13 as PSelectBtn,
992
+ _10 as PRingLoader,
993
+ _11 as PSelect,
994
+ _12 as PSelectBtn,
997
995
  _sfc_main$2 as PSelectList,
998
996
  default15 as PSelectPill,
999
997
  default16 as PSkeletonLoader,
1000
998
  pTable as PTable,
1001
999
  PTableHeaderCell,
1002
- _14 as PTableLoader,
1000
+ _13 as PTableLoader,
1003
1001
  pTableSort as PTableSort,
1004
1002
  default18 as PTableTd,
1005
- _15 as PTabs,
1003
+ _14 as PTabs,
1006
1004
  default19 as PTextarea,
1007
1005
  default20 as PToggle,
1008
1006
  P_ICON_ALIASES,
1009
- SELECT_ARROW,
1010
- SELECT_BASE,
1011
- SELECT_SIZES,
1007
+ S as SIZES,
1012
1008
  SORTING_TYPES,
1013
- SPACING_LEFT,
1014
- SPACING_PREFIX,
1015
- SPACING_RIGHT,
1016
- SPACING_SUFFIX,
1017
- TEXTAREA_BASE,
1009
+ M as cn,
1010
+ N as cnBase,
1018
1011
  colsInjectionKey,
1019
1012
  createPagingRange,
1013
+ f as createTV,
1014
+ i as defaultConfig,
1020
1015
  getColor,
1021
1016
  getColorDeep,
1022
1017
  getNextActiveElement,
@@ -1034,10 +1029,12 @@ export {
1034
1029
  squirrelTailwindConfig,
1035
1030
  toNumberOrNull,
1036
1031
  toString,
1032
+ c as tv,
1037
1033
  useInputClasses,
1038
1034
  usePLoading,
1039
1035
  usePModal,
1040
1036
  usePTableColResize,
1041
1037
  usePTableRowVirtualizer,
1042
- useSelectList
1038
+ useSelectList,
1039
+ x as voidEmpty
1043
1040
  };
@@ -0,0 +1,129 @@
1
+ import { c as ce } from "./chunks/index.js";
2
+ const inputClasses = ce({
3
+ slots: {
4
+ 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",
5
+ label: "mb-1 block font-medium",
6
+ errorMessage: "mt-1 text-xs text-on-error"
7
+ },
8
+ variants: {
9
+ size: {
10
+ sm: {
11
+ input: "h-8 pl-3 pr-3 text-sm",
12
+ label: "text-xs"
13
+ },
14
+ md: {
15
+ input: "h-10 pl-4 pr-4 text-base",
16
+ label: "text-sm"
17
+ },
18
+ lg: {
19
+ input: "h-12 pl-5 pr-5 text-lg",
20
+ label: "text-base"
21
+ }
22
+ },
23
+ prefix: {
24
+ true: "pl-8"
25
+ },
26
+ suffix: {
27
+ true: "pr-6"
28
+ },
29
+ required: {
30
+ true: {
31
+ label: `after:text-on-error after:content-["_*"]`
32
+ }
33
+ },
34
+ error: {
35
+ true: {
36
+ input: "ring-on-error hover:ring-on-error focus:ring-on-error"
37
+ }
38
+ },
39
+ rounded: {
40
+ true: {
41
+ input: "rounded-full"
42
+ }
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 = 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 = 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-[position:right_0.675rem_center] pr-8"
115
+ },
116
+ md: {
117
+ input: "bg-[position:right_1rem_center] pr-10"
118
+ },
119
+ lg: {
120
+ input: "bg-[position:right_1.25rem_center] pr-12"
121
+ }
122
+ }
123
+ }
124
+ });
125
+ export {
126
+ inputClasses,
127
+ selectClasses,
128
+ textareaClasses
129
+ };
@@ -1,4 +1,5 @@
1
- import { TEXTAREA_BASE, SELECT_BASE, SELECT_ARROW, SELECT_SIZES, SPACING_RIGHT, LABEL_BASE, LABEL_SIZES, LABEL_REQUIRED, INPUT_BASE, INPUT_SIZES, SPACING_PREFIX, SPACING_LEFT, SPACING_SUFFIX, INPUT_ERROR, INPUT_NORMAL, ERROR_MSG } from "./inputClassesShared.js";
1
+ import { S as SIZES } from "./chunks/p-btn.types.js";
2
+ import { textareaClasses, selectClasses, inputClasses } from "./inputClasses.js";
2
3
  import { defineComponent } from "vue";
3
4
  const inputClassesMixin = defineComponent({
4
5
  props: {
@@ -6,7 +7,7 @@ const inputClassesMixin = defineComponent({
6
7
  type: String,
7
8
  default: "md",
8
9
  validator(value) {
9
- return Object.keys(INPUT_SIZES).includes(value);
10
+ return SIZES.includes(value);
10
11
  }
11
12
  },
12
13
  errorMsg: {
@@ -22,31 +23,34 @@ const inputClassesMixin = defineComponent({
22
23
  default: false
23
24
  }
24
25
  },
25
- data() {
26
- return {
27
- errorMsgClasses: ERROR_MSG
28
- };
29
- },
30
26
  computed: {
27
+ allClasses() {
28
+ const { input, label, errorMessage } = inputClasses({
29
+ size: this.size,
30
+ prefix: !!this.$slots.prefix,
31
+ suffix: !!this.$slots.suffix,
32
+ required: this.required,
33
+ error: !!this.errorMsg,
34
+ rounded: this.rounded
35
+ });
36
+ return { input: input(), label: label(), errorMessage: errorMessage() };
37
+ },
31
38
  inputClasses() {
32
- const base = `${INPUT_BASE} ${INPUT_SIZES[this.size]}`;
33
- const spacingLeft = this.$slots.prefix ? SPACING_PREFIX[this.size] : SPACING_LEFT[this.size];
34
- const spacingRight = this.$slots.suffix ? SPACING_SUFFIX[this.size] : SPACING_RIGHT[this.size];
35
- const res = `${base} ${spacingLeft} ${spacingRight} ${this.errorMsg ? INPUT_ERROR : INPUT_NORMAL}${this.rounded ? " rounded-full" : ""}`;
36
- return res;
39
+ return this.allClasses.input;
37
40
  },
38
41
  labelClasses() {
39
- const base = `${LABEL_BASE} ${LABEL_SIZES[this.size]}`;
40
- const res = this.required ? `${base} ${LABEL_REQUIRED}` : base;
41
- return res;
42
+ return this.allClasses.label;
43
+ },
44
+ errorMsgClasses() {
45
+ return this.allClasses.errorMessage;
42
46
  },
43
47
  selectClasses() {
44
- const res = `${this.inputClasses.replace(` ${SPACING_RIGHT[this.size]}`, "")} ${SELECT_BASE} ${SELECT_ARROW} ${SELECT_SIZES[this.size]}`;
45
- return res;
48
+ const { input } = selectClasses({ size: this.size, required: this.required, error: !!this.errorMsg });
49
+ return input();
46
50
  },
47
51
  textareaClasses() {
48
- const res = `${this.inputClasses} ${TEXTAREA_BASE}`;
49
- return res;
52
+ const { input } = textareaClasses({ required: this.required, error: !!this.errorMsg });
53
+ return input();
50
54
  }
51
55
  }
52
56
  });