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