@pequity/squirrel 6.1.1 → 7.0.1

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 (96) hide show
  1. package/dist/cjs/chunks/index.js +748 -504
  2. package/dist/cjs/chunks/p-alert.js +52 -0
  3. package/dist/cjs/chunks/p-avatar.js +65 -0
  4. package/dist/cjs/chunks/p-btn.js +2 -2
  5. package/dist/cjs/chunks/p-date-picker.js +2 -2
  6. package/dist/cjs/chunks/p-input-number.js +161 -0
  7. package/dist/cjs/chunks/p-input-percent.js +2 -2
  8. package/dist/cjs/chunks/p-input.js +111 -0
  9. package/dist/cjs/chunks/p-progress-bar.js +38 -0
  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/index.js +748 -504
  26. package/dist/es/chunks/p-alert.js +53 -0
  27. package/dist/es/chunks/p-avatar.js +66 -0
  28. package/dist/es/chunks/p-btn.js +2 -2
  29. package/dist/es/chunks/p-date-picker.js +2 -2
  30. package/dist/es/chunks/p-input-number.js +162 -0
  31. package/dist/es/chunks/p-input-percent.js +2 -2
  32. package/dist/es/chunks/p-input.js +112 -0
  33. package/dist/es/chunks/p-progress-bar.js +39 -0
  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 +8 -248
  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 +9 -525
  68. package/dist/squirrel.css +5 -5
  69. package/package.json +28 -28
  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 +2 -3
  75. package/squirrel/components/p-btn/p-btn.vue +2 -2
  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-table-header-cell/p-table-filter-icon.vue +8 -9
  80. package/squirrel/components/p-table-sort/p-table-sort.vue +13 -16
  81. package/squirrel/components/p-textarea/p-textarea.vue +55 -37
  82. package/squirrel/components/p-toggle/p-toggle.vue +59 -43
  83. package/squirrel/composables/useInputClasses.spec.js +50 -13
  84. package/squirrel/composables/useInputClasses.ts +18 -24
  85. package/squirrel/utils/index.ts +0 -7
  86. package/squirrel/utils/inputClasses.ts +8 -2
  87. package/dist/cjs/inputClassesMixin.js +0 -58
  88. package/dist/cjs/tailwind.js +0 -25
  89. package/dist/es/inputClassesMixin.js +0 -59
  90. package/dist/es/tailwind.js +0 -25
  91. package/dist/squirrel/utils/inputClassesMixin.d.ts +0 -56
  92. package/dist/squirrel/utils/tailwind.d.ts +0 -8
  93. package/squirrel/utils/inputClassesMixin.spec.js +0 -241
  94. package/squirrel/utils/inputClassesMixin.ts +0 -60
  95. package/squirrel/utils/tailwind.spec.js +0 -27
  96. package/squirrel/utils/tailwind.ts +0 -28
