@phila/phila-ui-radio 0.0.10 → 0.0.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.
package/README.md CHANGED
@@ -1,30 +1,75 @@
1
+ # Radio Component
2
+
3
+ A simple, customizable Vue 3. Radio component built with TypeScript and Vite.
4
+ A radio input component for Phila UI.
5
+
6
+ ## Features
7
+
8
+ - 🎯 TypeScript support with full type definitions
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ npm install @phila/phila-ui-radio
14
+ # or
15
+ yarn add @phila/phila-ui-radio
16
+ # or
17
+ pnpm add @phila/phila-ui-radio
18
+ ```
19
+
1
20
  ## Usage
2
21
 
3
- #### Import single component...
22
+ ```vue
23
+ <script setup lang="ts">
24
+ import { Radio } from "@phila/phila-ui-radio";
25
+ </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...
4
35
 
5
- ```js
6
- import { Radio } from '@phila/phila-ui';
36
+ ## Events
7
37
 
8
- //register it locally...
9
- components: {
10
- Radio,
11
- }
38
+ | Event | Payload | Description |
39
+ | ----- | ------- | ----------- |
12
40
 
13
- //... or register it globally
14
- Vue.component('radio', Radio);
41
+ | ...Add events here...
42
+
43
+ ## Examples
44
+
45
+ ...Add examples here...
46
+
47
+ ## Development
48
+
49
+ ### Install Dependencies
50
+
51
+ ```bash
52
+ pnpm install
15
53
  ```
16
54
 
17
- #### or import the whole library,
55
+ ### Run Demo
56
+
57
+ ```bash
58
+ pnpm dev
59
+ ```
60
+
61
+ ### Build Library
62
+
63
+ ```bash
64
+ pnpm build
65
+ ```
18
66
 
19
- ```js
20
- import * as PhilaUI from "@phila/phila-ui";
67
+ ### Type Check
21
68
 
22
- //register it globally
23
- Vue.use(PhilaUI);
69
+ ```bash
70
+ pnpm type-check
24
71
  ```
25
72
 
26
- #### then use it in the vue template
73
+ ## License
27
74
 
