@digital2analogue2/parsimony-components 0.1.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/custom-elements.json +3751 -0
- package/dist/alert/alert.d.ts +36 -0
- package/dist/alert/alert.d.ts.map +1 -0
- package/dist/alert/alert.js +179 -0
- package/dist/alert/alert.js.map +1 -0
- package/dist/alert/alert.stories.d.ts +12 -0
- package/dist/alert/alert.stories.d.ts.map +1 -0
- package/dist/alert/alert.stories.js +59 -0
- package/dist/alert/alert.stories.js.map +1 -0
- package/dist/avatar/avatar.d.ts +37 -0
- package/dist/avatar/avatar.d.ts.map +1 -0
- package/dist/avatar/avatar.js +150 -0
- package/dist/avatar/avatar.js.map +1 -0
- package/dist/avatar/avatar.stories.d.ts +10 -0
- package/dist/avatar/avatar.stories.d.ts.map +1 -0
- package/dist/avatar/avatar.stories.js +56 -0
- package/dist/avatar/avatar.stories.js.map +1 -0
- package/dist/badge/badge.d.ts +31 -0
- package/dist/badge/badge.d.ts.map +1 -0
- package/dist/badge/badge.js +104 -0
- package/dist/badge/badge.js.map +1 -0
- package/dist/badge/badge.stories.d.ts +9 -0
- package/dist/badge/badge.stories.d.ts.map +1 -0
- package/dist/badge/badge.stories.js +35 -0
- package/dist/badge/badge.stories.js.map +1 -0
- package/dist/button/button.d.ts +50 -0
- package/dist/button/button.d.ts.map +1 -0
- package/dist/button/button.js +237 -0
- package/dist/button/button.js.map +1 -0
- package/dist/button/button.stories.d.ts +12 -0
- package/dist/button/button.stories.d.ts.map +1 -0
- package/dist/button/button.stories.js +44 -0
- package/dist/button/button.stories.js.map +1 -0
- package/dist/card/card.d.ts +32 -0
- package/dist/card/card.d.ts.map +1 -0
- package/dist/card/card.js +107 -0
- package/dist/card/card.js.map +1 -0
- package/dist/card/card.stories.d.ts +9 -0
- package/dist/card/card.stories.d.ts.map +1 -0
- package/dist/card/card.stories.js +39 -0
- package/dist/card/card.stories.js.map +1 -0
- package/dist/checkbox/checkbox.d.ts +44 -0
- package/dist/checkbox/checkbox.d.ts.map +1 -0
- package/dist/checkbox/checkbox.js +201 -0
- package/dist/checkbox/checkbox.js.map +1 -0
- package/dist/checkbox/checkbox.stories.d.ts +10 -0
- package/dist/checkbox/checkbox.stories.d.ts.map +1 -0
- package/dist/checkbox/checkbox.stories.js +38 -0
- package/dist/checkbox/checkbox.stories.js.map +1 -0
- package/dist/dialog/dialog.d.ts +51 -0
- package/dist/dialog/dialog.d.ts.map +1 -0
- package/dist/dialog/dialog.js +234 -0
- package/dist/dialog/dialog.js.map +1 -0
- package/dist/dialog/dialog.stories.d.ts +7 -0
- package/dist/dialog/dialog.stories.d.ts.map +1 -0
- package/dist/dialog/dialog.stories.js +30 -0
- package/dist/dialog/dialog.stories.js.map +1 -0
- package/dist/icon/icon.d.ts +40 -0
- package/dist/icon/icon.d.ts.map +1 -0
- package/dist/icon/icon.js +99 -0
- package/dist/icon/icon.js.map +1 -0
- package/dist/icon/icon.stories.d.ts +9 -0
- package/dist/icon/icon.stories.d.ts.map +1 -0
- package/dist/icon/icon.stories.js +41 -0
- package/dist/icon/icon.stories.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/input/input.d.ts +61 -0
- package/dist/input/input.d.ts.map +1 -0
- package/dist/input/input.js +233 -0
- package/dist/input/input.js.map +1 -0
- package/dist/input/input.stories.d.ts +10 -0
- package/dist/input/input.stories.d.ts.map +1 -0
- package/dist/input/input.stories.js +48 -0
- package/dist/input/input.stories.js.map +1 -0
- package/dist/link/link.d.ts +39 -0
- package/dist/link/link.d.ts.map +1 -0
- package/dist/link/link.js +112 -0
- package/dist/link/link.js.map +1 -0
- package/dist/link/link.stories.d.ts +9 -0
- package/dist/link/link.stories.d.ts.map +1 -0
- package/dist/link/link.stories.js +44 -0
- package/dist/link/link.stories.js.map +1 -0
- package/dist/progress/progress.d.ts +35 -0
- package/dist/progress/progress.d.ts.map +1 -0
- package/dist/progress/progress.js +116 -0
- package/dist/progress/progress.js.map +1 -0
- package/dist/progress/progress.stories.d.ts +10 -0
- package/dist/progress/progress.stories.d.ts.map +1 -0
- package/dist/progress/progress.stories.js +32 -0
- package/dist/progress/progress.stories.js.map +1 -0
- package/dist/radio/radio-group.d.ts +53 -0
- package/dist/radio/radio-group.d.ts.map +1 -0
- package/dist/radio/radio-group.js +183 -0
- package/dist/radio/radio-group.js.map +1 -0
- package/dist/radio/radio-group.stories.d.ts +9 -0
- package/dist/radio/radio-group.stories.d.ts.map +1 -0
- package/dist/radio/radio-group.stories.js +44 -0
- package/dist/radio/radio-group.stories.js.map +1 -0
- package/dist/radio/radio.d.ts +29 -0
- package/dist/radio/radio.d.ts.map +1 -0
- package/dist/radio/radio.js +166 -0
- package/dist/radio/radio.js.map +1 -0
- package/dist/radio/radio.stories.d.ts +13 -0
- package/dist/radio/radio.stories.d.ts.map +1 -0
- package/dist/radio/radio.stories.js +28 -0
- package/dist/radio/radio.stories.js.map +1 -0
- package/dist/select/select.d.ts +63 -0
- package/dist/select/select.d.ts.map +1 -0
- package/dist/select/select.js +258 -0
- package/dist/select/select.js.map +1 -0
- package/dist/select/select.stories.d.ts +9 -0
- package/dist/select/select.stories.d.ts.map +1 -0
- package/dist/select/select.stories.js +46 -0
- package/dist/select/select.stories.js.map +1 -0
- package/dist/skeleton/skeleton.d.ts +39 -0
- package/dist/skeleton/skeleton.d.ts.map +1 -0
- package/dist/skeleton/skeleton.js +111 -0
- package/dist/skeleton/skeleton.js.map +1 -0
- package/dist/skeleton/skeleton.stories.d.ts +9 -0
- package/dist/skeleton/skeleton.stories.d.ts.map +1 -0
- package/dist/skeleton/skeleton.stories.js +36 -0
- package/dist/skeleton/skeleton.stories.js.map +1 -0
- package/dist/spinner/spinner.d.ts +29 -0
- package/dist/spinner/spinner.d.ts.map +1 -0
- package/dist/spinner/spinner.js +131 -0
- package/dist/spinner/spinner.js.map +1 -0
- package/dist/spinner/spinner.stories.d.ts +8 -0
- package/dist/spinner/spinner.stories.d.ts.map +1 -0
- package/dist/spinner/spinner.stories.js +29 -0
- package/dist/spinner/spinner.stories.js.map +1 -0
- package/dist/tabs/tab-list.d.ts +45 -0
- package/dist/tabs/tab-list.d.ts.map +1 -0
- package/dist/tabs/tab-list.js +150 -0
- package/dist/tabs/tab-list.js.map +1 -0
- package/dist/tabs/tab-list.stories.d.ts +7 -0
- package/dist/tabs/tab-list.stories.d.ts.map +1 -0
- package/dist/tabs/tab-list.stories.js +27 -0
- package/dist/tabs/tab-list.stories.js.map +1 -0
- package/dist/tabs/tab.d.ts +40 -0
- package/dist/tabs/tab.d.ts.map +1 -0
- package/dist/tabs/tab.js +114 -0
- package/dist/tabs/tab.js.map +1 -0
- package/dist/tabs/tab.stories.d.ts +13 -0
- package/dist/tabs/tab.stories.d.ts.map +1 -0
- package/dist/tabs/tab.stories.js +28 -0
- package/dist/tabs/tab.stories.js.map +1 -0
- package/dist/tag/tag.d.ts +38 -0
- package/dist/tag/tag.d.ts.map +1 -0
- package/dist/tag/tag.js +71 -0
- package/dist/tag/tag.js.map +1 -0
- package/dist/tag/tag.stories.d.ts +10 -0
- package/dist/tag/tag.stories.d.ts.map +1 -0
- package/dist/tag/tag.stories.js +43 -0
- package/dist/tag/tag.stories.js.map +1 -0
- package/dist/test-setup.d.ts +2 -0
- package/dist/test-setup.d.ts.map +1 -0
- package/dist/test-setup.js +2 -0
- package/dist/test-setup.js.map +1 -0
- package/dist/textarea/textarea.d.ts +60 -0
- package/dist/textarea/textarea.d.ts.map +1 -0
- package/dist/textarea/textarea.js +232 -0
- package/dist/textarea/textarea.js.map +1 -0
- package/dist/textarea/textarea.stories.d.ts +10 -0
- package/dist/textarea/textarea.stories.d.ts.map +1 -0
- package/dist/textarea/textarea.stories.js +47 -0
- package/dist/textarea/textarea.stories.js.map +1 -0
- package/dist/toggle/toggle.d.ts +43 -0
- package/dist/toggle/toggle.d.ts.map +1 -0
- package/dist/toggle/toggle.js +189 -0
- package/dist/toggle/toggle.js.map +1 -0
- package/dist/toggle/toggle.stories.d.ts +9 -0
- package/dist/toggle/toggle.stories.d.ts.map +1 -0
- package/dist/toggle/toggle.stories.js +34 -0
- package/dist/toggle/toggle.stories.js.map +1 -0
- package/package.json +65 -0
- package/src/react.d.ts +199 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/web-components-vite';
|
|
2
|
+
import '@digital2analogue2/parsimony-components';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj;
|
|
6
|
+
export declare const Open: Story;
|
|
7
|
+
//# sourceMappingURL=dialog.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.stories.d.ts","sourceRoot":"","sources":["../../src/dialog/dialog.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,yCAAyC,CAAC;AAEjD,QAAA,MAAM,IAAI,EAAE,IAwBX,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC;AAEtB,eAAO,MAAM,IAAI,EAAE,KAAU,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import '@digital2analogue2/parsimony-components';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Components/Dialog',
|
|
5
|
+
component: 'rr-dialog',
|
|
6
|
+
argTypes: {
|
|
7
|
+
heading: { control: 'text' },
|
|
8
|
+
open: { control: 'boolean' },
|
|
9
|
+
closeOnBackdrop: { control: 'boolean' },
|
|
10
|
+
},
|
|
11
|
+
args: {
|
|
12
|
+
heading: 'Confirm',
|
|
13
|
+
open: true,
|
|
14
|
+
closeOnBackdrop: true,
|
|
15
|
+
},
|
|
16
|
+
render: ({ heading, open, closeOnBackdrop }) => html `
|
|
17
|
+
<rr-dialog
|
|
18
|
+
heading=${heading}
|
|
19
|
+
?open=${open}
|
|
20
|
+
?close-on-backdrop=${closeOnBackdrop}
|
|
21
|
+
>
|
|
22
|
+
Are you sure you want to continue?
|
|
23
|
+
<rr-button slot="footer" variant="secondary">Cancel</rr-button>
|
|
24
|
+
<rr-button slot="footer">Confirm</rr-button>
|
|
25
|
+
</rr-dialog>
|
|
26
|
+
`,
|
|
27
|
+
};
|
|
28
|
+
export default meta;
|
|
29
|
+
export const Open = {};
|
|
30
|
+
//# sourceMappingURL=dialog.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.stories.js","sourceRoot":"","sources":["../../src/dialog/dialog.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,yCAAyC,CAAC;AAEjD,MAAM,IAAI,GAAS;IACjB,KAAK,EAAE,mBAAmB;IAC1B,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE;QACR,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAC5B,IAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;QAC5B,eAAe,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;KACxC;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,IAAI;QACV,eAAe,EAAE,IAAI;KACtB;IACD,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC,IAAI,CAAA;;gBAEtC,OAAO;cACT,IAAI;2BACS,eAAe;;;;;;GAMvC;CACF,CAAC;AACF,eAAe,IAAI,CAAC;AAIpB,MAAM,CAAC,MAAM,IAAI,GAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export type IconSize = 'compact' | 'default' | 'large' | 'xl';
|
|
3
|
+
/**
|
|
4
|
+
* A sized, accessible wrapper for inline SVG icons.
|
|
5
|
+
*
|
|
6
|
+
* Slot any SVG icon inside — the component handles sizing via icon-size
|
|
7
|
+
* tokens and accessibility attributes. By default the icon is decorative
|
|
8
|
+
* (aria-hidden="true"). Set `aria-label` to make it a meaningful image.
|
|
9
|
+
*
|
|
10
|
+
* @example Decorative (screen readers skip it):
|
|
11
|
+
* <rr-icon size="default">
|
|
12
|
+
* <svg ...><path .../></svg>
|
|
13
|
+
* </rr-icon>
|
|
14
|
+
*
|
|
15
|
+
* @example Standalone icon with label:
|
|
16
|
+
* <rr-icon aria-label="Close dialog">
|
|
17
|
+
* <svg ...><path .../></svg>
|
|
18
|
+
* </rr-icon>
|
|
19
|
+
*
|
|
20
|
+
* @slot - The SVG icon element.
|
|
21
|
+
* @cssprop --icon-size-compact 16px
|
|
22
|
+
* @cssprop --icon-size-default 20px
|
|
23
|
+
* @cssprop --icon-size-large 24px
|
|
24
|
+
* @cssprop --icon-size-xl 32px
|
|
25
|
+
*/
|
|
26
|
+
export declare class RrIcon extends LitElement {
|
|
27
|
+
static styles: import("lit").CSSResult;
|
|
28
|
+
/** Icon size, mapped to the icon-size design tokens. Reflected to an attribute. */
|
|
29
|
+
size: IconSize;
|
|
30
|
+
/** Accessible label. When set, the host gets role="img"; otherwise it is aria-hidden="true" (decorative). */
|
|
31
|
+
ariaLabel: string | null;
|
|
32
|
+
updated(): void;
|
|
33
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
34
|
+
}
|
|
35
|
+
declare global {
|
|
36
|
+
interface HTMLElementTagNameMap {
|
|
37
|
+
'rr-icon': RrIcon;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../src/icon/icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAGrD,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,IAAI,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBACa,MAAO,SAAQ,UAAU;IACpC,MAAM,CAAC,MAAM,0BAgCX;IAEF,mFAAmF;IAEnF,IAAI,EAAE,QAAQ,CAAa;IAE3B,6GAA6G;IAEpG,SAAS,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEhC,OAAO;IAYhB,MAAM;CAGP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,MAAM,CAAC;KACnB;CACF"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, html, css } from 'lit';
|
|
8
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
9
|
+
/**
|
|
10
|
+
* A sized, accessible wrapper for inline SVG icons.
|
|
11
|
+
*
|
|
12
|
+
* Slot any SVG icon inside — the component handles sizing via icon-size
|
|
13
|
+
* tokens and accessibility attributes. By default the icon is decorative
|
|
14
|
+
* (aria-hidden="true"). Set `aria-label` to make it a meaningful image.
|
|
15
|
+
*
|
|
16
|
+
* @example Decorative (screen readers skip it):
|
|
17
|
+
* <rr-icon size="default">
|
|
18
|
+
* <svg ...><path .../></svg>
|
|
19
|
+
* </rr-icon>
|
|
20
|
+
*
|
|
21
|
+
* @example Standalone icon with label:
|
|
22
|
+
* <rr-icon aria-label="Close dialog">
|
|
23
|
+
* <svg ...><path .../></svg>
|
|
24
|
+
* </rr-icon>
|
|
25
|
+
*
|
|
26
|
+
* @slot - The SVG icon element.
|
|
27
|
+
* @cssprop --icon-size-compact 16px
|
|
28
|
+
* @cssprop --icon-size-default 20px
|
|
29
|
+
* @cssprop --icon-size-large 24px
|
|
30
|
+
* @cssprop --icon-size-xl 32px
|
|
31
|
+
*/
|
|
32
|
+
let RrIcon = class RrIcon extends LitElement {
|
|
33
|
+
constructor() {
|
|
34
|
+
super(...arguments);
|
|
35
|
+
/** Icon size, mapped to the icon-size design tokens. Reflected to an attribute. */
|
|
36
|
+
this.size = 'default';
|
|
37
|
+
/** Accessible label. When set, the host gets role="img"; otherwise it is aria-hidden="true" (decorative). */
|
|
38
|
+
this.ariaLabel = null;
|
|
39
|
+
}
|
|
40
|
+
updated() {
|
|
41
|
+
// Manage host-level aria attributes imperatively so they appear
|
|
42
|
+
// on the element itself (not inside the shadow root).
|
|
43
|
+
if (this.ariaLabel) {
|
|
44
|
+
this.setAttribute('role', 'img');
|
|
45
|
+
this.removeAttribute('aria-hidden');
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
this.removeAttribute('role');
|
|
49
|
+
this.setAttribute('aria-hidden', 'true');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
render() {
|
|
53
|
+
return html `<slot></slot>`;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
RrIcon.styles = css `
|
|
57
|
+
:host {
|
|
58
|
+
display: inline-flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
justify-content: center;
|
|
61
|
+
flex-shrink: 0;
|
|
62
|
+
width: var(--icon-size-default);
|
|
63
|
+
height: var(--icon-size-default);
|
|
64
|
+
color: inherit;
|
|
65
|
+
line-height: 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
:host([size='compact']) {
|
|
69
|
+
width: var(--icon-size-compact);
|
|
70
|
+
height: var(--icon-size-compact);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
:host([size='large']) {
|
|
74
|
+
width: var(--icon-size-large);
|
|
75
|
+
height: var(--icon-size-large);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
:host([size='xl']) {
|
|
79
|
+
width: var(--icon-size-xl);
|
|
80
|
+
height: var(--icon-size-xl);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
::slotted(svg) {
|
|
84
|
+
display: block;
|
|
85
|
+
width: 100%;
|
|
86
|
+
height: 100%;
|
|
87
|
+
}
|
|
88
|
+
`;
|
|
89
|
+
__decorate([
|
|
90
|
+
property({ reflect: true })
|
|
91
|
+
], RrIcon.prototype, "size", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
property({ attribute: 'aria-label' })
|
|
94
|
+
], RrIcon.prototype, "ariaLabel", void 0);
|
|
95
|
+
RrIcon = __decorate([
|
|
96
|
+
customElement('rr-icon')
|
|
97
|
+
], RrIcon);
|
|
98
|
+
export { RrIcon };
|
|
99
|
+
//# sourceMappingURL=icon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.js","sourceRoot":"","sources":["../../src/icon/icon.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAW,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAI5D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEI,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,UAAU;IAA/B;;QAmCL,mFAAmF;QAEnF,SAAI,GAAa,SAAS,CAAC;QAE3B,6GAA6G;QAEpG,cAAS,GAAkB,IAAI,CAAC;IAiB3C,CAAC;IAfU,OAAO;QACd,gEAAgE;QAChE,sDAAsD;QACtD,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YACjC,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;QACtC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAC7B,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;;AAxDM,aAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgClB,AAhCY,CAgCX;AAIF;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oCACD;AAIlB;IADR,QAAQ,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;yCACG;AAzC9B,MAAM;IADlB,aAAa,CAAC,SAAS,CAAC;GACZ,MAAM,CA0DlB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/web-components-vite';
|
|
2
|
+
import '@digital2analogue2/parsimony-components';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Sizes: Story;
|
|
8
|
+
export declare const Labelled: Story;
|
|
9
|
+
//# sourceMappingURL=icon.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.stories.d.ts","sourceRoot":"","sources":["../../src/icon/icon.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,yCAAyC,CAAC;AASjD,QAAA,MAAM,IAAI,EAAE,IAcX,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC;AAEtB,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,eAAO,MAAM,KAAK,EAAE,KASnB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAItB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import '@digital2analogue2/parsimony-components';
|
|
3
|
+
const checkSvg = html `
|
|
4
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
5
|
+
<circle cx="12" cy="12" r="9" />
|
|
6
|
+
<path d="m8 12 3 3 5-6" />
|
|
7
|
+
</svg>
|
|
8
|
+
`;
|
|
9
|
+
const meta = {
|
|
10
|
+
title: 'Components/Icon',
|
|
11
|
+
component: 'rr-icon',
|
|
12
|
+
argTypes: {
|
|
13
|
+
size: { control: 'select', options: ['compact', 'default', 'large', 'xl'] },
|
|
14
|
+
'aria-label': { control: 'text' },
|
|
15
|
+
},
|
|
16
|
+
args: {
|
|
17
|
+
size: 'default',
|
|
18
|
+
'aria-label': null,
|
|
19
|
+
},
|
|
20
|
+
render: ({ size, ['aria-label']: ariaLabel }) => html `
|
|
21
|
+
<rr-icon size=${size} aria-label=${ariaLabel ?? ''}>${checkSvg}</rr-icon>
|
|
22
|
+
`,
|
|
23
|
+
};
|
|
24
|
+
export default meta;
|
|
25
|
+
export const Default = {};
|
|
26
|
+
export const Sizes = {
|
|
27
|
+
render: () => html `
|
|
28
|
+
<div style="display: flex; align-items: center; gap: var(--spacing-inline);">
|
|
29
|
+
<rr-icon size="compact">${checkSvg}</rr-icon>
|
|
30
|
+
<rr-icon size="default">${checkSvg}</rr-icon>
|
|
31
|
+
<rr-icon size="large">${checkSvg}</rr-icon>
|
|
32
|
+
<rr-icon size="xl">${checkSvg}</rr-icon>
|
|
33
|
+
</div>
|
|
34
|
+
`,
|
|
35
|
+
};
|
|
36
|
+
export const Labelled = {
|
|
37
|
+
render: () => html `
|
|
38
|
+
<rr-icon aria-label="Info">${checkSvg}</rr-icon>
|
|
39
|
+
`,
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=icon.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.stories.js","sourceRoot":"","sources":["../../src/icon/icon.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,yCAAyC,CAAC;AAEjD,MAAM,QAAQ,GAAG,IAAI,CAAA;;;;;CAKpB,CAAC;AAEF,MAAM,IAAI,GAAS;IACjB,KAAK,EAAE,iBAAiB;IACxB,SAAS,EAAE,SAAS;IACpB,QAAQ,EAAE;QACR,IAAI,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE;QAC3E,YAAY,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;KAClC;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,YAAY,EAAE,IAAI;KACnB;IACD,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,YAAY,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,IAAI,CAAA;oBACnC,IAAI,eAAe,SAAS,IAAI,EAAE,IAAI,QAAQ;GAC/D;CACF,CAAC;AACF,eAAe,IAAI,CAAC;AAIpB,MAAM,CAAC,MAAM,OAAO,GAAU,EAAE,CAAC;AAEjC,MAAM,CAAC,MAAM,KAAK,GAAU;IAC1B,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAA;;gCAEY,QAAQ;gCACR,QAAQ;8BACV,QAAQ;2BACX,QAAQ;;GAEhC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAU;IAC7B,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAA;iCACa,QAAQ;GACtC;CACF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { RrAlert } from './alert/alert.js';
|
|
2
|
+
export { RrAvatar } from './avatar/avatar.js';
|
|
3
|
+
export { RrBadge } from './badge/badge.js';
|
|
4
|
+
export { RrButton } from './button/button.js';
|
|
5
|
+
export { RrCard } from './card/card.js';
|
|
6
|
+
export { RrCheckbox } from './checkbox/checkbox.js';
|
|
7
|
+
export { RrDialog } from './dialog/dialog.js';
|
|
8
|
+
export { RrIcon } from './icon/icon.js';
|
|
9
|
+
export { RrInput } from './input/input.js';
|
|
10
|
+
export { RrLink } from './link/link.js';
|
|
11
|
+
export { RrProgress } from './progress/progress.js';
|
|
12
|
+
export { RrRadio } from './radio/radio.js';
|
|
13
|
+
export { RrRadioGroup } from './radio/radio-group.js';
|
|
14
|
+
export { RrSelect } from './select/select.js';
|
|
15
|
+
export { RrSkeleton } from './skeleton/skeleton.js';
|
|
16
|
+
export { RrSpinner } from './spinner/spinner.js';
|
|
17
|
+
export { RrTab } from './tabs/tab.js';
|
|
18
|
+
export { RrTabList } from './tabs/tab-list.js';
|
|
19
|
+
export { RrTag } from './tag/tag.js';
|
|
20
|
+
export { RrTextarea } from './textarea/textarea.js';
|
|
21
|
+
export { RrToggle } from './toggle/toggle.js';
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { RrAlert } from './alert/alert.js';
|
|
2
|
+
export { RrAvatar } from './avatar/avatar.js';
|
|
3
|
+
export { RrBadge } from './badge/badge.js';
|
|
4
|
+
export { RrButton } from './button/button.js';
|
|
5
|
+
export { RrCard } from './card/card.js';
|
|
6
|
+
export { RrCheckbox } from './checkbox/checkbox.js';
|
|
7
|
+
export { RrDialog } from './dialog/dialog.js';
|
|
8
|
+
export { RrIcon } from './icon/icon.js';
|
|
9
|
+
export { RrInput } from './input/input.js';
|
|
10
|
+
export { RrLink } from './link/link.js';
|
|
11
|
+
export { RrProgress } from './progress/progress.js';
|
|
12
|
+
export { RrRadio } from './radio/radio.js';
|
|
13
|
+
export { RrRadioGroup } from './radio/radio-group.js';
|
|
14
|
+
export { RrSelect } from './select/select.js';
|
|
15
|
+
export { RrSkeleton } from './skeleton/skeleton.js';
|
|
16
|
+
export { RrSpinner } from './spinner/spinner.js';
|
|
17
|
+
export { RrTab } from './tabs/tab.js';
|
|
18
|
+
export { RrTabList } from './tabs/tab-list.js';
|
|
19
|
+
export { RrTag } from './tag/tag.js';
|
|
20
|
+
export { RrTextarea } from './textarea/textarea.js';
|
|
21
|
+
export { RrToggle } from './toggle/toggle.js';
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* A form-associated text input with label, helper text, and error state.
|
|
4
|
+
*
|
|
5
|
+
* Uses `ElementInternals` for native form participation and
|
|
6
|
+
* `delegatesFocus` so the host forwards focus to the inner `<input>`.
|
|
7
|
+
*
|
|
8
|
+
* @slot label - Optional override for the label text
|
|
9
|
+
* @fires input - When the input value changes (mirrors native input event)
|
|
10
|
+
* @fires change - When the input value is committed (mirrors native change event)
|
|
11
|
+
* @csspart label - The label element
|
|
12
|
+
* @csspart input - The inner input element
|
|
13
|
+
* @csspart helper - The helper text container
|
|
14
|
+
* @csspart error - The error message container
|
|
15
|
+
*/
|
|
16
|
+
export declare class RrInput extends LitElement {
|
|
17
|
+
static formAssociated: boolean;
|
|
18
|
+
static shadowRootOptions: {
|
|
19
|
+
delegatesFocus: boolean;
|
|
20
|
+
clonable?: boolean;
|
|
21
|
+
customElementRegistry?: CustomElementRegistry | null;
|
|
22
|
+
mode: ShadowRootMode;
|
|
23
|
+
serializable?: boolean;
|
|
24
|
+
slotAssignment?: SlotAssignmentMode;
|
|
25
|
+
};
|
|
26
|
+
static styles: import("lit").CSSResult;
|
|
27
|
+
/** Input type attribute (text, email, password, etc.). */
|
|
28
|
+
type: string;
|
|
29
|
+
/** Form field name for submission. */
|
|
30
|
+
name: string;
|
|
31
|
+
/** Current input value. */
|
|
32
|
+
value: string;
|
|
33
|
+
/** Placeholder text shown when empty. */
|
|
34
|
+
placeholder: string;
|
|
35
|
+
/** Visible label text above the input. */
|
|
36
|
+
label: string;
|
|
37
|
+
/** Helper text below the input. Hidden when error-text is set. */
|
|
38
|
+
helperText: string;
|
|
39
|
+
/** Error message below the input. Sets aria-invalid and replaces helper text. */
|
|
40
|
+
errorText: string;
|
|
41
|
+
/** Marks the field as required. Shows asterisk and sets aria-required. */
|
|
42
|
+
required: boolean;
|
|
43
|
+
/** Disables the input. */
|
|
44
|
+
disabled: boolean;
|
|
45
|
+
/** Autocomplete hint for browser autofill. */
|
|
46
|
+
autoComplete: string;
|
|
47
|
+
private _input;
|
|
48
|
+
private _internals;
|
|
49
|
+
constructor();
|
|
50
|
+
private get _isInvalid();
|
|
51
|
+
updated(changed: Map<string, unknown>): void;
|
|
52
|
+
private _onInput;
|
|
53
|
+
private _onChange;
|
|
54
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
55
|
+
}
|
|
56
|
+
declare global {
|
|
57
|
+
interface HTMLElementTagNameMap {
|
|
58
|
+
'rr-input': RrInput;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/input/input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAIrD;;;;;;;;;;;;;GAaG;AACH,qBACa,OAAQ,SAAQ,UAAU;IACrC,MAAM,CAAC,cAAc,UAAQ;IAE7B,MAAM,CAAC,iBAAiB;;;;;;;MAGtB;IAEF,MAAM,CAAC,MAAM,0BA0EX;IAEF,0DAA0D;IAC9C,IAAI,SAAU;IAE1B,sCAAsC;IAC1B,IAAI,SAAM;IAEtB,2BAA2B;IACf,KAAK,SAAM;IAEvB,yCAAyC;IAC7B,WAAW,SAAM;IAE7B,0CAA0C;IAC9B,KAAK,SAAM;IAEvB,kEAAkE;IAC1B,UAAU,SAAM;IAExD,iFAAiF;IAC1C,SAAS,SAAM;IAEtD,0EAA0E;IAC9B,QAAQ,UAAS;IAE7D,0BAA0B;IACkB,QAAQ,UAAS;IAE7D,8CAA8C;IACL,YAAY,SAAM;IAE3C,OAAO,CAAC,MAAM,CAAoB;IAElD,OAAO,CAAC,UAAU,CAAmB;;IAOrC,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAmBrC,OAAO,CAAC,QAAQ;IAOhB,OAAO,CAAC,SAAS;IAOjB,MAAM;CAqCP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,OAAO,CAAC;KACrB;CACF"}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, html, css, nothing } from 'lit';
|
|
8
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
9
|
+
import { live } from 'lit/directives/live.js';
|
|
10
|
+
/**
|
|
11
|
+
* A form-associated text input with label, helper text, and error state.
|
|
12
|
+
*
|
|
13
|
+
* Uses `ElementInternals` for native form participation and
|
|
14
|
+
* `delegatesFocus` so the host forwards focus to the inner `<input>`.
|
|
15
|
+
*
|
|
16
|
+
* @slot label - Optional override for the label text
|
|
17
|
+
* @fires input - When the input value changes (mirrors native input event)
|
|
18
|
+
* @fires change - When the input value is committed (mirrors native change event)
|
|
19
|
+
* @csspart label - The label element
|
|
20
|
+
* @csspart input - The inner input element
|
|
21
|
+
* @csspart helper - The helper text container
|
|
22
|
+
* @csspart error - The error message container
|
|
23
|
+
*/
|
|
24
|
+
let RrInput = class RrInput extends LitElement {
|
|
25
|
+
constructor() {
|
|
26
|
+
super();
|
|
27
|
+
/** Input type attribute (text, email, password, etc.). */
|
|
28
|
+
this.type = 'text';
|
|
29
|
+
/** Form field name for submission. */
|
|
30
|
+
this.name = '';
|
|
31
|
+
/** Current input value. */
|
|
32
|
+
this.value = '';
|
|
33
|
+
/** Placeholder text shown when empty. */
|
|
34
|
+
this.placeholder = '';
|
|
35
|
+
/** Visible label text above the input. */
|
|
36
|
+
this.label = '';
|
|
37
|
+
/** Helper text below the input. Hidden when error-text is set. */
|
|
38
|
+
this.helperText = '';
|
|
39
|
+
/** Error message below the input. Sets aria-invalid and replaces helper text. */
|
|
40
|
+
this.errorText = '';
|
|
41
|
+
/** Marks the field as required. Shows asterisk and sets aria-required. */
|
|
42
|
+
this.required = false;
|
|
43
|
+
/** Disables the input. */
|
|
44
|
+
this.disabled = false;
|
|
45
|
+
/** Autocomplete hint for browser autofill. */
|
|
46
|
+
this.autoComplete = '';
|
|
47
|
+
this._internals = this.attachInternals();
|
|
48
|
+
}
|
|
49
|
+
get _isInvalid() {
|
|
50
|
+
return this.errorText.length > 0;
|
|
51
|
+
}
|
|
52
|
+
updated(changed) {
|
|
53
|
+
if (changed.has('value')) {
|
|
54
|
+
this._internals.setFormValue?.(this.value);
|
|
55
|
+
}
|
|
56
|
+
if (changed.has('errorText')) {
|
|
57
|
+
if (this._isInvalid) {
|
|
58
|
+
this.setAttribute('data-invalid', '');
|
|
59
|
+
this._internals.setValidity?.({ customError: true }, this.errorText, this._input);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
this.removeAttribute('data-invalid');
|
|
63
|
+
this._internals.setValidity?.({});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
_onInput(e) {
|
|
68
|
+
const input = e.target;
|
|
69
|
+
this.value = input.value;
|
|
70
|
+
this._internals.setFormValue?.(this.value);
|
|
71
|
+
this.dispatchEvent(new Event('input', { bubbles: true, composed: true }));
|
|
72
|
+
}
|
|
73
|
+
_onChange(e) {
|
|
74
|
+
const input = e.target;
|
|
75
|
+
this.value = input.value;
|
|
76
|
+
this._internals.setFormValue?.(this.value);
|
|
77
|
+
this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
|
|
78
|
+
}
|
|
79
|
+
render() {
|
|
80
|
+
const hasLabel = this.label.length > 0;
|
|
81
|
+
const describedBy = this._isInvalid ? 'error' : this.helperText ? 'helper' : undefined;
|
|
82
|
+
return html `
|
|
83
|
+
${hasLabel
|
|
84
|
+
? html `<label part="label" for="input">
|
|
85
|
+
<slot name="label">${this.label}</slot>${this.required
|
|
86
|
+
? html `<span class="required" aria-hidden="true">*</span>`
|
|
87
|
+
: nothing}
|
|
88
|
+
</label>`
|
|
89
|
+
: nothing}
|
|
90
|
+
<input
|
|
91
|
+
part="input"
|
|
92
|
+
id="input"
|
|
93
|
+
.type=${this.type}
|
|
94
|
+
.value=${live(this.value)}
|
|
95
|
+
.placeholder=${this.placeholder}
|
|
96
|
+
.name=${this.name}
|
|
97
|
+
.disabled=${this.disabled}
|
|
98
|
+
.required=${this.required}
|
|
99
|
+
autocomplete=${this.autoComplete || nothing}
|
|
100
|
+
aria-required=${this.required ? 'true' : nothing}
|
|
101
|
+
aria-invalid=${this._isInvalid ? 'true' : nothing}
|
|
102
|
+
aria-errormessage=${this._isInvalid ? 'error' : nothing}
|
|
103
|
+
aria-describedby=${describedBy || nothing}
|
|
104
|
+
@input=${this._onInput}
|
|
105
|
+
@change=${this._onChange}
|
|
106
|
+
/>
|
|
107
|
+
${this.helperText && !this._isInvalid
|
|
108
|
+
? html `<div id="helper" part="helper" class="helper">${this.helperText}</div>`
|
|
109
|
+
: nothing}
|
|
110
|
+
${this._isInvalid
|
|
111
|
+
? html `<div id="error" part="error" class="error" role="alert">${this.errorText}</div>`
|
|
112
|
+
: nothing}
|
|
113
|
+
`;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
RrInput.formAssociated = true;
|
|
117
|
+
RrInput.shadowRootOptions = {
|
|
118
|
+
...LitElement.shadowRootOptions,
|
|
119
|
+
delegatesFocus: true,
|
|
120
|
+
};
|
|
121
|
+
RrInput.styles = css `
|
|
122
|
+
:host {
|
|
123
|
+
display: block;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
label {
|
|
127
|
+
display: block;
|
|
128
|
+
font: var(--font-label-medium);
|
|
129
|
+
color: var(--component-input-foreground-label);
|
|
130
|
+
margin-bottom: 4px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.required {
|
|
134
|
+
color: var(--component-input-foreground-label-required);
|
|
135
|
+
margin-left: 2px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
input {
|
|
139
|
+
display: block;
|
|
140
|
+
width: 100%;
|
|
141
|
+
box-sizing: border-box;
|
|
142
|
+
font: var(--font-body-large);
|
|
143
|
+
color: var(--component-input-foreground-value);
|
|
144
|
+
background: var(--component-input-background-default);
|
|
145
|
+
border: 1px solid var(--component-input-border-default);
|
|
146
|
+
border-radius: var(--component-input-radius);
|
|
147
|
+
padding: var(--component-input-padding-y) var(--component-input-padding-x);
|
|
148
|
+
outline: none;
|
|
149
|
+
transition: border-color 120ms ease;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
input::placeholder {
|
|
153
|
+
color: var(--component-input-foreground-placeholder);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
input:hover {
|
|
157
|
+
border-color: var(--component-input-border-hover);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
input:focus {
|
|
161
|
+
border-color: var(--component-input-border-focus);
|
|
162
|
+
box-shadow: 0 0 0 1px var(--component-input-border-focus);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
:host([disabled]) input {
|
|
166
|
+
background: var(--component-input-background-disabled);
|
|
167
|
+
border-color: var(--component-input-border-disabled);
|
|
168
|
+
color: var(--component-input-foreground-disabled);
|
|
169
|
+
cursor: not-allowed;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
:host([disabled]) label {
|
|
173
|
+
color: var(--component-input-foreground-disabled);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.helper {
|
|
177
|
+
font: var(--font-label-small);
|
|
178
|
+
color: var(--component-input-foreground-helper);
|
|
179
|
+
margin-top: 4px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.error {
|
|
183
|
+
font: var(--font-label-small);
|
|
184
|
+
color: var(--component-input-foreground-error);
|
|
185
|
+
margin-top: 4px;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
:host([data-invalid]) input {
|
|
189
|
+
border-color: var(--component-input-border-error);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
:host([data-invalid]) input:focus {
|
|
193
|
+
box-shadow: 0 0 0 1px var(--component-input-border-error);
|
|
194
|
+
}
|
|
195
|
+
`;
|
|
196
|
+
__decorate([
|
|
197
|
+
property()
|
|
198
|
+
], RrInput.prototype, "type", void 0);
|
|
199
|
+
__decorate([
|
|
200
|
+
property()
|
|
201
|
+
], RrInput.prototype, "name", void 0);
|
|
202
|
+
__decorate([
|
|
203
|
+
property()
|
|
204
|
+
], RrInput.prototype, "value", void 0);
|
|
205
|
+
__decorate([
|
|
206
|
+
property()
|
|
207
|
+
], RrInput.prototype, "placeholder", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
property()
|
|
210
|
+
], RrInput.prototype, "label", void 0);
|
|
211
|
+
__decorate([
|
|
212
|
+
property({ attribute: 'helper-text' })
|
|
213
|
+
], RrInput.prototype, "helperText", void 0);
|
|
214
|
+
__decorate([
|
|
215
|
+
property({ attribute: 'error-text' })
|
|
216
|
+
], RrInput.prototype, "errorText", void 0);
|
|
217
|
+
__decorate([
|
|
218
|
+
property({ type: Boolean, reflect: true })
|
|
219
|
+
], RrInput.prototype, "required", void 0);
|
|
220
|
+
__decorate([
|
|
221
|
+
property({ type: Boolean, reflect: true })
|
|
222
|
+
], RrInput.prototype, "disabled", void 0);
|
|
223
|
+
__decorate([
|
|
224
|
+
property({ attribute: 'autocomplete' })
|
|
225
|
+
], RrInput.prototype, "autoComplete", void 0);
|
|
226
|
+
__decorate([
|
|
227
|
+
query('input')
|
|
228
|
+
], RrInput.prototype, "_input", void 0);
|
|
229
|
+
RrInput = __decorate([
|
|
230
|
+
customElement('rr-input')
|
|
231
|
+
], RrInput);
|
|
232
|
+
export { RrInput };
|
|
233
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../src/input/input.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C;;;;;;;;;;;;;GAaG;AAEI,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,UAAU;IAsHrC;QACE,KAAK,EAAE,CAAC;QAnCV,0DAA0D;QAC9C,SAAI,GAAG,MAAM,CAAC;QAE1B,sCAAsC;QAC1B,SAAI,GAAG,EAAE,CAAC;QAEtB,2BAA2B;QACf,UAAK,GAAG,EAAE,CAAC;QAEvB,yCAAyC;QAC7B,gBAAW,GAAG,EAAE,CAAC;QAE7B,0CAA0C;QAC9B,UAAK,GAAG,EAAE,CAAC;QAEvB,kEAAkE;QAC1B,eAAU,GAAG,EAAE,CAAC;QAExD,iFAAiF;QAC1C,cAAS,GAAG,EAAE,CAAC;QAEtD,0EAA0E;QAC9B,aAAQ,GAAG,KAAK,CAAC;QAE7D,0BAA0B;QACkB,aAAQ,GAAG,KA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AAK,CAAC,OAAO,CAAC;uCAAmC;AAlHvC,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAqMnB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/web-components-vite';
|
|
2
|
+
import '@digital2analogue2/parsimony-components';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithHelperText: Story;
|
|
8
|
+
export declare const Error: Story;
|
|
9
|
+
export declare const Disabled: Story;
|
|
10
|
+
//# sourceMappingURL=input.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.stories.d.ts","sourceRoot":"","sources":["../../src/input/input.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,yCAAyC,CAAC;AAEjD,QAAA,MAAM,IAAI,EAAE,IAmCX,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC;AAEtB,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,eAAO,MAAM,cAAc,EAAE,KAE5B,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAEnB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAAiE,CAAC"}
|