@pequity/squirrel 1.2.10 → 1.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -8,7 +8,7 @@ const pDropdown = require("./p-dropdown.js");
8
8
  const pAlert = require("./p-alert.js");
9
9
  const pAvatar = require("./p-avatar.js");
10
10
  const pCard_vue_vue_type_script_setup_true_lang = require("./chunks/p-card.js");
11
- const pCheckbox_vue_vue_type_script_setup_true_lang = require("./chunks/p-checkbox.js");
11
+ const pCheckbox = require("./p-checkbox.js");
12
12
  const pChips = require("./p-chips.js");
13
13
  const pDatePicker = require("./p-date-picker.js");
14
14
  const pDrawer = require("./p-drawer.js");
@@ -1044,7 +1044,7 @@ exports.PDropdown = pDropdown;
1044
1044
  exports.PAlert = pAlert;
1045
1045
  exports.PAvatar = pAvatar;
1046
1046
  exports.PCard = pCard_vue_vue_type_script_setup_true_lang._sfc_main;
1047
- exports.PCheckbox = pCheckbox_vue_vue_type_script_setup_true_lang._sfc_main;
1047
+ exports.PCheckbox = pCheckbox;
1048
1048
  exports.PChips = pChips;
1049
1049
  exports.PDatePicker = pDatePicker;
1050
1050
  exports.PDrawer = pDrawer;
@@ -1,3 +1,46 @@
1
1
  "use strict";
2
- const pCheckbox_vue_vue_type_script_setup_true_lang = require("./chunks/p-checkbox.js");
3
- module.exports = pCheckbox_vue_vue_type_script_setup_true_lang._sfc_main;
2
+ const vue = require("vue");
3
+ const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
4
+ const _hoisted_1 = { class: "inline-flex items-center" };
5
+ const _hoisted_2 = ["checked"];
6
+ const _hoisted_3 = {
7
+ key: 0,
8
+ class: "ml-2 text-sm"
9
+ };
10
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
11
+ ...{
12
+ name: "PCheckbox",
13
+ inheritAttrs: false
14
+ },
15
+ __name: "p-checkbox",
16
+ props: {
17
+ modelValue: {
18
+ type: Boolean,
19
+ default: false
20
+ },
21
+ label: {
22
+ type: String,
23
+ default: ""
24
+ }
25
+ },
26
+ emits: ["update:modelValue"],
27
+ setup(__props) {
28
+ return (_ctx, _cache) => {
29
+ return vue.openBlock(), vue.createElementBlock("label", _hoisted_1, [
30
+ vue.renderSlot(_ctx.$slots, "label-before", {}, void 0, true),
31
+ vue.createElementVNode("input", vue.mergeProps({
32
+ type: "checkbox",
33
+ class: "h-4 w-4 shrink-0 appearance-none rounded border border-p-gray-30 bg-surface duration-100 ease-in-out checked:border-none checked:bg-primary disabled:opacity-50",
34
+ checked: __props.modelValue
35
+ }, _ctx.$attrs, {
36
+ onChange: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", $event.target.checked))
37
+ }), null, 16, _hoisted_2),
38
+ vue.renderSlot(_ctx.$slots, "label", {}, () => [
39
+ __props.label ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3, vue.toDisplayString(__props.label), 1)) : vue.createCommentVNode("", true)
40
+ ], true)
41
+ ]);
42
+ };
43
+ }
44
+ });
45
+ const pCheckbox = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-6729bf3b"]]);
46
+ module.exports = pCheckbox;
package/dist/es/index.js CHANGED
@@ -6,52 +6,52 @@ import PDropdown from "./p-dropdown.js";
6
6
  import { default as default2 } from "./p-alert.js";
7
7
  import { default as default3 } from "./p-avatar.js";
8
8
  import { _ } from "./chunks/p-card.js";
9
- import { _ as _2 } from "./chunks/p-checkbox.js";
10
- import { default as default4 } from "./p-chips.js";
11
- import { default as default5 } from "./p-date-picker.js";
12
- import { default as default6 } from "./p-drawer.js";
9
+ import { default as default4 } from "./p-checkbox.js";
10
+ import { default as default5 } from "./p-chips.js";
11
+ import { default as default6 } from "./p-date-picker.js";
12
+ import { default as default7 } from "./p-drawer.js";
13
13
  import { a as _imports_0$2 } from "./chunks/p-dropdown-select.js";
