@phila/phila-ui-core 2.3.0 → 2.3.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.
- package/dist/index.js +1 -1
- package/dist/index.mjs +366 -19
- package/dist/styles/elements/buttons.css +4 -1
- package/dist/styles/utilities/color.css +1 -1
- package/package.json +1 -16
- package/dist/BaseLink.vue_vue_type_script_setup_true_lang-Cp8pZrsD.js +0 -233
- package/dist/BaseLink.vue_vue_type_script_setup_true_lang-DYewXFgw.cjs +0 -1
- package/dist/classNames-CcykAxZN.js +0 -6
- package/dist/classNames-GLLmlfI4.cjs +0 -1
- package/dist/collapse-ApWEJVnD.cjs +0 -1
- package/dist/collapse-BvsHwQBu.js +0 -74
- package/dist/components.d.ts +0 -282
- package/dist/components.js +0 -1
- package/dist/components.mjs +0 -9
- package/dist/composables.d.ts +0 -127
- package/dist/composables.js +0 -1
- package/dist/composables.mjs +0 -9
- package/dist/useRouter-BVKwor6C.js +0 -50
- package/dist/useRouter-C4oT8vFk.cjs +0 -1
- package/dist/utils.d.ts +0 -112
- package/dist/utils.js +0 -1
- package/dist/utils.mjs +0 -20
- /package/dist/{BaseLink.css → index.css} +0 -0
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const e=require("vue"),F=require("@fortawesome/vue-fontawesome");function M(...n){return n.filter(Boolean).join(" ")}function W(n,t){let o;return(...l)=>{o!==void 0&&clearTimeout(o),o=setTimeout(()=>{n(...l)},t)}}function H(n="phila-ui-"){const t=new Uint8Array(16);crypto.getRandomValues(t);const o=Array.from(t,l=>l.toString(36)).join("").substring(0,12);return`${n}-${o}`}const q=e.ref("");function E(){return{inputValue:q,setInputValue:t=>{q.value=t}}}const r=e.reactive({validateOnBlur:!1,validateOnInput:!1,validateOnChange:!1,validateOnMount:!1,required:!1,isValid:!0,errors:[]}),{inputValue:S}=E();function T(n,t){return{init:()=>{n&&(r.validateOnBlur=n.validateOnBlur??!1,r.validateOnInput=n.validateOnInput??!1,r.validateOnChange=n.validateOnChange??!1,r.validateOnMount=n.validateOnMount??!1,r.validate=n.validate,r.required=n.required??!1,r.errors=n.errors||[])},validation:()=>{const a=Object.assign([],n?.errors||[]);if(r.required&&!S.value&&(r.isValid=!1,a.push("This field is required")),r.validate){const s=r.validate(S.value);typeof s=="string"?(r.isValid=!1,a.push(s)):Array.isArray(s)?(r.isValid=!1,a.push(...s)):r.isValid=!0}r.errors=a,a.length>0?(r.isValid=!1,t?.("error",a)):r.isValid=!0},isValid:e.computed(()=>r.isValid),errors:e.computed(()=>r.errors)}}const U={key:0,class:"input-errors"},K=e.defineComponent({__name:"ErrorList",props:{errors:{},validateOnBlur:{type:Boolean},validateOnInput:{type:Boolean},validateOnChange:{type:Boolean},validateOnMount:{type:Boolean},validate:{type:Function},required:{type:Boolean}},setup(n){const{errors:t,isValid:o}=T(),l=n,a=e.computed(()=>Object.assign([],t.value,l.errors||[]));return(s,m)=>!e.unref(o)&&a.value?.length?(e.openBlock(),e.createElementBlock("div",U,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(c,d)=>(e.openBlock(),e.createElementBlock("li",{key:d},e.toDisplayString(c),1))),128))])])):e.createCommentVNode("",!0)}}),_=(n,t)=>{const o=n.__vccOpts||n;for(const[l,a]of t)o[l]=a;return o},N=_(K,[["__scopeId","data-v-caba8dd2"]]),G=["for"],J={key:0,class:"required"},Q=e.defineComponent({__name:"InputLabel",props:{id:{},required:{type:Boolean}},setup(n){return(t,o)=>(e.openBlock(),e.createElementBlock("label",{class:"input-label",for:n.id},[e.renderSlot(t.$slots,"default",{},void 0,!0),n.required?(e.openBlock(),e.createElementBlock("span",J,"*")):e.createCommentVNode("",!0)],8,G))}}),A=_(Q,[["__scopeId","data-v-00c91174"]]),X=e.defineComponent({inheritAttrs:!1,__name:"InputWrap",props:{id:{},name:{},placeholder:{},label:{},icon:{},required:{type:Boolean},errors:{},validateOnBlur:{type:Boolean},validateOnInput:{type:Boolean},validateOnChange:{type:Boolean},validateOnMount:{type:Boolean},validate:{type:Function},className:{}},emits:["update:modelValue","input","change","focus","blur","keydown","keyup","keypress","error"],setup(n,{emit:t}){const{setInputValue:o}=E(),l=e.ref(""),a=n,s=t,{init:m,isValid:c,validation:d}=T({validateOnMount:a.validateOnMount??!0,validateOnInput:a.validateOnInput??!0,validateOnBlur:a.validateOnBlur??!0,validateOnChange:a.validateOnChange??!0,required:a.required??!1,errors:a.errors||[],validate:a.validate},s),p=e.computed(()=>({invalid:!c.value})),C=B=>(l.value=B.target.value,s("update:modelValue",l.value),s("input",l.value),o(l.value),a.validateOnInput&&d(),l.value),b=()=>{a.validateOnBlur&&d(),s("blur")},O=()=>{s("focus")};return e.onBeforeMount(()=>{m()}),e.onMounted(()=>{a.validateOnMount&&d()}),(B,w)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["input-wrap",{hasError:!e.unref(c)}])},[a.label?(e.openBlock(),e.createBlock(A,{key:0,id:a.id,required:a.required},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.label),1)]),_:1},8,["id","required"])):e.createCommentVNode("",!0),e.renderSlot(B.$slots,"default",e.normalizeProps(e.guardReactiveProps({inputValue:l.value,onBlur:b,onFocus:O,onInput:C,isValid:e.unref(c),inputClasses:p.value})),void 0,!0),e.createVNode(N)],2))}}),Y=_(X,[["__scopeId","data-v-751bf20e"]]),Z=["innerHTML"],ee=["src","alt"],te=e.defineComponent({__name:"Icon",props:{className:{},iconDefinition:{},iconClass:{},src:{},svgRaw:{},variant:{},size:{default:"small"},inline:{type:Boolean},shadow:{type:Boolean},decorative:{type:Boolean},ariaLabel:{}},setup(n){const t=n,o=e.computed(()=>M("phila-icon",t.size&&`phila-icon--${t.size}`,t.inline&&"phila-icon--inline",t.variant&&t.variant!=="default"&&`phila-icon--${t.variant}`,t.shadow&&"phila-icon--shadow",t.className)),l=e.computed(()=>t.decorative?{"aria-hidden":!0}:{"aria-label":t.ariaLabel,role:"img"});return(a,s)=>(e.openBlock(),e.createElementBlock("span",e.mergeProps({class:o.value},l.value),[t.iconDefinition?(e.openBlock(),e.createBlock(e.unref(F.FontAwesomeIcon),{key:0,icon:t.iconDefinition},null,8,["icon"])):t.iconClass?(e.openBlock(),e.createElementBlock("i",{key:1,class:e.normalizeClass(`fa fa-${t.iconClass}`)},null,2)):t.svgRaw?(e.openBlock(),e.createElementBlock("span",{key:2,class:"phila-icon__svg",innerHTML:t.svgRaw},null,8,Z)):t.src?(e.openBlock(),e.createElementBlock("img",{key:3,src:t.src,alt:t.decorative?"":t.ariaLabel||"Icon"},null,8,ee)):e.createCommentVNode("",!0)],16))}}),V=_(te,[["__scopeId","data-v-55074cbf"]]),ne={key:1},ae=e.defineComponent({__name:"ActionContent",props:{iconRight:{type:Boolean,default:!1},iconOnly:{type:Boolean,default:!1},inline:{type:Boolean},text:{default:void 0},size:{default:void 0},shadow:{type:Boolean},iconDefinition:{},iconClass:{},src:{},svgRaw:{},variant:{}},setup(n){const t=n,o=e.computed(()=>t.iconDefinition||t.iconClass||t.src||t.svgRaw),l=e.computed(()=>({iconDefinition:t.iconDefinition,iconClass:t.iconClass,src:t.src,svgRaw:t.svgRaw,size:t.iconOnly?t.size:void 0,decorative:!0,class:"icon",inline:t.inline??!t.iconOnly,shadow:t.shadow}));return(a,s)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[o.value&&!t.iconRight?(e.openBlock(),e.createBlock(V,e.normalizeProps(e.mergeProps({key:0},l.value)),null,16)):e.createCommentVNode("",!0),t.iconOnly?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",ne,[e.renderSlot(a.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.text),1)])])),o.value&&t.iconRight?(e.openBlock(),e.createBlock(V,e.normalizeProps(e.mergeProps({key:2},l.value)),null,16)):e.createCommentVNode("",!0)],64))}}),L=n=>"to"in n&&n.to!==void 0;function D(){const n=e.inject("router",null),t=e.computed(()=>n!==null);return{router:n,hasRouter:t}}const oe=e.defineComponent({__name:"BaseLink",props:{to:{},href:{},target:{},rel:{},disabled:{type:Boolean},ariaLabel:{},className:{}},setup(n){const t=n,{hasRouter:o}=D(),l=e.computed(()=>L(t)&&o.value?e.resolveComponent("RouterLink"):"a"),a=e.computed(()=>L(t)?{to:t.disabled?void 0:t.to,...t.disabled&&{"aria-disabled":"true"},...t.ariaLabel&&{"aria-label":t.ariaLabel}}:{href:t.disabled?void 0:t.href,...t.target&&{target:t.target},...t.rel&&{rel:t.rel},...t.disabled&&{"aria-disabled":"true"},...t.ariaLabel&&{"aria-label":t.ariaLabel}});return(s,m)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.value),e.mergeProps({class:n.className},a.value),{default:e.withCtx(()=>[e.renderSlot(s.$slots,"default")]),_:3},16,["class"]))}}),v=e.ref({}),f=e.ref(),h=400,I=e.ref(null);function le(n){const t=n?.group??"global",o=(i,u)=>{v.value[t][i]=u},l=(i,u)=>{v.value[t]={[i]:u}},a=i=>v.value[t]?.[i]??!1,s=i=>{o(i,!a(i))},m=i=>{l(i,!a(i))},c=()=>{v.value[t]={}},d=i=>{i.key==="Escape"&&(o(n.id,!1),g())},p=i=>{if(!n)return;const u=i.target,[y]=Object.keys(v.value[t]).filter(j=>v.value[t][j]===!0),k=document.getElementById(y),P=document.querySelector(`[aria-controls="${y}"]`),x=u.getAttribute("aria-controls")===y||P?.contains(i.target);k&&!k.contains(u)&&!x&&(o(n.id,!1),g())},C=()=>{n&&(f.value=setTimeout(()=>{o(n.id,!1),g()},h))},b=()=>{n&&n.mouseOverToggle===!0&&(I.value=n.id,f.value=setTimeout(()=>{$()},h))},O=()=>{n&&n.mouseOverToggle===!0&&(I.value=null,clearTimeout(f.value),f.value=setTimeout(()=>{I.value!==n.id&&(o(n.id,!1),g())},h))},B=i=>{if(!n)return;const{relatedTarget:u}=i;if(!u||u.getAttribute("aria-controls")===n.id)return;const k=document.getElementById(n.id);k&&k.contains(u)||(clearTimeout(f.value),f.value=setTimeout(()=>{n.openSingle?l(n.id,!1):o(n.id,!1),g()},h))},w=()=>{n&&(n.outsideClickClose&&(document.addEventListener("click",p),document.addEventListener("touchend",p)),n.escapeKeyClose&&document.addEventListener("keydown",d))},g=()=>{document.removeEventListener("click",p),document.removeEventListener("touchend",p),document.removeEventListener("keydown",d),document.removeEventListener("scroll",C)},R=i=>{n&&(i?.preventDefault(),clearTimeout(f.value),w())},z=i=>{n&&(R(i),n.openSingle?m(n.id):s(n.id))},$=i=>{n&&(R(i),n.openSingle?l(n.id,!0):o(n.id,!0))};return e.onBeforeMount(()=>{v.value[t]||c()}),e.onUnmounted(()=>{g()}),{state:v,timeout:f,toggle:s,toggleSingle:m,setCollapsed:o,setSingleCollapsed:l,isCollapsed:a,reset:c,onMouseEnter:b,onMouseLeave:O,focusChange:B,onClickToggle:z,onClickOpen:$}}exports.ActionContent=ae;exports.BaseLink=oe;exports.ErrorList=N;exports.Icon=V;exports.InputLabel=A;exports.InputWrap=Y;exports.cn=M;exports.debounce=W;exports.generateRandomId=H;exports.isRouterLink=L;exports.useCollapse=le;exports.useInput=E;exports.useRouter=D;exports.useValidation=T;
|
package/dist/index.mjs
CHANGED
|
@@ -1,21 +1,368 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { ref as k, reactive as te, computed as c, defineComponent as O, createElementBlock as u, createCommentVNode as y, unref as V, openBlock as s, createElementVNode as ne, Fragment as H, renderList as ae, toDisplayString as D, renderSlot as $, onBeforeMount as U, onMounted as ie, normalizeClass as W, createBlock as C, createVNode as le, withCtx as K, createTextVNode as G, normalizeProps as A, guardReactiveProps as oe, mergeProps as T, inject as re, resolveComponent as se, resolveDynamicComponent as ue, onUnmounted as ce } from "vue";
|
|
2
|
+
import { FontAwesomeIcon as de } from "@fortawesome/vue-fontawesome";
|
|
3
|
+
import './index.css';function ve(...t) {
|
|
4
|
+
return t.filter(Boolean).join(" ");
|
|
5
|
+
}
|
|
6
|
+
function Te(t, e) {
|
|
7
|
+
let a;
|
|
8
|
+
return (...i) => {
|
|
9
|
+
a !== void 0 && clearTimeout(a), a = setTimeout(() => {
|
|
10
|
+
t(...i);
|
|
11
|
+
}, e);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function $e(t = "phila-ui-") {
|
|
15
|
+
const e = new Uint8Array(16);
|
|
16
|
+
crypto.getRandomValues(e);
|
|
17
|
+
const a = Array.from(e, (i) => i.toString(36)).join("").substring(0, 12);
|
|
18
|
+
return `${t}-${a}`;
|
|
19
|
+
}
|
|
20
|
+
const z = k("");
|
|
21
|
+
function J() {
|
|
22
|
+
return {
|
|
23
|
+
inputValue: z,
|
|
24
|
+
setInputValue: (e) => {
|
|
25
|
+
z.value = e;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const o = te({
|
|
30
|
+
validateOnBlur: !1,
|
|
31
|
+
validateOnInput: !1,
|
|
32
|
+
validateOnChange: !1,
|
|
33
|
+
validateOnMount: !1,
|
|
34
|
+
required: !1,
|
|
35
|
+
isValid: !0,
|
|
36
|
+
errors: []
|
|
37
|
+
}), { inputValue: j } = J();
|
|
38
|
+
function Q(t, e) {
|
|
39
|
+
return {
|
|
40
|
+
init: () => {
|
|
41
|
+
t && (o.validateOnBlur = t.validateOnBlur ?? !1, o.validateOnInput = t.validateOnInput ?? !1, o.validateOnChange = t.validateOnChange ?? !1, o.validateOnMount = t.validateOnMount ?? !1, o.validate = t.validate, o.required = t.required ?? !1, o.errors = t.errors || []);
|
|
42
|
+
},
|
|
43
|
+
validation: () => {
|
|
44
|
+
const n = Object.assign([], t?.errors || []);
|
|
45
|
+
if (o.required && !j.value && (o.isValid = !1, n.push("This field is required")), o.validate) {
|
|
46
|
+
const r = o.validate(j.value);
|
|
47
|
+
typeof r == "string" ? (o.isValid = !1, n.push(r)) : Array.isArray(r) ? (o.isValid = !1, n.push(...r)) : o.isValid = !0;
|
|
48
|
+
}
|
|
49
|
+
o.errors = n, n.length > 0 ? (o.isValid = !1, e?.("error", n)) : o.isValid = !0;
|
|
50
|
+
},
|
|
51
|
+
isValid: c(() => o.isValid),
|
|
52
|
+
errors: c(() => o.errors)
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const fe = {
|
|
56
|
+
key: 0,
|
|
57
|
+
class: "input-errors"
|
|
58
|
+
}, me = /* @__PURE__ */ O({
|
|
59
|
+
__name: "ErrorList",
|
|
60
|
+
props: {
|
|
61
|
+
errors: {},
|
|
62
|
+
validateOnBlur: { type: Boolean },
|
|
63
|
+
validateOnInput: { type: Boolean },
|
|
64
|
+
validateOnChange: { type: Boolean },
|
|
65
|
+
validateOnMount: { type: Boolean },
|
|
66
|
+
validate: { type: Function },
|
|
67
|
+
required: { type: Boolean }
|
|
68
|
+
},
|
|
69
|
+
setup(t) {
|
|
70
|
+
const { errors: e, isValid: a } = Q(), i = t, n = c(() => Object.assign([], e.value, i.errors || []));
|
|
71
|
+
return (r, h) => !V(a) && n.value?.length ? (s(), u("div", fe, [
|
|
72
|
+
ne("ul", null, [
|
|
73
|
+
(s(!0), u(H, null, ae(n.value, (v, f) => (s(), u("li", { key: f }, D(v), 1))), 128))
|
|
74
|
+
])
|
|
75
|
+
])) : y("", !0);
|
|
76
|
+
}
|
|
77
|
+
}), w = (t, e) => {
|
|
78
|
+
const a = t.__vccOpts || t;
|
|
79
|
+
for (const [i, n] of e)
|
|
80
|
+
a[i] = n;
|
|
81
|
+
return a;
|
|
82
|
+
}, ge = /* @__PURE__ */ w(me, [["__scopeId", "data-v-caba8dd2"]]), ye = ["for"], he = {
|
|
83
|
+
key: 0,
|
|
84
|
+
class: "required"
|
|
85
|
+
}, _e = /* @__PURE__ */ O({
|
|
86
|
+
__name: "InputLabel",
|
|
87
|
+
props: {
|
|
88
|
+
id: {},
|
|
89
|
+
required: { type: Boolean }
|
|
90
|
+
},
|
|
91
|
+
setup(t) {
|
|
92
|
+
return (e, a) => (s(), u("label", {
|
|
93
|
+
class: "input-label",
|
|
94
|
+
for: t.id
|
|
95
|
+
}, [
|
|
96
|
+
$(e.$slots, "default", {}, void 0, !0),
|
|
97
|
+
t.required ? (s(), u("span", he, "*")) : y("", !0)
|
|
98
|
+
], 8, ye));
|
|
99
|
+
}
|
|
100
|
+
}), pe = /* @__PURE__ */ w(_e, [["__scopeId", "data-v-00c91174"]]), Oe = /* @__PURE__ */ O({
|
|
101
|
+
inheritAttrs: !1,
|
|
102
|
+
__name: "InputWrap",
|
|
103
|
+
props: {
|
|
104
|
+
id: {},
|
|
105
|
+
name: {},
|
|
106
|
+
placeholder: {},
|
|
107
|
+
label: {},
|
|
108
|
+
icon: {},
|
|
109
|
+
required: { type: Boolean },
|
|
110
|
+
errors: {},
|
|
111
|
+
validateOnBlur: { type: Boolean },
|
|
112
|
+
validateOnInput: { type: Boolean },
|
|
113
|
+
validateOnChange: { type: Boolean },
|
|
114
|
+
validateOnMount: { type: Boolean },
|
|
115
|
+
validate: { type: Function },
|
|
116
|
+
className: {}
|
|
117
|
+
},
|
|
118
|
+
emits: ["update:modelValue", "input", "change", "focus", "blur", "keydown", "keyup", "keypress", "error"],
|
|
119
|
+
setup(t, { emit: e }) {
|
|
120
|
+
const { setInputValue: a } = J(), i = k(""), n = t, r = e, { init: h, isValid: v, validation: f } = Q(
|
|
121
|
+
{
|
|
122
|
+
validateOnMount: n.validateOnMount ?? !0,
|
|
123
|
+
validateOnInput: n.validateOnInput ?? !0,
|
|
124
|
+
validateOnBlur: n.validateOnBlur ?? !0,
|
|
125
|
+
validateOnChange: n.validateOnChange ?? !0,
|
|
126
|
+
required: n.required ?? !1,
|
|
127
|
+
errors: n.errors || [],
|
|
128
|
+
validate: n.validate
|
|
129
|
+
},
|
|
130
|
+
r
|
|
131
|
+
), _ = c(() => ({
|
|
132
|
+
invalid: !v.value
|
|
133
|
+
})), R = (b) => (i.value = b.target.value, r("update:modelValue", i.value), r("input", i.value), a(i.value), n.validateOnInput && f(), i.value), E = () => {
|
|
134
|
+
n.validateOnBlur && f(), r("blur");
|
|
135
|
+
}, q = () => {
|
|
136
|
+
r("focus");
|
|
137
|
+
};
|
|
138
|
+
return U(() => {
|
|
139
|
+
h();
|
|
140
|
+
}), ie(() => {
|
|
141
|
+
n.validateOnMount && f();
|
|
142
|
+
}), (b, S) => (s(), u("div", {
|
|
143
|
+
class: W(["input-wrap", { hasError: !V(v) }])
|
|
144
|
+
}, [
|
|
145
|
+
n.label ? (s(), C(pe, {
|
|
146
|
+
key: 0,
|
|
147
|
+
id: n.id,
|
|
148
|
+
required: n.required
|
|
149
|
+
}, {
|
|
150
|
+
default: K(() => [
|
|
151
|
+
G(D(n.label), 1)
|
|
152
|
+
]),
|
|
153
|
+
_: 1
|
|
154
|
+
}, 8, ["id", "required"])) : y("", !0),
|
|
155
|
+
$(b.$slots, "default", A(oe({ inputValue: i.value, onBlur: E, onFocus: q, onInput: R, isValid: V(v), inputClasses: _.value })), void 0, !0),
|
|
156
|
+
le(ge)
|
|
157
|
+
], 2));
|
|
158
|
+
}
|
|
159
|
+
}), we = /* @__PURE__ */ w(Oe, [["__scopeId", "data-v-751bf20e"]]), be = ["innerHTML"], Be = ["src", "alt"], Ce = /* @__PURE__ */ O({
|
|
160
|
+
__name: "Icon",
|
|
161
|
+
props: {
|
|
162
|
+
className: {},
|
|
163
|
+
iconDefinition: {},
|
|
164
|
+
iconClass: {},
|
|
165
|
+
src: {},
|
|
166
|
+
svgRaw: {},
|
|
167
|
+
variant: {},
|
|
168
|
+
size: { default: "small" },
|
|
169
|
+
inline: { type: Boolean },
|
|
170
|
+
shadow: { type: Boolean },
|
|
171
|
+
decorative: { type: Boolean },
|
|
172
|
+
ariaLabel: {}
|
|
173
|
+
},
|
|
174
|
+
setup(t) {
|
|
175
|
+
const e = t, a = c(() => ve(
|
|
176
|
+
"phila-icon",
|
|
177
|
+
e.size && `phila-icon--${e.size}`,
|
|
178
|
+
e.inline && "phila-icon--inline",
|
|
179
|
+
e.variant && e.variant !== "default" && `phila-icon--${e.variant}`,
|
|
180
|
+
e.shadow && "phila-icon--shadow",
|
|
181
|
+
e.className
|
|
182
|
+
)), i = c(() => e.decorative ? {
|
|
183
|
+
"aria-hidden": !0
|
|
184
|
+
} : {
|
|
185
|
+
"aria-label": e.ariaLabel,
|
|
186
|
+
role: "img"
|
|
187
|
+
});
|
|
188
|
+
return (n, r) => (s(), u("span", T({ class: a.value }, i.value), [
|
|
189
|
+
e.iconDefinition ? (s(), C(V(de), {
|
|
190
|
+
key: 0,
|
|
191
|
+
icon: e.iconDefinition
|
|
192
|
+
}, null, 8, ["icon"])) : e.iconClass ? (s(), u("i", {
|
|
193
|
+
key: 1,
|
|
194
|
+
class: W(`fa fa-${e.iconClass}`)
|
|
195
|
+
}, null, 2)) : e.svgRaw ? (s(), u("span", {
|
|
196
|
+
key: 2,
|
|
197
|
+
class: "phila-icon__svg",
|
|
198
|
+
innerHTML: e.svgRaw
|
|
199
|
+
}, null, 8, be)) : e.src ? (s(), u("img", {
|
|
200
|
+
key: 3,
|
|
201
|
+
src: e.src,
|
|
202
|
+
alt: e.decorative ? "" : e.ariaLabel || "Icon"
|
|
203
|
+
}, null, 8, Be)) : y("", !0)
|
|
204
|
+
], 16));
|
|
205
|
+
}
|
|
206
|
+
}), F = /* @__PURE__ */ w(Ce, [["__scopeId", "data-v-55074cbf"]]), ke = { key: 1 }, Re = /* @__PURE__ */ O({
|
|
207
|
+
__name: "ActionContent",
|
|
208
|
+
props: {
|
|
209
|
+
iconRight: { type: Boolean, default: !1 },
|
|
210
|
+
iconOnly: { type: Boolean, default: !1 },
|
|
211
|
+
inline: { type: Boolean },
|
|
212
|
+
text: { default: void 0 },
|
|
213
|
+
size: { default: void 0 },
|
|
214
|
+
shadow: { type: Boolean },
|
|
215
|
+
iconDefinition: {},
|
|
216
|
+
iconClass: {},
|
|
217
|
+
src: {},
|
|
218
|
+
svgRaw: {},
|
|
219
|
+
variant: {}
|
|
220
|
+
},
|
|
221
|
+
setup(t) {
|
|
222
|
+
const e = t, a = c(() => e.iconDefinition || e.iconClass || e.src || e.svgRaw), i = c(
|
|
223
|
+
() => ({
|
|
224
|
+
iconDefinition: e.iconDefinition,
|
|
225
|
+
iconClass: e.iconClass,
|
|
226
|
+
src: e.src,
|
|
227
|
+
svgRaw: e.svgRaw,
|
|
228
|
+
size: e.iconOnly ? e.size : void 0,
|
|
229
|
+
decorative: !0,
|
|
230
|
+
class: "icon",
|
|
231
|
+
inline: e.inline ?? !e.iconOnly,
|
|
232
|
+
shadow: e.shadow
|
|
233
|
+
})
|
|
234
|
+
);
|
|
235
|
+
return (n, r) => (s(), u(H, null, [
|
|
236
|
+
a.value && !e.iconRight ? (s(), C(F, A(T({ key: 0 }, i.value)), null, 16)) : y("", !0),
|
|
237
|
+
e.iconOnly ? y("", !0) : (s(), u("span", ke, [
|
|
238
|
+
$(n.$slots, "default", {}, () => [
|
|
239
|
+
G(D(e.text), 1)
|
|
240
|
+
])
|
|
241
|
+
])),
|
|
242
|
+
a.value && e.iconRight ? (s(), C(F, A(T({ key: 2 }, i.value)), null, 16)) : y("", !0)
|
|
243
|
+
], 64));
|
|
244
|
+
}
|
|
245
|
+
}), P = (t) => "to" in t && t.to !== void 0;
|
|
246
|
+
function Ie() {
|
|
247
|
+
const t = re("router", null), e = c(() => t !== null);
|
|
248
|
+
return {
|
|
249
|
+
router: t,
|
|
250
|
+
hasRouter: e
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
const Ee = /* @__PURE__ */ O({
|
|
254
|
+
__name: "BaseLink",
|
|
255
|
+
props: {
|
|
256
|
+
to: {},
|
|
257
|
+
href: {},
|
|
258
|
+
target: {},
|
|
259
|
+
rel: {},
|
|
260
|
+
disabled: { type: Boolean },
|
|
261
|
+
ariaLabel: {},
|
|
262
|
+
className: {}
|
|
263
|
+
},
|
|
264
|
+
setup(t) {
|
|
265
|
+
const e = t, { hasRouter: a } = Ie(), i = c(() => P(e) && a.value ? se("RouterLink") : "a"), n = c(() => P(e) ? {
|
|
266
|
+
to: e.disabled ? void 0 : e.to,
|
|
267
|
+
...e.disabled && { "aria-disabled": "true" },
|
|
268
|
+
...e.ariaLabel && { "aria-label": e.ariaLabel }
|
|
269
|
+
} : {
|
|
270
|
+
href: e.disabled ? void 0 : e.href,
|
|
271
|
+
...e.target && { target: e.target },
|
|
272
|
+
...e.rel && { rel: e.rel },
|
|
273
|
+
...e.disabled && { "aria-disabled": "true" },
|
|
274
|
+
...e.ariaLabel && { "aria-label": e.ariaLabel }
|
|
275
|
+
});
|
|
276
|
+
return (r, h) => (s(), C(ue(i.value), T({ class: t.className }, n.value), {
|
|
277
|
+
default: K(() => [
|
|
278
|
+
$(r.$slots, "default")
|
|
279
|
+
]),
|
|
280
|
+
_: 3
|
|
281
|
+
}, 16, ["class"]));
|
|
282
|
+
}
|
|
283
|
+
}), m = k({}), g = k(), L = 400, M = k(null);
|
|
284
|
+
function qe(t) {
|
|
285
|
+
const e = t?.group ?? "global", a = (l, d) => {
|
|
286
|
+
m.value[e][l] = d;
|
|
287
|
+
}, i = (l, d) => {
|
|
288
|
+
m.value[e] = { [l]: d };
|
|
289
|
+
}, n = (l) => m.value[e]?.[l] ?? !1, r = (l) => {
|
|
290
|
+
a(l, !n(l));
|
|
291
|
+
}, h = (l) => {
|
|
292
|
+
i(l, !n(l));
|
|
293
|
+
}, v = () => {
|
|
294
|
+
m.value[e] = {};
|
|
295
|
+
}, f = (l) => {
|
|
296
|
+
l.key === "Escape" && (a(t.id, !1), p());
|
|
297
|
+
}, _ = (l) => {
|
|
298
|
+
if (!t) return;
|
|
299
|
+
const d = l.target, [I] = Object.keys(m.value[e]).filter((ee) => m.value[e][ee] === !0), B = document.getElementById(I), Y = document.querySelector(`[aria-controls="${I}"]`), Z = d.getAttribute("aria-controls") === I || Y?.contains(l.target);
|
|
300
|
+
B && !B.contains(d) && !Z && (a(t.id, !1), p());
|
|
301
|
+
}, R = () => {
|
|
302
|
+
t && (g.value = setTimeout(() => {
|
|
303
|
+
a(t.id, !1), p();
|
|
304
|
+
}, L));
|
|
305
|
+
}, E = () => {
|
|
306
|
+
t && t.mouseOverToggle === !0 && (M.value = t.id, g.value = setTimeout(() => {
|
|
307
|
+
x();
|
|
308
|
+
}, L));
|
|
309
|
+
}, q = () => {
|
|
310
|
+
t && t.mouseOverToggle === !0 && (M.value = null, clearTimeout(g.value), g.value = setTimeout(() => {
|
|
311
|
+
M.value !== t.id && (a(t.id, !1), p());
|
|
312
|
+
}, L));
|
|
313
|
+
}, b = (l) => {
|
|
314
|
+
if (!t) return;
|
|
315
|
+
const { relatedTarget: d } = l;
|
|
316
|
+
if (!d || d.getAttribute("aria-controls") === t.id)
|
|
317
|
+
return;
|
|
318
|
+
const B = document.getElementById(t.id);
|
|
319
|
+
B && B.contains(d) || (clearTimeout(g.value), g.value = setTimeout(() => {
|
|
320
|
+
t.openSingle ? i(t.id, !1) : a(t.id, !1), p();
|
|
321
|
+
}, L));
|
|
322
|
+
}, S = () => {
|
|
323
|
+
t && (t.outsideClickClose && (document.addEventListener("click", _), document.addEventListener("touchend", _)), t.escapeKeyClose && document.addEventListener("keydown", f));
|
|
324
|
+
}, p = () => {
|
|
325
|
+
document.removeEventListener("click", _), document.removeEventListener("touchend", _), document.removeEventListener("keydown", f), document.removeEventListener("scroll", R);
|
|
326
|
+
}, N = (l) => {
|
|
327
|
+
t && (l?.preventDefault(), clearTimeout(g.value), S());
|
|
328
|
+
}, X = (l) => {
|
|
329
|
+
t && (N(l), t.openSingle ? h(t.id) : r(t.id));
|
|
330
|
+
}, x = (l) => {
|
|
331
|
+
t && (N(l), t.openSingle ? i(t.id, !0) : a(t.id, !0));
|
|
332
|
+
};
|
|
333
|
+
return U(() => {
|
|
334
|
+
m.value[e] || v();
|
|
335
|
+
}), ce(() => {
|
|
336
|
+
p();
|
|
337
|
+
}), {
|
|
338
|
+
state: m,
|
|
339
|
+
timeout: g,
|
|
340
|
+
toggle: r,
|
|
341
|
+
toggleSingle: h,
|
|
342
|
+
setCollapsed: a,
|
|
343
|
+
setSingleCollapsed: i,
|
|
344
|
+
isCollapsed: n,
|
|
345
|
+
reset: v,
|
|
346
|
+
onMouseEnter: E,
|
|
347
|
+
onMouseLeave: q,
|
|
348
|
+
focusChange: b,
|
|
349
|
+
onClickToggle: X,
|
|
350
|
+
onClickOpen: x
|
|
351
|
+
};
|
|
352
|
+
}
|
|
6
353
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
354
|
+
Re as ActionContent,
|
|
355
|
+
Ee as BaseLink,
|
|
356
|
+
ge as ErrorList,
|
|
357
|
+
F as Icon,
|
|
358
|
+
pe as InputLabel,
|
|
359
|
+
we as InputWrap,
|
|
360
|
+
ve as cn,
|
|
361
|
+
Te as debounce,
|
|
362
|
+
$e as generateRandomId,
|
|
363
|
+
P as isRouterLink,
|
|
364
|
+
qe as useCollapse,
|
|
365
|
+
J as useInput,
|
|
366
|
+
Ie as useRouter,
|
|
367
|
+
Q as useValidation
|
|
21
368
|
};
|
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
&.icon-button--standard:not(:disabled) {
|
|
188
188
|
box-shadow: none;
|
|
189
189
|
color: var(--Schemes-Primary, #003282);
|
|
190
|
-
background:
|
|
190
|
+
background: transparent;
|
|
191
191
|
&:visited:not(:hover):not(:focus):not(:active) {
|
|
192
192
|
color: var(--Schemes-Primary, #003282);
|
|
193
193
|
}
|
|
@@ -209,6 +209,9 @@
|
|
|
209
209
|
color: var(--Schemes-Primary);
|
|
210
210
|
background: var(--Schemes-Surface-Container);
|
|
211
211
|
border-color: transparent;
|
|
212
|
+
box-shadow:
|
|
213
|
+
0 1px 2px 0 rgba(0, 0, 0, 0.3),
|
|
214
|
+
0 1px 3px 1px rgba(0, 0, 0, 0.15);
|
|
212
215
|
}
|
|
213
216
|
}
|
|
214
217
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
--Extended-Colors-link-default: var(--Schemes-Primary);
|
|
17
17
|
--Extended-Colors-link-hover: var(--Schemes-On-Surface);
|
|
18
18
|
--Extended-Colors-link-visited: var(--Extended-Colors-link-visited);
|
|
19
|
-
background-color: var(--
|
|
19
|
+
background-color: var(--Schemes-Surface-Container-Low);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
.has-background-secondary {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phila/phila-ui-core",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Core utilities and styles for Phila UI library",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -12,21 +12,6 @@
|
|
|
12
12
|
"import": "./dist/index.mjs",
|
|
13
13
|
"require": "./dist/index.js"
|
|
14
14
|
},
|
|
15
|
-
"./utils": {
|
|
16
|
-
"types": "./dist/utils.d.ts",
|
|
17
|
-
"import": "./dist/utils.mjs",
|
|
18
|
-
"require": "./dist/utils.js"
|
|
19
|
-
},
|
|
20
|
-
"./composables": {
|
|
21
|
-
"types": "./dist/composables.d.ts",
|
|
22
|
-
"import": "./dist/composables.mjs",
|
|
23
|
-
"require": "./dist/composables.js"
|
|
24
|
-
},
|
|
25
|
-
"./components": {
|
|
26
|
-
"types": "./dist/components/index.d.ts",
|
|
27
|
-
"import": "./dist/components/index.mjs",
|
|
28
|
-
"require": "./dist/components/index.js"
|
|
29
|
-
},
|
|
30
15
|
"./styles/*": "./dist/styles/*"
|
|
31
16
|
},
|
|
32
17
|
"files": [
|