@pequity/squirrel 6.1.0 → 7.0.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 (98) hide show
  1. package/dist/cjs/chunks/p-alert.js +52 -0
  2. package/dist/cjs/chunks/p-avatar.js +65 -0
  3. package/dist/cjs/chunks/p-btn.js +4 -4
  4. package/dist/cjs/chunks/p-date-picker.js +2 -2
  5. package/dist/cjs/chunks/p-input-number.js +161 -0
  6. package/dist/cjs/chunks/p-input-percent.js +2 -2
  7. package/dist/cjs/chunks/p-input.js +111 -0
  8. package/dist/cjs/chunks/p-progress-bar.js +38 -0
  9. package/dist/cjs/chunks/p-select-btn.js +3 -4
  10. package/dist/cjs/chunks/p-textarea.js +89 -0
  11. package/dist/cjs/index.js +69 -76
  12. package/dist/cjs/inputClasses.js +8 -2
  13. package/dist/cjs/p-alert.js +2 -64
  14. package/dist/cjs/p-avatar.js +2 -70
  15. package/dist/cjs/p-drawer.js +2 -2
  16. package/dist/cjs/p-input-number.js +2 -145
  17. package/dist/cjs/p-input-search.js +2 -2
  18. package/dist/cjs/p-input.js +2 -92
  19. package/dist/cjs/p-modal.js +2 -2
  20. package/dist/cjs/p-progress-bar.js +2 -40
  21. package/dist/cjs/p-table-filter-icon.js +14 -9
  22. package/dist/cjs/p-textarea.js +2 -72
  23. package/dist/cjs/p-toggle.js +76 -64
  24. package/dist/cjs/useInputClasses.js +13 -18
  25. package/dist/es/chunks/p-alert.js +53 -0
  26. package/dist/es/chunks/p-avatar.js +66 -0
  27. package/dist/es/chunks/p-btn.js +4 -4
  28. package/dist/es/chunks/p-date-picker.js +2 -2
  29. package/dist/es/chunks/p-input-number.js +162 -0
  30. package/dist/es/chunks/p-input-percent.js +2 -2
  31. package/dist/es/chunks/p-input.js +112 -0
  32. package/dist/es/chunks/p-progress-bar.js +39 -0
  33. package/dist/es/chunks/p-select-btn.js +4 -5
  34. package/dist/es/chunks/p-textarea.js +90 -0
  35. package/dist/es/index.js +119 -126
  36. package/dist/es/inputClasses.js +8 -2
  37. package/dist/es/p-alert.js +2 -64
  38. package/dist/es/p-avatar.js +2 -70
  39. package/dist/es/p-drawer.js +2 -2
  40. package/dist/es/p-input-number.js +2 -145
  41. package/dist/es/p-input-search.js +2 -2
  42. package/dist/es/p-input.js +2 -92
  43. package/dist/es/p-modal.js +2 -2
  44. package/dist/es/p-progress-bar.js +2 -40
  45. package/dist/es/p-table-filter-icon.js +14 -9
  46. package/dist/es/p-textarea.js +2 -72
  47. package/dist/es/p-toggle.js +77 -65
  48. package/dist/es/useInputClasses.js +14 -19
  49. package/dist/squirrel/components/p-alert/p-alert.vue.d.ts +27 -10
  50. package/dist/squirrel/components/p-avatar/p-avatar.vue.d.ts +9 -10
  51. package/dist/squirrel/components/p-btn/p-btn.vue.d.ts +28 -28
  52. package/dist/squirrel/components/p-date-picker/p-date-picker.vue.d.ts +2 -2
  53. package/dist/squirrel/components/p-drawer/p-drawer.vue.d.ts +37 -13
  54. package/dist/squirrel/components/p-inline-date-picker/p-inline-date-picker.vue.d.ts +2 -2
  55. package/dist/squirrel/components/p-input/p-input.vue.d.ts +30 -61
  56. package/dist/squirrel/components/p-input-number/p-input-number.vue.d.ts +101 -65
  57. package/dist/squirrel/components/p-input-search/p-input-search.vue.d.ts +113 -83
  58. package/dist/squirrel/components/p-modal/p-modal.vue.d.ts +2 -2
  59. package/dist/squirrel/components/p-progress-bar/p-progress-bar.vue.d.ts +5 -20
  60. package/dist/squirrel/components/p-table-header-cell/p-table-header-cell.vue.d.ts +1 -1
  61. package/dist/squirrel/components/p-table-loader/p-table-loader.vue.d.ts +1 -1
  62. package/dist/squirrel/components/p-table-sort/p-table-sort.vue.d.ts +3 -7
  63. package/dist/squirrel/components/p-textarea/p-textarea.vue.d.ts +79 -42
  64. package/dist/squirrel/components/p-toggle/p-toggle.vue.d.ts +25 -62
  65. package/dist/squirrel/composables/useInputClasses.d.ts +2 -1
  66. package/dist/squirrel/utils/index.d.ts +1 -3
  67. package/dist/squirrel/utils/inputClasses.d.ts +12 -0
  68. package/dist/squirrel.css +5 -5
  69. package/package.json +19 -19
  70. package/squirrel/components/p-alert/p-alert.spec.js +9 -8
  71. package/squirrel/components/p-alert/p-alert.vue +19 -31
  72. package/squirrel/components/p-avatar/p-avatar.spec.ts +10 -3
  73. package/squirrel/components/p-avatar/p-avatar.vue +40 -42
  74. package/squirrel/components/p-btn/p-btn.spec.js +7 -7
  75. package/squirrel/components/p-btn/p-btn.vue +4 -4
  76. package/squirrel/components/p-input/p-input.vue +63 -40
  77. package/squirrel/components/p-input-number/p-input-number.vue +101 -86
  78. package/squirrel/components/p-progress-bar/p-progress-bar.vue +9 -14
  79. package/squirrel/components/p-select-btn/p-select-btn.spec.js +24 -5
  80. package/squirrel/components/p-select-btn/p-select-btn.vue +1 -1
  81. package/squirrel/components/p-table-header-cell/p-table-filter-icon.vue +8 -9
  82. package/squirrel/components/p-table-sort/p-table-sort.vue +13 -16
  83. package/squirrel/components/p-textarea/p-textarea.vue +55 -37
  84. package/squirrel/components/p-toggle/p-toggle.vue +59 -43
  85. package/squirrel/composables/useInputClasses.spec.js +50 -13
  86. package/squirrel/composables/useInputClasses.ts +18 -24
  87. package/squirrel/utils/index.ts +0 -7
  88. package/squirrel/utils/inputClasses.ts +8 -2
  89. package/dist/cjs/inputClassesMixin.js +0 -58
  90. package/dist/cjs/tailwind.js +0 -25
  91. package/dist/es/inputClassesMixin.js +0 -59
  92. package/dist/es/tailwind.js +0 -25
  93. package/dist/squirrel/utils/inputClassesMixin.d.ts +0 -56
  94. package/dist/squirrel/utils/tailwind.d.ts +0 -8
  95. package/squirrel/utils/inputClassesMixin.spec.js +0 -241
  96. package/squirrel/utils/inputClassesMixin.ts +0 -60
  97. package/squirrel/utils/tailwind.spec.js +0 -27
  98. package/squirrel/utils/tailwind.ts +0 -28
