@phila/phila-ui-checkbox 0.1.1-beta.9 → 1.0.0-beta.10
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/Checkbox.vue.d.ts +1 -1
- package/dist/Checkbox.vue.d.ts.map +1 -1
- package/dist/CheckboxGroup.vue.d.ts +2 -2
- package/dist/CheckboxGroup.vue.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +340 -74
- package/package.json +3 -2
package/dist/Checkbox.vue.d.ts
CHANGED
|
@@ -11,6 +11,6 @@ declare const _default: import('vue').DefineComponent<CheckboxProps, {}, {}, {},
|
|
|
11
11
|
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
12
12
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
13
13
|
inputRef: HTMLInputElement;
|
|
14
|
-
},
|
|
14
|
+
}, HTMLSpanElement>;
|
|
15
15
|
export default _default;
|
|
16
16
|
//# sourceMappingURL=Checkbox.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.vue.d.ts","sourceRoot":"","sources":["../src/Checkbox.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Checkbox.vue.d.ts","sourceRoot":"","sources":["../src/Checkbox.vue"],"names":[],"mappings":"AA6LA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;;;;;;;;;;;;;;AAsM7C,wBAUG"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CheckboxGroupProps } from './index';
|
|
2
2
|
declare const _default: import('vue').DefineComponent<CheckboxGroupProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
3
|
-
"update:modelValue": (value:
|
|
3
|
+
"update:modelValue": (value: Record<string, boolean>) => any;
|
|
4
4
|
}, string, import('vue').PublicProps, Readonly<CheckboxGroupProps> & Readonly<{
|
|
5
|
-
"onUpdate:modelValue"?: ((value:
|
|
5
|
+
"onUpdate:modelValue"?: ((value: Record<string, boolean>) => any) | undefined;
|
|
6
6
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
7
7
|
export default _default;
|
|
8
8
|
//# sourceMappingURL=CheckboxGroup.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxGroup.vue.d.ts","sourceRoot":"","sources":["../src/CheckboxGroup.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CheckboxGroup.vue.d.ts","sourceRoot":"","sources":["../src/CheckboxGroup.vue"],"names":[],"mappings":"AAuHA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;;;;;;AAkKlD,wBASG"}
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.checkbox-svg .checkbox-bg{fill:var(--Schemes-Surface-Bright, #fafafa);stroke:var(--Schemes-Border, #cfcfcf);stroke-width:1}.checkbox-svg .checkbox-check{stroke:none;fill:none}.checkbox-svg--checked .checkbox-bg{fill:var(--Schemes-Primary, #0f33f5);stroke:var(--Schemes-Primary, #0f33f5)}.checkbox-svg--checked .checkbox-check{stroke:var(--Schemes-On-Primary, #ffffff);stroke-width:2}.philaCheckbox[data-v-
|
|
1
|
+
.tooltip[data-v-af4a0398]{position:relative;display:inline-flex;flex-direction:column;align-items:flex-start;border-radius:var(--border-radius-xs);filter:drop-shadow(0px 1px 2px rgba(0,0,0,.3)) drop-shadow(0px 1px 3px rgba(0,0,0,.15));--tooltip-bg: var(--Schemes-On-Primary);background-color:var(--tooltip-bg);color:var(--Schemes-On-Background)}.tooltip.tooltip--grey[data-v-af4a0398]{--tooltip-bg: var(--Schemes-Surface-Container-Lowest);color:var(--Schemes-On-Surface)}.tooltip.tooltip--plain[data-v-af4a0398]{--tail-height: 10px;padding:var(--spacing-2xs) var(--spacing-xs);justify-content:center;width:max-content;max-width:min(18rem,calc(100vw - 3rem))}.tooltip.tooltip--rich[data-v-af4a0398]{--tail-height: 12px;padding:var(--spacing-s) var(--spacing-m);width:max-content;min-width:11.25rem;max-width:min(25rem,calc(100vw - 3rem));gap:var(--spacing-xs)}.tooltip .tooltip__tail[data-v-af4a0398]{position:absolute;width:20px;height:var(--tail-height);background-color:var(--tooltip-bg)}.tooltip.tooltip--top-left .tooltip__tail[data-v-af4a0398],.tooltip.tooltip--top-right .tooltip__tail[data-v-af4a0398],.tooltip.tooltip--top-center .tooltip__tail[data-v-af4a0398]{clip-path:polygon(0 0,100% 0,50% 100%);bottom:calc(-1 * var(--tail-height) + 1px)}.tooltip.tooltip--bottom-left .tooltip__tail[data-v-af4a0398],.tooltip.tooltip--bottom-right .tooltip__tail[data-v-af4a0398],.tooltip.tooltip--bottom-center .tooltip__tail[data-v-af4a0398]{clip-path:polygon(50% 0,0 100%,100% 100%);top:calc(-1 * var(--tail-height) + 1px)}.tooltip.tooltip--top-left .tooltip__tail[data-v-af4a0398],.tooltip.tooltip--bottom-left .tooltip__tail[data-v-af4a0398]{left:8px}.tooltip.tooltip--top-right .tooltip__tail[data-v-af4a0398],.tooltip.tooltip--bottom-right .tooltip__tail[data-v-af4a0398]{right:8px}.tooltip.tooltip--top-center .tooltip__tail[data-v-af4a0398],.tooltip.tooltip--bottom-center .tooltip__tail[data-v-af4a0398]{left:50%;transform:translate(-50%)}.tooltip__plain-row[data-v-af4a0398],.tooltip__title-row[data-v-af4a0398]{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--spacing-xs);width:100%}.tooltip__title-row h6[data-v-af4a0398]{flex:1}.tooltip__dismiss[data-v-af4a0398]{margin-left:auto;flex-shrink:0}.tooltip-trigger[data-v-b3f93b8c]{position:relative;display:inline-block}.tooltip-trigger__positioner[data-v-b3f93b8c]{position:absolute;z-index:1000}.tooltip-trigger__positioner.tooltip-trigger__positioner--top-left[data-v-b3f93b8c]{bottom:100%;left:-8px;padding-bottom:var(--positioner-gap);transform:translate(var(--adjust-x, 0px))}.tooltip-trigger__positioner.tooltip-trigger__positioner--top-right[data-v-b3f93b8c]{bottom:100%;right:-8px;padding-bottom:var(--positioner-gap);transform:translate(var(--adjust-x, 0px))}.tooltip-trigger__positioner.tooltip-trigger__positioner--top-center[data-v-b3f93b8c]{bottom:100%;left:50%;transform:translate(calc(-50% + var(--adjust-x, 0px)));padding-bottom:var(--positioner-gap)}.tooltip-trigger__positioner.tooltip-trigger__positioner--bottom-left[data-v-b3f93b8c]{top:100%;left:-8px;padding-top:var(--positioner-gap);transform:translate(var(--adjust-x, 0px))}.tooltip-trigger__positioner.tooltip-trigger__positioner--bottom-right[data-v-b3f93b8c]{top:100%;right:-8px;padding-top:var(--positioner-gap);transform:translate(var(--adjust-x, 0px))}.tooltip-trigger__positioner.tooltip-trigger__positioner--bottom-center[data-v-b3f93b8c]{top:100%;left:50%;transform:translate(calc(-50% + var(--adjust-x, 0px)));padding-top:var(--positioner-gap)}.checkbox-svg .checkbox-bg{fill:var(--Schemes-Surface-Bright, #fafafa);stroke:var(--Schemes-Border, #cfcfcf);stroke-width:1}.checkbox-svg .checkbox-check{stroke:none;fill:none}.checkbox-svg--checked .checkbox-bg{fill:var(--Schemes-Primary, #0f33f5);stroke:var(--Schemes-Primary, #0f33f5)}.checkbox-svg--checked .checkbox-check{stroke:var(--Schemes-On-Primary, #ffffff);stroke-width:2}.philaCheckbox-row[data-v-6d41adb5]{display:inline-flex;align-items:center;gap:var(--spacing-xs, .5rem)}.philaCheckbox[data-v-6d41adb5]{position:relative;display:inline-block;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.philaCheckbox__visual[data-v-6d41adb5]{display:flex;align-items:center;gap:var(--spacing-s, .75rem)}.philaCheckbox__info[data-v-6d41adb5]{display:inline-flex;align-items:center;padding:0;border:none;background:none;cursor:help;color:var(--Schemes-On-Surface-Variant, inherit)}.philaCheckbox--icon-only .philaCheckbox__visual[data-v-6d41adb5]{gap:0}.philaCheckbox input[data-v-6d41adb5]{position:absolute;opacity:0;cursor:pointer;height:0;width:0}[data-v-6d41adb5] .checkbox-svg{flex-shrink:0;overflow:visible}.philaCheckbox[data-v-6d41adb5]:focus-within{outline:2px solid var(--Schemes-Primary, #0f33f5);outline-offset:2px}.philaCheckbox-enabled[data-v-6d41adb5]:hover .checkbox-svg .checkbox-bg{stroke:var(--Schemes-Primary, #0f33f5);stroke-width:2}.philaCheckbox-error[data-v-6d41adb5] .checkbox-svg .checkbox-bg{stroke:var(--Schemes-Error, #cc0406);stroke-width:2}.philaCheckbox-disabled[data-v-6d41adb5]{cursor:not-allowed;color:var(--Schemes-Surface-Variant, #a2a2a2)}.philaCheckbox-disabled[data-v-6d41adb5] .checkbox-svg .checkbox-bg{stroke:var(--Schemes-Surface-Dim, #cfcfcf);stroke-width:1;fill:var(--Schemes-Surface-Bright, #fafafa)}.philaCheckbox-disabled[data-v-6d41adb5] .checkbox-svg--checked .checkbox-bg{fill:var(--Schemes-Surface-Dim, #cfcfcf);stroke:var(--Schemes-Surface-Dim, #cfcfcf)}.philaCheckbox-disabled[data-v-6d41adb5] .checkbox-svg--checked .checkbox-check{stroke:var(--Schemes-Surface-Bright, #fafafa);stroke-width:2}.group-container[data-v-dfb87f32]{display:flex;flex-direction:column;align-items:flex-start;gap:var(--spacing-xs, .5rem)}.labels-container[data-v-dfb87f32]{display:flex;flex-direction:column;align-items:flex-start;gap:var(--spacing-2xs, .25rem);align-self:stretch}span[data-v-dfb87f32]{display:block}.checkbox-container[data-v-dfb87f32]{display:flex;padding:var(--spacing-m, 1rem);flex-direction:column;align-items:flex-start;gap:var(--Radio-margin-bottom, 1rem);align-self:stretch}.checkbox-container-error[data-v-dfb87f32]{border-radius:var(--border-radius-m, .75rem)}.error-message[data-v-dfb87f32]{display:flex;align-items:center;gap:var(--spacing-s, .75rem);align-self:stretch;font-weight:600}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export interface CheckboxProps extends BaseProps {
|
|
|
7
7
|
value?: string | number | boolean;
|
|
8
8
|
modelValue?: boolean | Array<string | number | boolean>;
|
|
9
9
|
text?: string;
|
|
10
|
+
tooltip?: string;
|
|
10
11
|
disabled?: boolean;
|
|
11
12
|
error?: boolean;
|
|
12
13
|
indeterminate?: boolean;
|
|
@@ -15,7 +16,7 @@ export interface CheckboxGroupProps extends BaseProps {
|
|
|
15
16
|
groupLabel: string;
|
|
16
17
|
description?: string;
|
|
17
18
|
choices: CheckboxChoice[];
|
|
18
|
-
modelValue?:
|
|
19
|
+
modelValue?: Record<string, boolean>;
|
|
19
20
|
error?: boolean;
|
|
20
21
|
errorMessage?: string;
|
|
21
22
|
disabled?: boolean;
|
|
@@ -23,5 +24,6 @@ export interface CheckboxGroupProps extends BaseProps {
|
|
|
23
24
|
type CheckboxChoice = {
|
|
24
25
|
text: string;
|
|
25
26
|
value: string | number | boolean;
|
|
27
|
+
tooltip?: string;
|
|
26
28
|
};
|
|
27
29
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE7D,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,UAAU,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE7D,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,KAAK,cAAc,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const e=require("vue"),s=require("@phila/phila-ui-core"),f=require("@phila/phila-ui-core/icons"),h=e.defineComponent({__name:"CheckboxIcon",props:{checked:{type:Boolean}},setup(a){return(c,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["checkbox-svg",{"checkbox-svg--checked":a.checked}]),width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("rect",{class:"checkbox-bg",x:"1",y:"1",width:"18",height:"18",rx:"3",ry:"3"},null,-1),e.createElementVNode("path",{class:"checkbox-check",d:"M 4.5 10 L 8.5 14 L 15.5 6","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}}),v={class:"philaCheckbox__visual"},g={key:0},C=["name","value","checked","disabled"],y=e.defineComponent({__name:"Checkbox",props:{name:{},value:{type:[String,Number,Boolean]},modelValue:{type:[Boolean,Array]},text:{},disabled:{type:Boolean},error:{type:Boolean},indeterminate:{type:Boolean},className:{}},emits:["update:modelValue","change","focus","blur"],setup(a,{emit:c}){const o=a,n=c,l=e.ref(null);e.watchEffect(()=>{l.value&&(l.value.indeterminate=o.indeterminate??!1)});const i=e.computed(()=>Array.isArray(o.modelValue)?o.modelValue.includes(o.value):!!o.modelValue);function m(u){if(Array.isArray(o.modelValue)){const t=[...o.modelValue],r=o.value,d=t.indexOf(r);d===-1?t.push(r):t.splice(d,1),n("update:modelValue",t)}else n("update:modelValue",!o.modelValue);n("change",u)}const p=e.computed(()=>s.cn("philaCheckbox","has-text-body-default",o.className,!o.disabled&&"philaCheckbox-enabled",o.disabled&&"philaCheckbox-disabled",o.error&&"philaCheckbox-error",!o.text&&"philaCheckbox--icon-only"));return(u,t)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(p.value)},[e.createElementVNode("span",v,[e.createVNode(h,{checked:i.value},null,8,["checked"]),o.text?(e.openBlock(),e.createElementBlock("span",g,e.toDisplayString(o.text),1)):e.createCommentVNode("",!0)]),e.createElementVNode("input",{ref_key:"inputRef",ref:l,type:"checkbox",name:o.name,value:o.value,checked:i.value,disabled:o.disabled,onChange:m,onFocus:t[0]||(t[0]=r=>n("focus",r)),onBlur:t[1]||(t[1]=r=>n("blur",r))},null,40,C)],2))}}),k=(a,c)=>{const o=a.__vccOpts||a;for(const[n,l]of c)o[n]=l;return o},b=k(y,[["__scopeId","data-v-354b2e5e"]]),_={class:"labels-container"},V={class:"has-text-body-default"},B={key:0,class:"error-message has-text-error content"},N=e.defineComponent({__name:"CheckboxGroup",props:{groupLabel:{},description:{},choices:{},modelValue:{},error:{type:Boolean},errorMessage:{},disabled:{type:Boolean},className:{}},emits:["update:modelValue"],setup(a,{emit:c}){const o=a,n=c,l=s.generateRandomId(),i=e.computed(()=>s.cn("group-container",o.className)),m=e.computed(()=>s.cn("checkbox-container",o.error&&"checkbox-container-error has-background-error")),p=e.computed(()=>s.cn("has-text-label-default",o.error&&"has-text-error"));function u(t){n("update:modelValue",t)}return(t,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(i.value)},[e.createElementVNode("div",_,[e.createElementVNode("span",{class:e.normalizeClass(p.value)},e.toDisplayString(a.groupLabel),3),e.createElementVNode("span",V,e.toDisplayString(a.description),1)]),e.createElementVNode("div",{class:e.normalizeClass(m.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.choices,(d,x)=>(e.openBlock(),e.createBlock(b,{key:e.unref(l)+x,name:e.unref(l),value:d.value,text:d.text,"model-value":o.modelValue,disabled:o.disabled,error:o.error,"onUpdate:modelValue":u},null,8,["name","value","text","model-value","disabled","error"]))),128)),o.error?(e.openBlock(),e.createElementBlock("div",B,[e.createVNode(e.unref(s.Icon),{style:{height:"fit-content",width:"fit-content",padding:"0"},size:"large",inline:"","aria-hidden":"true",icon:e.unref(f.IconCircleExclamation)},null,8,["icon"]),e.createTextVNode(" "+e.toDisplayString(a.errorMessage),1)])):e.createCommentVNode("",!0)],2)],2))}}),E=k(N,[["__scopeId","data-v-38f469d0"]]);exports.Checkbox=b;exports.CheckboxGroup=E;exports.CheckboxIcon=h;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const e=require("vue"),u=require("@phila/phila-ui-core"),y=require("@phila/phila-ui-core/icons"),D=["disabled"],B=e.defineComponent({inheritAttrs:!1,__name:"PhlButton",props:{href:{},to:{},target:{},rel:{},disabled:{type:Boolean,default:!1},clickTarget:{},variant:{default:"primary"},size:{default:"medium"},iconOnly:{type:Boolean,default:!1},iconRight:{type:Boolean},text:{},className:{},icon:{},src:{},svgRaw:{}},setup(l){const o=l,t=i=>"href"in i&&i.href!==void 0||"to"in i&&i.to!==void 0,n=e.computed(()=>u.cn("phila-button",`phila-button--${o.variant}`,o.size&&`is-${o.size}`,o.iconOnly&&"icon-button",o.iconOnly&&o.variant==="standard"&&"icon-button--standard",o.className)),a=e.computed(()=>t(o)?"to"in o&&o.to!==void 0?{to:o.to,disabled:o.disabled,className:n.value}:{href:o.href,target:o.target,rel:o.rel,disabled:o.disabled,className:n.value}:{}),s=e.computed(()=>({icon:o.icon,src:o.src,iconRight:o.iconRight,iconOnly:o.iconOnly,text:o.text,size:o.size}));return(i,f)=>t(o)?(e.openBlock(),e.createBlock(e.unref(u.BaseLink),e.mergeProps({key:0},{...a.value,...i.$attrs},{role:"button"}),{default:e.withCtx(()=>[e.createVNode(e.unref(u.ActionContent),e.normalizeProps(e.guardReactiveProps(s.value)),{default:e.withCtx(()=>[e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(o.text),1)])]),_:3},16)]),_:3},16)):(e.openBlock(),e.createElementBlock("button",e.mergeProps({key:1,type:"button",disabled:o.disabled,class:n.value},i.$attrs),[e.createVNode(e.unref(u.ActionContent),e.normalizeProps(e.guardReactiveProps(s.value)),{default:e.withCtx(()=>[e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(o.text),1)])]),_:3},16)],16,D))}}),O=["id"],P={key:0,class:"tooltip__tail","aria-hidden":"true"},L={key:1,class:"tooltip__plain-row has-text-body-small"},T={key:0,class:"tooltip__title-row"},M={key:0},A=e.defineComponent({__name:"TooltipBubble",props:{id:{},type:{default:"plain"},color:{default:"default"},tail:{type:Boolean,default:!1},placement:{default:"top-center"},title:{},dismissable:{type:Boolean,default:!1},className:{}},emits:["dismiss"],setup(l){const o=l,t=e.computed(()=>u.cn("tooltip","content","resets-link-colors",`tooltip--${o.type}`,`tooltip--${o.color}`,o.tail&&`tooltip--${o.placement}`,o.className));return(n,a)=>(e.openBlock(),e.createElementBlock("div",{id:l.id,class:e.normalizeClass(t.value),role:"tooltip"},[l.tail?(e.openBlock(),e.createElementBlock("div",P)):e.createCommentVNode("",!0),l.type==="plain"?(e.openBlock(),e.createElementBlock("div",L,[e.renderSlot(n.$slots,"default",{},void 0,!0),l.dismissable?(e.openBlock(),e.createBlock(e.unref(B),{key:0,class:"tooltip__dismiss",variant:"standard",size:"extra-small","icon-only":!0,icon:e.unref(y.IconClose),"aria-label":"Dismiss tooltip",onClick:a[0]||(a[0]=s=>n.$emit("dismiss"))},null,8,["icon"])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[l.title||l.dismissable?(e.openBlock(),e.createElementBlock("div",T,[l.title?(e.openBlock(),e.createElementBlock("h6",M,e.toDisplayString(l.title),1)):e.createCommentVNode("",!0),l.dismissable?(e.openBlock(),e.createBlock(e.unref(B),{key:1,class:"tooltip__dismiss",variant:"standard",size:"extra-small","icon-only":!0,icon:e.unref(y.IconClose),"aria-label":"Dismiss tooltip",onClick:a[1]||(a[1]=s=>n.$emit("dismiss"))},null,8,["icon"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"default",{},void 0,!0)],64))],10,O))}}),V=(l,o)=>{const t=l.__vccOpts||l;for(const[n,a]of o)t[n]=a;return t},F=V(A,[["__scopeId","data-v-af4a0398"]]),U=e.defineComponent({__name:"Tooltip",props:{trigger:{default:"hover"},type:{default:"plain"},color:{default:"default"},tail:{type:Boolean,default:!1},placement:{default:"auto"},title:{},dismissable:{type:Boolean},className:{}},setup(l,{expose:o}){const t=l,n=e.useId(),a=e.ref(!1),s=e.ref(null),i=e.ref(null),f=e.ref("top-center"),h=e.ref(0),c=()=>{const r=s.value?.getBoundingClientRect();if(!r)return"top-center";const{innerWidth:v,innerHeight:_}=window,g=r.top,z=_-r.bottom,x=i.value?.firstElementChild?.getBoundingClientRect().height??0,I=(x>0?g>=x:g>=z)?"top":"bottom",C=r.left+r.width/2,R=C<v/3?"left":C>v*2/3?"right":"center";return`${I}-${R}`},p=r=>{r.key==="Escape"&&k()},d=r=>{s.value&&!s.value.contains(r.target)&&k()};function b(){const r=i.value?.firstElementChild?.getBoundingClientRect();if(!r)return;const v=8,_=r.right-(window.innerWidth-v),g=v-r.left;_<=0&&g<=0||(h.value=window.innerWidth/2-(r.left+r.width/2))}const m=async()=>{t.placement==="auto"?f.value=c():f.value=t.placement,h.value=0,a.value=!0,document.addEventListener("keydown",p),t.trigger==="click"&&document.addEventListener("click",d),await e.nextTick(),b()},k=()=>{a.value=!1,document.removeEventListener("keydown",p),document.removeEventListener("click",d)},$=()=>{a.value?k():m()};e.onUnmounted(k),o({show:m,hide:k});const S=e.computed(()=>({type:t.type,color:t.color,tail:t.tail,placement:f.value,title:t.title,dismissable:t.dismissable}));return(r,v)=>(e.openBlock(),e.createElementBlock("span",e.mergeProps({ref_key:"wrapperEl",ref:s,class:e.unref(u.cn)("tooltip-trigger",t.className)},l.trigger==="click"?{onClick:$}:{onMouseenter:m,onMouseleave:k,onFocusin:m,onFocusout:k}),[e.renderSlot(r.$slots,"default",{tooltipId:e.unref(n),isOpen:a.value},void 0,!0),e.createElementVNode("span",{ref_key:"positionerEl",ref:i,class:e.normalizeClass(["tooltip-trigger__positioner",`tooltip-trigger__positioner--${f.value}`]),style:e.normalizeStyle({visibility:a.value?"visible":"hidden","--positioner-gap":l.tail?"var(--spacing-l)":"0.5rem","--adjust-x":`${h.value}px`}),onClick:v[0]||(v[0]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(F,e.mergeProps(S.value,{id:e.unref(n),onDismiss:k}),{default:e.withCtx(()=>[e.renderSlot(r.$slots,"body",{},void 0,!0)]),_:3},16,["id"])],6)],16))}}),j=V(U,[["__scopeId","data-v-b3f93b8c"]]),N=e.defineComponent({__name:"CheckboxIcon",props:{checked:{type:Boolean}},setup(l){return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["checkbox-svg",{"checkbox-svg--checked":l.checked}]),width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("rect",{class:"checkbox-bg",x:"1",y:"1",width:"18",height:"18",rx:"3",ry:"3"},null,-1),e.createElementVNode("path",{class:"checkbox-check",d:"M 4.5 10 L 8.5 14 L 15.5 6","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}}),q={class:"philaCheckbox-row"},W={class:"philaCheckbox__visual"},G={key:0},H=["name","value","checked","disabled"],X={type:"button",class:"philaCheckbox__info","aria-label":"More information"},J=e.defineComponent({__name:"Checkbox",props:{name:{},value:{type:[String,Number,Boolean]},modelValue:{type:[Boolean,Array]},text:{},tooltip:{},disabled:{type:Boolean},error:{type:Boolean},indeterminate:{type:Boolean},className:{}},emits:["update:modelValue","change","focus","blur"],setup(l,{emit:o}){const t=l,n=o,a=e.ref(null);e.watchEffect(()=>{a.value&&(a.value.indeterminate=t.indeterminate??!1)});const s=e.computed(()=>Array.isArray(t.modelValue)?t.modelValue.includes(t.value):!!t.modelValue);function i(h){if(Array.isArray(t.modelValue)){const c=[...t.modelValue],p=t.value,d=c.indexOf(p);d===-1?c.push(p):c.splice(d,1),n("update:modelValue",c)}else n("update:modelValue",!t.modelValue);n("change",h)}const f=e.computed(()=>u.cn("philaCheckbox","has-text-body-default",t.className,!t.disabled&&"philaCheckbox-enabled",t.disabled&&"philaCheckbox-disabled",t.error&&"philaCheckbox-error",!t.text&&"philaCheckbox--icon-only"));return(h,c)=>(e.openBlock(),e.createElementBlock("span",q,[e.createElementVNode("label",{class:e.normalizeClass(f.value)},[e.createElementVNode("span",W,[e.createVNode(N,{checked:s.value},null,8,["checked"]),t.text?(e.openBlock(),e.createElementBlock("span",G,e.toDisplayString(t.text),1)):e.createCommentVNode("",!0)]),e.createElementVNode("input",{ref_key:"inputRef",ref:a,type:"checkbox",name:t.name,value:t.value,checked:s.value,disabled:t.disabled,onChange:i,onFocus:c[0]||(c[0]=p=>n("focus",p)),onBlur:c[1]||(c[1]=p=>n("blur",p))},null,40,H)],2),t.tooltip?(e.openBlock(),e.createBlock(e.unref(j),{key:0,trigger:"hover",class:"philaCheckbox__tooltip"},{body:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.tooltip),1)]),default:e.withCtx(()=>[e.createElementVNode("button",X,[e.createVNode(e.unref(u.Icon),{icon:e.unref(y.IconCircleInfo),size:"small",inline:"",decorative:""},null,8,["icon"])])]),_:1})):e.createCommentVNode("",!0)]))}}),E=(l,o)=>{const t=l.__vccOpts||l;for(const[n,a]of o)t[n]=a;return t},w=E(J,[["__scopeId","data-v-6d41adb5"]]),K={class:"labels-container"},Q={class:"has-text-body-default"},Y={key:0,class:"error-message has-text-error content"},Z=e.defineComponent({__name:"CheckboxGroup",props:{groupLabel:{},description:{},choices:{},modelValue:{},error:{type:Boolean},errorMessage:{},disabled:{type:Boolean},className:{}},emits:["update:modelValue"],setup(l,{emit:o}){const t=l,n=o,a=u.generateRandomId(),s=e.computed(()=>u.cn("group-container",t.className)),i=e.computed(()=>u.cn("checkbox-container",t.error&&"checkbox-container-error has-background-error")),f=e.computed(()=>u.cn("has-text-label-default",t.error&&"has-text-error"));function h(c,p){const d={};for(const b of t.choices){const m=String(b.value);d[m]=m===String(c)?p:!!t.modelValue?.[m]}n("update:modelValue",d)}return(c,p)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(s.value)},[e.createElementVNode("div",K,[e.createElementVNode("span",{class:e.normalizeClass(f.value)},e.toDisplayString(l.groupLabel),3),e.createElementVNode("span",Q,e.toDisplayString(l.description),1)]),e.createElementVNode("div",{class:e.normalizeClass(i.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.choices,(d,b)=>(e.openBlock(),e.createBlock(w,{key:e.unref(a)+b,name:e.unref(a),value:d.value,text:d.text,tooltip:d.tooltip,"model-value":t.modelValue?.[String(d.value)]??!1,disabled:t.disabled,error:t.error,"onUpdate:modelValue":m=>h(d.value,m)},null,8,["name","value","text","tooltip","model-value","disabled","error","onUpdate:modelValue"]))),128)),t.error?(e.openBlock(),e.createElementBlock("div",Y,[e.createVNode(e.unref(u.Icon),{style:{height:"fit-content",width:"fit-content",padding:"0"},size:"large",inline:"","aria-hidden":"true",icon:e.unref(y.IconCircleExclamation)},null,8,["icon"]),e.createTextVNode(" "+e.toDisplayString(l.errorMessage),1)])):e.createCommentVNode("",!0)],2)],2))}}),ee=E(Z,[["__scopeId","data-v-dfb87f32"]]);exports.Checkbox=w;exports.CheckboxGroup=ee;exports.CheckboxIcon=N;
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,247 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { cn as
|
|
3
|
-
import { IconCircleExclamation as
|
|
4
|
-
import './index.css';const
|
|
1
|
+
import { defineComponent as I, useId as Y, ref as B, onUnmounted as Z, computed as v, createElementBlock as p, openBlock as i, mergeProps as L, unref as r, renderSlot as V, createElementVNode as h, withModifiers as ee, normalizeStyle as te, normalizeClass as C, createVNode as N, withCtx as $, nextTick as oe, createCommentVNode as g, createBlock as E, Fragment as W, toDisplayString as x, normalizeProps as T, guardReactiveProps as D, createTextVNode as O, watchEffect as le, renderList as ae } from "vue";
|
|
2
|
+
import { cn as w, BaseLink as ie, ActionContent as P, Icon as j, generateRandomId as se } from "@phila/phila-ui-core";
|
|
3
|
+
import { IconClose as F, IconCircleInfo as ne, IconCircleExclamation as re } from "@phila/phila-ui-core/icons";
|
|
4
|
+
import './index.css';const ce = ["disabled"], U = /* @__PURE__ */ I({
|
|
5
|
+
inheritAttrs: !1,
|
|
6
|
+
__name: "PhlButton",
|
|
7
|
+
props: {
|
|
8
|
+
href: {},
|
|
9
|
+
to: {},
|
|
10
|
+
target: {},
|
|
11
|
+
rel: {},
|
|
12
|
+
disabled: { type: Boolean, default: !1 },
|
|
13
|
+
clickTarget: {},
|
|
14
|
+
variant: { default: "primary" },
|
|
15
|
+
size: { default: "medium" },
|
|
16
|
+
iconOnly: { type: Boolean, default: !1 },
|
|
17
|
+
iconRight: { type: Boolean },
|
|
18
|
+
text: {},
|
|
19
|
+
className: {},
|
|
20
|
+
icon: {},
|
|
21
|
+
src: {},
|
|
22
|
+
svgRaw: {}
|
|
23
|
+
},
|
|
24
|
+
setup(o) {
|
|
25
|
+
const t = o, e = (n) => "href" in n && n.href !== void 0 || "to" in n && n.to !== void 0, l = v(() => w(
|
|
26
|
+
"phila-button",
|
|
27
|
+
`phila-button--${t.variant}`,
|
|
28
|
+
t.size && `is-${t.size}`,
|
|
29
|
+
t.iconOnly && "icon-button",
|
|
30
|
+
t.iconOnly && t.variant === "standard" && "icon-button--standard",
|
|
31
|
+
t.className
|
|
32
|
+
)), a = v(() => e(t) ? "to" in t && t.to !== void 0 ? {
|
|
33
|
+
to: t.to,
|
|
34
|
+
disabled: t.disabled,
|
|
35
|
+
className: l.value
|
|
36
|
+
} : {
|
|
37
|
+
href: t.href,
|
|
38
|
+
target: t.target,
|
|
39
|
+
rel: t.rel,
|
|
40
|
+
disabled: t.disabled,
|
|
41
|
+
className: l.value
|
|
42
|
+
} : {}), c = v(
|
|
43
|
+
() => ({
|
|
44
|
+
icon: t.icon,
|
|
45
|
+
src: t.src,
|
|
46
|
+
iconRight: t.iconRight,
|
|
47
|
+
iconOnly: t.iconOnly,
|
|
48
|
+
text: t.text,
|
|
49
|
+
size: t.size
|
|
50
|
+
})
|
|
51
|
+
);
|
|
52
|
+
return (n, b) => e(t) ? (i(), E(r(ie), L({ key: 0 }, { ...a.value, ...n.$attrs }, { role: "button" }), {
|
|
53
|
+
default: $(() => [
|
|
54
|
+
N(r(P), T(D(c.value)), {
|
|
55
|
+
default: $(() => [
|
|
56
|
+
V(n.$slots, "default", {}, () => [
|
|
57
|
+
O(x(t.text), 1)
|
|
58
|
+
])
|
|
59
|
+
]),
|
|
60
|
+
_: 3
|
|
61
|
+
}, 16)
|
|
62
|
+
]),
|
|
63
|
+
_: 3
|
|
64
|
+
}, 16)) : (i(), p("button", L({
|
|
65
|
+
key: 1,
|
|
66
|
+
type: "button",
|
|
67
|
+
disabled: t.disabled,
|
|
68
|
+
class: l.value
|
|
69
|
+
}, n.$attrs), [
|
|
70
|
+
N(r(P), T(D(c.value)), {
|
|
71
|
+
default: $(() => [
|
|
72
|
+
V(n.$slots, "default", {}, () => [
|
|
73
|
+
O(x(t.text), 1)
|
|
74
|
+
])
|
|
75
|
+
]),
|
|
76
|
+
_: 3
|
|
77
|
+
}, 16)
|
|
78
|
+
], 16, ce));
|
|
79
|
+
}
|
|
80
|
+
}), de = ["id"], ue = {
|
|
81
|
+
key: 0,
|
|
82
|
+
class: "tooltip__tail",
|
|
83
|
+
"aria-hidden": "true"
|
|
84
|
+
}, pe = {
|
|
85
|
+
key: 1,
|
|
86
|
+
class: "tooltip__plain-row has-text-body-small"
|
|
87
|
+
}, me = {
|
|
88
|
+
key: 0,
|
|
89
|
+
class: "tooltip__title-row"
|
|
90
|
+
}, he = { key: 0 }, fe = /* @__PURE__ */ I({
|
|
91
|
+
__name: "TooltipBubble",
|
|
92
|
+
props: {
|
|
93
|
+
id: {},
|
|
94
|
+
type: { default: "plain" },
|
|
95
|
+
color: { default: "default" },
|
|
96
|
+
tail: { type: Boolean, default: !1 },
|
|
97
|
+
placement: { default: "top-center" },
|
|
98
|
+
title: {},
|
|
99
|
+
dismissable: { type: Boolean, default: !1 },
|
|
100
|
+
className: {}
|
|
101
|
+
},
|
|
102
|
+
emits: ["dismiss"],
|
|
103
|
+
setup(o) {
|
|
104
|
+
const t = o, e = v(
|
|
105
|
+
() => w(
|
|
106
|
+
"tooltip",
|
|
107
|
+
"content",
|
|
108
|
+
"resets-link-colors",
|
|
109
|
+
`tooltip--${t.type}`,
|
|
110
|
+
`tooltip--${t.color}`,
|
|
111
|
+
t.tail && `tooltip--${t.placement}`,
|
|
112
|
+
t.className
|
|
113
|
+
)
|
|
114
|
+
);
|
|
115
|
+
return (l, a) => (i(), p("div", {
|
|
116
|
+
id: o.id,
|
|
117
|
+
class: C(e.value),
|
|
118
|
+
role: "tooltip"
|
|
119
|
+
}, [
|
|
120
|
+
o.tail ? (i(), p("div", ue)) : g("", !0),
|
|
121
|
+
o.type === "plain" ? (i(), p("div", pe, [
|
|
122
|
+
V(l.$slots, "default", {}, void 0, !0),
|
|
123
|
+
o.dismissable ? (i(), E(r(U), {
|
|
124
|
+
key: 0,
|
|
125
|
+
class: "tooltip__dismiss",
|
|
126
|
+
variant: "standard",
|
|
127
|
+
size: "extra-small",
|
|
128
|
+
"icon-only": !0,
|
|
129
|
+
icon: r(F),
|
|
130
|
+
"aria-label": "Dismiss tooltip",
|
|
131
|
+
onClick: a[0] || (a[0] = (c) => l.$emit("dismiss"))
|
|
132
|
+
}, null, 8, ["icon"])) : g("", !0)
|
|
133
|
+
])) : (i(), p(W, { key: 2 }, [
|
|
134
|
+
o.title || o.dismissable ? (i(), p("div", me, [
|
|
135
|
+
o.title ? (i(), p("h6", he, x(o.title), 1)) : g("", !0),
|
|
136
|
+
o.dismissable ? (i(), E(r(U), {
|
|
137
|
+
key: 1,
|
|
138
|
+
class: "tooltip__dismiss",
|
|
139
|
+
variant: "standard",
|
|
140
|
+
size: "extra-small",
|
|
141
|
+
"icon-only": !0,
|
|
142
|
+
icon: r(F),
|
|
143
|
+
"aria-label": "Dismiss tooltip",
|
|
144
|
+
onClick: a[1] || (a[1] = (c) => l.$emit("dismiss"))
|
|
145
|
+
}, null, 8, ["icon"])) : g("", !0)
|
|
146
|
+
])) : g("", !0),
|
|
147
|
+
V(l.$slots, "default", {}, void 0, !0)
|
|
148
|
+
], 64))
|
|
149
|
+
], 10, de));
|
|
150
|
+
}
|
|
151
|
+
}), G = (o, t) => {
|
|
152
|
+
const e = o.__vccOpts || o;
|
|
153
|
+
for (const [l, a] of t)
|
|
154
|
+
e[l] = a;
|
|
155
|
+
return e;
|
|
156
|
+
}, ve = /* @__PURE__ */ G(fe, [["__scopeId", "data-v-af4a0398"]]), be = /* @__PURE__ */ I({
|
|
157
|
+
__name: "Tooltip",
|
|
158
|
+
props: {
|
|
159
|
+
trigger: { default: "hover" },
|
|
160
|
+
type: { default: "plain" },
|
|
161
|
+
color: { default: "default" },
|
|
162
|
+
tail: { type: Boolean, default: !1 },
|
|
163
|
+
placement: { default: "auto" },
|
|
164
|
+
title: {},
|
|
165
|
+
dismissable: { type: Boolean },
|
|
166
|
+
className: {}
|
|
167
|
+
},
|
|
168
|
+
setup(o, { expose: t }) {
|
|
169
|
+
const e = o, l = Y(), a = B(!1), c = B(null), n = B(null), b = B("top-center"), y = B(0), d = () => {
|
|
170
|
+
const s = c.value?.getBoundingClientRect();
|
|
171
|
+
if (!s) return "top-center";
|
|
172
|
+
const { innerWidth: k, innerHeight: M } = window, R = s.top, J = M - s.bottom, S = n.value?.firstElementChild?.getBoundingClientRect().height ?? 0, K = (S > 0 ? R >= S : R >= J) ? "top" : "bottom", A = s.left + s.width / 2, Q = A < k / 3 ? "left" : A > k * 2 / 3 ? "right" : "center";
|
|
173
|
+
return `${K}-${Q}`;
|
|
174
|
+
}, m = (s) => {
|
|
175
|
+
s.key === "Escape" && _();
|
|
176
|
+
}, u = (s) => {
|
|
177
|
+
c.value && !c.value.contains(s.target) && _();
|
|
178
|
+
};
|
|
179
|
+
function z() {
|
|
180
|
+
const s = n.value?.firstElementChild?.getBoundingClientRect();
|
|
181
|
+
if (!s) return;
|
|
182
|
+
const k = 8, M = s.right - (window.innerWidth - k), R = k - s.left;
|
|
183
|
+
M <= 0 && R <= 0 || (y.value = window.innerWidth / 2 - (s.left + s.width / 2));
|
|
184
|
+
}
|
|
185
|
+
const f = async () => {
|
|
186
|
+
e.placement === "auto" ? b.value = d() : b.value = e.placement, y.value = 0, a.value = !0, document.addEventListener("keydown", m), e.trigger === "click" && document.addEventListener("click", u), await oe(), z();
|
|
187
|
+
}, _ = () => {
|
|
188
|
+
a.value = !1, document.removeEventListener("keydown", m), document.removeEventListener("click", u);
|
|
189
|
+
}, q = () => {
|
|
190
|
+
a.value ? _() : f();
|
|
191
|
+
};
|
|
192
|
+
Z(_), t({ show: f, hide: _ });
|
|
193
|
+
const X = v(() => ({
|
|
194
|
+
type: e.type,
|
|
195
|
+
color: e.color,
|
|
196
|
+
tail: e.tail,
|
|
197
|
+
placement: b.value,
|
|
198
|
+
title: e.title,
|
|
199
|
+
dismissable: e.dismissable
|
|
200
|
+
}));
|
|
201
|
+
return (s, k) => (i(), p("span", L(
|
|
202
|
+
{
|
|
203
|
+
ref_key: "wrapperEl",
|
|
204
|
+
ref: c,
|
|
205
|
+
class: r(w)("tooltip-trigger", e.className)
|
|
206
|
+
},
|
|
207
|
+
o.trigger === "click" ? { onClick: q } : { onMouseenter: f, onMouseleave: _, onFocusin: f, onFocusout: _ }
|
|
208
|
+
), [
|
|
209
|
+
V(s.$slots, "default", {
|
|
210
|
+
tooltipId: r(l),
|
|
211
|
+
isOpen: a.value
|
|
212
|
+
}, void 0, !0),
|
|
213
|
+
h("span", {
|
|
214
|
+
ref_key: "positionerEl",
|
|
215
|
+
ref: n,
|
|
216
|
+
class: C(["tooltip-trigger__positioner", `tooltip-trigger__positioner--${b.value}`]),
|
|
217
|
+
style: te({
|
|
218
|
+
visibility: a.value ? "visible" : "hidden",
|
|
219
|
+
"--positioner-gap": o.tail ? "var(--spacing-l)" : "0.5rem",
|
|
220
|
+
"--adjust-x": `${y.value}px`
|
|
221
|
+
}),
|
|
222
|
+
onClick: k[0] || (k[0] = ee(() => {
|
|
223
|
+
}, ["stop"]))
|
|
224
|
+
}, [
|
|
225
|
+
N(ve, L(X.value, {
|
|
226
|
+
id: r(l),
|
|
227
|
+
onDismiss: _
|
|
228
|
+
}), {
|
|
229
|
+
default: $(() => [
|
|
230
|
+
V(s.$slots, "body", {}, void 0, !0)
|
|
231
|
+
]),
|
|
232
|
+
_: 3
|
|
233
|
+
}, 16, ["id"])
|
|
234
|
+
], 6)
|
|
235
|
+
], 16));
|
|
236
|
+
}
|
|
237
|
+
}), ye = /* @__PURE__ */ G(be, [["__scopeId", "data-v-b3f93b8c"]]), _e = /* @__PURE__ */ I({
|
|
5
238
|
__name: "CheckboxIcon",
|
|
6
239
|
props: {
|
|
7
240
|
checked: { type: Boolean }
|
|
8
241
|
},
|
|
9
242
|
setup(o) {
|
|
10
|
-
return (
|
|
11
|
-
class:
|
|
243
|
+
return (t, e) => (i(), p("svg", {
|
|
244
|
+
class: C(["checkbox-svg", { "checkbox-svg--checked": o.checked }]),
|
|
12
245
|
width: "20",
|
|
13
246
|
height: "20",
|
|
14
247
|
viewBox: "0 0 20 20",
|
|
@@ -16,7 +249,7 @@ import './index.css';const R = /* @__PURE__ */ _({
|
|
|
16
249
|
xmlns: "http://www.w3.org/2000/svg",
|
|
17
250
|
"aria-hidden": "true"
|
|
18
251
|
}, [...e[0] || (e[0] = [
|
|
19
|
-
|
|
252
|
+
h("rect", {
|
|
20
253
|
class: "checkbox-bg",
|
|
21
254
|
x: "1",
|
|
22
255
|
y: "1",
|
|
@@ -25,7 +258,7 @@ import './index.css';const R = /* @__PURE__ */ _({
|
|
|
25
258
|
rx: "3",
|
|
26
259
|
ry: "3"
|
|
27
260
|
}, null, -1),
|
|
28
|
-
|
|
261
|
+
h("path", {
|
|
29
262
|
class: "checkbox-check",
|
|
30
263
|
d: "M 4.5 10 L 8.5 14 L 15.5 6",
|
|
31
264
|
"stroke-linecap": "round",
|
|
@@ -33,34 +266,39 @@ import './index.css';const R = /* @__PURE__ */ _({
|
|
|
33
266
|
}, null, -1)
|
|
34
267
|
])], 2));
|
|
35
268
|
}
|
|
36
|
-
}),
|
|
269
|
+
}), ke = { class: "philaCheckbox-row" }, ge = { class: "philaCheckbox__visual" }, xe = { key: 0 }, Ce = ["name", "value", "checked", "disabled"], we = {
|
|
270
|
+
type: "button",
|
|
271
|
+
class: "philaCheckbox__info",
|
|
272
|
+
"aria-label": "More information"
|
|
273
|
+
}, Be = /* @__PURE__ */ I({
|
|
37
274
|
__name: "Checkbox",
|
|
38
275
|
props: {
|
|
39
276
|
name: {},
|
|
40
277
|
value: { type: [String, Number, Boolean] },
|
|
41
278
|
modelValue: { type: [Boolean, Array] },
|
|
42
279
|
text: {},
|
|
280
|
+
tooltip: {},
|
|
43
281
|
disabled: { type: Boolean },
|
|
44
282
|
error: { type: Boolean },
|
|
45
283
|
indeterminate: { type: Boolean },
|
|
46
284
|
className: {}
|
|
47
285
|
},
|
|
48
286
|
emits: ["update:modelValue", "change", "focus", "blur"],
|
|
49
|
-
setup(o, { emit:
|
|
50
|
-
const e = o,
|
|
51
|
-
|
|
52
|
-
|
|
287
|
+
setup(o, { emit: t }) {
|
|
288
|
+
const e = o, l = t, a = B(null);
|
|
289
|
+
le(() => {
|
|
290
|
+
a.value && (a.value.indeterminate = e.indeterminate ?? !1);
|
|
53
291
|
});
|
|
54
|
-
const
|
|
55
|
-
function
|
|
292
|
+
const c = v(() => Array.isArray(e.modelValue) ? e.modelValue.includes(e.value) : !!e.modelValue);
|
|
293
|
+
function n(y) {
|
|
56
294
|
if (Array.isArray(e.modelValue)) {
|
|
57
|
-
const
|
|
58
|
-
|
|
295
|
+
const d = [...e.modelValue], m = e.value, u = d.indexOf(m);
|
|
296
|
+
u === -1 ? d.push(m) : d.splice(u, 1), l("update:modelValue", d);
|
|
59
297
|
} else
|
|
60
|
-
|
|
61
|
-
|
|
298
|
+
l("update:modelValue", !e.modelValue);
|
|
299
|
+
l("change", y);
|
|
62
300
|
}
|
|
63
|
-
const
|
|
301
|
+
const b = v(() => w(
|
|
64
302
|
"philaCheckbox",
|
|
65
303
|
"has-text-body-default",
|
|
66
304
|
e.className,
|
|
@@ -69,36 +307,58 @@ import './index.css';const R = /* @__PURE__ */ _({
|
|
|
69
307
|
e.error && "philaCheckbox-error",
|
|
70
308
|
!e.text && "philaCheckbox--icon-only"
|
|
71
309
|
));
|
|
72
|
-
return (
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
310
|
+
return (y, d) => (i(), p("span", ke, [
|
|
311
|
+
h("label", {
|
|
312
|
+
class: C(b.value)
|
|
313
|
+
}, [
|
|
314
|
+
h("span", ge, [
|
|
315
|
+
N(_e, { checked: c.value }, null, 8, ["checked"]),
|
|
316
|
+
e.text ? (i(), p("span", xe, x(e.text), 1)) : g("", !0)
|
|
317
|
+
]),
|
|
318
|
+
h("input", {
|
|
319
|
+
ref_key: "inputRef",
|
|
320
|
+
ref: a,
|
|
321
|
+
type: "checkbox",
|
|
322
|
+
name: e.name,
|
|
323
|
+
value: e.value,
|
|
324
|
+
checked: c.value,
|
|
325
|
+
disabled: e.disabled,
|
|
326
|
+
onChange: n,
|
|
327
|
+
onFocus: d[0] || (d[0] = (m) => l("focus", m)),
|
|
328
|
+
onBlur: d[1] || (d[1] = (m) => l("blur", m))
|
|
329
|
+
}, null, 40, Ce)
|
|
330
|
+
], 2),
|
|
331
|
+
e.tooltip ? (i(), E(r(ye), {
|
|
332
|
+
key: 0,
|
|
333
|
+
trigger: "hover",
|
|
334
|
+
class: "philaCheckbox__tooltip"
|
|
335
|
+
}, {
|
|
336
|
+
body: $(() => [
|
|
337
|
+
O(x(e.tooltip), 1)
|
|
338
|
+
]),
|
|
339
|
+
default: $(() => [
|
|
340
|
+
h("button", we, [
|
|
341
|
+
N(r(j), {
|
|
342
|
+
icon: r(ne),
|
|
343
|
+
size: "small",
|
|
344
|
+
inline: "",
|
|
345
|
+
decorative: ""
|
|
346
|
+
}, null, 8, ["icon"])
|
|
347
|
+
])
|
|
348
|
+
]),
|
|
349
|
+
_: 1
|
|
350
|
+
})) : g("", !0)
|
|
351
|
+
]));
|
|
92
352
|
}
|
|
93
|
-
}),
|
|
353
|
+
}), H = (o, t) => {
|
|
94
354
|
const e = o.__vccOpts || o;
|
|
95
|
-
for (const [
|
|
96
|
-
e[
|
|
355
|
+
for (const [l, a] of t)
|
|
356
|
+
e[l] = a;
|
|
97
357
|
return e;
|
|
98
|
-
},
|
|
358
|
+
}, $e = /* @__PURE__ */ H(Be, [["__scopeId", "data-v-6d41adb5"]]), Ve = { class: "labels-container" }, Ne = { class: "has-text-body-default" }, Ie = {
|
|
99
359
|
key: 0,
|
|
100
360
|
class: "error-message has-text-error content"
|
|
101
|
-
},
|
|
361
|
+
}, ze = /* @__PURE__ */ I({
|
|
102
362
|
__name: "CheckboxGroup",
|
|
103
363
|
props: {
|
|
104
364
|
groupLabel: {},
|
|
@@ -111,49 +371,55 @@ import './index.css';const R = /* @__PURE__ */ _({
|
|
|
111
371
|
className: {}
|
|
112
372
|
},
|
|
113
373
|
emits: ["update:modelValue"],
|
|
114
|
-
setup(o, { emit:
|
|
115
|
-
const e = o,
|
|
116
|
-
function
|
|
117
|
-
|
|
374
|
+
setup(o, { emit: t }) {
|
|
375
|
+
const e = o, l = t, a = se(), c = v(() => w("group-container", e.className)), n = v(() => w("checkbox-container", e.error && "checkbox-container-error has-background-error")), b = v(() => w("has-text-label-default", e.error && "has-text-error"));
|
|
376
|
+
function y(d, m) {
|
|
377
|
+
const u = {};
|
|
378
|
+
for (const z of e.choices) {
|
|
379
|
+
const f = String(z.value);
|
|
380
|
+
u[f] = f === String(d) ? m : !!e.modelValue?.[f];
|
|
381
|
+
}
|
|
382
|
+
l("update:modelValue", u);
|
|
118
383
|
}
|
|
119
|
-
return (
|
|
120
|
-
class:
|
|
384
|
+
return (d, m) => (i(), p("div", {
|
|
385
|
+
class: C(c.value)
|
|
121
386
|
}, [
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
class:
|
|
387
|
+
h("div", Ve, [
|
|
388
|
+
h("span", {
|
|
389
|
+
class: C(b.value)
|
|
125
390
|
}, x(o.groupLabel), 3),
|
|
126
|
-
|
|
391
|
+
h("span", Ne, x(o.description), 1)
|
|
127
392
|
]),
|
|
128
|
-
|
|
129
|
-
class:
|
|
393
|
+
h("div", {
|
|
394
|
+
class: C(n.value)
|
|
130
395
|
}, [
|
|
131
|
-
(
|
|
132
|
-
key:
|
|
133
|
-
name:
|
|
134
|
-
value:
|
|
135
|
-
text:
|
|
136
|
-
|
|
396
|
+
(i(!0), p(W, null, ae(e.choices, (u, z) => (i(), E($e, {
|
|
397
|
+
key: r(a) + z,
|
|
398
|
+
name: r(a),
|
|
399
|
+
value: u.value,
|
|
400
|
+
text: u.text,
|
|
401
|
+
tooltip: u.tooltip,
|
|
402
|
+
"model-value": e.modelValue?.[String(u.value)] ?? !1,
|
|
137
403
|
disabled: e.disabled,
|
|
138
404
|
error: e.error,
|
|
139
|
-
"onUpdate:modelValue":
|
|
140
|
-
}, null, 8, ["name", "value", "text", "model-value", "disabled", "error"]))), 128)),
|
|
141
|
-
e.error ? (
|
|
142
|
-
|
|
405
|
+
"onUpdate:modelValue": (f) => y(u.value, f)
|
|
406
|
+
}, null, 8, ["name", "value", "text", "tooltip", "model-value", "disabled", "error", "onUpdate:modelValue"]))), 128)),
|
|
407
|
+
e.error ? (i(), p("div", Ie, [
|
|
408
|
+
N(r(j), {
|
|
143
409
|
style: { height: "fit-content", width: "fit-content", padding: "0" },
|
|
144
410
|
size: "large",
|
|
145
411
|
inline: "",
|
|
146
412
|
"aria-hidden": "true",
|
|
147
|
-
icon:
|
|
413
|
+
icon: r(re)
|
|
148
414
|
}, null, 8, ["icon"]),
|
|
149
|
-
|
|
150
|
-
])) :
|
|
415
|
+
O(" " + x(o.errorMessage), 1)
|
|
416
|
+
])) : g("", !0)
|
|
151
417
|
], 2)
|
|
152
418
|
], 2));
|
|
153
419
|
}
|
|
154
|
-
}),
|
|
420
|
+
}), Oe = /* @__PURE__ */ H(ze, [["__scopeId", "data-v-dfb87f32"]]);
|
|
155
421
|
export {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
422
|
+
$e as Checkbox,
|
|
423
|
+
Oe as CheckboxGroup,
|
|
424
|
+
_e as CheckboxIcon
|
|
159
425
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phila/phila-ui-checkbox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-beta.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A checkbox input.",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"vue": "^3.0.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@phila/phila-ui-core": "3.0.0-beta.
|
|
31
|
+
"@phila/phila-ui-core": "3.0.0-beta.9",
|
|
32
|
+
"@phila/phila-ui-tooltip": "0.1.0-beta.10"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
35
|
"@types/node": "^24.0.0",
|