@phila/phila-ui-radio 0.0.16-beta.0 → 0.1.0-beta.0
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/README.md +74 -46
- package/dist/Radio.vue.d.ts +5 -1
- package/dist/Radio.vue.d.ts.map +1 -1
- package/dist/RadioGroup.vue.d.ts +8 -0
- package/dist/RadioGroup.vue.d.ts.map +1 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +130 -15
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,75 +1,103 @@
|
|
|
1
1
|
# Radio Component
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
A radio input component for Phila UI.
|
|
3
|
+
<!-- status-badge-start -->
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
### Component Status
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
| Component | Status |
|
|
8
|
+
| ---------- | ----------------------------------------------------------- |
|
|
9
|
+
| Radio |  |
|
|
10
|
+
| RadioGroup |  |
|
|
11
|
+
|
|
12
|
+
<!-- status-badge-end -->
|
|
13
|
+
|
|
14
|
+
Single-select radio button components for Phila UI. Use `Radio` for a standalone radio button, or `RadioGroup` to manage a set of related options with a shared label, description, and error state.
|
|
9
15
|
|
|
10
16
|
## Installation
|
|
11
17
|
|
|
12
18
|
```bash
|
|
13
|
-
npm install @phila/phila-ui-radio
|
|
14
|
-
# or
|
|
15
|
-
yarn add @phila/phila-ui-radio
|
|
16
|
-
# or
|
|
17
19
|
pnpm add @phila/phila-ui-radio
|
|
18
20
|
```
|
|
19
21
|
|
|
20
22
|
## Usage
|
|
21
23
|
|
|
24
|
+
### RadioGroup (recommended)
|
|
25
|
+
|
|
22
26
|
```vue
|
|
23
27
|
<script setup lang="ts">
|
|
24
|
-
import {
|
|
28
|
+
import { RadioGroup } from "@phila/phila-ui-radio";
|
|
29
|
+
import { ref } from "vue";
|
|
30
|
+
|
|
31
|
+
const selected = ref("");
|
|
32
|
+
const choices = [
|
|
33
|
+
{ text: "Option A", value: "a" },
|
|
34
|
+
{ text: "Option B", value: "b" },
|
|
35
|
+
{ text: "Option C", value: "c" },
|
|
36
|
+
];
|
|
25
37
|
</script>
|
|
26
|
-
<template>...Add basic component template here...</template>
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## Props
|
|
30
|
-
|
|
31
|
-
| Prop | Type | Default | Description |
|
|
32
|
-
| ---- | ---- | ------- | ----------- |
|
|
33
|
-
|
|
34
|
-
| ...Add props here...
|
|
35
|
-
|
|
36
|
-
## Events
|
|
37
|
-
|
|
38
|
-
| Event | Payload | Description |
|
|
39
|
-
| ----- | ------- | ----------- |
|
|
40
|
-
|
|
41
|
-
| ...Add events here...
|
|
42
|
-
|
|
43
|
-
## Examples
|
|
44
38
|
|
|
45
|
-
|
|
39
|
+
<template>
|
|
40
|
+
<RadioGroup groupLabel="Choose an option" description="Select exactly one." :choices="choices" v-model="selected" />
|
|
41
|
+
</template>
|
|
42
|
+
```
|
|
46
43
|
|
|
47
|
-
|
|
44
|
+
### Radio (standalone)
|
|
48
45
|
|
|
49
|
-
|
|
46
|
+
```vue
|
|
47
|
+
<script setup lang="ts">
|
|
48
|
+
import { Radio } from "@phila/phila-ui-radio";
|
|
49
|
+
</script>
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
<template>
|
|
52
|
+
<Radio name="group" value="a" text="Option A" />
|
|
53
|
+
</template>
|
|
53
54
|
```
|
|
54
55
|
|
|
55
|
-
|
|
56
|
+
## Radio Props
|
|
57
|
+
|
|
58
|
+
| Prop | Type | Default | Description |
|
|
59
|
+
| ----------- | --------- | ------- | ------------------------------------------------------------------------ |
|
|
60
|
+
| `text` | `string` | — | Label text displayed next to the radio button |
|
|
61
|
+
| `value` | `string` | — | The value submitted when this radio is selected |
|
|
62
|
+
| `name` | `string` | — | Groups radio buttons together (use the same name for mutual exclusivity) |
|
|
63
|
+
| `disabled` | `boolean` | `false` | Disables the radio button |
|
|
64
|
+
| `error` | `boolean` | `false` | Applies error styling |
|
|
65
|
+
| `className` | `string` | — | Additional CSS classes |
|
|
66
|
+
|
|
67
|
+
## RadioGroup Props
|
|
68
|
+
|
|
69
|
+
| Prop | Type | Default | Description |
|
|
70
|
+
| -------------- | ----------------------------------- | ------- | ---------------------------------------------------------- |
|
|
71
|
+
| `groupLabel` | `string` | — | Label displayed above the group |
|
|
72
|
+
| `description` | `string` | — | Optional helper text below the label |
|
|
73
|
+
| `choices` | `{ text: string, value: string }[]` | — | Array of options to render |
|
|
74
|
+
| `modelValue` | `string` | — | Currently selected value (use with `v-model`) |
|
|
75
|
+
| `error` | `boolean` | `false` | Applies error styling to the group |
|
|
76
|
+
| `errorMessage` | `string` | — | Error message shown below the options when `error` is true |
|
|
77
|
+
| `disabled` | `boolean` | `false` | Disables all radio buttons in the group |
|
|
78
|
+
| `className` | `string` | — | Additional CSS classes |
|
|
56
79
|
|
|
57
|
-
|
|
58
|
-
pnpm dev
|
|
59
|
-
```
|
|
80
|
+
## Events
|
|
60
81
|
|
|
61
|
-
###
|
|
82
|
+
### Radio
|
|
62
83
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
84
|
+
| Event | Payload | Description |
|
|
85
|
+
| ------------------- | -------- | ---------------------------------- |
|
|
86
|
+
| `update:modelValue` | `string` | Emitted when the radio is selected |
|
|
66
87
|
|
|
67
|
-
###
|
|
88
|
+
### RadioGroup
|
|
68
89
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
90
|
+
| Event | Payload | Description |
|
|
91
|
+
| ------------------- | -------- | ---------------------------------------- |
|
|
92
|
+
| `update:modelValue` | `string` | Emitted when the selected option changes |
|
|
72
93
|
|
|
73
|
-
##
|
|
94
|
+
## Visual States
|
|
74
95
|
|
|
75
|
-
|
|
96
|
+
| State | Description |
|
|
97
|
+
| -------- | ---------------------------------------- |
|
|
98
|
+
| Default | Gray border, white background |
|
|
99
|
+
| Hover | Primary-colored border (2px) |
|
|
100
|
+
| Selected | Primary fill with white center dot |
|
|
101
|
+
| Focus | Primary-colored outline around the label |
|
|
102
|
+
| Error | Error-colored border (2px) |
|
|
103
|
+
| Disabled | Muted border and text, not interactive |
|
package/dist/Radio.vue.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { RadioProps } from './index';
|
|
2
|
-
declare const _default: import('vue').DefineComponent<RadioProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
2
|
+
declare const _default: import('vue').DefineComponent<RadioProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
3
|
+
"update:modelValue": (value: string) => any;
|
|
4
|
+
}, string, import('vue').PublicProps, Readonly<RadioProps> & Readonly<{
|
|
5
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
6
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLLabelElement>;
|
|
3
7
|
export default _default;
|
|
4
8
|
//# sourceMappingURL=Radio.vue.d.ts.map
|
package/dist/Radio.vue.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.vue.d.ts","sourceRoot":"","sources":["../src/Radio.vue"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RadioGroupProps } from './index';
|
|
2
|
+
declare const _default: import('vue').DefineComponent<RadioGroupProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
3
|
+
"update:modelValue": (value: string) => any;
|
|
4
|
+
}, string, import('vue').PublicProps, Readonly<RadioGroupProps> & Readonly<{
|
|
5
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
6
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
7
|
+
export default _default;
|
|
8
|
+
//# sourceMappingURL=RadioGroup.vue.d.ts.map
|
|
@@ -0,0 +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"}
|
package/dist/index.css
CHANGED
|
@@ -0,0 +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-f9cddd8f]{display:flex;flex-direction:column;align-items:flex-start;gap:var(--spacing-xs, .5rem)}.labels-container[data-v-f9cddd8f]{display:flex;flex-direction:column;align-items:flex-start;gap:var(--spacing-2xs, .25rem);align-self:stretch}span[data-v-f9cddd8f]{display:block}.radio-container[data-v-f9cddd8f]{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-f9cddd8f]{border-radius:var(--border-radius-m, .75rem)}.error-message[data-v-f9cddd8f]{display:flex;align-items:center;gap:var(--spacing-s, .75rem);align-self:stretch;font-weight:600}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
import { BaseProps } from '@phila/phila-ui-core';
|
|
2
2
|
export { default as Radio } from './Radio.vue';
|
|
3
|
+
export { default as RadioGroup } from './RadioGroup.vue';
|
|
3
4
|
export interface RadioProps extends BaseProps {
|
|
5
|
+
name?: string;
|
|
6
|
+
value: string;
|
|
7
|
+
text: string;
|
|
8
|
+
modelValue?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
error?: boolean;
|
|
4
11
|
}
|
|
12
|
+
export interface RadioGroupProps extends BaseProps {
|
|
13
|
+
groupLabel: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
choices: RadioChoice[];
|
|
16
|
+
modelValue?: string;
|
|
17
|
+
error?: boolean;
|
|
18
|
+
errorMessage?: string;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
}
|
|
21
|
+
type RadioChoice = {
|
|
22
|
+
text: string;
|
|
23
|
+
value: string;
|
|
24
|
+
};
|
|
5
25
|
//# 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,KAAK,EAAE,MAAM,aAAa,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,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,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,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"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const e=require("vue"),r=require("@phila/phila-ui-core"),f=["for"],g=["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(o,{emit:n}){const a=o,l=n,t=r.generateRandomId(),c=e.computed(()=>a.modelValue!==void 0?a.modelValue===a.value:void 0);function d(){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(u,s)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(i.value),for:e.unref(t)},[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(t),type:"radio",name:a.name,value:a.value,checked:c.value,disabled:a.disabled,onChange:d},null,40,g)],10,f))}}),p=(o,n)=>{const a=o.__vccOpts||o;for(const[l,t]of n)a[l]=t;return a},h=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(o,{emit:n}){const a=o,l=n,t=r.generateRandomId(),c=e.computed(()=>r.cn("group-container",a.className)),d=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 u(s){l("update:modelValue",s)}return(s,B)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(c.value)},[e.createElementVNode("div",V,[e.createElementVNode("span",{class:e.normalizeClass(i.value)},e.toDisplayString(o.groupLabel),3),e.createElementVNode("span",_,e.toDisplayString(o.description),1)]),e.createElementVNode("div",{class:e.normalizeClass(d.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.choices,(m,v)=>(e.openBlock(),e.createBlock(h,{key:e.unref(t)+v,name:e.unref(t),value:m.value,text:m.text,"model-value":a.modelValue,disabled:a.disabled,error:a.error,"onUpdate:modelValue":u},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(o.errorMessage),1)])):e.createCommentVNode("",!0)],2)],2))}}),k=p(N,[["__scopeId","data-v-f9cddd8f"]]);exports.Radio=h;exports.RadioGroup=k;
|
package/dist/index.mjs
CHANGED
|
@@ -1,22 +1,137 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { cn as p } from "@phila/phila-ui-core";
|
|
3
|
-
import './index.css';const
|
|
1
|
+
import { defineComponent as b, 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__ */ b({
|
|
4
4
|
__name: "Radio",
|
|
5
5
|
props: {
|
|
6
|
+
name: {},
|
|
7
|
+
value: {},
|
|
8
|
+
text: {},
|
|
9
|
+
modelValue: {},
|
|
10
|
+
disabled: { type: Boolean },
|
|
11
|
+
error: { type: Boolean },
|
|
6
12
|
className: {}
|
|
7
13
|
},
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
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);
|
|
19
|
+
}
|
|
20
|
+
const f = i(() => p(
|
|
21
|
+
"philaRadio",
|
|
22
|
+
"has-text-body-default",
|
|
23
|
+
e.className,
|
|
24
|
+
!e.disabled && "philaRadio-enabled",
|
|
25
|
+
e.disabled && "philaRadio-disabled",
|
|
26
|
+
e.error && "philaRadio-error"
|
|
27
|
+
));
|
|
28
|
+
return (g, s) => (d(), c("label", {
|
|
29
|
+
class: u(f.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"
|
|
40
|
+
}, [
|
|
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));
|
|
13
65
|
}
|
|
14
|
-
}),
|
|
15
|
-
const
|
|
16
|
-
for (const [
|
|
17
|
-
|
|
18
|
-
return
|
|
19
|
-
},
|
|
66
|
+
}), V = (a, l) => {
|
|
67
|
+
const e = a.__vccOpts || a;
|
|
68
|
+
for (const [n, t] of l)
|
|
69
|
+
e[n] = t;
|
|
70
|
+
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 = {
|
|
78
|
+
key: 0,
|
|
79
|
+
class: "error-message has-text-error content"
|
|
80
|
+
}, F = /* @__PURE__ */ b({
|
|
81
|
+
__name: "RadioGroup",
|
|
82
|
+
props: {
|
|
83
|
+
groupLabel: {},
|
|
84
|
+
description: {},
|
|
85
|
+
choices: {},
|
|
86
|
+
modelValue: {},
|
|
87
|
+
error: { type: Boolean },
|
|
88
|
+
errorMessage: {},
|
|
89
|
+
disabled: { type: Boolean },
|
|
90
|
+
className: {}
|
|
91
|
+
},
|
|
92
|
+
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")), f = i(() => p("has-text-label-default", e.error && "has-text-error"));
|
|
95
|
+
function g(s) {
|
|
96
|
+
n("update:modelValue", s);
|
|
97
|
+
}
|
|
98
|
+
return (s, O) => (d(), c("div", {
|
|
99
|
+
class: u(h.value)
|
|
100
|
+
}, [
|
|
101
|
+
o("div", G, [
|
|
102
|
+
o("span", {
|
|
103
|
+
class: u(f.value)
|
|
104
|
+
}, m(a.groupLabel), 3),
|
|
105
|
+
o("span", U, m(a.description), 1)
|
|
106
|
+
]),
|
|
107
|
+
o("div", {
|
|
108
|
+
class: u(v.value)
|
|
109
|
+
}, [
|
|
110
|
+
(d(!0), c(N, null, R(e.choices, (x, k) => (d(), B(M, {
|
|
111
|
+
key: r(t) + k,
|
|
112
|
+
name: r(t),
|
|
113
|
+
value: x.value,
|
|
114
|
+
text: x.text,
|
|
115
|
+
"model-value": e.modelValue,
|
|
116
|
+
disabled: e.disabled,
|
|
117
|
+
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), {
|
|
122
|
+
style: { height: "fit-content", width: "fit-content", padding: "0" },
|
|
123
|
+
size: "large",
|
|
124
|
+
inline: "",
|
|
125
|
+
"aria-hidden": "true",
|
|
126
|
+
"icon-definition": r($)
|
|
127
|
+
}, null, 8, ["icon-definition"]),
|
|
128
|
+
_(" " + m(a.errorMessage), 1)
|
|
129
|
+
])) : C("", !0)
|
|
130
|
+
], 2)
|
|
131
|
+
], 2));
|
|
132
|
+
}
|
|
133
|
+
}), j = /* @__PURE__ */ V(F, [["__scopeId", "data-v-f9cddd8f"]]);
|
|
20
134
|
export {
|
|
21
|
-
|
|
135
|
+
M as Radio,
|
|
136
|
+
j as RadioGroup
|
|
22
137
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phila/phila-ui-radio",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0-beta.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A radio input component for Phila UI.",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"vue": "^3.0.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@phila/phila-ui-core": "2.3.1
|
|
31
|
+
"@phila/phila-ui-core": "2.3.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "^24.0.0",
|