@ucalgary-design-system/radio 1.0.1

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.
Files changed (4) hide show
  1. package/README.md +57 -0
  2. package/index.js +432 -0
  3. package/package.json +24 -0
  4. package/radio.css +1 -0
package/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # Radio
2
+
3
+ This package provides the **Radio** web component.
4
+
5
+ ## Installation
6
+
7
+ Install the component using npm:
8
+
9
+ ```sh
10
+ npm install @ucalgary-design-system/radio
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Import the component into your application:
16
+
17
+ ```ts
18
+ import '@ucalgary-design-system/radio';
19
+ ```
20
+
21
+ Use the component in your HTML:
22
+
23
+ ```html
24
+ <ucds-radio></ucds-radio>
25
+ ```
26
+
27
+ ## Development
28
+
29
+ Build the component:
30
+
31
+ ```sh
32
+ npm run build
33
+ ```
34
+
35
+ Alternatively, build from the monorepo root:
36
+
37
+ ```sh
38
+ npm run build -w @ucalgary-design-system/ucds-radio
39
+ ```
40
+
41
+ Run storybook from the monorepo root.
42
+
43
+ ## Testing
44
+
45
+ Run the test from this package:
46
+
47
+ ```sh
48
+ npm run test
49
+ ```
50
+
51
+ Alternatively, run the tests from the monorepo root:
52
+
53
+ ```sh
54
+ npm run test -w @ucalgary-design-system/ucds-radio
55
+ ```
56
+
57
+
package/index.js ADDED
@@ -0,0 +1,432 @@
1
+ import { unsafeCSS as C, nothing as $, html as p } from "lit";
2
+ import { BaseElement as P } from "@ucalgary-design-system/core";
3
+ import { FormLabel as x } from "@ucalgary-design-system/helper-components";
4
+ import "@ucalgary-design-system/icon";
5
+ /**
6
+ * @license
7
+ * Copyright 2017 Google LLC
8
+ * SPDX-License-Identifier: BSD-3-Clause
9
+ */
10
+ const O = (o) => (e, t) => {
11
+ t !== void 0 ? t.addInitializer(() => {
12
+ customElements.define(o, e);
13
+ }) : customElements.define(o, e);
14
+ };
15
+ /**
16
+ * @license
17
+ * Copyright 2019 Google LLC
18
+ * SPDX-License-Identifier: BSD-3-Clause
19
+ */
20
+ const m = globalThis, v = m.ShadowRoot && (m.ShadyCSS === void 0 || m.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, U = Symbol(), S = /* @__PURE__ */ new WeakMap();
21
+ let A = class {
22
+ constructor(e, t, r) {
23
+ if (this._$cssResult$ = !0, r !== U) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
24
+ this.cssText = e, this.t = t;
25
+ }
26
+ get styleSheet() {
27
+ let e = this.o;
28
+ const t = this.t;
29
+ if (v && e === void 0) {
30
+ const r = t !== void 0 && t.length === 1;
31
+ r && (e = S.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), r && S.set(t, e));
32
+ }
33
+ return e;
34
+ }
35
+ toString() {
36
+ return this.cssText;
37
+ }
38
+ };
39
+ const R = (o) => new A(typeof o == "string" ? o : o + "", void 0, U), T = (o, e) => {
40
+ if (v) o.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
41
+ else for (const t of e) {
42
+ const r = document.createElement("style"), i = m.litNonce;
43
+ i !== void 0 && r.setAttribute("nonce", i), r.textContent = t.cssText, o.appendChild(r);
44
+ }
45
+ }, k = v ? (o) => o : (o) => o instanceof CSSStyleSheet ? ((e) => {
46
+ let t = "";
47
+ for (const r of e.cssRules) t += r.cssText;
48
+ return R(t);
49
+ })(o) : o;
50
+ /**
51
+ * @license
52
+ * Copyright 2017 Google LLC
53
+ * SPDX-License-Identifier: BSD-3-Clause
54
+ */
55
+ const { is: N, defineProperty: q, getOwnPropertyDescriptor: M, getOwnPropertyNames: z, getOwnPropertySymbols: I, getPrototypeOf: D } = Object, h = globalThis, E = h.trustedTypes, j = E ? E.emptyScript : "", g = h.reactiveElementPolyfillSupport, f = (o, e) => o, b = { toAttribute(o, e) {
56
+ switch (e) {
57
+ case Boolean:
58
+ o = o ? j : null;
59
+ break;
60
+ case Object:
61
+ case Array:
62
+ o = o == null ? o : JSON.stringify(o);
63
+ }
64
+ return o;
65
+ }, fromAttribute(o, e) {
66
+ let t = o;
67
+ switch (e) {
68
+ case Boolean:
69
+ t = o !== null;
70
+ break;
71
+ case Number:
72
+ t = o === null ? null : Number(o);
73
+ break;
74
+ case Object:
75
+ case Array:
76
+ try {
77
+ t = JSON.parse(o);
78
+ } catch {
79
+ t = null;
80
+ }
81
+ }
82
+ return t;
83
+ } }, _ = (o, e) => !N(o, e), w = { attribute: !0, type: String, converter: b, reflect: !1, hasChanged: _ };
84
+ Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), h.litPropertyMetadata ?? (h.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
85
+ class u extends HTMLElement {
86
+ static addInitializer(e) {
87
+ this._$Ei(), (this.l ?? (this.l = [])).push(e);
88
+ }
89
+ static get observedAttributes() {
90
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
91
+ }
92
+ static createProperty(e, t = w) {
93
+ if (t.state && (t.attribute = !1), this._$Ei(), this.elementProperties.set(e, t), !t.noAccessor) {
94
+ const r = Symbol(), i = this.getPropertyDescriptor(e, r, t);
95
+ i !== void 0 && q(this.prototype, e, i);
96
+ }
97
+ }
98
+ static getPropertyDescriptor(e, t, r) {
99
+ const { get: i, set: a } = M(this.prototype, e) ?? { get() {
100
+ return this[t];
101
+ }, set(s) {
102
+ this[t] = s;
103
+ } };
104
+ return { get() {
105
+ return i == null ? void 0 : i.call(this);
106
+ }, set(s) {
107
+ const l = i == null ? void 0 : i.call(this);
108
+ a.call(this, s), this.requestUpdate(e, l, r);
109
+ }, configurable: !0, enumerable: !0 };
110
+ }
111
+ static getPropertyOptions(e) {
112
+ return this.elementProperties.get(e) ?? w;
113
+ }
114
+ static _$Ei() {
115
+ if (this.hasOwnProperty(f("elementProperties"))) return;
116
+ const e = D(this);
117
+ e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
118
+ }
119
+ static finalize() {
120
+ if (this.hasOwnProperty(f("finalized"))) return;
121
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(f("properties"))) {
122
+ const t = this.properties, r = [...z(t), ...I(t)];
123
+ for (const i of r) this.createProperty(i, t[i]);
124
+ }
125
+ const e = this[Symbol.metadata];
126
+ if (e !== null) {
127
+ const t = litPropertyMetadata.get(e);
128
+ if (t !== void 0) for (const [r, i] of t) this.elementProperties.set(r, i);
129
+ }
130
+ this._$Eh = /* @__PURE__ */ new Map();
131
+ for (const [t, r] of this.elementProperties) {
132
+ const i = this._$Eu(t, r);
133
+ i !== void 0 && this._$Eh.set(i, t);
134
+ }
135
+ this.elementStyles = this.finalizeStyles(this.styles);
136
+ }
137
+ static finalizeStyles(e) {
138
+ const t = [];
139
+ if (Array.isArray(e)) {
140
+ const r = new Set(e.flat(1 / 0).reverse());
141
+ for (const i of r) t.unshift(k(i));
142
+ } else e !== void 0 && t.push(k(e));
143
+ return t;
144
+ }
145
+ static _$Eu(e, t) {
146
+ const r = t.attribute;
147
+ return r === !1 ? void 0 : typeof r == "string" ? r : typeof e == "string" ? e.toLowerCase() : void 0;
148
+ }
149
+ constructor() {
150
+ super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
151
+ }
152
+ _$Ev() {
153
+ var e;
154
+ this._$ES = new Promise((t) => this.enableUpdating = t), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (e = this.constructor.l) == null || e.forEach((t) => t(this));
155
+ }
156
+ addController(e) {
157
+ var t;
158
+ (this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(e), this.renderRoot !== void 0 && this.isConnected && ((t = e.hostConnected) == null || t.call(e));
159
+ }
160
+ removeController(e) {
161
+ var t;
162
+ (t = this._$EO) == null || t.delete(e);
163
+ }
164
+ _$E_() {
165
+ const e = /* @__PURE__ */ new Map(), t = this.constructor.elementProperties;
166
+ for (const r of t.keys()) this.hasOwnProperty(r) && (e.set(r, this[r]), delete this[r]);
167
+ e.size > 0 && (this._$Ep = e);
168
+ }
169
+ createRenderRoot() {
170
+ const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
171
+ return T(e, this.constructor.elementStyles), e;
172
+ }
173
+ connectedCallback() {
174
+ var e;
175
+ this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (e = this._$EO) == null || e.forEach((t) => {
176
+ var r;
177
+ return (r = t.hostConnected) == null ? void 0 : r.call(t);
178
+ });
179
+ }
180
+ enableUpdating(e) {
181
+ }
182
+ disconnectedCallback() {
183
+ var e;
184
+ (e = this._$EO) == null || e.forEach((t) => {
185
+ var r;
186
+ return (r = t.hostDisconnected) == null ? void 0 : r.call(t);
187
+ });
188
+ }
189
+ attributeChangedCallback(e, t, r) {
190
+ this._$AK(e, r);
191
+ }
192
+ _$EC(e, t) {
193
+ var a;
194
+ const r = this.constructor.elementProperties.get(e), i = this.constructor._$Eu(e, r);
195
+ if (i !== void 0 && r.reflect === !0) {
196
+ const s = (((a = r.converter) == null ? void 0 : a.toAttribute) !== void 0 ? r.converter : b).toAttribute(t, r.type);
197
+ this._$Em = e, s == null ? this.removeAttribute(i) : this.setAttribute(i, s), this._$Em = null;
198
+ }
199
+ }
200
+ _$AK(e, t) {
201
+ var a;
202
+ const r = this.constructor, i = r._$Eh.get(e);
203
+ if (i !== void 0 && this._$Em !== i) {
204
+ const s = r.getPropertyOptions(i), l = typeof s.converter == "function" ? { fromAttribute: s.converter } : ((a = s.converter) == null ? void 0 : a.fromAttribute) !== void 0 ? s.converter : b;
205
+ this._$Em = i, this[i] = l.fromAttribute(t, s.type), this._$Em = null;
206
+ }
207
+ }
208
+ requestUpdate(e, t, r) {
209
+ if (e !== void 0) {
210
+ if (r ?? (r = this.constructor.getPropertyOptions(e)), !(r.hasChanged ?? _)(this[e], t)) return;
211
+ this.P(e, t, r);
212
+ }
213
+ this.isUpdatePending === !1 && (this._$ES = this._$ET());
214
+ }
215
+ P(e, t, r) {
216
+ this._$AL.has(e) || this._$AL.set(e, t), r.reflect === !0 && this._$Em !== e && (this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Set())).add(e);
217
+ }
218
+ async _$ET() {
219
+ this.isUpdatePending = !0;
220
+ try {
221
+ await this._$ES;
222
+ } catch (t) {
223
+ Promise.reject(t);
224
+ }
225
+ const e = this.scheduleUpdate();
226
+ return e != null && await e, !this.isUpdatePending;
227
+ }
228
+ scheduleUpdate() {
229
+ return this.performUpdate();
230
+ }
231
+ performUpdate() {
232
+ var r;
233
+ if (!this.isUpdatePending) return;
234
+ if (!this.hasUpdated) {
235
+ if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
236
+ for (const [a, s] of this._$Ep) this[a] = s;
237
+ this._$Ep = void 0;
238
+ }
239
+ const i = this.constructor.elementProperties;
240
+ if (i.size > 0) for (const [a, s] of i) s.wrapped !== !0 || this._$AL.has(a) || this[a] === void 0 || this.P(a, this[a], s);
241
+ }
242
+ let e = !1;
243
+ const t = this._$AL;
244
+ try {
245
+ e = this.shouldUpdate(t), e ? (this.willUpdate(t), (r = this._$EO) == null || r.forEach((i) => {
246
+ var a;
247
+ return (a = i.hostUpdate) == null ? void 0 : a.call(i);
248
+ }), this.update(t)) : this._$EU();
249
+ } catch (i) {
250
+ throw e = !1, this._$EU(), i;
251
+ }
252
+ e && this._$AE(t);
253
+ }
254
+ willUpdate(e) {
255
+ }
256
+ _$AE(e) {
257
+ var t;
258
+ (t = this._$EO) == null || t.forEach((r) => {
259
+ var i;
260
+ return (i = r.hostUpdated) == null ? void 0 : i.call(r);
261
+ }), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
262
+ }
263
+ _$EU() {
264
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
265
+ }
266
+ get updateComplete() {
267
+ return this.getUpdateComplete();
268
+ }
269
+ getUpdateComplete() {
270
+ return this._$ES;
271
+ }
272
+ shouldUpdate(e) {
273
+ return !0;
274
+ }
275
+ update(e) {
276
+ this._$Ej && (this._$Ej = this._$Ej.forEach((t) => this._$EC(t, this[t]))), this._$EU();
277
+ }
278
+ updated(e) {
279
+ }
280
+ firstUpdated(e) {
281
+ }
282
+ }
283
+ u.elementStyles = [], u.shadowRootOptions = { mode: "open" }, u[f("elementProperties")] = /* @__PURE__ */ new Map(), u[f("finalized")] = /* @__PURE__ */ new Map(), g == null || g({ ReactiveElement: u }), (h.reactiveElementVersions ?? (h.reactiveElementVersions = [])).push("2.0.4");
284
+ /**
285
+ * @license
286
+ * Copyright 2017 Google LLC
287
+ * SPDX-License-Identifier: BSD-3-Clause
288
+ */
289
+ const L = { attribute: !0, type: String, converter: b, reflect: !1, hasChanged: _ }, B = (o = L, e, t) => {
290
+ const { kind: r, metadata: i } = t;
291
+ let a = globalThis.litPropertyMetadata.get(i);
292
+ if (a === void 0 && globalThis.litPropertyMetadata.set(i, a = /* @__PURE__ */ new Map()), a.set(t.name, o), r === "accessor") {
293
+ const { name: s } = t;
294
+ return { set(l) {
295
+ const y = e.get.call(this);
296
+ e.set.call(this, l), this.requestUpdate(s, y, o);
297
+ }, init(l) {
298
+ return l !== void 0 && this.P(s, void 0, o), l;
299
+ } };
300
+ }
301
+ if (r === "setter") {
302
+ const { name: s } = t;
303
+ return function(l) {
304
+ const y = this[s];
305
+ e.call(this, l), this.requestUpdate(s, y, o);
306
+ };
307
+ }
308
+ throw Error("Unsupported decorator location: " + r);
309
+ };
310
+ function c(o) {
311
+ return (e, t) => typeof t == "object" ? B(o, e, t) : ((r, i, a) => {
312
+ const s = i.hasOwnProperty(a);
313
+ return i.constructor.createProperty(a, s ? { ...r, wrapped: !0 } : r), s ? Object.getOwnPropertyDescriptor(i, a) : void 0;
314
+ })(o, e, t);
315
+ }
316
+ const H = ':host{display:block}.form-radio{display:flex;flex-direction:column;gap:var(--ucds-form-component-intra-spacing);width:var(--ucds-form-element-width);max-width:var(--ucds-form-element-maxwidth);--formRadioCheckboxHeight: 1.25rem;--checkmarkHeight: .625rem;--radioHeight: .625rem}.form-radio input[type=checkbox],.form-radio input[type=radio]{position:absolute;opacity:0}.form-radio input[type=checkbox]+label,.form-radio input[type=radio]+label{display:flex;position:relative;width:100%;max-width:555px;padding-left:28px;line-height:var(--formRadioCheckboxHeight);cursor:pointer}.form-radio input[type=checkbox]+label .radio-control,.form-radio input[type=radio]+label .radio-control{content:"";display:block;position:absolute;width:var(--formRadioCheckboxHeight);height:var(--formRadioCheckboxHeight);top:0;left:0;background-color:var(--ucds-color-palette-white);border:var(--ucds-form-element-border-width) solid var(--ucds-color-forms-input-border-rest);transition:background-color .5s ease,border-color .5s ease}.form-radio input[type=checkbox]:hover+label .radio-control,.form-radio input[type=radio]:hover+label .radio-control{border-color:var(--ucds-color-forms-input-border-hover)}.form-radio input[type=checkbox]:active:not(:disabled)+label .radio-control,.form-radio input[type=checkbox]:focus:not(:disabled)+label .radio-control,.form-radio input[type=radio]:active:not(:disabled)+label .radio-control,.form-radio input[type=radio]:focus:not(:disabled)+label .radio-control{outline:var(--ucds-color-action-focus) 2px solid;outline-offset:2px}.form-radio input[type=checkbox]:checked+label .radio-control,.form-radio input[type=radio]:checked+label .radio-control{background-color:var(--ucds-color-forms-input-background-selected);border-color:var(--ucds-color-forms-input-border-selected)}.form-radio input[type=checkbox]:checked+label .radio-control ucds-icon,.form-radio input[type=radio]:checked+label .radio-control ucds-icon{transform:scale(75%);color:var(--ucds-color-icon-primary-inverse)}.form-radio input[type=checkbox]:disabled+label,.form-radio input[type=radio]:disabled+label{color:var(--ucds-color-text-disabled);cursor:default}.form-radio input[type=checkbox]:disabled+label .radio-control,.form-radio input[type=radio]:disabled+label .radio-control{background-color:transparent;border-color:var(--ucds-color-forms-input-border-disabled)}.form-radio input[type=checkbox]:disabled:checked+label .radio-control,.form-radio input[type=radio]:disabled:checked+label .radio-control{background-color:var(--ucds-color-forms-input-background-disabled);border-color:var(--ucds-color-forms-input-border-disabled)}.form-radio input[type=checkbox][error]:not(:disabled)+label .radio-control,.form-radio input[type=checkbox][errors]:not(:disabled)+label .radio-control,.form-radio input[type=radio][error]:not(:disabled)+label .radio-control,.form-radio input[type=radio][errors]:not(:disabled)+label .radio-control{background-color:var(--ucds-color-feedback-error-background-light);border-color:var(--ucds-color-feedback-error-light)}.form-radio input[type=checkbox][error]:not(:disabled)+label .radio-control ucds-icon,.form-radio input[type=checkbox][errors]:not(:disabled)+label .radio-control ucds-icon,.form-radio input[type=radio][error]:not(:disabled)+label .radio-control ucds-icon,.form-radio input[type=radio][errors]:not(:disabled)+label .radio-control ucds-icon{color:var(--ucds-color-feedback-error-light)}.form-radio input[type=radio]+label .radio-control{border-radius:50%}';
317
+ var F = Object.defineProperty, J = Object.getOwnPropertyDescriptor, d = (o, e, t, r) => {
318
+ for (var i = r > 1 ? void 0 : r ? J(e, t) : e, a = o.length - 1, s; a >= 0; a--)
319
+ (s = o[a]) && (i = (r ? s(e, t, i) : s(i)) || i);
320
+ return r && i && F(e, t, i), i;
321
+ };
322
+ let n = class extends P {
323
+ constructor() {
324
+ super(), this.radioID = "radio", this.radioName = "", this.value = "", this.checked = !1, this.disabled = !1, this.required = !1, this.errors = !1, this.error = !1, this.internals = this.attachInternals();
325
+ }
326
+ // Iterate over sibling radios and reset form state.
327
+ _uncheckOtherRadios() {
328
+ var t;
329
+ if (!this.radioName) {
330
+ console.error(`${this.localName}: Property 'name' is required for radio button group functionality and was not set.`);
331
+ return;
332
+ }
333
+ const o = this.form || this.getRootNode(), e = Array.from(o.querySelectorAll(this.localName));
334
+ for (const r of e)
335
+ r !== this && r.form === this.form && r.radioName === this.radioName && (r.checked = !1, (t = r._updateInternals) == null || t.call(r));
336
+ }
337
+ // Update the internal form value.
338
+ _updateInternals() {
339
+ var e;
340
+ this.internals.setFormValue(this.checked ? this.value : null, this.checked ? "true" : ""), this.setAttribute("aria-checked", String(this.checked));
341
+ const o = (e = this.shadowRoot) == null ? void 0 : e.querySelector("input");
342
+ o.checked = this.checked;
343
+ }
344
+ // Handle change event.
345
+ _handleChange({ target: o }) {
346
+ const e = o;
347
+ this.checked = e.checked, this._updateInternals(), this._uncheckOtherRadios();
348
+ }
349
+ // Initialize component and warn if required properties have not been set.
350
+ firstUpdated(o) {
351
+ super.firstUpdated(o), this.form = this.internals.form, this._updateInternals(), this.radioName || console.error(`${this.localName}: Property 'name' is required and was not set.`), this.value || console.error(`${this.localName}: Property 'value' is required and was not set.`);
352
+ }
353
+ // Catch non-click changes.
354
+ update(o) {
355
+ super.update(o), o.has("checked") && o.get("checked") !== void 0 && this._updateInternals();
356
+ }
357
+ // Reset form state.
358
+ formResetCallback() {
359
+ this.checked = !1, this._updateInternals();
360
+ }
361
+ formStateRestoreCallback(o) {
362
+ this.checked = String(o).toLowerCase() === "true", this.checked && this._uncheckOtherRadios();
363
+ }
364
+ render() {
365
+ return p`
366
+ <div class="form-radio">
367
+ <input
368
+ type="radio"
369
+ id="${this.radioID}"
370
+ name="${this.radioName}"
371
+ .value="${this.value}"
372
+ ?checked="${this.checked}"
373
+ ?disabled="${this.disabled}"
374
+ ?required="${this.required}"
375
+ ?errors="${this.errors}"
376
+ ?error="${this.error}"
377
+ @change=${this._handleChange}
378
+ />
379
+ <label for="${this.radioID}" ?disabled=${this.disabled}>
380
+ <span class="radio-control">
381
+ ${this.checked ? p`<ucds-icon name="dot" size="16"></ucds-icon>` : ""}
382
+ </span>
383
+ <span><slot>Radio Label</slot>${this.required ? p`${x.requiredAsteriskTemplate()}` : $}</span>
384
+ </label>
385
+ ${this.error && !this.disabled ? p`<form-error-message text="${this.errorText}"></form-error-message>` : $}
386
+ ${this.helpText ? p`<form-help-message text="${this.helpText}" ?disabled="${this.disabled}"></form-help-message>` : $}
387
+ </div>
388
+ `;
389
+ }
390
+ };
391
+ n.styles = [
392
+ P.styles,
393
+ x.styles,
394
+ C(H)
395
+ ];
396
+ n.formAssociated = !0;
397
+ d([
398
+ c({ type: String, attribute: "input-id" })
399
+ ], n.prototype, "radioID", 2);
400
+ d([
401
+ c({ type: String, attribute: "name" })
402
+ ], n.prototype, "radioName", 2);
403
+ d([
404
+ c({ type: String })
405
+ ], n.prototype, "value", 2);
406
+ d([
407
+ c({ type: Boolean, reflect: !0 })
408
+ ], n.prototype, "checked", 2);
409
+ d([
410
+ c({ type: Boolean, reflect: !0 })
411
+ ], n.prototype, "disabled", 2);
412
+ d([
413
+ c({ type: Boolean, reflect: !0 })
414
+ ], n.prototype, "required", 2);
415
+ d([
416
+ c({ type: Boolean, reflect: !0 })
417
+ ], n.prototype, "errors", 2);
418
+ d([
419
+ c({ type: Boolean, reflect: !0 })
420
+ ], n.prototype, "error", 2);
421
+ d([
422
+ c({ type: String, attribute: "error-text" })
423
+ ], n.prototype, "errorText", 2);
424
+ d([
425
+ c({ type: String, attribute: "help-text" })
426
+ ], n.prototype, "helpText", 2);
427
+ n = d([
428
+ O("ucds-radio")
429
+ ], n);
430
+ export {
431
+ n as Radio
432
+ };
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@ucalgary-design-system/radio",
3
+ "version": "1.0.1",
4
+ "type": "module",
5
+ "main": "index.js",
6
+ "module": "index.js",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./index.js",
10
+ "require": "./index.js"
11
+ }
12
+ },
13
+ "dependencies": {
14
+ "@ucalgary-design-system/core": "^1.0.1",
15
+ "@ucalgary-design-system/helper-components": "^1.0.1",
16
+ "@ucalgary-design-system/icon": "^1.0.1",
17
+ "@ucalgary-design-system/tokens": "^1.0.1",
18
+ "lit": "^3.2.1"
19
+ },
20
+ "description": "A web component for Radio",
21
+ "publishConfig": {
22
+ "access": "public"
23
+ }
24
+ }
package/radio.css ADDED
@@ -0,0 +1 @@
1
+ :root{--ucds-color-palette-brand-red: #d6001c;--ucds-color-palette-brand-gold: #ffcd00;--ucds-color-palette-brand-light-orange: #ffa300;--ucds-color-palette-brand-dark-orange: #ff7b1f;--ucds-color-palette-brand-berry: #9c0534;--ucds-color-palette-brand-rubine: #ce0058;--ucds-color-palette-brand-brown: #6b3529;--ucds-color-palette-brand-teal: #47a67c;--ucds-color-palette-white: #ffffff;--ucds-color-palette-black: #000000;--ucds-color-palette-gray-100: #2d2d2d;--ucds-color-palette-gray-200: #3d3d3d;--ucds-color-palette-gray-250: #4d4d4d;--ucds-color-palette-gray-300: #5d5d5d;--ucds-color-palette-gray-400: #8d8d8d;--ucds-color-palette-gray-500: #adadad;--ucds-color-palette-gray-600: #c0c0c0;--ucds-color-palette-gray-700: #d8d8d8;--ucds-color-palette-gray-800: #e5e5e5;--ucds-color-palette-gray-900: #f4f4f4;--ucds-color-palette-red-100: #3d0910;--ucds-color-palette-red-200: #5c0e18;--ucds-color-palette-red-300: #7a111f;--ucds-color-palette-red-400: #991022;--ucds-color-palette-red-500: #b70b21;--ucds-color-palette-red-600: #d6001c;--ucds-color-palette-red-700: #df3047;--ucds-color-palette-red-800: #ee0e2c;--ucds-color-palette-red-900: #ffadad;--ucds-color-palette-berry-600: #9c0534;--ucds-color-palette-berry-700: #a6192e;--ucds-color-palette-berry-800: #ea7b8a;--ucds-color-palette-berry-900: #f6ebed;--ucds-color-palette-rubine-600: #ce0058;--ucds-color-palette-rubine-800: #ed0a72;--ucds-color-palette-rubine-900: #ffa3c9;--ucds-color-palette-dark-orange-200: #6b3529;--ucds-color-palette-dark-orange-600: #ff671f;--ucds-color-palette-dark-orange-900: #fff2e9;--ucds-color-palette-light-orange-200: #614e00;--ucds-color-palette-light-orange-600: #ffa300;--ucds-color-palette-light-orange-900: #fff6e7;--ucds-color-palette-brown-600: #6c3302;--ucds-color-palette-brown-900: #ca7d68;--ucds-color-surface-page: #ffffff;--ucds-color-surface-primary: #ffffff;--ucds-color-border-neutral: #8d8d8d;--ucds-color-text-primary: #2d2d2d;--ucds-color-text-primary-inverse: #ffffff;--ucds-color-text-secondary: #5d5d5d;--ucds-color-text-error: #df3047;--ucds-color-text-disabled: #e5e5e5;--ucds-color-icon-primary: #2d2d2d;--ucds-color-icon-primary-inverse: #ffffff;--ucds-color-forms-input-background-rest: #ffffff;--ucds-color-forms-input-background-hover: #9c0534;--ucds-color-forms-input-background-active: #9c0534;--ucds-color-forms-input-background-selected: #9c0534;--ucds-color-forms-input-background-disabled: #e5e5e5;--ucds-color-forms-input-background-error: rgb(255 173 173 / 50%);--ucds-color-forms-input-border-rest: #8d8d8d;--ucds-color-forms-input-border-hover: #3d3d3d;--ucds-color-forms-input-border-active: #3d3d3d;--ucds-color-forms-input-border-selected: #9c0534;--ucds-color-forms-input-border-disabled: #e5e5e5;--ucds-color-forms-input-border-error: #df3047;--ucds-color-forms-input-element-disabled: #f4f4f4;--ucds-color-action-rest: #d6001c;--ucds-color-action-hover: #991022;--ucds-color-action-active: #991022;--ucds-color-action-focus: #4d4d4d;--ucds-color-action-visited: #991022;--ucds-color-action-secondary-rest: #2d2d2d;--ucds-color-action-secondary-hover: #4d4d4d;--ucds-color-action-secondary-active: #4d4d4d;--ucds-color-action-secondary-focus: #4d4d4d;--ucds-color-action-inverse-rest: #ffffff;--ucds-color-action-inverse-hover: #e5e5e5;--ucds-color-action-inverse-active: #e5e5e5;--ucds-color-action-inverse-focus: #ffffff;--ucds-color-feedback-error-light: #df3047;--ucds-color-feedback-error-background-light: rgb(255 173 173 / 50%);--ucds-font-base-size: 16px;--ucds-font-base-line-height: 24px;--ucds-font-base-weight-light: 200;--ucds-font-base-weight-normal: 400;--ucds-font-base-weight-medium: 500;--ucds-font-base-weight-semibold: 600;--ucds-font-base-weight-bold: 700;--ucds-font-sans-serif-family: "Proxima Nova", Arial, Helvetica, sans-serif;--ucds-font-serif-family: "Museo Slab", "Proxima Nova", Arial, Helvetica, sans-serif;--ucds-form-element-border-radius: 8px;--ucds-form-element-border-width: 2px;--ucds-form-element-height: 48px;--ucds-form-element-width: 100%;--ucds-form-element-maxwidth: 555px;--ucds-form-element-horizontal-padding: 16px;--ucds-form-component-intra-spacing: 8px;--ucds-form-component-inter-spacing: 16px}