@salesforce/design-system-react 11.0.0-alpha.7 → 11.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/color-picker/color-picker.cjs +1 -1
- package/dist/cjs/components/color-picker/color-picker.cjs.map +1 -1
- package/dist/cjs/components/combobox/combobox.cjs +1 -1
- package/dist/cjs/components/combobox/combobox.cjs.map +1 -1
- package/dist/cjs/components/filter/filter.cjs +1 -1
- package/dist/cjs/components/filter/filter.cjs.map +1 -1
- package/dist/cjs/components/modal/check-props.cjs +2 -0
- package/dist/cjs/components/modal/check-props.cjs.map +1 -0
- package/dist/cjs/components/modal/component.cjs +2 -0
- package/dist/cjs/components/modal/component.cjs.map +1 -0
- package/dist/cjs/components/modal/index.cjs +1 -1
- package/dist/cjs/components/modal/index.cjs.map +1 -1
- package/dist/cjs/components/popover/component.cjs +2 -0
- package/dist/cjs/components/popover/component.cjs.map +1 -0
- package/dist/cjs/components/popover/edit-dialog.cjs +1 -1
- package/dist/cjs/components/popover/edit-dialog.cjs.map +1 -1
- package/dist/cjs/components/popover/popover.cjs +1 -1
- package/dist/cjs/components/popover/popover.cjs.map +1 -1
- package/dist/cjs/components/slider/check-props.cjs +1 -1
- package/dist/cjs/components/slider/check-props.cjs.map +1 -1
- package/dist/cjs/components/slider/index.cjs +1 -1
- package/dist/cjs/components/slider/index.cjs.map +1 -1
- package/dist/cjs/components/spinner/check-props.cjs +2 -0
- package/dist/cjs/components/spinner/check-props.cjs.map +1 -0
- package/dist/cjs/components/spinner/component.cjs +2 -0
- package/dist/cjs/components/spinner/component.cjs.map +1 -0
- package/dist/cjs/components/spinner/index.cjs +1 -1
- package/dist/cjs/components/spinner/index.cjs.map +1 -1
- package/dist/cjs/components/tree/check-props.cjs +1 -1
- package/dist/cjs/components/tree/check-props.cjs.map +1 -1
- package/dist/cjs/components/tree/tree.cjs +1 -1
- package/dist/cjs/components/tree/tree.cjs.map +1 -1
- package/dist/cjs/components/vertical-navigation/index.cjs +1 -1
- package/dist/cjs/components/vertical-navigation/index.cjs.map +1 -1
- package/dist/cjs/components/welcome-mat/index.cjs +1 -1
- package/dist/cjs/components/welcome-mat/index.cjs.map +1 -1
- package/dist/es/components/color-picker/color-picker.js +1 -1
- package/dist/es/components/color-picker/color-picker.js.map +1 -1
- package/dist/es/components/combobox/combobox.js +2 -2
- package/dist/es/components/combobox/combobox.js.map +1 -1
- package/dist/es/components/filter/filter.js +1 -1
- package/dist/es/components/filter/filter.js.map +1 -1
- package/dist/es/components/modal/check-props.js +22 -0
- package/dist/es/components/modal/check-props.js.map +1 -0
- package/dist/es/components/modal/component.js +35 -0
- package/dist/es/components/modal/component.js.map +1 -0
- package/dist/es/components/modal/index.js +118 -104
- package/dist/es/components/modal/index.js.map +1 -1
- package/dist/es/components/popover/component.js +59 -0
- package/dist/es/components/popover/component.js.map +1 -0
- package/dist/es/components/popover/edit-dialog.js +1 -1
- package/dist/es/components/popover/edit-dialog.js.map +1 -1
- package/dist/es/components/popover/popover.js +235 -191
- package/dist/es/components/popover/popover.js.map +1 -1
- package/dist/es/components/slider/check-props.js +1 -1
- package/dist/es/components/slider/check-props.js.map +1 -1
- package/dist/es/components/slider/index.js +63 -60
- package/dist/es/components/slider/index.js.map +1 -1
- package/dist/es/components/spinner/check-props.js +13 -0
- package/dist/es/components/spinner/check-props.js.map +1 -0
- package/dist/es/components/spinner/component.js +17 -0
- package/dist/es/components/spinner/component.js.map +1 -0
- package/dist/es/components/spinner/index.js +43 -29
- package/dist/es/components/spinner/index.js.map +1 -1
- package/dist/es/components/tree/check-props.js +1 -1
- package/dist/es/components/tree/check-props.js.map +1 -1
- package/dist/es/components/tree/tree.js +79 -73
- package/dist/es/components/tree/tree.js.map +1 -1
- package/dist/es/components/vertical-navigation/index.js +17 -16
- package/dist/es/components/vertical-navigation/index.js.map +1 -1
- package/dist/es/components/welcome-mat/index.js +51 -50
- package/dist/es/components/welcome-mat/index.js.map +1 -1
- package/dist/types/components/color-picker/color-picker.d.ts.map +1 -1
- package/dist/types/components/modal/check-props.d.ts +3 -0
- package/dist/types/components/modal/check-props.d.ts.map +1 -0
- package/dist/types/components/modal/index.d.ts +21 -13
- package/dist/types/components/modal/index.d.ts.map +1 -1
- package/dist/types/components/popover/popover.d.ts +24 -14
- package/dist/types/components/popover/popover.d.ts.map +1 -1
- package/dist/types/components/slider/check-props.d.ts.map +1 -1
- package/dist/types/components/slider/index.d.ts +9 -7
- package/dist/types/components/slider/index.d.ts.map +1 -1
- package/dist/types/components/spinner/check-props.d.ts +3 -0
- package/dist/types/components/spinner/check-props.d.ts.map +1 -0
- package/dist/types/components/spinner/index.d.ts +18 -9
- package/dist/types/components/spinner/index.d.ts.map +1 -1
- package/dist/types/components/tree/check-props.d.ts.map +1 -1
- package/dist/types/components/tree/tree.d.ts +8 -4
- package/dist/types/components/tree/tree.d.ts.map +1 -1
- package/dist/types/components/vertical-navigation/index.d.ts +7 -7
- package/dist/types/components/vertical-navigation/index.d.ts.map +1 -1
- package/dist/types/components/welcome-mat/index.d.ts +5 -6
- package/dist/types/components/welcome-mat/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/modal/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n// Implements the [Modal design pattern](https://lightningdesignsystem.com/components/modals/) in React.\n\nimport React, {\n\tuseState,\n\tuseEffect,\n\tuseCallback,\n\tuseMemo,\n\tuseRef,\n\tCSSProperties,\n\tReactNode,\n\tMouseEvent,\n\tKeyboardEvent,\n} from 'react';\nimport classNames from 'classnames';\nimport ReactModal from 'react-modal';\n\nimport checkAppElementIsSet from '../../utilities/warning/check-app-element-set';\nimport Button from '../button';\nimport { MODAL } from '../../utilities/constants';\nimport generateId from '../../utilities/generate-id';\n\nconst documentDefined = typeof document !== 'undefined';\nconst windowDefined = typeof window !== 'undefined';\n\n// Types\nexport type ModalAlign = 'top' | 'center';\nexport type ModalSize = 'small' | 'medium' | 'large';\nexport type ModalPrompt =\n\t'success' | 'warning' | 'error' | 'wrench' | 'offline' | 'info';\n\nexport interface ModalAssistiveText {\n\t/** This is a visually hidden label for the dialog. If not provided, `heading` is used. */\n\tdialogLabel?: string;\n\t/** This describes which node labels the dialog. If not provided and dialogLabel is unavailable, `id` is used. */\n\tdialogLabelledBy?: string;\n\t/** This is a visually hidden label for the close button. */\n\tcloseButton?: string;\n}\n\n/**\n * What caused a Modal close request:\n * - `'close-button'`: the header close button was clicked\n * - `'escape'`: the Escape key was pressed\n * - `'click-outside'`: a click landed outside the modal container (on the backdrop area)\n */\nexport type ModalRequestCloseTrigger =\n\t'close-button' | 'escape' | 'click-outside';\n\n/**\n * Data passed to `onRequestClose`\n */\nexport interface ModalRequestCloseData {\n\t/** What caused the close request */\n\ttrigger: ModalRequestCloseTrigger;\n}\n\n/**\n * Event passed to `onRequestClose`: the click (close button / outside click) or\n * keydown (Escape) that caused the request\n */\nexport type ModalRequestCloseEvent = MouseEvent | KeyboardEvent;\n\nexport interface ModalProps {\n\t/** Vertical alignment of Modal. */\n\talign?: ModalAlign;\n\t/** Boolean indicating if the appElement should be hidden. */\n\tariaHideApp?: boolean;\n\t/** Assistive text for accessibility. */\n\tassistiveText?: ModalAssistiveText;\n\t/** Modal content. */\n\tchildren: ReactNode;\n\t/** Custom CSS classes for the modal `section` node. */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Custom CSS classes for the modal's container. */\n\tcontainerClassName?: string | string[] | Record<string, boolean>;\n\t/** Custom CSS classes for the modal's body. */\n\tcontentClassName?: string | string[] | Record<string, boolean>;\n\t/** Custom styles for the modal's body. */\n\tcontentStyle?: CSSProperties;\n\t/** If true, modal footer buttons render left and right. */\n\tdirectional?: boolean;\n\t/** If true, Modals cannot be dismissed by clicking on the close icon or pressing esc key. */\n\tdisableClose?: boolean;\n\t/** If true, Modals can be dismissed by clicking outside of modal. If unspecified, defaults to !disableClose. */\n\tdismissOnClickOutside?: boolean;\n\t/**\n\t * Callback to fire when the Modal requests to be dismissed. Receives the triggering\n\t * click or keydown event and `data.trigger`: `'close-button'`, `'escape'`, or `'click-outside'`.\n\t * Not called when `disableClose` (or `dismissOnClickOutside: false` for outside clicks) prevents it.\n\t */\n\tonRequestClose?: (\n\t\tevent: ModalRequestCloseEvent,\n\t\tdata: ModalRequestCloseData\n\t) => void;\n\t/** Modal footer content, typically buttons. */\n\tfooter?: ReactNode | ReactNode[];\n\t/** Custom CSS classes for the footer. */\n\tfooterClassName?: string | string[] | Record<string, boolean>;\n\t/** Allows for a custom modal header that does not scroll with modal content. */\n\theader?: ReactNode;\n\t/** Adds CSS classes to the container surrounding the modal header. */\n\theaderClassName?: string | string[] | Record<string, boolean>;\n\t/** Unique identifier for the modal. The id is automatically generated if not provided. */\n\tid?: string;\n\t/** Forces the modal to be open or closed. */\n\tisOpen: boolean;\n\t/** Function whose return value is the mount node to insert the Modal element into. */\n\tparentSelector?: () => HTMLElement;\n\t/** Custom CSS classes for the portal DOM node. */\n\tportalClassName?: string | string[] | Record<string, boolean>;\n\t/** Styles the modal as a prompt. */\n\tprompt?: ModalPrompt;\n\t/** Specifies the modal's width. */\n\tsize?: ModalSize;\n\t/** Content underneath the heading in the modal header. */\n\ttagline?: ReactNode;\n\t/** Content underneath the title in the modal header. @deprecated Use heading instead */\n\ttitle?: ReactNode;\n\t/** Text heading at the top of a modal. */\n\theading?: ReactNode;\n\t/** Allows adding additional notifications within the modal. */\n\ttoast?: ReactNode;\n\t/** @deprecated Use assistiveText.closeButton instead */\n\tcloseButtonAssistiveText?: string;\n}\n\nconst defaultAssistiveText: ModalAssistiveText = {\n\tdialogLabelledBy: '',\n\tcloseButton: 'Close',\n};\n\n/**\n * The Modal component is used for the Lightning Design System Modal and Notification > Prompt components.\n * The Modal opens from a state change outside of the component itself (pass this state to the `isOpen` prop).\n *\n * By default, `Modal` will add `aria-hidden=true` to the `body` tag, but this disables some assistive technologies.\n * To prevent this you can add the following to your application with `#mount` being the root node of your application:\n * ```\n * import settings from 'design-system-react/components/settings';\n * settings.setAppElement('#mount');\n * ```\n */\nconst Modal: React.FC<ModalProps> = ({\n\talign = 'center',\n\tariaHideApp = true,\n\tassistiveText: assistiveTextProp,\n\tchildren,\n\tclassName,\n\tcontainerClassName,\n\tcontentClassName,\n\tcontentStyle: contentStyleProp,\n\tdirectional,\n\tdisableClose,\n\tdismissOnClickOutside,\n\tonRequestClose,\n\tfooter,\n\tfooterClassName,\n\theader,\n\theaderClassName,\n\tid: idProp,\n\tisOpen,\n\tparentSelector,\n\tportalClassName,\n\tprompt,\n\tsize,\n\ttagline,\n\ttitle,\n\theading,\n\ttoast,\n\tcloseButtonAssistiveText,\n}) => {\n\t// State\n\tconst [returnFocusTo, setReturnFocusTo] = useState<Element | null>(null);\n\n\t// Refs\n\tconst generatedId = useRef(generateId());\n\n\t// Merged assistive text\n\tconst assistiveText = useMemo(\n\t\t() => ({\n\t\t\t...defaultAssistiveText,\n\t\t\t...assistiveTextProp,\n\t\t}),\n\t\t[assistiveTextProp]\n\t);\n\n\t// ID getter\n\tconst getId = useCallback(() => idProp || generatedId.current, [idProp]);\n\n\t// Is this a prompt modal?\n\tconst isPrompt = prompt !== undefined;\n\n\t// Warn in development if the app element isn't set\n\tuseEffect(() => {\n\t\tif (ariaHideApp) {\n\t\t\tcheckAppElementIsSet();\n\t\t}\n\t}, []); // Only run on mount\n\n\t// Set return focus on mount\n\tuseEffect(() => {\n\t\tif (documentDefined) {\n\t\t\tsetReturnFocusTo(document.activeElement);\n\t\t}\n\t}, []);\n\n\t// Update body scroll when isOpen changes\n\tuseEffect(() => {\n\t\tif (windowDefined && documentDefined && document.body) {\n\t\t\tif (isOpen) {\n\t\t\t\tdocument.body.style.overflow = 'hidden';\n\t\t\t} else {\n\t\t\t\tdocument.body.style.overflow = 'inherit';\n\t\t\t}\n\t\t}\n\n\t\treturn () => {\n\t\t\t// Clear body scroll on unmount\n\t\t\tif (windowDefined && documentDefined && document.body) {\n\t\t\t\tdocument.body.style.overflow = 'inherit';\n\t\t\t}\n\t\t};\n\t}, [isOpen]);\n\n\t// Dismiss modal handler\n\tconst dismissModal = useCallback(\n\t\t(event: ModalRequestCloseEvent, data: ModalRequestCloseData) => {\n\t\t\tif (\n\t\t\t\treturnFocusTo &&\n\t\t\t\t'focus' in returnFocusTo &&\n\t\t\t\ttypeof returnFocusTo.focus === 'function'\n\t\t\t) {\n\t\t\t\treturnFocusTo.focus();\n\t\t\t}\n\t\t\tif (onRequestClose) {\n\t\t\t\tonRequestClose(event, data);\n\t\t\t}\n\t\t},\n\t\t[returnFocusTo, onRequestClose]\n\t);\n\n\t// Close modal handler (respects disableClose)\n\tconst closeModal = useCallback(\n\t\t(event: ModalRequestCloseEvent, data: ModalRequestCloseData) => {\n\t\t\tif (!disableClose) {\n\t\t\t\tdismissModal(event, data);\n\t\t\t}\n\t\t},\n\t\t[disableClose, dismissModal]\n\t);\n\n\t// Close button click handler\n\tconst handleCloseButtonClick = useCallback(\n\t\t(event: MouseEvent<HTMLButtonElement>) => {\n\t\t\tcloseModal(event, { trigger: 'close-button' });\n\t\t},\n\t\t[closeModal]\n\t);\n\n\t// react-modal's own close request: Escape keydown, or a click directly on its overlay\n\tconst handleReactModalRequestClose = useCallback(\n\t\t(event: ModalRequestCloseEvent) => {\n\t\t\tcloseModal(event, {\n\t\t\t\ttrigger: event.type === 'keydown' ? 'escape' : 'click-outside',\n\t\t\t});\n\t\t},\n\t\t[closeModal]\n\t);\n\n\t// Dismiss on click outside handler\n\tconst dismissModalOnClickOutside = useCallback(\n\t\t(event: MouseEvent<HTMLElement>) => {\n\t\t\t// if dismissOnClickOutside is not set, default its value to !disableClose\n\t\t\tconst shouldDismiss =\n\t\t\t\tdismissOnClickOutside !== undefined\n\t\t\t\t\t? dismissOnClickOutside\n\t\t\t\t\t: !disableClose;\n\n\t\t\tif (shouldDismiss) {\n\t\t\t\tdismissModal(event, { trigger: 'click-outside' });\n\t\t\t}\n\t\t},\n\t\t[dismissOnClickOutside, disableClose, dismissModal]\n\t);\n\n\t// Prevent click propagation inside modal\n\tconst handleModalClick = useCallback((event: MouseEvent) => {\n\t\tif (event && event.stopPropagation) {\n\t\t\tevent.stopPropagation();\n\t\t}\n\t}, []);\n\n\t// Calculate border radius based on header/footer presence\n\tconst getBorderRadius = useCallback((): CSSProperties => {\n\t\tconst borderRadiusValue = '.25rem';\n\t\tconst hasHeader = heading || header;\n\t\tconst borderTopRadius = hasHeader\n\t\t\t? {}\n\t\t\t: {\n\t\t\t\t\tborderTopLeftRadius: borderRadiusValue,\n\t\t\t\t\tborderTopRightRadius: borderRadiusValue,\n\t\t\t\t};\n\t\tconst borderBottomRadius = footer\n\t\t\t? {}\n\t\t\t: {\n\t\t\t\t\tborderBottomLeftRadius: borderRadiusValue,\n\t\t\t\t\tborderBottomRightRadius: borderRadiusValue,\n\t\t\t\t};\n\t\treturn {\n\t\t\t...borderTopRadius,\n\t\t\t...borderBottomRadius,\n\t\t};\n\t}, [heading, header, footer]);\n\n\t// Get ARIA attributes\n\tconst getAriaAttributes = useCallback(() => {\n\t\tconst modalId = getId();\n\t\tconst ariaAttributes: {\n\t\t\tdescribedby: string;\n\t\t\tmodal: boolean;\n\t\t\tlabel?: string;\n\t\t\tlabelledby?: string;\n\t\t} = {\n\t\t\tdescribedby: `${modalId}-modal-content`,\n\t\t\tmodal: true,\n\t\t};\n\n\t\tif (assistiveText.dialogLabel) {\n\t\t\tariaAttributes.label = assistiveText.dialogLabel;\n\t\t\treturn ariaAttributes;\n\t\t}\n\n\t\tlet dialogLabelledBy: string | undefined;\n\n\t\tif (assistiveText.dialogLabelledBy) {\n\t\t\tdialogLabelledBy = assistiveText.dialogLabelledBy;\n\t\t} else if (heading) {\n\t\t\tdialogLabelledBy = `${modalId}-heading`;\n\t\t}\n\n\t\tif (dialogLabelledBy) {\n\t\t\tariaAttributes.labelledby = dialogLabelledBy;\n\t\t}\n\n\t\treturn ariaAttributes;\n\t}, [getId, assistiveText, heading]);\n\n\t// Render header\n\tconst renderHeader = () => {\n\t\tlet headerContent = header;\n\t\tconst headerEmpty = !headerContent && !heading && !tagline;\n\t\tconst closeButtonText = assistiveText.closeButton;\n\n\t\tconst closeButton = (\n\t\t\t<Button\n\t\t\t\tassistiveText={{ icon: closeButtonText }}\n\t\t\t\ticonCategory=\"utility\"\n\t\t\t\ticonName=\"close\"\n\t\t\t\ticonSize=\"large\"\n\t\t\t\tclassName=\"slds-button_icon slds-modal__close\"\n\t\t\t\tonClick={handleCloseButtonClick}\n\t\t\t\ttitle={closeButtonText}\n\t\t\t\tvariant=\"icon\"\n\t\t\t/>\n\t\t);\n\n\t\tif ((!headerContent && heading) || tagline) {\n\t\t\theaderContent = (\n\t\t\t\t<div>\n\t\t\t\t\t{toast}\n\t\t\t\t\t<h1\n\t\t\t\t\t\tclassName={classNames({\n\t\t\t\t\t\t\t'slds-text-heading_small': isPrompt,\n\t\t\t\t\t\t\t'slds-text-heading_medium': !isPrompt,\n\t\t\t\t\t\t})}\n\t\t\t\t\t\tid={`${getId()}-heading`}\n\t\t\t\t\t>\n\t\t\t\t\t\t{heading}\n\t\t\t\t\t</h1>\n\t\t\t\t\t{tagline ? <p className=\"slds-m-top_x-small\">{tagline}</p> : null}\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<header\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-modal__header',\n\t\t\t\t\t{\n\t\t\t\t\t\t'slds-modal__header_empty': headerEmpty,\n\t\t\t\t\t\t[`slds-theme_${prompt}`]: isPrompt,\n\t\t\t\t\t\t'slds-theme_alert-texture': isPrompt,\n\t\t\t\t\t},\n\t\t\t\t\theaderClassName\n\t\t\t\t)}\n\t\t\t\tonClick={handleModalClick}\n\t\t\t>\n\t\t\t\t{disableClose ? null : closeButton}\n\t\t\t\t{headerContent}\n\t\t\t</header>\n\t\t);\n\t};\n\n\t// Render footer\n\tconst renderFooter = () => {\n\t\tif (!footer) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst footerClasses = {\n\t\t\t'slds-modal__footer': true,\n\t\t\t'slds-modal__footer_directional': directional,\n\t\t\t'slds-theme_default': isPrompt,\n\t\t};\n\n\t\treturn (\n\t\t\t<footer\n\t\t\t\tclassName={classNames(footerClasses, footerClassName)}\n\t\t\t\tonClick={handleModalClick}\n\t\t\t>\n\t\t\t\t{footer}\n\t\t\t</footer>\n\t\t);\n\t};\n\n\t// Render modal content\n\tconst renderModal = () => {\n\t\tconst modalStyle =\n\t\t\talign === 'top' ? { justifyContent: 'flex-start' } : undefined;\n\t\tconst borderRadius = getBorderRadius();\n\t\tconst contentStyle: CSSProperties = {\n\t\t\t...borderRadius,\n\t\t\t...contentStyleProp,\n\t\t};\n\n\t\treturn (\n\t\t\t<section\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-modal',\n\t\t\t\t\t'slds-fade-in-open',\n\t\t\t\t\tsize ? `slds-modal_${size}` : null,\n\t\t\t\t\t{ 'slds-modal_prompt': isPrompt },\n\t\t\t\t\tclassName\n\t\t\t\t)}\n\t\t\t\tonClick={dismissModalOnClickOutside}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tclassName={classNames('slds-modal__container', containerClassName)}\n\t\t\t\t\tstyle={modalStyle}\n\t\t\t\t>\n\t\t\t\t\t{renderHeader()}\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={classNames('slds-modal__content', contentClassName)}\n\t\t\t\t\t\tid={`${getId()}-modal-content`}\n\t\t\t\t\t\tstyle={contentStyle}\n\t\t\t\t\t\tonClick={handleModalClick}\n\t\t\t\t\t>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t\t{renderFooter()}\n\t\t\t\t</div>\n\t\t\t</section>\n\t\t);\n\t};\n\n\t// Custom styles for ReactModal - using undefined to reset default styles\n\tconst customStyles: ReactModal.Styles = {\n\t\tcontent: {\n\t\t\tposition: undefined,\n\t\t\ttop: undefined,\n\t\t\tleft: undefined,\n\t\t\tright: undefined,\n\t\t\tbottom: undefined,\n\t\t\tborder: undefined,\n\t\t\tbackground: undefined,\n\t\t\toverflow: undefined,\n\t\t\tWebkitOverflowScrolling: undefined,\n\t\t\tborderRadius: undefined,\n\t\t\toutline: undefined,\n\t\t\tpadding: undefined,\n\t\t},\n\t\toverlay: {\n\t\t\tzIndex: 8000, // following SLDS guideline for z-index overlay\n\t\t\tbackgroundColor: undefined,\n\t\t},\n\t};\n\n\tconst ariaAttributes = getAriaAttributes();\n\n\treturn (\n\t\t<ReactModal\n\t\t\taria={ariaAttributes}\n\t\t\tariaHideApp={ariaHideApp}\n\t\t\tisOpen={isOpen}\n\t\t\tonRequestClose={handleReactModalRequestClose}\n\t\t\trole={disableClose ? 'alertdialog' : 'dialog'}\n\t\t\tstyle={customStyles}\n\t\t\tparentSelector={parentSelector}\n\t\t\tportalClassName={classNames('ReactModalPortal', portalClassName)}\n\t\t>\n\t\t\t{renderModal()}\n\t\t\t<div className=\"slds-backdrop slds-backdrop_open\" />\n\t\t</ReactModal>\n\t);\n};\n\nModal.displayName = MODAL;\n\nexport default Modal;\n"],"mappings":"ifAwBA,IAAM,EAAkB,OAAO,SAAa,IACtC,EAAgB,OAAO,OAAW,IAwGlC,EAA2C,CAChD,iBAAkB,GAClB,YAAa,OACd,EAaM,GAA+B,CACpC,QAAQ,SACR,cAAc,GACd,cAAe,EACf,WACA,YACA,qBACA,mBACA,aAAc,EACd,cACA,eACA,wBACA,iBACA,SACA,kBACA,SACA,kBACA,GAAI,EACJ,SACA,iBACA,kBACA,SACA,OACA,UACA,SACA,UACA,QACA,+BACK,CAEL,GAAM,CAAC,EAAe,IAAA,EAAoB,EAAA,SAAA,CAAyB,IAAI,EAGjE,GAAA,EAAc,EAAA,OAAA,CAAO,EAAA,QAAW,CAAC,EAGjC,GAAA,EAA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,OAAQ,IAAA,GACR,OAAQ,IAAA,GACR,WAAY,IAAA,GACZ,SAAU,IAAA,GACV,wBAAyB,IAAA,GACzB,aAAc,IAAA,GACd,QAAS,IAAA,GACT,QAAS,IAAA,EACV,EACA,QAAS,CACR,OAAQ,IACR,gBAAiB,IAAA,EAClB,CACD,EAEM,EAAiB,EAAkB,EAEzC,OACC,EAAA,EAAA,KAAA,CAAC,EAAA,QAAD,CACC,KAAM,EACO,cACL,SACR,eAAgB,EAChB,KAAM,EAAe,cAAgB,SACrC,MAAO,EACS,iBAChB,iBAAA,EAAiB,EAAA,QAAA,CAAW,mBAAoB,CAAe,EARhE,SAAA,CAUE,EAAY,GACb,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,kCAAoC,CAAA,CACxC,GAEd,EAEA,EAAM,YAAc,EAAA"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/modal/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n// Implements the [Modal design pattern](https://lightningdesignsystem.com/components/modals/) in React.\n\nimport {\n\tforwardRef,\n\tuseState,\n\tuseEffect,\n\tuseCallback,\n\tuseMemo,\n\tuseRef,\n\tCSSProperties,\n\tReactNode,\n\tMouseEvent,\n\tKeyboardEvent,\n} from 'react';\nimport classNames from 'classnames';\nimport ReactModal from 'react-modal';\n\nimport checkAppElementIsSet from '../../utilities/warning/check-app-element-set';\nimport Button from '../button';\nimport { MODAL } from '../../utilities/constants';\nimport generateId from '../../utilities/generate-id';\nimport checkProps from './check-props';\nimport componentDoc from './component.json';\n\nconst documentDefined = typeof document !== 'undefined';\nconst windowDefined = typeof window !== 'undefined';\n\n// Types\nexport type ModalAlign = 'top' | 'center';\nexport type ModalSize = 'small' | 'medium' | 'large';\nexport type ModalPrompt =\n\t'success' | 'warning' | 'error' | 'wrench' | 'offline' | 'info';\n\nexport interface ModalAssistiveText {\n\t/** This is a visually hidden label for the dialog. If not provided, `heading` is used. */\n\tdialogLabel?: string;\n\t/** This describes which node labels the dialog. If not provided and dialogLabel is unavailable, `id` is used. */\n\tdialogLabelledBy?: string;\n\t/** This is a visually hidden label for the close button. */\n\tcloseButton?: string;\n}\n\n/**\n * What caused a Modal close request:\n * - `'close-button'`: the header close button was clicked\n * - `'escape'`: the Escape key was pressed\n * - `'click-outside'`: a click landed outside the modal container (on the backdrop area)\n */\nexport type ModalRequestCloseTrigger =\n\t'close-button' | 'escape' | 'click-outside';\n\n/**\n * Data passed to `onRequestClose`\n */\nexport interface ModalRequestCloseData {\n\t/** What caused the close request */\n\ttrigger: ModalRequestCloseTrigger;\n}\n\n/**\n * Event passed to `onRequestClose`: the click (close button / outside click) or\n * keydown (Escape) that caused the request\n */\nexport type ModalRequestCloseEvent = MouseEvent | KeyboardEvent;\n\nexport interface ModalProps {\n\t/** Vertical alignment of Modal. */\n\talign?: ModalAlign;\n\t/** Boolean indicating if the appElement should be hidden. */\n\tariaHideApp?: boolean;\n\t/** Assistive text for accessibility. */\n\tassistiveText?: ModalAssistiveText;\n\t/** Modal content. */\n\tchildren: ReactNode;\n\t/** Custom CSS classes for the root `section.slds-modal` node. */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Custom CSS classes for the `.slds-modal__container` node. */\n\tclassNameContainer?: string | string[] | Record<string, boolean>;\n\t/** Custom CSS classes for the `.slds-modal__content` (body) node. */\n\tclassNameContent?: string | string[] | Record<string, boolean>;\n\t/** Custom CSS classes for the `footer.slds-modal__footer` node. */\n\tclassNameFooter?: string | string[] | Record<string, boolean>;\n\t/** Custom CSS classes for the `header.slds-modal__header` node. */\n\tclassNameHeader?: string | string[] | Record<string, boolean>;\n\t/** Custom CSS classes for the portal DOM node that react-modal appends to `parentSelector()`. */\n\tclassNamePortal?: string | string[] | Record<string, boolean>;\n\t/** @deprecated Use `classNameContainer`. */\n\tcontainerClassName?: string | string[] | Record<string, boolean>;\n\t/** @deprecated Use `classNameContent`. */\n\tcontentClassName?: string | string[] | Record<string, boolean>;\n\t/** @deprecated Use `styleContent`. */\n\tcontentStyle?: CSSProperties;\n\t/** If true, modal footer buttons render left and right. */\n\tdirectional?: boolean;\n\t/** If true, Modals cannot be dismissed by clicking on the close icon or pressing esc key. */\n\tdisableClose?: boolean;\n\t/** If true, Modals can be dismissed by clicking outside of modal. If unspecified, defaults to !disableClose. */\n\tdismissOnClickOutside?: boolean;\n\t/**\n\t * Callback to fire when the Modal requests to be dismissed. Receives the triggering\n\t * click or keydown event and `data.trigger`: `'close-button'`, `'escape'`, or `'click-outside'`.\n\t * Not called when `disableClose` (or `dismissOnClickOutside: false` for outside clicks) prevents it.\n\t */\n\tonRequestClose?: (\n\t\tevent: ModalRequestCloseEvent,\n\t\tdata: ModalRequestCloseData\n\t) => void;\n\t/** Modal footer content, typically buttons. */\n\tfooter?: ReactNode | ReactNode[];\n\t/** @deprecated Use `classNameFooter`. */\n\tfooterClassName?: string | string[] | Record<string, boolean>;\n\t/** Allows for a custom modal header that does not scroll with modal content. */\n\theader?: ReactNode;\n\t/** @deprecated Use `classNameHeader`. */\n\theaderClassName?: string | string[] | Record<string, boolean>;\n\t/** Unique identifier for the modal. The id is automatically generated if not provided. */\n\tid?: string;\n\t/** Forces the modal to be open or closed. */\n\tisOpen: boolean;\n\t/** Function whose return value is the mount node to insert the Modal element into. */\n\tparentSelector?: () => HTMLElement;\n\t/** @deprecated Use `classNamePortal`. */\n\tportalClassName?: string | string[] | Record<string, boolean>;\n\t/** Styles the modal as a prompt. */\n\tprompt?: ModalPrompt;\n\t/** Specifies the modal's width. */\n\tsize?: ModalSize;\n\t/** Custom styles for the `.slds-modal__content` (body) node. */\n\tstyleContent?: CSSProperties;\n\t/** Content underneath the heading in the modal header. */\n\ttagline?: ReactNode;\n\t/** Text heading at the top of a modal. */\n\theading?: ReactNode;\n\t/** Allows adding additional notifications within the modal. */\n\ttoast?: ReactNode;\n}\n\nconst defaultAssistiveText: ModalAssistiveText = {\n\tdialogLabelledBy: '',\n\tcloseButton: 'Close',\n};\n\n/**\n * The Modal component is used for the Lightning Design System Modal and Notification > Prompt components.\n * The Modal opens from a state change outside of the component itself (pass this state to the `isOpen` prop).\n *\n * By default, `Modal` will add `aria-hidden=true` to the `body` tag, but this disables some assistive technologies.\n * To prevent this you can add the following to your application with `#mount` being the root node of your application:\n * ```\n * import settings from 'design-system-react/components/settings';\n * settings.setAppElement('#mount');\n * ```\n */\nconst Modal = forwardRef<HTMLElement, ModalProps>(\n\t(\n\t\t{\n\t\t\talign = 'center',\n\t\t\tariaHideApp = true,\n\t\t\tassistiveText: assistiveTextProp,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tclassNameContainer,\n\t\t\tclassNameContent,\n\t\t\tclassNameFooter,\n\t\t\tclassNameHeader,\n\t\t\tclassNamePortal,\n\t\t\tcontainerClassName,\n\t\t\tcontentClassName,\n\t\t\tcontentStyle,\n\t\t\tdirectional,\n\t\t\tdisableClose,\n\t\t\tdismissOnClickOutside,\n\t\t\tonRequestClose,\n\t\t\tfooter,\n\t\t\tfooterClassName,\n\t\t\theader,\n\t\t\theaderClassName,\n\t\t\tid: idProp,\n\t\t\tisOpen,\n\t\t\tparentSelector,\n\t\t\tportalClassName,\n\t\t\tprompt,\n\t\t\tsize,\n\t\t\tstyleContent,\n\t\t\ttagline,\n\t\t\theading,\n\t\t\ttoast,\n\t\t},\n\t\tref\n\t) => {\n\t\tuseEffect(() => {\n\t\t\tcheckProps(\n\t\t\t\tMODAL,\n\t\t\t\t{\n\t\t\t\t\tcontainerClassName,\n\t\t\t\t\tcontentClassName,\n\t\t\t\t\tcontentStyle,\n\t\t\t\t\tfooterClassName,\n\t\t\t\t\theaderClassName,\n\t\t\t\t\tportalClassName,\n\t\t\t\t},\n\t\t\t\tcomponentDoc\n\t\t\t);\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t}, []); // Only run on mount\n\n\t\t// State\n\t\tconst [returnFocusTo, setReturnFocusTo] = useState<Element | null>(null);\n\n\t\t// Refs\n\t\tconst generatedId = useRef(generateId());\n\n\t\t// Merged assistive text\n\t\tconst assistiveText = useMemo(\n\t\t\t() => ({\n\t\t\t\t...defaultAssistiveText,\n\t\t\t\t...assistiveTextProp,\n\t\t\t}),\n\t\t\t[assistiveTextProp]\n\t\t);\n\n\t\t// ID getter\n\t\tconst getId = useCallback(() => idProp || generatedId.current, [idProp]);\n\n\t\t// Is this a prompt modal?\n\t\tconst isPrompt = prompt !== undefined;\n\n\t\t// Warn in development if the app element isn't set\n\t\tuseEffect(() => {\n\t\t\tif (ariaHideApp) {\n\t\t\t\tcheckAppElementIsSet();\n\t\t\t}\n\t\t}, []); // Only run on mount\n\n\t\t// Set return focus on mount\n\t\tuseEffect(() => {\n\t\t\tif (documentDefined) {\n\t\t\t\tsetReturnFocusTo(document.activeElement);\n\t\t\t}\n\t\t}, []);\n\n\t\t// Update body scroll when isOpen changes\n\t\tuseEffect(() => {\n\t\t\tif (windowDefined && documentDefined && document.body) {\n\t\t\t\tif (isOpen) {\n\t\t\t\t\tdocument.body.style.overflow = 'hidden';\n\t\t\t\t} else {\n\t\t\t\t\tdocument.body.style.overflow = 'inherit';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn () => {\n\t\t\t\t// Clear body scroll on unmount\n\t\t\t\tif (windowDefined && documentDefined && document.body) {\n\t\t\t\t\tdocument.body.style.overflow = 'inherit';\n\t\t\t\t}\n\t\t\t};\n\t\t}, [isOpen]);\n\n\t\t// Dismiss modal handler\n\t\tconst dismissModal = useCallback(\n\t\t\t(event: ModalRequestCloseEvent, data: ModalRequestCloseData) => {\n\t\t\t\tif (\n\t\t\t\t\treturnFocusTo &&\n\t\t\t\t\t'focus' in returnFocusTo &&\n\t\t\t\t\ttypeof returnFocusTo.focus === 'function'\n\t\t\t\t) {\n\t\t\t\t\treturnFocusTo.focus();\n\t\t\t\t}\n\t\t\t\tif (onRequestClose) {\n\t\t\t\t\tonRequestClose(event, data);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[returnFocusTo, onRequestClose]\n\t\t);\n\n\t\t// Close modal handler (respects disableClose)\n\t\tconst closeModal = useCallback(\n\t\t\t(event: ModalRequestCloseEvent, data: ModalRequestCloseData) => {\n\t\t\t\tif (!disableClose) {\n\t\t\t\t\tdismissModal(event, data);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[disableClose, dismissModal]\n\t\t);\n\n\t\t// Close button click handler\n\t\tconst handleCloseButtonClick = useCallback(\n\t\t\t(event: MouseEvent<HTMLButtonElement>) => {\n\t\t\t\tcloseModal(event, { trigger: 'close-button' });\n\t\t\t},\n\t\t\t[closeModal]\n\t\t);\n\n\t\t// react-modal's own close request: Escape keydown, or a click directly on its overlay\n\t\tconst handleReactModalRequestClose = useCallback(\n\t\t\t(event: ModalRequestCloseEvent) => {\n\t\t\t\tcloseModal(event, {\n\t\t\t\t\ttrigger: event.type === 'keydown' ? 'escape' : 'click-outside',\n\t\t\t\t});\n\t\t\t},\n\t\t\t[closeModal]\n\t\t);\n\n\t\t// Dismiss on click outside handler\n\t\tconst dismissModalOnClickOutside = useCallback(\n\t\t\t(event: MouseEvent<HTMLElement>) => {\n\t\t\t\t// if dismissOnClickOutside is not set, default its value to !disableClose\n\t\t\t\tconst shouldDismiss =\n\t\t\t\t\tdismissOnClickOutside !== undefined\n\t\t\t\t\t\t? dismissOnClickOutside\n\t\t\t\t\t\t: !disableClose;\n\n\t\t\t\tif (shouldDismiss) {\n\t\t\t\t\tdismissModal(event, { trigger: 'click-outside' });\n\t\t\t\t}\n\t\t\t},\n\t\t\t[dismissOnClickOutside, disableClose, dismissModal]\n\t\t);\n\n\t\t// Prevent click propagation inside modal\n\t\tconst handleModalClick = useCallback((event: MouseEvent) => {\n\t\t\tif (event && event.stopPropagation) {\n\t\t\t\tevent.stopPropagation();\n\t\t\t}\n\t\t}, []);\n\n\t\t// Calculate border radius based on header/footer presence\n\t\tconst getBorderRadius = useCallback((): CSSProperties => {\n\t\t\tconst borderRadiusValue = '.25rem';\n\t\t\tconst hasHeader = heading || header;\n\t\t\tconst borderTopRadius = hasHeader\n\t\t\t\t? {}\n\t\t\t\t: {\n\t\t\t\t\t\tborderTopLeftRadius: borderRadiusValue,\n\t\t\t\t\t\tborderTopRightRadius: borderRadiusValue,\n\t\t\t\t\t};\n\t\t\tconst borderBottomRadius = footer\n\t\t\t\t? {}\n\t\t\t\t: {\n\t\t\t\t\t\tborderBottomLeftRadius: borderRadiusValue,\n\t\t\t\t\t\tborderBottomRightRadius: borderRadiusValue,\n\t\t\t\t\t};\n\t\t\treturn {\n\t\t\t\t...borderTopRadius,\n\t\t\t\t...borderBottomRadius,\n\t\t\t};\n\t\t}, [heading, header, footer]);\n\n\t\t// Get ARIA attributes\n\t\tconst getAriaAttributes = useCallback(() => {\n\t\t\tconst modalId = getId();\n\t\t\tconst ariaAttributes: {\n\t\t\t\tdescribedby: string;\n\t\t\t\tmodal: boolean;\n\t\t\t\tlabel?: string;\n\t\t\t\tlabelledby?: string;\n\t\t\t} = {\n\t\t\t\tdescribedby: `${modalId}-modal-content`,\n\t\t\t\tmodal: true,\n\t\t\t};\n\n\t\t\tif (assistiveText.dialogLabel) {\n\t\t\t\tariaAttributes.label = assistiveText.dialogLabel;\n\t\t\t\treturn ariaAttributes;\n\t\t\t}\n\n\t\t\tlet dialogLabelledBy: string | undefined;\n\n\t\t\tif (assistiveText.dialogLabelledBy) {\n\t\t\t\tdialogLabelledBy = assistiveText.dialogLabelledBy;\n\t\t\t} else if (heading) {\n\t\t\t\tdialogLabelledBy = `${modalId}-heading`;\n\t\t\t}\n\n\t\t\tif (dialogLabelledBy) {\n\t\t\t\tariaAttributes.labelledby = dialogLabelledBy;\n\t\t\t}\n\n\t\t\treturn ariaAttributes;\n\t\t}, [getId, assistiveText, heading]);\n\n\t\t// Render header\n\t\tconst renderHeader = () => {\n\t\t\tlet headerContent = header;\n\t\t\tconst headerEmpty = !headerContent && !heading && !tagline;\n\t\t\tconst closeButtonText = assistiveText.closeButton;\n\n\t\t\tconst closeButton = (\n\t\t\t\t<Button\n\t\t\t\t\tassistiveText={{ icon: closeButtonText }}\n\t\t\t\t\ticonCategory=\"utility\"\n\t\t\t\t\ticonName=\"close\"\n\t\t\t\t\ticonSize=\"large\"\n\t\t\t\t\tclassName=\"slds-button_icon slds-modal__close\"\n\t\t\t\t\tonClick={handleCloseButtonClick}\n\t\t\t\t\ttitle={closeButtonText}\n\t\t\t\t\tvariant=\"icon\"\n\t\t\t\t/>\n\t\t\t);\n\n\t\t\tif ((!headerContent && heading) || tagline) {\n\t\t\t\theaderContent = (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t{toast}\n\t\t\t\t\t\t<h1\n\t\t\t\t\t\t\tclassName={classNames({\n\t\t\t\t\t\t\t\t'slds-text-heading_small': isPrompt,\n\t\t\t\t\t\t\t\t'slds-text-heading_medium': !isPrompt,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\tid={`${getId()}-heading`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{heading}\n\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t{tagline ? <p className=\"slds-m-top_x-small\">{tagline}</p> : null}\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<header\n\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t'slds-modal__header',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'slds-modal__header_empty': headerEmpty,\n\t\t\t\t\t\t\t[`slds-theme_${prompt}`]: isPrompt,\n\t\t\t\t\t\t\t'slds-theme_alert-texture': isPrompt,\n\t\t\t\t\t\t},\n\t\t\t\t\t\theaderClassName,\n\t\t\t\t\t\tclassNameHeader\n\t\t\t\t\t)}\n\t\t\t\t\tonClick={handleModalClick}\n\t\t\t\t>\n\t\t\t\t\t{disableClose ? null : closeButton}\n\t\t\t\t\t{headerContent}\n\t\t\t\t</header>\n\t\t\t);\n\t\t};\n\n\t\t// Render footer\n\t\tconst renderFooter = () => {\n\t\t\tif (!footer) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst footerClasses = {\n\t\t\t\t'slds-modal__footer': true,\n\t\t\t\t'slds-modal__footer_directional': directional,\n\t\t\t\t'slds-theme_default': isPrompt,\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\t<footer\n\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\tfooterClasses,\n\t\t\t\t\t\tfooterClassName,\n\t\t\t\t\t\tclassNameFooter\n\t\t\t\t\t)}\n\t\t\t\t\tonClick={handleModalClick}\n\t\t\t\t>\n\t\t\t\t\t{footer}\n\t\t\t\t</footer>\n\t\t\t);\n\t\t};\n\n\t\t// Render modal content\n\t\tconst renderModal = () => {\n\t\t\tconst modalStyle =\n\t\t\t\talign === 'top' ? { justifyContent: 'flex-start' } : undefined;\n\t\t\tconst borderRadius = getBorderRadius();\n\t\t\tconst mergedStyleContent: CSSProperties = {\n\t\t\t\t...borderRadius,\n\t\t\t\t...contentStyle,\n\t\t\t\t...styleContent,\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\t<section\n\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t'slds-modal',\n\t\t\t\t\t\t'slds-fade-in-open',\n\t\t\t\t\t\tsize ? `slds-modal_${size}` : null,\n\t\t\t\t\t\t{ 'slds-modal_prompt': isPrompt },\n\t\t\t\t\t\tclassName\n\t\t\t\t\t)}\n\t\t\t\t\tonClick={dismissModalOnClickOutside}\n\t\t\t\t\tref={ref}\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t'slds-modal__container',\n\t\t\t\t\t\t\tcontainerClassName,\n\t\t\t\t\t\t\tclassNameContainer\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tstyle={modalStyle}\n\t\t\t\t\t>\n\t\t\t\t\t\t{renderHeader()}\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t\t'slds-modal__content',\n\t\t\t\t\t\t\t\tcontentClassName,\n\t\t\t\t\t\t\t\tclassNameContent\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tid={`${getId()}-modal-content`}\n\t\t\t\t\t\t\tstyle={mergedStyleContent}\n\t\t\t\t\t\t\tonClick={handleModalClick}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{renderFooter()}\n\t\t\t\t\t</div>\n\t\t\t\t</section>\n\t\t\t);\n\t\t};\n\n\t\t// Custom styles for ReactModal - using undefined to reset default styles\n\t\tconst customStyles: ReactModal.Styles = {\n\t\t\tcontent: {\n\t\t\t\tposition: undefined,\n\t\t\t\ttop: undefined,\n\t\t\t\tleft: undefined,\n\t\t\t\tright: undefined,\n\t\t\t\tbottom: undefined,\n\t\t\t\tborder: undefined,\n\t\t\t\tbackground: undefined,\n\t\t\t\toverflow: undefined,\n\t\t\t\tWebkitOverflowScrolling: undefined,\n\t\t\t\tborderRadius: undefined,\n\t\t\t\toutline: undefined,\n\t\t\t\tpadding: undefined,\n\t\t\t},\n\t\t\toverlay: {\n\t\t\t\tzIndex: 8000, // following SLDS guideline for z-index overlay\n\t\t\t\tbackgroundColor: undefined,\n\t\t\t},\n\t\t};\n\n\t\tconst ariaAttributes = getAriaAttributes();\n\n\t\treturn (\n\t\t\t<ReactModal\n\t\t\t\taria={ariaAttributes}\n\t\t\t\tariaHideApp={ariaHideApp}\n\t\t\t\tisOpen={isOpen}\n\t\t\t\tonRequestClose={handleReactModalRequestClose}\n\t\t\t\trole={disableClose ? 'alertdialog' : 'dialog'}\n\t\t\t\tstyle={customStyles}\n\t\t\t\tparentSelector={parentSelector}\n\t\t\t\tportalClassName={classNames(\n\t\t\t\t\t'ReactModalPortal',\n\t\t\t\t\tportalClassName,\n\t\t\t\t\tclassNamePortal\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{renderModal()}\n\t\t\t\t<div className=\"slds-backdrop slds-backdrop_open\" />\n\t\t\t</ReactModal>\n\t\t);\n\t}\n);\n\nModal.displayName = MODAL;\n\nexport default Modal;\n"],"mappings":"whBA2BA,IAAM,EAAkB,OAAO,SAAa,IACtC,EAAgB,OAAO,OAAW,IAgHlC,GAA2C,CAChD,iBAAkB,GAClB,YAAa,OACd,EAaM,GAAA,EAAQ,EAAA,WAAA,EAEZ,CACC,QAAQ,SACR,cAAc,GACd,cAAe,EACf,WACA,YACA,qBACA,mBACA,kBACA,kBACA,kBACA,qBACA,mBACA,eACA,cACA,eACA,wBACA,iBACA,SACA,kBACA,SACA,kBACA,GAAI,EACJ,SACA,iBACA,kBACA,SACA,OACA,eACA,UACA,UACA,SAED,IACI,EACJ,EAAA,EAAA,UAAA,KAAgB,CACf,EAAA,QACC,EAAA,MACA,CACC,qBACA,mBACA,eACA,kBACA,kBACA,iBACD,EACA,EAAA,OACD,CAED,EAAG,CAAC,CAAC,EAGL,GAAM,CAAC,EAAe,IAAA,EAAoB,EAAA,SAAA,CAAyB,IAAI,EAGjE,GAAA,EAAc,EAAA,OAAA,CAAO,EAAA,QAAW,CAAC,EAGjC,GAAA,EAAgB,EAAA,QAAA,MACd,CACN,GAAG,GACH,GAAG,CACJ,GACA,CAAC,CAAiB,CACnB,EAGM,GAAA,EAAQ,EAAA,YAAA,KAAkB,GAAU,EAAY,QAAS,CAAC,CAAM,CAAC,EAGjE,EAAW,IAAW,IAAA,IAG5B,EAAA,EAAA,UAAA,KAAgB,CACX,GACH,EAAA,QAAqB,CAEvB,EAAG,CAAC,CAAC,GAGL,EAAA,EAAA,UAAA,KAAgB,CACX,GACH,EAAiB,SAAS,aAAa,CAEzC,EAAG,CAAC,CAAC,GAGL,EAAA,EAAA,UAAA,MACK,GAAiB,GAAmB,SAAS,OAC5C,EACH,SAAS,KAAK,MAAM,SAAW,SAE/B,SAAS,KAAK,MAAM,SAAW,eAIpB,CAER,GAAiB,GAAmB,S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CAAoC,CAAA,CACxC,GAEd,CACD,EAEA,EAAM,YAAc,EAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=`popover`,t=`prod`,n=`Popover`,r={component:e,status:t,"display-name":`Popovers`,classKey:n,"last-accessibility-review":{"date-iso-8601":`2018/01/18`,"commit-sha":`ad6b6c6523ee21cada11be5f7ea4d99abc530726`},"SLDS-component-path":`/components/popovers`,"site-stories":[{heading:`With Header`,path:`/__examples__/header.jsx`},{heading:`With Alternative Header`,path:`/__examples__/alternative-header.jsx`},{heading:`Controlled State with Footer`,path:`/__examples__/controlled-with-footer.jsx`},{heading:`Custom Target`,path:`/__examples__/custom-target.jsx`},{heading:`Error Theme`,path:`/__examples__/error.jsx`},{heading:`Feature`,path:`/__examples__/feature.jsx`},{heading:`Walkthrough`,path:`/__examples__/walkthrough.jsx`},{heading:`Walkthrough Action`,path:`/__examples__/walkthrough-action.jsx`},{heading:`Warning`,path:`/__examples__/warning.jsx`},{heading:`Edit Dialog`,path:`/__examples__/edit-dialog.jsx`}],"url-slug":`popovers`};exports.classKey=n,exports.component=e,exports.default=r,exports.status=t;
|
|
2
|
+
//# sourceMappingURL=component.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.cjs","names":[],"sources":["../../../../components/popover/component.json"],"sourcesContent":["{\n\t\"component\": \"popover\",\n\t\"status\": \"prod\",\n\t\"display-name\": \"Popovers\",\n\t\"classKey\": \"Popover\",\n\t\"last-accessibility-review\": {\n\t\t\"date-iso-8601\": \"2018/01/18\",\n\t\t\"commit-sha\": \"ad6b6c6523ee21cada11be5f7ea4d99abc530726\"\n\t},\n\t\"SLDS-component-path\": \"/components/popovers\",\n\t\"site-stories\": [\n\t\t{\n\t\t\t\"heading\": \"With Header\",\n\t\t\t\"path\": \"/__examples__/header.jsx\"\n\t\t},\n\t\t{\n\t\t\t\"heading\": \"With Alternative Header\",\n\t\t\t\"path\": \"/__examples__/alternative-header.jsx\"\n\t\t},\n\t\t{\n\t\t\t\"heading\": \"Controlled State with Footer\",\n\t\t\t\"path\": \"/__examples__/controlled-with-footer.jsx\"\n\t\t},\n\t\t{\n\t\t\t\"heading\": \"Custom Target\",\n\t\t\t\"path\": \"/__examples__/custom-target.jsx\"\n\t\t},\n\t\t{\n\t\t\t\"heading\": \"Error Theme\",\n\t\t\t\"path\": \"/__examples__/error.jsx\"\n\t\t},\n\t\t{\n\t\t\t\"heading\": \"Feature\",\n\t\t\t\"path\": \"/__examples__/feature.jsx\"\n\t\t},\n\t\t{\n\t\t\t\"heading\": \"Walkthrough\",\n\t\t\t\"path\": \"/__examples__/walkthrough.jsx\"\n\t\t},\n\t\t{\n\t\t\t\"heading\": \"Walkthrough Action\",\n\t\t\t\"path\": \"/__examples__/walkthrough-action.jsx\"\n\t\t},\n\t\t{\n\t\t\t\"heading\": \"Warning\",\n\t\t\t\"path\": \"/__examples__/warning.jsx\"\n\t\t},\n\t\t{\n\t\t\t\"heading\": \"Edit Dialog\",\n\t\t\t\"path\": \"/__examples__/edit-dialog.jsx\"\n\t\t}\n\t],\n\t\"url-slug\": \"popovers\"\n}\n"],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("../button/index.cjs"),r=require("./index.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("react/jsx-runtime"),o=require("lodash.assign");o=e.__toESM(o,1);var s={labels:{cancel:`Cancel`,save:`Save`}},c=class extends i.default.Component{static displayName=t.POPOVER_EDIT_DIALOG;static defaultProps=s;state={isOpen:!1};handleOpen=()=>{this.setState({isOpen:!0})};handleClose=()=>{this.setState({isOpen:!1})};render(){let{onCancel:e,onSave:t,...i}=this.props,c=this.props.children?this.props.children:(0,a.jsx)(n.default,{assistiveText:{icon:`Edit: Status`},className:`slds-button_reset`,disabled:this.props.disabled,iconCategory:`utility`,iconClassName:`slds-button__icon slds-button__icon_hint`,iconName:`edit`,onClick:this.props.handleOpen,variant:`icon`,style:{verticalAlign:`middle`}}),l=(0,o.default)({},s.labels,this.props.labels);return(0,a.jsx)(r.default,{classNameFooter:[`slds-p-top_xxx-small`,`slds-p-bottom_xx-small`,`slds-p-right_large`],classNameBody:[`slds-p-bottom_xx-small`],footer:(0,a.jsxs)(`div`,{className:`slds-text-align_right slds-text-align_right slds-p-bottom_x-small slds-p-right_xx-small`,children:[(0,a.jsx)(n.default,{label:l.cancel,onClick:e}),(0,a.jsx)(n.default,{disabled:!this.props.isModified,variant:`brand`,label:l.save,onClick:t})]}),
|
|
1
|
+
const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("../button/index.cjs"),r=require("./index.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("react/jsx-runtime"),o=require("lodash.assign");o=e.__toESM(o,1);var s={labels:{cancel:`Cancel`,save:`Save`}},c=class extends i.default.Component{static displayName=t.POPOVER_EDIT_DIALOG;static defaultProps=s;state={isOpen:!1};handleOpen=()=>{this.setState({isOpen:!0})};handleClose=()=>{this.setState({isOpen:!1})};render(){let{onCancel:e,onSave:t,...i}=this.props,c=this.props.children?this.props.children:(0,a.jsx)(n.default,{assistiveText:{icon:`Edit: Status`},className:`slds-button_reset`,disabled:this.props.disabled,iconCategory:`utility`,iconClassName:`slds-button__icon slds-button__icon_hint`,iconName:`edit`,onClick:this.props.handleOpen,variant:`icon`,style:{verticalAlign:`middle`}}),l=(0,o.default)({},s.labels,this.props.labels);return(0,a.jsx)(r.default,{classNameFooter:[`slds-p-top_xxx-small`,`slds-p-bottom_xx-small`,`slds-p-right_large`],classNameBody:[`slds-p-bottom_xx-small`],footer:(0,a.jsxs)(`div`,{className:`slds-text-align_right slds-text-align_right slds-p-bottom_x-small slds-p-right_xx-small`,children:[(0,a.jsx)(n.default,{label:l.cancel,onClick:e}),(0,a.jsx)(n.default,{disabled:!this.props.isModified,variant:`brand`,label:l.save,onClick:t})]}),styleFooter:{borderTop:`0px`},onClose:this.handleClose,onRequestClose:this.handleClose,onOpen:this.handleOpen,...i,children:c})}};exports.default=c;
|
|
2
2
|
//# sourceMappingURL=edit-dialog.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit-dialog.cjs","names":[],"sources":["../../../../components/popover/edit-dialog.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n// # Edit Dialog Popver Component\n\n// ### React\nimport React, { type ReactNode } from 'react';\nimport assign from 'lodash.assign';\n\nimport { POPOVER_EDIT_DIALOG } from '../../utilities/constants';\n\nimport Button from '../button';\nimport Popover, { type PopoverProps } from './index';\n\nexport interface EditDialogLabels {\n\t/** text for Cancel button */\n\tcancel?: ReactNode;\n\t/** text for Save button */\n\tsave?: ReactNode;\n}\n\nexport interface EditDialogProps {\n\t/**\n\t * The trigger element. Defaults to an edit button when not provided.\n\t */\n\tchildren?: ReactNode;\n\t/**\n\t * Disables the edit dialog and prevents clicking it.\n\t */\n\tdisabled?: boolean;\n\t/**\n\t * Passed to the default trigger button's `onClick`.\n\t */\n\thandleOpen?: (event: React.MouseEvent) => void;\n\t/**\n\t * By default, a unique ID will be created at render to support keyboard navigation, ARIA roles, and connect the popover to the triggering button. This ID will be applied to the triggering element. `${id}-popover`, `${id}-dialog-heading`, `${id}-dialog-body` are also created.\n\t */\n\tid?: string;\n\t/**\n\t * Set to true when inputs within the popover are modified.\n\t */\n\tisModified?: boolean;\n\t/**\n\t * **Text labels for internationalization**\n\t * This object is merged with the default props object on every render.\n\t * * `cancel`: text for Cancel button\n\t * * `save`: text for Save button\n\t *\n\t * _Tested with snapshot testing._\n\t */\n\tlabels?: EditDialogLabels;\n\t/**\n\t * This function is passed onto the cancel `Button`. Triggered when the trigger button is clicked.\n\t */\n\tonCancel?: (event: React.MouseEvent) => void;\n\t/**\n\t * This function is passed onto the save `Button`. Triggered when the trigger button is clicked.\n\t */\n\tonSave?: (event: React.MouseEvent) => void;\n\t/**\n\t * Popover of type `~/components/popover`. This popover will be cloned and additional props appended, if passed in.\n\t */\n\tpopover?: ReactNode;\n\t/**\n\t * Additional props are passed onto the underlying `Popover`.\n\t */\n\t[key: string]: unknown;\n}\n\ninterface EditDialogState {\n\tisOpen: boolean;\n}\n\nconst defaultProps: Partial<EditDialogProps> = {\n\tlabels: {\n\t\tcancel: 'Cancel',\n\t\tsave: 'Save',\n\t},\n};\n\nclass EditDialog extends React.Component<EditDialogProps, EditDialogState> {\n\t// ### Display Name\n\t// Always use the canonical component name as the React display name.\n\tstatic displayName = POPOVER_EDIT_DIALOG;\n\n\tstatic defaultProps = defaultProps;\n\n\tstate: EditDialogState = { isOpen: false };\n\n\thandleOpen = () => {\n\t\tthis.setState({ isOpen: true });\n\t};\n\n\thandleClose = () => {\n\t\tthis.setState({ isOpen: false });\n\t};\n\n\trender() {\n\t\tconst { onCancel, onSave, ...restProps } = this.props;\n\n\t\t// trigger button will either be passed in children or defaults to an edit button.\n\t\tconst children = this.props.children ? (\n\t\t\tthis.props.children\n\t\t) : (\n\t\t\t<Button\n\t\t\t\tassistiveText={{ icon: 'Edit: Status' }}\n\t\t\t\tclassName=\"slds-button_reset\"\n\t\t\t\tdisabled={this.props.disabled}\n\t\t\t\ticonCategory=\"utility\"\n\t\t\t\ticonClassName=\"slds-button__icon slds-button__icon_hint\"\n\t\t\t\ticonName=\"edit\"\n\t\t\t\tonClick={this.props.handleOpen}\n\t\t\t\tvariant=\"icon\"\n\t\t\t\tstyle={{ verticalAlign: 'middle' }}\n\t\t\t/>\n\t\t);\n\n\t\tconst labels = assign({}, defaultProps.labels, this.props.labels);\n\n\t\treturn (\n\t\t\t<Popover\n\t\t\t\tclassNameFooter={[\n\t\t\t\t\t'slds-p-top_xxx-small',\n\t\t\t\t\t'slds-p-bottom_xx-small',\n\t\t\t\t\t'slds-p-right_large',\n\t\t\t\t]}\n\t\t\t\tclassNameBody={['slds-p-bottom_xx-small']}\n\t\t\t\tfooter={\n\t\t\t\t\t<div className=\"slds-text-align_right slds-text-align_right slds-p-bottom_x-small slds-p-right_xx-small\">\n\t\t\t\t\t\t<Button label={labels.cancel} onClick={onCancel} />\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tdisabled={!this.props.isModified}\n\t\t\t\t\t\t\tvariant=\"brand\"\n\t\t\t\t\t\t\tlabel={labels.save}\n\t\t\t\t\t\t\tonClick={onSave}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t\
|
|
1
|
+
{"version":3,"file":"edit-dialog.cjs","names":[],"sources":["../../../../components/popover/edit-dialog.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n// # Edit Dialog Popver Component\n\n// ### React\nimport React, { type ReactNode } from 'react';\nimport assign from 'lodash.assign';\n\nimport { POPOVER_EDIT_DIALOG } from '../../utilities/constants';\n\nimport Button from '../button';\nimport Popover, { type PopoverProps } from './index';\n\nexport interface EditDialogLabels {\n\t/** text for Cancel button */\n\tcancel?: ReactNode;\n\t/** text for Save button */\n\tsave?: ReactNode;\n}\n\nexport interface EditDialogProps {\n\t/**\n\t * The trigger element. Defaults to an edit button when not provided.\n\t */\n\tchildren?: ReactNode;\n\t/**\n\t * Disables the edit dialog and prevents clicking it.\n\t */\n\tdisabled?: boolean;\n\t/**\n\t * Passed to the default trigger button's `onClick`.\n\t */\n\thandleOpen?: (event: React.MouseEvent) => void;\n\t/**\n\t * By default, a unique ID will be created at render to support keyboard navigation, ARIA roles, and connect the popover to the triggering button. This ID will be applied to the triggering element. `${id}-popover`, `${id}-dialog-heading`, `${id}-dialog-body` are also created.\n\t */\n\tid?: string;\n\t/**\n\t * Set to true when inputs within the popover are modified.\n\t */\n\tisModified?: boolean;\n\t/**\n\t * **Text labels for internationalization**\n\t * This object is merged with the default props object on every render.\n\t * * `cancel`: text for Cancel button\n\t * * `save`: text for Save button\n\t *\n\t * _Tested with snapshot testing._\n\t */\n\tlabels?: EditDialogLabels;\n\t/**\n\t * This function is passed onto the cancel `Button`. Triggered when the trigger button is clicked.\n\t */\n\tonCancel?: (event: React.MouseEvent) => void;\n\t/**\n\t * This function is passed onto the save `Button`. Triggered when the trigger button is clicked.\n\t */\n\tonSave?: (event: React.MouseEvent) => void;\n\t/**\n\t * Popover of type `~/components/popover`. This popover will be cloned and additional props appended, if passed in.\n\t */\n\tpopover?: ReactNode;\n\t/**\n\t * Additional props are passed onto the underlying `Popover`.\n\t */\n\t[key: string]: unknown;\n}\n\ninterface EditDialogState {\n\tisOpen: boolean;\n}\n\nconst defaultProps: Partial<EditDialogProps> = {\n\tlabels: {\n\t\tcancel: 'Cancel',\n\t\tsave: 'Save',\n\t},\n};\n\nclass EditDialog extends React.Component<EditDialogProps, EditDialogState> {\n\t// ### Display Name\n\t// Always use the canonical component name as the React display name.\n\tstatic displayName = POPOVER_EDIT_DIALOG;\n\n\tstatic defaultProps = defaultProps;\n\n\tstate: EditDialogState = { isOpen: false };\n\n\thandleOpen = () => {\n\t\tthis.setState({ isOpen: true });\n\t};\n\n\thandleClose = () => {\n\t\tthis.setState({ isOpen: false });\n\t};\n\n\trender() {\n\t\tconst { onCancel, onSave, ...restProps } = this.props;\n\n\t\t// trigger button will either be passed in children or defaults to an edit button.\n\t\tconst children = this.props.children ? (\n\t\t\tthis.props.children\n\t\t) : (\n\t\t\t<Button\n\t\t\t\tassistiveText={{ icon: 'Edit: Status' }}\n\t\t\t\tclassName=\"slds-button_reset\"\n\t\t\t\tdisabled={this.props.disabled}\n\t\t\t\ticonCategory=\"utility\"\n\t\t\t\ticonClassName=\"slds-button__icon slds-button__icon_hint\"\n\t\t\t\ticonName=\"edit\"\n\t\t\t\tonClick={this.props.handleOpen}\n\t\t\t\tvariant=\"icon\"\n\t\t\t\tstyle={{ verticalAlign: 'middle' }}\n\t\t\t/>\n\t\t);\n\n\t\tconst labels = assign({}, defaultProps.labels, this.props.labels);\n\n\t\treturn (\n\t\t\t<Popover\n\t\t\t\tclassNameFooter={[\n\t\t\t\t\t'slds-p-top_xxx-small',\n\t\t\t\t\t'slds-p-bottom_xx-small',\n\t\t\t\t\t'slds-p-right_large',\n\t\t\t\t]}\n\t\t\t\tclassNameBody={['slds-p-bottom_xx-small']}\n\t\t\t\tfooter={\n\t\t\t\t\t<div className=\"slds-text-align_right slds-text-align_right slds-p-bottom_x-small slds-p-right_xx-small\">\n\t\t\t\t\t\t<Button label={labels.cancel} onClick={onCancel} />\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tdisabled={!this.props.isModified}\n\t\t\t\t\t\t\tvariant=\"brand\"\n\t\t\t\t\t\t\tlabel={labels.save}\n\t\t\t\t\t\t\tonClick={onSave}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t\tstyleFooter={{ borderTop: '0px' }}\n\t\t\t\tonClose={this.handleClose}\n\t\t\t\tonRequestClose={this.handleClose}\n\t\t\t\tonOpen={this.handleOpen}\n\t\t\t\t{...(restProps as unknown as PopoverProps)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</Popover>\n\t\t);\n\t}\n}\n\nexport default EditDialog;\n"],"mappings":"oRAyEA,IAAM,EAAyC,CAC9C,OAAQ,CACP,OAAQ,SACR,KAAM,MACP,CACD,EAEM,EAAN,cAAyB,EAAA,QAAM,SAA4C,CAG1E,OAAO,YAAc,EAAA,oBAErB,OAAO,aAAe,EAEtB,MAAyB,CAAE,OAAQ,EAAM,EAEzC,eAAmB,CAClB,KAAK,SAAS,CAAE,OAAQ,EAAK,CAAC,CAC/B,EAEA,gBAAoB,CACnB,KAAK,SAAS,CAAE,OAAQ,EAAM,CAAC,CAChC,EAEA,QAAS,CACR,GAAM,CAAE,WAAU,SAAQ,GAAG,GAAc,KAAK,MAG1C,EAAW,KAAK,MAAM,SAC3B,KAAK,MAAM,UAEX,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACC,cAAe,CAAE,KAAM,cAAe,EACtC,UAAU,oBACV,SAAU,KAAK,MAAM,SACrB,aAAa,UACb,cAAc,2CACd,SAAS,OACT,QAAS,KAAK,MAAM,WACpB,QAAQ,OACR,MAAO,CAAE,cAAe,QAAS,CACjC,CAAA,EAGI,GAAA,EAAS,EAAA,QAAA,CAAO,CAAC,EAAG,EAAa,OAAQ,KAAK,MAAM,MAAM,EAEhE,OACC,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACC,gBAAiB,CAChB,uBACA,yBACA,oBACD,EACA,cAAe,CAAC,wBAAwB,EACxC,QACC,EAAA,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,0FAAf,SAAA,EACC,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CAAQ,MAAO,EAAO,OAAQ,QAAS,CAAW,CAAA,GAClD,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACC,SAAU,CAAC,KAAK,MAAM,WACtB,QAAQ,QACR,MAAO,EAAO,KACd,QAAS,CACT,CAAA,CACG,IAEN,YAAa,CAAE,UAAW,KAAM,EAChC,QAAS,KAAK,YACd,eAAgB,KAAK,YACrB,OAAQ,KAAK,WACb,GAAK,EAEJ,UACO,CAAA,CAEX,CACD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("../icon-settings/index.cjs"),
|
|
1
|
+
const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("../icon-settings/index.cjs"),r=require("../../utilities/key-code.cjs"),i=require("../utilities/dialog/index.cjs"),a=require("../icon/index.cjs"),ee=require("../../utilities/get-component-doc.cjs"),te=require("../button/index.cjs"),ne=require("../../utilities/warning/deprecated-property.cjs"),re=require("../media-object/index.cjs"),ie=require("../../utilities/keyboard-navigable-dialog.cjs"),ae=require("./component.cjs");let o=require("react");o=e.__toESM(o,1);let s=require("classnames");s=e.__toESM(s,1);let c=require("react/jsx-runtime");var l=typeof document<`u`,u=l?document.createElement(`span`):{style:{}};l&&(u.style.top=`0`,u.style.left=`0`,u.style.width=`100%`,u.style.height=`100%`,u.style.position=`absolute`);var d=null,f=[`top left`,`top`,`top right`,`bottom left`,`bottom`,`bottom right`],oe={closeButton:`Close dialog`},p=(0,o.forwardRef)(({align:e=`right`,assistiveText:f,ariaLabelledby:p,children:se,body:m,classNameBody:h,classNameFooter:ce,footerClassName:g,className:le,classNameDialog:ue,contentsClassName:de,disabled:fe=!1,footer:_,footerStyle:v,footerWalkthroughActions:y,hasNoCloseButton:pe=!1,hasNoNubbin:me=!1,hasStaticAlignment:he=!1,hasNoTriggerStyles:ge=!1,heading:b,icon:_e,id:ve,isOpen:x,offset:ye,onClick:S,onClose:C,onFocus:w,onKeyDown:T,onMouseDown:be,onMouseEnter:E,onMouseLeave:D,onOpen:O,onRequestClose:k,onRequestTargetElement:A,openOn:j=`click`,overlay:M,position:xe=`absolute`,stepText:N,style:Se,styleDialog:Ce,styleFooter:P,triggerClassName:F,variant:I=`base`,hoverCloseDelay:L=300,closeButtonAssistiveText:we},R)=>{(0,o.useEffect)(()=>{if(process.env.NODE_ENV!==`production`){let e=ee.default(ae.default);[[`contentsClassName`,de,`classNameDialog`],[`footerClassName`,g,`classNameFooter`],[`footerStyle`,v,`styleFooter`],[`triggerClassName`,F,`className`]].forEach(([n,r,i])=>{ne.default(t.POPOVER,r,n,i,e(i))})}},[]);let Te=(0,o.useId)(),z=ve||Te,Ee=(0,o.useContext)(n.IconSettingsContext),De={...oe,...f},Oe=we||De.closeButton,[ke,B]=(0,o.useState)(!1),[V,Ae]=(0,o.useState)(!1),H=(0,o.useRef)(null),je=(0,o.useRef)(null),U=(0,o.useRef)(!1),W=(0,o.useRef)(null),G=(0,o.useRef)(null),Me=(0,o.useRef)(!1),K=!fe&&(x===void 0?ke:x),Ne=(0,o.useCallback)(()=>{if(A){let e=A();if(e)return e}return H.current},[A]),Pe=(0,o.useCallback)((e,t)=>{let n=t?.componentWillUnmount||!1;d?.getId()===z&&(d=null),C&&C(void 0,{componentWillUnmount:n})},[z,C]),Fe=(0,o.useCallback)((e,t)=>{O&&O(void 0,{portal:t?.portal})},[O]),q=(0,o.useCallback)((e,t)=>{K&&(k&&k(e,t),d?.getId()===z&&(d=null),B(!1),U.current=!1)},[K,z,k]),J=(0,o.useRef)(q);(0,o.useEffect)(()=>{J.current=q},[q]);let Y=(0,o.useCallback)(()=>{K||(d&&d.getId()!==z&&d.handleClose(void 0,{trigger:`newPopover`,id:d.getId()}),d={handleClose:(e,t)=>J.current(e,t),getId:()=>z},B(!0))},[K,z]),X=(0,o.useCallback)(e=>{q(e,{trigger:`cancel`})},[q]);(0,o.useCallback)(e=>{q(e,{trigger:`clickOutside`})},[q]);let Ie=(0,o.useCallback)(e=>{U.current=!0,!K&&j===`hover`?Y():W.current&&clearTimeout(W.current),E&&E(e)},[K,j,Y,E]),Le=(0,o.useCallback)(e=>{K&&(W.current=setTimeout(()=>{q(void 0,{trigger:`mouseLeave`})},L)),D&&D(e)},[K,L,q,D]),Z=(0,o.useCallback)((e,t)=>{K?q(e,{trigger:`triggerClick`}):Y(),S&&S(e),t&&t(e)},[K,Y,q,S]),Re=(0,o.useCallback)(e=>{K||Y(),w&&w(e)},[K,Y,w]),ze=(0,o.useCallback)(e=>{K?X(e):Y()},[K,X,Y]),Be=(0,o.useCallback)(e=>{e.keyCode&&(e.keyCode!==r.default.TAB&&ie.default({event:e,isOpen:K,handleClick:e=>Z(e),keyCode:e.keyCode,eventTarget:e.target,toggleOpen:()=>ze(e),trigger:H.current}),T&&T(e))},[K,Z,ze,T]),Q=(0,o.useCallback)(e=>{typeof M==`function`&&l?M(e,u):M&&e&&!G.current&&l?(G.current=u,document.querySelector(`body`)?.appendChild(u)):!e&&G.current?.parentNode&&(G.current.parentNode.removeChild(G.current),G.current=null)},[M]),Ve=(0,o.useCallback)(e=>{H.current=e,typeof R==`function`?R(e):R&&(R.current=e),e&&!V&&Ae(!0)},[V,R]),He=(0,o.useCallback)(e=>{je.current=e},[]);(0,o.useEffect)(()=>()=>{Me.current=!0,d?.getId()===z&&(d=null),Q(!1)},[z,Q]),(0,o.useEffect)(()=>{Q(K)},[K,Q]);let Ue=()=>{let e=I===`error`||I===`warning`;if(!(b||e)||I===`walkthrough-action`||I===`feature`)return null;let t={error:(0,c.jsx)(a.default,{category:`utility`,name:`error`,size:`x-small`,inverse:!0}),warning:(0,c.jsx)(a.default,{category:`utility`,name:`warning`,size:`x-small`,inverse:!0})};return e?(0,c.jsx)(`header`,{className:`slds-popover__header`,children:(0,c.jsx)(re.default,{body:(0,c.jsx)(`h2`,{id:p||`${z}-dialog-heading`,className:`slds-truncate slds-text-heading_medium`,title:typeof b==`string`?b:void 0,children:b}),figure:t[I],verticalCenter:!0})}):(0,c.jsx)(`header`,{className:(0,s.default)(`slds-popover__header`,{"slds-p-vertical_medium":I===`walkthrough`}),children:(0,c.jsx)(`h2`,{id:p||`${z}-dialog-heading`,className:(0,s.default)({"slds-text-heading_small":I!==`walkthrough`,"slds-text-heading_medium":I===`walkthrough`}),children:b})})},We=()=>I===`error`||I===`warning`?(0,c.jsx)(`div`,{id:`${z}-dialog-body`,className:(0,s.default)(`slds-popover__body`,h),children:m}):I===`walkthrough-action`||I===`feature`?(0,c.jsx)(`div`,{className:(0,s.default)(`slds-popover__body`,h),id:`${z}-dialog-body`,children:(0,c.jsxs)(`div`,{className:`slds-media`,children:[(0,c.jsx)(`div`,{className:`slds-media__figure`,children:I===`walkthrough-action`?(0,c.jsx)(a.default,{category:`utility`,name:`touch_action`,size:`small`,inverse:!0}):_e}),(0,c.jsxs)(`div`,{className:`slds-media__body`,children:[b&&(0,c.jsx)(`h2`,{id:p||`${z}-dialog-heading`,className:`slds-text-heading_small`,children:b}),m,N&&(0,c.jsx)(`p`,{className:`slds-m-top_medium slds-text-title`,children:N})]})]})}):(0,c.jsx)(`div`,{id:`${z}-dialog-body`,className:(0,s.default)(`slds-popover__body`,h),children:m}),Ge=()=>{let e=(0,s.default)(`slds-popover__footer`,g,ce),t=v||P?{...v,...P}:void 0;return _?(0,c.jsx)(`footer`,{className:e,style:t,children:_}):I!==`walkthrough-action`&&(y||N)?(0,c.jsx)(`footer`,{className:e,style:t,children:(0,c.jsxs)(`div`,{className:`slds-grid slds-grid_vertical-align-center`,children:[N&&(0,c.jsx)(`span`,{className:`slds-text-title`,children:N}),y&&(0,c.jsx)(`div`,{className:`slds-col_bump-left`,style:{display:`inline-block`},children:y})]})}):null},Ke=()=>{if(!K)return null;let t=`ignore-click-${z}`;return(0,c.jsxs)(i.default,{hasNubbin:!me,align:e,contentsClassName:(0,s.default)(de,`ignore-react-onclickoutside`,`slds-popover`,{"slds-popover_error":I===`error`},{"slds-popover_walkthrough":I===`walkthrough`||I===`walkthrough-action`||I===`feature`},{"slds-popover_walkthrough-alt":I===`walkthrough-action`},{"slds-popover_feature":I===`feature`},{"slds-popover_warning":I===`warning`},ue),context:Ee,hasStaticAlignment:he,offset:ye,onClose:Pe,onOpen:Fe,onKeyDown:Be,onMouseEnter:j===`hover`?Ie:void 0,onMouseLeave:j===`hover`?Le:void 0,outsideClickIgnoreClass:t,onRequestTargetElement:Ne,position:xe,style:Ce,variant:`popover`,ref:He,containerProps:{id:`${z}-popover`,"aria-labelledby":p||`${z}-dialog-heading`,"aria-describedby":`${z}-dialog-body`},children:[!pe&&(0,c.jsx)(te.default,{assistiveText:{icon:Oe},iconCategory:`utility`,iconName:`close`,className:(0,s.default)(`slds-button slds-button_icon-small slds-float_right slds-popover__close slds-button_icon`,{"slds-button_icon-inverse":I===`walkthrough`||I===`walkthrough-action`||I===`feature`}),onClick:X,variant:`icon`,inverse:I===`error`||I===`warning`}),Ue(),We(),Ge()]})},$=[],qe=null;o.default.Children.forEach(se,(e,t)=>{if(t===0&&o.default.isValidElement(e)){let t=e.props,n={"aria-haspopup":`dialog`,id:z,onClick:j===`click`||j===`hybrid`?e=>{Z(e,t.onClick)}:t.onClick,onFocus:j===`hover`?Re:void 0,onMouseDown:be,onMouseEnter:j===`hover`||j===`hybrid`?Ie:void 0,onMouseLeave:j===`hover`||j===`hybrid`?Le:void 0,tabIndex:t.tabIndex||0};qe=o.default.cloneElement(e,n)}else e&&$.push(e)});let Je={display:ge?void 0:`inline-block`,...Se};return(0,c.jsxs)(`div`,{className:(0,s.default)(F,le)||void 0,style:Je,ref:Ve,children:[qe,$.length>0?$:null,Ke()]})});p.displayName=t.POPOVER,exports.PopoverNubbinPositions=f,exports.default=p;
|
|
2
2
|
//# sourceMappingURL=popover.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.cjs","names":[],"sources":["../../../../components/popover/popover.tsx"],"sourcesContent":["/* eslint-disable max-lines */\n/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport React, {\n\tuseState,\n\tuseEffect,\n\tuseRef,\n\tuseCallback,\n\tuseId,\n\tuseContext,\n\ttype ReactNode,\n\ttype ReactElement,\n\ttype MouseEvent,\n\ttype KeyboardEvent,\n\ttype FocusEvent,\n\ttype CSSProperties,\n} from 'react';\nimport classNames from 'classnames';\n\nimport Button from '../button';\nimport MediaObject from '../media-object';\nimport Icon from '../icon';\nimport Dialog from '../utilities/dialog';\nimport keyboardNavigableDialog from '../../utilities/keyboard-navigable-dialog';\nimport KEYS from '../../utilities/key-code';\nimport { POPOVER } from '../../utilities/constants';\nimport { IconSettingsContext } from '../icon-settings';\n\nconst documentDefined = typeof document !== 'undefined';\n\n// Shared overlay element for click-outside detection over iframes\nconst overlay = documentDefined\n\t? document.createElement('span')\n\t: ({ style: {} } as HTMLSpanElement);\nif (documentDefined) {\n\toverlay.style.top = '0';\n\toverlay.style.left = '0';\n\toverlay.style.width = '100%';\n\toverlay.style.height = '100%';\n\toverlay.style.position = 'absolute';\n}\n\n// Track currently open popover for single-popover-at-a-time behavior\nlet currentOpenPopover: {\n\thandleClose: (\n\t\tevent: MouseEvent | KeyboardEvent | undefined,\n\t\tdata: PopoverRequestCloseData\n\t) => void;\n\tgetId: () => string;\n} | null = null;\n\n/**\n * Popover alignment options\n */\nexport type PopoverAlign =\n\t| 'top'\n\t| 'top left'\n\t| 'top right'\n\t| 'right'\n\t| 'right top'\n\t| 'right bottom'\n\t| 'bottom'\n\t| 'bottom left'\n\t| 'bottom right'\n\t| 'left'\n\t| 'left top'\n\t| 'left bottom';\n\n/**\n * Popover position options\n */\nexport type PopoverPosition =\n\t'absolute' | 'overflowBoundaryElement' | 'relative';\n\n/**\n * Popover variant options\n */\nexport type PopoverVariant =\n\t| 'base'\n\t| 'error'\n\t| 'feature'\n\t| 'walkthrough'\n\t| 'walkthrough-action'\n\t| 'warning';\n\n/**\n * Assistive text for Popover\n */\nexport interface PopoverAssistiveText {\n\tcloseButton?: string;\n}\n\n/**\n * What caused `onRequestClose` to fire:\n * * `cancel`: the close button was clicked or Escape was pressed\n * * `clickOutside`: a click landed outside the popover\n * * `mouseLeave`: the mouse left the trigger/popover (`openOn` `hover`/`hybrid`) and `hoverCloseDelay` elapsed\n * * `newPopover`: another Popover opened (only one can be open at a time)\n * * `triggerClick`: the trigger was clicked while the popover was open\n */\nexport type PopoverRequestCloseTrigger =\n\t'cancel' | 'clickOutside' | 'mouseLeave' | 'newPopover' | 'triggerClick';\n\n/**\n * Data passed to `onRequestClose`\n */\nexport interface PopoverRequestCloseData {\n\t/** What caused the close request */\n\ttrigger: PopoverRequestCloseTrigger;\n\t/** HTML id of the popover being closed. Only present when `trigger` is `newPopover`. */\n\tid?: string;\n}\n\n/**\n * Data passed to `onOpen`\n */\nexport interface PopoverOpenData {\n\t/** The rendered popover dialog element */\n\tportal?: HTMLElement;\n}\n\n/**\n * Data passed to `onClose`\n */\nexport interface PopoverCloseData {\n\t/** `true` when the popover dialog is closing because it is being unmounted */\n\tcomponentWillUnmount: boolean;\n}\n\n/**\n * Props for the Popover component\n */\nexport interface PopoverProps {\n\t/** Alignment relative to trigger */\n\talign?: PopoverAlign;\n\t/** Accessibility labels */\n\tassistiveText?: PopoverAssistiveText;\n\t/** HTML id of heading for aria-labelledby */\n\tariaLabelledby?: string;\n\t/** Trigger element (first child) and optional other children */\n\tchildren: ReactNode;\n\t/** Popover body content */\n\tbody: ReactNode;\n\t/** CSS classes for body */\n\tclassNameBody?: string | string[] | Record<string, boolean>;\n\t/** CSS classes for footer */\n\tclassNameFooter?: string | string[] | Record<string, boolean>;\n\t/** @deprecated Use classNameFooter */\n\tfooterClassName?: string | string[] | Record<string, boolean>;\n\t/** CSS classes for popover container */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** CSS classes for contents wrapper */\n\tcontentsClassName?: string | string[] | Record<string, boolean>;\n\t/** Disable the popover */\n\tdisabled?: boolean;\n\t/** Footer content */\n\tfooter?: ReactNode;\n\t/** Footer styles */\n\tfooterStyle?: CSSProperties;\n\t/** Walkthrough footer actions */\n\tfooterWalkthroughActions?: ReactNode | ReactNode[];\n\t/** Hide close button */\n\thasNoCloseButton?: boolean;\n\t/** Hide nubbin/arrow */\n\thasNoNubbin?: boolean;\n\t/** Prevent position flipping */\n\thasStaticAlignment?: boolean;\n\t/** Remove trigger inline-block style */\n\thasNoTriggerStyles?: boolean;\n\t/** Popover heading */\n\theading?: ReactNode;\n\t/** Icon for feature variant */\n\ticon?: ReactNode;\n\t/** HTML id */\n\tid?: string;\n\t/** Controlled open state */\n\tisOpen?: boolean;\n\t/** Offset from target */\n\toffset?: string;\n\t/** Click handler */\n\tonClick?: (event: MouseEvent) => void;\n\t/** Called after the popover dialog has closed (unmounted). There is no triggering event, so `event` is `undefined`. */\n\tonClose?: (event: undefined, data: PopoverCloseData) => void;\n\t/** Focus handler */\n\tonFocus?: (event: FocusEvent) => void;\n\t/** Key down handler */\n\tonKeyDown?: (event: KeyboardEvent) => void;\n\t/** Mouse down handler */\n\tonMouseDown?: (event: MouseEvent) => void;\n\t/** Mouse enter handler */\n\tonMouseEnter?: (event: MouseEvent) => void;\n\t/** Mouse leave handler */\n\tonMouseLeave?: (event: MouseEvent) => void;\n\t/** Called after the popover dialog has opened and rendered. There is no triggering event, so `event` is `undefined`. */\n\tonOpen?: (event: undefined, data: PopoverOpenData) => void;\n\t/**\n\t * Called when the popover requests to close. `data.trigger` says why. `event` is the triggering\n\t * click or key event, or `undefined` when there is none (`mouseLeave` timer, `newPopover`).\n\t */\n\tonRequestClose?: (\n\t\tevent: MouseEvent | KeyboardEvent | undefined,\n\t\tdata: PopoverRequestCloseData\n\t) => void;\n\t/** Custom target element getter */\n\tonRequestTargetElement?: () => HTMLElement | null;\n\t/** Open trigger type */\n\topenOn?: 'click' | 'hover' | 'hybrid';\n\t/** Overlay for click-outside on iframes */\n\toverlay?: boolean | ((isOpen: boolean, overlayElement: HTMLElement) => void);\n\t/** Positioning strategy */\n\tposition?: PopoverPosition;\n\t/** Walkthrough step text */\n\tstepText?: string;\n\t/** Custom styles */\n\tstyle?: CSSProperties;\n\t/** CSS classes for trigger wrapper */\n\ttriggerClassName?: string | string[] | Record<string, boolean>;\n\t/** Popover variant */\n\tvariant?: PopoverVariant;\n\t/** Delay before closing on hover (ms) */\n\thoverCloseDelay?: number;\n\t/** @deprecated Use assistiveText.closeButton */\n\tcloseButtonAssistiveText?: string;\n}\n\n// Nubbin positions for export (legacy)\nexport const PopoverNubbinPositions = [\n\t'top left',\n\t'top',\n\t'top right',\n\t'bottom left',\n\t'bottom',\n\t'bottom right',\n];\n\nconst defaultAssistiveText: PopoverAssistiveText = {\n\tcloseButton: 'Close dialog',\n};\n\n/**\n * The Popover component is a non-modal dialog. It should be paired with a clickable\n * trigger such as a Button. It traps focus from the page and must be exited if focus\n * needs to be outside the Popover.\n */\nconst Popover = ({\n\talign = 'right',\n\tassistiveText: propAssistiveText,\n\tariaLabelledby,\n\tchildren,\n\tbody,\n\tclassNameBody,\n\tclassNameFooter,\n\tfooterClassName,\n\tclassName,\n\tcontentsClassName,\n\tdisabled = false,\n\tfooter,\n\tfooterStyle,\n\tfooterWalkthroughActions,\n\thasNoCloseButton = false,\n\thasNoNubbin = false,\n\thasStaticAlignment = false,\n\thasNoTriggerStyles = false,\n\theading,\n\ticon,\n\tid: propId,\n\tisOpen: controlledIsOpen,\n\toffset,\n\tonClick,\n\tonClose,\n\tonFocus,\n\tonKeyDown,\n\tonMouseDown,\n\tonMouseEnter,\n\tonMouseLeave,\n\tonOpen,\n\tonRequestClose,\n\tonRequestTargetElement,\n\topenOn = 'click',\n\toverlay: overlayProp,\n\tposition = 'absolute',\n\tstepText,\n\tstyle,\n\ttriggerClassName,\n\tvariant = 'base',\n\thoverCloseDelay = 300,\n\tcloseButtonAssistiveText,\n}: PopoverProps): ReactElement => {\n\tconst generatedId = useId();\n\tconst id = propId || generatedId;\n\tconst context = useContext(IconSettingsContext);\n\n\tconst assistiveText = { ...defaultAssistiveText, ...propAssistiveText };\n\tconst finalCloseButtonAssistiveText =\n\t\tcloseButtonAssistiveText || assistiveText.closeButton;\n\n\t// State\n\tconst [internalIsOpen, setInternalIsOpen] = useState(false);\n\tconst [inputRendered, setInputRendered] = useState(false);\n\n\t// Refs\n\tconst triggerRef = useRef<HTMLDivElement>(null);\n\tconst dialogRef = useRef<HTMLElement>(null);\n\tconst isHoverRef = useRef(false);\n\tconst isClosingRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\tconst overlayRef = useRef<HTMLSpanElement | null>(null);\n\tconst isUnmountingRef = useRef(false);\n\n\t// Derived state\n\tconst isOpen =\n\t\t!disabled &&\n\t\t(controlledIsOpen !== undefined ? controlledIsOpen : internalIsOpen);\n\n\t// Get target element for positioning\n\tconst getTargetElement = useCallback(() => {\n\t\tif (onRequestTargetElement) {\n\t\t\tconst target = onRequestTargetElement();\n\t\t\tif (target) return target;\n\t\t}\n\t\treturn triggerRef.current;\n\t}, [onRequestTargetElement]);\n\n\t// Handle dialog close (when unmounted)\n\tconst handleDialogClose = useCallback(\n\t\t(\n\t\t\t_event?: React.SyntheticEvent,\n\t\t\tdata?: { componentWillUnmount?: boolean }\n\t\t) => {\n\t\t\tconst componentWillUnmount = data?.componentWillUnmount || false;\n\n\t\t\tif (currentOpenPopover?.getId() === id) {\n\t\t\t\tcurrentOpenPopover = null;\n\t\t\t}\n\n\t\t\tif (onClose) {\n\t\t\t\tonClose(undefined, { componentWillUnmount });\n\t\t\t}\n\t\t},\n\t\t[id, onClose]\n\t);\n\n\t// Handle dialog open (after it has rendered)\n\tconst handleDialogOpen = useCallback(\n\t\t(_event?: unknown, data?: { portal?: HTMLElement }) => {\n\t\t\tif (onOpen) {\n\t\t\t\tonOpen(undefined, { portal: data?.portal });\n\t\t\t}\n\t\t},\n\t\t[onOpen]\n\t);\n\n\t// Handle close\n\tconst handleClose = useCallback(\n\t\t(\n\t\t\tevent: MouseEvent | KeyboardEvent | undefined,\n\t\t\tdata: PopoverRequestCloseData\n\t\t) => {\n\t\t\tif (isOpen) {\n\t\t\t\tif (onRequestClose) {\n\t\t\t\t\tonRequestClose(event, data);\n\t\t\t\t}\n\n\t\t\t\tif (currentOpenPopover?.getId() === id) {\n\t\t\t\t\tcurrentOpenPopover = null;\n\t\t\t\t}\n\n\t\t\t\tsetInternalIsOpen(false);\n\t\t\t\tisHoverRef.current = false;\n\t\t\t}\n\t\t},\n\t\t[isOpen, id, onRequestClose]\n\t);\n\n\t// Latest `handleClose`, so the \"close the other open popover\" path does not call a stale\n\t// closure from when this popover opened (whose `isOpen` was still `false`).\n\tconst handleCloseRef = useRef(handleClose);\n\tuseEffect(() => {\n\t\thandleCloseRef.current = handleClose;\n\t}, [handleClose]);\n\n\t// Handle open\n\tconst handleOpen = useCallback(() => {\n\t\tif (!isOpen) {\n\t\t\t// Close any other open popover\n\t\t\tif (currentOpenPopover && currentOpenPopover.getId() !== id) {\n\t\t\t\tcurrentOpenPopover.handleClose(undefined, {\n\t\t\t\t\ttrigger: 'newPopover',\n\t\t\t\t\tid: currentOpenPopover.getId(),\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tcurrentOpenPopover = {\n\t\t\t\thandleClose: (event, data) => handleCloseRef.current(event, data),\n\t\t\t\tgetId: () => id,\n\t\t\t};\n\n\t\t\tsetInternalIsOpen(true);\n\t\t}\n\t}, [isOpen, id]);\n\n\t// Handle cancel (close button or escape)\n\tconst handleCancel = useCallback(\n\t\t(event: MouseEvent | KeyboardEvent) => {\n\t\t\thandleClose(event, { trigger: 'cancel' });\n\t\t},\n\t\t[handleClose]\n\t);\n\n\t// Handle click outside\n\tconst handleClickOutside = useCallback(\n\t\t(event: MouseEvent) => {\n\t\t\thandleClose(event, { trigger: 'clickOutside' });\n\t\t},\n\t\t[handleClose]\n\t);\n\n\t// Handle mouse enter\n\tconst handleMouseEnter = useCallback(\n\t\t(event: MouseEvent) => {\n\t\t\tisHoverRef.current = true;\n\n\t\t\tif (!isOpen && openOn === 'hover') {\n\t\t\t\thandleOpen();\n\t\t\t} else {\n\t\t\t\tif (isClosingRef.current) {\n\t\t\t\t\tclearTimeout(isClosingRef.current);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (onMouseEnter) {\n\t\t\t\tonMouseEnter(event);\n\t\t\t}\n\t\t},\n\t\t[isOpen, openOn, handleOpen, onMouseEnter]\n\t);\n\n\t// Handle mouse leave\n\tconst handleMouseLeave = useCallback(\n\t\t(event: MouseEvent) => {\n\t\t\tif (isOpen) {\n\t\t\t\tisClosingRef.current = setTimeout(() => {\n\t\t\t\t\thandleClose(undefined, { trigger: 'mouseLeave' });\n\t\t\t\t}, hoverCloseDelay);\n\t\t\t}\n\n\t\t\tif (onMouseLeave) {\n\t\t\t\tonMouseLeave(event);\n\t\t\t}\n\t\t},\n\t\t[isOpen, hoverCloseDelay, handleClose, onMouseLeave]\n\t);\n\n\t// Handle click\n\tconst handleClick = useCallback(\n\t\t(event: MouseEvent, triggerOnClickCallback?: (e: MouseEvent) => void) => {\n\t\t\tif (!isOpen) {\n\t\t\t\thandleOpen();\n\t\t\t} else {\n\t\t\t\thandleClose(event, { trigger: 'triggerClick' });\n\t\t\t}\n\n\t\t\tif (onClick) {\n\t\t\t\tonClick(event);\n\t\t\t}\n\n\t\t\tif (triggerOnClickCallback) {\n\t\t\t\ttriggerOnClickCallback(event);\n\t\t\t}\n\t\t},\n\t\t[isOpen, handleOpen, handleClose, onClick]\n\t);\n\n\t// Handle focus\n\tconst handleFocus = useCallback(\n\t\t(event: FocusEvent) => {\n\t\t\tif (!isOpen) {\n\t\t\t\thandleOpen();\n\t\t\t}\n\n\t\t\tif (onFocus) {\n\t\t\t\tonFocus(event);\n\t\t\t}\n\t\t},\n\t\t[isOpen, handleOpen, onFocus]\n\t);\n\n\t// Toggle from keyboard\n\tconst toggleOpenFromKeyboard = useCallback(\n\t\t(event: KeyboardEvent) => {\n\t\t\tif (isOpen) {\n\t\t\t\thandleCancel(event);\n\t\t\t} else {\n\t\t\t\thandleOpen();\n\t\t\t}\n\t\t},\n\t\t[isOpen, handleCancel, handleOpen]\n\t);\n\n\t// Handle key down\n\tconst handleKeyDown = useCallback(\n\t\t(event: KeyboardEvent) => {\n\t\t\tif (event.keyCode) {\n\t\t\t\tif (event.keyCode !== KEYS.TAB) {\n\t\t\t\t\tkeyboardNavigableDialog({\n\t\t\t\t\t\tevent,\n\t\t\t\t\t\tisOpen,\n\t\t\t\t\t\thandleClick: (e: MouseEvent) => handleClick(e),\n\t\t\t\t\t\tkeyCode: event.keyCode,\n\t\t\t\t\t\teventTarget: event.target,\n\t\t\t\t\t\t// keyboardNavigableDialog calls `toggleOpen()` without the event; pass it through\n\t\t\t\t\t\ttoggleOpen: () => toggleOpenFromKeyboard(event),\n\t\t\t\t\t\ttrigger: triggerRef.current,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif (onKeyDown) {\n\t\t\t\t\tonKeyDown(event);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[isOpen, handleClick, toggleOpenFromKeyboard, onKeyDown]\n\t);\n\n\t// Render overlay for click-outside detection\n\tconst renderOverlay = useCallback(\n\t\t(shouldShow: boolean) => {\n\t\t\tif (typeof overlayProp === 'function' && documentDefined) {\n\t\t\t\toverlayProp(shouldShow, overlay);\n\t\t\t} else if (\n\t\t\t\toverlayProp &&\n\t\t\t\tshouldShow &&\n\t\t\t\t!overlayRef.current &&\n\t\t\t\tdocumentDefined\n\t\t\t) {\n\t\t\t\toverlayRef.current = overlay;\n\t\t\t\tdocument.querySelector('body')?.appendChild(overlay);\n\t\t\t} else if (!shouldShow && overlayRef.current?.parentNode) {\n\t\t\t\toverlayRef.current.parentNode.removeChild(overlayRef.current);\n\t\t\t\toverlayRef.current = null;\n\t\t\t}\n\t\t},\n\t\t[overlayProp]\n\t);\n\n\t// Container ref callback\n\tconst setContainerRef = useCallback(\n\t\t(component: HTMLDivElement | null) => {\n\t\t\t(triggerRef as React.MutableRefObject<HTMLDivElement | null>).current =\n\t\t\t\tcomponent;\n\t\t\tif (component && !inputRendered) {\n\t\t\t\tsetInputRendered(true);\n\t\t\t}\n\t\t},\n\t\t[inputRendered]\n\t);\n\n\t// Dialog ref callback\n\tconst setMenuRef = useCallback((component: HTMLElement | null) => {\n\t\t(dialogRef as React.MutableRefObject<HTMLElement | null>).current =\n\t\t\tcomponent;\n\t}, []);\n\n\t// Cleanup on unmount\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tisUnmountingRef.current = true;\n\t\t\tif (currentOpenPopover?.getId() === id) {\n\t\t\t\tcurrentOpenPopover = null;\n\t\t\t}\n\t\t\trenderOverlay(false);\n\t\t};\n\t}, [id, renderOverlay]);\n\n\t// Update overlay when isOpen changes\n\tuseEffect(() => {\n\t\trenderOverlay(isOpen);\n\t}, [isOpen, renderOverlay]);\n\n\t// Render header\n\tconst renderHeader = () => {\n\t\tconst hasThemedHeader = variant === 'error' || variant === 'warning';\n\t\tconst hasDefinedHeader = heading || hasThemedHeader;\n\n\t\tif (\n\t\t\t!hasDefinedHeader ||\n\t\t\tvariant === 'walkthrough-action' ||\n\t\t\tvariant === 'feature'\n\t\t) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst headerIcon = {\n\t\t\terror: <Icon category=\"utility\" name=\"error\" size=\"x-small\" inverse />,\n\t\t\twarning: (\n\t\t\t\t<Icon category=\"utility\" name=\"warning\" size=\"x-small\" inverse />\n\t\t\t),\n\t\t};\n\n\t\tif (hasThemedHeader) {\n\t\t\treturn (\n\t\t\t\t<header className=\"slds-popover__header\">\n\t\t\t\t\t<MediaObject\n\t\t\t\t\t\tbody={\n\t\t\t\t\t\t\t<h2\n\t\t\t\t\t\t\t\tid={ariaLabelledby || `${id}-dialog-heading`}\n\t\t\t\t\t\t\t\tclassName=\"slds-truncate slds-text-heading_medium\"\n\t\t\t\t\t\t\t\ttitle={typeof heading === 'string' ? heading : undefined}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{heading}\n\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfigure={headerIcon[variant as 'error' | 'warning']}\n\t\t\t\t\t\tverticalCenter\n\t\t\t\t\t/>\n\t\t\t\t</header>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<header\n\t\t\t\tclassName={classNames('slds-popover__header', {\n\t\t\t\t\t'slds-p-vertical_medium': variant === 'walkthrough',\n\t\t\t\t})}\n\t\t\t>\n\t\t\t\t<h2\n\t\t\t\t\tid={ariaLabelledby || `${id}-dialog-heading`}\n\t\t\t\t\tclassName={classNames({\n\t\t\t\t\t\t'slds-text-heading_small': variant !== 'walkthrough',\n\t\t\t\t\t\t'slds-text-heading_medium': variant === 'walkthrough',\n\t\t\t\t\t})}\n\t\t\t\t>\n\t\t\t\t\t{heading}\n\t\t\t\t</h2>\n\t\t\t</header>\n\t\t);\n\t};\n\n\t// Render body\n\tconst renderBody = () => {\n\t\tif (variant === 'error' || variant === 'warning') {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tid={`${id}-dialog-body`}\n\t\t\t\t\tclassName={classNames('slds-popover__body', classNameBody as string)}\n\t\t\t\t>\n\t\t\t\t\t{body}\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\tif (variant === 'walkthrough-action' || variant === 'feature') {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tclassName={classNames('slds-popover__body', classNameBody as string)}\n\t\t\t\t\tid={`${id}-dialog-body`}\n\t\t\t\t>\n\t\t\t\t\t<div className=\"slds-media\">\n\t\t\t\t\t\t<div className=\"slds-media__figure\">\n\t\t\t\t\t\t\t{variant === 'walkthrough-action' ? (\n\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\t\t\t\tname=\"touch_action\"\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\tinverse\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\ticon\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"slds-media__body\">\n\t\t\t\t\t\t\t{heading && (\n\t\t\t\t\t\t\t\t<h2\n\t\t\t\t\t\t\t\t\tid={ariaLabelledby || `${id}-dialog-heading`}\n\t\t\t\t\t\t\t\t\tclassName=\"slds-text-heading_small\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{heading}\n\t\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{body}\n\t\t\t\t\t\t\t{stepText && (\n\t\t\t\t\t\t\t\t<p className=\"slds-m-top_medium slds-text-title\">{stepText}</p>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tid={`${id}-dialog-body`}\n\t\t\t\tclassName={classNames('slds-popover__body', classNameBody as string)}\n\t\t\t>\n\t\t\t\t{body}\n\t\t\t</div>\n\t\t);\n\t};\n\n\t// Render footer\n\tconst renderFooter = () => {\n\t\tif (footer) {\n\t\t\treturn (\n\t\t\t\t<footer\n\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t'slds-popover__footer',\n\t\t\t\t\t\tclassNameFooter as string,\n\t\t\t\t\t\tfooterClassName as string\n\t\t\t\t\t)}\n\t\t\t\t\tstyle={footerStyle}\n\t\t\t\t>\n\t\t\t\t\t{footer}\n\t\t\t\t</footer>\n\t\t\t);\n\t\t}\n\n\t\tif (\n\t\t\tvariant !== 'walkthrough-action' &&\n\t\t\t(footerWalkthroughActions || stepText)\n\t\t) {\n\t\t\treturn (\n\t\t\t\t<footer\n\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t'slds-popover__footer',\n\t\t\t\t\t\tclassNameFooter as string,\n\t\t\t\t\t\tfooterClassName as string\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t<div className=\"slds-grid slds-grid_vertical-align-center\">\n\t\t\t\t\t\t{stepText && <span className=\"slds-text-title\">{stepText}</span>}\n\t\t\t\t\t\t{footerWalkthroughActions && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName=\"slds-col_bump-left\"\n\t\t\t\t\t\t\t\tstyle={{ display: 'inline-block' }}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{footerWalkthroughActions}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</footer>\n\t\t\t);\n\t\t}\n\n\t\treturn null;\n\t};\n\n\t// Render dialog\n\tconst renderDialog = () => {\n\t\tif (!isOpen) return null;\n\n\t\tconst outsideClickIgnoreClass = `ignore-click-${id}`;\n\n\t\treturn (\n\t\t\t<Dialog\n\t\t\t\thasNubbin={!hasNoNubbin}\n\t\t\t\talign={align}\n\t\t\t\tcontentsClassName={classNames(\n\t\t\t\t\tcontentsClassName as string,\n\t\t\t\t\t'ignore-react-onclickoutside',\n\t\t\t\t\t'slds-popover',\n\t\t\t\t\t{ 'slds-popover_error': variant === 'error' },\n\t\t\t\t\t{\n\t\t\t\t\t\t'slds-popover_walkthrough':\n\t\t\t\t\t\t\tvariant === 'walkthrough' ||\n\t\t\t\t\t\t\tvariant === 'walkthrough-action' ||\n\t\t\t\t\t\t\tvariant === 'feature',\n\t\t\t\t\t},\n\t\t\t\t\t{ 'slds-popover_walkthrough-alt': variant === 'walkthrough-action' },\n\t\t\t\t\t{ 'slds-popover_feature': variant === 'feature' },\n\t\t\t\t\t{ 'slds-popover_warning': variant === 'warning' },\n\t\t\t\t\tclassName as string\n\t\t\t\t)}\n\t\t\t\tcontext={context}\n\t\t\t\thasStaticAlignment={hasStaticAlignment}\n\t\t\t\toffset={offset}\n\t\t\t\tonClose={handleDialogClose}\n\t\t\t\tonOpen={handleDialogOpen}\n\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\tonMouseEnter={openOn === 'hover' ? handleMouseEnter : undefined}\n\t\t\t\tonMouseLeave={openOn === 'hover' ? handleMouseLeave : undefined}\n\t\t\t\toutsideClickIgnoreClass={outsideClickIgnoreClass}\n\t\t\t\tonRequestTargetElement={getTargetElement}\n\t\t\t\tposition={position}\n\t\t\t\tstyle={style}\n\t\t\t\tvariant=\"popover\"\n\t\t\t\tref={setMenuRef}\n\t\t\t\tcontainerProps={{\n\t\t\t\t\tid: `${id}-popover`,\n\t\t\t\t\t'aria-labelledby': ariaLabelledby || `${id}-dialog-heading`,\n\t\t\t\t\t'aria-describedby': `${id}-dialog-body`,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{!hasNoCloseButton && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tassistiveText={{ icon: finalCloseButtonAssistiveText }}\n\t\t\t\t\t\ticonCategory=\"utility\"\n\t\t\t\t\t\ticonName=\"close\"\n\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t'slds-button slds-button_icon-small slds-float_right slds-popover__close slds-button_icon',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'slds-button_icon-inverse':\n\t\t\t\t\t\t\t\t\tvariant === 'walkthrough' ||\n\t\t\t\t\t\t\t\t\tvariant === 'walkthrough-action' ||\n\t\t\t\t\t\t\t\t\tvariant === 'feature',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tonClick={handleCancel}\n\t\t\t\t\t\tvariant=\"icon\"\n\t\t\t\t\t\tinverse={variant === 'error' || variant === 'warning'}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{renderHeader()}\n\t\t\t\t{renderBody()}\n\t\t\t\t{renderFooter()}\n\t\t\t</Dialog>\n\t\t);\n\t};\n\n\t// Clone trigger element\n\tconst otherChildren: ReactNode[] = [];\n\tlet clonedTrigger: ReactNode = null;\n\n\tReact.Children.forEach(children, (child, index) => {\n\t\tif (index === 0 && React.isValidElement(child)) {\n\t\t\tconst childProps = child.props as Record<string, unknown>;\n\t\t\tconst triggerProps: Record<string, unknown> = {\n\t\t\t\t'aria-haspopup': 'dialog',\n\t\t\t\tid,\n\t\t\t\tonClick:\n\t\t\t\t\topenOn === 'click' || openOn === 'hybrid'\n\t\t\t\t\t\t? (event: MouseEvent) => {\n\t\t\t\t\t\t\t\thandleClick(\n\t\t\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\t\t\tchildProps.onClick as (e: MouseEvent) => void\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: childProps.onClick,\n\t\t\t\tonFocus: openOn === 'hover' ? handleFocus : undefined,\n\t\t\t\tonMouseDown,\n\t\t\t\tonMouseEnter:\n\t\t\t\t\topenOn === 'hover' || openOn === 'hybrid'\n\t\t\t\t\t\t? handleMouseEnter\n\t\t\t\t\t\t: undefined,\n\t\t\t\tonMouseLeave:\n\t\t\t\t\topenOn === 'hover' || openOn === 'hybrid'\n\t\t\t\t\t\t? handleMouseLeave\n\t\t\t\t\t\t: undefined,\n\t\t\t\ttabIndex: (childProps.tabIndex as number) || 0,\n\t\t\t};\n\t\t\tclonedTrigger = React.cloneElement(child, triggerProps);\n\t\t} else if (child) {\n\t\t\totherChildren.push(child);\n\t\t}\n\t});\n\n\tconst containerStyles: CSSProperties = {\n\t\tdisplay: hasNoTriggerStyles ? undefined : 'inline-block',\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName={triggerClassName as string}\n\t\t\tstyle={containerStyles}\n\t\t\tref={setContainerRef}\n\t\t>\n\t\t\t{clonedTrigger}\n\t\t\t{otherChildren.length > 0 ? otherChildren : null}\n\t\t\t{renderDialog()}\n\t\t</div>\n\t);\n};\n\nPopover.displayName = POPOVER;\n\nexport default Popover;\n"],"mappings":"+fA6BA,IAAM,EAAkB,OAAO,SAAa,IAGtC,EAAU,EACb,SAAS,cAAc,MAAM,EAC5B,CAAE,MAAO,CAAC,CAAE,EACZ,IACH,EAAQ,MAAM,IAAM,IACpB,EAAQ,MAAM,KAAO,IACrB,EAAQ,MAAM,MAAQ,OACtB,EAAQ,MAAM,OAAS,OACvB,EAAQ,MAAM,SAAW,YAI1B,IAAI,EAMO,KAiLE,EAAyB,CACrC,WACA,MACA,YACA,cACA,SACA,cACD,EAEM,GAA6C,CAClD,YAAa,cACd,EAOM,GAAW,CAChB,QAAQ,QACR,cAAe,EACf,iBACA,WACA,OACA,gBACA,kBACA,kBACA,aACA,qBACA,YAAW,GACX,SACA,eACA,2BACA,oBAAmB,GACnB,eAAc,GACd,sBAAqB,GACrB,sBAAqB,GACrB,UACA,QACA,GAAI,GACJ,OAAQ,EACR,UACA,UACA,UACA,UACA,YACA,eACA,eACA,eACA,SACA,iBACA,yBACA,SAAS,QACT,QAAS,EACT,YAAW,WACX,WACA,SACA,oBACA,UAAU,OACV,kBAAkB,IAClB,+BACiC,CACjC,IAAM,IAAA,EAAc,EAAA,MAAA,CAAM,EACpB,EAAK,IAAU,GACf,IAAA,EAAU,EAAA,WAAA,C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AO,IAAU,CAClD,GAAI,IAAU,GAAK,EAAA,QAAM,eAAe,CAAK,EAAG,CAC/C,IAAM,EAAa,EAAM,MACnB,EAAwC,CAC7C,gBAAiB,SACjB,KACA,QACC,IAAW,SAAW,IAAW,SAC7B,GAAsB,CACvB,EACC,EACA,EAAW,OACZ,CACD,EACC,EAAW,QACf,QAAS,IAAW,QAAU,GAAc,IAAA,GAC5C,eACA,aACC,IAAW,SAAW,IAAW,SAC9B,EACA,IAAA,GACJ,aACC,IAAW,SAAW,IAAW,SAC9B,EACA,IAAA,GACJ,SAAW,EAAW,UAAuB,CAC9C,EACA,EAAgB,EAAA,QAAM,aAAa,EAAO,CAAY,CACvD,MAAW,GACV,EAAc,KAAK,CAAK,CAE1B,CAAC,GAOA,EAAA,EAAA,KAAA,CAAC,MAAD,CACC,UAAW,GACX,MAAO,CANR,QAAS,GAAqB,IAAA,GAAY,cAMlC,EACP,IAAK,GAHN,SAAA,CAKE,EACA,EAAc,OAAS,EAAI,EAAgB,KAC3C,GAAa,CACV,GAEP,EAEA,EAAQ,YAAc,EAAA"}
|
|
1
|
+
{"version":3,"file":"popover.cjs","names":[],"sources":["../../../../components/popover/popover.tsx"],"sourcesContent":["/* eslint-disable max-lines */\n/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport React, {\n\tforwardRef,\n\tuseState,\n\tuseEffect,\n\tuseRef,\n\tuseCallback,\n\tuseId,\n\tuseContext,\n\ttype ReactNode,\n\ttype MouseEvent,\n\ttype KeyboardEvent,\n\ttype FocusEvent,\n\ttype CSSProperties,\n} from 'react';\nimport classNames from 'classnames';\n\nimport Button from '../button';\nimport MediaObject from '../media-object';\nimport Icon from '../icon';\nimport Dialog from '../utilities/dialog';\nimport keyboardNavigableDialog from '../../utilities/keyboard-navigable-dialog';\nimport KEYS from '../../utilities/key-code';\nimport { POPOVER } from '../../utilities/constants';\nimport { IconSettingsContext } from '../icon-settings';\nimport deprecatedProperty from '../../utilities/warning/deprecated-property';\nimport getComponentDocFn from '../../utilities/get-component-doc';\nimport componentDoc from './component.json';\n\nconst documentDefined = typeof document !== 'undefined';\n\n// Shared overlay element for click-outside detection over iframes\nconst overlay = documentDefined\n\t? document.createElement('span')\n\t: ({ style: {} } as HTMLSpanElement);\nif (documentDefined) {\n\toverlay.style.top = '0';\n\toverlay.style.left = '0';\n\toverlay.style.width = '100%';\n\toverlay.style.height = '100%';\n\toverlay.style.position = 'absolute';\n}\n\n// Track currently open popover for single-popover-at-a-time behavior\nlet currentOpenPopover: {\n\thandleClose: (\n\t\tevent: MouseEvent | KeyboardEvent | undefined,\n\t\tdata: PopoverRequestCloseData\n\t) => void;\n\tgetId: () => string;\n} | null = null;\n\n/**\n * Popover alignment options\n */\nexport type PopoverAlign =\n\t| 'top'\n\t| 'top left'\n\t| 'top right'\n\t| 'right'\n\t| 'right top'\n\t| 'right bottom'\n\t| 'bottom'\n\t| 'bottom left'\n\t| 'bottom right'\n\t| 'left'\n\t| 'left top'\n\t| 'left bottom';\n\n/**\n * Popover position options\n */\nexport type PopoverPosition =\n\t'absolute' | 'overflowBoundaryElement' | 'relative';\n\n/**\n * Popover variant options\n */\nexport type PopoverVariant =\n\t| 'base'\n\t| 'error'\n\t| 'feature'\n\t| 'walkthrough'\n\t| 'walkthrough-action'\n\t| 'warning';\n\n/**\n * Assistive text for Popover\n */\nexport interface PopoverAssistiveText {\n\tcloseButton?: string;\n}\n\n/**\n * What caused `onRequestClose` to fire:\n * * `cancel`: the close button was clicked or Escape was pressed\n * * `clickOutside`: a click landed outside the popover\n * * `mouseLeave`: the mouse left the trigger/popover (`openOn` `hover`/`hybrid`) and `hoverCloseDelay` elapsed\n * * `newPopover`: another Popover opened (only one can be open at a time)\n * * `triggerClick`: the trigger was clicked while the popover was open\n */\nexport type PopoverRequestCloseTrigger =\n\t'cancel' | 'clickOutside' | 'mouseLeave' | 'newPopover' | 'triggerClick';\n\n/**\n * Data passed to `onRequestClose`\n */\nexport interface PopoverRequestCloseData {\n\t/** What caused the close request */\n\ttrigger: PopoverRequestCloseTrigger;\n\t/** HTML id of the popover being closed. Only present when `trigger` is `newPopover`. */\n\tid?: string;\n}\n\n/**\n * Data passed to `onOpen`\n */\nexport interface PopoverOpenData {\n\t/** The rendered popover dialog element */\n\tportal?: HTMLElement;\n}\n\n/**\n * Data passed to `onClose`\n */\nexport interface PopoverCloseData {\n\t/** `true` when the popover dialog is closing because it is being unmounted */\n\tcomponentWillUnmount: boolean;\n}\n\n/**\n * Props for the Popover component\n */\nexport interface PopoverProps {\n\t/** Alignment relative to trigger */\n\talign?: PopoverAlign;\n\t/** Accessibility labels */\n\tassistiveText?: PopoverAssistiveText;\n\t/** HTML id of heading for aria-labelledby */\n\tariaLabelledby?: string;\n\t/** Trigger element (first child) and optional other children */\n\tchildren: ReactNode;\n\t/** Popover body content */\n\tbody: ReactNode;\n\t/** CSS classes for the `.slds-popover__body` element */\n\tclassNameBody?: string | string[] | Record<string, boolean>;\n\t/** CSS classes for the `.slds-popover__footer` element */\n\tclassNameFooter?: string | string[] | Record<string, boolean>;\n\t/** @deprecated Use `classNameFooter`. */\n\tfooterClassName?: string | string[] | Record<string, boolean>;\n\t/**\n\t * CSS classes for the root element: the `div` that wraps the trigger. To style the\n\t * `.slds-popover` dialog (for example `slds-popover_large`), use `classNameDialog`.\n\t */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** CSS classes for the `.slds-popover` dialog element */\n\tclassNameDialog?: string | string[] | Record<string, boolean>;\n\t/** @deprecated Use `classNameDialog`, which lands on the same element. */\n\tcontentsClassName?: string | string[] | Record<string, boolean>;\n\t/** Disable the popover */\n\tdisabled?: boolean;\n\t/** Footer content */\n\tfooter?: ReactNode;\n\t/** @deprecated Use `styleFooter`. */\n\tfooterStyle?: CSSProperties;\n\t/** Walkthrough footer actions */\n\tfooterWalkthroughActions?: ReactNode | ReactNode[];\n\t/** Hide close button */\n\thasNoCloseButton?: boolean;\n\t/** Hide nubbin/arrow */\n\thasNoNubbin?: boolean;\n\t/** Prevent position flipping */\n\thasStaticAlignment?: boolean;\n\t/** Remove trigger inline-block style */\n\thasNoTriggerStyles?: boolean;\n\t/** Popover heading */\n\theading?: ReactNode;\n\t/** Icon for feature variant */\n\ticon?: ReactNode;\n\t/** HTML id */\n\tid?: string;\n\t/** Controlled open state */\n\tisOpen?: boolean;\n\t/** Offset from target */\n\toffset?: string;\n\t/** Click handler */\n\tonClick?: (event: MouseEvent) => void;\n\t/** Called after the popover dialog has closed (unmounted). There is no triggering event, so `event` is `undefined`. */\n\tonClose?: (event: undefined, data: PopoverCloseData) => void;\n\t/** Focus handler */\n\tonFocus?: (event: FocusEvent) => void;\n\t/** Key down handler */\n\tonKeyDown?: (event: KeyboardEvent) => void;\n\t/** Mouse down handler */\n\tonMouseDown?: (event: MouseEvent) => void;\n\t/** Mouse enter handler */\n\tonMouseEnter?: (event: MouseEvent) => void;\n\t/** Mouse leave handler */\n\tonMouseLeave?: (event: MouseEvent) => void;\n\t/** Called after the popover dialog has opened and rendered. There is no triggering event, so `event` is `undefined`. */\n\tonOpen?: (event: undefined, data: PopoverOpenData) => void;\n\t/**\n\t * Called when the popover requests to close. `data.trigger` says why. `event` is the triggering\n\t * click or key event, or `undefined` when there is none (`mouseLeave` timer, `newPopover`).\n\t */\n\tonRequestClose?: (\n\t\tevent: MouseEvent | KeyboardEvent | undefined,\n\t\tdata: PopoverRequestCloseData\n\t) => void;\n\t/** Custom target element getter */\n\tonRequestTargetElement?: () => HTMLElement | null;\n\t/** Open trigger type */\n\topenOn?: 'click' | 'hover' | 'hybrid';\n\t/** Overlay for click-outside on iframes */\n\toverlay?: boolean | ((isOpen: boolean, overlayElement: HTMLElement) => void);\n\t/** Positioning strategy */\n\tposition?: PopoverPosition;\n\t/** Walkthrough step text */\n\tstepText?: string;\n\t/** Styles for the root element: the `div` that wraps the trigger. To style the dialog, use `styleDialog`. */\n\tstyle?: CSSProperties;\n\t/** Styles for the `.slds-popover` dialog element */\n\tstyleDialog?: CSSProperties;\n\t/** Styles for the `.slds-popover__footer` element */\n\tstyleFooter?: CSSProperties;\n\t/** @deprecated Use `className`, which lands on the same element. */\n\ttriggerClassName?: string | string[] | Record<string, boolean>;\n\t/** Popover variant */\n\tvariant?: PopoverVariant;\n\t/** Delay before closing on hover (ms) */\n\thoverCloseDelay?: number;\n\t/** @deprecated Use assistiveText.closeButton */\n\tcloseButtonAssistiveText?: string;\n}\n\n// Nubbin positions for export (legacy)\nexport const PopoverNubbinPositions = [\n\t'top left',\n\t'top',\n\t'top right',\n\t'bottom left',\n\t'bottom',\n\t'bottom right',\n];\n\nconst defaultAssistiveText: PopoverAssistiveText = {\n\tcloseButton: 'Close dialog',\n};\n\n/**\n * The Popover component is a non-modal dialog. It should be paired with a clickable\n * trigger such as a Button. It traps focus from the page and must be exited if focus\n * needs to be outside the Popover.\n */\nconst Popover = forwardRef<HTMLDivElement, PopoverProps>(\n\t(\n\t\t{\n\t\t\talign = 'right',\n\t\t\tassistiveText: propAssistiveText,\n\t\t\tariaLabelledby,\n\t\t\tchildren,\n\t\t\tbody,\n\t\t\tclassNameBody,\n\t\t\tclassNameFooter,\n\t\t\tfooterClassName,\n\t\t\tclassName,\n\t\t\tclassNameDialog,\n\t\t\tcontentsClassName,\n\t\t\tdisabled = false,\n\t\t\tfooter,\n\t\t\tfooterStyle,\n\t\t\tfooterWalkthroughActions,\n\t\t\thasNoCloseButton = false,\n\t\t\thasNoNubbin = false,\n\t\t\thasStaticAlignment = false,\n\t\t\thasNoTriggerStyles = false,\n\t\t\theading,\n\t\t\ticon,\n\t\t\tid: propId,\n\t\t\tisOpen: controlledIsOpen,\n\t\t\toffset,\n\t\t\tonClick,\n\t\t\tonClose,\n\t\t\tonFocus,\n\t\t\tonKeyDown,\n\t\t\tonMouseDown,\n\t\t\tonMouseEnter,\n\t\t\tonMouseLeave,\n\t\t\tonOpen,\n\t\t\tonRequestClose,\n\t\t\tonRequestTargetElement,\n\t\t\topenOn = 'click',\n\t\t\toverlay: overlayProp,\n\t\t\tposition = 'absolute',\n\t\t\tstepText,\n\t\t\tstyle,\n\t\t\tstyleDialog,\n\t\t\tstyleFooter,\n\t\t\ttriggerClassName,\n\t\t\tvariant = 'base',\n\t\t\thoverCloseDelay = 300,\n\t\t\tcloseButtonAssistiveText,\n\t\t},\n\t\tref\n\t) => {\n\t\t// `check-props.js` is not wired up (its trigger and heading checks predate v11), so the\n\t\t// renamed props are checked here.\n\t\tuseEffect(() => {\n\t\t\tif (process.env.NODE_ENV !== 'production') {\n\t\t\t\tconst createDocUrl = getComponentDocFn(componentDoc);\n\t\t\t\tconst renamedProps: [string, unknown, string][] = [\n\t\t\t\t\t['contentsClassName', contentsClassName, 'classNameDialog'],\n\t\t\t\t\t['footerClassName', footerClassName, 'classNameFooter'],\n\t\t\t\t\t['footerStyle', footerStyle, 'styleFooter'],\n\t\t\t\t\t['triggerClassName', triggerClassName, 'className'],\n\t\t\t\t];\n\t\t\t\trenamedProps.forEach(([oldProp, value, newProp]) => {\n\t\t\t\t\tdeprecatedProperty(\n\t\t\t\t\t\tPOPOVER,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\toldProp,\n\t\t\t\t\t\tnewProp,\n\t\t\t\t\t\tcreateDocUrl(newProp)\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t}\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t}, []); // Only run on mount\n\n\t\tconst generatedId = useId();\n\t\tconst id = propId || generatedId;\n\t\tconst context = useContext(IconSettingsContext);\n\n\t\tconst assistiveText = { ...defaultAssistiveText, ...propAssistiveText };\n\t\tconst finalCloseButtonAssistiveText =\n\t\t\tcloseButtonAssistiveText || assistiveText.closeButton;\n\n\t\t// State\n\t\tconst [internalIsOpen, setInternalIsOpen] = useState(false);\n\t\tconst [inputRendered, setInputRendered] = useState(false);\n\n\t\t// Refs\n\t\tconst triggerRef = useRef<HTMLDivElement>(null);\n\t\tconst dialogRef = useRef<HTMLElement>(null);\n\t\tconst isHoverRef = useRef(false);\n\t\tconst isClosingRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\t\tconst overlayRef = useRef<HTMLSpanElement | null>(null);\n\t\tconst isUnmountingRef = useRef(false);\n\n\t\t// Derived state\n\t\tconst isOpen =\n\t\t\t!disabled &&\n\t\t\t(controlledIsOpen !== undefined ? controlledIsOpen : internalIsOpen);\n\n\t\t// Get target element for positioning\n\t\tconst getTargetElement = useCallback(() => {\n\t\t\tif (onRequestTargetElement) {\n\t\t\t\tconst target = onRequestTargetElement();\n\t\t\t\tif (target) return target;\n\t\t\t}\n\t\t\treturn triggerRef.current;\n\t\t}, [onRequestTargetElement]);\n\n\t\t// Handle dialog close (when unmounted)\n\t\tconst handleDialogClose = useCallback(\n\t\t\t(\n\t\t\t\t_event?: React.SyntheticEvent,\n\t\t\t\tdata?: { componentWillUnmount?: boolean }\n\t\t\t) => {\n\t\t\t\tconst componentWillUnmount = data?.componentWillUnmount || false;\n\n\t\t\t\tif (currentOpenPopover?.getId() === id) {\n\t\t\t\t\tcurrentOpenPopover = null;\n\t\t\t\t}\n\n\t\t\t\tif (onClose) {\n\t\t\t\t\tonClose(undefined, { componentWillUnmount });\n\t\t\t\t}\n\t\t\t},\n\t\t\t[id, onClose]\n\t\t);\n\n\t\t// Handle dialog open (after it has rendered)\n\t\tconst handleDialogOpen = useCallback(\n\t\t\t(_event?: unknown, data?: { portal?: HTMLElement }) => {\n\t\t\t\tif (onOpen) {\n\t\t\t\t\tonOpen(undefined, { portal: data?.portal });\n\t\t\t\t}\n\t\t\t},\n\t\t\t[onOpen]\n\t\t);\n\n\t\t// Handle close\n\t\tconst handleClose = useCallback(\n\t\t\t(\n\t\t\t\tevent: MouseEvent | KeyboardEvent | undefined,\n\t\t\t\tdata: PopoverRequestCloseData\n\t\t\t) => {\n\t\t\t\tif (isOpen) {\n\t\t\t\t\tif (onRequestClose) {\n\t\t\t\t\t\tonRequestClose(event, data);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (currentOpenPopover?.getId() === id) {\n\t\t\t\t\t\tcurrentOpenPopover = null;\n\t\t\t\t\t}\n\n\t\t\t\t\tsetInternalIsOpen(false);\n\t\t\t\t\tisHoverRef.current = false;\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isOpen, id, onRequestClose]\n\t\t);\n\n\t\t// Latest `handleClose`, so the \"close the other open popover\" path does not call a stale\n\t\t// closure from when this popover opened (whose `isOpen` was still `false`).\n\t\tconst handleCloseRef = useRef(handleClose);\n\t\tuseEffect(() => {\n\t\t\thandleCloseRef.current = handleClose;\n\t\t}, [handleClose]);\n\n\t\t// Handle open\n\t\tconst handleOpen = useCallback(() => {\n\t\t\tif (!isOpen) {\n\t\t\t\t// Close any other open popover\n\t\t\t\tif (currentOpenPopover && currentOpenPopover.getId() !== id) {\n\t\t\t\t\tcurrentOpenPopover.handleClose(undefined, {\n\t\t\t\t\t\ttrigger: 'newPopover',\n\t\t\t\t\t\tid: currentOpenPopover.getId(),\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tcurrentOpenPopover = {\n\t\t\t\t\thandleClose: (event, data) => handleCloseRef.current(event, data),\n\t\t\t\t\tgetId: () => id,\n\t\t\t\t};\n\n\t\t\t\tsetInternalIsOpen(true);\n\t\t\t}\n\t\t}, [isOpen, id]);\n\n\t\t// Handle cancel (close button or escape)\n\t\tconst handleCancel = useCallback(\n\t\t\t(event: MouseEvent | KeyboardEvent) => {\n\t\t\t\thandleClose(event, { trigger: 'cancel' });\n\t\t\t},\n\t\t\t[handleClose]\n\t\t);\n\n\t\t// Handle click outside\n\t\tconst handleClickOutside = useCallback(\n\t\t\t(event: MouseEvent) => {\n\t\t\t\thandleClose(event, { trigger: 'clickOutside' });\n\t\t\t},\n\t\t\t[handleClose]\n\t\t);\n\n\t\t// Handle mouse enter\n\t\tconst handleMouseEnter = useCallback(\n\t\t\t(event: MouseEvent) => {\n\t\t\t\tisHoverRef.current = true;\n\n\t\t\t\tif (!isOpen && openOn === 'hover') {\n\t\t\t\t\thandleOpen();\n\t\t\t\t} else {\n\t\t\t\t\tif (isClosingRef.current) {\n\t\t\t\t\t\tclearTimeout(isClosingRef.current);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (onMouseEnter) {\n\t\t\t\t\tonMouseEnter(event);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isOpen, openOn, handleOpen, onMouseEnter]\n\t\t);\n\n\t\t// Handle mouse leave\n\t\tconst handleMouseLeave = useCallback(\n\t\t\t(event: MouseEvent) => {\n\t\t\t\tif (isOpen) {\n\t\t\t\t\tisClosingRef.current = setTimeout(() => {\n\t\t\t\t\t\thandleClose(undefined, { trigger: 'mouseLeave' });\n\t\t\t\t\t}, hoverCloseDelay);\n\t\t\t\t}\n\n\t\t\t\tif (onMouseLeave) {\n\t\t\t\t\tonMouseLeave(event);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isOpen, hoverCloseDelay, handleClose, onMouseLeave]\n\t\t);\n\n\t\t// Handle click\n\t\tconst handleClick = useCallback(\n\t\t\t(event: MouseEvent, triggerOnClickCallback?: (e: MouseEvent) => void) => {\n\t\t\t\tif (!isOpen) {\n\t\t\t\t\thandleOpen();\n\t\t\t\t} else {\n\t\t\t\t\thandleClose(event, { trigger: 'triggerClick' });\n\t\t\t\t}\n\n\t\t\t\tif (onClick) {\n\t\t\t\t\tonClick(event);\n\t\t\t\t}\n\n\t\t\t\tif (triggerOnClickCallback) {\n\t\t\t\t\ttriggerOnClickCallback(event);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isOpen, handleOpen, handleClose, onClick]\n\t\t);\n\n\t\t// Handle focus\n\t\tconst handleFocus = useCallback(\n\t\t\t(event: FocusEvent) => {\n\t\t\t\tif (!isOpen) {\n\t\t\t\t\thandleOpen();\n\t\t\t\t}\n\n\t\t\t\tif (onFocus) {\n\t\t\t\t\tonFocus(event);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isOpen, handleOpen, onFocus]\n\t\t);\n\n\t\t// Toggle from keyboard\n\t\tconst toggleOpenFromKeyboard = useCallback(\n\t\t\t(event: KeyboardEvent) => {\n\t\t\t\tif (isOpen) {\n\t\t\t\t\thandleCancel(event);\n\t\t\t\t} else {\n\t\t\t\t\thandleOpen();\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isOpen, handleCancel, handleOpen]\n\t\t);\n\n\t\t// Handle key down\n\t\tconst handleKeyDown = useCallback(\n\t\t\t(event: KeyboardEvent) => {\n\t\t\t\tif (event.keyCode) {\n\t\t\t\t\tif (event.keyCode !== KEYS.TAB) {\n\t\t\t\t\t\tkeyboardNavigableDialog({\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\tisOpen,\n\t\t\t\t\t\t\thandleClick: (e: MouseEvent) => handleClick(e),\n\t\t\t\t\t\t\tkeyCode: event.keyCode,\n\t\t\t\t\t\t\teventTarget: event.target,\n\t\t\t\t\t\t\t// keyboardNavigableDialog calls `toggleOpen()` without the event; pass it through\n\t\t\t\t\t\t\ttoggleOpen: () => toggleOpenFromKeyboard(event),\n\t\t\t\t\t\t\ttrigger: triggerRef.current,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tif (onKeyDown) {\n\t\t\t\t\t\tonKeyDown(event);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isOpen, handleClick, toggleOpenFromKeyboard, onKeyDown]\n\t\t);\n\n\t\t// Render overlay for click-outside detection\n\t\tconst renderOverlay = useCallback(\n\t\t\t(shouldShow: boolean) => {\n\t\t\t\tif (typeof overlayProp === 'function' && documentDefined) {\n\t\t\t\t\toverlayProp(shouldShow, overlay);\n\t\t\t\t} else if (\n\t\t\t\t\toverlayProp &&\n\t\t\t\t\tshouldShow &&\n\t\t\t\t\t!overlayRef.current &&\n\t\t\t\t\tdocumentDefined\n\t\t\t\t) {\n\t\t\t\t\toverlayRef.current = overlay;\n\t\t\t\t\tdocument.querySelector('body')?.appendChild(overlay);\n\t\t\t\t} else if (!shouldShow && overlayRef.current?.parentNode) {\n\t\t\t\t\toverlayRef.current.parentNode.removeChild(overlayRef.current);\n\t\t\t\t\toverlayRef.current = null;\n\t\t\t\t}\n\t\t\t},\n\t\t\t[overlayProp]\n\t\t);\n\n\t\t// Container ref callback\n\t\tconst setContainerRef = useCallback(\n\t\t\t(component: HTMLDivElement | null) => {\n\t\t\t\t(triggerRef as React.MutableRefObject<HTMLDivElement | null>).current =\n\t\t\t\t\tcomponent;\n\t\t\t\tif (typeof ref === 'function') {\n\t\t\t\t\tref(component);\n\t\t\t\t} else if (ref) {\n\t\t\t\t\tref.current = component;\n\t\t\t\t}\n\t\t\t\tif (component && !inputRendered) {\n\t\t\t\t\tsetInputRendered(true);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[inputRendered, ref]\n\t\t);\n\n\t\t// Dialog ref callback\n\t\tconst setMenuRef = useCallback((component: HTMLElement | null) => {\n\t\t\t(dialogRef as React.MutableRefObject<HTMLElement | null>).current =\n\t\t\t\tcomponent;\n\t\t}, []);\n\n\t\t// Cleanup on unmount\n\t\tuseEffect(() => {\n\t\t\treturn () => {\n\t\t\t\tisUnmountingRef.current = true;\n\t\t\t\tif (currentOpenPopover?.getId() === id) {\n\t\t\t\t\tcurrentOpenPopover = null;\n\t\t\t\t}\n\t\t\t\trenderOverlay(false);\n\t\t\t};\n\t\t}, [id, renderOverlay]);\n\n\t\t// Update overlay when isOpen changes\n\t\tuseEffect(() => {\n\t\t\trenderOverlay(isOpen);\n\t\t}, [isOpen, renderOverlay]);\n\n\t\t// Render header\n\t\tconst renderHeader = () => {\n\t\t\tconst hasThemedHeader = variant === 'error' || variant === 'warning';\n\t\t\tconst hasDefinedHeader = heading || hasThemedHeader;\n\n\t\t\tif (\n\t\t\t\t!hasDefinedHeader ||\n\t\t\t\tvariant === 'walkthrough-action' ||\n\t\t\t\tvariant === 'feature'\n\t\t\t) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst headerIcon = {\n\t\t\t\terror: <Icon category=\"utility\" name=\"error\" size=\"x-small\" inverse />,\n\t\t\t\twarning: (\n\t\t\t\t\t<Icon category=\"utility\" name=\"warning\" size=\"x-small\" inverse />\n\t\t\t\t),\n\t\t\t};\n\n\t\t\tif (hasThemedHeader) {\n\t\t\t\treturn (\n\t\t\t\t\t<header className=\"slds-popover__header\">\n\t\t\t\t\t\t<MediaObject\n\t\t\t\t\t\t\tbody={\n\t\t\t\t\t\t\t\t<h2\n\t\t\t\t\t\t\t\t\tid={ariaLabelledby || `${id}-dialog-heading`}\n\t\t\t\t\t\t\t\t\tclassName=\"slds-truncate slds-text-heading_medium\"\n\t\t\t\t\t\t\t\t\ttitle={typeof heading === 'string' ? heading : undefined}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{heading}\n\t\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfigure={headerIcon[variant as 'error' | 'warning']}\n\t\t\t\t\t\t\tverticalCenter\n\t\t\t\t\t\t/>\n\t\t\t\t\t</header>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<header\n\t\t\t\t\tclassName={classNames('slds-popover__header', {\n\t\t\t\t\t\t'slds-p-vertical_medium': variant === 'walkthrough',\n\t\t\t\t\t})}\n\t\t\t\t>\n\t\t\t\t\t<h2\n\t\t\t\t\t\tid={ariaLabelledby || `${id}-dialog-heading`}\n\t\t\t\t\t\tclassName={classNames({\n\t\t\t\t\t\t\t'slds-text-heading_small': variant !== 'walkthrough',\n\t\t\t\t\t\t\t'slds-text-heading_medium': variant === 'walkthrough',\n\t\t\t\t\t\t})}\n\t\t\t\t\t>\n\t\t\t\t\t\t{heading}\n\t\t\t\t\t</h2>\n\t\t\t\t</header>\n\t\t\t);\n\t\t};\n\n\t\t// Render body\n\t\tconst renderBody = () => {\n\t\t\tif (variant === 'error' || variant === 'warning') {\n\t\t\t\treturn (\n\t\t\t\t\t<div\n\t\t\t\t\t\tid={`${id}-dialog-body`}\n\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t'slds-popover__body',\n\t\t\t\t\t\t\tclassNameBody as string\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{body}\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (variant === 'walkthrough-action' || variant === 'feature') {\n\t\t\t\treturn (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t'slds-popover__body',\n\t\t\t\t\t\t\tclassNameBody as string\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tid={`${id}-dialog-body`}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"slds-media\">\n\t\t\t\t\t\t\t<div className=\"slds-media__figure\">\n\t\t\t\t\t\t\t\t{variant === 'walkthrough-action' ? (\n\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\t\t\t\t\tname=\"touch_action\"\n\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\tinverse\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\ticon\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"slds-media__body\">\n\t\t\t\t\t\t\t\t{heading && (\n\t\t\t\t\t\t\t\t\t<h2\n\t\t\t\t\t\t\t\t\t\tid={ariaLabelledby || `${id}-dialog-heading`}\n\t\t\t\t\t\t\t\t\t\tclassName=\"slds-text-heading_small\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{heading}\n\t\t\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{body}\n\t\t\t\t\t\t\t\t{stepText && (\n\t\t\t\t\t\t\t\t\t<p className=\"slds-m-top_medium slds-text-title\">\n\t\t\t\t\t\t\t\t\t\t{stepText}\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tid={`${id}-dialog-body`}\n\t\t\t\t\tclassName={classNames('slds-popover__body', classNameBody as string)}\n\t\t\t\t>\n\t\t\t\t\t{body}\n\t\t\t\t</div>\n\t\t\t);\n\t\t};\n\n\t\t// Render footer\n\t\tconst renderFooter = () => {\n\t\t\tconst footerClassNames = classNames(\n\t\t\t\t'slds-popover__footer',\n\t\t\t\tfooterClassName,\n\t\t\t\tclassNameFooter\n\t\t\t);\n\t\t\tconst footerStyles =\n\t\t\t\tfooterStyle || styleFooter\n\t\t\t\t\t? { ...footerStyle, ...styleFooter }\n\t\t\t\t\t: undefined;\n\n\t\t\tif (footer) {\n\t\t\t\treturn (\n\t\t\t\t\t<footer className={footerClassNames} style={footerStyles}>\n\t\t\t\t\t\t{footer}\n\t\t\t\t\t</footer>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tvariant !== 'walkthrough-action' &&\n\t\t\t\t(footerWalkthroughActions || stepText)\n\t\t\t) {\n\t\t\t\treturn (\n\t\t\t\t\t<footer className={footerClassNames} style={footerStyles}>\n\t\t\t\t\t\t<div className=\"slds-grid slds-grid_vertical-align-center\">\n\t\t\t\t\t\t\t{stepText && <span className=\"slds-text-title\">{stepText}</span>}\n\t\t\t\t\t\t\t{footerWalkthroughActions && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tclassName=\"slds-col_bump-left\"\n\t\t\t\t\t\t\t\t\tstyle={{ display: 'inline-block' }}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{footerWalkthroughActions}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</footer>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn null;\n\t\t};\n\n\t\t// Render dialog\n\t\tconst renderDialog = () => {\n\t\t\tif (!isOpen) return null;\n\n\t\t\tconst outsideClickIgnoreClass = `ignore-click-${id}`;\n\n\t\t\treturn (\n\t\t\t\t<Dialog\n\t\t\t\t\thasNubbin={!hasNoNubbin}\n\t\t\t\t\talign={align}\n\t\t\t\t\tcontentsClassName={classNames(\n\t\t\t\t\t\tcontentsClassName,\n\t\t\t\t\t\t'ignore-react-onclickoutside',\n\t\t\t\t\t\t'slds-popover',\n\t\t\t\t\t\t{ 'slds-popover_error': variant === 'error' },\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'slds-popover_walkthrough':\n\t\t\t\t\t\t\t\tvariant === 'walkthrough' ||\n\t\t\t\t\t\t\t\tvariant === 'walkthrough-action' ||\n\t\t\t\t\t\t\t\tvariant === 'feature',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'slds-popover_walkthrough-alt': variant === 'walkthrough-action',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ 'slds-popover_feature': variant === 'feature' },\n\t\t\t\t\t\t{ 'slds-popover_warning': variant === 'warning' },\n\t\t\t\t\t\tclassNameDialog\n\t\t\t\t\t)}\n\t\t\t\t\tcontext={context}\n\t\t\t\t\thasStaticAlignment={hasStaticAlignment}\n\t\t\t\t\toffset={offset}\n\t\t\t\t\tonClose={handleDialogClose}\n\t\t\t\t\tonOpen={handleDialogOpen}\n\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\tonMouseEnter={openOn === 'hover' ? handleMouseEnter : undefined}\n\t\t\t\t\tonMouseLeave={openOn === 'hover' ? handleMouseLeave : undefined}\n\t\t\t\t\toutsideClickIgnoreClass={outsideClickIgnoreClass}\n\t\t\t\t\tonRequestTargetElement={getTargetElement}\n\t\t\t\t\tposition={position}\n\t\t\t\t\tstyle={styleDialog}\n\t\t\t\t\tvariant=\"popover\"\n\t\t\t\t\tref={setMenuRef}\n\t\t\t\t\tcontainerProps={{\n\t\t\t\t\t\tid: `${id}-popover`,\n\t\t\t\t\t\t'aria-labelledby': ariaLabelledby || `${id}-dialog-heading`,\n\t\t\t\t\t\t'aria-describedby': `${id}-dialog-body`,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{!hasNoCloseButton && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tassistiveText={{ icon: finalCloseButtonAssistiveText }}\n\t\t\t\t\t\t\ticonCategory=\"utility\"\n\t\t\t\t\t\t\ticonName=\"close\"\n\t\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t\t'slds-button slds-button_icon-small slds-float_right slds-popover__close slds-button_icon',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'slds-button_icon-inverse':\n\t\t\t\t\t\t\t\t\t\tvariant === 'walkthrough' ||\n\t\t\t\t\t\t\t\t\t\tvariant === 'walkthrough-action' ||\n\t\t\t\t\t\t\t\t\t\tvariant === 'feature',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tonClick={handleCancel}\n\t\t\t\t\t\t\tvariant=\"icon\"\n\t\t\t\t\t\t\tinverse={variant === 'error' || variant === 'warning'}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t{renderHeader()}\n\t\t\t\t\t{renderBody()}\n\t\t\t\t\t{renderFooter()}\n\t\t\t\t</Dialog>\n\t\t\t);\n\t\t};\n\n\t\t// Clone trigger element\n\t\tconst otherChildren: ReactNode[] = [];\n\t\tlet clonedTrigger: ReactNode = null;\n\n\t\tReact.Children.forEach(children, (child, index) => {\n\t\t\tif (index === 0 && React.isValidElement(child)) {\n\t\t\t\tconst childProps = child.props as Record<string, unknown>;\n\t\t\t\tconst triggerProps: Record<string, unknown> = {\n\t\t\t\t\t'aria-haspopup': 'dialog',\n\t\t\t\t\tid,\n\t\t\t\t\tonClick:\n\t\t\t\t\t\topenOn === 'click' || openOn === 'hybrid'\n\t\t\t\t\t\t\t? (event: MouseEvent) => {\n\t\t\t\t\t\t\t\t\thandleClick(\n\t\t\t\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\t\t\t\tchildProps.onClick as (e: MouseEvent) => void\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: childProps.onClick,\n\t\t\t\t\tonFocus: openOn === 'hover' ? handleFocus : undefined,\n\t\t\t\t\tonMouseDown,\n\t\t\t\t\tonMouseEnter:\n\t\t\t\t\t\topenOn === 'hover' || openOn === 'hybrid'\n\t\t\t\t\t\t\t? handleMouseEnter\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\tonMouseLeave:\n\t\t\t\t\t\topenOn === 'hover' || openOn === 'hybrid'\n\t\t\t\t\t\t\t? handleMouseLeave\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\ttabIndex: (childProps.tabIndex as number) || 0,\n\t\t\t\t};\n\t\t\t\tclonedTrigger = React.cloneElement(child, triggerProps);\n\t\t\t} else if (child) {\n\t\t\t\totherChildren.push(child);\n\t\t\t}\n\t\t});\n\n\t\tconst containerStyles: CSSProperties = {\n\t\t\tdisplay: hasNoTriggerStyles ? undefined : 'inline-block',\n\t\t\t...style,\n\t\t};\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={classNames(triggerClassName, className) || undefined}\n\t\t\t\tstyle={containerStyles}\n\t\t\t\tref={setContainerRef}\n\t\t\t>\n\t\t\t\t{clonedTrigger}\n\t\t\t\t{otherChildren.length > 0 ? otherChildren : null}\n\t\t\t\t{renderDialog()}\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nPopover.displayName = POPOVER;\n\nexport default Popover;\n"],"mappings":"6oBAgCA,IAAM,EAAkB,OAAO,SAAa,IAGtC,EAA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EAA6B,CAAC,EAChC,GAA2B,KAE/B,EAAA,QAAM,SAAS,QAAQ,IAAW,EAAO,IAAU,CAClD,GAAI,IAAU,GAAK,EAAA,QAAM,eAAe,CAAK,EAAG,CAC/C,IAAM,EAAa,EAAM,MACnB,EAAwC,CAC7C,gBAAiB,SACjB,KACA,QACC,IAAW,SAAW,IAAW,SAC7B,GAAsB,CACvB,EACC,EACA,EAAW,OACZ,CACD,EACC,EAAW,QACf,QAAS,IAAW,QAAU,GAAc,IAAA,GAC5C,eACA,aACC,IAAW,SAAW,IAAW,SAC9B,GACA,IAAA,GACJ,aACC,IAAW,SAAW,IAAW,SAC9B,GACA,IAAA,GACJ,SAAW,EAAW,UAAuB,CAC9C,EACA,GAAgB,EAAA,QAAM,aAAa,EAAO,CAAY,CACvD,MAAW,GACV,EAAc,KAAK,CAAK,CAE1B,CAAC,EAED,IAAM,GAAiC,CACtC,QAAS,GAAqB,IAAA,GAAY,eAC1C,GAAG,EACJ,EAEA,OACC,EAAA,EAAA,KAAA,CAAC,MAAD,CACC,WAAA,EAAW,EAAA,QAAA,CAAW,EAAkB,EAAS,GAAK,IAAA,GACtD,MAAO,GACP,IAAK,GAHN,SAAA,CAKE,GACA,EAAc,OAAS,EAAI,EAAgB,KAC3C,GAAa,CACV,GAEP,CACD,EAEA,EAAQ,YAAc,EAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../../utilities/get-component-doc.cjs"),t=require("../../utilities/warning/deprecated-property.cjs"),n=require("../../utilities/warning/only-one-of-properties.cjs");var r=function(){};process.env.NODE_ENV!==`production`&&(r=function(r,i,a){let o=e.default(a);t.default(r,i.errorText,`errorText`,"labels.error` and `hasError",o(`labels`)),t.default(r,i.label,`label`,`labels.label`,o(`labels`)),n.default(r,{"labels.label":i.labels?.label??i.label,"assistiveText.label":i.assistiveText?.label},o())});var i=r;exports.default=i;
|
|
1
|
+
const e=require("../../utilities/get-component-doc.cjs"),t=require("../../utilities/warning/deprecated-property.cjs"),n=require("../../utilities/warning/only-one-of-properties.cjs");var r=function(){};process.env.NODE_ENV!==`production`&&(r=function(r,i,a){let o=e.default(a);t.default(r,i.classNameContainer,`classNameContainer`,`className`,o(`className`)),t.default(r,i.errorText,`errorText`,"labels.error` and `hasError",o(`labels`)),t.default(r,i.label,`label`,`labels.label`,o(`labels`)),n.default(r,{"labels.label":i.labels?.label??i.label,"assistiveText.label":i.assistiveText?.label},o())});var i=r;exports.default=i;
|
|
2
2
|
//# sourceMappingURL=check-props.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-props.cjs","names":[],"sources":["../../../../components/slider/check-props.js"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n/* eslint-disable import/no-mutable-exports */\n\nimport deprecatedProperty from '../../utilities/warning/deprecated-property';\nimport onlyOneOfProperties from '../../utilities/warning/only-one-of-properties';\nimport getComponentDocFn from '../../utilities/get-component-doc';\n\nlet checkProps = function checkPropsFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tcheckProps = function checkPropsFunction(COMPONENT, props, jsonDoc) {\n\t\tconst createDocUrl = getComponentDocFn(jsonDoc);\n\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.errorText,\n\t\t\t'errorText',\n\t\t\t'labels.error` and `hasError',\n\t\t\tcreateDocUrl('labels')\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.label,\n\t\t\t'label',\n\t\t\t'labels.label',\n\t\t\tcreateDocUrl('labels')\n\t\t);\n\t\tonlyOneOfProperties(\n\t\t\tCOMPONENT,\n\t\t\t{\n\t\t\t\t'labels.label': props.labels?.label ?? props.label,\n\t\t\t\t'assistiveText.label': props.assistiveText?.label,\n\t\t\t},\n\t\t\tcreateDocUrl()\n\t\t);\n\t};\n}\n\nexport default checkProps;\n"],"mappings":"sLAQA,IAAI,EAAa,UAA8B,CAAC,EAEhD,QAAA,IAAA,WAA6B,eAC5B,EAAa,SAA4B,EAAW,EAAO,EAAS,CACnE,IAAM,EAAe,EAAA,QAAkB,CAAO,EAE9C,EAAA,QACC,EACA,EAAM,UACN,YACA,8BACA,EAAa,QAAQ,CACtB,EACA,EAAA,QACC,EACA,EAAM,MACN,QACA,eACA,EAAa,QAAQ,CACtB,EACA,EAAA,QACC,EACA,CACC,eAAgB,EAAM,QAAQ,OAAS,EAAM,MAC7C,sBAAuB,EAAM,eAAe,KAC7C,EACA,EAAa,CACd,CACD,GAGD,IAAA,EAAe"}
|
|
1
|
+
{"version":3,"file":"check-props.cjs","names":[],"sources":["../../../../components/slider/check-props.js"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n/* eslint-disable import/no-mutable-exports */\n\nimport deprecatedProperty from '../../utilities/warning/deprecated-property';\nimport onlyOneOfProperties from '../../utilities/warning/only-one-of-properties';\nimport getComponentDocFn from '../../utilities/get-component-doc';\n\nlet checkProps = function checkPropsFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tcheckProps = function checkPropsFunction(COMPONENT, props, jsonDoc) {\n\t\tconst createDocUrl = getComponentDocFn(jsonDoc);\n\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.classNameContainer,\n\t\t\t'classNameContainer',\n\t\t\t'className',\n\t\t\tcreateDocUrl('className')\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.errorText,\n\t\t\t'errorText',\n\t\t\t'labels.error` and `hasError',\n\t\t\tcreateDocUrl('labels')\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.label,\n\t\t\t'label',\n\t\t\t'labels.label',\n\t\t\tcreateDocUrl('labels')\n\t\t);\n\t\tonlyOneOfProperties(\n\t\t\tCOMPONENT,\n\t\t\t{\n\t\t\t\t'labels.label': props.labels?.label ?? props.label,\n\t\t\t\t'assistiveText.label': props.assistiveText?.label,\n\t\t\t},\n\t\t\tcreateDocUrl()\n\t\t);\n\t};\n}\n\nexport default checkProps;\n"],"mappings":"sLAQA,IAAI,EAAa,UAA8B,CAAC,EAEhD,QAAA,IAAA,WAA6B,eAC5B,EAAa,SAA4B,EAAW,EAAO,EAAS,CACnE,IAAM,EAAe,EAAA,QAAkB,CAAO,EAE9C,EAAA,QACC,EACA,EAAM,mBACN,qBACA,YACA,EAAa,WAAW,CACzB,EACA,EAAA,QACC,EACA,EAAM,UACN,YACA,8BACA,EAAa,QAAQ,CACtB,EACA,EAAA,QACC,EACA,EAAM,MACN,QACA,eACA,EAAa,QAAQ,CACtB,EACA,EAAA,QACC,EACA,CACC,eAAgB,EAAM,QAAQ,OAAS,EAAM,MAC7C,sBAAuB,EAAM,eAAe,KAC7C,EACA,EAAa,CACd,CACD,GAGD,IAAA,EAAe"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("../../utilities/get-aria-props.cjs"),r=require("./check-props.cjs"),i=require("./component.cjs");let a=require("react")
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("../../utilities/get-aria-props.cjs"),r=require("./check-props.cjs"),i=require("./component.cjs");let a=require("react"),o=require("classnames");o=e.__toESM(o,1);let s=require("react/jsx-runtime");var c={disabled:`Disabled`},l=(0,a.forwardRef)(({"aria-describedby":e,assistiveText:l,className:u,classNameContainer:d,defaultValue:f,disabled:p,errorText:m,hasError:h,id:g,label:_,labels:v,max:y=100,min:b=0,name:x,onChange:S,onInput:C,size:w,step:T=1,value:E,vertical:D,...O},k)=>{let A=(0,a.useId)(),j=(0,a.useId)(),M=g||A,N=h??!!m,P=N?v?.error??m:void 0,F=e||(P?j:void 0),I={...c,...l},L=v?.label??_,R=L||I.label;(0,a.useEffect)(()=>{r.default(t.SLIDER,{assistiveText:l,classNameContainer:d,errorText:m,label:_,labels:v},i.default)},[l,d,m,_,v]);let z=n.default(O);F&&(z[`aria-describedby`]=F);let B=(0,a.useCallback)(e=>{S?.(e,{value:Number(e.target.value)})},[S]),V=(0,a.useCallback)(e=>{C?.(e,{value:Number(e.target.value)})},[C]),H=E??f??0;return(0,s.jsxs)(`div`,{className:(0,o.default)(`slds-form-element`,{"slds-has-error":N},d,u),ref:k,children:[(0,s.jsx)(`label`,{className:(0,o.default)(`slds-form-element__label`,{"slds-assistive-text":I.label&&!L}),htmlFor:M,children:(0,s.jsxs)(`span`,{className:`slds-slider-label`,children:[R&&(0,s.jsx)(`span`,{className:`slds-slider-label__label`,children:R}),(0,s.jsxs)(`span`,{className:`slds-slider-label__range`,children:[b,` - `,y]}),p&&(0,s.jsxs)(`span`,{className:`slds-assistive-text`,children:[` `,I.disabled]})]})}),(0,s.jsxs)(`div`,{className:`slds-form-element__control`,children:[(0,s.jsxs)(`div`,{className:(0,o.default)(`slds-slider`,{"slds-slider_vertical":D,"slds-size_x-small":w===`x-small`,"slds-size_small":w===`small`,"slds-size_medium":w===`medium`,"slds-size_large":w===`large`}),children:[(0,s.jsx)(`input`,{type:`range`,id:M,name:x,className:`slds-slider__range`,min:b,max:y,step:T,disabled:p,onChange:B,onInput:V,...z,...E===void 0?{defaultValue:f}:{value:E}}),(0,s.jsx)(`span`,{className:`slds-slider__value`,"aria-hidden":`true`,children:H})]}),P&&(0,s.jsx)(`div`,{id:F,className:`slds-form-element__help`,children:P})]})]})});l.displayName=t.SLIDER,exports.default=l;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/slider/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/slider/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport {\n\tforwardRef,\n\tuseId,\n\tuseCallback,\n\tuseEffect,\n\ttype ChangeEvent,\n\ttype FormEvent,\n\ttype ReactNode,\n} from 'react';\nimport classNames from 'classnames';\nimport { SLIDER } from '../../utilities/constants';\nimport getAriaProps from '../../utilities/get-aria-props';\nimport checkProps from './check-props';\nimport componentDoc from './component.json';\n\n/**\n * Slider size options\n */\nexport type SliderSize = 'x-small' | 'small' | 'medium' | 'large';\n\n/**\n * Assistive text for Slider\n */\nexport interface SliderAssistiveText {\n\t/** Text for disabled state */\n\tdisabled?: string;\n\t/** Visually hidden label */\n\tlabel?: string;\n}\n\n/**\n * Labels for Slider\n */\nexport interface SliderLabels {\n\t/** Error message shown below the slider while `hasError` is true */\n\terror?: ReactNode;\n\t/** Visible label */\n\tlabel?: ReactNode;\n}\n\n/**\n * Props for the Slider component\n */\nexport interface SliderProps {\n\t/** ARIA describedby attribute */\n\t'aria-describedby'?: string;\n\t/**\n\t * **Assistive text for accessibility**\n\t * * `disabled`: Read after the range while the slider is disabled\n\t * * `label`: Visually hidden label. Use instead of `labels.label`.\n\t */\n\tassistiveText?: SliderAssistiveText;\n\t/** CSS classes for the root `.slds-form-element` div */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** @deprecated Use `className`, which lands on the same element. */\n\tclassNameContainer?: string | string[] | Record<string, boolean>;\n\t/** Initial value for uncontrolled usage */\n\tdefaultValue?: number;\n\t/** Whether the slider is disabled */\n\tdisabled?: boolean;\n\t/** @deprecated Use `labels.error` and `hasError` instead. */\n\terrorText?: string;\n\t/** Puts the slider in an error state and shows `labels.error` */\n\thasError?: boolean;\n\t/** HTML id attribute */\n\tid?: string;\n\t/** @deprecated Use `labels.label` instead. */\n\tlabel?: string;\n\t/**\n\t * **Text labels for internationalization**\n\t * * `error`: Error message shown below the slider while `hasError` is true\n\t * * `label`: Visible label. Use `assistiveText.label` for a visually hidden label.\n\t */\n\tlabels?: SliderLabels;\n\t/** Maximum value (default: 100) */\n\tmax?: number;\n\t/** Minimum value (default: 0) */\n\tmin?: number;\n\t/** Form input name */\n\tname?: string;\n\t/** Called when value changes */\n\tonChange?: (\n\t\tevent: ChangeEvent<HTMLInputElement>,\n\t\tdata: { value: number }\n\t) => void;\n\t/** Called on input event */\n\tonInput?: (\n\t\tevent: FormEvent<HTMLInputElement>,\n\t\tdata: { value: number }\n\t) => void;\n\t/** Size of the slider */\n\tsize?: SliderSize;\n\t/** Step increment (default: 1) */\n\tstep?: number;\n\t/** Controlled value */\n\tvalue?: number;\n\t/** Display vertically */\n\tvertical?: boolean;\n}\n\nconst defaultAssistiveText: SliderAssistiveText = {\n\tdisabled: 'Disabled',\n};\n\n/**\n * The ability to style sliders with CSS varies across browsers.\n * Using this component ensures sliders look the same everywhere.\n */\nconst Slider = forwardRef<HTMLDivElement, SliderProps>(\n\t(\n\t\t{\n\t\t\t'aria-describedby': ariaDescribedBy,\n\t\t\tassistiveText: propAssistiveText,\n\t\t\tclassName,\n\t\t\tclassNameContainer,\n\t\t\tdefaultValue,\n\t\t\tdisabled,\n\t\t\terrorText,\n\t\t\thasError: hasErrorProp,\n\t\t\tid: propId,\n\t\t\tlabel: labelProp,\n\t\t\tlabels,\n\t\t\tmax = 100,\n\t\t\tmin = 0,\n\t\t\tname,\n\t\t\tonChange,\n\t\t\tonInput,\n\t\t\tsize,\n\t\t\tstep = 1,\n\t\t\tvalue,\n\t\t\tvertical,\n\t\t\t...rest\n\t\t},\n\t\tref\n\t) => {\n\t\tconst generatedId = useId();\n\t\tconst generatedErrorId = useId();\n\n\t\tconst id = propId || generatedId;\n\t\t// `errorText` is deprecated: it sets both the error state and the message\n\t\tconst hasError = hasErrorProp ?? !!errorText;\n\t\tconst errorMessage = hasError ? (labels?.error ?? errorText) : undefined;\n\t\tconst errorId =\n\t\t\tariaDescribedBy || (errorMessage ? generatedErrorId : undefined);\n\t\tconst assistiveText = { ...defaultAssistiveText, ...propAssistiveText };\n\t\t// `label` is deprecated\n\t\tconst label = labels?.label ?? labelProp;\n\t\tconst labelText = label || assistiveText.label;\n\n\t\tuseEffect(() => {\n\t\t\tcheckProps(\n\t\t\t\tSLIDER,\n\t\t\t\t{\n\t\t\t\t\tassistiveText: propAssistiveText,\n\t\t\t\t\tclassNameContainer,\n\t\t\t\t\terrorText,\n\t\t\t\t\tlabel: labelProp,\n\t\t\t\t\tlabels,\n\t\t\t\t},\n\t\t\t\tcomponentDoc\n\t\t\t);\n\t\t}, [propAssistiveText, classNameContainer, errorText, labelProp, labels]);\n\n\t\tconst ariaProps = getAriaProps(rest) as Record<string, unknown>;\n\t\tif (errorId) {\n\t\t\tariaProps['aria-describedby'] = errorId;\n\t\t}\n\n\t\tconst handleChange = useCallback(\n\t\t\t(event: ChangeEvent<HTMLInputElement>) => {\n\t\t\t\tonChange?.(event, { value: Number(event.target.value) });\n\t\t\t},\n\t\t\t[onChange]\n\t\t);\n\n\t\tconst handleInput = useCallback(\n\t\t\t(event: FormEvent<HTMLInputElement>) => {\n\t\t\t\tonInput?.(event, {\n\t\t\t\t\tvalue: Number((event.target as HTMLInputElement).value),\n\t\t\t\t});\n\t\t\t},\n\t\t\t[onInput]\n\t\t);\n\n\t\tconst displayValue = value ?? defaultValue ?? 0;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-form-element',\n\t\t\t\t\t{ 'slds-has-error': hasError },\n\t\t\t\t\tclassNameContainer,\n\t\t\t\t\tclassName\n\t\t\t\t)}\n\t\t\t\tref={ref}\n\t\t\t>\n\t\t\t\t<label\n\t\t\t\t\tclassName={classNames('slds-form-element__label', {\n\t\t\t\t\t\t'slds-assistive-text': assistiveText.label && !label,\n\t\t\t\t\t})}\n\t\t\t\t\thtmlFor={id}\n\t\t\t\t>\n\t\t\t\t\t<span className=\"slds-slider-label\">\n\t\t\t\t\t\t{labelText && (\n\t\t\t\t\t\t\t<span className=\"slds-slider-label__label\">{labelText}</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<span className=\"slds-slider-label__range\">\n\t\t\t\t\t\t\t{min} - {max}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{disabled && (\n\t\t\t\t\t\t\t<span className=\"slds-assistive-text\">\n\t\t\t\t\t\t\t\t{' '}\n\t\t\t\t\t\t\t\t{assistiveText.disabled}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</span>\n\t\t\t\t</label>\n\t\t\t\t<div className=\"slds-form-element__control\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={classNames('slds-slider', {\n\t\t\t\t\t\t\t'slds-slider_vertical': vertical,\n\t\t\t\t\t\t\t'slds-size_x-small': size === 'x-small',\n\t\t\t\t\t\t\t'slds-size_small': size === 'small',\n\t\t\t\t\t\t\t'slds-size_medium': size === 'medium',\n\t\t\t\t\t\t\t'slds-size_large': size === 'large',\n\t\t\t\t\t\t})}\n\t\t\t\t\t>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\ttype=\"range\"\n\t\t\t\t\t\t\tid={id}\n\t\t\t\t\t\t\tname={name}\n\t\t\t\t\t\t\tclassName=\"slds-slider__range\"\n\t\t\t\t\t\t\tmin={min}\n\t\t\t\t\t\t\tmax={max}\n\t\t\t\t\t\t\tstep={step}\n\t\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t\tonChange={handleChange}\n\t\t\t\t\t\t\tonInput={handleInput}\n\t\t\t\t\t\t\t{...ariaProps}\n\t\t\t\t\t\t\t{...(value !== undefined ? { value } : { defaultValue })}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<span className=\"slds-slider__value\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t{displayValue}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t{errorMessage && (\n\t\t\t\t\t\t<div id={errorId} className=\"slds-form-element__help\">\n\t\t\t\t\t\t\t{errorMessage}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nSlider.displayName = SLIDER;\n\nexport default Slider;\n"],"mappings":"iZAuGA,IAAM,EAA4C,CACjD,SAAU,UACX,EAMM,GAAA,EAAS,EAAA,WAAA,EAEb,CACC,mBAAoB,EACpB,cAAe,EACf,YACA,qBACA,eACA,WACA,YACA,SAAU,EACV,GAAI,EACJ,MAAO,EACP,SACA,MAAM,IACN,MAAM,EACN,OACA,WACA,UACA,OACA,OAAO,EACP,QACA,WACA,GAAG,GAEJ,IACI,CACJ,IAAM,GAAA,EAAc,EAAA,MAAA,CAAM,EACpB,GAAA,EAAmB,EAAA,MAAA,CAAM,EAEzB,EAAK,GAAU,EAEf,EAAW,GAAgB,CAAC,CAAC,EAC7B,EAAe,EAAY,GAAQ,OAAS,EAAa,IAAA,GACzD,EACL,IAAoB,EAAe,EAAmB,IAAA,IACjD,EAAgB,CAAE,GAAG,EAAsB,GAAG,CAAkB,EAEhE,EAAQ,GAAQ,OAAS,EACzB,EAAY,GAAS,EAAc,OAEzC,EAAA,EAAA,UAAA,KAAgB,CACf,EAAA,QACC,EAAA,OACA,CACC,cAAe,EACf,qBACA,YACA,MAAO,EACP,QACD,EACA,EAAA,OACD,CACD,EAAG,CAAC,EAAmB,EAAoB,EAAW,EAAW,CAAM,CAAC,EAExE,IAAM,EAAY,EAAA,QAAa,CAAI,EAC/B,IACH,EAAU,oBAAsB,GAGjC,IAAM,GAAA,EAAe,EAAA,YAAA,CACnB,GAAyC,CACzC,IAAW,EAAO,CAAE,MAAO,O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IAAA,GAAwB,CAAE,cAAa,EAA3B,CAAE,OAAM,CACnC,CAAA,GACD,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,qBAAqB,cAAY,OAC/C,SAAA,CACI,CAAA,CACF,CACJ,CAAA,EAAA,IACA,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,GAAI,EAAS,UAAU,0BAC1B,SAAA,CACG,CAAA,CAEF,CACD,CAAA,CAAA,GAEP,CACD,EAEA,EAAO,YAAc,EAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("../../utilities/get-component-doc.cjs"),t=require("../../utilities/warning/deprecated-property.cjs");var n=function(){};process.env.NODE_ENV!==`production`&&(n=function(n,r={},i){let a=e.default(i);t.default(n,r.containerClassName,`containerClassName`,`className`,a(`className`)),t.default(n,r.containerStyle,`containerStyle`,`style`,a(`style`))});var r=n;exports.default=r;
|
|
2
|
+
//# sourceMappingURL=check-props.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-props.cjs","names":[],"sources":["../../../../components/spinner/check-props.js"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n/* eslint-disable import/no-mutable-exports */\n\nimport deprecatedProperty from '../../utilities/warning/deprecated-property';\nimport getComponentDocFn from '../../utilities/get-component-doc';\n\nlet checkProps = function checkPropsFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tcheckProps = function checkPropsFunction(COMPONENT, props = {}, jsonDoc) {\n\t\tconst createDocUrl = getComponentDocFn(jsonDoc);\n\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.containerClassName,\n\t\t\t'containerClassName',\n\t\t\t'className',\n\t\t\tcreateDocUrl('className')\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.containerStyle,\n\t\t\t'containerStyle',\n\t\t\t'style',\n\t\t\tcreateDocUrl('style')\n\t\t);\n\t};\n}\n\nexport default checkProps;\n"],"mappings":"sHAOA,IAAI,EAAa,UAA8B,CAAC,EAEhD,QAAA,IAAA,WAA6B,eAC5B,EAAa,SAA4B,EAAW,EAAQ,CAAC,EAAG,EAAS,CACxE,IAAM,EAAe,EAAA,QAAkB,CAAO,EAE9C,EAAA,QACC,EACA,EAAM,mBACN,qBACA,YACA,EAAa,WAAW,CACzB,EACA,EAAA,QACC,EACA,EAAM,eACN,iBACA,QACA,EAAa,OAAO,CACrB,CACD,GAGD,IAAA,EAAe"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=`spinner`,t=`prod`,n=`Spinner`,r={component:e,status:t,"display-name":`Spinners`,classKey:n,"SLDS-component-path":`/components/spinner`,"site-stories":[{heading:`Default`,path:`/__examples__/default.jsx`}],"url-slug":`spinners`};exports.classKey=n,exports.component=e,exports.default=r,exports.status=t;
|
|
2
|
+
//# sourceMappingURL=component.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.cjs","names":[],"sources":["../../../../components/spinner/component.json"],"sourcesContent":["{\n\t\"component\": \"spinner\",\n\t\"status\": \"prod\",\n\t\"display-name\": \"Spinners\",\n\t\"classKey\": \"Spinner\",\n\t\"SLDS-component-path\": \"/components/spinner\",\n\t\"site-stories\": [\n\t\t{\n\t\t\t\"heading\": \"Default\",\n\t\t\t\"path\": \"/__examples__/default.jsx\"\n\t\t}\n\t],\n\t\"url-slug\": \"spinners\"\n}\n"],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs")
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("./check-props.cjs"),r=require("./component.cjs");let i=require("react"),a=require("classnames");a=e.__toESM(a,1);let o=require("react/jsx-runtime");var s={label:`Loading...`},c=(0,i.forwardRef)(({assistiveText:e=s,className:c,classNameSpinner:l,containerClassName:u,containerStyle:d,hasContainer:f=!0,id:p,isDelayed:m=!1,isInline:h=!1,isInput:g=!1,size:_=`medium`,style:v,variant:y=`base`},b)=>{(0,i.useEffect)(()=>{n.default(t.SPINNER,{containerClassName:u,containerStyle:d},r.default)},[]);let x={...s,...e}.label,S=f?(0,a.default)(u,c):c,C=f?{...d,...v}:v,w=(0,a.default)(`slds-spinner`,{"slds-spinner_inline":h,"slds-input__spinner":g,"slds-spinner_brand":y===`brand`,"slds-spinner_inverse":y===`inverse`,"slds-spinner_delayed":m,[`slds-spinner_${_}`]:_},l,f?void 0:S),T=(0,o.jsxs)(`div`,{"aria-hidden":`false`,className:w,id:p,ref:f?void 0:b,role:`status`,style:f?void 0:C,children:[x&&(0,o.jsx)(`span`,{className:`slds-assistive-text`,children:x}),(0,o.jsx)(`div`,{className:`slds-spinner__dot-a`}),(0,o.jsx)(`div`,{className:`slds-spinner__dot-b`})]});return f?(0,o.jsx)(`div`,{className:(0,a.default)(S,`slds-spinner_container`),ref:b,style:C,children:T}):T});c.displayName=t.SPINNER,exports.default=c;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/spinner/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/spinner/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport { forwardRef, useEffect, type CSSProperties } from 'react';\nimport classNames from 'classnames';\nimport { SPINNER } from '../../utilities/constants';\nimport checkProps from './check-props';\nimport componentDoc from './component.json';\n\n/**\n * Spinner size options\n */\nexport type SpinnerSize = 'xx-small' | 'x-small' | 'small' | 'medium' | 'large';\n\n/**\n * Spinner color variant\n */\nexport type SpinnerVariant = 'base' | 'brand' | 'inverse';\n\n/**\n * Assistive text for Spinner\n */\nexport interface SpinnerAssistiveText {\n\t/** Text read by screen readers */\n\tlabel?: string;\n}\n\n/**\n * Props for the Spinner component\n */\nexport interface SpinnerProps {\n\t/** Assistive text for accessibility */\n\tassistiveText?: SpinnerAssistiveText;\n\t/**\n\t * CSS classes for the root element: the `.slds-spinner_container` div, or the\n\t * `.slds-spinner` div when `hasContainer` is `false`.\n\t */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** CSS classes for the `.slds-spinner` div */\n\tclassNameSpinner?: string | string[] | Record<string, boolean>;\n\t/** @deprecated Use `className`, which lands on the container when `hasContainer` is `true`. */\n\tcontainerClassName?: string | string[] | Record<string, boolean>;\n\t/** @deprecated Use `style`, which lands on the container when `hasContainer` is `true`. */\n\tcontainerStyle?: CSSProperties;\n\t/** Render inside a container div */\n\thasContainer?: boolean;\n\t/** Unique identifier */\n\tid?: string;\n\t/** Add 300ms delay before showing */\n\tisDelayed?: boolean;\n\t/** Inline spinner inside document flow */\n\tisInline?: boolean;\n\t/** Spinner inside an input field */\n\tisInput?: boolean;\n\t/** Size of the spinner */\n\tsize?: SpinnerSize;\n\t/** Styles for the root element (see `className`) */\n\tstyle?: CSSProperties;\n\t/** Color variant */\n\tvariant?: SpinnerVariant;\n}\n\nconst defaultAssistiveText: SpinnerAssistiveText = { label: 'Loading...' };\n\n/**\n * Spinners are CSS loading indicators that should be shown when retrieving data\n * or performing slow computations.\n */\nconst Spinner = forwardRef<HTMLDivElement, SpinnerProps>(\n\t(\n\t\t{\n\t\t\tassistiveText = defaultAssistiveText,\n\t\t\tclassName,\n\t\t\tclassNameSpinner,\n\t\t\tcontainerClassName,\n\t\t\tcontainerStyle,\n\t\t\thasContainer = true,\n\t\t\tid,\n\t\t\tisDelayed = false,\n\t\t\tisInline = false,\n\t\t\tisInput = false,\n\t\t\tsize = 'medium',\n\t\t\tstyle,\n\t\t\tvariant = 'base',\n\t\t},\n\t\tref\n\t) => {\n\t\tuseEffect(() => {\n\t\t\tcheckProps(SPINNER, { containerClassName, containerStyle }, componentDoc);\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t}, []); // Only run on mount\n\n\t\tconst mergedAssistiveText = {\n\t\t\t...defaultAssistiveText,\n\t\t\t...assistiveText,\n\t\t}.label;\n\n\t\t// The deprecated container props only ever applied to the container\n\t\tconst rootClassName = hasContainer\n\t\t\t? classNames(containerClassName, className)\n\t\t\t: className;\n\t\tconst rootStyle = hasContainer ? { ...containerStyle, ...style } : style;\n\n\t\tconst spinnerClassName = classNames(\n\t\t\t'slds-spinner',\n\t\t\t{\n\t\t\t\t'slds-spinner_inline': isInline,\n\t\t\t\t'slds-input__spinner': isInput,\n\t\t\t\t'slds-spinner_brand': variant === 'brand',\n\t\t\t\t'slds-spinner_inverse': variant === 'inverse',\n\t\t\t\t'slds-spinner_delayed': isDelayed,\n\t\t\t\t[`slds-spinner_${size}`]: size,\n\t\t\t},\n\t\t\tclassNameSpinner,\n\t\t\thasContainer ? undefined : rootClassName\n\t\t);\n\n\t\tconst spinner = (\n\t\t\t<div\n\t\t\t\taria-hidden=\"false\"\n\t\t\t\tclassName={spinnerClassName}\n\t\t\t\tid={id}\n\t\t\t\tref={hasContainer ? undefined : ref}\n\t\t\t\trole=\"status\"\n\t\t\t\tstyle={hasContainer ? undefined : rootStyle}\n\t\t\t>\n\t\t\t\t{mergedAssistiveText && (\n\t\t\t\t\t<span className=\"slds-assistive-text\">{mergedAssistiveText}</span>\n\t\t\t\t)}\n\t\t\t\t<div className=\"slds-spinner__dot-a\" />\n\t\t\t\t<div className=\"slds-spinner__dot-b\" />\n\t\t\t</div>\n\t\t);\n\n\t\tif (hasContainer) {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tclassName={classNames(rootClassName, 'slds-spinner_container')}\n\t\t\t\t\tref={ref}\n\t\t\t\t\tstyle={rootStyle}\n\t\t\t\t>\n\t\t\t\t\t{spinner}\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn spinner;\n\t}\n);\n\nSpinner.displayName = SPINNER;\n\nexport default Spinner;\n"],"mappings":"iWA8DA,IAAM,EAA6C,CAAE,MAAO,YAAa,EAMnE,GAAA,EAAU,EAAA,WAAA,EAEd,CACC,gBAAgB,EAChB,YACA,mBACA,qBACA,iBACA,eAAe,GACf,KACA,YAAY,GACZ,WAAW,GACX,UAAU,GACV,OAAO,SACP,QACA,UAAU,QAEX,IACI,EACJ,EAAA,EAAA,UAAA,KAAgB,CACf,EAAA,QAAW,EAAA,QAAS,CAAE,qBAAoB,gBAAe,EAAG,EAAA,OAAY,CAEzE,EAAG,CAAC,CAAC,EAEL,IAAM,EAAsB,CAC3B,GAAG,EACH,GAAG,CACJ,EAAE,MAGI,EAAgB,GAAA,EACnB,EAAA,QAAA,CAAW,EAAoB,CAAS,EACxC,EACG,EAAY,EAAe,CAAE,GAAG,EAAgB,GAAG,CAAM,EAAI,EAE7D,GAAA,EAAmB,EAAA,QAAA,CACxB,eACA,CACC,sBAAuB,EACvB,sBAAuB,EACvB,qBAAsB,IAAY,QAClC,uBAAwB,IAAY,UACpC,uBAAwB,GACvB,gBAAgB,KAAS,CAC3B,EACA,EACA,EAAe,IAAA,GAAY,CAC5B,EAEM,GACL,EAAA,EAAA,KAAA,CAAC,MAAD,CACC,cAAY,QACZ,UAAW,EACP,KACJ,IAAK,EAAe,IAAA,GAAY,EAChC,KAAK,SACL,MAAO,EAAe,IAAA,GAAY,EANnC,SAAA,CAQE,IACA,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,sBAAuB,SAAA,CAA0B,CAAA,GAElE,EAAA,EAAA,IAA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