@pequity/squirrel 1.0.20-beta.2 → 1.0.20-beta.3

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 (144) hide show
  1. package/dist/cjs/chunks/_plugin-vue_export-helper.js +9 -1
  2. package/dist/cjs/chunks/p-action-bar.js +60 -1
  3. package/dist/cjs/chunks/p-card.js +28 -1
  4. package/dist/cjs/chunks/p-checkbox.js +24 -1
  5. package/dist/cjs/chunks/p-dropdown-select.js +414 -1
  6. package/dist/cjs/chunks/p-input-percent.js +53 -1
  7. package/dist/cjs/chunks/p-pagination-info.js +66 -1
  8. package/dist/cjs/chunks/p-pagination.js +122 -1
  9. package/dist/cjs/chunks/p-ring-loader.js +81 -1
  10. package/dist/cjs/chunks/p-select-btn.js +97 -1
  11. package/dist/cjs/chunks/p-select.js +123 -1
  12. package/dist/cjs/chunks/p-table-loader.js +70 -1
  13. package/dist/cjs/chunks/p-tabs.js +52 -1
  14. package/dist/cjs/config.js +105 -1
  15. package/dist/cjs/currency.js +9 -1
  16. package/dist/cjs/dom.js +27 -1
  17. package/dist/cjs/index.js +976 -1
  18. package/dist/cjs/inputClassesMixin.js +50 -1
  19. package/dist/cjs/inputClassesShared.js +76 -1
  20. package/dist/cjs/listKeyboardNavigation.js +110 -1
  21. package/dist/cjs/number.js +9 -1
  22. package/dist/cjs/object.js +4 -1
  23. package/dist/cjs/p-action-bar.js +3 -1
  24. package/dist/cjs/p-alert.js +65 -1
  25. package/dist/cjs/p-avatar.js +71 -1
  26. package/dist/cjs/p-btn.js +358 -2
  27. package/dist/cjs/p-card.js +3 -1
  28. package/dist/cjs/p-checkbox.js +3 -1
  29. package/dist/cjs/p-chips.js +110 -1
  30. package/dist/cjs/p-close-btn.js +36 -1
  31. package/dist/cjs/p-date-picker.js +139 -1
  32. package/dist/cjs/p-drawer.js +253 -1
  33. package/dist/cjs/p-dropdown-select.js +3 -1
  34. package/dist/cjs/p-dropdown.js +138 -1
  35. package/dist/cjs/p-file-upload.js +21 -1
  36. package/dist/cjs/p-info-icon.js +35 -1
  37. package/dist/cjs/p-inline-date-picker.js +142 -1
  38. package/dist/cjs/p-input-number.js +146 -1
  39. package/dist/cjs/p-input-percent.js +3 -1
  40. package/dist/cjs/p-input-search.js +110 -1
  41. package/dist/cjs/p-input.js +89 -1
  42. package/dist/cjs/p-loading.js +38 -1
  43. package/dist/cjs/p-modal.js +369 -1
  44. package/dist/cjs/p-pagination-info.js +3 -1
  45. package/dist/cjs/p-pagination.js +3 -1
  46. package/dist/cjs/p-progress-bar.js +41 -1
  47. package/dist/cjs/p-ring-loader.js +3 -1
  48. package/dist/cjs/p-select-btn.js +3 -1
  49. package/dist/cjs/p-select-list.js +4 -1
  50. package/dist/cjs/p-select-pill.js +111 -1
  51. package/dist/cjs/p-select.js +3 -1
  52. package/dist/cjs/p-skeleton-loader.js +73 -1
  53. package/dist/cjs/p-table-filter-icon.js +20 -1
  54. package/dist/cjs/p-table-header-cell.js +75 -1
  55. package/dist/cjs/p-table-loader.js +3 -1
  56. package/dist/cjs/p-table-sort.js +8 -1
  57. package/dist/cjs/p-table-td.js +88 -1
  58. package/dist/cjs/p-table.js +12 -1
  59. package/dist/cjs/p-tabs.js +3 -1
  60. package/dist/cjs/p-textarea.js +73 -1
  61. package/dist/cjs/p-toggle.js +114 -1
  62. package/dist/cjs/pagination.js +29 -1
  63. package/dist/cjs/string.js +12 -1
  64. package/dist/cjs/tailwind.js +4353 -1
  65. package/dist/cjs/text.js +16 -1
  66. package/dist/cjs/useInputClasses.js +44 -1
  67. package/dist/cjs/usePLoading.js +35 -1
  68. package/dist/cjs/usePModal.js +21 -1
  69. package/dist/cjs/usePTableColResize.js +81 -1
  70. package/dist/cjs/usePTableRowVirtualizer.js +31 -1
  71. package/dist/cjs/useSelectList.js +256 -1
  72. package/dist/es/chunks/_plugin-vue_export-helper.js +7 -6
  73. package/dist/es/chunks/p-action-bar.js +45 -36
  74. package/dist/es/chunks/p-card.js +18 -14
  75. package/dist/es/chunks/p-checkbox.js +14 -11
  76. package/dist/es/chunks/p-dropdown-select.js +232 -183
  77. package/dist/es/chunks/p-input-percent.js +34 -25
  78. package/dist/es/chunks/p-pagination-info.js +30 -24
  79. package/dist/es/chunks/p-pagination.js +78 -48
  80. package/dist/es/chunks/p-ring-loader.js +63 -40
  81. package/dist/es/chunks/p-select-btn.js +80 -59
  82. package/dist/es/chunks/p-select.js +81 -54
  83. package/dist/es/chunks/p-table-loader.js +46 -32
  84. package/dist/es/chunks/p-tabs.js +35 -29
  85. package/dist/es/config.js +2 -2
  86. package/dist/es/currency.js +3 -3
  87. package/dist/es/dom.js +24 -12
  88. package/dist/es/index.js +703 -561
  89. package/dist/es/inputClassesMixin.js +20 -14
  90. package/dist/es/inputClassesShared.js +60 -45
  91. package/dist/es/listKeyboardNavigation.js +86 -36
  92. package/dist/es/number.js +7 -2
  93. package/dist/es/object.js +2 -2
  94. package/dist/es/p-action-bar.js +2 -2
  95. package/dist/es/p-alert.js +35 -30
  96. package/dist/es/p-avatar.js +30 -27
  97. package/dist/es/p-btn.js +209 -164
  98. package/dist/es/p-card.js +2 -2
  99. package/dist/es/p-checkbox.js +2 -2
  100. package/dist/es/p-chips.js +60 -40
  101. package/dist/es/p-close-btn.js +20 -16
  102. package/dist/es/p-date-picker.js +66 -58
  103. package/dist/es/p-drawer.js +108 -89
  104. package/dist/es/p-dropdown-select.js +2 -2
  105. package/dist/es/p-dropdown.js +52 -33
  106. package/dist/es/p-file-upload.js +17 -9
  107. package/dist/es/p-info-icon.js +21 -16
  108. package/dist/es/p-inline-date-picker.js +64 -53
  109. package/dist/es/p-input-number.js +84 -66
  110. package/dist/es/p-input-percent.js +2 -2
  111. package/dist/es/p-input-search.js +43 -41
  112. package/dist/es/p-input.js +51 -45
  113. package/dist/es/p-loading.js +31 -22
  114. package/dist/es/p-modal.js +261 -174
  115. package/dist/es/p-pagination-info.js +2 -2
  116. package/dist/es/p-pagination.js +2 -2
  117. package/dist/es/p-progress-bar.js +26 -23
  118. package/dist/es/p-ring-loader.js +2 -2
  119. package/dist/es/p-select-btn.js +2 -2
  120. package/dist/es/p-select-list.js +2 -2
  121. package/dist/es/p-select-pill.js +58 -41
  122. package/dist/es/p-select.js +2 -2
  123. package/dist/es/p-skeleton-loader.js +34 -29
  124. package/dist/es/p-table-filter-icon.js +11 -11
  125. package/dist/es/p-table-header-cell.js +38 -33
  126. package/dist/es/p-table-loader.js +2 -2
  127. package/dist/es/p-table-sort.js +2 -2
  128. package/dist/es/p-table-td.js +76 -29
  129. package/dist/es/p-table.js +10 -6
  130. package/dist/es/p-tabs.js +2 -2
  131. package/dist/es/p-textarea.js +36 -34
  132. package/dist/es/p-toggle.js +53 -48
  133. package/dist/es/pagination.js +25 -8
  134. package/dist/es/string.js +10 -2
  135. package/dist/es/tailwind.js +1660 -1101
  136. package/dist/es/text.js +13 -8
  137. package/dist/es/useInputClasses.js +38 -22
  138. package/dist/es/usePLoading.js +31 -15
  139. package/dist/es/usePModal.js +15 -12
  140. package/dist/es/usePTableColResize.js +71 -39
  141. package/dist/es/usePTableRowVirtualizer.js +24 -15
  142. package/dist/es/useSelectList.js +234 -121
  143. package/dist/style.css +2124 -1
  144. package/package.json +1 -1
