@pine-ds/core 3.5.1 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/mock-pds-modal.js +9 -4
- package/components/mock-pds-modal.js.map +1 -1
- package/components/pds-box2.js +164 -4
- package/components/pds-box2.js.map +1 -1
- package/components/pds-button2.js +51 -2
- package/components/pds-button2.js.map +1 -1
- package/components/pds-modal-content.js +128 -11
- package/components/pds-modal-content.js.map +1 -1
- package/components/pds-modal.js +13 -3
- package/components/pds-modal.js.map +1 -1
- package/components/pds-row.js +8 -2
- package/components/pds-row.js.map +1 -1
- package/components/pds-textarea.js +111 -7
- package/components/pds-textarea.js.map +1 -1
- package/components/pds-toast.js +3 -3
- package/components/pds-tooltip.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mock-pds-modal.cjs.entry.js +8 -4
- package/dist/cjs/mock-pds-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/mock-pds-modal.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-box.cjs.entry.js +82 -2
- package/dist/cjs/pds-box.cjs.entry.js.map +1 -1
- package/dist/cjs/pds-box.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-button.cjs.entry.js +50 -1
- package/dist/cjs/pds-button.cjs.entry.js.map +1 -1
- package/dist/cjs/pds-button.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-modal-content.cjs.entry.js +128 -11
- package/dist/cjs/pds-modal-content.cjs.entry.js.map +1 -1
- package/dist/cjs/pds-modal-content.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-modal.cjs.entry.js +12 -3
- package/dist/cjs/pds-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/pds-modal.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-row.cjs.entry.js +6 -2
- package/dist/cjs/pds-row.cjs.entry.js.map +1 -1
- package/dist/cjs/pds-row.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-textarea.cjs.entry.js +108 -6
- package/dist/cjs/pds-textarea.cjs.entry.js.map +1 -1
- package/dist/cjs/pds-textarea.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-toast.cjs.entry.js +3 -3
- package/dist/cjs/pds-tooltip.cjs.entry.js +2 -2
- package/dist/cjs/pine-core.cjs.js +1 -1
- package/dist/collection/components/pds-box/pds-box.css +1607 -3
- package/dist/collection/components/pds-box/pds-box.js +2222 -127
- package/dist/collection/components/pds-box/pds-box.js.map +1 -1
- package/dist/collection/components/pds-button/pds-button.js +59 -1
- package/dist/collection/components/pds-button/pds-button.js.map +1 -1
- package/dist/collection/components/pds-modal/pds-modal-content/pds-modal-content.css +4 -6
- package/dist/collection/components/pds-modal/pds-modal-content/pds-modal-content.js +128 -11
- package/dist/collection/components/pds-modal/pds-modal-content/pds-modal-content.js.map +1 -1
- package/dist/collection/components/pds-modal/pds-modal.css +42 -1
- package/dist/collection/components/pds-modal/pds-modal.js +34 -2
- package/dist/collection/components/pds-modal/pds-modal.js.map +1 -1
- package/dist/collection/components/pds-modal/stories/pds-modal.stories.js +245 -0
- package/dist/collection/components/pds-modal/test/mock-pds-modal.js +30 -3
- package/dist/collection/components/pds-modal/test/mock-pds-modal.js.map +1 -1
- package/dist/collection/components/pds-row/pds-row.js +56 -2
- package/dist/collection/components/pds-row/pds-row.js.map +1 -1
- package/dist/collection/components/pds-textarea/pds-textarea.css +51 -11
- package/dist/collection/components/pds-textarea/pds-textarea.js +127 -4
- package/dist/collection/components/pds-textarea/pds-textarea.js.map +1 -1
- package/dist/collection/components/pds-textarea/stories/pds-textarea.stories.js +13 -0
- package/dist/collection/components/pds-toast/pds-toast.js +3 -3
- package/dist/collection/components/pds-tooltip/pds-tooltip.js +2 -2
- package/dist/docs.json +4845 -447
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mock-pds-modal.entry.js +8 -4
- package/dist/esm/mock-pds-modal.entry.js.map +1 -1
- package/dist/esm/pds-box.entry.js +82 -2
- package/dist/esm/pds-box.entry.js.map +1 -1
- package/dist/esm/pds-button.entry.js +50 -1
- package/dist/esm/pds-button.entry.js.map +1 -1
- package/dist/esm/pds-modal-content.entry.js +128 -11
- package/dist/esm/pds-modal-content.entry.js.map +1 -1
- package/dist/esm/pds-modal.entry.js +12 -3
- package/dist/esm/pds-modal.entry.js.map +1 -1
- package/dist/esm/pds-row.entry.js +6 -2
- package/dist/esm/pds-row.entry.js.map +1 -1
- package/dist/esm/pds-textarea.entry.js +108 -6
- package/dist/esm/pds-textarea.entry.js.map +1 -1
- package/dist/esm/pds-toast.entry.js +3 -3
- package/dist/esm/pds-tooltip.entry.js +2 -2
- package/dist/esm/pine-core.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mock-pds-modal.entry.js +1 -1
- package/dist/esm-es5/mock-pds-modal.entry.js.map +1 -1
- package/dist/esm-es5/pds-box.entry.js +1 -1
- package/dist/esm-es5/pds-box.entry.js.map +1 -1
- package/dist/esm-es5/pds-button.entry.js +1 -1
- package/dist/esm-es5/pds-button.entry.js.map +1 -1
- package/dist/esm-es5/pds-modal-content.entry.js +1 -1
- package/dist/esm-es5/pds-modal-content.entry.js.map +1 -1
- package/dist/esm-es5/pds-modal.entry.js +1 -1
- package/dist/esm-es5/pds-modal.entry.js.map +1 -1
- package/dist/esm-es5/pds-row.entry.js +1 -1
- package/dist/esm-es5/pds-row.entry.js.map +1 -1
- package/dist/esm-es5/pds-textarea.entry.js +1 -1
- package/dist/esm-es5/pds-textarea.entry.js.map +1 -1
- package/dist/esm-es5/pds-toast.entry.js +1 -1
- package/dist/esm-es5/pds-tooltip.entry.js +1 -1
- package/dist/esm-es5/pine-core.js +1 -1
- package/dist/pine-core/mock-pds-modal.entry.esm.js.map +1 -1
- package/dist/pine-core/p-318fd0cf.entry.js +2 -0
- package/dist/pine-core/p-318fd0cf.entry.js.map +1 -0
- package/dist/pine-core/{p-c4d6fe50.system.entry.js → p-346561a6.system.entry.js} +2 -2
- package/dist/pine-core/p-346561a6.system.entry.js.map +1 -0
- package/dist/pine-core/p-3gYSFJIn.system.js.map +1 -0
- package/dist/pine-core/{p-IG5YumI3.system.js.map → p-3pEJO0vO.system.js.map} +1 -1
- package/dist/pine-core/p-41d1b164.entry.js +2 -0
- package/dist/pine-core/p-41d1b164.entry.js.map +1 -0
- package/dist/pine-core/{p-02326ac3.entry.js → p-4c81420c.entry.js} +2 -2
- package/dist/pine-core/p-52cb152b.system.entry.js +2 -0
- package/dist/pine-core/p-52cb152b.system.entry.js.map +1 -0
- package/dist/pine-core/p-540cfd70.entry.js +2 -0
- package/dist/pine-core/p-540cfd70.entry.js.map +1 -0
- package/dist/pine-core/{p-11d4036e.entry.js → p-5f5b19f4.entry.js} +2 -2
- package/dist/pine-core/p-6d4d4705.system.entry.js +2 -0
- package/dist/pine-core/p-6d4d4705.system.entry.js.map +1 -0
- package/dist/pine-core/{p-68b5665a.entry.js → p-84949a12.entry.js} +2 -2
- package/dist/pine-core/p-84949a12.entry.js.map +1 -0
- package/dist/pine-core/{p-7a95a90f.system.entry.js → p-8726c99d.system.entry.js} +2 -2
- package/dist/pine-core/{p-2kXtbFXu.system.js.map → p-BZoPY2dP.system.js.map} +1 -1
- package/dist/pine-core/p-C0zqu7Gr.system.js.map +1 -0
- package/dist/pine-core/p-CHJgq_z7.system.js.map +1 -0
- package/dist/pine-core/p-Co5XZmTN.system.js.map +1 -0
- package/dist/pine-core/p-Czoq9yJM.system.js.map +1 -0
- package/dist/pine-core/p-De9tROL-.system.js +1 -1
- package/dist/pine-core/p-EYhpJx2s.system.js.map +1 -0
- package/dist/pine-core/p-WkrM7Vv0.system.js.map +1 -0
- package/dist/pine-core/p-a9895385.system.entry.js +2 -0
- package/dist/pine-core/p-a9895385.system.entry.js.map +1 -0
- package/dist/pine-core/{p-5aed29fe.system.entry.js → p-b2b1b7a9.system.entry.js} +2 -2
- package/dist/pine-core/p-b2b1b7a9.system.entry.js.map +1 -0
- package/dist/pine-core/p-c0df3222.entry.js +2 -0
- package/dist/pine-core/p-c0df3222.entry.js.map +1 -0
- package/dist/pine-core/{p-884b9ae6.system.entry.js → p-d8d8fe07.system.entry.js} +2 -2
- package/dist/pine-core/p-dc19ce6c.system.entry.js +2 -0
- package/dist/pine-core/p-dc19ce6c.system.entry.js.map +1 -0
- package/dist/pine-core/p-e08f492a.entry.js +2 -0
- package/dist/pine-core/p-e08f492a.entry.js.map +1 -0
- package/dist/pine-core/{p-79e2782b.entry.js → p-ecb9edf8.entry.js} +2 -2
- package/dist/pine-core/p-ecb9edf8.entry.js.map +1 -0
- package/dist/pine-core/p-fcb39155.system.entry.js +2 -0
- package/dist/pine-core/p-fcb39155.system.entry.js.map +1 -0
- package/dist/pine-core/pds-box.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-button.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-modal-content.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-modal.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-row.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-textarea.entry.esm.js.map +1 -1
- package/dist/pine-core/pine-core.esm.js +1 -1
- package/dist/types/components/pds-box/pds-box.d.ts +393 -3
- package/dist/types/components/pds-button/pds-button.d.ts +4 -0
- package/dist/types/components/pds-modal/pds-modal-content/pds-modal-content.d.ts +18 -1
- package/dist/types/components/pds-modal/pds-modal.d.ts +5 -0
- package/dist/types/components/pds-modal/test/mock-pds-modal.d.ts +5 -0
- package/dist/types/components/pds-row/pds-row.d.ts +8 -0
- package/dist/types/components/pds-textarea/pds-textarea.d.ts +20 -0
- package/dist/types/components.d.ts +822 -8
- package/hydrate/index.js +489 -39
- package/hydrate/index.mjs +489 -39
- package/package.json +2 -2
- package/dist/pine-core/p-0485aa93.system.entry.js +0 -2
- package/dist/pine-core/p-0485aa93.system.entry.js.map +0 -1
- package/dist/pine-core/p-0d9e28a2.entry.js +0 -2
- package/dist/pine-core/p-0d9e28a2.entry.js.map +0 -1
- package/dist/pine-core/p-2186e5d4.system.entry.js +0 -2
- package/dist/pine-core/p-2186e5d4.system.entry.js.map +0 -1
- package/dist/pine-core/p-48b658fc.system.entry.js +0 -2
- package/dist/pine-core/p-48b658fc.system.entry.js.map +0 -1
- package/dist/pine-core/p-5aed29fe.system.entry.js.map +0 -1
- package/dist/pine-core/p-68b5665a.entry.js.map +0 -1
- package/dist/pine-core/p-79e2782b.entry.js.map +0 -1
- package/dist/pine-core/p-96a89cd5.system.entry.js +0 -2
- package/dist/pine-core/p-96a89cd5.system.entry.js.map +0 -1
- package/dist/pine-core/p-BOHu_LEs.system.js.map +0 -1
- package/dist/pine-core/p-CD_nPb2F.system.js.map +0 -1
- package/dist/pine-core/p-DAwJ242E.system.js.map +0 -1
- package/dist/pine-core/p-DJekRkSL.system.js.map +0 -1
- package/dist/pine-core/p-DNYl_6t_.system.js.map +0 -1
- package/dist/pine-core/p-Dt10r3RZ.system.js.map +0 -1
- package/dist/pine-core/p-IIl2cTlj.system.js.map +0 -1
- package/dist/pine-core/p-a24c46e4.entry.js +0 -2
- package/dist/pine-core/p-a24c46e4.entry.js.map +0 -1
- package/dist/pine-core/p-c4d6fe50.system.entry.js.map +0 -1
- package/dist/pine-core/p-c6badcf8.entry.js +0 -2
- package/dist/pine-core/p-c6badcf8.entry.js.map +0 -1
- package/dist/pine-core/p-d714f68f.system.entry.js +0 -2
- package/dist/pine-core/p-d714f68f.system.entry.js.map +0 -1
- package/dist/pine-core/p-e5ca5b8e.entry.js +0 -2
- package/dist/pine-core/p-e5ca5b8e.entry.js.map +0 -1
- package/dist/pine-core/p-fb4058e6.entry.js +0 -2
- package/dist/pine-core/p-fb4058e6.entry.js.map +0 -1
- /package/dist/pine-core/{p-02326ac3.entry.js.map → p-4c81420c.entry.js.map} +0 -0
- /package/dist/pine-core/{p-11d4036e.entry.js.map → p-5f5b19f4.entry.js.map} +0 -0
- /package/dist/pine-core/{p-7a95a90f.system.entry.js.map → p-8726c99d.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-884b9ae6.system.ent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AC,gBAAgB,EAAE,CACpB,CACP;QAED,QACEA,OAAA,CAACE,UAAI,EAAA,EAAA,eAAA,EACY,IAAI,CAAC,QAAQ,GAAG,MAAM,GAAG,IAAI,EAC5C,EAAE,EAAE,IAAI,CAAC,WAAW,EACpB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,OAAO,EAAE,IAAI,CAAC,OAAO,EAAA,EAErBF,OAAC,CAAA,cAAc,oBAAK,UAAU,EAAE,GAC7B,OAAO,CACO,CACZ;;;;;;;;","names":["hasShadowDom","h","caretDown","Host"],"sources":["src/components/pds-button/pds-button.scss?tag=pds-button&encapsulation=shadow","src/components/pds-button/pds-button.tsx"],"sourcesContent":[":host {\n --pds-button-background: var(--color-background-default);\n --pds-button-border: var(--pine-border);\n --pds-button-border-radius: var(--pine-border-radius-full);\n --pds-button-border-radius-start-end: var(--pine-border-radius-full);\n --pds-button-border-radius-start-start: var(--pine-border-radius-full);\n --pds-button-border-radius-end-end: var(--pine-border-radius-full);\n --pds-button-border-radius-end-start: var(--pine-border-radius-full);\n --pds-button-min-height: var(--pine-dimension-450);\n --color-border-default: transparent;\n --color-border-disabled: transparent;\n --color-border-focus: transparent;\n --color-border-hover: transparent;\n --button-loader-color: var(--color-text-default);\n\n display: inline-flex;\n vertical-align: middle;\n}\n\n:host([full-width=\"true\"]) {\n display: flex;\n width: 100%;\n\n a,\n button {\n justify-content: center;\n width: 100%;\n }\n\n .pds-button__content {\n justify-content: center;\n text-align: center;\n }\n}\n\n:host([loading=\"true\"]) {\n cursor: wait;\n pointer-events: none;\n}\n\n:host([disabled=\"true\"]) {\n pointer-events: none;\n}\n\n.pds-button {\n --pds-loader-color: var(--color-text-default);\n align-items: center;\n background-color: var(--pds-button-background, var(--color-background-default));\n border: var(--pds-button-border);\n border-color: var(--color-border-default);\n border-end-end-radius: var(--pds-button-border-radius-end-end, var(--pds-button-border-radius));\n border-end-start-radius: var(--pds-button-border-radius-end-start, var(--pds-button-border-radius));\n border-radius: var(--pds-button-border-radius);\n border-start-end-radius: var(--pds-button-border-radius-start-end, var(--pds-button-border-radius));\n border-start-start-radius: var(--pds-button-border-radius-start-start, var(--pds-button-border-radius));\n box-sizing: border-box;\n color: var(--color-text-default);\n cursor: pointer;\n display: flex;\n font: var(--pine-typography-body-brand-label);\n letter-spacing: var(--pine-letter-spacing);\n min-height: var(--pds-button-min-height);\n padding: calc(var(--pine-dimension-xs) - var(--pine-border-width)) var(--pine-dimension-sm);\n position: relative;\n text-decoration: none;\n\n pds-icon {\n color: currentColor;\n fill: currentColor;\n }\n\n &:hover {\n background-color: var(--color-background-hover);\n border-color: var(--color-border-hover);\n }\n\n &:focus-visible {\n border-color: var(--color-border-focus);\n outline: var(--pine-outline-focus);\n outline-offset: var(--pine-border-width);\n }\n\n &:disabled {\n background-color: var(--color-background-disabled);\n border-color: var(--color-border-disabled);\n color: var(--color-text-disabled);\n pointer-events: none;\n }\n}\n\n.pds-button--primary {\n --color-background-default: var(--pine-color-primary);\n --color-background-hover: var(--pine-color-primary-hover);\n --color-background-disabled: var(--pine-color-primary-disabled);\n --color-border-default: var(--pine-color-primary);\n --color-border-hover: var(--pine-color-primary-hover);\n --color-text-default: var(--pine-color-text-primary);\n --color-text-disabled: var(--pine-color-text-primary-disabled);\n --color-outline: var(--pine-color-focus-ring);\n --button-loader-color: var(--pine-color-text-primary);\n}\n\n.pds-button--accent {\n --color-background-default: var(--pine-color-accent);\n --color-background-hover: var(--pine-color-accent-hover);\n --color-background-disabled: var(--pine-color-accent-disabled);\n --color-border-default: var(--pine-color-accent);\n --color-border-hover: var(--pine-color-accent-hover);\n --color-text-default: var(--pine-color-text-primary);\n --color-text-disabled: var(--pine-color-text-accent-disabled);\n --color-outline: var(--pine-color-focus-ring);\n --button-loader-color: var(--pine-color-text-primary);\n}\n\n.pds-button--destructive {\n --color-background-default: var(--pine-color-danger);\n --color-background-hover: var(--pine-color-danger-hover);\n --color-background-disabled: var(--pine-color-danger-disabled);\n --color-border-default: var(--pine-color-danger);\n --color-border-hover: var(--pine-color-danger-hover);\n --color-text-default: var(--pine-color-text-primary);\n --color-text-disabled: var(--pine-color-text-danger-disabled);\n --color-outline: var(--pine-color-focus-ring-danger);\n --button-loader-color: var(--pine-color-text-primary);\n\n &:focus-visible {\n outline-color: var(--pine-color-focus-ring-danger);\n }\n}\n\n.pds-button--secondary,\n.pds-button--disclosure {\n --color-background-default: var(--pine-color-secondary);\n --color-background-hover: var(--pine-color-secondary-hover);\n --color-background-disabled: var(--pine-color-secondary-disabled);\n --color-border-disabled: var(--pine-color-border-disabled);\n --color-border-focus: var(--pine-color-border);\n --color-border-hover: var(--pine-color-border-hover);\n --color-border-default: var(--pine-color-border);\n --color-text-default: var(--pine-color-text-secondary);\n --color-text-disabled: var(--pine-color-text-secondary-disabled);\n --color-outline: var(--pine-color-focus-ring);\n --button-loader-color: var(--pine-color-text-secondary);\n\n &:hover {\n background-color: var(--pine-color-secondary-hover);\n }\n}\n\n.pds-button--unstyled {\n --color-background-default: transparent;\n --color-background-hover: transparent;\n --color-background-disabled: transparent;\n --color-text-default: inherit;\n --button-loader-color: inherit;\n border-width: var(--pine-dimension-none);\n margin: var(--pine-dimension-none);\n min-height: auto;\n padding: var(--pine-dimension-none);\n width: inherit;\n}\n\n.pds-button__content {\n align-items: center;\n display: inline-flex;\n gap: var(--pine-dimension-xs);\n position: relative;\n width: 100%;\n}\n\n.pds-button__icon {\n display: inline-flex;\n}\n\n.pds-button__text {\n align-items: center;\n display: inline-flex;\n white-space: nowrap;\n}\n\n.pds-button__icon--hidden,\n.pds-button__text--hidden {\n opacity: 0;\n}\n\n.pds-button__loader {\n height: var(--pine-dimension-250);\n left: 50%;\n position: absolute;\n top: 50%;\n transform: translate(-50%, -50%);\n width: var(--pine-dimension-250);\n}\n\n.pds-button--loading {\n cursor: wait;\n pointer-events: none;\n\n .pds-button__loader {\n pds-loader {\n --loader-color: var(--button-loader-color);\n }\n }\n}\n\n.pds-button--icon-only {\n align-items: center;\n border-radius: var(--pine-border-radius-full);\n height: var(--button-dimension);\n justify-content: center;\n min-height: var(--button-dimension);\n min-width: var(--button-dimension);\n padding: var(--pine-dimension-xs);\n width: var(--button-dimension);\n\n .pds-button__content {\n height: 100%;\n justify-content: center;\n width: 100%;\n }\n\n .pds-button__text--hidden {\n border: 0;\n clip: rect(0 0 0 0);\n clip-path: polygon(0 0, 0 0, 0 0);\n height: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n }\n}\n","import { Component, Element, Event, EventEmitter, Host, h, Prop } from '@stencil/core';\nimport { hasShadowDom } from '../../utils/utils';\n\nimport { caretDown } from '@pine-ds/icons/icons';\n\n/**\n * @part button - Exposes the button element for styling.\n * @part button-content - Exposes the button content for styling.\n * @part button-text - Exposes the button text for styling.\n * @part caret - Exposes the caret icon component for styling. Appears only on the disclosure variant.\n * @part icon - Exposes the icon component for styling.\n * @part loader-svg - Exposes the loader SVG element for color customization. Appears only when loading.\n * @slot (default) - Button text.\n * @slot start - Content to display before the button text.\n * @slot end - Content to display after the button text.\n*/\n\n@Component({\n tag: 'pds-button',\n styleUrls: ['pds-button.scss'],\n shadow: true,\n})\nexport class PdsButton {\n @Element() el: HTMLPdsButtonElement;\n\n /**\n * A unique identifier used for the underlying component `id` attribute.\n */\n @Prop() componentId: string;\n\n /**\n * Determines the button's disabled state.\n * @defaultValue false\n */\n @Prop() disabled? = false;\n\n /**\n * Determines if the button should take up the full width of its container.\n * @defaultValue false\n */\n @Prop() fullWidth? = false;\n\n /**\n * If provided, renders the component as an anchor (`<a>`) element instead of a button.\n * When using href, button-specific props (type, name, value, loading) will be ignored.\n */\n @Prop() href?: string;\n\n /**\n * Displays a leading icon in the button. DEPRECATED.\n * @defaultValue null\n * @deprecated Use `start` slot instead.\n */\n @Prop() icon?: string = null;\n\n /**\n * When true, displays only the icon and visually hides the text (keeping it accessible).\n */\n @Prop() iconOnly? = false;\n\n /**\n * Determines if the button is in a loading state.\n * When true, displays a loader and hides the button text.\n * @defaultValue false\n */\n @Prop() loading? = false;\n\n /**\n * Provides the button with a submittable name.\n */\n @Prop() name?: string;\n\n /**\n * Specifies where to open the linked document when href is provided.\n * Only applies when href is set.\n */\n @Prop() target?: '_blank' | '_self' | '_parent' | '_top';\n\n /**\n * Provides button with a type.\n * @defaultValue button\n */\n @Prop() type?: 'button' | 'reset' | 'submit' = 'button';\n\n /**\n * Provides button with a submittable value\n */\n @Prop() value?: string;\n\n /**\n * Sets the style variant of the button.\n * @defaultValue primary\n */\n @Prop() variant: 'primary' | 'secondary' | 'accent' | 'disclosure' | 'destructive' | 'unstyled' = 'primary';\n\n @Event() pdsClick: EventEmitter;\n\n private handleClick = (ev: Event) => {\n if (this.loading) {\n ev.preventDefault();\n return;\n }\n\n if (!this.href && this.type != 'button') {\n // If button clicked IS NOT associated with a form\n if (hasShadowDom(this.el)) {\n const form = this.el.closest('form');\n if (form) {\n ev.preventDefault();\n\n const fakeButton = document.createElement('button');\n fakeButton.type = this.type;\n fakeButton.style.display = 'none';\n form.appendChild(fakeButton);\n fakeButton.click();\n fakeButton.remove();\n }\n }\n }\n this.pdsClick.emit(ev);\n };\n\n private classNames() {\n const classNames = ['pds-button'];\n\n if (this.variant) {\n classNames.push('pds-button--' + this.variant);\n }\n\n if (this.iconOnly) {\n classNames.push('pds-button--icon-only');\n }\n\n if (this.loading) {\n classNames.push('pds-button--loading');\n }\n\n return classNames.join(' ');\n }\n\n private hasSlotContent(slotName: string): boolean {\n const elements = this.el.querySelectorAll(`[slot=\"${slotName}\"]`);\n return elements.length > 0;\n }\n\n private renderStartContent() {\n const hasIcon = this.icon && this.variant !== 'disclosure';\n const hasStartSlot = this.hasSlotContent('start');\n\n if (Boolean(hasIcon)) {\n return (\n <pds-icon class={this.loading ? 'pds-button__icon--hidden' : ''} name={this.icon} part=\"icon\" aria-hidden=\"true\"></pds-icon>\n );\n } else if (Boolean(hasStartSlot)) {\n return <span class={`pds-button__icon ${this.loading ? 'pds-button__icon--hidden' : ''}`}><slot name=\"start\" /></span>;\n }\n\n return null;\n }\n\n private renderEndContent() {\n if (this.iconOnly) {\n return null;\n }\n\n if (this.variant === 'disclosure') {\n return (\n <pds-icon class={this.loading ? 'pds-button__icon--hidden' : ''} icon={caretDown} part=\"caret\" aria-hidden=\"true\"></pds-icon>\n );\n } else if (this.hasSlotContent('end')) {\n return <span class={`pds-button__icon ${this.loading ? 'pds-button__icon--hidden' : ''}`}><slot name=\"end\" /></span>;\n }\n\n return null;\n }\n\n render() {\n // Common props for both button and anchor elements\n const commonProps = {\n class: this.classNames(),\n part: 'button',\n };\n\n const attributes = () => {\n if (this.href) {\n return {\n // Anchor element props\n ...commonProps,\n href: this.disabled ? null : this.href,\n target: this.target,\n };\n }\n\n return {\n // Button element props\n ...commonProps,\n 'aria-busy': this.loading ? 'true' : null,\n 'aria-live': this.loading ? 'polite' : null,\n 'disabled': this.disabled,\n 'name': this.name,\n 'type': this.type,\n 'value': this.value,\n };\n };\n\n const ContentElement = this.href ? 'a' : 'button';\n\n // Hide text when loading or iconOnly is true\n const hideText = this.loading || this.iconOnly;\n\n const content = (\n <div class=\"pds-button__content\" part=\"button-content\">\n {this.renderStartContent()}\n\n <span class={`pds-button__text ${hideText ? 'pds-button__text--hidden' : ''}`} part=\"button-text\">\n <slot />\n </span>\n\n {this.loading && (\n <span class=\"pds-button__loader\">\n <pds-loader is-loading={true} size=\"var(--pine-font-size-body-2xl)\" variant=\"spinner\" exportparts=\"loader-svg\">\n Loading...\n </pds-loader>\n </span>\n )}\n\n {this.renderEndContent()}\n </div>\n );\n\n return (\n <Host\n aria-disabled={this.disabled ? 'true' : null}\n id={this.componentId}\n onClick={this.handleClick}\n variant={this.variant}\n >\n <ContentElement {...attributes()}>\n {content}\n </ContentElement>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"pds-button.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,YAAY,GAAG,0pNAA0pN;;MCsBlqN,SAAS,GAAA,M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A,EAC9BA,OAAA,CAAA,YAAA,EAAA,EAAA,YAAA,EAAwB,IAAI,EAAE,IAAI,EAAC,gCAAgC,EAAC,OAAO,EAAC,SAAS,EAAC,WAAW,EAAC,YAAY,EAAA,EAAA,YAAA,CAEjG,CACR,CACR,EAEA,IAAI,CAAC,gBAAgB,EAAE,CACpB,CACP;QAED,QACEA,OAAA,CAACE,UAAI,EAAA,EAAA,eAAA,EACY,IAAI,CAAC,QAAQ,GAAG,MAAM,GAAG,IAAI,EAC5C,EAAE,EAAE,IAAI,CAAC,WAAW,EACpB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,OAAO,EAAE,IAAI,CAAC,OAAO,EAAA,EAErBF,OAAC,CAAA,cAAc,oBAAK,UAAU,EAAE,GAC7B,OAAO,CACO,CACZ;;;;;;;;","names":["hasShadowDom","h","caretDown","Host"],"sources":["src/components/pds-button/pds-button.scss?tag=pds-button&encapsulation=shadow","src/components/pds-button/pds-button.tsx"],"sourcesContent":[":host {\n --pds-button-background: var(--color-background-default);\n --pds-button-border: var(--pine-border);\n --pds-button-border-radius: var(--pine-border-radius-full);\n --pds-button-border-radius-start-end: var(--pine-border-radius-full);\n --pds-button-border-radius-start-start: var(--pine-border-radius-full);\n --pds-button-border-radius-end-end: var(--pine-border-radius-full);\n --pds-button-border-radius-end-start: var(--pine-border-radius-full);\n --pds-button-min-height: var(--pine-dimension-450);\n --color-border-default: transparent;\n --color-border-disabled: transparent;\n --color-border-focus: transparent;\n --color-border-hover: transparent;\n --button-loader-color: var(--color-text-default);\n\n display: inline-flex;\n vertical-align: middle;\n}\n\n:host([full-width=\"true\"]) {\n display: flex;\n width: 100%;\n\n a,\n button {\n justify-content: center;\n width: 100%;\n }\n\n .pds-button__content {\n justify-content: center;\n text-align: center;\n }\n}\n\n:host([loading=\"true\"]) {\n cursor: wait;\n pointer-events: none;\n}\n\n:host([disabled=\"true\"]) {\n pointer-events: none;\n}\n\n.pds-button {\n --pds-loader-color: var(--color-text-default);\n align-items: center;\n background-color: var(--pds-button-background, var(--color-background-default));\n border: var(--pds-button-border);\n border-color: var(--color-border-default);\n border-end-end-radius: var(--pds-button-border-radius-end-end, var(--pds-button-border-radius));\n border-end-start-radius: var(--pds-button-border-radius-end-start, var(--pds-button-border-radius));\n border-radius: var(--pds-button-border-radius);\n border-start-end-radius: var(--pds-button-border-radius-start-end, var(--pds-button-border-radius));\n border-start-start-radius: var(--pds-button-border-radius-start-start, var(--pds-button-border-radius));\n box-sizing: border-box;\n color: var(--color-text-default);\n cursor: pointer;\n display: flex;\n font: var(--pine-typography-body-brand-label);\n letter-spacing: var(--pine-letter-spacing);\n min-height: var(--pds-button-min-height);\n padding: calc(var(--pine-dimension-xs) - var(--pine-border-width)) var(--pine-dimension-sm);\n position: relative;\n text-decoration: none;\n\n pds-icon {\n color: currentColor;\n fill: currentColor;\n }\n\n &:hover {\n background-color: var(--color-background-hover);\n border-color: var(--color-border-hover);\n }\n\n &:focus-visible {\n border-color: var(--color-border-focus);\n outline: var(--pine-outline-focus);\n outline-offset: var(--pine-border-width);\n }\n\n &:disabled {\n background-color: var(--color-background-disabled);\n border-color: var(--color-border-disabled);\n color: var(--color-text-disabled);\n pointer-events: none;\n }\n}\n\n.pds-button--primary {\n --color-background-default: var(--pine-color-primary);\n --color-background-hover: var(--pine-color-primary-hover);\n --color-background-disabled: var(--pine-color-primary-disabled);\n --color-border-default: var(--pine-color-primary);\n --color-border-hover: var(--pine-color-primary-hover);\n --color-text-default: var(--pine-color-text-primary);\n --color-text-disabled: var(--pine-color-text-primary-disabled);\n --color-outline: var(--pine-color-focus-ring);\n --button-loader-color: var(--pine-color-text-primary);\n}\n\n.pds-button--accent {\n --color-background-default: var(--pine-color-accent);\n --color-background-hover: var(--pine-color-accent-hover);\n --color-background-disabled: var(--pine-color-accent-disabled);\n --color-border-default: var(--pine-color-accent);\n --color-border-hover: var(--pine-color-accent-hover);\n --color-text-default: var(--pine-color-text-primary);\n --color-text-disabled: var(--pine-color-text-accent-disabled);\n --color-outline: var(--pine-color-focus-ring);\n --button-loader-color: var(--pine-color-text-primary);\n}\n\n.pds-button--destructive {\n --color-background-default: var(--pine-color-danger);\n --color-background-hover: var(--pine-color-danger-hover);\n --color-background-disabled: var(--pine-color-danger-disabled);\n --color-border-default: var(--pine-color-danger);\n --color-border-hover: var(--pine-color-danger-hover);\n --color-text-default: var(--pine-color-text-primary);\n --color-text-disabled: var(--pine-color-text-danger-disabled);\n --color-outline: var(--pine-color-focus-ring-danger);\n --button-loader-color: var(--pine-color-text-primary);\n\n &:focus-visible {\n outline-color: var(--pine-color-focus-ring-danger);\n }\n}\n\n.pds-button--secondary,\n.pds-button--disclosure {\n --color-background-default: var(--pine-color-secondary);\n --color-background-hover: var(--pine-color-secondary-hover);\n --color-background-disabled: var(--pine-color-secondary-disabled);\n --color-border-disabled: var(--pine-color-border-disabled);\n --color-border-focus: var(--pine-color-border);\n --color-border-hover: var(--pine-color-border-hover);\n --color-border-default: var(--pine-color-border);\n --color-text-default: var(--pine-color-text-secondary);\n --color-text-disabled: var(--pine-color-text-secondary-disabled);\n --color-outline: var(--pine-color-focus-ring);\n --button-loader-color: var(--pine-color-text-secondary);\n\n &:hover {\n background-color: var(--pine-color-secondary-hover);\n }\n}\n\n.pds-button--unstyled {\n --color-background-default: transparent;\n --color-background-hover: transparent;\n --color-background-disabled: transparent;\n --color-text-default: inherit;\n --button-loader-color: inherit;\n border-width: var(--pine-dimension-none);\n margin: var(--pine-dimension-none);\n min-height: auto;\n padding: var(--pine-dimension-none);\n width: inherit;\n}\n\n.pds-button__content {\n align-items: center;\n display: inline-flex;\n gap: var(--pine-dimension-xs);\n position: relative;\n width: 100%;\n}\n\n.pds-button__icon {\n display: inline-flex;\n}\n\n.pds-button__text {\n align-items: center;\n display: inline-flex;\n white-space: nowrap;\n}\n\n.pds-button__icon--hidden,\n.pds-button__text--hidden {\n opacity: 0;\n}\n\n.pds-button__loader {\n height: var(--pine-dimension-250);\n left: 50%;\n position: absolute;\n top: 50%;\n transform: translate(-50%, -50%);\n width: var(--pine-dimension-250);\n}\n\n.pds-button--loading {\n cursor: wait;\n pointer-events: none;\n\n .pds-button__loader {\n pds-loader {\n --loader-color: var(--button-loader-color);\n }\n }\n}\n\n.pds-button--icon-only {\n align-items: center;\n border-radius: var(--pine-border-radius-full);\n height: var(--button-dimension);\n justify-content: center;\n min-height: var(--button-dimension);\n min-width: var(--button-dimension);\n padding: var(--pine-dimension-xs);\n width: var(--button-dimension);\n\n .pds-button__content {\n height: 100%;\n justify-content: center;\n width: 100%;\n }\n\n .pds-button__text--hidden {\n border: 0;\n clip: rect(0 0 0 0);\n clip-path: polygon(0 0, 0 0, 0 0);\n height: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n }\n}\n","import { Component, Element, Event, EventEmitter, Host, h, Listen, Prop } from '@stencil/core';\nimport { hasShadowDom } from '../../utils/utils';\n\nimport { caretDown } from '@pine-ds/icons/icons';\n\n/**\n * @part button - Exposes the button element for styling.\n * @part button-content - Exposes the button content for styling.\n * @part button-text - Exposes the button text for styling.\n * @part caret - Exposes the caret icon component for styling. Appears only on the disclosure variant.\n * @part icon - Exposes the icon component for styling.\n * @part loader-svg - Exposes the loader SVG element for color customization. Appears only when loading.\n * @slot (default) - Button text.\n * @slot start - Content to display before the button text.\n * @slot end - Content to display after the button text.\n*/\n\n@Component({\n tag: 'pds-button',\n styleUrls: ['pds-button.scss'],\n shadow: true,\n})\nexport class PdsButton {\n @Element() el: HTMLPdsButtonElement;\n\n /**\n * A unique identifier used for the underlying component `id` attribute.\n */\n @Prop() componentId: string;\n\n /**\n * Determines the button's disabled state.\n * @defaultValue false\n */\n @Prop() disabled? = false;\n\n /**\n * Determines if the button should take up the full width of its container.\n * @defaultValue false\n */\n @Prop() fullWidth? = false;\n\n /**\n * If provided, renders the component as an anchor (`<a>`) element instead of a button.\n * When using href, button-specific props (type, name, value, loading) will be ignored.\n */\n @Prop() href?: string;\n\n /**\n * Displays a leading icon in the button. DEPRECATED.\n * @defaultValue null\n * @deprecated Use `start` slot instead.\n */\n @Prop() icon?: string = null;\n\n /**\n * When true, displays only the icon and visually hides the text (keeping it accessible).\n */\n @Prop() iconOnly? = false;\n\n /**\n * Determines if the button is in a loading state.\n * When true, displays a loader and hides the button text.\n * @defaultValue false\n */\n @Prop() loading? = false;\n\n /**\n * Provides the button with a submittable name.\n */\n @Prop() name?: string;\n\n /**\n * Specifies where to open the linked document when href is provided.\n * Only applies when href is set.\n */\n @Prop() target?: '_blank' | '_self' | '_parent' | '_top';\n\n /**\n * Provides button with a type.\n * @defaultValue button\n */\n @Prop() type?: 'button' | 'reset' | 'submit' = 'button';\n\n /**\n * Provides button with a submittable value\n */\n @Prop() value?: string;\n\n /**\n * Sets the style variant of the button.\n * @defaultValue primary\n */\n @Prop() variant: 'primary' | 'secondary' | 'accent' | 'disclosure' | 'destructive' | 'unstyled' = 'primary';\n\n @Event() pdsClick: EventEmitter;\n\n /**\n * Listen for Enter key presses on form inputs to trigger submit\n */\n @Listen('keydown', { target: 'body' })\n\n handleFormKeyDown(event: KeyboardEvent) {\n // Only handle Enter key for submit buttons that are not disabled\n if (event.key !== 'Enter' || this.type !== 'submit' || this.href || this.disabled) {\n return;\n }\n\n const target = event.target as Element;\n\n // Ensure event.target is an Element with matches method before proceeding\n if (!target || typeof target.matches !== 'function') {\n return;\n }\n const form = this.el.closest('form');\n\n // Check if the Enter key was pressed in a form input within the same form\n if (!form || !target || !form.contains(target)) {\n return;\n }\n\n // Check if target is a form input element (exclude reset buttons)\n const isFormInput = target.matches('input:not([type=\"submit\"]):not([type=\"button\"]):not([type=\"reset\"])') ||\n target.matches('pds-input') ||\n target.matches('pds-select') ||\n target.matches('pds-switch') ||\n target.matches('pds-checkbox') ||\n target.matches('pds-radio');\n\n if (isFormInput) {\n // Find all submit buttons in the form and check their actual properties\n const allSubmitButtons = Array.from(form.querySelectorAll('pds-button, button[type=\"submit\"], input[type=\"submit\"]'));\n const enabledSubmitButtons = allSubmitButtons.filter(button => {\n if (button.tagName.toLowerCase() === 'pds-button') {\n const pdsButton = button as HTMLPdsButtonElement;\n return pdsButton.type === 'submit' && !pdsButton.disabled;\n } else {\n return !button.hasAttribute('disabled');\n }\n });\n\n // Only synthesize click if this button is strictly the first enabled submit button\n if (enabledSubmitButtons.length > 0 && enabledSubmitButtons[0] === this.el) {\n event.preventDefault();\n this.el.click();\n }\n }\n }\n\n\n private handleClick = (ev: Event) => {\n if (this.loading) {\n ev.preventDefault();\n return;\n }\n\n // Prevent form submission for disabled buttons\n if (this.disabled) {\n ev.preventDefault();\n return;\n }\n\n if (!this.href && this.type != 'button') {\n // Handle form submission for Shadow DOM buttons\n if (hasShadowDom(this.el)) {\n const form = this.el.closest('form');\n if (form) {\n ev.preventDefault();\n\n const fakeButton = document.createElement('button');\n fakeButton.type = this.type;\n fakeButton.style.display = 'none';\n form.appendChild(fakeButton);\n fakeButton.click();\n fakeButton.remove();\n }\n }\n }\n this.pdsClick.emit(ev);\n };\n\n private classNames() {\n const classNames = ['pds-button'];\n\n if (this.variant) {\n classNames.push('pds-button--' + this.variant);\n }\n\n if (this.iconOnly) {\n classNames.push('pds-button--icon-only');\n }\n\n if (this.loading) {\n classNames.push('pds-button--loading');\n }\n\n return classNames.join(' ');\n }\n\n private hasSlotContent(slotName: string): boolean {\n const elements = this.el.querySelectorAll(`[slot=\"${slotName}\"]`);\n return elements.length > 0;\n }\n\n private renderStartContent() {\n const hasIcon = this.icon && this.variant !== 'disclosure';\n const hasStartSlot = this.hasSlotContent('start');\n\n if (Boolean(hasIcon)) {\n return (\n <pds-icon class={this.loading ? 'pds-button__icon--hidden' : ''} name={this.icon} part=\"icon\" aria-hidden=\"true\"></pds-icon>\n );\n } else if (Boolean(hasStartSlot)) {\n return <span class={`pds-button__icon ${this.loading ? 'pds-button__icon--hidden' : ''}`}><slot name=\"start\" /></span>;\n }\n\n return null;\n }\n\n private renderEndContent() {\n if (this.iconOnly) {\n return null;\n }\n\n if (this.variant === 'disclosure') {\n return (\n <pds-icon class={this.loading ? 'pds-button__icon--hidden' : ''} icon={caretDown} part=\"caret\" aria-hidden=\"true\"></pds-icon>\n );\n } else if (this.hasSlotContent('end')) {\n return <span class={`pds-button__icon ${this.loading ? 'pds-button__icon--hidden' : ''}`}><slot name=\"end\" /></span>;\n }\n\n return null;\n }\n\n render() {\n // Common props for both button and anchor elements\n const commonProps = {\n class: this.classNames(),\n part: 'button',\n };\n\n const attributes = () => {\n if (this.href) {\n return {\n // Anchor element props\n ...commonProps,\n href: this.disabled ? null : this.href,\n target: this.target,\n };\n }\n\n return {\n // Button element props\n ...commonProps,\n 'aria-busy': this.loading ? 'true' : null,\n 'aria-live': this.loading ? 'polite' : null,\n 'disabled': this.disabled,\n 'name': this.name,\n 'type': this.type,\n 'value': this.value,\n };\n };\n\n const ContentElement = this.href ? 'a' : 'button';\n\n // Hide text when loading or iconOnly is true\n const hideText = this.loading || this.iconOnly;\n\n const content = (\n <div class=\"pds-button__content\" part=\"button-content\">\n {this.renderStartContent()}\n\n <span class={`pds-button__text ${hideText ? 'pds-button__text--hidden' : ''}`} part=\"button-text\">\n <slot />\n </span>\n\n {this.loading && (\n <span class=\"pds-button__loader\">\n <pds-loader is-loading={true} size=\"var(--pine-font-size-body-2xl)\" variant=\"spinner\" exportparts=\"loader-svg\">\n Loading...\n </pds-loader>\n </span>\n )}\n\n {this.renderEndContent()}\n </div>\n );\n\n return (\n <Host\n aria-disabled={this.disabled ? 'true' : null}\n id={this.componentId}\n onClick={this.handleClick}\n variant={this.variant}\n >\n <ContentElement {...attributes()}>\n {content}\n </ContentElement>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds-button.entry.cjs.js","sources":["src/components/pds-button/pds-button.scss?tag=pds-button&encapsulation=shadow","src/components/pds-button/pds-button.tsx"],"sourcesContent":[":host {\n --pds-button-background: var(--color-background-default);\n --pds-button-border: var(--pine-border);\n --pds-button-border-radius: var(--pine-border-radius-full);\n --pds-button-border-radius-start-end: var(--pine-border-radius-full);\n --pds-button-border-radius-start-start: var(--pine-border-radius-full);\n --pds-button-border-radius-end-end: var(--pine-border-radius-full);\n --pds-button-border-radius-end-start: var(--pine-border-radius-full);\n --pds-button-min-height: var(--pine-dimension-450);\n --color-border-default: transparent;\n --color-border-disabled: transparent;\n --color-border-focus: transparent;\n --color-border-hover: transparent;\n --button-loader-color: var(--color-text-default);\n\n display: inline-flex;\n vertical-align: middle;\n}\n\n:host([full-width=\"true\"]) {\n display: flex;\n width: 100%;\n\n a,\n button {\n justify-content: center;\n width: 100%;\n }\n\n .pds-button__content {\n justify-content: center;\n text-align: center;\n }\n}\n\n:host([loading=\"true\"]) {\n cursor: wait;\n pointer-events: none;\n}\n\n:host([disabled=\"true\"]) {\n pointer-events: none;\n}\n\n.pds-button {\n --pds-loader-color: var(--color-text-default);\n align-items: center;\n background-color: var(--pds-button-background, var(--color-background-default));\n border: var(--pds-button-border);\n border-color: var(--color-border-default);\n border-end-end-radius: var(--pds-button-border-radius-end-end, var(--pds-button-border-radius));\n border-end-start-radius: var(--pds-button-border-radius-end-start, var(--pds-button-border-radius));\n border-radius: var(--pds-button-border-radius);\n border-start-end-radius: var(--pds-button-border-radius-start-end, var(--pds-button-border-radius));\n border-start-start-radius: var(--pds-button-border-radius-start-start, var(--pds-button-border-radius));\n box-sizing: border-box;\n color: var(--color-text-default);\n cursor: pointer;\n display: flex;\n font: var(--pine-typography-body-brand-label);\n letter-spacing: var(--pine-letter-spacing);\n min-height: var(--pds-button-min-height);\n padding: calc(var(--pine-dimension-xs) - var(--pine-border-width)) var(--pine-dimension-sm);\n position: relative;\n text-decoration: none;\n\n pds-icon {\n color: currentColor;\n fill: currentColor;\n }\n\n &:hover {\n background-color: var(--color-background-hover);\n border-color: var(--color-border-hover);\n }\n\n &:focus-visible {\n border-color: var(--color-border-focus);\n outline: var(--pine-outline-focus);\n outline-offset: var(--pine-border-width);\n }\n\n &:disabled {\n background-color: var(--color-background-disabled);\n border-color: var(--color-border-disabled);\n color: var(--color-text-disabled);\n pointer-events: none;\n }\n}\n\n.pds-button--primary {\n --color-background-default: var(--pine-color-primary);\n --color-background-hover: var(--pine-color-primary-hover);\n --color-background-disabled: var(--pine-color-primary-disabled);\n --color-border-default: var(--pine-color-primary);\n --color-border-hover: var(--pine-color-primary-hover);\n --color-text-default: var(--pine-color-text-primary);\n --color-text-disabled: var(--pine-color-text-primary-disabled);\n --color-outline: var(--pine-color-focus-ring);\n --button-loader-color: var(--pine-color-text-primary);\n}\n\n.pds-button--accent {\n --color-background-default: var(--pine-color-accent);\n --color-background-hover: var(--pine-color-accent-hover);\n --color-background-disabled: var(--pine-color-accent-disabled);\n --color-border-default: var(--pine-color-accent);\n --color-border-hover: var(--pine-color-accent-hover);\n --color-text-default: var(--pine-color-text-primary);\n --color-text-disabled: var(--pine-color-text-accent-disabled);\n --color-outline: var(--pine-color-focus-ring);\n --button-loader-color: var(--pine-color-text-primary);\n}\n\n.pds-button--destructive {\n --color-background-default: var(--pine-color-danger);\n --color-background-hover: var(--pine-color-danger-hover);\n --color-background-disabled: var(--pine-color-danger-disabled);\n --color-border-default: var(--pine-color-danger);\n --color-border-hover: var(--pine-color-danger-hover);\n --color-text-default: var(--pine-color-text-primary);\n --color-text-disabled: var(--pine-color-text-danger-disabled);\n --color-outline: var(--pine-color-focus-ring-danger);\n --button-loader-color: var(--pine-color-text-primary);\n\n &:focus-visible {\n outline-color: var(--pine-color-focus-ring-danger);\n }\n}\n\n.pds-button--secondary,\n.pds-button--disclosure {\n --color-background-default: var(--pine-color-secondary);\n --color-background-hover: var(--pine-color-secondary-hover);\n --color-background-disabled: var(--pine-color-secondary-disabled);\n --color-border-disabled: var(--pine-color-border-disabled);\n --color-border-focus: var(--pine-color-border);\n --color-border-hover: var(--pine-color-border-hover);\n --color-border-default: var(--pine-color-border);\n --color-text-default: var(--pine-color-text-secondary);\n --color-text-disabled: var(--pine-color-text-secondary-disabled);\n --color-outline: var(--pine-color-focus-ring);\n --button-loader-color: var(--pine-color-text-secondary);\n\n &:hover {\n background-color: var(--pine-color-secondary-hover);\n }\n}\n\n.pds-button--unstyled {\n --color-background-default: transparent;\n --color-background-hover: transparent;\n --color-background-disabled: transparent;\n --color-text-default: inherit;\n --button-loader-color: inherit;\n border-width: var(--pine-dimension-none);\n margin: var(--pine-dimension-none);\n min-height: auto;\n padding: var(--pine-dimension-none);\n width: inherit;\n}\n\n.pds-button__content {\n align-items: center;\n display: inline-flex;\n gap: var(--pine-dimension-xs);\n position: relative;\n width: 100%;\n}\n\n.pds-button__icon {\n display: inline-flex;\n}\n\n.pds-button__text {\n align-items: center;\n display: inline-flex;\n white-space: nowrap;\n}\n\n.pds-button__icon--hidden,\n.pds-button__text--hidden {\n opacity: 0;\n}\n\n.pds-button__loader {\n height: var(--pine-dimension-250);\n left: 50%;\n position: absolute;\n top: 50%;\n transform: translate(-50%, -50%);\n width: var(--pine-dimension-250);\n}\n\n.pds-button--loading {\n cursor: wait;\n pointer-events: none;\n\n .pds-button__loader {\n pds-loader {\n --loader-color: var(--button-loader-color);\n }\n }\n}\n\n.pds-button--icon-only {\n align-items: center;\n border-radius: var(--pine-border-radius-full);\n height: var(--button-dimension);\n justify-content: center;\n min-height: var(--button-dimension);\n min-width: var(--button-dimension);\n padding: var(--pine-dimension-xs);\n width: var(--button-dimension);\n\n .pds-button__content {\n height: 100%;\n justify-content: center;\n width: 100%;\n }\n\n .pds-button__text--hidden {\n border: 0;\n clip: rect(0 0 0 0);\n clip-path: polygon(0 0, 0 0, 0 0);\n height: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n }\n}\n","import { Component, Element, Event, EventEmitter, Host, h, Prop } from '@stencil/core';\nimport { hasShadowDom } from '../../utils/utils';\n\nimport { caretDown } from '@pine-ds/icons/icons';\n\n/**\n * @part button - Exposes the button element for styling.\n * @part button-content - Exposes the button content for styling.\n * @part button-text - Exposes the button text for styling.\n * @part caret - Exposes the caret icon component for styling. Appears only on the disclosure variant.\n * @part icon - Exposes the icon component for styling.\n * @part loader-svg - Exposes the loader SVG element for color customization. Appears only when loading.\n * @slot (default) - Button text.\n * @slot start - Content to display before the button text.\n * @slot end - Content to display after the button text.\n*/\n\n@Component({\n tag: 'pds-button',\n styleUrls: ['pds-button.scss'],\n shadow: true,\n})\nexport class PdsButton {\n @Element() el: HTMLPdsButtonElement;\n\n /**\n * A unique identifier used for the underlying component `id` attribute.\n */\n @Prop() componentId: string;\n\n /**\n * Determines the button's disabled state.\n * @defaultValue false\n */\n @Prop() disabled? = false;\n\n /**\n * Determines if the button should take up the full width of its container.\n * @defaultValue false\n */\n @Prop() fullWidth? = false;\n\n /**\n * If provided, renders the component as an anchor (`<a>`) element instead of a button.\n * When using href, button-specific props (type, name, value, loading) will be ignored.\n */\n @Prop() href?: string;\n\n /**\n * Displays a leading icon in the button. DEPRECATED.\n * @defaultValue null\n * @deprecated Use `start` slot instead.\n */\n @Prop() icon?: string = null;\n\n /**\n * When true, displays only the icon and visually hides the text (keeping it accessible).\n */\n @Prop() iconOnly? = false;\n\n /**\n * Determines if the button is in a loading state.\n * When true, displays a loader and hides the button text.\n * @defaultValue false\n */\n @Prop() loading? = false;\n\n /**\n * Provides the button with a submittable name.\n */\n @Prop() name?: string;\n\n /**\n * Specifies where to open the linked document when href is provided.\n * Only applies when href is set.\n */\n @Prop() target?: '_blank' | '_self' | '_parent' | '_top';\n\n /**\n * Provides button with a type.\n * @defaultValue button\n */\n @Prop() type?: 'button' | 'reset' | 'submit' = 'button';\n\n /**\n * Provides button with a submittable value\n */\n @Prop() value?: string;\n\n /**\n * Sets the style variant of the button.\n * @defaultValue primary\n */\n @Prop() variant: 'primary' | 'secondary' | 'accent' | 'disclosure' | 'destructive' | 'unstyled' = 'primary';\n\n @Event() pdsClick: EventEmitter;\n\n private handleClick = (ev: Event) => {\n if (this.loading) {\n ev.preventDefault();\n return;\n }\n\n if (!this.href && this.type != 'button') {\n // If button clicked IS NOT associated with a form\n if (hasShadowDom(this.el)) {\n const form = this.el.closest('form');\n if (form) {\n ev.preventDefault();\n\n const fakeButton = document.createElement('button');\n fakeButton.type = this.type;\n fakeButton.style.display = 'none';\n form.appendChild(fakeButton);\n fakeButton.click();\n fakeButton.remove();\n }\n }\n }\n this.pdsClick.emit(ev);\n };\n\n private classNames() {\n const classNames = ['pds-button'];\n\n if (this.variant) {\n classNames.push('pds-button--' + this.variant);\n }\n\n if (this.iconOnly) {\n classNames.push('pds-button--icon-only');\n }\n\n if (this.loading) {\n classNames.push('pds-button--loading');\n }\n\n return classNames.join(' ');\n }\n\n private hasSlotContent(slotName: string): boolean {\n const elements = this.el.querySelectorAll(`[slot=\"${slotName}\"]`);\n return elements.length > 0;\n }\n\n private renderStartContent() {\n const hasIcon = this.icon && this.variant !== 'disclosure';\n const hasStartSlot = this.hasSlotContent('start');\n\n if (Boolean(hasIcon)) {\n return (\n <pds-icon class={this.loading ? 'pds-button__icon--hidden' : ''} name={this.icon} part=\"icon\" aria-hidden=\"true\"></pds-icon>\n );\n } else if (Boolean(hasStartSlot)) {\n return <span class={`pds-button__icon ${this.loading ? 'pds-button__icon--hidden' : ''}`}><slot name=\"start\" /></span>;\n }\n\n return null;\n }\n\n private renderEndContent() {\n if (this.iconOnly) {\n return null;\n }\n\n if (this.variant === 'disclosure') {\n return (\n <pds-icon class={this.loading ? 'pds-button__icon--hidden' : ''} icon={caretDown} part=\"caret\" aria-hidden=\"true\"></pds-icon>\n );\n } else if (this.hasSlotContent('end')) {\n return <span class={`pds-button__icon ${this.loading ? 'pds-button__icon--hidden' : ''}`}><slot name=\"end\" /></span>;\n }\n\n return null;\n }\n\n render() {\n // Common props for both button and anchor elements\n const commonProps = {\n class: this.classNames(),\n part: 'button',\n };\n\n const attributes = () => {\n if (this.href) {\n return {\n // Anchor element props\n ...commonProps,\n href: this.disabled ? null : this.href,\n target: this.target,\n };\n }\n\n return {\n // Button element props\n ...commonProps,\n 'aria-busy': this.loading ? 'true' : null,\n 'aria-live': this.loading ? 'polite' : null,\n 'disabled': this.disabled,\n 'name': this.name,\n 'type': this.type,\n 'value': this.value,\n };\n };\n\n const ContentElement = this.href ? 'a' : 'button';\n\n // Hide text when loading or iconOnly is true\n const hideText = this.loading || this.iconOnly;\n\n const content = (\n <div class=\"pds-button__content\" part=\"button-content\">\n {this.renderStartContent()}\n\n <span class={`pds-button__text ${hideText ? 'pds-button__text--hidden' : ''}`} part=\"button-text\">\n <slot />\n </span>\n\n {this.loading && (\n <span class=\"pds-button__loader\">\n <pds-loader is-loading={true} size=\"var(--pine-font-size-body-2xl)\" variant=\"spinner\" exportparts=\"loader-svg\">\n Loading...\n </pds-loader>\n </span>\n )}\n\n {this.renderEndContent()}\n </div>\n );\n\n return (\n <Host\n aria-disabled={this.disabled ? 'true' : null}\n id={this.componentId}\n onClick={this.handleClick}\n variant={this.variant}\n >\n <ContentElement {...attributes()}>\n {content}\n </ContentElement>\n </Host>\n );\n }\n}\n"],"names":["hasShadowDom","h","caretDown","Host"],"mappings":";;;;;;AAAA,MAAM,YAAY,GAAG,0pNAA0pN;;MCsBlqN,SAAS,GAAA,MAAA;AALtB,IAAA,WAAA,CAAA,OAAA,EAAA;;;AAaE;;;AAGG;AACK,QAAA,IAAQ,CAAA,QAAA,GAAI,KAAK;AAEzB;;;AAGG;AACK,QAAA,IAAS,CAAA,SAAA,GAAI,KAAK;AAQ1B;;;;AAIG;AACK,QAAA,IAAI,CAAA,IAAA,GAAY,IAAI;AAE5B;;AAEG;AACK,QAAA,IAAQ,CAAA,QAAA,GAAI,KAAK;AAEzB;;;;AAIG;AACK,QAAA,IAAO,CAAA,OAAA,GAAI,KAAK;AAaxB;;;AAGG;AACK,QAAA,IAAI,CAAA,IAAA,GAAmC,QAAQ;AAOvD;;;AAGG;AACK,QAAA,IAAO,CAAA,OAAA,GAAmF,SAAS;AAInG,QAAA,IAAA,CAAA,WAAW,GAAG,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IACXA,OAAK,CAAA,KAAA,EAAA,EAAA,KAAK,EAAC,qBAAqB,EAAC,IAAI,EAAC,gBAAgB,EAAA,EACnD,IAAI,CAAC,kBAAkB,EAAE,EAE1BA,OAAA,CAAA,MAAA,EAAA,EAAM,KAAK,EAAE,CAAA,iBAAA,EAAoB,QAAQ,GAAG,0BAA0B,GAAG,EAAE,CAAA,CAAE,EAAE,IAAI,EAAC,aAAa,EAAA,EAC/FA,OAAA,CAAA,MAAA,EAAA,IAAA,CAAQ,CACH,EAEN,IAAI,CAAC,OAAO,KACXA,OAAM,CAAA,MAAA,EAAA,EAAA,KAAK,EAAC,oBAAoB,EAAA,EAC9BA,OAAA,CAAA,YAAA,EAAA,EAAA,YAAA,EAAwB,IAAI,EAAE,IAAI,EAAC,gCAAgC,EAAC,OAAO,EAAC,SAAS,EAAC,WAAW,EAAC,YAAY,EAAA,EAAA,YAAA,CAEjG,CACR,CACR,EAEA,IAAI,CAAC,gBAAgB,EAAE,CACpB,CACP;QAED,QACEA,OAAA,CAACE,UAAI,EAAA,EAAA,eAAA,EACY,IAAI,CAAC,QAAQ,GAAG,MAAM,GAAG,IAAI,EAC5C,EAAE,EAAE,IAAI,CAAC,WAAW,EACpB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,OAAO,EAAE,IAAI,CAAC,OAAO,EAAA,EAErBF,OAAC,CAAA,cAAc,oBAAK,UAAU,EAAE,GAC7B,OAAO,CACO,CACZ;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"pds-button.entry.cjs.js","sources":["src/components/pds-button/pds-button.scss?tag=pds-button&encapsulation=shadow","src/components/pds-button/pds-button.tsx"],"sourcesContent":[":host {\n --pds-button-background: var(--color-background-default);\n --pds-button-border: var(--pine-border);\n --pds-button-border-radius: var(--pine-border-radius-full);\n --pds-button-border-radius-start-end: var(--pine-border-radius-full);\n --pds-button-border-radius-start-start: var(--pine-border-radius-full);\n --pds-button-border-radius-end-end: var(--pine-border-radius-full);\n --pds-button-border-radius-end-start: var(--pine-border-radius-full);\n --pds-button-min-height: var(--pine-dimension-450);\n --color-border-default: transparent;\n --color-border-disabled: transparent;\n --color-border-focus: transparent;\n --color-border-hover: transparent;\n --button-loader-color: var(--color-text-default);\n\n display: inline-flex;\n vertical-align: middle;\n}\n\n:host([full-width=\"true\"]) {\n display: flex;\n width: 100%;\n\n a,\n button {\n justify-content: center;\n width: 100%;\n }\n\n .pds-button__content {\n justify-content: center;\n text-align: center;\n }\n}\n\n:host([loading=\"true\"]) {\n cursor: wait;\n pointer-events: none;\n}\n\n:host([disabled=\"true\"]) {\n pointer-events: none;\n}\n\n.pds-button {\n --pds-loader-color: var(--color-text-default);\n align-items: center;\n background-color: var(--pds-button-background, var(--color-background-default));\n border: var(--pds-button-border);\n border-color: var(--color-border-default);\n border-end-end-radius: var(--pds-button-border-radius-end-end, var(--pds-button-border-radius));\n border-end-start-radius: var(--pds-button-border-radius-end-start, var(--pds-button-border-radius));\n border-radius: var(--pds-button-border-radius);\n border-start-end-radius: var(--pds-button-border-radius-start-end, var(--pds-button-border-radius));\n border-start-start-radius: var(--pds-button-border-radius-start-start, var(--pds-button-border-radius));\n box-sizing: border-box;\n color: var(--color-text-default);\n cursor: pointer;\n display: flex;\n font: var(--pine-typography-body-brand-label);\n letter-spacing: var(--pine-letter-spacing);\n min-height: var(--pds-button-min-height);\n padding: calc(var(--pine-dimension-xs) - var(--pine-border-width)) var(--pine-dimension-sm);\n position: relative;\n text-decoration: none;\n\n pds-icon {\n color: currentColor;\n fill: currentColor;\n }\n\n &:hover {\n background-color: var(--color-background-hover);\n border-color: var(--color-border-hover);\n }\n\n &:focus-visible {\n border-color: var(--color-border-focus);\n outline: var(--pine-outline-focus);\n outline-offset: var(--pine-border-width);\n }\n\n &:disabled {\n background-color: var(--color-background-disabled);\n border-color: var(--color-border-disabled);\n color: var(--color-text-disabled);\n pointer-events: none;\n }\n}\n\n.pds-button--primary {\n --color-background-default: var(--pine-color-primary);\n --color-background-hover: var(--pine-color-primary-hover);\n --color-background-disabled: var(--pine-color-primary-disabled);\n --color-border-default: var(--pine-color-primary);\n --color-border-hover: var(--pine-color-primary-hover);\n --color-text-default: var(--pine-color-text-primary);\n --color-text-disabled: var(--pine-color-text-primary-disabled);\n --color-outline: var(--pine-color-focus-ring);\n --button-loader-color: var(--pine-color-text-primary);\n}\n\n.pds-button--accent {\n --color-background-default: var(--pine-color-accent);\n --color-background-hover: var(--pine-color-accent-hover);\n --color-background-disabled: var(--pine-color-accent-disabled);\n --color-border-default: var(--pine-color-accent);\n --color-border-hover: var(--pine-color-accent-hover);\n --color-text-default: var(--pine-color-text-primary);\n --color-text-disabled: var(--pine-color-text-accent-disabled);\n --color-outline: var(--pine-color-focus-ring);\n --button-loader-color: var(--pine-color-text-primary);\n}\n\n.pds-button--destructive {\n --color-background-default: var(--pine-color-danger);\n --color-background-hover: var(--pine-color-danger-hover);\n --color-background-disabled: var(--pine-color-danger-disabled);\n --color-border-default: var(--pine-color-danger);\n --color-border-hover: var(--pine-color-danger-hover);\n --color-text-default: var(--pine-color-text-primary);\n --color-text-disabled: var(--pine-color-text-danger-disabled);\n --color-outline: var(--pine-color-focus-ring-danger);\n --button-loader-color: var(--pine-color-text-primary);\n\n &:focus-visible {\n outline-color: var(--pine-color-focus-ring-danger);\n }\n}\n\n.pds-button--secondary,\n.pds-button--disclosure {\n --color-background-default: var(--pine-color-secondary);\n --color-background-hover: var(--pine-color-secondary-hover);\n --color-background-disabled: var(--pine-color-secondary-disabled);\n --color-border-disabled: var(--pine-color-border-disabled);\n --color-border-focus: var(--pine-color-border);\n --color-border-hover: var(--pine-color-border-hover);\n --color-border-default: var(--pine-color-border);\n --color-text-default: var(--pine-color-text-secondary);\n --color-text-disabled: var(--pine-color-text-secondary-disabled);\n --color-outline: var(--pine-color-focus-ring);\n --button-loader-color: var(--pine-color-text-secondary);\n\n &:hover {\n background-color: var(--pine-color-secondary-hover);\n }\n}\n\n.pds-button--unstyled {\n --color-background-default: transparent;\n --color-background-hover: transparent;\n --color-background-disabled: transparent;\n --color-text-default: inherit;\n --button-loader-color: inherit;\n border-width: var(--pine-dimension-none);\n margin: var(--pine-dimension-none);\n min-height: auto;\n padding: var(--pine-dimension-none);\n width: inherit;\n}\n\n.pds-button__content {\n align-items: center;\n display: inline-flex;\n gap: var(--pine-dimension-xs);\n position: relative;\n width: 100%;\n}\n\n.pds-button__icon {\n display: inline-flex;\n}\n\n.pds-button__text {\n align-items: center;\n display: inline-flex;\n white-space: nowrap;\n}\n\n.pds-button__icon--hidden,\n.pds-button__text--hidden {\n opacity: 0;\n}\n\n.pds-button__loader {\n height: var(--pine-dimension-250);\n left: 50%;\n position: absolute;\n top: 50%;\n transform: translate(-50%, -50%);\n width: var(--pine-dimension-250);\n}\n\n.pds-button--loading {\n cursor: wait;\n pointer-events: none;\n\n .pds-button__loader {\n pds-loader {\n --loader-color: var(--button-loader-color);\n }\n }\n}\n\n.pds-button--icon-only {\n align-items: center;\n border-radius: var(--pine-border-radius-full);\n height: var(--button-dimension);\n justify-content: center;\n min-height: var(--button-dimension);\n min-width: var(--button-dimension);\n padding: var(--pine-dimension-xs);\n width: var(--button-dimension);\n\n .pds-button__content {\n height: 100%;\n justify-content: center;\n width: 100%;\n }\n\n .pds-button__text--hidden {\n border: 0;\n clip: rect(0 0 0 0);\n clip-path: polygon(0 0, 0 0, 0 0);\n height: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n }\n}\n","import { Component, Element, Event, EventEmitter, Host, h, Listen, Prop } from '@stencil/core';\nimport { hasShadowDom } from '../../utils/utils';\n\nimport { caretDown } from '@pine-ds/icons/icons';\n\n/**\n * @part button - Exposes the button element for styling.\n * @part button-content - Exposes the button content for styling.\n * @part button-text - Exposes the button text for styling.\n * @part caret - Exposes the caret icon component for styling. Appears only on the disclosure variant.\n * @part icon - Exposes the icon component for styling.\n * @part loader-svg - Exposes the loader SVG element for color customization. Appears only when loading.\n * @slot (default) - Button text.\n * @slot start - Content to display before the button text.\n * @slot end - Content to display after the button text.\n*/\n\n@Component({\n tag: 'pds-button',\n styleUrls: ['pds-button.scss'],\n shadow: true,\n})\nexport class PdsButton {\n @Element() el: HTMLPdsButtonElement;\n\n /**\n * A unique identifier used for the underlying component `id` attribute.\n */\n @Prop() componentId: string;\n\n /**\n * Determines the button's disabled state.\n * @defaultValue false\n */\n @Prop() disabled? = false;\n\n /**\n * Determines if the button should take up the full width of its container.\n * @defaultValue false\n */\n @Prop() fullWidth? = false;\n\n /**\n * If provided, renders the component as an anchor (`<a>`) element instead of a button.\n * When using href, button-specific props (type, name, value, loading) will be ignored.\n */\n @Prop() href?: string;\n\n /**\n * Displays a leading icon in the button. DEPRECATED.\n * @defaultValue null\n * @deprecated Use `start` slot instead.\n */\n @Prop() icon?: string = null;\n\n /**\n * When true, displays only the icon and visually hides the text (keeping it accessible).\n */\n @Prop() iconOnly? = false;\n\n /**\n * Determines if the button is in a loading state.\n * When true, displays a loader and hides the button text.\n * @defaultValue false\n */\n @Prop() loading? = false;\n\n /**\n * Provides the button with a submittable name.\n */\n @Prop() name?: string;\n\n /**\n * Specifies where to open the linked document when href is provided.\n * Only applies when href is set.\n */\n @Prop() target?: '_blank' | '_self' | '_parent' | '_top';\n\n /**\n * Provides button with a type.\n * @defaultValue button\n */\n @Prop() type?: 'button' | 'reset' | 'submit' = 'button';\n\n /**\n * Provides button with a submittable value\n */\n @Prop() value?: string;\n\n /**\n * Sets the style variant of the button.\n * @defaultValue primary\n */\n @Prop() variant: 'primary' | 'secondary' | 'accent' | 'disclosure' | 'destructive' | 'unstyled' = 'primary';\n\n @Event() pdsClick: EventEmitter;\n\n /**\n * Listen for Enter key presses on form inputs to trigger submit\n */\n @Listen('keydown', { target: 'body' })\n\n handleFormKeyDown(event: KeyboardEvent) {\n // Only handle Enter key for submit buttons that are not disabled\n if (event.key !== 'Enter' || this.type !== 'submit' || this.href || this.disabled) {\n return;\n }\n\n const target = event.target as Element;\n\n // Ensure event.target is an Element with matches method before proceeding\n if (!target || typeof target.matches !== 'function') {\n return;\n }\n const form = this.el.closest('form');\n\n // Check if the Enter key was pressed in a form input within the same form\n if (!form || !target || !form.contains(target)) {\n return;\n }\n\n // Check if target is a form input element (exclude reset buttons)\n const isFormInput = target.matches('input:not([type=\"submit\"]):not([type=\"button\"]):not([type=\"reset\"])') ||\n target.matches('pds-input') ||\n target.matches('pds-select') ||\n target.matches('pds-switch') ||\n target.matches('pds-checkbox') ||\n target.matches('pds-radio');\n\n if (isFormInput) {\n // Find all submit buttons in the form and check their actual properties\n const allSubmitButtons = Array.from(form.querySelectorAll('pds-button, button[type=\"submit\"], input[type=\"submit\"]'));\n const enabledSubmitButtons = allSubmitButtons.filter(button => {\n if (button.tagName.toLowerCase() === 'pds-button') {\n const pdsButton = button as HTMLPdsButtonElement;\n return pdsButton.type === 'submit' && !pdsButton.disabled;\n } else {\n return !button.hasAttribute('disabled');\n }\n });\n\n // Only synthesize click if this button is strictly the first enabled submit button\n if (enabledSubmitButtons.length > 0 && enabledSubmitButtons[0] === this.el) {\n event.preventDefault();\n this.el.click();\n }\n }\n }\n\n\n private handleClick = (ev: Event) => {\n if (this.loading) {\n ev.preventDefault();\n return;\n }\n\n // Prevent form submission for disabled buttons\n if (this.disabled) {\n ev.preventDefault();\n return;\n }\n\n if (!this.href && this.type != 'button') {\n // Handle form submission for Shadow DOM buttons\n if (hasShadowDom(this.el)) {\n const form = this.el.closest('form');\n if (form) {\n ev.preventDefault();\n\n const fakeButton = document.createElement('button');\n fakeButton.type = this.type;\n fakeButton.style.display = 'none';\n form.appendChild(fakeButton);\n fakeButton.click();\n fakeButton.remove();\n }\n }\n }\n this.pdsClick.emit(ev);\n };\n\n private classNames() {\n const classNames = ['pds-button'];\n\n if (this.variant) {\n classNames.push('pds-button--' + this.variant);\n }\n\n if (this.iconOnly) {\n classNames.push('pds-button--icon-only');\n }\n\n if (this.loading) {\n classNames.push('pds-button--loading');\n }\n\n return classNames.join(' ');\n }\n\n private hasSlotContent(slotName: string): boolean {\n const elements = this.el.querySelectorAll(`[slot=\"${slotName}\"]`);\n return elements.length > 0;\n }\n\n private renderStartContent() {\n const hasIcon = this.icon && this.variant !== 'disclosure';\n const hasStartSlot = this.hasSlotContent('start');\n\n if (Boolean(hasIcon)) {\n return (\n <pds-icon class={this.loading ? 'pds-button__icon--hidden' : ''} name={this.icon} part=\"icon\" aria-hidden=\"true\"></pds-icon>\n );\n } else if (Boolean(hasStartSlot)) {\n return <span class={`pds-button__icon ${this.loading ? 'pds-button__icon--hidden' : ''}`}><slot name=\"start\" /></span>;\n }\n\n return null;\n }\n\n private renderEndContent() {\n if (this.iconOnly) {\n return null;\n }\n\n if (this.variant === 'disclosure') {\n return (\n <pds-icon class={this.loading ? 'pds-button__icon--hidden' : ''} icon={caretDown} part=\"caret\" aria-hidden=\"true\"></pds-icon>\n );\n } else if (this.hasSlotContent('end')) {\n return <span class={`pds-button__icon ${this.loading ? 'pds-button__icon--hidden' : ''}`}><slot name=\"end\" /></span>;\n }\n\n return null;\n }\n\n render() {\n // Common props for both button and anchor elements\n const commonProps = {\n class: this.classNames(),\n part: 'button',\n };\n\n const attributes = () => {\n if (this.href) {\n return {\n // Anchor element props\n ...commonProps,\n href: this.disabled ? null : this.href,\n target: this.target,\n };\n }\n\n return {\n // Button element props\n ...commonProps,\n 'aria-busy': this.loading ? 'true' : null,\n 'aria-live': this.loading ? 'polite' : null,\n 'disabled': this.disabled,\n 'name': this.name,\n 'type': this.type,\n 'value': this.value,\n };\n };\n\n const ContentElement = this.href ? 'a' : 'button';\n\n // Hide text when loading or iconOnly is true\n const hideText = this.loading || this.iconOnly;\n\n const content = (\n <div class=\"pds-button__content\" part=\"button-content\">\n {this.renderStartContent()}\n\n <span class={`pds-button__text ${hideText ? 'pds-button__text--hidden' : ''}`} part=\"button-text\">\n <slot />\n </span>\n\n {this.loading && (\n <span class=\"pds-button__loader\">\n <pds-loader is-loading={true} size=\"var(--pine-font-size-body-2xl)\" variant=\"spinner\" exportparts=\"loader-svg\">\n Loading...\n </pds-loader>\n </span>\n )}\n\n {this.renderEndContent()}\n </div>\n );\n\n return (\n <Host\n aria-disabled={this.disabled ? 'true' : null}\n id={this.componentId}\n onClick={this.handleClick}\n variant={this.variant}\n >\n <ContentElement {...attributes()}>\n {content}\n </ContentElement>\n </Host>\n );\n }\n}\n"],"names":["hasShadowDom","h","caretDown","Host"],"mappings":";;;;;;AAAA,MAAM,YAAY,GAAG,0pNAA0pN;;MCsBlqN,SAAS,GAAA,MAAA;AALtB,IAAA,WAAA,CAAA,OAAA,EAAA;;;AAaE;;;AAGG;AACK,QAAA,IAAQ,CAAA,QAAA,GAAI,KAAK;AAEzB;;;AAGG;AACK,QAAA,IAAS,CAAA,SAAA,GAAI,KAAK;AAQ1B;;;;AAIG;AACK,QAAA,IAAI,CAAA,IAAA,GAAY,IAAI;AAE5B;;AAEG;AACK,QAAA,IAAQ,CAAA,QAAA,GAAI,KAAK;AAEzB;;;;AAIG;AACK,QAAA,IAAO,CAAA,OAAA,GAAI,KAAK;AAaxB;;;AAGG;AACK,QAAA,IAAI,CAAA,IAAA,GAAmC,QAAQ;AAOvD;;;AAGG;AACK,QAAA,IAAO,CAAA,OAAA,GAAmF,SAAS;AAyDnG,QAAA,IAAA,CAAA,WAAW,GAAG,CAAC,EAAS,KAAI;AAClC,YAAA,IAAI,IAAI,CAAC,OAAO,EAAE;gBAChB,EAAE,CAAC,cAAc,EAAE;gBACnB;;;AAIF,YAAA,IAAI,IAAI,CAAC,QAAQ,EAAE;gBACjB,EAAE,CAAC,cAAc,EAAE;gBACnB;;YAGF,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,QAAQ,EAAE;;AAEvC,gBAAA,IAAIA,kBAAY,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;oBACzB,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;oBACpC,IAAI,IAAI,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AgB,EAAA,EACnD,IAAI,CAAC,kBAAkB,EAAE,EAE1BA,OAAA,CAAA,MAAA,EAAA,EAAM,KAAK,EAAE,CAAA,iBAAA,EAAoB,QAAQ,GAAG,0BAA0B,GAAG,EAAE,CAAA,CAAE,EAAE,IAAI,EAAC,aAAa,EAAA,EAC/FA,OAAA,CAAA,MAAA,EAAA,IAAA,CAAQ,CACH,EAEN,IAAI,CAAC,OAAO,KACXA,OAAM,CAAA,MAAA,EAAA,EAAA,KAAK,EAAC,oBAAoB,EAAA,EAC9BA,OAAA,CAAA,YAAA,EAAA,EAAA,YAAA,EAAwB,IAAI,EAAE,IAAI,EAAC,gCAAgC,EAAC,OAAO,EAAC,SAAS,EAAC,WAAW,EAAC,YAAY,EAAA,EAAA,YAAA,CAEjG,CACR,CACR,EAEA,IAAI,CAAC,gBAAgB,EAAE,CACpB,CACP;QAED,QACEA,OAAA,CAACE,UAAI,EAAA,EAAA,eAAA,EACY,IAAI,CAAC,QAAQ,GAAG,MAAM,GAAG,IAAI,EAC5C,EAAE,EAAE,IAAI,CAAC,WAAW,EACpB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,OAAO,EAAE,IAAI,CAAC,OAAO,EAAA,EAErBF,OAAC,CAAA,cAAc,oBAAK,UAAU,EAAE,GAC7B,OAAO,CACO,CACZ;;;;;;;;"}
|
|
@@ -2,31 +2,133 @@
|
|
|
2
2
|
|
|
3
3
|
var index = require('./index-g-uSeICs.js');
|
|
4
4
|
|
|
5
|
-
const pdsModalContentCss = "pds-modal-content{display:block;-ms-flex:1 1 auto;flex:1 1 auto;
|
|
5
|
+
const pdsModalContentCss = "pds-modal-content{display:block;-ms-flex:1 1 auto;flex:1 1 auto;width:100%}pds-modal-content:has(.pds-modal-content.pds-modal-content--border-none){border:0}pds-modal-content:has(.pds-modal-content.pds-modal-content--border-both){-webkit-border-after:1px solid var(--pine-color-grey-200);border-block-end:1px solid var(--pine-color-grey-200);-webkit-border-before:1px solid var(--pine-color-grey-200);border-block-start:1px solid var(--pine-color-grey-200)}pds-modal-content:has(.pds-modal-content.pds-modal-content--border-top){-webkit-border-before:1px solid var(--pine-color-grey-200);border-block-start:1px solid var(--pine-color-grey-200)}pds-modal-content:has(.pds-modal-content.pds-modal-content--border-bottom){-webkit-border-after:1px solid var(--pine-color-grey-200);border-block-end:1px solid var(--pine-color-grey-200)}.pds-modal-content{display:block;-ms-flex:1 1 auto;flex:1 1 auto;min-height:0;width:100%}";
|
|
6
6
|
|
|
7
7
|
const PdsModalContent = class {
|
|
8
8
|
constructor(hostRef) {
|
|
9
9
|
index.registerInstance(this, hostRef);
|
|
10
10
|
/**
|
|
11
|
-
* The border style for the content area.
|
|
11
|
+
* The border style for the content area. When not explicitly set, automatically determined based on scroll state.
|
|
12
12
|
* @default 'none'
|
|
13
13
|
*/
|
|
14
14
|
this.border = 'none';
|
|
15
|
-
this.contentMaxHeight = '
|
|
15
|
+
this.contentMaxHeight = 'none';
|
|
16
|
+
/**
|
|
17
|
+
* Tracks whether the border prop was explicitly set by the user
|
|
18
|
+
*/
|
|
19
|
+
this.userSetBorder = false;
|
|
20
|
+
}
|
|
21
|
+
componentWillLoad() {
|
|
22
|
+
// Check if border was explicitly set via attribute or property
|
|
23
|
+
const borderAttr = this.el.getAttribute('border');
|
|
24
|
+
const hasBorderAttribute = borderAttr !== null;
|
|
25
|
+
// If border attribute exists or border prop is not the default, user set it
|
|
26
|
+
this.userSetBorder = hasBorderAttribute || this.border !== 'none';
|
|
16
27
|
}
|
|
17
28
|
componentDidLoad() {
|
|
18
|
-
const slotContent = this.el.firstElementChild;
|
|
19
|
-
const isScrollable = slotContent.scrollHeight > slotContent.clientHeight;
|
|
20
|
-
this.border = isScrollable ? 'both' : 'none';
|
|
21
29
|
this.calculateMaxHeight();
|
|
22
|
-
|
|
30
|
+
// Set up resize listener
|
|
31
|
+
window.addEventListener('resize', this.handleResize.bind(this));
|
|
32
|
+
// Only set up scroll listener for border updates if borders are managed automatically
|
|
33
|
+
if (!this.userSetBorder) {
|
|
34
|
+
setTimeout(() => {
|
|
35
|
+
// The scroll happens on the component element itself (this.el), not the inner div
|
|
36
|
+
console.log('Setting up scroll listener on component element:', this.el);
|
|
37
|
+
this.el.addEventListener('scroll', this.handleScroll.bind(this));
|
|
38
|
+
// Initial border update after everything is set up
|
|
39
|
+
setTimeout(() => this.updateBorders(), 100);
|
|
40
|
+
}, 100);
|
|
41
|
+
}
|
|
23
42
|
}
|
|
24
43
|
disconnectedCallback() {
|
|
25
|
-
window.removeEventListener('resize', this.
|
|
44
|
+
window.removeEventListener('resize', this.handleResize.bind(this));
|
|
45
|
+
// Clean up scroll listener only if it was set up
|
|
46
|
+
if (!this.userSetBorder) {
|
|
47
|
+
this.el.removeEventListener('scroll', this.handleScroll.bind(this));
|
|
48
|
+
}
|
|
26
49
|
if (this.mutationObserver) {
|
|
27
50
|
this.mutationObserver.disconnect();
|
|
28
51
|
}
|
|
29
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Handle scroll events
|
|
55
|
+
*/
|
|
56
|
+
handleScroll() {
|
|
57
|
+
console.log('Scroll event fired!');
|
|
58
|
+
this.updateBorders();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Handle resize events
|
|
62
|
+
*/
|
|
63
|
+
handleResize() {
|
|
64
|
+
this.calculateMaxHeight();
|
|
65
|
+
// Update borders after resize as content scrollability might change
|
|
66
|
+
setTimeout(() => this.updateBorders(), 50);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Updates border visibility based on scroll state (only if not user-defined)
|
|
70
|
+
*/
|
|
71
|
+
updateBorders() {
|
|
72
|
+
// If user explicitly set a border value, don't override it
|
|
73
|
+
if (this.userSetBorder) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
// Find the modal element (parent of this component)
|
|
77
|
+
const modalElement = this.el.closest('pds-modal');
|
|
78
|
+
if (!modalElement)
|
|
79
|
+
return;
|
|
80
|
+
// Only apply border logic if modal is scrollable
|
|
81
|
+
const isModalScrollable = modalElement.scrollable !== false;
|
|
82
|
+
if (!isModalScrollable) {
|
|
83
|
+
this.border = 'none';
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
// The scrollable element is the component itself (this.el), not the inner div
|
|
87
|
+
const scrollableElement = this.el;
|
|
88
|
+
// Check if content is actually scrollable
|
|
89
|
+
const isContentScrollable = scrollableElement.scrollHeight > scrollableElement.clientHeight;
|
|
90
|
+
if (!isContentScrollable) {
|
|
91
|
+
this.border = 'none';
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
// Determine border position based on scroll position
|
|
95
|
+
const { scrollTop, scrollHeight, clientHeight } = scrollableElement;
|
|
96
|
+
const scrollBottom = scrollTop + clientHeight;
|
|
97
|
+
// More generous tolerance for scroll detection (3px instead of 1px)
|
|
98
|
+
const tolerance = 3;
|
|
99
|
+
const isAtTop = scrollTop <= tolerance;
|
|
100
|
+
const isAtBottom = scrollBottom >= scrollHeight - tolerance;
|
|
101
|
+
// Debug logging (can be removed later)
|
|
102
|
+
console.log('Border Debug:', {
|
|
103
|
+
scrollTop,
|
|
104
|
+
scrollHeight,
|
|
105
|
+
clientHeight,
|
|
106
|
+
scrollBottom,
|
|
107
|
+
isAtTop,
|
|
108
|
+
isAtBottom,
|
|
109
|
+
currentBorder: this.border
|
|
110
|
+
});
|
|
111
|
+
if (isAtTop && isAtBottom) {
|
|
112
|
+
// Content fits exactly, no borders needed
|
|
113
|
+
this.border = 'none';
|
|
114
|
+
console.log('Content fits exactly, no borders needed');
|
|
115
|
+
}
|
|
116
|
+
else if (isAtTop && !isAtBottom) {
|
|
117
|
+
// At top, show bottom border only
|
|
118
|
+
this.border = 'bottom';
|
|
119
|
+
console.log('At top, show bottom border only');
|
|
120
|
+
}
|
|
121
|
+
else if (!isAtTop && isAtBottom) {
|
|
122
|
+
// At bottom, show top border only
|
|
123
|
+
this.border = 'top';
|
|
124
|
+
console.log('At bottom, show top border only');
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
// In middle, show both borders
|
|
128
|
+
this.border = 'both';
|
|
129
|
+
console.log('In middle, show both borders');
|
|
130
|
+
}
|
|
131
|
+
}
|
|
30
132
|
/**
|
|
31
133
|
* Calculates the max-height based on header and footer heights
|
|
32
134
|
*/
|
|
@@ -35,7 +137,18 @@ const PdsModalContent = class {
|
|
|
35
137
|
const modalElement = this.el.closest('pds-modal');
|
|
36
138
|
if (!modalElement)
|
|
37
139
|
return;
|
|
140
|
+
// Check if the parent modal is scrollable
|
|
141
|
+
const isScrollable = modalElement.scrollable !== false;
|
|
38
142
|
setTimeout(() => {
|
|
143
|
+
// If modal is not scrollable, don't apply max-height constraints
|
|
144
|
+
if (!isScrollable) {
|
|
145
|
+
this.contentMaxHeight = 'none';
|
|
146
|
+
const contentElement = this.el.querySelector('.pds-modal-content');
|
|
147
|
+
if (contentElement) {
|
|
148
|
+
contentElement.style.maxHeight = 'none';
|
|
149
|
+
}
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
39
152
|
// Find header and footer elements
|
|
40
153
|
const headerElement = modalElement.querySelector('pds-modal-header');
|
|
41
154
|
const footerElement = modalElement.querySelector('pds-modal-footer');
|
|
@@ -60,8 +173,10 @@ const PdsModalContent = class {
|
|
|
60
173
|
}
|
|
61
174
|
}
|
|
62
175
|
else {
|
|
63
|
-
this.contentMaxHeight = '
|
|
176
|
+
this.contentMaxHeight = 'none'; // Default fallback
|
|
64
177
|
}
|
|
178
|
+
// Update borders after height calculations with longer delay
|
|
179
|
+
setTimeout(() => this.updateBorders(), 150);
|
|
65
180
|
}, 100); // Delay to ensure DOM is fully rendered
|
|
66
181
|
// Set up mutation observer if not already done
|
|
67
182
|
if (!this.mutationObserver && modalElement) {
|
|
@@ -78,10 +193,12 @@ const PdsModalContent = class {
|
|
|
78
193
|
}
|
|
79
194
|
}
|
|
80
195
|
render() {
|
|
81
|
-
|
|
196
|
+
// Only apply max-height style if it's not 'none'
|
|
197
|
+
const styleObj = this.contentMaxHeight !== 'none' ? { maxHeight: this.contentMaxHeight } : {};
|
|
198
|
+
return (index.h(index.Host, { key: '545e18de51a427ac59a33dece5054ec700163ae5' }, index.h("div", { key: '3e418670869f63d0251348f7787bca60e0057c91', class: {
|
|
82
199
|
'pds-modal-content': true,
|
|
83
200
|
[`pds-modal-content--border-${this.border}`]: true
|
|
84
|
-
}, style:
|
|
201
|
+
}, style: styleObj, tabindex: "-1" }, index.h("slot", { key: 'f312a2ff4b3249637d50536e12cf8ad94db5eff2' }))));
|
|
85
202
|
}
|
|
86
203
|
get el() { return index.getElement(this); }
|
|
87
204
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"pds-modal-content.entry.cjs.js","mappings":";;;;AAAA,MAAM,kBAAkB,GAAG,k3BAAk3B;;MCYh4B,eAAe,GAAA,MAAA;AAJ5B,IAAA,WAAA,CAAA,OAAA,EAAA;;AAQE;;;AAGG;AACsB,QAAA,IAAM,CAAA,MAAA,GAAuC,MAAM;AAEnE,QAAA,IAAgB,CAAA,gBAAA,GAAW,MAAM;AAgG3C;IA9FC,gBAAgB,GAAA;AACd,QAAA,MAAM,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,iBAAgC;QAC5D,MAAM,YAAY,GAAG,WAAW,CAAC,YAAY,GAAG,WAAW,CAAC,YAAY;AACxE,QAAA,IAAI,CAAC,MAAM,GAAG,YAAY,GAAG,MAAM,GAAG,MAAM;QAE5C,IAAI,CAAC,kBAAkB,EAAE;AAEzB,QAAA,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;IAGvE,oBAAoB,GAAA;AAClB,QAAA,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAExE,QAAA,IAAI,IAAI,CAAC,gBAAgB,EAAE;AACzB,YAAA,IAAI,CAAC,gBAAgB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CAAC;;AAGF,YAAA,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,YAAY,EAAE;AAC1C,gBAAA,SAAS,EAAE,IAAI;AACf,gBAAA,OAAO,EAAE,IAAI;AACb,gBAAA,UAAU,EAAE,IAAI;AAChB,gBAAA,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO;AACnC,aAAA,CAAC;;;IAGN,MAAM,GAAA;QACJ,QACEA,QAACC,UAAI,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EACHD,OAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EACE,KAAK,EAAE;AACL,gBAAA,mBAAmB,EAAE,IAAI;AACzB,gBAAA,CAAC,6BAA6B,IAAI,CAAC,MAAM,CAAE,CAAA,GAAG;AAC/C,aAAA,EACD,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,gBAAgB,EAAE,EAC3C,QAAQ,EAAC,IAAI,EAAA,EAEbA,OAAa,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAA,CACT,CACD;;;;;;;;","names":["h","Host"],"sources":["src/components/pds-modal/pds-modal-content/pds-modal-content.scss?tag=pds-modal-content","src/components/pds-modal/pds-modal-content/pds-modal-content.tsx"],"sourcesContent":["pds-modal-content {\n display: block;\n flex: 1 1 auto;\n overflow-y: auto;\n width: 100%;\n\n &:has(.pds-modal-content--border-none) {\n border: 0;\n }\n\n &:has(.pds-modal-content--border-both) {\n border-block-end: 1px solid var(--pine-color-grey-200);\n border-block-start: 1px solid var(--pine-color-grey-200);\n }\n\n &:has(.pds-modal-content--border-top) {\n border-block-start: 1px solid var(--pine-color-grey-200);\n }\n\n &:has(.pds-modal-content--border-bottom) {\n border-block-end: 1px solid var(--pine-color-grey-200);\n }\n}\n\n.pds-modal-content {\n display: block;\n flex: 1 1 auto;\n // Max height is set via inline styles based on header and footer heights\n min-height: 0;\n overflow-y: auto;\n width: 100%;\n\n}\n","import { Component, h, Host, Prop, Element, State } from '@stencil/core';\n\ndeclare global {\n interface HTMLPdsModalContentElement extends HTMLElement {\n border: 'none' | 'both';\n }\n}\n\n@Component({\n tag: 'pds-modal-content',\n styleUrl: 'pds-modal-content.scss',\n})\nexport class PdsModalContent {\n\n @Element() el: HTMLPdsModalContentElement;\n\n /**\n * The border style for the content area. Automatically set based on available space of the modal content.\n * @default 'none'\n */\n @Prop({ reflect: true }) border: 'none' | 'both' | 'top' | 'bottom' = 'none';\n\n @State() contentMaxHeight: string = '60vh';\n\n componentDidLoad() {\n const slotContent = this.el.firstElementChild as HTMLElement;\n const isScrollable = slotContent.scrollHeight > slotContent.clientHeight;\n this.border = isScrollable ? 'both' : 'none';\n\n this.calculateMaxHeight();\n\n window.addEventListener('resize', this.calculateMaxHeight.bind(this));\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.calculateMaxHeight.bind(this));\n\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n }\n }\n\n /**\n * Calculates the max-height based on header and footer heights\n */\n private mutationObserver: MutationObserver;\n\n /**\n * Calculates the max-height based on header and footer heights\n */\n private calculateMaxHeight() {\n // Find the modal element (parent of this component)\n const modalElement = this.el.closest('pds-modal');\n if (!modalElement) return;\n\n setTimeout(() => {\n // Find header and footer elements\n const headerElement = modalElement.querySelector('pds-modal-header');\n const footerElement = modalElement.querySelector('pds-modal-footer');\n\n // Get header and footer heights\n const headerHeight = headerElement ? headerElement.offsetHeight : 0;\n const footerHeight = footerElement ? footerElement.offsetHeight : 0;\n\n // Set the max-height as a calculation\n if (headerHeight > 0 || footerHeight > 0) {\n // Calculate the available height by subtracting:\n // 1. Header and footer heights\n // 2. Modal padding (48px)\n // 3. Additional space for modal positioning (6vh)\n // 4. Extra adjustment for perfect fit (50px)\n const viewportAdjustment = Math.round(window.innerHeight * 0.06); // 6vh approximation\n const totalReduction = headerHeight + footerHeight + 48 + viewportAdjustment + 50;\n\n // Set the content max height\n this.contentMaxHeight = `calc(100vh - ${totalReduction}px)`;\n\n // Apply the style directly to ensure it takes effect\n const contentElement = this.el.querySelector('.pds-modal-content') as HTMLElement;\n if (contentElement) {\n contentElement.style.maxHeight = this.contentMaxHeight;\n }\n } else {\n this.contentMaxHeight = '60vh'; // Default fallback\n }\n }, 100); // Delay to ensure DOM is fully rendered\n\n // Set up mutation observer if not already done\n if (!this.mutationObserver && modalElement) {\n this.mutationObserver = new MutationObserver(() => {\n this.calculateMaxHeight();\n });\n\n // Observe changes to the modal's children\n this.mutationObserver.observe(modalElement, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['style', 'class']\n });\n }\n }\n render() {\n return (\n <Host>\n <div\n class={{\n 'pds-modal-content': true,\n [`pds-modal-content--border-${this.border}`]: true\n }}\n style={{ maxHeight: this.contentMaxHeight }}\n tabindex=\"-1\"\n >\n <slot></slot>\n </div>\n </Host>\n );\n }\n}"],"version":3}
|
|
1
|
+
{"file":"pds-modal-content.entry.cjs.js","mappings":";;;;AAAA,MAAM,kBAAkB,GAAG,05BAA05B;;MCYx6B,eAAe,GAAA,MAAA;AAJ5B,IAAA,WAAA,CAAA,OAAA,EAAA;;AAQE;;;AAGG;AACsB,QAAA,IAAM,CAAA,MAAA,GAAuC,MAAM;AAEnE,QAAA,IAAgB,CAAA,gBAAA,GAAW,MAAM;AAE1C;;AAEG;AACK,QAAA,IAAa,CAAA,aAAA,GAAG,KAAK;AAgO9B;IA9NC,iBAAiB,GAAA;;QAEf,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC;AACjD,QAAA,MAAM,kBAAkB,GAAG,UAAU,KAAK,IAAI;;QAG9C,IAAI,CAAC,aAAa,GAAG,kBAAkB,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM;;IAGnE,gBAAgB,GAAA;QACd,IAAI,CAAC,kBAAkB,EAAE;;AAGzB,QAAA,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,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-content","src/components/pds-modal/pds-modal-content/pds-modal-content.tsx"],"sourcesContent":["pds-modal-content {\n display: block;\n flex: 1 1 auto;\n width: 100%;\n\n &:has(.pds-modal-content.pds-modal-content--border-none) {\n border: 0;\n }\n\n &:has(.pds-modal-content.pds-modal-content--border-both) {\n border-block-end: 1px solid var(--pine-color-grey-200);\n border-block-start: 1px solid var(--pine-color-grey-200);\n }\n\n &:has(.pds-modal-content.pds-modal-content--border-top) {\n border-block-start: 1px solid var(--pine-color-grey-200);\n }\n\n &:has(.pds-modal-content.pds-modal-content--border-bottom) {\n border-block-end: 1px solid var(--pine-color-grey-200);\n }\n}\n\n.pds-modal-content {\n display: block;\n flex: 1 1 auto;\n // Max height is set via inline styles based on header and footer heights\n min-height: 0;\n width: 100%;\n\n}\n","import { Component, h, Host, Prop, Element, State } from '@stencil/core';\n\ndeclare global {\n interface HTMLPdsModalContentElement extends HTMLElement {\n border: 'none' | 'both';\n }\n}\n\n@Component({\n tag: 'pds-modal-content',\n styleUrl: 'pds-modal-content.scss',\n})\nexport class PdsModalContent {\n\n @Element() el: HTMLPdsModalContentElement;\n\n /**\n * The border style for the content area. When not explicitly set, automatically determined based on scroll state.\n * @default 'none'\n */\n @Prop({ reflect: true }) border: 'none' | 'both' | 'top' | 'bottom' = 'none';\n\n @State() contentMaxHeight: string = 'none';\n\n /**\n * Tracks whether the border prop was explicitly set by the user\n */\n private userSetBorder = false;\n\n componentWillLoad() {\n // Check if border was explicitly set via attribute or property\n const borderAttr = this.el.getAttribute('border');\n const hasBorderAttribute = borderAttr !== null;\n\n // If border attribute exists or border prop is not the default, user set it\n this.userSetBorder = hasBorderAttribute || this.border !== 'none';\n }\n\n componentDidLoad() {\n this.calculateMaxHeight();\n\n // Set up resize listener\n window.addEventListener('resize', this.handleResize.bind(this));\n\n // Only set up scroll listener for border updates if borders are managed automatically\n if (!this.userSetBorder) {\n setTimeout(() => {\n // The scroll happens on the component element itself (this.el), not the inner div\n console.log('Setting up scroll listener on component element:', this.el);\n this.el.addEventListener('scroll', this.handleScroll.bind(this));\n // Initial border update after everything is set up\n setTimeout(() => this.updateBorders(), 100);\n }, 100);\n }\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.handleResize.bind(this));\n\n // Clean up scroll listener only if it was set up\n if (!this.userSetBorder) {\n this.el.removeEventListener('scroll', this.handleScroll.bind(this));\n }\n\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n }\n }\n\n /**\n * Handle scroll events\n */\n private handleScroll() {\n console.log('Scroll event fired!');\n this.updateBorders();\n }\n\n /**\n * Handle resize events\n */\n private handleResize() {\n this.calculateMaxHeight();\n // Update borders after resize as content scrollability might change\n setTimeout(() => this.updateBorders(), 50);\n }\n\n /**\n * Calculates the max-height based on header and footer heights\n */\n private mutationObserver: MutationObserver;\n\n /**\n * Updates border visibility based on scroll state (only if not user-defined)\n */\n private updateBorders() {\n // If user explicitly set a border value, don't override it\n if (this.userSetBorder) {\n return;\n }\n\n // Find the modal element (parent of this component)\n const modalElement = this.el.closest('pds-modal');\n if (!modalElement) return;\n\n // Only apply border logic if modal is scrollable\n const isModalScrollable = modalElement.scrollable !== false;\n if (!isModalScrollable) {\n this.border = 'none';\n return;\n }\n\n // The scrollable element is the component itself (this.el), not the inner div\n const scrollableElement = this.el;\n\n // Check if content is actually scrollable\n const isContentScrollable = scrollableElement.scrollHeight > scrollableElement.clientHeight;\n\n if (!isContentScrollable) {\n this.border = 'none';\n return;\n }\n\n // Determine border position based on scroll position\n const { scrollTop, scrollHeight, clientHeight } = scrollableElement;\n const scrollBottom = scrollTop + clientHeight;\n\n // More generous tolerance for scroll detection (3px instead of 1px)\n const tolerance = 3;\n const isAtTop = scrollTop <= tolerance;\n const isAtBottom = scrollBottom >= scrollHeight - tolerance;\n\n // Debug logging (can be removed later)\n console.log('Border Debug:', {\n scrollTop,\n scrollHeight,\n clientHeight,\n scrollBottom,\n isAtTop,\n isAtBottom,\n currentBorder: this.border\n });\n\n if (isAtTop && isAtBottom) {\n // Content fits exactly, no borders needed\n this.border = 'none';\n console.log('Content fits exactly, no borders needed');\n } else if (isAtTop && !isAtBottom) {\n // At top, show bottom border only\n this.border = 'bottom';\n console.log('At top, show bottom border only');\n } else if (!isAtTop && isAtBottom) {\n // At bottom, show top border only\n this.border = 'top';\n console.log('At bottom, show top border only');\n } else {\n // In middle, show both borders\n this.border = 'both';\n console.log('In middle, show both borders');\n }\n }\n\n /**\n * Calculates the max-height based on header and footer heights\n */\n private calculateMaxHeight() {\n // Find the modal element (parent of this component)\n const modalElement = this.el.closest('pds-modal');\n if (!modalElement) return;\n\n // Check if the parent modal is scrollable\n const isScrollable = modalElement.scrollable !== false;\n\n setTimeout(() => {\n // If modal is not scrollable, don't apply max-height constraints\n if (!isScrollable) {\n this.contentMaxHeight = 'none';\n const contentElement = this.el.querySelector('.pds-modal-content') as HTMLElement;\n if (contentElement) {\n contentElement.style.maxHeight = 'none';\n }\n return;\n }\n\n // Find header and footer elements\n const headerElement = modalElement.querySelector('pds-modal-header');\n const footerElement = modalElement.querySelector('pds-modal-footer');\n\n // Get header and footer heights\n const headerHeight = headerElement ? headerElement.offsetHeight : 0;\n const footerHeight = footerElement ? footerElement.offsetHeight : 0;\n\n // Set the max-height as a calculation\n if (headerHeight > 0 || footerHeight > 0) {\n // Calculate the available height by subtracting:\n // 1. Header and footer heights\n // 2. Modal padding (48px)\n // 3. Additional space for modal positioning (6vh)\n // 4. Extra adjustment for perfect fit (50px)\n const viewportAdjustment = Math.round(window.innerHeight * 0.06); // 6vh approximation\n const totalReduction = headerHeight + footerHeight + 48 + viewportAdjustment + 50;\n\n // Set the content max height\n this.contentMaxHeight = `calc(100vh - ${totalReduction}px)`;\n\n // Apply the style directly to ensure it takes effect\n const contentElement = this.el.querySelector('.pds-modal-content') as HTMLElement;\n if (contentElement) {\n contentElement.style.maxHeight = this.contentMaxHeight;\n }\n } else {\n this.contentMaxHeight = 'none'; // Default fallback\n }\n\n // Update borders after height calculations with longer delay\n setTimeout(() => this.updateBorders(), 150);\n }, 100); // Delay to ensure DOM is fully rendered\n\n // Set up mutation observer if not already done\n if (!this.mutationObserver && modalElement) {\n this.mutationObserver = new MutationObserver(() => {\n this.calculateMaxHeight();\n });\n\n // Observe changes to the modal's children\n this.mutationObserver.observe(modalElement, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['style', 'class']\n });\n }\n }\n render() {\n // Only apply max-height style if it's not 'none'\n const styleObj = this.contentMaxHeight !== 'none' ? { maxHeight: this.contentMaxHeight } : {};\n\n return (\n <Host>\n <div\n class={{\n 'pds-modal-content': true,\n [`pds-modal-content--border-${this.border}`]: true\n }}\n style={styleObj}\n tabindex=\"-1\"\n >\n <slot></slot>\n </div>\n </Host>\n );\n }\n}"],"version":3}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds-modal-content.entry.cjs.js","sources":["src/components/pds-modal/pds-modal-content/pds-modal-content.scss?tag=pds-modal-content","src/components/pds-modal/pds-modal-content/pds-modal-content.tsx"],"sourcesContent":["pds-modal-content {\n display: block;\n flex: 1 1 auto;\n overflow-y: auto;\n width: 100%;\n\n &:has(.pds-modal-content--border-none) {\n border: 0;\n }\n\n &:has(.pds-modal-content--border-both) {\n border-block-end: 1px solid var(--pine-color-grey-200);\n border-block-start: 1px solid var(--pine-color-grey-200);\n }\n\n &:has(.pds-modal-content--border-top) {\n border-block-start: 1px solid var(--pine-color-grey-200);\n }\n\n &:has(.pds-modal-content--border-bottom) {\n border-block-end: 1px solid var(--pine-color-grey-200);\n }\n}\n\n.pds-modal-content {\n display: block;\n flex: 1 1 auto;\n // Max height is set via inline styles based on header and footer heights\n min-height: 0;\n overflow-y: auto;\n width: 100%;\n\n}\n","import { Component, h, Host, Prop, Element, State } from '@stencil/core';\n\ndeclare global {\n interface HTMLPdsModalContentElement extends HTMLElement {\n border: 'none' | 'both';\n }\n}\n\n@Component({\n tag: 'pds-modal-content',\n styleUrl: 'pds-modal-content.scss',\n})\nexport class PdsModalContent {\n\n @Element() el: HTMLPdsModalContentElement;\n\n /**\n * The border style for the content area. Automatically set based on available space of the modal content.\n * @default 'none'\n */\n @Prop({ reflect: true }) border: 'none' | 'both' | 'top' | 'bottom' = 'none';\n\n @State() contentMaxHeight: string = '60vh';\n\n componentDidLoad() {\n const slotContent = this.el.firstElementChild as HTMLElement;\n const isScrollable = slotContent.scrollHeight > slotContent.clientHeight;\n this.border = isScrollable ? 'both' : 'none';\n\n this.calculateMaxHeight();\n\n window.addEventListener('resize', this.calculateMaxHeight.bind(this));\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.calculateMaxHeight.bind(this));\n\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n }\n }\n\n /**\n * Calculates the max-height based on header and footer heights\n */\n private mutationObserver: MutationObserver;\n\n /**\n * Calculates the max-height based on header and footer heights\n */\n private calculateMaxHeight() {\n // Find the modal element (parent of this component)\n const modalElement = this.el.closest('pds-modal');\n if (!modalElement) return;\n\n setTimeout(() => {\n // Find header and footer elements\n const headerElement = modalElement.querySelector('pds-modal-header');\n const footerElement = modalElement.querySelector('pds-modal-footer');\n\n // Get header and footer heights\n const headerHeight = headerElement ? headerElement.offsetHeight : 0;\n const footerHeight = footerElement ? footerElement.offsetHeight : 0;\n\n // Set the max-height as a calculation\n if (headerHeight > 0 || footerHeight > 0) {\n // Calculate the available height by subtracting:\n // 1. Header and footer heights\n // 2. Modal padding (48px)\n // 3. Additional space for modal positioning (6vh)\n // 4. Extra adjustment for perfect fit (50px)\n const viewportAdjustment = Math.round(window.innerHeight * 0.06); // 6vh approximation\n const totalReduction = headerHeight + footerHeight + 48 + viewportAdjustment + 50;\n\n // Set the content max height\n this.contentMaxHeight = `calc(100vh - ${totalReduction}px)`;\n\n // Apply the style directly to ensure it takes effect\n const contentElement = this.el.querySelector('.pds-modal-content') as HTMLElement;\n if (contentElement) {\n contentElement.style.maxHeight = this.contentMaxHeight;\n }\n } else {\n this.contentMaxHeight = '60vh'; // Default fallback\n }\n }, 100); // Delay to ensure DOM is fully rendered\n\n // Set up mutation observer if not already done\n if (!this.mutationObserver && modalElement) {\n this.mutationObserver = new MutationObserver(() => {\n this.calculateMaxHeight();\n });\n\n // Observe changes to the modal's children\n this.mutationObserver.observe(modalElement, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['style', 'class']\n });\n }\n }\n render() {\n return (\n <Host>\n <div\n class={{\n 'pds-modal-content': true,\n [`pds-modal-content--border-${this.border}`]: true\n }}\n style={{ maxHeight: this.contentMaxHeight }}\n tabindex=\"-1\"\n >\n <slot></slot>\n </div>\n </Host>\n );\n }\n}"],"names":["h","Host"],"mappings":";;;;AAAA,MAAM,kBAAkB,GAAG,k3BAAk3B;;MCYh4B,eAAe,GAAA,MAAA;AAJ5B,IAAA,WAAA,CAAA,OAAA,EAAA;;AAQE;;;AAGG;AACsB,QAAA,IAAM,CAAA,MAAA,GAAuC,MAAM;AAEnE,QAAA,IAAgB,CAAA,gBAAA,GAAW,MAAM;AAgG3C;IA9FC,gBAAgB,GAAA;AACd,QAAA,MAAM,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,iBAAgC;QAC5D,MAAM,YAAY,GAAG,WAAW,CAAC,YAAY,GAAG,WAAW,CAAC,YAAY;AACxE,QAAA,IAAI,CAAC,MAAM,GAAG,YAAY,GAAG,MAAM,GAAG,MAAM;QAE5C,IAAI,CAAC,kBAAkB,EAAE;AAEzB,QAAA,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;IAGvE,oBAAoB,GAAA;AAClB,QAAA,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAExE,QAAA,IAAI,IAAI,CAAC,gBAAgB,EAAE;AACzB,YAAA,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE;;;AAStC;;AAEG;IACK,kBAA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,OAAO,CAAC,YAAY,EAAE;AAC1C,gBAAA,SAAS,EAAE,IAAI;AACf,gBAAA,OAAO,EAAE,IAAI;AACb,gBAAA,UAAU,EAAE,IAAI;AAChB,gBAAA,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO;AACnC,aAAA,CAAC;;;IAGN,MAAM,GAAA;QACJ,QACEA,QAACC,UAAI,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EACHD,OAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EACE,KAAK,EAAE;AACL,gBAAA,mBAAmB,EAAE,IAAI;AACzB,gBAAA,CAAC,6BAA6B,IAAI,CAAC,MAAM,CAAE,CAAA,GAAG;AAC/C,aAAA,EACD,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,gBAAgB,EAAE,EAC3C,QAAQ,EAAC,IAAI,EAAA,EAEbA,OAAa,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAA,CACT,CACD;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"pds-modal-content.entry.cjs.js","sources":["src/components/pds-modal/pds-modal-content/pds-modal-content.scss?tag=pds-modal-content","src/components/pds-modal/pds-modal-content/pds-modal-content.tsx"],"sourcesContent":["pds-modal-content {\n display: block;\n flex: 1 1 auto;\n width: 100%;\n\n &:has(.pds-modal-content.pds-modal-content--border-none) {\n border: 0;\n }\n\n &:has(.pds-modal-content.pds-modal-content--border-both) {\n border-block-end: 1px solid var(--pine-color-grey-200);\n border-block-start: 1px solid var(--pine-color-grey-200);\n }\n\n &:has(.pds-modal-content.pds-modal-content--border-top) {\n border-block-start: 1px solid var(--pine-color-grey-200);\n }\n\n &:has(.pds-modal-content.pds-modal-content--border-bottom) {\n border-block-end: 1px solid var(--pine-color-grey-200);\n }\n}\n\n.pds-modal-content {\n display: block;\n flex: 1 1 auto;\n // Max height is set via inline styles based on header and footer heights\n min-height: 0;\n width: 100%;\n\n}\n","import { Component, h, Host, Prop, Element, State } from '@stencil/core';\n\ndeclare global {\n interface HTMLPdsModalContentElement extends HTMLElement {\n border: 'none' | 'both';\n }\n}\n\n@Component({\n tag: 'pds-modal-content',\n styleUrl: 'pds-modal-content.scss',\n})\nexport class PdsModalContent {\n\n @Element() el: HTMLPdsModalContentElement;\n\n /**\n * The border style for the content area. When not explicitly set, automatically determined based on scroll state.\n * @default 'none'\n */\n @Prop({ reflect: true }) border: 'none' | 'both' | 'top' | 'bottom' = 'none';\n\n @State() contentMaxHeight: string = 'none';\n\n /**\n * Tracks whether the border prop was explicitly set by the user\n */\n private userSetBorder = false;\n\n componentWillLoad() {\n // Check if border was explicitly set via attribute or property\n const borderAttr = this.el.getAttribute('border');\n const hasBorderAttribute = borderAttr !== null;\n\n // If border attribute exists or border prop is not the default, user set it\n this.userSetBorder = hasBorderAttribute || this.border !== 'none';\n }\n\n componentDidLoad() {\n this.calculateMaxHeight();\n\n // Set up resize listener\n window.addEventListener('resize', this.handleResize.bind(this));\n\n // Only set up scroll listener for border updates if borders are managed automatically\n if (!this.userSetBorder) {\n setTimeout(() => {\n // The scroll happens on the component element itself (this.el), not the inner div\n console.log('Setting up scroll listener on component element:', this.el);\n this.el.addEventListener('scroll', this.handleScroll.bind(this));\n // Initial border update after everything is set up\n setTimeout(() => this.updateBorders(), 100);\n }, 100);\n }\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.handleResize.bind(this));\n\n // Clean up scroll listener only if it was set up\n if (!this.userSetBorder) {\n this.el.removeEventListener('scroll', this.handleScroll.bind(this));\n }\n\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n }\n }\n\n /**\n * Handle scroll events\n */\n private handleScroll() {\n console.log('Scroll event fired!');\n this.updateBorders();\n }\n\n /**\n * Handle resize events\n */\n private handleResize() {\n this.calculateMaxHeight();\n // Update borders after resize as content scrollability might change\n setTimeout(() => this.updateBorders(), 50);\n }\n\n /**\n * Calculates the max-height based on header and footer heights\n */\n private mutationObserver: MutationObserver;\n\n /**\n * Updates border visibility based on scroll state (only if not user-defined)\n */\n private updateBorders() {\n // If user explicitly set a border value, don't override it\n if (this.userSetBorder) {\n return;\n }\n\n // Find the modal element (parent of this component)\n const modalElement = this.el.closest('pds-modal');\n if (!modalElement) return;\n\n // Only apply border logic if modal is scrollable\n const isModalScrollable = modalElement.scrollable !== false;\n if (!isModalScrollable) {\n this.border = 'none';\n return;\n }\n\n // The scrollable element is the component itself (this.el), not the inner div\n const scrollableElement = this.el;\n\n // Check if content is actually scrollable\n const isContentScrollable = scrollableElement.scrollHeight > scrollableElement.clientHeight;\n\n if (!isContentScrollable) {\n this.border = 'none';\n return;\n }\n\n // Determine border position based on scroll position\n const { scrollTop, scrollHeight, clientHeight } = scrollableElement;\n const scrollBottom = scrollTop + clientHeight;\n\n // More generous tolerance for scroll detection (3px instead of 1px)\n const tolerance = 3;\n const isAtTop = scrollTop <= tolerance;\n const isAtBottom = scrollBottom >= scrollHeight - tolerance;\n\n // Debug logging (can be removed later)\n console.log('Border Debug:', {\n scrollTop,\n scrollHeight,\n clientHeight,\n scrollBottom,\n isAtTop,\n isAtBottom,\n currentBorder: this.border\n });\n\n if (isAtTop && isAtBottom) {\n // Content fits exactly, no borders needed\n this.border = 'none';\n console.log('Content fits exactly, no borders needed');\n } else if (isAtTop && !isAtBottom) {\n // At top, show bottom border only\n this.border = 'bottom';\n console.log('At top, show bottom border only');\n } else if (!isAtTop && isAtBottom) {\n // At bottom, show top border only\n this.border = 'top';\n console.log('At bottom, show top border only');\n } else {\n // In middle, show both borders\n this.border = 'both';\n console.log('In middle, show both borders');\n }\n }\n\n /**\n * Calculates the max-height based on header and footer heights\n */\n private calculateMaxHeight() {\n // Find the modal element (parent of this component)\n const modalElement = this.el.closest('pds-modal');\n if (!modalElement) return;\n\n // Check if the parent modal is scrollable\n const isScrollable = modalElement.scrollable !== false;\n\n setTimeout(() => {\n // If modal is not scrollable, don't apply max-height constraints\n if (!isScrollable) {\n this.contentMaxHeight = 'none';\n const contentElement = this.el.querySelector('.pds-modal-content') as HTMLElement;\n if (contentElement) {\n contentElement.style.maxHeight = 'none';\n }\n return;\n }\n\n // Find header and footer elements\n const headerElement = modalElement.querySelector('pds-modal-header');\n const footerElement = modalElement.querySelector('pds-modal-footer');\n\n // Get header and footer heights\n const headerHeight = headerElement ? headerElement.offsetHeight : 0;\n const footerHeight = footerElement ? footerElement.offsetHeight : 0;\n\n // Set the max-height as a calculation\n if (headerHeight > 0 || footerHeight > 0) {\n // Calculate the available height by subtracting:\n // 1. Header and footer heights\n // 2. Modal padding (48px)\n // 3. Additional space for modal positioning (6vh)\n // 4. Extra adjustment for perfect fit (50px)\n const viewportAdjustment = Math.round(window.innerHeight * 0.06); // 6vh approximation\n const totalReduction = headerHeight + footerHeight + 48 + viewportAdjustment + 50;\n\n // Set the content max height\n this.contentMaxHeight = `calc(100vh - ${totalReduction}px)`;\n\n // Apply the style directly to ensure it takes effect\n const contentElement = this.el.querySelector('.pds-modal-content') as HTMLElement;\n if (contentElement) {\n contentElement.style.maxHeight = this.contentMaxHeight;\n }\n } else {\n this.contentMaxHeight = 'none'; // Default fallback\n }\n\n // Update borders after height calculations with longer delay\n setTimeout(() => this.updateBorders(), 150);\n }, 100); // Delay to ensure DOM is fully rendered\n\n // Set up mutation observer if not already done\n if (!this.mutationObserver && modalElement) {\n this.mutationObserver = new MutationObserver(() => {\n this.calculateMaxHeight();\n });\n\n // Observe changes to the modal's children\n this.mutationObserver.observe(modalElement, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['style', 'class']\n });\n }\n }\n render() {\n // Only apply max-height style if it's not 'none'\n const styleObj = this.contentMaxHeight !== 'none' ? { maxHeight: this.contentMaxHeight } : {};\n\n return (\n <Host>\n <div\n class={{\n 'pds-modal-content': true,\n [`pds-modal-content--border-${this.border}`]: true\n }}\n style={styleObj}\n tabindex=\"-1\"\n >\n <slot></slot>\n </div>\n </Host>\n );\n }\n}"],"names":["h","Host"],"mappings":";;;;AAAA,MAAM,kBAAkB,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C,OAAO,EAAE,OAAO;AACnC,aAAA,CAAC;;;IAGN,MAAM,GAAA;;QAEJ,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,KAAK,MAAM,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE;QAE7F,QACEA,QAACC,UAAI,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EACHD,OAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EACE,KAAK,EAAE;AACL,gBAAA,mBAAmB,EAAE,IAAI;AACzB,gBAAA,CAAC,6BAA6B,IAAI,CAAC,MAAM,CAAE,CAAA,GAAG;aAC/C,EACD,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAC,IAAI,EAAA,EAEbA,OAAa,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAA,CACT,CACD;;;;;;;;"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var index = require('./index-g-uSeICs.js');
|
|
4
4
|
|
|
5
|
-
const pdsModalCss = ".pds-modal__backdrop{-ms-flex-align:start;align-items:flex-start;background-color:rgba(0, 0, 0, 0.4);border:0;display:-ms-flexbox;display:flex;height:100%;inset:0;-ms-flex-pack:center;justify-content:center;margin:0;max-height:100%;max-width:100%;opacity:0;padding:0;position:fixed;-webkit-transition:opacity 0.2s ease, visibility 0.2s ease;transition:opacity 0.2s ease, visibility 0.2s ease;visibility:hidden;width:100%;z-index:1000}@supports ((-webkit-backdrop-filter: blur(3px)) or (backdrop-filter: blur(3px))){.pds-modal__backdrop{-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px)}}pds-modal .pds-modal__backdrop{z-index:1001}.pds-modal__backdrop::-webkit-backdrop{background:transparent}.pds-modal__backdrop::-ms-backdrop{background:transparent}.pds-modal__backdrop::backdrop{background:transparent}.pds-modal__backdrop.open{opacity:1;visibility:visible}.pds-modal{background:var(--pine-color-background-container);border-radius:var(--pine-dimension-sm);-webkit-box-shadow:var(--pine-box-shadow-400);box-shadow:var(--pine-box-shadow-400);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;margin:var(--pine-dimension-md);max-height:calc(100vh - (5vh + 96px))
|
|
5
|
+
const pdsModalCss = ".pds-modal__backdrop{-ms-flex-align:start;align-items:flex-start;background-color:rgba(0, 0, 0, 0.4);border:0;display:-ms-flexbox;display:flex;height:100%;inset:0;-ms-flex-pack:center;justify-content:center;margin:0;max-height:100%;max-width:100%;opacity:0;padding:0;position:fixed;-webkit-transition:opacity 0.2s ease, visibility 0.2s ease;transition:opacity 0.2s ease, visibility 0.2s ease;visibility:hidden;width:100%;z-index:1000}@supports ((-webkit-backdrop-filter: blur(3px)) or (backdrop-filter: blur(3px))){.pds-modal__backdrop{-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px)}}pds-modal .pds-modal__backdrop{z-index:1001}.pds-modal__backdrop::-webkit-backdrop{background:transparent}.pds-modal__backdrop::-ms-backdrop{background:transparent}.pds-modal__backdrop::backdrop{background:transparent}.pds-modal__backdrop.open{opacity:1;visibility:visible}.pds-modal{background:var(--pine-color-background-container);border-radius:var(--pine-dimension-sm);-webkit-box-shadow:var(--pine-box-shadow-400);box-shadow:var(--pine-box-shadow-400);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;margin:var(--pine-dimension-md);max-height:none;width:100%}.pds-modal.pds-modal--scrollable{max-height:calc(100vh - (5vh + 96px))}@supports (height: 100dvh){.pds-modal.pds-modal--scrollable{max-height:calc(100dvh - (5dvh + 96px))}}@media (min-width: 992px){.pds-modal{-webkit-margin-before:6vh;margin-block-start:6vh}@supports (height: 100dvh){.pds-modal{-webkit-margin-before:6dvh;margin-block-start:6dvh}}}@media (min-width: 1200px){.pds-modal{-webkit-margin-before:8vh;margin-block-start:8vh}@supports (height: 100dvh){.pds-modal{-webkit-margin-before:8dvh;margin-block-start:8dvh}}}.pds-modal--sm{max-width:520px}.pds-modal--md{max-width:700px}.pds-modal--lg{max-width:900px}.pds-modal--fullscreen{border-radius:0;height:100%;margin:0;max-height:100vh;max-width:100%}@supports (height: 100dvh){.pds-modal--fullscreen{max-height:100dvh}}.pds-modal--fullscreen.pds-modal--scrollable{max-height:100vh}@supports (height: 100dvh){.pds-modal--fullscreen.pds-modal--scrollable{max-height:100dvh}}.pds-modal--fullscreen .pds-modal-content{-ms-flex:1;flex:1}.pds-modal--scrollable pds-modal-content{-webkit-border-after:1px solid transparent;border-block-end:1px solid transparent;-webkit-border-before:1px solid transparent;border-block-start:1px solid transparent;overflow-y:auto}.pds-modal:not(.pds-modal--scrollable) pds-modal-content{overflow-y:visible}";
|
|
6
6
|
|
|
7
7
|
const PdsModal = class {
|
|
8
8
|
constructor(hostRef) {
|
|
@@ -25,6 +25,11 @@ const PdsModal = class {
|
|
|
25
25
|
* @default 'md'
|
|
26
26
|
*/
|
|
27
27
|
this.size = 'md';
|
|
28
|
+
/**
|
|
29
|
+
* Whether the modal content should be scrollable
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
this.scrollable = true;
|
|
28
33
|
/**
|
|
29
34
|
* Stores the list of focusable elements in the modal
|
|
30
35
|
*/
|
|
@@ -235,10 +240,14 @@ const PdsModal = class {
|
|
|
235
240
|
return thisZIndex === maxZIndex;
|
|
236
241
|
}
|
|
237
242
|
render() {
|
|
238
|
-
return (index.h("dialog", { key: '
|
|
243
|
+
return (index.h("dialog", { key: '57daacecb0d85c643c1fe17b98046dcc98f982cb', class: {
|
|
239
244
|
'pds-modal__backdrop': true,
|
|
240
245
|
'open': this.open
|
|
241
|
-
}, "aria-modal": "true", "aria-labelledby": `${this.componentId}-heading`, onClick: this.handleBackdropClick }, index.h("div", { key: '
|
|
246
|
+
}, "aria-modal": "true", "aria-labelledby": `${this.componentId}-heading`, onClick: this.handleBackdropClick }, index.h("div", { key: '9fe239071cb2679dd626bc3cf8fd94abe9c1bee0', class: {
|
|
247
|
+
'pds-modal': true,
|
|
248
|
+
[`pds-modal--${this.size}`]: true,
|
|
249
|
+
'pds-modal--scrollable': this.scrollable
|
|
250
|
+
} }, index.h("slot", { key: '59edffec7f550550a03ce2100eb3aeb2be99902b' }))));
|
|
242
251
|
}
|
|
243
252
|
get el() { return index.getElement(this); }
|
|
244
253
|
static get watchers() { return {
|