@usecapsule/core-components 3.4.0 → 3.4.1-dev.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/capsule/capsule.esm.js +1 -1
- package/dist/capsule/capsule.esm.js.map +1 -1
- package/dist/capsule/index.esm.js +1 -1
- package/dist/capsule/index.esm.js.map +1 -1
- package/dist/capsule/p-286db996.js +2 -0
- package/dist/capsule/p-286db996.js.map +1 -0
- package/dist/capsule/p-7be8987f.entry.js +20 -0
- package/dist/capsule/p-7be8987f.entry.js.map +1 -0
- package/dist/capsule/p-9e64a60e.entry.js +2 -0
- package/dist/capsule/p-9e64a60e.entry.js.map +1 -0
- package/dist/capsule/{p-32cdf894.entry.js → p-b96e357a.entry.js} +2 -2
- package/dist/capsule/p-b96e357a.entry.js.map +1 -0
- package/dist/capsule/p-c33942ad.entry.js +2 -0
- package/dist/capsule/p-c33942ad.entry.js.map +1 -0
- package/dist/capsule/p-cfc382c0.entry.js +2 -0
- package/dist/capsule/{p-de2a16e4.entry.js → p-d165df27.entry.js} +2 -2
- package/dist/capsule/{p-41bc3c58.entry.js → p-f0cd0482.entry.js} +2 -2
- package/dist/cjs/capsule.cjs.js +1 -1
- package/dist/cjs/cpsl-alert_34.cjs.entry.js +122 -65
- package/dist/cjs/cpsl-alert_34.cjs.entry.js.map +1 -1
- package/dist/cjs/cpsl-col.cjs.entry.js +1 -1
- package/dist/cjs/cpsl-grid.cjs.entry.js +2 -2
- package/dist/cjs/cpsl-hero.cjs.entry.js +4 -3
- package/dist/cjs/cpsl-hero.cjs.entry.js.map +1 -1
- package/dist/cjs/cpsl-identicon.cjs.entry.js +76 -30
- package/dist/cjs/cpsl-identicon.cjs.entry.js.map +1 -1
- package/dist/cjs/cpsl-nav-button.cjs.entry.js +40 -0
- package/dist/cjs/cpsl-nav-button.cjs.entry.js.map +1 -0
- package/dist/cjs/cpsl-row.cjs.entry.js +1 -1
- package/dist/cjs/index-65f57499.js +4 -4
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/prand-a35ea6b2.js +209 -0
- package/dist/cjs/prand-a35ea6b2.js.map +1 -0
- package/dist/collection/assets/icons/check-circle-filled.svg +5 -0
- package/dist/collection/assets/icons/cosmos.svg +12 -0
- package/dist/collection/assets/icons/ethereum.svg +4 -0
- package/dist/collection/assets/icons/folder.svg +5 -0
- package/dist/collection/assets/icons/hero-plus-circle-capsule.svg +14 -0
- package/dist/collection/assets/icons/hero-plus-circle.svg +7 -0
- package/dist/collection/assets/icons/index.js +8 -1
- package/dist/collection/assets/icons/index.js.map +1 -1
- package/dist/collection/assets/icons/plus-circle.svg +1 -1
- package/dist/collection/assets/icons/solana.svg +19 -0
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/cpsl-alert/cpsl-alert.js +1 -1
- package/dist/collection/components/cpsl-animation/cpsl-animation.js +44 -104
- package/dist/collection/components/cpsl-animation/cpsl-animation.js.map +1 -1
- package/dist/collection/components/cpsl-app-bar/cpsl-app-bar.js +3 -3
- package/dist/collection/components/cpsl-auth-modal/cpsl-auth-modal.css +2 -1
- package/dist/collection/components/cpsl-avatar/cpsl-avatar.js +1 -1
- package/dist/collection/components/cpsl-button/cpsl-button.css +1 -1
- package/dist/collection/components/cpsl-button/cpsl-button.js +2 -2
- package/dist/collection/components/cpsl-button-group/cpsl-button-group.js +1 -1
- package/dist/collection/components/cpsl-card/cpsl-card.js +1 -1
- package/dist/collection/components/cpsl-checkbox/cpsl-checkbox.js +1 -1
- package/dist/collection/components/cpsl-code-input/cpsl-code-input.js +2 -2
- package/dist/collection/components/cpsl-col/cpsl-col.js +1 -1
- package/dist/collection/components/cpsl-divider/cpsl-divider.js +1 -1
- package/dist/collection/components/cpsl-drawer/cpsl-drawer.js +2 -2
- package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js +1 -1
- package/dist/collection/components/cpsl-file-upload/cpsl-file-upload.js +1 -1
- package/dist/collection/components/cpsl-grid/cpsl-grid.js +2 -2
- package/dist/collection/components/cpsl-hero/cpsl-hero.css +29 -2
- package/dist/collection/components/cpsl-hero/cpsl-hero.js +6 -5
- package/dist/collection/components/cpsl-hero/cpsl-hero.js.map +1 -1
- package/dist/collection/components/cpsl-icon/cpsl-icon.js +1 -1
- package/dist/collection/components/cpsl-identicon/cpsl-identicon.css +17 -10
- package/dist/collection/components/cpsl-identicon/cpsl-identicon.js +101 -36
- package/dist/collection/components/cpsl-identicon/cpsl-identicon.js.map +1 -1
- package/dist/collection/components/cpsl-identicon/cpsl-identicon.stories.js +1 -1
- package/dist/collection/components/cpsl-identicon/cpsl-identicon.stories.js.map +1 -1
- package/dist/collection/components/cpsl-input/cpsl-input.js +1 -1
- package/dist/collection/components/cpsl-nav-button/cpsl-nav-button.css +107 -0
- package/dist/collection/components/cpsl-nav-button/cpsl-nav-button.js +175 -0
- package/dist/collection/components/cpsl-nav-button/cpsl-nav-button.js.map +1 -0
- package/dist/collection/components/cpsl-nav-button-group/cpsl-nav-button-group.css +0 -42
- package/dist/collection/components/cpsl-nav-button-group/cpsl-nav-button-group.js +2 -50
- package/dist/collection/components/cpsl-nav-button-group/cpsl-nav-button-group.js.map +1 -1
- package/dist/collection/components/cpsl-overlay/cpsl-overlay.js +1 -1
- package/dist/collection/components/cpsl-pagination/cpsl-pagination.js +1 -1
- package/dist/collection/components/cpsl-pill/cpsl-pill.js +1 -1
- package/dist/collection/components/cpsl-popover/cpsl-popover.js +2 -2
- package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.js +1 -1
- package/dist/collection/components/cpsl-radio/cpsl-radio.js +1 -1
- package/dist/collection/components/cpsl-row/cpsl-row.js +1 -1
- package/dist/collection/components/cpsl-select/cpsl-select.js +2 -2
- package/dist/collection/components/cpsl-select/cpsl-select.js.map +1 -1
- package/dist/collection/components/cpsl-select-item/cpsl-select-item.js +1 -1
- package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.js +3 -3
- package/dist/collection/components/cpsl-spinner/cpsl-spinner.js +2 -2
- package/dist/collection/components/cpsl-switch/cpsl-switch.js +1 -1
- package/dist/collection/components/cpsl-tab/cpsl-tab.js +1 -1
- package/dist/collection/components/cpsl-table/cpsl-table.js +1 -1
- package/dist/collection/components/cpsl-tabs/cpsl-tabs.js +1 -1
- package/dist/collection/components/cpsl-text/cpsl-text.js +1 -1
- package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.js +2 -2
- package/dist/collection/index.js +1 -0
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/lib/prando.js +187 -0
- package/dist/collection/lib/prando.js.map +1 -0
- package/dist/collection/utils/prand.js +16 -0
- package/dist/collection/utils/prand.js.map +1 -0
- package/dist/esm/capsule.js +1 -1
- package/dist/esm/cpsl-alert_34.entry.js +122 -65
- package/dist/esm/cpsl-alert_34.entry.js.map +1 -1
- package/dist/esm/cpsl-col.entry.js +1 -1
- package/dist/esm/cpsl-grid.entry.js +2 -2
- package/dist/esm/cpsl-hero.entry.js +4 -3
- package/dist/esm/cpsl-hero.entry.js.map +1 -1
- package/dist/esm/cpsl-identicon.entry.js +76 -30
- package/dist/esm/cpsl-identicon.entry.js.map +1 -1
- package/dist/esm/cpsl-nav-button.entry.js +36 -0
- package/dist/esm/cpsl-nav-button.entry.js.map +1 -0
- package/dist/esm/cpsl-row.entry.js +1 -1
- package/dist/esm/index-91db3414.js +4 -4
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/prand-c8323494.js +205 -0
- package/dist/esm/prand-c8323494.js.map +1 -0
- package/dist/types/assets/icons/index.d.ts +7 -0
- package/dist/types/components/cpsl-animation/cpsl-animation.d.ts +0 -15
- package/dist/types/components/cpsl-hero/cpsl-hero.d.ts +2 -2
- package/dist/types/components/cpsl-identicon/cpsl-identicon.d.ts +5 -4
- package/dist/types/components/cpsl-nav-button/cpsl-nav-button.d.ts +43 -0
- package/dist/types/components/cpsl-nav-button-group/cpsl-nav-button-group.d.ts +0 -6
- package/dist/types/components.d.ts +93 -39
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lib/prando.d.ts +92 -0
- package/dist/types/utils/prand.d.ts +3 -0
- package/package.json +2 -4
- package/dist/capsule/p-0e558c7f.entry.js +0 -10
- package/dist/capsule/p-0e558c7f.entry.js.map +0 -1
- package/dist/capsule/p-0e6007ae.entry.js +0 -20
- package/dist/capsule/p-0e6007ae.entry.js.map +0 -1
- package/dist/capsule/p-32cdf894.entry.js.map +0 -1
- package/dist/capsule/p-3b042fd1.entry.js +0 -2
- package/dist/capsule/p-5d62e610.entry.js +0 -2
- package/dist/capsule/p-5d62e610.entry.js.map +0 -1
- package/dist/cjs/cpsl-animation.cjs.entry.js +0 -20133
- package/dist/cjs/cpsl-animation.cjs.entry.js.map +0 -1
- package/dist/collection/components/cpsl-animation/cpsl-animation.css +0 -17
- package/dist/esm/cpsl-animation.entry.js +0 -20129
- package/dist/esm/cpsl-animation.entry.js.map +0 -1
- /package/dist/capsule/{p-3b042fd1.entry.js.map → p-cfc382c0.entry.js.map} +0 -0
- /package/dist/capsule/{p-de2a16e4.entry.js.map → p-d165df27.entry.js.map} +0 -0
- /package/dist/capsule/{p-41bc3c58.entry.js.map → p-f0cd0482.entry.js.map} +0 -0
- /package/dist/types/Users/{norwood/capsule-repos → taylorbosch/Documents/GitHub/Capsule}/web-sdk/packages/core-components/.stencil/scripts/buildAssets.d.ts +0 -0
@@ -1,4 +1,6 @@
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
2
|
+
import Prando from "../../lib/prando";
|
3
|
+
import { COLORS } from "../../utils/prand";
|
2
4
|
const SingleArc = (rotation) => (h("svg", { class: {
|
3
5
|
rotate90: rotation === 1,
|
4
6
|
rotate180: rotation === 2,
|
@@ -9,35 +11,72 @@ const DoubleArc = (rotation) => (h("svg", { class: {
|
|
9
11
|
rotate180: rotation === 2,
|
10
12
|
rotate270: rotation === 3,
|
11
13
|
}, viewBox: "0 0 12 12", xmlns: "http://www.w3.org/2000/svg" }, h("g", { "clip-path": "url(#clip0_674_255)" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M12 24C18.6274 24 24 18.6274 24 12C24 5.37258 18.6274 0 12 0C5.37258 0 0 5.37258 0 12C0 18.6274 5.37258 24 12 24ZM12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21Z" }), h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M12 18C15.3137 18 18 15.3137 18 12C18 8.68629 15.3137 6 12 6C8.68629 6 6 8.68629 6 12C6 15.3137 8.68629 18 12 18ZM12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z" })), h("defs", null, h("clipPath", { id: "clip0_674_255" }, h("rect", { width: "12", height: "12" })))));
|
14
|
+
const BASE_PATTERNS = [
|
15
|
+
[
|
16
|
+
[0, 0, 0, 0],
|
17
|
+
[0, 1, 3, 2],
|
18
|
+
],
|
19
|
+
[
|
20
|
+
[1, 1, 0, 0],
|
21
|
+
[0, 1, 3, 2],
|
22
|
+
],
|
23
|
+
[
|
24
|
+
[0, 1, 0, 1],
|
25
|
+
[0, 1, 3, 2],
|
26
|
+
],
|
27
|
+
[
|
28
|
+
[0, 0, 1, 1],
|
29
|
+
[0, 1, 3, 2],
|
30
|
+
],
|
31
|
+
[
|
32
|
+
[1, 0, 1, 0],
|
33
|
+
[0, 1, 3, 2],
|
34
|
+
],
|
35
|
+
[
|
36
|
+
[1, 1, 1, 1],
|
37
|
+
[0, 1, 3, 2],
|
38
|
+
],
|
39
|
+
[
|
40
|
+
[0, 0, 0, 0],
|
41
|
+
[2, 3, 1, 0],
|
42
|
+
],
|
43
|
+
[
|
44
|
+
[1, 1, 1, 1],
|
45
|
+
[2, 3, 1, 0],
|
46
|
+
],
|
47
|
+
[
|
48
|
+
[1, 1, 1, 1],
|
49
|
+
[0, 1, 2, 3],
|
50
|
+
],
|
51
|
+
];
|
12
52
|
export class CpslIdenticon {
|
13
53
|
constructor() {
|
14
54
|
this.hash = undefined;
|
15
|
-
this.size =
|
55
|
+
this.size = '40px';
|
56
|
+
this.variant = 'default';
|
16
57
|
}
|
17
58
|
render() {
|
18
|
-
|
19
|
-
const
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
}
|
39
|
-
return isDouble ? DoubleArc(rotations[index]) : SingleArc(rotations[index]);
|
40
|
-
})));
|
59
|
+
let props;
|
60
|
+
const isEmpty = !this.hash;
|
61
|
+
if (!isEmpty)
|
62
|
+
props = getIdenticonProps(this.hash);
|
63
|
+
return (h(Host, { key: 'dca30d0d61d0e29f2ec3ad657225ac51db09940d', class: {
|
64
|
+
red: (props === null || props === void 0 ? void 0 : props.color) === 'red',
|
65
|
+
orange: (props === null || props === void 0 ? void 0 : props.color) === 'orange',
|
66
|
+
yellow: (props === null || props === void 0 ? void 0 : props.color) === 'yellow',
|
67
|
+
green: (props === null || props === void 0 ? void 0 : props.color) === 'green',
|
68
|
+
blue: (props === null || props === void 0 ? void 0 : props.color) === 'blue',
|
69
|
+
purple: (props === null || props === void 0 ? void 0 : props.color) === 'purple',
|
70
|
+
empty: !(props === null || props === void 0 ? void 0 : props.color) && !this.hash,
|
71
|
+
avatar: this.variant === 'avatar',
|
72
|
+
}, style: {
|
73
|
+
width: this.size,
|
74
|
+
height: this.size,
|
75
|
+
} }, (props === null || props === void 0 ? void 0 : props.shapes) &&
|
76
|
+
(props === null || props === void 0 ? void 0 : props.rotations) &&
|
77
|
+
props.shapes.map((isDouble, index) => {
|
78
|
+
return isDouble ? DoubleArc(props.rotations[index]) : SingleArc(props.rotations[index]);
|
79
|
+
})));
|
41
80
|
}
|
42
81
|
static get is() { return "cpsl-identicon"; }
|
43
82
|
static get encapsulation() { return "shadow"; }
|
@@ -57,12 +96,12 @@ export class CpslIdenticon {
|
|
57
96
|
"type": "string",
|
58
97
|
"mutable": false,
|
59
98
|
"complexType": {
|
60
|
-
"original": "string",
|
99
|
+
"original": "string | undefined",
|
61
100
|
"resolved": "string",
|
62
101
|
"references": {}
|
63
102
|
},
|
64
103
|
"required": false,
|
65
|
-
"optional":
|
104
|
+
"optional": true,
|
66
105
|
"docs": {
|
67
106
|
"tags": [],
|
68
107
|
"text": ""
|
@@ -71,30 +110,56 @@ export class CpslIdenticon {
|
|
71
110
|
"reflect": false
|
72
111
|
},
|
73
112
|
"size": {
|
74
|
-
"type": "
|
113
|
+
"type": "string",
|
75
114
|
"mutable": false,
|
76
115
|
"complexType": {
|
77
|
-
"original": "
|
78
|
-
"resolved": "
|
116
|
+
"original": "string",
|
117
|
+
"resolved": "string",
|
79
118
|
"references": {}
|
80
119
|
},
|
81
120
|
"required": false,
|
82
121
|
"optional": false,
|
83
122
|
"docs": {
|
84
123
|
"tags": [],
|
85
|
-
"text": "The
|
124
|
+
"text": "The CSS width and height of the identicon.\nDefault is: 40px."
|
86
125
|
},
|
87
126
|
"attribute": "size",
|
88
127
|
"reflect": false,
|
89
|
-
"defaultValue": "
|
128
|
+
"defaultValue": "'40px'"
|
129
|
+
},
|
130
|
+
"variant": {
|
131
|
+
"type": "string",
|
132
|
+
"mutable": false,
|
133
|
+
"complexType": {
|
134
|
+
"original": "'default' | 'avatar'",
|
135
|
+
"resolved": "\"avatar\" | \"default\"",
|
136
|
+
"references": {}
|
137
|
+
},
|
138
|
+
"required": false,
|
139
|
+
"optional": false,
|
140
|
+
"docs": {
|
141
|
+
"tags": [],
|
142
|
+
"text": ""
|
143
|
+
},
|
144
|
+
"attribute": "variant",
|
145
|
+
"reflect": false,
|
146
|
+
"defaultValue": "'default'"
|
90
147
|
}
|
91
148
|
};
|
92
149
|
}
|
93
150
|
}
|
94
|
-
const
|
95
|
-
function
|
96
|
-
const
|
97
|
-
const
|
98
|
-
|
151
|
+
const PRANDO_INTS = [COLORS.length, BASE_PATTERNS.length, 16];
|
152
|
+
function getIdenticonProps(seed) {
|
153
|
+
const rng = new Prando(seed);
|
154
|
+
const [iColor, iPattern, iDeviation] = PRANDO_INTS.map(len => rng.nextInt(0, len - 1));
|
155
|
+
const deviationIndex = Math.floor(iDeviation / 4);
|
156
|
+
const [isDeviateShape, isDeviateFlip] = [iDeviation % 2 === 1, iDeviation % 4 >= 2];
|
157
|
+
return {
|
158
|
+
color: COLORS[iColor],
|
159
|
+
shapes: BASE_PATTERNS[iPattern][0].map((s, i) => {
|
160
|
+
return i === deviationIndex ? (isDeviateShape ? (s === 1 ? false : true) : s === 1) : s === 1;
|
161
|
+
}),
|
162
|
+
rotations: BASE_PATTERNS[iPattern][1].map((r, i) => (i === deviationIndex ? (isDeviateFlip ? (r + 2) % 4 : r) : r)),
|
163
|
+
};
|
99
164
|
}
|
100
165
|
//# sourceMappingURL=cpsl-identicon.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"cpsl-identicon.js","sourceRoot":"","sources":["../../../../src/components/cpsl-identicon/cpsl-identicon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;
|
1
|
+
{"version":3,"file":"cpsl-identicon.js","sourceRoot":"","sources":["../../../../src/components/cpsl-identicon/cpsl-identicon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAS,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,SAAS,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,CACtC,WACE,KAAK,EAAE;QACL,QAAQ,EAAE,QAAQ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C","sourcesContent":["import { Component, Host, Prop, h } from '@stencil/core';\nimport Prando from '../../lib/prando';\nimport { Color, COLORS } from '../../utils/prand';\n\nconst SingleArc = (rotation: number) => (\n <svg\n class={{\n rotate90: rotation === 1,\n rotate180: rotation === 2,\n rotate270: rotation === 3,\n }}\n viewBox=\"0 0 12 12\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <g clip-path=\"url(#clip0_674_66)\">\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M12 24C18.6274 24 24 18.6274 24 12C24 5.37258 18.6274 0 12 0C5.37258 0 0 5.37258 0 12C0 18.6274 5.37258 24 12 24ZM12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21Z\"\n />\n </g>\n <defs>\n <clipPath id=\"clip0_674_66\">\n <rect width=\"12\" height=\"12\" />\n </clipPath>\n </defs>\n </svg>\n);\n\nconst DoubleArc = (rotation: number) => (\n <svg\n class={{\n rotate90: rotation === 1,\n rotate180: rotation === 2,\n rotate270: rotation === 3,\n }}\n viewBox=\"0 0 12 12\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <g clip-path=\"url(#clip0_674_255)\">\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M12 24C18.6274 24 24 18.6274 24 12C24 5.37258 18.6274 0 12 0C5.37258 0 0 5.37258 0 12C0 18.6274 5.37258 24 12 24ZM12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21Z\"\n />\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M12 18C15.3137 18 18 15.3137 18 12C18 8.68629 15.3137 6 12 6C8.68629 6 6 8.68629 6 12C6 15.3137 8.68629 18 12 18ZM12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z\"\n />\n </g>\n <defs>\n <clipPath id=\"clip0_674_255\">\n <rect width=\"12\" height=\"12\" />\n </clipPath>\n </defs>\n </svg>\n);\n\nconst BASE_PATTERNS = [\n [\n [0, 0, 0, 0],\n [0, 1, 3, 2],\n ],\n [\n [1, 1, 0, 0],\n [0, 1, 3, 2],\n ],\n [\n [0, 1, 0, 1],\n [0, 1, 3, 2],\n ],\n [\n [0, 0, 1, 1],\n [0, 1, 3, 2],\n ],\n [\n [1, 0, 1, 0],\n [0, 1, 3, 2],\n ],\n [\n [1, 1, 1, 1],\n [0, 1, 3, 2],\n ],\n [\n [0, 0, 0, 0],\n [2, 3, 1, 0],\n ],\n [\n [1, 1, 1, 1],\n [2, 3, 1, 0],\n ],\n [\n [1, 1, 1, 1],\n [0, 1, 2, 3],\n ],\n];\n\n@Component({\n tag: 'cpsl-identicon',\n styleUrl: 'cpsl-identicon.scss',\n shadow: true,\n})\nexport class CpslIdenticon {\n @Prop() hash?: string | undefined;\n\n /**\n * The CSS width and height of the identicon.\n * Default is: 40px.\n */\n @Prop() size: string = '40px';\n\n @Prop() variant: 'default' | 'avatar' = 'default';\n\n render() {\n let props;\n const isEmpty = !this.hash;\n if (!isEmpty) props = getIdenticonProps(this.hash);\n\n return (\n <Host\n class={{\n red: props?.color === 'red',\n orange: props?.color === 'orange',\n yellow: props?.color === 'yellow',\n green: props?.color === 'green',\n blue: props?.color === 'blue',\n purple: props?.color === 'purple',\n empty: !props?.color && !this.hash,\n avatar: this.variant === 'avatar',\n }}\n style={{\n width: this.size,\n height: this.size,\n }}\n >\n {props?.shapes &&\n props?.rotations &&\n props.shapes.map((isDouble, index) => {\n return isDouble ? DoubleArc(props.rotations[index]) : SingleArc(props.rotations[index]);\n })}\n </Host>\n );\n }\n}\n\nconst PRANDO_INTS = [COLORS.length, BASE_PATTERNS.length, 16];\n\nfunction getIdenticonProps(seed: string): { color: Color; shapes: boolean[]; rotations: number[] } {\n const rng = new Prando(seed);\n\n const [iColor, iPattern, iDeviation] = PRANDO_INTS.map(len => rng.nextInt(0, len - 1));\n\n const deviationIndex = Math.floor(iDeviation / 4);\n const [isDeviateShape, isDeviateFlip] = [iDeviation % 2 === 1, iDeviation % 4 >= 2];\n\n return {\n color: COLORS[iColor],\n shapes: BASE_PATTERNS[iPattern][0].map((s, i) => {\n return i === deviationIndex ? (isDeviateShape ? (s === 1 ? false : true) : s === 1) : s === 1;\n }),\n rotations: BASE_PATTERNS[iPattern][1].map((r, i) => (i === deviationIndex ? (isDeviateFlip ? (r + 2) % 4 : r) : r)),\n };\n}\n"]}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
const meta = {
|
2
2
|
title: 'Components/CpslIdenticon',
|
3
|
-
args: { hash: 'wruvbwic8932nc4u3cr9394n3cibj3892438cr', size:
|
3
|
+
args: { hash: 'wruvbwic8932nc4u3cr9394n3cibj3892438cr', size: '40px' },
|
4
4
|
argTypes: {
|
5
5
|
hash: { control: 'text' },
|
6
6
|
size: { control: 'number' },
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"cpsl-identicon.stories.js","sourceRoot":"","sources":["../../../../src/components/cpsl-identicon/cpsl-identicon.stories.tsx"],"names":[],"mappings":"AAGA,MAAM,IAAI,GAA+C;IACvD,KAAK,EAAE,0BAA0B;IACjC,IAAI,EAAE,EAAE,IAAI,EAAE,wCAAwC,EAAE,IAAI,EAAE,
|
1
|
+
{"version":3,"file":"cpsl-identicon.stories.js","sourceRoot":"","sources":["../../../../src/components/cpsl-identicon/cpsl-identicon.stories.tsx"],"names":[],"mappings":"AAGA,MAAM,IAAI,GAA+C;IACvD,KAAK,EAAE,0BAA0B;IACjC,IAAI,EAAE,EAAE,IAAI,EAAE,wCAAwC,EAAE,IAAI,EAAE,MAAM,EAAE;IACtE,QAAQ,EAAE;QACR,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QACzB,IAAI,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;KAC5B;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAIpB,MAAM,QAAQ,GAAU,IAAI,CAAC,EAAE,CAAC,wBAAwB,IAAI,CAAC,IAAI,IAAI,CAAC;AAEtE,MAAM,CAAC,MAAM,OAAO,GAAU,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC","sourcesContent":["import type { Meta, StoryFn } from '@storybook/html';\nimport { type CpslIdenticon } from './cpsl-identicon';\n\nconst meta: Meta<CpslIdenticon & { content?: string }> = {\n title: 'Components/CpslIdenticon',\n args: { hash: 'wruvbwic8932nc4u3cr9394n3cibj3892438cr', size: '40px' },\n argTypes: {\n hash: { control: 'text' },\n size: { control: 'number' },\n },\n};\n\nexport default meta;\n\ntype Story = StoryFn<CpslIdenticon & { content?: string }>;\n\nconst Template: Story = args => `<cpsl-identicon hash=${args.hash}/>`;\n\nexport const Primary: Story = Template.bind({});\n"]}
|
@@ -675,7 +675,7 @@ export class CpslInput {
|
|
675
675
|
"mutable": false,
|
676
676
|
"complexType": {
|
677
677
|
"original": "IconType",
|
678
|
-
"resolved": "\"search\" | \"alertCircle\" | \"angelListBrand\" | \"angelList\" | \"appleBrand\" | \"apple\" | \"arrowCircleBrokenDownLeft\" | \"arrowNarrow\" | \"arrow\" | \"backupKit\" | \"bank\" | \"brush\" | \"capsuleLogo\" | \"capsuleRingsDark\" | \"capsuleRings\" | \"capsule\" | \"checkCircle\" | \"check\" | \"chevronUp\" | \"clock\" | \"close\" | \"clubhouseBrand\" | \"clubhouse\" | \"copy\" | \"creditCard\" | \"cube\" | \"decentBrand\" | \"decent\" | \"discordBrand\" | \"discord\" | \"dot\" | \"downloadCloud\" | \"download\" | \"dribbbleBrand\" | \"dribbble\" | \"earth\" | \"eyeOff\" | \"eye\" | \"facebookBrand\" | \"facebook\" | \"farcasterBrand\" | \"farcaster\" | \"figmaBrand\" | \"figma\" | \"file\" | \"githubBrand\" | \"github\" | \"globe\" | \"googleBrand\" | \"google\" | \"helpCircle\" | \"heroAlertCircle\" | \"heroCheckmarkCapsule\" | \"heroCheckmark\" | \"heroEmail\" | \"heroExternalConnection\" | \"heroLock\" | \"heroPasskey\" | \"heroPhone\" | \"heroWallet\" | \"home\" | \"image\" | \"infoCircle\" | \"instagramBrand\" | \"instagram\" | \"key\" | \"lightning01\" | \"lightning\" | \"linkExternal\" | \"linkedinBrand\" | \"linkedin\" | \"logOut\" | \"mail\" | \"menu\" | \"moonpayBrand\" | \"moreLoginOptions\" | \"phone\" | \"pintrestBrand\" | \"pintrest\" | \"plusCircle\" | \"puzzlePiece\" | \"qrCode02\" | \"qrCode\" | \"rampNetworkBrand\" | \"rampNetwork\" | \"redditBrand\" | \"reddit\" | \"refresh\" | \"send\" | \"settings\" | \"shield\" | \"signalBrand\" | \"signal\" | \"snapchatBrand\" | \"snapchat\" | \"stars\" | \"stripeBrand\" | \"telegramBrand\" | \"telegram\" | \"tikTokBrand\" | \"tikTok\" | \"tumblrBrand\" | \"tumblr\" | \"twitterBrand\" | \"twitter\" | \"wallet\" | \"x\" | \"youtubeBrand\" | \"youtube\" | \"AD\" | \"AE\" | \"AF\" | \"AG\" | \"AI\" | \"AL\" | \"AM\" | \"AO\" | \"AR\" | \"AS\" | \"AT\" | \"AU\" | \"AW\" | \"AX\" | \"AZ\" | \"BA\" | \"BB\" | \"BD\" | \"BE\" | \"BF\" | \"BG\" | \"BH\" | \"BI\" | \"BJ\" | \"BL\" | \"BM\" | \"BN\" | \"BO\" | \"BQ\" | \"BQ2\" | \"BQ3\" | \"BR\" | \"BS\" | \"BT\" | \"BW\" | \"BY\" | \"BZ\" | \"CA\" | \"CC\" | \"CD\" | \"CD2\" | \"CF\" | \"CH\" | \"CK\" | \"CL\" | \"CM\" | \"CN\" | \"CO\" | \"CR\" | \"CU\" | \"CW\" | \"CX\" | \"CY\" | \"CZ\" | \"DE\" | \"DJ\" | \"DK\" | \"DM\" | \"DO\" | \"DS\" | \"DZ\" | \"EC\" | \"EE\" | \"EG\" | \"EH\" | \"ER\" | \"ES\" | \"ET\" | \"FI\" | \"FJ\" | \"FK\" | \"FM\" | \"FO\" | \"FR\" | \"GA\" | \"GB2\" | \"GB\" | \"GD\" | \"GE\" | \"GG\" | \"GH\" | \"GI\" | \"GL\" | \"GM\" | \"GN\" | \"GQ\" | \"GR\" | \"GT\" | \"GU\" | \"GW\" | \"GY\" | \"HK\" | \"HN\" | \"HR\" | \"HT\" | \"HU\" | \"ID\" | \"IE\" | \"IL\" | \"IM\" | \"IN\" | \"IO\" | \"IQ\" | \"IR\" | \"IS\" | \"IT\" | \"JE\" | \"JM\" | \"JO\" | \"JP\" | \"KE\" | \"KG\" | \"KH\" | \"KI\" | \"KM\" | \"KN\" | \"KP\" | \"KR\" | \"KW\" | \"KY\" | \"KZ\" | \"LA\" | \"LB\" | \"LC\" | \"LI\" | \"LK\" | \"LR\" | \"LS\" | \"LT\" | \"LU\" | \"LV\" | \"LY\" | \"MA\" | \"MC\" | \"MD\" | \"ME\" | \"MG\" | \"MH\" | \"MK\" | \"ML\" | \"MM\" | \"MN\" | \"MO\" | \"MP\" | \"MQ\" | \"MR\" | \"MS\" | \"MT\" | \"MU\" | \"MV\" | \"MW\" | \"MX\" | \"MY\" | \"MZ\" | \"NA\" | \"NE\" | \"NF\" | \"NG\" | \"NI\" | \"NL\" | \"NO\" | \"NP\" | \"NR\" | \"NU\" | \"NZ\" | \"OM\" | \"PA\" | \"PE\" | \"PF\" | \"PG\" | \"PH\" | \"PK\" | \"PL\" | \"PN\" | \"PR\" | \"PS\" | \"PT\" | \"PW\" | \"PY\" | \"QA\" | \"RO\" | \"RS\" | \"RU\" | \"RW\" | \"SA\" | \"SB\" | \"SC\" | \"SE\" | \"SG\" | \"SI\" | \"SK\" | \"SL\" | \"SM\" | \"SN\" | \"SO\" | \"SR\" | \"SS\" | \"ST\" | \"SV\" | \"SX\" | \"SY\" | \"SZ\" | \"TC\" | \"TD\" | \"TG\" | \"TH\" | \"TJ\" | \"TK\" | \"TL\" | \"TM\" | \"TN\" | \"TO\" | \"TR\" | \"TT\" | \"TV\" | \"TW\" | \"TZ\" | \"UA\" | \"UG\" | \"US\" | \"UY\" | \"UZ\" | \"VC\" | \"VE\" | \"VG\" | \"VI\" | \"VN\" | \"VU\" | \"WS\" | \"YE\" | \"ZA\" | \"ZM\" | \"ZW\"",
|
678
|
+
"resolved": "\"search\" | \"alertCircle\" | \"angelListBrand\" | \"angelList\" | \"appleBrand\" | \"apple\" | \"arrowCircleBrokenDownLeft\" | \"arrowNarrow\" | \"arrow\" | \"backupKit\" | \"bank\" | \"brush\" | \"capsuleLogo\" | \"capsuleRingsDark\" | \"capsuleRings\" | \"capsule\" | \"checkCircleFilled\" | \"checkCircle\" | \"check\" | \"chevronUp\" | \"clock\" | \"close\" | \"clubhouseBrand\" | \"clubhouse\" | \"copy\" | \"cosmos\" | \"creditCard\" | \"cube\" | \"decentBrand\" | \"decent\" | \"discordBrand\" | \"discord\" | \"dot\" | \"downloadCloud\" | \"download\" | \"dribbbleBrand\" | \"dribbble\" | \"earth\" | \"ethereum\" | \"eyeOff\" | \"eye\" | \"facebookBrand\" | \"facebook\" | \"farcasterBrand\" | \"farcaster\" | \"figmaBrand\" | \"figma\" | \"file\" | \"folder\" | \"githubBrand\" | \"github\" | \"globe\" | \"googleBrand\" | \"google\" | \"helpCircle\" | \"heroAlertCircle\" | \"heroCheckmarkCapsule\" | \"heroCheckmark\" | \"heroEmail\" | \"heroExternalConnection\" | \"heroLock\" | \"heroPasskey\" | \"heroPhone\" | \"heroPlusCircleCapsule\" | \"heroPlusCircle\" | \"heroWallet\" | \"home\" | \"image\" | \"infoCircle\" | \"instagramBrand\" | \"instagram\" | \"key\" | \"lightning01\" | \"lightning\" | \"linkExternal\" | \"linkedinBrand\" | \"linkedin\" | \"logOut\" | \"mail\" | \"menu\" | \"moonpayBrand\" | \"moreLoginOptions\" | \"phone\" | \"pintrestBrand\" | \"pintrest\" | \"plusCircle\" | \"puzzlePiece\" | \"qrCode02\" | \"qrCode\" | \"rampNetworkBrand\" | \"rampNetwork\" | \"redditBrand\" | \"reddit\" | \"refresh\" | \"send\" | \"settings\" | \"shield\" | \"signalBrand\" | \"signal\" | \"snapchatBrand\" | \"snapchat\" | \"solana\" | \"stars\" | \"stripeBrand\" | \"telegramBrand\" | \"telegram\" | \"tikTokBrand\" | \"tikTok\" | \"tumblrBrand\" | \"tumblr\" | \"twitterBrand\" | \"twitter\" | \"wallet\" | \"x\" | \"youtubeBrand\" | \"youtube\" | \"AD\" | \"AE\" | \"AF\" | \"AG\" | \"AI\" | \"AL\" | \"AM\" | \"AO\" | \"AR\" | \"AS\" | \"AT\" | \"AU\" | \"AW\" | \"AX\" | \"AZ\" | \"BA\" | \"BB\" | \"BD\" | \"BE\" | \"BF\" | \"BG\" | \"BH\" | \"BI\" | \"BJ\" | \"BL\" | \"BM\" | \"BN\" | \"BO\" | \"BQ\" | \"BQ2\" | \"BQ3\" | \"BR\" | \"BS\" | \"BT\" | \"BW\" | \"BY\" | \"BZ\" | \"CA\" | \"CC\" | \"CD\" | \"CD2\" | \"CF\" | \"CH\" | \"CK\" | \"CL\" | \"CM\" | \"CN\" | \"CO\" | \"CR\" | \"CU\" | \"CW\" | \"CX\" | \"CY\" | \"CZ\" | \"DE\" | \"DJ\" | \"DK\" | \"DM\" | \"DO\" | \"DS\" | \"DZ\" | \"EC\" | \"EE\" | \"EG\" | \"EH\" | \"ER\" | \"ES\" | \"ET\" | \"FI\" | \"FJ\" | \"FK\" | \"FM\" | \"FO\" | \"FR\" | \"GA\" | \"GB2\" | \"GB\" | \"GD\" | \"GE\" | \"GG\" | \"GH\" | \"GI\" | \"GL\" | \"GM\" | \"GN\" | \"GQ\" | \"GR\" | \"GT\" | \"GU\" | \"GW\" | \"GY\" | \"HK\" | \"HN\" | \"HR\" | \"HT\" | \"HU\" | \"ID\" | \"IE\" | \"IL\" | \"IM\" | \"IN\" | \"IO\" | \"IQ\" | \"IR\" | \"IS\" | \"IT\" | \"JE\" | \"JM\" | \"JO\" | \"JP\" | \"KE\" | \"KG\" | \"KH\" | \"KI\" | \"KM\" | \"KN\" | \"KP\" | \"KR\" | \"KW\" | \"KY\" | \"KZ\" | \"LA\" | \"LB\" | \"LC\" | \"LI\" | \"LK\" | \"LR\" | \"LS\" | \"LT\" | \"LU\" | \"LV\" | \"LY\" | \"MA\" | \"MC\" | \"MD\" | \"ME\" | \"MG\" | \"MH\" | \"MK\" | \"ML\" | \"MM\" | \"MN\" | \"MO\" | \"MP\" | \"MQ\" | \"MR\" | \"MS\" | \"MT\" | \"MU\" | \"MV\" | \"MW\" | \"MX\" | \"MY\" | \"MZ\" | \"NA\" | \"NE\" | \"NF\" | \"NG\" | \"NI\" | \"NL\" | \"NO\" | \"NP\" | \"NR\" | \"NU\" | \"NZ\" | \"OM\" | \"PA\" | \"PE\" | \"PF\" | \"PG\" | \"PH\" | \"PK\" | \"PL\" | \"PN\" | \"PR\" | \"PS\" | \"PT\" | \"PW\" | \"PY\" | \"QA\" | \"RO\" | \"RS\" | \"RU\" | \"RW\" | \"SA\" | \"SB\" | \"SC\" | \"SE\" | \"SG\" | \"SI\" | \"SK\" | \"SL\" | \"SM\" | \"SN\" | \"SO\" | \"SR\" | \"SS\" | \"ST\" | \"SV\" | \"SX\" | \"SY\" | \"SZ\" | \"TC\" | \"TD\" | \"TG\" | \"TH\" | \"TJ\" | \"TK\" | \"TL\" | \"TM\" | \"TN\" | \"TO\" | \"TR\" | \"TT\" | \"TV\" | \"TW\" | \"TZ\" | \"UA\" | \"UG\" | \"US\" | \"UY\" | \"UZ\" | \"VC\" | \"VE\" | \"VG\" | \"VI\" | \"VN\" | \"VU\" | \"WS\" | \"YE\" | \"ZA\" | \"ZM\" | \"ZW\"",
|
679
679
|
"references": {
|
680
680
|
"IconType": {
|
681
681
|
"location": "import",
|
@@ -0,0 +1,107 @@
|
|
1
|
+
:host {
|
2
|
+
display: flex;
|
3
|
+
flex-direction: column;
|
4
|
+
gap: 8px;
|
5
|
+
padding: 0px;
|
6
|
+
box-sizing: border-box;
|
7
|
+
width: 100%;
|
8
|
+
background: var(--cpsl-color-background-4);
|
9
|
+
border-radius: var(--cpsl-border-radius-primary-button);
|
10
|
+
overflow: hidden;
|
11
|
+
}
|
12
|
+
|
13
|
+
.sub-route-container {
|
14
|
+
display: flex;
|
15
|
+
flex-direction: column;
|
16
|
+
gap: 8px;
|
17
|
+
border-left: 1px solid var(--cpsl-color-background-16);
|
18
|
+
padding-left: 16px;
|
19
|
+
margin-left: 16px;
|
20
|
+
margin-bottom: 8px;
|
21
|
+
margin-right: 8px;
|
22
|
+
background: var(--cpsl-color-background-4);
|
23
|
+
}
|
24
|
+
|
25
|
+
.sub-route {
|
26
|
+
--button-padding-start: 8px;
|
27
|
+
--button-padding-end: 8px;
|
28
|
+
--button-padding-top: 8px;
|
29
|
+
--button-padding-bottom: 8px;
|
30
|
+
--button-justify-content: start;
|
31
|
+
--button-primary-color: var(--cpsl-color-background-48);
|
32
|
+
--button-primary-background-color: var(--cpsl-color-background-4);
|
33
|
+
--button-primary-border-color: var(--cpsl-color-background-4);
|
34
|
+
--button-primary-icon-color: var(--cpsl-color-text-primary);
|
35
|
+
--button-primary-disabled-color: var(--cpsl-color-text-primary);
|
36
|
+
--button-primary-disabled-background-color: var(--cpsl-color-background-4);
|
37
|
+
--button-primary-disabled-border-color: var(--cpsl-color-background-4);
|
38
|
+
--button-primary-disabled-icon-color: var(--cpsl-color-text-primary);
|
39
|
+
--button-primary-hover-color: var(--cpsl-color-background-48);
|
40
|
+
--button-primary-hover-background-color: var(--cpsl-color-background-0);
|
41
|
+
--button-primary-hover-border-color: var(--cpsl-color-background-4);
|
42
|
+
--button-primary-hover-icon-color: var(--cpsl-color-background-48);
|
43
|
+
--button-primary-active-color: var(--cpsl-color-text-primary);
|
44
|
+
--button-primary-active-background-color: var(--cpsl-color-background-4);
|
45
|
+
--button-primary-active-border-color: var(--cpsl-color-background-4);
|
46
|
+
--button-primary-active-icon-color: var(--cpsl-color-text-primary);
|
47
|
+
}
|
48
|
+
.sub-route.selected {
|
49
|
+
--button-primary-color: var(--cpsl-color-text-primary);
|
50
|
+
--button-primary-background-color: var(--cpsl-color-background-0);
|
51
|
+
--button-primary-border-color: var(--cpsl-color-background-0);
|
52
|
+
--button-primary-icon-color: var(--cpsl-color-background-48);
|
53
|
+
--button-primary-disabled-color: var(--cpsl-color-background-48);
|
54
|
+
--button-primary-disabled-background-color: var(--cpsl-color-background-0);
|
55
|
+
--button-primary-disabled-border-color: var(--cpsl-color-background-0);
|
56
|
+
--button-primary-disabled-icon-color: var(--cpsl-color-background-48);
|
57
|
+
--button-primary-hover-color: var(--cpsl-color-text-primary);
|
58
|
+
--button-primary-hover-background-color: var(--cpsl-color-background-0);
|
59
|
+
--button-primary-hover-border-color: var(--cpsl-color-background-4);
|
60
|
+
--button-primary-hover-icon-color: var(--cpsl-color-background-48);
|
61
|
+
--button-primary-active-color: var(--cpsl-color-background-48);
|
62
|
+
--button-primary-active-background-color: var(--cpsl-color-background-4);
|
63
|
+
--button-primary-active-border-color: var(--cpsl-color-background-4);
|
64
|
+
--button-primary-active-icon-color: var(--cpsl-color-background-48);
|
65
|
+
}
|
66
|
+
|
67
|
+
.main-route {
|
68
|
+
--button-padding-start: 8px;
|
69
|
+
--button-padding-end: 8px;
|
70
|
+
--button-padding-top: 8px;
|
71
|
+
--button-padding-bottom: 8px;
|
72
|
+
--button-justify-content: start;
|
73
|
+
--button-primary-color: var(--cpsl-color-background-48);
|
74
|
+
--button-primary-background-color: var(--cpsl-color-background-0);
|
75
|
+
--button-primary-border-color: var(--cpsl-color-background-0);
|
76
|
+
--button-primary-icon-color: var(--cpsl-color-background-48);
|
77
|
+
--button-primary-disabled-color: var(--cpsl-color-background-48);
|
78
|
+
--button-primary-disabled-background-color: var(--cpsl-color-background-0);
|
79
|
+
--button-primary-disabled-border-color: var(--cpsl-color-background-0);
|
80
|
+
--button-primary-disabled-icon-color: var(--cpsl-color-background-48);
|
81
|
+
--button-primary-hover-color: var(--cpsl-color-background-48);
|
82
|
+
--button-primary-hover-background-color: var(--cpsl-color-background-4);
|
83
|
+
--button-primary-hover-border-color: var(--cpsl-color-background-4);
|
84
|
+
--button-primary-hover-icon-color: var(--cpsl-color-background-48);
|
85
|
+
--button-primary-active-color: var(--cpsl-color-background-48);
|
86
|
+
--button-primary-active-background-color: var(--cpsl-color-background-4);
|
87
|
+
--button-primary-active-border-color: var(--cpsl-color-background-4);
|
88
|
+
--button-primary-active-icon-color: var(--cpsl-color-background-48);
|
89
|
+
}
|
90
|
+
.main-route.selected {
|
91
|
+
--button-primary-color: var(--cpsl-color-text-primary);
|
92
|
+
--button-primary-background-color: var(--cpsl-color-background-4);
|
93
|
+
--button-primary-border-color: var(--cpsl-color-background-4);
|
94
|
+
--button-primary-icon-color: var(--cpsl-color-text-primary);
|
95
|
+
--button-primary-disabled-color: var(--cpsl-color-text-primary);
|
96
|
+
--button-primary-disabled-background-color: var(--cpsl-color-background-4);
|
97
|
+
--button-primary-disabled-border-color: var(--cpsl-color-background-4);
|
98
|
+
--button-primary-disabled-icon-color: var(--cpsl-color-text-primary);
|
99
|
+
--button-primary-hover-color: var(--cpsl-color-text-primary);
|
100
|
+
--button-primary-hover-background-color: var(--cpsl-color-background-4);
|
101
|
+
--button-primary-hover-border-color: var(--cpsl-color-background-4);
|
102
|
+
--button-primary-hover-icon-color: var(--cpsl-color-text-primary);
|
103
|
+
--button-primary-active-color: var(--cpsl-color-text-primary);
|
104
|
+
--button-primary-active-background-color: var(--cpsl-color-background-4);
|
105
|
+
--button-primary-active-border-color: var(--cpsl-color-background-4);
|
106
|
+
--button-primary-active-icon-color: var(--cpsl-color-text-primary);
|
107
|
+
}
|
@@ -0,0 +1,175 @@
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
2
|
+
export class CpslNavButton {
|
3
|
+
constructor() {
|
4
|
+
this.handleNavButtonClick = () => {
|
5
|
+
this.cpslNavButtonClick.emit(this.route);
|
6
|
+
};
|
7
|
+
this.handleSubRouteClick = (route) => () => {
|
8
|
+
this.cpslNavButtonSubRouteClick.emit(route);
|
9
|
+
};
|
10
|
+
this.disabled = false;
|
11
|
+
this.exactMainRouteMatch = undefined;
|
12
|
+
this.exactSubRouteMatch = undefined;
|
13
|
+
this.route = undefined;
|
14
|
+
this.subRoutes = undefined;
|
15
|
+
this.path = undefined;
|
16
|
+
}
|
17
|
+
render() {
|
18
|
+
var _a, _b;
|
19
|
+
const selectedSubRoute = (_a = this.subRoutes) === null || _a === void 0 ? void 0 : _a.find(sr => (this.exactSubRouteMatch ? this.path === `${this.route}/${sr.value}` : this.path.includes(`${this.route}/${sr.value}`)));
|
20
|
+
const isMainRouteSelected = this.exactMainRouteMatch ? this.path === this.route : this.path.includes(this.route);
|
21
|
+
return (h(Host, { key: '8f8bd86051b11efc848491e7f5628c331ad2b208' }, h("cpsl-button", { key: '1e7a1a43032764760d4240a9af75a80fbf432d7e', id: this.route, class: { 'main-route': true, 'selected': !!selectedSubRoute || isMainRouteSelected }, fullWidth: true, variant: "primary", disabled: this.disabled, onClick: this.handleNavButtonClick }, h("slot", { key: '3adfced15f2744d0e49e5627e7b3d1ae35fe2e64', name: "start" }), h("slot", { key: '0a0480f72a68d0af0a279ba086a9915138212bd6' }), h("slot", { key: '624cf7807db283f33e7c727f00e32083d2b483b1', name: "end" })), (!!selectedSubRoute || isMainRouteSelected) && !!((_b = this.subRoutes) === null || _b === void 0 ? void 0 : _b.length) && (h("div", { key: '88039fa248445cc6f0cd641abdfdc2a3a5c45f26', class: "sub-route-container" }, this.subRoutes.map(sr => (h("cpsl-button", { key: sr.value, id: `${this.route}/${sr.value}`, class: { 'sub-route': true, 'selected': sr.value === (selectedSubRoute === null || selectedSubRoute === void 0 ? void 0 : selectedSubRoute.value) }, onClick: this.handleSubRouteClick(`${this.route}/${sr.value}`), fullWidth: true, variant: "primary" }, sr.label)))))));
|
22
|
+
}
|
23
|
+
static get is() { return "cpsl-nav-button"; }
|
24
|
+
static get encapsulation() { return "shadow"; }
|
25
|
+
static get originalStyleUrls() {
|
26
|
+
return {
|
27
|
+
"$": ["cpsl-nav-button.scss"]
|
28
|
+
};
|
29
|
+
}
|
30
|
+
static get styleUrls() {
|
31
|
+
return {
|
32
|
+
"$": ["cpsl-nav-button.css"]
|
33
|
+
};
|
34
|
+
}
|
35
|
+
static get properties() {
|
36
|
+
return {
|
37
|
+
"disabled": {
|
38
|
+
"type": "boolean",
|
39
|
+
"mutable": false,
|
40
|
+
"complexType": {
|
41
|
+
"original": "boolean",
|
42
|
+
"resolved": "boolean",
|
43
|
+
"references": {}
|
44
|
+
},
|
45
|
+
"required": false,
|
46
|
+
"optional": true,
|
47
|
+
"docs": {
|
48
|
+
"tags": [],
|
49
|
+
"text": "If the button is disabled.\nDefault is: false."
|
50
|
+
},
|
51
|
+
"attribute": "disabled",
|
52
|
+
"reflect": true,
|
53
|
+
"defaultValue": "false"
|
54
|
+
},
|
55
|
+
"exactMainRouteMatch": {
|
56
|
+
"type": "boolean",
|
57
|
+
"mutable": false,
|
58
|
+
"complexType": {
|
59
|
+
"original": "boolean",
|
60
|
+
"resolved": "boolean",
|
61
|
+
"references": {}
|
62
|
+
},
|
63
|
+
"required": false,
|
64
|
+
"optional": true,
|
65
|
+
"docs": {
|
66
|
+
"tags": [],
|
67
|
+
"text": "Whether or not to use exact matching for the selected main route."
|
68
|
+
},
|
69
|
+
"attribute": "exact-main-route-match",
|
70
|
+
"reflect": false
|
71
|
+
},
|
72
|
+
"exactSubRouteMatch": {
|
73
|
+
"type": "boolean",
|
74
|
+
"mutable": false,
|
75
|
+
"complexType": {
|
76
|
+
"original": "boolean",
|
77
|
+
"resolved": "boolean",
|
78
|
+
"references": {}
|
79
|
+
},
|
80
|
+
"required": false,
|
81
|
+
"optional": true,
|
82
|
+
"docs": {
|
83
|
+
"tags": [],
|
84
|
+
"text": "Whether or not to use exact matching for the selected sub route."
|
85
|
+
},
|
86
|
+
"attribute": "exact-sub-route-match",
|
87
|
+
"reflect": false
|
88
|
+
},
|
89
|
+
"route": {
|
90
|
+
"type": "string",
|
91
|
+
"mutable": false,
|
92
|
+
"complexType": {
|
93
|
+
"original": "string",
|
94
|
+
"resolved": "string",
|
95
|
+
"references": {}
|
96
|
+
},
|
97
|
+
"required": false,
|
98
|
+
"optional": false,
|
99
|
+
"docs": {
|
100
|
+
"tags": [],
|
101
|
+
"text": "The route for the button."
|
102
|
+
},
|
103
|
+
"attribute": "route",
|
104
|
+
"reflect": false
|
105
|
+
},
|
106
|
+
"subRoutes": {
|
107
|
+
"type": "unknown",
|
108
|
+
"mutable": false,
|
109
|
+
"complexType": {
|
110
|
+
"original": "{ label: string; value: string }[]",
|
111
|
+
"resolved": "{ label: string; value: string; }[]",
|
112
|
+
"references": {}
|
113
|
+
},
|
114
|
+
"required": false,
|
115
|
+
"optional": true,
|
116
|
+
"docs": {
|
117
|
+
"tags": [],
|
118
|
+
"text": "The id of the selected button."
|
119
|
+
}
|
120
|
+
},
|
121
|
+
"path": {
|
122
|
+
"type": "string",
|
123
|
+
"mutable": false,
|
124
|
+
"complexType": {
|
125
|
+
"original": "string",
|
126
|
+
"resolved": "string",
|
127
|
+
"references": {}
|
128
|
+
},
|
129
|
+
"required": false,
|
130
|
+
"optional": true,
|
131
|
+
"docs": {
|
132
|
+
"tags": [],
|
133
|
+
"text": "Path used to determine what button is selected"
|
134
|
+
},
|
135
|
+
"attribute": "path",
|
136
|
+
"reflect": false
|
137
|
+
}
|
138
|
+
};
|
139
|
+
}
|
140
|
+
static get events() {
|
141
|
+
return [{
|
142
|
+
"method": "cpslNavButtonClick",
|
143
|
+
"name": "cpslNavButtonClick",
|
144
|
+
"bubbles": true,
|
145
|
+
"cancelable": true,
|
146
|
+
"composed": true,
|
147
|
+
"docs": {
|
148
|
+
"tags": [],
|
149
|
+
"text": "Called when the nav button is clicked."
|
150
|
+
},
|
151
|
+
"complexType": {
|
152
|
+
"original": "string",
|
153
|
+
"resolved": "string",
|
154
|
+
"references": {}
|
155
|
+
}
|
156
|
+
}, {
|
157
|
+
"method": "cpslNavButtonSubRouteClick",
|
158
|
+
"name": "cpslNavButtonSubRouteClick",
|
159
|
+
"bubbles": true,
|
160
|
+
"cancelable": true,
|
161
|
+
"composed": true,
|
162
|
+
"docs": {
|
163
|
+
"tags": [],
|
164
|
+
"text": "Called when a nav button sub route is clicked."
|
165
|
+
},
|
166
|
+
"complexType": {
|
167
|
+
"original": "string",
|
168
|
+
"resolved": "string",
|
169
|
+
"references": {}
|
170
|
+
}
|
171
|
+
}];
|
172
|
+
}
|
173
|
+
static get elementRef() { return "el"; }
|
174
|
+
}
|
175
|
+
//# sourceMappingURL=cpsl-nav-button.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"cpsl-nav-button.js","sourceRoot":"","sources":["../../../../src/components/cpsl-nav-button/cpsl-nav-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAOvF,MAAM,OAAO,aAAa;;QAuChB,yBAAoB,GAAG,GAAG,EAAE;YAClC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3C,CAAC,CAAC;QAOM,wBAAmB,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,GAAG,EAAE;YACpD,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9C,CAAC,CAAC;wBA3C4C,KAAK;;;;;;;IA6CnD,MAAM;;QACJ,MAAM,gBAAgB,GAAG,MAAA,IAAI,CAAC,SAAS,0CAAE,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC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AI,EAAE,CAAC,KAAK,EAAE,CAAC,EAC9D,SAAS,QACT,OAAO,EAAC,SAAS,IAEhB,EAAE,CAAC,KAAK,CACG,CACf,CAAC,CACE,CACP,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, EventEmitter, Host, Prop, h, Event, Element } from '@stencil/core';\n\n@Component({\n tag: 'cpsl-nav-button',\n styleUrl: 'cpsl-nav-button.scss',\n shadow: true,\n})\nexport class CpslNavButton {\n @Element() el!: HTMLCpslNavButtonElement;\n\n /**\n * If the button is disabled.\n * Default is: false.\n */\n @Prop({ reflect: true }) disabled?: boolean = false;\n\n /**\n * Whether or not to use exact matching for the selected main route.\n */\n @Prop() exactMainRouteMatch?: boolean;\n\n /**\n * Whether or not to use exact matching for the selected sub route.\n */\n @Prop() exactSubRouteMatch?: boolean;\n\n /**\n * The route for the button.\n */\n @Prop() route: string;\n\n /**\n * The id of the selected button.\n */\n @Prop() subRoutes?: { label: string; value: string }[];\n\n /**\n * Path used to determine what button is selected\n */\n @Prop() path?: string;\n\n /**\n * Called when the nav button is clicked.\n */\n @Event() cpslNavButtonClick: EventEmitter<string>;\n\n private handleNavButtonClick = () => {\n this.cpslNavButtonClick.emit(this.route);\n };\n\n /**\n * Called when a nav button sub route is clicked.\n */\n @Event() cpslNavButtonSubRouteClick: EventEmitter<string>;\n\n private handleSubRouteClick = (route: string) => () => {\n this.cpslNavButtonSubRouteClick.emit(route);\n };\n\n render() {\n const selectedSubRoute = this.subRoutes?.find(sr => (this.exactSubRouteMatch ? this.path === `${this.route}/${sr.value}` : this.path.includes(`${this.route}/${sr.value}`)));\n const isMainRouteSelected = this.exactMainRouteMatch ? this.path === this.route : this.path.includes(this.route);\n\n return (\n <Host>\n <cpsl-button\n id={this.route}\n class={{ 'main-route': true, 'selected': !!selectedSubRoute || isMainRouteSelected }}\n fullWidth\n variant=\"primary\"\n disabled={this.disabled}\n onClick={this.handleNavButtonClick}\n >\n <slot name=\"start\"></slot>\n <slot></slot>\n <slot name=\"end\"></slot>\n </cpsl-button>\n {(!!selectedSubRoute || isMainRouteSelected) && !!this.subRoutes?.length && (\n <div class=\"sub-route-container\">\n {this.subRoutes.map(sr => (\n <cpsl-button\n key={sr.value}\n id={`${this.route}/${sr.value}`}\n class={{ 'sub-route': true, 'selected': sr.value === selectedSubRoute?.value }}\n onClick={this.handleSubRouteClick(`${this.route}/${sr.value}`)}\n fullWidth\n variant=\"primary\"\n >\n {sr.label}\n </cpsl-button>\n ))}\n </div>\n )}\n </Host>\n );\n }\n}\n"]}
|