@@ -1,12 +1,12 @@
1
- import { INPUT_SIZES as t, ERROR_MSG as n, INPUT_BASE as a, SPACING_PREFIX as o, SPACING_LEFT as E, SPACING_SUFFIX as l, SPACING_RIGHT as r, INPUT_ERROR as S, INPUT_NORMAL as u, LABEL_BASE as $, LABEL_SIZES as p, LABEL_REQUIRED as c, SELECT_BASE as C, SELECT_ARROW as _, SELECT_SIZES as h, TEXTAREA_BASE as A } from "./inputClassesShared.js";
2
- import { defineComponent as I } from "vue";
3
- const L = I({
1
+ import { INPUT_SIZES, ERROR_MSG, INPUT_BASE, SPACING_PREFIX, SPACING_LEFT, SPACING_SUFFIX, SPACING_RIGHT, INPUT_ERROR, INPUT_NORMAL, LABEL_BASE, LABEL_SIZES, LABEL_REQUIRED, SELECT_BASE, SELECT_ARROW, SELECT_SIZES, TEXTAREA_BASE } from "./inputClassesShared.js";
2
+ import { defineComponent } from "vue";
3
+ const inputClassesMixin = defineComponent({
4
4
  props: {
5
5
  size: {
6
6
  type: String,
7
7
  default: "md",
8
- validator(s) {
9
- return Object.keys(t).includes(s);
8
+ validator(value) {
9
+ return Object.keys(INPUT_SIZES).includes(value);
10
10
  }
11
11
  },
12
12
  errorMsg: {
@@ -15,31 +15,37 @@ const L = I({
15
15
  },
16
16
  required: {
17
17
  type: Boolean,
18
- default: !1
18
+ default: false
19
19
  }
20
20
  },
21
21
  data() {
22
22
  return {
23
- errorMsgClasses: n
23
+ errorMsgClasses: ERROR_MSG
24
24
  };
25
25
  },
26
26
  computed: {
27
27
  inputClasses() {
28
- const s = `${a} ${t[this.size]}`, e = this.$slots.prefix ? o[this.size] : E[this.size], i = this.$slots.suffix ? l[this.size] : r[this.size];
29
- return `${s} ${e} ${i} ${this.errorMsg ? S : u}`;
28
+ const base = `${INPUT_BASE} ${INPUT_SIZES[this.size]}`;
29
+ const spacingLeft = this.$slots.prefix ? SPACING_PREFIX[this.size] : SPACING_LEFT[this.size];
30
+ const spacingRight = this.$slots.suffix ? SPACING_SUFFIX[this.size] : SPACING_RIGHT[this.size];
31
+ const res = `${base} ${spacingLeft} ${spacingRight} ${this.errorMsg ? INPUT_ERROR : INPUT_NORMAL}`;
32
+ return res;
30
33
  },
31
34
  labelClasses() {
32
- const s = `${$} ${p[this.size]}`;
33
- return this.required ? `${s} ${c}` : s;
35
+ const base = `${LABEL_BASE} ${LABEL_SIZES[this.size]}`;
36
+ const res = this.required ? `${base} ${LABEL_REQUIRED}` : base;
37
+ return res;
34
38
  },
35
39
  selectClasses() {
36
- return `${this.inputClasses.replace(` ${r[this.size]}`, "")} ${C} ${_} ${h[this.size]}`;
40
+ const res = `${this.inputClasses.replace(` ${SPACING_RIGHT[this.size]}`, "")} ${SELECT_BASE} ${SELECT_ARROW} ${SELECT_SIZES[this.size]}`;
41
+ return res;
37
42
  },
38
43
  textareaClasses() {
39
- return `${this.inputClasses} ${A}`;
44
+ const res = `${this.inputClasses} ${TEXTAREA_BASE}`;
45
+ return res;
40
46
  }
41
47
  }
42
48
  });
43
49
  export {
44
- L as default
50
+ inputClassesMixin as default
45
51
  };
@@ -1,8 +1,12 @@
1
- const r = "block mb-1 font-bold", e = {
2
- sm: "text-xs",
3
- md: "text-sm",
4
- lg: "text-base"
5
- }, t = "after:content-['_*'] after:text-on-error", o = "text-xs text-on-error mt-1", n = [
1
+ const LABEL_BASE = `block mb-1 font-bold`;
2
+ const LABEL_SIZES = {
3
+ sm: `text-xs`,
4
+ md: `text-sm`,
5
+ lg: `text-base`
6
+ };
7
+ const LABEL_REQUIRED = `after:content-['_*'] after:text-on-error`;
8
+ const ERROR_MSG = `text-xs text-on-error mt-1`;
9
+ const INPUT_BASE = [
6
10
  "text-night",
7
11
  "w-full",
8
12
  "bg-surface",
@@ -16,46 +20,57 @@ const r = "block mb-1 font-bold", e = {
16
20
  "disabled:bg-p-blue-10",
17
21
  "disabled:cursor-default",
18
22
  "placeholder:text-p-gray-40"
19
- ].join(" "), s = "ring-p-gray-30 hover:ring-primary focus:ring-primary", g = "ring-on-error hover:ring-on-error focus:ring-on-error", c = {
20
- sm: "h-8 text-sm rounded",
21
- md: "h-10 text-base rounded",
22
- lg: "h-12 text-lg rounded"
23
- }, l = "resize-y px-3 py-3 overflow-auto h-auto", p = "truncate", d = "squirrel-bg-chevron-down bg-no-repeat appearance-none", i = {
24
- sm: "bg-[right_0.675rem_center] pr-8",
25
- md: "bg-[right_1rem_center] pr-10",
26
- lg: "bg-[right_1.25rem_center] pr-12"
27
- }, a = {
28
- sm: "pl-3",
29
- md: "pl-4",
30
- lg: "pl-5"
31
- }, E = {
32
- sm: "pr-3",
33
- md: "pr-4",
34
- lg: "pr-5"
35
- }, m = {
36
- sm: "pl-6",
37
- md: "pl-8",
38
- lg: "pl-12"
39
- }, _ = {
40
- sm: "pr-6",
41
- md: "pr-8",
42
- lg: "pr-12"
23
+ ].join(" ");
24
+ const INPUT_NORMAL = `ring-p-gray-30 hover:ring-primary focus:ring-primary`;
25
+ const INPUT_ERROR = `ring-on-error hover:ring-on-error focus:ring-on-error`;
26
+ const INPUT_SIZES = {
27
+ sm: `h-8 text-sm rounded`,
28
+ md: `h-10 text-base rounded`,
29
+ lg: `h-12 text-lg rounded`
30
+ };
31
+ const TEXTAREA_BASE = `resize-y px-3 py-3 overflow-auto h-auto`;
32
+ const SELECT_BASE = "truncate";
33
+ const SELECT_ARROW = `squirrel-bg-chevron-down bg-no-repeat appearance-none`;
34
+ const SELECT_SIZES = {
35
+ sm: `bg-[right_0.675rem_center] pr-8`,
36
+ md: `bg-[right_1rem_center] pr-10`,
37
+ lg: `bg-[right_1.25rem_center] pr-12`
38
+ };
39
+ const SPACING_LEFT = {
40
+ sm: `pl-3`,
41
+ md: `pl-4`,
42
+ lg: `pl-5`
43
+ };
44
+ const SPACING_RIGHT = {
45
+ sm: `pr-3`,
46
+ md: `pr-4`,
47
+ lg: `pr-5`
48
+ };
49
+ const SPACING_PREFIX = {
50
+ sm: `pl-6`,
51
+ md: `pl-8`,
52
+ lg: `pl-12`
53
+ };
54
+ const SPACING_SUFFIX = {
55
+ sm: `pr-6`,
56
+ md: `pr-8`,
57
+ lg: `pr-12`
43
58
  };
44
59
  export {
45
- o as ERROR_MSG,
46
- n as INPUT_BASE,
47
- g as INPUT_ERROR,
48
- s as INPUT_NORMAL,
49
- c as INPUT_SIZES,
50
- r as LABEL_BASE,
51
- t as LABEL_REQUIRED,
52
- e as LABEL_SIZES,
53
- d as SELECT_ARROW,
54
- p as SELECT_BASE,
55
- i as SELECT_SIZES,
56
- a as SPACING_LEFT,
57
- m as SPACING_PREFIX,
58
- E as SPACING_RIGHT,
59
- _ as SPACING_SUFFIX,
60
- l as TEXTAREA_BASE
60
+ ERROR_MSG,
61
+ INPUT_BASE,
62
+ INPUT_ERROR,
63
+ INPUT_NORMAL,
64
+ INPUT_SIZES,
65
+ LABEL_BASE,
66
+ LABEL_REQUIRED,
67
+ LABEL_SIZES,
68
+ SELECT_ARROW,
69
+ SELECT_BASE,
70
+ SELECT_SIZES,
71
+ SPACING_LEFT,
72
+ SPACING_PREFIX,
73
+ SPACING_RIGHT,
74
+ SPACING_SUFFIX,
75
+ TEXTAREA_BASE
61
76
  };
@@ -1,9 +1,13 @@
1
- import { isElement as S, isVisible as A, getNextActiveElement as K } from "./dom.js";
2
- const L = "ArrowUp", y = "ArrowDown", R = "Enter", _ = "focus", F = Object.freeze({
1
+ import { isElement, isVisible, getNextActiveElement } from "./dom.js";
2
+ const ARROW_UP_KEY = "ArrowUp";
3
+ const ARROW_DOWN_KEY = "ArrowDown";
4
+ const ENTER_KEY = "Enter";
5
+ const ITEM_FOCUS_CLASS = "focus";
6
+ const defaults = Object.freeze({
3
7
  itemContainer: null,
4
8
  // HTMLElement
5
9
  itemSelector: ".dropdown-item:not(.disabled), .dropdown-item:not(:disabled)",
6
- itemFocusClass: _,
10
+ itemFocusClass: ITEM_FOCUS_CLASS,
7
11
  /**
8
12
  * The selector for the event trigger
9
13
  */
@@ -11,50 +15,96 @@ const L = "ArrowUp", y = "ArrowDown", R = "Enter", _ = "focus", F = Object.freez
11
15
  /**
12
16
  * The keys to trigger selection
13
17
  */
14
- itemSelectKeys: [R],
18
+ itemSelectKeys: [ENTER_KEY],
15
19
  /**
16
20
  * The events to trigger on selection (enter/space)
17
21
  */
18
22
  itemSelectEvents: ["click"]
19
23
  });
20
- let c = null;
21
- const D = (l) => {
22
- if (!l || !l.itemContainer)
24
+ let activeInstance = null;
25
+ const setupListKeyboardNavigation = (options) => {
26
+ if (!options || !options.itemContainer) {
23
27
  throw Error("You must define an item container");
24
- const b = { ...F, ...l }, { itemContainer: n, itemSelector: w, itemFocusClass: a, itemSelectSelector: f, itemSelectEvents: g, itemSelectKeys: C } = b, r = () => !n || !S(n) ? [] : [...n.querySelectorAll(`${w}`)].filter((t) => A(t)), i = () => r().find((e) => e.classList.contains(a)), m = () => {
25
- r().forEach((e) => e.classList.remove(a));
26
- }, v = (e) => {
27
- m(), e == null || e.classList.add(a);
28
- }, d = (e) => {
29
- if ([L, y].includes(e.key)) {
28
+ }
29
+ const opts = { ...defaults, ...options };
30
+ const { itemContainer, itemSelector, itemFocusClass, itemSelectSelector, itemSelectEvents, itemSelectKeys } = opts;
31
+ const getItems = () => {
32
+ if (!itemContainer || !isElement(itemContainer)) {
33
+ return [];
34
+ }
35
+ const items = [...itemContainer.querySelectorAll(`${itemSelector}`)];
36
+ return items.filter((element) => isVisible(element));
37
+ };
38
+ const getFocusedItem = () => {
39
+ return getItems().find((item) => item.classList.contains(itemFocusClass));
40
+ };
41
+ const clearFocusedState = () => {
42
+ getItems().forEach((item) => item.classList.remove(itemFocusClass));
43
+ };
44
+ const setFocusedItem = (el) => {
45
+ clearFocusedState();
46
+ el == null ? void 0 : el.classList.add(itemFocusClass);
47
+ };
48
+ const listKeydown = (e) => {
49
+ if ([ARROW_UP_KEY, ARROW_DOWN_KEY].includes(e.key)) {
30
50
  e.preventDefault();
31
- const t = r();
32
- if (!t.length)
51
+ const items = getItems();
52
+ if (!items.length) {
33
53
  return;
34
- const o = i() ?? e.target, s = K(t, o, e.key === y, !1);
35
- v(s), k(s);
54
+ }
55
+ const target = getFocusedItem() ?? e.target;
56
+ const activeElement = getNextActiveElement(items, target, e.key === ARROW_DOWN_KEY, false);
57
+ setFocusedItem(activeElement);
58
+ adjustScroll(activeElement);
36
59
  }
37
- if (C.includes(e.key) && i()) {
38
- e.preventDefault();
39
- const t = i(), o = f ? t == null ? void 0 : t.querySelector(f) : i();
40
- g.forEach((s) => {
41
- const p = new Event(s);
42
- o && o.dispatchEvent(p);
43
- });
60
+ if (itemSelectKeys.includes(e.key)) {
61
+ if (getFocusedItem()) {
62
+ e.preventDefault();
63
+ const focusedItem = getFocusedItem();
64
+ const el = itemSelectSelector ? focusedItem == null ? void 0 : focusedItem.querySelector(itemSelectSelector) : getFocusedItem();
65
+ itemSelectEvents.forEach((e2) => {
66
+ const event = new Event(e2);
67
+ if (el) {
68
+ el.dispatchEvent(event);
69
+ }
70
+ });
71
+ }
72
+ }
73
+ };
74
+ const init = () => {
75
+ if (activeInstance === instance)
76
+ ;
77
+ else {
78
+ if (activeInstance) {
79
+ console.warn("There can only be one instance of list navigation active at a time.");
80
+ activeInstance.destroy();
81
+ }
82
+ document.addEventListener("keydown", listKeydown);
83
+ activeInstance = instance;
44
84
  }
45
- }, E = () => {
46
- c === u || (c && (console.warn("There can only be one instance of list navigation active at a time."), c.destroy()), document.addEventListener("keydown", d), c = u);
47
- }, h = () => {
48
- m(), document.removeEventListener("keydown", d), c = null;
49
- }, k = (e) => {
50
- if (!n || !S(n))
85
+ };
86
+ const destroy = () => {
87
+ clearFocusedState();
88
+ document.removeEventListener("keydown", listKeydown);
89
+ activeInstance = null;
90
+ };
91
+ const adjustScroll = (activeOptionEl) => {
92
+ if (!itemContainer || !isElement(itemContainer)) {
51
93
  return;
52
- const t = n.getBoundingClientRect(), { top: o, bottom: s } = e.getBoundingClientRect();
53
- o < t.top ? e.scrollIntoView({ behavior: "auto", block: "nearest", inline: "start" }) : s > t.bottom && e.scrollIntoView({ behavior: "auto", block: "nearest", inline: "end" });
54
- }, u = { getItems: r, getFocusedItem: i, clearFocusedState: m, setFocusedItem: v, listKeydown: d, init: E, destroy: h };
55
- return E(), u;
94
+ }
95
+ const bounds = itemContainer.getBoundingClientRect();
96
+ const { top, bottom } = activeOptionEl.getBoundingClientRect();
97
+ if (top < bounds.top) {
98
+ activeOptionEl.scrollIntoView({ behavior: "auto", block: "nearest", inline: "start" });
99
+ } else if (bottom > bounds.bottom) {
100
+ activeOptionEl.scrollIntoView({ behavior: "auto", block: "nearest", inline: "end" });
101
+ }
102
+ };
103
+ const instance = { getItems, getFocusedItem, clearFocusedState, setFocusedItem, listKeydown, init, destroy };
104
+ init();
105
+ return instance;
56
106
  };
57
107
  export {
58
- _ as ITEM_FOCUS_CLASS,
59
- D as setupListKeyboardNavigation
108
+ ITEM_FOCUS_CLASS,
109
+ setupListKeyboardNavigation
60
110
  };
package/dist/es/number.js CHANGED
@@ -1,4 +1,9 @@
1
- const u = (r) => r === "" || r === null || isNaN(Number(r)) ? null : Number(r);
1
+ const toNumberOrNull = (val) => {
2
+ if (val === "" || val === null || isNaN(Number(val))) {
3
+ return null;
4
+ }
5
+ return Number(val);
6
+ };
2
7
  export {
3
- u as toNumberOrNull
8
+ toNumberOrNull
4
9
  };
package/dist/es/object.js CHANGED
@@ -1,4 +1,4 @@
1
- const e = (t) => typeof t == "object" && t !== null;
1
+ const isObject = (val) => typeof val === "object" && val !== null;
2
2
  export {
3
- e as isObject
3
+ isObject
4
4
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./chunks/p-action-bar.js";
1
+ import { _ as _sfc_main } from "./chunks/p-action-bar.js";
2
2
  export {
3
- f as default
3
+ _sfc_main as default
4
4
  };
@@ -1,61 +1,66 @@
1
- import { getColor as C } from "./tailwind.js";
2
- import { defineComponent as l, openBlock as o, createElementBlock as s, normalizeClass as i, createElementVNode as t, renderSlot as n } from "vue";
3
- import { _ as c } from "./chunks/_plugin-vue_export-helper.js";
4
- const r = {
5
- info: "bg-info text-on-info",
6
- warning: "bg-warning text-on-warning",
7
- error: "bg-error text-on-error",
8
- success: "bg-success text-on-success"
9
- }, a = l({
1
+ import { getColor } from "./tailwind.js";
2
+ import { defineComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, renderSlot } from "vue";
3
+ import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
4
+ const ALERT_TYPES = {
5
+ info: `bg-info text-on-info`,
6
+ warning: `bg-warning text-on-warning`,
7
+ error: `bg-error text-on-error`,
8
+ success: `bg-success text-on-success`
9
+ };
10
+ const _sfc_main = defineComponent({
10
11
  name: "PAlert",
11
12
  props: {
12
13
  type: {
13
14
  type: String,
14
15
  default: "info",
15
- validator(e) {
16
- return Object.keys(r).includes(e);
16
+ validator(value) {
17
+ return Object.keys(ALERT_TYPES).includes(value);
17
18
  }
18
19
  }
19
20
  },
20
21
  computed: {
21
22
  classes() {
22
- return `${r[this.type]}`;
23
+ return `${ALERT_TYPES[this.type]}`;
23
24
  },
24
25
  svgColor() {
25
- const e = `on-${this.type}`;
26
- return C(e);
26
+ const type = `on-${this.type}`;
27
+ return getColor(type);
27
28
  }
28
29
  }
29
- }), d = { class: "flex" }, p = { class: "pr-2" }, f = {
30
+ });
31
+ const _hoisted_1 = { class: "flex" };
32
+ const _hoisted_2 = { class: "pr-2" };
33
+ const _hoisted_3 = {
30
34
  width: "16",
31
35
  height: "16",
32
36
  viewBox: "0 0 16 16",
33
37
  fill: "none",
34
38
  xmlns: "http://www.w3.org/2000/svg"
35
- }, u = ["fill"];
36
- function g(e, m, _, h, v, w) {
37
- return o(), s("div", {
38
- class: i(["rounded p-4 text-xs font-semibold", e.classes]),
39
+ };
40
+ const _hoisted_4 = ["fill"];
41
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
42
+ return openBlock(), createElementBlock("div", {
43
+ class: normalizeClass(["rounded p-4 text-xs font-semibold", _ctx.classes]),
39
44
  role: "alert"
40
45
  }, [
41
- t("div", d, [
42
- t("div", p, [
43
- n(e.$slots, "icon", {}, () => [
44
- (o(), s("svg", f, [
45
- t("path", {
46
+ createElementVNode("div", _hoisted_1, [
47
+ createElementVNode("div", _hoisted_2, [
48
+ renderSlot(_ctx.$slots, "icon", {}, () => [
49
+ (openBlock(), createElementBlock("svg", _hoisted_3, [
50
+ createElementVNode("path", {
46
51
  d: "M8 0C6.41775 0 4.87104 0.469192 3.55544 1.34824C2.23985 2.22729 1.21447 3.47672 0.608967 4.93853C0.00346629 6.40034 -0.15496 8.00887 0.153721 9.56072C0.462403 11.1126 1.22433 12.538 2.34315 13.6569C3.46197 14.7757 4.88743 15.5376 6.43928 15.8463C7.99113 16.155 9.59966 15.9965 11.0615 15.391C12.5233 14.7855 13.7727 13.7602 14.6518 12.4446C15.5308 11.129 16 9.58225 16 8C16 5.87827 15.1571 3.84344 13.6569 2.34315C12.1566 0.842855 10.1217 0 8 0V0ZM8.16667 3.33333C8.36445 3.33333 8.55779 3.39198 8.72224 3.50186C8.88669 3.61175 9.01486 3.76792 9.09055 3.95065C9.16624 4.13338 9.18604 4.33444 9.14746 4.52842C9.10887 4.72241 9.01363 4.90059 8.87378 5.04044C8.73392 5.18029 8.55574 5.27553 8.36176 5.31412C8.16778 5.3527 7.96671 5.3329 7.78399 5.25721C7.60126 5.18153 7.44508 5.05335 7.3352 4.8889C7.22532 4.72445 7.16667 4.53112 7.16667 4.33333C7.16667 4.06812 7.27203 3.81376 7.45956 3.62623C7.6471 3.43869 7.90145 3.33333 8.16667 3.33333ZM9.66667 12.3333H7C6.82319 12.3333 6.65362 12.2631 6.5286 12.1381C6.40358 12.013 6.33334 11.8435 6.33334 11.6667C6.33334 11.4899 6.40358 11.3203 6.5286 11.1953C6.65362 11.0702 6.82319 11 7 11H7.5C7.54421 11 7.5866 10.9824 7.61786 10.9512C7.64911 10.9199 7.66667 10.8775 7.66667 10.8333V7.83333C7.66667 7.78913 7.64911 7.74674 7.61786 7.71548C7.5866 7.68423 7.54421 7.66667 7.5 7.66667H7C6.82319 7.66667 6.65362 7.59643 6.5286 7.47141C6.40358 7.34638 6.33334 7.17681 6.33334 7C6.33334 6.82319 6.40358 6.65362 6.5286 6.5286C6.65362 6.40357 6.82319 6.33333 7 6.33333H7.66667C8.02029 6.33333 8.35943 6.47381 8.60948 6.72386C8.85953 6.97391 9 7.31305 9 7.66667V10.8333C9 10.8775 9.01756 10.9199 9.04882 10.9512C9.08008 10.9824 9.12247 11 9.16667 11H9.66667C9.84348 11 10.0131 11.0702 10.1381 11.1953C10.2631 11.3203 10.3333 11.4899 10.3333 11.6667C10.3333 11.8435 10.2631 12.013 10.1381 12.1381C10.0131 12.2631 9.84348 12.3333 9.66667 12.3333Z",
47
- fill: e.svgColor
48
- }, null, 8, u)
52
+ fill: _ctx.svgColor
53
+ }, null, 8, _hoisted_4)
49
54
  ]))
50
55
  ])
51
56
  ]),
52
- t("div", null, [
53
- n(e.$slots, "default")
57
+ createElementVNode("div", null, [
58
+ renderSlot(_ctx.$slots, "default")
54
59
  ])
55
60
  ])
56
61
  ], 2);
57
62
  }
58
- const y = /* @__PURE__ */ c(a, [["render", g]]);
63
+ const PAlert = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
59
64
  export {
60
- y as default
65
+ PAlert as default
61
66
  };
@@ -1,18 +1,20 @@
1
- import { defineComponent as n, openBlock as l, createElementBlock as r, normalizeClass as s, toDisplayString as i } from "vue";
2
- import { _ as o } from "./chunks/_plugin-vue_export-helper.js";
3
- const a = {
1
+ import { defineComponent, openBlock, createElementBlock, normalizeClass, toDisplayString } from "vue";
2
+ import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
3
+ const SHAPES = {
4
4
  rectangle: "rectangle",
5
5
  circle: "circle"
6
- }, c = {
7
- [a.rectangle]: "rounded-lg",
8
- [a.circle]: "rounded-full"
9
- }, p = n({
6
+ };
7
+ const SHAPE_CLASSES = {
8
+ [SHAPES.rectangle]: "rounded-lg",
9
+ [SHAPES.circle]: "rounded-full"
10
+ };
11
+ const _sfc_main = defineComponent({
10
12
  name: "PAvatar",
11
13
  props: {
12
14
  shape: {
13
15
  type: String,
14
- default: a.circle,
15
- validator: (e) => Object.values(a).includes(e)
16
+ default: SHAPES.circle,
17
+ validator: (value) => Object.values(SHAPES).includes(value)
16
18
  },
17
19
  imageSrc: {
18
20
  type: String,
@@ -20,7 +22,7 @@ const a = {
20
22
  },
21
23
  label: {
22
24
  type: String,
23
- required: !0
25
+ required: true
24
26
  },
25
27
  imageClass: {
26
28
  type: String,
@@ -33,37 +35,38 @@ const a = {
33
35
  },
34
36
  data() {
35
37
  return {
36
- imageBroken: !1
38
+ imageBroken: false
37
39
  };
38
40
  },
39
41
  computed: {
40
42
  shapeClass() {
41
- return c[this.shape];
43
+ return SHAPE_CLASSES[this.shape];
42
44
  }
43
45
  },
44
46
  watch: {
45
47
  imageSrc() {
46
- this.imageBroken = !1;
48
+ this.imageBroken = false;
47
49
  }
48
50
  }
49
- }), u = ["src", "alt"];
50
- function m(e, t, d, f, g, S) {
51
- return l(), r("div", {
52
- class: s(e.shapeClass)
51
+ });
52
+ const _hoisted_1 = ["src", "alt"];
53
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
54
+ return openBlock(), createElementBlock("div", {
55
+ class: normalizeClass(_ctx.shapeClass)
53
56
  }, [
54
- e.imageSrc && !e.imageBroken ? (l(), r("img", {
57
+ _ctx.imageSrc && !_ctx.imageBroken ? (openBlock(), createElementBlock("img", {
55
58
  key: 0,
56
- src: e.imageSrc,
57
- alt: e.label,
58
- class: s(["h-full w-full object-cover", [e.shapeClass, e.imageClass]]),
59
- onError: t[0] || (t[0] = (h) => e.imageBroken = !0)
60
- }, null, 42, u)) : (l(), r("div", {
59
+ src: _ctx.imageSrc,
60
+ alt: _ctx.label,
61
+ class: normalizeClass(["h-full w-full object-cover", [_ctx.shapeClass, _ctx.imageClass]]),
62
+ onError: _cache[0] || (_cache[0] = ($event) => _ctx.imageBroken = true)
63
+ }, null, 42, _hoisted_1)) : (openBlock(), createElementBlock("div", {
61
64
  key: 1,
62
- class: s(["flex h-full w-full items-center justify-center", [e.shapeClass, e.labelClass]])
63
- }, i(e.label), 3))
65
+ class: normalizeClass(["flex h-full w-full items-center justify-center", [_ctx.shapeClass, _ctx.labelClass]])
66
+ }, toDisplayString(_ctx.label), 3))
64
67
  ], 2);
65
68
  }
66
- const k = /* @__PURE__ */ o(p, [["render", m]]);
69
+ const pAvatar = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
67
70
  export {
68
- k as default
71
+ pAvatar as default
69
72
  };