@@ -1,11 +1,11 @@
1
1
  import { S as SIZES } from "./chunks/p-btn.types.js";
2
- import PInput from "./p-input.js";
2
+ import { _ as _sfc_main$1 } from "./chunks/p-input.js";
3
3
  import { defineComponent, resolveComponent, resolveDirective, createBlock, openBlock, mergeProps, withKeys, withCtx, withDirectives, createCommentVNode, createElementBlock, normalizeClass, createElementVNode } from "vue";
4
4
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
5
5
  const _sfc_main = defineComponent({
6
6
  name: "PInputSearch",
7
7
  components: {
8
- PInput
8
+ PInput: _sfc_main$1
9
9
  },
10
10
  inheritAttrs: false,
11
11
  props: {
@@ -1,94 +1,4 @@
1
- import inputClassesMixin from "./inputClassesMixin.js";
2
- import { defineComponent, createElementBlock, openBlock, normalizeStyle, normalizeClass, renderSlot, createElementVNode, withDirectives, createCommentVNode, toDisplayString, mergeProps, vShow } from "vue";
3
- import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
4
- const INPUT_TYPES = { TEXT: "text", PASSWORD: "password" };
5
- const _sfc_main = defineComponent({
6
- name: "PInput",
7
- mixins: [inputClassesMixin],
8
- inheritAttrs: false,
9
- props: {
10
- modelValue: {
11
- type: [String, Number],
12
- default: ""
13
- },
14
- type: {
15
- type: String,
16
- default: INPUT_TYPES.TEXT,
17
- validator(value) {
18
- return Object.values(INPUT_TYPES).includes(value);
19
- }
20
- },
21
- label: {
22
- type: String,
23
- default: ""
24
- },
25
- errorMsg: {
26
- type: String,
27
- default: ""
28
- },
29
- required: {
30
- type: Boolean,
31
- default: false
32
- },
33
- rounded: {
34
- type: Boolean,
35
- default: false
36
- }
37
- },
38
- emits: ["update:modelValue"],
39
- computed: {
40
- attrs() {
41
- const { class: classes, style, ...rest } = this.$attrs;
42
- return rest;
43
- },
44
- style() {
45
- return this.$attrs.style;
46
- }
47
- }
48
- });
49
- const _hoisted_1 = ["data-has-error"];
50
- const _hoisted_2 = { class: "relative w-full" };
51
- const _hoisted_3 = { key: 0 };
52
- const _hoisted_4 = ["type", "value"];
53
- const _hoisted_5 = { key: 1 };
54
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
55
- return openBlock(), createElementBlock("div", {
56
- class: normalizeClass([{ hidden: _ctx.$attrs.hidden }, _ctx.$attrs.class]),
57
- "data-has-error": !!_ctx.errorMsg,
58
- style: normalizeStyle(_ctx.style)
59
- }, [
60
- renderSlot(_ctx.$slots, "label", {
61
- label: _ctx.label,
62
- labelClasses: _ctx.labelClasses
63
- }, () => [
64
- _ctx.label ? (openBlock(), createElementBlock("label", {
65
- key: 0,
66
- class: normalizeClass(_ctx.labelClasses)
67
- }, toDisplayString(_ctx.label), 3)) : createCommentVNode("", true)
68
- ]),
69
- createElementVNode("div", _hoisted_2, [
70
- !!_ctx.$slots.prefix ? (openBlock(), createElementBlock("div", _hoisted_3, [
71
- renderSlot(_ctx.$slots, "prefix")
72
- ])) : createCommentVNode("", true),
73
- createElementVNode("input", mergeProps({
74
- type: _ctx.type,
75
- value: _ctx.modelValue
76
- }, _ctx.attrs, {
77
- class: _ctx.inputClasses,
78
- onInput: _cache[0] || (_cache[0] = (event) => _ctx.$emit("update:modelValue", event.target.value))
79
- }), null, 16, _hoisted_4),
80
- !!_ctx.$slots.suffix ? (openBlock(), createElementBlock("div", _hoisted_5, [
81
- renderSlot(_ctx.$slots, "suffix")
82
- ])) : createCommentVNode("", true)
83
- ]),
84
- withDirectives(createElementVNode("div", {
85
- class: normalizeClass(_ctx.errorMsgClasses)
86
- }, toDisplayString(_ctx.errorMsg), 3), [
87
- [vShow, _ctx.errorMsg]
88
- ])
89
- ], 14, _hoisted_1);
90
- }
91
- const PInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
1
+ import { _ as _sfc_main } from "./chunks/p-input.js";
92
2
  export {
93
- PInput as default
3
+ _sfc_main as default
94
4
  };
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, useCssVars, ref, onBeforeMount, onMounted, getCurrentInstance, watch, nextTick, onBeforeUnmount, createBlock, createCommentVNode, openBlock, Teleport, createVNode, Transition, withCtx, withDirectives, createElementVNode, normalizeStyle, normalizeClass, vShow, renderSlot, createElementBlock, toDisplayString, withModifiers, createTextVNode } from "vue";
2
- import PAlert from "./p-alert.js";
2
+ import { _ as _sfc_main$1 } from "./chunks/p-alert.js";
3
3
  import PCloseBtn from "./p-close-btn.js";
4
4
  import { usePModal } from "./usePModal.js";
5
5
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
@@ -336,7 +336,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
336
336
  ])