14
- import { _ as _3 } from "./chunks/p-dropdown-select.js";
14
+ import { _ as _2 } from "./chunks/p-dropdown-select.js";
15
15
  import { formatBytes, getFileExtension } from "./p-file-upload.js";
16
16
  import { uniq, kebabCase } from "lodash-es";
17
17
  import { useInputClasses } from "./useInputClasses.js";
18
18
  import { useToast } from "vue-toastification";
19
19
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
20
- import { default as default7 } from "./p-table-filter-icon.js";
21
- import { default as default8 } from "./p-info-icon.js";
22
- import { default as default9 } from "./p-inline-date-picker.js";
23
- import { default as default10 } from "./p-input.js";
24
- import { default as default11 } from "./p-input-number.js";
25
- import { _ as _4 } from "./chunks/p-input-percent.js";
20
+ import { default as default8 } from "./p-table-filter-icon.js";
21
+ import { default as default9 } from "./p-info-icon.js";
22
+ import { default as default10 } from "./p-inline-date-picker.js";
23
+ import { default as default11 } from "./p-input.js";
24
+ import { default as default12 } from "./p-input-number.js";
25
+ import { _ as _3 } from "./chunks/p-input-percent.js";
26
26
  import PInputSearch from "./p-input-search.js";
27
- import { default as default12 } from "./p-loading.js";
28
- import { default as default13 } from "./p-modal.js";
29
- import { _ as _5 } from "./chunks/p-pagination.js";
30
- import { _ as _6 } from "./chunks/p-pagination-info.js";
31
- import { default as default14 } from "./p-progress-bar.js";
32
- import { _ as _7 } from "./chunks/p-ring-loader.js";
33
- import { _ as _8 } from "./chunks/p-select.js";
34
- import { _ as _9 } from "./chunks/p-select-btn.js";
27
+ import { default as default13 } from "./p-loading.js";
28
+ import { default as default14 } from "./p-modal.js";
29
+ import { _ as _4 } from "./chunks/p-pagination.js";
30
+ import { _ as _5 } from "./chunks/p-pagination-info.js";
31
+ import { default as default15 } from "./p-progress-bar.js";
32
+ import { _ as _6 } from "./chunks/p-ring-loader.js";
33
+ import { _ as _7 } from "./chunks/p-select.js";
34
+ import { _ as _8 } from "./chunks/p-select-btn.js";
35
35
  import { SIZES } from "./p-select-list.js";
36
36
  import { splitStringForHighlight } from "./text.js";
37
37
  import { toString } from "./string.js";
38
38
  import { useSelectList } from "./useSelectList.js";
39
- import { default as default15 } from "./p-select-pill.js";
40
- import { default as default16 } from "./p-skeleton-loader.js";
39
+ import { default as default16 } from "./p-select-pill.js";
40
+ import { default as default17 } from "./p-skeleton-loader.js";
41
41
  import PTableHeaderCell from "./p-table-header-cell.js";
42
42
  import { colsInjectionKey, isFirstColFixedInjectionKey, isLastColFixedInjectionKey, isColsResizableInjectionKey } from "./p-table.js";
43
43
  import { MIN_WIDTH_COL_RESIZE } from "./p-table.js";
44
44
  import { usePTableColResize } from "./usePTableColResize.js";
45
- import { _ as _10 } from "./chunks/p-table-loader.js";
45
+ import { _ as _9 } from "./chunks/p-table-loader.js";
46
46
  import { SORTING_TYPES } from "./p-table-sort.js";
47
- import { default as default17 } from "./p-table-td.js";
48
- import { _ as _11 } from "./chunks/p-tabs.js";
49
- import { default as default18 } from "./p-textarea.js";
50
- import { default as default19 } from "./p-toggle.js";
47
+ import { default as default18 } from "./p-table-td.js";
48
+ import { _ as _10 } from "./chunks/p-tabs.js";
49
+ import { default as default19 } from "./p-textarea.js";
50
+ import { default as default20 } from "./p-toggle.js";
51
51
  import { usePLoading } from "./usePLoading.js";
52
52
  import { usePModal } from "./usePModal.js";
53
53
  import { usePTableRowVirtualizer } from "./usePTableRowVirtualizer.js";
