@carbon/ibm-products-web-components 0.31.0 → 0.32.0-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/custom-elements.json +414 -5
- package/es/components/about-modal/about-modal.scss.js +1 -1
- package/es/components/big-number/big-number-skeleton.d.ts +22 -0
- package/es/components/big-number/big-number-skeleton.js +56 -0
- package/es/components/big-number/big-number-skeleton.js.map +1 -0
- package/es/components/big-number/big-number-skeleton.scss.js +13 -0
- package/es/components/big-number/big-number-skeleton.scss.js.map +1 -0
- package/es/components/big-number/big-number.d.ts +37 -0
- package/es/components/big-number/big-number.js +184 -0
- package/es/components/big-number/big-number.js.map +1 -0
- package/es/components/big-number/big-number.scss.js +13 -0
- package/es/components/big-number/big-number.scss.js.map +1 -0
- package/es/{utilities/carousel/index.d.ts → components/big-number/big-number.test.d.ts} +1 -2
- package/es/components/big-number/big-number.test.js +113 -0
- package/es/components/big-number/big-number.test.js.map +1 -0
- package/es/components/big-number/constants.d.ts +19 -0
- package/es/components/big-number/constants.js +30 -0
- package/es/components/big-number/constants.js.map +1 -0
- package/es/components/big-number/index.d.ts +10 -0
- package/es/{node_modules/@carbon/utilities/es/dateTimeFormat → components/big-number}/index.js +2 -5
- package/es/components/big-number/index.js.map +1 -0
- package/es/components/checklist/checklist.scss.js +1 -1
- package/es/components/coachmark/coachmark-tagline/coachmark-tagline.d.ts +422 -0
- package/es/components/coachmark/coachmark-tagline/coachmark-tagline.js +135 -0
- package/es/components/coachmark/coachmark-tagline/coachmark-tagline.js.map +1 -0
- package/es/components/coachmark/coachmark-tagline/coachmark-tagline.scss.js +13 -0
- package/es/components/coachmark/coachmark-tagline/coachmark-tagline.scss.js.map +1 -0
- package/es/{utilities/carousel/types.js → components/coachmark/coachmark-tagline/coachmark-tagline.test.d.ts} +4 -3
- package/es/components/coachmark/coachmark-tagline/coachmark-tagline.test.js +126 -0
- package/es/components/coachmark/coachmark-tagline/coachmark-tagline.test.js.map +1 -0
- package/es/components/coachmark/coachmark-tagline/index.d.ts +9 -0
- package/{es-custom/utilities/carousel → es/components/coachmark/coachmark-tagline}/index.js +1 -1
- package/es/components/coachmark/coachmark-tagline/index.js.map +1 -0
- package/es/components/guide-banner/guide-banner-element.d.ts +7 -0
- package/es/components/guide-banner/guide-banner-element.js +14 -0
- package/es/components/guide-banner/guide-banner-element.js.map +1 -1
- package/es/components/guide-banner/guide-banner-element.scss.js +13 -0
- package/es/components/guide-banner/guide-banner-element.scss.js.map +1 -0
- package/es/components/guide-banner/guide-banner-element.test.d.ts +7 -0
- package/es/components/guide-banner/guide-banner-element.test.js +58 -0
- package/es/components/guide-banner/guide-banner-element.test.js.map +1 -0
- package/es/components/guide-banner/guide-banner.d.ts +4 -4
- package/es/components/guide-banner/guide-banner.js +4 -4
- package/es/components/guide-banner/guide-banner.js.map +1 -1
- package/es/components/guide-banner/guide-banner.scss.js +1 -1
- package/es/components/guide-banner/guide-banner.test.d.ts +6 -0
- package/es/components/guide-banner/guide-banner.test.js +3 -3
- package/es/components/guide-banner/guide-banner.test.js.map +1 -1
- package/es/components/interstitial-screen/interstitial-screen-body-item.scss.js +1 -1
- package/es/components/interstitial-screen/interstitial-screen-body.d.ts +1 -0
- package/es/components/interstitial-screen/interstitial-screen-body.js +16 -4
- package/es/components/interstitial-screen/interstitial-screen-body.js.map +1 -1
- package/es/components/interstitial-screen/interstitial-screen-body.scss.js +1 -1
- package/es/components/interstitial-screen/interstitial-screen-context.d.ts +1 -0
- package/es/components/interstitial-screen/interstitial-screen-context.js +5 -0
- package/es/components/interstitial-screen/interstitial-screen-context.js.map +1 -1
- package/es/components/interstitial-screen/interstitial-screen.js +15 -0
- package/es/components/interstitial-screen/interstitial-screen.js.map +1 -1
- package/es/components/interstitial-screen/interstitial-screen.test.js +11 -0
- package/es/components/interstitial-screen/interstitial-screen.test.js.map +1 -1
- package/es/components/interstitial-screen/interstitial.figma.js +288 -0
- package/es/components/interstitial-screen/interstitial.figma.js.map +1 -0
- package/es/components/notification-panel/notification.js +2 -3
- package/es/components/notification-panel/notification.js.map +1 -1
- package/es/components/notification-panel/notification.test.js +2 -3
- package/es/components/notification-panel/notification.test.js.map +1 -1
- package/es/components/page-header/_story-assets/set-of-breadcrumbs.scss.js +1 -1
- package/es/components/page-header/_story-assets/set-of-tags/set-of-tags.js +2 -3
- package/es/components/page-header/_story-assets/set-of-tags/set-of-tags.js.map +1 -1
- package/es/components/page-header/_story-assets/set-of-tags/set-of-tags.scss.js +1 -1
- package/es/components/page-header/utils.js +17 -5
- package/es/components/page-header/utils.js.map +1 -1
- package/es/components/side-panel/side-panel.figma.js +229 -0
- package/es/components/side-panel/side-panel.figma.js.map +1 -0
- package/es/components/tearsheet/tearsheet.d.ts +33 -14
- package/es/components/tearsheet/tearsheet.js +65 -98
- package/es/components/tearsheet/tearsheet.js.map +1 -1
- package/es/components/tearsheet/tearsheet.scss.js +1 -1
- package/es/index.d.ts +4 -1
- package/es/index.js +3 -0
- package/es/index.js.map +1 -1
- package/es/packages/ibm-products-web-components/package.json.js +1 -1
- package/es/utilities/snapscroll/index.d.ts +7 -0
- package/es/utilities/snapscroll/index.js +9 -0
- package/es/utilities/snapscroll/index.js.map +1 -0
- package/es/utilities/snapscroll/snapscroll.d.ts +29 -0
- package/es/utilities/snapscroll/snapscroll.js +134 -0
- package/es/utilities/snapscroll/snapscroll.js.map +1 -0
- package/es/utilities/snapscroll/snapscroll.test.d.ts +1 -0
- package/es/utilities/snapscroll/snapscroll.test.js +41 -0
- package/es/utilities/snapscroll/snapscroll.test.js.map +1 -0
- package/es-custom/components/about-modal/about-modal.scss.js +1 -1
- package/es-custom/components/big-number/big-number-skeleton.d.ts +22 -0
- package/es-custom/components/big-number/big-number-skeleton.js +56 -0
- package/es-custom/components/big-number/big-number-skeleton.js.map +1 -0
- package/es-custom/components/big-number/big-number-skeleton.scss.js +13 -0
- package/es-custom/components/big-number/big-number-skeleton.scss.js.map +1 -0
- package/es-custom/components/big-number/big-number.d.ts +37 -0
- package/es-custom/components/big-number/big-number.js +184 -0
- package/es-custom/components/big-number/big-number.js.map +1 -0
- package/es-custom/components/big-number/big-number.scss.js +13 -0
- package/es-custom/components/big-number/big-number.scss.js.map +1 -0
- package/{lib/utilities/carousel/index.d.ts → es-custom/components/big-number/big-number.test.d.ts} +1 -2
- package/es-custom/components/big-number/big-number.test.js +113 -0
- package/es-custom/components/big-number/big-number.test.js.map +1 -0
- package/es-custom/components/big-number/constants.d.ts +19 -0
- package/es-custom/components/big-number/constants.js +30 -0
- package/es-custom/components/big-number/constants.js.map +1 -0
- package/es-custom/components/big-number/index.d.ts +10 -0
- package/es-custom/{node_modules/@carbon/utilities/es/dateTimeFormat → components/big-number}/index.js +2 -5
- package/es-custom/components/big-number/index.js.map +1 -0
- package/es-custom/components/checklist/checklist.scss.js +1 -1
- package/es-custom/components/coachmark/coachmark-tagline/coachmark-tagline.d.ts +422 -0
- package/es-custom/components/coachmark/coachmark-tagline/coachmark-tagline.js +135 -0
- package/es-custom/components/coachmark/coachmark-tagline/coachmark-tagline.js.map +1 -0
- package/es-custom/components/coachmark/coachmark-tagline/coachmark-tagline.scss.js +13 -0
- package/es-custom/components/coachmark/coachmark-tagline/coachmark-tagline.scss.js.map +1 -0
- package/es-custom/{utilities/carousel/types.js → components/coachmark/coachmark-tagline/coachmark-tagline.test.d.ts} +4 -3
- package/es-custom/components/coachmark/coachmark-tagline/coachmark-tagline.test.js +126 -0
- package/es-custom/components/coachmark/coachmark-tagline/coachmark-tagline.test.js.map +1 -0
- package/es-custom/components/coachmark/coachmark-tagline/index.d.ts +9 -0
- package/{es/utilities/carousel → es-custom/components/coachmark/coachmark-tagline}/index.js +1 -1
- package/es-custom/components/guide-banner/guide-banner-element.d.ts +7 -0
- package/es-custom/components/guide-banner/guide-banner-element.js +14 -0
- package/es-custom/components/guide-banner/guide-banner-element.js.map +1 -1
- package/es-custom/components/guide-banner/guide-banner-element.scss.js +13 -0
- package/es-custom/components/guide-banner/guide-banner-element.scss.js.map +1 -0
- package/es-custom/{utilities/carousel/index.d.ts → components/guide-banner/guide-banner-element.test.d.ts} +1 -2
- package/es-custom/components/guide-banner/guide-banner-element.test.js +58 -0
- package/es-custom/components/guide-banner/guide-banner-element.test.js.map +1 -0
- package/es-custom/components/guide-banner/guide-banner.d.ts +4 -4
- package/es-custom/components/guide-banner/guide-banner.js +4 -4
- package/es-custom/components/guide-banner/guide-banner.js.map +1 -1
- package/es-custom/components/guide-banner/guide-banner.scss.js +1 -1
- package/es-custom/components/guide-banner/guide-banner.test.d.ts +6 -0
- package/es-custom/components/guide-banner/guide-banner.test.js +3 -3
- package/es-custom/components/guide-banner/guide-banner.test.js.map +1 -1
- package/es-custom/components/interstitial-screen/interstitial-screen-body-item.scss.js +1 -1
- package/es-custom/components/interstitial-screen/interstitial-screen-body.d.ts +1 -0
- package/es-custom/components/interstitial-screen/interstitial-screen-body.js +16 -4
- package/es-custom/components/interstitial-screen/interstitial-screen-body.js.map +1 -1
- package/es-custom/components/interstitial-screen/interstitial-screen-body.scss.js +1 -1
- package/es-custom/components/interstitial-screen/interstitial-screen-context.d.ts +1 -0
- package/es-custom/components/interstitial-screen/interstitial-screen-context.js +5 -0
- package/es-custom/components/interstitial-screen/interstitial-screen-context.js.map +1 -1
- package/es-custom/components/interstitial-screen/interstitial-screen.js +15 -0
- package/es-custom/components/interstitial-screen/interstitial-screen.js.map +1 -1
- package/es-custom/components/interstitial-screen/interstitial-screen.test.js +11 -0
- package/es-custom/components/interstitial-screen/interstitial-screen.test.js.map +1 -1
- package/es-custom/components/interstitial-screen/interstitial.figma.js +288 -0
- package/es-custom/components/interstitial-screen/interstitial.figma.js.map +1 -0
- package/es-custom/components/notification-panel/notification.js +2 -3
- package/es-custom/components/notification-panel/notification.js.map +1 -1
- package/es-custom/components/notification-panel/notification.test.js +2 -3
- package/es-custom/components/notification-panel/notification.test.js.map +1 -1
- package/es-custom/components/page-header/_story-assets/set-of-breadcrumbs.scss.js +1 -1
- package/es-custom/components/page-header/_story-assets/set-of-tags/set-of-tags.js +2 -3
- package/es-custom/components/page-header/_story-assets/set-of-tags/set-of-tags.js.map +1 -1
- package/es-custom/components/page-header/_story-assets/set-of-tags/set-of-tags.scss.js +1 -1
- package/es-custom/components/page-header/utils.js +17 -5
- package/es-custom/components/page-header/utils.js.map +1 -1
- package/es-custom/components/side-panel/side-panel.figma.js +229 -0
- package/es-custom/components/side-panel/side-panel.figma.js.map +1 -0
- package/es-custom/components/tearsheet/tearsheet.d.ts +33 -14
- package/es-custom/components/tearsheet/tearsheet.js +65 -98
- package/es-custom/components/tearsheet/tearsheet.js.map +1 -1
- package/es-custom/components/tearsheet/tearsheet.scss.js +1 -1
- package/es-custom/index.d.ts +4 -1
- package/es-custom/index.js +3 -0
- package/es-custom/index.js.map +1 -1
- package/es-custom/packages/ibm-products-web-components/package.json.js +1 -1
- package/{es/utilities/carousel/swipeEvents.d.ts → es-custom/utilities/snapscroll/index.d.ts} +1 -1
- package/es-custom/utilities/snapscroll/index.js +9 -0
- package/es-custom/utilities/snapscroll/snapscroll.d.ts +29 -0
- package/es-custom/utilities/snapscroll/snapscroll.js +134 -0
- package/es-custom/utilities/snapscroll/snapscroll.js.map +1 -0
- package/es-custom/utilities/snapscroll/snapscroll.test.d.ts +1 -0
- package/es-custom/utilities/snapscroll/snapscroll.test.js +41 -0
- package/es-custom/utilities/snapscroll/snapscroll.test.js.map +1 -0
- package/lib/components/big-number/big-number-skeleton.d.ts +22 -0
- package/lib/components/big-number/big-number.d.ts +37 -0
- package/lib/components/big-number/big-number.test.d.ts +7 -0
- package/lib/components/big-number/constants.d.ts +19 -0
- package/lib/components/big-number/index.d.ts +10 -0
- package/lib/components/coachmark/coachmark-tagline/coachmark-tagline.d.ts +422 -0
- package/lib/components/coachmark/coachmark-tagline/coachmark-tagline.test.d.ts +9 -0
- package/lib/components/coachmark/coachmark-tagline/index.d.ts +9 -0
- package/lib/components/guide-banner/guide-banner-element.d.ts +7 -0
- package/lib/components/guide-banner/guide-banner-element.test.d.ts +7 -0
- package/lib/components/guide-banner/guide-banner.d.ts +4 -4
- package/lib/components/guide-banner/guide-banner.test.d.ts +6 -0
- package/lib/components/interstitial-screen/interstitial-screen-body.d.ts +1 -0
- package/lib/components/interstitial-screen/interstitial-screen-context.d.ts +1 -0
- package/lib/components/tearsheet/tearsheet.d.ts +33 -14
- package/lib/index.d.ts +4 -1
- package/lib/utilities/snapscroll/index.d.ts +7 -0
- package/lib/utilities/snapscroll/snapscroll.d.ts +29 -0
- package/lib/utilities/snapscroll/snapscroll.test.d.ts +1 -0
- package/package.json +6 -3
- package/scss/components/big-number/big-number-skeleton.scss +59 -0
- package/scss/components/big-number/big-number.scss +27 -0
- package/scss/components/coachmark/coachmark-tagline/coachmark-tagline.scss +22 -0
- package/scss/components/guide-banner/guide-banner-element.scss +31 -0
- package/scss/components/guide-banner/guide-banner.scss +2 -0
- package/scss/components/interstitial-screen/interstitial-screen-body-item.scss +1 -1
- package/scss/components/interstitial-screen/interstitial-screen-body.scss +1 -1
- package/scss/components/page-header/_story-assets/_storybook-styles.scss +6 -4
- package/telemetry.yml +12 -3
- package/es/node_modules/@carbon/utilities/es/dateTimeFormat/index.js.map +0 -1
- package/es/node_modules/@carbon/utilities/es/dateTimeFormat/relative.js +0 -11
- package/es/node_modules/@carbon/utilities/es/dateTimeFormat/relative.js.map +0 -1
- package/es/node_modules/@carbon/utilities/es/documentLang/documentLang.js +0 -9
- package/es/node_modules/@carbon/utilities/es/documentLang/documentLang.js.map +0 -1
- package/es/node_modules/@carbon/utilities/es/overflowHandler/overflowHandler.js +0 -11
- package/es/node_modules/@carbon/utilities/es/overflowHandler/overflowHandler.js.map +0 -1
- package/es/utilities/carousel/carousel.d.ts +0 -14
- package/es/utilities/carousel/carousel.js +0 -341
- package/es/utilities/carousel/carousel.js.map +0 -1
- package/es/utilities/carousel/swipeEvents.js +0 -109
- package/es/utilities/carousel/swipeEvents.js.map +0 -1
- package/es/utilities/carousel/types.d.ts +0 -37
- package/es/utilities/carousel/types.js.map +0 -1
- package/es-custom/node_modules/@carbon/utilities/es/dateTimeFormat/index.js.map +0 -1
- package/es-custom/node_modules/@carbon/utilities/es/dateTimeFormat/relative.js +0 -11
- package/es-custom/node_modules/@carbon/utilities/es/dateTimeFormat/relative.js.map +0 -1
- package/es-custom/node_modules/@carbon/utilities/es/documentLang/documentLang.js +0 -9
- package/es-custom/node_modules/@carbon/utilities/es/documentLang/documentLang.js.map +0 -1
- package/es-custom/node_modules/@carbon/utilities/es/overflowHandler/overflowHandler.js +0 -11
- package/es-custom/node_modules/@carbon/utilities/es/overflowHandler/overflowHandler.js.map +0 -1
- package/es-custom/utilities/carousel/carousel.d.ts +0 -14
- package/es-custom/utilities/carousel/carousel.js +0 -341
- package/es-custom/utilities/carousel/carousel.js.map +0 -1
- package/es-custom/utilities/carousel/swipeEvents.d.ts +0 -7
- package/es-custom/utilities/carousel/swipeEvents.js +0 -109
- package/es-custom/utilities/carousel/swipeEvents.js.map +0 -1
- package/es-custom/utilities/carousel/types.d.ts +0 -37
- package/es-custom/utilities/carousel/types.js.map +0 -1
- package/lib/utilities/carousel/carousel.d.ts +0 -14
- package/lib/utilities/carousel/swipeEvents.d.ts +0 -7
- package/lib/utilities/carousel/types.d.ts +0 -37
- /package/es-custom/{utilities/carousel → components/coachmark/coachmark-tagline}/index.js.map +0 -0
- /package/{es/utilities/carousel → es-custom/utilities/snapscroll}/index.js.map +0 -0
|
@@ -20,12 +20,24 @@
|
|
|
20
20
|
*/
|
|
21
21
|
const getHeaderOffset = (el) => {
|
|
22
22
|
const scrollableContainer = scrollableAncestor(el);
|
|
23
|
-
|
|
24
|
-
? scrollableContainer.getBoundingClientRect().top
|
|
25
|
-
: 0;
|
|
23
|
+
// Get the element's position relative to the viewport
|
|
26
24
|
const offsetMeasuringTop = el ? el.getBoundingClientRect().top : 0;
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
if (scrollableContainer === document.scrollingElement) {
|
|
26
|
+
// If scrolling on the document level, return the current viewport position
|
|
27
|
+
// This ensures the breadcrumb bar stays correctly positioned regardless of scroll
|
|
28
|
+
return offsetMeasuringTop >= 0 ? offsetMeasuringTop : 0;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
// If there's a scrollable parent container
|
|
32
|
+
const scrollableContainerTop = scrollableContainer
|
|
33
|
+
? scrollableContainer.getBoundingClientRect().top
|
|
34
|
+
: 0;
|
|
35
|
+
// Calculate offset relative to the scrollable container
|
|
36
|
+
const totalHeaderOffset = offsetMeasuringTop !== 0
|
|
37
|
+
? offsetMeasuringTop - scrollableContainerTop
|
|
38
|
+
: 0;
|
|
39
|
+
return totalHeaderOffset >= 0 ? totalHeaderOffset : 0;
|
|
40
|
+
}
|
|
29
41
|
};
|
|
30
42
|
const windowExists = typeof window !== `undefined`;
|
|
31
43
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../src/components/page-header/utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAEH;;;;AAIG;AAEU,MAAA,eAAe,GAAG,CAAC,EAAe,KAAY;AACzD,IAAA,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,EAAE,CAAC
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../src/components/page-header/utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAEH;;;;AAIG;AAEU,MAAA,eAAe,GAAG,CAAC,EAAe,KAAY;AACzD,IAAA,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,EAAE,CAAC;;AAGlD,IAAA,MAAM,kBAAkB,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAqB,EAAE,CAAC,GAAG,GAAG,CAAC;AAElE,IAAA,IAAI,mBAAmB,KAAK,QAAQ,CAAC,gBAAgB,EAAE;;;QAGrD,OAAO,kBAAkB,IAAI,CAAC,GAAG,kBAAkB,GAAG,CAAC;;SAClD;;QAEL,MAAM,sBAAsB,GAAG;AAC7B,cAAG,mBAAmC,CAAC,qBAAqB,EAAE,CAAC;cAC7D,CAAC;;AAGL,QAAA,MAAM,iBAAiB,GACrB,kBAAkB,KAAK;cACnB,kBAAkB,GAAG;cACrB,CAAC;QACP,OAAO,iBAAiB,IAAI,CAAC,GAAG,iBAAiB,GAAG,CAAC;;AAEzD;AAEA,MAAM,YAAY,GAAG,OAAO,MAAM,KAAK,WAAW;AAElD;;;;;AAKG;AACU,MAAA,UAAU,GAAG,CAAC,MAAmB,KAAa;IACzD,MAAM,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC;IAC7C,OAAO,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;AACpD;AAEA;;AAEG;AACU,MAAA,uBAAuB,GAAG,CAAC,MAAmB,KAAI;IAC7D,IAAI,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,KAAK,QAAQ,EAAE;AACvD,QAAA,IAAI,UAAU,CAAC,MAAM,CAAC,UAAyB,CAAC,EAAE;YAChD,OAAO,MAAM,CAAC,UAAU;;aACnB;AACL,YAAA,OAAO,uBAAuB,CAAC,MAAM,CAAC,UAAyB,CAAC;;;SAE7D;QACL,OAAO,QAAQ,CAAC,gBAAgB;;AAEpC;AAEA;;;;;AAKG;AACU,MAAA,kBAAkB,GAAG,CAAC,MAAmB,KAAI;AACxD,IAAA,IAAI,CAAC,YAAY,IAAI,CAAC,MAAM,EAAE;AAC5B,QAAA,OAAO,IAAI;;;IAIb,MAAM,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC;AAE7C,IAAA,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,QAAQ,KAAK,OAAO,EAAE;QACnD,OAAO,QAAQ,CAAC,gBAAgB;;AAElC,IAAA,OAAO,uBAAuB,CAAC,MAAM,CAAC;AACxC;;;;"}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2024
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import './side-panel.js';
|
|
9
|
+
import figma, { html } from '@figma/code-connect/html';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Copyright IBM Corp. 2025
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
15
|
+
* LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
figma.connect(
|
|
20
|
+
'https://www.figma.com/design/0F9dKH2abAd7gSfvnacfWf/-v11--IBM-Products-%E2%80%93-Carbon-Design-System?node-id=8858%3A390246',
|
|
21
|
+
{
|
|
22
|
+
props: {
|
|
23
|
+
size: figma.enum('Size', {
|
|
24
|
+
'X-Small (256)': 'xs',
|
|
25
|
+
'Small (320)': 'sm',
|
|
26
|
+
'Medium (480)': 'md',
|
|
27
|
+
'Large (640)': 'lg',
|
|
28
|
+
'X-Large (<75%)': 'xl',
|
|
29
|
+
}),
|
|
30
|
+
children: figma.children('Slot'),
|
|
31
|
+
title: figma.nestedProps('Header', {
|
|
32
|
+
text: figma.boolean('Title', {
|
|
33
|
+
true: figma.string('Title text'),
|
|
34
|
+
false: undefined,
|
|
35
|
+
}),
|
|
36
|
+
}),
|
|
37
|
+
subtitle: figma.nestedProps('Header', {
|
|
38
|
+
text: figma.string('Description text'),
|
|
39
|
+
}),
|
|
40
|
+
labelText: figma.nestedProps('Header', {
|
|
41
|
+
text: figma.boolean('Eyebrow', {
|
|
42
|
+
true: figma.string('Eyebrow text'),
|
|
43
|
+
false: undefined,
|
|
44
|
+
}),
|
|
45
|
+
}),
|
|
46
|
+
slideIn: figma.boolean('Slide over', {
|
|
47
|
+
true: true,
|
|
48
|
+
false: undefined,
|
|
49
|
+
}),
|
|
50
|
+
placement: figma.boolean('Slide over', {
|
|
51
|
+
true: undefined,
|
|
52
|
+
false: 'right',
|
|
53
|
+
}),
|
|
54
|
+
selectorPageContent: figma.boolean('Slide over', {
|
|
55
|
+
true: undefined,
|
|
56
|
+
false: '#page-content',
|
|
57
|
+
}),
|
|
58
|
+
actions: figma.boolean('Primary actions', {
|
|
59
|
+
false: { actionElements: undefined },
|
|
60
|
+
true: figma.nestedProps('Footer', {
|
|
61
|
+
actionElements: figma.enum('Buttons', {
|
|
62
|
+
'1': html`<cds-custom-button key="p" slot="actions" kind="primary"
|
|
63
|
+
>Primary</cds-custom-button
|
|
64
|
+
>`,
|
|
65
|
+
'2': html`<cds-custom-button slot="actions" kind="secondary"
|
|
66
|
+
>Secondary</cds-custom-button
|
|
67
|
+
>
|
|
68
|
+
<cds-custom-button key="p" slot="actions" kind="primary"
|
|
69
|
+
>Primary</cds-custom-button
|
|
70
|
+
>`,
|
|
71
|
+
|
|
72
|
+
'3': html`<cds-custom-button slot="actions" kind="secondary"
|
|
73
|
+
>Secondary</cds-custom-button
|
|
74
|
+
>
|
|
75
|
+
<cds-custom-button slot="actions" kind="secondary"
|
|
76
|
+
>Secondary 2</cds-custom-button
|
|
77
|
+
>
|
|
78
|
+
<cds-custom-button key="p" slot="actions" kind="primary"
|
|
79
|
+
>Primary</cds-custom-button
|
|
80
|
+
>`,
|
|
81
|
+
'1 + Ghost': html`<cds-custom-button slot="actions" kind="ghost"
|
|
82
|
+
>Ghost</cds-custom-button
|
|
83
|
+
>
|
|
84
|
+
<cds-custom-button key="p" slot="actions" kind="primary"
|
|
85
|
+
>Primary</cds-custom-button
|
|
86
|
+
>`,
|
|
87
|
+
'2 + Ghost': html`<cds-custom-button slot="actions" kind="ghost"
|
|
88
|
+
>Ghost</cds-custom-button
|
|
89
|
+
>
|
|
90
|
+
<cds-custom-button slot="actions" kind="secondary">Secondary</cds-custom-button>
|
|
91
|
+
<cds-custom-button slot="actions" kind="primary">Primary</cds-custom-button>`,
|
|
92
|
+
}),
|
|
93
|
+
}),
|
|
94
|
+
}),
|
|
95
|
+
toolbar: figma.nestedProps('Header', {
|
|
96
|
+
items: figma.boolean('Action toolbar', {
|
|
97
|
+
false: { actionsElements: undefined },
|
|
98
|
+
true: figma.nestedProps('Action toolbar', {
|
|
99
|
+
actionsElements: figma.boolean('Button', {
|
|
100
|
+
true: html`<cds-custom-button slot="action-toolbar">Copy</cds-custom-button>
|
|
101
|
+
<cds-custom-button
|
|
102
|
+
slot="action-toolbar"
|
|
103
|
+
aria-label="Settings"
|
|
104
|
+
has-icon-only="true"
|
|
105
|
+
size="sm"
|
|
106
|
+
tooltip-text="Settings"
|
|
107
|
+
kind="ghost"
|
|
108
|
+
>
|
|
109
|
+
<svg
|
|
110
|
+
focusable="false"
|
|
111
|
+
preserveAspectRatio="xMidYMid meet"
|
|
112
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
113
|
+
fill="currentColor"
|
|
114
|
+
slot="icon"
|
|
115
|
+
width="16"
|
|
116
|
+
height="16"
|
|
117
|
+
viewBox="0 0 16 16"
|
|
118
|
+
aria-hidden="true"
|
|
119
|
+
>
|
|
120
|
+
<path
|
|
121
|
+
d="M13.5,8.4c0-0.1,0-0.3,0-0.4c0-0.1,0-0.3,0-0.4l1-0.8c0.4-0.3,0.4-0.9,0.2-1.3l-1.2-2C13.3,3.2,13,3,12.6,3 c-0.1,0-0.2,0-0.3,0.1l-1.2,0.4c-0.2-0.1-0.4-0.3-0.7-0.4l-0.3-1.3C10.1,1.3,9.7,1,9.2,1H6.8c-0.5,0-0.9,0.3-1,0.8L5.6,3.1 C5.3,3.2,5.1,3.3,4.9,3.4L3.7,3C3.6,3,3.5,3,3.4,3C3,3,2.7,3.2,2.5,3.5l-1.2,2C1.1,5.9,1.2,6.4,1.6,6.8l0.9,0.9c0,0.1,0,0.3,0,0.4 c0,0.1,0,0.3,0,0.4L1.6,9.2c-0.4,0.3-0.5,0.9-0.2,1.3l1.2,2C2.7,12.8,3,13,3.4,13c0.1,0,0.2,0,0.3-0.1l1.2-0.4 c0.2,0.1,0.4,0.3,0.7,0.4l0.3,1.3c0.1,0.5,0.5,0.8,1,0.8h2.4c0.5,0,0.9-0.3,1-0.8l0.3-1.3c0.2-0.1,0.4-0.2,0.7-0.4l1.2,0.4 c0.1,0,0.2,0.1,0.3,0.1c0.4,0,0.7-0.2,0.9-0.5l1.1-2c0.2-0.4,0.2-0.9-0.2-1.3L13.5,8.4z M12.6,12l-1.7-0.6c-0.4,0.3-0.9,0.6-1.4,0.8 L9.2,14H6.8l-0.4-1.8c-0.5-0.2-0.9-0.5-1.4-0.8L3.4,12l-1.2-2l1.4-1.2c-0.1-0.5-0.1-1.1,0-1.6L2.2,6l1.2-2l1.7,0.6 C5.5,4.2,6,4,6.5,3.8L6.8,2h2.4l0.4,1.8c0.5,0.2,0.9,0.5,1.4,0.8L12.6,4l1.2,2l-1.4,1.2c0.1,0.5,0.1,1.1,0,1.6l1.4,1.2L12.6,12z"
|
|
122
|
+
></path>
|
|
123
|
+
<path
|
|
124
|
+
d="M8,11c-1.7,0-3-1.3-3-3s1.3-3,3-3s3,1.3,3,3C11,9.6,9.7,11,8,11C8,11,8,11,8,11z M8,6C6.9,6,6,6.8,6,7.9C6,7.9,6,8,6,8 c0,1.1,0.8,2,1.9,2c0,0,0.1,0,0.1,0c1.1,0,2-0.8,2-1.9c0,0,0-0.1,0-0.1C10,6.9,9.2,6,8,6C8.1,6,8,6,8,6z"
|
|
125
|
+
></path>
|
|
126
|
+
</svg>
|
|
127
|
+
</cds-custom-button>
|
|
128
|
+
<cds-custom-button
|
|
129
|
+
slot="action-toolbar"
|
|
130
|
+
aria-label="Delete"
|
|
131
|
+
has-icon-only="true"
|
|
132
|
+
size="sm"
|
|
133
|
+
tooltip-text="Delete"
|
|
134
|
+
kind="ghost"
|
|
135
|
+
>
|
|
136
|
+
<svg
|
|
137
|
+
focusable="false"
|
|
138
|
+
preserveAspectRatio="xMidYMid meet"
|
|
139
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
140
|
+
fill="currentColor"
|
|
141
|
+
slot="icon"
|
|
142
|
+
width="16"
|
|
143
|
+
height="16"
|
|
144
|
+
viewBox="0 0 32 32"
|
|
145
|
+
aria-hidden="true"
|
|
146
|
+
>
|
|
147
|
+
<path d="M12 12H14V24H12zM18 12H20V24H18z"></path>
|
|
148
|
+
<path
|
|
149
|
+
d="M4 6V8H6V28a2 2 0 002 2H24a2 2 0 002-2V8h2V6zM8 28V8H24V28zM12 2H20V4H12z"
|
|
150
|
+
></path>
|
|
151
|
+
</svg>
|
|
152
|
+
</cds-custom-button>`,
|
|
153
|
+
false: html`<cds-custom-button
|
|
154
|
+
slot="action-toolbar"
|
|
155
|
+
aria-label="Settings"
|
|
156
|
+
has-icon-only="true"
|
|
157
|
+
size="sm"
|
|
158
|
+
tooltip-text="Settings"
|
|
159
|
+
kind="ghost"
|
|
160
|
+
>
|
|
161
|
+
<svg
|
|
162
|
+
focusable="false"
|
|
163
|
+
preserveAspectRatio="xMidYMid meet"
|
|
164
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
165
|
+
fill="currentColor"
|
|
166
|
+
slot="icon"
|
|
167
|
+
width="16"
|
|
168
|
+
height="16"
|
|
169
|
+
viewBox="0 0 16 16"
|
|
170
|
+
aria-hidden="true"
|
|
171
|
+
>
|
|
172
|
+
<path
|
|
173
|
+
d="M13.5,8.4c0-0.1,0-0.3,0-0.4c0-0.1,0-0.3,0-0.4l1-0.8c0.4-0.3,0.4-0.9,0.2-1.3l-1.2-2C13.3,3.2,13,3,12.6,3 c-0.1,0-0.2,0-0.3,0.1l-1.2,0.4c-0.2-0.1-0.4-0.3-0.7-0.4l-0.3-1.3C10.1,1.3,9.7,1,9.2,1H6.8c-0.5,0-0.9,0.3-1,0.8L5.6,3.1 C5.3,3.2,5.1,3.3,4.9,3.4L3.7,3C3.6,3,3.5,3,3.4,3C3,3,2.7,3.2,2.5,3.5l-1.2,2C1.1,5.9,1.2,6.4,1.6,6.8l0.9,0.9c0,0.1,0,0.3,0,0.4 c0,0.1,0,0.3,0,0.4L1.6,9.2c-0.4,0.3-0.5,0.9-0.2,1.3l1.2,2C2.7,12.8,3,13,3.4,13c0.1,0,0.2,0,0.3-0.1l1.2-0.4 c0.2,0.1,0.4,0.3,0.7,0.4l0.3,1.3c0.1,0.5,0.5,0.8,1,0.8h2.4c0.5,0,0.9-0.3,1-0.8l0.3-1.3c0.2-0.1,0.4-0.2,0.7-0.4l1.2,0.4 c0.1,0,0.2,0.1,0.3,0.1c0.4,0,0.7-0.2,0.9-0.5l1.1-2c0.2-0.4,0.2-0.9-0.2-1.3L13.5,8.4z M12.6,12l-1.7-0.6c-0.4,0.3-0.9,0.6-1.4,0.8 L9.2,14H6.8l-0.4-1.8c-0.5-0.2-0.9-0.5-1.4-0.8L3.4,12l-1.2-2l1.4-1.2c-0.1-0.5-0.1-1.1,0-1.6L2.2,6l1.2-2l1.7,0.6 C5.5,4.2,6,4,6.5,3.8L6.8,2h2.4l0.4,1.8c0.5,0.2,0.9,0.5,1.4,0.8L12.6,4l1.2,2l-1.4,1.2c0.1,0.5,0.1,1.1,0,1.6l1.4,1.2L12.6,12z"
|
|
174
|
+
></path>
|
|
175
|
+
<path
|
|
176
|
+
d="M8,11c-1.7,0-3-1.3-3-3s1.3-3,3-3s3,1.3,3,3C11,9.6,9.7,11,8,11C8,11,8,11,8,11z M8,6C6.9,6,6,6.8,6,7.9C6,7.9,6,8,6,8 c0,1.1,0.8,2,1.9,2c0,0,0.1,0,0.1,0c1.1,0,2-0.8,2-1.9c0,0,0-0.1,0-0.1C10,6.9,9.2,6,8,6C8.1,6,8,6,8,6z"
|
|
177
|
+
></path>
|
|
178
|
+
</svg>
|
|
179
|
+
</cds-custom-button>
|
|
180
|
+
<cds-custom-button
|
|
181
|
+
slot="action-toolbar"
|
|
182
|
+
aria-label="Delete"
|
|
183
|
+
has-icon-only="true"
|
|
184
|
+
size="sm"
|
|
185
|
+
tooltip-text="Delete"
|
|
186
|
+
kind="ghost"
|
|
187
|
+
>
|
|
188
|
+
<svg
|
|
189
|
+
focusable="false"
|
|
190
|
+
preserveAspectRatio="xMidYMid meet"
|
|
191
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
192
|
+
fill="currentColor"
|
|
193
|
+
slot="icon"
|
|
194
|
+
width="16"
|
|
195
|
+
height="16"
|
|
196
|
+
viewBox="0 0 32 32"
|
|
197
|
+
aria-hidden="true"
|
|
198
|
+
>
|
|
199
|
+
<path d="M12 12H14V24H12zM18 12H20V24H18z"></path>
|
|
200
|
+
<path
|
|
201
|
+
d="M4 6V8H6V28a2 2 0 002 2H24a2 2 0 002-2V8h2V6zM8 28V8H24V28zM12 2H20V4H12z"
|
|
202
|
+
></path>
|
|
203
|
+
</svg>
|
|
204
|
+
</cds-custom-button>`,
|
|
205
|
+
}),
|
|
206
|
+
}),
|
|
207
|
+
}),
|
|
208
|
+
}),
|
|
209
|
+
},
|
|
210
|
+
example: (props) => html`
|
|
211
|
+
<c4p-side-panel
|
|
212
|
+
open
|
|
213
|
+
label-text="${props.labelText.text}"
|
|
214
|
+
slide-in="${props.slideIn}"
|
|
215
|
+
size="${props.size}"
|
|
216
|
+
placement=${props.placement}
|
|
217
|
+
selector-page-content=${props.selectorPageContent}
|
|
218
|
+
.title="${props.title.text}"
|
|
219
|
+
>
|
|
220
|
+
${props.subtitle.text} ${props.toolbar.items.actionsElements}
|
|
221
|
+
${props.actions.actionElements} ${props.children}
|
|
222
|
+
</c4p-side-panel>
|
|
223
|
+
`,
|
|
224
|
+
imports: [
|
|
225
|
+
"import '@carbon/ibm-products-web-components/es/components/side-panel/index';",
|
|
226
|
+
],
|
|
227
|
+
}
|
|
228
|
+
);
|
|
229
|
+
//# sourceMappingURL=side-panel.figma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"side-panel.figma.js","sources":["../../../src/components/side-panel/side-panel.figma.ts"],"sourcesContent":["/**\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport './side-panel';\nimport figma, { html } from '@figma/code-connect/html';\n\nfigma.connect(\n 'https://www.figma.com/design/0F9dKH2abAd7gSfvnacfWf/-v11--IBM-Products-%E2%80%93-Carbon-Design-System?node-id=8858%3A390246',\n {\n props: {\n size: figma.enum('Size', {\n 'X-Small (256)': 'xs',\n 'Small (320)': 'sm',\n 'Medium (480)': 'md',\n 'Large (640)': 'lg',\n 'X-Large (<75%)': 'xl',\n }),\n children: figma.children('Slot'),\n title: figma.nestedProps('Header', {\n text: figma.boolean('Title', {\n true: figma.string('Title text'),\n false: undefined,\n }),\n }),\n subtitle: figma.nestedProps('Header', {\n text: figma.string('Description text'),\n }),\n labelText: figma.nestedProps('Header', {\n text: figma.boolean('Eyebrow', {\n true: figma.string('Eyebrow text'),\n false: undefined,\n }),\n }),\n slideIn: figma.boolean('Slide over', {\n true: true,\n false: undefined,\n }),\n placement: figma.boolean('Slide over', {\n true: undefined,\n false: 'right',\n }),\n selectorPageContent: figma.boolean('Slide over', {\n true: undefined,\n false: '#page-content',\n }),\n actions: figma.boolean('Primary actions', {\n false: { actionElements: undefined },\n true: figma.nestedProps('Footer', {\n actionElements: figma.enum('Buttons', {\n '1': html`<cds-custom-button key=\"p\" slot=\"actions\" kind=\"primary\"\n >Primary</cds-custom-button\n >`,\n '2': html`<cds-custom-button slot=\"actions\" kind=\"secondary\"\n >Secondary</cds-custom-button\n >\n <cds-custom-button key=\"p\" slot=\"actions\" kind=\"primary\"\n >Primary</cds-custom-button\n >`,\n\n '3': html`<cds-custom-button slot=\"actions\" kind=\"secondary\"\n >Secondary</cds-custom-button\n >\n <cds-custom-button slot=\"actions\" kind=\"secondary\"\n >Secondary 2</cds-custom-button\n >\n <cds-custom-button key=\"p\" slot=\"actions\" kind=\"primary\"\n >Primary</cds-custom-button\n >`,\n '1 + Ghost': html`<cds-custom-button slot=\"actions\" kind=\"ghost\"\n >Ghost</cds-custom-button\n >\n <cds-custom-button key=\"p\" slot=\"actions\" kind=\"primary\"\n >Primary</cds-custom-button\n >`,\n '2 + Ghost': html`<cds-custom-button slot=\"actions\" kind=\"ghost\"\n >Ghost</cds-custom-button\n >\n <cds-custom-button slot=\"actions\" kind=\"secondary\">Secondary</cds-custom-button>\n <cds-custom-button slot=\"actions\" kind=\"primary\">Primary</cds-custom-button>`,\n }),\n }),\n }),\n toolbar: figma.nestedProps('Header', {\n items: figma.boolean('Action toolbar', {\n false: { actionsElements: undefined },\n true: figma.nestedProps('Action toolbar', {\n actionsElements: figma.boolean('Button', {\n true: html`<cds-custom-button slot=\"action-toolbar\">Copy</cds-custom-button>\n <cds-custom-button\n slot=\"action-toolbar\"\n aria-label=\"Settings\"\n has-icon-only=\"true\"\n size=\"sm\"\n tooltip-text=\"Settings\"\n kind=\"ghost\"\n >\n <svg\n focusable=\"false\"\n preserveAspectRatio=\"xMidYMid meet\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"currentColor\"\n slot=\"icon\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n aria-hidden=\"true\"\n >\n <path\n d=\"M13.5,8.4c0-0.1,0-0.3,0-0.4c0-0.1,0-0.3,0-0.4l1-0.8c0.4-0.3,0.4-0.9,0.2-1.3l-1.2-2C13.3,3.2,13,3,12.6,3\tc-0.1,0-0.2,0-0.3,0.1l-1.2,0.4c-0.2-0.1-0.4-0.3-0.7-0.4l-0.3-1.3C10.1,1.3,9.7,1,9.2,1H6.8c-0.5,0-0.9,0.3-1,0.8L5.6,3.1\tC5.3,3.2,5.1,3.3,4.9,3.4L3.7,3C3.6,3,3.5,3,3.4,3C3,3,2.7,3.2,2.5,3.5l-1.2,2C1.1,5.9,1.2,6.4,1.6,6.8l0.9,0.9c0,0.1,0,0.3,0,0.4\tc0,0.1,0,0.3,0,0.4L1.6,9.2c-0.4,0.3-0.5,0.9-0.2,1.3l1.2,2C2.7,12.8,3,13,3.4,13c0.1,0,0.2,0,0.3-0.1l1.2-0.4\tc0.2,0.1,0.4,0.3,0.7,0.4l0.3,1.3c0.1,0.5,0.5,0.8,1,0.8h2.4c0.5,0,0.9-0.3,1-0.8l0.3-1.3c0.2-0.1,0.4-0.2,0.7-0.4l1.2,0.4\tc0.1,0,0.2,0.1,0.3,0.1c0.4,0,0.7-0.2,0.9-0.5l1.1-2c0.2-0.4,0.2-0.9-0.2-1.3L13.5,8.4z M12.6,12l-1.7-0.6c-0.4,0.3-0.9,0.6-1.4,0.8\tL9.2,14H6.8l-0.4-1.8c-0.5-0.2-0.9-0.5-1.4-0.8L3.4,12l-1.2-2l1.4-1.2c-0.1-0.5-0.1-1.1,0-1.6L2.2,6l1.2-2l1.7,0.6\tC5.5,4.2,6,4,6.5,3.8L6.8,2h2.4l0.4,1.8c0.5,0.2,0.9,0.5,1.4,0.8L12.6,4l1.2,2l-1.4,1.2c0.1,0.5,0.1,1.1,0,1.6l1.4,1.2L12.6,12z\"\n ></path>\n <path\n d=\"M8,11c-1.7,0-3-1.3-3-3s1.3-3,3-3s3,1.3,3,3C11,9.6,9.7,11,8,11C8,11,8,11,8,11z M8,6C6.9,6,6,6.8,6,7.9C6,7.9,6,8,6,8\tc0,1.1,0.8,2,1.9,2c0,0,0.1,0,0.1,0c1.1,0,2-0.8,2-1.9c0,0,0-0.1,0-0.1C10,6.9,9.2,6,8,6C8.1,6,8,6,8,6z\"\n ></path>\n </svg>\n </cds-custom-button>\n <cds-custom-button\n slot=\"action-toolbar\"\n aria-label=\"Delete\"\n has-icon-only=\"true\"\n size=\"sm\"\n tooltip-text=\"Delete\"\n kind=\"ghost\"\n >\n <svg\n focusable=\"false\"\n preserveAspectRatio=\"xMidYMid meet\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"currentColor\"\n slot=\"icon\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 32 32\"\n aria-hidden=\"true\"\n >\n <path d=\"M12 12H14V24H12zM18 12H20V24H18z\"></path>\n <path\n d=\"M4 6V8H6V28a2 2 0 002 2H24a2 2 0 002-2V8h2V6zM8 28V8H24V28zM12 2H20V4H12z\"\n ></path>\n </svg>\n </cds-custom-button>`,\n false: html`<cds-custom-button\n slot=\"action-toolbar\"\n aria-label=\"Settings\"\n has-icon-only=\"true\"\n size=\"sm\"\n tooltip-text=\"Settings\"\n kind=\"ghost\"\n >\n <svg\n focusable=\"false\"\n preserveAspectRatio=\"xMidYMid meet\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"currentColor\"\n slot=\"icon\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n aria-hidden=\"true\"\n >\n <path\n d=\"M13.5,8.4c0-0.1,0-0.3,0-0.4c0-0.1,0-0.3,0-0.4l1-0.8c0.4-0.3,0.4-0.9,0.2-1.3l-1.2-2C13.3,3.2,13,3,12.6,3\tc-0.1,0-0.2,0-0.3,0.1l-1.2,0.4c-0.2-0.1-0.4-0.3-0.7-0.4l-0.3-1.3C10.1,1.3,9.7,1,9.2,1H6.8c-0.5,0-0.9,0.3-1,0.8L5.6,3.1\tC5.3,3.2,5.1,3.3,4.9,3.4L3.7,3C3.6,3,3.5,3,3.4,3C3,3,2.7,3.2,2.5,3.5l-1.2,2C1.1,5.9,1.2,6.4,1.6,6.8l0.9,0.9c0,0.1,0,0.3,0,0.4\tc0,0.1,0,0.3,0,0.4L1.6,9.2c-0.4,0.3-0.5,0.9-0.2,1.3l1.2,2C2.7,12.8,3,13,3.4,13c0.1,0,0.2,0,0.3-0.1l1.2-0.4\tc0.2,0.1,0.4,0.3,0.7,0.4l0.3,1.3c0.1,0.5,0.5,0.8,1,0.8h2.4c0.5,0,0.9-0.3,1-0.8l0.3-1.3c0.2-0.1,0.4-0.2,0.7-0.4l1.2,0.4\tc0.1,0,0.2,0.1,0.3,0.1c0.4,0,0.7-0.2,0.9-0.5l1.1-2c0.2-0.4,0.2-0.9-0.2-1.3L13.5,8.4z M12.6,12l-1.7-0.6c-0.4,0.3-0.9,0.6-1.4,0.8\tL9.2,14H6.8l-0.4-1.8c-0.5-0.2-0.9-0.5-1.4-0.8L3.4,12l-1.2-2l1.4-1.2c-0.1-0.5-0.1-1.1,0-1.6L2.2,6l1.2-2l1.7,0.6\tC5.5,4.2,6,4,6.5,3.8L6.8,2h2.4l0.4,1.8c0.5,0.2,0.9,0.5,1.4,0.8L12.6,4l1.2,2l-1.4,1.2c0.1,0.5,0.1,1.1,0,1.6l1.4,1.2L12.6,12z\"\n ></path>\n <path\n d=\"M8,11c-1.7,0-3-1.3-3-3s1.3-3,3-3s3,1.3,3,3C11,9.6,9.7,11,8,11C8,11,8,11,8,11z M8,6C6.9,6,6,6.8,6,7.9C6,7.9,6,8,6,8\tc0,1.1,0.8,2,1.9,2c0,0,0.1,0,0.1,0c1.1,0,2-0.8,2-1.9c0,0,0-0.1,0-0.1C10,6.9,9.2,6,8,6C8.1,6,8,6,8,6z\"\n ></path>\n </svg>\n </cds-custom-button>\n <cds-custom-button\n slot=\"action-toolbar\"\n aria-label=\"Delete\"\n has-icon-only=\"true\"\n size=\"sm\"\n tooltip-text=\"Delete\"\n kind=\"ghost\"\n >\n <svg\n focusable=\"false\"\n preserveAspectRatio=\"xMidYMid meet\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"currentColor\"\n slot=\"icon\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 32 32\"\n aria-hidden=\"true\"\n >\n <path d=\"M12 12H14V24H12zM18 12H20V24H18z\"></path>\n <path\n d=\"M4 6V8H6V28a2 2 0 002 2H24a2 2 0 002-2V8h2V6zM8 28V8H24V28zM12 2H20V4H12z\"\n ></path>\n </svg>\n </cds-custom-button>`,\n }),\n }),\n }),\n }),\n },\n example: (props) => html`\n <c4p-side-panel\n open\n label-text=\"${props.labelText.text}\"\n slide-in=\"${props.slideIn}\"\n size=\"${props.size}\"\n placement=${props.placement}\n selector-page-content=${props.selectorPageContent}\n .title=\"${props.title.text}\"\n >\n ${props.subtitle.text} ${props.toolbar.items.actionsElements}\n ${props.actions.actionElements} ${props.children}\n </c4p-side-panel>\n `,\n imports: [\n \"import '@carbon/ibm-products-web-components/es/components/side-panel/index';\",\n ],\n }\n);\n"],"names":[],"mappings":"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"}
|
|
@@ -44,7 +44,27 @@ declare const CDSTearsheet_base: {
|
|
|
44
44
|
hidePopover(): void;
|
|
45
45
|
showPopover(): void;
|
|
46
46
|
togglePopover(options?: boolean): boolean;
|
|
47
|
-
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options
|
|
47
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options
|
|
48
|
+
/**
|
|
49
|
+
* Tearsheet.
|
|
50
|
+
*
|
|
51
|
+
* @element c4p-tearsheet
|
|
52
|
+
* @csspart dialog The dialog.
|
|
53
|
+
* @fires c4p-tearsheet-beingclosed
|
|
54
|
+
* The custom event fired before this tearsheet is being closed upon a user gesture.
|
|
55
|
+
* Cancellation of this event stops the user-initiated action of closing this tearsheet.
|
|
56
|
+
* @fires c4p-tearsheet-closed - The custom event fired after this tearsheet is closed upon a user gesture.
|
|
57
|
+
*/
|
|
58
|
+
? /**
|
|
59
|
+
* Tearsheet.
|
|
60
|
+
*
|
|
61
|
+
* @element c4p-tearsheet
|
|
62
|
+
* @csspart dialog The dialog.
|
|
63
|
+
* @fires c4p-tearsheet-beingclosed
|
|
64
|
+
* The custom event fired before this tearsheet is being closed upon a user gesture.
|
|
65
|
+
* Cancellation of this event stops the user-initiated action of closing this tearsheet.
|
|
66
|
+
* @fires c4p-tearsheet-closed - The custom event fired after this tearsheet is closed upon a user gesture.
|
|
67
|
+
*/: boolean | AddEventListenerOptions): void;
|
|
48
68
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
49
69
|
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
50
70
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
@@ -392,14 +412,6 @@ declare class CDSTearsheet extends CDSTearsheet_base {
|
|
|
392
412
|
* The element that had focus before this tearsheet gets open.
|
|
393
413
|
*/
|
|
394
414
|
private _launcher;
|
|
395
|
-
/**
|
|
396
|
-
* Node to track focus going outside of tearsheet content.
|
|
397
|
-
*/
|
|
398
|
-
private _startSentinelNode;
|
|
399
|
-
/**
|
|
400
|
-
* Node to track focus going outside of tearsheet content.
|
|
401
|
-
*/
|
|
402
|
-
private _endSentinelNode;
|
|
403
415
|
/**
|
|
404
416
|
* Node to track tearsheet.
|
|
405
417
|
*/
|
|
@@ -424,14 +436,21 @@ declare class CDSTearsheet extends CDSTearsheet_base {
|
|
|
424
436
|
*/
|
|
425
437
|
private _handleClick;
|
|
426
438
|
/**
|
|
427
|
-
*
|
|
439
|
+
* Get focusable elements.
|
|
428
440
|
*
|
|
429
|
-
*
|
|
430
|
-
*
|
|
431
|
-
* @
|
|
441
|
+
* Querying all tabbable items.
|
|
442
|
+
*
|
|
443
|
+
* @returns {{first: HTMLElement, last: HTMLElement, all: HTMLElement[]}} Returns an object with various elements.
|
|
432
444
|
*/
|
|
433
|
-
private
|
|
445
|
+
private getFocusable;
|
|
434
446
|
private _handleKeydown;
|
|
447
|
+
/**
|
|
448
|
+
* Handle the keydown event.
|
|
449
|
+
* Trap the focus inside the side-panel by tracking keydown.key == `Tab`
|
|
450
|
+
*
|
|
451
|
+
* @param {KeyboardEvent} event The keyboard event object.
|
|
452
|
+
*/
|
|
453
|
+
protected _handleHostKeydown: (event: KeyboardEvent) => void;
|
|
435
454
|
private _checkSetHasSlot;
|
|
436
455
|
/**
|
|
437
456
|
* Handles `click` event on the modal container.
|
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
import { __decorate } from 'tslib';
|
|
9
9
|
import { LitElement, html } from 'lit';
|
|
10
10
|
import { query, queryAssignedElements, state, property } from 'lit/decorators.js';
|
|
11
|
-
import {
|
|
11
|
+
import { carbonPrefix, prefix } from '../../globals/settings.js';
|
|
12
12
|
import HostListener from '@carbon/web-components/es/globals/decorators/host-listener.js';
|
|
13
13
|
import HostListenerMixin from '@carbon/web-components/es/globals/mixins/host-listener.js';
|
|
14
14
|
import styles from './tearsheet.scss.js';
|
|
15
|
+
import { selectorTabbable } from '@carbon/web-components/es/globals/settings.js';
|
|
15
16
|
import pconsole from '../../globals/internal/pconsole.js';
|
|
16
17
|
import { carbonElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';
|
|
17
18
|
import '@carbon/web-components/es-custom/components/button/index.js';
|
|
@@ -30,34 +31,9 @@ import { TEARSHEET_INFLUENCER_PLACEMENT, TEARSHEET_INFLUENCER_WIDTH, TEARSHEET_W
|
|
|
30
31
|
*/
|
|
31
32
|
var CDSTearsheet_1;
|
|
32
33
|
const maxStackDepth = 3;
|
|
33
|
-
const PRECEDING =
|
|
34
|
-
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
|
|
35
|
-
Node.DOCUMENT_POSITION_PRECEDING | Node.DOCUMENT_POSITION_CONTAINS;
|
|
36
|
-
const FOLLOWING =
|
|
37
|
-
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
|
|
38
|
-
Node.DOCUMENT_POSITION_FOLLOWING | Node.DOCUMENT_POSITION_CONTAINED_BY;
|
|
39
34
|
const blockClass = `${prefix}--tearsheet`;
|
|
40
35
|
const blockClassModalHeader = `${carbonPrefix}--modal-header`;
|
|
41
36
|
const blockClassActionSet = `${prefix}--action-set`;
|
|
42
|
-
/**
|
|
43
|
-
* Tries to focus on the given elements and bails out if one of them is successful.
|
|
44
|
-
*
|
|
45
|
-
* @param elements The elements.
|
|
46
|
-
* @param reverse `true` to go through the list in reverse order.
|
|
47
|
-
* @returns `true` if one of the attempts is successful, `false` otherwise.
|
|
48
|
-
*/
|
|
49
|
-
function tryFocusElements(elements, reverse) {
|
|
50
|
-
{
|
|
51
|
-
for (let i = elements.length - 1; i >= 0; --i) {
|
|
52
|
-
const elem = elements[i];
|
|
53
|
-
elem.focus();
|
|
54
|
-
if (elem.ownerDocument.activeElement === elem) {
|
|
55
|
-
return true;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
37
|
/**
|
|
62
38
|
* Tearsheet.
|
|
63
39
|
*
|
|
@@ -98,56 +74,33 @@ let CDSTearsheet = CDSTearsheet_1 = class CDSTearsheet extends HostListenerMixin
|
|
|
98
74
|
this._handleUserInitiatedClose(event.target);
|
|
99
75
|
}
|
|
100
76
|
};
|
|
77
|
+
this._handleKeydown = ({ key, target }) => {
|
|
78
|
+
if ((key === 'Esc' || key === 'Escape') && this._topOfStack()) {
|
|
79
|
+
this._handleUserInitiatedClose(target);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
101
82
|
/**
|
|
102
|
-
*
|
|
83
|
+
* Handle the keydown event.
|
|
84
|
+
* Trap the focus inside the side-panel by tracking keydown.key == `Tab`
|
|
103
85
|
*
|
|
104
|
-
* @param event The event.
|
|
105
|
-
* @param event.target The event target.
|
|
106
|
-
* @param event.relatedTarget The event relatedTarget.
|
|
86
|
+
* @param {KeyboardEvent} event The keyboard event object.
|
|
107
87
|
*/
|
|
108
|
-
this.
|
|
88
|
+
this._handleHostKeydown = (event) => {
|
|
109
89
|
var _a;
|
|
110
|
-
if (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const currentContains = relatedTarget !== this &&
|
|
118
|
-
(this.contains(relatedTarget) ||
|
|
119
|
-
(((_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.contains(relatedTarget)) &&
|
|
120
|
-
relatedTarget !== startSentinelNode &&
|
|
121
|
-
relatedTarget !== endSentinelNode));
|
|
122
|
-
// Performs focus wrapping if _all_ of the following is met:
|
|
123
|
-
// * This tearsheet is open
|
|
124
|
-
// * The viewport still has focus
|
|
125
|
-
// * Tearsheet body used to have focus but no longer has focus
|
|
126
|
-
const { selectorTabbable: selectorTabbableForTearsheet } = this
|
|
127
|
-
.constructor;
|
|
128
|
-
if (open && relatedTarget && oldContains && !currentContains) {
|
|
129
|
-
const comparisonResult = target.compareDocumentPosition(relatedTarget);
|
|
130
|
-
if (relatedTarget === startSentinelNode || comparisonResult & PRECEDING) {
|
|
131
|
-
await this.constructor._delay();
|
|
132
|
-
if (!tryFocusElements(this.querySelectorAll(selectorTabbableForTearsheet)) &&
|
|
133
|
-
relatedTarget !== this) {
|
|
134
|
-
this.focus();
|
|
135
|
-
}
|
|
90
|
+
if (event.key === 'Tab') {
|
|
91
|
+
const { first: _firstElement, last: _lastElement } = this.getFocusable();
|
|
92
|
+
if (event.shiftKey &&
|
|
93
|
+
(((_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.activeElement) === _firstElement ||
|
|
94
|
+
document.activeElement === _firstElement)) {
|
|
95
|
+
event.preventDefault();
|
|
96
|
+
_lastElement === null || _lastElement === void 0 ? void 0 : _lastElement.focus();
|
|
136
97
|
}
|
|
137
|
-
else if (
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (!tryFocusElements(this.querySelectorAll(selectorTabbableForTearsheet))) {
|
|
141
|
-
this.focus();
|
|
142
|
-
}
|
|
98
|
+
else if (!event.shiftKey && document.activeElement === _lastElement) {
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
_firstElement === null || _firstElement === void 0 ? void 0 : _firstElement.focus();
|
|
143
101
|
}
|
|
144
102
|
}
|
|
145
103
|
};
|
|
146
|
-
this._handleKeydown = ({ key, target }) => {
|
|
147
|
-
if ((key === 'Esc' || key === 'Escape') && this._topOfStack()) {
|
|
148
|
-
this._handleUserInitiatedClose(target);
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
104
|
/**
|
|
152
105
|
* Optional aria label for the tearsheet
|
|
153
106
|
*/
|
|
@@ -250,6 +203,40 @@ let CDSTearsheet = CDSTearsheet_1 = class CDSTearsheet extends HostListenerMixin
|
|
|
250
203
|
}
|
|
251
204
|
};
|
|
252
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Get focusable elements.
|
|
208
|
+
*
|
|
209
|
+
* Querying all tabbable items.
|
|
210
|
+
*
|
|
211
|
+
* @returns {{first: HTMLElement, last: HTMLElement, all: HTMLElement[]}} Returns an object with various elements.
|
|
212
|
+
*/
|
|
213
|
+
getFocusable() {
|
|
214
|
+
var _a, _b;
|
|
215
|
+
const elements = [];
|
|
216
|
+
// Add slug elements if present
|
|
217
|
+
if (this._hasSlug) {
|
|
218
|
+
elements.push(this.querySelectorAll(`${carbonPrefix}-slug`));
|
|
219
|
+
}
|
|
220
|
+
// Add close button if not hidden
|
|
221
|
+
if (this.hasCloseIcon) {
|
|
222
|
+
const closeButtons = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll(`${carbonPrefix}-modal-close-button`);
|
|
223
|
+
if (closeButtons) {
|
|
224
|
+
elements.push(closeButtons);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
// Add tabbable elements inside light DOM
|
|
228
|
+
const _tabbableItems = this.querySelectorAll(selectorTabbable);
|
|
229
|
+
if (_tabbableItems) {
|
|
230
|
+
elements.push(_tabbableItems);
|
|
231
|
+
}
|
|
232
|
+
// Flatten NodeList arrays and filter for focusable items
|
|
233
|
+
const all = (_b = elements === null || elements === void 0 ? void 0 : elements.flatMap((nodeList) => Array.from(nodeList))) === null || _b === void 0 ? void 0 : _b.filter((el) => typeof (el === null || el === void 0 ? void 0 : el.focus) === 'function');
|
|
234
|
+
return {
|
|
235
|
+
first: all[0],
|
|
236
|
+
last: all[all.length - 1],
|
|
237
|
+
all,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
253
240
|
_checkSetHasSlot(e) {
|
|
254
241
|
var _a, _b;
|
|
255
242
|
const t = e.target;
|
|
@@ -426,12 +413,6 @@ let CDSTearsheet = CDSTearsheet_1 = class CDSTearsheet extends HostListenerMixin
|
|
|
426
413
|
</cds-custom-modal-header>`;
|
|
427
414
|
if (this._stackPosition <= this._stackDepth) {
|
|
428
415
|
return html `
|
|
429
|
-
<a
|
|
430
|
-
id="start-sentinel"
|
|
431
|
-
class="${prefix}--visually-hidden"
|
|
432
|
-
href="javascript:void 0"
|
|
433
|
-
role="navigation"
|
|
434
|
-
></a>
|
|
435
416
|
<div
|
|
436
417
|
aria-label=${this.ariaLabel}
|
|
437
418
|
class=${`${blockClass}__container ${carbonPrefix}--modal-container ${carbonPrefix}--modal-container--sm`}
|
|
@@ -507,12 +488,6 @@ let CDSTearsheet = CDSTearsheet_1 = class CDSTearsheet extends HostListenerMixin
|
|
|
507
488
|
</div>
|
|
508
489
|
</cds-custom-modal-body>
|
|
509
490
|
</div>
|
|
510
|
-
<a
|
|
511
|
-
id="end-sentinel"
|
|
512
|
-
class="${prefix}--visually-hidden"
|
|
513
|
-
href="javascript:void 0"
|
|
514
|
-
role="navigation"
|
|
515
|
-
></a>
|
|
516
491
|
`;
|
|
517
492
|
}
|
|
518
493
|
else {
|
|
@@ -521,6 +496,7 @@ let CDSTearsheet = CDSTearsheet_1 = class CDSTearsheet extends HostListenerMixin
|
|
|
521
496
|
}
|
|
522
497
|
}
|
|
523
498
|
async updated(changedProperties) {
|
|
499
|
+
var _a, _b;
|
|
524
500
|
if (changedProperties.has('width')) {
|
|
525
501
|
this._checkUpdateActionSizes();
|
|
526
502
|
}
|
|
@@ -547,16 +523,14 @@ let CDSTearsheet = CDSTearsheet_1 = class CDSTearsheet extends HostListenerMixin
|
|
|
547
523
|
this._checkSetOpen();
|
|
548
524
|
if (this.open) {
|
|
549
525
|
this._launcher = this.ownerDocument.activeElement;
|
|
550
|
-
const focusNode = this.selectorInitialFocus &&
|
|
551
|
-
this.querySelector(this.selectorInitialFocus);
|
|
552
526
|
await this.constructor._delay();
|
|
553
|
-
if (
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
focusNode.focus();
|
|
527
|
+
if ((_b = (_a = this.selectorInitialFocus) === null || _a === void 0 ? void 0 : _a.trim()) === null || _b === void 0 ? void 0 : _b.length) {
|
|
528
|
+
const focusNode = this.querySelector(this.selectorInitialFocus);
|
|
529
|
+
focusNode === null || focusNode === void 0 ? void 0 : focusNode.focus();
|
|
557
530
|
}
|
|
558
|
-
else
|
|
559
|
-
this.
|
|
531
|
+
else {
|
|
532
|
+
const { first: _firstElement } = this.getFocusable();
|
|
533
|
+
_firstElement === null || _firstElement === void 0 ? void 0 : _firstElement.focus();
|
|
560
534
|
}
|
|
561
535
|
}
|
|
562
536
|
else if (this._launcher &&
|
|
@@ -612,12 +586,6 @@ CDSTearsheet._stack = {
|
|
|
612
586
|
all: [],
|
|
613
587
|
};
|
|
614
588
|
CDSTearsheet.styles = styles; // `styles` here is a `CSSResult` generated by custom WebPack loader
|
|
615
|
-
__decorate([
|
|
616
|
-
query('#start-sentinel')
|
|
617
|
-
], CDSTearsheet.prototype, "_startSentinelNode", void 0);
|
|
618
|
-
__decorate([
|
|
619
|
-
query('#end-sentinel')
|
|
620
|
-
], CDSTearsheet.prototype, "_endSentinelNode", void 0);
|
|
621
589
|
__decorate([
|
|
622
590
|
query(`.${blockClass}__container`)
|
|
623
591
|
], CDSTearsheet.prototype, "_tearsheet", void 0);
|
|
@@ -667,14 +635,13 @@ __decorate([
|
|
|
667
635
|
HostListener('click')
|
|
668
636
|
// @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to
|
|
669
637
|
], CDSTearsheet.prototype, "_handleClick", void 0);
|
|
670
|
-
__decorate([
|
|
671
|
-
HostListener('shadowRoot:focusout')
|
|
672
|
-
// @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to
|
|
673
|
-
], CDSTearsheet.prototype, "_handleBlur", void 0);
|
|
674
638
|
__decorate([
|
|
675
639
|
HostListener('document:keydown')
|
|
676
640
|
// @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to
|
|
677
641
|
], CDSTearsheet.prototype, "_handleKeydown", void 0);
|
|
642
|
+
__decorate([
|
|
643
|
+
HostListener('keydown')
|
|
644
|
+
], CDSTearsheet.prototype, "_handleHostKeydown", void 0);
|
|
678
645
|
__decorate([
|
|
679
646
|
property({ reflect: true, attribute: 'aria-label' })
|
|
680
647
|
], CDSTearsheet.prototype, "ariaLabel", void 0);
|