@@ -0,0 +1,53 @@
1
+ import { defineComponent, createElementBlock, openBlock, normalizeClass, createElementVNode, renderSlot, createVNode } from "vue";
2
+ import { _ as _sfc_main$1 } from "./p-icon.js";
3
+ const _hoisted_1 = { class: "flex" };
4
+ const _hoisted_2 = { class: "pr-2" };
5
+ const ALERT_TYPES = {
6
+ info: { classes: `bg-info text-on-info`, icon: "streamline:information-circle-solid" },
7
+ warning: { classes: `bg-warning text-on-warning`, icon: "streamline:warning-triangle-solid" },
8
+ error: { classes: `bg-error text-on-error`, icon: "streamline:warning-octagon-solid" },
9
+ success: { classes: `bg-success text-on-success`, icon: "streamline:check-square-solid" }
10
+ };
11
+ const _sfc_main = /* @__PURE__ */ defineComponent({
12
+ ...{
13
+ name: "PAlert"
14
+ },
15
+ __name: "p-alert",
16
+ props: {
17
+ type: {
18
+ type: String,
19
+ default: "info",
20
+ validator(value) {
21
+ return Object.keys(ALERT_TYPES).includes(value);
22
+ }
23
+ }
24
+ },
25
+ setup(__props) {
26
+ const props = __props;
27
+ return (_ctx, _cache) => {
28
+ return openBlock(), createElementBlock("div", {
29
+ class: normalizeClass(["rounded p-4 text-xs font-semibold", ALERT_TYPES[props.type].classes]),
30
+ role: "alert"
31
+ }, [
32
+ createElementVNode("div", _hoisted_1, [
33
+ createElementVNode("div", _hoisted_2, [
34
+ renderSlot(_ctx.$slots, "icon", {}, () => [
35
+ createVNode(_sfc_main$1, {
36
+ icon: ALERT_TYPES[props.type].icon,
37
+ width: "16",
38
+ class: "-mb-0.5",
39
+ inline: ""
40
+ }, null, 8, ["icon"])
41
+ ])
42
+ ]),
43
+ createElementVNode("div", null, [
44
+ renderSlot(_ctx.$slots, "default")
45
+ ])
46
+ ])
47
+ ], 2);
48
+ };
49
+ }
50
+ });
51
+ export {
52
+ _sfc_main as _
53
+ };
@@ -0,0 +1,66 @@
1
+ import { defineComponent, ref, computed, watch, createElementBlock, openBlock, normalizeClass, toDisplayString } from "vue";
2
+ const _hoisted_1 = ["src", "alt"];
3
+ const SHAPES = ["rectangle", "circle"];
4
+ const SHAPE_CLASSES = {
5
+ rectangle: "rounded-lg",
6
+ circle: "rounded-full"
7
+ };
8
+ const _sfc_main = /* @__PURE__ */ defineComponent({
9
+ ...{
10
+ name: "PAvatar"
11
+ },
12
+ __name: "p-avatar",
13
+ props: {
14
+ shape: {
15
+ type: String,
16
+ default: "circle",
17
+ validator: (value) => SHAPES.includes(value)
18
+ },
19
+ imageSrc: {
20
+ type: String,
21
+ default: ""
22
+ },
23
+ label: {
24
+ type: String,
25
+ required: true
26
+ },
27
+ imageClass: {
28
+ type: String,
29
+ default: ""
30
+ },
31
+ labelClass: {
32
+ type: String,
33
+ default: ""
34
+ }
35
+ },
36
+ setup(__props) {
37
+ const props = __props;
38
+ const imageBroken = ref(false);
39
+ const shapeClass = computed(() => SHAPE_CLASSES[props.shape]);
40
+ watch(
41
+ () => props.imageSrc,
42
+ () => {
43
+ imageBroken.value = false;
44
+ }
45
+ );
46
+ return (_ctx, _cache) => {
47
+ return openBlock(), createElementBlock("div", {
48
+ class: normalizeClass(shapeClass.value)
49
+ }, [
50
+ __props.imageSrc && !imageBroken.value ? (openBlock(), createElementBlock("img", {
51
+ key: 0,
52
+ src: __props.imageSrc,
53
+ alt: __props.label,
54
+ class: normalizeClass(["h-full w-full object-cover", [shapeClass.value, __props.imageClass]]),
55
+ onError: _cache[0] || (_cache[0] = ($event) => imageBroken.value = true)
56
+ }, null, 42, _hoisted_1)) : (openBlock(), createElementBlock("div", {
57
+ key: 1,
58
+ class: normalizeClass(["flex h-full w-full items-center justify-center", [shapeClass.value, __props.labelClass]])
59
+ }, toDisplayString(__props.label), 3))
60
+ ], 2);
61
+ };
62
+ }
63
+ });
64
+ export {
65
+ _sfc_main as _
66
+ };
@@ -9,7 +9,7 @@ const _hoisted_1 = ["href", "disabled", "aria-disabled"];
9
9
  const _hoisted_2 = { class: "slot-wrapper empty:hidden" };
