@pequity/squirrel 10.0.3 → 10.1.0

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 (59) hide show
  1. package/README.md +20 -1
  2. package/dist/cjs/chunks/p-action-bar.js +17 -14
  3. package/dist/cjs/chunks/p-date-picker.js +3 -1
  4. package/dist/cjs/chunks/p-dropdown-select.js +27 -26
  5. package/dist/cjs/chunks/p-inline-date-picker.js +3 -1
  6. package/dist/cjs/chunks/p-pagination-info.js +2 -2
  7. package/dist/cjs/chunks/p-pagination.js +13 -11
  8. package/dist/cjs/chunks/p-tabs-pills.js +8 -8
  9. package/dist/cjs/index.js +101 -48
  10. package/dist/cjs/p-drawer.js +4 -4
  11. package/dist/cjs/p-input-search.js +5 -4
  12. package/dist/cjs/p-modal.js +3 -3
  13. package/dist/es/chunks/p-action-bar.js +18 -15
  14. package/dist/es/chunks/p-date-picker.js +3 -1
  15. package/dist/es/chunks/p-dropdown-select.js +27 -26
  16. package/dist/es/chunks/p-inline-date-picker.js +3 -1
  17. package/dist/es/chunks/p-pagination-info.js +2 -2
  18. package/dist/es/chunks/p-pagination.js +13 -11
  19. package/dist/es/chunks/p-tabs-pills.js +8 -8
  20. package/dist/es/index.js +102 -49
  21. package/dist/es/p-drawer.js +4 -4
  22. package/dist/es/p-input-search.js +5 -4
  23. package/dist/es/p-modal.js +3 -3
  24. package/dist/squirrel/index.d.ts +1 -0
  25. package/dist/squirrel/plugin/index.d.ts +11 -0
  26. package/dist/squirrel.css +40 -40
  27. package/package.json +28 -25
  28. package/squirrel/components/p-action-bar/p-action-bar.vue +4 -1
  29. package/squirrel/components/p-btn/p-btn.spec.js +0 -1
  30. package/squirrel/components/p-checkbox/p-checkbox.stories.js +2 -2
  31. package/squirrel/components/p-date-picker/p-date-picker.vue +3 -2
  32. package/squirrel/components/p-drawer/p-drawer.spec.js +364 -0
  33. package/squirrel/components/p-drawer/p-drawer.vue +8 -2
  34. package/squirrel/components/p-dropdown/p-dropdown.spec.js +252 -55
  35. package/squirrel/components/p-dropdown-select/p-dropdown-select.vue +16 -12
  36. package/squirrel/components/p-file-upload/p-file-upload.spec.js +0 -1
  37. package/squirrel/components/p-file-upload/p-file-upload.vue +26 -9
  38. package/squirrel/components/p-inline-date-picker/p-inline-date-picker.vue +3 -1
  39. package/squirrel/components/p-input-search/p-input-search.vue +2 -2
  40. package/squirrel/components/p-modal/p-modal.vue +1 -1
  41. package/squirrel/components/p-pagination/p-pagination.vue +3 -3
  42. package/squirrel/components/p-pagination-info/p-pagination-info.vue +2 -2
  43. package/squirrel/components/p-progress-bar/{p-progess-bar.spec.js → p-progress-bar.spec.js} +7 -5
  44. package/squirrel/components/p-select-btn/p-select-btn.spec.js +104 -0
  45. package/squirrel/components/p-select-list/p-select-list.vue +7 -5
  46. package/squirrel/components/p-select-pill/p-select-pill.spec.js +114 -0
  47. package/squirrel/components/p-table/usePTableColResize.spec.js +123 -11
  48. package/squirrel/components/p-table/usePTableHeaderWrap.spec.js +1 -1
  49. package/squirrel/components/p-table/usePTableRowVirtualizer.spec.js +207 -0
  50. package/squirrel/components/p-table-header-cell/p-table-header-cell.stories.js +3 -0
  51. package/squirrel/components/p-table-sort/p-table-sort.vue +4 -4
  52. package/squirrel/components/p-tabs-pills/p-tabs-pills.vue +1 -1
  53. package/squirrel/index.spec.js +5 -0
  54. package/squirrel/index.ts +1 -0
  55. package/squirrel/locales/en-US.json +47 -0
  56. package/squirrel/locales/fr-CA.json +47 -0
  57. package/squirrel/plugin/index.spec.ts +140 -0
  58. package/squirrel/plugin/index.ts +54 -0
  59. package/squirrel/utils/listKeyboardNavigation.spec.js +58 -0
