@phila/phila-ui-checkbox 0.1.1 → 1.0.0-beta.11

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.
@@ -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
- }, HTMLLabelElement>;
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":"AAiKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;;;;;;;;;;;;;;AAsJ7C,wBAUG"}
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: (string | number | boolean)[]) => any;
3
+ "update:modelValue": (value: Record<string, boolean>) => any;
4
4
  }, string, import('vue').PublicProps, Readonly<CheckboxGroupProps> & Readonly<{
5
- "onUpdate:modelValue"?: ((value: (string | number | boolean)[]) => any) | undefined;
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":"AA+GA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;;;;;;AAyJlD,wBASG"}
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-354b2e5e]{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-354b2e5e]{display:flex;align-items:center;gap:var(--spacing-s, .75rem)}.philaCheckbox--icon-only .philaCheckbox__visual[data-v-354b2e5e]{gap:0}.philaCheckbox input[data-v-354b2e5e]{position:absolute;opacity:0;cursor:pointer;height:0;width:0}[data-v-354b2e5e] .checkbox-svg{flex-shrink:0;overflow:visible}.philaCheckbox[data-v-354b2e5e]:focus-within{outline:2px solid var(--Schemes-Primary, #0f33f5);outline-offset:2px}.philaCheckbox-enabled[data-v-354b2e5e]:hover .checkbox-svg .checkbox-bg{stroke:var(--Schemes-Primary, #0f33f5);stroke-width:2}.philaCheckbox-error[data-v-354b2e5e] .checkbox-svg .checkbox-bg{stroke:var(--Schemes-Error, #cc0406);stroke-width:2}.philaCheckbox-disabled[data-v-354b2e5e]{cursor:not-allowed;color:var(--Schemes-Surface-Variant, #a2a2a2)}.philaCheckbox-disabled[data-v-354b2e5e] .checkbox-svg .checkbox-bg{stroke:var(--Schemes-Surface-Dim, #cfcfcf);stroke-width:1;fill:var(--Schemes-Surface-Bright, #fafafa)}.philaCheckbox-disabled[data-v-354b2e5e] .checkbox-svg--checked .checkbox-bg{fill:var(--Schemes-Surface-Dim, #cfcfcf);stroke:var(--Schemes-Surface-Dim, #cfcfcf)}.philaCheckbox-disabled[data-v-354b2e5e] .checkbox-svg--checked .checkbox-check{stroke:var(--Schemes-Surface-Bright, #fafafa);stroke-width:2}.group-container[data-v-1408bdad]{display:flex;flex-direction:column;align-items:flex-start;gap:var(--spacing-xs, .5rem)}.labels-container[data-v-1408bdad]{display:flex;flex-direction:column;align-items:flex-start;gap:var(--spacing-2xs, .25rem);align-self:stretch}span[data-v-1408bdad]{display:block}.checkbox-container[data-v-1408bdad]{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-1408bdad]{border-radius:var(--border-radius-m, .75rem)}.error-message[data-v-1408bdad]{display:flex;align-items:center;gap:var(--spacing-s, .75rem);align-self:stretch;font-weight:600}
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-591a1092]{position:relative;display:inline-block}.tooltip-positioner[data-v-591a1092]{position:fixed;z-index:10010;width:max-content}.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?: Array<string | number | boolean>;
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
@@ -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,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IAC9C,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;CAClC,CAAC"}
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"),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))}}),f={class:"philaCheckbox__visual"},v={key:0},g=["name","value","checked","disabled"],C=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 d=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,i=t.indexOf(r);i===-1?t.push(r):t.splice(i,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",f,[e.createVNode(h,{checked:d.value},null,8,["checked"]),o.text?(e.openBlock(),e.createElementBlock("span",v,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:d.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,g)],2))}}),k=(a,c)=>{const o=a.__vccOpts||a;for(const[n,l]of c)o[n]=l;return o},b=k(C,[["__scopeId","data-v-354b2e5e"]]);var y={prefix:"fas",iconName:"circle-exclamation",icon:[512,512,["exclamation-circle"],"f06a","M256 512a256 256 0 1 1 0-512 256 256 0 1 1 0 512zm0-192a32 32 0 1 0 0 64 32 32 0 1 0 0-64zm0-192c-18.2 0-32.7 15.5-31.4 33.7l7.4 104c.9 12.6 11.4 22.3 23.9 22.3 12.6 0 23-9.7 23.9-22.3l7.4-104c1.3-18.2-13.1-33.7-31.4-33.7z"]};const _={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(),d=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(d.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,(i,x)=>(e.openBlock(),e.createBlock(b,{key:e.unref(l)+x,name:e.unref(l),value:i.value,text:i.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-definition":e.unref(y)},null,8,["icon-definition"]),e.createTextVNode(" "+e.toDisplayString(a.errorMessage),1)])):e.createCommentVNode("",!0)],2)],2))}}),E=k(N,[["__scopeId","data-v-1408bdad"]]);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"),p=require("@phila/phila-ui-core"),E=require("@phila/phila-ui-core/icons"),F=["disabled"],z=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=s=>"href"in s&&s.href!==void 0||"to"in s&&s.to!==void 0,a=e.computed(()=>p.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)),n=e.computed(()=>t(o)?"to"in o&&o.to!==void 0?{to:o.to,disabled:o.disabled,className:a.value}:{href:o.href,target:o.target,rel:o.rel,disabled:o.disabled,className:a.value}:{}),c=e.computed(()=>({icon:o.icon,src:o.src,iconRight:o.iconRight,iconOnly:o.iconOnly,text:o.text,size:o.size}));return(s,h)=>t(o)?(e.openBlock(),e.createBlock(e.unref(p.BaseLink),e.mergeProps({key:0},{...n.value,...s.$attrs},{role:"button"}),{default:e.withCtx(()=>[e.createVNode(e.unref(p.ActionContent),e.normalizeProps(e.guardReactiveProps(c.value)),{default:e.withCtx(()=>[e.renderSlot(s.$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:a.value},s.$attrs),[e.createVNode(e.unref(p.ActionContent),e.normalizeProps(e.guardReactiveProps(c.value)),{default:e.withCtx(()=>[e.renderSlot(s.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(o.text),1)])]),_:3},16)],16,F))}}),U=["id"],q={key:0,class:"tooltip__tail","aria-hidden":"true"},G={key:1,class:"tooltip__plain-row has-text-body-small"},H={key:0,class:"tooltip__title-row"},j={key:0},W=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(()=>p.cn("tooltip","content","resets-link-colors",`tooltip--${o.type}`,`tooltip--${o.color}`,o.tail&&`tooltip--${o.placement}`,o.className));return(a,n)=>(e.openBlock(),e.createElementBlock("div",{id:l.id,class:e.normalizeClass(t.value),role:"tooltip"},[l.tail?(e.openBlock(),e.createElementBlock("div",q)):e.createCommentVNode("",!0),l.type==="plain"?(e.openBlock(),e.createElementBlock("div",G,[e.renderSlot(a.$slots,"default",{},void 0,!0),l.dismissable?(e.openBlock(),e.createBlock(e.unref(z),{key:0,class:"tooltip__dismiss",variant:"standard",size:"extra-small","icon-only":!0,icon:e.unref(E.IconClose),"aria-label":"Dismiss tooltip",onClick:n[0]||(n[0]=c=>a.$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",H,[l.title?(e.openBlock(),e.createElementBlock("h6",j,e.toDisplayString(l.title),1)):e.createCommentVNode("",!0),l.dismissable?(e.openBlock(),e.createBlock(e.unref(z),{key:1,class:"tooltip__dismiss",variant:"standard",size:"extra-small","icon-only":!0,icon:e.unref(E.IconClose),"aria-label":"Dismiss tooltip",onClick:n[1]||(n[1]=c=>a.$emit("dismiss"))},null,8,["icon"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(a.$slots,"default",{},void 0,!0)],64))],10,U))}}),I=(l,o)=>{const t=l.__vccOpts||l;for(const[a,n]of o)t[a]=n;return t},K=I(W,[["__scopeId","data-v-af4a0398"]]),N=8,w=8,X=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,a=e.useId(),n=e.ref(!1),c=e.ref(null),s=e.ref(null),h=e.ref("top-center"),k=e.ref({top:0,left:0});let r=null;const m=()=>{const i=c.value?.getBoundingClientRect();if(!i)return"top-center";const{innerWidth:u,innerHeight:x}=window,y=i.top,$=x-i.bottom,_=s.value?.getBoundingClientRect().height??0,B=(_>0?y>=_:y>=$)?"top":"bottom",v=i.left+i.width/2,A=v<u/3?"left":v>u*2/3?"right":"center";return`${B}-${A}`};function d(){const i=c.value?.getBoundingClientRect(),u=s.value?.getBoundingClientRect();if(!i||!u)return;const{innerWidth:x,innerHeight:y}=window,[$,_]=h.value.split("-");let B=$==="top"?i.top-N-u.height:i.bottom+N,v;_==="center"?v=i.left+i.width/2-u.width/2:_==="left"?v=i.left-N:v=i.right+N-u.width,v=Math.min(Math.max(v,w),x-w-u.width),B=Math.min(Math.max(B,w),y-w-u.height),k.value={top:B,left:v}}const g=i=>{i.key==="Escape"&&f()},b=i=>{const u=i.target,x=c.value?.contains(u),y=s.value?.contains(u);!x&&!y&&f()},C=()=>{n.value&&d()},V=async()=>{r&&(clearTimeout(r),r=null),h.value=t.placement==="auto"?m():t.placement,n.value=!0,document.addEventListener("keydown",g),t.trigger==="click"&&document.addEventListener("click",b),window.addEventListener("scroll",C,!0),window.addEventListener("resize",C),await e.nextTick(),t.placement==="auto"&&(h.value=m()),d()},f=()=>{n.value=!1,r&&(clearTimeout(r),r=null),document.removeEventListener("keydown",g),document.removeEventListener("click",b),window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C)},S=()=>{if(t.trigger!=="hover")return f();r=setTimeout(f,100)},R=()=>{r&&(clearTimeout(r),r=null)},D=()=>{n.value?f():V()};e.onUnmounted(f),o({show:V,hide:f});const P=e.computed(()=>({type:t.type,color:t.color,tail:t.tail,placement:h.value,title:t.title,dismissable:t.dismissable})),O=e.computed(()=>({top:`${k.value.top}px`,left:`${k.value.left}px`,visibility:n.value?"visible":"hidden"}));return(i,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("span",e.mergeProps({ref_key:"wrapperEl",ref:c,class:e.unref(p.cn)("tooltip-trigger",t.className)},l.trigger==="click"?{onClick:D}:{onMouseenter:V,onMouseleave:S,onFocusin:V,onFocusout:f}),[e.renderSlot(i.$slots,"default",{tooltipId:e.unref(a),isOpen:n.value},void 0,!0)],16),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createElementVNode("div",{ref_key:"bubbleEl",ref:s,class:"tooltip-positioner",style:e.normalizeStyle(O.value),onMouseenter:R,onMouseleave:S},[e.createVNode(K,e.mergeProps(P.value,{id:e.unref(a),onDismiss:f}),{default:e.withCtx(()=>[e.renderSlot(i.$slots,"body",{},void 0,!0)]),_:3},16,["id"])],36)]))],64))}}),Y=I(X,[["__scopeId","data-v-591a1092"]]),T=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))}}),Z={class:"philaCheckbox-row"},J={class:"philaCheckbox__visual"},Q={key:0},ee=["name","value","checked","disabled"],te={type:"button",class:"philaCheckbox__info","aria-label":"More information"},oe=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,a=o,n=e.ref(null);e.watchEffect(()=>{n.value&&(n.value.indeterminate=t.indeterminate??!1)});const c=e.computed(()=>Array.isArray(t.modelValue)?t.modelValue.includes(t.value):!!t.modelValue);function s(k){if(Array.isArray(t.modelValue)){const r=[...t.modelValue],m=t.value,d=r.indexOf(m);d===-1?r.push(m):r.splice(d,1),a("update:modelValue",r)}else a("update:modelValue",!t.modelValue);a("change",k)}const h=e.computed(()=>p.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(k,r)=>(e.openBlock(),e.createElementBlock("span",Z,[e.createElementVNode("label",{class:e.normalizeClass(h.value)},[e.createElementVNode("span",J,[e.createVNode(T,{checked:c.value},null,8,["checked"]),t.text?(e.openBlock(),e.createElementBlock("span",Q,e.toDisplayString(t.text),1)):e.createCommentVNode("",!0)]),e.createElementVNode("input",{ref_key:"inputRef",ref:n,type:"checkbox",name:t.name,value:t.value,checked:c.value,disabled:t.disabled,onChange:s,onFocus:r[0]||(r[0]=m=>a("focus",m)),onBlur:r[1]||(r[1]=m=>a("blur",m))},null,40,ee)],2),t.tooltip?(e.openBlock(),e.createBlock(e.unref(Y),{key:0,trigger:"hover",class:"philaCheckbox__tooltip"},{body:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.tooltip),1)]),default:e.withCtx(()=>[e.createElementVNode("button",te,[e.createVNode(e.unref(p.Icon),{icon:e.unref(E.IconCircleInfo),size:"small",inline:"",decorative:""},null,8,["icon"])])]),_:1})):e.createCommentVNode("",!0)]))}}),L=(l,o)=>{const t=l.__vccOpts||l;for(const[a,n]of o)t[a]=n;return t},M=L(oe,[["__scopeId","data-v-6d41adb5"]]),le={class:"labels-container"},ne={class:"has-text-body-default"},ae={key:0,class:"error-message has-text-error content"},re=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,a=o,n=p.generateRandomId(),c=e.computed(()=>p.cn("group-container",t.className)),s=e.computed(()=>p.cn("checkbox-container",t.error&&"checkbox-container-error has-background-error")),h=e.computed(()=>p.cn("has-text-label-default",t.error&&"has-text-error"));function k(r,m){const d={};for(const g of t.choices){const b=String(g.value);d[b]=b===String(r)?m:!!t.modelValue?.[b]}a("update:modelValue",d)}return(r,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(c.value)},[e.createElementVNode("div",le,[e.createElementVNode("span",{class:e.normalizeClass(h.value)},e.toDisplayString(l.groupLabel),3),e.createElementVNode("span",ne,e.toDisplayString(l.description),1)]),e.createElementVNode("div",{class:e.normalizeClass(s.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.choices,(d,g)=>(e.openBlock(),e.createBlock(M,{key:e.unref(n)+g,name:e.unref(n),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":b=>k(d.value,b)},null,8,["name","value","text","tooltip","model-value","disabled","error","onUpdate:modelValue"]))),128)),t.error?(e.openBlock(),e.createElementBlock("div",ae,[e.createVNode(e.unref(p.Icon),{style:{height:"fit-content",width:"fit-content",padding:"0"},size:"large",inline:"","aria-hidden":"true",icon:e.unref(E.IconCircleExclamation)},null,8,["icon"]),e.createTextVNode(" "+e.toDisplayString(l.errorMessage),1)])):e.createCommentVNode("",!0)],2)],2))}}),ie=L(re,[["__scopeId","data-v-dfb87f32"]]);exports.Checkbox=M;exports.CheckboxGroup=ie;exports.CheckboxIcon=T;
package/dist/index.mjs CHANGED
@@ -1,13 +1,262 @@
1
- import { defineComponent as _, createElementBlock as i, openBlock as c, normalizeClass as u, createElementVNode as l, ref as B, watchEffect as N, computed as h, createVNode as g, createCommentVNode as y, toDisplayString as b, Fragment as w, renderList as I, createBlock as z, unref as x, createTextVNode as A } from "vue";
2
- import { cn as k, generateRandomId as L, Icon as $ } from "@phila/phila-ui-core";
3
- import './index.css';const E = /* @__PURE__ */ _({
1
+ import { defineComponent as M, useId as ne, ref as V, onUnmounted as se, computed as f, createElementBlock as p, openBlock as i, Fragment as G, createElementVNode as v, createBlock as I, mergeProps as F, unref as c, renderSlot as z, Teleport as ie, normalizeStyle as re, createVNode as L, withCtx as N, nextTick as ce, normalizeClass as E, createCommentVNode as x, toDisplayString as C, normalizeProps as j, guardReactiveProps as K, createTextVNode as H, watchEffect as de, renderList as ue } from "vue";
2
+ import { cn as w, BaseLink as pe, ActionContent as X, Icon as q, generateRandomId as me } from "@phila/phila-ui-core";
3
+ import { IconClose as Y, IconCircleInfo as he, IconCircleExclamation as ve } from "@phila/phila-ui-core/icons";
4
+ import './index.css';const fe = ["disabled"], Z = /* @__PURE__ */ M({
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 = (r) => "href" in r && r.href !== void 0 || "to" in r && r.to !== void 0, a = f(() => 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
+ )), l = f(() => e(t) ? "to" in t && t.to !== void 0 ? {
33
+ to: t.to,
34
+ disabled: t.disabled,
35
+ className: a.value
36
+ } : {
37
+ href: t.href,
38
+ target: t.target,
39
+ rel: t.rel,
40
+ disabled: t.disabled,
41
+ className: a.value
42
+ } : {}), d = f(
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 (r, b) => e(t) ? (i(), I(c(pe), F({ key: 0 }, { ...l.value, ...r.$attrs }, { role: "button" }), {
53
+ default: N(() => [
54
+ L(c(X), j(K(d.value)), {
55
+ default: N(() => [
56
+ z(r.$slots, "default", {}, () => [
57
+ H(C(t.text), 1)
58
+ ])
59
+ ]),
60
+ _: 3
61
+ }, 16)
62
+ ]),
63
+ _: 3
64
+ }, 16)) : (i(), p("button", F({
65
+ key: 1,
66
+ type: "button",
67
+ disabled: t.disabled,
68
+ class: a.value
69
+ }, r.$attrs), [
70
+ L(c(X), j(K(d.value)), {
71
+ default: N(() => [
72
+ z(r.$slots, "default", {}, () => [
73
+ H(C(t.text), 1)
74
+ ])
75
+ ]),
76
+ _: 3
77
+ }, 16)
78
+ ], 16, fe));
79
+ }
80
+ }), be = ["id"], ye = {
81
+ key: 0,
82
+ class: "tooltip__tail",
83
+ "aria-hidden": "true"
84
+ }, ge = {
85
+ key: 1,
86
+ class: "tooltip__plain-row has-text-body-small"
87
+ }, ke = {
88
+ key: 0,
89
+ class: "tooltip__title-row"
90
+ }, _e = { key: 0 }, xe = /* @__PURE__ */ M({
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 = f(
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 (a, l) => (i(), p("div", {
116
+ id: o.id,
117
+ class: E(e.value),
118
+ role: "tooltip"
119
+ }, [
120
+ o.tail ? (i(), p("div", ye)) : x("", !0),
121
+ o.type === "plain" ? (i(), p("div", ge, [
122
+ z(a.$slots, "default", {}, void 0, !0),
123
+ o.dismissable ? (i(), I(c(Z), {
124
+ key: 0,
125
+ class: "tooltip__dismiss",
126
+ variant: "standard",
127
+ size: "extra-small",
128
+ "icon-only": !0,
129
+ icon: c(Y),
130
+ "aria-label": "Dismiss tooltip",
131
+ onClick: l[0] || (l[0] = (d) => a.$emit("dismiss"))
132
+ }, null, 8, ["icon"])) : x("", !0)
133
+ ])) : (i(), p(G, { key: 2 }, [
134
+ o.title || o.dismissable ? (i(), p("div", ke, [
135
+ o.title ? (i(), p("h6", _e, C(o.title), 1)) : x("", !0),
136
+ o.dismissable ? (i(), I(c(Z), {
137
+ key: 1,
138
+ class: "tooltip__dismiss",
139
+ variant: "standard",
140
+ size: "extra-small",
141
+ "icon-only": !0,
142
+ icon: c(Y),
143
+ "aria-label": "Dismiss tooltip",
144
+ onClick: l[1] || (l[1] = (d) => a.$emit("dismiss"))
145
+ }, null, 8, ["icon"])) : x("", !0)
146
+ ])) : x("", !0),
147
+ z(a.$slots, "default", {}, void 0, !0)
148
+ ], 64))
149
+ ], 10, be));
150
+ }
151
+ }), J = (o, t) => {
152
+ const e = o.__vccOpts || o;
153
+ for (const [a, l] of t)
154
+ e[a] = l;
155
+ return e;
156
+ }, Ce = /* @__PURE__ */ J(xe, [["__scopeId", "data-v-af4a0398"]]), P = 8, D = 8, we = /* @__PURE__ */ M({
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, a = ne(), l = V(!1), d = V(null), r = V(null), b = V("top-center"), k = V({ top: 0, left: 0 });
170
+ let n = null;
171
+ const h = () => {
172
+ const s = d.value?.getBoundingClientRect();
173
+ if (!s) return "top-center";
174
+ const { innerWidth: m, innerHeight: R } = window, $ = s.top, U = R - s.bottom, T = r.value?.getBoundingClientRect().height ?? 0, O = (T > 0 ? $ >= T : $ >= U) ? "top" : "bottom", g = s.left + s.width / 2, ae = g < m / 3 ? "left" : g > m * 2 / 3 ? "right" : "center";
175
+ return `${O}-${ae}`;
176
+ };
177
+ function u() {
178
+ const s = d.value?.getBoundingClientRect(), m = r.value?.getBoundingClientRect();
179
+ if (!s || !m) return;
180
+ const { innerWidth: R, innerHeight: $ } = window, [U, T] = b.value.split("-");
181
+ let O = U === "top" ? s.top - P - m.height : s.bottom + P, g;
182
+ T === "center" ? g = s.left + s.width / 2 - m.width / 2 : T === "left" ? g = s.left - P : g = s.right + P - m.width, g = Math.min(Math.max(g, D), R - D - m.width), O = Math.min(Math.max(O, D), $ - D - m.height), k.value = { top: O, left: g };
183
+ }
184
+ const B = (s) => {
185
+ s.key === "Escape" && y();
186
+ }, _ = (s) => {
187
+ const m = s.target, R = d.value?.contains(m), $ = r.value?.contains(m);
188
+ !R && !$ && y();
189
+ }, S = () => {
190
+ l.value && u();
191
+ }, A = async () => {
192
+ n && (clearTimeout(n), n = null), b.value = e.placement === "auto" ? h() : e.placement, l.value = !0, document.addEventListener("keydown", B), e.trigger === "click" && document.addEventListener("click", _), window.addEventListener("scroll", S, !0), window.addEventListener("resize", S), await ce(), e.placement === "auto" && (b.value = h()), u();
193
+ }, y = () => {
194
+ l.value = !1, n && (clearTimeout(n), n = null), document.removeEventListener("keydown", B), document.removeEventListener("click", _), window.removeEventListener("scroll", S, !0), window.removeEventListener("resize", S);
195
+ }, W = () => {
196
+ if (e.trigger !== "hover") return y();
197
+ n = setTimeout(y, 100);
198
+ }, ee = () => {
199
+ n && (clearTimeout(n), n = null);
200
+ }, te = () => {
201
+ l.value ? y() : A();
202
+ };
203
+ se(y), t({ show: A, hide: y });
204
+ const oe = f(() => ({
205
+ type: e.type,
206
+ color: e.color,
207
+ tail: e.tail,
208
+ placement: b.value,
209
+ title: e.title,
210
+ dismissable: e.dismissable
211
+ })), le = f(() => ({
212
+ top: `${k.value.top}px`,
213
+ left: `${k.value.left}px`,
214
+ visibility: l.value ? "visible" : "hidden"
215
+ }));
216
+ return (s, m) => (i(), p(G, null, [
217
+ v("span", F(
218
+ {
219
+ ref_key: "wrapperEl",
220
+ ref: d,
221
+ class: c(w)("tooltip-trigger", e.className)
222
+ },
223
+ o.trigger === "click" ? { onClick: te } : { onMouseenter: A, onMouseleave: W, onFocusin: A, onFocusout: y }
224
+ ), [
225
+ z(s.$slots, "default", {
226
+ tooltipId: c(a),
227
+ isOpen: l.value
228
+ }, void 0, !0)
229
+ ], 16),
230
+ (i(), I(ie, { to: "body" }, [
231
+ v("div", {
232
+ ref_key: "bubbleEl",
233
+ ref: r,
234
+ class: "tooltip-positioner",
235
+ style: re(le.value),
236
+ onMouseenter: ee,
237
+ onMouseleave: W
238
+ }, [
239
+ L(Ce, F(oe.value, {
240
+ id: c(a),
241
+ onDismiss: y
242
+ }), {
243
+ default: N(() => [
244
+ z(s.$slots, "body", {}, void 0, !0)
245
+ ]),
246
+ _: 3
247
+ }, 16, ["id"])
248
+ ], 36)
249
+ ]))
250
+ ], 64));
251
+ }
252
+ }), Be = /* @__PURE__ */ J(we, [["__scopeId", "data-v-591a1092"]]), $e = /* @__PURE__ */ M({
4
253
  __name: "CheckboxIcon",
5
254
  props: {
6
255
  checked: { type: Boolean }
7
256
  },
8
- setup(t) {
9
- return (s, e) => (c(), i("svg", {
10
- class: u(["checkbox-svg", { "checkbox-svg--checked": t.checked }]),
257
+ setup(o) {
258
+ return (t, e) => (i(), p("svg", {
259
+ class: E(["checkbox-svg", { "checkbox-svg--checked": o.checked }]),
11
260
  width: "20",
12
261
  height: "20",
13
262
  viewBox: "0 0 20 20",
@@ -15,7 +264,7 @@ import './index.css';const E = /* @__PURE__ */ _({
15
264
  xmlns: "http://www.w3.org/2000/svg",
16
265
  "aria-hidden": "true"
17
266
  }, [...e[0] || (e[0] = [
18
- l("rect", {
267
+ v("rect", {
19
268
  class: "checkbox-bg",
20
269
  x: "1",
21
270
  y: "1",
@@ -24,7 +273,7 @@ import './index.css';const E = /* @__PURE__ */ _({
24
273
  rx: "3",
25
274
  ry: "3"
26
275
  }, null, -1),
27
- l("path", {
276
+ v("path", {
28
277
  class: "checkbox-check",
29
278
  d: "M 4.5 10 L 8.5 14 L 15.5 6",
30
279
  "stroke-linecap": "round",
@@ -32,34 +281,39 @@ import './index.css';const E = /* @__PURE__ */ _({
32
281
  }, null, -1)
33
282
  ])], 2));
34
283
  }
35
- }), M = { class: "philaCheckbox__visual" }, R = { key: 0 }, F = ["name", "value", "checked", "disabled"], G = /* @__PURE__ */ _({
284
+ }), Ve = { class: "philaCheckbox-row" }, Ne = { class: "philaCheckbox__visual" }, Ee = { key: 0 }, Ie = ["name", "value", "checked", "disabled"], ze = {
285
+ type: "button",
286
+ class: "philaCheckbox__info",
287
+ "aria-label": "More information"
288
+ }, Le = /* @__PURE__ */ M({
36
289
  __name: "Checkbox",
37
290
  props: {
38
291
  name: {},
39
292
  value: { type: [String, Number, Boolean] },
40
293
  modelValue: { type: [Boolean, Array] },
41
294
  text: {},
295
+ tooltip: {},
42
296
  disabled: { type: Boolean },
43
297
  error: { type: Boolean },
44
298
  indeterminate: { type: Boolean },
45
299
  className: {}
46
300
  },
47
301
  emits: ["update:modelValue", "change", "focus", "blur"],
48
- setup(t, { emit: s }) {
49
- const e = t, o = s, n = B(null);
50
- N(() => {
51
- n.value && (n.value.indeterminate = e.indeterminate ?? !1);
302
+ setup(o, { emit: t }) {
303
+ const e = o, a = t, l = V(null);
304
+ de(() => {
305
+ l.value && (l.value.indeterminate = e.indeterminate ?? !1);
52
306
  });
53
- const m = h(() => Array.isArray(e.modelValue) ? e.modelValue.includes(e.value) : !!e.modelValue);
54
- function f(p) {
307
+ const d = f(() => Array.isArray(e.modelValue) ? e.modelValue.includes(e.value) : !!e.modelValue);
308
+ function r(k) {
55
309
  if (Array.isArray(e.modelValue)) {
56
- const a = [...e.modelValue], r = e.value, d = a.indexOf(r);
57
- d === -1 ? a.push(r) : a.splice(d, 1), o("update:modelValue", a);
310
+ const n = [...e.modelValue], h = e.value, u = n.indexOf(h);
311
+ u === -1 ? n.push(h) : n.splice(u, 1), a("update:modelValue", n);
58
312
  } else
59
- o("update:modelValue", !e.modelValue);
60
- o("change", p);
313
+ a("update:modelValue", !e.modelValue);
314
+ a("change", k);
61
315
  }
62
- const v = h(() => k(
316
+ const b = f(() => w(
63
317
  "philaCheckbox",
64
318
  "has-text-body-default",
65
319
  e.className,
@@ -68,42 +322,58 @@ import './index.css';const E = /* @__PURE__ */ _({
68
322
  e.error && "philaCheckbox-error",
69
323
  !e.text && "philaCheckbox--icon-only"
70
324
  ));
71
- return (p, a) => (c(), i("label", {
72
- class: u(v.value)
73
- }, [
74
- l("span", M, [
75
- g(E, { checked: m.value }, null, 8, ["checked"]),
76
- e.text ? (c(), i("span", R, b(e.text), 1)) : y("", !0)
77
- ]),
78
- l("input", {
79
- ref_key: "inputRef",
80
- ref: n,
81
- type: "checkbox",
82
- name: e.name,
83
- value: e.value,
84
- checked: m.value,
85
- disabled: e.disabled,
86
- onChange: f,
87
- onFocus: a[0] || (a[0] = (r) => o("focus", r)),
88
- onBlur: a[1] || (a[1] = (r) => o("blur", r))
89
- }, null, 40, F)
90
- ], 2));
325
+ return (k, n) => (i(), p("span", Ve, [
326
+ v("label", {
327
+ class: E(b.value)
328
+ }, [
329
+ v("span", Ne, [
330
+ L($e, { checked: d.value }, null, 8, ["checked"]),
331
+ e.text ? (i(), p("span", Ee, C(e.text), 1)) : x("", !0)
332
+ ]),
333
+ v("input", {
334
+ ref_key: "inputRef",
335
+ ref: l,
336
+ type: "checkbox",
337
+ name: e.name,
338
+ value: e.value,
339
+ checked: d.value,
340
+ disabled: e.disabled,
341
+ onChange: r,
342
+ onFocus: n[0] || (n[0] = (h) => a("focus", h)),
343
+ onBlur: n[1] || (n[1] = (h) => a("blur", h))
344
+ }, null, 40, Ie)
345
+ ], 2),
346
+ e.tooltip ? (i(), I(c(Be), {
347
+ key: 0,
348
+ trigger: "hover",
349
+ class: "philaCheckbox__tooltip"
350
+ }, {
351
+ body: N(() => [
352
+ H(C(e.tooltip), 1)
353
+ ]),
354
+ default: N(() => [
355
+ v("button", ze, [
356
+ L(c(q), {
357
+ icon: c(he),
358
+ size: "small",
359
+ inline: "",
360
+ decorative: ""
361
+ }, null, 8, ["icon"])
362
+ ])
363
+ ]),
364
+ _: 1
365
+ })) : x("", !0)
366
+ ]));
91
367
  }
92
- }), C = (t, s) => {
93
- const e = t.__vccOpts || t;
94
- for (const [o, n] of s)
95
- e[o] = n;
368
+ }), Q = (o, t) => {
369
+ const e = o.__vccOpts || o;
370
+ for (const [a, l] of t)
371
+ e[a] = l;
96
372
  return e;
97
- }, O = /* @__PURE__ */ C(G, [["__scopeId", "data-v-354b2e5e"]]);
98
- var S = {
99
- prefix: "fas",
100
- iconName: "circle-exclamation",
101
- icon: [512, 512, ["exclamation-circle"], "f06a", "M256 512a256 256 0 1 1 0-512 256 256 0 1 1 0 512zm0-192a32 32 0 1 0 0 64 32 32 0 1 0 0-64zm0-192c-18.2 0-32.7 15.5-31.4 33.7l7.4 104c.9 12.6 11.4 22.3 23.9 22.3 12.6 0 23-9.7 23.9-22.3l7.4-104c1.3-18.2-13.1-33.7-31.4-33.7z"]
102
- };
103
- const U = { class: "labels-container" }, j = { class: "has-text-body-default" }, D = {
373
+ }, Me = /* @__PURE__ */ Q(Le, [["__scopeId", "data-v-6d41adb5"]]), Re = { class: "labels-container" }, Te = { class: "has-text-body-default" }, Oe = {
104
374
  key: 0,
105
375
  class: "error-message has-text-error content"
106
- }, T = /* @__PURE__ */ _({
376
+ }, Se = /* @__PURE__ */ M({
107
377
  __name: "CheckboxGroup",
108
378
  props: {
109
379
  groupLabel: {},
@@ -116,49 +386,55 @@ const U = { class: "labels-container" }, j = { class: "has-text-body-default" },
116
386
  className: {}
117
387
  },
118
388
  emits: ["update:modelValue"],
119
- setup(t, { emit: s }) {
120
- const e = t, o = s, n = L(), m = h(() => k("group-container", e.className)), f = h(() => k("checkbox-container", e.error && "checkbox-container-error has-background-error")), v = h(() => k("has-text-label-default", e.error && "has-text-error"));
121
- function p(a) {
122
- o("update:modelValue", a);
389
+ setup(o, { emit: t }) {
390
+ const e = o, a = t, l = me(), d = f(() => w("group-container", e.className)), r = f(() => w("checkbox-container", e.error && "checkbox-container-error has-background-error")), b = f(() => w("has-text-label-default", e.error && "has-text-error"));
391
+ function k(n, h) {
392
+ const u = {};
393
+ for (const B of e.choices) {
394
+ const _ = String(B.value);
395
+ u[_] = _ === String(n) ? h : !!e.modelValue?.[_];
396
+ }
397
+ a("update:modelValue", u);
123
398
  }
124
- return (a, r) => (c(), i("div", {
125
- class: u(m.value)
399
+ return (n, h) => (i(), p("div", {
400
+ class: E(d.value)
126
401
  }, [
127
- l("div", U, [
128
- l("span", {
129
- class: u(v.value)
130
- }, b(t.groupLabel), 3),
131
- l("span", j, b(t.description), 1)
402
+ v("div", Re, [
403
+ v("span", {
404
+ class: E(b.value)
405
+ }, C(o.groupLabel), 3),
406
+ v("span", Te, C(o.description), 1)
132
407
  ]),
133
- l("div", {
134
- class: u(f.value)
408
+ v("div", {
409
+ class: E(r.value)
135
410
  }, [
136
- (c(!0), i(w, null, I(e.choices, (d, V) => (c(), z(O, {
137
- key: x(n) + V,
138
- name: x(n),
139
- value: d.value,
140
- text: d.text,
141
- "model-value": e.modelValue,
411
+ (i(!0), p(G, null, ue(e.choices, (u, B) => (i(), I(Me, {
412
+ key: c(l) + B,
413
+ name: c(l),
414
+ value: u.value,
415
+ text: u.text,
416
+ tooltip: u.tooltip,
417
+ "model-value": e.modelValue?.[String(u.value)] ?? !1,
142
418
  disabled: e.disabled,
143
419
  error: e.error,
144
- "onUpdate:modelValue": p
145
- }, null, 8, ["name", "value", "text", "model-value", "disabled", "error"]))), 128)),
146
- e.error ? (c(), i("div", D, [
147
- g(x($), {
420
+ "onUpdate:modelValue": (_) => k(u.value, _)
421
+ }, null, 8, ["name", "value", "text", "tooltip", "model-value", "disabled", "error", "onUpdate:modelValue"]))), 128)),
422
+ e.error ? (i(), p("div", Oe, [
423
+ L(c(q), {
148
424
  style: { height: "fit-content", width: "fit-content", padding: "0" },
149
425
  size: "large",
150
426
  inline: "",
151
427
  "aria-hidden": "true",
152
- "icon-definition": x(S)
153
- }, null, 8, ["icon-definition"]),
154
- A(" " + b(t.errorMessage), 1)
155
- ])) : y("", !0)
428
+ icon: c(ve)
429
+ }, null, 8, ["icon"]),
430
+ H(" " + C(o.errorMessage), 1)
431
+ ])) : x("", !0)
156
432
  ], 2)
157
433
  ], 2));
158
434
  }
159
- }), J = /* @__PURE__ */ C(T, [["__scopeId", "data-v-1408bdad"]]);
435
+ }), Fe = /* @__PURE__ */ Q(Se, [["__scopeId", "data-v-dfb87f32"]]);
160
436
  export {
161
- O as Checkbox,
162
- J as CheckboxGroup,
163
- E as CheckboxIcon
437
+ Me as Checkbox,
438
+ Fe as CheckboxGroup,
439
+ $e as CheckboxIcon
164
440
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phila/phila-ui-checkbox",
3
- "version": "0.1.1",
3
+ "version": "1.0.0-beta.11",
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": "2.4.0"
31
+ "@phila/phila-ui-core": "3.0.0-beta.9",
32
+ "@phila/phila-ui-tooltip": "0.1.0-beta.11"
32
33
  },
33
34
  "devDependencies": {
34
35
  "@types/node": "^24.0.0",