@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","sourceRoot":"","sources":["../../../components/popover/popover.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,GAAI,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,oBAAoB,CAAC;AAC5B,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAGzC;;;;;;;;;;GAUG;AAEH,MAAM,OAAO,WAAY,SAAQ,WAAW;IAA5C;;QAgRE;;;;;;;;;;;WAWG;QACH,yBAAoB,GAAG,CAAC,CAAa,EAAE,EAAE;YACvC,OAAO;YACL,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACjB,OAAO;YACX,CAAC;YAEH,OAAO;YACL,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;gBACzB,MAAM,KAAK,CAAC,wDAAwD,CAAC,CAAC;YAC1E,CAAC;YAEH,OAAO;YACL,MAAM,cAAc,GAAG,CAAC,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAEzE,OAAO;YACL,IAAI,CAAC,CAAC,CAAC,CAAC,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AAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDACb;AAW1B;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CACpB;AAOnB;IADH,KAAK,CAAC,iBAAiB,CAAC;iDACK;AAM1B;IADH,KAAK,CAAC,wBAAwB,CAAC;sDACG;AAM/B;IADH,qBAAqB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;wDACC;AAMxC;IADH,qBAAqB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;uDACC;AAwS7C,IAAI,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,SAAS,EAAE,CAAC;IACnD,cAAc,CAAC,MAAM,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;AACvD,CAAC;AAQD,eAAe,WAAW,CAAC","sourcesContent":["import { html, nothing, } from 'lit';\nimport { property, query, queryAssignedElements } from 'lit/decorators.js';\nimport { Cre8Element } from '../cre8-element';\nimport '../heading/heading';\nimport styles from './popover.styles.js';\nimport { Cre8Button } from '../button/button';\n\n/**\n * The Popover is for progressive disclosure of relevant content often hidden behind a help or info icon.\n * Its content should be no longer than 3-4 lines in addition to a line of heading text and an optional button.\n * @slot - The component content\n * @slot trigger - The element that toggles the popover open and closed\n * @slot header - Custom header content for the popover panel\n * @slot footer - Custom footer content for the popover panel\n *\n * @fires open - Fires when the popover opens. `event.detail.isActive` is `true`.\n * @fires close - Fires when the popover closes. `event.detail.isActive` is `false`.\n */\n\nexport class Cre8Popover extends Cre8Element {\n static styles = [styles];\n\n /**\n * The heading text that appears at the top of the popover panel. Should only be 2-3 lines max.\n * @attr {string | undefined}\n */\n @property()\n heading?: string;\n\n /**\n * Positions the popover panel absolutely to the trigger\n * - **default** positions the popover panel below the trigger\n * - **top** positions the popover panel below the trigger\n * - **left** positions the popover panel below the trigger\n * - **right** positions the popover panel below the trigger\n * @attr {string | undefined}\n */\n @property()\n position?: 'top' | 'left' | 'right';\n\n /**\n * Set to prevent the popover panel from hiding on scroll\n * @attr {boolean | undefined}\n */\n @property({ type: Boolean, reflect: true })\n isVisibleOnScroll?: boolean;\n\n /**\n * The dynamic state for the popover\n * - If true, the popover panel placement is determined by its position in the viewport\n * - If false, the popover panel placement will be placed according to the position value\n * @attr {boolean | undefined}\n */\n @property({ type: Boolean, reflect: true })\n isDynamic?: boolean;\n\n /**\n * The dynamic active state\n * _This property is dynamically set_\n * @attr {boolean | undefined}\n */\n @property({ type: Boolean, reflect: true })\n isActiveDynamic?: boolean;\n\n /**\n * The active state for the popover\n * - If true, the popover panel is visible\n * - If false, the popover panel is hidden\n *\n * _This property is dynamically set_\n * @attr {boolean | undefined}\n */\n @property({ type: Boolean, reflect: true })\n isActive?: boolean;\n\n\n /**\n * Query the popover panel element\n */\n @query('.cre8-c-popover')\n _Cre8Popover: HTMLElement;\n\n /**\n * Query the popover panel element\n */\n @query('.cre8-c-popover__panel')\n _Cre8PopoverPanel: HTMLElement;\n\n /**\n * Query the assigned elements in the trigger slot\n */\n @queryAssignedElements({ slot: 'trigger' })\n _Cre8PopoverTrigger: Array<HTMLElement>;\n\n /**\n * Query the assigned elements in the footer slot\n */\n @queryAssignedElements({ slot: 'footer' })\n _Cre8PopoverFooter: Array<HTMLElement>;\n\n /**\n * Query the document direction value\n * <br/><br/> _*This property is dynamically set_\n */\n get isRTL() {\n return document.dir === 'rtl';\n }\n\n /**\n * Connected Callback Lifecycle\n * 1. Add window resize event listener\n * 2. Add window scroll event listener\n * 3. Add window orientation change event listener\n * 4. Add mousedown event listener\n */\n connectedCallback() {\n super.connectedCallback();\n globalThis.window.addEventListener('resize', this.removeActive); /* 1 */\n globalThis.window.addEventListener('scroll', this.removeActiveOnScroll); /* 2 */\n globalThis.window.addEventListener('orientationchange', this.removeActive); /* 3 */\n globalThis.document.addEventListener('mousedown', this.handleOnClickOutside, false); /* 4 */\n }\n\n /**\n * Disconnected Callback Lifecycle\n * 1. Remove window resize event listener\n * 2. Remove window scroll event listener\n * 3. Remove window orientation change event listener\n * 4. Remove mousedown event listener\n */\n disconnectedCallback() {\n super.disconnectedCallback();\n globalThis.window.removeEventListener('resize', this.removeActive); /* 1 */\n globalThis.window.removeEventListener('scroll', this.removeActiveOnScroll); /* 2 */\n globalThis.window.removeEventListener('orientationchange', this.removeActive); /* 3 */\n globalThis.document.removeEventListener('mousedown', this.handleOnClickOutside, false); /* 4 */\n }\n\n /**\n * First Updated Lifecycle\n * 1. Set attribute since aria expanded can't be passed down through the slot\n */\n firstUpdated() {\n this.addAria(); /* 1 */\n }\n\n /**\n * Add aria attributes on the trigger button\n * 1. Select the element within the trigger slot\n * 2. Set aria-expanded on the popover trigger to the active state if provided. Otherwise, set to false.\n * 3 Set the type to button.\n */\n addAria() {\n /* 1 */\n let popoverTrigger;\n if (this._Cre8PopoverTrigger[0].tagName === 'CRE8-BUTTON') {\n popoverTrigger = this._Cre8PopoverTrigger[0] as Cre8Button;\n popoverTrigger.buttonAriaExpanded = this.isActive ? this.isActive : false;\n } else {\n popoverTrigger = this._Cre8PopoverTrigger[0];\n popoverTrigger.setAttribute('aria-expanded', `${this.isActive ? this.isActive : false}`); /* 2 */\n popoverTrigger.setAttribute('type', 'button'); /* 3 */\n }\n }\n\n /**\n * Handle all dynamic placement\n */\n dynamicPosition() {\n // TODO: Temporarily keep eslint complexity as warning. Update during specific story for this rule.\n /* eslint complexity: [\"warn\", 10] */\n if (this.isDynamic && this._Cre8PopoverPanel) {\n const body = document.querySelector('body').getBoundingClientRect();\n const popoverPanel = this._Cre8PopoverPanel.getBoundingClientRect();\n\n /**\n * If popover panel breaks out the left side of the window, position it to the right\n */\n if (popoverPanel.left < 0) {\n this.position = this.isRTL ? 'left' : 'right';\n }\n\n /**\n * If popover panel breaks out the right side of the window, position it to the left\n */\n if (popoverPanel.right >= body.width) {\n this.position = this.isRTL ? 'right' : 'left';\n }\n\n /**\n * If popover panel breaks out the top side of the window only, position it to the bottom\n */\n if (popoverPanel.top < 0 && popoverPanel.left > 0 && popoverPanel.right < body.width) {\n this.position = null;\n }\n\n /**\n * If popover panel breaks out the bottom side of the window only, position it to the top\n */\n if (\n popoverPanel.bottom >= window.innerHeight\n && popoverPanel.left >= 0\n && popoverPanel.right <= body.width\n ) {\n this.position = 'top';\n }\n }\n }\n\n /**\n * Set Popover Active State\n * 1. Toggle the active state between true and false\n * 2. Set attribute since aria expanded can't be passed down through the slot\n * 3. If the active state is toggled to false, close the panel and return focus to the dropdown trigger.\n * This accounts for both design system buttons and native HTML buttons\n */\n private _toggleActive() {\n this.isActive = !this.isActive; /* 1 */\n this.addAria(); /* 2 */\n\n if (this.isActive) {\n requestAnimationFrame(() => {\n this.dynamicPosition();\n });\n this.dispatchEvent(\n new CustomEvent('open', { detail: { isActive: this.isActive }, bubbles: true, composed: true })\n );\n } else {\n /* 3 */\n this.dispatchEvent(\n new CustomEvent('close', { detail: { isActive: this.isActive }, bubbles: true, composed: true })\n );\n }\n\n /**\n * Toggle the active state for dynamic. This prevents a flash of the popover in the orginal position\n */\n setTimeout(() => {\n if (this.isActive) {\n this.isActiveDynamic = true;\n } else {\n this.isActiveDynamic = false;\n }\n }, 2);\n }\n\n /**\n * Handle Keydown\n * 1. If the panel is open and escape is keyed, close the popover panel and return focus to the trigger button\n * 2. If the panel is opened, tab away closes the popover panel\n * 3. The panel can be opened and closed by Enter or Space keys.\n */\n private _handleKeydown(e: KeyboardEvent) {\n if (e.key === 'Escape' && this.isActive === true) {\n this._toggleActive();\n } else if (e.key === 'Tab') {\n this._handleTabNavigation(e);\n }\n }\n\n private _handleTabNavigation(e: KeyboardEvent) {\n if (this.isActive) {\n this._navigateInsidePopover(e);\n }\n }\n\n private _navigateInsidePopover(e: KeyboardEvent) {\n const focusableElements = this._getFocusableElements();\n if (focusableElements.length === 0) {\n this._closePopoverAndFocusTrigger(e);\n return;\n }\n\n const lastFocusableElement = focusableElements[focusableElements.length - 1] as HTMLElement;\n\n if (document.activeElement === lastFocusableElement) {\n this._closePopoverAndFocusTrigger(e);\n e.preventDefault();\n }\n }\n\n private _getFocusableElements(): HTMLElement[] {\n const panelFocusableElements = Array.from(this._Cre8PopoverFooter);\n return [...panelFocusableElements];\n }\n\n private _closePopoverAndFocusTrigger(e: KeyboardEvent) {\n this._toggleActive();\n e.preventDefault();\n }\n\n /**\n * Handle click outside the component\n * 1. Close the show/hide popover panel on click outside\n * 2. If the popover panel is already closed then we don't care about outside clicks and we can bail early\n * 3. By the time a user clicks on the page the shadowRoot will almost certainly be\n * defined, but TypeScript isn't that trusting and sees this.shadowRoot as possibly\n * undefined. To work around that we'll check that we have a shadowRoot (and a\n * rendered .host) element here to appease the TypeScript compiler. This should never\n * actually be shown or run for a human end user.\n * 4. Check to see if we clicked inside the active panel\n * 5. If the panel is active and we've clicked outside of the panel then it should be closed.\n */\n handleOnClickOutside = (e: MouseEvent) => {\n /* 2 */\n if (!this.isActive) {\n return;\n }\n\n /* 3 */\n if (!this.shadowRoot?.host) {\n throw Error('Could not determine panel context during click handler');\n }\n\n /* 4 */\n const didClickInside = e.composedPath().includes(this.shadowRoot.host);\n\n /* 5 */\n if (!(e.target === document.querySelector('html') && e.clientX >= document.documentElement.offsetWidth)) {\n if (this.isActive && !didClickInside) {\n this._toggleActive();\n }\n }\n };\n\n /**\n * Remove Active State on Scroll\n * 1. If a scroll event is fired and visibileOnScroll is not true, remove the active state\n * 2. If the popover height is less than the window height, then allow the active to remove on scroll\n */\n removeActiveOnScroll = () => {\n /* 1 */\n if (this.isActive && !this.isVisibleOnScroll) {\n /* 2 */\n const popoverPanel = this._Cre8PopoverPanel.getBoundingClientRect();\n const popoverTrigger = this._Cre8Popover;\n const popoverHeight = popoverTrigger.clientHeight + popoverPanel.height + popoverPanel.top;\n\n if (popoverHeight < window.innerHeight) {\n this._toggleActive();\n }\n }\n };\n\n /**\n * Remove Active State\n * 1. If a specific event is fired, remove the active state.\n */\n removeActive = () => {\n if (this.isActive) {\n this._toggleActive();\n }\n };\n\n render() {\n const componentClassNames = this.componentClassNames('cre8-c-popover', {\n 'cre8-c-popover--top': this.position === 'top',\n 'cre8-c-popover--left': this.position === 'left',\n 'cre8-c-popover--right': this.position === 'right',\n 'cre8-is-active': this.isActive,\n 'cre8-is-dynamic': this.isDynamic,\n 'cre8-is-dynamic-active': this.isActiveDynamic,\n });\n\n return html`\n <div class=\"${componentClassNames}\">\n ${this.slotNotEmpty('trigger')\n && html` <slot name=\"trigger\" @keydown=${this._handleKeydown} @click=${this._toggleActive}></slot> `}\n ${this.isActive\n ? html`\n <div tabindex=\"0\" class=\"cre8-c-popover__panel\" @keydown=${this._handleKeydown}>\n ${(this.slotNotEmpty('header') || this.heading)\n && html`\n <div class=\"cre8-c-popover__header\">\n ${this.heading\n ? html`<div class=\"cre8-c-popover__heading\">${this.heading}</div>`\n : html`<slot name=\"header\"></slot>`}\n </div>\n `}\n <slot></slot>\n ${this.slotNotEmpty('footer')\n && html`\n <div class=\"cre8-c-popover__footer\">\n <slot name=\"footer\"></slot>\n </div>\n `}\n </div>\n `\n : nothing}\n </div>\n `;\n }\n}\n\nif (customElements.get('cre8-popover') === undefined) {\n customElements.define('cre8-popover', Cre8Popover);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-popover': Cre8Popover;\n }\n}\n\nexport default Cre8Popover;\n"]}
|
|
1
|
+
{"version":3,"file":"popover.js","sourceRoot":"","sources":["../../../components/popover/popover.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,GAAI,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,oBAAoB,CAAC;AAC5B,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAGzC;;;;;;;;;;GAUG;AAEH,MAAM,OAAO,WAAY,SAAQ,WAAW;IAA5C;;QA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AC,YAAY,CAAC,QAAQ,CAAC;mBAC1B,IAAI,CAAA;;;;iBAIN;;aAEJ;YACL,CAAC,CAAC,OAAO;;KAEZ,CAAC;IACJ,CAAC;;AAlXQ,kBAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AAOvB;IADH,QAAQ,EAAE;4CACU;AAUjB;IADH,QAAQ,EAAE;6CAC6B;AAOpC;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sDACX;AAS5B;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CACnB;AAQpB;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDACb;AAW1B;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CACpB;AAOnB;IADH,KAAK,CAAC,iBAAiB,CAAC;iDACK;AAM1B;IADH,KAAK,CAAC,wBAAwB,CAAC;sDACG;AAM/B;IADH,qBAAqB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;wDACC;AAMxC;IADH,qBAAqB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;uDACC;AAwS7C,IAAI,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,SAAS,EAAE,CAAC;IACnD,cAAc,CAAC,MAAM,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;AACvD,CAAC;AAQD,eAAe,WAAW,CAAC","sourcesContent":["import { html, nothing, } from 'lit';\nimport { property, query, queryAssignedElements } from 'lit/decorators.js';\nimport { Cre8Element } from '../cre8-element';\nimport '../heading/heading';\nimport styles from './popover.styles.js';\nimport { Cre8Button } from '../button/button';\n\n/**\n * The Popover is for progressive disclosure of relevant content often hidden behind a help or info icon.\n * Its content should be no longer than 3-4 lines in addition to a line of heading text and an optional button.\n * @slot - The component content\n * @slot trigger - The element that toggles the popover open and closed\n * @slot header - Custom header content for the popover panel\n * @slot footer - Custom footer content for the popover panel\n *\n * @fires popover-open - Fires when the popover opens. `event.detail.isActive` is `true`.\n * @fires popover-close - Fires when the popover closes. `event.detail.isActive` is `false`.\n */\n\nexport class Cre8Popover extends Cre8Element {\n static styles = [styles];\n\n /**\n * The heading text that appears at the top of the popover panel. Should only be 2-3 lines max.\n * @attr {string | undefined}\n */\n @property()\n heading?: string;\n\n /**\n * Positions the popover panel absolutely to the trigger\n * - Omitting this prop positions the popover panel below the trigger\n * - **top** positions the popover panel above the trigger\n * - **left** positions the popover panel to the left of the trigger\n * - **right** positions the popover panel to the right of the trigger\n */\n @property()\n position?: 'top' | 'left' | 'right';\n\n /**\n * Set to prevent the popover panel from hiding on scroll\n * @attr {boolean | undefined}\n */\n @property({ type: Boolean, reflect: true })\n isVisibleOnScroll?: boolean;\n\n /**\n * The dynamic state for the popover\n * - If true, the popover panel placement is determined by its position in the viewport\n * - If false, the popover panel placement will be placed according to the position value\n * @attr {boolean | undefined}\n */\n @property({ type: Boolean, reflect: true })\n isDynamic?: boolean;\n\n /**\n * The dynamic active state\n * _This property is dynamically set_\n * @attr {boolean | undefined}\n */\n @property({ type: Boolean, reflect: true })\n isActiveDynamic?: boolean;\n\n /**\n * The active state for the popover\n * - If true, the popover panel is visible\n * - If false, the popover panel is hidden\n *\n * _This property is dynamically set_\n * @attr {boolean | undefined}\n */\n @property({ type: Boolean, reflect: true })\n isActive?: boolean;\n\n\n /**\n * Query the popover panel element\n */\n @query('.cre8-c-popover')\n _Cre8Popover: HTMLElement;\n\n /**\n * Query the popover panel element\n */\n @query('.cre8-c-popover__panel')\n _Cre8PopoverPanel: HTMLElement;\n\n /**\n * Query the assigned elements in the trigger slot\n */\n @queryAssignedElements({ slot: 'trigger' })\n _Cre8PopoverTrigger: Array<HTMLElement>;\n\n /**\n * Query the assigned elements in the footer slot\n */\n @queryAssignedElements({ slot: 'footer' })\n _Cre8PopoverFooter: Array<HTMLElement>;\n\n /**\n * Query the document direction value\n * <br/><br/> _*This property is dynamically set_\n */\n get isRTL() {\n return document.dir === 'rtl';\n }\n\n /**\n * Connected Callback Lifecycle\n * 1. Add window resize event listener\n * 2. Add window scroll event listener\n * 3. Add window orientation change event listener\n * 4. Add mousedown event listener\n */\n connectedCallback() {\n super.connectedCallback();\n globalThis.window.addEventListener('resize', this.removeActive); /* 1 */\n globalThis.window.addEventListener('scroll', this.removeActiveOnScroll); /* 2 */\n globalThis.window.addEventListener('orientationchange', this.removeActive); /* 3 */\n globalThis.document.addEventListener('mousedown', this.handleOnClickOutside, false); /* 4 */\n }\n\n /**\n * Disconnected Callback Lifecycle\n * 1. Remove window resize event listener\n * 2. Remove window scroll event listener\n * 3. Remove window orientation change event listener\n * 4. Remove mousedown event listener\n */\n disconnectedCallback() {\n super.disconnectedCallback();\n globalThis.window.removeEventListener('resize', this.removeActive); /* 1 */\n globalThis.window.removeEventListener('scroll', this.removeActiveOnScroll); /* 2 */\n globalThis.window.removeEventListener('orientationchange', this.removeActive); /* 3 */\n globalThis.document.removeEventListener('mousedown', this.handleOnClickOutside, false); /* 4 */\n }\n\n /**\n * First Updated Lifecycle\n * 1. Set attribute since aria expanded can't be passed down through the slot\n */\n firstUpdated() {\n this.addAria(); /* 1 */\n }\n\n /**\n * Add aria attributes on the trigger button\n * 1. Select the element within the trigger slot\n * 2. Set aria-expanded on the popover trigger to the active state if provided. Otherwise, set to false.\n * 3 Set the type to button.\n */\n addAria() {\n /* 1 */\n let popoverTrigger;\n if (this._Cre8PopoverTrigger[0].tagName === 'CRE8-BUTTON') {\n popoverTrigger = this._Cre8PopoverTrigger[0] as Cre8Button;\n popoverTrigger.buttonAriaExpanded = this.isActive ? this.isActive : false;\n } else {\n popoverTrigger = this._Cre8PopoverTrigger[0];\n popoverTrigger.setAttribute('aria-expanded', `${this.isActive ? this.isActive : false}`); /* 2 */\n popoverTrigger.setAttribute('type', 'button'); /* 3 */\n }\n }\n\n /**\n * Handle all dynamic placement\n */\n dynamicPosition() {\n // TODO: Temporarily keep eslint complexity as warning. Update during specific story for this rule.\n /* eslint complexity: [\"warn\", 10] */\n if (this.isDynamic && this._Cre8PopoverPanel) {\n const body = document.querySelector('body').getBoundingClientRect();\n const popoverPanel = this._Cre8PopoverPanel.getBoundingClientRect();\n\n /**\n * If popover panel breaks out the left side of the window, position it to the right\n */\n if (popoverPanel.left < 0) {\n this.position = this.isRTL ? 'left' : 'right';\n }\n\n /**\n * If popover panel breaks out the right side of the window, position it to the left\n */\n if (popoverPanel.right >= body.width) {\n this.position = this.isRTL ? 'right' : 'left';\n }\n\n /**\n * If popover panel breaks out the top side of the window only, position it to the bottom\n */\n if (popoverPanel.top < 0 && popoverPanel.left > 0 && popoverPanel.right < body.width) {\n this.position = null;\n }\n\n /**\n * If popover panel breaks out the bottom side of the window only, position it to the top\n */\n if (\n popoverPanel.bottom >= window.innerHeight\n && popoverPanel.left >= 0\n && popoverPanel.right <= body.width\n ) {\n this.position = 'top';\n }\n }\n }\n\n /**\n * Set Popover Active State\n * 1. Toggle the active state between true and false\n * 2. Set attribute since aria expanded can't be passed down through the slot\n * 3. If the active state is toggled to false, close the panel and return focus to the dropdown trigger.\n * This accounts for both design system buttons and native HTML buttons\n */\n private _toggleActive() {\n this.isActive = !this.isActive; /* 1 */\n this.addAria(); /* 2 */\n\n if (this.isActive) {\n requestAnimationFrame(() => {\n this.dynamicPosition();\n });\n this.dispatchWithLegacyAlias(\n new CustomEvent('popover-open', { detail: { isActive: this.isActive }, bubbles: true, composed: true })\n );\n } else {\n /* 3 */\n this.dispatchWithLegacyAlias(\n new CustomEvent('popover-close', { detail: { isActive: this.isActive }, bubbles: true, composed: true })\n );\n }\n\n /**\n * Toggle the active state for dynamic. This prevents a flash of the popover in the orginal position\n */\n setTimeout(() => {\n if (this.isActive) {\n this.isActiveDynamic = true;\n } else {\n this.isActiveDynamic = false;\n }\n }, 2);\n }\n\n /**\n * Handle Keydown\n * 1. If the panel is open and escape is keyed, close the popover panel and return focus to the trigger button\n * 2. If the panel is opened, tab away closes the popover panel\n * 3. The panel can be opened and closed by Enter or Space keys.\n */\n private _handleKeydown(e: KeyboardEvent) {\n if (e.key === 'Escape' && this.isActive === true) {\n this._toggleActive();\n } else if (e.key === 'Tab') {\n this._handleTabNavigation(e);\n }\n }\n\n private _handleTabNavigation(e: KeyboardEvent) {\n if (this.isActive) {\n this._navigateInsidePopover(e);\n }\n }\n\n private _navigateInsidePopover(e: KeyboardEvent) {\n const focusableElements = this._getFocusableElements();\n if (focusableElements.length === 0) {\n this._closePopoverAndFocusTrigger(e);\n return;\n }\n\n const lastFocusableElement = focusableElements[focusableElements.length - 1] as HTMLElement;\n\n if (document.activeElement === lastFocusableElement) {\n this._closePopoverAndFocusTrigger(e);\n e.preventDefault();\n }\n }\n\n private _getFocusableElements(): HTMLElement[] {\n const panelFocusableElements = Array.from(this._Cre8PopoverFooter);\n return [...panelFocusableElements];\n }\n\n private _closePopoverAndFocusTrigger(e: KeyboardEvent) {\n this._toggleActive();\n e.preventDefault();\n }\n\n /**\n * Handle click outside the component\n * 1. Close the show/hide popover panel on click outside\n * 2. If the popover panel is already closed then we don't care about outside clicks and we can bail early\n * 3. By the time a user clicks on the page the shadowRoot will almost certainly be\n * defined, but TypeScript isn't that trusting and sees this.shadowRoot as possibly\n * undefined. To work around that we'll check that we have a shadowRoot (and a\n * rendered .host) element here to appease the TypeScript compiler. This should never\n * actually be shown or run for a human end user.\n * 4. Check to see if we clicked inside the active panel\n * 5. If the panel is active and we've clicked outside of the panel then it should be closed.\n */\n handleOnClickOutside = (e: MouseEvent) => {\n /* 2 */\n if (!this.isActive) {\n return;\n }\n\n /* 3 */\n if (!this.shadowRoot?.host) {\n throw Error('Could not determine panel context during click handler');\n }\n\n /* 4 */\n const didClickInside = e.composedPath().includes(this.shadowRoot.host);\n\n /* 5 */\n if (!(e.target === document.querySelector('html') && e.clientX >= document.documentElement.offsetWidth)) {\n if (this.isActive && !didClickInside) {\n this._toggleActive();\n }\n }\n };\n\n /**\n * Remove Active State on Scroll\n * 1. If a scroll event is fired and visibileOnScroll is not true, remove the active state\n * 2. If the popover height is less than the window height, then allow the active to remove on scroll\n */\n removeActiveOnScroll = () => {\n /* 1 */\n if (this.isActive && !this.isVisibleOnScroll) {\n /* 2 */\n const popoverPanel = this._Cre8PopoverPanel.getBoundingClientRect();\n const popoverTrigger = this._Cre8Popover;\n const popoverHeight = popoverTrigger.clientHeight + popoverPanel.height + popoverPanel.top;\n\n if (popoverHeight < window.innerHeight) {\n this._toggleActive();\n }\n }\n };\n\n /**\n * Remove Active State\n * 1. If a specific event is fired, remove the active state.\n */\n removeActive = () => {\n if (this.isActive) {\n this._toggleActive();\n }\n };\n\n render() {\n const componentClassNames = this.componentClassNames('cre8-c-popover', {\n 'cre8-c-popover--top': this.position === 'top',\n 'cre8-c-popover--left': this.position === 'left',\n 'cre8-c-popover--right': this.position === 'right',\n 'cre8-is-active': this.isActive,\n 'cre8-is-dynamic': this.isDynamic,\n 'cre8-is-dynamic-active': this.isActiveDynamic,\n });\n\n return html`\n <div class=\"${componentClassNames}\">\n ${this.slotNotEmpty('trigger')\n && html` <slot name=\"trigger\" @keydown=${this._handleKeydown} @click=${this._toggleActive}></slot> `}\n ${this.isActive\n ? html`\n <div tabindex=\"0\" class=\"cre8-c-popover__panel\" @keydown=${this._handleKeydown}>\n ${(this.slotNotEmpty('header') || this.heading)\n && html`\n <div class=\"cre8-c-popover__header\">\n ${this.heading\n ? html`<div class=\"cre8-c-popover__heading\">${this.heading}</div>`\n : html`<slot name=\"header\"></slot>`}\n </div>\n `}\n <slot></slot>\n ${this.slotNotEmpty('footer')\n && html`\n <div class=\"cre8-c-popover__footer\">\n <slot name=\"footer\"></slot>\n </div>\n `}\n </div>\n `\n : nothing}\n </div>\n `;\n }\n}\n\nif (customElements.get('cre8-popover') === undefined) {\n customElements.define('cre8-popover', Cre8Popover);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-popover': Cre8Popover;\n }\n}\n\nexport default Cre8Popover;\n"]}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import { Cre8Element } from '../cre8-element';
|
|
2
|
-
export declare enum status {
|
|
3
|
-
'error' = 0,
|
|
4
|
-
'warning' = 1,
|
|
5
|
-
'success' = 2,
|
|
6
|
-
undefined = 3
|
|
7
|
-
}
|
|
8
2
|
/**
|
|
9
3
|
* A progress meter provides feedback that the system is working and gives
|
|
10
4
|
* the user an indication of how much time they will wait.
|
|
@@ -18,8 +12,6 @@ export declare class Cre8ProgressMeter extends Cre8Element {
|
|
|
18
12
|
* - **Error** renders a meter with an error status fill
|
|
19
13
|
* - **Warning** renders a meter with a warning status
|
|
20
14
|
* - **Success** renders a meter with a success status fill
|
|
21
|
-
*
|
|
22
|
-
* @attr {status}
|
|
23
15
|
*/
|
|
24
16
|
status?: 'error' | 'warning' | 'success';
|
|
25
17
|
knockout?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-meter.d.ts","sourceRoot":"","sources":["../../../components/progress-meter/progress-meter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI9C
|
|
1
|
+
{"version":3,"file":"progress-meter.d.ts","sourceRoot":"","sources":["../../../components/progress-meter/progress-meter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI9C;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;IAC9C,MAAM,CAAC,MAAM,4BAAY;IAE3B;;;;;;OAMG;IAEC,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;IAOzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAOnB,GAAG,EAAE,MAAM,CAAO;IAQlB,KAAK,EAAE,MAAM,CAAC;IAElB;;;OAGG;IAEC,OAAO,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IAEC,IAAI,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IAEC,KAAK,EAAE,MAAM,CAAC;IAElB,iBAAiB;IAKjB,MAAM;CAuBP;AAMD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,qBAAqB,EAAE,iBAAiB,CAAC;KAC1C;CACF"}
|
|
@@ -9,13 +9,6 @@ import { property } from 'lit/decorators.js';
|
|
|
9
9
|
import { nanoid } from 'nanoid';
|
|
10
10
|
import { Cre8Element } from '../cre8-element';
|
|
11
11
|
import styles from './progress-meter.styles.js';
|
|
12
|
-
export var status;
|
|
13
|
-
(function (status) {
|
|
14
|
-
status[status["error"] = 0] = "error";
|
|
15
|
-
status[status["warning"] = 1] = "warning";
|
|
16
|
-
status[status["success"] = 2] = "success";
|
|
17
|
-
status[status["undefined"] = 3] = "undefined";
|
|
18
|
-
})(status || (status = {}));
|
|
19
12
|
/**
|
|
20
13
|
* A progress meter provides feedback that the system is working and gives
|
|
21
14
|
* the user an indication of how much time they will wait.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-meter.js","sourceRoot":"","sources":["../../../components/progress-meter/progress-meter.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,GAAI,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,MAAM,MAAM,4BAA4B,CAAC;AAGhD
|
|
1
|
+
{"version":3,"file":"progress-meter.js","sourceRoot":"","sources":["../../../components/progress-meter/progress-meter.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,GAAI,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAA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AAE,OAAO,EAAE,IAAI,EAAE,CAAC;mDACpB;AAOnB;IADH,QAAQ,EAAE;8CACW;AAQlB;IADH,QAAQ,EAAE;gDACO;AAOd;IADH,QAAQ,EAAE;kDACU;AAOjB;IADH,QAAQ,EAAE;+CACO;AAOd;IADH,QAAQ,EAAE;gDACO;AAgCpB,IAAI,cAAc,CAAC,GAAG,CAAC,qBAAqB,CAAC,KAAK,SAAS,EAAE,CAAC;IAC1D,cAAc,CAAC,MAAM,CAAC,qBAAqB,EAAE,iBAAiB,CAAC,CAAC;AACpE,CAAC","sourcesContent":["import { html, } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { nanoid } from 'nanoid';\nimport { Cre8Element } from '../cre8-element';\nimport styles from './progress-meter.styles.js';\n\n\n/**\n * A progress meter provides feedback that the system is working and gives\n * the user an indication of how much time they will wait.\n * This indicator should be used when the system response time is longer and determinable.\n */\nexport class Cre8ProgressMeter extends Cre8Element {\n static styles = [styles];\n\n /**\n * Progress Status\n * - **Default** renders a meter with default status fill\n * - **Error** renders a meter with an error status fill\n * - **Warning** renders a meter with a warning status\n * - **Success** renders a meter with a success status fill\n */\n @property()\n status?: 'error' | 'warning' | 'success';\n\n /*\n * Determines if the progress meter is displayed on a dark background (uses knockout colors for contrast)\n * @attr {boolean}\n */\n @property({ type: Boolean, reflect: true })\n knockout?: boolean;\n\n /*\n * The max number for the progress bar (defaulted to 100 to match percentages)\n * @attr {number}\n */\n @property()\n max: number = 100;\n\n /*\n * The the percentage of the bar that is filled in (defaulted to match percentages)\n * I.E a value of 50 with a 100 max would result in half the meter being filled\n * @attr {number}\n */\n @property()\n value: number;\n\n /**\n * Progress Meter FieldId\n * @attr {string}\n */\n @property()\n fieldId?: string;\n\n /**\n * Progress Meter name\n * @attr {string}\n */\n @property()\n name?: string;\n\n /**\n * Progress Meter label\n * @attr {string}\n */\n @property()\n label: string;\n\n connectedCallback() {\n super.connectedCallback();\n this.fieldId = this.fieldId || nanoid();\n }\n\n render() {\n const componentClassNames = this.componentClassNames('cre8-c-progress-meter', {\n 'cre8-c-progress-meter--error': this.status === 'error',\n 'cre8-c-progress-meter--warning': this.status === 'warning',\n 'cre8-c-progress-meter--success': this.status === 'success',\n 'cre8-c-progress-meter--knockout': this.knockout,\n });\n\n return html`<div class=\"${componentClassNames}\">\n <label class=\"cre8-c-progress-meter__label\" for=\"${this.fieldId}\">${this.label}</label>\n <span class=\"cre8-c-progress-meter__sr-only\">${Math.round((this.value / this.max) * 100)}%</span>\n <progress\n class=\"cre8-c-progress-meter__progress\"\n aria-hidden=\"true\"\n id=${this.fieldId}\n name=${this.name}\n max=\"${this.max}\"\n value=\"${this.value}\"\n >\n ${Math.round((this.value / this.max) * 100)}%\n </progress>\n </div>`;\n }\n}\n\nif (customElements.get('cre8-progress-meter') === undefined) {\n customElements.define('cre8-progress-meter', Cre8ProgressMeter);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-progress-meter': Cre8ProgressMeter;\n }\n}\n"]}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { Cre8Element } from '../cre8-element';
|
|
2
2
|
import '../progress-steps-item/progress-steps-item.js';
|
|
3
|
+
/** One step in a data-driven progress indicator. */
|
|
4
|
+
export interface Cre8ProgressStepData {
|
|
5
|
+
/** The visible label. This is the `name` prop — the item does not render children. */
|
|
6
|
+
name: string;
|
|
7
|
+
message?: string;
|
|
8
|
+
state?: 'error' | 'warning' | 'complete' | 'current';
|
|
9
|
+
}
|
|
3
10
|
/**
|
|
4
11
|
* The Progress Steps component is used to display where a user is in a multistep process.
|
|
5
12
|
* It clearly indicates the total number of steps, which steps are complete and incomplete,
|
|
@@ -23,6 +30,15 @@ import '../progress-steps-item/progress-steps-item.js';
|
|
|
23
30
|
*/
|
|
24
31
|
export declare class Cre8ProgressSteps extends Cre8Element {
|
|
25
32
|
static get styles(): import("lit").CSSResult;
|
|
33
|
+
/**
|
|
34
|
+
* Steps for a data-driven progress indicator. Note that the visible label is
|
|
35
|
+
* each item's `name` prop rather than its content — `cre8-progress-steps-item`
|
|
36
|
+
* does not render children, which is easy to get wrong by hand.
|
|
37
|
+
*/
|
|
38
|
+
steps?: Cre8ProgressStepData[];
|
|
39
|
+
/** The composition the data property stands for. */
|
|
40
|
+
private buildComposition;
|
|
41
|
+
protected updated(changed: Map<string, unknown>): void;
|
|
26
42
|
render(): import("lit-html").TemplateResult<1>;
|
|
27
43
|
}
|
|
28
44
|
declare global {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-steps.d.ts","sourceRoot":"","sources":["../../../components/progress-steps/progress-steps.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"progress-steps.d.ts","sourceRoot":"","sources":["../../../components/progress-steps/progress-steps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,+CAA+C,CAAC;AAGvD,oDAAoD;AACpD,MAAM,WAAW,oBAAoB;IACnC,sFAAsF;IACtF,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;CACtD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,MAAM,KAAK,MAAM,4BAEhB;IACD;;;;OAIG;IAEC,KAAK,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAEnC,oDAAoD;IACpD,OAAO,CAAC,gBAAgB;IAQxB,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAOtD,MAAM;CAOP;AAMD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,qBAAqB,EAAE,iBAAiB,CAAC;KAC1C;CACF;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
1
7
|
import { html, unsafeCSS } from 'lit';
|
|
8
|
+
import { property } from 'lit/decorators.js';
|
|
2
9
|
import { Cre8Element } from '../cre8-element';
|
|
10
|
+
import { syncLightChildren } from '../utils/light-children';
|
|
3
11
|
import '../progress-steps-item/progress-steps-item.js';
|
|
4
12
|
import styles from './progress-steps.styles.js';
|
|
5
13
|
/**
|
|
@@ -27,6 +35,20 @@ export class Cre8ProgressSteps extends Cre8Element {
|
|
|
27
35
|
static get styles() {
|
|
28
36
|
return unsafeCSS(styles.toString());
|
|
29
37
|
}
|
|
38
|
+
/** The composition the data property stands for. */
|
|
39
|
+
buildComposition() {
|
|
40
|
+
if (!this.steps)
|
|
41
|
+
return null;
|
|
42
|
+
return this.steps.map((step) => ({
|
|
43
|
+
tag: 'cre8-progress-steps-item',
|
|
44
|
+
props: { name: step.name, message: step.message, state: step.state },
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
updated(changed) {
|
|
48
|
+
if (['steps'].some((key) => changed.has(key))) {
|
|
49
|
+
syncLightChildren(this, this.buildComposition());
|
|
50
|
+
}
|
|
51
|
+
}
|
|
30
52
|
render() {
|
|
31
53
|
const componentClassNames = this.componentClassNames('cre8-c-progress-steps');
|
|
32
54
|
return html `<div class='${componentClassNames}'>
|
|
@@ -34,6 +56,9 @@ export class Cre8ProgressSteps extends Cre8Element {
|
|
|
34
56
|
</div>`;
|
|
35
57
|
}
|
|
36
58
|
}
|
|
59
|
+
__decorate([
|
|
60
|
+
property({ type: Array })
|
|
61
|
+
], Cre8ProgressSteps.prototype, "steps", void 0);
|
|
37
62
|
if (customElements.get('cre8-progress-steps') === undefined) {
|
|
38
63
|
customElements.define('cre8-progress-steps', Cre8ProgressSteps);
|
|
39
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-steps.js","sourceRoot":"","sources":["../../../components/progress-steps/progress-steps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,+CAA+C,CAAC;AACvD,OAAO,MAAM,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"progress-steps.js","sourceRoot":"","sources":["../../../components/progress-steps/progress-steps.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAkB,MAAM,yBAAyB,CAAC;AAC5E,OAAO,+CAA+C,CAAC;AACvD,OAAO,MAAM,MAAM,4BAA4B,CAAC;AAUhD;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,OAAO,iBAAkB,SAAQ,WAAW;IAChD,MAAM,KAAK,MAAM;QACf,OAAO,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;IACtC,CAAC;IASD,oDAAoD;IAC5C,gBAAgB;QACpB,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC7B,GAAG,EAAE,0BAA0B;YAC/B,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE;SACvE,CAAC,CAAC,CAAC;IACR,CAAC;IAES,OAAO,CAAC,OAA6B;QAC3C,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YAC5C,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC;QACrD,CAAC;IACL,CAAC;IAGD,MAAM;QACJ,MAAM,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC,uBAAuB,CAAC,CAAC;QAE9E,OAAO,IAAI,CAAA,eAAe,mBAAmB;;eAElC,CAAC;IACd,CAAC;CACF;AAzBK;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;gDACS;AA2BrC,IAAI,cAAc,CAAC,GAAG,CAAC,qBAAqB,CAAC,KAAK,SAAS,EAAE,CAAC;IAC5D,cAAc,CAAC,MAAM,CAAC,qBAAqB,EAAE,iBAAiB,CAAC,CAAC;AAClE,CAAC;AAQD,eAAe,iBAAiB,CAAC","sourcesContent":["import { html, unsafeCSS } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { Cre8Element } from '../cre8-element';\nimport { syncLightChildren, type ChildSpec } from '../utils/light-children';\nimport '../progress-steps-item/progress-steps-item.js';\nimport styles from './progress-steps.styles.js';\n\n/** One step in a data-driven progress indicator. */\nexport interface Cre8ProgressStepData {\n /** The visible label. This is the `name` prop — the item does not render children. */\n name: string;\n message?: string;\n state?: 'error' | 'warning' | 'complete' | 'current';\n}\n\n/**\n * The Progress Steps component is used to display where a user is in a multistep process.\n * It clearly indicates the total number of steps, which steps are complete and incomplete,\n * and which step you’re currently on. They help users estimate how long a task will take and can be\n * used to track status on orders.\n *\n * The Progress Steps component should be used as a parent component for `cre8-progress-steps-item` components.\n * These Components serve a contextual purpose and don't provide any functionality.\n *\n * # How to Use\n *\n * Progress Steps is used when there is ample horizontal space and two to six steps. It displays each step by name\n * and number to help users understand exactly where they are in a process. It is the preferred option for desktop.\n * Progress Steps should change to Compact Steps on mobile web to conserve space.\n *\n * Progress Steps can also be used to track order status. It provides a quick visual of how an order is progressing\n * with options to alert users of any problems along the way. When used for order status, Progress Steps should\n * change to Vertical Steps on mobile web to conserve space while allowing alerts and messages to remain visible.\n *\n * @slot - The Progress Steps Item components that represent the steps in the multistep process.\n */\n\nexport class Cre8ProgressSteps extends Cre8Element {\n static get styles() {\n return unsafeCSS(styles.toString());\n }\n /**\n * Steps for a data-driven progress indicator. Note that the visible label is\n * each item's `name` prop rather than its content — `cre8-progress-steps-item`\n * does not render children, which is easy to get wrong by hand.\n */\n @property({ type: Array })\n steps?: Cre8ProgressStepData[];\n\n /** The composition the data property stands for. */\n private buildComposition(): ChildSpec[] | null {\n if (!this.steps) return null;\n return this.steps.map((step) => ({\n tag: 'cre8-progress-steps-item',\n props: { name: step.name, message: step.message, state: step.state },\n }));\n }\n\n protected updated(changed: Map<string, unknown>): void {\n if (['steps'].some((key) => changed.has(key))) {\n syncLightChildren(this, this.buildComposition());\n }\n }\n\n\n render() {\n const componentClassNames = this.componentClassNames('cre8-c-progress-steps');\n\n return html`<div class='${componentClassNames}'>\n <slot></slot>\n </div>`;\n }\n}\n\nif (customElements.get('cre8-progress-steps') === undefined) {\n customElements.define('cre8-progress-steps', Cre8ProgressSteps);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-progress-steps': Cre8ProgressSteps;\n }\n}\n\nexport default Cre8ProgressSteps;\n"]}
|
|
@@ -6,7 +6,6 @@ import { Cre8Element } from '../cre8-element';
|
|
|
6
6
|
*
|
|
7
7
|
* @property {string} message - Optional message to display under the step name.
|
|
8
8
|
* @property {string} name - The name of the step.
|
|
9
|
-
* @property {string} state - The state of the step: 'incomplete', 'current', 'complete', 'error', 'warning';
|
|
10
9
|
* @property {string} svg - An SVG string to use as the step icon.
|
|
11
10
|
*
|
|
12
11
|
* @slot - The component content
|
|
@@ -24,8 +23,7 @@ export declare class Cre8ProgressStepsItem extends Cre8Element {
|
|
|
24
23
|
*/
|
|
25
24
|
name: string;
|
|
26
25
|
/**
|
|
27
|
-
* The state of the step
|
|
28
|
-
* @type {string}
|
|
26
|
+
* The state of the step.
|
|
29
27
|
*/
|
|
30
28
|
state: 'complete' | 'current' | 'error' | 'incomplete' | 'warning';
|
|
31
29
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-steps-item.d.ts","sourceRoot":"","sources":["../../../components/progress-steps-item/progress-steps-item.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C
|
|
1
|
+
{"version":3,"file":"progress-steps-item.d.ts","sourceRoot":"","sources":["../../../components/progress-steps-item/progress-steps-item.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C;;;;;;;;;;GAUG;AACH,qBAAa,qBAAsB,SAAQ,WAAW;IAClD,MAAM,CAAC,MAAM,4BAAY;IAEzB;;;OAGG;IAEH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IAEH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IAEH,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,YAAY,GAAG,SAAS,CAAC;IAEnE;;;OAGG;IAEH,GAAG,EAAE,MAAM,CAAC;IAEZ,MAAM;CAuBT;AAMD,OAAO,CAAC,MAAM,CAAC;IAAE,UAAU,qBAAqB;QAAG,0BAA0B,EAAE,qBAAqB,CAAC;KAAE;CAAE;AAEzG,eAAe,qBAAqB,CAAC"}
|
|
@@ -15,7 +15,6 @@ import styles from './progress-steps-item.styles.js';
|
|
|
15
15
|
*
|
|
16
16
|
* @property {string} message - Optional message to display under the step name.
|
|
17
17
|
* @property {string} name - The name of the step.
|
|
18
|
-
* @property {string} state - The state of the step: 'incomplete', 'current', 'complete', 'error', 'warning';
|
|
19
18
|
* @property {string} svg - An SVG string to use as the step icon.
|
|
20
19
|
*
|
|
21
20
|
* @slot - The component content
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-steps-item.js","sourceRoot":"","sources":["../../../components/progress-steps-item/progress-steps-item.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,GAAG,MAAM,KAAK,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,MAAM,MAAM,iCAAiC,CAAC;AAErD
|
|
1
|
+
{"version":3,"file":"progress-steps-item.js","sourceRoot":"","sources":["../../../components/progress-steps-item/progress-steps-item.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,GAAG,MAAM,KAAK,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,MAAM,MAAM,iCAAiC,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,qBAAsB,SAAQ,WAAW;IA8BlD,MAAM;QACF,MAAM,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC,4BAA4B,EAAE;YAC/E,sCAAsC,EAAE,IAAI,CAAC,KAAK,KAAK,UAAU;YACjE,qCAAqC,EAAE,IAAI,CAAC,KAAK,KAAK,SAAS;YAC/D,mCAAmC,EAAE,IAAI,CAAC,KAAK,KAAK,OAAO;YAC3D,wCAAwC,EAAE,IAAI,CAAC,KAAK,KAAK,YAAY;YACrE,qCAAqC,EAAE,IAAI,CAAC,KAAK,KAAK,SAAS;SAClE,CAAC,CAAC;QAEH,OAAO,IAAI,CAAA;sBACG,mBAAmB;;;;kCAIP,IAAI,CAAC,GAAG;;;;4DAIkB,IAAI,CAAC,IAAI;+DACN,IAAI,CAAC,OAAO;;SAElE,CAAC;IACN,CAAC;;AAnDM,4BAAM,GAAG,CAAC,MAAM,CAAC,CAAC;AAOzB;IADC,QAAQ,EAAE;sDACM;AAOjB;IADC,QAAQ,EAAE;mDACE;AAMb;IADC,QAAQ,EAAE;oDACwD;AAOnE;IADC,QAAQ,EAAE;kDACC;AA2BhB,IAAI,cAAc,CAAC,GAAG,CAAC,0BAA0B,CAAC,KAAK,SAAS,EAAE,CAAC;IAC/D,cAAc,CAAC,MAAM,CAAC,0BAA0B,EAAE,qBAAqB,CAAC,CAAC;AAC7E,CAAC;AAID,eAAe,qBAAqB,CAAC","sourcesContent":["import { html, } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { Cre8Element } from '../cre8-element';\nimport styles from './progress-steps-item.styles.js';\n\n/**\n * The Progress Steps Item component is used to display a single step in a multi-step process.\n * It should be used as a child component of `cre8-progress-steps`.\n * These Components serve a contextual purpose and don't provide any functionality.\n *\n * @property {string} message - Optional message to display under the step name.\n * @property {string} name - The name of the step.\n * @property {string} svg - An SVG string to use as the step icon.\n *\n * @slot - The component content\n */\nexport class Cre8ProgressStepsItem extends Cre8Element {\n static styles = [styles];\n\n /**\n * Optional message to display under the step name.\n * @type {string}\n */\n @property()\n message?: string;\n\n /**\n * The name of the step.\n * @type {string}\n */\n @property()\n name: string;\n\n /**\n * The state of the step.\n */\n @property()\n state: 'complete' | 'current' | 'error' | 'incomplete' | 'warning';\n\n /**\n * An SVG string to use as the step icon.\n * @type {string}\n */\n @property()\n svg: string;\n\n render() {\n const componentClassNames = this.componentClassNames('cre8-c-progress-steps-item', {\n 'cre8-c-progress-steps-item--complete': this.state === 'complete',\n 'cre8-c-progress-steps-item--current': this.state === 'current',\n 'cre8-c-progress-steps-item--error': this.state === 'error',\n 'cre8-c-progress-steps-item--incomplete': this.state === 'incomplete',\n 'cre8-c-progress-steps-item--warning': this.state === 'warning',\n });\n\n return html`\n <div class='${componentClassNames}'>\n <div class='cre8-c-progress-steps-item__top-container'>\n <div class='cre8-c-progress-steps-item__divider--left' part='left-divider'></div>\n <span class='cre8-c-progress-steps-item__svg'>\n <cre8-icon svg='${this.svg}' aria-hidden='true'></cre8-icon>\n </span>\n <div class='cre8-c-progress-steps-item__divider--right' part='right-divider'></div>\n </div>\n <div class='cre8-c-progress-steps-item__name'>${this.name}</div>\n <div class='cre8-c-progress-steps-item__message'>${this.message}</div>\n </div>\n `;\n }\n}\n\nif (customElements.get('cre8-progress-steps-item') === undefined) {\n customElements.define('cre8-progress-steps-item', Cre8ProgressStepsItem);\n}\n\ndeclare global { interface HTMLElementTagNameMap { 'cre8-progress-steps-item': Cre8ProgressStepsItem; } }\n\nexport default Cre8ProgressStepsItem;\n"]}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { Cre8Element } from '../cre8-element';
|
|
2
2
|
import '../field-note/field-note';
|
|
3
|
+
/** One option in a data-driven radio field. */
|
|
4
|
+
export interface Cre8RadioItemData {
|
|
5
|
+
label: string;
|
|
6
|
+
value?: string;
|
|
7
|
+
checked?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
}
|
|
3
11
|
/**
|
|
4
12
|
* Radio Field is the parent container for `radio-field-item`.
|
|
5
13
|
* It is required to allow for grouping numerous radio fields that need additional context (in the form of `<legend>`).
|
|
@@ -45,6 +53,31 @@ export declare class Cre8RadioField extends Cre8Element {
|
|
|
45
53
|
* Radio field legend label
|
|
46
54
|
*/
|
|
47
55
|
label?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Options for a data-driven radio field. Each becomes a
|
|
58
|
+
* `cre8-radio-field-item` sharing the field's `name`, which is what the form
|
|
59
|
+
* submits under. Exclusivity is enforced by the field itself — see
|
|
60
|
+
* `enforceSingleSelection`, and do not assume `name` alone does it.
|
|
61
|
+
*/
|
|
62
|
+
items?: Cre8RadioItemData[];
|
|
63
|
+
/** Form control name shared by every generated option. */
|
|
64
|
+
name?: string;
|
|
65
|
+
/** The composition the data property stands for. */
|
|
66
|
+
private buildComposition;
|
|
67
|
+
protected updated(changed: Map<string, unknown>): void;
|
|
68
|
+
connectedCallback(): void;
|
|
69
|
+
disconnectedCallback(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Keep the group to one selection.
|
|
72
|
+
*
|
|
73
|
+
* A native radio group is formed by `name`, but only within one tree scope —
|
|
74
|
+
* and each `cre8-radio-field-item` keeps its `input` in its own shadow root,
|
|
75
|
+
* so the browser never sees them as siblings and every option stays checked
|
|
76
|
+
* once clicked. That is true of a hand-written field too, not just a generated
|
|
77
|
+
* one, which is why the fix lives here on the group rather than in the
|
|
78
|
+
* flattened path.
|
|
79
|
+
*/
|
|
80
|
+
private enforceSingleSelection;
|
|
48
81
|
render(): import("lit-html").TemplateResult<1>;
|
|
49
82
|
}
|
|
50
83
|
declare global {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-field.d.ts","sourceRoot":"","sources":["../../../components/radio-field/radio-field.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"radio-field.d.ts","sourceRoot":"","sources":["../../../components/radio-field/radio-field.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,0BAA0B,CAAC;AAGlC,+CAA+C;AAC/C,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;GAQG;AAGH,qBAAa,cAAe,SAAQ,WAAW;IAC3C,MAAM,CAAC,MAAM,4BAAY;IAE3B;;;OAGG;IAEC,SAAS,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IAEC,eAAe,CAAC,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IAEC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE/B;;;OAGG;IAEC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;OAGG;IAEC,SAAS,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IAEC,OAAO,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IAEC,KAAK,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IAEC,KAAK,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAEhC,0DAA0D;IAEtD,IAAI,CAAC,EAAE,MAAM,CAAC;IAElB,oDAAoD;IACpD,OAAO,CAAC,gBAAgB;IAexB,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAMtD,iBAAiB,IAAI,IAAI;IAKzB,oBAAoB,IAAI,IAAI;IAK5B;;;;;;;;;OASG;IACH,OAAO,CAAC,sBAAsB,CAS5B;IAGF,MAAM;CAwBP;AAMD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,kBAAkB,EAAE,cAAc,CAAC;KACpC;CACF;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -8,6 +8,7 @@ import { html, } from 'lit';
|
|
|
8
8
|
import { ifDefined } from 'lit-html/directives/if-defined.js';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { Cre8Element } from '../cre8-element';
|
|
11
|
+
import { syncLightChildren } from '../utils/light-children';
|
|
11
12
|
import '../field-note/field-note';
|
|
12
13
|
import styles from './radio-field.styles.js';
|
|
13
14
|
/**
|
|
@@ -20,6 +21,61 @@ import styles from './radio-field.styles.js';
|
|
|
20
21
|
* @slot - The component content, which should be a set of `radio-field-item`s
|
|
21
22
|
*/
|
|
22
23
|
export class Cre8RadioField extends Cre8Element {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
/**
|
|
27
|
+
* Keep the group to one selection.
|
|
28
|
+
*
|
|
29
|
+
* A native radio group is formed by `name`, but only within one tree scope —
|
|
30
|
+
* and each `cre8-radio-field-item` keeps its `input` in its own shadow root,
|
|
31
|
+
* so the browser never sees them as siblings and every option stays checked
|
|
32
|
+
* once clicked. That is true of a hand-written field too, not just a generated
|
|
33
|
+
* one, which is why the fix lives here on the group rather than in the
|
|
34
|
+
* flattened path.
|
|
35
|
+
*/
|
|
36
|
+
this.enforceSingleSelection = (event) => {
|
|
37
|
+
const source = event.target;
|
|
38
|
+
if (!source)
|
|
39
|
+
return;
|
|
40
|
+
const items = [...this.querySelectorAll('cre8-radio-field-item')];
|
|
41
|
+
const selected = items.find((item) => item === source || item.contains(source));
|
|
42
|
+
if (!selected)
|
|
43
|
+
return;
|
|
44
|
+
for (const item of items) {
|
|
45
|
+
if (item !== selected)
|
|
46
|
+
item.checked = false;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/** The composition the data property stands for. */
|
|
51
|
+
buildComposition() {
|
|
52
|
+
if (!this.items)
|
|
53
|
+
return null;
|
|
54
|
+
return this.items.map((item) => ({
|
|
55
|
+
tag: 'cre8-radio-field-item',
|
|
56
|
+
props: {
|
|
57
|
+
label: item.label,
|
|
58
|
+
value: item.value,
|
|
59
|
+
checked: item.checked,
|
|
60
|
+
disabled: item.disabled,
|
|
61
|
+
required: item.required,
|
|
62
|
+
name: this.name,
|
|
63
|
+
},
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
updated(changed) {
|
|
67
|
+
if (['items', 'name'].some((key) => changed.has(key))) {
|
|
68
|
+
syncLightChildren(this, this.buildComposition());
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
connectedCallback() {
|
|
72
|
+
super.connectedCallback();
|
|
73
|
+
this.addEventListener('change', this.enforceSingleSelection);
|
|
74
|
+
}
|
|
75
|
+
disconnectedCallback() {
|
|
76
|
+
this.removeEventListener('change', this.enforceSingleSelection);
|
|
77
|
+
super.disconnectedCallback();
|
|
78
|
+
}
|
|
23
79
|
render() {
|
|
24
80
|
const componentClassNames = this.componentClassNames('cre8-c-radio-field', {});
|
|
25
81
|
return html `
|
|
@@ -66,6 +122,12 @@ __decorate([
|
|
|
66
122
|
__decorate([
|
|
67
123
|
property()
|
|
68
124
|
], Cre8RadioField.prototype, "label", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
property({ type: Array })
|
|
127
|
+
], Cre8RadioField.prototype, "items", void 0);
|
|
128
|
+
__decorate([
|
|
129
|
+
property()
|
|
130
|
+
], Cre8RadioField.prototype, "name", void 0);
|
|
69
131
|
if (customElements.get('cre8-radio-field') === undefined) {
|
|
70
132
|
customElements.define('cre8-radio-field', Cre8RadioField);
|
|
71
133
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-field.js","sourceRoot":"","sources":["../../../components/radio-field/radio-field.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,GAAI,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,0BAA0B,CAAC;AAClC,OAAO,MAAM,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"radio-field.js","sourceRoot":"","sources":["../../../components/radio-field/radio-field.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,GAAI,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,E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CAAC,MAAM,CAAC,AAAX,CAAY;AAOvB;IADH,QAAQ,EAAE;iDACY;AAOnB;IADH,QAAQ,EAAE;uDACkB;AAOzB;IADH,QAAQ,EAAE;yDACoB;AAO3B;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yDACX;AAO5B;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDACnB;AAOpB;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CACrB;AAMlB;IADH,QAAQ,EAAE;6CACQ;AAQf;IADH,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;6CACM;AAI5B;IADH,QAAQ,EAAE;4CACO;AAkFpB,IAAI,cAAc,CAAC,GAAG,CAAC,kBAAkB,CAAC,KAAK,SAAS,EAAE,CAAC;IACvD,cAAc,CAAC,MAAM,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC;AAC9D,CAAC;AAQD,eAAe,cAAc,CAAC","sourcesContent":["import { html, } from 'lit';\nimport { ifDefined } from 'lit-html/directives/if-defined.js';\nimport { property } from 'lit/decorators.js';\nimport { Cre8Element } from '../cre8-element';\nimport { syncLightChildren, type ChildSpec } from '../utils/light-children';\nimport '../field-note/field-note';\nimport styles from './radio-field.styles.js';\n\n/** One option in a data-driven radio field. */\nexport interface Cre8RadioItemData {\n label: string;\n value?: string;\n checked?: boolean;\n disabled?: boolean;\n required?: boolean;\n}\n\n/**\n * Radio Field is the parent container for `radio-field-item`.\n * It is required to allow for grouping numerous radio fields that need additional context (in the form of `<legend>`).\n * It also provides accessibility roles, aria attributes and field note messaging on the group.\n *\n * See [radio-field-item](?path=/story/cre8-components-radio-field-item--default) for more guidance on its usage.\n *\n * @slot - The component content, which should be a set of `radio-field-item`s\n */\n\n\nexport class Cre8RadioField extends Cre8Element {\n static styles = [styles];\n\n /**\n * Radio Field Note\n * @attr {string}\n */\n @property()\n fieldNote?: string;\n\n /**\n * Radio container fieldnote aria describe by\n * @attr {string}\n */\n @property()\n ariaDescribedBy?: string;\n\n /**\n * Radio container fieldnote icon name\n * @attr {string}\n */\n @property()\n fieldNoteIconName?: string;\n\n /**\n * Radio container fieldnote knockout\n * @attr {boolean}\n */\n @property({ type: Boolean, reflect: true })\n fieldNoteKnockout?: boolean;\n\n /**\n * Radio container fieldnote isSuccess\n * @attr {boolean}\n */\n @property({ type: Boolean, reflect: true })\n isSuccess?: boolean;\n\n /**\n * Radio container fieldnote isError\n * @attr {boolean}\n */\n @property({ type: Boolean, reflect: true })\n isError?: boolean;\n\n /**\n * Radio field legend label\n */\n @property()\n label?: string;\n /**\n * Options for a data-driven radio field. Each becomes a\n * `cre8-radio-field-item` sharing the field's `name`, which is what the form\n * submits under. Exclusivity is enforced by the field itself — see\n * `enforceSingleSelection`, and do not assume `name` alone does it.\n */\n @property({ type: Array })\n items?: Cre8RadioItemData[];\n\n /** Form control name shared by every generated option. */\n @property()\n name?: string;\n\n /** The composition the data property stands for. */\n private buildComposition(): ChildSpec[] | null {\n if (!this.items) return null;\n return this.items.map((item) => ({\n tag: 'cre8-radio-field-item',\n props: {\n label: item.label,\n value: item.value,\n checked: item.checked,\n disabled: item.disabled,\n required: item.required,\n name: this.name,\n },\n }));\n }\n\n protected updated(changed: Map<string, unknown>): void {\n if (['items', 'name'].some((key) => changed.has(key))) {\n syncLightChildren(this, this.buildComposition());\n }\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('change', this.enforceSingleSelection as EventListener);\n }\n\n disconnectedCallback(): void {\n this.removeEventListener('change', this.enforceSingleSelection as EventListener);\n super.disconnectedCallback();\n }\n\n /**\n * Keep the group to one selection.\n *\n * A native radio group is formed by `name`, but only within one tree scope —\n * and each `cre8-radio-field-item` keeps its `input` in its own shadow root,\n * so the browser never sees them as siblings and every option stays checked\n * once clicked. That is true of a hand-written field too, not just a generated\n * one, which is why the fix lives here on the group rather than in the\n * flattened path.\n */\n private enforceSingleSelection = (event: Event): void => {\n const source = event.target as HTMLElement | null;\n if (!source) return;\n const items = [...this.querySelectorAll('cre8-radio-field-item')];\n const selected = items.find((item) => item === source || item.contains(source));\n if (!selected) return;\n for (const item of items) {\n if (item !== selected) (item as HTMLElement & { checked?: boolean }).checked = false;\n }\n };\n\n\n render() {\n const componentClassNames = this.componentClassNames('cre8-c-radio-field', {});\n\n return html`\n <fieldset class=\"${componentClassNames}\" aria-describedby=\"${ifDefined(this.ariaDescribedBy)}\">\n <legend class=\"cre8-c-radio-field__legend\">${this.label}</legend>\n <div class=\"cre8-c-radio-field__body\">\n <ul class=\"cre8-c-radio-field__list\" role=\"list\">\n <slot></slot>\n </ul>\n </div>\n ${this.fieldNote\n ? html`<cre8-field-note\n ?inverted=${this.fieldNoteKnockout}\n id=${ifDefined(this.ariaDescribedBy)}\n iconName=${ifDefined(this.fieldNoteIconName)}\n ?isSuccess=${this.isSuccess}\n ?isError=${this.isError}\n >\n ${this.fieldNote}\n </cre8-field-note>` : ''}\n </fieldset>\n `;\n }\n}\n\nif (customElements.get('cre8-radio-field') === undefined) {\n customElements.define('cre8-radio-field', Cre8RadioField);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-radio-field': Cre8RadioField;\n }\n}\n\nexport default Cre8RadioField;\n"]}
|
|
@@ -13,7 +13,7 @@ export declare enum Color {
|
|
|
13
13
|
* Clicking a Remove Tag causes it to disappear from the page or field (in the case of Multi-Select).
|
|
14
14
|
* These tags always display a "Close" icon.
|
|
15
15
|
*
|
|
16
|
-
* @fires
|
|
16
|
+
* @fires remove-tag-click - Fires when the remove tag is clicked.
|
|
17
17
|
*/
|
|
18
18
|
export declare class Cre8RemoveTag extends Cre8Element {
|
|
19
19
|
static styles: import("lit").CSSResult[];
|
|
@@ -26,7 +26,7 @@ export var Color;
|
|
|
26
26
|
* Clicking a Remove Tag causes it to disappear from the page or field (in the case of Multi-Select).
|
|
27
27
|
* These tags always display a "Close" icon.
|
|
28
28
|
*
|
|
29
|
-
* @fires
|
|
29
|
+
* @fires remove-tag-click - Fires when the remove tag is clicked.
|
|
30
30
|
*/
|
|
31
31
|
export class Cre8RemoveTag extends Cre8Element {
|
|
32
32
|
constructor() {
|
|
@@ -51,12 +51,12 @@ export class Cre8RemoveTag extends Cre8Element {
|
|
|
51
51
|
* Dispatches an event when the tag is clicked
|
|
52
52
|
*/
|
|
53
53
|
_handleRemoveTagClicked() {
|
|
54
|
-
const customEvent = new CustomEvent('
|
|
54
|
+
const customEvent = new CustomEvent('remove-tag-click', {
|
|
55
55
|
detail: { message: 'Remove Tag clicked.' },
|
|
56
56
|
bubbles: true,
|
|
57
57
|
composed: true,
|
|
58
58
|
});
|
|
59
|
-
this.
|
|
59
|
+
this.dispatchWithLegacyAlias(customEvent);
|
|
60
60
|
}
|
|
61
61
|
render() {
|
|
62
62
|
const componentClassName = classnames('cre8-c-remove-tag', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-tag.js","sourceRoot":"","sources":["../../../components/remove-tag/remove-tag.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,IAAI,GAAI,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,QAAQ,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,cAAc,CAAC;AACtB,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAE5C,MAAM,CAAN,IAAY,KAGX;AAHD,WAAY,KAAK;IACf,wBAAe,CAAA;IACf,0BAAiB,CAAA;AACnB,CAAC,EAHW,KAAK,KAAL,KAAK,QAGhB;AAED,MAAM,CAAN,IAAY,KAIX;AAJD,WAAY,KAAK;IACf,4BAAmB,CAAA;IACnB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AAc,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,SAAS,EAAE,CAAC;IACtD,cAAc,CAAC,MAAM,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC;AAC5D,CAAC;AAQD,eAAe,aAAa,CAAC","sourcesContent":["import classnames from 'classnames';\nimport { html, } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport svgClose from '@tmorrow/cre8-wc/icons/Close.svg?raw';\nimport { Cre8Element } from '../cre8-element';\nimport '../icon/icon';\nimport styles from './remove-tag.styles.js';\n\nexport enum Shape {\n Round = 'round',\n Square = 'square',\n}\n\nexport enum Color {\n Neutral = 'neutral',\n Branded = 'branded',\n NeutralHybrid = 'neutral-hybrid',\n}\n\n/**\n * Clicking a Remove Tag causes it to disappear from the page or field (in the case of Multi-Select).\n * These tags always display a \"Close\" icon.\n *\n * @fires remove-tag-click - Fires when the remove tag is clicked.\n */\nexport class Cre8RemoveTag extends Cre8Element {\n static styles = [styles];\n\n /**\n * The tag text\n */\n @property({ type: String })\n text?: string;\n\n /**\n * The tag color scheme\n *\n * - **neutral** should be used when doing non-link actions such as filters or multi-select, within forms, etc.\n * - **neutral-hybrid** should be used for when tags are doing an action like a button or a link\n * - **branded** should be used like Neutral, but for marketing / actionable items\n */\n @property({ type: String })\n color: Color.Neutral | Color.Branded | Color.NeutralHybrid = Color.Neutral;\n\n /**\n * The tag shape\n *\n * - **round** will give the tag a rounded border\n * - **square** will give the tag a squared border\n */\n @property({ type: String })\n shape: Shape.Round | Shape.Square = Shape.Round;\n\n /**\n * Disabled state for remove tag\n */\n @property({ type: Boolean })\n disabled?: boolean;\n\n /**\n * Dispatches an event when the tag is clicked\n */\n private _handleRemoveTagClicked() {\n const customEvent = new CustomEvent('remove-tag-click', {\n detail: { message: 'Remove Tag clicked.' },\n bubbles: true,\n composed: true,\n });\n this.dispatchWithLegacyAlias(customEvent);\n }\n\n render() {\n const componentClassName = classnames('cre8-c-remove-tag', {\n 'cre8-c-remove-tag--neutral': this.color === 'neutral',\n 'cre8-c-remove-tag--branded': this.color === 'branded',\n 'cre8-c-remove-tag--neutral-hybrid': this.color === 'neutral-hybrid',\n 'cre8-c-remove-tag--round': this.shape === 'round',\n 'cre8-c-remove-tag--square': this.shape === 'square',\n });\n\n return html` <button\n class=\"${componentClassName}\"\n @click=\"${this._handleRemoveTagClicked}\"\n ?disabled=${this.disabled}\n >\n <span>${this.text}</span>\n <div class=\"cre8-c-remove-tag-item__icon\">\n <cre8-icon\n width=\"16\"\n height=\"16\"\n svg=\"${svgClose}\"\n aria-hidden=\"true\"\n ></cre8-icon>\n </div>\n </button>`;\n }\n}\n\nif (customElements.get('cre8-remove-tag') === undefined) {\n customElements.define('cre8-remove-tag', Cre8RemoveTag);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-remove-tag': Cre8RemoveTag;\n }\n}\n\nexport default Cre8RemoveTag;\n"]}
|
|
@@ -2,6 +2,9 @@ import { Cre8Element } from '../cre8-element';
|
|
|
2
2
|
import '../button/button';
|
|
3
3
|
/**
|
|
4
4
|
* @slot - The component content , this will consist of the dropdown when the user clicks the caret
|
|
5
|
+
*
|
|
6
|
+
* @fires split-button-text-click - Fires when the main text button is clicked.
|
|
7
|
+
* @fires split-button-dropdown-click - Fires when the dropdown toggle is clicked.
|
|
5
8
|
*/
|
|
6
9
|
export declare class Cre8SplitButton extends Cre8Element {
|
|
7
10
|
static styles: import("lit").CSSResult[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-button.d.ts","sourceRoot":"","sources":["../../../components/split-button/split-button.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,kBAAkB,CAAC;AAG1B
|
|
1
|
+
{"version":3,"file":"split-button.d.ts","sourceRoot":"","sources":["../../../components/split-button/split-button.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,kBAAkB,CAAC;AAG1B;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,WAAW;IAC5C,MAAM,CAAC,MAAM,4BAAY;IAGvB,YAAY,UAAS;IAEzB;;OAEG;IAEC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;;;;;OAQG;IAEC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAEvB;;OAEG;IAEC,UAAU,EAAE,MAAM,CAAC;IAEvB,MAAM;IAiCN,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,cAAc;CAIvB;AAMD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,mBAAmB,EAAE,eAAe,CAAC;KACtC;CACF;AAED,eAAe,eAAe,CAAC"}
|