@@ -9,7 +9,7 @@ import { toString } from "../string.js";
9
9
  import { splitStringForHighlight } from "../text.js";
10
10
  import { omit } from "lodash-es";
11
11
  const _imports_0 = "data:image/svg+xml,%3csvg%20width='18'%20height='12'%20viewBox='0%200%2018%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M16.1383%200.166992L6.30411%209.83366L1.69828%205.27533L0.526611%206.46033L5.71578%2011.597C5.87174%2011.7509%206.08205%2011.8372%206.3012%2011.8372C6.52034%2011.8372%206.73065%2011.7509%206.88661%2011.597L17.3033%201.35366L16.1383%200.166992Z'%20fill='%231A123B'%20/%3e%3c/svg%3e";
12
- const _hoisted_1 = ["data-has-error"];
12
+ const _hoisted_1 = ["data-has-error", "aria-label"];
13
13
  const _hoisted_2 = { class: "truncate text-left text-p-gray-40" };
14
14
  const _hoisted_3 = {
15
15
  key: 0,
@@ -19,25 +19,26 @@ const _hoisted_4 = {
19
19
  class: "max-w-[200px] truncate",
20
20
  "data-test": "pill-text"
21
21
  };
22
- const _hoisted_5 = ["onClick"];
22
+ const _hoisted_5 = ["aria-label", "onClick"];
23
23
  const _hoisted_6 = {
24
24
  key: 1,
25
25
  class: "truncate text-left"
26
26
  };
27
- const _hoisted_7 = {
27
+ const _hoisted_7 = ["aria-label"];
28
+ const _hoisted_8 = {
28
29
  key: 0,
29
30
  class: "mt-3 px-3"
30
31
  };
31
- const _hoisted_8 = { class: "text-p-purple-60" };
32
- const _hoisted_9 = { class: "flex flex-row" };
33
- const _hoisted_10 = ["onClick"];
34
- const _hoisted_11 = ["title"];
35
- const _hoisted_12 = {
32
+ const _hoisted_9 = { class: "text-p-purple-60" };
33
+ const _hoisted_10 = { class: "flex flex-row" };
34
+ const _hoisted_11 = ["onClick"];
35
+ const _hoisted_12 = ["title"];
36
+ const _hoisted_13 = {
36
37
  key: 0,
37
38
  class: "ml-auto fill-p-purple-60 pl-2",
38
39
  src: _imports_0
39
40
  };
40
- const _hoisted_13 = {
41
+ const _hoisted_14 = {
41
42
  key: 1,
42
43
  class: "ml-auto h-4 w-[26px] pl-2"
43
44
  };
@@ -347,7 +348,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
347
348
  class: normalizeClass([{ hidden: unref($attrs).hidden }, unref($attrs).class]),
348
349
  "data-has-error": !!__props.errorMsg,
349
350
  style: normalizeStyle(style.value),
350
- "aria-label": "Dropdown select"
351
+ "aria-label": _ctx.$t("squirrel.dropdown_select_aria_label")
351
352
  }, [
352
353
  __props.label ? (openBlock(), createElementBlock("label", {
353
354
  key: 0,
@@ -365,15 +366,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
365
366
  "p-select-list": "",
366
367
  role: "listbox"
367
368
  }), [
368
- __props.multiple || __props.searchable ? (openBlock(), createElementBlock("div", _hoisted_7, [
369
+ __props.multiple || __props.searchable ? (openBlock(), createElementBlock("div", _hoisted_8, [
369
370
  __props.multiple ? (openBlock(), createElementBlock("div", {
370
371
  key: 0,
371
372
  ref_key: "actionsContainer",
372
373
  ref: actionsContainer,
373
374
  class: "flex flex-row justify-between text-xs font-semibold text-primary"
374
375
  }, [
375
- createElementVNode("p", _hoisted_8, toDisplayString(unref(computedItems).length) + " items", 1),
376
- createElementVNode("div", _hoisted_9, [
376
+ createElementVNode("p", _hoisted_9, toDisplayString(_ctx.$t("squirrel.dropdown_select_items", unref(computedItems).length)), 1),
377
+ createElementVNode("div", _hoisted_10, [
377
378
  unref(computedItems).length === unref(internalItems).length ? (openBlock(), createElementBlock("a", {
378
379
  key: 0,
379
380
  class: normalizeClass([
@@ -381,18 +382,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
381
382
  ]),
382
383
  onClick: _cache[2] || (_cache[2] = //@ts-ignore
383
384
  (...args) => unref(selectAll) && unref(selectAll)(...args))
384
- }, " Select all ", 2)) : (openBlock(), createElementBlock("a", {
385
+ }, toDisplayString(_ctx.$t("squirrel.dropdown_select_select_all")), 3)) : (openBlock(), createElementBlock("a", {
385
386
  key: 1,
386
387
  class: normalizeClass([unref(computedInsideSelected) ? "pointer-events-none opacity-50" : "cursor-pointer"]),
387
388
  onClick: _cache[3] || (_cache[3] = //@ts-ignore
388
389
  (...args) => unref(selectAll) && unref(selectAll)(...args))
389
- }, " Select all filtered ", 2)),
390
+ }, toDisplayString(_ctx.$t("squirrel.dropdown_select_select_all_filtered")), 3)),
390
391
  _cache[7] || (_cache[7] = createElementVNode("span", { class: "px-1 leading-none" }, ".", -1)),
391
392
  createElementVNode("a", {
392
393
  class: normalizeClass([unref(selectedItems).length ? "cursor-pointer" : "pointer-events-none opacity-50"]),
393
394
  onClick: _cache[4] || (_cache[4] = //@ts-ignore
394
395
  (...args) => unref(clearAll) && unref(clearAll)(...args))
395
- }, " Clear all ", 2)
396
+ }, toDisplayString(_ctx.$t("squirrel.dropdown_select_clear_all")), 3)
396
397
  ])
397
398
  ], 512)) : createCommentVNode("", true),
398
399
  __props.searchable ? (openBlock(), createElementBlock("div", {
@@ -460,11 +461,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
460
461
  class: normalizeClass({ "bg-p-blue-20": index === 1 })
461
462
  }, toDisplayString(str), 3);
462
463
  }), 128))
463
- ], 8, _hoisted_11)
464
+ ], 8, _hoisted_12)
464
465
  ]),