54
- import { default as default20 } from "./inputClassesMixin.js";
54
+ import { default as default21 } from "./inputClassesMixin.js";
55
55
  import { CURRENCY_INPUT_DEFAULTS } from "./currency.js";
56
56
  import { getColor, getColorDeep, getScreen } from "./tailwind.js";
57
57
  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";
@@ -1053,40 +1053,40 @@ export {
1053
1053
  default3 as PAvatar,
1054
1054
  PBtn,
1055
1055
  _ as PCard,
1056
- _2 as PCheckbox,
1057
- default4 as PChips,
1056
+ default4 as PCheckbox,
1057
+ default5 as PChips,
1058
1058
  PCloseBtn,
1059
- default5 as PDatePicker,
1060
- default6 as PDrawer,
1059
+ default6 as PDatePicker,
1060
+ default7 as PDrawer,
1061
1061
  PDropdown,
1062
- _3 as PDropdownSelect,
1062
+ _2 as PDropdownSelect,
1063
1063
  pFileUpload as PFileUpload,
1064
- default7 as PFilterIcon,
1065
- default8 as PInfoIcon,
1066
- default9 as PInlineDatePicker,
1067
- default10 as PInput,
1068
- default11 as PInputNumber,
1069
- _4 as PInputPercent,
1064
+ default8 as PFilterIcon,
1065
+ default9 as PInfoIcon,
1066
+ default10 as PInlineDatePicker,
1067
+ default11 as PInput,
1068
+ default12 as PInputNumber,
1069
+ _3 as PInputPercent,
1070
1070
  PInputSearch,
1071
- default12 as PLoading,
1072
- default13 as PModal,
1073
- _5 as PPagination,
1074
- _6 as PPaginationInfo,
1075
- default14 as PProgressBar,
1076
- _7 as PRingLoader,
1077
- _8 as PSelect,
1078
- _9 as PSelectBtn,
1071
+ default13 as PLoading,
1072
+ default14 as PModal,
1073
+ _4 as PPagination,
1074
+ _5 as PPaginationInfo,
1075
+ default15 as PProgressBar,
1076
+ _6 as PRingLoader,
1077
+ _7 as PSelect,
1078
+ _8 as PSelectBtn,
1079
1079
  _sfc_main$2 as PSelectList,
1080
- default15 as PSelectPill,
1081
- default16 as PSkeletonLoader,
1080
+ default16 as PSelectPill,
1081
+ default17 as PSkeletonLoader,
1082
1082
  pTable as PTable,
1083
1083
  PTableHeaderCell,
1084
- _10 as PTableLoader,
1084
+ _9 as PTableLoader,
1085
1085
  pTableSort as PTableSort,
1086
- default17 as PTableTd,
1087
- _11 as PTabs,
1088
- default18 as PTextarea,
1089
- default19 as PToggle,
1086
+ default18 as PTableTd,
1087
+ _10 as PTabs,
1088
+ default19 as PTextarea,
1089
+ default20 as PToggle,
1090
1090
  SELECT_ARROW,
1091
1091
  SELECT_BASE,
1092
1092
  SELECT_SIZES,
@@ -1103,7 +1103,7 @@ export {
1103
1103
  getColorDeep,
1104
1104
  getNextActiveElement,
1105
1105
  getScreen,
1106
- default20 as inputClassesMixin,
1106
+ default21 as inputClassesMixin,
1107
1107
  isColsResizableInjectionKey,
1108
1108
  isElement,
1109
1109
  isFirstColFixedInjectionKey,
@@ -1,4 +1,47 @@
1
- import { _ as _sfc_main } from "./chunks/p-checkbox.js";
1
+ import { defineComponent, openBlock, createElementBlock, renderSlot, createElementVNode, mergeProps, toDisplayString, createCommentVNode } from "vue";
2
+ import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
3
+ const _hoisted_1 = { class: "inline-flex items-center" };
4
+ const _hoisted_2 = ["checked"];
5
+ const _hoisted_3 = {
6
+ key: 0,
7
+ class: "ml-2 text-sm"
8
+ };
9
+ const _sfc_main = /* @__PURE__ */ defineComponent({
10
+ ...{
11
+ name: "PCheckbox",
12
+ inheritAttrs: false
13
+ },
14
+ __name: "p-checkbox",
15
+ props: {
16
+ modelValue: {
17
+ type: Boolean,
18
+ default: false
19
+ },
20
+ label: {
21
+ type: String,
22
+ default: ""
23
+ }
24
+ },
25
+ emits: ["update:modelValue"],
26
+ setup(__props) {
27
+ return (_ctx, _cache) => {
28
+ return openBlock(), createElementBlock("label", _hoisted_1, [
29
+ renderSlot(_ctx.$slots, "label-before", {}, void 0, true),
30
+ createElementVNode("input", mergeProps({
31
+ type: "checkbox",
32
+ class: "h-4 w-4 shrink-0 appearance-none rounded border border-p-gray-30 bg-surface duration-100 ease-in-out checked:border-none checked:bg-primary disabled:opacity-50",
33
+ checked: __props.modelValue
34
+ }, _ctx.$attrs, {
35
+ onChange: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", $event.target.checked))
36
+ }), null, 16, _hoisted_2),
37
+ renderSlot(_ctx.$slots, "label", {}, () => [
38
+ __props.label ? (openBlock(), createElementBlock("div", _hoisted_3, toDisplayString(__props.label), 1)) : createCommentVNode("", true)
39
+ ], true)
40
+ ]);
41
+ };
42
+ }
43
+ });
44
+ const pCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6729bf3b"]]);
2
45
  export {
3
- _sfc_main as default
46
+ pCheckbox as default
4
47
  };
@@ -1,5 +1,4 @@
1
1
  import { type PropType } from 'vue';
2
- import { type RouteLocationRaw } from 'vue-router';
3
2
  import { type Size } from './p-btn.types';
4
3
  declare const BUTTON_TYPES: {
5
4
  readonly PRIMARY: "primary";
@@ -61,7 +60,7 @@ declare const _default: import("vue").DefineComponent<{
61
60
  * See https://router.vuejs.org/api/#RouteLocationRaw
62
61
  */
63
62
  to: {
64
- type: PropType<RouteLocationRaw>;
63
+ type: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
65
64
  default: string;
66
65
  };
67
66
  }, unknown, {
@@ -117,7 +116,7 @@ declare const _default: import("vue").DefineComponent<{
117
116
  * See https://router.vuejs.org/api/#RouteLocationRaw
118
117
  */
119
118
  to: {
120
- type: PropType<RouteLocationRaw>;
119
+ type: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
121
120
  default: string;
122
121
  };
123
122
  }>>, {
@@ -126,6 +125,6 @@ declare const _default: import("vue").DefineComponent<{
126
125
  nativeType: "button" | "submit" | "reset";
127
126
  loading: boolean;
128
127
  selected: boolean;
129
- to: RouteLocationRaw;
128
+ to: string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric;
130
129
  }, {}>;
131
130
  export default _default;
@@ -1,8 +1,12 @@
1
- declare const _default: import("vue").DefineComponent<{
1
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
2
2
  modelValue: {
3
3
  type: BooleanConstructor;
4
4
  default: boolean;
5
5
  };
6
+ label: {
7
+ type: StringConstructor;
8
+ default: string;
9
+ };
6
10
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
11
  "update:modelValue": (...args: any[]) => void;
8
12
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -10,9 +14,22 @@ declare const _default: import("vue").DefineComponent<{
10
14
  type: BooleanConstructor;
11
15
  default: boolean;
12
16
  };
17
+ label: {
18
+ type: StringConstructor;
19
+ default: string;
20
+ };
13
21
  }>> & {
14
22
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
15
23
  }, {
24
+ label: string;
16
25
  modelValue: boolean;
17
- }, {}>;
26
+ }, {}>, {
27
+ "label-before"?(_: {}): any;
28
+ label?(_: {}): any;
29
+ }>;
18
30
  export default _default;
31
+ type __VLS_WithTemplateSlots<T, S> = T & {
32
+ new (): {
33
+ $slots: S;
34
+ };
35
+ };
@@ -17,7 +17,7 @@ export declare const usePTableRowVirtualizer: (options: Options) => {
17
17
  measureElement: () => Ref<undefined>;
18
18
  } | {
19
19
  virtualizer: Ref<import("@tanstack/vue-virtual").Virtualizer<HTMLElement, Element>>;
20
- virtualRows: ComputedRef<import("@tanstack/vue-virtual").VirtualItem[]>;
20
+ virtualRows: ComputedRef<import("@tanstack/vue-virtual").VirtualItem<Element>[]>;
21
21
  paddingTop: ComputedRef<number>;
22
22
  paddingBottom: ComputedRef<number>;
23
23
  measureElement: (cmp: ComponentPublicInstance | Ref<HTMLElement>) => undefined;
package/dist/style.css CHANGED
@@ -256,6 +256,10 @@ div[id^=popper_].dropdown .v-popper__inner .dropdown-menu .dropdown-divider {
256
256
  --tw-content: "";
257
257
  content: var(--tw-content);
258
258
  }
259
+ input[type='checkbox'][data-v-6729bf3b]:checked {
260
+ background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E");
261
+ }
262
+
259
263
  .bg-cross[data-v-cb511035] {
260
264
  background-image: url("data:image/svg+xml,%3csvg%20width='6'%20height='6'%20viewBox='0%200%206%206'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_2511_8629)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M3%203.51667L5.42083%205.9375L5.9375%205.42083L3.51667%203L5.9375%200.57917L5.42083%200.0625L3%202.48333L0.57917%200.0625L0.0625%200.57917L2.48333%203L0.0625%205.42083L0.57917%205.9375L3%203.51667Z'%20fill='%231A123B'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_2511_8629'%3e%3crect%20width='6'%20height='6'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e");
261
265
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pequity/squirrel",
3
3
  "description": "Squirrel component library",
4
- "version": "1.2.10",
4
+ "version": "1.2.11",
5
5
  "packageManager": "pnpm@8.9.2",
6
6
  "type": "module",
7
7
  "scripts": {
@@ -58,26 +58,26 @@
58
58
  "@popperjs/core": "2.11.8",
59
59
  "@semantic-release/changelog": "^6.0.3",
60
60
  "@semantic-release/git": "^10.0.1",
61
- "@storybook/addon-a11y": "^8.1.9",
62
- "@storybook/addon-actions": "^8.1.9",
63
- "@storybook/addon-essentials": "^8.1.9",
64
- "@storybook/addon-interactions": "^8.1.9",
65
- "@storybook/addon-links": "^8.1.9",
66
- "@storybook/blocks": "^8.1.9",
61
+ "@storybook/addon-a11y": "^8.1.10",
62
+ "@storybook/addon-actions": "^8.1.10",
63
+ "@storybook/addon-essentials": "^8.1.10",
64
+ "@storybook/addon-interactions": "^8.1.10",
65
+ "@storybook/addon-links": "^8.1.10",
66
+ "@storybook/blocks": "^8.1.10",
67
67
  "@storybook/jest": "^0.2.3",
68
- "@storybook/manager-api": "^8.1.9",
69
- "@storybook/test-runner": "^0.18.2",
68
+ "@storybook/manager-api": "^8.1.10",
69
+ "@storybook/test-runner": "^0.19.0",
70
70
  "@storybook/testing-library": "^0.2.2",
71
- "@storybook/theming": "^8.1.9",
72
- "@storybook/vue3": "^8.1.9",
73
- "@storybook/vue3-vite": "^8.1.9",
74
- "@tanstack/vue-virtual": "3.5.1",
71
+ "@storybook/theming": "^8.1.10",
72
+ "@storybook/vue3": "^8.1.10",
73
+ "@storybook/vue3-vite": "^8.1.10",
74
+ "@tanstack/vue-virtual": "3.7.0",
75
75
  "@types/jest": "^29.5.12",
76
76
  "@types/jsdom": "^21.1.7",
77
77
  "@types/lodash-es": "^4.17.12",
78
- "@types/node": "^20.14.2",
78
+ "@types/node": "^20.14.8",
79
79
  "@vitejs/plugin-vue": "^5.0.5",
80
- "@vue/compiler-sfc": "3.4.27",
80
+ "@vue/compiler-sfc": "3.4.30",
81
81
  "@vue/test-utils": "^2.4.6",
82
82
  "@vue/vue3-jest": "^29.2.6",
83
83
  "autoprefixer": "^10.4.19",
@@ -86,7 +86,7 @@
86
86
  "eslint": "^8.57.0",
87
87
  "eslint-plugin-storybook": "^0.8.0",
88
88
  "floating-vue": "5.2.2",
89
- "glob": "^10.4.1",
89
+ "glob": "^10.4.2",
90
90
  "husky": "^9.0.11",
91
91
  "jest": "^29.7.0",
92
92
  "jest-environment-jsdom": "^29.7.0",
@@ -95,22 +95,22 @@
95
95
  "make-coverage-badge": "^1.2.0",
96
96
  "postcss": "^8.4.38",
97
97
  "prettier": "^3.3.2",
98
- "prettier-plugin-tailwindcss": "^0.6.4",
98
+ "prettier-plugin-tailwindcss": "^0.6.5",
99
99
  "resolve-tspaths": "^0.8.19",
100
100
  "rimraf": "^5.0.7",
101
- "sass": "^1.77.5",
101
+ "sass": "^1.77.6",
102
102
  "semantic-release": "^24.0.0",
103
- "storybook": "^8.1.9",
103
+ "storybook": "^8.1.10",
104
104
  "svgo": "^3.3.2",
105
105
  "tailwindcss": "^3.4.4",
106
- "ts-jest": "^29.1.4",
106
+ "ts-jest": "^29.1.5",
107
107
  "typescript": "5.4.5",
108
108
  "v-calendar": "3.1.2",
109
- "vite": "^5.3.0",
110
- "vue": "3.4.27",
109
+ "vite": "^5.3.1",
110
+ "vue": "3.4.30",
111
111
  "vue-currency-input": "3.1.0",
112
- "vue-router": "4.3.3",
112
+ "vue-router": "4.4.0",
113
113
  "vue-toastification": "2.0.0-rc.5",
114
- "vue-tsc": "2.0.21"
114
+ "vue-tsc": "2.0.22"
115
115
  }
116
116
  }
@@ -1,6 +1,22 @@
1
1
  import PCheckbox from '@squirrel/components/p-checkbox/p-checkbox.vue';
2
2
  import { createWrapperFor } from '@tests/jest.helpers';
3
3
 
4
+ const checkboxClasses = [
5
+ 'h-4',
6
+ 'w-4',
7
+ 'shrink-0',
8
+ 'appearance-none',
9
+ 'rounded',
10
+ 'border',
11
+ 'border-p-gray-30',
12
+ 'bg-surface',
13
+ 'duration-100',
14
+ 'ease-in-out',
15
+ 'checked:border-none',
16
+ 'checked:bg-primary',
17
+ 'disabled:opacity-50',
18
+ ];
19
+
4
20
  describe('PCheckbox.vue', () => {
5
21
  it('renders correctly', async () => {
6
22
  const wrapper = createWrapperFor(PCheckbox);
@@ -9,7 +25,7 @@ describe('PCheckbox.vue', () => {
9
25
 
10
26
  expect(input.exists()).toBe(true);
11
27
  expect(input.attributes().type).toBe('checkbox');
12
- expect(input.classes()).toEqual(['cursor-pointer', 'accent-p-blue-50']);
28
+ expect(input.classes()).toEqual(checkboxClasses);
13
29
  expect(input.attributes().disabled).toBeUndefined();
14
30
  });
15
31
 
@@ -20,7 +36,7 @@ describe('PCheckbox.vue', () => {
20
36
 
21
37
  expect(input.exists()).toBe(true);
22
38
  expect(input.attributes().type).toBe('checkbox');
23
- expect(input.classes()).toEqual(['cursor-pointer', 'accent-p-blue-50']);
39
+ expect(input.classes()).toEqual(checkboxClasses);
24
40
  expect(input.attributes().disabled).toBeDefined();
25
41
  });
26
42
  });
@@ -8,7 +8,7 @@ export default {
8
8
  parameters: {
9
9
  docs: {
10
10
  description: {
11
- component: 'Checkbox Component',
11
+ component: 'Checkboxes allow the user to select multiple options from a set.',
12
12
  },
13
13
  },
14
14
  },
@@ -25,7 +25,39 @@ export const Default = {
25
25
  template: `<PCheckbox v-bind="args" @click="onClick" />`,
26
26
  }),
27
27
  args: {
28
- checked: false,
28
+ modelValue: false,
29
29
  disabled: false,
30
30
  },
31
31
  };
32
+
33
+ export const WithLabel = {
34
+ args: {
35
+ ...Default.args,
36
+ label: 'Checkbox label',
37
+ },
38
+ };
39
+
40
+ export const WithLabelBefore = {
41
+ render: (args) => {
42
+ const { default: defaultSlot, labelBefore, ...argsWithoutSlots } = args;
43
+
44
+ return {
45
+ components: { PCheckbox },
46
+ setup() {
47
+ return { argsWithoutSlots };
48
+ },
49
+ template: `
50
+ <PCheckbox v-bind="argsWithoutSlots">
51
+ <template #label-before>
52
+ <div class="text-sm mr-2">${args.labelBefore}</div>
53
+ </template>
54
+ </PCheckbox>
55
+ `,
56
+ };
57
+ },
58
+ args: {
59
+ modelValue: false,
60
+ disabled: false,
61
+ labelBefore: 'Test label',
62
+ },
63
+ };
@@ -1,13 +1,27 @@
1
1
  <template>
2
- <input
3
- type="checkbox"
4
- class="cursor-pointer accent-p-blue-50"
5
- :checked="modelValue"
6
- @change="$emit('update:modelValue', ($event.target as HTMLInputElement).checked)"
7
- />
2
+ <label class="inline-flex items-center">
3
+ <slot name="label-before"></slot>
4
+ <input
5
+ type="checkbox"
6
+ class="h-4 w-4 shrink-0 appearance-none rounded border border-p-gray-30 bg-surface duration-100 ease-in-out checked:border-none checked:bg-primary disabled:opacity-50"
7
+ :checked="modelValue"
8
+ v-bind="$attrs"
9
+ @change="$emit('update:modelValue', ($event.target as HTMLInputElement).checked)"
10
+ />
11
+ <slot name="label">
12
+ <div v-if="label" class="ml-2 text-sm">
13
+ {{ label }}
14
+ </div>
15
+ </slot>
16
+ </label>
8
17
  </template>
9
18
 
10
19
  <script setup lang="ts">
20
+ defineOptions({
21
+ name: 'PCheckbox',
22
+ inheritAttrs: false,
23
+ });
24
+
11
25
  defineEmits(['update:modelValue']);
12
26
 
13
27
  defineProps({
@@ -15,5 +29,15 @@ defineProps({
15
29
  type: Boolean,
16
30
  default: false,
17
31
  },
32
+ label: {
33
+ type: String,
34
+ default: '',
35
+ },
18
36
  });
19
37
  </script>
38
+
39
+ <style lang="css" scoped>
40
+ input[type='checkbox']:checked {
41
+ background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E");
42
+ }
43
+ </style>
@@ -1,24 +0,0 @@
1
- "use strict";
2
- const vue = require("vue");
3
- const _hoisted_1 = ["checked"];
4
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
5
- __name: "p-checkbox",
6
- props: {
7
- modelValue: {
8
- type: Boolean,
9
- default: false
10
- }
11
- },
12
- emits: ["update:modelValue"],
13
- setup(__props) {
14
- return (_ctx, _cache) => {
15
- return vue.openBlock(), vue.createElementBlock("input", {
16
- type: "checkbox",
17
- class: "cursor-pointer accent-p-blue-50",
18
- checked: __props.modelValue,
19
- onChange: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", $event.target.checked))
20
- }, null, 40, _hoisted_1);
21
- };
22
- }
23
- });
24
- exports._sfc_main = _sfc_main;
@@ -1,25 +0,0 @@
1
- import { defineComponent, openBlock, createElementBlock } from "vue";
2
- const _hoisted_1 = ["checked"];
3
- const _sfc_main = /* @__PURE__ */ defineComponent({
4
- __name: "p-checkbox",
5
- props: {
6
- modelValue: {
7
- type: Boolean,
8
- default: false
9
- }
10
- },
11
- emits: ["update:modelValue"],
12
- setup(__props) {
13
- return (_ctx, _cache) => {
14
- return openBlock(), createElementBlock("input", {
15
- type: "checkbox",
16
- class: "cursor-pointer accent-p-blue-50",
17
- checked: __props.modelValue,
18
- onChange: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", $event.target.checked))
19
- }, null, 40, _hoisted_1);
20
- };
21
- }
22
- });
23
- export {
24
- _sfc_main as _
25
- };