@substrate-system/radio-input 0.0.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/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ THE MIT LICENSE (MIT)
2
+
3
+ Copyright © 2024 Nick Thomas <nichoth@nichoth.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the “Software”), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,99 @@
1
+ # radio input
2
+ ![tests](https://github.com/substrate-system/radio-input/actions/workflows/nodejs.yml/badge.svg)
3
+ [![types](https://img.shields.io/npm/types/@substrate-system/radio-input?style=flat-square)](README.md)
4
+ [![module](https://img.shields.io/badge/module-ESM%2FCJS-blue?style=flat-square)](README.md)
5
+ [![install size](https://packagephobia.com/badge?p=@substrate-system/radio-input)](https://packagephobia.com/result?p=@substrate-system/radio-input)
6
+ [![dependencies](https://img.shields.io/badge/dependencies-zero-brightgreen.svg?style=flat-square)](package.json)
7
+ [![semantic versioning](https://img.shields.io/badge/semver-2.0.0-blue?logo=semver&style=flat-square)](https://semver.org/)
8
+ [![license](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
9
+
10
+ Radio inputs with some style.
11
+
12
+ [See a live demo](https://substrate-system.github.io/radio-input/)
13
+
14
+ <!-- toc -->
15
+
16
+ ## install
17
+
18
+ ```sh
19
+ npm i -S @substrate-system/radio-input
20
+ ```
21
+
22
+ ## API
23
+
24
+ This exposes ESM and common JS via [package.json `exports` field](https://nodejs.org/api/packages.html#exports).
25
+
26
+ ### ESM
27
+ ```js
28
+ import '@substrate-system/radio-input'
29
+ ```
30
+
31
+ ### attributes
32
+
33
+ In addition to standard `input[type=radio]` attributes, you can pass in the following
34
+
35
+ #### `label`
36
+ Pass in some text to use as the label element.
37
+
38
+ ## CSS
39
+
40
+ ### Import CSS
41
+
42
+ ```js
43
+ import '@substrate-system/radio-input/css'
44
+ ```
45
+
46
+ Or minified:
47
+ ```js
48
+ import '@substrate-system/radio-input/css/min'
49
+ ```
50
+
51
+ ### CSS variables
52
+ Override these to customize
53
+
54
+ ```css
55
+ radio-input {
56
+ --form-control-color: #4281CB;
57
+ }
58
+ ```
59
+
60
+ ## Example
61
+ This calls the global function `customElements.define`. Just import, then use
62
+ the tag in your HTML.
63
+
64
+ ```js
65
+ import '@substrate-system/radio-input'
66
+ import '@substrate-system/radio-input/css'
67
+ ```
68
+
69
+ ### HTML
70
+ ```html
71
+ <form>
72
+ <radio-input
73
+ name="example"
74
+ value="example1"
75
+ label="example one"
76
+ ></radio-input>
77
+ <radio-input
78
+ name="example"
79
+ value="example2"
80
+ label="example two"
81
+ ></radio-input>
82
+
83
+ <button type="submit">submit</button>
84
+ </form>
85
+ ```
86
+
87
+ ### pre-built JS
88
+ This package exposes minified JS files too. Copy them to a location that is
89
+ accessible to your web server, then link to them in HTML.
90
+
91
+ #### copy
92
+ ```sh
93
+ cp ./node_modules/@substrate-system/radio-input/dist/index.min.js ./public/radio-input.min.js
94
+ ```
95
+
96
+ #### HTML
97
+ ```html
98
+ <script type="module" src="./radio-input.min.js"></script>
99
+ ```
package/dist/index.cjs ADDED
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var src_exports = {};
21
+ __export(src_exports, {
22
+ RadioInput: () => RadioInput
23
+ });
24
+ module.exports = __toCommonJS(src_exports);
25
+ var import_util = require("@substrate-system/util");
26
+ class RadioInput extends HTMLElement {
27
+ static {
28
+ __name(this, "RadioInput");
29
+ }
30
+ connectedCallback() {
31
+ if (this.innerHTML) return;
32
+ const attrs = Array.from(this.attributes);
33
+ const obj = (0, import_util.attributesAsObject)(attrs);
34
+ const labelText = this.getAttribute("label");
35
+ if (!labelText) throw new Error("Missing label");
36
+ this.innerHTML = `<label class="radio-input">
37
+ <input type="radio" />
38
+ ${labelText}
39
+ </label>`;
40
+ const input = this.querySelector("input");
41
+ (0, import_util.setAttributes)(input, obj);
42
+ }
43
+ }
44
+ customElements.define("radio-input", RadioInput);
45
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["import { attributesAsObject, setAttributes } from '@substrate-system/util'\n\n// for docuement.querySelector\ndeclare global {\n interface HTMLElementTagNameMap {\n 'radio-input': RadioInput\n }\n}\n\nexport class RadioInput extends HTMLElement {\n connectedCallback () {\n if (this.innerHTML) return\n const attrs = Array.from(this.attributes)\n const obj = attributesAsObject(attrs)\n const labelText = this.getAttribute('label')\n\n if (!labelText) throw new Error('Missing label')\n\n this.innerHTML = `<label class=\"radio-input\">\n <input type=\"radio\" />\n ${labelText}\n </label>`\n\n const input = this.querySelector('input')!\n setAttributes(input, obj)\n }\n}\n\ncustomElements.define('radio-input', RadioInput)\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAkD;AAS3C,MAAM,mBAAmB,YAAY;AAAA,EAT5C,OAS4C;AAAA;AAAA;AAAA,EACxC,oBAAqB;AACjB,QAAI,KAAK,UAAW;AACpB,UAAM,QAAQ,MAAM,KAAK,KAAK,UAAU;AACxC,UAAM,UAAM,gCAAmB,KAAK;AACpC,UAAM,YAAY,KAAK,aAAa,OAAO;AAE3C,QAAI,CAAC,UAAW,OAAM,IAAI,MAAM,eAAe;AAE/C,SAAK,YAAY;AAAA;AAAA,cAEX,SAAS;AAAA;AAGf,UAAM,QAAQ,KAAK,cAAc,OAAO;AACxC,mCAAc,OAAO,GAAG;AAAA,EAC5B;AACJ;AAEA,eAAe,OAAO,eAAe,UAAU;",
6
+ "names": []
7
+ }
@@ -0,0 +1,9 @@
1
+ declare global {
2
+ interface HTMLElementTagNameMap {
3
+ 'radio-input': RadioInput;
4
+ }
5
+ }
6
+ export declare class RadioInput extends HTMLElement {
7
+ connectedCallback(): void;
8
+ }
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,aAAa,EAAE,UAAU,CAAA;KAC5B;CACJ;AAED,qBAAa,UAAW,SAAQ,WAAW;IACvC,iBAAiB;CAgBpB"}
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { attributesAsObject, setAttributes } from "@substrate-system/util";
4
+ class RadioInput extends HTMLElement {
5
+ static {
6
+ __name(this, "RadioInput");
7
+ }
8
+ connectedCallback() {
9
+ if (this.innerHTML) return;
10
+ const attrs = Array.from(this.attributes);
11
+ const obj = attributesAsObject(attrs);
12
+ const labelText = this.getAttribute("label");
13
+ if (!labelText) throw new Error("Missing label");
14
+ this.innerHTML = `<label class="radio-input">
15
+ <input type="radio" />
16
+ ${labelText}
17
+ </label>`;
18
+ const input = this.querySelector("input");
19
+ setAttributes(input, obj);
20
+ }
21
+ }
22
+ customElements.define("radio-input", RadioInput);
23
+ export {
24
+ RadioInput
25
+ };
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["import { attributesAsObject, setAttributes } from '@substrate-system/util'\n\n// for docuement.querySelector\ndeclare global {\n interface HTMLElementTagNameMap {\n 'radio-input': RadioInput\n }\n}\n\nexport class RadioInput extends HTMLElement {\n connectedCallback () {\n if (this.innerHTML) return\n const attrs = Array.from(this.attributes)\n const obj = attributesAsObject(attrs)\n const labelText = this.getAttribute('label')\n\n if (!labelText) throw new Error('Missing label')\n\n this.innerHTML = `<label class=\"radio-input\">\n <input type=\"radio\" />\n ${labelText}\n </label>`\n\n const input = this.querySelector('input')!\n setAttributes(input, obj)\n }\n}\n\ncustomElements.define('radio-input', RadioInput)\n"],
5
+ "mappings": ";;AAAA,SAAS,oBAAoB,qBAAqB;AAS3C,MAAM,mBAAmB,YAAY;AAAA,EAT5C,OAS4C;AAAA;AAAA;AAAA,EACxC,oBAAqB;AACjB,QAAI,KAAK,UAAW;AACpB,UAAM,QAAQ,MAAM,KAAK,KAAK,UAAU;AACxC,UAAM,MAAM,mBAAmB,KAAK;AACpC,UAAM,YAAY,KAAK,aAAa,OAAO;AAE3C,QAAI,CAAC,UAAW,OAAM,IAAI,MAAM,eAAe;AAE/C,SAAK,YAAY;AAAA;AAAA,cAEX,SAAS;AAAA;AAGf,UAAM,QAAQ,KAAK,cAAc,OAAO;AACxC,kBAAc,OAAO,GAAG;AAAA,EAC5B;AACJ;AAEA,eAAe,OAAO,eAAe,UAAU;",
6
+ "names": []
7
+ }
@@ -0,0 +1,5 @@
1
+ var c=Object.defineProperty;var n=(e,t)=>c(e,"name",{value:t,configurable:!0});var b=Object.defineProperty,s=n((e,t)=>b(e,"name",{value:t,configurable:!0}),"__name");function f(e){return e.map(t=>t.name+(t.value===""?"":`="${t.value}"`)).join(" ")}n(f,"attributesToString");s(f,"attributesToString");function u(e){return e.reduce((t,r)=>(t[r.name]=r.value||!0,t),{})}n(u,"attributesAsObject");s(u,"attributesAsObject");function m(e){return Object.keys(e).map(t=>t+(e[t]===!0?"":`="${e[t]}"`)).join(" ")}n(m,"objectToString");s(m,"objectToString");function a(e,t){for(let r in t){let i=t[r];i===!1?e.removeAttribute(r):e.setAttribute(r,i===!0?"":i)}}n(a,"setAttributes");s(a,"setAttributes");var o=class extends HTMLElement{static{n(this,"RadioInput")}connectedCallback(){if(this.innerHTML)return;let t=Array.from(this.attributes),r=u(t),i=this.getAttribute("label");if(!i)throw new Error("Missing label");this.innerHTML=`<label class="radio-input">
2
+ <input type="radio" />
3
+ ${i}
4
+ </label>`;let l=this.querySelector("input");a(l,r)}};customElements.define("radio-input",o);export{o as RadioInput};
5
+ //# sourceMappingURL=index.min.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../node_modules/@substrate-system/util/src/index.ts", "../src/index.ts"],
4
+ "sourcesContent": ["/**\n * Get attributes from an HTMLElement, and return them as a string\n * like `key=val`.\n * @param {Attr[]} attrs An array of the attributes\n * @returns {string} The attributes as a string like `key=val`\n */\nexport function attributesToString (attrs:Attr[]):string {\n return attrs.map(attr => attr.name + (attr.value === '' ?\n '' :\n `=\"${attr.value}\"`))\n .join(' ')\n}\n\n/**\n * Return a new object of key value pairs given an array of attributes.\n *\n * @param attrs An array of attributes\n * @returns {Record<string, string|true>} An object of key value pairs, or\n * key -> true for boolean attributes\n */\nexport function attributesAsObject (attrs:Attr[]):Record<string, string|true> {\n return attrs.reduce((acc, attr) => {\n acc[attr.name] = attr.value || true\n return acc\n }, {})\n}\n\nexport function objectToString (obj:Record<string, string|true>):string {\n return Object.keys(obj).map(k => {\n return k + (obj[k] === true ? '' : `=\"${obj[k]}\"`)\n }).join(' ')\n}\n\nexport default {\n attributesToString,\n attributesAsObject,\n setAttributes\n}\n\nexport function setAttributes (el:HTMLElement, attrs:Record<string, string|boolean>) {\n for (const key in attrs) {\n const val = attrs[key]\n if (val === false) {\n el.removeAttribute(key)\n } else {\n el.setAttribute(key, (val === true ? '' : val))\n }\n }\n}\n", "import { attributesAsObject, setAttributes } from '@substrate-system/util'\n\n// for docuement.querySelector\ndeclare global {\n interface HTMLElementTagNameMap {\n 'radio-input': RadioInput\n }\n}\n\nexport class RadioInput extends HTMLElement {\n connectedCallback () {\n if (this.innerHTML) return\n const attrs = Array.from(this.attributes)\n const obj = attributesAsObject(attrs)\n const labelText = this.getAttribute('label')\n\n if (!labelText) throw new Error('Missing label')\n\n this.innerHTML = `<label class=\"radio-input\">\n <input type=\"radio\" />\n ${labelText}\n </label>`\n\n const input = this.querySelector('input')!\n setAttributes(input, obj)\n }\n}\n\ncustomElements.define('radio-input', RadioInput)\n"],
5
+ "mappings": "sKAMO,SAASA,EAAoBC,EAAqB,CACrD,OAAOA,EAAM,IAAIC,GAAQA,EAAK,MAAQA,EAAK,QAAU,GACjD,GACA,KAAKA,EAAK,KAAK,IAAI,EAClB,KAAK,GAAG,CACjB,CALgBC,EAAAH,EAAA,sBAAAG,EAAAH,EAAA,oBAAA,EAcT,SAASI,EAAoBH,EAA0C,CAC1E,OAAOA,EAAM,OAAO,CAACI,EAAKH,KACtBG,EAAIH,EAAK,IAAI,EAAIA,EAAK,OAAS,GACxBG,GACR,CAAC,CAAC,CACT,CALgBF,EAAAC,EAAA,sBAAAD,EAAAC,EAAA,oBAAA,EAOT,SAASE,EAAgBC,EAAwC,CACpE,OAAO,OAAO,KAAKA,CAAG,EAAE,IAAIC,GACjBA,GAAKD,EAAIC,CAAC,IAAM,GAAO,GAAK,KAAKD,EAAIC,CAAC,CAAC,IACjD,EAAE,KAAK,GAAG,CACf,CAJgBL,EAAAG,EAAA,kBAAAH,EAAAG,EAAA,gBAAA,EAYT,SAASG,EAAeC,EAAgBC,EAAsC,CACjF,QAAWC,KAAOD,EAAO,CACrB,IAAME,EAAMF,EAAMC,CAAG,EACjBC,IAAQ,GACRH,EAAG,gBAAgBE,CAAG,EAEtBF,EAAG,aAAaE,EAAMC,IAAQ,GAAO,GAAKA,CAAI,CAEtD,CACJ,CATgBC,EAAAL,EAAA,iBAAAK,EAAAL,EAAA,eAAA,EC9BT,IAAMM,EAAN,cAAyB,WAAY,CAT5C,MAS4C,CAAAC,EAAA,mBACxC,mBAAqB,CACjB,GAAI,KAAK,UAAW,OACpB,IAAMC,EAAQ,MAAM,KAAK,KAAK,UAAU,EAClCC,EAAMC,EAAmBF,CAAK,EAC9BG,EAAY,KAAK,aAAa,OAAO,EAE3C,GAAI,CAACA,EAAW,MAAM,IAAI,MAAM,eAAe,EAE/C,KAAK,UAAY;AAAA;AAAA,cAEXA,CAAS;AAAA,kBAGf,IAAMC,EAAQ,KAAK,cAAc,OAAO,EACxCC,EAAcD,EAAOH,CAAG,CAC5B,CACJ,EAEA,eAAe,OAAO,cAAeH,CAAU",
6
+ "names": ["attributesToString", "attrs", "attr", "__name", "attributesAsObject", "acc", "objectToString", "obj", "k", "setAttributes", "el", "attrs", "key", "val", "__name", "RadioInput", "__name", "attrs", "obj", "attributesAsObject", "labelText", "input", "setAttributes"]
7
+ }
package/dist/meta.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "inputs": {
3
+ "src/index.ts": {
4
+ "bytes": 797,
5
+ "imports": [],
6
+ "format": "esm"
7
+ }
8
+ },
9
+ "outputs": {
10
+ "dist/index.js.map": {
11
+ "imports": [],
12
+ "exports": [],
13
+ "inputs": {},
14
+ "bytes": 1327
15
+ },
16
+ "dist/index.js": {
17
+ "imports": [
18
+ {
19
+ "path": "@substrate-system/util",
20
+ "kind": "import-statement",
21
+ "external": true
22
+ }
23
+ ],
24
+ "exports": [
25
+ "RadioInput"
26
+ ],
27
+ "entryPoint": "src/index.ts",
28
+ "inputs": {
29
+ "src/index.ts": {
30
+ "bytesInOutput": 675
31
+ }
32
+ },
33
+ "bytes": 863
34
+ }
35
+ }
36
+ }
package/dist/style.css ADDED
@@ -0,0 +1,50 @@
1
+ :root {
2
+ --form-control-color: #4281CB;
3
+ }
4
+
5
+ radio-input .radio-input {
6
+ margin-right: 1rem;
7
+ cursor: pointer;
8
+
9
+ font-size: 1.5rem;
10
+ display: grid;
11
+ grid-template-columns: 1em auto;
12
+ gap: 0.5em;
13
+ }
14
+
15
+ radio-input .radio-input input {
16
+ cursor: pointer;
17
+ }
18
+
19
+ radio-input .radio-input input[type="radio"] {
20
+ -webkit-appearance: none;
21
+ appearance: none;
22
+ /* For iOS < 15 to remove gradient background */
23
+ background-color: #fff;
24
+ margin: 0;
25
+ font: inherit;
26
+ color: currentColor;
27
+ width: 1.15em;
28
+ height: 1.15em;
29
+ border: 0.15em solid currentColor;
30
+ border-radius: 50%;
31
+ display: grid;
32
+ place-content: center;
33
+ }
34
+
35
+ radio-input .radio-input input[type="radio"]::before {
36
+ content: "";
37
+ width: 0.65em;
38
+ height: 0.65em;
39
+ border-radius: 50%;
40
+ transform: scale(0);
41
+ transition: 120ms transform ease-in-out;
42
+ box-shadow: inset 1em 1em var(--form-control-color);
43
+ }
44
+
45
+ radio-input .radio-input input[type="radio"]:checked::before {
46
+ appearance: initial;
47
+ transform: scale(1);
48
+ }
49
+
50
+ /*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9pbmRleC5jc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7SUFDSSw2QkFBNkI7QUFDakM7O0FBR0k7UUFDSSxrQkFBa0I7UUFDbEIsZUFBZTs7UUFLZixpQkFBaUI7UUFDakIsYUFBYTtRQUNiLCtCQUErQjtRQUMvQixVQUFVO0lBZ0NkOztBQXZDSTtZQUNJLGVBQWU7UUFDbkI7O0FBT0E7WUFDSSx3QkFBd0I7WUFDeEIsZ0JBQWdCO1lBQ2hCLCtDQUErQztZQUMvQyxzQkFBc0I7WUFDdEIsU0FBUztZQUNULGFBQWE7WUFDYixtQkFBbUI7WUFDbkIsYUFBYTtZQUNiLGNBQWM7WUFDZCxpQ0FBaUM7WUFDakMsa0JBQWtCO1lBQ2xCLGFBQWE7WUFDYixxQkFBcUI7UUFnQnpCOztBQWRJO2dCQUNJLFdBQVc7Z0JBQ1gsYUFBYTtnQkFDYixjQUFjO2dCQUNkLGtCQUFrQjtnQkFDbEIsbUJBQW1CO2dCQUNuQix1Q0FBdUM7Z0JBQ3ZDLG1EQUFtRDtZQUN2RDs7QUFFSjtnQkFDUSxtQkFBbUI7Z0JBQ25CLG1CQUFtQjtZQUN2QiIsImZpbGUiOiJzcmMvaW5kZXguY3NzIiwic291cmNlc0NvbnRlbnQiOlsiOnJvb3Qge1xuICAgIC0tZm9ybS1jb250cm9sLWNvbG9yOiAjNDI4MUNCO1xufVxuXG5yYWRpby1pbnB1dCB7XG4gICAgJiAucmFkaW8taW5wdXQge1xuICAgICAgICBtYXJnaW4tcmlnaHQ6IDFyZW07XG4gICAgICAgIGN1cnNvcjogcG9pbnRlcjtcbiAgICAgICAgJiBpbnB1dCB7XG4gICAgICAgICAgICBjdXJzb3I6IHBvaW50ZXI7XG4gICAgICAgIH1cblxuICAgICAgICBmb250LXNpemU6IDEuNXJlbTtcbiAgICAgICAgZGlzcGxheTogZ3JpZDtcbiAgICAgICAgZ3JpZC10ZW1wbGF0ZS1jb2x1bW5zOiAxZW0gYXV0bztcbiAgICAgICAgZ2FwOiAwLjVlbTtcblxuICAgICAgICAmIGlucHV0W3R5cGU9XCJyYWRpb1wiXSB7XG4gICAgICAgICAgICAtd2Via2l0LWFwcGVhcmFuY2U6IG5vbmU7XG4gICAgICAgICAgICBhcHBlYXJhbmNlOiBub25lO1xuICAgICAgICAgICAgLyogRm9yIGlPUyA8IDE1IHRvIHJlbW92ZSBncmFkaWVudCBiYWNrZ3JvdW5kICovXG4gICAgICAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiAjZmZmO1xuICAgICAgICAgICAgbWFyZ2luOiAwO1xuICAgICAgICAgICAgZm9udDogaW5oZXJpdDtcbiAgICAgICAgICAgIGNvbG9yOiBjdXJyZW50Q29sb3I7XG4gICAgICAgICAgICB3aWR0aDogMS4xNWVtO1xuICAgICAgICAgICAgaGVpZ2h0OiAxLjE1ZW07XG4gICAgICAgICAgICBib3JkZXI6IDAuMTVlbSBzb2xpZCBjdXJyZW50Q29sb3I7XG4gICAgICAgICAgICBib3JkZXItcmFkaXVzOiA1MCU7XG4gICAgICAgICAgICBkaXNwbGF5OiBncmlkO1xuICAgICAgICAgICAgcGxhY2UtY29udGVudDogY2VudGVyO1xuXG4gICAgICAgICAgICAmOjpiZWZvcmUge1xuICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFwiXCI7XG4gICAgICAgICAgICAgICAgd2lkdGg6IDAuNjVlbTtcbiAgICAgICAgICAgICAgICBoZWlnaHQ6IDAuNjVlbTtcbiAgICAgICAgICAgICAgICBib3JkZXItcmFkaXVzOiA1MCU7XG4gICAgICAgICAgICAgICAgdHJhbnNmb3JtOiBzY2FsZSgwKTtcbiAgICAgICAgICAgICAgICB0cmFuc2l0aW9uOiAxMjBtcyB0cmFuc2Zvcm0gZWFzZS1pbi1vdXQ7XG4gICAgICAgICAgICAgICAgYm94LXNoYWRvdzogaW5zZXQgMWVtIDFlbSB2YXIoLS1mb3JtLWNvbnRyb2wtY29sb3IpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICY6Y2hlY2tlZDo6YmVmb3JlIHtcbiAgICAgICAgICAgICAgICBhcHBlYXJhbmNlOiBpbml0aWFsO1xuICAgICAgICAgICAgICAgIHRyYW5zZm9ybTogc2NhbGUoMSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG59XG4iXX0= */
@@ -0,0 +1,2 @@
1
+ :root{--form-control-color:#4281cb}radio-input .radio-input{cursor:pointer;display:grid;font-size:1.5rem;gap:.5em;grid-template-columns:1em auto;margin-right:1rem}radio-input .radio-input input{cursor:pointer}radio-input .radio-input input[type=radio]{-webkit-appearance:none;appearance:none;background-color:#fff;border:.15em solid;border-radius:50%;color:currentColor;display:grid;font:inherit;height:1.15em;margin:0;place-content:center;width:1.15em}radio-input .radio-input input[type=radio]:before{border-radius:50%;box-shadow:inset 1em 1em var(--form-control-color);content:"";height:.65em;transform:scale(0);transition:transform .12s ease-in-out;width:.65em}radio-input .radio-input input[type=radio]:checked:before{appearance:none;transform:scale(1)}
2
+ /*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9pbmRleC5jc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFDSSw0QkFDSixDQUdJLHlCQUVJLGNBQWUsQ0FNZixZQUFhLENBRGIsZ0JBQWlCLENBR2pCLFFBQVUsQ0FEViw4QkFBK0IsQ0FSL0IsaUJBeUNKLENBdkNJLCtCQUNJLGNBQ0osQ0FPQSwyQ0FDSSx1QkFBd0IsQ0FDeEIsZUFBZ0IsQ0FFaEIscUJBQXNCLENBTXRCLGtCQUFpQyxDQUNqQyxpQkFBa0IsQ0FKbEIsa0JBQW1CLENBS25CLFlBQWEsQ0FOYixZQUFhLENBR2IsYUFBYyxDQUpkLFFBQVMsQ0FRVCxvQkFBcUIsQ0FMckIsWUFxQkosQ0FkSSxrREFJSSxpQkFBa0IsQ0FHbEIsa0RBQW1ELENBTm5ELFVBQVcsQ0FFWCxZQUFjLENBRWQsa0JBQW1CLENBQ25CLHFDQUF1QyxDQUp2QyxXQU1KLENBRUosMERBQ1EsZUFBbUIsQ0FDbkIsa0JBQ0oiLCJmaWxlIjoic3JjL2luZGV4LmNzcyIsInNvdXJjZXNDb250ZW50IjpbIjpyb290IHtcbiAgICAtLWZvcm0tY29udHJvbC1jb2xvcjogIzQyODFDQjtcbn1cblxucmFkaW8taW5wdXQge1xuICAgICYgLnJhZGlvLWlucHV0IHtcbiAgICAgICAgbWFyZ2luLXJpZ2h0OiAxcmVtO1xuICAgICAgICBjdXJzb3I6IHBvaW50ZXI7XG4gICAgICAgICYgaW5wdXQge1xuICAgICAgICAgICAgY3Vyc29yOiBwb2ludGVyO1xuICAgICAgICB9XG5cbiAgICAgICAgZm9udC1zaXplOiAxLjVyZW07XG4gICAgICAgIGRpc3BsYXk6IGdyaWQ7XG4gICAgICAgIGdyaWQtdGVtcGxhdGUtY29sdW1uczogMWVtIGF1dG87XG4gICAgICAgIGdhcDogMC41ZW07XG5cbiAgICAgICAgJiBpbnB1dFt0eXBlPVwicmFkaW9cIl0ge1xuICAgICAgICAgICAgLXdlYmtpdC1hcHBlYXJhbmNlOiBub25lO1xuICAgICAgICAgICAgYXBwZWFyYW5jZTogbm9uZTtcbiAgICAgICAgICAgIC8qIEZvciBpT1MgPCAxNSB0byByZW1vdmUgZ3JhZGllbnQgYmFja2dyb3VuZCAqL1xuICAgICAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogI2ZmZjtcbiAgICAgICAgICAgIG1hcmdpbjogMDtcbiAgICAgICAgICAgIGZvbnQ6IGluaGVyaXQ7XG4gICAgICAgICAgICBjb2xvcjogY3VycmVudENvbG9yO1xuICAgICAgICAgICAgd2lkdGg6IDEuMTVlbTtcbiAgICAgICAgICAgIGhlaWdodDogMS4xNWVtO1xuICAgICAgICAgICAgYm9yZGVyOiAwLjE1ZW0gc29saWQgY3VycmVudENvbG9yO1xuICAgICAgICAgICAgYm9yZGVyLXJhZGl1czogNTAlO1xuICAgICAgICAgICAgZGlzcGxheTogZ3JpZDtcbiAgICAgICAgICAgIHBsYWNlLWNvbnRlbnQ6IGNlbnRlcjtcblxuICAgICAgICAgICAgJjo6YmVmb3JlIHtcbiAgICAgICAgICAgICAgICBjb250ZW50OiBcIlwiO1xuICAgICAgICAgICAgICAgIHdpZHRoOiAwLjY1ZW07XG4gICAgICAgICAgICAgICAgaGVpZ2h0OiAwLjY1ZW07XG4gICAgICAgICAgICAgICAgYm9yZGVyLXJhZGl1czogNTAlO1xuICAgICAgICAgICAgICAgIHRyYW5zZm9ybTogc2NhbGUoMCk7XG4gICAgICAgICAgICAgICAgdHJhbnNpdGlvbjogMTIwbXMgdHJhbnNmb3JtIGVhc2UtaW4tb3V0O1xuICAgICAgICAgICAgICAgIGJveC1zaGFkb3c6IGluc2V0IDFlbSAxZW0gdmFyKC0tZm9ybS1jb250cm9sLWNvbG9yKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAmOmNoZWNrZWQ6OmJlZm9yZSB7XG4gICAgICAgICAgICAgICAgYXBwZWFyYW5jZTogaW5pdGlhbDtcbiAgICAgICAgICAgICAgICB0cmFuc2Zvcm06IHNjYWxlKDEpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxufVxuIl19 */
package/package.json ADDED
@@ -0,0 +1,94 @@
1
+ {
2
+ "name": "@substrate-system/radio-input",
3
+ "type": "module",
4
+ "version": "0.0.0",
5
+ "main": "dist/index.js",
6
+ "files": [
7
+ "./dist/*"
8
+ ],
9
+ "scripts": {
10
+ "lint": "eslint \"./**/*.{ts,js}\"",
11
+ "build-tests": "esbuild test/index.ts --target=es2020 --bundle --keep-names > test/test-bundle.js",
12
+ "test": "npm run lint && npm run build && npm run build-tests && npm run test-tape-run",
13
+ "test-tape-run": "cat test/index.html | tape-run --input=html --static=test | tap-spec",
14
+ "build-css": "postcss src/index.css --use postcss-nesting > dist/style.css",
15
+ "build-css:min": "postcss src/index.css --use cssnano postcss-nesting > dist/style.min.css",
16
+ "build-cjs": "esbuild src/*.ts --format=cjs --keep-names --tsconfig=tsconfig.build.json --outdir=./dist --out-extension:.js=.cjs --sourcemap",
17
+ "build-esm": "esbuild src/*.ts --format=esm --metafile=dist/meta.json --keep-names --tsconfig=tsconfig.build.json --outdir=./dist --sourcemap && tsc --emitDeclarationOnly --project tsconfig.build.json --outDir dist",
18
+ "build-esm:min": "esbuild ./src/*.ts --format=esm --keep-names --bundle --tsconfig=tsconfig.build.json --minify --out-extension:.js=.min.js --outdir=./dist --sourcemap",
19
+ "build-example": "mkdir -p ./public && rm -rf ./public/* && vite --base=\"/example\" build",
20
+ "build-docs": "typedoc --tsconfig tsconfig.build.json ./src/index.ts",
21
+ "build": "mkdir -p ./dist && rm -rf ./dist/* && npm run build-cjs && npm run build-esm && npm run build-esm:min && npm run build-css && npm run build-css:min",
22
+ "start": "vite",
23
+ "toc": "markdown-toc --maxdepth 3 -i README.md",
24
+ "preversion": "npm run lint && stylelint src/*.css",
25
+ "version": "npm run toc && auto-changelog -p --template keepachangelog --breaking-pattern 'BREAKING CHANGE:' && git add CHANGELOG.md README.md",
26
+ "postversion": "git push --follow-tags && npm publish",
27
+ "prepublishOnly": "npm run build"
28
+ },
29
+ "exports": {
30
+ ".": {
31
+ "import": "./dist/index.js",
32
+ "require": "./dist/index.cjs"
33
+ },
34
+ "./css": "./dist/style.css",
35
+ "./css/min": "./dist/style.min.css",
36
+ "./*": {
37
+ "import": [
38
+ "./dist/*.js",
39
+ "./dist/*"
40
+ ],
41
+ "require": [
42
+ "./dist/*.cjs",
43
+ "./dist/*"
44
+ ]
45
+ }
46
+ },
47
+ "dependencies": {
48
+ "@substrate-system/util": "^0.1.6"
49
+ },
50
+ "devDependencies": {
51
+ "@bicycle-codes/debug": "^0.6.13",
52
+ "@bicycle-codes/dom": "^0.0.23",
53
+ "@bicycle-codes/tapzero": "^0.10.0",
54
+ "@typescript-eslint/eslint-plugin": "^7.9.0",
55
+ "@typescript-eslint/parser": "^7.9.0",
56
+ "auto-changelog": "^2.4.0",
57
+ "cssnano": "^7.0.3",
58
+ "esbuild": "^0.23.0",
59
+ "eslint": "^8.57.0",
60
+ "eslint-config-standard": "^17.1.0",
61
+ "markdown-toc": "^1.2.0",
62
+ "postcss": "^8.4.38",
63
+ "postcss-cli": "^11.0.0",
64
+ "postcss-nesting": "^12.1.5",
65
+ "stylelint": "^16.7.0",
66
+ "stylelint-config-standard": "^36.0.1",
67
+ "tap-spec": "^5.0.0",
68
+ "tape-run": "^11.0.0",
69
+ "typedoc": "^0.26.2",
70
+ "typescript": "^5.4.5",
71
+ "vite": "^5.2.11"
72
+ },
73
+ "author": "nichoth <nichoth@nichoth.com> (https://nichoth.com)",
74
+ "license": "MIT",
75
+ "description": "Radio input with style",
76
+ "directories": {
77
+ "example": "example",
78
+ "test": "test"
79
+ },
80
+ "repository": {
81
+ "type": "git",
82
+ "url": "git+https://github.com/substrate-system/radio-input.git"
83
+ },
84
+ "keywords": [
85
+ "radio",
86
+ "web",
87
+ "component"
88
+ ],
89
+ "types": "./dist/index.d.ts",
90
+ "bugs": {
91
+ "url": "https://github.com/substrate-system/radio-input/issues"
92
+ },
93
+ "homepage": "https://github.com/substrate-system/radio-input#readme"
94
+ }