465
- unref(isSelected)(unref(getValue)(row.index)) ? (openBlock(), createElementBlock("img", _hoisted_12)) : (openBlock(), createElementBlock("div", _hoisted_13))
466
+ unref(isSelected)(unref(getValue)(row.index)) ? (openBlock(), createElementBlock("img", _hoisted_13)) : (openBlock(), createElementBlock("div", _hoisted_14))
466
467
  ], 2)
467
- ], 14, _hoisted_10)), [
468
+ ], 14, _hoisted_11)), [
468
469
  [_directive_close_popper, !__props.multiple]
469
470
  ])
470
471
  ], 4);
@@ -480,11 +481,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
480
481
  onClick: handleCreate
481
482
  }, [
482
483
  createVNode(_sfc_main$1, { icon: "fe:plus-circle" }),
483
- createTextVNode(" Add '" + toDisplayString(unref(search)) + "' ", 1)
484
+ createTextVNode(" " + toDisplayString(_ctx.$t("squirrel.dropdown_select_add")) + " '" + toDisplayString(unref(search)) + "' ", 1)
484
485
  ])) : __props.creatable ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
485
- createTextVNode("No items found. Type to add")
486
+ createTextVNode(toDisplayString(_ctx.$t("squirrel.dropdown_select_no_items_found_type_to_add")), 1)
486
487
  ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