28
- ```html
29
- <radio></radio>
30
- ```
75
+ MIT
@@ -1,77 +1,4 @@
1
- import { InputProps } from '@phila/phila-ui-core';
2
- import { RadioProps } from './types';
3
-
4
- declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<InputProps & RadioProps>, {
5
- id: any;
6
- errors(): never[];
7
- label: string;
8
- desc: string;
9
- modelValue: string;
10
- valueKey: string;
11
- textKey: string;
12
- numOfColumns: number;
13
- small: boolean;
14
- options: () => {
15
- "option-1": string;
16
- "option-2": string;
17
- "option-3": string;
18
- };
19
- }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
20
- "update:modelValue": (...args: any[]) => void;
21
- change: (...args: any[]) => void;
22
- }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<InputProps & RadioProps>, {
23
- id: any;
24
- errors(): never[];
25
- label: string;
26
- desc: string;
27
- modelValue: string;
28
- valueKey: string;
29
- textKey: string;
30
- numOfColumns: number;
31
- small: boolean;
32
- options: () => {
33
- "option-1": string;
34
- "option-2": string;
35
- "option-3": string;
36
- };
37
- }>>> & Readonly<{
38
- "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
39
- onChange?: ((...args: any[]) => any) | undefined;
40
- }>, {
41
- id: string;
42
- errors: import('@phila/phila-ui-core').InputErrors;
43
- options: (import('@phila/phila-ui-core').HTMLInputValue[] | import('@phila/phila-ui-core').InputOptions | import('@phila/phila-ui-core').InputOptions[] | import('@phila/phila-ui-core').InputOptionsGroup | import('@phila/phila-ui-core').InputOptionObject[] | undefined) & (object | (string | number | object)[]);
44
- textKey: string;
45
- valueKey: string;
46
- label: string;
47
- desc: string;
48
- modelValue: string | number | boolean;
49
- numOfColumns: string | number;
50
- small: boolean;
51
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>, {
52
- label?(_: {}): any;
53
- desc?(_: {}): any;
54
- }>;
1
+ import { RadioProps } from './index';
2
+ declare const _default: import('vue').DefineComponent<RadioProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<RadioProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLSpanElement>;
55
3
  export default _default;
56
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
57
- type __VLS_TypePropsToRuntimeProps<T> = {
58
- [K in keyof T]-?: {} extends Pick<T, K> ? {
59
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
60
- } : {
61
- type: import('vue').PropType<T[K]>;
62
- required: true;
63
- };
64
- };
65
- type __VLS_WithDefaults<P, D> = {
66
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
67
- default: D[K];
68
- }> : P[K];
69
- };
70
- type __VLS_Prettify<T> = {
71
- [K in keyof T]: T[K];
72
- } & {};
73
- type __VLS_WithTemplateSlots<T, S> = T & {
74
- new (): {
75
- $slots: S;
76
- };
77
- };
4
+ //# sourceMappingURL=Radio.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Radio.vue.d.ts","sourceRoot":"","sources":["../src/Radio.vue"],"names":[],"mappings":"AAGA;AAgCA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;;AA+D1C,wBASG"}
package/dist/index.css ADDED
File without changes
@@ -0,0 +1,5 @@
1
+ import { BaseProps } from '@phila/phila-ui-core';
2
+ export { default as Radio } from './Radio.vue';
3
+ export interface RadioProps extends BaseProps {
4
+ }
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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;AAI/C,MAAM,WAAW,UAAW,SAAQ,SAAS;CAE5C"}
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const e=require("vue"),n=require("@phila/phila-ui-core"),r=e.defineComponent({__name:"Radio",props:{className:{}},setup(o,{emit:a}){const t=o,s=e.computed(()=>n.cn("default-class",t.className));return(c,p)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(s.value)}," Hello world! I am Radio ",2))}}),l=(o,a)=>{const t=o.__vccOpts||o;for(const[s,c]of a)t[s]=c;return t},i=l(r,[["__scopeId","data-v-be223e4b"]]);exports.Radio=i;
package/dist/index.mjs ADDED
@@ -0,0 +1,22 @@
1
+ import { defineComponent as c, computed as n, createElementBlock as r, openBlock as l, normalizeClass as m } from "vue";
2
+ import { cn as p } from "@phila/phila-ui-core";
3
+ import './index.css';const _ = /* @__PURE__ */ c({
4
+ __name: "Radio",
5
+ props: {
6
+ className: {}
7
+ },
8
+ setup(e, { emit: s }) {
9
+ const o = e, t = n(() => p("default-class", o.className));
10
+ return (a, d) => (l(), r("span", {
11
+ class: m(t.value)
12
+ }, " Hello world! I am Radio ", 2));
13
+ }
14
+ }), i = (e, s) => {
15
+ const o = e.__vccOpts || e;
16
+ for (const [t, a] of s)
17
+ o[t] = a;
18
+ return o;
19
+ }, v = /* @__PURE__ */ i(_, [["__scopeId", "data-v-be223e4b"]]);
20
+ export {
21
+ v as Radio
22
+ };
package/package.json CHANGED
@@ -1,47 +1,52 @@
1
1
  {
2
2
  "name": "@phila/phila-ui-radio",
3
- "private": false,
4
- "version": "0.0.10",
3
+ "version": "0.0.11",
5
4
  "type": "module",
6
- "files": [
7
- "dist"
8
- ],
9
- "main": "./dist/Radio.umd.cjs",
10
- "module": "./dist/Radio.js",
11
- "types": "./dist/types.d.ts",
5
+ "description": "A radio input component for Phila UI.",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.mjs",
8
+ "types": "./dist/index.d.ts",
12
9
  "exports": {
13
10
  ".": {
14
- "import": {
15
- "types": "./dist/types.d.ts",
16
- "default": "./dist/Radio.js"
17
- },
18
- "require": "./dist/Radio.umd.cjs"
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.mjs",
13
+ "require": "./dist/index.js"
19
14
  }
20
15
  },
21
- "scripts": {
22
- "dev": "vite",
23
- "prepublish": "npm i && npm run build",
24
- "build": "vue-tsc && vite build",
25
- "preview": "vite preview"
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "keywords": [
20
+ "ui",
21
+ "radio",
22
+ "vue",
23
+ "component"
24
+ ],
25
+ "author": "",
26
+ "license": "MIT",
27
+ "peerDependencies": {
28
+ "vue": "^3.0.0"
26
29
  },
27
30
  "dependencies": {
28
- "@phila/phila-ui-core": "^1.0.24",
29
- "bulma": "^0.9.4",
30
- "vue": "^3.3.8"
31
+ "@phila/phila-ui-core": "2.1.0"
31
32
  },
32
33
  "devDependencies": {
33
- "@types/node": "^20.10.3",
34
- "@vitejs/plugin-vue": "^4.5.0",
35
- "sass": "^1.69.5",
36
- "typescript": "^5.8.2",
37
- "vite": "^5.0.0",
38
- "vite-plugin-dts": "^3.6.4",
39
- "vite-plugin-lib-inject-css": "^1.3.0",
40
- "vue-tsc": "^2.2.8"
34
+ "@types/node": "^24.0.0",
35
+ "@vitejs/plugin-vue": "^6.0.1",
36
+ "eslint": "^9.0.0",
37
+ "typescript": "^5.8.3",
38
+ "vite": "^7.0.6",
39
+ "vite-plugin-dts": "^4.5.4",
40
+ "vite-plugin-lib-inject-css": "^2.2.2"
41
41
  },
42
- "publishConfig": {
43
- "registry": "https://registry.npmjs.com/",
44
- "access": "public"
45
- },
46
- "gitHead": "f00518592815b1bf558d88f77fc4b6b3a30296e5"
47
- }
42
+ "scripts": {
43
+ "build": "vite build",
44
+ "dev": "vite build --watch",
45
+ "lint": "eslint src --ext .ts,.tsx,.vue",
46
+ "lint:fix": "eslint src --ext .ts,.tsx,.vue --fix",
47
+ "type-check": "tsc --noEmit",
48
+ "clean": "rm -rf dist",
49
+ "format": "prettier --write .",
50
+ "format:check": "prettier --check ."
51
+ }
52
+ }
package/dist/Radio.js DELETED
@@ -1,104 +0,0 @@
1
- import { defineComponent as O, getCurrentInstance as I, ref as N, watch as S, createElementBlock as o, openBlock as l, normalizeClass as w, unref as s, createElementVNode as a, createCommentVNode as v, renderSlot as h, Fragment as p, createTextVNode as D, toDisplayString as n, normalizeStyle as P, renderList as _, withDirectives as z, mergeProps as E, vModelRadio as K } from "vue";
2
- import R from "@phila/phila-ui-core";
3
- const T = {
4
- key: 0,
5
- class: "input-error-msg"
6
- }, U = {
7
- key: 1,
8
- class: "is-field-info"
9
- }, q = {
10
- key: 0,
11
- class: "is-field-info"
12
- }, A = ["id"], F = ["id", "aria-checked", "name", "value"], H = ["for"], { formHelpers: g } = R, { randomID: L } = g, M = {
13
- inheritAttrs: !1
14
- }, J = /* @__PURE__ */ O({
15
- ...M,
16
- __name: "Radio",
17
- props: {
18
- id: { default: L() },
19
- errors: { default() {
20
- return [];
21
- } },
22
- optgroup: { type: Boolean },
23
- disableableOptions: { type: Boolean },
24
- options: { default: () => ({
25
- "option-1": "Option 1",
26
- "option-2": "Option 2",
27
- "option-3": "Option 3"
28
- }) },
29
- name: {},
30
- textKey: { default: "" },
31
- valueKey: { default: "" },
32
- imaskProps: {},
33
- label: { default: "" },
34
- desc: { default: "" },
35
- modelValue: { type: [String, Number, Boolean], default: "" },
36
- numOfColumns: { default: 1 },
37
- small: { type: Boolean, default: !1 }
38
- },
39
- emits: ["update:modelValue", "change"],
40
- setup($, { emit: V }) {
41
- const r = $, m = V, y = I(), { error: c, classes: b, optionText: C, optionValue: f } = g.useInput.useInputComposable(y, r), i = N(r.modelValue);
42
- S(
43
- () => r.modelValue,
44
- (e) => {
45
- i.value = e;
46
- }
47
- );
48
- const k = (e) => {
49
- m("change", e), m("update:modelValue", i.value);
50
- };
51
- return (e, d) => (l(), o("div", {
52
- class: w(["input-wrap input-radio", [s(b), r.small && "small-checkradio"]])
53
- }, [
54
- a("fieldset", null, [
55
- a("legend", null, [
56
- e.label ? (l(), o(p, { key: 0 }, [
57
- D(n(e.label) + " " + n(e.$attrs.required !== void 0 ? "*" : ""), 1)
58
- ], 64)) : h(e.$slots, "label", { key: 1 })
59
- ]),
60
- s(c) ? (l(), o("div", T, [
61
- d[1] || (d[1] = a("span", { class: "icon" }, [
62
- a("i", { class: "fas fa-exclamation-circle" })
63
- ], -1)),
64
- a("span", null, n(s(c)), 1)
65
- ])) : v("", !0),
66
- e.desc ? (l(), o("div", U, n(e.desc), 1)) : (l(), o(p, { key: 2 }, [
67
- e.$slots.desc ? (l(), o("div", q, [
68
- h(e.$slots, "desc")
69
- ])) : v("", !0)
70
- ], 64)),
71
- a("div", {
72
- id: `rd-group-${e.id}`,
73
- style: P(`columns: ${e.numOfColumns} auto`),
74
- role: "radiogroup"
75
- }, [
76
- (l(!0), o(p, null, _(e.options, (u, t) => (l(), o("div", {
77
- key: t,
78
- class: "control"
79
- }, [
80
- z(a("input", E({
81
- id: `rd-${t}-${e.id}`,
82
- "onUpdate:modelValue": d[0] || (d[0] = (B) => i.value = B),
83
- type: "radio",
84
- role: "radio",
85
- "aria-checked": e.modelValue === s(f)(u, t),
86
- name: `rd-${t}-${e.id}`,
87
- class: "is-checkradio",
88
- value: s(f)(u, t),
89
- ref_for: !0
90
- }, e.$attrs, { onChange: k }), null, 16, F), [
91
- [K, i.value]
92
- ]),
93
- a("label", {
94
- for: `rd-${t}-${e.id}`
95
- }, n(s(C)(u)), 9, H)
96
- ]))), 128))
97
- ], 12, A)
98
- ])
99
- ], 2));
100
- }
101
- });
102
- export {
103
- J as default
104
- };
@@ -1 +0,0 @@
1
- (function(e,l){typeof exports=="object"&&typeof module<"u"?module.exports=l(require("vue"),require("@phila/phila-ui-core")):typeof define=="function"&&define.amd?define(["vue","@phila/phila-ui-core"],l):(e=typeof globalThis<"u"?globalThis:e||self,e.Radio=l(e.Vue,e.PhilaUICore))})(this,function(e,l){"use strict";const m={key:0,class:"input-error-msg"},f={key:1,class:"is-field-info"},u={key:0,class:"is-field-info"},k=["id"],h=["id","aria-checked","name","value"],V=["for"],{formHelpers:i}=l,{randomID:B}=i,g={inheritAttrs:!1};return e.defineComponent({...g,__name:"Radio",props:{id:{default:B()},errors:{default(){return[]}},optgroup:{type:Boolean},disableableOptions:{type:Boolean},options:{default:()=>({"option-1":"Option 1","option-2":"Option 2","option-3":"Option 3"})},name:{},textKey:{default:""},valueKey:{default:""},imaskProps:{},label:{default:""},desc:{default:""},modelValue:{type:[String,Number,Boolean],default:""},numOfColumns:{default:1},small:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(y,{emit:E}){const n=y,d=E,$=e.getCurrentInstance(),{error:c,classes:N,optionText:C,optionValue:p}=i.useInput.useInputComposable($,n),a=e.ref(n.modelValue);e.watch(()=>n.modelValue,o=>{a.value=o});const S=o=>{d("change",o),d("update:modelValue",a.value)};return(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["input-wrap input-radio",[e.unref(N),n.small&&"small-checkradio"]])},[e.createElementVNode("fieldset",null,[e.createElementVNode("legend",null,[o.label?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(o.label)+" "+e.toDisplayString(o.$attrs.required!==void 0?"*":""),1)],64)):e.renderSlot(o.$slots,"label",{key:1})]),e.unref(c)?(e.openBlock(),e.createElementBlock("div",m,[r[1]||(r[1]=e.createElementVNode("span",{class:"icon"},[e.createElementVNode("i",{class:"fas fa-exclamation-circle"})],-1)),e.createElementVNode("span",null,e.toDisplayString(e.unref(c)),1)])):e.createCommentVNode("",!0),o.desc?(e.openBlock(),e.createElementBlock("div",f,e.toDisplayString(o.desc),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[o.$slots.desc?(e.openBlock(),e.createElementBlock("div",u,[e.renderSlot(o.$slots,"desc")])):e.createCommentVNode("",!0)],64)),e.createElementVNode("div",{id:`rd-group-${o.id}`,style:e.normalizeStyle(`columns: ${o.numOfColumns} auto`),role:"radiogroup"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options,(s,t)=>(e.openBlock(),e.createElementBlock("div",{key:t,class:"control"},[e.withDirectives(e.createElementVNode("input",e.mergeProps({id:`rd-${t}-${o.id}`,"onUpdate:modelValue":r[0]||(r[0]=b=>a.value=b),type:"radio",role:"radio","aria-checked":o.modelValue===e.unref(p)(s,t),name:`rd-${t}-${o.id}`,class:"is-checkradio",value:e.unref(p)(s,t),ref_for:!0},o.$attrs,{onChange:S}),null,16,h),[[e.vModelRadio,a.value]]),e.createElementVNode("label",{for:`rd-${t}-${o.id}`},e.toDisplayString(e.unref(C)(s)),9,V)]))),128))],12,k)])],2))}})});
package/dist/types.d.ts DELETED
@@ -1,18 +0,0 @@
1
- import { default as Radio } from './Radio.vue';
2
-
3
- declare module 'vue' {
4
- interface GlobalComponents {
5
- Radio: typeof Radio;
6
- }
7
- }
8
- export interface RadioProps {
9
- label?: string;
10
- desc?: string;
11
- modelValue: string | number | boolean;
12
- valueKey?: string;
13
- textKey?: string;
14
- numOfColumns?: string | number;
15
- small?: boolean;
16
- options: object | Array<string | number | object>;
17
- }
18
- export default Radio;