@govtechsg/sgds-web-component 3.3.2 → 3.3.3-rc.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/Masthead/index.js +2 -2
- package/base/card.js +1 -1
- package/base/sgds-element2.js +1 -1
- package/components/Accordion/index.umd.js +1 -1
- package/components/Alert/index.umd.js +2 -2
- package/components/Badge/index.umd.js +1 -1
- package/components/Breadcrumb/index.umd.js +36 -11
- package/components/Breadcrumb/index.umd.js.map +1 -1
- package/components/Button/button.js +1 -1
- package/components/Button/index.umd.js +61 -54
- package/components/Button/index.umd.js.map +1 -1
- package/components/Button/sgds-button.d.ts +1 -6
- package/components/Button/sgds-button.js +11 -27
- package/components/Button/sgds-button.js.map +1 -1
- package/components/Card/index.umd.js +3330 -3251
- package/components/Card/index.umd.js.map +1 -1
- package/components/Card/sgds-card.d.ts +1 -0
- package/components/Card/sgds-card.js +9 -3
- package/components/Card/sgds-card.js.map +1 -1
- package/components/Checkbox/index.umd.js +1 -1
- package/components/ComboBox/index.umd.js +2 -2
- package/components/Datepicker/index.umd.js +62 -29
- package/components/Datepicker/index.umd.js.map +1 -1
- package/components/DescriptionList/index.umd.js +1 -1
- package/components/Divider/index.umd.js +1 -1
- package/components/Drawer/index.umd.js +1 -1
- package/components/Dropdown/index.umd.js +2 -2
- package/components/FileUpload/index.umd.js +62 -29
- package/components/FileUpload/index.umd.js.map +1 -1
- package/components/Footer/footer-item.js +1 -1
- package/components/Footer/index.umd.js +89 -45
- package/components/Footer/index.umd.js.map +1 -1
- package/components/Footer/sgds-footer.d.ts +1 -1
- package/components/Footer/sgds-footer.js +39 -44
- package/components/Footer/sgds-footer.js.map +1 -1
- package/components/Icon/icon.js +1 -1
- package/components/Icon/index.umd.js +2 -2
- package/components/IconButton/index.umd.js +2 -2
- package/components/IconCard/index.umd.js +93 -14
- package/components/IconCard/index.umd.js.map +1 -1
- package/components/IconCard/sgds-icon-card.d.ts +1 -0
- package/components/IconCard/sgds-icon-card.js +8 -3
- package/components/IconCard/sgds-icon-card.js.map +1 -1
- package/components/IconList/index.umd.js +1 -1
- package/components/ImageCard/index.umd.js +93 -14
- package/components/ImageCard/index.umd.js.map +1 -1
- package/components/ImageCard/sgds-image-card.d.ts +1 -0
- package/components/ImageCard/sgds-image-card.js +8 -3
- package/components/ImageCard/sgds-image-card.js.map +1 -1
- package/components/Input/index.umd.js +2 -2
- package/components/Link/index.umd.js +35 -10
- package/components/Link/index.umd.js.map +1 -1
- package/components/Link/link.js +1 -1
- package/components/Link/sgds-link.d.ts +3 -0
- package/components/Link/sgds-link.js +33 -8
- package/components/Link/sgds-link.js.map +1 -1
- package/components/Mainnav/index.umd.js +2 -2
- package/components/Masthead/index.umd.js +2 -2
- package/components/Masthead/masthead.js +1 -1
- package/components/Modal/index.umd.js +1 -1
- package/components/OverflowMenu/index.umd.js +2 -2
- package/components/Pagination/index.umd.js +62 -29
- package/components/Pagination/index.umd.js.map +1 -1
- package/components/ProgressBar/index.umd.js +1 -1
- package/components/QuantityToggle/index.umd.js +2 -2
- package/components/Radio/index.umd.js +1 -1
- package/components/Select/index.umd.js +2 -2
- package/components/Sidenav/index.umd.js +2 -2
- package/components/Skeleton/index.umd.js +1 -1
- package/components/Spinner/index.umd.js +1 -1
- package/components/Stepper/index.umd.js +2 -2
- package/components/Subnav/index.umd.js +3 -3
- package/components/Subnav/subnav-item.js +1 -1
- package/components/Switch/index.umd.js +1 -1
- package/components/Tab/index.umd.js +1 -1
- package/components/Table/index.umd.js +1 -1
- package/components/TableOfContents/index.umd.js +1 -1
- package/components/Textarea/index.umd.js +1 -1
- package/components/ThumbnailCard/index.umd.js +93 -14
- package/components/ThumbnailCard/index.umd.js.map +1 -1
- package/components/ThumbnailCard/sgds-thumbnail-card.d.ts +1 -0
- package/components/ThumbnailCard/sgds-thumbnail-card.js +8 -3
- package/components/ThumbnailCard/sgds-thumbnail-card.js.map +1 -1
- package/components/Toast/index.umd.js +1 -1
- package/components/Tooltip/index.umd.js +1 -1
- package/components/index.umd.js +113 -95
- package/components/index.umd.js.map +1 -1
- package/index.umd.js +115 -97
- package/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/react/base/card.cjs.js +1 -1
- package/react/base/card.js +1 -1
- package/react/base/sgds-element.cjs2.js +1 -1
- package/react/base/sgds-element2.js +1 -1
- package/react/components/Button/button.cjs.js +1 -1
- package/react/components/Button/button.js +1 -1
- package/react/components/Button/sgds-button.cjs.js +10 -26
- package/react/components/Button/sgds-button.cjs.js.map +1 -1
- package/react/components/Button/sgds-button.js +11 -27
- package/react/components/Button/sgds-button.js.map +1 -1
- package/react/components/Card/sgds-card.cjs.js +9 -3
- package/react/components/Card/sgds-card.cjs.js.map +1 -1
- package/react/components/Card/sgds-card.js +9 -3
- package/react/components/Card/sgds-card.js.map +1 -1
- package/react/components/Footer/footer-item.cjs.js +1 -1
- package/react/components/Footer/footer-item.js +1 -1
- package/react/components/Footer/sgds-footer.cjs.js +38 -43
- package/react/components/Footer/sgds-footer.cjs.js.map +1 -1
- package/react/components/Footer/sgds-footer.js +39 -44
- package/react/components/Footer/sgds-footer.js.map +1 -1
- package/react/components/Icon/icon.cjs.js +1 -1
- package/react/components/Icon/icon.js +1 -1
- package/react/components/IconCard/sgds-icon-card.cjs.js +8 -3
- package/react/components/IconCard/sgds-icon-card.cjs.js.map +1 -1
- package/react/components/IconCard/sgds-icon-card.js +8 -3
- package/react/components/IconCard/sgds-icon-card.js.map +1 -1
- package/react/components/ImageCard/sgds-image-card.cjs.js +8 -3
- package/react/components/ImageCard/sgds-image-card.cjs.js.map +1 -1
- package/react/components/ImageCard/sgds-image-card.js +8 -3
- package/react/components/ImageCard/sgds-image-card.js.map +1 -1
- package/react/components/Link/link.cjs.js +1 -1
- package/react/components/Link/link.js +1 -1
- package/react/components/Link/sgds-link.cjs.js +33 -8
- package/react/components/Link/sgds-link.cjs.js.map +1 -1
- package/react/components/Link/sgds-link.js +33 -8
- package/react/components/Link/sgds-link.js.map +1 -1
- package/react/components/Masthead/masthead.cjs.js +1 -1
- package/react/components/Masthead/masthead.js +1 -1
- package/react/components/Subnav/subnav-item.cjs.js +1 -1
- package/react/components/Subnav/subnav-item.js +1 -1
- package/react/components/ThumbnailCard/sgds-thumbnail-card.cjs.js +8 -3
- package/react/components/ThumbnailCard/sgds-thumbnail-card.cjs.js.map +1 -1
- package/react/components/ThumbnailCard/sgds-thumbnail-card.js +8 -3
- package/react/components/ThumbnailCard/sgds-thumbnail-card.js.map +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
|
|
3
|
-
var css_248z = css`:host{display:inline-block}:host([fullWidth]),:host([fullWidth]) .btn{width:100%}:host([fullWidth]) .btn.has-left-icon{justify-content:flex-start}:host([fullWidth]) .btn.has-right-icon{justify-content:space-between}:host([fullWidth]) .btn.has-left-icon.has-right-icon{justify-content:center}.btn span{padding:0 var(--sgds-padding-2-xs)}`;
|
|
3
|
+
var css_248z = css`:host{display:inline-block}:host([fullWidth]),:host([fullWidth]) .btn{width:100%}:host([fullWidth]) .btn.has-left-icon{justify-content:flex-start}:host([fullWidth]) .btn.has-right-icon{justify-content:space-between}:host([fullWidth]) .btn.has-left-icon.has-right-icon{justify-content:center}.btn span{padding:0 var(--sgds-padding-2-xs)}.btn.no-icon{gap:var(--sgds-gap-none)}`;
|
|
4
4
|
|
|
5
5
|
export { css_248z as default };
|
|
6
6
|
//# sourceMappingURL=button.js.map
|
|
@@ -1322,32 +1322,6 @@
|
|
|
1322
1322
|
};
|
|
1323
1323
|
}
|
|
1324
1324
|
|
|
1325
|
-
/**
|
|
1326
|
-
* @license
|
|
1327
|
-
* Copyright 2017 Google LLC
|
|
1328
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1329
|
-
*/
|
|
1330
|
-
/**
|
|
1331
|
-
* Declares a private or protected reactive property that still triggers
|
|
1332
|
-
* updates to the element when it changes. It does not reflect from the
|
|
1333
|
-
* corresponding attribute.
|
|
1334
|
-
*
|
|
1335
|
-
* Properties declared this way must not be used from HTML or HTML templating
|
|
1336
|
-
* systems, they're solely for properties internal to the element. These
|
|
1337
|
-
* properties may be renamed by optimization tools like closure compiler.
|
|
1338
|
-
* @category Decorator
|
|
1339
|
-
*/
|
|
1340
|
-
function state(options) {
|
|
1341
|
-
return property({
|
|
1342
|
-
...options,
|
|
1343
|
-
// Add both `state` and `attribute` because we found a third party
|
|
1344
|
-
// controller that is keying off of PropertyOptions.state to determine
|
|
1345
|
-
// whether a field is a private internal property or not.
|
|
1346
|
-
state: true,
|
|
1347
|
-
attribute: false,
|
|
1348
|
-
});
|
|
1349
|
-
}
|
|
1350
|
-
|
|
1351
1325
|
/**
|
|
1352
1326
|
* @license
|
|
1353
1327
|
* Copyright 2017 Google LLC
|
|
@@ -4493,7 +4467,7 @@
|
|
|
4493
4467
|
`is not recommended.`);
|
|
4494
4468
|
}
|
|
4495
4469
|
|
|
4496
|
-
var css_248z$3 = css`:host{-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0,0,0,0);color:var(--sgds-body-color-default);font-family:var(--sgds-font-family-brand);font-size:var(--sgds-font-size-2);font-weight:var(--sgds-font-weight-regular);line-height:var(--sgds-line-height-body);margin:0;*,:after,:before{box-sizing:border-box}:disabled{cursor:not-allowed}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}
|
|
4470
|
+
var css_248z$3 = css`:host{-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0,0,0,0);color:var(--sgds-body-color-default);font-family:var(--sgds-font-family-brand);font-size:var(--sgds-font-size-2);font-weight:var(--sgds-font-weight-regular);line-height:var(--sgds-line-height-body);margin:0;*,:after,:before{box-sizing:border-box}:disabled{cursor:not-allowed}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}::slotted(a[target=_blank]):after,a[target=_blank]:after{background-color:currentColor;content:"/";display:inline-block;height:var(--sgds-icon-size-lg);margin-left:.25rem;-webkit-mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M9.774 4.4H9.8a.6.6 0 1 1 0 1.2c-.85 0-1.451 0-1.922.039-.463.038-.745.11-.968.223A2.4 2.4 0 0 0 5.861 6.91c-.113.223-.184.505-.222.968-.039.47-.04 1.072-.04 1.922v4.4c0 .85.001 1.451.04 1.922.038.463.11.745.222.968a2.4 2.4 0 0 0 1.05 1.048c.222.114.504.185.967.223.47.038 1.072.039 1.922.039h4.4c.85 0 1.451 0 1.921-.039.464-.038.746-.11.969-.223a2.4 2.4 0 0 0 1.048-1.048c.113-.223.185-.505.223-.968.038-.47.039-1.072.039-1.922a.6.6 0 1 1 1.2 0v.026c0 .818 0 1.468-.043 1.993-.044.538-.136.996-.35 1.415a3.6 3.6 0 0 1-1.573 1.574c-.42.213-.878.305-1.415.35-.525.042-1.175.042-1.993.042H9.774c-.818 0-1.469 0-1.993-.043-.538-.044-.996-.136-1.415-.35a3.6 3.6 0 0 1-1.574-1.573c-.213-.42-.305-.877-.35-1.415-.042-.525-.042-1.175-.042-1.993V9.774c0-.818 0-1.468.043-1.993.044-.538.136-.996.35-1.415a3.6 3.6 0 0 1 1.573-1.574c.42-.213.877-.305 1.415-.35C8.305 4.4 8.956 4.4 9.774 4.4ZM12.4 5a.6.6 0 0 1 .6-.6h6a.6.6 0 0 1 .6.6v6a.6.6 0 1 1-1.2 0V6.449l-5.976 5.975a.6.6 0 0 1-.848-.848L17.55 5.6H13a.6.6 0 0 1-.6-.6Z' fill='%230E0E0E'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M9.774 4.4H9.8a.6.6 0 1 1 0 1.2c-.85 0-1.451 0-1.922.039-.463.038-.745.11-.968.223A2.4 2.4 0 0 0 5.861 6.91c-.113.223-.184.505-.222.968-.039.47-.04 1.072-.04 1.922v4.4c0 .85.001 1.451.04 1.922.038.463.11.745.222.968a2.4 2.4 0 0 0 1.05 1.048c.222.114.504.185.967.223.47.038 1.072.039 1.922.039h4.4c.85 0 1.451 0 1.921-.039.464-.038.746-.11.969-.223a2.4 2.4 0 0 0 1.048-1.048c.113-.223.185-.505.223-.968.038-.47.039-1.072.039-1.922a.6.6 0 1 1 1.2 0v.026c0 .818 0 1.468-.043 1.993-.044.538-.136.996-.35 1.415a3.6 3.6 0 0 1-1.573 1.574c-.42.213-.878.305-1.415.35-.525.042-1.175.042-1.993.042H9.774c-.818 0-1.469 0-1.993-.043-.538-.044-.996-.136-1.415-.35a3.6 3.6 0 0 1-1.574-1.573c-.213-.42-.305-.877-.35-1.415-.042-.525-.042-1.175-.042-1.993V9.774c0-.818 0-1.468.043-1.993.044-.538.136-.996.35-1.415a3.6 3.6 0 0 1 1.573-1.574c.42-.213.877-.305 1.415-.35C8.305 4.4 8.956 4.4 9.774 4.4ZM12.4 5a.6.6 0 0 1 .6-.6h6a.6.6 0 0 1 .6.6v6a.6.6 0 1 1-1.2 0V6.449l-5.976 5.975a.6.6 0 0 1-.848-.848L17.55 5.6H13a.6.6 0 0 1-.6-.6Z' fill='%230E0E0E'/%3E%3C/svg%3E");-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;vertical-align:bottom;width:var(--sgds-icon-size-lg)}::slotted(svg){vertical-align:middle}}`;
|
|
4497
4471
|
|
|
4498
4472
|
/**
|
|
4499
4473
|
* @cssprop --sgds-{stateColor} - State colors in hexadecimal value
|
|
@@ -4627,6 +4601,56 @@
|
|
|
4627
4601
|
|
|
4628
4602
|
var css_248z$1 = css`::slotted(a[target=_blank]:after),a[target=_blank]:after{background-color:currentColor;content:"/";display:inline-block;margin:0 .125rem;-webkit-mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M9.274 3.9H9.3a.6.6 0 0 1 0 1.2c-.85 0-1.451 0-1.922.039-.463.038-.745.11-.968.223A2.4 2.4 0 0 0 5.361 6.41c-.113.223-.184.505-.222.968-.039.47-.04 1.072-.04 1.922v5.4c0 .85.001 1.451.04 1.922.038.463.11.745.222.968a2.4 2.4 0 0 0 1.05 1.048c.222.114.504.185.967.223.47.038 1.072.039 1.922.039h5.4c.85 0 1.451 0 1.921-.039.464-.038.746-.11.969-.223a2.4 2.4 0 0 0 1.048-1.048c.113-.223.185-.505.223-.968.038-.47.039-1.072.039-1.922a.6.6 0 1 1 1.2 0v.026c0 .818 0 1.469-.043 1.993-.044.538-.136.996-.35 1.415a3.6 3.6 0 0 1-1.573 1.574c-.42.213-.878.305-1.415.35-.525.042-1.175.042-1.993.042H9.274c-.818 0-1.469 0-1.993-.043-.538-.044-.996-.136-1.415-.35a3.6 3.6 0 0 1-1.574-1.573c-.213-.42-.305-.877-.35-1.415-.042-.524-.042-1.175-.042-1.993V9.274c0-.818 0-1.468.043-1.993.044-.538.136-.996.35-1.415a3.6 3.6 0 0 1 1.573-1.574c.42-.213.877-.305 1.415-.35C7.805 3.9 8.456 3.9 9.274 3.9Zm3.626.6a.6.6 0 0 1 .6-.6h6a.6.6 0 0 1 .6.6v6a.6.6 0 1 1-1.2 0V5.949l-5.976 5.975a.6.6 0 0 1-.848-.848L18.05 5.1H13.5a.6.6 0 0 1-.6-.6Z' fill='%230E0E0E'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M9.274 3.9H9.3a.6.6 0 0 1 0 1.2c-.85 0-1.451 0-1.922.039-.463.038-.745.11-.968.223A2.4 2.4 0 0 0 5.361 6.41c-.113.223-.184.505-.222.968-.039.47-.04 1.072-.04 1.922v5.4c0 .85.001 1.451.04 1.922.038.463.11.745.222.968a2.4 2.4 0 0 0 1.05 1.048c.222.114.504.185.967.223.47.038 1.072.039 1.922.039h5.4c.85 0 1.451 0 1.921-.039.464-.038.746-.11.969-.223a2.4 2.4 0 0 0 1.048-1.048c.113-.223.185-.505.223-.968.038-.47.039-1.072.039-1.922a.6.6 0 1 1 1.2 0v.026c0 .818 0 1.469-.043 1.993-.044.538-.136.996-.35 1.415a3.6 3.6 0 0 1-1.573 1.574c-.42.213-.878.305-1.415.35-.525.042-1.175.042-1.993.042H9.274c-.818 0-1.469 0-1.993-.043-.538-.044-.996-.136-1.415-.35a3.6 3.6 0 0 1-1.574-1.573c-.213-.42-.305-.877-.35-1.415-.042-.524-.042-1.175-.042-1.993V9.274c0-.818 0-1.468.043-1.993.044-.538.136-.996.35-1.415a3.6 3.6 0 0 1 1.573-1.574c.42-.213.877-.305 1.415-.35C7.805 3.9 8.456 3.9 9.274 3.9Zm3.626.6a.6.6 0 0 1 .6-.6h6a.6.6 0 0 1 .6.6v6a.6.6 0 1 1-1.2 0V5.949l-5.976 5.975a.6.6 0 0 1-.848-.848L18.05 5.1H13.5a.6.6 0 0 1-.6-.6Z' fill='%230E0E0E'/%3E%3C/svg%3E");-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;mask-size:73%;-webkit-mask-size:73%;padding:0 .45em}`;
|
|
4629
4603
|
|
|
4604
|
+
class HasSlotController {
|
|
4605
|
+
constructor(host, ...slotNames) {
|
|
4606
|
+
this.slotNames = [];
|
|
4607
|
+
(this.host = host).addController(this);
|
|
4608
|
+
this.slotNames = slotNames;
|
|
4609
|
+
this.handleSlotChange = this.handleSlotChange.bind(this);
|
|
4610
|
+
}
|
|
4611
|
+
hasDefaultSlot() {
|
|
4612
|
+
return [...this.host.childNodes].some(node => {
|
|
4613
|
+
var _a;
|
|
4614
|
+
if (node.nodeType === node.TEXT_NODE && ((_a = node.textContent) === null || _a === void 0 ? void 0 : _a.trim()) !== "") {
|
|
4615
|
+
return true;
|
|
4616
|
+
}
|
|
4617
|
+
if (node.nodeType === node.ELEMENT_NODE) {
|
|
4618
|
+
const el = node;
|
|
4619
|
+
const tagName = el.tagName.toLowerCase();
|
|
4620
|
+
// Ignore visually hidden elements since they aren't rendered
|
|
4621
|
+
if (tagName === "sl-visually-hidden") {
|
|
4622
|
+
return false;
|
|
4623
|
+
}
|
|
4624
|
+
// If it doesn't have a slot attribute, it's part of the default slot
|
|
4625
|
+
if (!el.hasAttribute("slot")) {
|
|
4626
|
+
return true;
|
|
4627
|
+
}
|
|
4628
|
+
}
|
|
4629
|
+
return false;
|
|
4630
|
+
});
|
|
4631
|
+
}
|
|
4632
|
+
hasNamedSlot(name) {
|
|
4633
|
+
return this.host.querySelector(`:scope > [slot="${name}"]`) !== null;
|
|
4634
|
+
}
|
|
4635
|
+
test(slotName) {
|
|
4636
|
+
return slotName === "[default]" ? this.hasDefaultSlot() : this.hasNamedSlot(slotName);
|
|
4637
|
+
}
|
|
4638
|
+
hostConnected() {
|
|
4639
|
+
var _a;
|
|
4640
|
+
(_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.addEventListener("slotchange", this.handleSlotChange);
|
|
4641
|
+
}
|
|
4642
|
+
hostDisconnected() {
|
|
4643
|
+
var _a;
|
|
4644
|
+
(_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.removeEventListener("slotchange", this.handleSlotChange);
|
|
4645
|
+
}
|
|
4646
|
+
handleSlotChange(event) {
|
|
4647
|
+
const slot = event.target;
|
|
4648
|
+
if ((this.slotNames.includes("[default]") && !slot.name) || (slot.name && this.slotNames.includes(slot.name))) {
|
|
4649
|
+
this.host.requestUpdate();
|
|
4650
|
+
}
|
|
4651
|
+
}
|
|
4652
|
+
}
|
|
4653
|
+
|
|
4630
4654
|
/**
|
|
4631
4655
|
* A controller to help with form submission
|
|
4632
4656
|
*/
|
|
@@ -4684,7 +4708,7 @@
|
|
|
4684
4708
|
}
|
|
4685
4709
|
}
|
|
4686
4710
|
|
|
4687
|
-
var css_248z = css`:host{display:inline-block}:host([fullWidth]),:host([fullWidth]) .btn{width:100%}:host([fullWidth]) .btn.has-left-icon{justify-content:flex-start}:host([fullWidth]) .btn.has-right-icon{justify-content:space-between}:host([fullWidth]) .btn.has-left-icon.has-right-icon{justify-content:center}.btn span{padding:0 var(--sgds-padding-2-xs)}`;
|
|
4711
|
+
var css_248z = css`:host{display:inline-block}:host([fullWidth]),:host([fullWidth]) .btn{width:100%}:host([fullWidth]) .btn.has-left-icon{justify-content:flex-start}:host([fullWidth]) .btn.has-right-icon{justify-content:space-between}:host([fullWidth]) .btn.has-left-icon.has-right-icon{justify-content:center}.btn span{padding:0 var(--sgds-padding-2-xs)}.btn.no-icon{gap:var(--sgds-gap-none)}`;
|
|
4688
4712
|
|
|
4689
4713
|
/**
|
|
4690
4714
|
* @summary Custom button styles for actions in forms, dialogs, and more with support for multiple sizes, states, and more.
|
|
@@ -4702,10 +4726,6 @@
|
|
|
4702
4726
|
constructor() {
|
|
4703
4727
|
super(...arguments);
|
|
4704
4728
|
/** @internal */
|
|
4705
|
-
this._hasLeftIcon = false;
|
|
4706
|
-
/** @internal */
|
|
4707
|
-
this._hasRightIcon = false;
|
|
4708
|
-
/** @internal */
|
|
4709
4729
|
this.formSubmitController = new FormSubmitController(this, {
|
|
4710
4730
|
form: (input) => {
|
|
4711
4731
|
// Buttons support a form attribute that points to an arbitrary form, so if this attribute it set we need to query
|
|
@@ -4723,6 +4743,7 @@
|
|
|
4723
4743
|
this.type = "button";
|
|
4724
4744
|
/** When set, the button will be in full width. */
|
|
4725
4745
|
this.fullWidth = false;
|
|
4746
|
+
this.hasSlotController = new HasSlotController(this, "leftIcon", "rightIcon");
|
|
4726
4747
|
this._clickHandler = () => {
|
|
4727
4748
|
if (this.type === "submit") {
|
|
4728
4749
|
this.formSubmitController.submit(this);
|
|
@@ -4741,28 +4762,20 @@
|
|
|
4741
4762
|
this.removeEventListener("click", this._clickHandler);
|
|
4742
4763
|
this.addEventListener("click", this._clickHandler);
|
|
4743
4764
|
}
|
|
4744
|
-
_handleLeftIconSlotchange(e) {
|
|
4745
|
-
const childNodes = e.target.assignedNodes({ flatten: true });
|
|
4746
|
-
if (childNodes.length > 0) {
|
|
4747
|
-
return (this._hasLeftIcon = true);
|
|
4748
|
-
}
|
|
4749
|
-
}
|
|
4750
|
-
_handleRightIconSlotchange(e) {
|
|
4751
|
-
const childNodes = e.target.assignedNodes({ flatten: true });
|
|
4752
|
-
if (childNodes.length > 0) {
|
|
4753
|
-
return (this._hasRightIcon = true);
|
|
4754
|
-
}
|
|
4755
|
-
}
|
|
4756
4765
|
render() {
|
|
4757
4766
|
const isLink = this.href;
|
|
4758
4767
|
const tag = isLink ? literal `a` : literal `button`;
|
|
4768
|
+
const hasLeftIconSlot = this.hasSlotController.test("leftIcon");
|
|
4769
|
+
const hasRightIconSlot = this.hasSlotController.test("rightIcon");
|
|
4770
|
+
const noIconSlot = !hasLeftIconSlot && !hasRightIconSlot;
|
|
4759
4771
|
return html `
|
|
4760
4772
|
<${tag}
|
|
4761
4773
|
class="btn ${classMap({
|
|
4762
4774
|
disabled: this.disabled,
|
|
4763
4775
|
active: this.active,
|
|
4764
|
-
"has-left-icon":
|
|
4765
|
-
"has-right-icon":
|
|
4776
|
+
"has-left-icon": hasLeftIconSlot,
|
|
4777
|
+
"has-right-icon": hasRightIconSlot,
|
|
4778
|
+
"no-icon": noIconSlot
|
|
4766
4779
|
})}"
|
|
4767
4780
|
?disabled=${ifDefined(isLink ? undefined : this.disabled)}
|
|
4768
4781
|
type=${ifDefined(isLink ? undefined : this.type)}
|
|
@@ -4778,20 +4791,14 @@
|
|
|
4778
4791
|
@blur=${this._handleBlur}
|
|
4779
4792
|
aria-label=${ifDefined(this.ariaLabel)}
|
|
4780
4793
|
>
|
|
4781
|
-
<slot name="leftIcon"
|
|
4794
|
+
<slot name="leftIcon"></slot>
|
|
4782
4795
|
<span><slot></slot></span>
|
|
4783
|
-
<slot name="rightIcon"
|
|
4796
|
+
<slot name="rightIcon"></slot>
|
|
4784
4797
|
</${tag}>
|
|
4785
4798
|
`;
|
|
4786
4799
|
}
|
|
4787
4800
|
}
|
|
4788
4801
|
SgdsButton.styles = [...ButtonElement.styles, css_248z$1, css_248z];
|
|
4789
|
-
__decorate([
|
|
4790
|
-
state()
|
|
4791
|
-
], SgdsButton.prototype, "_hasLeftIcon", void 0);
|
|
4792
|
-
__decorate([
|
|
4793
|
-
state()
|
|
4794
|
-
], SgdsButton.prototype, "_hasRightIcon", void 0);
|
|
4795
4802
|
__decorate([
|
|
4796
4803
|
property({ type: String, reflect: true })
|
|
4797
4804
|
], SgdsButton.prototype, "type", void 0);
|