487
- createTextVNode("No items found")
488
+ createTextVNode(toDisplayString(_ctx.$t("squirrel.dropdown_select_no_items_found")), 1)
488
489
  ], 64))
489
490
  ], 2)
490
491
  ]) : createCommentVNode("", true)
@@ -523,7 +524,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
523
524
  createElementVNode("button", {
524
525
  type: "button",
525
526
  class: "flex items-center justify-center text-p-gray-40 hover:text-p-gray-60",
526
- "aria-label": "Remove item",
527
+ "aria-label": _ctx.$t("squirrel.dropdown_select_remove_item"),
527
528
  "data-test": "pill-remove",
528
529
  onClick: withModifiers(($event) => unref(select)($event, item[__props.itemValue]), ["stop"])
529
530
  }, [
@@ -534,12 +535,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
534
535
  ], 8, _hoisted_5)
535
536
  ], 2);
536
537
  }), 128))
537
- ])) : (openBlock(), createElementBlock("div", _hoisted_6, toDisplayString(__props.multiple ? unref(selectedItems).length === unref(computedItems).length ? "All options selected" : `${unref(selectedItems).length} option${unref(selectedItems).length > 1 ? "s" : ""} selected` : unref(selectedItems)[0][__props.itemText]), 1))
538
+ ])) : (openBlock(), createElementBlock("div", _hoisted_6, toDisplayString(__props.multiple ? unref(selectedItems).length === unref(computedItems).length ? _ctx.$t("squirrel.dropdown_select_all_options_selected") : `${unref(selectedItems).length} ${_ctx.$t("squirrel.dropdown_select_options", unref(selectedItems).length)} ${_ctx.$t("squirrel.dropdown_select_selected")}` : unref(selectedItems)[0][__props.itemText]), 1))
538
539
  ]),
539
540
  __props.clearable && unref(selectedItems).length ? (openBlock(), createElementBlock("button", {
540
541
  key: 2,
541
542
  class: normalizeClass(["absolute right-9 flex h-6 items-center justify-center text-base text-p-gray-40 hover:text-p-gray-60", [CLEAR_BUTTON_SPACING[__props.size]]]),
542
- "aria-label": "Clear selection",
543
+ "aria-label": _ctx.$t("squirrel.dropdown_select_clear_selection"),
543
544
  onClick: _cache[0] || (_cache[0] = withModifiers(
544
545
  //@ts-ignore
545
546
  (...args) => unref(clearAll) && unref(clearAll)(...args),
@@ -547,7 +548,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
547
548
  ))
548
549
  }, [
549
550
  createVNode(_sfc_main$1, { icon: "fe:close" })
550
- ], 2)) : createCommentVNode("", true)
551
+ ], 10, _hoisted_7)) : createCommentVNode("", true)
551
552
  ], 16)
552
553
  ]),
553
554
  _: 3
@@ -1,6 +1,7 @@
1
1
  import { defineComponent, mergeModels, useModel, useAttrs, computed, createElementBlock, openBlock, normalizeStyle, normalizeClass, renderSlot, createVNode, withDirectives, unref, createCommentVNode, toDisplayString, mergeProps, createElementVNode, vShow } from "vue";
2
2
  import { useInputClasses } from "../useInputClasses.js";
3
3
  import VueDatePicker from "@vuepic/vue-datepicker";
4
+ import { useI18n } from "vue-i18n";
4
5
  const _hoisted_1 = ["data-has-error"];