10
10
  const btnClasses = {
11
11
  slots: {
12
- button: "relative inline-block rounded font-medium outline-none disabled:pointer-events-none disabled:cursor-default disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:cursor-default aria-disabled:opacity-50",
12
+ button: "relative inline-block whitespace-nowrap rounded font-medium outline-none disabled:pointer-events-none disabled:cursor-default disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:cursor-default aria-disabled:opacity-50",
13
13
  content: "flex items-center justify-center has-[.slot-wrapper:empty]:gap-0",
14
14
  loader: "absolute bottom-0 left-0 right-0 top-0 flex items-center justify-center font-medium",
15
15
  icon: "shrink-0"
@@ -54,7 +54,7 @@ const btnClasses = {
54
54
  icon: "text-xl"
55
55
  },
56
56
  lg: {
57
- button: "px-6 has-[.slot-wrapper:empty]:px-3 py-3 text-lg leading-7",
57
+ button: "px-6 has-[.slot-wrapper:empty]:px-3 py-3 text-lg leading-6",
58
58
  content: "gap-2.5",
59
59
  icon: "text-2xl"
60
60
  }
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, mergeModels, useModel, useAttrs, computed, createBlock, openBlock, unref, mergeProps, withCtx, createVNode, withKeys } from "vue";
2
- import PInput from "../p-input.js";
2
+ import { _ as _sfc_main$1 } from "./p-input.js";
3
3
  import VueDatePicker from "@vuepic/vue-datepicker";
4
4
  const _sfc_main = /* @__PURE__ */ defineComponent({
5
5
  ...{
@@ -150,7 +150,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
150
150
  class: [{ hidden: _ctx.$attrs.hidden }, _ctx.$attrs.class]
151
151
  }, datePickerProps.value), {
152
152
  "dp-input": withCtx(({ value, onInput, onEnter, onTab, onFocus, onBlur, onClear }) => [
153
- createVNode(PInput, mergeProps({ "model-value": value }, inputPropsAndAttrs.value, {
153
+ createVNode(_sfc_main$1, mergeProps({ "model-value": value }, inputPropsAndAttrs.value, {
154
154
  onInput: ($event) => handleInput($event, onInput, onClear),
155
155
  onKeydown: [
156
156
  withKeys(($event) => onEnter($event), ["enter"]),
@@ -0,0 +1,162 @@
1
+ import { defineComponent, useSlots, computed, useAttrs, watch, createElementBlock, openBlock, normalizeStyle, normalizeClass, createElementVNode, withDirectives, renderSlot, createBlock, createCommentVNode, unref, toDisplayString, mergeProps, vShow } from "vue";
2
+ import { S as SIZES } from "./p-btn.types.js";
3
+ import { _ as _sfc_main$1 } from "./p-info-icon.js";
4
+ import { useInputClasses } from "../useInputClasses.js";
5
+ import { toNumberOrNull } from "../number.js";
6
+ import { kebabCase } from "lodash-es";
7
+ import { useCurrencyInput } from "vue-currency-input";
8
+ const _hoisted_1 = ["data-has-error"];
9
+ const _hoisted_2 = { class: "flex flex-row items-center" };
10
+ const _hoisted_3 = { class: "relative w-full" };
11
+ const _hoisted_4 = { key: 0 };
12
+ const _sfc_main = /* @__PURE__ */ defineComponent({
13
+ ...{
14
+ name: "PInputNumber",
15
+ inheritAttrs: false
16
+ },
17
+ __name: "p-input-number",
18
+ props: {
19
+ modelValue: {
20
+ type: [Number, String],
21
+ default: null
22
+ },
23
+ label: {
24
+ type: String,
25
+ default: ""
26
+ },
27
+ errorMsg: {
28
+ type: String,
29
+ default: ""
30
+ },
31
+ required: {
32
+ type: Boolean,
33
+ default: false
34
+ },
35
+ size: {
36
+ type: String,
37
+ default: "md",
38
+ validator(value) {
39
+ return SIZES.includes(value);
40
+ }
41
+ },
42
+ selectOnClick: {
43
+ type: Boolean,
44
+ default: true
45
+ },
46
+ tooltipText: {
47
+ type: String,
48
+ default: ""
49
+ }
50
+ },
51
+ emits: ["update:modelValue", "change"],
52
+ setup(__props, { expose: __expose, emit: __emit }) {
53
+ const ALL_OPTIONS = [
54
+ "locale",
55
+ "currency",
56
+ "currencyDisplay",
57
+ "hideGroupingSeparatorOnFocus",
58
+ "hideCurrencySymbolOnFocus",
59
+ "hideNegligibleDecimalDigitsOnFocus",
60
+ "precision",
61
+ "autoDecimalDigits",
62
+ "valueRange",
63
+ "useGrouping",
64
+ "valueScaling"
65
+ ];
66
+ const emit = __emit;
67
+ const props = __props;
68
+ const slots = useSlots();
69
+ const { labelClasses, inputClasses, errorMsgClasses } = useInputClasses(
70
+ computed(() => ({
71
+ ...props,
72
+ prefix: !!slots.prefix,
73
+ suffix: !!slots.suffix
74
+ }))
75
+ );
76
+ const attrs = useAttrs();
77
+ const DEFAULTS = {
78
+ locale: "en-US",
79
+ currency: "USD",
80
+ precision: 0,
81
+ currencyDisplay: "hidden"
82
+ };
83
+ const inputCurrencyOptions = computed(() => {
84
+ ALL_OPTIONS.forEach((key) => {
85
+ const attr = attrs[kebabCase(key)];
86
+ if (attr && typeof attr !== "undefined") {
87
+ DEFAULTS[key] = attr;
88
+ }
89
+ });
90
+ return DEFAULTS;
91
+ });
92
+ const { inputRef, numberValue, setValue } = useCurrencyInput(
93
+ inputCurrencyOptions.value,
94
+ false
95
+ );
96
+ watch(numberValue, (value) => {
97
+ emit("update:modelValue", toNumberOrNull(value));
98
+ });
99
+ watch(
100
+ () => props.modelValue,
101
+ (value) => {
102
+ setValue(toNumberOrNull(value));
103
+ }
104
+ );
105
+ const computedAttrs = computed(() => {
106
+ const { class: classes, style: style2, ...rest } = attrs;
107
+ return rest;
108
+ });
109
+ const style = computed(() => {
110
+ return attrs.style;
111
+ });
112
+ const focus = () => {
113
+ props.selectOnClick && inputRef.value.select();
114
+ };
115
+ __expose({ setValue });
116
+ return (_ctx, _cache) => {
117
+ return openBlock(), createElementBlock("div", {
118
+ class: normalizeClass([{ hidden: _ctx.$attrs.hidden }, _ctx.$attrs.class]),
119
+ "data-has-error": !!__props.errorMsg,
120
+ style: normalizeStyle(style.value)
121
+ }, [
122
+ createElementVNode("div", _hoisted_2, [
123
+ renderSlot(_ctx.$slots, "label", {
124
+ label: __props.label,
125
+ labelClasses: unref(labelClasses)
126
+ }, () => [
127
+ __props.label ? (openBlock(), createElementBlock("label", {
128
+ key: 0,
129
+ class: normalizeClass(unref(labelClasses))
130
+ }, toDisplayString(__props.label), 3)) : createCommentVNode("", true)
131
+ ]),
132
+ __props.tooltipText ? (openBlock(), createBlock(_sfc_main$1, {
133
+ key: 0,
134
+ text: __props.tooltipText,
135
+ class: "ml-1"
136
+ }, null, 8, ["text"])) : createCommentVNode("", true)
137
+ ]),
138
+ createElementVNode("div", _hoisted_3, [
139
+ !!_ctx.$slots.prefix ? (openBlock(), createElementBlock("div", _hoisted_4, [
140
+ renderSlot(_ctx.$slots, "prefix")
141
+ ])) : createCommentVNode("", true),
142
+ createElementVNode("input", mergeProps({
143
+ ref_key: "inputRef",
144
+ ref: inputRef,
145
+ type: "text"
146
+ }, computedAttrs.value, {
147
+ class: unref(inputClasses),
148
+ onFocus: focus
149
+ }), null, 16)
150
+ ]),
151
+ withDirectives(createElementVNode("div", {
152
+ class: normalizeClass(unref(errorMsgClasses))
153
+ }, toDisplayString(__props.errorMsg), 3), [
154
+ [vShow, __props.errorMsg]
155
+ ])
156
+ ], 14, _hoisted_1);
157
+ };
158
+ }
159
+ });
160
+ export {
161
+ _sfc_main as _
162
+ };
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, computed, createBlock, openBlock, withCtx, createElementVNode, normalizeClass } from "vue";
2
- import PInputNumber from "../p-input-number.js";
2
+ import { _ as _sfc_main$1 } from "./p-input-number.js";
3
3
  import { isNumber } from "lodash-es";
4
4
  const _sfc_main = /* @__PURE__ */ defineComponent({
5
5
  ...{
@@ -30,7 +30,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
30
30
  set: (nV) => emit("update:modelValue", isNumber(nV) ? nV / 100 : nV)
31
31
  });
32
32
  return (_ctx, _cache) => {
33
- return openBlock(), createBlock(PInputNumber, {
33
+ return openBlock(), createBlock(_sfc_main$1, {
34
34
  modelValue: convertedValue.value,
35
35
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => convertedValue.value = $event),
36
36
  size: __props.size
@@ -0,0 +1,112 @@
1
+ import { defineComponent, useSlots, computed, useAttrs, createElementBlock, openBlock, normalizeStyle, normalizeClass, renderSlot, createElementVNode, withDirectives, unref, createCommentVNode, toDisplayString, mergeProps, vShow } from "vue";
2
+ import { S as SIZES } from "./p-btn.types.js";
3
+ import { useInputClasses } from "../useInputClasses.js";
4
+ const _hoisted_1 = ["data-has-error"];
5
+ const _hoisted_2 = { class: "relative w-full" };
6
+ const _hoisted_3 = { key: 0 };
7
+ const _hoisted_4 = ["type", "value"];
8
+ const _hoisted_5 = { key: 1 };
9
+ const INPUT_TYPES = { TEXT: "text", PASSWORD: "password" };
10
+ const _sfc_main = /* @__PURE__ */ defineComponent({
11
+ ...{
12
+ name: "PInput",
13
+ inheritAttrs: false
14
+ },
15
+ __name: "p-input",
16
+ props: {
17
+ modelValue: {
18
+ type: [String, Number, Boolean, null],
19
+ default: ""
20
+ },
21
+ type: {
22
+ type: String,
23
+ default: INPUT_TYPES.TEXT,
24
+ validator(value) {
25
+ return Object.values(INPUT_TYPES).includes(value);
26
+ }
27
+ },
28
+ label: {
29
+ type: String,
30
+ default: ""
31
+ },
32
+ errorMsg: {
33
+ type: String,
34
+ default: ""
35
+ },
36
+ required: {
37
+ type: Boolean,
38
+ default: false
39
+ },
40
+ size: {
41
+ type: String,
42
+ default: "md",
43
+ validator(value) {
44
+ return SIZES.includes(value);
45
+ }
46
+ },
47
+ rounded: {
48
+ type: Boolean,
49
+ default: false
50
+ }
51
+ },
52
+ emits: ["update:modelValue"],
53
+ setup(__props) {
54
+ const props = __props;
55
+ const slots = useSlots();
56
+ const { labelClasses, inputClasses, errorMsgClasses } = useInputClasses(
57
+ computed(() => ({
58
+ ...props,
59
+ prefix: !!slots.prefix,
60
+ suffix: !!slots.suffix
61
+ }))
62
+ );
63
+ const allAttrs = useAttrs();
64
+ const attrs = computed(() => {
65
+ const { class: classes, style: style2, ...rest } = allAttrs;
66
+ return rest;
67
+ });
68
+ const style = computed(() => {
69
+ return allAttrs.style;
70
+ });
71
+ return (_ctx, _cache) => {
72
+ return openBlock(), createElementBlock("div", {
73
+ class: normalizeClass([{ hidden: _ctx.$attrs.hidden }, _ctx.$attrs.class]),
74
+ "data-has-error": !!__props.errorMsg,
75
+ style: normalizeStyle(style.value)
76
+ }, [
77
+ renderSlot(_ctx.$slots, "label", {
78
+ label: __props.label,
79
+ labelClasses: unref(labelClasses)
80
+ }, () => [
81
+ __props.label ? (openBlock(), createElementBlock("label", {
82
+ key: 0,
83
+ class: normalizeClass(unref(labelClasses))
84
+ }, toDisplayString(__props.label), 3)) : createCommentVNode("", true)
85
+ ]),
86
+ createElementVNode("div", _hoisted_2, [
87
+ !!_ctx.$slots.prefix ? (openBlock(), createElementBlock("div", _hoisted_3, [
88
+ renderSlot(_ctx.$slots, "prefix")
89
+ ])) : createCommentVNode("", true),
90
+ createElementVNode("input", mergeProps({
91
+ type: __props.type,
92
+ value: __props.modelValue
93
+ }, attrs.value, {
94
+ class: unref(inputClasses),
95
+ onInput: _cache[0] || (_cache[0] = (event) => _ctx.$emit("update:modelValue", event.target.value))
96
+ }), null, 16, _hoisted_4),
97
+ !!_ctx.$slots.suffix ? (openBlock(), createElementBlock("div", _hoisted_5, [
98
+ renderSlot(_ctx.$slots, "suffix")
99
+ ])) : createCommentVNode("", true)
100
+ ]),
101
+ withDirectives(createElementVNode("div", {
102
+ class: normalizeClass(unref(errorMsgClasses))
103
+ }, toDisplayString(__props.errorMsg), 3), [
104
+ [vShow, __props.errorMsg]
105
+ ])
106
+ ], 14, _hoisted_1);
107
+ };
108
+ }
109
+ });
110
+ export {
111
+ _sfc_main as _
112
+ };
@@ -0,0 +1,39 @@
1
+ import { defineComponent, resolveDirective, createElementBlock, openBlock, Fragment, renderList, withDirectives, normalizeStyle } from "vue";
2
+ const _hoisted_1 = {
3
+ class: "flex justify-start overflow-hidden rounded bg-p-blue-20",
4
+ role: "progressbar"
5
+ };
6
+ const _sfc_main = /* @__PURE__ */ defineComponent({
7
+ ...{
8
+ name: "PProgressBar"
9
+ },
10
+ __name: "p-progress-bar",
11
+ props: {
12
+ total: {},
13
+ items: {}
14
+ },
15
+ setup(__props) {
16
+ return (_ctx, _cache) => {
17
+ const _directive_tooltip = resolveDirective("tooltip");
18
+ return openBlock(), createElementBlock("div", _hoisted_1, [
19
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.items, (item) => {
20
+ return withDirectives((openBlock(), createElementBlock("div", {
21
+ key: `progress-value-${item.color}`,
22
+ class: "h-full",
23
+ style: normalizeStyle({ width: `${item.value / _ctx.total * 100}%`, background: item.color })
24
+ }, null, 4)), [
25
+ [
26
+ _directive_tooltip,
27
+ item.label,
28
+ void 0,
29
+ { top: true }
30
+ ]
31
+ ]);
32
+ }), 128))
33
+ ]);
34
+ };
35
+ }
36
+ });
37
+ export {
38
+ _sfc_main as _
39
+ };
@@ -0,0 +1,90 @@
1
+ import { defineComponent, computed, useAttrs, createElementBlock, openBlock, normalizeStyle, normalizeClass, renderSlot, createElementVNode, withDirectives, unref, createCommentVNode, toDisplayString, mergeProps, vShow } from "vue";
2
+ import { S as SIZES } from "./p-btn.types.js";
3
+ import { useInputClasses } from "../useInputClasses.js";
4
+ const _hoisted_1 = ["data-has-error"];
5
+ const _hoisted_2 = ["value"];
6
+ const _sfc_main = /* @__PURE__ */ defineComponent({
7
+ ...{
8
+ name: "PTextarea",
9
+ inheritAttrs: false
10
+ },
11
+ __name: "p-textarea",
12
+ props: {
13
+ modelValue: {
14
+ type: [String, Number, null],
15
+ default: ""
16
+ },
17
+ label: {
18
+ type: String,
19
+ default: ""
20
+ },
21
+ errorMsg: {
22
+ type: String,
23
+ default: ""
24
+ },
25
+ required: {
26
+ type: Boolean,
27
+ default: false
28
+ },
29
+ size: {
30
+ type: String,
31
+ default: "md",
32
+ validator(value) {
33
+ return SIZES.includes(value);
34
+ }
35
+ }
36
+ },
37
+ emits: ["update:modelValue"],
38
+ setup(__props, { emit: __emit }) {
39
+ const emit = __emit;
40
+ const props = __props;
41
+ const { labelClasses, textareaClasses, errorMsgClasses } = useInputClasses(
42
+ computed(() => ({
43
+ required: props.required,
44
+ errorMsg: props.errorMsg,
45
+ size: props.size
46
+ }))
47
+ );
48
+ const allAttrs = useAttrs();
49
+ const attrs = computed(() => {
50
+ const { class: classes, style: style2, ...rest } = allAttrs;
51
+ return rest;
52
+ });
53
+ const style = computed(() => {
54
+ return allAttrs.style;
55
+ });
56
+ const updateValue = (e) => {
57
+ const target = e.target;
58
+ emit("update:modelValue", target.value);
59
+ };
60
+ return (_ctx, _cache) => {
61
+ return openBlock(), createElementBlock("div", {
62
+ class: normalizeClass([{ hidden: _ctx.$attrs.hidden }, _ctx.$attrs.class]),
63
+ "data-has-error": !!__props.errorMsg,
64
+ style: normalizeStyle(style.value)
65
+ }, [
66
+ renderSlot(_ctx.$slots, "label", {
67
+ label: __props.label,
68
+ labelClasses: unref(labelClasses)
69
+ }, () => [
70
+ __props.label ? (openBlock(), createElementBlock("label", {
71
+ key: 0,
72
+ class: normalizeClass(unref(labelClasses))
73
+ }, toDisplayString(__props.label), 3)) : createCommentVNode("", true)
74
+ ]),
75
+ createElementVNode("textarea", mergeProps({ value: __props.modelValue }, attrs.value, {
76
+ class: unref(textareaClasses),
77
+ onInput: updateValue
78
+ }), " ", 16, _hoisted_2),
79
+ withDirectives(createElementVNode("div", {
80
+ class: normalizeClass(unref(errorMsgClasses))
81
+ }, toDisplayString(__props.errorMsg), 3), [
82
+ [vShow, __props.errorMsg]
83
+ ])
84
+ ], 14, _hoisted_1);
85
+ };
86
+ }
87
+ });
88
+ export {
89
+ _sfc_main as _
90
+ };