@govtechsg/sgds-web-component 3.2.0-rc.2 → 3.2.0-rc.3
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/components/Badge/badge.js +1 -1
- package/components/Badge/index.umd.js +11 -5
- package/components/Badge/index.umd.js.map +1 -1
- package/components/Badge/sgds-badge.js +10 -4
- package/components/Badge/sgds-badge.js.map +1 -1
- package/components/ComboBox/index.umd.js +11 -5
- package/components/ComboBox/index.umd.js.map +1 -1
- package/components/index.umd.js +11 -5
- package/components/index.umd.js.map +1 -1
- package/index.umd.js +11 -5
- package/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/react/components/Badge/badge.cjs.js +1 -1
- package/react/components/Badge/badge.js +1 -1
- package/react/components/Badge/sgds-badge.cjs.js +10 -4
- package/react/components/Badge/sgds-badge.cjs.js.map +1 -1
- package/react/components/Badge/sgds-badge.js +10 -4
- package/react/components/Badge/sgds-badge.js.map +1 -1
- package/src/components/Badge/sgds-badge.d.ts +4 -2
|
@@ -32,6 +32,8 @@ class SgdsBadge extends SgdsElement {
|
|
|
32
32
|
this.outlined = false;
|
|
33
33
|
/** Manually set the dismissible state of the button to `false` */
|
|
34
34
|
this.dismissible = false;
|
|
35
|
+
/** Manually enable full width */
|
|
36
|
+
this.fullWidth = false;
|
|
35
37
|
this.truncated = false;
|
|
36
38
|
this.text = "";
|
|
37
39
|
}
|
|
@@ -75,14 +77,15 @@ class SgdsBadge extends SgdsElement {
|
|
|
75
77
|
this.text = getTextContent(e.target);
|
|
76
78
|
return;
|
|
77
79
|
}
|
|
78
|
-
|
|
80
|
+
_renderBadge() {
|
|
79
81
|
return html `<div
|
|
80
82
|
class="
|
|
81
83
|
${classMap({
|
|
82
84
|
[`badge-dismissible`]: this.dismissible,
|
|
83
85
|
badge: true,
|
|
84
86
|
outlined: this.outlined,
|
|
85
|
-
truncated: this.truncated
|
|
87
|
+
truncated: this.truncated,
|
|
88
|
+
"full-width": this.fullWidth
|
|
86
89
|
})}"
|
|
87
90
|
aria-hidden=${this.show ? "false" : "true"}
|
|
88
91
|
>
|
|
@@ -105,8 +108,8 @@ class SgdsBadge extends SgdsElement {
|
|
|
105
108
|
render() {
|
|
106
109
|
return (this.dismissible && this.show) || !this.dismissible
|
|
107
110
|
? this.truncated
|
|
108
|
-
? html `<sgds-tooltip content=${this.text}>${this.
|
|
109
|
-
: this.
|
|
111
|
+
? html `<sgds-tooltip content=${this.text}>${this._renderBadge()}</sgds-tooltip>`
|
|
112
|
+
: this._renderBadge()
|
|
110
113
|
: nothing;
|
|
111
114
|
}
|
|
112
115
|
}
|
|
@@ -128,6 +131,9 @@ __decorate([
|
|
|
128
131
|
__decorate([
|
|
129
132
|
property({ type: Boolean, reflect: true })
|
|
130
133
|
], SgdsBadge.prototype, "dismissible", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
property({ type: Boolean, reflect: true })
|
|
136
|
+
], SgdsBadge.prototype, "fullWidth", void 0);
|
|
131
137
|
__decorate([
|
|
132
138
|
state()
|
|
133
139
|
], SgdsBadge.prototype, "truncated", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sgds-badge.js","sources":["../../../src/components/Badge/sgds-badge.ts"],"sourcesContent":["import { html, nothing } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\n\nimport { watch } from \"../../utils/watch\";\nimport badgeStyle from \"./badge.css\";\n\nimport SgdsElement from \"../../base/sgds-element\";\nimport SgdsTooltip from \"../Tooltip/sgds-tooltip\";\nimport SgdsCloseButton from \"../../internals/CloseButton/sgds-close-button\";\n\nimport { getTextContent } from \"../../utils/slot\";\n\nexport type BadgeVariant = \"info\" | \"success\" | \"danger\" | \"warning\" | \"neutral\";\n\n/**\n * @summary Badges can be used to highlight important bits of information such as labels, notifications & status.\n * When the text exceeds the width, it will be truncated with a tooltip that will be displayed on hover.\n *\n * @slot default - slot for badge\n * @slot icon - The slot for icon to the left of the badge text\n *\n * @event sgds-show - Emitted when the badge appears.\n * @event sgds-hide - Emitted when the badge is starting to close but has not closed.\n * @event sgds-after-show - Emitted after the badge has appeared\n * @event sgds-after-hide - Emitted after the badge has closed\n */\nexport class SgdsBadge extends SgdsElement {\n static styles = [...SgdsElement.styles, badgeStyle];\n\n /**@internal */\n static dependencies = {\n \"sgds-close-button\": SgdsCloseButton,\n \"sgds-tooltip\": SgdsTooltip\n };\n\n /** Controls the appearance of the dismissible badge. This prop only applies when dismissible is true */\n @property({ type: Boolean, reflect: true }) show = false;\n\n /** One or more button variant combinations buttons may be one of a variety of visual variants such as: `info`, `success`, `danger`, `warning`, 'neutral' */\n @property({ reflect: true }) variant: BadgeVariant = \"info\";\n\n /** Manually set the outlined state to false */\n @property({ type: Boolean, reflect: true }) outlined = false;\n\n /** Manually set the dismissible state of the button to `false` */\n @property({ type: Boolean, reflect: true }) dismissible = false;\n\n @state() private truncated = false;\n @state() private text = \"\";\n\n /** Closes the badge */\n public close() {\n this.show = false;\n }\n\n /**@internal */\n @watch(\"show\")\n _handleShowChange() {\n if (this.show) {\n const sgdsShow = this.emit(\"sgds-show\", { cancelable: true });\n if (sgdsShow.defaultPrevented) {\n this.show = false;\n return;\n }\n // animations if any go here\n\n this.emit(\"sgds-after-show\");\n } else {\n const sgdsHide = this.emit(\"sgds-hide\", { cancelable: true });\n if (sgdsHide.defaultPrevented) {\n this.show = true;\n return;\n }\n // animations if any go here\n\n this.emit(\"sgds-after-hide\");\n }\n }\n\n /**@internal */\n @watch(\"text\")\n _handleTruncation() {\n // checking of text height if its exceeding parent, it needs to be truncated\n const badge = this.shadowRoot.querySelector(\".badge\");\n const badgeLabel = this.shadowRoot.querySelector(\".badge-label\");\n\n if (badge && badgeLabel) {\n const labelHeight = badgeLabel.getBoundingClientRect().height;\n const badgeHeight = badge.getBoundingClientRect().height;\n\n this.truncated = labelHeight > badgeHeight;\n }\n }\n\n _handleLabelSlotChange(e: Event) {\n this.text = getTextContent(e.target as HTMLSlotElement);\n return;\n }\n\n
|
|
1
|
+
{"version":3,"file":"sgds-badge.js","sources":["../../../src/components/Badge/sgds-badge.ts"],"sourcesContent":["import { html, nothing } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\n\nimport { watch } from \"../../utils/watch\";\nimport badgeStyle from \"./badge.css\";\n\nimport SgdsElement from \"../../base/sgds-element\";\nimport SgdsTooltip from \"../Tooltip/sgds-tooltip\";\nimport SgdsCloseButton from \"../../internals/CloseButton/sgds-close-button\";\n\nimport { getTextContent } from \"../../utils/slot\";\n\nexport type BadgeVariant = \"info\" | \"success\" | \"danger\" | \"warning\" | \"neutral\";\n\n/**\n * @summary Badges can be used to highlight important bits of information such as labels, notifications & status.\n * When the text exceeds the width, it will be truncated with a tooltip that will be displayed on hover.\n *\n * @slot default - slot for badge\n * @slot icon - The slot for icon to the left of the badge text\n *\n * @event sgds-show - Emitted when the badge appears.\n * @event sgds-hide - Emitted when the badge is starting to close but has not closed.\n * @event sgds-after-show - Emitted after the badge has appeared\n * @event sgds-after-hide - Emitted after the badge has closed\n */\nexport class SgdsBadge extends SgdsElement {\n static styles = [...SgdsElement.styles, badgeStyle];\n\n /**@internal */\n static dependencies = {\n \"sgds-close-button\": SgdsCloseButton,\n \"sgds-tooltip\": SgdsTooltip\n };\n\n /** Controls the appearance of the dismissible badge. This prop only applies when dismissible is true */\n @property({ type: Boolean, reflect: true }) show = false;\n\n /** One or more button variant combinations buttons may be one of a variety of visual variants such as: `info`, `success`, `danger`, `warning`, 'neutral' */\n @property({ reflect: true }) variant: BadgeVariant = \"info\";\n\n /** Manually set the outlined state to false */\n @property({ type: Boolean, reflect: true }) outlined = false;\n\n /** Manually set the dismissible state of the button to `false` */\n @property({ type: Boolean, reflect: true }) dismissible = false;\n\n /** Manually enable full width */\n @property({ type: Boolean, reflect: true }) fullWidth = false;\n\n @state() private truncated = false;\n @state() private text = \"\";\n\n /** Closes the badge */\n public close() {\n this.show = false;\n }\n\n /**@internal */\n @watch(\"show\")\n _handleShowChange() {\n if (this.show) {\n const sgdsShow = this.emit(\"sgds-show\", { cancelable: true });\n if (sgdsShow.defaultPrevented) {\n this.show = false;\n return;\n }\n // animations if any go here\n\n this.emit(\"sgds-after-show\");\n } else {\n const sgdsHide = this.emit(\"sgds-hide\", { cancelable: true });\n if (sgdsHide.defaultPrevented) {\n this.show = true;\n return;\n }\n // animations if any go here\n\n this.emit(\"sgds-after-hide\");\n }\n }\n\n /**@internal */\n @watch(\"text\")\n _handleTruncation() {\n // checking of text height if its exceeding parent, it needs to be truncated\n const badge = this.shadowRoot.querySelector(\".badge\");\n const badgeLabel = this.shadowRoot.querySelector(\".badge-label\");\n\n if (badge && badgeLabel) {\n const labelHeight = badgeLabel.getBoundingClientRect().height;\n const badgeHeight = badge.getBoundingClientRect().height;\n\n this.truncated = labelHeight > badgeHeight;\n }\n }\n\n private _handleLabelSlotChange(e: Event) {\n this.text = getTextContent(e.target as HTMLSlotElement);\n return;\n }\n\n private _renderBadge() {\n return html`<div\n class=\" \n ${classMap({\n [`badge-dismissible`]: this.dismissible,\n badge: true,\n outlined: this.outlined,\n truncated: this.truncated,\n \"full-width\": this.fullWidth\n })}\"\n aria-hidden=${this.show ? \"false\" : \"true\"}\n >\n ${!this.dismissible ? html`<slot name=\"icon\"></slot>` : nothing}\n\n <span class=\"badge-label\">\n <slot @slotchange=${this._handleLabelSlotChange}></slot>\n </span>\n\n ${this.dismissible\n ? html`<sgds-close-button\n size=\"sm\"\n aria-label=\"close the badge\"\n @click=${this.close}\n variant=${this.outlined ? \"dark\" : \"light\"}\n ></sgds-close-button>`\n : nothing}\n </div>`;\n }\n\n render() {\n return (this.dismissible && this.show) || !this.dismissible\n ? this.truncated\n ? html`<sgds-tooltip content=${this.text}>${this._renderBadge()}</sgds-tooltip>`\n : this._renderBadge()\n : nothing;\n }\n}\n\nexport default SgdsBadge;\n"],"names":["badgeStyle"],"mappings":";;;;;;;;;;;AAe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IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAmB,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAE7C,UAAA,CAAA;AAAhB,IAAA,KAAK,EAAE;AAA2B,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAClB,UAAA,CAAA;AAAhB,IAAA,KAAK,EAAE;AAAmB,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,MAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAS3B,UAAA,CAAA;IADC,KAAK,CAAC,MAAM,CAAC;AAqBb,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,mBAAA,EAAA,IAAA,CAAA,CAAA;AAID,UAAA,CAAA;IADC,KAAK,CAAC,MAAM,CAAC;AAYb,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,mBAAA,EAAA,IAAA,CAAA;;;;"}
|
|
@@ -9080,7 +9080,7 @@
|
|
|
9080
9080
|
};
|
|
9081
9081
|
}
|
|
9082
9082
|
|
|
9083
|
-
var css_248z$8 = css`:host{cursor:default;display:inline-flex;max-width:100%}:host([variant=success]) .badge{background-color:var(--sgds-success-surface-default)}:host([variant=danger]) .badge{background-color:var(--sgds-danger-surface-default)}:host([variant=warning]) .badge{background-color:var(--sgds-warning-surface-default);color:var(--sgds-color-fixed-dark)}:host([variant=neutral]) .badge{background-color:var(--sgds-neutral-surface-default)}:host([variant=success][outlined]) .badge{background-color:var(--sgds-success-surface-muted);border:var(--sgds-border-width-1) solid var(--sgds-success-border-color-default)}:host([variant=danger][outlined]) .badge{background-color:var(--sgds-danger-surface-muted);border:var(--sgds-border-width-1) solid var(--sgds-danger-border-color-default)}:host([variant=warning][outlined]) .badge{background-color:var(--sgds-warning-surface-muted);border:var(--sgds-border-width-1) solid var(--sgds-warning-border-color-default)}:host([variant=neutral][outlined]) .badge{background-color:var(--sgds-neutral-surface-muted);border:var(--sgds-border-width-1) solid var(--sgds-neutral-border-color-default)}sgds-tooltip{display:block;max-width:100%}.badge{align-items:center;background-color:var(--sgds-primary-surface-default);border:var(--sgds-border-width-1) solid var(--sgds-border-color-transparent);border-radius:var(--sgds-border-radius-sm);color:var(--sgds-color-fixed-light);display:inline-flex;font-size:var(--sgds-font-size-1);height:var(--sgds-dimension-24,24px);justify-content:center;max-width:
|
|
9083
|
+
var css_248z$8 = css`:host{cursor:default;display:inline-flex;max-width:100%}:host([variant=success]) .badge{background-color:var(--sgds-success-surface-default)}:host([variant=danger]) .badge{background-color:var(--sgds-danger-surface-default)}:host([variant=warning]) .badge{background-color:var(--sgds-warning-surface-default);color:var(--sgds-color-fixed-dark)}:host([variant=neutral]) .badge{background-color:var(--sgds-neutral-surface-default)}:host([variant=success][outlined]) .badge{background-color:var(--sgds-success-surface-muted);border:var(--sgds-border-width-1) solid var(--sgds-success-border-color-default)}:host([variant=danger][outlined]) .badge{background-color:var(--sgds-danger-surface-muted);border:var(--sgds-border-width-1) solid var(--sgds-danger-border-color-default)}:host([variant=warning][outlined]) .badge{background-color:var(--sgds-warning-surface-muted);border:var(--sgds-border-width-1) solid var(--sgds-warning-border-color-default)}:host([variant=neutral][outlined]) .badge{background-color:var(--sgds-neutral-surface-muted);border:var(--sgds-border-width-1) solid var(--sgds-neutral-border-color-default)}sgds-tooltip{display:block;max-width:100%}.badge{align-items:center;background-color:var(--sgds-primary-surface-default);border:var(--sgds-border-width-1) solid var(--sgds-border-color-transparent);border-radius:var(--sgds-border-radius-sm);color:var(--sgds-color-fixed-light);display:inline-flex;font-size:var(--sgds-font-size-1);height:var(--sgds-dimension-24,24px);justify-content:center;max-width:192px;min-width:var(--sgds-dimension-24);padding:var(--sgds-padding-none) var(--sgds-padding-2-xs)}.badge.outlined{background-color:var(--sgds-primary-surface-muted);border:var(--sgds-border-width-1) solid var(--sgds-primary-border-color-default);color:var(--sgds-color-fixed-dark)}.badge.full-width{max-width:100%}.badge-label{line-height:var(--sgds-line-height-min);padding:var(--sgds-padding-none) var(--sgds-padding-2-xs)}.badge-dismissible{padding-right:0}.badge-dimissible sgds-close-button{--sgds-close-btn-border-radius:var(--sgds-border-radius-sm)}.badge.truncated .badge-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}slot::slotted(*){font-size:14px;font-weight:400}`;
|
|
9084
9084
|
|
|
9085
9085
|
/**
|
|
9086
9086
|
* --------------------------------------------------------------------------
|
|
@@ -10205,6 +10205,8 @@
|
|
|
10205
10205
|
this.outlined = false;
|
|
10206
10206
|
/** Manually set the dismissible state of the button to `false` */
|
|
10207
10207
|
this.dismissible = false;
|
|
10208
|
+
/** Manually enable full width */
|
|
10209
|
+
this.fullWidth = false;
|
|
10208
10210
|
this.truncated = false;
|
|
10209
10211
|
this.text = "";
|
|
10210
10212
|
}
|
|
@@ -10248,14 +10250,15 @@
|
|
|
10248
10250
|
this.text = getTextContent(e.target);
|
|
10249
10251
|
return;
|
|
10250
10252
|
}
|
|
10251
|
-
|
|
10253
|
+
_renderBadge() {
|
|
10252
10254
|
return html `<div
|
|
10253
10255
|
class="
|
|
10254
10256
|
${classMap({
|
|
10255
10257
|
[`badge-dismissible`]: this.dismissible,
|
|
10256
10258
|
badge: true,
|
|
10257
10259
|
outlined: this.outlined,
|
|
10258
|
-
truncated: this.truncated
|
|
10260
|
+
truncated: this.truncated,
|
|
10261
|
+
"full-width": this.fullWidth
|
|
10259
10262
|
})}"
|
|
10260
10263
|
aria-hidden=${this.show ? "false" : "true"}
|
|
10261
10264
|
>
|
|
@@ -10278,8 +10281,8 @@
|
|
|
10278
10281
|
render() {
|
|
10279
10282
|
return (this.dismissible && this.show) || !this.dismissible
|
|
10280
10283
|
? this.truncated
|
|
10281
|
-
? html `<sgds-tooltip content=${this.text}>${this.
|
|
10282
|
-
: this.
|
|
10284
|
+
? html `<sgds-tooltip content=${this.text}>${this._renderBadge()}</sgds-tooltip>`
|
|
10285
|
+
: this._renderBadge()
|
|
10283
10286
|
: nothing;
|
|
10284
10287
|
}
|
|
10285
10288
|
}
|
|
@@ -10301,6 +10304,9 @@
|
|
|
10301
10304
|
__decorate([
|
|
10302
10305
|
property({ type: Boolean, reflect: true })
|
|
10303
10306
|
], SgdsBadge.prototype, "dismissible", void 0);
|
|
10307
|
+
__decorate([
|
|
10308
|
+
property({ type: Boolean, reflect: true })
|
|
10309
|
+
], SgdsBadge.prototype, "fullWidth", void 0);
|
|
10304
10310
|
__decorate([
|
|
10305
10311
|
state()
|
|
10306
10312
|
], SgdsBadge.prototype, "truncated", void 0);
|