5
6
  const _sfc_main = /* @__PURE__ */ defineComponent({
6
7
  ...{
@@ -121,12 +122,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
121
122
  setup(__props) {
122
123
  const props = __props;
123
124
  const model = useModel(__props, "modelValue");
125
+ const { locale } = useI18n();
124
126
  const attrs = useAttrs();
125
127
  const { labelClasses, errorMsgClasses } = useInputClasses(props);
126
128
  const datePickerProps = computed(() => {
127
129
  const { modelValue: _, ...propsWithoutModelValue } = props;
128
130
  const { class: classes, style: style2, ...attrsWithoutClassAndStyle } = attrs;
129
- return { ...propsWithoutModelValue, ...attrsWithoutClassAndStyle };
131
+ return { ...propsWithoutModelValue, ...attrsWithoutClassAndStyle, locale: locale.value };
130
132
  });
131
133
  const style = computed(() => {
132
134
  return attrs.style;
@@ -58,9 +58,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
58
58
  class: "h-6 w-56"
59
59
  })) : (openBlock(), createElementBlock("div", _hoisted_1, [
60
60
  __props.count ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
61
- createTextVNode("Showing " + toDisplayString(from.value) + " to " + toDisplayString(to.value) + " of " + toDisplayString(__props.count) + " results", 1)
61
+ createTextVNode(toDisplayString(_ctx.$t("squirrel.pagination_info_showing_results", { from: from.value, to: to.value, count: __props.count })), 1)
62
62
  ], 64)) : renderSlot(_ctx.$slots, "no-results", { key: 1 }, () => [
63
- _cache[0] || (_cache[0] = createTextVNode("No results found", -1))
63
+ createTextVNode(toDisplayString(_ctx.$t("squirrel.pagination_info_no_results_found")), 1)
64
64
  ])
65
65
  ]));
66
66
  };
@@ -6,9 +6,11 @@ const _hoisted_1 = {
6
6
  key: 1,
7
7
  class: "flex text-p-gray-40"
8
8
  };
9
- const _hoisted_2 = ["onClick"];
10
- const _hoisted_3 = { class: "flex" };
11
- const _hoisted_4 = ["aria-label"];
9
+ const _hoisted_2 = ["aria-label"];
10
+ const _hoisted_3 = ["onClick"];
11
+ const _hoisted_4 = { class: "flex" };
12
+ const _hoisted_5 = ["aria-label"];
13
+ const _hoisted_6 = ["aria-label"];
12
14
  const DOTS = "...";
13
15
  const BTN_CLASS = "w-6 h-6 flex justify-center items-center mx-1 font-semibold text-sm leading-none";
14
16
  const BTN_ACTIVE_CLASS = "text-p-purple-60 bg-p-gray-30 rounded-lg";