337
337
  ], true),
338
338
  __props.errorMsg ? (openBlock(), createElementBlock("div", _hoisted_7, [
339
- createVNode(PAlert, { type: "error" }, {
339
+ createVNode(_sfc_main$1, { type: "error" }, {
340
340
  default: withCtx(() => [
341
341
  createTextVNode(toDisplayString(__props.errorMsg), 1)
342
342
  ]),
@@ -1,42 +1,4 @@
1
- import { defineComponent, resolveDirective, createElementBlock, openBlock, Fragment, renderList, withDirectives, normalizeStyle } from "vue";
2
- import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
3
- const _sfc_main = defineComponent({
4
- name: "PProgressBar",
5
- props: {
6
- total: {
7
- type: Number,
8
- required: true
9
- },
10
- items: {
11
- type: Array,
12
- required: true
13
- }
14
- }
15
- });
16
- const _hoisted_1 = {
17
- class: "flex justify-start overflow-hidden rounded bg-p-blue-20",
18
- role: "progressbar"
19
- };
20
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
21
- const _directive_tooltip = resolveDirective("tooltip");
22
- return openBlock(), createElementBlock("div", _hoisted_1, [
23
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.items, (item) => {
24
- return withDirectives((openBlock(), createElementBlock("div", {
25
- key: `progress-value-${item.color}`,
26
- class: "h-full",
27
- style: normalizeStyle({ width: `${item.value / _ctx.total * 100}%`, background: item.color })
28
- }, null, 4)), [
29
- [
30
- _directive_tooltip,
31
- item.label,
32
- void 0,
33
- { top: true }
34
- ]
35
- ]);
36
- }), 128))
37
- ]);
38
- }
39
- const pProgressBar = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
1
+ import { _ as _sfc_main } from "./chunks/p-progress-bar.js";
40
2
  export {
41
- pProgressBar as default
3
+ _sfc_main as default
42
4
  };
@@ -1,21 +1,26 @@
1
1
  import { defineComponent, createElementBlock, openBlock, mergeProps } from "vue";
2
2
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
3
- const _sfc_main = defineComponent({
4
- name: "PTableFilterIcon",
5
- inheritAttrs: false,
3
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4
+ ...{
5
+ name: "PTableFilterIcon",
6
+ inheritAttrs: false
7
+ },
8
+ __name: "p-table-filter-icon",
6
9
  props: {
7
10
  active: {
8
11
  type: Boolean,
9
12
  default: false
10
13
  }
14
+ },
15
+ setup(__props) {
16
+ return (_ctx, _cache) => {
17
+ return openBlock(), createElementBlock("div", mergeProps({
18
+ class: ["h-5 w-5 shrink-0 cursor-pointer filter", { active: __props.active }]
19
+ }, _ctx.$attrs), null, 16);
20
+ };
11
21
  }
12
22
  });
13
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
14
- return openBlock(), createElementBlock("div", mergeProps({
15
- class: ["h-5 w-5 shrink-0 cursor-pointer filter", { active: _ctx.active }]
16
- }, _ctx.$attrs), null, 16);
17
- }
18
- const PTableFilterIcon = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-cbac2434"]]);
23
+ const PTableFilterIcon = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-84864117"]]);
19
24
  export {
20
25
  PTableFilterIcon as default
21
26
  };
@@ -1,74 +1,4 @@
1
- import inputClassesMixin from "./inputClassesMixin.js";
2
- import { defineComponent, createElementBlock, openBlock, normalizeStyle, normalizeClass, renderSlot, createElementVNode, withDirectives, createCommentVNode, toDisplayString, mergeProps, vShow } from "vue";
3
- import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
4
- const _sfc_main = defineComponent({
5
- name: "PTextarea",
6
- mixins: [inputClassesMixin],
7
- inheritAttrs: false,
8
- props: {
9
- modelValue: {
10
- type: [String, Number],
11
- default: ""
12
- },
13
- label: {
14
- type: String,
15
- default: ""
16
- },
17
- errorMsg: {
18
- type: String,
19
- default: ""
20
- },
21
- required: {
22
- type: Boolean,
23
- default: false
24
- }
25
- },
26
- emits: ["update:modelValue"],
27
- computed: {
28
- attrs() {
29
- const { class: classes, style, ...rest } = this.$attrs;
30
- return rest;
31
- },
32
- style() {
33
- return this.$attrs.style;
34
- }
35
- },
36
- methods: {
37
- updateValue(e) {
38
- const target = e.target;
39
- this.$emit("update:modelValue", target.value);
40
- }
41
- }
42
- });
43
- const _hoisted_1 = ["data-has-error"];
44
- const _hoisted_2 = ["value"];
45
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
46
- return openBlock(), createElementBlock("div", {
47
- class: normalizeClass([{ hidden: _ctx.$attrs.hidden }, _ctx.$attrs.class]),
48
- "data-has-error": !!_ctx.errorMsg,
49
- style: normalizeStyle(_ctx.style)
50
- }, [
51
- renderSlot(_ctx.$slots, "label", {
52
- label: _ctx.label,
53
- labelClasses: _ctx.labelClasses
54
- }, () => [
55
- _ctx.label ? (openBlock(), createElementBlock("label", {
56
- key: 0,
57
- class: normalizeClass(_ctx.labelClasses)
58
- }, toDisplayString(_ctx.label), 3)) : createCommentVNode("", true)
59
- ]),
60
- createElementVNode("textarea", mergeProps({ value: _ctx.modelValue }, _ctx.attrs, {
61
- class: _ctx.textareaClasses,
62
- onInput: _cache[0] || (_cache[0] = (...args) => _ctx.updateValue && _ctx.updateValue(...args))
63
- }), " ", 16, _hoisted_2),
64
- withDirectives(createElementVNode("div", {
65
- class: normalizeClass(_ctx.errorMsgClasses)
66
- }, toDisplayString(_ctx.errorMsg), 3), [
67
- [vShow, _ctx.errorMsg]
68
- ])
69
- ], 14, _hoisted_1);
70
- }
71
- const pTextarea = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
1
+ import { _ as _sfc_main } from "./chunks/p-textarea.js";
72
2
  export {
73
- pTextarea as default
3
+ _sfc_main as default
74
4
  };
@@ -1,6 +1,9 @@
1
- import inputClassesMixin from "./inputClassesMixin.js";
2
- import { defineComponent, createElementBlock, openBlock, normalizeStyle, normalizeClass, createElementVNode, withDirectives, renderSlot, mergeProps, createCommentVNode, toDisplayString, vShow } from "vue";
1
+ import { defineComponent, useAttrs, computed, createElementBlock, openBlock, normalizeStyle, normalizeClass, createElementVNode, withDirectives, renderSlot, mergeProps, createCommentVNode, toDisplayString, unref, vShow } from "vue";
2
+ import { S as SIZES } from "./chunks/p-btn.types.js";
3
+ import { useInputClasses } from "./useInputClasses.js";
3
4
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
5
+ const _hoisted_1 = ["aria-checked", "data-testid"];
6
+ const _hoisted_2 = ["checked"];
4
7
  const TOGGLE_SIZES = {
5
8
  sm: `w-7 h-4 after:top-[2px] after:left-[2px] after:h-3 after:w-3`,
6
9
  md: `w-11 h-6 after:top-[2px] after:left-[2px] after:h-5 after:w-5`,
@@ -24,10 +27,12 @@ const TOGGLE_CLASSES = [
24
27
  "peer-disabled:bg-p-blue-10",
25
28
  "peer-disabled:after:border-p-blue-10"
26
29
  ].join(" ");
27
- const _sfc_main = defineComponent({
28
- name: "PToggle",
29
- mixins: [inputClassesMixin],
30
- inheritAttrs: false,
30
+ const _sfc_main = /* @__PURE__ */ defineComponent({
31
+ ...{
32
+ name: "PToggle",
33
+ inheritAttrs: false
34
+ },
35
+ __name: "p-toggle",
31
36
  props: {
32
37
  modelValue: {
33
38
  type: Boolean,
@@ -44,73 +49,80 @@ const _sfc_main = defineComponent({
44
49
  required: {
45
50
  type: Boolean,
46
51
  default: false
52
+ },
53
+ size: {
54
+ type: String,
55
+ default: "md",
56
+ validator(value) {
57
+ return SIZES.includes(value);
58
+ }
47
59
  }
48
60
  },
49
61
  emits: ["update:modelValue"],
50
- computed: {
51
- toggleClasses() {
52
- const base = `${TOGGLE_CLASSES} ${TOGGLE_SIZES[this.size]}`;
53
- const res = this.errorMsg ? `${base} border border-on-error` : base;
62
+ setup(__props, { emit: __emit }) {
63
+ const emit = __emit;
64
+ const props = __props;
65
+ const allAttrs = useAttrs();
66
+ const { labelClasses, errorMsgClasses } = useInputClasses(props);
67
+ const toggleClasses = computed(() => {
68
+ const base = `${TOGGLE_CLASSES} ${TOGGLE_SIZES[props.size]}`;
69
+ const res = props.errorMsg ? `${base} border border-on-error` : base;
54
70
  return res;
55
- },
56
- toggleLabelClasses() {
57
- return `${this.labelClasses.replace("mb-1", "")} ml-2`;
58
- },
59
- attrs() {
60
- const { style, class: classes, "data-testid": dataTestId, ...rest } = this.$attrs;
71
+ });
72
+ const toggleLabelClasses = computed(() => {
73
+ return `${labelClasses.value.replace("mb-1", "")} ml-2`;
74
+ });
75
+ const attrs = computed(() => {
76
+ const { style: style2, class: classes, "data-testid": dataTestId, ...rest } = allAttrs;
61
77
  return rest;
62
- },
63
- style() {
64
- return this.$attrs.style;
65
- }
66
- },
67
- methods: {
68
- change(e) {
78
+ });
79
+ const style = computed(() => {
80
+ return allAttrs.style;
81
+ });
82
+ const change = (e) => {
69
83
  const target = e.target;
70
- this.$emit("update:modelValue", target.checked);
71
- }
84
+ emit("update:modelValue", target.checked);
85
+ };
86
+ return (_ctx, _cache) => {
87
+ return openBlock(), createElementBlock("div", {
88
+ class: normalizeClass(["inline-flex flex-col", _ctx.$attrs.class]),
89
+ style: normalizeStyle(style.value),
90
+ role: "switch",
91
+ "aria-checked": __props.modelValue ? "true" : "false",
92
+ "data-testid": _ctx.$attrs["data-testid"]
93
+ }, [
94
+ createElementVNode("label", {
95
+ class: normalizeClass(["relative inline-flex items-center", { "cursor-pointer": !_ctx.$attrs.disabled }])
96
+ }, [
97
+ createElementVNode("input", mergeProps({
98
+ type: "checkbox",
99
+ checked: __props.modelValue,
100
+ class: "peer sr-only"
101
+ }, { ...attrs.value, input: () => {
102
+ }, onChange: change }), null, 16, _hoisted_2),
103
+ createElementVNode("div", {
104
+ class: normalizeClass(toggleClasses.value)
105
+ }, null, 2),
106
+ renderSlot(_ctx.$slots, "label", {
107
+ label: __props.label,
108
+ labelClasses: toggleLabelClasses.value
109
+ }, () => [
110
+ __props.label ? (openBlock(), createElementBlock("span", {
111
+ key: 0,
112
+ class: normalizeClass(toggleLabelClasses.value)
113
+ }, toDisplayString(__props.label), 3)) : createCommentVNode("", true)
114
+ ], true)
115
+ ], 2),
116
+ withDirectives(createElementVNode("div", {
117
+ class: normalizeClass(unref(errorMsgClasses))
118
+ }, toDisplayString(__props.errorMsg), 3), [
119
+ [vShow, __props.errorMsg]
120
+ ])
121
+ ], 14, _hoisted_1);
122
+ };
72
123
  }
73
124
  });
74
- const _hoisted_1 = ["aria-checked", "data-testid"];
75
- const _hoisted_2 = ["checked"];
76
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
77
- return openBlock(), createElementBlock("div", {
78
- class: normalizeClass(["inline-flex flex-col", _ctx.$attrs.class]),
79
- style: normalizeStyle(_ctx.style),
80
- role: "switch",
81
- "aria-checked": _ctx.modelValue ? "true" : "false",
82
- "data-testid": _ctx.$attrs["data-testid"]
83
- }, [
84
- createElementVNode("label", {
85
- class: normalizeClass(["relative inline-flex items-center", { "cursor-pointer": !_ctx.$attrs.disabled }])
86
- }, [
87
- createElementVNode("input", mergeProps({
88
- type: "checkbox",
89
- checked: _ctx.modelValue,
90
- class: "peer sr-only"
91
- }, { ..._ctx.attrs, input: () => {
92
- }, onChange: _ctx.change }), null, 16, _hoisted_2),
93
- createElementVNode("div", {
94
- class: normalizeClass(_ctx.toggleClasses)
95
- }, null, 2),
96
- renderSlot(_ctx.$slots, "label", {
97
- label: _ctx.label,
98
- labelClasses: _ctx.toggleLabelClasses
99
- }, () => [
100
- _ctx.label ? (openBlock(), createElementBlock("span", {
101
- key: 0,
102
- class: normalizeClass(_ctx.toggleLabelClasses)
103
- }, toDisplayString(_ctx.label), 3)) : createCommentVNode("", true)
104
- ], true)
105
- ], 2),
106
- withDirectives(createElementVNode("div", {
107
- class: normalizeClass(_ctx.errorMsgClasses)
108
- }, toDisplayString(_ctx.errorMsg), 3), [
109
- [vShow, _ctx.errorMsg]
110
- ])
111
- ], 14, _hoisted_1);
112
- }
113
- const pToggle = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-152f5bf8"]]);
125
+ const pToggle = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-be9ecb77"]]);
114
126
  export {
115
127
  pToggle as default
116
128
  };
@@ -1,36 +1,31 @@
1
1
  import { inputClasses, selectClasses, textareaClasses } from "./inputClasses.js";
2
- import { ref, toRefs, computed } from "vue";
2
+ import { computed, toValue } from "vue";
3
3
  const defaults = {
4
- size: ref("md"),
5
- errorMsg: ref(""),
6
- required: ref(false),
7
- prefix: ref(false),
8
- suffix: ref(false),
9
- rounded: ref(false)
4
+ size: "md",
5
+ errorMsg: "",
6
+ required: false,
7
+ prefix: false,
8
+ suffix: false,
9
+ rounded: false
10
10
  };
11
11
  function useInputClasses(props) {
12
- const opts = { ...defaults, ...toRefs(props) };
13
- const { size, errorMsg, required, rounded, prefix, suffix } = opts;
12
+ const opts = computed(() => {
13
+ const propsValue = toValue(props);
14
+ return { ...defaults, ...propsValue, error: !!propsValue.errorMsg };
15
+ });
14
16
  const allClasses = computed(() => {
15
- const { input, label, errorMessage } = inputClasses({
16
- size: size.value,
17
- prefix: prefix.value,
18
- suffix: suffix.value,
19
- required: required.value,
20
- error: !!errorMsg.value,
21
- rounded: rounded.value
22
- });
17
+ const { input, label, errorMessage } = inputClasses(opts.value);
23
18
  return { input: input(), label: label(), errorMessage: errorMessage() };
24
19
  });
25
20
  const inputClasses$1 = computed(() => allClasses.value.input);
26
21
  const labelClasses = computed(() => allClasses.value.label);
27
22
  const errorMsgClasses = computed(() => allClasses.value.errorMessage);
28
23
  const selectClasses$1 = computed(() => {
29
- const { input } = selectClasses({ size: size.value, required: required.value, error: !!errorMsg.value });
24
+ const { input } = selectClasses(opts.value);
30
25
  return input();
31
26
  });
32
27
  const textareaClasses$1 = computed(() => {
33
- const { input } = textareaClasses({ required: required.value, error: !!errorMsg.value });
28
+ const { input } = textareaClasses(opts.value);
34
29
  return input();
35
30
  });
36
31
  return {
@@ -1,20 +1,29 @@
1
1
  import { type PropType } from 'vue';
2
2
  declare const ALERT_TYPES: {
3
- info: string;
4
- warning: string;
5
- error: string;
6
- success: string;
3
+ info: {
4
+ classes: string;
5
+ icon: string;
6
+ };
7
+ warning: {
8
+ classes: string;
9
+ icon: string;
10
+ };
11
+ error: {
12
+ classes: string;
13
+ icon: string;
14
+ };
15
+ success: {
16
+ classes: string;
17
+ icon: string;
18
+ };
7
19
  };
8
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
20
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
9
21
  type: {
10
22
  type: PropType<keyof typeof ALERT_TYPES>;
11
23
  default: string;
12
24
  validator(value: keyof typeof ALERT_TYPES): boolean;
13
25
  };
14
- }>, {}, {}, {
15
- classes(): string;
16
- svgColor(): undefined;
17
- }, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
26
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
18
27
  type: {
19
28
  type: PropType<keyof typeof ALERT_TYPES>;
20
29
  default: string;
@@ -22,5 +31,13 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
22
31
  };
23
32
  }>> & Readonly<{}>, {
24
33
  type: "info" | "error" | "success" | "warning";
25
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
34
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
35
+ icon?: ((props: {}) => any) | undefined;
36
+ default?: ((props: {}) => any) | undefined;
37
+ }>;
26
38
  export default _default;
39
+ type __VLS_WithSlots<T, S> = T & {
40
+ new (): {
41
+ $slots: S;
42
+ };
43
+ };
@@ -1,8 +1,11 @@
1
+ import { type PropType } from 'vue';
2
+ declare const SHAPES: readonly ["rectangle", "circle"];
3
+ type Shape = (typeof SHAPES)[number];
1
4
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
5
  shape: {
3
- type: StringConstructor;
6
+ type: PropType<Shape>;
4
7
  default: string;
5
- validator: (value: string) => boolean;
8
+ validator: (value: Shape) => boolean;
6
9
  };
7
10
  imageSrc: {
8
11
  type: StringConstructor;
@@ -20,15 +23,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
20
23
  type: StringConstructor;
21
24
  default: string;
22
25
  };
23
- }>, {}, {
24
- imageBroken: boolean;
25
- }, {
26
- shapeClass(): string;
27
- }, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
26
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
28
27
  shape: {
29
- type: StringConstructor;
28
+ type: PropType<Shape>;
30
29
  default: string;
31
- validator: (value: string) => boolean;
30
+ validator: (value: Shape) => boolean;
32
31
  };
33
32
  imageSrc: {
34
33
  type: StringConstructor;
@@ -47,7 +46,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
47
46
  default: string;
48
47
  };
49
48
  }>> & Readonly<{}>, {
50
- shape: string;
49
+ shape: "circle" | "rectangle";
51
50
  imageSrc: string;
52
51
  imageClass: string;
53
52
  labelClass: string;