@tmorrow/cre8-wc 2.1.1 → 2.2.2
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-kg.json +441 -299
- package/a2ui/catalog.compact.json +27 -3
- package/a2ui/catalog.json +88 -2
- package/a2ui/demo.html +11 -2
- package/a2ui/generate-catalog-kg.mjs +122 -0
- package/cdn/cre8-wc.esm.js +2081 -1863
- package/cdn/cre8-wc.esm.js.map +1 -1
- package/cdn/cre8-wc.min.js +275 -257
- package/cdn/cre8-wc.min.js.map +1 -1
- package/dist/assets/{Changelog-Documentation-CeOetLxK.js → Changelog-Documentation-DAkpnvjl.js} +1 -1
- package/dist/assets/{Code-Guidelines-BjdezAjj.js → Code-Guidelines-BaDD3Qt-.js} +1 -1
- package/dist/assets/{Color-6AOWCN3U-DPFGZitI.js → Color-6AOWCN3U-Br-VT4Nz.js} +1 -1
- package/dist/assets/{Contributing-Guidelines-B1M2V1hW.js → Contributing-Guidelines-CcP9zakB.js} +1 -1
- package/dist/assets/{DocsRenderer-JROSPFPF-BBy8KWNl.js → DocsRenderer-JROSPFPF-yAlipAFi.js} +1 -1
- package/dist/assets/{Tokens-Documentation-CdTxFDLe.js → Tokens-Documentation-C7AoT8M_.js} +1 -1
- package/dist/assets/{WithTooltip-7X4HQR7L-DZzTNMQ7.js → WithTooltip-7X4HQR7L-DGAfa3Vb.js} +1 -1
- package/dist/assets/{accordion-item.stories-Bl26JlHp.js → accordion-item.stories-BZFx3mtU.js} +9 -1
- package/dist/assets/{accordion.stories-DjoLApQw.js → accordion.stories-Bvj-QGNl.js} +22 -14
- package/dist/assets/address-form.stories-CseRFoqX.js +71 -0
- package/dist/assets/{alert.stories-pO1y3YCQ.js → alert.stories-CbICvjHf.js} +31 -15
- package/dist/assets/{badge-BTxW3bN2.js → badge-UrvSTJon.js} +11 -3
- package/dist/assets/{badge.stories-vqh63RJ2.js → badge.stories-DOZqQX5K.js} +7 -8
- package/dist/assets/{band.stories-CjKRppSb.js → band.stories-CK_yg4DT.js} +9 -1
- package/dist/assets/{blocks-1be_-L6v.js → blocks-Du1uvPRr.js} +5 -5
- package/dist/assets/{breadcrumbs.stories-Doyfy3V9.js → breadcrumbs.stories-D7yO08QU.js} +25 -9
- package/dist/assets/{button-CgaWukz0.js → button-BCRNRwfX.js} +9 -1
- package/dist/assets/{button-group-G7qN4MwM.js → button-group-CwodvBV3.js} +9 -1
- package/dist/assets/{button-group.stories-cL3Kay6M.js → button-group.stories-DqUGrtzO.js} +1 -1
- package/dist/assets/{button.stories-C9HSpxWb.js → button.stories-CsEf8OvS.js} +1 -1
- package/dist/assets/{card.stories-BbU8YymD.js → card-DSDkldbr.js} +14 -50
- package/dist/assets/card.stories-DBa0yvbU.js +45 -0
- package/dist/assets/{chart.stories-BL4FxIA_.js → chart.stories-DS4mwVqy.js} +3 -3
- package/dist/assets/{checkbox-field-item-DIMHcWM0.js → checkbox-field-item-sISvPESD.js} +9 -1
- package/dist/assets/{checkbox-field-item.stories-XbB4x_lO.js → checkbox-field-item.stories-BCvdJgaW.js} +1 -1
- package/dist/assets/{checkbox-field.stories-YnqFUI4K.js → checkbox-field.stories-DnG0eNYV.js} +20 -12
- package/dist/assets/cre8-element-q82VmUgi.js +1 -0
- package/dist/assets/cre8-form-element-Bk9Cy3PA.js +1 -0
- package/dist/assets/{danger-button.stories-xh25hmfd.js → danger-button.stories-UbeDkyI-.js} +9 -1
- package/dist/assets/{date-picker.stories-DD_ctzEF.js → date-picker.stories-B1SKYMVQ.js} +51 -3
- package/dist/assets/{divider-xZ2KARHf.js → divider-Bci4ZIK6.js} +10 -2
- package/dist/assets/{divider.stories-Bk9oF-OV.js → divider.stories-BhUpwAzD.js} +1 -1
- package/dist/assets/{dropdown-BEP5x3CW.js → dropdown-CbkVYKEV.js} +25 -9
- package/dist/assets/dropdown-item.stories-C3cFlIXo.js +26 -0
- package/dist/assets/{dropdown.stories-B0OlKD7h.js → dropdown.stories-DNo1ezrT.js} +2 -2
- package/dist/assets/{f-po-BdPzDRD-.js → f-po-CGwWqyus.js} +1 -1
- package/dist/assets/{feature.stories-DYE1Js70.js → feature.stories-B1bhPf5C.js} +9 -1
- package/dist/assets/field-V4dGu-vp.js +44 -0
- package/dist/assets/{field-note-fccBckVl.js → field-note-CI4Ca7JE.js} +11 -3
- package/dist/assets/{field-note.stories-BH9AZMbF.js → field-note.stories-qXAywEeq.js} +1 -1
- package/dist/assets/{field.stories-BQPtmziK.js → field.stories-CQf9a7bv.js} +6 -6
- package/dist/assets/{field-BpUYyRW1.js → field.styles-CiOFAoAG.js} +12 -45
- package/dist/assets/{footer.stories-DCWEciqD.js → footer.stories-C7TG2Cky.js} +9 -1
- package/dist/assets/form-DHk8aePA.js +17 -0
- package/dist/assets/form.stories-CJ9sqwpA.js +75 -0
- package/dist/assets/{formatter-L2YTDE3Q-B9u1AOWn.js → formatter-L2YTDE3Q-B-Ee-OPm.js} +1 -1
- package/dist/assets/{global-nav-item-T4htN-yO.js → global-nav-item-pjd1OC7i.js} +14 -6
- package/dist/assets/{global-nav-item.stories-2dWRfCXv.js → global-nav-item.stories-D6N0iKNQ.js} +1 -1
- package/dist/assets/{global-nav.stories-Fh1gScqg.js → global-nav.stories-CwJ0cKW_.js} +10 -2
- package/dist/assets/{grid-C5CKMXNe.js → grid-item-WCDk_zGh.js} +573 -557
- package/dist/assets/{grid.stories-BLmCNdeA.js → grid.stories-DR4e60eQ.js} +1 -1
- package/dist/assets/{header.stories-BkDrjJtj.js → header.stories-BUO2t2KS.js} +9 -1
- package/dist/assets/{heading-Dbka33DK.js → heading-Cux7lJt-.js} +10 -2
- package/dist/assets/{heading.stories-Be40_bmG.js → heading.stories-BlgEi0dB.js} +1 -1
- package/dist/assets/{hero.stories-vRu7PZG9.js → hero.stories-C853F5_Y.js} +9 -1
- package/dist/assets/{icon-ChfRWXWy.js → icon-ByzQuB0Z.js} +9 -1
- package/dist/assets/{icon.stories-Cj4U7L5G.js → icon.stories-DYCuJ4Rv.js} +1 -1
- package/dist/assets/if-defined-DWVEXvB4.js +1 -0
- package/dist/assets/{iframe-BNJP6ovU.js → iframe-CTa_pRc7.js} +142 -142
- package/dist/assets/iframe-CWwoGI65.css +1 -0
- package/dist/assets/{inline-alert.stories-CygBYI02.js → inline-alert.stories-C_R0hcQ4.js} +9 -1
- package/dist/assets/{layout-container.stories-TMyIJteJ.js → layout-container.stories-Bywbzd_L.js} +10 -2
- package/dist/assets/{layout.stories-ylRM-ANL.js → layout.stories-CI7XD-aG.js} +23 -7
- package/dist/assets/light-children-DDjBxt3J.js +1 -0
- package/dist/assets/{linelength-container.stories-Br2v8jXE.js → linelength-container.stories-DvwrIt8x.js} +9 -1
- package/dist/assets/{link-CRE0Eqdo.js → link-CkyZrqNv.js} +9 -1
- package/dist/assets/{link-list.stories--y-urrVo.js → link-list.stories-BrOT-y5d.js} +39 -23
- package/dist/assets/{link.stories-C3WQOgkY.js → link.stories-DvGexqBV.js} +1 -1
- package/dist/assets/{list.stories-Bd2bxkxn.js → list.stories-B2PmqPK-.js} +29 -13
- package/dist/assets/{loading-spinner-C52KNq6y.js → loading-spinner-D_r3kfYs.js} +12 -4
- package/dist/assets/{loading-spinner.stories-DPRGEeHT.js → loading-spinner.stories-B2GCLqqq.js} +1 -1
- package/dist/assets/{logo.stories-2LBqqraT.js → logo.stories-BK37XQOB.js} +9 -1
- package/dist/assets/{main.stories-BQzD7iWD.js → main.stories-DzXRavXL.js} +10 -2
- package/dist/assets/{modal-CCfbY4fF.js → modal-CRGEVzx5.js} +10 -2
- package/dist/assets/{modal-GglWRNJp.js → modal-frjOZV7F.js} +3 -3
- package/dist/assets/{modal.stories-CpybCs79.js → modal.stories-DPTsnRPI.js} +1 -1
- package/dist/assets/{multi-select.stories-BhzEKRui.js → multi-select.stories-DoNFngx3.js} +12 -4
- package/dist/assets/{nav-container.stories-Be1YlegP.js → nav-container.stories-BV0DiV1z.js} +11 -3
- package/dist/assets/{page-header.stories-BOVLQ0YF.js → page-header.stories-DGqzeCVS.js} +9 -1
- package/dist/assets/{pagination.stories-D62sa_1K.js → pagination.stories-DymlgiVw.js} +28 -12
- package/dist/assets/{percent-bar.stories-CYi4El7T.js → percent-bar.stories-BJd3Qi90.js} +11 -3
- package/dist/assets/{popover.stories-B9O8F4yv.js → popover.stories-0CnGKfM7.js} +11 -3
- package/dist/assets/{primary-nav.stories-Bt-o7h45.js → primary-nav.stories-DoEjkNEW.js} +17 -1
- package/dist/assets/{progress-meter-Dit59091.js → progress-meter-Ca-xdNNC.js} +9 -1
- package/dist/assets/{progress-meter.stories-CYnOCmjo.js → progress-meter.stories-CiwBm4ND.js} +1 -1
- package/dist/assets/{progress-steps-item-CWJsad0s.js → progress-steps-item-XkO_k158.js} +9 -1
- package/dist/assets/{progress-steps-item.stories-ePn_6bPn.js → progress-steps-item.stories-ikJlzkED.js} +1 -1
- package/dist/assets/{progress-steps.stories-CblrEcXF.js → progress-steps.stories-ezsJjY7f.js} +37 -29
- package/dist/assets/{radio-field-item-Bm-0RWPe.js → radio-field-item-gOof1xz7.js} +31 -15
- package/dist/assets/{radio-field-item.stories-y_TrTRIW.js → radio-field-item.stories-Bg7NJuid.js} +6 -6
- package/dist/assets/{radio-field.stories-CSWrbUrn.js → radio-field.stories-CwqXSLAA.js} +2 -2
- package/dist/assets/{remove-tag-lCr57c5r.js → remove-tag-tJrDexqV.js} +10 -2
- package/dist/assets/{remove-tag.stories-CDfwCdvZ.js → remove-tag.stories-CANJ3xUD.js} +1 -1
- package/dist/assets/{sample-modal.stories-BZ4N2R2Z.js → sample-modal.stories-CAZBmR1N.js} +4 -4
- package/dist/assets/{section.stories-D_1InThX.js → section.stories-Dbw4FBo8.js} +9 -1
- package/dist/assets/{select-tile-BqqB3ZtE.js → select-tile-DbEfRqPZ.js} +10 -2
- package/dist/assets/{select-tile-list.stories-Di4ILgV8.js → select-tile-list.stories-BWIbF_U7.js} +9 -1
- package/dist/assets/{select-tile.stories-D3h_6zlV.js → select-tile.stories-DWzrgGaK.js} +1 -1
- package/dist/assets/{select.stories-BB2phP9A.js → select.stories-DP29QG7D.js} +9 -1
- package/dist/assets/sign-in.stories-BYo2rxIQ.js +63 -0
- package/dist/assets/{skeleton-loader.stories-y4uml_kV.js → skeleton-loader.stories-B1cPTECY.js} +13 -5
- package/dist/assets/{split-button.stories-C_82I4ME.js → split-button.stories-DlxT6EYF.js} +12 -4
- package/dist/assets/{spread-CnPic3C2.js → spread-B518TqwY.js} +1 -1
- package/dist/assets/state-C6YC-MeJ.js +1 -0
- package/dist/assets/{submenu.stories-UDtaREr1.js → submenu.stories-BT13dETW.js} +18 -2
- package/dist/assets/{syntaxhighlighter-T5IQBZDB-D-I_s_yD.js → syntaxhighlighter-T5IQBZDB-DkhjPTlq.js} +1 -1
- package/dist/assets/{table-header-2837i43H.js → table-header-DMiTn2zX.js} +81 -33
- package/dist/assets/{table-object.stories-D4KoI-wA.js → table-object.stories-D2dcUZ2O.js} +11 -3
- package/dist/assets/{table.stories-DUJDibEp.js → table.stories-BXu1RY5-.js} +2 -2
- package/dist/assets/{tabs.stories-C06SngOF.js → tabs.stories-B9tPcDRI.js} +34 -10
- package/dist/assets/{tag-oHGdclJl.js → tag-AWpjXoCW.js} +9 -1
- package/dist/assets/{tag-list.stories-Du-IoYzu.js → tag-list.stories-CiqM7sIX.js} +21 -13
- package/dist/assets/{tag.stories-C5D5IbuK.js → tag.stories-BcbkBkLR.js} +1 -1
- package/dist/assets/{tertiary-nav.stories-B1GU8Zi4.js → tertiary-nav.stories-CuP_odo_.js} +19 -3
- package/dist/assets/{text-link-B3m3KEqY.js → text-link-DWpfqc0H.js} +9 -1
- package/dist/assets/{text-link.stories-4O6qn82H.js → text-link.stories-BSQQ8Bf8.js} +1 -1
- package/dist/assets/{text-passage-xQVosjOr.js → text-passage-C-tu1uRd.js} +19 -3
- package/dist/assets/{text-passage.stories-Da1nspwG.js → text-passage.stories-qCVobGhn.js} +1 -1
- package/dist/assets/{tooltip.stories-DLKyyeKn.js → tooltip.stories-CcxLUUaE.js} +16 -8
- package/dist/assets/{utility-nav.stories-B6xBFe7z.js → utility-nav.stories-CmUYbo0J.js} +21 -5
- package/dist/design-tokens/brands/cre8-a2ui/css/tokens_brand.css +4 -4
- package/dist/design-tokens/core/scss/theming/component.css +1 -1
- package/dist/design-tokens/core/scss/theming/variables.css +7 -1
- package/dist/design-tokens/core/scss/theming/variables.scss +11 -0
- 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/iframe.html +25 -2
- package/dist/index.html +82 -26
- package/dist/index.json +1 -1
- package/dist/logo.svg +1 -0
- package/dist/manifests/components.html +766 -0
- package/dist/manifests/docs.json +37 -0
- package/dist/project.json +1 -1
- package/dist/sb-addons/storybook-5/manager-bundle.js +8 -0
- package/dist/sb-addons/vitest-4/manager-bundle.js +3 -0
- package/lib/cdn-entry.d.ts +2 -1
- package/lib/cdn-entry.d.ts.map +1 -1
- package/lib/cdn-entry.js +2 -1
- package/lib/cdn-entry.js.map +1 -1
- package/lib/components/cre8-field.js +1 -1
- package/lib/components/cre8-form-element.d.ts +27 -0
- package/lib/components/cre8-form-element.d.ts.map +1 -1
- package/lib/components/cre8-form-element.js +65 -1
- package/lib/components/cre8-form-element.js.map +1 -1
- package/lib/components/field/field.styles.d.ts.map +1 -1
- package/lib/components/field/field.styles.js +4 -2
- package/lib/components/field/field.styles.js.map +1 -1
- package/lib/components/form/form.d.ts +87 -0
- package/lib/components/form/form.d.ts.map +1 -0
- package/lib/components/form/form.js +209 -0
- package/lib/components/form/form.js.map +1 -0
- package/lib/components/form/form.styles.d.ts +14 -0
- package/lib/components/form/form.styles.d.ts.map +1 -0
- package/lib/components/form/form.styles.js +31 -0
- package/lib/components/form/form.styles.js.map +1 -0
- package/lib/{cre8-form-element-BymRdQUC.js → cre8-form-element-CCzBYtDm.js} +85 -32
- package/lib/design-tokens/brands/cre8-a2ui/css/tokens_brand.css +4 -4
- package/lib/design-tokens/brands/cre8-a2ui/css/tokens_cre8-a2ui.module.d.ts +1 -1
- package/lib/design-tokens/brands/cre8-a2ui/css/tokens_cre8-a2ui.module.d.ts.map +1 -1
- package/lib/design-tokens/brands/cre8-a2ui/css/tokens_cre8-a2ui.module.js +4 -4
- package/lib/design-tokens/brands/cre8-a2ui/css/tokens_cre8-a2ui.module.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/scripts/generate-mcp-manifest.js +1 -0
- package/lib/scripts/generate-mcp-manifest.js.map +1 -1
- package/lib/toBeAccessible.d.ts +6 -5
- package/lib/toBeAccessible.d.ts.map +1 -1
- package/lib/toBeAccessible.js +1 -1
- package/lib/toBeAccessible.js.map +1 -1
- package/mcp-manifest.json +44 -1
- package/package.json +16 -13
- package/react-manifest.json +40 -2
- package/dist/assets/cre8-element-B35i4Lyg.js +0 -1
- package/dist/assets/cre8-form-element-Cfc5VeYV.js +0 -1
- package/dist/assets/dropdown-item.stories-Iaw_UrEP.js +0 -26
- package/dist/assets/example-drug-card.stories-Bp5JIeE_.js +0 -10
- package/dist/assets/form-example.stories-9IDC0AgX.js +0 -49
- package/dist/assets/icon-description-BBSwDykJ.js +0 -45
- package/dist/assets/icon-description.stories-Cg6ekOme.js +0 -3
- package/dist/assets/if-defined-Bxnzk64Q.js +0 -1
- package/dist/assets/medication-card.stories-Wc-hA0-s.js +0 -165
- package/dist/assets/medication-form.stories-DfFOCDaU.js +0 -57
- package/dist/assets/request-prescription.stories-O4zqokfb.js +0 -24
- package/dist/assets/state-DkQhleoO.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.styles.js","sourceRoot":"","sources":["../../../components/field/field.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0sBhB,CAAC;AACH,eAAe,MAAM,CAAC","sourcesContent":["import { css } from 'lit';\nconst styles = css`.cre8-u-content-knockout-brand {\n color: var(----cre8-color-content-knockout-brand);\n}\n\n.cre8-u-is-hidden {\n display: none !important;\n visibility: hidden !important;\n}\n\n.cre8-u-is-vishidden {\n position: absolute !important;\n overflow: hidden;\n width: 1px;\n height: 1px;\n padding: 0;\n border: 0;\n clip: rect(1px, 1px, 1px, 1px);\n}\n\n@media all and (min-width: 23.4375rem) {\n .cre8-u-hide-sm {\n display: none !important;\n }\n}\n@media all and (min-width: 35rem) {\n .cre8-u-hide-sm-2 {\n display: none !important;\n }\n}\n@media all and (min-width: 48rem) {\n .cre8-u-hide-md {\n display: none !important;\n }\n}\n@media all and (min-width: 60rem) {\n .cre8-u-hide-lg {\n display: none !important;\n }\n}\n@media all and (min-width: 75rem) {\n .cre8-u-hide-xl {\n display: none !important;\n }\n}\n@media all and (max-width: 23.4375rem) {\n .cre8-u-show-sm {\n display: none !important;\n }\n}\n@media all and (max-width: 35rem) {\n .cre8-u-show-sm-2 {\n display: none !important;\n }\n}\n@media all and (max-width: 48rem) {\n .cre8-u-show-md {\n display: none !important;\n }\n}\n@media all and (max-width: 60rem) {\n .cre8-u-show-lg {\n display: none !important;\n }\n}\n@media all and (max-width: 75rem) {\n .cre8-u-show-xl {\n display: none !important;\n }\n}\n.cre8-u-margin-none {\n margin: 0 !important;\n}\n\n.cre8-u-margin-sm {\n margin: size(1) !important;\n}\n\n.cre8-u-margin-md {\n margin: size(2) !important;\n}\n\n.cre8-u-margin-lg {\n margin: size(3) !important;\n}\n\n.cre8-u-margin-xl {\n margin: size(4) !important;\n}\n\n.cre8-u-margin-xxl {\n margin: size(8) !important;\n}\n\n.cre8-u-margin-top-none {\n margin-top: 0 !important;\n}\n\n.cre8-u-margin-top-sm {\n margin-top: size(1) !important;\n}\n\n.cre8-u-margin-top-md {\n margin-top: size(2) !important;\n}\n\n.cre8-u-margin-top-lg {\n margin-top: size(3) !important;\n}\n\n.cre8-u-margin-top-xl {\n margin-top: size(4) !important;\n}\n\n.cre8-u-margin-top-xxl {\n margin-top: size(8) !important;\n}\n\n.cre8-u-margin-right-none {\n margin-right: 0 !important;\n}\n\n.cre8-u-margin-right-sm {\n margin-right: size(1) !important;\n}\n\n.cre8-u-margin-right-md {\n margin-right: size(2) !important;\n}\n\n.cre8-u-margin-right-lg {\n margin-right: size(3) !important;\n}\n\n.cre8-u-margin-right-xl {\n margin-right: size(4) !important;\n}\n\n.cre8-u-margin-right-xxl {\n margin-right: size(8) !important;\n}\n\n.cre8-u-margin-bottom-none {\n margin-bottom: 0 !important;\n}\n\n.cre8-u-margin-bottom-sm {\n margin-bottom: size(1) !important;\n}\n\n.cre8-u-margin-bottom-md {\n margin-bottom: size(2) !important;\n}\n\n.cre8-u-margin-bottom-lg {\n margin-bottom: size(3) !important;\n}\n\n.cre8-u-margin-bottom-xl {\n margin-bottom: size(4) !important;\n}\n\n.cre8-u-margin-bottom-xxl {\n margin-bottom: size(8) !important;\n}\n\n.cre8-u-margin-bottom-xl-xxl {\n margin-bottom: size(4) !important;\n}\n\n@media all and (min-width: 768px) {\n .cre8-u-margin-bottom-xl-xxl {\n margin-bottom: size(8) !important;\n }\n}\n.cre8-u-margin-left-none {\n margin-left: 0 !important;\n}\n\n.cre8-u-margin-left-sm {\n margin-left: size(1) !important;\n}\n\n.cre8-u-margin-left-md {\n margin-left: size(2) !important;\n}\n\n.cre8-u-margin-left-lg {\n margin-left: size(3) !important;\n}\n\n.cre8-u-margin-left-xl {\n margin-left: size(4) !important;\n}\n\n.cre8-u-margin-left-xxl {\n margin-left: size(8) !important;\n}\n\n.cre8-u-padding-none {\n padding: 0 !important;\n}\n\n.cre8-u-padding-sm {\n padding: size(1) !important;\n}\n\n.cre8-u-padding-md {\n padding: size(2) !important;\n}\n\n.cre8-u-padding-lg {\n padding: size(3) !important;\n}\n\n.cre8-u-padding-xl {\n padding: size(4) !important;\n}\n\n.cre8-u-padding-xxl {\n padding: size(8) !important;\n}\n\n.cre8-u-padding-top-none {\n padding-top: 0 !important;\n}\n\n.cre8-u-padding-top-sm {\n padding-top: size(1) !important;\n}\n\n.cre8-u-padding-top-md {\n padding-top: size(2) !important;\n}\n\n.cre8-u-padding-top-lg {\n padding-top: size(3) !important;\n}\n\n.cre8-u-padding-top-xl {\n padding-top: size(4) !important;\n}\n\n.cre8-u-padding-top-xxl {\n padding-top: size(8) !important;\n}\n\n.cre8-u-padding-right-none {\n padding-right: 0 !important;\n}\n\n.cre8-u-padding-right-sm {\n padding-right: size(1) !important;\n}\n\n.cre8-u-padding-right-md {\n padding-right: size(2) !important;\n}\n\n.cre8-u-padding-right-lg {\n padding-right: size(3) !important;\n}\n\n.cre8-u-padding-right-xl {\n padding-right: size(4) !important;\n}\n\n.cre8-u-padding-right-xxl {\n padding-right: size(8) !important;\n}\n\n.cre8-u-padding-bottom-none {\n padding-bottom: 0 !important;\n}\n\n.cre8-u-padding-bottom-sm {\n padding-bottom: size(1) !important;\n}\n\n.cre8-u-padding-bottom-md {\n padding-bottom: size(2) !important;\n}\n\n.cre8-u-padding-bottom-lg {\n padding-bottom: size(3) !important;\n}\n\n.cre8-u-padding-bottom-xl {\n padding-bottom: size(4) !important;\n}\n\n.cre8-u-padding-bottom-xxl {\n padding-bottom: size(8) !important;\n}\n\n.cre8-u-padding-left-none {\n padding-left: 0 !important;\n}\n\n.cre8-u-padding-left-sm {\n padding-left: size(1) !important;\n}\n\n.cre8-u-padding-left-md {\n padding-left: size(2) !important;\n}\n\n.cre8-u-padding-left-lg {\n padding-left: size(3) !important;\n}\n\n.cre8-u-padding-left-xl {\n padding-left: size(4) !important;\n}\n\n.cre8-u-padding-left-xxl {\n padding-left: size(8) !important;\n}\n\n.cre8-u-display-flex {\n display: flex !important;\n}\n\n.cre8-u-display-block {\n display: block !important;\n}\n\nbody {\n font-family: var(--cre8-typography-body-default-font-family);\n font-size: var(--cre8-typography-body-default-font-size);\n font-weight: var(--cre8-typography-body-default-font-weight);\n line-height: var(--cre8-typography-body-default-line-height);\n -webkit-text-decoration: var(--cre8-typography-body-default-text-decoration);\n text-decoration: var(--cre8-typography-body-default-text-decoration);\n text-transform: var(--cre8-typography-body-default-text-transform);\n display: flex;\n flex-direction: column;\n padding: 0;\n margin: 0;\n color: var(--cre8-color-content-default);\n background: var(--background-default);\n}\n\n@media all and (min-width: 60rem) {\n .page-container {\n background: linear-gradient(90deg, #fff 0, #fff 66.66%, #f8f8f9 0, #f8f8f9 0);\n }\n}\n.band__inner {\n margin-left: 2rem;\n margin-right: 2rem;\n}\n\n@media all and (min-width: 60rem) {\n .band__inner {\n margin-right: 0;\n }\n}\nimg {\n max-width: 100%;\n height: auto;\n}\n\n/**\n * Border-Box http:/paulirish.com/2012/box-sizing-border-box-ftw/\n */\n*,\n::slotted(*),\n*:before,\n*:after {\n box-sizing: border-box;\n}\n\n:root {\n --size-base-unit: 0.5rem;\n --cre8-l-max-width: 82.5rem;\n /* 1 */\n --cre8-l-linelength-width: 42rem;\n /* 1 */\n}\n\n/**\n * RTL support for values logical properties can't automatically adjust for\n * 1) Percentage based horizontal translate values need to be flipped\n * 2) Background gradients using \"to-right\" or \"to-left\" need to be switched to using deg values.\n * 3) Inverse items that have 45degs\n */\n[dir=rtl] {\n --rtlTranslateX: 50%;\n /* 1 */\n --rtlGradientToRight: 270deg;\n /* 2 */\n --rtlRotate45Inverse: -45deg;\n /* 3 */\n}\n\n/**\n * Visible focus outline for elements on a light background\n */\n/**\n * Visible focus outline for elements with an error status\n */\n/**\n * Visible focus outline for elements on a dark background\n */\n/**\n* Focus state for themes that need a dashed outline for focus\n* state\n**/\n/**\n * Invisible focus outline for elements that need a more visible\n * focus state for high-contrast mode\n */\n/**\n * Visually hidden from display\n */\n/*\n=======\nAnimations\n=======\n*/\n:host {\n --cre8-z-index-1: 1;\n --cre8-z-index-50: 50;\n --cre8-z-index-100: 100;\n --cre8-z-index-200: 200;\n --cre8-z-index-1030: 1030;\n --cre8-anim-fade-quick: 0.35s;\n --cre8-anim-ease: ease;\n}\n\n@keyframes fadeIn {\n 100% {\n opacity: 1;\n }\n}\n@keyframes slideIn {\n 100% {\n transform: translateX(0);\n }\n}\n@keyframes slideInFwd {\n 100% {\n width: 272px;\n height: 272px;\n }\n}\n@keyframes slideOutRight {\n 100% {\n width: 272px;\n height: 272px;\n }\n}\n@keyframes slideUp {\n 100% {\n transform: translateY(0);\n }\n}\n@media (width >= 481px) {\n @keyframes slideInFwd {\n 100% {\n width: 417px;\n height: 417px;\n }\n }\n @keyframes slideOutRight {\n 100% {\n width: 417px;\n height: 417px;\n }\n }\n}\n@media (width >= 48rem) {\n @keyframes slideInFwd {\n 100% {\n width: 330px;\n height: 330px;\n }\n }\n @keyframes slideOutRight {\n 100% {\n width: 330px;\n height: 330px;\n transform: translateX(calc(100vw - 45px));\n }\n }\n}\n@media (width >= 60rem) {\n @keyframes slideInFwd {\n 100% {\n width: 460px;\n height: 460px;\n }\n }\n @keyframes slideOutRight {\n 100% {\n width: 460px;\n height: 460px;\n transform: translateX(calc(100vw - 45px));\n }\n }\n}\n@media (width >= 75rem) {\n @keyframes slideInFwd {\n 100% {\n width: 592px;\n height: 591px;\n }\n }\n @keyframes slideOutRight {\n 100% {\n width: 592px;\n height: 591px;\n transform: translateX(calc(100vw - 45px));\n }\n }\n}\n@media (width >= 87.5rem) {\n @keyframes slideOutRight {\n 100% {\n width: 592px;\n height: 591px;\n transform: translateX(calc(100vw - 120px));\n }\n }\n}\n@media (width >= 2200px) {\n @keyframes slideOutRight {\n 100% {\n width: 592px;\n height: 591px;\n transform: translateX(calc(100vw - 592px));\n }\n }\n}\nspan.ripple {\n position: absolute;\n border-radius: 50%;\n transform: scale(0);\n animation: ripple 600ms linear;\n background-color: var(--ripple-bg-color);\n}\n\n@keyframes ripple {\n to {\n transform: scale(4);\n opacity: 1;\n }\n}\n:root {\n --size-base-unit: 0.5rem;\n --cre8-l-max-width: 82.5rem;\n /* 1 */\n --cre8-l-linelength-width: 42rem;\n /* 1 */\n}\n\n/**\n * RTL support for values logical properties can't automatically adjust for\n * 1) Percentage based horizontal translate values need to be flipped\n * 2) Background gradients using \"to-right\" or \"to-left\" need to be switched to using deg values.\n * 3) Inverse items that have 45degs\n */\n[dir=rtl] {\n --rtlTranslateX: 50%;\n /* 1 */\n --rtlGradientToRight: 270deg;\n /* 2 */\n --rtlRotate45Inverse: -45deg;\n /* 3 */\n}\n\n/**\n * Visible focus outline for elements on a light background\n */\n/**\n * Visible focus outline for elements with an error status\n */\n/**\n * Visible focus outline for elements on a dark background\n */\n/**\n* Focus state for themes that need a dashed outline for focus\n* state\n**/\n/**\n * Invisible focus outline for elements that need a more visible\n * focus state for high-contrast mode\n */\n/**\n * Visually hidden from display\n */\n:host {\n display: block;\n}\n\n/** \n * Field Label \n */\n.cre8-c-field__label {\n font-family: var(--cre8-typography-label-small-font-family);\n font-size: var(--cre8-typography-label-small-font-size);\n font-weight: var(--cre8-typography-label-small-font-weight);\n line-height: var(--cre8-typography-label-small-line-height);\n text-decoration: var(--cre8-typography-label-small-text-decoration);\n text-transform: var(--cre8-typography-label-small-text-transform);\n display: block;\n margin-bottom: 0.5rem;\n margin-left: var(--cre8-input-label-margin-left, 0px);\n}\n\n/** \n * Field Body\n * 1) The div that contains the input and icons \n */\n.cre8-c-field__body {\n position: relative;\n}\n\n/** \n * Field Input \n * 1) The html5 input element\n */\n.cre8-c-field__input {\n font-family: var(--cre8-typography-body-default-font-family);\n font-size: var(--cre8-typography-body-default-font-size);\n font-weight: var(--cre8-typography-body-default-font-weight);\n line-height: var(--cre8-typography-body-default-line-height);\n text-decoration: var(--cre8-typography-body-default-text-decoration);\n text-transform: var(--cre8-typography-body-default-text-transform);\n outline: var(--cre8-border-width-focus) solid transparent;\n outline-offset: 0.125rem;\n --size-base-unit: .5rem;\n -webkit-appearance: none;\n width: 100%;\n border-width: var(--cre8-border-width-default);\n border-style: solid;\n border-color: var(--cre8-color-border-strong);\n border-radius: var(--cre8-border-radius-default);\n padding: var(--cre8-input-padding, 0.75rem 0.5rem);\n color: var(--cre8-color-content-default);\n background-color: var(--cre8-color-bg-default);\n transition: outline-color var(--cre8-anim-fade-quick) var(--cre8-anim-ease), border-color var(--cre8-anim-fade-quick) var(--cre8-anim-ease), background-color var(--cre8-anim-fade-quick) var(--cre8-anim-ease), color var(--cre8-anim-fade-quick) var(--cre8-anim-ease);\n /**\n * Hover, focus, active, and focus-visible styles for default input elements\n */\n}\n.cre8-c-field__input:hover:not(:disabled), .cre8-c-field__input:focus:not(:disabled), .cre8-c-field__input:active:not(:disabled), .cre8-c-field__input:focus-visible {\n outline: var(--cre8-border-width-focus) solid var(--cre8-color-border-active-outline);\n outline-offset: 0.125rem;\n /**\n * Error state\n */\n}\n.cre8-is-error .cre8-c-field__input:hover:not(:disabled), .cre8-is-error .cre8-c-field__input:focus:not(:disabled), .cre8-is-error .cre8-c-field__input:active:not(:disabled), .cre8-is-error .cre8-c-field__input:focus-visible {\n outline-color: var(--cre8-color-border-error);\n}\n.cre8-c-field__input:hover:not(:disabled), .cre8-c-field__input:focus:not(:disabled), .cre8-c-field__input:active:not(:disabled), .cre8-c-field__input:focus-visible {\n /**\n * Success state\n */\n}\n.cre8-is-success .cre8-c-field__input:hover:not(:disabled), .cre8-is-success .cre8-c-field__input:focus:not(:disabled), .cre8-is-success .cre8-c-field__input:active:not(:disabled), .cre8-is-success .cre8-c-field__input:focus-visible {\n outline-color: var(--cre8-color-border-success);\n}\n.cre8-c-field__input {\n /**\n * Disabled styles for default input elements\n */\n}\n.cre8-c-field__input:disabled {\n background-color: var(--cre8-color-bg-disabled);\n border-color: var(--cre8-color-border-disabled);\n color: var(--cre8-color-content-disabled);\n cursor: not-allowed;\n /**\n * Disabled text colors\n */\n}\n.cre8-c-field__input:disabled::placeholder {\n color: var(--cre8-color-content-disabled);\n}\n.cre8-c-field__input {\n /**\n * Placeholder styles for default input elements\n */\n}\n.cre8-c-field__input::placeholder {\n color: var(--cre8-color-content-subtle);\n}\n.cre8-c-field__input {\n /**\n * Error state for default input elements\n */\n}\n.cre8-is-error .cre8-c-field__input {\n border-color: var(--cre8-color-border-error);\n}\n.cre8-c-field__input {\n /**\n * Success state for default input elements\n */\n}\n.cre8-is-success .cre8-c-field__input {\n border-color: var(--cre8-color-border-success);\n}\n.cre8-c-field__input {\n /**\n * Readonly input styles\n */\n}\n.cre8-c-field__input:read-only {\n background-color: var(--cre8-color-bg-disabled);\n border-color: var(--cre8-color-border-disabled);\n cursor: default;\n}`;\nexport default styles;\n"]}
|
|
1
|
+
{"version":3,"file":"field.styles.js","sourceRoot":"","sources":["../../../components/field/field.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4sBjB,CAAC;AAAA,eAAe,MAAM,CAAC","sourcesContent":["import { css } from 'lit';\n\nconst styles = css`\n.cre8-u-content-knockout-brand {\n color: var(----cre8-color-content-knockout-brand);\n}\n\n.cre8-u-is-hidden {\n display: none !important;\n visibility: hidden !important;\n}\n\n.cre8-u-is-vishidden {\n position: absolute !important;\n overflow: hidden;\n width: 1px;\n height: 1px;\n padding: 0;\n border: 0;\n clip: rect(1px, 1px, 1px, 1px);\n}\n\n@media all and (min-width: 23.4375rem) {\n .cre8-u-hide-sm {\n display: none !important;\n }\n}\n@media all and (min-width: 35rem) {\n .cre8-u-hide-sm-2 {\n display: none !important;\n }\n}\n@media all and (min-width: 48rem) {\n .cre8-u-hide-md {\n display: none !important;\n }\n}\n@media all and (min-width: 60rem) {\n .cre8-u-hide-lg {\n display: none !important;\n }\n}\n@media all and (min-width: 75rem) {\n .cre8-u-hide-xl {\n display: none !important;\n }\n}\n@media all and (max-width: 23.4375rem) {\n .cre8-u-show-sm {\n display: none !important;\n }\n}\n@media all and (max-width: 35rem) {\n .cre8-u-show-sm-2 {\n display: none !important;\n }\n}\n@media all and (max-width: 48rem) {\n .cre8-u-show-md {\n display: none !important;\n }\n}\n@media all and (max-width: 60rem) {\n .cre8-u-show-lg {\n display: none !important;\n }\n}\n@media all and (max-width: 75rem) {\n .cre8-u-show-xl {\n display: none !important;\n }\n}\n.cre8-u-margin-none {\n margin: 0 !important;\n}\n\n.cre8-u-margin-sm {\n margin: size(1) !important;\n}\n\n.cre8-u-margin-md {\n margin: size(2) !important;\n}\n\n.cre8-u-margin-lg {\n margin: size(3) !important;\n}\n\n.cre8-u-margin-xl {\n margin: size(4) !important;\n}\n\n.cre8-u-margin-xxl {\n margin: size(8) !important;\n}\n\n.cre8-u-margin-top-none {\n margin-top: 0 !important;\n}\n\n.cre8-u-margin-top-sm {\n margin-top: size(1) !important;\n}\n\n.cre8-u-margin-top-md {\n margin-top: size(2) !important;\n}\n\n.cre8-u-margin-top-lg {\n margin-top: size(3) !important;\n}\n\n.cre8-u-margin-top-xl {\n margin-top: size(4) !important;\n}\n\n.cre8-u-margin-top-xxl {\n margin-top: size(8) !important;\n}\n\n.cre8-u-margin-right-none {\n margin-right: 0 !important;\n}\n\n.cre8-u-margin-right-sm {\n margin-right: size(1) !important;\n}\n\n.cre8-u-margin-right-md {\n margin-right: size(2) !important;\n}\n\n.cre8-u-margin-right-lg {\n margin-right: size(3) !important;\n}\n\n.cre8-u-margin-right-xl {\n margin-right: size(4) !important;\n}\n\n.cre8-u-margin-right-xxl {\n margin-right: size(8) !important;\n}\n\n.cre8-u-margin-bottom-none {\n margin-bottom: 0 !important;\n}\n\n.cre8-u-margin-bottom-sm {\n margin-bottom: size(1) !important;\n}\n\n.cre8-u-margin-bottom-md {\n margin-bottom: size(2) !important;\n}\n\n.cre8-u-margin-bottom-lg {\n margin-bottom: size(3) !important;\n}\n\n.cre8-u-margin-bottom-xl {\n margin-bottom: size(4) !important;\n}\n\n.cre8-u-margin-bottom-xxl {\n margin-bottom: size(8) !important;\n}\n\n.cre8-u-margin-bottom-xl-xxl {\n margin-bottom: size(4) !important;\n}\n\n@media all and (min-width: 768px) {\n .cre8-u-margin-bottom-xl-xxl {\n margin-bottom: size(8) !important;\n }\n}\n.cre8-u-margin-left-none {\n margin-left: 0 !important;\n}\n\n.cre8-u-margin-left-sm {\n margin-left: size(1) !important;\n}\n\n.cre8-u-margin-left-md {\n margin-left: size(2) !important;\n}\n\n.cre8-u-margin-left-lg {\n margin-left: size(3) !important;\n}\n\n.cre8-u-margin-left-xl {\n margin-left: size(4) !important;\n}\n\n.cre8-u-margin-left-xxl {\n margin-left: size(8) !important;\n}\n\n.cre8-u-padding-none {\n padding: 0 !important;\n}\n\n.cre8-u-padding-sm {\n padding: size(1) !important;\n}\n\n.cre8-u-padding-md {\n padding: size(2) !important;\n}\n\n.cre8-u-padding-lg {\n padding: size(3) !important;\n}\n\n.cre8-u-padding-xl {\n padding: size(4) !important;\n}\n\n.cre8-u-padding-xxl {\n padding: size(8) !important;\n}\n\n.cre8-u-padding-top-none {\n padding-top: 0 !important;\n}\n\n.cre8-u-padding-top-sm {\n padding-top: size(1) !important;\n}\n\n.cre8-u-padding-top-md {\n padding-top: size(2) !important;\n}\n\n.cre8-u-padding-top-lg {\n padding-top: size(3) !important;\n}\n\n.cre8-u-padding-top-xl {\n padding-top: size(4) !important;\n}\n\n.cre8-u-padding-top-xxl {\n padding-top: size(8) !important;\n}\n\n.cre8-u-padding-right-none {\n padding-right: 0 !important;\n}\n\n.cre8-u-padding-right-sm {\n padding-right: size(1) !important;\n}\n\n.cre8-u-padding-right-md {\n padding-right: size(2) !important;\n}\n\n.cre8-u-padding-right-lg {\n padding-right: size(3) !important;\n}\n\n.cre8-u-padding-right-xl {\n padding-right: size(4) !important;\n}\n\n.cre8-u-padding-right-xxl {\n padding-right: size(8) !important;\n}\n\n.cre8-u-padding-bottom-none {\n padding-bottom: 0 !important;\n}\n\n.cre8-u-padding-bottom-sm {\n padding-bottom: size(1) !important;\n}\n\n.cre8-u-padding-bottom-md {\n padding-bottom: size(2) !important;\n}\n\n.cre8-u-padding-bottom-lg {\n padding-bottom: size(3) !important;\n}\n\n.cre8-u-padding-bottom-xl {\n padding-bottom: size(4) !important;\n}\n\n.cre8-u-padding-bottom-xxl {\n padding-bottom: size(8) !important;\n}\n\n.cre8-u-padding-left-none {\n padding-left: 0 !important;\n}\n\n.cre8-u-padding-left-sm {\n padding-left: size(1) !important;\n}\n\n.cre8-u-padding-left-md {\n padding-left: size(2) !important;\n}\n\n.cre8-u-padding-left-lg {\n padding-left: size(3) !important;\n}\n\n.cre8-u-padding-left-xl {\n padding-left: size(4) !important;\n}\n\n.cre8-u-padding-left-xxl {\n padding-left: size(8) !important;\n}\n\n.cre8-u-display-flex {\n display: flex !important;\n}\n\n.cre8-u-display-block {\n display: block !important;\n}\n\nbody {\n font-family: var(--cre8-typography-body-default-font-family);\n font-size: var(--cre8-typography-body-default-font-size);\n font-weight: var(--cre8-typography-body-default-font-weight);\n line-height: var(--cre8-typography-body-default-line-height);\n -webkit-text-decoration: var(--cre8-typography-body-default-text-decoration);\n text-decoration: var(--cre8-typography-body-default-text-decoration);\n text-transform: var(--cre8-typography-body-default-text-transform);\n display: flex;\n flex-direction: column;\n padding: 0;\n margin: 0;\n color: var(--cre8-color-content-default);\n background: var(--background-default);\n}\n\n@media all and (min-width: 60rem) {\n .page-container {\n background: linear-gradient(90deg, #fff 0, #fff 66.66%, #f8f8f9 0, #f8f8f9 0);\n }\n}\n.band__inner {\n margin-left: 2rem;\n margin-right: 2rem;\n}\n\n@media all and (min-width: 60rem) {\n .band__inner {\n margin-right: 0;\n }\n}\nimg {\n max-width: 100%;\n height: auto;\n}\n\n/**\n * Border-Box http:/paulirish.com/2012/box-sizing-border-box-ftw/\n */\n*,\n::slotted(*),\n*:before,\n*:after {\n box-sizing: border-box;\n}\n\n:root {\n --size-base-unit: 0.5rem;\n --cre8-l-max-width: 82.5rem;\n /* 1 */\n --cre8-l-linelength-width: 42rem;\n /* 1 */\n}\n\n/**\n * RTL support for values logical properties can't automatically adjust for\n * 1) Percentage based horizontal translate values need to be flipped\n * 2) Background gradients using \"to-right\" or \"to-left\" need to be switched to using deg values.\n * 3) Inverse items that have 45degs\n */\n[dir=rtl] {\n --rtlTranslateX: 50%;\n /* 1 */\n --rtlGradientToRight: 270deg;\n /* 2 */\n --rtlRotate45Inverse: -45deg;\n /* 3 */\n}\n\n/**\n * Visible focus outline for elements on a light background\n */\n/**\n * Visible focus outline for elements with an error status\n */\n/**\n * Visible focus outline for elements on a dark background\n */\n/**\n* Focus state for themes that need a dashed outline for focus\n* state\n**/\n/**\n * Invisible focus outline for elements that need a more visible\n * focus state for high-contrast mode\n */\n/**\n * Visually hidden from display\n */\n/*\n=======\nAnimations\n=======\n*/\n:host {\n --cre8-z-index-1: 1;\n --cre8-z-index-50: 50;\n --cre8-z-index-100: 100;\n --cre8-z-index-200: 200;\n --cre8-z-index-1030: 1030;\n --cre8-anim-fade-quick: 0.35s;\n --cre8-anim-ease: ease;\n}\n\n@keyframes fadeIn {\n 100% {\n opacity: 1;\n }\n}\n@keyframes slideIn {\n 100% {\n transform: translateX(0);\n }\n}\n@keyframes slideInFwd {\n 100% {\n width: 272px;\n height: 272px;\n }\n}\n@keyframes slideOutRight {\n 100% {\n width: 272px;\n height: 272px;\n }\n}\n@keyframes slideUp {\n 100% {\n transform: translateY(0);\n }\n}\n@media (width >= 481px) {\n @keyframes slideInFwd {\n 100% {\n width: 417px;\n height: 417px;\n }\n }\n @keyframes slideOutRight {\n 100% {\n width: 417px;\n height: 417px;\n }\n }\n}\n@media (width >= 48rem) {\n @keyframes slideInFwd {\n 100% {\n width: 330px;\n height: 330px;\n }\n }\n @keyframes slideOutRight {\n 100% {\n width: 330px;\n height: 330px;\n transform: translateX(calc(100vw - 45px));\n }\n }\n}\n@media (width >= 60rem) {\n @keyframes slideInFwd {\n 100% {\n width: 460px;\n height: 460px;\n }\n }\n @keyframes slideOutRight {\n 100% {\n width: 460px;\n height: 460px;\n transform: translateX(calc(100vw - 45px));\n }\n }\n}\n@media (width >= 75rem) {\n @keyframes slideInFwd {\n 100% {\n width: 592px;\n height: 591px;\n }\n }\n @keyframes slideOutRight {\n 100% {\n width: 592px;\n height: 591px;\n transform: translateX(calc(100vw - 45px));\n }\n }\n}\n@media (width >= 87.5rem) {\n @keyframes slideOutRight {\n 100% {\n width: 592px;\n height: 591px;\n transform: translateX(calc(100vw - 120px));\n }\n }\n}\n@media (width >= 2200px) {\n @keyframes slideOutRight {\n 100% {\n width: 592px;\n height: 591px;\n transform: translateX(calc(100vw - 592px));\n }\n }\n}\nspan.ripple {\n position: absolute;\n border-radius: 50%;\n transform: scale(0);\n animation: ripple 600ms linear;\n background-color: var(--ripple-bg-color);\n}\n\n@keyframes ripple {\n to {\n transform: scale(4);\n opacity: 1;\n }\n}\n:root {\n --size-base-unit: 0.5rem;\n --cre8-l-max-width: 82.5rem;\n /* 1 */\n --cre8-l-linelength-width: 42rem;\n /* 1 */\n}\n\n/**\n * RTL support for values logical properties can't automatically adjust for\n * 1) Percentage based horizontal translate values need to be flipped\n * 2) Background gradients using \"to-right\" or \"to-left\" need to be switched to using deg values.\n * 3) Inverse items that have 45degs\n */\n[dir=rtl] {\n --rtlTranslateX: 50%;\n /* 1 */\n --rtlGradientToRight: 270deg;\n /* 2 */\n --rtlRotate45Inverse: -45deg;\n /* 3 */\n}\n\n/**\n * Visible focus outline for elements on a light background\n */\n/**\n * Visible focus outline for elements with an error status\n */\n/**\n * Visible focus outline for elements on a dark background\n */\n/**\n* Focus state for themes that need a dashed outline for focus\n* state\n**/\n/**\n * Invisible focus outline for elements that need a more visible\n * focus state for high-contrast mode\n */\n/**\n * Visually hidden from display\n */\n:host {\n display: block;\n}\n\n/** \n * Field Label \n */\n.cre8-c-field__label {\n font-family: var(--cre8-typography-label-small-font-family);\n font-size: var(--cre8-typography-label-small-font-size);\n font-weight: var(--cre8-typography-label-small-font-weight);\n line-height: var(--cre8-typography-label-small-line-height);\n text-decoration: var(--cre8-typography-label-small-text-decoration);\n text-transform: var(--cre8-typography-label-small-text-transform);\n display: block;\n margin-bottom: 0.5rem;\n margin-left: var(--cre8-input-label-margin-left, 0px);\n}\n\n/** \n * Field Body\n * 1) The div that contains the input and icons \n */\n.cre8-c-field__body {\n position: relative;\n}\n\n/** \n * Field Input \n * 1) The html5 input element\n */\n.cre8-c-field__input {\n font-family: var(--cre8-typography-body-default-font-family);\n font-size: var(--cre8-typography-body-default-font-size);\n font-weight: var(--cre8-typography-body-default-font-weight);\n line-height: var(--cre8-typography-body-default-line-height);\n text-decoration: var(--cre8-typography-body-default-text-decoration);\n text-transform: var(--cre8-typography-body-default-text-transform);\n outline: var(--cre8-border-width-focus) solid transparent;\n outline-offset: 0.125rem;\n --size-base-unit: .5rem;\n -webkit-appearance: none;\n width: 100%;\n border-width: var(--cre8-border-width-default);\n border-style: solid;\n border-color: var(--cre8-color-border-strong);\n border-radius: var(--cre8-border-radius-default);\n padding: var(--cre8-input-padding, 0.75rem 0.5rem);\n color: var(--cre8-color-content-default);\n background-color: var(--cre8-color-bg-default);\n transition: outline-color var(--cre8-anim-fade-quick) var(--cre8-anim-ease), border-color var(--cre8-anim-fade-quick) var(--cre8-anim-ease), background-color var(--cre8-anim-fade-quick) var(--cre8-anim-ease), color var(--cre8-anim-fade-quick) var(--cre8-anim-ease);\n /**\n * Hover, focus, active, and focus-visible styles for default input elements\n */\n}\n.cre8-c-field__input:hover:not(:disabled), .cre8-c-field__input:focus:not(:disabled), .cre8-c-field__input:active:not(:disabled), .cre8-c-field__input:focus-visible {\n outline: var(--cre8-border-width-focus) solid var(--cre8-color-border-active-outline);\n outline-offset: 0.125rem;\n /**\n * Error state\n */\n}\n.cre8-is-error .cre8-c-field__input:hover:not(:disabled), .cre8-is-error .cre8-c-field__input:focus:not(:disabled), .cre8-is-error .cre8-c-field__input:active:not(:disabled), .cre8-is-error .cre8-c-field__input:focus-visible {\n outline-color: var(--cre8-color-border-error);\n}\n.cre8-c-field__input:hover:not(:disabled), .cre8-c-field__input:focus:not(:disabled), .cre8-c-field__input:active:not(:disabled), .cre8-c-field__input:focus-visible {\n /**\n * Success state\n */\n}\n.cre8-is-success .cre8-c-field__input:hover:not(:disabled), .cre8-is-success .cre8-c-field__input:focus:not(:disabled), .cre8-is-success .cre8-c-field__input:active:not(:disabled), .cre8-is-success .cre8-c-field__input:focus-visible {\n outline-color: var(--cre8-color-border-success);\n}\n.cre8-c-field__input {\n /**\n * Disabled styles for default input elements\n */\n}\n.cre8-c-field__input:disabled {\n background-color: var(--cre8-color-bg-disabled);\n border-color: var(--cre8-color-border-disabled);\n color: var(--cre8-color-content-disabled);\n cursor: not-allowed;\n /**\n * Disabled text colors\n */\n}\n.cre8-c-field__input:disabled::placeholder {\n color: var(--cre8-color-content-disabled);\n}\n.cre8-c-field__input {\n /**\n * Placeholder styles for default input elements\n */\n}\n.cre8-c-field__input::placeholder {\n color: var(--cre8-color-content-subtle);\n}\n.cre8-c-field__input {\n /**\n * Error state for default input elements\n */\n}\n.cre8-is-error .cre8-c-field__input {\n border-color: var(--cre8-color-border-error);\n}\n.cre8-c-field__input {\n /**\n * Success state for default input elements\n */\n}\n.cre8-is-success .cre8-c-field__input {\n border-color: var(--cre8-color-border-success);\n}\n.cre8-c-field__input {\n /**\n * Readonly input styles\n */\n}\n.cre8-c-field__input:read-only {\n background-color: var(--cre8-color-bg-disabled);\n border-color: var(--cre8-color-border-disabled);\n cursor: default;\n}\n`;export default styles;\n"]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { type PropertyValues } from 'lit';
|
|
2
|
+
import { Cre8Element } from '../cre8-element';
|
|
3
|
+
import type { Cre8FormElement } from '../cre8-form-element';
|
|
4
|
+
/**
|
|
5
|
+
* The form component groups form-associated Cre8 controls, aggregates their
|
|
6
|
+
* validation on submit, and orchestrates submit and reset.
|
|
7
|
+
*
|
|
8
|
+
* # How to Use
|
|
9
|
+
* 1. Place any Cre8 form controls inside `cre8-form`. They may be nested inside
|
|
10
|
+
* layout components such as `cre8-grid` or `cre8-layout`.
|
|
11
|
+
* 2. Add a `cre8-button` with `type="submit"` to submit the form.
|
|
12
|
+
* 3. Listen for `form-submit` to receive the collected `FormData`.
|
|
13
|
+
*
|
|
14
|
+
* Note: this component renders to light DOM. A form-associated control's form
|
|
15
|
+
* owner is the nearest `<form>` in its own node tree, so a shadow-DOM `<form>`
|
|
16
|
+
* would own nothing and `new FormData(form)` would come back empty.
|
|
17
|
+
*
|
|
18
|
+
* @slot The form's controls and layout.
|
|
19
|
+
*/
|
|
20
|
+
export declare class Cre8Form extends Cre8Element {
|
|
21
|
+
/**
|
|
22
|
+
* Skips aggregate validation on submit.
|
|
23
|
+
*/
|
|
24
|
+
novalidate?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Disables every control in the form, for example while submitting.
|
|
27
|
+
*/
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
private _form;
|
|
30
|
+
/** Renders to light DOM so child controls are owned by the form. */
|
|
31
|
+
createRenderRoot(): this;
|
|
32
|
+
/**
|
|
33
|
+
* Renders nothing. The `<form>` and the author's controls are managed
|
|
34
|
+
* imperatively in `_ensureForm` so that Lit never owns, and therefore never
|
|
35
|
+
* clears, the light-DOM children.
|
|
36
|
+
*/
|
|
37
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
38
|
+
connectedCallback(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Installs the component's stylesheet into its root node.
|
|
41
|
+
*
|
|
42
|
+
* Light-DOM components have no shadow root, so Lit never attaches
|
|
43
|
+
* `static styles`. The sheet is instead adopted by the document (or the
|
|
44
|
+
* enclosing shadow root, when the form is composed inside one) exactly
|
|
45
|
+
* once per root. Falls back to appending a `<style>` element where
|
|
46
|
+
* constructable stylesheets are unavailable (e.g. jsdom).
|
|
47
|
+
*/
|
|
48
|
+
private _adoptStyles;
|
|
49
|
+
protected updated(changed: PropertyValues): void;
|
|
50
|
+
private _ensureForm;
|
|
51
|
+
/** The wrapped native form element. */
|
|
52
|
+
get form(): HTMLFormElement | null;
|
|
53
|
+
/**
|
|
54
|
+
* Every form-associated Cre8 control owned by this form, in document order.
|
|
55
|
+
* Reaches through layout components because slotting does not move nodes
|
|
56
|
+
* out of the light-DOM tree.
|
|
57
|
+
*/
|
|
58
|
+
get controls(): Cre8FormElement[];
|
|
59
|
+
/** The form's current values, derived from FormData. */
|
|
60
|
+
get values(): Record<string, FormDataEntryValue | FormDataEntryValue[]>;
|
|
61
|
+
private _onSubmit;
|
|
62
|
+
private _onReset;
|
|
63
|
+
/** Submits the form, running aggregate validation unless `novalidate`. */
|
|
64
|
+
submit(): void;
|
|
65
|
+
/** Resets the form to its default values. */
|
|
66
|
+
reset(): void;
|
|
67
|
+
/** True when every control is valid. Does not change error state. */
|
|
68
|
+
checkValidity(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Like `checkValidity`, but flags errors and focuses the first invalid
|
|
71
|
+
* control.
|
|
72
|
+
*/
|
|
73
|
+
reportValidity(): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Checks every control, reflects the result onto their `isError` state,
|
|
76
|
+
* focuses the first invalid one, and emits `form-invalid`.
|
|
77
|
+
* Returns true when the form is valid.
|
|
78
|
+
*/
|
|
79
|
+
private _validate;
|
|
80
|
+
}
|
|
81
|
+
declare global {
|
|
82
|
+
interface HTMLElementTagNameMap {
|
|
83
|
+
'cre8-form': Cre8Form;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export default Cre8Form;
|
|
87
|
+
//# sourceMappingURL=form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../components/form/form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,QAAS,SAAQ,WAAW;IACrC;;OAEG;IAEC,UAAU,CAAC,EAAE,OAAO,CAAC;IAEzB;;OAEG;IAEC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEvB,OAAO,CAAC,KAAK,CAAgC;IAE7C,oEAAoE;IACpE,gBAAgB;IAIhB;;;;OAIG;IACH,MAAM;IAIN,iBAAiB;IAMjB;;;;;;;;OAQG;IACH,OAAO,CAAC,YAAY;IAoBpB,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,cAAc;IASzC,OAAO,CAAC,WAAW;IAsBnB,uCAAuC;IACvC,IAAI,IAAI,IAAI,eAAe,GAAG,IAAI,CAEjC;IAED;;;;OAIG;IACH,IAAI,QAAQ,IAAI,eAAe,EAAE,CAOhC;IAED,wDAAwD;IACxD,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,EAAE,CAAC,CAgBtE;IAED,OAAO,CAAC,SAAS,CAmBf;IAEF,OAAO,CAAC,QAAQ,CAOd;IAEF,0EAA0E;IAC1E,MAAM;IAIN,6CAA6C;IAC7C,KAAK;IAIL,qEAAqE;IACrE,aAAa,IAAI,OAAO;IAIxB;;;OAGG;IACH,cAAc,IAAI,OAAO;IAIzB;;;;OAIG;IACH,OAAO,CAAC,SAAS;CAsBpB;AAMD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,209 @@
|
|
|
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
|
+
};
|
|
7
|
+
import { html } from 'lit';
|
|
8
|
+
import { property } from 'lit/decorators.js';
|
|
9
|
+
import { Cre8Element } from '../cre8-element';
|
|
10
|
+
import styles from './form.styles';
|
|
11
|
+
/**
|
|
12
|
+
* The form component groups form-associated Cre8 controls, aggregates their
|
|
13
|
+
* validation on submit, and orchestrates submit and reset.
|
|
14
|
+
*
|
|
15
|
+
* # How to Use
|
|
16
|
+
* 1. Place any Cre8 form controls inside `cre8-form`. They may be nested inside
|
|
17
|
+
* layout components such as `cre8-grid` or `cre8-layout`.
|
|
18
|
+
* 2. Add a `cre8-button` with `type="submit"` to submit the form.
|
|
19
|
+
* 3. Listen for `form-submit` to receive the collected `FormData`.
|
|
20
|
+
*
|
|
21
|
+
* Note: this component renders to light DOM. A form-associated control's form
|
|
22
|
+
* owner is the nearest `<form>` in its own node tree, so a shadow-DOM `<form>`
|
|
23
|
+
* would own nothing and `new FormData(form)` would come back empty.
|
|
24
|
+
*
|
|
25
|
+
* @slot The form's controls and layout.
|
|
26
|
+
*/
|
|
27
|
+
export class Cre8Form extends Cre8Element {
|
|
28
|
+
constructor() {
|
|
29
|
+
super(...arguments);
|
|
30
|
+
this._form = null;
|
|
31
|
+
this._onSubmit = (event) => {
|
|
32
|
+
// This component never performs a native navigation.
|
|
33
|
+
event.preventDefault();
|
|
34
|
+
if (!this.novalidate && !this._validate()) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
this.dispatchEvent(new CustomEvent('form-submit', {
|
|
38
|
+
detail: {
|
|
39
|
+
data: new FormData(this._form),
|
|
40
|
+
values: this.values,
|
|
41
|
+
form: this._form,
|
|
42
|
+
},
|
|
43
|
+
bubbles: true,
|
|
44
|
+
composed: true,
|
|
45
|
+
}));
|
|
46
|
+
};
|
|
47
|
+
this._onReset = () => {
|
|
48
|
+
this.controls.forEach((control) => {
|
|
49
|
+
control.isError = false;
|
|
50
|
+
});
|
|
51
|
+
this.dispatchEvent(new CustomEvent('form-reset', { bubbles: true, composed: true }));
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/** Renders to light DOM so child controls are owned by the form. */
|
|
55
|
+
createRenderRoot() {
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Renders nothing. The `<form>` and the author's controls are managed
|
|
60
|
+
* imperatively in `_ensureForm` so that Lit never owns, and therefore never
|
|
61
|
+
* clears, the light-DOM children.
|
|
62
|
+
*/
|
|
63
|
+
render() {
|
|
64
|
+
return html ``;
|
|
65
|
+
}
|
|
66
|
+
connectedCallback() {
|
|
67
|
+
super.connectedCallback();
|
|
68
|
+
this._ensureForm();
|
|
69
|
+
this._adoptStyles();
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Installs the component's stylesheet into its root node.
|
|
73
|
+
*
|
|
74
|
+
* Light-DOM components have no shadow root, so Lit never attaches
|
|
75
|
+
* `static styles`. The sheet is instead adopted by the document (or the
|
|
76
|
+
* enclosing shadow root, when the form is composed inside one) exactly
|
|
77
|
+
* once per root. Falls back to appending a `<style>` element where
|
|
78
|
+
* constructable stylesheets are unavailable (e.g. jsdom).
|
|
79
|
+
*/
|
|
80
|
+
_adoptStyles() {
|
|
81
|
+
const root = this.getRootNode();
|
|
82
|
+
const sheet = styles.styleSheet;
|
|
83
|
+
if (sheet && 'adoptedStyleSheets' in root) {
|
|
84
|
+
if (!root.adoptedStyleSheets.includes(sheet)) {
|
|
85
|
+
root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
|
|
86
|
+
}
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const target = root instanceof Document ? root.head : root;
|
|
90
|
+
if (!target.querySelector('style[data-cre8-form]')) {
|
|
91
|
+
const styleEl = document.createElement('style');
|
|
92
|
+
styleEl.setAttribute('data-cre8-form', '');
|
|
93
|
+
styleEl.textContent = styles.cssText;
|
|
94
|
+
target.appendChild(styleEl);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
updated(changed) {
|
|
98
|
+
super.updated(changed);
|
|
99
|
+
if (changed.has('disabled')) {
|
|
100
|
+
this.controls.forEach((control) => {
|
|
101
|
+
control.disabled = this.disabled;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
_ensureForm() {
|
|
106
|
+
if (this._form?.isConnected) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const form = document.createElement('form');
|
|
110
|
+
form.className = 'cre8-c-form';
|
|
111
|
+
// We own the validation UX. Without this the browser blocks submission
|
|
112
|
+
// on invalid controls and our submit handler never runs.
|
|
113
|
+
form.noValidate = true;
|
|
114
|
+
while (this.firstChild) {
|
|
115
|
+
form.appendChild(this.firstChild);
|
|
116
|
+
}
|
|
117
|
+
this.appendChild(form);
|
|
118
|
+
this._form = form;
|
|
119
|
+
form.addEventListener('submit', this._onSubmit);
|
|
120
|
+
form.addEventListener('reset', this._onReset);
|
|
121
|
+
}
|
|
122
|
+
/** The wrapped native form element. */
|
|
123
|
+
get form() {
|
|
124
|
+
return this._form;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Every form-associated Cre8 control owned by this form, in document order.
|
|
128
|
+
* Reaches through layout components because slotting does not move nodes
|
|
129
|
+
* out of the light-DOM tree.
|
|
130
|
+
*/
|
|
131
|
+
get controls() {
|
|
132
|
+
if (!this._form) {
|
|
133
|
+
return [];
|
|
134
|
+
}
|
|
135
|
+
return Array.from(this.querySelectorAll('*')).filter((el) => el._internals?.form === this._form);
|
|
136
|
+
}
|
|
137
|
+
/** The form's current values, derived from FormData. */
|
|
138
|
+
get values() {
|
|
139
|
+
const out = {};
|
|
140
|
+
if (!this._form) {
|
|
141
|
+
return out;
|
|
142
|
+
}
|
|
143
|
+
for (const [key, value] of new FormData(this._form).entries()) {
|
|
144
|
+
const existing = out[key];
|
|
145
|
+
if (existing === undefined) {
|
|
146
|
+
out[key] = value;
|
|
147
|
+
}
|
|
148
|
+
else if (Array.isArray(existing)) {
|
|
149
|
+
existing.push(value);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
out[key] = [existing, value];
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return out;
|
|
156
|
+
}
|
|
157
|
+
/** Submits the form, running aggregate validation unless `novalidate`. */
|
|
158
|
+
submit() {
|
|
159
|
+
this._form?.requestSubmit();
|
|
160
|
+
}
|
|
161
|
+
/** Resets the form to its default values. */
|
|
162
|
+
reset() {
|
|
163
|
+
this._form?.reset();
|
|
164
|
+
}
|
|
165
|
+
/** True when every control is valid. Does not change error state. */
|
|
166
|
+
checkValidity() {
|
|
167
|
+
return this.controls.every((control) => control.checkValidity());
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Like `checkValidity`, but flags errors and focuses the first invalid
|
|
171
|
+
* control.
|
|
172
|
+
*/
|
|
173
|
+
reportValidity() {
|
|
174
|
+
return this._validate();
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Checks every control, reflects the result onto their `isError` state,
|
|
178
|
+
* focuses the first invalid one, and emits `form-invalid`.
|
|
179
|
+
* Returns true when the form is valid.
|
|
180
|
+
*/
|
|
181
|
+
_validate() {
|
|
182
|
+
const controls = this.controls;
|
|
183
|
+
const invalid = controls.filter((control) => !control.checkValidity());
|
|
184
|
+
controls.forEach((control) => {
|
|
185
|
+
control.isError = invalid.includes(control);
|
|
186
|
+
});
|
|
187
|
+
if (invalid.length === 0) {
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
invalid[0].focus?.();
|
|
191
|
+
this.dispatchEvent(new CustomEvent('form-invalid', {
|
|
192
|
+
detail: { invalidControls: invalid },
|
|
193
|
+
bubbles: true,
|
|
194
|
+
composed: true,
|
|
195
|
+
}));
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
__decorate([
|
|
200
|
+
property({ type: Boolean, reflect: true })
|
|
201
|
+
], Cre8Form.prototype, "novalidate", void 0);
|
|
202
|
+
__decorate([
|
|
203
|
+
property({ type: Boolean, reflect: true })
|
|
204
|
+
], Cre8Form.prototype, "disabled", void 0);
|
|
205
|
+
if (customElements.get('cre8-form') === undefined) {
|
|
206
|
+
customElements.define('cre8-form', Cre8Form);
|
|
207
|
+
}
|
|
208
|
+
export default Cre8Form;
|
|
209
|
+
//# sourceMappingURL=form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.js","sourceRoot":"","sources":["../../../components/form/form.ts"],"names":[],"mappings":"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","sourcesContent":["import { html, type PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { Cre8Element } from '../cre8-element';\nimport type { Cre8FormElement } from '../cre8-form-element';\nimport styles from './form.styles';\n\n/**\n * The form component groups form-associated Cre8 controls, aggregates their\n * validation on submit, and orchestrates submit and reset.\n *\n * # How to Use\n * 1. Place any Cre8 form controls inside `cre8-form`. They may be nested inside\n * layout components such as `cre8-grid` or `cre8-layout`.\n * 2. Add a `cre8-button` with `type=\"submit\"` to submit the form.\n * 3. Listen for `form-submit` to receive the collected `FormData`.\n *\n * Note: this component renders to light DOM. A form-associated control's form\n * owner is the nearest `<form>` in its own node tree, so a shadow-DOM `<form>`\n * would own nothing and `new FormData(form)` would come back empty.\n *\n * @slot The form's controls and layout.\n */\nexport class Cre8Form extends Cre8Element {\n /**\n * Skips aggregate validation on submit.\n */\n @property({ type: Boolean, reflect: true })\n novalidate?: boolean;\n\n /**\n * Disables every control in the form, for example while submitting.\n */\n @property({ type: Boolean, reflect: true })\n disabled?: boolean;\n\n private _form: HTMLFormElement | null = null;\n\n /** Renders to light DOM so child controls are owned by the form. */\n createRenderRoot() {\n return this;\n }\n\n /**\n * Renders nothing. The `<form>` and the author's controls are managed\n * imperatively in `_ensureForm` so that Lit never owns, and therefore never\n * clears, the light-DOM children.\n */\n render() {\n return html``;\n }\n\n connectedCallback() {\n super.connectedCallback();\n this._ensureForm();\n this._adoptStyles();\n }\n\n /**\n * Installs the component's stylesheet into its root node.\n *\n * Light-DOM components have no shadow root, so Lit never attaches\n * `static styles`. The sheet is instead adopted by the document (or the\n * enclosing shadow root, when the form is composed inside one) exactly\n * once per root. Falls back to appending a `<style>` element where\n * constructable stylesheets are unavailable (e.g. jsdom).\n */\n private _adoptStyles() {\n const root = this.getRootNode() as Document | ShadowRoot;\n const sheet = styles.styleSheet;\n\n if (sheet && 'adoptedStyleSheets' in root) {\n if (!root.adoptedStyleSheets.includes(sheet)) {\n root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];\n }\n return;\n }\n\n const target = root instanceof Document ? root.head : root;\n if (!target.querySelector('style[data-cre8-form]')) {\n const styleEl = document.createElement('style');\n styleEl.setAttribute('data-cre8-form', '');\n styleEl.textContent = styles.cssText;\n target.appendChild(styleEl);\n }\n }\n\n protected updated(changed: PropertyValues) {\n super.updated(changed);\n if (changed.has('disabled')) {\n this.controls.forEach((control) => {\n control.disabled = this.disabled;\n });\n }\n }\n\n private _ensureForm() {\n if (this._form?.isConnected) {\n return;\n }\n\n const form = document.createElement('form');\n form.className = 'cre8-c-form';\n // We own the validation UX. Without this the browser blocks submission\n // on invalid controls and our submit handler never runs.\n form.noValidate = true;\n\n while (this.firstChild) {\n form.appendChild(this.firstChild);\n }\n\n this.appendChild(form);\n this._form = form;\n\n form.addEventListener('submit', this._onSubmit);\n form.addEventListener('reset', this._onReset);\n }\n\n /** The wrapped native form element. */\n get form(): HTMLFormElement | null {\n return this._form;\n }\n\n /**\n * Every form-associated Cre8 control owned by this form, in document order.\n * Reaches through layout components because slotting does not move nodes\n * out of the light-DOM tree.\n */\n get controls(): Cre8FormElement[] {\n if (!this._form) {\n return [];\n }\n return Array.from(this.querySelectorAll<HTMLElement>('*')).filter(\n (el) => (el as unknown as Cre8FormElement)._internals?.form === this._form\n ) as unknown as Cre8FormElement[];\n }\n\n /** The form's current values, derived from FormData. */\n get values(): Record<string, FormDataEntryValue | FormDataEntryValue[]> {\n const out: Record<string, FormDataEntryValue | FormDataEntryValue[]> = {};\n if (!this._form) {\n return out;\n }\n for (const [key, value] of new FormData(this._form).entries()) {\n const existing = out[key];\n if (existing === undefined) {\n out[key] = value;\n } else if (Array.isArray(existing)) {\n existing.push(value);\n } else {\n out[key] = [existing, value];\n }\n }\n return out;\n }\n\n private _onSubmit = (event: Event) => {\n // This component never performs a native navigation.\n event.preventDefault();\n\n if (!this.novalidate && !this._validate()) {\n return;\n }\n\n this.dispatchEvent(\n new CustomEvent('form-submit', {\n detail: {\n data: new FormData(this._form!),\n values: this.values,\n form: this._form,\n },\n bubbles: true,\n composed: true,\n })\n );\n };\n\n private _onReset = () => {\n this.controls.forEach((control) => {\n control.isError = false;\n });\n this.dispatchEvent(\n new CustomEvent('form-reset', { bubbles: true, composed: true })\n );\n };\n\n /** Submits the form, running aggregate validation unless `novalidate`. */\n submit() {\n this._form?.requestSubmit();\n }\n\n /** Resets the form to its default values. */\n reset() {\n this._form?.reset();\n }\n\n /** True when every control is valid. Does not change error state. */\n checkValidity(): boolean {\n return this.controls.every((control) => control.checkValidity());\n }\n\n /**\n * Like `checkValidity`, but flags errors and focuses the first invalid\n * control.\n */\n reportValidity(): boolean {\n return this._validate();\n }\n\n /**\n * Checks every control, reflects the result onto their `isError` state,\n * focuses the first invalid one, and emits `form-invalid`.\n * Returns true when the form is valid.\n */\n private _validate(): boolean {\n const controls = this.controls;\n const invalid = controls.filter((control) => !control.checkValidity());\n\n controls.forEach((control) => {\n control.isError = invalid.includes(control);\n });\n\n if (invalid.length === 0) {\n return true;\n }\n\n (invalid[0] as unknown as HTMLElement).focus?.();\n this.dispatchEvent(\n new CustomEvent('form-invalid', {\n detail: { invalidControls: invalid },\n bubbles: true,\n composed: true,\n })\n );\n return false;\n }\n}\n\nif (customElements.get('cre8-form') === undefined) {\n customElements.define('cre8-form', Cre8Form);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cre8-form': Cre8Form;\n }\n}\n\nexport default Cre8Form;\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Document-level styles for the light-DOM `cre8-form` component.
|
|
3
|
+
*
|
|
4
|
+
* Hand-authored rather than generated from a `.module.scss`: the SCSS
|
|
5
|
+
* pipeline prepends global theming boilerplate (body and utility rules)
|
|
6
|
+
* that is inert inside a shadow root but must never be adopted into the
|
|
7
|
+
* host document. Every selector here is scoped under `cre8-form`.
|
|
8
|
+
*
|
|
9
|
+
* `--cre8-form-gap` is the themeable knob for vertical rhythm between
|
|
10
|
+
* rows; it defaults to the 24px step of the spacing scale.
|
|
11
|
+
*/
|
|
12
|
+
declare const styles: import("lit").CSSResult;
|
|
13
|
+
export default styles;
|
|
14
|
+
//# sourceMappingURL=form.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.styles.d.ts","sourceRoot":"","sources":["../../../components/form/form.styles.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,QAAA,MAAM,MAAM,yBAgBX,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* Document-level styles for the light-DOM `cre8-form` component.
|
|
4
|
+
*
|
|
5
|
+
* Hand-authored rather than generated from a `.module.scss`: the SCSS
|
|
6
|
+
* pipeline prepends global theming boilerplate (body and utility rules)
|
|
7
|
+
* that is inert inside a shadow root but must never be adopted into the
|
|
8
|
+
* host document. Every selector here is scoped under `cre8-form`.
|
|
9
|
+
*
|
|
10
|
+
* `--cre8-form-gap` is the themeable knob for vertical rhythm between
|
|
11
|
+
* rows; it defaults to the 24px step of the spacing scale.
|
|
12
|
+
*/
|
|
13
|
+
const styles = css `
|
|
14
|
+
cre8-form {
|
|
15
|
+
display: block;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
cre8-form .cre8-c-form {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
align-items: stretch;
|
|
22
|
+
gap: var(--cre8-form-gap, 1.5rem);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
cre8-form .cre8-c-form > cre8-button,
|
|
26
|
+
cre8-form .cre8-c-form > cre8-button-group:not([fullwidth]) {
|
|
27
|
+
align-self: flex-start;
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
export default styles;
|
|
31
|
+
//# sourceMappingURL=form.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.styles.js","sourceRoot":"","sources":["../../../components/form/form.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;CAgBjB,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import { css } from 'lit';\n\n/**\n * Document-level styles for the light-DOM `cre8-form` component.\n *\n * Hand-authored rather than generated from a `.module.scss`: the SCSS\n * pipeline prepends global theming boilerplate (body and utility rules)\n * that is inert inside a shadow root but must never be adopted into the\n * host document. Every selector here is scoped under `cre8-form`.\n *\n * `--cre8-form-gap` is the themeable knob for vertical rhythm between\n * rows; it defaults to the 24px step of the spacing scale.\n */\nconst styles = css`\n cre8-form {\n display: block;\n }\n\n cre8-form .cre8-c-form {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n gap: var(--cre8-form-gap, 1.5rem);\n }\n\n cre8-form .cre8-c-form > cre8-button,\n cre8-form .cre8-c-form > cre8-button-group:not([fullwidth]) {\n align-self: flex-start;\n }\n`;\n\nexport default styles;\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { property as
|
|
1
|
+
import { property as u } from "lit/decorators.js";
|
|
2
2
|
import { Cre8Element as f } from "./components/cre8-element.js";
|
|
3
|
-
let
|
|
3
|
+
let v = class extends Event {
|
|
4
4
|
constructor(t, s, i, e) {
|
|
5
5
|
super("context-request", { bubbles: !0, composed: !0 }), this.context = t, this.contextTarget = s, this.callback = i, this.subscribe = e ?? !1;
|
|
6
6
|
}
|
|
7
7
|
};
|
|
8
|
-
class
|
|
8
|
+
class b {
|
|
9
9
|
get value() {
|
|
10
10
|
return this.o;
|
|
11
11
|
}
|
|
@@ -33,12 +33,12 @@ class v {
|
|
|
33
33
|
this.subscriptions.clear();
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
let
|
|
36
|
+
let m = class extends Event {
|
|
37
37
|
constructor(t, s) {
|
|
38
38
|
super("context-provider", { bubbles: !0, composed: !0 }), this.context = t, this.contextTarget = s;
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
-
class d extends
|
|
41
|
+
class d extends b {
|
|
42
42
|
constructor(t, s, i) {
|
|
43
43
|
super(s.context !== void 0 ? s.initialValue : i), this.onContextRequest = (e) => {
|
|
44
44
|
if (e.context !== this.context) return;
|
|
@@ -47,7 +47,7 @@ class d extends v {
|
|
|
47
47
|
}, this.onProviderRequest = (e) => {
|
|
48
48
|
if (e.context !== this.context || (e.contextTarget ?? e.composedPath()[0]) === this.host) return;
|
|
49
49
|
const a = /* @__PURE__ */ new Set();
|
|
50
|
-
for (const [r, { consumerHost: l }] of this.subscriptions) a.has(r) || (a.add(r), l.dispatchEvent(new
|
|
50
|
+
for (const [r, { consumerHost: l }] of this.subscriptions) a.has(r) || (a.add(r), l.dispatchEvent(new v(this.context, l, r, !0)));
|
|
51
51
|
e.stopPropagation();
|
|
52
52
|
}, this.host = t, s.context !== void 0 ? this.context = s.context : this.context = s, this.attachListeners(), this.host.addController?.(this);
|
|
53
53
|
}
|
|
@@ -55,7 +55,7 @@ class d extends v {
|
|
|
55
55
|
this.host.addEventListener("context-request", this.onContextRequest), this.host.addEventListener("context-provider", this.onProviderRequest);
|
|
56
56
|
}
|
|
57
57
|
hostConnected() {
|
|
58
|
-
this.host.dispatchEvent(new
|
|
58
|
+
this.host.dispatchEvent(new m(this.context, this.host));
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
function p({ context: n }) {
|
|
@@ -91,15 +91,15 @@ function p({ context: n }) {
|
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
-
const
|
|
95
|
-
var
|
|
96
|
-
for (var e = i > 1 ? void 0 : i ?
|
|
94
|
+
const y = /* @__PURE__ */ Symbol("cre8-form-internals"), x = /* @__PURE__ */ Symbol("cre8-form-state");
|
|
95
|
+
var g = Object.defineProperty, V = Object.getOwnPropertyDescriptor, h = (n, t, s, i) => {
|
|
96
|
+
for (var e = i > 1 ? void 0 : i ? V(t, s) : t, a = n.length - 1, r; a >= 0; a--)
|
|
97
97
|
(r = n[a]) && (e = (i ? r(t, s, e) : r(e)) || e);
|
|
98
|
-
return i && e &&
|
|
98
|
+
return i && e && g(t, s, e), e;
|
|
99
99
|
};
|
|
100
100
|
const c = class c extends f {
|
|
101
101
|
constructor() {
|
|
102
|
-
super(), this.internalValue = "", this.defaultValue = "", this._formState = {
|
|
102
|
+
super(), this.internalValue = "", this.hasCustomError = !1, this.defaultValue = "", this._formState = {
|
|
103
103
|
value: "",
|
|
104
104
|
disabled: !1,
|
|
105
105
|
required: !1,
|
|
@@ -141,6 +141,59 @@ const c = class c extends f {
|
|
|
141
141
|
updateField() {
|
|
142
142
|
this.field && this.internalValue !== void 0 && (this.field.value = this.internalValue ?? "");
|
|
143
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Moves focus to the underlying field.
|
|
146
|
+
*
|
|
147
|
+
* Custom elements are not focusable by default, so without this calling
|
|
148
|
+
* `focus()` on the host silently did nothing and focus stayed where it was.
|
|
149
|
+
* Anything that needs to move focus to a control - such as a form focusing
|
|
150
|
+
* its first invalid field - depends on this.
|
|
151
|
+
*/
|
|
152
|
+
focus(t) {
|
|
153
|
+
if (this.field) {
|
|
154
|
+
this.field.focus(t);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
super.focus(t);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Forwards the underlying field's constraint validity to ElementInternals.
|
|
161
|
+
*
|
|
162
|
+
* The inner field renders the constraint attributes (`required`, `pattern`,
|
|
163
|
+
* `min`, `max`, ...), so the browser already computes a correct
|
|
164
|
+
* ValidityState for it. Without this the host element's own
|
|
165
|
+
* `checkValidity()` always returned true and `required` was effectively
|
|
166
|
+
* ignored by any form containing it.
|
|
167
|
+
*
|
|
168
|
+
* A message set through `setCustomValidity` takes precedence and is left
|
|
169
|
+
* untouched.
|
|
170
|
+
*/
|
|
171
|
+
syncValidity() {
|
|
172
|
+
if (!this._internals || !this.field || this.hasCustomError)
|
|
173
|
+
return;
|
|
174
|
+
const t = this.field.validity;
|
|
175
|
+
if (t.valid) {
|
|
176
|
+
this._internals.setValidity({});
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
const s = {
|
|
180
|
+
badInput: t.badInput,
|
|
181
|
+
customError: t.customError,
|
|
182
|
+
patternMismatch: t.patternMismatch,
|
|
183
|
+
rangeOverflow: t.rangeOverflow,
|
|
184
|
+
rangeUnderflow: t.rangeUnderflow,
|
|
185
|
+
stepMismatch: t.stepMismatch,
|
|
186
|
+
tooLong: t.tooLong,
|
|
187
|
+
tooShort: t.tooShort,
|
|
188
|
+
typeMismatch: t.typeMismatch,
|
|
189
|
+
valueMissing: t.valueMissing
|
|
190
|
+
};
|
|
191
|
+
this._internals.setValidity(
|
|
192
|
+
s,
|
|
193
|
+
this.field.validationMessage || "This field is invalid.",
|
|
194
|
+
this.field
|
|
195
|
+
);
|
|
196
|
+
}
|
|
144
197
|
/**
|
|
145
198
|
* Lifecycle hook called after first render
|
|
146
199
|
*/
|
|
@@ -151,7 +204,7 @@ const c = class c extends f {
|
|
|
151
204
|
* Called when properties change
|
|
152
205
|
*/
|
|
153
206
|
updated(t) {
|
|
154
|
-
super.updated(t), (t.has("disabled") || t.has("required") || t.has("isError") || t.has("isSuccess") || t.has("name")) && this.updateFormState();
|
|
207
|
+
super.updated(t), (t.has("disabled") || t.has("required") || t.has("isError") || t.has("isSuccess") || t.has("name")) && this.updateFormState(), this.syncValidity();
|
|
155
208
|
}
|
|
156
209
|
/**
|
|
157
210
|
* Form lifecycle callback - called when the form is reset
|
|
@@ -211,37 +264,37 @@ const c = class c extends f {
|
|
|
211
264
|
* Sets a custom validity message
|
|
212
265
|
*/
|
|
213
266
|
setCustomValidity(t) {
|
|
214
|
-
this._internals && this.field && (t ? this._internals.setValidity({ customError: !0 }, t, this.field) : this.
|
|
267
|
+
this._internals && this.field && (t ? (this.hasCustomError = !0, this._internals.setValidity({ customError: !0 }, t, this.field)) : (this.hasCustomError = !1, this.syncValidity()));
|
|
215
268
|
}
|
|
216
269
|
};
|
|
217
270
|
c.formAssociated = !0;
|
|
218
271
|
let o = c;
|
|
219
|
-
|
|
220
|
-
p({ context: m })
|
|
221
|
-
], o.prototype, "_internals", 2);
|
|
222
|
-
u([
|
|
272
|
+
h([
|
|
223
273
|
p({ context: y })
|
|
274
|
+
], o.prototype, "_internals", 2);
|
|
275
|
+
h([
|
|
276
|
+
p({ context: x })
|
|
224
277
|
], o.prototype, "_formState", 2);
|
|
225
|
-
|
|
226
|
-
|
|
278
|
+
h([
|
|
279
|
+
u()
|
|
227
280
|
], o.prototype, "name", 2);
|
|
228
|
-
|
|
229
|
-
|
|
281
|
+
h([
|
|
282
|
+
u({ type: Boolean, reflect: !0 })
|
|
230
283
|
], o.prototype, "disabled", 2);
|
|
231
|
-
|
|
232
|
-
|
|
284
|
+
h([
|
|
285
|
+
u({ type: Boolean, reflect: !0 })
|
|
233
286
|
], o.prototype, "required", 2);
|
|
234
|
-
|
|
235
|
-
|
|
287
|
+
h([
|
|
288
|
+
u({ type: Boolean, reflect: !0 })
|
|
236
289
|
], o.prototype, "isError", 2);
|
|
237
|
-
|
|
238
|
-
|
|
290
|
+
h([
|
|
291
|
+
u({ type: Boolean, reflect: !0 })
|
|
239
292
|
], o.prototype, "isSuccess", 2);
|
|
240
|
-
|
|
241
|
-
|
|
293
|
+
h([
|
|
294
|
+
u()
|
|
242
295
|
], o.prototype, "value", 1);
|
|
243
296
|
export {
|
|
244
297
|
o as C,
|
|
245
|
-
|
|
246
|
-
|
|
298
|
+
y as f,
|
|
299
|
+
v as s
|
|
247
300
|
};
|