@phila/phila-ui-radio 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.
@@ -3,6 +3,6 @@ declare const _default: import('vue').DefineComponent<RadioProps, {}, {}, {}, {}
3
3
  "update:modelValue": (value: string) => any;
4
4
  }, string, import('vue').PublicProps, Readonly<RadioProps> & Readonly<{
5
5
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
6
- }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLLabelElement>;
6
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLSpanElement>;
7
7
  export default _default;
8
8
  //# sourceMappingURL=Radio.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.vue.d.ts","sourceRoot":"","sources":["../src/Radio.vue"],"names":[],"mappings":"AA0IA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;;;;;;AAmH1C,wBASG"}
1
+ {"version":3,"file":"Radio.vue.d.ts","sourceRoot":"","sources":["../src/Radio.vue"],"names":[],"mappings":"AAsKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;;;;;;AAmK1C,wBASG"}
@@ -1,8 +1,8 @@
1
1
  import { RadioGroupProps } from './index';
2
2
  declare const _default: import('vue').DefineComponent<RadioGroupProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
3
- "update:modelValue": (value: string) => any;
3
+ "update:modelValue": (value: Record<string, boolean>) => any;
4
4
  }, string, import('vue').PublicProps, Readonly<RadioGroupProps> & Readonly<{
5
- "onUpdate:modelValue"?: ((value: string) => 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=RadioGroup.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroup.vue.d.ts","sourceRoot":"","sources":["../src/RadioGroup.vue"],"names":[],"mappings":"AA+GA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;;;;;;AAyJ/C,wBASG"}
1
+ {"version":3,"file":"RadioGroup.vue.d.ts","sourceRoot":"","sources":["../src/RadioGroup.vue"],"names":[],"mappings":"AA4HA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;;;;;;AAwK/C,wBASG"}
package/dist/index.css CHANGED
@@ -1 +1 @@
1
- .philaRadio[data-v-90692348]{display:flex;width:fit-content;align-items:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;gap:var(--spacing-s, .75rem)}.philaRadio input[data-v-90692348]{opacity:0;cursor:pointer;height:0;width:0}.radio-svg[data-v-90692348]{flex-shrink:0;overflow:visible}.radio-bg[data-v-90692348]{fill:var(--Schemes-Surface-Bright, #fafafa);stroke:var(--Schemes-Border, #cfcfcf);stroke-width:1}.radio-dot[data-v-90692348]{fill:none}.philaRadio:has(input:checked) .radio-svg .radio-bg[data-v-90692348]{fill:var(--Schemes-Primary, #0f33f5);stroke:var(--Schemes-Primary, #0f33f5)}.philaRadio:has(input:checked) .radio-svg .radio-dot[data-v-90692348]{fill:var(--Schemes-Surface-Bright, #fafafa)}.philaRadio[data-v-90692348]:focus-within{outline:2px solid var(--Schemes-Primary, #0f33f5);outline-offset:2px}.philaRadio-error .radio-svg .radio-bg[data-v-90692348]{stroke:var(--Schemes-Error, #cc0406);stroke-width:2}.philaRadio-enabled:hover .radio-svg .radio-bg[data-v-90692348]{stroke:var(--Schemes-Primary, #0f33f5);stroke-width:2}.philaRadio-disabled[data-v-90692348]{cursor:not-allowed;color:var(--Schemes-Surface-Variant, #a2a2a2)}.philaRadio-disabled .radio-svg .radio-bg[data-v-90692348]{stroke:var(--Schemes-Surface-Dim, #cfcfcf);stroke-width:1}.group-container[data-v-e831bcab]{display:flex;flex-direction:column;align-items:flex-start;gap:var(--spacing-xs, .5rem)}.labels-container[data-v-e831bcab]{display:flex;flex-direction:column;align-items:flex-start;gap:var(--spacing-2xs, .25rem);align-self:stretch}span[data-v-e831bcab]{display:block}.radio-container[data-v-e831bcab]{display:flex;padding:var(--spacing-m, 1rem);flex-direction:column;align-items:flex-start;gap:var(--spacing-m, 1rem);align-self:stretch}.radio-container-error[data-v-e831bcab]{border-radius:var(--border-radius-m, .75rem)}.error-message[data-v-e831bcab]{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}.philaRadio-row[data-v-305d0fad]{display:inline-flex;align-items:center;gap:var(--spacing-xs, .5rem)}.philaRadio[data-v-305d0fad]{display:flex;width:fit-content;align-items:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;gap:var(--spacing-s, .75rem)}.philaRadio input[data-v-305d0fad]{opacity:0;cursor:pointer;height:0;width:0}.radio-svg[data-v-305d0fad]{flex-shrink:0;overflow:visible}.philaRadio__info[data-v-305d0fad]{display:inline-flex;align-items:center;padding:0;border:none;background:none;cursor:help;color:var(--Schemes-On-Surface-Variant, inherit)}.radio-bg[data-v-305d0fad]{fill:var(--Schemes-Surface-Bright, #fafafa);stroke:var(--Schemes-Border, #cfcfcf);stroke-width:1}.radio-dot[data-v-305d0fad]{fill:none}.philaRadio:has(input:checked) .radio-svg .radio-bg[data-v-305d0fad]{fill:var(--Schemes-Primary, #0f33f5);stroke:var(--Schemes-Primary, #0f33f5)}.philaRadio:has(input:checked) .radio-svg .radio-dot[data-v-305d0fad]{fill:var(--Schemes-Surface-Bright, #fafafa)}.philaRadio[data-v-305d0fad]:focus-within{outline:2px solid var(--Schemes-Primary, #0f33f5);outline-offset:2px}.philaRadio-error .radio-svg .radio-bg[data-v-305d0fad]{stroke:var(--Schemes-Error, #cc0406);stroke-width:2}.philaRadio-enabled:hover .radio-svg .radio-bg[data-v-305d0fad]{stroke:var(--Schemes-Primary, #0f33f5);stroke-width:2}.philaRadio-disabled[data-v-305d0fad]{cursor:not-allowed;color:var(--Schemes-Surface-Variant, #a2a2a2)}.philaRadio-disabled .radio-svg .radio-bg[data-v-305d0fad]{stroke:var(--Schemes-Surface-Dim, #cfcfcf);stroke-width:1}.group-container[data-v-af0e1574]{display:flex;flex-direction:column;align-items:flex-start;gap:var(--spacing-xs, .5rem)}.labels-container[data-v-af0e1574]{display:flex;flex-direction:column;align-items:flex-start;gap:var(--spacing-2xs, .25rem);align-self:stretch}span[data-v-af0e1574]{display:block}.radio-container[data-v-af0e1574]{display:flex;padding:var(--spacing-m, 1rem);flex-direction:column;align-items:flex-start;gap:var(--spacing-m, 1rem);align-self:stretch}.radio-container-error[data-v-af0e1574]{border-radius:var(--border-radius-m, .75rem)}.error-message[data-v-af0e1574]{display:flex;align-items:center;gap:var(--spacing-s, .75rem);align-self:stretch;font-weight:600}
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export interface RadioProps extends BaseProps {
5
5
  name?: string;
6
6
  value: string;
7
7
  text: string;
8
+ tooltip?: string;
8
9
  modelValue?: string;
9
10
  disabled?: boolean;
10
11
  error?: boolean;
@@ -13,7 +14,7 @@ export interface RadioGroupProps extends BaseProps {
13
14
  groupLabel: string;
14
15
  description?: string;
15
16
  choices: RadioChoice[];
16
- modelValue?: string;
17
+ modelValue?: Record<string, boolean>;
17
18
  error?: boolean;
18
19
  errorMessage?: string;
19
20
  disabled?: boolean;
@@ -22,5 +23,6 @@ export type RadioChoice = {
22
23
  text: string;
23
24
  value: string;
24
25
  disabled?: boolean;
26
+ tooltip?: string;
25
27
  };
26
28
  //# 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,KAAK,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,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,KAAK,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,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,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,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"),r=require("@phila/phila-ui-core"),g=["for"],f=["id","name","value","checked","disabled"],b=e.defineComponent({__name:"Radio",props:{name:{},value:{},text:{},modelValue:{},disabled:{type:Boolean},error:{type:Boolean},className:{}},emits:["update:modelValue"],setup(t,{emit:n}){const a=t,l=n,o=r.generateRandomId(),d=e.computed(()=>a.modelValue!==void 0?a.modelValue===a.value:void 0);function c(){l("update:modelValue",a.value)}const i=e.computed(()=>r.cn("philaRadio","has-text-body-default",a.className,!a.disabled&&"philaRadio-enabled",a.disabled&&"philaRadio-disabled",a.error&&"philaRadio-error"));return(m,s)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(i.value),for:e.unref(o)},[s[0]||(s[0]=e.createElementVNode("svg",{class:"radio-svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[e.createElementVNode("circle",{class:"radio-bg",cx:"10",cy:"10",r:"9.5"}),e.createElementVNode("circle",{class:"radio-dot",cx:"10",cy:"10",r:"4"})],-1)),e.createTextVNode(" "+e.toDisplayString(a.text)+" ",1),e.createElementVNode("input",{id:e.unref(o),type:"radio",name:a.name,value:a.value,checked:d.value,disabled:a.disabled,onChange:c},null,40,f)],10,g))}}),p=(t,n)=>{const a=t.__vccOpts||t;for(const[l,o]of n)a[l]=o;return a},v=p(b,[["__scopeId","data-v-90692348"]]);var x={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 V={class:"labels-container"},_={class:"has-text-body-default"},y={key:0,class:"error-message has-text-error content"},N=e.defineComponent({__name:"RadioGroup",props:{groupLabel:{},description:{},choices:{},modelValue:{},error:{type:Boolean},errorMessage:{},disabled:{type:Boolean},className:{}},emits:["update:modelValue"],setup(t,{emit:n}){const a=t,l=n,o=r.generateRandomId(),d=e.computed(()=>r.cn("group-container",a.className)),c=e.computed(()=>r.cn("radio-container",a.error&&"radio-container-error has-background-error")),i=e.computed(()=>r.cn("has-text-label-default",a.error&&"has-text-error"));function m(s){l("update:modelValue",s)}return(s,B)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(d.value)},[e.createElementVNode("div",V,[e.createElementVNode("span",{class:e.normalizeClass(i.value)},e.toDisplayString(t.groupLabel),3),e.createElementVNode("span",_,e.toDisplayString(t.description),1)]),e.createElementVNode("div",{class:e.normalizeClass(c.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.choices,(u,h)=>(e.openBlock(),e.createBlock(v,{key:e.unref(o)+h,name:e.unref(o),value:u.value,text:u.text,"model-value":a.modelValue,disabled:a.disabled||u.disabled,error:a.error,"onUpdate:modelValue":m},null,8,["name","value","text","model-value","disabled","error"]))),128)),a.error?(e.openBlock(),e.createElementBlock("div",y,[e.createVNode(e.unref(r.Icon),{style:{height:"fit-content",width:"fit-content",padding:"0"},size:"large",inline:"","aria-hidden":"true","icon-definition":e.unref(x)},null,8,["icon-definition"]),e.createTextVNode(" "+e.toDisplayString(t.errorMessage),1)])):e.createCommentVNode("",!0)],2)],2))}}),k=p(N,[["__scopeId","data-v-e831bcab"]]);exports.Radio=v;exports.RadioGroup=k;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const e=require("vue"),c=require("@phila/phila-ui-core"),E=require("@phila/phila-ui-core/icons"),F=["disabled"],S=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,r=e.computed(()=>c.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:r.value}:{href:o.href,target:o.target,rel:o.rel,disabled:o.disabled,className:r.value}:{}),d=e.computed(()=>({icon:o.icon,src:o.src,iconRight:o.iconRight,iconOnly:o.iconOnly,text:o.text,size:o.size}));return(i,m)=>t(o)?(e.openBlock(),e.createBlock(e.unref(c.BaseLink),e.mergeProps({key:0},{...a.value,...i.$attrs},{role:"button"}),{default:e.withCtx(()=>[e.createVNode(e.unref(c.ActionContent),e.normalizeProps(e.guardReactiveProps(d.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:r.value},i.$attrs),[e.createVNode(e.unref(c.ActionContent),e.normalizeProps(e.guardReactiveProps(d.value)),{default:e.withCtx(()=>[e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(o.text),1)])]),_:3},16)],16,F))}}),U=["id"],q={key:0,class:"tooltip__tail","aria-hidden":"true"},A={key:1,class:"tooltip__plain-row has-text-body-small"},G={key:0,class:"tooltip__title-row"},H={key:0},j=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(()=>c.cn("tooltip","content","resets-link-colors",`tooltip--${o.type}`,`tooltip--${o.color}`,o.tail&&`tooltip--${o.placement}`,o.className));return(r,a)=>(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",A,[e.renderSlot(r.$slots,"default",{},void 0,!0),l.dismissable?(e.openBlock(),e.createBlock(e.unref(S),{key:0,class:"tooltip__dismiss",variant:"standard",size:"extra-small","icon-only":!0,icon:e.unref(E.IconClose),"aria-label":"Dismiss tooltip",onClick:a[0]||(a[0]=d=>r.$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",G,[l.title?(e.openBlock(),e.createElementBlock("h6",H,e.toDisplayString(l.title),1)):e.createCommentVNode("",!0),l.dismissable?(e.openBlock(),e.createBlock(e.unref(S),{key:1,class:"tooltip__dismiss",variant:"standard",size:"extra-small","icon-only":!0,icon:e.unref(E.IconClose),"aria-label":"Dismiss tooltip",onClick:a[1]||(a[1]=d=>r.$emit("dismiss"))},null,8,["icon"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(r.$slots,"default",{},void 0,!0)],64))],10,U))}}),z=(l,o)=>{const t=l.__vccOpts||l;for(const[r,a]of o)t[r]=a;return t},K=z(j,[["__scopeId","data-v-af4a0398"]]),V=8,w=8,W=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,r=e.useId(),a=e.ref(!1),d=e.ref(null),i=e.ref(null),m=e.ref("top-center"),y=e.ref({top:0,left:0});let s=null;const h=()=>{const n=d.value?.getBoundingClientRect();if(!n)return"top-center";const{innerWidth:u,innerHeight:b}=window,k=n.top,R=b-n.bottom,_=i.value?.getBoundingClientRect().height??0,B=(_>0?k>=_:k>=R)?"top":"bottom",v=n.left+n.width/2,O=v<u/3?"left":v>u*2/3?"right":"center";return`${B}-${O}`};function g(){const n=d.value?.getBoundingClientRect(),u=i.value?.getBoundingClientRect();if(!n||!u)return;const{innerWidth:b,innerHeight:k}=window,[R,_]=m.value.split("-");let B=R==="top"?n.top-V-u.height:n.bottom+V,v;_==="center"?v=n.left+n.width/2-u.width/2:_==="left"?v=n.left-V:v=n.right+V-u.width,v=Math.min(Math.max(v,w),b-w-u.width),B=Math.min(Math.max(B,w),k-w-u.height),y.value={top:B,left:v}}const p=n=>{n.key==="Escape"&&f()},x=n=>{const u=n.target,b=d.value?.contains(u),k=i.value?.contains(u);!b&&!k&&f()},C=()=>{a.value&&g()},N=async()=>{s&&(clearTimeout(s),s=null),m.value=t.placement==="auto"?h():t.placement,a.value=!0,document.addEventListener("keydown",p),t.trigger==="click"&&document.addEventListener("click",x),window.addEventListener("scroll",C,!0),window.addEventListener("resize",C),await e.nextTick(),t.placement==="auto"&&(m.value=h()),g()},f=()=>{a.value=!1,s&&(clearTimeout(s),s=null),document.removeEventListener("keydown",p),document.removeEventListener("click",x),window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C)},$=()=>{if(t.trigger!=="hover")return f();s=setTimeout(f,100)},D=()=>{s&&(clearTimeout(s),s=null)},L=()=>{a.value?f():N()};e.onUnmounted(f),o({show:N,hide:f});const M=e.computed(()=>({type:t.type,color:t.color,tail:t.tail,placement:m.value,title:t.title,dismissable:t.dismissable})),P=e.computed(()=>({top:`${y.value.top}px`,left:`${y.value.left}px`,visibility:a.value?"visible":"hidden"}));return(n,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("span",e.mergeProps({ref_key:"wrapperEl",ref:d,class:e.unref(c.cn)("tooltip-trigger",t.className)},l.trigger==="click"?{onClick:L}:{onMouseenter:N,onMouseleave:$,onFocusin:N,onFocusout:f}),[e.renderSlot(n.$slots,"default",{tooltipId:e.unref(r),isOpen:a.value},void 0,!0)],16),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createElementVNode("div",{ref_key:"bubbleEl",ref:i,class:"tooltip-positioner",style:e.normalizeStyle(P.value),onMouseenter:D,onMouseleave:$},[e.createVNode(K,e.mergeProps(M.value,{id:e.unref(r),onDismiss:f}),{default:e.withCtx(()=>[e.renderSlot(n.$slots,"body",{},void 0,!0)]),_:3},16,["id"])],36)]))],64))}}),X=z(W,[["__scopeId","data-v-591a1092"]]),Y={class:"philaRadio-row"},Z=["for"],J=["id","name","value","checked","disabled"],Q={type:"button",class:"philaRadio__info","aria-label":"More information"},ee=e.defineComponent({__name:"Radio",props:{name:{},value:{},text:{},tooltip:{},modelValue:{},disabled:{type:Boolean},error:{type:Boolean},className:{}},emits:["update:modelValue"],setup(l,{emit:o}){const t=l,r=o,a=c.generateRandomId(),d=e.computed(()=>t.modelValue!==void 0?t.modelValue===t.value:void 0);function i(){r("update:modelValue",t.value)}const m=e.computed(()=>c.cn("philaRadio","has-text-body-default",t.className,!t.disabled&&"philaRadio-enabled",t.disabled&&"philaRadio-disabled",t.error&&"philaRadio-error"));return(y,s)=>(e.openBlock(),e.createElementBlock("span",Y,[e.createElementVNode("label",{class:e.normalizeClass(m.value),for:e.unref(a)},[s[0]||(s[0]=e.createElementVNode("svg",{class:"radio-svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[e.createElementVNode("circle",{class:"radio-bg",cx:"10",cy:"10",r:"9.5"}),e.createElementVNode("circle",{class:"radio-dot",cx:"10",cy:"10",r:"4"})],-1)),e.createTextVNode(" "+e.toDisplayString(t.text)+" ",1),e.createElementVNode("input",{id:e.unref(a),type:"radio",name:t.name,value:t.value,checked:d.value,disabled:t.disabled,onChange:i},null,40,J)],10,Z),t.tooltip?(e.openBlock(),e.createBlock(e.unref(X),{key:0,trigger:"hover",class:"philaRadio__tooltip"},{body:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.tooltip),1)]),default:e.withCtx(()=>[e.createElementVNode("button",Q,[e.createVNode(e.unref(c.Icon),{icon:e.unref(E.IconCircleInfo),size:"small",inline:"",decorative:""},null,8,["icon"])])]),_:1})):e.createCommentVNode("",!0)]))}}),I=(l,o)=>{const t=l.__vccOpts||l;for(const[r,a]of o)t[r]=a;return t},T=I(ee,[["__scopeId","data-v-305d0fad"]]),te={class:"labels-container"},oe={class:"has-text-body-default"},le={key:0,class:"error-message has-text-error content"},ae=e.defineComponent({__name:"RadioGroup",props:{groupLabel:{},description:{},choices:{},modelValue:{},error:{type:Boolean},errorMessage:{},disabled:{type:Boolean},className:{}},emits:["update:modelValue"],setup(l,{emit:o}){const t=l,r=o,a=c.generateRandomId(),d=e.computed(()=>{const h=Object.entries(t.modelValue??{}).filter(([,g])=>g);return h.length>1,h[0]?.[0]??""}),i=e.computed(()=>c.cn("group-container",t.className)),m=e.computed(()=>c.cn("radio-container",t.error&&"radio-container-error has-background-error")),y=e.computed(()=>c.cn("has-text-label-default",t.error&&"has-text-error"));function s(h){const g={};for(const p of t.choices)g[String(p.value)]=String(p.value)===h;r("update:modelValue",g)}return(h,g)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(i.value)},[e.createElementVNode("div",te,[e.createElementVNode("span",{class:e.normalizeClass(y.value)},e.toDisplayString(l.groupLabel),3),e.createElementVNode("span",oe,e.toDisplayString(l.description),1)]),e.createElementVNode("div",{class:e.normalizeClass(m.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.choices,(p,x)=>(e.openBlock(),e.createBlock(T,{key:e.unref(a)+x,name:e.unref(a),value:p.value,text:p.text,tooltip:p.tooltip,"model-value":d.value,disabled:t.disabled||p.disabled,error:t.error,"onUpdate:modelValue":s},null,8,["name","value","text","tooltip","model-value","disabled","error"]))),128)),t.error?(e.openBlock(),e.createElementBlock("div",le,[e.createVNode(e.unref(c.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))}}),ne=I(ae,[["__scopeId","data-v-af0e1574"]]);exports.Radio=T;exports.RadioGroup=ne;
package/dist/index.mjs CHANGED
@@ -1,23 +1,277 @@
1
- import { defineComponent as x, computed as i, createElementBlock as c, openBlock as d, unref as r, normalizeClass as u, createElementVNode as o, createTextVNode as _, toDisplayString as m, createCommentVNode as C, Fragment as N, renderList as R, createBlock as B, createVNode as w } from "vue";
2
- import { generateRandomId as y, cn as p, Icon as z } from "@phila/phila-ui-core";
3
- import './index.css';const I = ["for"], E = ["id", "name", "value", "checked", "disabled"], L = /* @__PURE__ */ x({
1
+ import { defineComponent as O, useId as se, ref as I, onUnmounted as ne, computed as v, createElementBlock as p, openBlock as r, Fragment as G, createElementVNode as m, createBlock as R, mergeProps as U, unref as s, renderSlot as N, Teleport as re, normalizeStyle as de, createVNode as M, withCtx as C, nextTick as ce, normalizeClass as L, createCommentVNode as x, toDisplayString as k, normalizeProps as W, guardReactiveProps as j, createTextVNode as T, renderList as ue } from "vue";
2
+ import { cn as w, BaseLink as pe, ActionContent as X, generateRandomId as q, Icon as J } from "@phila/phila-ui-core";
3
+ import { IconClose as Y, IconCircleInfo as me, IconCircleExclamation as ve } from "@phila/phila-ui-core/icons";
4
+ import './index.css';const fe = ["disabled"], Z = /* @__PURE__ */ O({
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, i = 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: i.value
36
+ } : {
37
+ href: t.href,
38
+ target: t.target,
39
+ rel: t.rel,
40
+ disabled: t.disabled,
41
+ className: i.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, h) => e(t) ? (r(), R(s(pe), U({ key: 0 }, { ...a.value, ...n.$attrs }, { role: "button" }), {
53
+ default: C(() => [
54
+ M(s(X), W(j(c.value)), {
55
+ default: C(() => [
56
+ N(n.$slots, "default", {}, () => [
57
+ T(k(t.text), 1)
58
+ ])
59
+ ]),
60
+ _: 3
61
+ }, 16)
62
+ ]),
63
+ _: 3
64
+ }, 16)) : (r(), p("button", U({
65
+ key: 1,
66
+ type: "button",
67
+ disabled: t.disabled,
68
+ class: i.value
69
+ }, n.$attrs), [
70
+ M(s(X), W(j(c.value)), {
71
+ default: C(() => [
72
+ N(n.$slots, "default", {}, () => [
73
+ T(k(t.text), 1)
74
+ ])
75
+ ]),
76
+ _: 3
77
+ }, 16)
78
+ ], 16, fe));
79
+ }
80
+ }), he = ["id"], be = {
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
+ }, ye = {
88
+ key: 0,
89
+ class: "tooltip__title-row"
90
+ }, _e = { key: 0 }, ke = /* @__PURE__ */ O({
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 (i, a) => (r(), p("div", {
116
+ id: o.id,
117
+ class: L(e.value),
118
+ role: "tooltip"
119
+ }, [
120
+ o.tail ? (r(), p("div", be)) : x("", !0),
121
+ o.type === "plain" ? (r(), p("div", ge, [
122
+ N(i.$slots, "default", {}, void 0, !0),
123
+ o.dismissable ? (r(), R(s(Z), {
124
+ key: 0,
125
+ class: "tooltip__dismiss",
126
+ variant: "standard",
127
+ size: "extra-small",
128
+ "icon-only": !0,
129
+ icon: s(Y),
130
+ "aria-label": "Dismiss tooltip",
131
+ onClick: a[0] || (a[0] = (c) => i.$emit("dismiss"))
132
+ }, null, 8, ["icon"])) : x("", !0)
133
+ ])) : (r(), p(G, { key: 2 }, [
134
+ o.title || o.dismissable ? (r(), p("div", ye, [
135
+ o.title ? (r(), p("h6", _e, k(o.title), 1)) : x("", !0),
136
+ o.dismissable ? (r(), R(s(Z), {
137
+ key: 1,
138
+ class: "tooltip__dismiss",
139
+ variant: "standard",
140
+ size: "extra-small",
141
+ "icon-only": !0,
142
+ icon: s(Y),
143
+ "aria-label": "Dismiss tooltip",
144
+ onClick: a[1] || (a[1] = (c) => i.$emit("dismiss"))
145
+ }, null, 8, ["icon"])) : x("", !0)
146
+ ])) : x("", !0),
147
+ N(i.$slots, "default", {}, void 0, !0)
148
+ ], 64))
149
+ ], 10, he));
150
+ }
151
+ }), Q = (o, t) => {
152
+ const e = o.__vccOpts || o;
153
+ for (const [i, a] of t)
154
+ e[i] = a;
155
+ return e;
156
+ }, xe = /* @__PURE__ */ Q(ke, [["__scopeId", "data-v-af4a0398"]]), F = 8, H = 8, we = /* @__PURE__ */ O({
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, i = se(), a = I(!1), c = I(null), n = I(null), h = I("top-center"), $ = I({ top: 0, left: 0 });
170
+ let d = null;
171
+ const y = () => {
172
+ const l = c.value?.getBoundingClientRect();
173
+ if (!l) return "top-center";
174
+ const { innerWidth: u, innerHeight: E } = window, B = l.top, A = E - l.bottom, V = n.value?.getBoundingClientRect().height ?? 0, z = (V > 0 ? B >= V : B >= A) ? "top" : "bottom", g = l.left + l.width / 2, ie = g < u / 3 ? "left" : g > u * 2 / 3 ? "right" : "center";
175
+ return `${z}-${ie}`;
176
+ };
177
+ function _() {
178
+ const l = c.value?.getBoundingClientRect(), u = n.value?.getBoundingClientRect();
179
+ if (!l || !u) return;
180
+ const { innerWidth: E, innerHeight: B } = window, [A, V] = h.value.split("-");
181
+ let z = A === "top" ? l.top - F - u.height : l.bottom + F, g;
182
+ V === "center" ? g = l.left + l.width / 2 - u.width / 2 : V === "left" ? g = l.left - F : g = l.right + F - u.width, g = Math.min(Math.max(g, H), E - H - u.width), z = Math.min(Math.max(z, H), B - H - u.height), $.value = { top: z, left: g };
183
+ }
184
+ const f = (l) => {
185
+ l.key === "Escape" && b();
186
+ }, P = (l) => {
187
+ const u = l.target, E = c.value?.contains(u), B = n.value?.contains(u);
188
+ !E && !B && b();
189
+ }, S = () => {
190
+ a.value && _();
191
+ }, D = async () => {
192
+ d && (clearTimeout(d), d = null), h.value = e.placement === "auto" ? y() : e.placement, a.value = !0, document.addEventListener("keydown", f), e.trigger === "click" && document.addEventListener("click", P), window.addEventListener("scroll", S, !0), window.addEventListener("resize", S), await ce(), e.placement === "auto" && (h.value = y()), _();
193
+ }, b = () => {
194
+ a.value = !1, d && (clearTimeout(d), d = null), document.removeEventListener("keydown", f), document.removeEventListener("click", P), window.removeEventListener("scroll", S, !0), window.removeEventListener("resize", S);
195
+ }, K = () => {
196
+ if (e.trigger !== "hover") return b();
197
+ d = setTimeout(b, 100);
198
+ }, te = () => {
199
+ d && (clearTimeout(d), d = null);
200
+ }, oe = () => {
201
+ a.value ? b() : D();
202
+ };
203
+ ne(b), t({ show: D, hide: b });
204
+ const ae = v(() => ({
205
+ type: e.type,
206
+ color: e.color,
207
+ tail: e.tail,
208
+ placement: h.value,
209
+ title: e.title,
210
+ dismissable: e.dismissable
211
+ })), le = v(() => ({
212
+ top: `${$.value.top}px`,
213
+ left: `${$.value.left}px`,
214
+ visibility: a.value ? "visible" : "hidden"
215
+ }));
216
+ return (l, u) => (r(), p(G, null, [
217
+ m("span", U(
218
+ {
219
+ ref_key: "wrapperEl",
220
+ ref: c,
221
+ class: s(w)("tooltip-trigger", e.className)
222
+ },
223
+ o.trigger === "click" ? { onClick: oe } : { onMouseenter: D, onMouseleave: K, onFocusin: D, onFocusout: b }
224
+ ), [
225
+ N(l.$slots, "default", {
226
+ tooltipId: s(i),
227
+ isOpen: a.value
228
+ }, void 0, !0)
229
+ ], 16),
230
+ (r(), R(re, { to: "body" }, [
231
+ m("div", {
232
+ ref_key: "bubbleEl",
233
+ ref: n,
234
+ class: "tooltip-positioner",
235
+ style: de(le.value),
236
+ onMouseenter: te,
237
+ onMouseleave: K
238
+ }, [
239
+ M(xe, U(ae.value, {
240
+ id: s(i),
241
+ onDismiss: b
242
+ }), {
243
+ default: C(() => [
244
+ N(l.$slots, "body", {}, void 0, !0)
245
+ ]),
246
+ _: 3
247
+ }, 16, ["id"])
248
+ ], 36)
249
+ ]))
250
+ ], 64));
251
+ }
252
+ }), $e = /* @__PURE__ */ Q(we, [["__scopeId", "data-v-591a1092"]]), Be = { class: "philaRadio-row" }, Ce = ["for"], Re = ["id", "name", "value", "checked", "disabled"], Ne = {
253
+ type: "button",
254
+ class: "philaRadio__info",
255
+ "aria-label": "More information"
256
+ }, Ee = /* @__PURE__ */ O({
4
257
  __name: "Radio",
5
258
  props: {
6
259
  name: {},
7
260
  value: {},
8
261
  text: {},
262
+ tooltip: {},
9
263
  modelValue: {},
10
264
  disabled: { type: Boolean },
11
265
  error: { type: Boolean },
12
266
  className: {}
13
267
  },
14
268
  emits: ["update:modelValue"],
15
- setup(a, { emit: l }) {
16
- const e = a, n = l, t = y(), h = i(() => e.modelValue !== void 0 ? e.modelValue === e.value : void 0);
17
- function v() {
18
- n("update:modelValue", e.value);
269
+ setup(o, { emit: t }) {
270
+ const e = o, i = t, a = q(), c = v(() => e.modelValue !== void 0 ? e.modelValue === e.value : void 0);
271
+ function n() {
272
+ i("update:modelValue", e.value);
19
273
  }
20
- const b = i(() => p(
274
+ const h = v(() => w(
21
275
  "philaRadio",
22
276
  "has-text-body-default",
23
277
  e.className,
@@ -25,59 +279,75 @@ import './index.css';const I = ["for"], E = ["id", "name", "value", "checked", "
25
279
  e.disabled && "philaRadio-disabled",
26
280
  e.error && "philaRadio-error"
27
281
  ));
28
- return (g, s) => (d(), c("label", {
29
- class: u(b.value),
30
- for: r(t)
31
- }, [
32
- s[0] || (s[0] = o("svg", {
33
- class: "radio-svg",
34
- width: "20",
35
- height: "20",
36
- viewBox: "0 0 20 20",
37
- fill: "none",
38
- xmlns: "http://www.w3.org/2000/svg",
39
- "aria-hidden": "true"
282
+ return ($, d) => (r(), p("span", Be, [
283
+ m("label", {
284
+ class: L(h.value),
285
+ for: s(a)
40
286
  }, [
41
- o("circle", {
42
- class: "radio-bg",
43
- cx: "10",
44
- cy: "10",
45
- r: "9.5"
46
- }),
47
- o("circle", {
48
- class: "radio-dot",
49
- cx: "10",
50
- cy: "10",
51
- r: "4"
52
- })
53
- ], -1)),
54
- _(" " + m(e.text) + " ", 1),
55
- o("input", {
56
- id: r(t),
57
- type: "radio",
58
- name: e.name,
59
- value: e.value,
60
- checked: h.value,
61
- disabled: e.disabled,
62
- onChange: v
63
- }, null, 40, E)
64
- ], 10, I));
287
+ d[0] || (d[0] = m("svg", {
288
+ class: "radio-svg",
289
+ width: "20",
290
+ height: "20",
291
+ viewBox: "0 0 20 20",
292
+ fill: "none",
293
+ xmlns: "http://www.w3.org/2000/svg",
294
+ "aria-hidden": "true"
295
+ }, [
296
+ m("circle", {
297
+ class: "radio-bg",
298
+ cx: "10",
299
+ cy: "10",
300
+ r: "9.5"
301
+ }),
302
+ m("circle", {
303
+ class: "radio-dot",
304
+ cx: "10",
305
+ cy: "10",
306
+ r: "4"
307
+ })
308
+ ], -1)),
309
+ T(" " + k(e.text) + " ", 1),
310
+ m("input", {
311
+ id: s(a),
312
+ type: "radio",
313
+ name: e.name,
314
+ value: e.value,
315
+ checked: c.value,
316
+ disabled: e.disabled,
317
+ onChange: n
318
+ }, null, 40, Re)
319
+ ], 10, Ce),
320
+ e.tooltip ? (r(), R(s($e), {
321
+ key: 0,
322
+ trigger: "hover",
323
+ class: "philaRadio__tooltip"
324
+ }, {
325
+ body: C(() => [
326
+ T(k(e.tooltip), 1)
327
+ ]),
328
+ default: C(() => [
329
+ m("button", Ne, [
330
+ M(s(J), {
331
+ icon: s(me),
332
+ size: "small",
333
+ inline: "",
334
+ decorative: ""
335
+ }, null, 8, ["icon"])
336
+ ])
337
+ ]),
338
+ _: 1
339
+ })) : x("", !0)
340
+ ]));
65
341
  }
66
- }), V = (a, l) => {
67
- const e = a.__vccOpts || a;
68
- for (const [n, t] of l)
69
- e[n] = t;
342
+ }), ee = (o, t) => {
343
+ const e = o.__vccOpts || o;
344
+ for (const [i, a] of t)
345
+ e[i] = a;
70
346
  return e;
71
- }, M = /* @__PURE__ */ V(L, [["__scopeId", "data-v-90692348"]]);
72
- var $ = {
73
- prefix: "fas",
74
- iconName: "circle-exclamation",
75
- 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"]
76
- };
77
- const G = { class: "labels-container" }, U = { class: "has-text-body-default" }, D = {
347
+ }, Ve = /* @__PURE__ */ ee(Ee, [["__scopeId", "data-v-305d0fad"]]), ze = { class: "labels-container" }, Ie = { class: "has-text-body-default" }, Le = {
78
348
  key: 0,
79
349
  class: "error-message has-text-error content"
80
- }, F = /* @__PURE__ */ x({
350
+ }, Me = /* @__PURE__ */ O({
81
351
  __name: "RadioGroup",
82
352
  props: {
83
353
  groupLabel: {},
@@ -90,48 +360,54 @@ const G = { class: "labels-container" }, U = { class: "has-text-body-default" },
90
360
  className: {}
91
361
  },
92
362
  emits: ["update:modelValue"],
93
- setup(a, { emit: l }) {
94
- const e = a, n = l, t = y(), h = i(() => p("group-container", e.className)), v = i(() => p("radio-container", e.error && "radio-container-error has-background-error")), b = i(() => p("has-text-label-default", e.error && "has-text-error"));
95
- function g(s) {
96
- n("update:modelValue", s);
363
+ setup(o, { emit: t }) {
364
+ const e = o, i = t, a = q(), c = v(() => {
365
+ const y = Object.entries(e.modelValue ?? {}).filter(([, _]) => _);
366
+ return y.length > 1, y[0]?.[0] ?? "";
367
+ }), n = v(() => w("group-container", e.className)), h = v(() => w("radio-container", e.error && "radio-container-error has-background-error")), $ = v(() => w("has-text-label-default", e.error && "has-text-error"));
368
+ function d(y) {
369
+ const _ = {};
370
+ for (const f of e.choices) _[String(f.value)] = String(f.value) === y;
371
+ i("update:modelValue", _);
97
372
  }
98
- return (s, O) => (d(), c("div", {
99
- class: u(h.value)
373
+ return (y, _) => (r(), p("div", {
374
+ class: L(n.value)
100
375
  }, [
101
- o("div", G, [
102
- o("span", {
103
- class: u(b.value)
104
- }, m(a.groupLabel), 3),
105
- o("span", U, m(a.description), 1)
376
+ m("div", ze, [
377
+ m("span", {
378
+ class: L($.value)
379
+ }, k(o.groupLabel), 3),
380
+ m("span", Ie, k(o.description), 1)
106
381
  ]),
107
- o("div", {
108
- class: u(v.value)
382
+ m("div", {
383
+ class: L(h.value)
109
384
  }, [
110
- (d(!0), c(N, null, R(e.choices, (f, k) => (d(), B(M, {
111
- key: r(t) + k,
112
- name: r(t),
385
+ (r(!0), p(G, null, ue(e.choices, (f, P) => (r(), R(Ve, {
386
+ key: s(a) + P,
387
+ name: s(a),
113
388
  value: f.value,
114
389
  text: f.text,
115
- "model-value": e.modelValue,
390
+ tooltip: f.tooltip,
391
+ "model-value": c.value,
116
392
  disabled: e.disabled || f.disabled,
117
393
  error: e.error,
118
- "onUpdate:modelValue": g
119
- }, null, 8, ["name", "value", "text", "model-value", "disabled", "error"]))), 128)),
120
- e.error ? (d(), c("div", D, [
121
- w(r(z), {
394
+ "onUpdate:modelValue": d
395
+ }, null, 8, ["name", "value", "text", "tooltip", "model-value", "disabled", "error"]))), 128)),
396
+ e.error ? (r(), p("div", Le, [
397
+ M(s(J), {
122
398
  style: { height: "fit-content", width: "fit-content", padding: "0" },
123
399
  size: "large",
124
400
  inline: "",
125
401
  "aria-hidden": "true",
126
- "icon-definition": r($)
127
- }, null, 8, ["icon-definition"]),
128
- _(" " + m(a.errorMessage), 1)
129
- ])) : C("", !0)
402
+ icon: s(ve)
403
+ }, null, 8, ["icon"]),
404
+ T(" " + k(o.errorMessage), 1)
405
+ ])) : x("", !0)
130
406
  ], 2)
131
407
  ], 2));
132
408
  }
133
- }), j = /* @__PURE__ */ V(F, [["__scopeId", "data-v-e831bcab"]]);
409
+ }), Se = /* @__PURE__ */ ee(Me, [["__scopeId", "data-v-af0e1574"]]);
134
410
  export {
135
- M as Radio,
136
- j as RadioGroup
411
+ Ve as Radio,
412
+ Se as RadioGroup
137
413
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phila/phila-ui-radio",
3
- "version": "0.1.1",
3
+ "version": "1.0.0-beta.11",
4
4
  "type": "module",
5
5
  "description": "A radio input component for Phila UI.",
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",