@rgrmdesign/rgrm-ds-elements 0.1.1 → 0.2.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/dist/button/index.d.ts +11 -0
- package/dist/button/index.js +11 -0
- package/dist/button/index.js.map +1 -0
- package/dist/chunk-YFBMGNKK.js +53 -0
- package/dist/chunk-YFBMGNKK.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -0
- package/package.json +10 -5
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { ButtonVariant, buttonClassNames } from '@rgrmdesign/rgrm-ds-core/button';
|
|
2
|
+
|
|
3
|
+
declare const RGRM_BUTTON_TAG = "rgrm-button";
|
|
4
|
+
declare class RgrmButtonElement extends HTMLElement {
|
|
5
|
+
#private;
|
|
6
|
+
static readonly observedAttributes: string[];
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
attributeChangedCallback(name: string): void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { RGRM_BUTTON_TAG, RgrmButtonElement };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// src/button/index.ts
|
|
2
|
+
import "@rgrmdesign/rgrm-ds-css/button";
|
|
3
|
+
import { buttonClassNames as buttonClassNames2 } from "@rgrmdesign/rgrm-ds-core/button";
|
|
4
|
+
|
|
5
|
+
// src/button/button-element.ts
|
|
6
|
+
import { buttonClassNames } from "@rgrmdesign/rgrm-ds-core/button";
|
|
7
|
+
var RGRM_BUTTON_TAG = "rgrm-button";
|
|
8
|
+
var DEFAULT_VARIANT = "primary";
|
|
9
|
+
function parseVariantAttribute(value) {
|
|
10
|
+
return value === "primary" ? value : DEFAULT_VARIANT;
|
|
11
|
+
}
|
|
12
|
+
var RgrmButtonElement = class extends HTMLElement {
|
|
13
|
+
static observedAttributes = ["variant"];
|
|
14
|
+
#inner = document.createElement("button");
|
|
15
|
+
connectedCallback() {
|
|
16
|
+
if (!this.#inner.type) {
|
|
17
|
+
this.#inner.type = "button";
|
|
18
|
+
}
|
|
19
|
+
this.#mountInner();
|
|
20
|
+
this.#render();
|
|
21
|
+
}
|
|
22
|
+
attributeChangedCallback(name) {
|
|
23
|
+
if (name === "variant") {
|
|
24
|
+
this.#render();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
#mountInner() {
|
|
28
|
+
if (this.#inner.parentNode === this) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
while (this.firstChild) {
|
|
32
|
+
this.#inner.appendChild(this.firstChild);
|
|
33
|
+
}
|
|
34
|
+
this.appendChild(this.#inner);
|
|
35
|
+
}
|
|
36
|
+
#render() {
|
|
37
|
+
this.#inner.className = buttonClassNames(
|
|
38
|
+
parseVariantAttribute(this.getAttribute("variant"))
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// src/button/index.ts
|
|
44
|
+
if (!customElements.get(RGRM_BUTTON_TAG)) {
|
|
45
|
+
customElements.define(RGRM_BUTTON_TAG, RgrmButtonElement);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
RGRM_BUTTON_TAG,
|
|
50
|
+
RgrmButtonElement,
|
|
51
|
+
buttonClassNames2 as buttonClassNames
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=chunk-YFBMGNKK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/button/index.ts","../src/button/button-element.ts"],"sourcesContent":["import '@rgrmdesign/rgrm-ds-css/button';\n\nexport { buttonClassNames, type ButtonVariant } from '@rgrmdesign/rgrm-ds-core/button';\nexport { RGRM_BUTTON_TAG, RgrmButtonElement } from './button-element.js';\n\nimport { RGRM_BUTTON_TAG, RgrmButtonElement } from './button-element.js';\n\nif (!customElements.get(RGRM_BUTTON_TAG)) {\n customElements.define(RGRM_BUTTON_TAG, RgrmButtonElement);\n}\n","import { buttonClassNames, type ButtonVariant } from '@rgrmdesign/rgrm-ds-core/button';\n\nexport const RGRM_BUTTON_TAG = 'rgrm-button';\n\nconst DEFAULT_VARIANT: ButtonVariant = 'primary';\n\nfunction parseVariantAttribute(value: string | null): ButtonVariant {\n return value === 'primary' ? value : DEFAULT_VARIANT;\n}\n\nexport class RgrmButtonElement extends HTMLElement {\n static readonly observedAttributes = ['variant'];\n\n readonly #inner: HTMLButtonElement = document.createElement('button');\n\n connectedCallback(): void {\n if (!this.#inner.type) {\n this.#inner.type = 'button';\n }\n this.#mountInner();\n this.#render();\n }\n\n attributeChangedCallback(name: string): void {\n if (name === 'variant') {\n this.#render();\n }\n }\n\n #mountInner(): void {\n if (this.#inner.parentNode === this) {\n return;\n }\n\n while (this.firstChild) {\n this.#inner.appendChild(this.firstChild);\n }\n\n this.appendChild(this.#inner);\n }\n\n #render(): void {\n this.#inner.className = buttonClassNames(\n parseVariantAttribute(this.getAttribute('variant')),\n );\n }\n}\n"],"mappings":";AAAA,OAAO;AAEP,SAAS,oBAAAA,yBAA4C;;;ACFrD,SAAS,wBAA4C;AAE9C,IAAM,kBAAkB;AAE/B,IAAM,kBAAiC;AAEvC,SAAS,sBAAsB,OAAqC;AAClE,SAAO,UAAU,YAAY,QAAQ;AACvC;AAEO,IAAM,oBAAN,cAAgC,YAAY;AAAA,EACjD,OAAgB,qBAAqB,CAAC,SAAS;AAAA,EAEtC,SAA4B,SAAS,cAAc,QAAQ;AAAA,EAEpE,oBAA0B;AACxB,QAAI,CAAC,KAAK,OAAO,MAAM;AACrB,WAAK,OAAO,OAAO;AAAA,IACrB;AACA,SAAK,YAAY;AACjB,SAAK,QAAQ;AAAA,EACf;AAAA,EAEA,yBAAyB,MAAoB;AAC3C,QAAI,SAAS,WAAW;AACtB,WAAK,QAAQ;AAAA,IACf;AAAA,EACF;AAAA,EAEA,cAAoB;AAClB,QAAI,KAAK,OAAO,eAAe,MAAM;AACnC;AAAA,IACF;AAEA,WAAO,KAAK,YAAY;AACtB,WAAK,OAAO,YAAY,KAAK,UAAU;AAAA,IACzC;AAEA,SAAK,YAAY,KAAK,MAAM;AAAA,EAC9B;AAAA,EAEA,UAAgB;AACd,SAAK,OAAO,YAAY;AAAA,MACtB,sBAAsB,KAAK,aAAa,SAAS,CAAC;AAAA,IACpD;AAAA,EACF;AACF;;;ADvCA,IAAI,CAAC,eAAe,IAAI,eAAe,GAAG;AACxC,iBAAe,OAAO,iBAAiB,iBAAiB;AAC1D;","names":["buttonClassNames"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { ButtonVariant, buttonClassNames } from '@rgrmdesign/rgrm-ds-core/button';
|
|
2
|
+
export { RGRM_BUTTON_TAG, RgrmButtonElement } from './button/index.js';
|
|
1
3
|
export { HeadingLevel, headingClassNames } from '@rgrmdesign/rgrm-ds-core/heading';
|
|
2
4
|
export { RGRM_HEADING_TAG, RgrmHeadingElement } from './heading/index.js';
|
|
3
5
|
export { ParagraphSize, paragraphClassNames } from '@rgrmdesign/rgrm-ds-core/paragraph';
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RGRM_BUTTON_TAG,
|
|
3
|
+
RgrmButtonElement,
|
|
4
|
+
buttonClassNames
|
|
5
|
+
} from "./chunk-YFBMGNKK.js";
|
|
1
6
|
import {
|
|
2
7
|
RGRM_HEADING_TAG,
|
|
3
8
|
RgrmHeadingElement,
|
|
@@ -15,12 +20,15 @@ import {
|
|
|
15
20
|
sectionContainerClassNames
|
|
16
21
|
} from "./chunk-OB3YM7YY.js";
|
|
17
22
|
export {
|
|
23
|
+
RGRM_BUTTON_TAG,
|
|
18
24
|
RGRM_HEADING_TAG,
|
|
19
25
|
RGRM_PARAGRAPH_TAG,
|
|
20
26
|
RGRM_SECTION_TAG,
|
|
27
|
+
RgrmButtonElement,
|
|
21
28
|
RgrmHeadingElement,
|
|
22
29
|
RgrmParagraphElement,
|
|
23
30
|
RgrmSectionElement,
|
|
31
|
+
buttonClassNames,
|
|
24
32
|
headingClassNames,
|
|
25
33
|
paragraphClassNames,
|
|
26
34
|
sectionClassNames,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rgrmdesign/rgrm-ds-elements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Web Components for the RGRM design system. Styles come from @rgrmdesign/rgrm-ds-css.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
"types": "./dist/index.d.ts",
|
|
15
15
|
"import": "./dist/index.js"
|
|
16
16
|
},
|
|
17
|
+
"./button": {
|
|
18
|
+
"types": "./dist/button/index.d.ts",
|
|
19
|
+
"import": "./dist/button/index.js"
|
|
20
|
+
},
|
|
17
21
|
"./heading": {
|
|
18
22
|
"types": "./dist/heading/index.d.ts",
|
|
19
23
|
"import": "./dist/heading/index.js"
|
|
@@ -33,19 +37,20 @@
|
|
|
33
37
|
"sideEffects": [
|
|
34
38
|
"@rgrmdesign/rgrm-ds-css",
|
|
35
39
|
"./dist/index.js",
|
|
40
|
+
"./dist/button/index.js",
|
|
36
41
|
"./dist/heading/index.js",
|
|
37
42
|
"./dist/paragraph/index.js",
|
|
38
43
|
"./dist/section/index.js"
|
|
39
44
|
],
|
|
40
45
|
"dependencies": {
|
|
41
|
-
"@rgrmdesign/rgrm-ds-core": "0.
|
|
42
|
-
"@rgrmdesign/rgrm-ds-css": "0.
|
|
46
|
+
"@rgrmdesign/rgrm-ds-core": "0.2.0",
|
|
47
|
+
"@rgrmdesign/rgrm-ds-css": "0.2.0"
|
|
43
48
|
},
|
|
44
49
|
"peerDependencies": {
|
|
45
|
-
"@rgrmdesign/rgrm-ds-tokens": ">=0.
|
|
50
|
+
"@rgrmdesign/rgrm-ds-tokens": ">=0.6.0"
|
|
46
51
|
},
|
|
47
52
|
"devDependencies": {
|
|
48
|
-
"@rgrmdesign/rgrm-ds-tokens": "^0.
|
|
53
|
+
"@rgrmdesign/rgrm-ds-tokens": "^0.6.1",
|
|
49
54
|
"rimraf": "^6.0.1",
|
|
50
55
|
"tsup": "^8.5.1",
|
|
51
56
|
"typescript": "^5.9.3"
|