@knapsack/sandbox-components 4.76.0--canary.5638.1676110.0 → 4.76.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/CHANGELOG.md +17 -0
- package/dist/web-components/bundle.js +120 -5
- package/dist/web-components/button.d.ts +4 -1
- package/dist/web-components/button.d.ts.map +1 -1
- package/dist/web-components/button.js +15 -5
- package/dist/web-components/button.js.map +1 -1
- package/dist/web-components/card.d.ts +36 -0
- package/dist/web-components/card.d.ts.map +1 -0
- package/dist/web-components/card.js +141 -0
- package/dist/web-components/card.js.map +1 -0
- package/dist/web-components/custom-elements.json +236 -47
- package/dist/web-components/index.d.ts +1 -0
- package/dist/web-components/index.d.ts.map +1 -1
- package/dist/web-components/index.js +1 -0
- package/dist/web-components/index.js.map +1 -1
- package/package.json +12 -12
- package/src/web-components/button.ts +5 -2
- package/src/web-components/card.ts +127 -0
- package/src/web-components/index.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
# v4.76.0 (Tue Mar 04 2025)
|
|
2
|
+
|
|
3
|
+
#### 🚀 Enhancement
|
|
4
|
+
|
|
5
|
+
- support Web Components manifest v1 KSP-6181 [#5727](https://github.com/knapsack-labs/app-monorepo/pull/5727) ([@EvanLovely](https://github.com/EvanLovely))
|
|
6
|
+
|
|
7
|
+
#### 🏠 Internal
|
|
8
|
+
|
|
9
|
+
- KSP-6162: ensure logger includes top-level error [#5710](https://github.com/knapsack-labs/app-monorepo/pull/5710) ([@illepic](https://github.com/illepic))
|
|
10
|
+
|
|
11
|
+
#### Authors: 2
|
|
12
|
+
|
|
13
|
+
- Christopher Bloom ([@illepic](https://github.com/illepic))
|
|
14
|
+
- Evan Lovely ([@EvanLovely](https://github.com/EvanLovely))
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
1
18
|
# v4.75.7 (Mon Feb 24 2025)
|
|
2
19
|
|
|
3
20
|
#### 🐛 Bug Fix
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __typeError = (msg) => {
|
|
4
|
+
throw TypeError(msg);
|
|
5
|
+
};
|
|
3
6
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
7
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
8
|
for (var i5 = decorators.length - 1, decorator; i5 >= 0; i5--)
|
|
@@ -8,6 +11,9 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
8
11
|
if (kind && result) __defProp(target, key, result);
|
|
9
12
|
return result;
|
|
10
13
|
};
|
|
14
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
15
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
16
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
11
17
|
|
|
12
18
|
// ../../../../node_modules/.pnpm/@lit+reactive-element@1.6.3/node_modules/@lit/reactive-element/css-tag.js
|
|
13
19
|
var t = window;
|
|
@@ -639,17 +645,15 @@ var n6;
|
|
|
639
645
|
var e6 = null != (null === (n6 = window.HTMLSlotElement) || void 0 === n6 ? void 0 : n6.prototype.assignedElements) ? (o7, n7) => o7.assignedElements(n7) : (o7, n7) => o7.assignedNodes(n7).filter((o8) => o8.nodeType === Node.ELEMENT_NODE);
|
|
640
646
|
|
|
641
647
|
// src/web-components/button.ts
|
|
648
|
+
var _SimpleButton_instances, handleClick_fn;
|
|
642
649
|
var SimpleButton = class extends s4 {
|
|
643
650
|
constructor() {
|
|
644
651
|
super(...arguments);
|
|
652
|
+
__privateAdd(this, _SimpleButton_instances);
|
|
645
653
|
this.label = "Click me";
|
|
646
654
|
this.size = "medium";
|
|
647
655
|
this.type = "filled";
|
|
648
656
|
}
|
|
649
|
-
_handleClick() {
|
|
650
|
-
console.log("Button clicked!");
|
|
651
|
-
this.dispatchEvent(new CustomEvent("button-click"));
|
|
652
|
-
}
|
|
653
657
|
render() {
|
|
654
658
|
const classes = {
|
|
655
659
|
button: true,
|
|
@@ -657,12 +661,17 @@ var SimpleButton = class extends s4 {
|
|
|
657
661
|
[`button--type-${this.type}`]: true
|
|
658
662
|
};
|
|
659
663
|
return x`
|
|
660
|
-
<button @click=${this
|
|
664
|
+
<button @click=${__privateMethod(this, _SimpleButton_instances, handleClick_fn)} class=${o5(classes)}>
|
|
661
665
|
${this.label}
|
|
662
666
|
</button>
|
|
663
667
|
`;
|
|
664
668
|
}
|
|
665
669
|
};
|
|
670
|
+
_SimpleButton_instances = new WeakSet();
|
|
671
|
+
handleClick_fn = function() {
|
|
672
|
+
console.log("Button clicked!");
|
|
673
|
+
this.dispatchEvent(new CustomEvent("button-click"));
|
|
674
|
+
};
|
|
666
675
|
SimpleButton.shadowRootOptions = {
|
|
667
676
|
...s4.shadowRootOptions,
|
|
668
677
|
mode: "open"
|
|
@@ -739,6 +748,112 @@ __decorateClass([
|
|
|
739
748
|
n5({ type: String })
|
|
740
749
|
], SimpleButton.prototype, "type", 2);
|
|
741
750
|
customElements.define("simple-button", SimpleButton);
|
|
751
|
+
|
|
752
|
+
// src/web-components/card.ts
|
|
753
|
+
var SimpleCard = class extends s4 {
|
|
754
|
+
constructor() {
|
|
755
|
+
super(...arguments);
|
|
756
|
+
this.elevation = "low";
|
|
757
|
+
this.padding = "medium";
|
|
758
|
+
this.bordered = false;
|
|
759
|
+
}
|
|
760
|
+
render() {
|
|
761
|
+
const classes = {
|
|
762
|
+
card: true,
|
|
763
|
+
"card--bordered": this.bordered,
|
|
764
|
+
[`card--elevation-${this.elevation}`]: this.elevation !== "none",
|
|
765
|
+
[`card--padding-${this.padding}`]: this.padding !== "none"
|
|
766
|
+
};
|
|
767
|
+
return x`
|
|
768
|
+
<div class=${o5(classes)} part="card">
|
|
769
|
+
<div class="header" part="header">
|
|
770
|
+
<slot name="header"></slot>
|
|
771
|
+
</div>
|
|
772
|
+
<div class="content" part="content">
|
|
773
|
+
<slot></slot>
|
|
774
|
+
</div>
|
|
775
|
+
<div class="footer" part="footer">
|
|
776
|
+
<slot name="footer"></slot>
|
|
777
|
+
</div>
|
|
778
|
+
</div>
|
|
779
|
+
`;
|
|
780
|
+
}
|
|
781
|
+
};
|
|
782
|
+
SimpleCard.shadowRootOptions = {
|
|
783
|
+
...s4.shadowRootOptions,
|
|
784
|
+
mode: "open"
|
|
785
|
+
};
|
|
786
|
+
SimpleCard.styles = i`
|
|
787
|
+
:host {
|
|
788
|
+
display: block;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
.card {
|
|
792
|
+
background-color: #ffffff;
|
|
793
|
+
background-color: var(--color-white);
|
|
794
|
+
border-radius: 8px;
|
|
795
|
+
border-radius: var(--radius-medium);
|
|
796
|
+
overflow: hidden;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
.card--bordered {
|
|
800
|
+
border: 1px solid #e5e7eb;
|
|
801
|
+
border: 1px solid var(--color-gray-200, #e5e7eb);
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
.card--elevation-low {
|
|
805
|
+
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
.card--elevation-medium {
|
|
809
|
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
|
810
|
+
0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
.card--elevation-high {
|
|
814
|
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
|
|
815
|
+
0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
.card--padding-small {
|
|
819
|
+
padding: 12px;
|
|
820
|
+
padding: var(--spacing-medium);
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
.card--padding-medium {
|
|
824
|
+
padding: 16px;
|
|
825
|
+
padding: var(--spacing-large);
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
.card--padding-large {
|
|
829
|
+
padding: 24px;
|
|
830
|
+
padding: var(--spacing-xlarge);
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
.header {
|
|
834
|
+
margin-bottom: 16px;
|
|
835
|
+
margin-bottom: var(--spacing-large);
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
.footer {
|
|
839
|
+
margin-top: 16px;
|
|
840
|
+
margin-top: var(--spacing-large);
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
::slotted(*) {
|
|
844
|
+
margin: 0;
|
|
845
|
+
}
|
|
846
|
+
`;
|
|
847
|
+
__decorateClass([
|
|
848
|
+
n5({ type: String })
|
|
849
|
+
], SimpleCard.prototype, "elevation", 2);
|
|
850
|
+
__decorateClass([
|
|
851
|
+
n5({ type: String })
|
|
852
|
+
], SimpleCard.prototype, "padding", 2);
|
|
853
|
+
__decorateClass([
|
|
854
|
+
n5({ type: Boolean })
|
|
855
|
+
], SimpleCard.prototype, "bordered", 2);
|
|
856
|
+
customElements.define("simple-card", SimpleCard);
|
|
742
857
|
/*! Bundled license information:
|
|
743
858
|
|
|
744
859
|
@lit/reactive-element/css-tag.js:
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* @event button-click - Fired when the button is clicked
|
|
4
|
+
*/
|
|
2
5
|
export declare class SimpleButton extends LitElement {
|
|
6
|
+
#private;
|
|
3
7
|
static shadowRootOptions: {
|
|
4
8
|
mode: "open";
|
|
5
9
|
delegatesFocus?: boolean;
|
|
@@ -13,7 +17,6 @@ export declare class SimpleButton extends LitElement {
|
|
|
13
17
|
size: 'small' | 'medium' | 'large';
|
|
14
18
|
type: 'filled' | 'outlined';
|
|
15
19
|
static styles: import("lit").CSSResult;
|
|
16
|
-
_handleClick(): void;
|
|
17
20
|
render(): import("lit").TemplateResult<1>;
|
|
18
21
|
}
|
|
19
22
|
//# sourceMappingURL=button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/web-components/button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C,qBAAa,YAAa,SAAQ,UAAU
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/web-components/button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C;;GAEG;AACH,qBAAa,YAAa,SAAQ,UAAU;;IAC1C,MAAM,CAAC,iBAAiB;;;;;MAGwB;IAGhD,KAAK,SAAc;IAEnB;;OAEG;IAEH,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAY;IAG9C,IAAI,EAAE,QAAQ,GAAG,UAAU,CAAY;IAEvC,MAAM,CAAC,MAAM,0BA6DX;IAOF,MAAM;CAaP"}
|
|
@@ -7,12 +7,22 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
11
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
12
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
13
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
14
|
+
};
|
|
15
|
+
var _SimpleButton_instances, _SimpleButton_handleClick;
|
|
10
16
|
import { LitElement, css, html } from 'lit';
|
|
11
17
|
import { classMap } from 'lit/directives/class-map.js';
|
|
12
18
|
import { property } from 'lit/decorators.js';
|
|
19
|
+
/**
|
|
20
|
+
* @event button-click - Fired when the button is clicked
|
|
21
|
+
*/
|
|
13
22
|
export class SimpleButton extends LitElement {
|
|
14
23
|
constructor() {
|
|
15
24
|
super(...arguments);
|
|
25
|
+
_SimpleButton_instances.add(this);
|
|
16
26
|
this.label = 'Click me';
|
|
17
27
|
/**
|
|
18
28
|
* How big
|
|
@@ -20,10 +30,6 @@ export class SimpleButton extends LitElement {
|
|
|
20
30
|
this.size = 'medium';
|
|
21
31
|
this.type = 'filled';
|
|
22
32
|
}
|
|
23
|
-
_handleClick() {
|
|
24
|
-
console.log('Button clicked!');
|
|
25
|
-
this.dispatchEvent(new CustomEvent('button-click'));
|
|
26
|
-
}
|
|
27
33
|
render() {
|
|
28
34
|
const classes = {
|
|
29
35
|
button: true,
|
|
@@ -31,12 +37,16 @@ export class SimpleButton extends LitElement {
|
|
|
31
37
|
[`button--type-${this.type}`]: true,
|
|
32
38
|
};
|
|
33
39
|
return html `
|
|
34
|
-
<button @click=${this
|
|
40
|
+
<button @click=${__classPrivateFieldGet(this, _SimpleButton_instances, "m", _SimpleButton_handleClick)} class=${classMap(classes)}>
|
|
35
41
|
${this.label}
|
|
36
42
|
</button>
|
|
37
43
|
`;
|
|
38
44
|
}
|
|
39
45
|
}
|
|
46
|
+
_SimpleButton_instances = new WeakSet(), _SimpleButton_handleClick = function _SimpleButton_handleClick() {
|
|
47
|
+
console.log('Button clicked!');
|
|
48
|
+
this.dispatchEvent(new CustomEvent('button-click'));
|
|
49
|
+
};
|
|
40
50
|
SimpleButton.shadowRootOptions = {
|
|
41
51
|
...LitElement.shadowRootOptions,
|
|
42
52
|
mode: 'open',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/web-components/button.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/web-components/button.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,UAAU;IAA5C;;;QAOE,UAAK,GAAG,UAAU,CAAC;QAEnB;;WAEG;QAEH,SAAI,GAAiC,QAAQ,CAAC;QAG9C,SAAI,GAA0B,QAAQ,CAAC;IAmFzC,CAAC;IAbC,MAAM;QACJ,MAAM,OAAO,GAAG;YACd,MAAM,EAAE,IAAI;YACZ,CAAC,gBAAgB,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;YACnC,CAAC,gBAAgB,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;SACpC,CAAC;QAEF,OAAO,IAAI,CAAA;uBACQ,uBAAA,IAAI,0DAAa,UAAU,QAAQ,CAAC,OAAO,CAAC;UACzD,IAAI,CAAC,KAAK;;KAEf,CAAC;IACJ,CAAC;;;IAhBC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAC/B,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC;AACtD,CAAC;AAnFM,8BAAiB,GAAG;IACzB,GAAG,UAAU,CAAC,iBAAiB;IAC/B,IAAI,EAAE,MAAM;CACiC,AAHvB,CAGwB;AAczC,mBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DlB,AA7DY,CA6DX;AAxEF;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CACR;AAMnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CACmB;AAG9C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CACY;AAqFzC,cAAc,CAAC,MAAM,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* A versatile card component that can be used to group related content.
|
|
4
|
+
*
|
|
5
|
+
* @slot header - Content to be rendered in the card header
|
|
6
|
+
* @slot default - The default slot for the main content
|
|
7
|
+
* @slot footer - Content to be rendered in the card footer
|
|
8
|
+
*
|
|
9
|
+
* @csspart card - The main card wrapper
|
|
10
|
+
* @csspart header - The header container
|
|
11
|
+
* @csspart content - The main content container
|
|
12
|
+
* @csspart footer - The footer container
|
|
13
|
+
*/
|
|
14
|
+
export declare class SimpleCard extends LitElement {
|
|
15
|
+
static shadowRootOptions: {
|
|
16
|
+
mode: "open";
|
|
17
|
+
delegatesFocus?: boolean;
|
|
18
|
+
serializable?: boolean;
|
|
19
|
+
slotAssignment?: SlotAssignmentMode;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Card elevation level
|
|
23
|
+
*/
|
|
24
|
+
elevation: 'none' | 'low' | 'medium' | 'high';
|
|
25
|
+
/**
|
|
26
|
+
* Card padding size
|
|
27
|
+
*/
|
|
28
|
+
padding: 'none' | 'small' | 'medium' | 'large';
|
|
29
|
+
/**
|
|
30
|
+
* Whether the card has a border
|
|
31
|
+
*/
|
|
32
|
+
bordered: boolean;
|
|
33
|
+
static styles: import("lit").CSSResult;
|
|
34
|
+
render(): import("lit").TemplateResult<1>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/web-components/card.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C;;;;;;;;;;;GAWG;AACH,qBAAa,UAAW,SAAQ,UAAU;IACxC,MAAM,CAAC,iBAAiB;;;;;MAGwB;IAEhD;;OAEG;IAEH,SAAS,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAS;IAEtD;;OAEG;IAEH,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAY;IAE1D;;OAEG;IAEH,QAAQ,UAAS;IAEjB,MAAM,CAAC,MAAM,0BA4DX;IAEF,MAAM;CAsBP"}
|
|
@@ -0,0 +1,141 @@
|
|
|
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
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { LitElement, css, html } from 'lit';
|
|
11
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
12
|
+
import { property } from 'lit/decorators.js';
|
|
13
|
+
/**
|
|
14
|
+
* A versatile card component that can be used to group related content.
|
|
15
|
+
*
|
|
16
|
+
* @slot header - Content to be rendered in the card header
|
|
17
|
+
* @slot default - The default slot for the main content
|
|
18
|
+
* @slot footer - Content to be rendered in the card footer
|
|
19
|
+
*
|
|
20
|
+
* @csspart card - The main card wrapper
|
|
21
|
+
* @csspart header - The header container
|
|
22
|
+
* @csspart content - The main content container
|
|
23
|
+
* @csspart footer - The footer container
|
|
24
|
+
*/
|
|
25
|
+
export class SimpleCard extends LitElement {
|
|
26
|
+
constructor() {
|
|
27
|
+
super(...arguments);
|
|
28
|
+
/**
|
|
29
|
+
* Card elevation level
|
|
30
|
+
*/
|
|
31
|
+
this.elevation = 'low';
|
|
32
|
+
/**
|
|
33
|
+
* Card padding size
|
|
34
|
+
*/
|
|
35
|
+
this.padding = 'medium';
|
|
36
|
+
/**
|
|
37
|
+
* Whether the card has a border
|
|
38
|
+
*/
|
|
39
|
+
this.bordered = false;
|
|
40
|
+
}
|
|
41
|
+
render() {
|
|
42
|
+
const classes = {
|
|
43
|
+
card: true,
|
|
44
|
+
'card--bordered': this.bordered,
|
|
45
|
+
[`card--elevation-${this.elevation}`]: this.elevation !== 'none',
|
|
46
|
+
[`card--padding-${this.padding}`]: this.padding !== 'none',
|
|
47
|
+
};
|
|
48
|
+
return html `
|
|
49
|
+
<div class=${classMap(classes)} part="card">
|
|
50
|
+
<div class="header" part="header">
|
|
51
|
+
<slot name="header"></slot>
|
|
52
|
+
</div>
|
|
53
|
+
<div class="content" part="content">
|
|
54
|
+
<slot></slot>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="footer" part="footer">
|
|
57
|
+
<slot name="footer"></slot>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
`;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
SimpleCard.shadowRootOptions = {
|
|
64
|
+
...LitElement.shadowRootOptions,
|
|
65
|
+
mode: 'open',
|
|
66
|
+
};
|
|
67
|
+
SimpleCard.styles = css `
|
|
68
|
+
:host {
|
|
69
|
+
display: block;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.card {
|
|
73
|
+
background-color: #ffffff;
|
|
74
|
+
background-color: var(--color-white);
|
|
75
|
+
border-radius: 8px;
|
|
76
|
+
border-radius: var(--radius-medium);
|
|
77
|
+
overflow: hidden;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.card--bordered {
|
|
81
|
+
border: 1px solid #e5e7eb;
|
|
82
|
+
border: 1px solid var(--color-gray-200, #e5e7eb);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.card--elevation-low {
|
|
86
|
+
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.card--elevation-medium {
|
|
90
|
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
|
91
|
+
0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.card--elevation-high {
|
|
95
|
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
|
|
96
|
+
0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.card--padding-small {
|
|
100
|
+
padding: 12px;
|
|
101
|
+
padding: var(--spacing-medium);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.card--padding-medium {
|
|
105
|
+
padding: 16px;
|
|
106
|
+
padding: var(--spacing-large);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.card--padding-large {
|
|
110
|
+
padding: 24px;
|
|
111
|
+
padding: var(--spacing-xlarge);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.header {
|
|
115
|
+
margin-bottom: 16px;
|
|
116
|
+
margin-bottom: var(--spacing-large);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.footer {
|
|
120
|
+
margin-top: 16px;
|
|
121
|
+
margin-top: var(--spacing-large);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
::slotted(*) {
|
|
125
|
+
margin: 0;
|
|
126
|
+
}
|
|
127
|
+
`;
|
|
128
|
+
__decorate([
|
|
129
|
+
property({ type: String }),
|
|
130
|
+
__metadata("design:type", String)
|
|
131
|
+
], SimpleCard.prototype, "elevation", void 0);
|
|
132
|
+
__decorate([
|
|
133
|
+
property({ type: String }),
|
|
134
|
+
__metadata("design:type", String)
|
|
135
|
+
], SimpleCard.prototype, "padding", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
property({ type: Boolean }),
|
|
138
|
+
__metadata("design:type", Object)
|
|
139
|
+
], SimpleCard.prototype, "bordered", void 0);
|
|
140
|
+
customElements.define('simple-card', SimpleCard);
|
|
141
|
+
//# sourceMappingURL=card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.js","sourceRoot":"","sources":["../../src/web-components/card.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,UAAW,SAAQ,UAAU;IAA1C;;QAME;;WAEG;QAEH,cAAS,GAAuC,KAAK,CAAC;QAEtD;;WAEG;QAEH,YAAO,GAA0C,QAAQ,CAAC;QAE1D;;WAEG;QAEH,aAAQ,GAAG,KAAK,CAAC;IAsFnB,CAAC;IAtBC,MAAM;QACJ,MAAM,OAAO,GAAG;YACd,IAAI,EAAE,IAAI;YACV,gBAAgB,EAAE,IAAI,CAAC,QAAQ;YAC/B,CAAC,mBAAmB,IAAI,CAAC,SAAS,EAAE,CAAC,EAAE,IAAI,CAAC,SAAS,KAAK,MAAM;YAChE,CAAC,iBAAiB,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,OAAO,KAAK,MAAM;SAC3D,CAAC;QAEF,OAAO,IAAI,CAAA;mBACI,QAAQ,CAAC,OAAO,CAAC;;;;;;;;;;;KAW/B,CAAC;IACJ,CAAC;;AA1GM,4BAAiB,GAAG;IACzB,GAAG,UAAU,CAAC,iBAAiB;IAC/B,IAAI,EAAE,MAAM;CACiC,AAHvB,CAGwB;AAoBzC,iBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DlB,AA5DY,CA4DX;AA1EF;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CAC2B;AAMtD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CAC+B;AAM1D;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;4CACX;AAwFnB,cAAc,CAAC,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -1,63 +1,252 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
2
|
+
"schemaVersion": "1.0.0",
|
|
3
|
+
"readme": "",
|
|
4
|
+
"modules": [
|
|
4
5
|
{
|
|
5
|
-
"
|
|
6
|
-
"path": "
|
|
7
|
-
"
|
|
6
|
+
"kind": "javascript-module",
|
|
7
|
+
"path": "src/web-components/button.ts",
|
|
8
|
+
"declarations": [
|
|
8
9
|
{
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
"kind": "class",
|
|
11
|
+
"description": "",
|
|
12
|
+
"name": "SimpleButton",
|
|
13
|
+
"members": [
|
|
14
|
+
{
|
|
15
|
+
"kind": "field",
|
|
16
|
+
"name": "shadowRootOptions",
|
|
17
|
+
"static": true,
|
|
18
|
+
"default": "{ ...LitElement.shadowRootOptions, mode: 'open', } satisfies typeof LitElement.shadowRootOptions"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"kind": "field",
|
|
22
|
+
"name": "label",
|
|
23
|
+
"type": {
|
|
24
|
+
"text": "string"
|
|
25
|
+
},
|
|
26
|
+
"default": "'Click me'",
|
|
27
|
+
"attribute": "label"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"kind": "field",
|
|
31
|
+
"name": "size",
|
|
32
|
+
"type": {
|
|
33
|
+
"text": "'small' | 'medium' | 'large'"
|
|
34
|
+
},
|
|
35
|
+
"default": "'medium'",
|
|
36
|
+
"description": "How big",
|
|
37
|
+
"attribute": "size"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"kind": "field",
|
|
41
|
+
"name": "type",
|
|
42
|
+
"type": {
|
|
43
|
+
"text": "'filled' | 'outlined'"
|
|
44
|
+
},
|
|
45
|
+
"default": "'filled'",
|
|
46
|
+
"attribute": "type"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"kind": "method",
|
|
50
|
+
"name": "#handleClick",
|
|
51
|
+
"privacy": "private"
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"events": [
|
|
55
|
+
{
|
|
56
|
+
"name": "button-click",
|
|
57
|
+
"type": {
|
|
58
|
+
"text": "CustomEvent"
|
|
59
|
+
},
|
|
60
|
+
"description": "Fired when the button is clicked"
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"attributes": [
|
|
64
|
+
{
|
|
65
|
+
"name": "label",
|
|
66
|
+
"type": {
|
|
67
|
+
"text": "string"
|
|
68
|
+
},
|
|
69
|
+
"default": "'Click me'",
|
|
70
|
+
"fieldName": "label"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "size",
|
|
74
|
+
"type": {
|
|
75
|
+
"text": "'small' | 'medium' | 'large'"
|
|
76
|
+
},
|
|
77
|
+
"default": "'medium'",
|
|
78
|
+
"description": "How big",
|
|
79
|
+
"fieldName": "size"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "type",
|
|
83
|
+
"type": {
|
|
84
|
+
"text": "'filled' | 'outlined'"
|
|
85
|
+
},
|
|
86
|
+
"default": "'filled'",
|
|
87
|
+
"fieldName": "type"
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"superclass": {
|
|
91
|
+
"name": "LitElement",
|
|
92
|
+
"package": "lit"
|
|
93
|
+
},
|
|
94
|
+
"tagName": "simple-button",
|
|
95
|
+
"customElement": true
|
|
23
96
|
}
|
|
24
97
|
],
|
|
25
|
-
"
|
|
26
|
-
{
|
|
27
|
-
"name": "shadowRootOptions",
|
|
28
|
-
"type": "{ mode: \"open\"; delegatesFocus?: boolean | undefined; slotAssignment?: SlotAssignmentMode | undefined; }",
|
|
29
|
-
"default": "\"{\\n ...LitElement.shadowRootOptions,\\n mode: 'open',\\n } satisfies typeof LitElement.shadowRootOptions\""
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"name": "label",
|
|
33
|
-
"attribute": "label",
|
|
34
|
-
"type": "string",
|
|
35
|
-
"default": "\"Click me\""
|
|
36
|
-
},
|
|
98
|
+
"exports": [
|
|
37
99
|
{
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
100
|
+
"kind": "js",
|
|
101
|
+
"name": "SimpleButton",
|
|
102
|
+
"declaration": {
|
|
103
|
+
"name": "SimpleButton",
|
|
104
|
+
"module": "src/web-components/button.ts"
|
|
105
|
+
}
|
|
43
106
|
},
|
|
44
107
|
{
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
108
|
+
"kind": "custom-element-definition",
|
|
109
|
+
"name": "simple-button",
|
|
110
|
+
"declaration": {
|
|
111
|
+
"name": "SimpleButton",
|
|
112
|
+
"module": "src/web-components/button.ts"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"kind": "javascript-module",
|
|
119
|
+
"path": "src/web-components/card.ts",
|
|
120
|
+
"declarations": [
|
|
50
121
|
{
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
122
|
+
"kind": "class",
|
|
123
|
+
"description": "A versatile card component that can be used to group related content.",
|
|
124
|
+
"name": "SimpleCard",
|
|
125
|
+
"cssParts": [
|
|
126
|
+
{
|
|
127
|
+
"description": "The main card wrapper",
|
|
128
|
+
"name": "card"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"description": "The header container",
|
|
132
|
+
"name": "header"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"description": "The main content container",
|
|
136
|
+
"name": "content"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"description": "The footer container",
|
|
140
|
+
"name": "footer"
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
"slots": [
|
|
144
|
+
{
|
|
145
|
+
"description": "Content to be rendered in the card header",
|
|
146
|
+
"name": "header"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"description": "The default slot for the main content",
|
|
150
|
+
"name": "default"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"description": "Content to be rendered in the card footer",
|
|
154
|
+
"name": "footer"
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
"members": [
|
|
158
|
+
{
|
|
159
|
+
"kind": "field",
|
|
160
|
+
"name": "shadowRootOptions",
|
|
161
|
+
"static": true,
|
|
162
|
+
"default": "{ ...LitElement.shadowRootOptions, mode: 'open', } satisfies typeof LitElement.shadowRootOptions"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"kind": "field",
|
|
166
|
+
"name": "elevation",
|
|
167
|
+
"type": {
|
|
168
|
+
"text": "'none' | 'low' | 'medium' | 'high'"
|
|
169
|
+
},
|
|
170
|
+
"default": "'low'",
|
|
171
|
+
"description": "Card elevation level",
|
|
172
|
+
"attribute": "elevation"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"kind": "field",
|
|
176
|
+
"name": "padding",
|
|
177
|
+
"type": {
|
|
178
|
+
"text": "'none' | 'small' | 'medium' | 'large'"
|
|
179
|
+
},
|
|
180
|
+
"default": "'medium'",
|
|
181
|
+
"description": "Card padding size",
|
|
182
|
+
"attribute": "padding"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"kind": "field",
|
|
186
|
+
"name": "bordered",
|
|
187
|
+
"type": {
|
|
188
|
+
"text": "boolean"
|
|
189
|
+
},
|
|
190
|
+
"default": "false",
|
|
191
|
+
"description": "Whether the card has a border",
|
|
192
|
+
"attribute": "bordered"
|
|
193
|
+
}
|
|
194
|
+
],
|
|
195
|
+
"attributes": [
|
|
196
|
+
{
|
|
197
|
+
"name": "elevation",
|
|
198
|
+
"type": {
|
|
199
|
+
"text": "'none' | 'low' | 'medium' | 'high'"
|
|
200
|
+
},
|
|
201
|
+
"default": "'low'",
|
|
202
|
+
"description": "Card elevation level",
|
|
203
|
+
"fieldName": "elevation"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"name": "padding",
|
|
207
|
+
"type": {
|
|
208
|
+
"text": "'none' | 'small' | 'medium' | 'large'"
|
|
209
|
+
},
|
|
210
|
+
"default": "'medium'",
|
|
211
|
+
"description": "Card padding size",
|
|
212
|
+
"fieldName": "padding"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"name": "bordered",
|
|
216
|
+
"type": {
|
|
217
|
+
"text": "boolean"
|
|
218
|
+
},
|
|
219
|
+
"default": "false",
|
|
220
|
+
"description": "Whether the card has a border",
|
|
221
|
+
"fieldName": "bordered"
|
|
222
|
+
}
|
|
223
|
+
],
|
|
224
|
+
"superclass": {
|
|
225
|
+
"name": "LitElement",
|
|
226
|
+
"package": "lit"
|
|
227
|
+
},
|
|
228
|
+
"tagName": "simple-card",
|
|
229
|
+
"customElement": true
|
|
54
230
|
}
|
|
55
231
|
],
|
|
56
|
-
"
|
|
232
|
+
"exports": [
|
|
233
|
+
{
|
|
234
|
+
"kind": "js",
|
|
235
|
+
"name": "SimpleCard",
|
|
236
|
+
"declaration": {
|
|
237
|
+
"name": "SimpleCard",
|
|
238
|
+
"module": "src/web-components/card.ts"
|
|
239
|
+
}
|
|
240
|
+
},
|
|
57
241
|
{
|
|
58
|
-
"
|
|
242
|
+
"kind": "custom-element-definition",
|
|
243
|
+
"name": "simple-card",
|
|
244
|
+
"declaration": {
|
|
245
|
+
"name": "SimpleCard",
|
|
246
|
+
"module": "src/web-components/card.ts"
|
|
247
|
+
}
|
|
59
248
|
}
|
|
60
249
|
]
|
|
61
250
|
}
|
|
62
251
|
]
|
|
63
|
-
}
|
|
252
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/web-components/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/web-components/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AACrB,OAAO,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/web-components/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/web-components/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AACrB,OAAO,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knapsack/sandbox-components",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "4.76.0
|
|
4
|
+
"version": "4.76.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./css": "./dist/css/ks-sandbox-styles.css",
|
|
8
|
+
"./customElements": "./dist/web-components/custom-elements.json",
|
|
8
9
|
"./hbs/*": "./src/hbs/*",
|
|
9
10
|
"./html/*": "./src/html/*",
|
|
10
11
|
"./package": "./package.json",
|
|
@@ -18,8 +19,7 @@
|
|
|
18
19
|
"./web-components": {
|
|
19
20
|
"types": "./dist/web-components/index.d.ts",
|
|
20
21
|
"default": "./dist/web-components/bundle.js"
|
|
21
|
-
}
|
|
22
|
-
"./web-components/custom-elements.json": "./dist/web-components/custom-elements.json"
|
|
22
|
+
}
|
|
23
23
|
},
|
|
24
24
|
"sideEffects": [
|
|
25
25
|
"./src/web-components/*"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"build:css": "postcss ./src/css/index.css --output ./dist/css/ks-sandbox-styles.css",
|
|
30
30
|
"build:ts": "tsc",
|
|
31
31
|
"build:wc": "esbuild --bundle --outfile=./dist/web-components/bundle.js --format=esm --platform=browser --target=es2020 --loader:.js=jsx --loader:.svg=file --loader:.png=file --loader:.json=json ./src/web-components/index.ts",
|
|
32
|
-
"build:wc-type-info": "
|
|
32
|
+
"build:wc-type-info": "custom-elements-manifest analyze --globs './src/web-components/**/*.ts' --exclude './src/web-components/index.ts' --outdir ./dist/web-components/ --litelement --dependencies",
|
|
33
33
|
"clean": "rm -rf ./dist",
|
|
34
34
|
"lint": "eslint ./",
|
|
35
35
|
"start": "run-p watch:*",
|
|
@@ -48,11 +48,12 @@
|
|
|
48
48
|
"vue": "^3.5.13"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@
|
|
52
|
-
"@knapsack/
|
|
53
|
-
"@knapsack/
|
|
54
|
-
"@knapsack/
|
|
55
|
-
"@knapsack/
|
|
51
|
+
"@custom-elements-manifest/analyzer": "^0.10.4",
|
|
52
|
+
"@knapsack/eslint-config-starter": "4.76.0",
|
|
53
|
+
"@knapsack/postcss-config-starter": "4.76.0",
|
|
54
|
+
"@knapsack/prettier-config": "4.76.0",
|
|
55
|
+
"@knapsack/sandbox-tokens": "4.76.0",
|
|
56
|
+
"@knapsack/typescript-config-starter": "4.76.0",
|
|
56
57
|
"@types/node": "^20.17.17",
|
|
57
58
|
"@types/react": "^18.3.18",
|
|
58
59
|
"esbuild": "^0.25.0",
|
|
@@ -60,8 +61,7 @@
|
|
|
60
61
|
"npm-run-all2": "^5.0.2",
|
|
61
62
|
"postcss-cli": "^9.1.0",
|
|
62
63
|
"tailwindcss": "^3.4.17",
|
|
63
|
-
"typescript": "^5.7.3"
|
|
64
|
-
"web-component-analyzer": "^2.0.0"
|
|
64
|
+
"typescript": "^5.7.3"
|
|
65
65
|
},
|
|
66
66
|
"license": "GPL-2.0-or-later",
|
|
67
67
|
"publishConfig": {
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"directory": "apps/ui/libs/sandbox-components",
|
|
73
73
|
"type": "git"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "89e02beeee71a7a91f9a745e5496e367dbd28ba3"
|
|
76
76
|
}
|
|
@@ -2,6 +2,9 @@ import { LitElement, css, html } from 'lit';
|
|
|
2
2
|
import { classMap } from 'lit/directives/class-map.js';
|
|
3
3
|
import { property } from 'lit/decorators.js';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @event button-click - Fired when the button is clicked
|
|
7
|
+
*/
|
|
5
8
|
export class SimpleButton extends LitElement {
|
|
6
9
|
static shadowRootOptions = {
|
|
7
10
|
...LitElement.shadowRootOptions,
|
|
@@ -83,7 +86,7 @@ export class SimpleButton extends LitElement {
|
|
|
83
86
|
}
|
|
84
87
|
`;
|
|
85
88
|
|
|
86
|
-
|
|
89
|
+
#handleClick() {
|
|
87
90
|
console.log('Button clicked!');
|
|
88
91
|
this.dispatchEvent(new CustomEvent('button-click'));
|
|
89
92
|
}
|
|
@@ -96,7 +99,7 @@ export class SimpleButton extends LitElement {
|
|
|
96
99
|
};
|
|
97
100
|
|
|
98
101
|
return html`
|
|
99
|
-
<button @click=${this
|
|
102
|
+
<button @click=${this.#handleClick} class=${classMap(classes)}>
|
|
100
103
|
${this.label}
|
|
101
104
|
</button>
|
|
102
105
|
`;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { LitElement, css, html } from 'lit';
|
|
2
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
3
|
+
import { property } from 'lit/decorators.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A versatile card component that can be used to group related content.
|
|
7
|
+
*
|
|
8
|
+
* @slot header - Content to be rendered in the card header
|
|
9
|
+
* @slot default - The default slot for the main content
|
|
10
|
+
* @slot footer - Content to be rendered in the card footer
|
|
11
|
+
*
|
|
12
|
+
* @csspart card - The main card wrapper
|
|
13
|
+
* @csspart header - The header container
|
|
14
|
+
* @csspart content - The main content container
|
|
15
|
+
* @csspart footer - The footer container
|
|
16
|
+
*/
|
|
17
|
+
export class SimpleCard extends LitElement {
|
|
18
|
+
static shadowRootOptions = {
|
|
19
|
+
...LitElement.shadowRootOptions,
|
|
20
|
+
mode: 'open',
|
|
21
|
+
} satisfies typeof LitElement.shadowRootOptions;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Card elevation level
|
|
25
|
+
*/
|
|
26
|
+
@property({ type: String })
|
|
27
|
+
elevation: 'none' | 'low' | 'medium' | 'high' = 'low';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Card padding size
|
|
31
|
+
*/
|
|
32
|
+
@property({ type: String })
|
|
33
|
+
padding: 'none' | 'small' | 'medium' | 'large' = 'medium';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Whether the card has a border
|
|
37
|
+
*/
|
|
38
|
+
@property({ type: Boolean })
|
|
39
|
+
bordered = false;
|
|
40
|
+
|
|
41
|
+
static styles = css`
|
|
42
|
+
:host {
|
|
43
|
+
display: block;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.card {
|
|
47
|
+
background-color: #ffffff;
|
|
48
|
+
background-color: var(--color-white);
|
|
49
|
+
border-radius: 8px;
|
|
50
|
+
border-radius: var(--radius-medium);
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.card--bordered {
|
|
55
|
+
border: 1px solid #e5e7eb;
|
|
56
|
+
border: 1px solid var(--color-gray-200, #e5e7eb);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.card--elevation-low {
|
|
60
|
+
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.card--elevation-medium {
|
|
64
|
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
|
65
|
+
0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.card--elevation-high {
|
|
69
|
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
|
|
70
|
+
0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.card--padding-small {
|
|
74
|
+
padding: 12px;
|
|
75
|
+
padding: var(--spacing-medium);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.card--padding-medium {
|
|
79
|
+
padding: 16px;
|
|
80
|
+
padding: var(--spacing-large);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.card--padding-large {
|
|
84
|
+
padding: 24px;
|
|
85
|
+
padding: var(--spacing-xlarge);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.header {
|
|
89
|
+
margin-bottom: 16px;
|
|
90
|
+
margin-bottom: var(--spacing-large);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.footer {
|
|
94
|
+
margin-top: 16px;
|
|
95
|
+
margin-top: var(--spacing-large);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
::slotted(*) {
|
|
99
|
+
margin: 0;
|
|
100
|
+
}
|
|
101
|
+
`;
|
|
102
|
+
|
|
103
|
+
render() {
|
|
104
|
+
const classes = {
|
|
105
|
+
card: true,
|
|
106
|
+
'card--bordered': this.bordered,
|
|
107
|
+
[`card--elevation-${this.elevation}`]: this.elevation !== 'none',
|
|
108
|
+
[`card--padding-${this.padding}`]: this.padding !== 'none',
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
return html`
|
|
112
|
+
<div class=${classMap(classes)} part="card">
|
|
113
|
+
<div class="header" part="header">
|
|
114
|
+
<slot name="header"></slot>
|
|
115
|
+
</div>
|
|
116
|
+
<div class="content" part="content">
|
|
117
|
+
<slot></slot>
|
|
118
|
+
</div>
|
|
119
|
+
<div class="footer" part="footer">
|
|
120
|
+
<slot name="footer"></slot>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
`;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
customElements.define('simple-card', SimpleCard);
|