@tmorrow/cre8-wc 2.0.6 → 2.0.8
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/a2ui/catalog +5 -5
- package/a2ui/catalog-kg.json +156 -20
- package/a2ui/catalog.json +394 -35
- package/a2ui/catalog.svg +2445 -2445
- package/a2ui/examples/compound-families.json +298 -0
- package/a2ui/examples/llm-observability.json +678 -650
- package/a2ui/generate-catalog.mjs +116 -3
- package/a2ui/inert-props.json +32 -0
- package/a2ui/render-audit.mjs +294 -0
- package/a2ui/renderer.d.ts +2 -1
- package/a2ui/renderer.js +1 -1
- package/a2ui/renderer.ts +1 -1
- package/a2ui/smoke-test.mjs +3 -3
- package/a2ui/stream/diff-test.mjs +299 -0
- package/a2ui/stream/diff.d.ts +28 -0
- package/a2ui/stream/diff.js +130 -0
- package/a2ui/stream/diff.ts +145 -0
- package/a2ui/stream/index.d.ts +11 -0
- package/a2ui/stream/index.js +11 -0
- package/a2ui/stream/index.ts +43 -0
- package/a2ui/stream/model.d.ts +66 -0
- package/a2ui/stream/model.js +429 -0
- package/a2ui/stream/model.ts +472 -0
- package/a2ui/stream/pointer.d.ts +34 -0
- package/a2ui/stream/pointer.js +146 -0
- package/a2ui/stream/pointer.ts +147 -0
- package/a2ui/stream/renderer.d.ts +51 -0
- package/a2ui/stream/renderer.js +282 -0
- package/a2ui/stream/renderer.ts +291 -0
- package/a2ui/stream/stream-test.mjs +592 -0
- package/a2ui/stream/types.d.ts +173 -0
- package/a2ui/stream/types.js +17 -0
- package/a2ui/stream/types.ts +127 -0
- package/cdn/cre8-wc.esm.js +3528 -3227
- package/cdn/cre8-wc.esm.js.map +1 -1
- package/cdn/cre8-wc.min.js +290 -290
- package/cdn/cre8-wc.min.js.map +1 -1
- package/dist/assets/{Changelog-Documentation-BguNswiM.js → Changelog-Documentation-CeOetLxK.js} +1 -1
- package/dist/assets/{Code-Guidelines-BM3dZyzL.js → Code-Guidelines-BjdezAjj.js} +1 -1
- package/dist/assets/{Color-6AOWCN3U-C4AEGNk3.js → Color-6AOWCN3U-DPFGZitI.js} +1 -1
- package/dist/assets/{Contributing-Guidelines-DZURVehh.js → Contributing-Guidelines-B1M2V1hW.js} +1 -1
- package/dist/assets/{DocsRenderer-JROSPFPF-DeZmCI9u.js → DocsRenderer-JROSPFPF-BBy8KWNl.js} +1 -1
- package/dist/assets/{Tokens-Documentation-ZecGbtQg.js → Tokens-Documentation-CdTxFDLe.js} +1 -1
- package/dist/assets/{WithTooltip-7X4HQR7L-2Hfrkir-.js → WithTooltip-7X4HQR7L-DZzTNMQ7.js} +1 -1
- package/dist/assets/{accordion-item.stories-D-MjrX5G.js → accordion-item.stories-Bl26JlHp.js} +1 -9
- package/dist/assets/{accordion.stories-icgNa1dl.js → accordion.stories-DjoLApQw.js} +3 -11
- package/dist/assets/{alert.stories-BzDaXtj-.js → alert.stories-pO1y3YCQ.js} +15 -31
- package/dist/assets/{badge-C5wOWgyg.js → badge-BTxW3bN2.js} +3 -11
- package/dist/assets/{badge.stories-5GfB4jVI.js → badge.stories-vqh63RJ2.js} +1 -1
- package/dist/assets/{band.stories-DhXaP_kL.js → band.stories-CjKRppSb.js} +1 -9
- package/dist/assets/{blocks-DhUVut8Z.js → blocks-1be_-L6v.js} +5 -5
- package/dist/assets/{breadcrumbs.stories-CrPUBVk1.js → breadcrumbs.stories-Doyfy3V9.js} +2 -18
- package/dist/assets/{button-CJL8yzAT.js → button-CgaWukz0.js} +1 -9
- package/dist/assets/{button-group-BgwgtSFC.js → button-group-G7qN4MwM.js} +1 -9
- package/dist/assets/{button-group.stories-W-07gO63.js → button-group.stories-cL3Kay6M.js} +1 -1
- package/dist/assets/{button.stories-BPzJ-sCv.js → button.stories-C9HSpxWb.js} +6 -6
- package/dist/assets/{card.stories-mlFGY2Xn.js → card.stories-BbU8YymD.js} +3 -11
- package/dist/assets/{chart.stories-C8yuHHeK.js → chart.stories-BL4FxIA_.js} +1 -1
- package/dist/assets/{checkbox-field-item-iHcdmTNw.js → checkbox-field-item-DIMHcWM0.js} +1 -9
- package/dist/assets/{checkbox-field-item.stories-D1aVLDXn.js → checkbox-field-item.stories-XbB4x_lO.js} +1 -1
- package/dist/assets/{checkbox-field.stories-BoVB2jCx.js → checkbox-field.stories-YnqFUI4K.js} +2 -10
- package/dist/assets/{cre8-element-DfmMtHJO.js → cre8-element-B35i4Lyg.js} +1 -1
- package/dist/assets/{cre8-form-element-bQpK8UYN.js → cre8-form-element-Cfc5VeYV.js} +1 -1
- package/dist/assets/{danger-button.stories-Cb4ljnhQ.js → danger-button.stories-xh25hmfd.js} +1 -9
- package/dist/assets/{date-picker.stories-Cje3qk8D.js → date-picker.stories-DD_ctzEF.js} +1 -49
- package/dist/assets/{divider-B_PXBGWD.js → divider-xZ2KARHf.js} +2 -10
- package/dist/assets/{divider.stories-CtfeBqVV.js → divider.stories-Bk9oF-OV.js} +1 -1
- package/dist/assets/{dropdown-Cgwne34I.js → dropdown-BEP5x3CW.js} +6 -22
- package/dist/assets/{dropdown-item.stories-pXkDLRuv.js → dropdown-item.stories-Iaw_UrEP.js} +1 -1
- package/dist/assets/{dropdown.stories-DZnmHieY.js → dropdown.stories-B0OlKD7h.js} +1 -1
- package/dist/assets/{example-drug-card.stories-DTzLXTFx.js → example-drug-card.stories-Bp5JIeE_.js} +1 -1
- package/dist/assets/{f-po-C2WpbOFJ.js → f-po-BdPzDRD-.js} +1 -1
- package/dist/assets/{feature.stories-DffXdJch.js → feature.stories-DYE1Js70.js} +1 -9
- package/dist/assets/{field-DzYRqQb2.js → field-BpUYyRW1.js} +1 -9
- package/dist/assets/{field-note-DKXZiXLU.js → field-note-fccBckVl.js} +3 -11
- package/dist/assets/{field-note.stories-DS_0bQul.js → field-note.stories-BH9AZMbF.js} +1 -1
- package/dist/assets/{field.stories-BvXn0oG6.js → field.stories-BQPtmziK.js} +1 -1
- package/dist/assets/{footer.stories-C3ZibisU.js → footer.stories-DCWEciqD.js} +1 -9
- package/dist/assets/{form-example.stories-C-TuOeF2.js → form-example.stories-9IDC0AgX.js} +1 -1
- package/dist/assets/{formatter-L2YTDE3Q-CJVnxOUW.js → formatter-L2YTDE3Q-B9u1AOWn.js} +1 -1
- package/dist/assets/{global-nav-item-xQL7wVjY.js → global-nav-item-T4htN-yO.js} +6 -14
- package/dist/assets/{global-nav-item.stories-Dp9TE3aR.js → global-nav-item.stories-2dWRfCXv.js} +1 -1
- package/dist/assets/{global-nav.stories-B5Nk8JZ0.js → global-nav.stories-Fh1gScqg.js} +2 -10
- package/dist/assets/{grid-DYgnZBsd.js → grid-C5CKMXNe.js} +3 -19
- package/dist/assets/{grid.stories-BFiXTq2C.js → grid.stories-BLmCNdeA.js} +1 -1
- package/dist/assets/{header.stories-D1f7xhjV.js → header.stories-BkDrjJtj.js} +1 -9
- package/dist/assets/{heading-485Jz7JZ.js → heading-Dbka33DK.js} +2 -10
- package/dist/assets/{heading.stories-gPF_SmTc.js → heading.stories-Be40_bmG.js} +1 -1
- package/dist/assets/{hero.stories-BHlFNdvF.js → hero.stories-vRu7PZG9.js} +1 -9
- package/dist/assets/{icon-DeTLDzTS.js → icon-ChfRWXWy.js} +2 -10
- package/dist/assets/{icon-description-o-YaiEjK.js → icon-description-BBSwDykJ.js} +1 -1
- package/dist/assets/{icon-description.stories-BdPRvEwe.js → icon-description.stories-Cg6ekOme.js} +1 -1
- package/dist/assets/{icon.stories-BxWpqxT5.js → icon.stories-Cj4U7L5G.js} +1 -1
- package/dist/assets/if-defined-Bxnzk64Q.js +1 -0
- package/dist/assets/{iframe-dHvya7sk.js → iframe-BNJP6ovU.js} +35 -35
- package/dist/assets/{inline-alert.stories-FH0bQ0jh.js → inline-alert.stories-CygBYI02.js} +1 -9
- package/dist/assets/{layout-container.stories-D6Z6Kx78.js → layout-container.stories-TMyIJteJ.js} +2 -10
- package/dist/assets/{layout.stories-CNYuwC_r.js → layout.stories-ylRM-ANL.js} +7 -23
- package/dist/assets/{linelength-container.stories-pCRXZvxS.js → linelength-container.stories-Br2v8jXE.js} +1 -9
- package/dist/assets/{link-BpCiLxNW.js → link-CRE0Eqdo.js} +1 -9
- package/dist/assets/{link-list.stories-12vsAa1P.js → link-list.stories--y-urrVo.js} +7 -23
- package/dist/assets/{link.stories-DAoQtY4_.js → link.stories-C3WQOgkY.js} +2 -2
- package/dist/assets/{list.stories-D0N3yBIf.js → list.stories-Bd2bxkxn.js} +7 -23
- package/dist/assets/{loading-spinner-g6iJajXH.js → loading-spinner-C52KNq6y.js} +4 -12
- package/dist/assets/{loading-spinner.stories-B6_mgPxB.js → loading-spinner.stories-DPRGEeHT.js} +1 -1
- package/dist/assets/{logo.stories-BvMwN2qg.js → logo.stories-2LBqqraT.js} +1 -9
- package/dist/assets/{main.stories-pL4zefbs.js → main.stories-BQzD7iWD.js} +2 -10
- package/dist/assets/{medication-card.stories-DK1XGJic.js → medication-card.stories-Wc-hA0-s.js} +5 -5
- package/dist/assets/{medication-form.stories-Bj5dLp5S.js → medication-form.stories-DfFOCDaU.js} +1 -1
- package/dist/assets/{modal-CO0M4e_8.js → modal-CCfbY4fF.js} +1 -9
- package/dist/assets/{modal-BNu8xy08.js → modal-GglWRNJp.js} +1 -1
- package/dist/assets/{modal.stories-CHYBrq_E.js → modal.stories-CpybCs79.js} +1 -1
- package/dist/assets/{multi-select.stories-C9XXsWio.js → multi-select.stories-BhzEKRui.js} +1 -9
- package/dist/assets/{nav-container.stories-DU9fhvDu.js → nav-container.stories-Be1YlegP.js} +3 -11
- package/dist/assets/{page-header.stories-BrstKiEY.js → page-header.stories-BOVLQ0YF.js} +1 -9
- package/dist/assets/{pagination.stories-Bw2M2iOn.js → pagination.stories-D62sa_1K.js} +9 -25
- package/dist/assets/{percent-bar.stories-UQRXYUqd.js → percent-bar.stories-CYi4El7T.js} +1 -9
- package/dist/assets/{popover.stories-ZkwrRFpR.js → popover.stories-B9O8F4yv.js} +1 -9
- package/dist/assets/{primary-nav.stories-wqOKwgQn.js → primary-nav.stories-Bt-o7h45.js} +1 -17
- package/dist/assets/{progress-meter-TzASasu0.js → progress-meter-Dit59091.js} +1 -9
- package/dist/assets/{progress-meter.stories-qfJALZf8.js → progress-meter.stories-CYnOCmjo.js} +1 -1
- package/dist/assets/{progress-steps-item-KvW1d_7L.js → progress-steps-item-CWJsad0s.js} +1 -9
- package/dist/assets/{progress-steps-item.stories-uOn6tJ1W.js → progress-steps-item.stories-ePn_6bPn.js} +1 -1
- package/dist/assets/{progress-steps.stories-CKFPx8D0.js → progress-steps.stories-CblrEcXF.js} +1 -9
- package/dist/assets/{radio-field-item-CTaR50XR.js → radio-field-item-Bm-0RWPe.js} +5 -21
- package/dist/assets/{radio-field-item.stories-DQSLj8W1.js → radio-field-item.stories-y_TrTRIW.js} +1 -1
- package/dist/assets/{radio-field.stories-Btmc_Iep.js → radio-field.stories-CSWrbUrn.js} +1 -1
- package/dist/assets/{remove-tag-BSEZ7VT8.js → remove-tag-lCr57c5r.js} +1 -9
- package/dist/assets/{remove-tag.stories-diRKi7Ua.js → remove-tag.stories-CDfwCdvZ.js} +1 -1
- package/dist/assets/{request-prescription.stories-DQvra7ia.js → request-prescription.stories-O4zqokfb.js} +1 -1
- package/dist/assets/{sample-modal.stories-deE1EBfZ.js → sample-modal.stories-BZ4N2R2Z.js} +1 -1
- package/dist/assets/{section.stories-DF4mcy2O.js → section.stories-D_1InThX.js} +1 -9
- package/dist/assets/{select-tile-D-C8oSrm.js → select-tile-BqqB3ZtE.js} +2 -10
- package/dist/assets/{select-tile-list.stories-vsBQUIcl.js → select-tile-list.stories-Di4ILgV8.js} +1 -9
- package/dist/assets/{select-tile.stories-CqHzN5fc.js → select-tile.stories-D3h_6zlV.js} +6 -6
- package/dist/assets/{select.stories-8aOGxTtr.js → select.stories-BB2phP9A.js} +1 -9
- package/dist/assets/{skeleton-loader.stories-CwR2-aC5.js → skeleton-loader.stories-y4uml_kV.js} +5 -13
- package/dist/assets/{split-button.stories-CyfdrK4u.js → split-button.stories-C_82I4ME.js} +2 -10
- package/dist/assets/{spread-BPiNgQQF.js → spread-CnPic3C2.js} +1 -1
- package/dist/assets/state-DkQhleoO.js +1 -0
- package/dist/assets/{submenu.stories-CDhNzZzh.js → submenu.stories-UDtaREr1.js} +2 -18
- package/dist/assets/{syntaxhighlighter-T5IQBZDB-BzI6WxUR.js → syntaxhighlighter-T5IQBZDB-D-I_s_yD.js} +1 -1
- package/dist/assets/{table-header-CfcchoYz.js → table-header-2837i43H.js} +3 -51
- package/dist/assets/{table-object.stories-Bd5qdfMU.js → table-object.stories-D4KoI-wA.js} +1 -9
- package/dist/assets/{table.stories-DxuBe9dJ.js → table.stories-DUJDibEp.js} +1 -1
- package/dist/assets/{tabs.stories-Cpc3OHJx.js → tabs.stories-C06SngOF.js} +5 -29
- package/dist/assets/{tag-list.stories-BmyCmrTF.js → tag-list.stories-Du-IoYzu.js} +2 -10
- package/dist/assets/{tag-vQFuZneb.js → tag-oHGdclJl.js} +1 -9
- package/dist/assets/{tag.stories-DGzrNUbb.js → tag.stories-C5D5IbuK.js} +1 -1
- package/dist/assets/{tertiary-nav.stories-D4q5K-am.js → tertiary-nav.stories-B1GU8Zi4.js} +3 -19
- package/dist/assets/{text-link-4qLRIeJB.js → text-link-B3m3KEqY.js} +1 -9
- package/dist/assets/{text-link.stories-D6BRm2I5.js → text-link.stories-4O6qn82H.js} +1 -1
- package/dist/assets/{text-passage-DGaI5i2I.js → text-passage-xQVosjOr.js} +3 -19
- package/dist/assets/{text-passage.stories-DkmXVUhH.js → text-passage.stories-Da1nspwG.js} +1 -1
- package/dist/assets/{tooltip.stories-B7ADDq7o.js → tooltip.stories-DLKyyeKn.js} +6 -14
- package/dist/assets/{utility-nav.stories-ffXVvyLp.js → utility-nav.stories-B6xBFe7z.js} +5 -21
- package/dist/design-tokens/brands/cre8/css/tokens_brand.css +1 -1
- package/dist/design-tokens/core/scss/theming/component.css +1 -1
- package/dist/design-tokens/core/scss/theming/variables.css +1 -7
- package/dist/design-tokens/core/scss/theming/variables.scss +0 -11
- package/dist/icons/cre8-icons.svg +1 -1
- package/dist/iframe.html +1 -24
- package/dist/index.html +25 -77
- package/dist/project.json +1 -1
- package/lib/a2ui/renderer.d.ts +2 -1
- package/lib/a2ui/renderer.d.ts.map +1 -1
- package/lib/a2ui/renderer.js +1 -1
- package/lib/a2ui/renderer.js.map +1 -1
- package/lib/a2ui/stream/diff.d.ts +29 -0
- package/lib/a2ui/stream/diff.d.ts.map +1 -0
- package/lib/a2ui/stream/diff.js +131 -0
- package/lib/a2ui/stream/diff.js.map +1 -0
- package/lib/a2ui/stream/index.d.ts +12 -0
- package/lib/a2ui/stream/index.d.ts.map +1 -0
- package/lib/a2ui/stream/index.js +12 -0
- package/lib/a2ui/stream/index.js.map +1 -0
- package/lib/a2ui/stream/model.d.ts +67 -0
- package/lib/a2ui/stream/model.d.ts.map +1 -0
- package/lib/a2ui/stream/model.js +423 -0
- package/lib/a2ui/stream/model.js.map +1 -0
- package/lib/a2ui/stream/pointer.d.ts +35 -0
- package/lib/a2ui/stream/pointer.d.ts.map +1 -0
- package/lib/a2ui/stream/pointer.js +147 -0
- package/lib/a2ui/stream/pointer.js.map +1 -0
- package/lib/a2ui/stream/renderer.d.ts +52 -0
- package/lib/a2ui/stream/renderer.d.ts.map +1 -0
- package/lib/a2ui/stream/renderer.js +279 -0
- package/lib/a2ui/stream/renderer.js.map +1 -0
- package/lib/a2ui/stream/types.d.ts +174 -0
- package/lib/a2ui/stream/types.d.ts.map +1 -0
- package/lib/a2ui/stream/types.js +18 -0
- package/lib/a2ui/stream/types.js.map +1 -0
- package/lib/components/accordion/accordion.d.ts +15 -0
- package/lib/components/accordion/accordion.d.ts.map +1 -1
- package/lib/components/accordion/accordion.js +23 -0
- package/lib/components/accordion/accordion.js.map +1 -1
- package/lib/components/badge/badge.d.ts +5 -18
- package/lib/components/badge/badge.d.ts.map +1 -1
- package/lib/components/badge/badge.js +0 -15
- package/lib/components/badge/badge.js.map +1 -1
- package/lib/components/breadcrumbs/breadcrumbs.d.ts +14 -0
- package/lib/components/breadcrumbs/breadcrumbs.d.ts.map +1 -1
- package/lib/components/breadcrumbs/breadcrumbs.js +21 -0
- package/lib/components/breadcrumbs/breadcrumbs.js.map +1 -1
- package/lib/components/chart/chart.d.ts +3 -3
- package/lib/components/chart/chart.js +6 -6
- package/lib/components/chart/chart.js.map +1 -1
- package/lib/components/checkbox-field/checkbox-field.d.ts +19 -0
- package/lib/components/checkbox-field/checkbox-field.d.ts.map +1 -1
- package/lib/components/checkbox-field/checkbox-field.js +28 -0
- package/lib/components/checkbox-field/checkbox-field.js.map +1 -1
- package/lib/components/cre8-element.d.ts +19 -0
- package/lib/components/cre8-element.d.ts.map +1 -1
- package/lib/components/cre8-element.js +51 -2
- package/lib/components/cre8-element.js.map +1 -1
- package/lib/components/divider/divider.d.ts +1 -1
- package/lib/components/divider/divider.d.ts.map +1 -1
- package/lib/components/divider/divider.js.map +1 -1
- package/lib/components/dropdown/dropdown.d.ts +13 -0
- package/lib/components/dropdown/dropdown.d.ts.map +1 -1
- package/lib/components/dropdown/dropdown.js +19 -0
- package/lib/components/dropdown/dropdown.js.map +1 -1
- package/lib/components/dropdown-item/dropdown-item.d.ts +1 -1
- package/lib/components/dropdown-item/dropdown-item.js +2 -2
- package/lib/components/dropdown-item/dropdown-item.js.map +1 -1
- package/lib/components/heading/heading.d.ts +3 -5
- package/lib/components/heading/heading.d.ts.map +1 -1
- package/lib/components/heading/heading.js +2 -4
- package/lib/components/heading/heading.js.map +1 -1
- package/lib/components/icon/icon.d.ts +4 -4
- package/lib/components/icon/icon.js +6 -6
- package/lib/components/icon/icon.js.map +1 -1
- package/lib/components/link-list/link-list.d.ts +19 -0
- package/lib/components/link-list/link-list.d.ts.map +1 -1
- package/lib/components/link-list/link-list.js +19 -0
- package/lib/components/link-list/link-list.js.map +1 -1
- package/lib/components/list/list.d.ts +13 -0
- package/lib/components/list/list.d.ts.map +1 -1
- package/lib/components/list/list.js +15 -0
- package/lib/components/list/list.js.map +1 -1
- package/lib/components/modal/modal.d.ts +2 -2
- package/lib/components/modal/modal.js +2 -2
- package/lib/components/modal/modal.js.map +1 -1
- package/lib/components/multi-select/multi-select.d.ts +2 -2
- package/lib/components/multi-select/multi-select.js +5 -5
- package/lib/components/multi-select/multi-select.js.map +1 -1
- package/lib/components/pagination/pagination.d.ts +1 -1
- package/lib/components/pagination/pagination.js +2 -2
- package/lib/components/pagination/pagination.js.map +1 -1
- package/lib/components/percent-bar/percent-bar.d.ts +2 -0
- package/lib/components/percent-bar/percent-bar.d.ts.map +1 -1
- package/lib/components/percent-bar/percent-bar.js +3 -1
- package/lib/components/percent-bar/percent-bar.js.map +1 -1
- package/lib/components/popover/popover.d.ts +6 -7
- package/lib/components/popover/popover.d.ts.map +1 -1
- package/lib/components/popover/popover.js +4 -4
- package/lib/components/popover/popover.js.map +1 -1
- package/lib/components/progress-meter/progress-meter.d.ts +0 -8
- package/lib/components/progress-meter/progress-meter.d.ts.map +1 -1
- package/lib/components/progress-meter/progress-meter.js +0 -7
- package/lib/components/progress-meter/progress-meter.js.map +1 -1
- package/lib/components/progress-steps/progress-steps.d.ts +16 -0
- package/lib/components/progress-steps/progress-steps.d.ts.map +1 -1
- package/lib/components/progress-steps/progress-steps.js +25 -0
- package/lib/components/progress-steps/progress-steps.js.map +1 -1
- package/lib/components/progress-steps-item/progress-steps-item.d.ts +1 -3
- package/lib/components/progress-steps-item/progress-steps-item.d.ts.map +1 -1
- package/lib/components/progress-steps-item/progress-steps-item.js +0 -1
- package/lib/components/progress-steps-item/progress-steps-item.js.map +1 -1
- package/lib/components/radio-field/radio-field.d.ts +33 -0
- package/lib/components/radio-field/radio-field.d.ts.map +1 -1
- package/lib/components/radio-field/radio-field.js +62 -0
- package/lib/components/radio-field/radio-field.js.map +1 -1
- package/lib/components/remove-tag/remove-tag.d.ts +1 -1
- package/lib/components/remove-tag/remove-tag.js +3 -3
- package/lib/components/remove-tag/remove-tag.js.map +1 -1
- package/lib/components/split-button/split-button.d.ts +3 -0
- package/lib/components/split-button/split-button.d.ts.map +1 -1
- package/lib/components/split-button/split-button.js +5 -2
- package/lib/components/split-button/split-button.js.map +1 -1
- package/lib/components/tab/tab.d.ts +1 -1
- package/lib/components/tab/tab.js +3 -3
- package/lib/components/tab/tab.js.map +1 -1
- package/lib/components/table/table.d.ts +36 -0
- package/lib/components/table/table.d.ts.map +1 -1
- package/lib/components/table/table.js +55 -0
- package/lib/components/table/table.js.map +1 -1
- package/lib/components/tabs/tabs.d.ts +20 -3
- package/lib/components/tabs/tabs.d.ts.map +1 -1
- package/lib/components/tabs/tabs.js +33 -5
- package/lib/components/tabs/tabs.js.map +1 -1
- package/lib/components/tag-list/tag-list.d.ts +17 -0
- package/lib/components/tag-list/tag-list.d.ts.map +1 -1
- package/lib/components/tag-list/tag-list.js +25 -0
- package/lib/components/tag-list/tag-list.js.map +1 -1
- package/lib/components/tooltip/tooltip.d.ts +2 -2
- package/lib/components/tooltip/tooltip.js +4 -4
- package/lib/components/tooltip/tooltip.js.map +1 -1
- package/lib/components/utils/light-children.d.ts +40 -0
- package/lib/components/utils/light-children.d.ts.map +1 -0
- package/lib/components/utils/light-children.js +100 -0
- package/lib/components/utils/light-children.js.map +1 -0
- package/lib/design-tokens/brands/cre8/css/tokens_brand.css +1 -1
- package/lib/directives/if-truthy.d.ts +1 -1
- package/lib/icons/cre8-icons.svg +1 -1
- package/lib/light-children-TlEXev5S.js +39 -0
- package/lib/scripts/generate-react-wrappers.d.ts +8 -1
- package/lib/scripts/generate-react-wrappers.d.ts.map +1 -1
- package/lib/scripts/generate-react-wrappers.js +45 -1
- package/lib/scripts/generate-react-wrappers.js.map +1 -1
- package/mcp-manifest.json +163 -53
- package/package.json +11 -4
- package/react-manifest.json +154 -48
- package/dist/assets/if-defined-HKKhGupN.js +0 -1
- package/dist/assets/iframe-CWwoGI65.css +0 -1
- package/dist/assets/state-CfuknrX8.js +0 -1
- package/dist/fonts/PlusJakartaSans-Bold.woff2 +0 -0
- package/dist/fonts/PlusJakartaSans-Medium.woff2 +0 -0
- package/dist/fonts/PlusJakartaSans-Regular.woff2 +0 -0
- package/dist/fonts/PlusJakartaSans-SemiBold.woff2 +0 -0
- package/dist/logo.svg +0 -1
- package/dist/sb-addons/storybook-4/manager-bundle.js +0 -8
- /package/dist/icons/{express-scripts copy.svg → pharmacy copy.svg} +0 -0
- /package/dist/icons/{express-scripts.svg → pharmacy.svg} +0 -0
- /package/lib/icons/{express-scripts copy.svg → pharmacy copy.svg} +0 -0
- /package/lib/icons/{express-scripts.svg → pharmacy.svg} +0 -0
|
@@ -28,7 +28,7 @@ import styles from './modal.styles.js';
|
|
|
28
28
|
* @slot header - Custom header content for the modal
|
|
29
29
|
* @slot footer - Custom footer content for the modal
|
|
30
30
|
*
|
|
31
|
-
* @fires close
|
|
31
|
+
* @fires modal-close - Fires when the modal is dismissed via the close button, overlay click, or Escape key.
|
|
32
32
|
*/
|
|
33
33
|
export class Cre8Modal extends Cre8Element {
|
|
34
34
|
constructor() {
|
|
@@ -79,7 +79,7 @@ export class Cre8Modal extends Cre8Element {
|
|
|
79
79
|
handleCloseModal() {
|
|
80
80
|
this.isActive = false;
|
|
81
81
|
this.dispatch({
|
|
82
|
-
eventName: 'close
|
|
82
|
+
eventName: 'modal-close',
|
|
83
83
|
detailObj: {
|
|
84
84
|
isActive: this.isActive,
|
|
85
85
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.js","sourceRoot":"","sources":["../../../components/modal/modal.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAkB,IAAI,GAAG,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,QAAQ,MAAM,sCAAsC,CAAC;AAC5D,OAAO,gBAAgB,MAAM,wCAAwC,CAAC;AACtE,OAAO,cAAc,MAAM,6CAA6C,CAAC;AACzE,OAAO,aAAa,MAAM,qCAAqC,CAAC;AAChE,OAA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,EAAE,CAAC;2CACxB;AAgBnB;IADC,QAAQ,EAAE;yCACgD;AAM3D;IADC,QAAQ,EAAE;oDACe;AAM1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDAClB;AAMzB;IADC,QAAQ,EAAE;kDACuB;AAMlC;IADC,QAAQ,EAAE;kDACuB;AAMlC;IADC,QAAQ,EAAE;4CACO;AAwItB,IAAI,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,KAAK,SAAS,EAAE,CAAC;IACjD,cAAc,CAAC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;AACnD,CAAC","sourcesContent":["import { PropertyValues, html, } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport svgError from '@tmorrow/cre8-wc/icons/Error.svg?raw';\nimport svgWarningFilled from '@tmorrow/cre8-wc/icons/Warning.svg?raw';\nimport svgCheckCircle from '@tmorrow/cre8-wc/icons/Check_Filled.svg?raw';\nimport svgInfoFilled from '@tmorrow/cre8-wc/icons/Info.svg?raw';\nimport svgHelp from '@tmorrow/cre8-wc/icons/Help.svg?raw';\nimport svgClose from '@tmorrow/cre8-wc/icons/Close.svg?raw';\nimport { Cre8Element } from '../cre8-element';\nimport '../icon/icon.js';\nimport '@a11y/focus-trap';\nimport styles from './modal.styles.js';\n\n/**\n * Modal component should be used in all modal situations.\n * It is natuarally composable and can even have a custom header and remove the close button.\n * (note: adding `slot=\"header\"` will insert the given element into the header section of the modal,\n * same for `slot=\"footer\"` and no given slot name will inset it into the body)\n *\n * If it is desired to create a utility modal. Cre8Modal requires a status value (see props table below,\n * and a UtilityModalTitle since all utility modals have a cre8-heading)\n * @slot - The component content\n * @slot header - Custom header content for the modal\n * @slot footer - Custom footer content for the modal\n *\n * @fires close-modal - Fires when the modal is dismissed via the close button, overlay click, or Escape key.\n */\nexport class Cre8Modal extends Cre8Element {\n static styles = [styles];\n\n /**\n * Query the modal window\n */\n @query('.cre8-c-modal__window')\n _modalWindow: HTMLDivElement;\n\n /**\n * Is Active attribute\n */\n @property({ type: Boolean, reflect: true })\n isActive?: boolean;\n\n /**\n * Status Types\n * <cre8-text-passage size=\"sm\">\n * <ul>\n * <li>**default (no value)** renders a default modal</li>\n * <li>**error** renders an error modal</li>\n * <li>**warning** renders a warning modal</li>\n * <li>**success** renders a success modal</li>\n * <li>**info** renders an info modal</li>\n * <li>**help** renders an help modal</li>\n * </ul>\n * </cre8-text-passage>\n */\n @property()\n status?: 'error' | 'warning' | 'success' | 'info' | 'help';\n\n /**\n * Utility Modal Heading (String)\n */\n @property()\n utilityModalTitle: string;\n\n /**\n * Not dismissible modal\n */\n @property({ type: Boolean, reflect: true })\n notDismissible?: boolean;\n\n /**\n * Close Button Text\n */\n @property()\n closeButtonText: string = 'close';\n\n /**\n * Close Button Icon\n */\n @property()\n closeButtonIcon: string = 'close';\n\n /**\n * Modal Aria Label - This is required for accessibility and provides context of the entire modal!\n */\n @property()\n ariaLabel: string;\n\n /**\n * Handle keydown\n * 1) Close the modal when escape is hit when the user is focused within the modal\n */\n handleKeydown(e: KeyboardEvent) {\n if (e.code === 'Escape' && !this.notDismissible) {\n this.handleCloseModal(); /* 2 */\n }\n }\n\n /**\n * Handle on close\n * 1) On close, set the modal to not active and dispatch event telling the parent the modal was closed.\n */\n handleCloseModal() {\n this.isActive = false;\n this.dispatch({\n eventName: 'close-modal',\n detailObj: {\n isActive: this.isActive,\n },\n });\n }\n\n /**\n * Handle \"click outside\"\n * 1) onClick of the area around the modal window, close the modal.\n */\n\n handleOnClickOutside(e: Event) {\n const eventTarget = e.target as HTMLElement;\n if (this.isActive && this._modalWindow && eventTarget.classList.contains('cre8-c-modal') && !this.notDismissible) {\n this.handleCloseModal();\n }\n }\n\n /**\n * Lifecycle method to focus on modal\n * 1) If there is a changed property, and this.isActive === true, then focus on the modal window.\n * 2) Disable the body from scrolling behind while the modal is open.\n */\n\n updated(changedProperties: PropertyValues<this>) {\n if (this.isActive === true) {\n setTimeout(() => {\n this._modalWindow.focus();\n }, 200);\n } /* 1 */\n\n if (changedProperties.has('isActive')) {\n const body = document.querySelector('body');\n if (this.isActive) {\n body.style.overflow = 'hidden';\n } else {\n body.style.removeProperty('overflow');\n }\n } /* 2 */\n }\n\n /*\n * Maps modal icons and modal status variants to what the alt text of the related icon should be\n * see: (https://digital.#.com/patterns-and-Components/informational-display/alerts-and-notifications#query=alerts)\n * this provides the recommendated alt text of different statuses\n */\n mapStatusToIconModal = (status: string) => {\n switch (status) {\n case 'error':\n return html`<cre8-icon class=\"cre8-modal-icon\" svg=${svgError} aria-hidden='true'></cre8-icon>`;\n case 'success':\n return html`<cre8-icon class=\"cre8-modal-icon\" svg=${svgCheckCircle} aria-hidden='true'></cre8-icon>`;\n case 'warning':\n return html`<cre8-icon class=\"cre8-modal-icon\" svg=${svgWarningFilled} aria-hidden='true'></cre8-icon>`;\n case 'help':\n return html`<cre8-icon class=\"cre8-modal-icon\" svg=${svgHelp} aria-hidden='true'></cre8-icon>`;\n case 'info':\n return html`<cre8-icon class=\"cre8-modal-icon\" svg=${svgInfoFilled} aria-hidden='true'></cre8-icon>`;\n default:\n return null;\n }\n };\n\n /**\n * Lifecycle method on removal from the DOM\n * Removed body overflow and handle close (isActive set to false)\n */\n disconnectedCallback() {\n this.isActive = false;\n const body = document.querySelector('body');\n body.style.removeProperty('overflow');\n }\n\n render() {\n const componentClassNames = this.componentClassNames('cre8-c-modal', {\n 'cre8-is-active': this.isActive,\n 'cre8-c-modal--error': this.status === 'error',\n 'cre8-c-modal--warning': this.status === 'warning',\n 'cre8-c-modal--success': this.status === 'success',\n 'cre8-c-modal--info': this.status === 'info',\n 'cre8-c-modal--help': this.status === 'help',\n });\n\n return html`\n <div class=\"${componentClassNames}\" @click=\"${this.handleOnClickOutside}\" @keydown=${this.handleKeydown}>\n <focus-trap class=\"cre8-c-modal__focus-trap\" ?inactive=${!this.isActive}>\n <div class=\"cre8-c-modal__window\" role=\"dialog\" aria-label=${this.ariaLabel} tabindex=${this.isActive ? 0 : -1}>\n <div class=\"cre8-c-modal__header\">\n ${this.status\n ? html`<div class=\"cre8-c-modal__header-inner\">\n ${this.mapStatusToIconModal(this.status)}\n <cre8-heading type=\"title-large\" ?brandColor=${true}>${this.utilityModalTitle}</cre8-heading>\n </div>`\n : html`<slot name=\"header\"></slot>`}\n ${!this.notDismissible\n ? html`<cre8-button\n class=\"cre8-c-modal__close-button\"\n variant=\"tertiary\"\n svg=${svgClose}\n iconPosition=\"after\"\n ?inverted=${!this.status}\n @click=${this.handleCloseModal}\n ></cre8-button>`\n : ''}\n </div>\n <div class=\"cre8-c-modal__body\">\n <slot></slot>\n </div>\n ${this.slotNotEmpty('footer') && html`<div class=\"cre8-c-modal__footer\"><slot name=\"footer\"></slot></div>`}\n </div>\n </focus-trap>\n </div>\n`;\n }\n}\n\nif (customElements.get('cre8-modal') === undefined) {\n customElements.define('cre8-modal', Cre8Modal);\n}\n\nexport interface CloseModalEvent extends CustomEvent<{ isActive: boolean }> {\n type: 'close-modal';\n currentTarget: Cre8Modal;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-modal': Cre8Modal;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"modal.js","sourceRoot":"","sources":["../../../components/modal/modal.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAkB,IAAI,GAAG,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,QAAQ,MAAM,sCAAsC,CAAC;AAC5D,OAAO,gBAAgB,MAAM,wCAAwC,CAAC;AACtE,OAAO,cAAc,MAAM,6CAA6C,CAAC;AACzE,OAAO,aAAa,MAAM,qCAAqC,CAAC;AAChE,OAAO,OAAO,MAAM,qCAAqC,CAAC;AAC1D,OAAO,QAAQ,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,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OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDAClB;AAMzB;IADC,QAAQ,EAAE;kDACuB;AAMlC;IADC,QAAQ,EAAE;kDACuB;AAMlC;IADC,QAAQ,EAAE;4CACO;AAwItB,IAAI,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,KAAK,SAAS,EAAE,CAAC;IACjD,cAAc,CAAC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;AACnD,CAAC","sourcesContent":["import { PropertyValues, html, } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport svgError from '@tmorrow/cre8-wc/icons/Error.svg?raw';\nimport svgWarningFilled from '@tmorrow/cre8-wc/icons/Warning.svg?raw';\nimport svgCheckCircle from '@tmorrow/cre8-wc/icons/Check_Filled.svg?raw';\nimport svgInfoFilled from '@tmorrow/cre8-wc/icons/Info.svg?raw';\nimport svgHelp from '@tmorrow/cre8-wc/icons/Help.svg?raw';\nimport svgClose from '@tmorrow/cre8-wc/icons/Close.svg?raw';\nimport { Cre8Element } from '../cre8-element';\nimport '../icon/icon.js';\nimport '@a11y/focus-trap';\nimport styles from './modal.styles.js';\n\n/**\n * Modal component should be used in all modal situations.\n * It is natuarally composable and can even have a custom header and remove the close button.\n * (note: adding `slot=\"header\"` will insert the given element into the header section of the modal,\n * same for `slot=\"footer\"` and no given slot name will inset it into the body)\n *\n * If it is desired to create a utility modal. Cre8Modal requires a status value (see props table below,\n * and a UtilityModalTitle since all utility modals have a cre8-heading)\n * @slot - The component content\n * @slot header - Custom header content for the modal\n * @slot footer - Custom footer content for the modal\n *\n * @fires modal-close - Fires when the modal is dismissed via the close button, overlay click, or Escape key.\n */\nexport class Cre8Modal extends Cre8Element {\n static styles = [styles];\n\n /**\n * Query the modal window\n */\n @query('.cre8-c-modal__window')\n _modalWindow: HTMLDivElement;\n\n /**\n * Is Active attribute\n */\n @property({ type: Boolean, reflect: true })\n isActive?: boolean;\n\n /**\n * Status Types\n * <cre8-text-passage size=\"sm\">\n * <ul>\n * <li>**default (no value)** renders a default modal</li>\n * <li>**error** renders an error modal</li>\n * <li>**warning** renders a warning modal</li>\n * <li>**success** renders a success modal</li>\n * <li>**info** renders an info modal</li>\n * <li>**help** renders an help modal</li>\n * </ul>\n * </cre8-text-passage>\n */\n @property()\n status?: 'error' | 'warning' | 'success' | 'info' | 'help';\n\n /**\n * Utility Modal Heading (String)\n */\n @property()\n utilityModalTitle: string;\n\n /**\n * Not dismissible modal\n */\n @property({ type: Boolean, reflect: true })\n notDismissible?: boolean;\n\n /**\n * Close Button Text\n */\n @property()\n closeButtonText: string = 'close';\n\n /**\n * Close Button Icon\n */\n @property()\n closeButtonIcon: string = 'close';\n\n /**\n * Modal Aria Label - This is required for accessibility and provides context of the entire modal!\n */\n @property()\n ariaLabel: string;\n\n /**\n * Handle keydown\n * 1) Close the modal when escape is hit when the user is focused within the modal\n */\n handleKeydown(e: KeyboardEvent) {\n if (e.code === 'Escape' && !this.notDismissible) {\n this.handleCloseModal(); /* 2 */\n }\n }\n\n /**\n * Handle on close\n * 1) On close, set the modal to not active and dispatch event telling the parent the modal was closed.\n */\n handleCloseModal() {\n this.isActive = false;\n this.dispatch({\n eventName: 'modal-close',\n detailObj: {\n isActive: this.isActive,\n },\n });\n }\n\n /**\n * Handle \"click outside\"\n * 1) onClick of the area around the modal window, close the modal.\n */\n\n handleOnClickOutside(e: Event) {\n const eventTarget = e.target as HTMLElement;\n if (this.isActive && this._modalWindow && eventTarget.classList.contains('cre8-c-modal') && !this.notDismissible) {\n this.handleCloseModal();\n }\n }\n\n /**\n * Lifecycle method to focus on modal\n * 1) If there is a changed property, and this.isActive === true, then focus on the modal window.\n * 2) Disable the body from scrolling behind while the modal is open.\n */\n\n updated(changedProperties: PropertyValues<this>) {\n if (this.isActive === true) {\n setTimeout(() => {\n this._modalWindow.focus();\n }, 200);\n } /* 1 */\n\n if (changedProperties.has('isActive')) {\n const body = document.querySelector('body');\n if (this.isActive) {\n body.style.overflow = 'hidden';\n } else {\n body.style.removeProperty('overflow');\n }\n } /* 2 */\n }\n\n /*\n * Maps modal icons and modal status variants to what the alt text of the related icon should be\n * see: (https://digital.#.com/patterns-and-Components/informational-display/alerts-and-notifications#query=alerts)\n * this provides the recommendated alt text of different statuses\n */\n mapStatusToIconModal = (status: string) => {\n switch (status) {\n case 'error':\n return html`<cre8-icon class=\"cre8-modal-icon\" svg=${svgError} aria-hidden='true'></cre8-icon>`;\n case 'success':\n return html`<cre8-icon class=\"cre8-modal-icon\" svg=${svgCheckCircle} aria-hidden='true'></cre8-icon>`;\n case 'warning':\n return html`<cre8-icon class=\"cre8-modal-icon\" svg=${svgWarningFilled} aria-hidden='true'></cre8-icon>`;\n case 'help':\n return html`<cre8-icon class=\"cre8-modal-icon\" svg=${svgHelp} aria-hidden='true'></cre8-icon>`;\n case 'info':\n return html`<cre8-icon class=\"cre8-modal-icon\" svg=${svgInfoFilled} aria-hidden='true'></cre8-icon>`;\n default:\n return null;\n }\n };\n\n /**\n * Lifecycle method on removal from the DOM\n * Removed body overflow and handle close (isActive set to false)\n */\n disconnectedCallback() {\n this.isActive = false;\n const body = document.querySelector('body');\n body.style.removeProperty('overflow');\n }\n\n render() {\n const componentClassNames = this.componentClassNames('cre8-c-modal', {\n 'cre8-is-active': this.isActive,\n 'cre8-c-modal--error': this.status === 'error',\n 'cre8-c-modal--warning': this.status === 'warning',\n 'cre8-c-modal--success': this.status === 'success',\n 'cre8-c-modal--info': this.status === 'info',\n 'cre8-c-modal--help': this.status === 'help',\n });\n\n return html`\n <div class=\"${componentClassNames}\" @click=\"${this.handleOnClickOutside}\" @keydown=${this.handleKeydown}>\n <focus-trap class=\"cre8-c-modal__focus-trap\" ?inactive=${!this.isActive}>\n <div class=\"cre8-c-modal__window\" role=\"dialog\" aria-label=${this.ariaLabel} tabindex=${this.isActive ? 0 : -1}>\n <div class=\"cre8-c-modal__header\">\n ${this.status\n ? html`<div class=\"cre8-c-modal__header-inner\">\n ${this.mapStatusToIconModal(this.status)}\n <cre8-heading type=\"title-large\" ?brandColor=${true}>${this.utilityModalTitle}</cre8-heading>\n </div>`\n : html`<slot name=\"header\"></slot>`}\n ${!this.notDismissible\n ? html`<cre8-button\n class=\"cre8-c-modal__close-button\"\n variant=\"tertiary\"\n svg=${svgClose}\n iconPosition=\"after\"\n ?inverted=${!this.status}\n @click=${this.handleCloseModal}\n ></cre8-button>`\n : ''}\n </div>\n <div class=\"cre8-c-modal__body\">\n <slot></slot>\n </div>\n ${this.slotNotEmpty('footer') && html`<div class=\"cre8-c-modal__footer\"><slot name=\"footer\"></slot></div>`}\n </div>\n </focus-trap>\n </div>\n`;\n }\n}\n\nif (customElements.get('cre8-modal') === undefined) {\n customElements.define('cre8-modal', Cre8Modal);\n}\n\nexport interface CloseModalEvent extends CustomEvent<{ isActive: boolean }> {\n type: 'modal-close';\n currentTarget: Cre8Modal;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-modal': Cre8Modal;\n }\n}\n"]}
|
|
@@ -9,12 +9,12 @@ import '../checkbox-field-item/checkbox-field-item';
|
|
|
9
9
|
* The checkbox will always reflect the selected nature of the item and is not removed
|
|
10
10
|
* from the dropdown when clicked, the tags will be added and removed based on their state.
|
|
11
11
|
*
|
|
12
|
-
* Event `
|
|
12
|
+
* Event `multi-select-change` emits whenever a tag is added or remove from the list and the
|
|
13
13
|
* current list after the change is given in the detail.
|
|
14
14
|
*
|
|
15
15
|
* @slot fieldNote - Container for optional field note content
|
|
16
16
|
*
|
|
17
|
-
* @fires
|
|
17
|
+
* @fires multi-select-change - Fires when a tag is added or removed. `event.detail.selectedItems` is the current selection.
|
|
18
18
|
*/
|
|
19
19
|
export declare class Cre8MultiSelect extends Cre8Element {
|
|
20
20
|
static styles: import("lit").CSSResult[];
|
|
@@ -26,12 +26,12 @@ import '../checkbox-field-item/checkbox-field-item';
|
|
|
26
26
|
* The checkbox will always reflect the selected nature of the item and is not removed
|
|
27
27
|
* from the dropdown when clicked, the tags will be added and removed based on their state.
|
|
28
28
|
*
|
|
29
|
-
* Event `
|
|
29
|
+
* Event `multi-select-change` emits whenever a tag is added or remove from the list and the
|
|
30
30
|
* current list after the change is given in the detail.
|
|
31
31
|
*
|
|
32
32
|
* @slot fieldNote - Container for optional field note content
|
|
33
33
|
*
|
|
34
|
-
* @fires
|
|
34
|
+
* @fires multi-select-change - Fires when a tag is added or removed. `event.detail.selectedItems` is the current selection.
|
|
35
35
|
*/
|
|
36
36
|
export class Cre8MultiSelect extends Cre8Element {
|
|
37
37
|
/* Life Cycle Methods */
|
|
@@ -91,7 +91,7 @@ export class Cre8MultiSelect extends Cre8Element {
|
|
|
91
91
|
color="neutral"
|
|
92
92
|
shape="square"
|
|
93
93
|
?disabled="${this.disabled}"
|
|
94
|
-
@
|
|
94
|
+
@remove-tag-click="${() => this._handleRemoveTagClick(item)}"
|
|
95
95
|
></cre8-remove-tag>
|
|
96
96
|
</li>`);
|
|
97
97
|
}
|
|
@@ -116,14 +116,14 @@ export class Cre8MultiSelect extends Cre8Element {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
emitSelectedItems() {
|
|
119
|
-
const customEvent = new CustomEvent('
|
|
119
|
+
const customEvent = new CustomEvent('multi-select-change', {
|
|
120
120
|
detail: {
|
|
121
121
|
selectedItems: this.selectedTagItems,
|
|
122
122
|
},
|
|
123
123
|
bubbles: true,
|
|
124
124
|
composed: true,
|
|
125
125
|
});
|
|
126
|
-
this.
|
|
126
|
+
this.dispatchWithLegacyAlias(customEvent);
|
|
127
127
|
}
|
|
128
128
|
toggleDropDown() {
|
|
129
129
|
this.dropdownOpen = !this.dropdownOpen;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi-select.js","sourceRoot":"","sources":["../../../components/multi-select/multi-select.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,yCAAyC;AACzC,0CAA0C;AAC1C,2BAA2B;;;;;;;AAE3B,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC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AE;kEACwB;AAOnC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDACxB;AAOnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDACzB;AAOlB;IADC,QAAQ,EAAE;kDACQ;AAOnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDACvB;AAOpB;IADC,QAAQ,EAAE;oDACU;AA4UvB,IAAI,cAAc,CAAC,GAAG,CAAC,mBAAmB,CAAC,KAAK,SAAS,EAAE,CAAC;IAC1D,cAAc,CAAC,MAAM,CAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC;AAC9D,CAAC;AAQD,eAAe,eAAe,CAAC","sourcesContent":["/* eslint-disable import/no-duplicates */\n/* eslint-disable no-duplicate-imports */\n/* eslint-disable lit/no-template-arrow */\n/* eslint-disable indent */\n\nimport { ifDefined } from 'lit-html/directives/if-defined.js';\nimport { html, nothing, } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { nanoid } from 'nanoid';\nimport svgCaretDown from '@tmorrow/cre8-wc/icons/Caret_Down.svg?raw';\nimport svgClear from '@tmorrow/cre8-wc/icons/Clear_X.svg?raw';\nimport styles from './multi-select.styles.js';\nimport { Cre8Element } from '../cre8-element';\nimport '../remove-tag/remove-tag';\nimport '../field-note/field-note';\nimport '../button/button';\nimport '../checkbox-field-item/checkbox-field-item';\n// eslint-disable-next-line import/no-named-as-default\nimport Cre8CheckboxFieldItem from '../checkbox-field-item/checkbox-field-item';\n\n/**\n * Multiselect is used when multiple options can be chosen from a static dropdown\n * This component has a list of items in the dropdown that can be added as \"selected tags\"\n * The checkbox will always reflect the selected nature of the item and is not removed\n * from the dropdown when clicked, the tags will be added and removed based on their state.\n *\n * Event `selectedItemsChange` emits whenever a tag is added or remove from the list and the\n * current list after the change is given in the detail.\n *\n * @slot fieldNote - Container for optional field note content\n *\n * @fires selectedItemsChange - Fires when a tag is added or removed. `event.detail.selectedItems` is the current selection.\n */\nexport class Cre8MultiSelect extends Cre8Element {\n static styles = [styles];\n\n\n /**\n * The list of string items the user can choose in the dropdown\n *\n * Note: For passing props containing arrays and complex types, you should pass the props using a\n * period in from of the prop like so: `.items=\"[]\"`\n * (this is only needed for Web Components and not the React version)\n * @attr {string[]}\n */\n @property({ type: Array })\n items: string[] = [];\n\n @state()\n selectedTagItems: string[] = [];\n\n /**\n * The list of string items that are initially in the selected list of tags\n * Note: This list MUST be a subset of the array of items to function.\n * i.e. if items=['cat', 'dog', 'bird'], preselectedItems=['cat'] is valid\n * while preselectedItems=['cat', 'goat'] is not and will break the component.\n *\n * Note: For passing props containing arrays and complex types, you should pass the props using a\n * period in from of the prop like so: `.items=\"[]\"`\n * (this is only needed for Web Components and not the React version)\n * @attr {string[]}\n */\n @property({ type: Array })\n preselectedItems: string[];\n\n @state()\n dropdownOpen: boolean = false;\n\n /**\n * The required label that appears above the multiselect\n * @attr {string}\n */\n @property()\n label: string;\n\n /**\n * The unique id of the select\n * @attr {string}\n */\n\n @property()\n fieldId?: string;\n\n /**\n * Optional field note text can be added to provide additional field guidance.\n * @attr {string}\n */\n @property()\n fieldNote?: string;\n\n /**\n * Used to connect the field note in text field to the text menu for accessibility\n * @attr {string}\n */\n @property()\n ariaDescribedBy?: string;\n\n /**\n * Additional aria-describedby connection to id for additional success and error notes to be accessible\n * @attr {string}\n */\n @property()\n validationAriaDescribedBy?: string;\n\n /**\n * The disabled attribute on the select\n * @attr {boolean}\n */\n @property({ type: Boolean, reflect: true })\n disabled?: boolean;\n\n /**\n * Changes the component's treatment to represent an error state\n * @attr {boolean}\n */\n @property({ type: Boolean, reflect: true })\n isError?: boolean;\n\n /**\n * The error field note that appears below the default field note\n * @attr {string}\n */\n @property()\n errorNote?: string;\n\n /**\n * Changes the component's treatment to represent a success state\n * @attr {boolean}\n */\n @property({ type: Boolean, reflect: true })\n isSuccess?: boolean;\n\n /**\n * The success field note that appears below the default field note\n * @attr {string}\n */\n @property()\n successNote?: string;\n\n /* Life Cycle Methods */\n\n constructor() {\n super();\n this._handleOnClick = this._handleOnClick.bind(this);\n }\n\n firstUpdated() {\n if (this.preselectedItems) this.setPreselectedItemsinDropdown();\n this.selectedTagItems = this.preselectedItems || [];\n this._initializeAria();\n }\n\n connectedCallback() {\n super.connectedCallback();\n window.addEventListener('click', this._handleOnClick, false);\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener('click', this._handleOnClick, false);\n }\n\n /* HTML Content functions */\n\n private _renderDropdownItems() {\n return this.items.map(\n // Note: Keyboard can already navigate to the checkbox\n // eslint-disable-next-line lit-a11y/click-events-have-key-events\n (item, index) => html`<li\n @click=\"${(e: MouseEvent) => this._handleListItemClick(e, index)}\"\n >\n <cre8-checkbox-field-item\n .checked=\"${!!this.selectedTagItems.includes(item)}\"\n label=${item}\n id=${index}\n @input=\"${(e: InputEvent) => this._handleDropdownItemInput(item, e)}\"\n >\n </cre8-checkbox-field-item>\n </li>`\n );\n }\n\n private _renderSelectedTags() {\n if (!this.selectedTagItems.length) {\n return nothing;\n }\n return this.selectedTagItems.map(\n (item) => html`<li>\n <cre8-remove-tag\n text=\"${item}\"\n color=\"neutral\"\n shape=\"square\"\n ?disabled=\"${this.disabled}\"\n @removeTagClicked=\"${() => this._handleRemoveTagClick(item)}\"\n ></cre8-remove-tag>\n </li>`\n );\n }\n\n /* Helper Functions */\n\n private setPreselectedItemsinDropdown() {\n this.preselectedItems.forEach((item) => {\n this.selectedTagItems = this.selectedTagItems.concat(item);\n });\n }\n\n private clearAllTags() {\n if (!this.disabled) {\n if (this.dropdownOpen) {\n this.selectedTagItems.forEach((item) => {\n this.shadowRoot\n ?.querySelector(`cre8-checkbox-field-item[label=\"${item}\"]`)\n .shadowRoot?.querySelector('input')\n .click();\n });\n }\n this.selectedTagItems = [];\n\n this.emitSelectedItems();\n }\n }\n\n private emitSelectedItems(): void {\n const customEvent = new CustomEvent('selectedItemsChange', {\n detail: {\n selectedItems: this.selectedTagItems,\n },\n bubbles: true,\n composed: true,\n });\n this.dispatchEvent(customEvent);\n }\n\n private toggleDropDown(): void {\n this.dropdownOpen = !this.dropdownOpen;\n }\n\n /* Click Event Functions */\n\n private _handleOnClick(event?: MouseEvent) {\n if (!this.shadowRoot?.host) {\n throw Error(\n 'Could not determine navigation context during click handler'\n );\n }\n\n const didClickInside = event.composedPath().includes(this.shadowRoot.host);\n const label = this.renderRoot.querySelector(\n '.cre8-c-multi-select__label'\n );\n const buttonsWrapper = this.renderRoot.querySelector(\n '.cre8-c-multi-select__icons-wrapper'\n );\n const removeTagWrapper = this.shadowRoot?.querySelector(\n '.cre8-c-multi-select__tag-wrapper'\n );\n const dropdownWrapper = this.shadowRoot?.querySelector(\n '.cre8-c-multi-select__dropdown'\n );\n\n if (!didClickInside) {\n this.dropdownOpen = false;\n } else if (\n !event.composedPath().includes(label)\n && !event.composedPath().includes(removeTagWrapper)\n && !event.composedPath().includes(buttonsWrapper)\n && !event.composedPath().includes(dropdownWrapper)\n && !this.disabled\n ) {\n this.toggleDropDown();\n }\n }\n\n private _handleListItemClick(e: MouseEvent, index: number) {\n if (\n e.target\n !== this.shadowRoot?.querySelector(`cre8-checkbox-field-item[id=\"${index}\"]`)\n ) {\n this.shadowRoot\n ?.querySelector(`cre8-checkbox-field-item[id=\"${index}\"]`)\n .shadowRoot?.querySelector('input')\n .click();\n }\n }\n\n private _handleDropdownItemInput(item: string, e: InputEvent) {\n const targetCheckbox = e.target as Cre8CheckboxFieldItem;\n\n if (targetCheckbox.checked) {\n this.selectedTagItems = this.selectedTagItems.concat(item);\n } else {\n this.selectedTagItems = this.selectedTagItems.filter((i) => i !== item);\n }\n\n this.emitSelectedItems();\n }\n\n private async _handleRemoveTagClick(item: string) {\n if (!this.disabled) {\n this.selectedTagItems = this.selectedTagItems.filter((i) => i !== item);\n this.shadowRoot\n ?.querySelector(`cre8-checkbox-field-item[label=\"${item}\"]`)\n .shadowRoot?.querySelector('input')\n .click();\n await this.updateComplete;\n\n this.emitSelectedItems();\n }\n }\n\n private dropdownArrowClick() {\n if (!this.disabled) {\n this.toggleDropDown();\n }\n }\n\n private _handleButtonToListKeydown(e: KeyboardEvent): void {\n if (e.code === 'Escape') {\n e.preventDefault();\n this.toggleDropDown();\n }\n }\n\n\n private _handleListKeydown(e: KeyboardEvent) {\n if (e.code === 'Escape') {\n e.preventDefault();\n this.toggleDropDown();\n }\n }\n\n private _initializeAria() {\n this.fieldId = this.fieldId || nanoid();\n if (this.fieldNote || this.slotNotEmpty('fieldNote')) {\n this.ariaDescribedBy = this.ariaDescribedBy || nanoid();\n }\n if (this.successNote || this.errorNote) {\n this.validationAriaDescribedBy = this.validationAriaDescribedBy || nanoid();\n }\n }\n\n /**\n * Aria describedby string based on field notes and error/success notes\n * 1) If both validationAriaDescribedBy (error/success note) and field note exists,\n * render both in the input's `aria-describedby` attribute\n * 2) Otherwise, if only validationAriaDescribedBy exists, then render only that as\n * the `aria-describedby` attribute (input without field note initially, but then error/success is added).\n * 3) Otherwise, render only the `ariaDescribedBy` property (field note only)\n */\n private _fieldNoteAria() {\n if (this.validationAriaDescribedBy && this.ariaDescribedBy) {\n return `${this.ariaDescribedBy} ${this.validationAriaDescribedBy}`; /* 1 */\n }\n if (this.validationAriaDescribedBy && !this.ariaDescribedBy) {\n return this.validationAriaDescribedBy; /* 2 */\n }\n return this.ariaDescribedBy; /* 3 */\n }\n\n /**\n * Render the success or error field notes\n * 1. If there is a successNote, then return the field note with the success message and state.\n * 2. If there is a errorNote, then return the field note with the error message and state.\n */\n private _renderSuccessErrorFieldNote() {\n if (this.successNote) {\n /* 1 */\n return html` <cre8-field-note\n ?isSuccess=${this.isSuccess}\n id=${this.validationAriaDescribedBy}\n class=\"cre8-c-multi-select__field-note-success\"\n iconName=\"success\"\n >\n ${this.successNote}\n </cre8-field-note>`;\n }\n if (this.errorNote) {\n /* 2 */\n return html` <cre8-field-note\n ?isError=${this.isError}\n id=${this.validationAriaDescribedBy}\n class=\"cre8-c-multi-select__field-note-error\"\n iconName=\"error-alt\"\n >\n ${this.errorNote}\n </cre8-field-note>`;\n }\n return null;\n }\n\n render() {\n const componentClassNames = this.componentClassNames(\n 'cre8-c-multi-select',\n {\n 'cre8-is-error': this.isError,\n 'cre8-is-success': this.isSuccess,\n 'cre8-is-disabled': this.disabled,\n 'cre8-c-multi-select--no-clear-icon': !this.selectedTagItems.length,\n }\n );\n\n return html`\n <div class=\"${componentClassNames}\">\n <label class=\"cre8-c-multi-select__label\" id=\"${this.fieldId}\"\n >${this.label}</label\n >\n <div class=\"cre8-c-multi-select__body\" ?disabled=${this.disabled}>\n <div\n class=\"cre8-c-multi-select__content\"\n aria-describedby=\"${ifDefined(this._fieldNoteAria())}\"\n >\n <ul\n class=\"cre8-c-multi-select__tag-wrapper\"\n aria-label=\"selected items\"\n >\n ${this._renderSelectedTags()}\n </ul>\n </div>\n <div class=\"cre8-c-multi-select__icons-wrapper\">\n <cre8-button\n ?hideText=${true}\n svg=\"${svgClear}\"\n text=\"Clear All\"\n variant=\"tertiary\"\n ?disabled=\"${this.disabled}\"\n class=\"cre8-c-multi-select__clear_icon\"\n @click=\"${this.clearAllTags}\"\n >\n </cre8-button>\n <cre8-button\n hideText\n svg=${svgCaretDown}\n variant=\"tertiary\"\n ?disabled=\"${this.disabled}\"\n class=\"cre8-c-multi-select__down_icon\"\n @click=\"${this.dropdownArrowClick}\"\n @keydown=\"${this._handleButtonToListKeydown}\"\n text=\"Open Dropdown\"\n aria-expanded=\"${this.dropdownOpen}\"\n >\n </cre8-button>\n </div>\n </div>\n ${this.dropdownOpen\n ? html`\n <fieldset class=\"cre8-c-multi-select__dropdown\" aria-describedby=\"${this.fieldId}\">\n <ul\n aria-label=\"available items\"\n @keydown=\"${this._handleListKeydown}\"\n >\n ${this._renderDropdownItems()}\n </ul>\n </fieldset>`\n : nothing}\n </div>\n ${this.fieldNote || this.slotNotEmpty('fieldNote')\n ? html`<cre8-field-note\n id=${this.ariaDescribedBy}\n class=\"cre8-c-multi-select__field-note\"\n >\n <slot name=\"fieldNote\">${this.fieldNote}</slot>\n </cre8-field-note>`\n : nothing}\n ${this._renderSuccessErrorFieldNote()}\n `;\n }\n}\n\nif (customElements.get('cre8-multi-select') === undefined) {\n customElements.define('cre8-multi-select', Cre8MultiSelect);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-multi-select': Cre8MultiSelect;\n }\n}\n\nexport default Cre8MultiSelect;\n"]}
|
|
1
|
+
{"version":3,"file":"multi-select.js","sourceRoot":"","sources":["../../../components/multi-select/multi-select.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,yCAAyC;AACzC,0CAA0C;AAC1C,2BAA2B;;;;;;;AAE3B,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,KAAK,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,YAAY,MAAM,2CAA2C,CAAC;AACrE,OAAO,QAAQ,MAAM,wCAAwC,CAAC;AAC9D,OAAO,MAAM,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,0BAA0B,CAAC;AAClC,OAAO,0BAA0B,CAAC;AAClC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,4CAA4C,CAAC;AAIpD;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,eAAgB,SAAQ,WAAW;IA0G9C,wBAAwB;IAExB;QACE,KAAK,EAAE,CAAC;QAzGV;;;;;;;WAOG;QAEH,UAAK,GAAa,EAAE,CAAC;QAGrB,qBAAgB,GAAa,EAAE,CAAC;QAiBhC,iBAAY,GAAY,KAAK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AChD,CAAC,CAAC,IAAI,CAAA;iBACG,IAAI,CAAC,eAAe;;;qCAGA,IAAI,CAAC,SAAS;6BACtB;YACrB,CAAC,CAAC,OAAO;QACT,IAAI,CAAC,4BAA4B,EAAE;KACtC,CAAC;IACJ,CAAC;;AAhbM,sBAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AAYzB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;8CACL;AAGrB;IADC,KAAK,EAAE;yDACwB;AAchC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;yDACC;AAG3B;IADC,KAAK,EAAE;qDACsB;AAO9B;IADC,QAAQ,EAAE;8CACG;AAQd;IADC,QAAQ,EAAE;gDACM;AAOjB;IADC,QAAQ,EAAE;kDACQ;AAOnB;IADC,QAAQ,EAAE;wDACc;AAOzB;IADC,QAAQ,EAAE;kEACwB;AAOnC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDACxB;AAOnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDACzB;AAOlB;IADC,QAAQ,EAAE;kDACQ;AAOnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDACvB;AAOpB;IADC,QAAQ,EAAE;oDACU;AA4UvB,IAAI,cAAc,CAAC,GAAG,CAAC,mBAAmB,CAAC,KAAK,SAAS,EAAE,CAAC;IAC1D,cAAc,CAAC,MAAM,CAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC;AAC9D,CAAC;AAQD,eAAe,eAAe,CAAC","sourcesContent":["/* eslint-disable import/no-duplicates */\n/* eslint-disable no-duplicate-imports */\n/* eslint-disable lit/no-template-arrow */\n/* eslint-disable indent */\n\nimport { ifDefined } from 'lit-html/directives/if-defined.js';\nimport { html, nothing, } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { nanoid } from 'nanoid';\nimport svgCaretDown from '@tmorrow/cre8-wc/icons/Caret_Down.svg?raw';\nimport svgClear from '@tmorrow/cre8-wc/icons/Clear_X.svg?raw';\nimport styles from './multi-select.styles.js';\nimport { Cre8Element } from '../cre8-element';\nimport '../remove-tag/remove-tag';\nimport '../field-note/field-note';\nimport '../button/button';\nimport '../checkbox-field-item/checkbox-field-item';\n// eslint-disable-next-line import/no-named-as-default\nimport Cre8CheckboxFieldItem from '../checkbox-field-item/checkbox-field-item';\n\n/**\n * Multiselect is used when multiple options can be chosen from a static dropdown\n * This component has a list of items in the dropdown that can be added as \"selected tags\"\n * The checkbox will always reflect the selected nature of the item and is not removed\n * from the dropdown when clicked, the tags will be added and removed based on their state.\n *\n * Event `multi-select-change` emits whenever a tag is added or remove from the list and the\n * current list after the change is given in the detail.\n *\n * @slot fieldNote - Container for optional field note content\n *\n * @fires multi-select-change - Fires when a tag is added or removed. `event.detail.selectedItems` is the current selection.\n */\nexport class Cre8MultiSelect extends Cre8Element {\n static styles = [styles];\n\n\n /**\n * The list of string items the user can choose in the dropdown\n *\n * Note: For passing props containing arrays and complex types, you should pass the props using a\n * period in from of the prop like so: `.items=\"[]\"`\n * (this is only needed for Web Components and not the React version)\n * @attr {string[]}\n */\n @property({ type: Array })\n items: string[] = [];\n\n @state()\n selectedTagItems: string[] = [];\n\n /**\n * The list of string items that are initially in the selected list of tags\n * Note: This list MUST be a subset of the array of items to function.\n * i.e. if items=['cat', 'dog', 'bird'], preselectedItems=['cat'] is valid\n * while preselectedItems=['cat', 'goat'] is not and will break the component.\n *\n * Note: For passing props containing arrays and complex types, you should pass the props using a\n * period in from of the prop like so: `.items=\"[]\"`\n * (this is only needed for Web Components and not the React version)\n * @attr {string[]}\n */\n @property({ type: Array })\n preselectedItems: string[];\n\n @state()\n dropdownOpen: boolean = false;\n\n /**\n * The required label that appears above the multiselect\n * @attr {string}\n */\n @property()\n label: string;\n\n /**\n * The unique id of the select\n * @attr {string}\n */\n\n @property()\n fieldId?: string;\n\n /**\n * Optional field note text can be added to provide additional field guidance.\n * @attr {string}\n */\n @property()\n fieldNote?: string;\n\n /**\n * Used to connect the field note in text field to the text menu for accessibility\n * @attr {string}\n */\n @property()\n ariaDescribedBy?: string;\n\n /**\n * Additional aria-describedby connection to id for additional success and error notes to be accessible\n * @attr {string}\n */\n @property()\n validationAriaDescribedBy?: string;\n\n /**\n * The disabled attribute on the select\n * @attr {boolean}\n */\n @property({ type: Boolean, reflect: true })\n disabled?: boolean;\n\n /**\n * Changes the component's treatment to represent an error state\n * @attr {boolean}\n */\n @property({ type: Boolean, reflect: true })\n isError?: boolean;\n\n /**\n * The error field note that appears below the default field note\n * @attr {string}\n */\n @property()\n errorNote?: string;\n\n /**\n * Changes the component's treatment to represent a success state\n * @attr {boolean}\n */\n @property({ type: Boolean, reflect: true })\n isSuccess?: boolean;\n\n /**\n * The success field note that appears below the default field note\n * @attr {string}\n */\n @property()\n successNote?: string;\n\n /* Life Cycle Methods */\n\n constructor() {\n super();\n this._handleOnClick = this._handleOnClick.bind(this);\n }\n\n firstUpdated() {\n if (this.preselectedItems) this.setPreselectedItemsinDropdown();\n this.selectedTagItems = this.preselectedItems || [];\n this._initializeAria();\n }\n\n connectedCallback() {\n super.connectedCallback();\n window.addEventListener('click', this._handleOnClick, false);\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener('click', this._handleOnClick, false);\n }\n\n /* HTML Content functions */\n\n private _renderDropdownItems() {\n return this.items.map(\n // Note: Keyboard can already navigate to the checkbox\n // eslint-disable-next-line lit-a11y/click-events-have-key-events\n (item, index) => html`<li\n @click=\"${(e: MouseEvent) => this._handleListItemClick(e, index)}\"\n >\n <cre8-checkbox-field-item\n .checked=\"${!!this.selectedTagItems.includes(item)}\"\n label=${item}\n id=${index}\n @input=\"${(e: InputEvent) => this._handleDropdownItemInput(item, e)}\"\n >\n </cre8-checkbox-field-item>\n </li>`\n );\n }\n\n private _renderSelectedTags() {\n if (!this.selectedTagItems.length) {\n return nothing;\n }\n return this.selectedTagItems.map(\n (item) => html`<li>\n <cre8-remove-tag\n text=\"${item}\"\n color=\"neutral\"\n shape=\"square\"\n ?disabled=\"${this.disabled}\"\n @remove-tag-click=\"${() => this._handleRemoveTagClick(item)}\"\n ></cre8-remove-tag>\n </li>`\n );\n }\n\n /* Helper Functions */\n\n private setPreselectedItemsinDropdown() {\n this.preselectedItems.forEach((item) => {\n this.selectedTagItems = this.selectedTagItems.concat(item);\n });\n }\n\n private clearAllTags() {\n if (!this.disabled) {\n if (this.dropdownOpen) {\n this.selectedTagItems.forEach((item) => {\n this.shadowRoot\n ?.querySelector(`cre8-checkbox-field-item[label=\"${item}\"]`)\n .shadowRoot?.querySelector('input')\n .click();\n });\n }\n this.selectedTagItems = [];\n\n this.emitSelectedItems();\n }\n }\n\n private emitSelectedItems(): void {\n const customEvent = new CustomEvent('multi-select-change', {\n detail: {\n selectedItems: this.selectedTagItems,\n },\n bubbles: true,\n composed: true,\n });\n this.dispatchWithLegacyAlias(customEvent);\n }\n\n private toggleDropDown(): void {\n this.dropdownOpen = !this.dropdownOpen;\n }\n\n /* Click Event Functions */\n\n private _handleOnClick(event?: MouseEvent) {\n if (!this.shadowRoot?.host) {\n throw Error(\n 'Could not determine navigation context during click handler'\n );\n }\n\n const didClickInside = event.composedPath().includes(this.shadowRoot.host);\n const label = this.renderRoot.querySelector(\n '.cre8-c-multi-select__label'\n );\n const buttonsWrapper = this.renderRoot.querySelector(\n '.cre8-c-multi-select__icons-wrapper'\n );\n const removeTagWrapper = this.shadowRoot?.querySelector(\n '.cre8-c-multi-select__tag-wrapper'\n );\n const dropdownWrapper = this.shadowRoot?.querySelector(\n '.cre8-c-multi-select__dropdown'\n );\n\n if (!didClickInside) {\n this.dropdownOpen = false;\n } else if (\n !event.composedPath().includes(label)\n && !event.composedPath().includes(removeTagWrapper)\n && !event.composedPath().includes(buttonsWrapper)\n && !event.composedPath().includes(dropdownWrapper)\n && !this.disabled\n ) {\n this.toggleDropDown();\n }\n }\n\n private _handleListItemClick(e: MouseEvent, index: number) {\n if (\n e.target\n !== this.shadowRoot?.querySelector(`cre8-checkbox-field-item[id=\"${index}\"]`)\n ) {\n this.shadowRoot\n ?.querySelector(`cre8-checkbox-field-item[id=\"${index}\"]`)\n .shadowRoot?.querySelector('input')\n .click();\n }\n }\n\n private _handleDropdownItemInput(item: string, e: InputEvent) {\n const targetCheckbox = e.target as Cre8CheckboxFieldItem;\n\n if (targetCheckbox.checked) {\n this.selectedTagItems = this.selectedTagItems.concat(item);\n } else {\n this.selectedTagItems = this.selectedTagItems.filter((i) => i !== item);\n }\n\n this.emitSelectedItems();\n }\n\n private async _handleRemoveTagClick(item: string) {\n if (!this.disabled) {\n this.selectedTagItems = this.selectedTagItems.filter((i) => i !== item);\n this.shadowRoot\n ?.querySelector(`cre8-checkbox-field-item[label=\"${item}\"]`)\n .shadowRoot?.querySelector('input')\n .click();\n await this.updateComplete;\n\n this.emitSelectedItems();\n }\n }\n\n private dropdownArrowClick() {\n if (!this.disabled) {\n this.toggleDropDown();\n }\n }\n\n private _handleButtonToListKeydown(e: KeyboardEvent): void {\n if (e.code === 'Escape') {\n e.preventDefault();\n this.toggleDropDown();\n }\n }\n\n\n private _handleListKeydown(e: KeyboardEvent) {\n if (e.code === 'Escape') {\n e.preventDefault();\n this.toggleDropDown();\n }\n }\n\n private _initializeAria() {\n this.fieldId = this.fieldId || nanoid();\n if (this.fieldNote || this.slotNotEmpty('fieldNote')) {\n this.ariaDescribedBy = this.ariaDescribedBy || nanoid();\n }\n if (this.successNote || this.errorNote) {\n this.validationAriaDescribedBy = this.validationAriaDescribedBy || nanoid();\n }\n }\n\n /**\n * Aria describedby string based on field notes and error/success notes\n * 1) If both validationAriaDescribedBy (error/success note) and field note exists,\n * render both in the input's `aria-describedby` attribute\n * 2) Otherwise, if only validationAriaDescribedBy exists, then render only that as\n * the `aria-describedby` attribute (input without field note initially, but then error/success is added).\n * 3) Otherwise, render only the `ariaDescribedBy` property (field note only)\n */\n private _fieldNoteAria() {\n if (this.validationAriaDescribedBy && this.ariaDescribedBy) {\n return `${this.ariaDescribedBy} ${this.validationAriaDescribedBy}`; /* 1 */\n }\n if (this.validationAriaDescribedBy && !this.ariaDescribedBy) {\n return this.validationAriaDescribedBy; /* 2 */\n }\n return this.ariaDescribedBy; /* 3 */\n }\n\n /**\n * Render the success or error field notes\n * 1. If there is a successNote, then return the field note with the success message and state.\n * 2. If there is a errorNote, then return the field note with the error message and state.\n */\n private _renderSuccessErrorFieldNote() {\n if (this.successNote) {\n /* 1 */\n return html` <cre8-field-note\n ?isSuccess=${this.isSuccess}\n id=${this.validationAriaDescribedBy}\n class=\"cre8-c-multi-select__field-note-success\"\n iconName=\"success\"\n >\n ${this.successNote}\n </cre8-field-note>`;\n }\n if (this.errorNote) {\n /* 2 */\n return html` <cre8-field-note\n ?isError=${this.isError}\n id=${this.validationAriaDescribedBy}\n class=\"cre8-c-multi-select__field-note-error\"\n iconName=\"error-alt\"\n >\n ${this.errorNote}\n </cre8-field-note>`;\n }\n return null;\n }\n\n render() {\n const componentClassNames = this.componentClassNames(\n 'cre8-c-multi-select',\n {\n 'cre8-is-error': this.isError,\n 'cre8-is-success': this.isSuccess,\n 'cre8-is-disabled': this.disabled,\n 'cre8-c-multi-select--no-clear-icon': !this.selectedTagItems.length,\n }\n );\n\n return html`\n <div class=\"${componentClassNames}\">\n <label class=\"cre8-c-multi-select__label\" id=\"${this.fieldId}\"\n >${this.label}</label\n >\n <div class=\"cre8-c-multi-select__body\" ?disabled=${this.disabled}>\n <div\n class=\"cre8-c-multi-select__content\"\n aria-describedby=\"${ifDefined(this._fieldNoteAria())}\"\n >\n <ul\n class=\"cre8-c-multi-select__tag-wrapper\"\n aria-label=\"selected items\"\n >\n ${this._renderSelectedTags()}\n </ul>\n </div>\n <div class=\"cre8-c-multi-select__icons-wrapper\">\n <cre8-button\n ?hideText=${true}\n svg=\"${svgClear}\"\n text=\"Clear All\"\n variant=\"tertiary\"\n ?disabled=\"${this.disabled}\"\n class=\"cre8-c-multi-select__clear_icon\"\n @click=\"${this.clearAllTags}\"\n >\n </cre8-button>\n <cre8-button\n hideText\n svg=${svgCaretDown}\n variant=\"tertiary\"\n ?disabled=\"${this.disabled}\"\n class=\"cre8-c-multi-select__down_icon\"\n @click=\"${this.dropdownArrowClick}\"\n @keydown=\"${this._handleButtonToListKeydown}\"\n text=\"Open Dropdown\"\n aria-expanded=\"${this.dropdownOpen}\"\n >\n </cre8-button>\n </div>\n </div>\n ${this.dropdownOpen\n ? html`\n <fieldset class=\"cre8-c-multi-select__dropdown\" aria-describedby=\"${this.fieldId}\">\n <ul\n aria-label=\"available items\"\n @keydown=\"${this._handleListKeydown}\"\n >\n ${this._renderDropdownItems()}\n </ul>\n </fieldset>`\n : nothing}\n </div>\n ${this.fieldNote || this.slotNotEmpty('fieldNote')\n ? html`<cre8-field-note\n id=${this.ariaDescribedBy}\n class=\"cre8-c-multi-select__field-note\"\n >\n <slot name=\"fieldNote\">${this.fieldNote}</slot>\n </cre8-field-note>`\n : nothing}\n ${this._renderSuccessErrorFieldNote()}\n `;\n }\n}\n\nif (customElements.get('cre8-multi-select') === undefined) {\n customElements.define('cre8-multi-select', Cre8MultiSelect);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-multi-select': Cre8MultiSelect;\n }\n}\n\nexport default Cre8MultiSelect;\n"]}
|
|
@@ -54,7 +54,7 @@ import './page-counter/page-counter';
|
|
|
54
54
|
*
|
|
55
55
|
* @slot - Optional content rendered alongside the pagination controls
|
|
56
56
|
*
|
|
57
|
-
* @fires pagination
|
|
57
|
+
* @fires pagination-change - Fires when the page changes. `event.detail` is `{ buttonName, value }` where `value` is the new current page.
|
|
58
58
|
*/
|
|
59
59
|
export declare class Cre8Pagination extends Cre8Element {
|
|
60
60
|
static styles: import("lit").CSSResult[];
|
|
@@ -71,7 +71,7 @@ import styles from './pagination.styles.js';
|
|
|
71
71
|
*
|
|
72
72
|
* @slot - Optional content rendered alongside the pagination controls
|
|
73
73
|
*
|
|
74
|
-
* @fires pagination
|
|
74
|
+
* @fires pagination-change - Fires when the page changes. `event.detail` is `{ buttonName, value }` where `value` is the new current page.
|
|
75
75
|
*/
|
|
76
76
|
export class Cre8Pagination extends Cre8Element {
|
|
77
77
|
constructor() {
|
|
@@ -104,7 +104,7 @@ export class Cre8Pagination extends Cre8Element {
|
|
|
104
104
|
this._currentPage = page;
|
|
105
105
|
this.currentPage = this._currentPage;
|
|
106
106
|
this.requestUpdate('currentPage', old);
|
|
107
|
-
this.
|
|
107
|
+
this.dispatchWithLegacyAlias(new CustomEvent('pagination-change', { detail: { buttonName: _buttonName ?? this.currentPage.toString(), value: this.currentPage } }));
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../../components/pagination/pagination.ts"],"names":[],"mappings":";;;;;;AAAA,iDAAiD;AACjD,wCAAwC;AACxC,OAAO,EACH,IAAI,EAAsB,OAAO,GACpC,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,YAAY,MAAM,2CAA2C,CAAC;AACrE,OAAO,YAAY,MAAM,kDAAkD,CAAC;AAC5E,OAAO,WAAW,MAAM,mDAAmD,CAAC;AAC5E,OAAO,aAAa,MAAM,4CAA4C,CAAC;AACvE,OAAO,WAAW,MAAM,yCAAyC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;A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,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,SAAS,EAAE,CAAC;IACtD,cAAc,CAAC,MAAM,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["/* eslint-disable import/prefer-default-export */\n/* eslint-disable lit/no-template-map */\nimport {\n html, HTMLTemplateResult, nothing,\n} from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { property, queryAll, state } from 'lit/decorators.js';\nimport svgCaretLeft from '@tmorrow/cre8-wc/icons/Caret_Left.svg?raw';\nimport svgFirstPage from '@tmorrow/cre8-wc/icons/Caret_Double_Left.svg?raw';\nimport svgLastPage from '@tmorrow/cre8-wc/icons/Caret_Double_Right.svg?raw';\nimport svgCaretRight from '@tmorrow/cre8-wc/icons/Caret_Right.svg?raw';\nimport svgEllipsis from '@tmorrow/cre8-wc/icons/Ellipsis.svg?raw';\nimport { Cre8Element } from '../cre8-element';\nimport { Cre8Button } from '../button/button';\nimport { isMobile, screenSizes } from '../../utilities/is-mobile';\nimport './page-counter/page-counter';\nimport styles from './pagination.styles.js';\n\n/**\n * The Pagination component is used to split up a large amount of results\n * by showing only a certain amount on each page. You can cycle through\n * the pages using Page Numbers, Next and Previous Buttons, or optional\n * First Page and Last Page Buttons. This component is also used by Table\n * to cycle through rows of results. Pagination has 3 display options:\n *\n * **default**: Can contain up to seven Page Numbers (ellipses included)\n * at a time flanked by Next and Previous Buttons. When there are more than\n * seven pages, numbers start getting replaced by ellipses. Use this option\n * when you have a lot of horizontal space in a layout. It should not be used\n * for mobile web layouts since its buttons are smaller than the minimum touch target of 44px.\n * The component has built in responsivity to mobile page size so you dont have tohandle this\n * seperately\n *\n *\n * **compact** : Best used as a summary of where you are among pages or table rows flanked by\n * Previous and Next Buttons. Use this option when you have limited horizontal space but still\n * need to show where users are among results. Great for mobile layouts.\n *\n *\n * **icon-only** : Use this option in very tight spaces when it’s not required to show users\n * where they are among results. Great for mobile layouts.\n *\n *\n * ## HOW TO USE\n *\n * Select an option from the “display” dropdown depending on layout width\n * Select where your current page is from the “Page” dropdown\n * To show less pages when using Full Numbers, use the \"visiblePages” toggles\n * To hide the First Page and Last Page Buttons, turn on the “hideFirstLastButton” toggle\n * To change the states of page numbers or buttons, interact with the buttond to invoke each “State”\n * When using Compact Numbers, you can choose between “compact” and “icon-only” formats\n *\n *\n * ## ACCESSIBILITY NOTE\n *\n * To best orient people using screen readers, push focus to the top of\n * the list of results after any of the pagination buttons have been triggered,\n * **except for the currently selected one**. Focus target could be a visual results heading,\n * or the top heading of the results container of the page selected\n * via a programmatic selector, e.g. < section id=“results” aria-label=\"results-section\" > or\n * < div role= “group” aria-label=“results” >.\n *\n * @dependency cre8-button, cre8-icon, cre8-pagination-counter\n * @csspart icon - distinguishes the page buttons from the icon buttons\n * @cssproperty \"--pagination-display\" - controls the display css property\n * @cssproperty \"--pagination-justify-content\" - controls horizontal alignment of pagination\n * @cssproperty \"--pagination-align-items\" - controls vertical alignment of pagination\n *\n * @slot - Optional content rendered alongside the pagination controls\n *\n * @fires pagination.click - Fires when the page changes. `event.detail` is `{ buttonName, value }` where `value` is the new current page.\n */\n\nexport class Cre8Pagination extends Cre8Element {\n static styles = [styles];\n\n static elementDefinitions = {\n 'cre8-button': Cre8Button,\n };\n\n @state()\n _currentPage: number = 99;\n\n /**\n * Input the total number of elements are returned from consuming app e.g. search results\n * @attr number\n * @required\n */\n @property({ reflect: true, type: Number })\n totalResults!: number;\n\n\n /**\n * how many elements will displayVariant per page, indicated by business to typically be 20\n * @attr number\n */\n @property({ type: Number, reflect: true })\n get pageSize() {\n return this._pageSize;\n }\n\n set pageSize(newSize: number) {\n const oldSize = this._pageSize;\n this._pageSize = newSize;\n this.requestUpdate('pageSize', oldSize);\n }\n\n @state()\n _pageSize = 10;\n\n\n /**\n * Controls how many page buttons are displayVarianted on the page\n * at once, if container size permits. recommended max = 5 pages\n *\n * @attr number\n */\n @property({ reflect: true, type: Number })\n visiblePages?: number = 5;\n\n /**\n * (optional) prop that allows for a compact and icon-only variant both\n * for mobile screen-sizes and for use in certain contexts as guided by design,\n * the component size will show 'default' in the absence of a value on desktop and\n * 'compact' on smaller views.\n *\n * @attr 'compact' | 'icon-only' | 'default'\n * @optional\n */\n @property({ type: String, reflect: true })\n display?: 'compact' | 'icon-only' | 'default';\n\n /**\n *\n *@state watches the width of the window and responds to show the accessibility approved variant.\n */\n @state()\n windowWidth!: number;\n\n @queryAll('cre8-button')\n buttons: typeof Cre8Button[];\n\n /**\n *\n * @optional\n */\n @property({ type: Boolean, reflect: true })\n hideLastAndFirstButtons?: boolean;\n\n /**\n * The currently active page (1-based). Setting it programmatically navigates the pagination.\n */\n @property({ reflect: true, type: Number })\n get currentPage() {\n return this._currentPage;\n }\n\n set currentPage(newPage: number) {\n const oldPage = this._currentPage;\n this._currentPage = newPage;\n this.requestUpdate('currentPage', oldPage);\n }\n\n connectedCallBack() {\n super.connectedCallback();\n }\n\n get maxVisiblePages() {\n const allowedVisiblePages = {\n md: 5,\n };\n\n // lg and up\n\n if (!isMobile(screenSizes.lg.toString())) {\n return this.visiblePages;\n }\n\n if (!isMobile(screenSizes.md.toString())) {\n return Math.min(allowedVisiblePages.md, this.visiblePages);\n }\n return 0;\n }\n\n\n private get totalPages(): number {\n return Math.ceil(this.totalResults / this.pageSize);\n }\n\n private get hasNoPreviousPage() {\n return this._currentPage <= 1;\n }\n\n private get hasNoNextPage() {\n return this._currentPage >= this.totalPages;\n }\n\n private _onHandleResize() {\n this.requestUpdate();\n }\n\n handleResize() {\n this._onHandleResize.bind(this);\n }\n\n // get range of pages to display [3, 4, 5], [2, 3, 4, 5]\n protected get pageRange(): number[] {\n const left = Math.floor(this.maxVisiblePages / 2);\n let startPage = this.currentPage - left;\n startPage = Math.min(startPage, this.totalPages - this.maxVisiblePages + 1);\n startPage = Math.max(startPage, 1);\n const endPage = Math.min(startPage + this.maxVisiblePages - 1, this.totalPages);\n return [...Array(this.totalPages)].map((_, index) => index + 1).slice(startPage - 1, endPage);\n }\n\n protected async firstUpdated() {\n await this.updateComplete;\n if (this._pageSize !== this.pageSize) {\n const old = this._pageSize;\n this._pageSize = this.pageSize;\n this.requestUpdate('pageSize', old);\n }\n this.windowWidth = window.innerWidth;\n window.addEventListener('resize', () => {\n if (this.windowWidth !== window.innerWidth) {\n const oldWidth = this.windowWidth;\n this.windowWidth = window.innerWidth;\n this.handleResize();\n this.requestUpdate('isResponsive', oldWidth);\n }\n });\n if (this._currentPage !== this.currentPage) {\n const old = this._currentPage;\n this._currentPage = this.currentPage;\n this.requestUpdate('currentPage', old);\n }\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.handleResize);\n super.disconnectedCallback();\n }\n\n displayTypes(): HTMLTemplateResult {\n return html`<cre8-page-counter\n currentPage=${this.currentPage}\n style=\"display:${this.display === 'compact' ? 'flex' : 'none'};\"\n totalResults=${this.totalResults}\n pageSize=${this._pageSize}\n display=${this.display}>\n </cre8-page-counter>`;\n }\n\n private _handleKeydown = (page: number, _buttonName?: string) => (e: KeyboardEvent) => {\n if (e.code === 'Enter') {\n this._goToPage(page, _buttonName); /* 2 */\n }\n };\n\n private _goToPage = (page: number, _buttonName?: string) => () => {\n const old = this._currentPage;\n let focusButton: Cre8Button;\n this.buttons.forEach((_: typeof Cre8Button) => {\n const b = new Cre8Button();\n if (b.hideText && (b.text === _buttonName)) {\n focusButton = b;\n (focusButton.shadowRoot!.querySelector('.cre8-c-button') as HTMLButtonElement).blur();\n }\n return null;\n });\n this._currentPage = page;\n this.currentPage = this._currentPage;\n this.requestUpdate('currentPage', old);\n this.dispatchEvent(new CustomEvent(\n 'pagination.click',\n { detail: { buttonName: _buttonName ?? this.currentPage.toString(), value: this.currentPage } }\n ));\n };\n\n public goToPage(page: number, buttonName?: string) {\n return this._goToPage(page, buttonName).bind(this);\n }\n\n public handleKeydown(page: number, buttonName?: string) {\n return this._handleKeydown(page, buttonName);\n }\n\n render() {\n const classNames = this.componentClassNames('cre8-c-pagination', {\n 'cre8-c-pagination--compact': this.display !== undefined && this.display === 'compact',\n 'cre8-c-pagination--icon-only': this.display !== undefined && this.display === 'icon-only',\n });\n\n\n return html`<nav\n aria-label=\"pagination\"\n class=${classNames}>\n <slot></slot>\n ${!this.hideLastAndFirstButtons ? html` <cre8-button\n variant=\"tertiary\"\n size=\"sm\"\n text=\"\"\n hideText\n part=\"icon\"\n aria-disabled=\"${ifDefined(this.hasNoPreviousPage)}\"\n ?disabled=${this.hasNoPreviousPage}\n @click=${this.goToPage(1, 'First Page')}\n @keydown=${this.handleKeydown(1, 'First Page')}\n\n >\n <span slot=\"before\">\n <cre8-icon\n className=\"cre8-c-pagination__icon\"\n aria-label=\"First Page\"\n svg=${svgFirstPage}\n size=\"24\">\n </cre8-icon>\n </span>\n </cre8-button>` : nothing}\n <cre8-button\n variant=\"tertiary\"\n size=\"sm\"\n hideText\n text=\"\"\n part=\"icon\"\n aria-disabled=\"${ifDefined(this.hasNoPreviousPage)}\"\n ?disabled=${this.hasNoPreviousPage}\n @click=${this.goToPage(this._currentPage - 1, 'Previous Page')}\n @keydown=${this.handleKeydown(this.currentPage - 1, 'Previous Page')}\n\n >\n <span slot=\"before\">\n <cre8-icon\n className=\"cre8-c-pagination__icon\"\n aria-label=\"Previous Page\"\n slot=\"before\"\n svg=${svgCaretLeft}\n size=\"24\"\n\n >\n </cre8-icon>\n </span>\n </cre8-button>\n\n ${this.displayTypes()}\n ${!this.display || this.display === 'default'\n ? html`${this.pageRange[this.pageRange.length - 1] > 1 && this.pageRange[0] !== 1\n ? html` <cre8-icon\n aria-label=\"ellipsis\"\n className=\"cre8-c-pagination__icon\"\n slot=\"before\" svg=${svgEllipsis}\n size=\"24\">\n </cre8-icon>`\n : nothing}\n ${this.pageRange.map((page) => (page === this.currentPage\n ? html`<cre8-button variant=\"tertiary\" tab-index=\"-1\" text=\"${page}\" class=\"icon-only\" size=\"sm\" id=\"current\"></cre8-button>`\n : html`<cre8-button\n variant=\"tertiary\"\n size=\"sm\"\n text=\"${page}\"\n class=\"icon-only\"\n id=\"${page}\"\n @click=${this.goToPage(page, page.toString())}\n @keydown=${this.handleKeydown(page, page.toString())}>\n </cre8-button>`\n ))}\n ${this.pageRange[this.pageRange.length - 1] < this.totalPages\n ? html` <cre8-icon\n aria-label=\"ellipsis\"\n className=\"cre8-c-pagination__icon\"\n slot=\"before\" svg=${svgEllipsis}\n size=\"24\">\n </cre8-icon>`\n : nothing}`\n : nothing}\n <cre8-button\n variant=\"tertiary\"\n size=\"sm\"\n part=\"icon\"\n hideText\n text=\"\"\n aria-disabled=\"${ifDefined(this.hasNoNextPage)}\"\n ?disabled=${this.hasNoNextPage}\n @click=${this.goToPage(this.currentPage + 1, 'Next Page')}\n @keydown=${this.handleKeydown(this.currentPage + 1, 'Next Page')}\n\n >\n <span slot=\"before\">\n <cre8-icon\n aria-label=\"Next Page\"\n className=\"cre8-c-pagination__icon\"\n slot=\"before\" svg=${svgCaretRight}\n size=\"24\">\n </cre8-icon>\n </span>\n </cre8-button>\n\n ${!this.hideLastAndFirstButtons\n ? html` <cre8-button\n variant=\"tertiary\"\n size=\"sm\"\n hideText\n text=\"\"\n part=\"icon\"\n aria-disabled=\"${ifDefined(this.hasNoNextPage)}\"\n ?disabled=${this.hasNoNextPage}\n @click=${this.goToPage(this.totalPages, 'Last Page')}\n @keydown=${this.handleKeydown(this.totalPages, 'Last Page')}\n\n >\n <span slot=\"before\">\n <cre8-icon\n aria-label=\"Last Page\"\n className=\"cre8-c-pagination__icon\"\n slot=\"before\"\n svg=${svgLastPage}\n size=\"24\"\n >\n </cre8-icon>\n </span>\n </cre8-button>`\n : nothing}\n\n </nav>`;\n }\n}\n\nif (customElements.get('cre8-pagination') === undefined) {\n customElements.define('cre8-pagination', Cre8Pagination);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-pagination': Cre8Pagination;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../../components/pagination/pagination.ts"],"names":[],"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AAC;oDACpB;AAQtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAGzC;AASD;IADC,KAAK,EAAE;iDACO;AAUf;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAChB;AAY1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CACI;AAO9C;IADC,KAAK,EAAE;mDACa;AAGrB;IADC,QAAQ,CAAC,aAAa,CAAC;+CACK;AAO7B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+DACT;AAMlC;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAGzC;AAgRL,IAAI,cAAc,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,SAAS,EAAE,CAAC;IACtD,cAAc,CAAC,MAAM,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["/* eslint-disable import/prefer-default-export */\n/* eslint-disable lit/no-template-map */\nimport {\n html, HTMLTemplateResult, nothing,\n} from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { property, queryAll, state } from 'lit/decorators.js';\nimport svgCaretLeft from '@tmorrow/cre8-wc/icons/Caret_Left.svg?raw';\nimport svgFirstPage from '@tmorrow/cre8-wc/icons/Caret_Double_Left.svg?raw';\nimport svgLastPage from '@tmorrow/cre8-wc/icons/Caret_Double_Right.svg?raw';\nimport svgCaretRight from '@tmorrow/cre8-wc/icons/Caret_Right.svg?raw';\nimport svgEllipsis from '@tmorrow/cre8-wc/icons/Ellipsis.svg?raw';\nimport { Cre8Element } from '../cre8-element';\nimport { Cre8Button } from '../button/button';\nimport { isMobile, screenSizes } from '../../utilities/is-mobile';\nimport './page-counter/page-counter';\nimport styles from './pagination.styles.js';\n\n/**\n * The Pagination component is used to split up a large amount of results\n * by showing only a certain amount on each page. You can cycle through\n * the pages using Page Numbers, Next and Previous Buttons, or optional\n * First Page and Last Page Buttons. This component is also used by Table\n * to cycle through rows of results. Pagination has 3 display options:\n *\n * **default**: Can contain up to seven Page Numbers (ellipses included)\n * at a time flanked by Next and Previous Buttons. When there are more than\n * seven pages, numbers start getting replaced by ellipses. Use this option\n * when you have a lot of horizontal space in a layout. It should not be used\n * for mobile web layouts since its buttons are smaller than the minimum touch target of 44px.\n * The component has built in responsivity to mobile page size so you dont have tohandle this\n * seperately\n *\n *\n * **compact** : Best used as a summary of where you are among pages or table rows flanked by\n * Previous and Next Buttons. Use this option when you have limited horizontal space but still\n * need to show where users are among results. Great for mobile layouts.\n *\n *\n * **icon-only** : Use this option in very tight spaces when it’s not required to show users\n * where they are among results. Great for mobile layouts.\n *\n *\n * ## HOW TO USE\n *\n * Select an option from the “display” dropdown depending on layout width\n * Select where your current page is from the “Page” dropdown\n * To show less pages when using Full Numbers, use the \"visiblePages” toggles\n * To hide the First Page and Last Page Buttons, turn on the “hideFirstLastButton” toggle\n * To change the states of page numbers or buttons, interact with the buttond to invoke each “State”\n * When using Compact Numbers, you can choose between “compact” and “icon-only” formats\n *\n *\n * ## ACCESSIBILITY NOTE\n *\n * To best orient people using screen readers, push focus to the top of\n * the list of results after any of the pagination buttons have been triggered,\n * **except for the currently selected one**. Focus target could be a visual results heading,\n * or the top heading of the results container of the page selected\n * via a programmatic selector, e.g. < section id=“results” aria-label=\"results-section\" > or\n * < div role= “group” aria-label=“results” >.\n *\n * @dependency cre8-button, cre8-icon, cre8-pagination-counter\n * @csspart icon - distinguishes the page buttons from the icon buttons\n * @cssproperty \"--pagination-display\" - controls the display css property\n * @cssproperty \"--pagination-justify-content\" - controls horizontal alignment of pagination\n * @cssproperty \"--pagination-align-items\" - controls vertical alignment of pagination\n *\n * @slot - Optional content rendered alongside the pagination controls\n *\n * @fires pagination-change - Fires when the page changes. `event.detail` is `{ buttonName, value }` where `value` is the new current page.\n */\n\nexport class Cre8Pagination extends Cre8Element {\n static styles = [styles];\n\n static elementDefinitions = {\n 'cre8-button': Cre8Button,\n };\n\n @state()\n _currentPage: number = 99;\n\n /**\n * Input the total number of elements are returned from consuming app e.g. search results\n * @attr number\n * @required\n */\n @property({ reflect: true, type: Number })\n totalResults!: number;\n\n\n /**\n * how many elements will displayVariant per page, indicated by business to typically be 20\n * @attr number\n */\n @property({ type: Number, reflect: true })\n get pageSize() {\n return this._pageSize;\n }\n\n set pageSize(newSize: number) {\n const oldSize = this._pageSize;\n this._pageSize = newSize;\n this.requestUpdate('pageSize', oldSize);\n }\n\n @state()\n _pageSize = 10;\n\n\n /**\n * Controls how many page buttons are displayVarianted on the page\n * at once, if container size permits. recommended max = 5 pages\n *\n * @attr number\n */\n @property({ reflect: true, type: Number })\n visiblePages?: number = 5;\n\n /**\n * (optional) prop that allows for a compact and icon-only variant both\n * for mobile screen-sizes and for use in certain contexts as guided by design,\n * the component size will show 'default' in the absence of a value on desktop and\n * 'compact' on smaller views.\n *\n * @attr 'compact' | 'icon-only' | 'default'\n * @optional\n */\n @property({ type: String, reflect: true })\n display?: 'compact' | 'icon-only' | 'default';\n\n /**\n *\n *@state watches the width of the window and responds to show the accessibility approved variant.\n */\n @state()\n windowWidth!: number;\n\n @queryAll('cre8-button')\n buttons: typeof Cre8Button[];\n\n /**\n *\n * @optional\n */\n @property({ type: Boolean, reflect: true })\n hideLastAndFirstButtons?: boolean;\n\n /**\n * The currently active page (1-based). Setting it programmatically navigates the pagination.\n */\n @property({ reflect: true, type: Number })\n get currentPage() {\n return this._currentPage;\n }\n\n set currentPage(newPage: number) {\n const oldPage = this._currentPage;\n this._currentPage = newPage;\n this.requestUpdate('currentPage', oldPage);\n }\n\n connectedCallBack() {\n super.connectedCallback();\n }\n\n get maxVisiblePages() {\n const allowedVisiblePages = {\n md: 5,\n };\n\n // lg and up\n\n if (!isMobile(screenSizes.lg.toString())) {\n return this.visiblePages;\n }\n\n if (!isMobile(screenSizes.md.toString())) {\n return Math.min(allowedVisiblePages.md, this.visiblePages);\n }\n return 0;\n }\n\n\n private get totalPages(): number {\n return Math.ceil(this.totalResults / this.pageSize);\n }\n\n private get hasNoPreviousPage() {\n return this._currentPage <= 1;\n }\n\n private get hasNoNextPage() {\n return this._currentPage >= this.totalPages;\n }\n\n private _onHandleResize() {\n this.requestUpdate();\n }\n\n handleResize() {\n this._onHandleResize.bind(this);\n }\n\n // get range of pages to display [3, 4, 5], [2, 3, 4, 5]\n protected get pageRange(): number[] {\n const left = Math.floor(this.maxVisiblePages / 2);\n let startPage = this.currentPage - left;\n startPage = Math.min(startPage, this.totalPages - this.maxVisiblePages + 1);\n startPage = Math.max(startPage, 1);\n const endPage = Math.min(startPage + this.maxVisiblePages - 1, this.totalPages);\n return [...Array(this.totalPages)].map((_, index) => index + 1).slice(startPage - 1, endPage);\n }\n\n protected async firstUpdated() {\n await this.updateComplete;\n if (this._pageSize !== this.pageSize) {\n const old = this._pageSize;\n this._pageSize = this.pageSize;\n this.requestUpdate('pageSize', old);\n }\n this.windowWidth = window.innerWidth;\n window.addEventListener('resize', () => {\n if (this.windowWidth !== window.innerWidth) {\n const oldWidth = this.windowWidth;\n this.windowWidth = window.innerWidth;\n this.handleResize();\n this.requestUpdate('isResponsive', oldWidth);\n }\n });\n if (this._currentPage !== this.currentPage) {\n const old = this._currentPage;\n this._currentPage = this.currentPage;\n this.requestUpdate('currentPage', old);\n }\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.handleResize);\n super.disconnectedCallback();\n }\n\n displayTypes(): HTMLTemplateResult {\n return html`<cre8-page-counter\n currentPage=${this.currentPage}\n style=\"display:${this.display === 'compact' ? 'flex' : 'none'};\"\n totalResults=${this.totalResults}\n pageSize=${this._pageSize}\n display=${this.display}>\n </cre8-page-counter>`;\n }\n\n private _handleKeydown = (page: number, _buttonName?: string) => (e: KeyboardEvent) => {\n if (e.code === 'Enter') {\n this._goToPage(page, _buttonName); /* 2 */\n }\n };\n\n private _goToPage = (page: number, _buttonName?: string) => () => {\n const old = this._currentPage;\n let focusButton: Cre8Button;\n this.buttons.forEach((_: typeof Cre8Button) => {\n const b = new Cre8Button();\n if (b.hideText && (b.text === _buttonName)) {\n focusButton = b;\n (focusButton.shadowRoot!.querySelector('.cre8-c-button') as HTMLButtonElement).blur();\n }\n return null;\n });\n this._currentPage = page;\n this.currentPage = this._currentPage;\n this.requestUpdate('currentPage', old);\n this.dispatchWithLegacyAlias(new CustomEvent(\n 'pagination-change',\n { detail: { buttonName: _buttonName ?? this.currentPage.toString(), value: this.currentPage } }\n ));\n };\n\n public goToPage(page: number, buttonName?: string) {\n return this._goToPage(page, buttonName).bind(this);\n }\n\n public handleKeydown(page: number, buttonName?: string) {\n return this._handleKeydown(page, buttonName);\n }\n\n render() {\n const classNames = this.componentClassNames('cre8-c-pagination', {\n 'cre8-c-pagination--compact': this.display !== undefined && this.display === 'compact',\n 'cre8-c-pagination--icon-only': this.display !== undefined && this.display === 'icon-only',\n });\n\n\n return html`<nav\n aria-label=\"pagination\"\n class=${classNames}>\n <slot></slot>\n ${!this.hideLastAndFirstButtons ? html` <cre8-button\n variant=\"tertiary\"\n size=\"sm\"\n text=\"\"\n hideText\n part=\"icon\"\n aria-disabled=\"${ifDefined(this.hasNoPreviousPage)}\"\n ?disabled=${this.hasNoPreviousPage}\n @click=${this.goToPage(1, 'First Page')}\n @keydown=${this.handleKeydown(1, 'First Page')}\n\n >\n <span slot=\"before\">\n <cre8-icon\n className=\"cre8-c-pagination__icon\"\n aria-label=\"First Page\"\n svg=${svgFirstPage}\n size=\"24\">\n </cre8-icon>\n </span>\n </cre8-button>` : nothing}\n <cre8-button\n variant=\"tertiary\"\n size=\"sm\"\n hideText\n text=\"\"\n part=\"icon\"\n aria-disabled=\"${ifDefined(this.hasNoPreviousPage)}\"\n ?disabled=${this.hasNoPreviousPage}\n @click=${this.goToPage(this._currentPage - 1, 'Previous Page')}\n @keydown=${this.handleKeydown(this.currentPage - 1, 'Previous Page')}\n\n >\n <span slot=\"before\">\n <cre8-icon\n className=\"cre8-c-pagination__icon\"\n aria-label=\"Previous Page\"\n slot=\"before\"\n svg=${svgCaretLeft}\n size=\"24\"\n\n >\n </cre8-icon>\n </span>\n </cre8-button>\n\n ${this.displayTypes()}\n ${!this.display || this.display === 'default'\n ? html`${this.pageRange[this.pageRange.length - 1] > 1 && this.pageRange[0] !== 1\n ? html` <cre8-icon\n aria-label=\"ellipsis\"\n className=\"cre8-c-pagination__icon\"\n slot=\"before\" svg=${svgEllipsis}\n size=\"24\">\n </cre8-icon>`\n : nothing}\n ${this.pageRange.map((page) => (page === this.currentPage\n ? html`<cre8-button variant=\"tertiary\" tab-index=\"-1\" text=\"${page}\" class=\"icon-only\" size=\"sm\" id=\"current\"></cre8-button>`\n : html`<cre8-button\n variant=\"tertiary\"\n size=\"sm\"\n text=\"${page}\"\n class=\"icon-only\"\n id=\"${page}\"\n @click=${this.goToPage(page, page.toString())}\n @keydown=${this.handleKeydown(page, page.toString())}>\n </cre8-button>`\n ))}\n ${this.pageRange[this.pageRange.length - 1] < this.totalPages\n ? html` <cre8-icon\n aria-label=\"ellipsis\"\n className=\"cre8-c-pagination__icon\"\n slot=\"before\" svg=${svgEllipsis}\n size=\"24\">\n </cre8-icon>`\n : nothing}`\n : nothing}\n <cre8-button\n variant=\"tertiary\"\n size=\"sm\"\n part=\"icon\"\n hideText\n text=\"\"\n aria-disabled=\"${ifDefined(this.hasNoNextPage)}\"\n ?disabled=${this.hasNoNextPage}\n @click=${this.goToPage(this.currentPage + 1, 'Next Page')}\n @keydown=${this.handleKeydown(this.currentPage + 1, 'Next Page')}\n\n >\n <span slot=\"before\">\n <cre8-icon\n aria-label=\"Next Page\"\n className=\"cre8-c-pagination__icon\"\n slot=\"before\" svg=${svgCaretRight}\n size=\"24\">\n </cre8-icon>\n </span>\n </cre8-button>\n\n ${!this.hideLastAndFirstButtons\n ? html` <cre8-button\n variant=\"tertiary\"\n size=\"sm\"\n hideText\n text=\"\"\n part=\"icon\"\n aria-disabled=\"${ifDefined(this.hasNoNextPage)}\"\n ?disabled=${this.hasNoNextPage}\n @click=${this.goToPage(this.totalPages, 'Last Page')}\n @keydown=${this.handleKeydown(this.totalPages, 'Last Page')}\n\n >\n <span slot=\"before\">\n <cre8-icon\n aria-label=\"Last Page\"\n className=\"cre8-c-pagination__icon\"\n slot=\"before\"\n svg=${svgLastPage}\n size=\"24\"\n >\n </cre8-icon>\n </span>\n </cre8-button>`\n : nothing}\n\n </nav>`;\n }\n}\n\nif (customElements.get('cre8-pagination') === undefined) {\n customElements.define('cre8-pagination', Cre8Pagination);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-pagination': Cre8Pagination;\n }\n}\n"]}
|
|
@@ -6,6 +6,8 @@ import '../progress-meter/progress-meter';
|
|
|
6
6
|
* The percent bar visually indicates a user's current progress and has a few features: a basic display bar with
|
|
7
7
|
* a percentage, an actionable icon that allows a user to revisit a prior step and an actionable link that
|
|
8
8
|
* allows a user save their progress before exiting.
|
|
9
|
+
*
|
|
10
|
+
* @fires percent-bar-left-action-click - Fires when the left action button is clicked.
|
|
9
11
|
*/
|
|
10
12
|
export declare class Cre8PercentBar extends Cre8Element {
|
|
11
13
|
static styles: import("lit").CSSResult[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"percent-bar.d.ts","sourceRoot":"","sources":["../../../components/percent-bar/percent-bar.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,kBAAkB,CAAC;AAC1B,OAAO,8BAA8B,CAAC;AACtC,OAAO,kCAAkC,CAAC;AAG1C
|
|
1
|
+
{"version":3,"file":"percent-bar.d.ts","sourceRoot":"","sources":["../../../components/percent-bar/percent-bar.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,kBAAkB,CAAC;AAC1B,OAAO,8BAA8B,CAAC;AACtC,OAAO,kCAAkC,CAAC;AAG1C;;;;;;GAMG;AACH,qBAAa,cAAe,SAAQ,WAAW;IAC7C,MAAM,CAAC,MAAM,4BAAY;IAOzB,KAAK,EAAE,MAAM,CAAC;IAMd,GAAG,EAAE,MAAM,CAAC;IAMZ,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,WAAW;IAInB,MAAM;CAoCP;AAMD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,kBAAkB,EAAE,cAAc,CAAC;KACpC;CACF;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -17,10 +17,12 @@ import styles from './percent-bar.styles.js';
|
|
|
17
17
|
* The percent bar visually indicates a user's current progress and has a few features: a basic display bar with
|
|
18
18
|
* a percentage, an actionable icon that allows a user to revisit a prior step and an actionable link that
|
|
19
19
|
* allows a user save their progress before exiting.
|
|
20
|
+
*
|
|
21
|
+
* @fires percent-bar-left-action-click - Fires when the left action button is clicked.
|
|
20
22
|
*/
|
|
21
23
|
export class Cre8PercentBar extends Cre8Element {
|
|
22
24
|
_handleClick(e) {
|
|
23
|
-
this.
|
|
25
|
+
this.dispatchWithLegacyAlias(new Event('percent-bar-left-action-click', e));
|
|
24
26
|
}
|
|
25
27
|
fractionAsPercent() {
|
|
26
28
|
return Math.round((this.value / this.max) * 100);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"percent-bar.js","sourceRoot":"","sources":["../../../components/percent-bar/percent-bar.ts"],"names":[],"mappings":";;;;;;AAAA,2BAA2B;AAC3B,OAAO,EAAE,IAAI,EAAE,OAAO,GAAI,MAAM,KAAK,CAAC;AACtC,OAAO,UAAU,MAAM,yCAAyC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAA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;;6BAET,UAAU;;;kCAGL,IAAI,CAAC,iBAAiB;gCACxB,IAAI,CAAC,YAAY;;mCAEd;YACjB,CAAC,CAAC,OAAO;;;;;;;oBAOP,IAAI,CAAC,iBAAiB,EAAE;;;;;mBAKzB,IAAI,CAAC,KAAK;iBACZ,IAAI,CAAC,GAAG;;;KAGpB,CAAC;IACJ,CAAC;;AApEM,qBAAM,GAAG,CAAC,MAAM,CAAC,CAAC;AAOzB;IADC,QAAQ,EAAE;6CACG;AAMd;IADC,QAAQ,EAAE;2CACC;AAMZ;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yDACf;AAoD9B,IAAI,cAAc,CAAC,GAAG,CAAC,kBAAkB,CAAC,KAAK,SAAS,EAAE,CAAC;IACzD,cAAc,CAAC,MAAM,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC;AAC5D,CAAC;AAQD,eAAe,cAAc,CAAC","sourcesContent":["/* eslint-disable indent */\nimport { html, nothing, } from 'lit';\nimport svgCaretUp from '@tmorrow/cre8-wc/icons/Caret_Up.svg?raw';\nimport { property } from 'lit/decorators.js';\nimport { Cre8Element } from '../cre8-element';\nimport '../button/button';\nimport '../text-passage/text-passage';\nimport '../progress-meter/progress-meter';\nimport styles from './percent-bar.styles.js';\n\n/**\n * The percent bar visually indicates a user's current progress and has a few features: a basic display bar with\n * a percentage, an actionable icon that allows a user to revisit a prior step and an actionable link that\n * allows a user save their progress before exiting.\n *\n * @fires percent-bar-left-action-click - Fires when the left action button is clicked.\n */\nexport class Cre8PercentBar extends Cre8Element {\n static styles = [styles];\n\n\n /*\n * The current step the user is on.\n */\n @property()\n value: number;\n\n /*\n * The total number of steps in the multistep process.\n */\n @property()\n max: number;\n\n /*\n * The action-left icon-only tertiary button in the percent bar controls can be disabled.\n */\n @property({ type: Boolean, reflect: true })\n disableActionLeft?: boolean;\n\n private _handleClick(e: MouseEvent) {\n this.dispatchWithLegacyAlias(new Event('percent-bar-left-action-click', e));\n }\n\n private fractionAsPercent(): number {\n return Math.round((this.value / this.max) * 100);\n }\n\n private isFirstStep(): boolean {\n return this.value > 1;\n }\n\n render() {\n const componentClassNames = this.componentClassNames('cre8-c-percent-bar', {});\n\n return html`\n <div class=\"${componentClassNames}\">\n <div class=\"cre8-c-percent-bar__controls\">\n <div lass=\"cre8-c-percent-bar__left-controls\">\n ${this.isFirstStep()\n ? html` <cre8-button\n ?hideText=${true}\n text=\"Previous step\"\n svg=\"${svgCaretUp}\"\n iconRotateDegree=\"-90\"\n variant=\"tertiary\"\n ?disabled=${this.disableActionLeft}\n @click=\"${this._handleClick}\"\n >\n </cre8-button>`\n : nothing}\n </div>\n <div class=\"cre8-c-percent-bar__right-controls\">\n <cre8-text-passage\n size=\"small\"\n class=\"cre8-c-percent-bar__text-passage\"\n >\n ${this.fractionAsPercent()}%\n </cre8-text-passage>\n </div>\n </div>\n <cre8-progress-meter\n value=\"${this.value}\"\n max=\"${this.max}\"\n ></cre8-progress-meter>\n </div>\n `;\n }\n}\n\nif (customElements.get('cre8-percent-bar') === undefined) {\n customElements.define('cre8-percent-bar', Cre8PercentBar);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-percent-bar': Cre8PercentBar;\n }\n}\n\nexport default Cre8PercentBar;\n"]}
|
|
@@ -8,8 +8,8 @@ import '../heading/heading';
|
|
|
8
8
|
* @slot header - Custom header content for the popover panel
|
|
9
9
|
* @slot footer - Custom footer content for the popover panel
|
|
10
10
|
*
|
|
11
|
-
* @fires open - Fires when the popover opens. `event.detail.isActive` is `true`.
|
|
12
|
-
* @fires close - Fires when the popover closes. `event.detail.isActive` is `false`.
|
|
11
|
+
* @fires popover-open - Fires when the popover opens. `event.detail.isActive` is `true`.
|
|
12
|
+
* @fires popover-close - Fires when the popover closes. `event.detail.isActive` is `false`.
|
|
13
13
|
*/
|
|
14
14
|
export declare class Cre8Popover extends Cre8Element {
|
|
15
15
|
static styles: import("lit").CSSResult[];
|
|
@@ -20,11 +20,10 @@ export declare class Cre8Popover extends Cre8Element {
|
|
|
20
20
|
heading?: string;
|
|
21
21
|
/**
|
|
22
22
|
* Positions the popover panel absolutely to the trigger
|
|
23
|
-
* -
|
|
24
|
-
* - **top** positions the popover panel
|
|
25
|
-
* - **left** positions the popover panel
|
|
26
|
-
* - **right** positions the popover panel
|
|
27
|
-
* @attr {string | undefined}
|
|
23
|
+
* - Omitting this prop positions the popover panel below the trigger
|
|
24
|
+
* - **top** positions the popover panel above the trigger
|
|
25
|
+
* - **left** positions the popover panel to the left of the trigger
|
|
26
|
+
* - **right** positions the popover panel to the right of the trigger
|
|
28
27
|
*/
|
|
29
28
|
position?: 'top' | 'left' | 'right';
|
|
30
29
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../../components/popover/popover.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,oBAAoB,CAAC;AAI5B;;;;;;;;;;GAUG;AAEH,qBAAa,WAAY,SAAQ,WAAW;IACxC,MAAM,CAAC,MAAM,4BAAY;IAE3B;;;OAGG;IAEC,OAAO,CAAC,EAAE,MAAM,CAAC;IAErB
|
|
1
|
+
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../../components/popover/popover.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,oBAAoB,CAAC;AAI5B;;;;;;;;;;GAUG;AAEH,qBAAa,WAAY,SAAQ,WAAW;IACxC,MAAM,CAAC,MAAM,4BAAY;IAE3B;;;OAGG;IAEC,OAAO,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;OAMG;IAEC,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;IAExC;;;OAGG;IAEC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;;OAKG;IAEC,SAAS,CAAC,EAAE,OAAO,CAAC;IAExB;;;;OAIG;IAEC,eAAe,CAAC,EAAE,OAAO,CAAC;IAE9B;;;;;;;OAOG;IAEC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAGvB;;OAEG;IAEC,YAAY,EAAE,WAAW,CAAC;IAE9B;;OAEG;IAEC,iBAAiB,EAAE,WAAW,CAAC;IAEnC;;OAEG;IAEC,mBAAmB,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAE5C;;OAEG;IAEC,kBAAkB,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAE3C;;;OAGG;IACH,IAAI,KAAK,YAER;IAED;;;;;;OAMG;IACH,iBAAiB;IAQjB;;;;;;OAMG;IACH,oBAAoB;IAQpB;;;OAGG;IACH,YAAY;IAIZ;;;;;OAKG;IACH,OAAO;IAaP;;OAEG;IACH,eAAe;IAyCf;;;;;;OAMG;IACH,OAAO,CAAC,aAAa;IA8BrB;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,sBAAsB;IAe9B,OAAO,CAAC,qBAAqB;IAK7B,OAAO,CAAC,4BAA4B;IAKpC;;;;;;;;;;;OAWG;IACH,oBAAoB,GAAI,GAAG,UAAU,UAoBnC;IAEF;;;;OAIG;IACH,oBAAoB,aAYlB;IAEF;;;OAGG;IACH,YAAY,aAIV;IAEF,MAAM;CAsCP;AAMD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -17,8 +17,8 @@ import styles from './popover.styles.js';
|
|
|
17
17
|
* @slot header - Custom header content for the popover panel
|
|
18
18
|
* @slot footer - Custom footer content for the popover panel
|
|
19
19
|
*
|
|
20
|
-
* @fires open - Fires when the popover opens. `event.detail.isActive` is `true`.
|
|
21
|
-
* @fires close - Fires when the popover closes. `event.detail.isActive` is `false`.
|
|
20
|
+
* @fires popover-open - Fires when the popover opens. `event.detail.isActive` is `true`.
|
|
21
|
+
* @fires popover-close - Fires when the popover closes. `event.detail.isActive` is `false`.
|
|
22
22
|
*/
|
|
23
23
|
export class Cre8Popover extends Cre8Element {
|
|
24
24
|
constructor() {
|
|
@@ -192,11 +192,11 @@ export class Cre8Popover extends Cre8Element {
|
|
|
192
192
|
requestAnimationFrame(() => {
|
|
193
193
|
this.dynamicPosition();
|
|
194
194
|
});
|
|
195
|
-
this.
|
|
195
|
+
this.dispatchWithLegacyAlias(new CustomEvent('popover-open', { detail: { isActive: this.isActive }, bubbles: true, composed: true }));
|
|
196
196
|
}
|
|
197
197
|
else {
|
|
198
198
|
/* 3 */
|
|
199
|
-
this.
|
|
199
|
+
this.dispatchWithLegacyAlias(new CustomEvent('popover-close', { detail: { isActive: this.isActive }, bubbles: true, composed: true }));
|
|
200
200
|
}
|
|
201
201
|
/**
|
|
202
202
|
* Toggle the active state for dynamic. This prevents a flash of the popover in the orginal position
|