@@ -84,41 +86,41 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
84
86
  !__props.loading && pages.value.length > 1 ? (openBlock(), createElementBlock("div", _hoisted_1, [
85
87
  createElementVNode("div", {
86
88
  class: normalizeClass([BTN_CLASS, Number(__props.modelValue) <= 1 ? ARROW_INACTIVE_CLASS : ARROW_ACTIVE_CLASS]),
87
- "aria-label": "go to the previous page",
89
+ "aria-label": _ctx.$t("squirrel.pagination_go_to_previous_page"),
88
90
  onClick: _cache[0] || (_cache[0] = ($event) => setPage(Number(__props.modelValue) - 1))
89
91
  }, [
90
92
  createVNode(_sfc_main$1, {
91
93
  icon: "chevron-left",
92
94
  width: "24px"
93
95
  })
94
- ], 2),
96
+ ], 10, _hoisted_2),
95
97
  (openBlock(true), createElementBlock(Fragment, null, renderList(pages.value, (page, index) => {
96
98
  return openBlock(), createElementBlock("div", {
97
99
  key: index,
98
100
  onClick: ($event) => setPage(Number(page))
99
101
  }, [
100
- createElementVNode("div", _hoisted_3, [
102
+ createElementVNode("div", _hoisted_4, [
101
103
  page !== DOTS ? (openBlock(), createElementBlock("div", {
102
104
  key: 0,
103
105
  class: normalizeClass([BTN_CLASS, page === __props.modelValue ? BTN_ACTIVE_CLASS : BTN_INACTIVE_CLASS]),
104
- "aria-label": `go to page ${page}`
105
- }, toDisplayString(page), 11, _hoisted_4)) : (openBlock(), createElementBlock("div", {
106
+ "aria-label": _ctx.$t("squirrel.pagination_go_to_page", { page })
107
+ }, toDisplayString(page), 11, _hoisted_5)) : (openBlock(), createElementBlock("div", {
106
108
  key: 1,
107
109
  class: normalizeClass(BTN_CLASS)
108
110
  }, toDisplayString(DOTS)))
109
111
  ])
110
- ], 8, _hoisted_2);
112
+ ], 8, _hoisted_3);
111
113
  }), 128)),
112
114
  createElementVNode("div", {
113
115
  class: normalizeClass([BTN_CLASS, __props.modelValue === pageCount.value ? ARROW_INACTIVE_CLASS : ARROW_ACTIVE_CLASS]),
114
- "aria-label": "go to the next page",
116
+ "aria-label": _ctx.$t("squirrel.pagination_go_to_next_page"),
115
117
  onClick: _cache[1] || (_cache[1] = ($event) => setPage(Number(__props.modelValue) + 1))
116
118
  }, [
117
119
  createVNode(_sfc_main$1, {
118
120
  icon: "chevron-right",
119
121
  width: "24px"
120
122
  })
121
- ], 2)
123
+ ], 10, _hoisted_6)
122
124
  ])) : createCommentVNode("", true)
123
125
  ], 64);
124
126
  };
@@ -1,10 +1,5 @@
1
1
  import { defineComponent, createElementBlock, openBlock, Fragment, renderList, normalizeClass, toDisplayString } from "vue";
2
- const _hoisted_1 = {
3
- class: "flex h-6 w-fit flex-row space-x-1 overflow-x-auto rounded bg-p-gray-10 p-1 text-sm font-medium text-p-gray-50",
4
- "aria-label": "Tabs Pills",
5
- role: "tablist",
6
- "aria-orientation": "horizontal"
7
- };
2
+ const _hoisted_1 = ["aria-label"];
8
3
  const _hoisted_2 = ["disabled", "aria-selected", "data-tab", "aria-controls", "onClick"];
9
4
  const _sfc_main = /* @__PURE__ */ defineComponent({
10
5
  ...{
@@ -20,7 +15,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
20
15
  emits: ["update:modelValue"],
21
16
  setup(__props) {
22
17
  return (_ctx, _cache) => {
23
- return openBlock(), createElementBlock("nav", _hoisted_1, [
18
+ return openBlock(), createElementBlock("nav", {
19
+ class: "flex h-6 w-fit flex-row space-x-1 overflow-x-auto rounded bg-p-gray-10 p-1 text-sm font-medium text-p-gray-50",
20
+ "aria-label": _ctx.$t("squirrel.tabs_pills_aria_label"),
21
+ role: "tablist",
22
+ "aria-orientation": "horizontal"
23
+ }, [
24
24
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (tab) => {
25
25
  return openBlock(), createElementBlock("button", {
26
26
  key: String(tab[__props.itemValue]),
@@ -36,7 +36,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
36
36
  onClick: ($event) => _ctx.$emit("update:modelValue", tab[__props.itemValue])
37
37
  }, toDisplayString(tab[__props.itemText]), 11, _hoisted_2);
38
38
  }), 128))
39
- ]);
39
+ ], 8, _hoisted_1);
40
40
  };
41
41
  }
42
42
  });