@zanichelli/albe-web-components 16.4.0-rc-2 → 16.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/cjs/{index-1bcf6013.js → index-22bdf239.js} +2 -2
- package/dist/cjs/index-22bdf239.js.map +1 -0
- package/dist/cjs/{index-59c3bcbe.js → index-6726b7d2.js} +2 -2
- package/dist/cjs/{index-59c3bcbe.js.map → index-6726b7d2.js.map} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/web-components-library.cjs.js +1 -1
- package/dist/cjs/z-app-header_12.cjs.entry.js +24 -3
- package/dist/cjs/z-app-header_12.cjs.entry.js.map +1 -1
- package/dist/cjs/z-dragdrop-area_2.cjs.entry.js +4 -10
- package/dist/cjs/z-dragdrop-area_2.cjs.entry.js.map +1 -1
- package/dist/cjs/z-menu.cjs.entry.js +1 -1
- package/dist/cjs/z-menu.cjs.entry.js.map +1 -1
- package/dist/cjs/z-table.cjs.entry.js +2 -2
- package/dist/cjs/z-th.cjs.entry.js +1 -1
- package/dist/cjs/z-tr.cjs.entry.js +2 -2
- package/dist/collection/beans/index.js.map +1 -1
- package/dist/collection/components/css-components/z-fab/index.stories.js.map +1 -1
- package/dist/collection/components/css-components/z-link/index.stories.js.map +1 -1
- package/dist/collection/components/date-picker/utils.js.map +1 -1
- package/dist/collection/components/date-picker/z-date-picker/index.js.map +1 -1
- package/dist/collection/components/date-picker/z-date-picker/index.stories.js.map +1 -1
- package/dist/collection/components/date-picker/z-range-picker/index.js.map +1 -1
- package/dist/collection/components/date-picker/z-range-picker/index.stories.js.map +1 -1
- package/dist/collection/components/deprecated/z-app-header-deprecated/index.js.map +1 -1
- package/dist/collection/components/deprecated/z-app-header-deprecated/index.stories.js.map +1 -1
- package/dist/collection/components/deprecated/z-menu-deprecated/index.js.map +1 -1
- package/dist/collection/components/deprecated/z-menu-deprecated/index.stories.js.map +1 -1
- package/dist/collection/components/deprecated/z-menu-section-deprecated/index.js.map +1 -1
- package/dist/collection/components/deprecated/z-menu-section-deprecated/index.stories.js.map +1 -1
- package/dist/collection/components/file-upload/z-dragdrop-area/index.js.map +1 -1
- package/dist/collection/components/file-upload/z-file/index.js.map +1 -1
- package/dist/collection/components/file-upload/z-file/index.stories.js.map +1 -1
- package/dist/collection/components/file-upload/z-file-upload/index.js.map +1 -1
- package/dist/collection/components/file-upload/z-file-upload/index.stories.js.map +1 -1
- package/dist/collection/components/index.js.map +1 -1
- package/dist/collection/components/list/z-list/index.js.map +1 -1
- package/dist/collection/components/list/z-list/index.stories.js.map +1 -1
- package/dist/collection/components/list/z-list-element/index.js.map +1 -1
- package/dist/collection/components/list/z-list-element/index.stories.js.map +1 -1
- package/dist/collection/components/list/z-list-group/index.js.map +1 -1
- package/dist/collection/components/list/z-list-group/index.stories.js.map +1 -1
- package/dist/collection/components/table/cells/z-td/index.js.map +1 -1
- package/dist/collection/components/table/cells/z-th/index.js.map +1 -1
- package/dist/collection/components/table/cells/z-th/styles.css +1 -1
- package/dist/collection/components/table/z-table/index.js.map +1 -1
- package/dist/collection/components/table/z-table/index.stories.js.map +1 -1
- package/dist/collection/components/table/z-tbody/index.js.map +1 -1
- package/dist/collection/components/table/z-tfoot/index.js.map +1 -1
- package/dist/collection/components/table/z-thead/index.js.map +1 -1
- package/dist/collection/components/table/z-tr/index.js.map +1 -1
- package/dist/collection/components/z-accordion/index.js.map +1 -1
- package/dist/collection/components/z-accordion/index.stories.js.map +1 -1
- package/dist/collection/components/z-anchor-navigation/index.js.map +1 -1
- package/dist/collection/components/z-anchor-navigation/index.stories.js.map +1 -1
- package/dist/collection/components/z-app-header/index.js.map +1 -1
- package/dist/collection/components/z-app-header/index.stories.js.map +1 -1
- package/dist/collection/components/z-aria-alert/index.js.map +1 -1
- package/dist/collection/components/z-aria-alert/index.stories.js.map +1 -1
- package/dist/collection/components/z-avatar/index.js.map +1 -1
- package/dist/collection/components/z-avatar/index.stories.js.map +1 -1
- package/dist/collection/components/z-book-card/index.js.map +1 -1
- package/dist/collection/components/z-book-card/index.stories.js.map +1 -1
- package/dist/collection/components/z-breadcrumb/index.js.map +1 -1
- package/dist/collection/components/z-breadcrumb/index.stories.js.map +1 -1
- package/dist/collection/components/z-button/index.js.map +1 -1
- package/dist/collection/components/z-button/index.stories.js.map +1 -1
- package/dist/collection/components/z-button-sort/index.js.map +1 -1
- package/dist/collection/components/z-button-sort/index.stories.js.map +1 -1
- package/dist/collection/components/z-card/index.js.map +1 -1
- package/dist/collection/components/z-card/index.stories.js.map +1 -1
- package/dist/collection/components/z-carousel/index.js.map +1 -1
- package/dist/collection/components/z-carousel/index.stories.js.map +1 -1
- package/dist/collection/components/z-chip/index.js.map +1 -1
- package/dist/collection/components/z-chip/index.stories.js.map +1 -1
- package/dist/collection/components/z-combobox/index.js.map +1 -1
- package/dist/collection/components/z-combobox/index.stories.js.map +1 -1
- package/dist/collection/components/z-cover-hero/index.js.map +1 -1
- package/dist/collection/components/z-cover-hero/index.stories.js.map +1 -1
- package/dist/collection/components/z-divider/index.js.map +1 -1
- package/dist/collection/components/z-divider/index.stories.js.map +1 -1
- package/dist/collection/components/z-ghost-loading/index.js.map +1 -1
- package/dist/collection/components/z-ghost-loading/index.stories.js.map +1 -1
- package/dist/collection/components/z-icon/index.js.map +1 -1
- package/dist/collection/components/z-icon/index.stories.js.map +1 -1
- package/dist/collection/components/z-info-box/index.js.map +1 -1
- package/dist/collection/components/z-info-box/index.stories.js.map +1 -1
- package/dist/collection/components/z-info-reveal/index.js.map +1 -1
- package/dist/collection/components/z-info-reveal/index.stories.js.map +1 -1
- package/dist/collection/components/z-input/index.js.map +1 -1
- package/dist/collection/components/z-input/index.stories.js.map +1 -1
- package/dist/collection/components/z-input-message/index.js.map +1 -1
- package/dist/collection/components/z-input-message/index.stories.js.map +1 -1
- package/dist/collection/components/z-logo/index.js.map +1 -1
- package/dist/collection/components/z-logo/index.stories.js.map +1 -1
- package/dist/collection/components/z-menu/index.js.map +1 -1
- package/dist/collection/components/z-menu/index.stories.js.map +1 -1
- package/dist/collection/components/z-menu/styles.css +1 -0
- package/dist/collection/components/z-menu-section/index.js.map +1 -1
- package/dist/collection/components/z-menu-section/index.stories.js.map +1 -1
- package/dist/collection/components/z-modal/index.js +4 -10
- package/dist/collection/components/z-modal/index.js.map +1 -1
- package/dist/collection/components/z-modal/index.stories.js.map +1 -1
- package/dist/collection/components/z-navigation-tabs/index.js.map +1 -1
- package/dist/collection/components/z-navigation-tabs/index.stories.js.map +1 -1
- package/dist/collection/components/z-notification/index.js.map +1 -1
- package/dist/collection/components/z-notification/index.stories.js.map +1 -1
- package/dist/collection/components/z-offcanvas/index.js +27 -3
- package/dist/collection/components/z-offcanvas/index.js.map +1 -1
- package/dist/collection/components/z-offcanvas/index.stories.js +12 -46
- package/dist/collection/components/z-offcanvas/index.stories.js.map +1 -1
- package/dist/collection/components/z-offcanvas/styles.css +10 -15
- package/dist/collection/components/z-pagination/index.js.map +1 -1
- package/dist/collection/components/z-pagination/index.stories.js.map +1 -1
- package/dist/collection/components/z-panel-elem/index.js.map +1 -1
- package/dist/collection/components/z-panel-elem/index.stories.js.map +1 -1
- package/dist/collection/components/z-popover/index.js.map +1 -1
- package/dist/collection/components/z-popover/index.stories.js.map +1 -1
- package/dist/collection/components/z-searchbar/index.js.map +1 -1
- package/dist/collection/components/z-searchbar/index.stories.js.map +1 -1
- package/dist/collection/components/z-section-title/index.js.map +1 -1
- package/dist/collection/components/z-section-title/index.stories.js.map +1 -1
- package/dist/collection/components/z-select/index.js.map +1 -1
- package/dist/collection/components/z-select/index.stories.js.map +1 -1
- package/dist/collection/components/z-skip-to-content/index.js.map +1 -1
- package/dist/collection/components/z-skip-to-content/index.stories.js.map +1 -1
- package/dist/collection/components/z-stepper/index.js.map +1 -1
- package/dist/collection/components/z-stepper/index.stories.js.map +1 -1
- package/dist/collection/components/z-stepper-item/index.js.map +1 -1
- package/dist/collection/components/z-stepper-item/index.stories.js.map +1 -1
- package/dist/collection/components/z-tag/index.js.map +1 -1
- package/dist/collection/components/z-tag/index.stories.js.map +1 -1
- package/dist/collection/components/z-toast-notification/index.js.map +1 -1
- package/dist/collection/components/z-toast-notification/index.stories.js.map +1 -1
- package/dist/collection/components/z-toast-notification-list/index.js.map +1 -1
- package/dist/collection/components/z-toast-notification-list/index.stories.js.map +1 -1
- package/dist/collection/components/z-toggle-button/index.js.map +1 -1
- package/dist/collection/components/z-toggle-button/index.stories.js.map +1 -1
- package/dist/collection/components/z-toggle-switch/index.js.map +1 -1
- package/dist/collection/components/z-toggle-switch/index.stories.js.map +1 -1
- package/dist/collection/components/z-tooltip/index.js.map +1 -1
- package/dist/collection/components/z-tooltip/index.stories.js.map +1 -1
- package/dist/collection/components/z-visually-hidden/index.js.map +1 -1
- package/dist/collection/components/z-visually-hidden/index.stories.js.map +1 -1
- package/dist/collection/constants/breakpoints.js.map +1 -1
- package/dist/collection/constants/icons.js.map +1 -1
- package/dist/collection/constants/iconset.js +12 -0
- package/dist/collection/constants/iconset.js.map +1 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/snowflakes/myz/card/z-myz-card/index.js.map +1 -1
- package/dist/collection/snowflakes/myz/card/z-myz-card-alert/index.js.map +1 -1
- package/dist/collection/snowflakes/myz/card/z-myz-card-body/index.js.map +1 -1
- package/dist/collection/snowflakes/myz/card/z-myz-card-cover/index.js.map +1 -1
- package/dist/collection/snowflakes/myz/card/z-myz-card-dictionary/index.js.map +1 -1
- package/dist/collection/snowflakes/myz/card/z-myz-card-footer/index.js.map +1 -1
- package/dist/collection/snowflakes/myz/card/z-myz-card-footer-sections/index.js.map +1 -1
- package/dist/collection/snowflakes/myz/card/z-myz-card-header/index.js.map +1 -1
- package/dist/collection/snowflakes/myz/card/z-myz-card-icon/index.js.map +1 -1
- package/dist/collection/snowflakes/myz/card/z-myz-card-info/index.js.map +1 -1
- package/dist/collection/snowflakes/myz/card/z-myz-card-list/index.js.map +1 -1
- package/dist/collection/snowflakes/myz/list/z-myz-list/index.js.map +1 -1
- package/dist/collection/snowflakes/myz/list/z-myz-list-item/index.js.map +1 -1
- package/dist/collection/snowflakes/myz/z-alert/index.js.map +1 -1
- package/dist/collection/snowflakes/myz/z-otp/index.js.map +1 -1
- package/dist/collection/snowflakes/myz/z-slideshow/index.js.map +1 -1
- package/dist/collection/utils/storybook-utils.js.map +1 -1
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/components/iconset.js +12 -0
- package/dist/components/iconset.js.map +1 -1
- package/dist/components/index15.js +4 -10
- package/dist/components/index15.js.map +1 -1
- package/dist/components/index21.js +13 -4
- package/dist/components/index21.js.map +1 -1
- package/dist/components/z-menu.js +1 -1
- package/dist/components/z-menu.js.map +1 -1
- package/dist/components/z-th.js +1 -1
- package/dist/components/z-th.js.map +1 -1
- package/dist/docs/grid/index.stories.js +54 -0
- package/dist/docs/grid/index.stories.js.map +1 -0
- package/dist/docs/iconset/index.stories.js +32 -0
- package/dist/docs/iconset/index.stories.js.map +1 -0
- package/dist/docs/themes/index.stories.js +90 -0
- package/dist/docs/themes/index.stories.js.map +1 -0
- package/dist/docs/typography/index.stories.js +186 -0
- package/dist/docs/typography/index.stories.js.map +1 -0
- package/dist/esm/{index-fcf764b5.js → index-681cc2b7.js} +2 -2
- package/dist/esm/index-681cc2b7.js.map +1 -0
- package/dist/esm/{index-2b5c2515.js → index-7b64c875.js} +2 -2
- package/dist/esm/{index-2b5c2515.js.map → index-7b64c875.js.map} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/web-components-library.js +1 -1
- package/dist/esm/z-app-header_12.entry.js +24 -3
- package/dist/esm/z-app-header_12.entry.js.map +1 -1
- package/dist/esm/z-dragdrop-area_2.entry.js +4 -10
- package/dist/esm/z-dragdrop-area_2.entry.js.map +1 -1
- package/dist/esm/z-menu.entry.js +1 -1
- package/dist/esm/z-menu.entry.js.map +1 -1
- package/dist/esm/z-table.entry.js +2 -2
- package/dist/esm/z-th.entry.js +1 -1
- package/dist/esm/z-tr.entry.js +2 -2
- package/dist/types/components/z-modal/index.d.ts +0 -1
- package/dist/types/components/z-offcanvas/index.d.ts +5 -0
- package/dist/types/components/z-offcanvas/index.stories.d.ts +4 -6
- package/dist/types/components.d.ts +2 -2
- package/dist/types/constants/iconset.d.ts +24 -0
- package/dist/types/home/runner/work/design-system/design-system/.stencil/docs/grid/index.stories.d.ts +9 -0
- package/dist/types/home/runner/work/design-system/design-system/.stencil/docs/iconset/index.stories.d.ts +11 -0
- package/dist/types/home/runner/work/design-system/design-system/.stencil/docs/themes/index.stories.d.ts +27 -0
- package/dist/types/home/runner/work/design-system/design-system/.stencil/docs/typography/index.stories.d.ts +96 -0
- package/dist/web-components-library/{p-6531d14a.entry.js → p-0c489c4b.entry.js} +2 -2
- package/dist/web-components-library/p-11df2c0a.entry.js +2 -0
- package/dist/web-components-library/p-11df2c0a.entry.js.map +1 -0
- package/dist/web-components-library/{p-cce46031.js → p-13366542.js} +2 -2
- package/dist/web-components-library/p-456f984f.js +2 -0
- package/dist/web-components-library/p-456f984f.js.map +1 -0
- package/dist/web-components-library/p-6b791915.entry.js +2 -0
- package/dist/web-components-library/p-8d443cac.entry.js +2 -0
- package/dist/web-components-library/p-b20bfb34.entry.js +2 -0
- package/dist/web-components-library/p-b20bfb34.entry.js.map +1 -0
- package/dist/web-components-library/p-ceb4403d.entry.js +2 -0
- package/dist/web-components-library/p-ceb4403d.entry.js.map +1 -0
- package/dist/web-components-library/web-components-library.css +529 -28
- package/dist/web-components-library/web-components-library.esm.js +1 -1
- package/dist/web-components-library/web-components-library.esm.js.map +1 -1
- package/package.json +1 -1
- package/www/build/{p-6531d14a.entry.js → p-0c489c4b.entry.js} +2 -2
- package/www/build/p-11df2c0a.entry.js +2 -0
- package/www/build/p-11df2c0a.entry.js.map +1 -0
- package/www/build/{p-cce46031.js → p-13366542.js} +2 -2
- package/www/build/p-1fcf4111.js +2 -0
- package/www/build/p-456f984f.js +2 -0
- package/www/build/p-456f984f.js.map +1 -0
- package/www/build/p-6b791915.entry.js +2 -0
- package/www/build/p-8d443cac.entry.js +2 -0
- package/www/build/p-b20bfb34.entry.js +2 -0
- package/www/build/p-b20bfb34.entry.js.map +1 -0
- package/www/build/p-ceb4403d.entry.js +2 -0
- package/www/build/p-ceb4403d.entry.js.map +1 -0
- package/www/build/{p-ae0a33a2.css → p-d9dbe303.css} +529 -28
- package/www/build/web-components-library.css +529 -28
- package/www/build/web-components-library.esm.js +1 -1
- package/www/build/web-components-library.esm.js.map +1 -1
- package/www/index.html +1 -1
- package/dist/cjs/index-1bcf6013.js.map +0 -1
- package/dist/esm/index-fcf764b5.js.map +0 -1
- package/dist/web-components-library/p-0c813477.entry.js +0 -2
- package/dist/web-components-library/p-0c813477.entry.js.map +0 -1
- package/dist/web-components-library/p-26ac8973.entry.js +0 -2
- package/dist/web-components-library/p-26ac8973.entry.js.map +0 -1
- package/dist/web-components-library/p-47bf778e.js +0 -2
- package/dist/web-components-library/p-47bf778e.js.map +0 -1
- package/dist/web-components-library/p-67896876.entry.js +0 -2
- package/dist/web-components-library/p-822a2097.entry.js +0 -2
- package/dist/web-components-library/p-b72a4b5e.entry.js +0 -2
- package/dist/web-components-library/p-b72a4b5e.entry.js.map +0 -1
- package/www/build/p-0c813477.entry.js +0 -2
- package/www/build/p-0c813477.entry.js.map +0 -1
- package/www/build/p-26ac8973.entry.js +0 -2
- package/www/build/p-26ac8973.entry.js.map +0 -1
- package/www/build/p-47bf778e.js +0 -2
- package/www/build/p-47bf778e.js.map +0 -1
- package/www/build/p-67896876.entry.js +0 -2
- package/www/build/p-822a2097.entry.js +0 -2
- package/www/build/p-88640e60.js +0 -2
- package/www/build/p-b72a4b5e.entry.js +0 -2
- package/www/build/p-b72a4b5e.entry.js.map +0 -1
- /package/dist/web-components-library/{p-6531d14a.entry.js.map → p-0c489c4b.entry.js.map} +0 -0
- /package/dist/web-components-library/{p-cce46031.js.map → p-13366542.js.map} +0 -0
- /package/dist/web-components-library/{p-67896876.entry.js.map → p-6b791915.entry.js.map} +0 -0
- /package/dist/web-components-library/{p-822a2097.entry.js.map → p-8d443cac.entry.js.map} +0 -0
- /package/www/build/{p-6531d14a.entry.js.map → p-0c489c4b.entry.js.map} +0 -0
- /package/www/build/{p-cce46031.js.map → p-13366542.js.map} +0 -0
- /package/www/build/{p-67896876.entry.js.map → p-6b791915.entry.js.map} +0 -0
- /package/www/build/{p-822a2097.entry.js.map → p-8d443cac.entry.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"z-menu.js","mappings":";;;;;AAAA,MAAM,SAAS,GAAG,0nHAA0nH,CAAC;AAC7oH,oBAAe,SAAS;;ACGxB,MAAM,cAAc,GAAG,CAAC,EAAyC,KAC/D,CAAA,EAAE,aAAF,EAAE,uBAAF,EAAE,CAAE,OAAO,MAAK,gBAAgB,CAAC;MAatBA,OAAK;IAwDhB,IAAY,aAAa;QACvB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,MAAM,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,YAAY,KAAK,CAAC,GAAG,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC;KAC1G;IAEO,MAAM;QACZ,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YACpB,OAAO;SACR;QAED,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;KACxB;;;;;IAMO,iBAAiB,CAAC,EAAS;QACjC,MAAM,YAAY,GAAI,EAAE,CAAC,MAA0B,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAgB,CAAC;QACzF,YAAY,CAAC,OAAO,CAAC,IAAI,GAAG,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,WAAW,CAAC;QACtD,IAAI,CAAC,iBAAiB,EAAE,CAAC;KAC1B;;;;;IAMO,MAAM,CAAC,IAAI,GAAG,KAAK;QACzB,IAAI,CAAC,IAAI,CAAC,QAAQ,E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AC/B,CACK,CACV,EAED,WACE,KAAK,EAAC,OAAO,EACb,IAAI,EAAC,MAAM,IAEX,YACE,IAAI,EAAC,MAAM,EACX,YAAY,EAAE,IAAI,CAAC,aAAa,GAChC,CACE,CACF,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["ZMenu"],"sources":["src/components/z-menu/styles.css?tag=z-menu&encapsulation=shadow","src/components/z-menu/index.tsx"],"sourcesContent":[":host,\n::slotted(*),\n* {\n box-sizing: border-box;\n outline: none;\n}\n\n:host {\n --z-menu-label-color: ;\n\n position: relative;\n display: inline-flex;\n height: fit-content;\n flex-direction: column;\n}\n\n::slotted(a) {\n text-decoration: none;\n}\n\n::slotted(*) {\n color: var(--color-default-text);\n font-family: var(--font-family-sans);\n font-weight: var(--font-rg);\n}\n\n.menu-label {\n position: relative;\n display: flex;\n width: 100%;\n align-items: center;\n padding: 0;\n border: 0;\n border-bottom: var(--border-size-large) solid transparent;\n margin: 0;\n background: transparent;\n border-radius: 0;\n color: inherit;\n text-align: left;\n}\n\nbutton.menu-label {\n cursor: pointer;\n}\n\n.menu-label:focus-visible,\ndiv.menu-label:focus-within {\n box-shadow: var(--shadow-focus-primary);\n}\n\n:host(:is([active], [open])) .menu-label ::slotted(*),\n.menu-label:focus-visible ::slotted(*),\ndiv.menu-label:focus-within ::slotted(*) {\n color: var(--color-primary01);\n font-weight: var(--font-bd);\n}\n\n:host([vertical-context]) .menu-label {\n padding: var(--space-unit) 0;\n border-width: var(--border-size-small);\n border-color: var(--color-surface03);\n}\n\n:host(:is([active], [open])) .menu-label,\n.menu-label:hover,\n.menu-label:focus-visible,\ndiv.menu-label:focus-within {\n border-color: var(--color-secondary01);\n}\n\n:host([vertical-context]:is([active], [open])) .menu-label::after,\n:host([vertical-context]) .menu-label:hover::after,\n:host([vertical-context]) .menu-label:focus-visible::after,\n:host([vertical-context]) div.menu-label:focus-within::after {\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100%;\n height: var(--border-size-large);\n background-color: var(--color-secondary01);\n content: \"\";\n}\n\n:host([vertical-context]) .menu-label ::slotted(*) {\n padding: 0;\n}\n\n.menu-label ::slotted(*) {\n display: inline-flex;\n width: 100%;\n min-width: fit-content;\n padding-bottom: 2px;\n margin: 0;\n appearance: none;\n color: var(--z-menu-label-color, var(--color-default-text));\n font-family: var(--font-family-sans);\n font-size: var(--font-size-3);\n font-weight: inherit;\n line-height: 1.5;\n}\n\n.menu-label z-icon {\n margin-left: calc(var(--space-unit) * 1.5);\n fill: var(--color-default-icon);\n}\n\n/* Prevents layout shifts on font-weight changes.\nThe trick is to put an hidden copy of the text already set to bold,\nso the needed space is correctly calculated before any hover/active state changes the\nfont-weight of the real text.\nThe hidden text has an height of 0px so it can expand the width without changing the height\nwhen placed below the real text using `flex-direction: column`. */\n::slotted([data-text]:not([slot]))::after {\n height: 0;\n content: attr(data-text);\n content: attr(data-text) / \"\";\n font-weight: var(--font-bd);\n letter-spacing: normal;\n pointer-events: none;\n user-select: none;\n visibility: hidden;\n}\n\n@media speech {\n ::slotted([data-text]:not([slot]))::after {\n display: none;\n }\n}\n\n::slotted([data-text]:not([slot])) {\n display: inline-flex;\n flex-direction: column;\n}\n\n.content {\n background: var(--color-surface01);\n}\n\n:host(:not([open])) .content {\n display: none;\n}\n\n:host([floating]:not([vertical-context])) .content {\n position: absolute;\n top: 100%;\n left: 0;\n width: 375px;\n min-width: 100%;\n max-width: 100vw;\n padding: 0 calc(var(--space-unit) * 2);\n box-shadow: var(--shadow-2);\n}\n\n:host(:not([floating])) .content {\n width: 100%;\n}\n\n.header {\n display: flex;\n align-items: center;\n padding: var(--space-unit) 0 calc(var(--space-unit) * 2);\n}\n\n.header ::slotted(img[slot=\"header\"]) {\n width: calc(var(--space-unit) * 11.25);\n height: auto;\n object-fit: contain;\n}\n\n.header ::slotted([slot=\"header\"]:not(:first-child)) {\n margin: auto 0;\n margin-left: calc(var(--space-unit) * 2.5);\n font-size: var(--font-size-3);\n font-weight: var(--font-sb);\n line-height: 1.5;\n}\n\n.items {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n background: inherit;\n}\n\n.items > ::slotted([slot=\"item\"]) {\n width: 100%;\n margin: 0;\n font-size: var(--font-size-3);\n line-height: 1.5;\n}\n\n.items > ::slotted([slot=\"item\"]:focus:focus-visible) {\n box-shadow: var(--shadow-focus-primary);\n}\n\n.items > ::slotted([slot=\"item\"]:not(z-menu-section)) {\n padding: var(--space-unit) 0;\n border-bottom: var(--border-size-small) solid var(--color-surface03);\n}\n\n:host(:not([vertical-context])) .items > ::slotted([slot=\"item\"]:last-child) {\n border-bottom: 0;\n}\n\n.items > ::slotted([slot=\"item\"]:hover),\n.items > ::slotted([slot=\"item\"]:focus:focus-visible),\n.items > ::slotted([slot=\"item\"]:active) {\n border-color: var(--color-secondary01);\n font-weight: var(--font-bd);\n}\n","import {Component, Element, Event, EventEmitter, Host, Listen, Method, Prop, State, Watch, h} from \"@stencil/core\";\nimport {KeyboardCode} from \"../../beans\";\nimport {containsElement} from \"../../utils/utils\";\n\nconst isZMenuSection = (el: HTMLElement | HTMLZMenuSectionElement): el is HTMLZMenuSectionElement =>\n el?.tagName === \"Z-MENU-SECTION\";\n\n/**\n * @slot - Menu label\n * @slot header - Header to display as the first entry of the open menu.\n * @slot item - Single entry of the section. Can be slotted multiple times to insert items onto the menu. Set the `active` HTML attribute on the element to highlight it. Use `z-menu-section` for submenus.\n * @cssprop --z-menu-label-color - Color of the label's text.\n */\n@Component({\n tag: \"z-menu\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZMenu {\n @Element() host: HTMLZMenuElement;\n\n /** Flag to set the active status of the menu. */\n @Prop({reflect: true})\n active?: boolean;\n\n /**\n * Flag to set the display mode of the list.\n * If true, the list will be absolutely positioned under the menu label,\n * stacked beneath it otherwise.\n */\n @Prop({reflect: true})\n floating? = true;\n\n /** The opening state of the menu. */\n @Prop({mutable: true, reflect: true})\n open = false;\n\n /**\n * Tells the component that it's placed in a vertical context with other `ZMenu`s (usually in the ZAppHeader's offcanvas).\n * A small border is placed under it as a separator from other elements.\n */\n @Prop({reflect: true})\n verticalContext = false;\n\n /**\n * Tabindex value to set on the menu label.\n * Useful to manage keyboard navigation focus with roving tabindex handled by this component's parent (usually ZAppHeader).\n */\n @Prop()\n htmlTabindex = -1;\n\n @State()\n hasHeader: boolean;\n\n @State()\n hasContent: boolean;\n\n /** The menu has been opened. */\n @Event()\n opened: EventEmitter;\n\n /** The menu has been closed. */\n @Event()\n closed: EventEmitter;\n\n private labelButton: HTMLButtonElement;\n\n private content: HTMLElement;\n\n private items: (HTMLElement | HTMLZMenuSectionElement)[] = [];\n\n /** Animation frame request id. */\n private raf: number;\n\n private get focusableItem(): HTMLZMenuSectionElement | HTMLElement | null {\n return this.items.find((item) => (isZMenuSection(item) ? item.htmlTabindex === 0 : item.tabIndex === 0));\n }\n\n private toggle(): void {\n if (!this.hasContent) {\n return;\n }\n\n this.open = !this.open;\n }\n\n /**\n * Sets slotted item text as `data-text` attribute value, to let CSS use it through `attr()`.\n * @param ev Slotchange event\n */\n private onLabelSlotChange(ev: Event): void {\n const labelElement = (ev.target as HTMLSlotElement).assignedElements()[0] as HTMLElement;\n labelElement.dataset.text = labelElement?.textContent;\n this.setLabelA11yAttrs();\n }\n\n /**\n * Correctly set position of the floating menu in order to prevent overflow.\n * @param live Should run the method on every refresh frame.\n */\n private reflow(live = false): void {\n if (!this.floating) {\n return;\n }\n\n if (this.content && this.hasContent) {\n const {style} = this.content;\n const {left} = this.host.getBoundingClientRect();\n const widthPx = getComputedStyle(this.content).width;\n const width = widthPx ? parseFloat(widthPx.replace(\"px\", \"\")) : 375;\n const safeScrollbarSpace = 30;\n style.left = `${Math.min(window.innerWidth - left - width - safeScrollbarSpace, 0)}px`;\n }\n if (live) {\n this.raf = requestAnimationFrame(this.reflow.bind(this, live));\n }\n }\n\n /**\n * Check if some content slot is set.\n */\n private checkContent(): void {\n this.hasHeader = !!this.host.querySelectorAll(\"[slot=header]\").length;\n this.hasContent = !!this.host.querySelectorAll(\"[slot=item]\").length || this.hasHeader;\n }\n\n private setItemTabindex(item: HTMLElement | HTMLZMenuSectionElement, tabIndex: number): void {\n if (isZMenuSection(item)) {\n item.htmlTabindex = tabIndex;\n } else {\n item.tabIndex = tabIndex;\n }\n }\n\n /**\n * Set `menuitem` role to all menu items (ZMenuSection items already have it).\n * Set -1 to the tabindex of the items and 0 to the first one.\n */\n private setItemsA11yAttrs(): void {\n this.items.forEach((item, index) => {\n const tabindex = index === 0 ? 0 : -1;\n this.setItemTabindex(item, tabindex);\n if (!isZMenuSection(item)) {\n item.setAttribute(\"role\", \"menuitem\");\n }\n });\n }\n\n private onItemsChange(): void {\n this.checkContent();\n this.items = Array.from(this.host.children).filter(({slot}) => slot === \"item\") as HTMLElement[];\n this.setItemsA11yAttrs();\n this.items.forEach((item) => {\n if (!isZMenuSection(item)) {\n item.dataset.text = item.textContent;\n }\n });\n }\n\n /**\n * Move focus and adjust the tabindex value of `receiver` and `current` elements,\n * setting -1 to the `current` and 0 to the `receiver`, then focus the `receiver` element.\n * If the receiver is a ZMenuSection and it's open, focus its first focusable item.\n */\n private moveFocus(\n receiver: HTMLElement | HTMLZMenuSectionElement,\n current?: HTMLElement | HTMLZMenuSectionElement\n ): void {\n if (isZMenuSection(receiver)) {\n receiver.setFocus();\n } else {\n receiver.tabIndex = 0;\n setTimeout(() => {\n receiver.focus();\n }, 100);\n }\n if (!current) {\n return;\n }\n\n this.setItemTabindex(current, -1);\n }\n\n private onLabelClick(): void {\n this.toggle();\n this.setFocus();\n }\n\n private onLabelKeydown(ev: KeyboardEvent): void {\n if (ev.key === KeyboardCode.ENTER || ev.key === KeyboardCode.SPACE) {\n ev.preventDefault();\n ev.stopPropagation();\n this.toggle();\n if (this.open) {\n this.moveFocus(this.items[0]);\n }\n\n return;\n }\n\n if (!this.verticalContext) {\n return;\n }\n\n if (ev.key === KeyboardCode.ARROW_RIGHT && !this.open) {\n ev.preventDefault();\n ev.stopPropagation();\n this.open = true;\n this.moveFocus(this.items[0]);\n }\n }\n\n /** Set tabindex of the label to 0, then focus it. */\n @Method()\n async setFocus(): Promise<void> {\n this.htmlTabindex = 0;\n const label = this.hasContent ? this.labelButton : (this.host.firstElementChild as HTMLElement);\n label.focus();\n }\n\n /**\n * Focus the last item.\n */\n @Method()\n async focusLastItem(): Promise<void> {\n const lastItem = this.items[this.items.length - 1];\n if (isZMenuSection(lastItem) && lastItem.open) {\n lastItem.focusLastItem();\n\n return;\n }\n\n this.moveFocus(lastItem);\n }\n\n @Watch(\"open\")\n onOpenChanged(): void {\n if (!this.open) {\n cancelAnimationFrame(this.raf);\n this.closed.emit();\n this.items.forEach((item) => {\n if (isZMenuSection(item) && item.open) {\n item.open = false;\n }\n });\n\n return;\n }\n\n this.setItemsA11yAttrs();\n this.opened.emit();\n if (this.floating) {\n this.reflow(true);\n }\n }\n\n @Watch(\"htmlTabindex\")\n setLabelA11yAttrs(): void {\n if (this.hasContent && this.labelButton) {\n this.labelButton.tabIndex = this.htmlTabindex;\n\n return;\n }\n\n const slottedLabel = this.host.firstElementChild as HTMLElement;\n slottedLabel.role = \"menuitem\";\n slottedLabel.tabIndex = this.htmlTabindex;\n }\n\n /**\n * Set tabindex to -1 to all siblings of the clicked item.\n */\n @Listen(\"click\", {target: \"document\"})\n onItemClick(ev: MouseEvent): void {\n const clickedItem = this.items.find((item) => containsElement(item, ev.target as HTMLElement));\n if (clickedItem) {\n this.items.forEach((item) => {\n if (item === clickedItem) {\n return;\n }\n\n if (isZMenuSection(item)) {\n item.htmlTabindex = -1;\n } else {\n item.tabIndex = -1;\n }\n });\n }\n }\n\n @Listen(\"keydown\")\n onKeyDown(ev: KeyboardEvent): void {\n if (!this.hasContent) {\n return;\n }\n\n switch (ev.key) {\n case KeyboardCode.ESC:\n if (!this.open) {\n break;\n }\n ev.stopPropagation();\n ev.preventDefault();\n this.open = false;\n this.setFocus();\n break;\n case KeyboardCode.ARROW_DOWN: {\n if (document.activeElement === this.host) {\n if (this.verticalContext && !this.open) {\n break;\n }\n\n ev.stopPropagation();\n ev.preventDefault();\n if (!this.open) {\n this.open = true;\n }\n this.moveFocus(this.items[0]);\n break;\n }\n\n const currentIndex = this.items.indexOf(this.focusableItem);\n if (this.verticalContext && currentIndex === this.items.length - 1) {\n // navigation is going to leave this menu. restore tabindex to the label and let the parent handle it\n this.setItemTabindex(this.items[currentIndex], -1);\n this.htmlTabindex = 0;\n break;\n }\n\n ev.stopPropagation();\n ev.preventDefault();\n const receiver = this.items[currentIndex + 1];\n // if the last item is already focused, navigate to the first one\n this.moveFocus(receiver ?? this.items[0], this.focusableItem);\n break;\n }\n case KeyboardCode.ARROW_UP: {\n if (document.activeElement === this.host) {\n if (this.verticalContext) {\n break;\n }\n\n ev.stopPropagation();\n ev.preventDefault();\n // open the menu and focus the last item\n if (!this.open) {\n this.open = true;\n }\n this.moveFocus(this.items[this.items.length - 1], this.focusableItem);\n break;\n }\n\n ev.stopPropagation();\n ev.preventDefault();\n const currentIndex = this.items.indexOf(this.focusableItem);\n if (currentIndex === 0 && this.verticalContext) {\n this.setItemTabindex(this.focusableItem, -1);\n this.setFocus();\n break;\n }\n\n const receiver = this.items[currentIndex - 1] ?? this.items[this.items.length - 1];\n // if the receiver is a ZMenuSection and it's open, focus its last item\n if (isZMenuSection(receiver) && receiver.open) {\n this.setItemTabindex(this.focusableItem, -1);\n receiver.focusLastItem();\n break;\n }\n\n this.moveFocus(receiver, this.focusableItem);\n break;\n }\n case KeyboardCode.ARROW_LEFT:\n if (!this.open || !this.verticalContext) {\n break;\n }\n\n // close the menu and focus the label\n ev.preventDefault();\n ev.stopPropagation();\n this.open = false;\n this.setFocus();\n }\n }\n\n constructor() {\n this.toggle = this.toggle.bind(this);\n this.checkContent = this.checkContent.bind(this);\n this.onLabelSlotChange = this.onLabelSlotChange.bind(this);\n this.onLabelClick = this.onLabelClick.bind(this);\n this.onItemsChange = this.onItemsChange.bind(this);\n this.onLabelKeydown = this.onLabelKeydown.bind(this);\n }\n\n componentWillLoad(): void {\n this.setLabelA11yAttrs();\n this.onItemsChange();\n }\n\n render(): HTMLDivElement | HTMLZMenuElement {\n if (!this.hasContent) {\n return (\n <div class=\"menu-label\">\n <slot onSlotchange={this.onLabelSlotChange} />\n </div>\n );\n }\n\n return (\n <Host>\n <button\n ref={(el) => (this.labelButton = el)}\n class=\"menu-label\"\n aria-expanded={`${!!this.open}`}\n aria-haspopup={`${this.hasContent}`}\n aria-label={this.open ? \"Chiudi menù\" : \"Apri menù\"}\n role=\"menuitem\"\n tabIndex={this.htmlTabindex}\n onClick={this.onLabelClick}\n onKeyDown={this.onLabelKeydown}\n >\n <slot onSlotchange={this.onLabelSlotChange} />\n <z-icon name={this.open ? \"chevron-up\" : \"chevron-down\"} />\n </button>\n\n <div\n class=\"content\"\n ref={(el) => (this.content = el)}\n >\n {this.hasHeader && (\n <header class=\"header\">\n <slot\n name=\"header\"\n onSlotchange={this.checkContent}\n />\n </header>\n )}\n\n <div\n class=\"items\"\n role=\"menu\"\n >\n <slot\n name=\"item\"\n onSlotchange={this.onItemsChange}\n />\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"z-menu.js","mappings":";;;;;AAAA,MAAM,SAAS,GAAG,6oHAA6oH,CAAC;AAChqH,oBAAe,SAAS;;ACGxB,MAAM,cAAc,GAAG,CAAC,EAAyC,KAC/D,CAAA,EAAE,aAAF,EAAE,uBAAF,EAAE,CAAE,OAAO,MAAK,gBAAgB,CAAC;MAatBA,OAAK;IAwDhB,IAAY,aAAa;QACvB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,MAAM,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,YAAY,KAAK,CAAC,GAAG,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC;KAC1G;IAEO,MAAM;QACZ,IAAI,CAAC,IAAI,CAAC,UAAU,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AC3B,OAAO,EAAE,IAAI,CAAC,YAAY,EAC1B,SAAS,EAAE,IAAI,CAAC,cAAc,IAE9B,YAAM,YAAY,EAAE,IAAI,CAAC,iBAAiB,GAAI,EAC9C,cAAQ,IAAI,EAAE,IAAI,CAAC,IAAI,GAAG,YAAY,GAAG,cAAc,GAAI,CACpD,EAET,WACE,KAAK,EAAC,SAAS,EACf,GAAG,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC,IAE/B,IAAI,CAAC,SAAS,KACb,cAAQ,KAAK,EAAC,QAAQ,IACpB,YACE,IAAI,EAAC,QAAQ,EACb,YAAY,EAAE,IAAI,CAAC,YAAY,GAC/B,CACK,CACV,EAED,WACE,KAAK,EAAC,OAAO,EACb,IAAI,EAAC,MAAM,IAEX,YACE,IAAI,EAAC,MAAM,EACX,YAAY,EAAE,IAAI,CAAC,aAAa,GAChC,CACE,CACF,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["ZMenu"],"sources":["src/components/z-menu/styles.css?tag=z-menu&encapsulation=shadow","src/components/z-menu/index.tsx"],"sourcesContent":[":host,\n::slotted(*),\n* {\n box-sizing: border-box;\n outline: none;\n}\n\n:host {\n --z-menu-label-color: ;\n\n position: relative;\n display: inline-flex;\n height: fit-content;\n flex-direction: column;\n}\n\n::slotted(a) {\n text-decoration: none;\n}\n\n::slotted(*) {\n color: var(--color-default-text);\n font-family: var(--font-family-sans);\n font-weight: var(--font-rg);\n}\n\n.menu-label {\n position: relative;\n display: flex;\n width: 100%;\n align-items: center;\n padding: 0;\n border: 0;\n border-bottom: var(--border-size-large) solid transparent;\n margin: 0;\n background: transparent;\n border-radius: 0;\n color: inherit;\n text-align: left;\n}\n\nbutton.menu-label {\n cursor: pointer;\n}\n\n.menu-label:focus-visible,\ndiv.menu-label:focus-within {\n box-shadow: var(--shadow-focus-primary);\n}\n\n:host(:is([active], [open])) .menu-label ::slotted(*),\n.menu-label:focus-visible ::slotted(*),\ndiv.menu-label:focus-within ::slotted(*) {\n color: var(--color-primary01);\n font-weight: var(--font-bd);\n}\n\n:host([vertical-context]) .menu-label {\n padding: var(--space-unit) 0;\n border-width: var(--border-size-small);\n border-color: var(--color-surface03);\n}\n\n:host(:is([active], [open])) .menu-label,\n.menu-label:hover,\n.menu-label:focus-visible,\ndiv.menu-label:focus-within {\n border-color: var(--color-secondary01);\n}\n\n:host([vertical-context]:is([active], [open])) .menu-label::after,\n:host([vertical-context]) .menu-label:hover::after,\n:host([vertical-context]) .menu-label:focus-visible::after,\n:host([vertical-context]) div.menu-label:focus-within::after {\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100%;\n height: var(--border-size-large);\n background-color: var(--color-secondary01);\n content: \"\";\n}\n\n:host([vertical-context]) .menu-label ::slotted(*) {\n padding: 0;\n}\n\n.menu-label ::slotted(*) {\n display: inline-flex;\n width: 100%;\n min-width: fit-content;\n padding-bottom: 2px;\n margin: 0;\n appearance: none;\n color: var(--z-menu-label-color, var(--color-default-text));\n font-family: var(--font-family-sans);\n font-size: var(--font-size-3);\n font-weight: inherit;\n line-height: 1.5;\n white-space: nowrap;\n}\n\n.menu-label z-icon {\n margin-left: calc(var(--space-unit) * 1.5);\n fill: var(--color-default-icon);\n}\n\n/* Prevents layout shifts on font-weight changes.\nThe trick is to put an hidden copy of the text already set to bold,\nso the needed space is correctly calculated before any hover/active state changes the\nfont-weight of the real text.\nThe hidden text has an height of 0px so it can expand the width without changing the height\nwhen placed below the real text using `flex-direction: column`. */\n::slotted([data-text]:not([slot]))::after {\n height: 0;\n content: attr(data-text);\n content: attr(data-text) / \"\";\n font-weight: var(--font-bd);\n letter-spacing: normal;\n pointer-events: none;\n user-select: none;\n visibility: hidden;\n}\n\n@media speech {\n ::slotted([data-text]:not([slot]))::after {\n display: none;\n }\n}\n\n::slotted([data-text]:not([slot])) {\n display: inline-flex;\n flex-direction: column;\n}\n\n.content {\n background: var(--color-surface01);\n}\n\n:host(:not([open])) .content {\n display: none;\n}\n\n:host([floating]:not([vertical-context])) .content {\n position: absolute;\n top: 100%;\n left: 0;\n width: 375px;\n min-width: 100%;\n max-width: 100vw;\n padding: 0 calc(var(--space-unit) * 2);\n box-shadow: var(--shadow-2);\n}\n\n:host(:not([floating])) .content {\n width: 100%;\n}\n\n.header {\n display: flex;\n align-items: center;\n padding: var(--space-unit) 0 calc(var(--space-unit) * 2);\n}\n\n.header ::slotted(img[slot=\"header\"]) {\n width: calc(var(--space-unit) * 11.25);\n height: auto;\n object-fit: contain;\n}\n\n.header ::slotted([slot=\"header\"]:not(:first-child)) {\n margin: auto 0;\n margin-left: calc(var(--space-unit) * 2.5);\n font-size: var(--font-size-3);\n font-weight: var(--font-sb);\n line-height: 1.5;\n}\n\n.items {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n background: inherit;\n}\n\n.items > ::slotted([slot=\"item\"]) {\n width: 100%;\n margin: 0;\n font-size: var(--font-size-3);\n line-height: 1.5;\n}\n\n.items > ::slotted([slot=\"item\"]:focus:focus-visible) {\n box-shadow: var(--shadow-focus-primary);\n}\n\n.items > ::slotted([slot=\"item\"]:not(z-menu-section)) {\n padding: var(--space-unit) 0;\n border-bottom: var(--border-size-small) solid var(--color-surface03);\n}\n\n:host(:not([vertical-context])) .items > ::slotted([slot=\"item\"]:last-child) {\n border-bottom: 0;\n}\n\n.items > ::slotted([slot=\"item\"]:hover),\n.items > ::slotted([slot=\"item\"]:focus:focus-visible),\n.items > ::slotted([slot=\"item\"]:active) {\n border-color: var(--color-secondary01);\n font-weight: var(--font-bd);\n}\n","import {Component, Element, Event, EventEmitter, Host, Listen, Method, Prop, State, Watch, h} from \"@stencil/core\";\nimport {KeyboardCode} from \"../../beans\";\nimport {containsElement} from \"../../utils/utils\";\n\nconst isZMenuSection = (el: HTMLElement | HTMLZMenuSectionElement): el is HTMLZMenuSectionElement =>\n el?.tagName === \"Z-MENU-SECTION\";\n\n/**\n * @slot - Menu label\n * @slot header - Header to display as the first entry of the open menu.\n * @slot item - Single entry of the section. Can be slotted multiple times to insert items onto the menu. Set the `active` HTML attribute on the element to highlight it. Use `z-menu-section` for submenus.\n * @cssprop --z-menu-label-color - Color of the label's text.\n */\n@Component({\n tag: \"z-menu\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZMenu {\n @Element() host: HTMLZMenuElement;\n\n /** Flag to set the active status of the menu. */\n @Prop({reflect: true})\n active?: boolean;\n\n /**\n * Flag to set the display mode of the list.\n * If true, the list will be absolutely positioned under the menu label,\n * stacked beneath it otherwise.\n */\n @Prop({reflect: true})\n floating? = true;\n\n /** The opening state of the menu. */\n @Prop({mutable: true, reflect: true})\n open = false;\n\n /**\n * Tells the component that it's placed in a vertical context with other `ZMenu`s (usually in the ZAppHeader's offcanvas).\n * A small border is placed under it as a separator from other elements.\n */\n @Prop({reflect: true})\n verticalContext = false;\n\n /**\n * Tabindex value to set on the menu label.\n * Useful to manage keyboard navigation focus with roving tabindex handled by this component's parent (usually ZAppHeader).\n */\n @Prop()\n htmlTabindex = -1;\n\n @State()\n hasHeader: boolean;\n\n @State()\n hasContent: boolean;\n\n /** The menu has been opened. */\n @Event()\n opened: EventEmitter;\n\n /** The menu has been closed. */\n @Event()\n closed: EventEmitter;\n\n private labelButton: HTMLButtonElement;\n\n private content: HTMLElement;\n\n private items: (HTMLElement | HTMLZMenuSectionElement)[] = [];\n\n /** Animation frame request id. */\n private raf: number;\n\n private get focusableItem(): HTMLZMenuSectionElement | HTMLElement | null {\n return this.items.find((item) => (isZMenuSection(item) ? item.htmlTabindex === 0 : item.tabIndex === 0));\n }\n\n private toggle(): void {\n if (!this.hasContent) {\n return;\n }\n\n this.open = !this.open;\n }\n\n /**\n * Sets slotted item text as `data-text` attribute value, to let CSS use it through `attr()`.\n * @param ev Slotchange event\n */\n private onLabelSlotChange(ev: Event): void {\n const labelElement = (ev.target as HTMLSlotElement).assignedElements()[0] as HTMLElement;\n labelElement.dataset.text = labelElement?.textContent;\n this.setLabelA11yAttrs();\n }\n\n /**\n * Correctly set position of the floating menu in order to prevent overflow.\n * @param live Should run the method on every refresh frame.\n */\n private reflow(live = false): void {\n if (!this.floating) {\n return;\n }\n\n if (this.content && this.hasContent) {\n const {style} = this.content;\n const {left} = this.host.getBoundingClientRect();\n const widthPx = getComputedStyle(this.content).width;\n const width = widthPx ? parseFloat(widthPx.replace(\"px\", \"\")) : 375;\n const safeScrollbarSpace = 30;\n style.left = `${Math.min(window.innerWidth - left - width - safeScrollbarSpace, 0)}px`;\n }\n if (live) {\n this.raf = requestAnimationFrame(this.reflow.bind(this, live));\n }\n }\n\n /**\n * Check if some content slot is set.\n */\n private checkContent(): void {\n this.hasHeader = !!this.host.querySelectorAll(\"[slot=header]\").length;\n this.hasContent = !!this.host.querySelectorAll(\"[slot=item]\").length || this.hasHeader;\n }\n\n private setItemTabindex(item: HTMLElement | HTMLZMenuSectionElement, tabIndex: number): void {\n if (isZMenuSection(item)) {\n item.htmlTabindex = tabIndex;\n } else {\n item.tabIndex = tabIndex;\n }\n }\n\n /**\n * Set `menuitem` role to all menu items (ZMenuSection items already have it).\n * Set -1 to the tabindex of the items and 0 to the first one.\n */\n private setItemsA11yAttrs(): void {\n this.items.forEach((item, index) => {\n const tabindex = index === 0 ? 0 : -1;\n this.setItemTabindex(item, tabindex);\n if (!isZMenuSection(item)) {\n item.setAttribute(\"role\", \"menuitem\");\n }\n });\n }\n\n private onItemsChange(): void {\n this.checkContent();\n this.items = Array.from(this.host.children).filter(({slot}) => slot === \"item\") as HTMLElement[];\n this.setItemsA11yAttrs();\n this.items.forEach((item) => {\n if (!isZMenuSection(item)) {\n item.dataset.text = item.textContent;\n }\n });\n }\n\n /**\n * Move focus and adjust the tabindex value of `receiver` and `current` elements,\n * setting -1 to the `current` and 0 to the `receiver`, then focus the `receiver` element.\n * If the receiver is a ZMenuSection and it's open, focus its first focusable item.\n */\n private moveFocus(\n receiver: HTMLElement | HTMLZMenuSectionElement,\n current?: HTMLElement | HTMLZMenuSectionElement\n ): void {\n if (isZMenuSection(receiver)) {\n receiver.setFocus();\n } else {\n receiver.tabIndex = 0;\n setTimeout(() => {\n receiver.focus();\n }, 100);\n }\n if (!current) {\n return;\n }\n\n this.setItemTabindex(current, -1);\n }\n\n private onLabelClick(): void {\n this.toggle();\n this.setFocus();\n }\n\n private onLabelKeydown(ev: KeyboardEvent): void {\n if (ev.key === KeyboardCode.ENTER || ev.key === KeyboardCode.SPACE) {\n ev.preventDefault();\n ev.stopPropagation();\n this.toggle();\n if (this.open) {\n this.moveFocus(this.items[0]);\n }\n\n return;\n }\n\n if (!this.verticalContext) {\n return;\n }\n\n if (ev.key === KeyboardCode.ARROW_RIGHT && !this.open) {\n ev.preventDefault();\n ev.stopPropagation();\n this.open = true;\n this.moveFocus(this.items[0]);\n }\n }\n\n /** Set tabindex of the label to 0, then focus it. */\n @Method()\n async setFocus(): Promise<void> {\n this.htmlTabindex = 0;\n const label = this.hasContent ? this.labelButton : (this.host.firstElementChild as HTMLElement);\n label.focus();\n }\n\n /**\n * Focus the last item.\n */\n @Method()\n async focusLastItem(): Promise<void> {\n const lastItem = this.items[this.items.length - 1];\n if (isZMenuSection(lastItem) && lastItem.open) {\n lastItem.focusLastItem();\n\n return;\n }\n\n this.moveFocus(lastItem);\n }\n\n @Watch(\"open\")\n onOpenChanged(): void {\n if (!this.open) {\n cancelAnimationFrame(this.raf);\n this.closed.emit();\n this.items.forEach((item) => {\n if (isZMenuSection(item) && item.open) {\n item.open = false;\n }\n });\n\n return;\n }\n\n this.setItemsA11yAttrs();\n this.opened.emit();\n if (this.floating) {\n this.reflow(true);\n }\n }\n\n @Watch(\"htmlTabindex\")\n setLabelA11yAttrs(): void {\n if (this.hasContent && this.labelButton) {\n this.labelButton.tabIndex = this.htmlTabindex;\n\n return;\n }\n\n const slottedLabel = this.host.firstElementChild as HTMLElement;\n slottedLabel.role = \"menuitem\";\n slottedLabel.tabIndex = this.htmlTabindex;\n }\n\n /**\n * Set tabindex to -1 to all siblings of the clicked item.\n */\n @Listen(\"click\", {target: \"document\"})\n onItemClick(ev: MouseEvent): void {\n const clickedItem = this.items.find((item) => containsElement(item, ev.target as HTMLElement));\n if (clickedItem) {\n this.items.forEach((item) => {\n if (item === clickedItem) {\n return;\n }\n\n if (isZMenuSection(item)) {\n item.htmlTabindex = -1;\n } else {\n item.tabIndex = -1;\n }\n });\n }\n }\n\n @Listen(\"keydown\")\n onKeyDown(ev: KeyboardEvent): void {\n if (!this.hasContent) {\n return;\n }\n\n switch (ev.key) {\n case KeyboardCode.ESC:\n if (!this.open) {\n break;\n }\n ev.stopPropagation();\n ev.preventDefault();\n this.open = false;\n this.setFocus();\n break;\n case KeyboardCode.ARROW_DOWN: {\n if (document.activeElement === this.host) {\n if (this.verticalContext && !this.open) {\n break;\n }\n\n ev.stopPropagation();\n ev.preventDefault();\n if (!this.open) {\n this.open = true;\n }\n this.moveFocus(this.items[0]);\n break;\n }\n\n const currentIndex = this.items.indexOf(this.focusableItem);\n if (this.verticalContext && currentIndex === this.items.length - 1) {\n // navigation is going to leave this menu. restore tabindex to the label and let the parent handle it\n this.setItemTabindex(this.items[currentIndex], -1);\n this.htmlTabindex = 0;\n break;\n }\n\n ev.stopPropagation();\n ev.preventDefault();\n const receiver = this.items[currentIndex + 1];\n // if the last item is already focused, navigate to the first one\n this.moveFocus(receiver ?? this.items[0], this.focusableItem);\n break;\n }\n case KeyboardCode.ARROW_UP: {\n if (document.activeElement === this.host) {\n if (this.verticalContext) {\n break;\n }\n\n ev.stopPropagation();\n ev.preventDefault();\n // open the menu and focus the last item\n if (!this.open) {\n this.open = true;\n }\n this.moveFocus(this.items[this.items.length - 1], this.focusableItem);\n break;\n }\n\n ev.stopPropagation();\n ev.preventDefault();\n const currentIndex = this.items.indexOf(this.focusableItem);\n if (currentIndex === 0 && this.verticalContext) {\n this.setItemTabindex(this.focusableItem, -1);\n this.setFocus();\n break;\n }\n\n const receiver = this.items[currentIndex - 1] ?? this.items[this.items.length - 1];\n // if the receiver is a ZMenuSection and it's open, focus its last item\n if (isZMenuSection(receiver) && receiver.open) {\n this.setItemTabindex(this.focusableItem, -1);\n receiver.focusLastItem();\n break;\n }\n\n this.moveFocus(receiver, this.focusableItem);\n break;\n }\n case KeyboardCode.ARROW_LEFT:\n if (!this.open || !this.verticalContext) {\n break;\n }\n\n // close the menu and focus the label\n ev.preventDefault();\n ev.stopPropagation();\n this.open = false;\n this.setFocus();\n }\n }\n\n constructor() {\n this.toggle = this.toggle.bind(this);\n this.checkContent = this.checkContent.bind(this);\n this.onLabelSlotChange = this.onLabelSlotChange.bind(this);\n this.onLabelClick = this.onLabelClick.bind(this);\n this.onItemsChange = this.onItemsChange.bind(this);\n this.onLabelKeydown = this.onLabelKeydown.bind(this);\n }\n\n componentWillLoad(): void {\n this.setLabelA11yAttrs();\n this.onItemsChange();\n }\n\n render(): HTMLDivElement | HTMLZMenuElement {\n if (!this.hasContent) {\n return (\n <div class=\"menu-label\">\n <slot onSlotchange={this.onLabelSlotChange} />\n </div>\n );\n }\n\n return (\n <Host>\n <button\n ref={(el) => (this.labelButton = el)}\n class=\"menu-label\"\n aria-expanded={`${!!this.open}`}\n aria-haspopup={`${this.hasContent}`}\n aria-label={this.open ? \"Chiudi menù\" : \"Apri menù\"}\n role=\"menuitem\"\n tabIndex={this.htmlTabindex}\n onClick={this.onLabelClick}\n onKeyDown={this.onLabelKeydown}\n >\n <slot onSlotchange={this.onLabelSlotChange} />\n <z-icon name={this.open ? \"chevron-up\" : \"chevron-down\"} />\n </button>\n\n <div\n class=\"content\"\n ref={(el) => (this.content = el)}\n >\n {this.hasHeader && (\n <header class=\"header\">\n <slot\n name=\"header\"\n onSlotchange={this.checkContent}\n />\n </header>\n )}\n\n <div\n class=\"items\"\n role=\"menu\"\n >\n <slot\n name=\"item\"\n onSlotchange={this.onItemsChange}\n />\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
package/dist/components/z-th.js
CHANGED
|
@@ -4,7 +4,7 @@ import { d as defineCustomElement$4 } from './index4.js';
|
|
|
4
4
|
import { d as defineCustomElement$3 } from './index9.js';
|
|
5
5
|
import { d as defineCustomElement$2 } from './index22.js';
|
|
6
6
|
|
|
7
|
-
const stylesCss = ":host{position:relative;display:flex;max-width:100%;align-items:center;padding:var(--z-table--cells-padding, calc(var(--space-unit) * 2));background-color:var(--color-surface01);gap:calc(var(--space-unit) * 2) var(--space-unit)}:host,*{box-sizing:border-box}:host([sticky]){position:sticky;z-index:1;top:0;left:0;box-shadow:8px 0 16px -8px var(--shadow-color-base)}:host([menu-open]){z-index:2}.cell--content{display:flex;width:100%;height:100%;align-items:center}:host([show-menu]) .cell--content{column-gap:var(--space-unit)}.cell--menu-container{margin-left:auto}:host(:not([show-menu])) .cell--menu-container{opacity:0;pointer-events:none}:host(:is([show-menu],[menu-open])) .cell--menu-container,:host([show-menu]) .cell--menu-container:focus-within{z-index:1;opacity:1;pointer-events:all}:host .cell-popover{z-index:100}@media (min-width: 768px) and (hover: hover){:host([show-menu=\"hover\"]) .cell--menu-container{opacity:0;pointer-events:none}:host([show-menu=\"hover\"]:hover) .cell--menu-container{z-index:1;opacity:1;pointer-events:all}}:host{z-index:1;padding:0;background-color:var(--color-surface02);font-weight:var(--font-sb)}.cell--content{padding:calc(var(--space-unit) * 2)}:host([show-sorting]) .cell--content{column-gap:var(--space-unit)}.z-th--sort-button{padding:0;border:none;background-color:transparent;cursor:pointer;outline:none}@media (min-width: 768px) and (hover: hover){:host([show-sorting=\"hover\"]) .z-th--sort-button{opacity:0;pointer-events:none}:host([show-sorting=\"hover\"]:hover) .z-th--sort-button,:host([show-sorting=\"hover\"]) .z-th--sort-button:focus:focus-visible,:host([show-sorting=\"always\"]) .z-th--sort-button,:host([sorted]) .z-th--sort-button{opacity:1;pointer-events:all}}:host([show-sorting=\"hover\"]:hover) .z-th--sort-button::after,:host([show-sorting=\"hover\"]) .z-th--sort-button:focus:focus-visible::after,:host([show-sorting=\"always\"]) .z-th--sort-button::after,:host([sorted]) .z-th--sort-button::after{position:absolute;top:6px;left:6px;width:calc(100% - 12px);height:calc(100% - 10px);background-color:transparent;content:\"\"}:host([sorted]) .z-th--sort-button::after,.z-th--sort-button:focus:focus-visible::after{box-shadow:var(--shadow-focus-primary)}";
|
|
7
|
+
const stylesCss = ":host{position:relative;display:flex;max-width:100%;align-items:center;padding:var(--z-table--cells-padding, calc(var(--space-unit) * 2));background-color:var(--color-surface01);gap:calc(var(--space-unit) * 2) var(--space-unit)}:host,*{box-sizing:border-box}:host([sticky]){position:sticky;z-index:1;top:0;left:0;box-shadow:8px 0 16px -8px var(--shadow-color-base)}:host([menu-open]){z-index:2}.cell--content{display:flex;width:100%;height:100%;align-items:center}:host([show-menu]) .cell--content{column-gap:var(--space-unit)}.cell--menu-container{margin-left:auto}:host(:not([show-menu])) .cell--menu-container{opacity:0;pointer-events:none}:host(:is([show-menu],[menu-open])) .cell--menu-container,:host([show-menu]) .cell--menu-container:focus-within{z-index:1;opacity:1;pointer-events:all}:host .cell-popover{z-index:100}@media (min-width: 768px) and (hover: hover){:host([show-menu=\"hover\"]) .cell--menu-container{opacity:0;pointer-events:none}:host([show-menu=\"hover\"]:hover) .cell--menu-container{z-index:1;opacity:1;pointer-events:all}}:host{z-index:1;padding:0;background-color:var(--color-surface02);font-weight:var(--font-sb)}.cell--content{padding:var(--z-table--cells-padding, calc(var(--space-unit) * 2))}:host([show-sorting]) .cell--content{column-gap:var(--space-unit)}.z-th--sort-button{padding:0;border:none;background-color:transparent;cursor:pointer;outline:none}@media (min-width: 768px) and (hover: hover){:host([show-sorting=\"hover\"]) .z-th--sort-button{opacity:0;pointer-events:none}:host([show-sorting=\"hover\"]:hover) .z-th--sort-button,:host([show-sorting=\"hover\"]) .z-th--sort-button:focus:focus-visible,:host([show-sorting=\"always\"]) .z-th--sort-button,:host([sorted]) .z-th--sort-button{opacity:1;pointer-events:all}}:host([show-sorting=\"hover\"]:hover) .z-th--sort-button::after,:host([show-sorting=\"hover\"]) .z-th--sort-button:focus:focus-visible::after,:host([show-sorting=\"always\"]) .z-th--sort-button::after,:host([sorted]) .z-th--sort-button::after{position:absolute;top:6px;left:6px;width:calc(100% - 12px);height:calc(100% - 10px);background-color:transparent;content:\"\"}:host([sorted]) .z-th--sort-button::after,.z-th--sort-button:focus:focus-visible::after{box-shadow:var(--shadow-focus-primary)}";
|
|
8
8
|
const ZThStyle0 = stylesCss;
|
|
9
9
|
|
|
10
10
|
const ZTh$1 = /*@__PURE__*/ proxyCustomElement(class ZTh extends HTMLElement {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"z-th.js","mappings":";;;;;;AAAA,MAAM,SAAS,GAAG,
|
|
1
|
+
{"file":"z-th.js","mappings":";;;;;;AAAA,MAAM,SAAS,GAAG,itEAAitE,CAAC;AACpuE,kBAAe,SAAS;;MCYXA,KAAG;;;;;;;wBAekB,IAAI;2BAQD,IAAI;sBAM9B,KAAK;;sBAYW,KAAK;+BAMZ,eAAe,CAAC,IAAI;0BAMzB,KAAK;;;;;IAiBlB,IAAY,iBAAiB;QAC3B,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;YACvB,OAAO,IAAI,CAAC;SACb;QAED,OAAO,IAAI,CAAC,aAAa,KAAK,aAAa,CAAC,GAAG,GAAG,WAAW,GAAG,YAAY,CAAC;KAC9E;;;;;IAMO,UAAU;QAChB,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;YACvB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YAEpB,OAAO;SACR;QAED,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,KAAK,aAAa,CAAC,GAAG,GAAG,aAAa,CAAC,IAAI,GAAG,aAAa,CAAC,GAAG,CAAC;QACvG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QAEnB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAC,aAAa,EAAE,IAAI,CAAC,aAAa,EAAC,CAAC,CAAC;KACrD;IAGS,aAAa;QACrB,IAAI,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EAAE,CAAC,KAAK,MAAM,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAC9D,QAAQ,EAAE,IAAI,CAAC,eAAe,IAE9B,6DAAM,IAAI,EAAC,iBAAiB,GAAQ,CAC1B,CACR,CACP,CACG,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["ZTh"],"sources":["src/components/table/cells/z-th/styles.css?tag=z-th&encapsulation=shadow","src/components/table/cells/z-th/index.tsx"],"sourcesContent":["@import \"../z-table-cells.css\";\n\n:host {\n z-index: 1;\n padding: 0;\n background-color: var(--color-surface02);\n font-weight: var(--font-sb);\n}\n\n.cell--content {\n padding: var(--z-table--cells-padding, calc(var(--space-unit) * 2));\n}\n\n:host([show-sorting]) .cell--content {\n column-gap: var(--space-unit);\n}\n\n.z-th--sort-button {\n padding: 0;\n border: none;\n background-color: transparent;\n cursor: pointer;\n outline: none;\n}\n\n@media (min-width: 768px) and (hover: hover) {\n :host([show-sorting=\"hover\"]) .z-th--sort-button {\n opacity: 0;\n pointer-events: none;\n }\n\n :host([show-sorting=\"hover\"]:hover) .z-th--sort-button,\n :host([show-sorting=\"hover\"]) .z-th--sort-button:focus:focus-visible,\n :host([show-sorting=\"always\"]) .z-th--sort-button,\n :host([sorted]) .z-th--sort-button {\n opacity: 1;\n pointer-events: all;\n }\n}\n\n:host([show-sorting=\"hover\"]:hover) .z-th--sort-button::after,\n:host([show-sorting=\"hover\"]) .z-th--sort-button:focus:focus-visible::after,\n:host([show-sorting=\"always\"]) .z-th--sort-button::after,\n:host([sorted]) .z-th--sort-button::after {\n position: absolute;\n top: 6px;\n left: 6px;\n width: calc(100% - 12px);\n height: calc(100% - 10px);\n background-color: transparent;\n content: \"\";\n}\n\n:host([sorted]) .z-th--sort-button::after,\n.z-th--sort-button:focus:focus-visible::after {\n box-shadow: var(--shadow-focus-primary);\n}\n","import {Component, Element, Event, EventEmitter, Host, Prop, State, Watch, h} from \"@stencil/core\";\nimport {ButtonVariant, ControlSize, PopoverPosition, SortDirection, VisibilityCondition} from \"../../../../beans\";\n\n/**\n * ZTh component.\n * @slot - ZTh content.\n * @slot contextual-menu - Contextual menu content. Only visible when `showMenu` is true.\n */\n@Component({\n tag: \"z-th\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZTh {\n @Element() host: HTMLZThElement;\n\n /**\n * Number of columns that the cell should span.\n */\n @Prop()\n colspan: number;\n\n /**\n * Enables the contextual menu.\n * Can be set to \"hover\" or \"always\" to show the button only on cell hover or always.\n * Set a nullish value to hide the menu button.\n */\n @Prop({reflect: true})\n showMenu: VisibilityCondition = null;\n\n /**\n * Enables the sorting button.\n * Can be set to \"hover\" or \"always\" to show the button only on cell hover or always.\n * Set a nullish value to hide the sort button.\n */\n @Prop({reflect: true})\n showSorting: VisibilityCondition = null;\n\n /**\n * Whether the cell should stick.\n */\n @Prop({reflect: true})\n sticky = false;\n\n /**\n * Current sorting direction.\n */\n @Prop({mutable: true})\n sortDirection?: SortDirection;\n\n /**\n * Sorted state of the column.\n */\n @Prop({reflect: true, mutable: true})\n sorted: boolean | null = false;\n\n /**\n * Set popover position.\n */\n @Prop()\n popoverPosition = PopoverPosition.AUTO;\n\n /**\n * Store the open state of the menu.\n */\n @State()\n isMenuOpen = false;\n\n /**\n * Sort event fired when the user clicks on the sort button.\n * The sorting logic must be implemented by the app.\n * You can set an `id` on the `z-th` to easly identify the column in the event listener.\n */\n @Event()\n private sort: EventEmitter;\n\n private menuTrigger: HTMLElement;\n\n private popoverEl: HTMLZPopoverElement;\n\n /**\n * Get the value to set to the `aria-sort` attribute based on the current sort direction.\n */\n private get ariaSortDirection(): string {\n if (!this.sortDirection) {\n return null;\n }\n\n return this.sortDirection === SortDirection.ASC ? \"ascending\" : \"descending\";\n }\n\n /**\n * Handle the click on the sort button.\n * @fires sort\n */\n private handleSort(): void {\n if (!this.sortDirection) {\n this.sorted = false;\n\n return;\n }\n\n this.sortDirection = this.sortDirection === SortDirection.ASC ? SortDirection.DESC : SortDirection.ASC;\n this.sorted = true;\n\n this.sort.emit({sortDirection: this.sortDirection});\n }\n\n @Watch(\"colspan\")\n protected updateColspan(): void {\n if (this.colspan) {\n this.host.style.gridColumn = `span ${this.colspan}`;\n } else {\n this.host.style.removeProperty(\"grid-column\");\n }\n }\n\n componentWillLoad(): void {\n this.updateColspan();\n }\n\n render(): HTMLZThElement {\n return (\n <Host\n role=\"columnheader\"\n menu-open={this.isMenuOpen}\n aria-sort={this.ariaSortDirection}\n sortable={this.showSorting}\n >\n <div class=\"cell--content\">\n <slot></slot>\n {this.showSorting && (\n <button\n class=\"z-th--sort-button\"\n type=\"button\"\n onClick={this.handleSort.bind(this)}\n >\n <z-icon\n name={this.sortDirection === SortDirection.DESC ? \"arrow-simple-up\" : \"arrow-simple-down\"}\n width={14}\n height={14}\n />\n </button>\n )}\n {this.showMenu && (\n <div class=\"cell--menu-container\">\n <z-button\n variant={ButtonVariant.TERTIARY}\n icon=\"contextual-menu\"\n size={ControlSize.X_SMALL}\n ref={(el) => (this.menuTrigger = el as HTMLElement)}\n onClick={() => (this.popoverEl.open = !this.popoverEl.open)}\n />\n <z-popover\n ref={(el) => (this.popoverEl = el as HTMLZPopoverElement)}\n bindTo={this.menuTrigger}\n onOpenChange={(event) => (this.isMenuOpen = event.detail.open)}\n position={this.popoverPosition}\n >\n <slot name=\"contextual-menu\"></slot>\n </z-popover>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
import "./index.stories.css";
|
|
3
|
+
export default {
|
|
4
|
+
title: "Grid",
|
|
5
|
+
tags: ["!autodocs"],
|
|
6
|
+
};
|
|
7
|
+
export const Grid = {
|
|
8
|
+
render: () => html `
|
|
9
|
+
<div class="grid-story body-1">
|
|
10
|
+
<p><strong>z-grid</strong> column responsive CSS classes.</p>
|
|
11
|
+
<p>Each "col" class can be used with a viewport prefix:
|
|
12
|
+
<ul>
|
|
13
|
+
<li>mobile-col-#</li>
|
|
14
|
+
<li>tablet-col-#</li>
|
|
15
|
+
<li>desktop-col-#</li>
|
|
16
|
+
<li>wide-col-#</li>
|
|
17
|
+
</ul>
|
|
18
|
+
</p>
|
|
19
|
+
<p>The prefix let the class apply its style only on that viewport.</p>
|
|
20
|
+
<div class="container">
|
|
21
|
+
<h3>Responsive columns</h3>
|
|
22
|
+
<div class="z-grid">
|
|
23
|
+
<div class="wide-col-6 desktop-col-4 tablet-col-3 mobile-col-2">
|
|
24
|
+
wide-col-6 desktop-col-4 tablet-col-3 mobile-col-2
|
|
25
|
+
</div>
|
|
26
|
+
<div class="wide-col-6 desktop-col-4 tablet-col-3 mobile-col-2">
|
|
27
|
+
wide-col-6 desktop-col-4 tablet-col-3 mobile-col-2
|
|
28
|
+
</div>
|
|
29
|
+
<div class="wide-col-4 desktop-col-4 tablet-col-3 mobile-col-2">
|
|
30
|
+
wide-col-4 desktop-col-4 tablet-col-3 mobile-col-2
|
|
31
|
+
</div>
|
|
32
|
+
<div class="wide-col-4 desktop-col-4 tablet-col-3 mobile-col-2">
|
|
33
|
+
wide-col-4 desktop-col-4 tablet-col-3 mobile-col-2
|
|
34
|
+
</div>
|
|
35
|
+
<div class="ghost-grid z-grid">
|
|
36
|
+
<div></div>
|
|
37
|
+
<div></div>
|
|
38
|
+
<div></div>
|
|
39
|
+
<div></div>
|
|
40
|
+
<div></div>
|
|
41
|
+
<div></div>
|
|
42
|
+
<div></div>
|
|
43
|
+
<div></div>
|
|
44
|
+
<div></div>
|
|
45
|
+
<div></div>
|
|
46
|
+
<div></div>
|
|
47
|
+
<div></div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
`,
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=index.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.stories.js","sourceRoot":"","sources":["../../../docs/grid/index.stories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAC;AACzB,OAAO,qBAAqB,CAAC;AAE7B,eAAe;IACb,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,CAAC,WAAW,CAAC;CACpB,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CjB;CACF,CAAC","sourcesContent":["import {html} from \"lit\";\nimport \"./index.stories.css\";\n\nexport default {\n title: \"Grid\",\n tags: [\"!autodocs\"],\n};\n\nexport const Grid = {\n render: () => html`\n <div class=\"grid-story body-1\">\n <p><strong>z-grid</strong> column responsive CSS classes.</p>\n <p>Each \"col\" class can be used with a viewport prefix:\n <ul>\n <li>mobile-col-#</li>\n <li>tablet-col-#</li>\n <li>desktop-col-#</li>\n <li>wide-col-#</li>\n </ul>\n </p>\n <p>The prefix let the class apply its style only on that viewport.</p>\n <div class=\"container\">\n <h3>Responsive columns</h3>\n <div class=\"z-grid\">\n <div class=\"wide-col-6 desktop-col-4 tablet-col-3 mobile-col-2\">\n wide-col-6 desktop-col-4 tablet-col-3 mobile-col-2\n </div>\n <div class=\"wide-col-6 desktop-col-4 tablet-col-3 mobile-col-2\">\n wide-col-6 desktop-col-4 tablet-col-3 mobile-col-2\n </div>\n <div class=\"wide-col-4 desktop-col-4 tablet-col-3 mobile-col-2\">\n wide-col-4 desktop-col-4 tablet-col-3 mobile-col-2\n </div>\n <div class=\"wide-col-4 desktop-col-4 tablet-col-3 mobile-col-2\">\n wide-col-4 desktop-col-4 tablet-col-3 mobile-col-2\n </div>\n <div class=\"ghost-grid z-grid\">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </div>\n </div>\n </div>\n </div>\n `,\n};\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
import "../../src/components/z-accordion/index";
|
|
3
|
+
import "../../src/components/z-icon/index";
|
|
4
|
+
import { BUTTON_ICONS, FILLED_ICONS, LEGACY_ICONS, STROKE_ICONS } from "../../src/constants/iconset";
|
|
5
|
+
import "./index.stories.css";
|
|
6
|
+
export default {
|
|
7
|
+
title: "Iconset",
|
|
8
|
+
tags: ["!autodocs"],
|
|
9
|
+
};
|
|
10
|
+
export const Iconset = {
|
|
11
|
+
render: () => html `<div class="icons-list">
|
|
12
|
+
${[STROKE_ICONS, FILLED_ICONS, BUTTON_ICONS, LEGACY_ICONS].map((iconsGroup, index) => html ` <z-accordion
|
|
13
|
+
open
|
|
14
|
+
shadow
|
|
15
|
+
highlight=${true}
|
|
16
|
+
variant="background"
|
|
17
|
+
label="${["Stroke icons", "Filled icons", "Button icons", "Legacy icon names"][index]} - (${Object.keys(iconsGroup).length})"
|
|
18
|
+
>
|
|
19
|
+
<ol class="icons-container">
|
|
20
|
+
${Object.keys(iconsGroup)
|
|
21
|
+
.sort()
|
|
22
|
+
.map((iconName) => html `
|
|
23
|
+
<li class="icon-box">
|
|
24
|
+
<z-icon name=${iconName}></z-icon>
|
|
25
|
+
<div class="icon-name">${iconName}</div>
|
|
26
|
+
</li>
|
|
27
|
+
`)}
|
|
28
|
+
</ol>
|
|
29
|
+
</z-accordion>`)}
|
|
30
|
+
</div>`,
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=index.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.stories.js","sourceRoot":"","sources":["../../../docs/iconset/index.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAC;AACzB,OAAO,wCAAwC,CAAC;AAChD,OAAO,mCAAmC,CAAC;AAC3C,OAAO,EAAC,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAC,MAAM,6BAA6B,CAAC;AACnG,OAAO,qBAAqB,CAAC;AAE7B,eAAe;IACb,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,CAAC,WAAW,CAAC;CACL,CAAC;AAEjB,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,MAAM,EAAE,GAAG,EAAE,CACX,IAAI,CAAA;QACA,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,GAAG,CAC5D,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE,CACpB,IAAI,CAAA;;;wBAGU,IAAI;;qBAEP,CAAC,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,mBAAmB,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,IAAI,CACrG,UAAU,CACX,CAAC,MAAM;;;gBAGJ,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;SACtB,IAAI,EAAE;SACN,GAAG,CACF,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAA;;qCAEC,QAAQ;+CACE,QAAQ;;mBAEpC,CACF;;yBAEQ,CAClB;WACI;CACS,CAAC","sourcesContent":["import {Meta, StoryObj} from \"@storybook/web-components\";\nimport {html} from \"lit\";\nimport \"../../src/components/z-accordion/index\";\nimport \"../../src/components/z-icon/index\";\nimport {BUTTON_ICONS, FILLED_ICONS, LEGACY_ICONS, STROKE_ICONS} from \"../../src/constants/iconset\";\nimport \"./index.stories.css\";\n\nexport default {\n title: \"Iconset\",\n tags: [\"!autodocs\"],\n} satisfies Meta;\n\nexport const Iconset = {\n render: () =>\n html`<div class=\"icons-list\">\n ${[STROKE_ICONS, FILLED_ICONS, BUTTON_ICONS, LEGACY_ICONS].map(\n (iconsGroup, index) =>\n html` <z-accordion\n open\n shadow\n highlight=${true}\n variant=\"background\"\n label=\"${[\"Stroke icons\", \"Filled icons\", \"Button icons\", \"Legacy icon names\"][index]} - (${Object.keys(\n iconsGroup\n ).length})\"\n >\n <ol class=\"icons-container\">\n ${Object.keys(iconsGroup)\n .sort()\n .map(\n (iconName) => html`\n <li class=\"icon-box\">\n <z-icon name=${iconName}></z-icon>\n <div class=\"icon-name\">${iconName}</div>\n </li>\n `\n )}\n </ol>\n </z-accordion>`\n )}\n </div>`,\n} satisfies StoryObj;\n"]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
import "../../src/components/z-section-title/index";
|
|
3
|
+
import { getPalettes, getThemesColorTokens, getThemeTokenValue } from "../../src/utils/storybook-utils";
|
|
4
|
+
import "./index.stories.css";
|
|
5
|
+
export default {
|
|
6
|
+
title: "Colors",
|
|
7
|
+
argTypes: {
|
|
8
|
+
theme: {
|
|
9
|
+
control: {
|
|
10
|
+
type: "inline-radio",
|
|
11
|
+
},
|
|
12
|
+
options: ["theme-default", "theme-black-yellow", "theme-dark"],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
args: {
|
|
16
|
+
theme: "theme-default",
|
|
17
|
+
},
|
|
18
|
+
parameters: {
|
|
19
|
+
layout: "fullscreen",
|
|
20
|
+
},
|
|
21
|
+
tags: ["!autodocs"],
|
|
22
|
+
};
|
|
23
|
+
export const Themes = {
|
|
24
|
+
render: (args) => html `
|
|
25
|
+
<div class="colors-story themes ${args.theme}">
|
|
26
|
+
<p>
|
|
27
|
+
Currently available color themes: <strong>default</strong>, <strong>black-yellow</strong>, <strong>dark</strong>
|
|
28
|
+
</p>
|
|
29
|
+
<p>On this page you can see the value of the color tokens for each theme, by switching it from the controls.</p>
|
|
30
|
+
<div class="tokens-container">
|
|
31
|
+
<z-section-title divider-position="after">
|
|
32
|
+
<div slot="primary-title">Color tokens</div>
|
|
33
|
+
</z-section-title>
|
|
34
|
+
<ul>
|
|
35
|
+
${getThemesColorTokens()
|
|
36
|
+
.sort()
|
|
37
|
+
.map((token) => {
|
|
38
|
+
var _a;
|
|
39
|
+
return html `
|
|
40
|
+
<li>
|
|
41
|
+
<span class="token-name">${token}</span>
|
|
42
|
+
<div class="color">
|
|
43
|
+
<div
|
|
44
|
+
class="color-box"
|
|
45
|
+
style="background-color: var(${token})"
|
|
46
|
+
></div>
|
|
47
|
+
<div class="interactive-2">
|
|
48
|
+
${(_a = getThemeTokenValue(args.theme, token)) !== null && _a !== void 0 ? _a : getComputedStyle(document.documentElement).getPropertyValue(token)}
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</li>
|
|
52
|
+
`;
|
|
53
|
+
})}
|
|
54
|
+
</ul>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
`,
|
|
58
|
+
};
|
|
59
|
+
const palettes = getPalettes();
|
|
60
|
+
export const Palettes = {
|
|
61
|
+
render: () => html `
|
|
62
|
+
<div class="colors-story palettes">
|
|
63
|
+
${Object.keys(palettes).map((paletteName) => html `<div class="tokens-container">
|
|
64
|
+
<z-section-title
|
|
65
|
+
divider-position="after"
|
|
66
|
+
style="--z-section-title--divider-color: var(${palettes[paletteName].find((token) => token.includes("500"))})"
|
|
67
|
+
>
|
|
68
|
+
<div slot="primary-title">${paletteName}</div>
|
|
69
|
+
</z-section-title>
|
|
70
|
+
<ul>
|
|
71
|
+
${palettes[paletteName].map((token) => html `
|
|
72
|
+
<li>
|
|
73
|
+
<span class="token-name">${token}</span>
|
|
74
|
+
<div class="color">
|
|
75
|
+
<div
|
|
76
|
+
class="color-box"
|
|
77
|
+
style="background-color: var(${token})"
|
|
78
|
+
></div>
|
|
79
|
+
<div class="interactive-2">
|
|
80
|
+
${getComputedStyle(document.documentElement).getPropertyValue(token)}
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
</li>
|
|
84
|
+
`)}
|
|
85
|
+
</ul>
|
|
86
|
+
</div>`)}
|
|
87
|
+
</div>
|
|
88
|
+
`,
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=index.stories.js.map
|
|
@@ -0,0 +1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Q,CAAC,CAAC,GAAG,CACzB,CAAC,WAAW,EAAE,EAAE,CACd,IAAI,CAAA;;;6DAG+C,QAAQ,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAClF,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CACtB;;0CAE2B,WAAW;;;gBAGrC,QAAQ,CAAC,WAAW,CAAC,CAAC,GAAG,CACzB,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAA;;+CAEgB,KAAK;;;;uDAIG,KAAK;;;0BAGlC,gBAAgB,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC;;;;iBAI3E,CACF;;iBAEE,CACV;;GAEJ;CACiB,CAAC","sourcesContent":["import {StoryObj} from \"@storybook/web-components\";\nimport {html} from \"lit\";\nimport \"../../src/components/z-section-title/index\";\nimport {getPalettes, getThemesColorTokens, getThemeTokenValue} from \"../../src/utils/storybook-utils\";\nimport \"./index.stories.css\";\n\nexport default {\n title: \"Colors\",\n argTypes: {\n theme: {\n control: {\n type: \"inline-radio\",\n },\n options: [\"theme-default\", \"theme-black-yellow\", \"theme-dark\"],\n },\n },\n args: {\n theme: \"theme-default\",\n },\n parameters: {\n layout: \"fullscreen\",\n },\n tags: [\"!autodocs\"],\n};\n\nexport const Themes = {\n render: (args) => html`\n <div class=\"colors-story themes ${args.theme}\">\n <p>\n Currently available color themes: <strong>default</strong>, <strong>black-yellow</strong>, <strong>dark</strong>\n </p>\n <p>On this page you can see the value of the color tokens for each theme, by switching it from the controls.</p>\n <div class=\"tokens-container\">\n <z-section-title divider-position=\"after\">\n <div slot=\"primary-title\">Color tokens</div>\n </z-section-title>\n <ul>\n ${getThemesColorTokens()\n .sort()\n .map(\n (token) => html`\n <li>\n <span class=\"token-name\">${token}</span>\n <div class=\"color\">\n <div\n class=\"color-box\"\n style=\"background-color: var(${token})\"\n ></div>\n <div class=\"interactive-2\">\n ${getThemeTokenValue(args.theme, token) ??\n getComputedStyle(document.documentElement).getPropertyValue(token)}\n </div>\n </div>\n </li>\n `\n )}\n </ul>\n </div>\n </div>\n `,\n} satisfies StoryObj;\n\nconst palettes = getPalettes();\n\nexport const Palettes = {\n render: () => html`\n <div class=\"colors-story palettes\">\n ${Object.keys(palettes).map(\n (paletteName) =>\n html`<div class=\"tokens-container\">\n <z-section-title\n divider-position=\"after\"\n style=\"--z-section-title--divider-color: var(${palettes[paletteName].find((token) =>\n token.includes(\"500\")\n )})\"\n >\n <div slot=\"primary-title\">${paletteName}</div>\n </z-section-title>\n <ul>\n ${palettes[paletteName].map(\n (token) => html`\n <li>\n <span class=\"token-name\">${token}</span>\n <div class=\"color\">\n <div\n class=\"color-box\"\n style=\"background-color: var(${token})\"\n ></div>\n <div class=\"interactive-2\">\n ${getComputedStyle(document.documentElement).getPropertyValue(token)}\n </div>\n </div>\n </li>\n `\n )}\n </ul>\n </div>`\n )}\n </div>\n `,\n} satisfies StoryObj;\n"]}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
import "./index.stories.css";
|
|
3
|
+
/**
|
|
4
|
+
* The typographic styles are based on the `IBM Plex` font family.
|
|
5
|
+
* Some CSS classes and props are provided to apply the typographic styles:
|
|
6
|
+
* - a set of CSS custom props for font sizes and font weights
|
|
7
|
+
* - a set of classes for headings, body text, and interactive text
|
|
8
|
+
* - a set of classes and CSS custom props for section titles
|
|
9
|
+
*/
|
|
10
|
+
export default {
|
|
11
|
+
title: "Typography",
|
|
12
|
+
argTypes: {
|
|
13
|
+
fontFamily: {
|
|
14
|
+
options: ["--font-family-sans", "--font-family-serif"],
|
|
15
|
+
control: { type: "inline-radio" },
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
args: {
|
|
19
|
+
fontFamily: "--font-family-sans",
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
const sampleText = "The quick brown fox jumps over the lazy dog";
|
|
23
|
+
const scaleProps = [
|
|
24
|
+
"--font-size-1",
|
|
25
|
+
"--font-size-2",
|
|
26
|
+
"--font-size-3",
|
|
27
|
+
"--font-size-4",
|
|
28
|
+
"--font-size-5",
|
|
29
|
+
"--font-size-6",
|
|
30
|
+
"--font-size-7",
|
|
31
|
+
"--font-size-8",
|
|
32
|
+
"--font-size-9",
|
|
33
|
+
"--font-size-10",
|
|
34
|
+
"--font-size-11",
|
|
35
|
+
"--font-size-12",
|
|
36
|
+
"--font-size-13",
|
|
37
|
+
"--font-size-14",
|
|
38
|
+
"--font-size-15",
|
|
39
|
+
"--font-size-16",
|
|
40
|
+
"--font-size-17",
|
|
41
|
+
];
|
|
42
|
+
export const TypeScale = {
|
|
43
|
+
parameters: {
|
|
44
|
+
docs: {
|
|
45
|
+
story: {
|
|
46
|
+
inline: false,
|
|
47
|
+
height: "300px",
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
argTypes: {
|
|
52
|
+
fontWeight: {
|
|
53
|
+
options: ["--font-lt", "--font-rg", "--font-sb", "--font-bd"],
|
|
54
|
+
control: { type: "inline-radio" },
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
args: {
|
|
58
|
+
fontWeight: "--font-rg",
|
|
59
|
+
},
|
|
60
|
+
render: (args) => html `<div class="type-scale">
|
|
61
|
+
${scaleProps.map((prop) => html `
|
|
62
|
+
<span class="body-5-sb">${prop}</span>
|
|
63
|
+
<span class="body-5"
|
|
64
|
+
>${parseFloat(getComputedStyle(document.documentElement).getPropertyValue(prop)) *
|
|
65
|
+
parseFloat(getComputedStyle(document.documentElement).getPropertyValue("font-size"))}px</span
|
|
66
|
+
>
|
|
67
|
+
<span
|
|
68
|
+
class="sample-text"
|
|
69
|
+
style="font-size: var(${prop}); font-family: var(${args.fontFamily}); font-weight: var(${args.fontWeight})"
|
|
70
|
+
>${sampleText}</span
|
|
71
|
+
>
|
|
72
|
+
`)}
|
|
73
|
+
</div>`,
|
|
74
|
+
};
|
|
75
|
+
const headingLevels = 4;
|
|
76
|
+
const bodyLevels = 5;
|
|
77
|
+
const interactiveLevels = 3;
|
|
78
|
+
const sectionTitleLevels = 6;
|
|
79
|
+
const getWeightSuffix = (weight) => (weight ? `-${weight}` : "");
|
|
80
|
+
/**
|
|
81
|
+
* `.heading-1` and `.heading-2` classes automatically scale in size starting from desktop viewport.
|
|
82
|
+
* Typography classes (except for `helper`) can also be used with a viewport prefix (`mobile`, `tablet`, `desktop`, `wide`)
|
|
83
|
+
* to apply the styles only on specific viewport sizes.
|
|
84
|
+
* For example:
|
|
85
|
+
*
|
|
86
|
+
* ```
|
|
87
|
+
* <p class="mobile-body-3 tablet-body-2 body-1">Lorem ipsum...</p>
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* will apply the `body-3` style on mobile, `body-2` on tablet, and `body-1` on desktop and wide viewports.
|
|
91
|
+
*
|
|
92
|
+
* Section titles are also available as CSS custom properties:
|
|
93
|
+
* those properties are meant to be used with the "font" shorthand property. For example:
|
|
94
|
+
*
|
|
95
|
+
* ```
|
|
96
|
+
* h4 {
|
|
97
|
+
* font: var(--section-title-4);
|
|
98
|
+
* }
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export const TypographyClasses = {
|
|
102
|
+
argTypes: {
|
|
103
|
+
headingWeight: {
|
|
104
|
+
options: ["lt", null, "sb"],
|
|
105
|
+
control: {
|
|
106
|
+
type: "inline-radio",
|
|
107
|
+
labels: {
|
|
108
|
+
lt: "Light",
|
|
109
|
+
null: "Regular",
|
|
110
|
+
sb: "Semibold",
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
fontWeight: {
|
|
115
|
+
options: [null, "sb"],
|
|
116
|
+
control: {
|
|
117
|
+
type: "inline-radio",
|
|
118
|
+
labels: {
|
|
119
|
+
null: "Regular",
|
|
120
|
+
sb: "Semibold",
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
args: {
|
|
126
|
+
headingWeight: null,
|
|
127
|
+
fontWeight: null,
|
|
128
|
+
},
|
|
129
|
+
render: (args) => html `<div class="typography-classes">
|
|
130
|
+
<div class="section-title-classes">
|
|
131
|
+
${Array.from({ length: sectionTitleLevels }, (_, i) => i + 1).map((level) => html `<div class="typography-group">
|
|
132
|
+
<div class="section-title-${level}">Section title ${level}</div>
|
|
133
|
+
<div class="body-5-sb">.section-title-${level} / --section-title-${level}</div>
|
|
134
|
+
</div>`)}
|
|
135
|
+
</div>
|
|
136
|
+
<div class="heading-classes">
|
|
137
|
+
${Array.from({ length: headingLevels }, (_, i) => i + 1).map((level) => html `
|
|
138
|
+
<div class="typography-group">
|
|
139
|
+
<div
|
|
140
|
+
class="heading-${level}${getWeightSuffix(args.headingWeight)}"
|
|
141
|
+
style="font-family: var(${args.fontFamily})"
|
|
142
|
+
>
|
|
143
|
+
Heading ${level}
|
|
144
|
+
</div>
|
|
145
|
+
<div class="body-5-sb">.heading-${level}${getWeightSuffix(args.headingWeight)}</div>
|
|
146
|
+
</div>
|
|
147
|
+
`)}
|
|
148
|
+
</div>
|
|
149
|
+
<div class="body-classes">
|
|
150
|
+
${Array.from({ length: bodyLevels }, (_, i) => i + 1).map((level) => html `
|
|
151
|
+
<div class="typography-group">
|
|
152
|
+
<div
|
|
153
|
+
class="body-${level}${getWeightSuffix(args.fontWeight)}"
|
|
154
|
+
style="font-family: var(${args.fontFamily})"
|
|
155
|
+
>
|
|
156
|
+
Body ${level}
|
|
157
|
+
</div>
|
|
158
|
+
<div class="body-5-sb">.body-${level}${getWeightSuffix(args.fontWeight)}</div>
|
|
159
|
+
</div>
|
|
160
|
+
`)}
|
|
161
|
+
</div>
|
|
162
|
+
<div class="interactive-classes">
|
|
163
|
+
${Array.from({ length: interactiveLevels }, (_, i) => i + 1).map((level) => html `<div class="typography-group">
|
|
164
|
+
<div
|
|
165
|
+
class="interactive-${level}${getWeightSuffix(args.fontWeight)}"
|
|
166
|
+
style="font-family: var(${args.fontFamily})"
|
|
167
|
+
>
|
|
168
|
+
Interactive ${level}
|
|
169
|
+
</div>
|
|
170
|
+
<div class="body-5-sb">.interactive-${level}${getWeightSuffix(args.fontWeight)}</div>
|
|
171
|
+
</div>`)}
|
|
172
|
+
</div>
|
|
173
|
+
<div class="helper-classes">
|
|
174
|
+
<div class="typography-group">
|
|
175
|
+
<div
|
|
176
|
+
class="helper${getWeightSuffix(args.fontWeight)}"
|
|
177
|
+
style="font-family: var(${args.fontFamily})"
|
|
178
|
+
>
|
|
179
|
+
Helper
|
|
180
|
+
</div>
|
|
181
|
+
<div class="body-5-sb">.helper${getWeightSuffix(args.fontWeight)}</div>
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
</div> `,
|
|
185
|
+
};
|
|
186
|
+
//# sourceMappingURL=index.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.stories.js","sourceRoot":"","sources":["../../../docs/typography/index.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAC;AACzB,OAAO,qBAAqB,CAAC;AAE7B;;;;;;GAMG;AACH,eAAe;IACb,KAAK,EAAE,YAAY;IACnB,QAAQ,EAAE;QACR,UAAU,EAAE;YACV,OAAO,EAAE,CAAC,oBAAoB,EAAE,qBAAqB,CAAC;YACtD,OAAO,EAAE,EAAC,IAAI,EAAE,cAAc,EAAC;SAChC;KACF;IACD,IAAI,EAAE;QACJ,UAAU,EAAE,oBAAoB;KACjC;CACa,CAAC;AAEjB,MAAM,UAAU,GAAG,6CAA6C,CAAC;AACjE,MAAM,UAAU,GAAG;IACjB,eAAe;IACf,eAAe;IACf,eAAe;IACf,eAAe;IACf,eAAe;IACf,eAAe;IACf,eAAe;IACf,eAAe;IACf,eAAe;IACf,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,g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CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CACrD,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAA;;;8BAGK,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC;0CAC5B,IAAI,CAAC,UAAU;;uBAElC,KAAK;;6CAEiB,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC;;WAE1E,CACF;;;UAGC,KAAK,CAAC,IAAI,CAAC,EAAC,MAAM,EAAE,iBAAiB,EAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAC5D,CAAC,KAAK,EAAE,EAAE,CACR,IAAI,CAAA;;qCAEqB,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC;0CACnC,IAAI,CAAC,UAAU;;8BAE3B,KAAK;;oDAEiB,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC;mBACzE,CACV;;;;;2BAKkB,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC;sCACrB,IAAI,CAAC,UAAU;;;;0CAIX,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC;;;YAG9D;CACQ,CAAC","sourcesContent":["import {Meta, StoryObj} from \"@storybook/web-components\";\nimport {html} from \"lit\";\nimport \"./index.stories.css\";\n\n/**\n * The typographic styles are based on the `IBM Plex` font family.\n * Some CSS classes and props are provided to apply the typographic styles:\n * - a set of CSS custom props for font sizes and font weights\n * - a set of classes for headings, body text, and interactive text\n * - a set of classes and CSS custom props for section titles\n */\nexport default {\n title: \"Typography\",\n argTypes: {\n fontFamily: {\n options: [\"--font-family-sans\", \"--font-family-serif\"],\n control: {type: \"inline-radio\"},\n },\n },\n args: {\n fontFamily: \"--font-family-sans\",\n },\n} satisfies Meta;\n\nconst sampleText = \"The quick brown fox jumps over the lazy dog\";\nconst scaleProps = [\n \"--font-size-1\",\n \"--font-size-2\",\n \"--font-size-3\",\n \"--font-size-4\",\n \"--font-size-5\",\n \"--font-size-6\",\n \"--font-size-7\",\n \"--font-size-8\",\n \"--font-size-9\",\n \"--font-size-10\",\n \"--font-size-11\",\n \"--font-size-12\",\n \"--font-size-13\",\n \"--font-size-14\",\n \"--font-size-15\",\n \"--font-size-16\",\n \"--font-size-17\",\n];\n\nexport const TypeScale = {\n parameters: {\n docs: {\n story: {\n inline: false,\n height: \"300px\",\n },\n },\n },\n argTypes: {\n fontWeight: {\n options: [\"--font-lt\", \"--font-rg\", \"--font-sb\", \"--font-bd\"],\n control: {type: \"inline-radio\"},\n },\n },\n args: {\n fontWeight: \"--font-rg\",\n },\n render: (args) =>\n html`<div class=\"type-scale\">\n ${scaleProps.map(\n (prop) => html`\n <span class=\"body-5-sb\">${prop}</span>\n <span class=\"body-5\"\n >${parseFloat(getComputedStyle(document.documentElement).getPropertyValue(prop)) *\n parseFloat(getComputedStyle(document.documentElement).getPropertyValue(\"font-size\"))}px</span\n >\n <span\n class=\"sample-text\"\n style=\"font-size: var(${prop}); font-family: var(${args.fontFamily}); font-weight: var(${args.fontWeight})\"\n >${sampleText}</span\n >\n `\n )}\n </div>`,\n} satisfies StoryObj;\n\nconst headingLevels = 4;\nconst bodyLevels = 5;\nconst interactiveLevels = 3;\nconst sectionTitleLevels = 6;\nconst getWeightSuffix = (weight: string | null): string => (weight ? `-${weight}` : \"\");\n\n/**\n * `.heading-1` and `.heading-2` classes automatically scale in size starting from desktop viewport.\n * Typography classes (except for `helper`) can also be used with a viewport prefix (`mobile`, `tablet`, `desktop`, `wide`)\n * to apply the styles only on specific viewport sizes.\n * For example:\n *\n * ```\n * <p class=\"mobile-body-3 tablet-body-2 body-1\">Lorem ipsum...</p>\n * ```\n *\n * will apply the `body-3` style on mobile, `body-2` on tablet, and `body-1` on desktop and wide viewports.\n *\n * Section titles are also available as CSS custom properties:\n * those properties are meant to be used with the \"font\" shorthand property. For example:\n *\n * ```\n * h4 {\n * font: var(--section-title-4);\n * }\n * ```\n */\nexport const TypographyClasses = {\n argTypes: {\n headingWeight: {\n options: [\"lt\", null, \"sb\"],\n control: {\n type: \"inline-radio\",\n labels: {\n lt: \"Light\",\n null: \"Regular\",\n sb: \"Semibold\",\n },\n },\n },\n fontWeight: {\n options: [null, \"sb\"],\n control: {\n type: \"inline-radio\",\n labels: {\n null: \"Regular\",\n sb: \"Semibold\",\n },\n },\n },\n },\n args: {\n headingWeight: null,\n fontWeight: null,\n },\n render: (args) =>\n html`<div class=\"typography-classes\">\n <div class=\"section-title-classes\">\n ${Array.from({length: sectionTitleLevels}, (_, i) => i + 1).map(\n (level) =>\n html`<div class=\"typography-group\">\n <div class=\"section-title-${level}\">Section title ${level}</div>\n <div class=\"body-5-sb\">.section-title-${level} / --section-title-${level}</div>\n </div>`\n )}\n </div>\n <div class=\"heading-classes\">\n ${Array.from({length: headingLevels}, (_, i) => i + 1).map(\n (level) => html`\n <div class=\"typography-group\">\n <div\n class=\"heading-${level}${getWeightSuffix(args.headingWeight)}\"\n style=\"font-family: var(${args.fontFamily})\"\n >\n Heading ${level}\n </div>\n <div class=\"body-5-sb\">.heading-${level}${getWeightSuffix(args.headingWeight)}</div>\n </div>\n `\n )}\n </div>\n <div class=\"body-classes\">\n ${Array.from({length: bodyLevels}, (_, i) => i + 1).map(\n (level) => html`\n <div class=\"typography-group\">\n <div\n class=\"body-${level}${getWeightSuffix(args.fontWeight)}\"\n style=\"font-family: var(${args.fontFamily})\"\n >\n Body ${level}\n </div>\n <div class=\"body-5-sb\">.body-${level}${getWeightSuffix(args.fontWeight)}</div>\n </div>\n `\n )}\n </div>\n <div class=\"interactive-classes\">\n ${Array.from({length: interactiveLevels}, (_, i) => i + 1).map(\n (level) =>\n html`<div class=\"typography-group\">\n <div\n class=\"interactive-${level}${getWeightSuffix(args.fontWeight)}\"\n style=\"font-family: var(${args.fontFamily})\"\n >\n Interactive ${level}\n </div>\n <div class=\"body-5-sb\">.interactive-${level}${getWeightSuffix(args.fontWeight)}</div>\n </div>`\n )}\n </div>\n <div class=\"helper-classes\">\n <div class=\"typography-group\">\n <div\n class=\"helper${getWeightSuffix(args.fontWeight)}\"\n style=\"font-family: var(${args.fontFamily})\"\n >\n Helper\n </div>\n <div class=\"body-5-sb\">.helper${getWeightSuffix(args.fontWeight)}</div>\n </div>\n </div>\n </div> `,\n} satisfies StoryObj;\n"]}
|