@persona/design-system 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/{Breadcrumbs-ClKHNIr-.mjs → Breadcrumbs-CR-xdruP.mjs} +3 -3
- package/dist/{Breadcrumbs-ClKHNIr-.mjs.map → Breadcrumbs-CR-xdruP.mjs.map} +1 -1
- package/dist/Card2.d.mts +2 -2
- package/dist/{CardV2-CFTjYWoO.mjs → CardV2-CBjhsfrn.mjs} +5 -5
- package/dist/{CardV2-CFTjYWoO.mjs.map → CardV2-CBjhsfrn.mjs.map} +1 -1
- package/dist/{Checkbox-CyeitZ5q.mjs → Checkbox-BHZ7c7_6.mjs} +2 -2
- package/dist/{Checkbox-CyeitZ5q.mjs.map → Checkbox-BHZ7c7_6.mjs.map} +1 -1
- package/dist/{Combobox-Ddas5FN-.mjs → Combobox-BCYLeZDP.mjs} +6 -6
- package/dist/{Combobox-Ddas5FN-.mjs.map → Combobox-BCYLeZDP.mjs.map} +1 -1
- package/dist/{Combobox-DX4DLe1b.d.mts → Combobox-DMN3nc7E.d.mts} +3 -3
- package/dist/Combobox.d.mts +2 -2
- package/dist/{ComboboxBase-Ds_i3K2m.d.mts → ComboboxBase-DBLJYQrh.d.mts} +2 -2
- package/dist/ComboboxBase.d.mts +1 -1
- package/dist/{ComboboxMultiSelect-S6oFJcOS.d.mts → ComboboxMultiSelect-CZRLyM_y.d.mts} +2 -2
- package/dist/ComboboxMultiSelect.d.mts +1 -1
- package/dist/{ComboboxSingleSelect-DFzCwW1Y.d.mts → ComboboxSingleSelect-BS6pZpU_.d.mts} +3 -3
- package/dist/ComboboxSingleSelect.d.mts +1 -1
- package/dist/{ConfigFormGroup-DcsM-u8o.mjs → ConfigFormGroup-BnRDAs0j.mjs} +2 -2
- package/dist/{ConfigFormGroup-DcsM-u8o.mjs.map → ConfigFormGroup-BnRDAs0j.mjs.map} +1 -1
- package/dist/{DatePicker-DTT-mJ8r.mjs → DatePicker-BcjrAr7o.mjs} +6 -6
- package/dist/{DatePicker-DTT-mJ8r.mjs.map → DatePicker-BcjrAr7o.mjs.map} +1 -1
- package/dist/{DropdownButton-DV5if_uG.mjs → DropdownButton-l-fzkb5_.mjs} +2 -2
- package/dist/{DropdownButton-DV5if_uG.mjs.map → DropdownButton-l-fzkb5_.mjs.map} +1 -1
- package/dist/DropdownButton.d.mts +1 -1
- package/dist/{DropdownMenu-CbhEzWy1.d.mts → DropdownMenu-Bg68vvxx.d.mts} +2 -2
- package/dist/{DropdownMenu-DovtBJBs.mjs → DropdownMenu-C0WK4bM0.mjs} +2 -2
- package/dist/{DropdownMenu-DovtBJBs.mjs.map → DropdownMenu-C0WK4bM0.mjs.map} +1 -1
- package/dist/DropdownMenu.d.mts +1 -1
- package/dist/{FormControl-BvRzRknE.mjs → FormControl-BzMbbgr0.mjs} +3 -3
- package/dist/{FormControl-BvRzRknE.mjs.map → FormControl-BzMbbgr0.mjs.map} +1 -1
- package/dist/{FormField-BDJ6zNE6.mjs → FormField-2sNS5PzN.mjs} +14 -14
- package/dist/{FormField-BDJ6zNE6.mjs.map → FormField-2sNS5PzN.mjs.map} +1 -1
- package/dist/{HoverCopyableField-WP6DPjy1.mjs → HoverCopyableField-CeJ0UP87.mjs} +2 -2
- package/dist/{HoverCopyableField-WP6DPjy1.mjs.map → HoverCopyableField-CeJ0UP87.mjs.map} +1 -1
- package/dist/InlineCombobox.d.mts +1 -1
- package/dist/InlineInput.d.mts +1 -1
- package/dist/{Input-DbfwNzS_.mjs → Input-DGWThZlt.mjs} +2 -2
- package/dist/{Input-DbfwNzS_.mjs.map → Input-DGWThZlt.mjs.map} +1 -1
- package/dist/{ListBox-P1eTecdo.d.mts → ListBox-Awtw7Xy_.d.mts} +2 -2
- package/dist/{ListBox-CXh9Jfb-.mjs → ListBox-DqII8giL.mjs} +6 -6
- package/dist/{ListBox-CXh9Jfb-.mjs.map → ListBox-DqII8giL.mjs.map} +1 -1
- package/dist/ListBox.d.mts +1 -1
- package/dist/ListBoxField.d.mts +2 -2
- package/dist/{LoadingShimmer-DeVCDCjT.mjs → LoadingShimmer-ZyzJs5Vi.mjs} +1 -1
- package/dist/{LoadingShimmer-DeVCDCjT.mjs.map → LoadingShimmer-ZyzJs5Vi.mjs.map} +1 -1
- package/dist/{LogicRow-DtZYOzQ8.d.mts → LogicRow-DIn0gLEq.d.mts} +2 -2
- package/dist/LogicRow.d.mts +1 -1
- package/dist/{Menu-CAGTCBqj.mjs → Menu-CeV3lL2g.mjs} +1 -1
- package/dist/{Menu-CAGTCBqj.mjs.map → Menu-CeV3lL2g.mjs.map} +1 -1
- package/dist/{Menu-_loh8pe3.d.mts → Menu-DdHN-drQ.d.mts} +2 -2
- package/dist/Menu.d.mts +1 -1
- package/dist/{PageHeader-wpvRRTaa.mjs → PageHeader-UI_6yImi.mjs} +2 -2
- package/dist/{PageHeader-wpvRRTaa.mjs.map → PageHeader-UI_6yImi.mjs.map} +1 -1
- package/dist/{Pagination-wjr3W3xf.mjs → Pagination-DgA0U1fa.mjs} +3 -3
- package/dist/{Pagination-wjr3W3xf.mjs.map → Pagination-DgA0U1fa.mjs.map} +1 -1
- package/dist/{Pii-Bm-qkweh.mjs → Pii-bxG0qu3t.mjs} +1 -1
- package/dist/{Pii-Bm-qkweh.mjs.map → Pii-bxG0qu3t.mjs.map} +1 -1
- package/dist/{Popover-DUyzmq3e.mjs → Popover-UiOUt5up.mjs} +1 -1
- package/dist/{Popover-DUyzmq3e.mjs.map → Popover-UiOUt5up.mjs.map} +1 -1
- package/dist/{Radio-CkugnL91.mjs → Radio-BrQzZhwP.mjs} +2 -2
- package/dist/{Radio-CkugnL91.mjs.map → Radio-BrQzZhwP.mjs.map} +1 -1
- package/dist/{RadioGroup-8dI8gljw.mjs → RadioGroup-Bl9oXPIo.mjs} +2 -2
- package/dist/{RadioGroup-8dI8gljw.mjs.map → RadioGroup-Bl9oXPIo.mjs.map} +1 -1
- package/dist/{SegmentedControl-DQE0hN57.mjs → SegmentedControl-BozydMtT.mjs} +2 -2
- package/dist/{SegmentedControl-DQE0hN57.mjs.map → SegmentedControl-BozydMtT.mjs.map} +1 -1
- package/dist/{Select-D9OVjzPR.mjs → Select-CktsIrzf.mjs} +4 -4
- package/dist/{Select-D9OVjzPR.mjs.map → Select-CktsIrzf.mjs.map} +1 -1
- package/dist/{Select-wnr46ROZ.d.mts → Select-yPqzqe5k.d.mts} +2 -2
- package/dist/Select.d.mts +1 -1
- package/dist/{Spinner-gBNWIwOn.mjs → Spinner-Dpw3-3JS.mjs} +1 -1
- package/dist/{Spinner-gBNWIwOn.mjs.map → Spinner-Dpw3-3JS.mjs.map} +1 -1
- package/dist/{TabBar-B__54oO3.mjs → TabBar-Dw3xE_B-.mjs} +1 -1
- package/dist/{TabBar-B__54oO3.mjs.map → TabBar-Dw3xE_B-.mjs.map} +1 -1
- package/dist/{Table-CqIi5mVF.mjs → Table-ELLvSvH4.mjs} +2 -2
- package/dist/{Table-CqIi5mVF.mjs.map → Table-ELLvSvH4.mjs.map} +1 -1
- package/dist/{TableBox-C-8RxZT4.mjs → TableBox-CCfha6G2.mjs} +7 -7
- package/dist/{TableBox-C-8RxZT4.mjs.map → TableBox-CCfha6G2.mjs.map} +1 -1
- package/dist/TableBox.d.mts +1 -1
- package/dist/{TableBoxCell-CQ3zT1jG.d.mts → TableBoxCell-xnzuHPV1.d.mts} +4 -4
- package/dist/TableBoxCell.d.mts +1 -1
- package/dist/TableBoxField.d.mts +3 -3
- package/dist/{TableBoxRow-ClK2pceY.d.mts → TableBoxRow-BBDMh5xl.d.mts} +2 -2
- package/dist/TableBoxRow.d.mts +1 -1
- package/dist/{TableBoxRowActions-CoF3DuUQ.d.mts → TableBoxRowActions-DCfol4GC.d.mts} +2 -2
- package/dist/TableBoxRowActions.d.mts +1 -1
- package/dist/{TableControls-DplArh-9.mjs → TableControls-C-yb5EYU.mjs} +11 -11
- package/dist/{TableControls-DplArh-9.mjs.map → TableControls-C-yb5EYU.mjs.map} +1 -1
- package/dist/{TechnicalSticker-D6MO_IfT.mjs → TechnicalSticker-CLbNA0kp.mjs} +1 -1
- package/dist/{TechnicalSticker-D6MO_IfT.mjs.map → TechnicalSticker-CLbNA0kp.mjs.map} +1 -1
- package/dist/{TextArea-CYirq-B2.mjs → TextArea-oAK1DKId.mjs} +2 -2
- package/dist/{TextArea-CYirq-B2.mjs.map → TextArea-oAK1DKId.mjs.map} +1 -1
- package/dist/{Toggle-CqgFNIYS.mjs → Toggle-DZzirZ8p.mjs} +2 -2
- package/dist/{Toggle-CqgFNIYS.mjs.map → Toggle-DZzirZ8p.mjs.map} +1 -1
- package/dist/components/BottomPanel/index.mjs +1 -1
- package/dist/components/Breadcrumbs/index.mjs +1 -1
- package/dist/components/ButtonGroup/index.mjs +1 -1
- package/dist/components/CardV2/index.mjs +1 -1
- package/dist/components/Checkbox/index.mjs +1 -1
- package/dist/components/Combobox/index.d.mts +2 -2
- package/dist/components/Combobox/index.mjs +1 -1
- package/dist/components/ConfigFormGroup/index.mjs +2 -2
- package/dist/components/DataTable/TableControls/index.mjs +1 -1
- package/dist/components/DataTable/index.mjs +7 -7
- package/dist/components/DataTable/types.d.mts +1 -1
- package/dist/components/DatePicker/index.mjs +1 -1
- package/dist/components/DropdownButton/index.mjs +1 -1
- package/dist/components/DropdownMenu/index.d.mts +1 -1
- package/dist/components/DropdownMenu/index.mjs +1 -1
- package/dist/components/FormControl/index.mjs +2 -2
- package/dist/components/FormField/index.mjs +1 -1
- package/dist/components/HoverCopyableField/index.mjs +1 -1
- package/dist/components/ImageTile/index.mjs +3 -3
- package/dist/components/Input/index.mjs +1 -1
- package/dist/components/ListBox/index.d.mts +3 -3
- package/dist/components/ListBox/index.mjs +1 -1
- package/dist/components/LoadingShimmer/index.mjs +1 -1
- package/dist/components/MaskedInput/index.mjs +1 -1
- package/dist/components/Menu/index.d.mts +1 -1
- package/dist/components/Menu/index.mjs +1 -1
- package/dist/components/Modal/index.mjs +3 -65
- package/dist/components/Modal/index.mjs.map +1 -1
- package/dist/components/PageHeader/index.mjs +1 -1
- package/dist/components/Pagination/index.mjs +1 -1
- package/dist/components/Pii/index.mjs +1 -1
- package/dist/components/Popover/index.mjs +1 -1
- package/dist/components/Radio/index.mjs +1 -1
- package/dist/components/RadioGroup/index.mjs +1 -1
- package/dist/components/RightPanel/index.mjs +1 -1
- package/dist/components/SegmentedControl/index.mjs +1 -1
- package/dist/components/Select/index.d.mts +1 -1
- package/dist/components/Select/index.mjs +1 -1
- package/dist/components/Slider/index.mjs +1 -1
- package/dist/components/SmartTextInput/parser/method-chain/grammar.pegjs +219 -0
- package/dist/components/SmartTextInput/parser/smart-text/grammar.pegjs +154 -0
- package/dist/components/Spinner/index.mjs +1 -1
- package/dist/components/TabBar/index.mjs +1 -1
- package/dist/components/Table/index.mjs +1 -1
- package/dist/components/TableBox/index.d.mts +1 -1
- package/dist/components/TableBox/index.mjs +1 -1
- package/dist/components/TechnicalSticker/index.mjs +1 -1
- package/dist/components/TextArea/index.mjs +1 -1
- package/dist/components/Toggle/index.mjs +1 -1
- package/dist/fieldPickerOptions.d.mts +1 -1
- package/dist/{index-BJr_obTf.d.mts → index-CBWvk6Ch.d.mts} +3 -3
- package/dist/inputFields.d.mts +3 -3
- package/dist/{intersperse-CRUnXmnu.mjs → intersperse-vOYvFOfF.mjs} +1 -1
- package/dist/{intersperse-CRUnXmnu.mjs.map → intersperse-vOYvFOfF.mjs.map} +1 -1
- package/dist/lib/useModalInsetRight.mjs +69 -0
- package/dist/lib/useModalInsetRight.mjs.map +1 -0
- package/dist/patterns/LayoutLoadingShimmer/index.mjs +4 -4
- package/dist/useComboboxFooterAction.d.mts +1 -1
- package/dist/{useFormField-C-K1lgmv.mjs → useFormField-DhYd6bNn.mjs} +2 -2
- package/dist/{useFormField-C-K1lgmv.mjs.map → useFormField-DhYd6bNn.mjs.map} +1 -1
- package/dist/{useFormGroup-y-duFylq.mjs → useFormGroup-DWVW7A9f.mjs} +1 -1
- package/dist/{useFormGroup-y-duFylq.mjs.map → useFormGroup-DWVW7A9f.mjs.map} +1 -1
- package/dist/useTruncation.d.mts +1 -1
- package/llms.txt +1 -0
- package/package.json +3 -1
- package/skills/design-system-component-authoring/SKILL.md +79 -0
- package/skills/design-system-component-authoring/clarifying-scope.md +18 -0
- package/skills/design-system-component-authoring/component-conventions.md +70 -0
- package/skills/design-system-component-authoring/prop-interface-patterns.md +30 -0
- /package/dist/{useModalInsetRight.d.mts → lib/useModalInsetRight.d.mts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechnicalSticker-D6MO_IfT.mjs","names":[],"sources":["../components/TechnicalSticker/TechnicalSticker.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type MouseEvent,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport styled, { css, useTheme } from 'styled-components';\n\nimport { BorderRadius, Color, Spacing, Typography } from '@persona/design-tokens';\nimport { CopyIcon } from '@persona/icons/12px';\nimport Tooltip from 'design-system/components/Tooltip';\nimport { withAlpha } from 'design-system/lib/color';\nimport copyTextToClipboard from 'design-system/lib/copyTextToClipboard';\nimport MiddleTruncatedText from 'design-system/lib/MiddleTruncatedText';\nimport { isHovered } from 'design-system/lib/pseudoClass';\nimport {\n type MaybeSemanticTheme,\n semanticColor,\n semanticTokens,\n} from 'design-system/lib/semanticColor';\nimport useToggle from 'design-system/lib/useToggle';\nimport type { SemanticTokens } from 'design-system/variables/semantic';\n\nexport type TechnicalStickerVariant = 'grey' | 'white';\n\nconst COPY_CONFIRMATION_TEXT = 'Copied!';\nconst COPY_CONFIRMATION_DURATION_MS = 1200;\nconst DEFAULT_COPY_TOOLTIP_LABEL = 'Copy ID';\nconst HREF_VALIDATION_BASE_URL = 'https://withpersona.com';\nconst TECHNICAL_TEXT_FONT = `${Typography.TextMono.fontWeight} ${Typography.TextExtraSmall.fontSize} ${Typography.TextMono.fontFamily}`;\n\nconst semanticRestFill = (tokens: SemanticTokens, variant: TechnicalStickerVariant) =>\n variant === 'white' ? tokens.FeedbackNeutralInverse : tokens.FeedbackNeutral1;\n\nconst restFill = (theme: MaybeSemanticTheme, variant: TechnicalStickerVariant) => {\n const tokens = semanticTokens(theme);\n if (tokens) {\n return semanticRestFill(tokens, variant);\n }\n return variant === 'white' ? Color.BackgroundLabelWhite : Color.BackgroundLabelGrey;\n};\n\nconst hoverFill = (theme: MaybeSemanticTheme, variant: TechnicalStickerVariant) =>\n variant === 'white'\n ? semanticColor(theme, 'FeedbackNeutral1', Color.BackgroundButtonInverseHover)\n : semanticColor(theme, 'ActionNeutralActive', Color.BackgroundLabelGreyHover);\n\nconst isSafeTechnicalStickerHref = (href: string) => {\n try {\n const url = new URL(href, HREF_VALIDATION_BASE_URL);\n return url.protocol === 'http:' || url.protocol === 'https:';\n } catch {\n return false;\n }\n};\n\nconst TechnicalStickerShell = styled.div<{\n variant: TechnicalStickerVariant;\n disabled?: boolean;\n $width?: number | string;\n}>`\n display: inline-flex;\n align-items: center;\n white-space: nowrap;\n\n border-radius: ${BorderRadius.Sm};\n height: 1rem;\n width: ${({ $width }) => (typeof $width === 'number' ? `${$width}px` : ($width ?? 'auto'))};\n max-width: 100%;\n box-sizing: border-box;\n\n color: ${({ theme, disabled }) =>\n disabled\n ? semanticColor(theme, 'FgDisabled', theme.color.text.disabled)\n : semanticColor(theme, 'FgPrimary', theme.color.text.primary)};\n background: ${({ theme, variant, disabled }) => {\n const tokens = semanticTokens(theme);\n return tokens && disabled\n ? withAlpha(semanticRestFill(tokens, variant), tokens.Opacity65)\n : restFill(theme, variant);\n }};\n\n position: relative;\n overflow: hidden;\n border: 1px solid ${({ theme }) => semanticColor(theme, 'BorderDefault', Color.BorderInputDefault)};\n\n ${({ theme, variant, disabled }) =>\n !disabled &&\n css`\n &:hover {\n background: ${hoverFill(theme, variant)};\n }\n `}\n`;\n\nconst labelContainerStyles = css`\n display: flex;\n align-items: center;\n justify-content: center;\n flex: 1 1 auto;\n min-width: 0;\n padding: 0 ${Spacing[1]};\n`;\n\nconst LabelContainer = styled.div`\n ${labelContainerStyles}\n`;\n\nconst LabelLink = styled.a`\n ${labelContainerStyles}\n color: inherit;\n text-decoration: none;\n`;\n\nconst TechnicalText = styled(MiddleTruncatedText)<{\n $isLinkEnabled: boolean;\n $isTruncated: boolean;\n}>`\n ${Typography.TextMono};\n font-size: ${Typography.TextExtraSmall.fontSize};\n line-height: ${Typography.TextExtraSmall.lineHeight};\n text-align: center;\n\n ${({ $isLinkEnabled, $isTruncated }) =>\n $isTruncated &&\n css`\n cursor: ${$isLinkEnabled ? 'pointer' : 'default'};\n user-select: none;\n\n & > span {\n user-select: none;\n }\n `}\n`;\n\nconst CopyActions = styled.div<{ $visible: boolean }>`\n position: absolute;\n top: 0;\n right: 0;\n z-index: 1;\n display: flex;\n align-items: center;\n height: 16px;\n opacity: ${({ $visible }) => ($visible ? 1 : 0)};\n pointer-events: ${({ $visible }) => ($visible ? 'auto' : 'none')};\n transition: opacity 120ms ease-in-out;\n\n /* Keyboard focus keeps the actions reachable, but a click also focuses the\n button — matching plain :focus-within would leave them visible after the\n pointer moves away. */\n &:has(:focus-visible) {\n opacity: 1;\n pointer-events: auto;\n }\n`;\n\nconst CopyGradient = styled.div<{ $background: string }>`\n width: 8px;\n height: 16px;\n background: linear-gradient(to left, ${({ $background }) => $background}, transparent);\n`;\n\nconst CopyButton = styled.button<{ $background: string }>`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n padding: 0 2px 0 0;\n border: none;\n background: ${({ $background }) => $background};\n color: ${({ theme }) => semanticColor(theme, 'FgPrimary', Color.BorderIconPrimary)};\n cursor: pointer;\n\n &:disabled {\n cursor: not-allowed;\n }\n\n &${isHovered}:not(:disabled) {\n color: ${({ theme }) => semanticColor(theme, 'FgPrimary', Color.TextPrimary)};\n }\n`;\n\nexport interface TechnicalStickerProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {\n /** Full untruncated technical value displayed in the sticker. */\n children: string;\n /** Visual style for the technical sticker. Default: `grey`. */\n variant?: TechnicalStickerVariant;\n /** Renders disabled style and disables copy/link interaction. */\n disabled?: boolean;\n /** Opens in a new tab when the sticker body is clicked. */\n href?: string;\n /**\n * Hover tooltip for the sticker body. Shown when text is truncated or when set explicitly.\n * Defaults to the untruncated `children` string when shown.\n */\n tooltipLabel?: string;\n /**\n * Hover tooltip for the copy icon.\n * Defaults to `Copy ID`.\n */\n copyTooltipLabel?: string;\n /**\n * Confirmation label shown in the copy tooltip after a successful copy.\n * Defaults to `Copied!`.\n */\n copyConfirmationLabel?: string;\n /** Whether to show the hover copy action. Default: true. */\n copyable?: boolean;\n /** Value copied to the clipboard. Defaults to `children`. */\n copyValue?: string;\n /** Width of the sticker. Numbers are interpreted as pixels. */\n width?: number | string;\n /** Max width for middle truncation. Default: '96px'. */\n maxWidth?: number | string;\n}\n\nexport const TechnicalSticker = ({\n variant = 'grey',\n href,\n tooltipLabel: tooltipLabelProp,\n copyTooltipLabel = DEFAULT_COPY_TOOLTIP_LABEL,\n copyConfirmationLabel = COPY_CONFIRMATION_TEXT,\n copyable = true,\n copyValue,\n width,\n maxWidth = '96px',\n children,\n disabled,\n onMouseEnter,\n onMouseLeave,\n ...stickerProps\n}: TechnicalStickerProps) => {\n const [isHoveredState, setIsHoveredState] = useState(false);\n const [isCopyButtonKeyboardFocused, setIsCopyButtonKeyboardFocused] = useState(false);\n const [isTruncated, setIsTruncated] = useState(false);\n const [isCopyTooltipOpen, setIsCopyTooltipOpen] = useState(false);\n const [copyConfirmationOpen, { enable: showCopyConfirmation, disable: hideCopyConfirmation }] =\n useToggle(false);\n const copyConfirmationTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const copyButtonRef = useRef<HTMLButtonElement>(null);\n const isPointerFocusRef = useRef(false);\n const copyRequestIdRef = useRef(0);\n\n const tooltipLabel = tooltipLabelProp ?? children;\n const hasCustomTooltipLabel = tooltipLabelProp != null;\n\n const theme = useTheme();\n const hoverBackground = hoverFill(theme, variant);\n const copyActionBackground = isHoveredState ? hoverBackground : restFill(theme, variant);\n const showCopyActions =\n copyable &&\n !disabled &&\n (isHoveredState || isCopyButtonKeyboardFocused || copyConfirmationOpen);\n const showStickerTooltip = tooltipLabel.length > 0 && (isTruncated || hasCustomTooltipLabel);\n const isCopyTooltipVisible = isCopyTooltipOpen || copyConfirmationOpen;\n const isLinkEnabled = href != null && !disabled && isSafeTechnicalStickerHref(href);\n\n const handleCopyTooltipOpenChange = useCallback(\n (open: boolean) => {\n if (copyConfirmationOpen) {\n return;\n }\n\n setIsCopyTooltipOpen(open);\n },\n [copyConfirmationOpen],\n );\n\n const dismissCopyConfirmation = useCallback(() => {\n // Writing to the clipboard is async, so a copy still in flight would\n // otherwise surface its confirmation after the dismissal.\n copyRequestIdRef.current += 1;\n\n if (copyConfirmationTimerRef.current) {\n clearTimeout(copyConfirmationTimerRef.current);\n copyConfirmationTimerRef.current = null;\n }\n\n setIsCopyTooltipOpen(false);\n hideCopyConfirmation();\n }, [hideCopyConfirmation]);\n\n const handleCopy = useCallback(\n async (event: MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n event.stopPropagation();\n\n if (disabled) {\n return;\n }\n\n const requestId = ++copyRequestIdRef.current;\n const copyWasSuccessful = await copyTextToClipboard(copyValue ?? children);\n if (!copyWasSuccessful || requestId !== copyRequestIdRef.current) {\n return;\n }\n\n setIsCopyTooltipOpen(true);\n showCopyConfirmation();\n if (copyConfirmationTimerRef.current) {\n clearTimeout(copyConfirmationTimerRef.current);\n }\n copyConfirmationTimerRef.current = setTimeout(() => {\n setIsCopyTooltipOpen(false);\n hideCopyConfirmation();\n copyConfirmationTimerRef.current = null;\n }, COPY_CONFIRMATION_DURATION_MS);\n },\n [children, copyValue, disabled, hideCopyConfirmation, showCopyConfirmation],\n );\n\n useEffect(\n () => () => {\n if (copyConfirmationTimerRef.current) {\n clearTimeout(copyConfirmationTimerRef.current);\n }\n },\n [],\n );\n\n // Clicking an already keyboard-focused button fires no second focus event, so\n // pointer input has to retire the keyboard state itself.\n const handleCopyButtonMouseDown = () => {\n isPointerFocusRef.current = true;\n setIsCopyButtonKeyboardFocused(false);\n };\n\n // A click focuses the button too, so treating any focus as a reason to keep\n // the actions visible would pin them open once the pointer moves away.\n const handleCopyButtonFocus = () => {\n setIsCopyButtonKeyboardFocused(!isPointerFocusRef.current);\n isPointerFocusRef.current = false;\n };\n\n const handleCopyButtonBlur = () => {\n isPointerFocusRef.current = false;\n setIsCopyButtonKeyboardFocused(false);\n };\n\n const technicalText = (\n <TechnicalText\n value={children}\n maxWidth={width ?? maxWidth}\n font={TECHNICAL_TEXT_FONT}\n onTruncatedChange={setIsTruncated}\n titleBehavior='never'\n $isLinkEnabled={isLinkEnabled}\n $isTruncated={isTruncated}\n />\n );\n\n const labelContent = isLinkEnabled ? (\n <LabelLink href={href} target='_blank' rel='noopener noreferrer'>\n {technicalText}\n </LabelLink>\n ) : (\n <LabelContainer>{technicalText}</LabelContainer>\n );\n\n const labelWithTooltip = showStickerTooltip ? (\n <Tooltip trigger={labelContent} interactive side='top' maxWidth='400px'>\n {tooltipLabel}\n </Tooltip>\n ) : (\n labelContent\n );\n\n return (\n <TechnicalStickerShell\n {...stickerProps}\n variant={variant}\n disabled={disabled}\n $width={width}\n onMouseEnter={(event) => {\n onMouseEnter?.(event);\n setIsHoveredState(true);\n }}\n onMouseLeave={(event) => {\n onMouseLeave?.(event);\n setIsHoveredState(false);\n if (!isCopyButtonKeyboardFocused) {\n // Otherwise a click's focus lingers on a button that is now hidden.\n copyButtonRef.current?.blur();\n dismissCopyConfirmation();\n }\n }}\n >\n {labelWithTooltip}\n {copyable && (\n <CopyActions $visible={showCopyActions}>\n <CopyGradient $background={copyActionBackground} />\n <Tooltip\n open={isCopyTooltipVisible}\n onOpenChange={handleCopyTooltipOpenChange}\n trigger={\n <CopyButton\n ref={copyButtonRef}\n type='button'\n aria-label='Copy'\n disabled={disabled}\n $background={copyActionBackground}\n onClick={handleCopy}\n onMouseDown={handleCopyButtonMouseDown}\n onBlur={handleCopyButtonBlur}\n onFocus={handleCopyButtonFocus}\n >\n <CopyIcon />\n </CopyButton>\n }\n interactive={false}\n side='top'\n >\n {copyConfirmationOpen ? copyConfirmationLabel : copyTooltipLabel}\n </Tooltip>\n </CopyActions>\n )}\n </TechnicalStickerShell>\n );\n};\n\nexport default TechnicalSticker;\n"],"mappings":";;;;;;;;;;;;;AA2BA,MAAM,yBAAyB;AAC/B,MAAM,gCAAgC;AACtC,MAAM,6BAA6B;AACnC,MAAM,2BAA2B;AACjC,MAAM,sBAAsB,GAAG,WAAW,SAAS,WAAW,GAAG,WAAW,eAAe,SAAS,GAAG,WAAW,SAAS;AAE3H,MAAM,oBAAoB,QAAwB,YAChD,YAAY,UAAU,OAAO,yBAAyB,OAAO;AAE/D,MAAM,YAAY,OAA2B,YAAqC;CAChF,MAAM,SAAS,eAAe,MAAM;AACpC,KAAI,OACF,QAAO,iBAAiB,QAAQ,QAAQ;AAE1C,QAAO,YAAY,UAAU,MAAM,uBAAuB,MAAM;;AAGlE,MAAM,aAAa,OAA2B,YAC5C,YAAY,UACR,cAAc,OAAO,oBAAoB,MAAM,6BAA6B,GAC5E,cAAc,OAAO,uBAAuB,MAAM,yBAAyB;AAEjF,MAAM,8BAA8B,SAAiB;AACnD,KAAI;EACF,MAAM,MAAM,IAAI,IAAI,MAAM,yBAAyB;AACnD,SAAO,IAAI,aAAa,WAAW,IAAI,aAAa;SAC9C;AACN,SAAO;;;AAIX,MAAM,wBAAwB,OAAO,GAInC;;;;;mBAKiB,aAAa,GAAG;;YAEvB,EAAE,aAAc,OAAO,WAAW,WAAW,GAAG,OAAO,MAAO,UAAU,OAAS;;;;YAIjF,EAAE,OAAO,eACjB,WACI,cAAc,OAAO,cAAc,MAAM,MAAM,KAAK,SAAS,GAC7D,cAAc,OAAO,aAAa,MAAM,MAAM,KAAK,QAAQ,CAAC;iBACnD,EAAE,OAAO,SA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,CAAA,EACnD,oBAAC,SAAD;IACE,MAAM;IACN,cAAc;IACd,SACE,oBAAC,YAAD;KACE,KAAK;KACL,MAAK;KACL,cAAW;KACD;KACV,aAAa;KACb,SAAS;KACT,aAAa;KACb,QAAQ;KACR,SAAS;eAET,oBAAC,UAAD,EAAY,CAAA;KACD,CAAA;IAEf,aAAa;IACb,MAAK;cAEJ,uBAAuB,wBAAwB;IACxC,CAAA,CACE;KAEM"}
|
|
1
|
+
{"version":3,"file":"TechnicalSticker-CLbNA0kp.mjs","names":[],"sources":["../components/TechnicalSticker/TechnicalSticker.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type MouseEvent,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport styled, { css, useTheme } from 'styled-components';\n\nimport { BorderRadius, Color, Spacing, Typography } from '@persona/design-tokens';\nimport { CopyIcon } from '@persona/icons/12px';\nimport Tooltip from 'design-system/components/Tooltip';\nimport { withAlpha } from 'design-system/lib/color';\nimport copyTextToClipboard from 'design-system/lib/copyTextToClipboard';\nimport MiddleTruncatedText from 'design-system/lib/MiddleTruncatedText';\nimport { isHovered } from 'design-system/lib/pseudoClass';\nimport {\n type MaybeSemanticTheme,\n semanticColor,\n semanticTokens,\n} from 'design-system/lib/semanticColor';\nimport useToggle from 'design-system/lib/useToggle';\nimport type { SemanticTokens } from 'design-system/variables/semantic';\n\nexport type TechnicalStickerVariant = 'grey' | 'white';\n\nconst COPY_CONFIRMATION_TEXT = 'Copied!';\nconst COPY_CONFIRMATION_DURATION_MS = 1200;\nconst DEFAULT_COPY_TOOLTIP_LABEL = 'Copy ID';\nconst HREF_VALIDATION_BASE_URL = 'https://withpersona.com';\nconst TECHNICAL_TEXT_FONT = `${Typography.TextMono.fontWeight} ${Typography.TextExtraSmall.fontSize} ${Typography.TextMono.fontFamily}`;\n\nconst semanticRestFill = (tokens: SemanticTokens, variant: TechnicalStickerVariant) =>\n variant === 'white' ? tokens.FeedbackNeutralInverse : tokens.FeedbackNeutral1;\n\nconst restFill = (theme: MaybeSemanticTheme, variant: TechnicalStickerVariant) => {\n const tokens = semanticTokens(theme);\n if (tokens) {\n return semanticRestFill(tokens, variant);\n }\n return variant === 'white' ? Color.BackgroundLabelWhite : Color.BackgroundLabelGrey;\n};\n\nconst hoverFill = (theme: MaybeSemanticTheme, variant: TechnicalStickerVariant) =>\n variant === 'white'\n ? semanticColor(theme, 'FeedbackNeutral1', Color.BackgroundButtonInverseHover)\n : semanticColor(theme, 'ActionNeutralActive', Color.BackgroundLabelGreyHover);\n\nconst isSafeTechnicalStickerHref = (href: string) => {\n try {\n const url = new URL(href, HREF_VALIDATION_BASE_URL);\n return url.protocol === 'http:' || url.protocol === 'https:';\n } catch {\n return false;\n }\n};\n\nconst TechnicalStickerShell = styled.div<{\n variant: TechnicalStickerVariant;\n disabled?: boolean;\n $width?: number | string;\n}>`\n display: inline-flex;\n align-items: center;\n white-space: nowrap;\n\n border-radius: ${BorderRadius.Sm};\n height: 1rem;\n width: ${({ $width }) => (typeof $width === 'number' ? `${$width}px` : ($width ?? 'auto'))};\n max-width: 100%;\n box-sizing: border-box;\n\n color: ${({ theme, disabled }) =>\n disabled\n ? semanticColor(theme, 'FgDisabled', theme.color.text.disabled)\n : semanticColor(theme, 'FgPrimary', theme.color.text.primary)};\n background: ${({ theme, variant, disabled }) => {\n const tokens = semanticTokens(theme);\n return tokens && disabled\n ? withAlpha(semanticRestFill(tokens, variant), tokens.Opacity65)\n : restFill(theme, variant);\n }};\n\n position: relative;\n overflow: hidden;\n border: 1px solid ${({ theme }) => semanticColor(theme, 'BorderDefault', Color.BorderInputDefault)};\n\n ${({ theme, variant, disabled }) =>\n !disabled &&\n css`\n &:hover {\n background: ${hoverFill(theme, variant)};\n }\n `}\n`;\n\nconst labelContainerStyles = css`\n display: flex;\n align-items: center;\n justify-content: center;\n flex: 1 1 auto;\n min-width: 0;\n padding: 0 ${Spacing[1]};\n`;\n\nconst LabelContainer = styled.div`\n ${labelContainerStyles}\n`;\n\nconst LabelLink = styled.a`\n ${labelContainerStyles}\n color: inherit;\n text-decoration: none;\n`;\n\nconst TechnicalText = styled(MiddleTruncatedText)<{\n $isLinkEnabled: boolean;\n $isTruncated: boolean;\n}>`\n ${Typography.TextMono};\n font-size: ${Typography.TextExtraSmall.fontSize};\n line-height: ${Typography.TextExtraSmall.lineHeight};\n text-align: center;\n\n ${({ $isLinkEnabled, $isTruncated }) =>\n $isTruncated &&\n css`\n cursor: ${$isLinkEnabled ? 'pointer' : 'default'};\n user-select: none;\n\n & > span {\n user-select: none;\n }\n `}\n`;\n\nconst CopyActions = styled.div<{ $visible: boolean }>`\n position: absolute;\n top: 0;\n right: 0;\n z-index: 1;\n display: flex;\n align-items: center;\n height: 16px;\n opacity: ${({ $visible }) => ($visible ? 1 : 0)};\n pointer-events: ${({ $visible }) => ($visible ? 'auto' : 'none')};\n transition: opacity 120ms ease-in-out;\n\n /* Keyboard focus keeps the actions reachable, but a click also focuses the\n button — matching plain :focus-within would leave them visible after the\n pointer moves away. */\n &:has(:focus-visible) {\n opacity: 1;\n pointer-events: auto;\n }\n`;\n\nconst CopyGradient = styled.div<{ $background: string }>`\n width: 8px;\n height: 16px;\n background: linear-gradient(to left, ${({ $background }) => $background}, transparent);\n`;\n\nconst CopyButton = styled.button<{ $background: string }>`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n padding: 0 2px 0 0;\n border: none;\n background: ${({ $background }) => $background};\n color: ${({ theme }) => semanticColor(theme, 'FgPrimary', Color.BorderIconPrimary)};\n cursor: pointer;\n\n &:disabled {\n cursor: not-allowed;\n }\n\n &${isHovered}:not(:disabled) {\n color: ${({ theme }) => semanticColor(theme, 'FgPrimary', Color.TextPrimary)};\n }\n`;\n\nexport interface TechnicalStickerProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {\n /** Full untruncated technical value displayed in the sticker. */\n children: string;\n /** Visual style for the technical sticker. Default: `grey`. */\n variant?: TechnicalStickerVariant;\n /** Renders disabled style and disables copy/link interaction. */\n disabled?: boolean;\n /** Opens in a new tab when the sticker body is clicked. */\n href?: string;\n /**\n * Hover tooltip for the sticker body. Shown when text is truncated or when set explicitly.\n * Defaults to the untruncated `children` string when shown.\n */\n tooltipLabel?: string;\n /**\n * Hover tooltip for the copy icon.\n * Defaults to `Copy ID`.\n */\n copyTooltipLabel?: string;\n /**\n * Confirmation label shown in the copy tooltip after a successful copy.\n * Defaults to `Copied!`.\n */\n copyConfirmationLabel?: string;\n /** Whether to show the hover copy action. Default: true. */\n copyable?: boolean;\n /** Value copied to the clipboard. Defaults to `children`. */\n copyValue?: string;\n /** Width of the sticker. Numbers are interpreted as pixels. */\n width?: number | string;\n /** Max width for middle truncation. Default: '96px'. */\n maxWidth?: number | string;\n}\n\nexport const TechnicalSticker = ({\n variant = 'grey',\n href,\n tooltipLabel: tooltipLabelProp,\n copyTooltipLabel = DEFAULT_COPY_TOOLTIP_LABEL,\n copyConfirmationLabel = COPY_CONFIRMATION_TEXT,\n copyable = true,\n copyValue,\n width,\n maxWidth = '96px',\n children,\n disabled,\n onMouseEnter,\n onMouseLeave,\n ...stickerProps\n}: TechnicalStickerProps) => {\n const [isHoveredState, setIsHoveredState] = useState(false);\n const [isCopyButtonKeyboardFocused, setIsCopyButtonKeyboardFocused] = useState(false);\n const [isTruncated, setIsTruncated] = useState(false);\n const [isCopyTooltipOpen, setIsCopyTooltipOpen] = useState(false);\n const [copyConfirmationOpen, { enable: showCopyConfirmation, disable: hideCopyConfirmation }] =\n useToggle(false);\n const copyConfirmationTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const copyButtonRef = useRef<HTMLButtonElement>(null);\n const isPointerFocusRef = useRef(false);\n const copyRequestIdRef = useRef(0);\n\n const tooltipLabel = tooltipLabelProp ?? children;\n const hasCustomTooltipLabel = tooltipLabelProp != null;\n\n const theme = useTheme();\n const hoverBackground = hoverFill(theme, variant);\n const copyActionBackground = isHoveredState ? hoverBackground : restFill(theme, variant);\n const showCopyActions =\n copyable &&\n !disabled &&\n (isHoveredState || isCopyButtonKeyboardFocused || copyConfirmationOpen);\n const showStickerTooltip = tooltipLabel.length > 0 && (isTruncated || hasCustomTooltipLabel);\n const isCopyTooltipVisible = isCopyTooltipOpen || copyConfirmationOpen;\n const isLinkEnabled = href != null && !disabled && isSafeTechnicalStickerHref(href);\n\n const handleCopyTooltipOpenChange = useCallback(\n (open: boolean) => {\n if (copyConfirmationOpen) {\n return;\n }\n\n setIsCopyTooltipOpen(open);\n },\n [copyConfirmationOpen],\n );\n\n const dismissCopyConfirmation = useCallback(() => {\n // Writing to the clipboard is async, so a copy still in flight would\n // otherwise surface its confirmation after the dismissal.\n copyRequestIdRef.current += 1;\n\n if (copyConfirmationTimerRef.current) {\n clearTimeout(copyConfirmationTimerRef.current);\n copyConfirmationTimerRef.current = null;\n }\n\n setIsCopyTooltipOpen(false);\n hideCopyConfirmation();\n }, [hideCopyConfirmation]);\n\n const handleCopy = useCallback(\n async (event: MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n event.stopPropagation();\n\n if (disabled) {\n return;\n }\n\n const requestId = ++copyRequestIdRef.current;\n const copyWasSuccessful = await copyTextToClipboard(copyValue ?? children);\n if (!copyWasSuccessful || requestId !== copyRequestIdRef.current) {\n return;\n }\n\n setIsCopyTooltipOpen(true);\n showCopyConfirmation();\n if (copyConfirmationTimerRef.current) {\n clearTimeout(copyConfirmationTimerRef.current);\n }\n copyConfirmationTimerRef.current = setTimeout(() => {\n setIsCopyTooltipOpen(false);\n hideCopyConfirmation();\n copyConfirmationTimerRef.current = null;\n }, COPY_CONFIRMATION_DURATION_MS);\n },\n [children, copyValue, disabled, hideCopyConfirmation, showCopyConfirmation],\n );\n\n useEffect(\n () => () => {\n if (copyConfirmationTimerRef.current) {\n clearTimeout(copyConfirmationTimerRef.current);\n }\n },\n [],\n );\n\n // Clicking an already keyboard-focused button fires no second focus event, so\n // pointer input has to retire the keyboard state itself.\n const handleCopyButtonMouseDown = () => {\n isPointerFocusRef.current = true;\n setIsCopyButtonKeyboardFocused(false);\n };\n\n // A click focuses the button too, so treating any focus as a reason to keep\n // the actions visible would pin them open once the pointer moves away.\n const handleCopyButtonFocus = () => {\n setIsCopyButtonKeyboardFocused(!isPointerFocusRef.current);\n isPointerFocusRef.current = false;\n };\n\n const handleCopyButtonBlur = () => {\n isPointerFocusRef.current = false;\n setIsCopyButtonKeyboardFocused(false);\n };\n\n const technicalText = (\n <TechnicalText\n value={children}\n maxWidth={width ?? maxWidth}\n font={TECHNICAL_TEXT_FONT}\n onTruncatedChange={setIsTruncated}\n titleBehavior='never'\n $isLinkEnabled={isLinkEnabled}\n $isTruncated={isTruncated}\n />\n );\n\n const labelContent = isLinkEnabled ? (\n <LabelLink href={href} target='_blank' rel='noopener noreferrer'>\n {technicalText}\n </LabelLink>\n ) : (\n <LabelContainer>{technicalText}</LabelContainer>\n );\n\n const labelWithTooltip = showStickerTooltip ? (\n <Tooltip trigger={labelContent} interactive side='top' maxWidth='400px'>\n {tooltipLabel}\n </Tooltip>\n ) : (\n labelContent\n );\n\n return (\n <TechnicalStickerShell\n {...stickerProps}\n variant={variant}\n disabled={disabled}\n $width={width}\n onMouseEnter={(event) => {\n onMouseEnter?.(event);\n setIsHoveredState(true);\n }}\n onMouseLeave={(event) => {\n onMouseLeave?.(event);\n setIsHoveredState(false);\n if (!isCopyButtonKeyboardFocused) {\n // Otherwise a click's focus lingers on a button that is now hidden.\n copyButtonRef.current?.blur();\n dismissCopyConfirmation();\n }\n }}\n >\n {labelWithTooltip}\n {copyable && (\n <CopyActions $visible={showCopyActions}>\n <CopyGradient $background={copyActionBackground} />\n <Tooltip\n open={isCopyTooltipVisible}\n onOpenChange={handleCopyTooltipOpenChange}\n trigger={\n <CopyButton\n ref={copyButtonRef}\n type='button'\n aria-label='Copy'\n disabled={disabled}\n $background={copyActionBackground}\n onClick={handleCopy}\n onMouseDown={handleCopyButtonMouseDown}\n onBlur={handleCopyButtonBlur}\n onFocus={handleCopyButtonFocus}\n >\n <CopyIcon />\n </CopyButton>\n }\n interactive={false}\n side='top'\n >\n {copyConfirmationOpen ? copyConfirmationLabel : copyTooltipLabel}\n </Tooltip>\n </CopyActions>\n )}\n </TechnicalStickerShell>\n );\n};\n\nexport default TechnicalSticker;\n"],"mappings":";;;;;;;;;;;;;AA2BA,MAAM,yBAAyB;AAC/B,MAAM,gCAAgC;AACtC,MAAM,6BAA6B;AACnC,MAAM,2BAA2B;AACjC,MAAM,sBAAsB,GAAG,WAAW,SAAS,WAAW,GAAG,WAAW,eAAe,SAAS,GAAG,WAAW,SAAS;AAE3H,MAAM,oBAAoB,QAAwB,YAChD,YAAY,UAAU,OAAO,yBAAyB,OAAO;AAE/D,MAAM,YAAY,OAA2B,YAAqC;CAChF,MAAM,SAAS,eAAe,MAAM;AACpC,KAAI,OACF,QAAO,iBAAiB,QAAQ,QAAQ;AAE1C,QAAO,YAAY,UAAU,MAAM,uBAAuB,MAAM;;AAGlE,MAAM,aAAa,OAA2B,YAC5C,YAAY,UACR,cAAc,OAAO,oBAAoB,MAAM,6BAA6B,GAC5E,cAAc,OAAO,uBAAuB,MAAM,yBAAyB;AAEjF,MAAM,8BAA8B,SAAiB;AACnD,KAAI;EACF,MAAM,MAAM,IAAI,IAAI,MAAM,yBAAyB;AACnD,SAAO,IAAI,aAAa,WAAW,IAAI,aAAa;SAC9C;AACN,SAAO;;;AAIX,MAAM,wBAAwB,OAAO,GAInC;;;;;mBAKiB,aAAa,GAAG;;YAEvB,EAAE,aAAc,OAAO,WAAW,WAAW,GAAG,OAAO,MAAO,UAAU,OAAS;;;;YAIjF,EAAE,OAAO,eACjB,WACI,cAAc,OAAO,cAAc,MAAM,MAAM,KAAK,SAAS,GAC7D,cAAc,OAAO,aAAa,MAAM,MAAM,KAAK,QAAQ,CAAC;iBACnD,EAAE,OAAO,SAAS,eAAe;CAC9C,MAAM,SAAS,eAAe,MAAM;AACpC,QAAO,UAAU,WACb,UAAU,iBAAiB,Q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K;KACL,MAAK;KACL,cAAW;KACD;KACV,aAAa;KACb,SAAS;KACT,aAAa;KACb,QAAQ;KACR,SAAS;eAET,oBAAC,UAAD,EAAY,CAAA;KACD,CAAA;IAEf,aAAa;IACb,MAAK;cAEJ,uBAAuB,wBAAwB;IACxC,CAAA,CACE;KAEM"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as styled } from "./styledComponentsInterop-NxwFjeA4.mjs";
|
|
2
2
|
import "./variables/transitions.mjs";
|
|
3
3
|
import inputMixin from "./mixins/input.mjs";
|
|
4
|
-
import { n as useFormField } from "./useFormField-
|
|
4
|
+
import { n as useFormField } from "./useFormField-DhYd6bNn.mjs";
|
|
5
5
|
import { forwardRef } from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
//#region components/TextArea/TextArea.tsx
|
|
@@ -30,4 +30,4 @@ const TextAreaWithStyle = forwardRef(function TextAreaWithStyle({ size, ...props
|
|
|
30
30
|
//#endregion
|
|
31
31
|
export { TextAreaWithStyle as t };
|
|
32
32
|
|
|
33
|
-
//# sourceMappingURL=TextArea-
|
|
33
|
+
//# sourceMappingURL=TextArea-oAK1DKId.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea-
|
|
1
|
+
{"version":3,"file":"TextArea-oAK1DKId.mjs","names":[],"sources":["../components/TextArea/TextArea.tsx"],"sourcesContent":["import { type ComponentPropsWithoutRef, forwardRef } from 'react';\nimport styled from 'styled-components';\n\nimport useFormField from 'design-system/components/FormControl/useFormField';\nimport inputMixin, { type InputMixinProps } from 'design-system/mixins/input';\nimport type { InputProps } from 'design-system/types/InputProps';\nimport { TransitionDuration } from 'design-system/variables/transitions';\n\nexport interface TextAreaProps\n extends ComponentPropsWithoutRef<'textarea'>, Omit<InputProps, 'inputSize'> {}\n\nconst TextArea = styled('textarea')<InputMixinProps>`\n ${inputMixin};\n /* Don't cut off overflow text */\n padding-bottom: 0;\n font-family: ${({ theme }) => theme.text.fontFamily.base};\n height: ${({ theme }) => theme.element.height.xl};\n white-space: pre-wrap;\n transition:\n all ${TransitionDuration.Fast},\n height 0s,\n width 0s;\n`;\n\nconst TextAreaWithStyle = forwardRef<HTMLTextAreaElement, TextAreaProps>(function TextAreaWithStyle(\n { size, ...props },\n ref,\n) {\n const { inputId } = useFormField(props);\n\n return (\n <TextArea\n id={inputId}\n aria-invalid={props.hasError === true}\n ref={ref}\n {...props}\n $size={size}\n />\n );\n});\n\nexport { TextAreaWithStyle as TextArea };\nexport default TextAreaWithStyle;\n"],"mappings":";;;;;;;AAWA,MAAM,WAAW,OAAO,WAAW;IAC/B,WAAW;;;kBAGG,EAAE,YAAY,MAAM,KAAK,WAAW,KAAK;aAC9C,EAAE,YAAY,MAAM,QAAQ,OAAO,GAAG;;;kBAGjB;;;;AAKlC,MAAM,oBAAoB,WAA+C,SAAS,kBAChF,EAAE,MAAM,GAAG,SACX,KACA;CACA,MAAM,EAAE,YAAY,aAAa,MAAM;AAEvC,QACE,oBAAC,UAAD;EACE,IAAI;EACJ,gBAAc,MAAM,aAAa;EAC5B;EACL,GAAI;EACJ,OAAO;EACP,CAAA;EAEJ"}
|
|
@@ -5,7 +5,7 @@ import { t as useToggle } from "./useToggle-0zLL1E7s.mjs";
|
|
|
5
5
|
import "./variables/transitions.mjs";
|
|
6
6
|
import { isDisabled, isHovered, isNotDisabled } from "./lib/pseudoClass.mjs";
|
|
7
7
|
import { focusOutlineControlled } from "./mixins/focus.mjs";
|
|
8
|
-
import { n as useFormField } from "./useFormField-
|
|
8
|
+
import { n as useFormField } from "./useFormField-DhYd6bNn.mjs";
|
|
9
9
|
import { Color, Spacing } from "@persona/design-tokens";
|
|
10
10
|
import { forwardRef, useCallback, useRef } from "react";
|
|
11
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -173,4 +173,4 @@ const Toggle = forwardRef(function Toggle({ className, disabled, titleOff = "Off
|
|
|
173
173
|
//#endregion
|
|
174
174
|
export { Toggle as t };
|
|
175
175
|
|
|
176
|
-
//# sourceMappingURL=Toggle-
|
|
176
|
+
//# sourceMappingURL=Toggle-DZzirZ8p.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle-CqgFNIYS.mjs","names":[],"sources":["../components/Toggle/Toggle.tsx"],"sourcesContent":["import { forwardRef, type ReactNode, useCallback, useRef } from 'react';\nimport { useId } from 'react-aria';\nimport styled, { css } from 'styled-components';\n\nimport { Color, Spacing } from '@persona/design-tokens';\nimport useFormField from 'design-system/components/FormControl/useFormField';\nimport { Label } from 'design-system/components/Text';\nimport { isDisabled, isHovered, isNotDisabled } from 'design-system/lib/pseudoClass';\nimport { semanticColor, semanticTokens } from 'design-system/lib/semanticColor';\nimport useToggle from 'design-system/lib/useToggle';\nimport { focusOutlineControlled } from 'design-system/mixins/focus';\nimport { TransitionDuration } from 'design-system/variables/transitions';\n\ntype ToggleSize = 'md' | 'sm';\n\ninterface SwitchSizes {\n width: number;\n height: number;\n}\n\nconst SWITCH_SIZES: Record<ToggleSize, SwitchSizes> = {\n md: { width: 32, height: 18 },\n sm: { width: 28, height: parseInt(Spacing[4], 10) }, // 16px height from tokens\n};\n\ninterface SliderSizes {\n diameter: number;\n offset: number;\n}\n\nconst SLIDER_SIZES: Record<ToggleSize, SliderSizes> = {\n md: { diameter: 14, offset: 2 },\n sm: { diameter: parseInt(Spacing[3], 10), offset: 2 }, // 12px diameter from tokens\n};\n\nconst Container = styled.div`\n display: inline-flex;\n align-items: center;\n position: relative;\n`;\n\ntype SwitchProps = Pick<ToggleProps, 'disabled'> & {\n checked: boolean;\n focused: boolean;\n size: ToggleSize;\n};\nconst Switch = styled.div<SwitchProps>`\n transition: box-shadow ${TransitionDuration.Fast};\n position: relative;\n display: inline-flex;\n height: ${({ size }) => SWITCH_SIZES[size].height}px;\n width: ${({ size }) => SWITCH_SIZES[size].width}px;\n border-radius: 1000px;\n cursor: pointer;\n &${isDisabled} {\n cursor: not-allowed;\n }\n\n ${focusOutlineControlled}\n\n /* Background */\n &:before {\n position: absolute;\n content: '';\n height: ${({ size }) => SWITCH_SIZES[size].height}px;\n width: ${({ size }) => SWITCH_SIZES[size].width}px;\n top: 0;\n right: 0;\n bottom: 0;\n background-color: ${({ theme, checked, disabled }) => {\n const tokens = semanticTokens(theme);\n if (tokens) {\n if (disabled) {\n return checked ? tokens.InputSurfaceAccentDisabled : tokens.InputSurfaceDisabled;\n }\n return checked ? tokens.InputSurfaceAccent : tokens.InputBorderStrong;\n }\n if (disabled) {\n return checked ? Color.BackgroundInputActiveDisabled : Color.BackgroundInputDisabled;\n }\n return checked ? Color.BackgroundInputActive : Color.BackgroundInputToggle;\n }};\n\n transition: ${TransitionDuration.Medium};\n border-radius: 1000px;\n }\n\n &${isHovered}${isNotDisabled}:before {\n background-color: ${({ theme, checked }) =>\n checked\n ? semanticColor(theme, 'InputSurfaceAccentHover', Color.BackgroundInputActiveHover)\n : semanticColor(theme, 'InputBorderHoverStrong', Color.BackgroundInputToggleHover)};\n }\n\n /* Slider thumb */\n &:after {\n position: absolute;\n content: '';\n height: ${({ size }) => SLIDER_SIZES[size].diameter}px;\n width: ${({ size }) => SLIDER_SIZES[size].diameter}px;\n bottom: ${({ size }) => SLIDER_SIZES[size].offset}px;\n background-color: ${({ theme }) => semanticColor(theme, 'InputSurfaceInverseStatic', Color.BackgroundInputDefault)};\n transition: ${TransitionDuration.Medium};\n border-radius: 1000px;\n\n right: ${({ size }) => SLIDER_SIZES[size].offset}px;\n\n ${({ checked, size }) =>\n !checked &&\n css`\n transform: translateX(-${getSlideDistance(size)}px);\n `}\n }\n`;\n\nconst ToggleLabel = styled(Label)<Pick<ToggleProps, 'disabled' | 'size'>>`\n cursor: ${({ disabled }) => (disabled ? 'initial' : 'pointer')};\n color: ${({ theme }) => semanticColor(theme, 'FgSecondary', Color.TextSecondary)};\n\n padding: 0 ${Spacing[2]};\n white-space: nowrap;\n line-height: ${({ size = 'md' }) => `${SWITCH_SIZES[size].height}px`};\n\n ${({ theme, disabled }) =>\n disabled &&\n css`\n color: ${semanticColor(theme, 'FgDisabled', theme.color.text.disabled)};\n `}\n`;\n\nfunction getSlideDistance(size: ToggleSize) {\n const switchSize = SWITCH_SIZES[size];\n const sliderSize = SLIDER_SIZES[size];\n return switchSize.width - sliderSize.diameter - sliderSize.offset * 2;\n}\n\nconst HiddenInput = styled.input`\n height: 0;\n width: 0;\n margin: -1px;\n border: 0;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n position: absolute;\n`;\n\nexport interface ToggleProps {\n className?: string;\n /** Disables interaction and renders the toggle in a muted style. */\n disabled?: boolean;\n /**\n * Tooltip / title shown on the root element when the toggle is off.\n * @defaultValue 'Off'\n */\n titleOff?: string;\n /**\n * Tooltip / title shown on the root element when the toggle is on.\n * @defaultValue 'On'\n */\n titleOn?: string;\n /**\n * Called with the new boolean value when the user clicks the toggle.\n * The component is fully controlled — you must update `value` in response.\n */\n onChange?: (value: boolean) => void;\n /**\n * Current on/off state. Falsy values (`false`, `null`, `undefined`, `''`)\n * are treated as off; `true` is treated as on.\n */\n value: boolean | null | undefined | '';\n /** `id` forwarded to the visible switch element. */\n id?: string;\n /** Label node rendered to the left of the switch when the toggle is on. */\n labelOn?: ReactNode;\n /**\n * Label node rendered to the left of the switch when the toggle is off.\n * Falls back to `labelOn` when not provided.\n */\n labelOff?: ReactNode;\n 'data-test'?: string;\n /**\n * Accessible label for the hidden `<input role=\"switch\">`.\n * Required when no visible label is provided via `labelOn` / `labelOff`.\n */\n 'aria-label'?: string;\n /**\n * Size of the toggle switch.\n * @defaultValue 'md'\n */\n size?: ToggleSize;\n}\n\nexport const Toggle = forwardRef<HTMLDivElement, ToggleProps>(function Toggle(\n {\n className,\n disabled,\n titleOff = 'Off',\n titleOn = 'On',\n onChange = () => undefined,\n value,\n id,\n labelOn,\n labelOff,\n 'data-test': dataTest,\n 'aria-label': ariaLabel,\n size = 'md',\n },\n ref,\n) {\n const field = useFormField({ disabled });\n const generatedId = useId();\n const label = value ? labelOn : labelOff || labelOn;\n\n const [focused, { enable: setFocus, disable: clearFocus }] = useToggle();\n\n const handleChange = useCallback(() => {\n onChange(!value);\n inputRef.current?.focus();\n }, [onChange, value]);\n\n const inputRef = useRef<HTMLInputElement>();\n\n return (\n <Container\n className={className}\n data-test={dataTest}\n title={value ? titleOn : titleOff}\n ref={ref}\n >\n {label != null && (\n <ToggleLabel htmlFor={generatedId} disabled={field.disabled} size={size}>\n {label}\n </ToggleLabel>\n )}\n <Switch\n id={id}\n checked={!!value}\n disabled={field.disabled}\n focused={focused}\n onClick={field.disabled ? undefined : handleChange}\n size={size}\n />\n <HiddenInput\n id={generatedId}\n /* @ts-expect-error [strict-migration] The following line is not strict; please fix! */\n ref={inputRef}\n data-test-toggle-status={value ? 'on' : 'off'}\n disabled={field.disabled}\n type='checkbox'\n checked={!!value}\n readOnly={true}\n onChange={disabled ? undefined : handleChange}\n onFocus={setFocus}\n onBlur={clearFocus}\n aria-checked={!!value}\n role='switch'\n aria-readonly={field.disabled}\n {...(label\n ? { 'aria-labelledby': generatedId }\n : { 'aria-label': ariaLabel ?? (value ? 'Toggle on' : 'Toggle off') })}\n />\n </Container>\n );\n});\n\nexport default Toggle;\n"],"mappings":";;;;;;;;;;;;;AAoBA,MAAM,eAAgD;CACpD,IAAI;EAAE,OAAO;EAAI,QAAQ;EAAI;CAC7B,IAAI;EAAE,OAAO;EAAI,QAAQ,SAAS,QAAQ,IAAI,GAAG;EAAE;CACpD;AAOD,MAAM,eAAgD;CACpD,IAAI;EAAE,UAAU;EAAI,QAAQ;EAAG;CAC/B,IAAI;EAAE,UAAU,SAAS,QAAQ,IAAI,GAAG;EAAE,QAAQ;EAAG;CACtD;AAED,MAAM,YAAY,OAAO,GAAG;;;;;AAW5B,MAAM,SAAS,OAAO,GAAgB;mCACa;;;aAGtC,EAAE,WAAW,aAAa,MAAM,OAAO;YACxC,EAAE,WAAW,aAAa,MAAM,MAAM;;;KAG7C,WAAW;;;;I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AAS;;AAGtE,MAAM,cAAc,OAAO,KAAK;;;;;;;;;AAwDhC,MAAa,SAAS,WAAwC,SAAS,OACrE,EACE,WACA,UACA,WAAW,OACX,UAAU,MACV,iBAAiB,KAAA,GACjB,OACA,IACA,SACA,UACA,aAAa,UACb,cAAc,WACd,OAAO,QAET,KACA;CACA,MAAM,QAAQ,aAAa,EAAE,UAAU,CAAC;CACxC,MAAM,cAAc,OAAO;CAC3B,MAAM,QAAQ,QAAQ,UAAU,YAAY;CAE5C,MAAM,CAAC,SAAS,EAAE,QAAQ,UAAU,SAAS,gBAAgB,WAAW;CAExE,MAAM,eAAe,kBAAkB;AACrC,WAAS,CAAC,MAAM;AAChB,WAAS,SAAS,OAAO;IACxB,CAAC,UAAU,MAAM,CAAC;CAErB,MAAM,WAAW,QAA0B;AAE3C,QACE,qBAAC,WAAD;EACa;EACX,aAAW;EACX,OAAO,QAAQ,UAAU;EACpB;YAJP;GAMG,SAAS,QACR,oBAAC,aAAD;IAAa,SAAS;IAAa,UAAU,MAAM;IAAgB;cAChE;IACW,CAAA;GAEhB,oBAAC,QAAD;IACM;IACJ,SAAS,CAAC,CAAC;IACX,UAAU,MAAM;IACP;IACT,SAAS,MAAM,WAAW,KAAA,IAAY;IAChC;IACN,CAAA;GACF,oBAAC,aAAD;IACE,IAAI;IAEJ,KAAK;IACL,2BAAyB,QAAQ,OAAO;IACxC,UAAU,MAAM;IAChB,MAAK;IACL,SAAS,CAAC,CAAC;IACX,UAAU;IACV,UAAU,WAAW,KAAA,IAAY;IACjC,SAAS;IACT,QAAQ;IACR,gBAAc,CAAC,CAAC;IAChB,MAAK;IACL,iBAAe,MAAM;IACrB,GAAK,QACD,EAAE,mBAAmB,aAAa,GAClC,EAAE,cAAc,cAAc,QAAQ,cAAc,eAAe;IACvE,CAAA;GACQ;;EAEd"}
|
|
1
|
+
{"version":3,"file":"Toggle-DZzirZ8p.mjs","names":[],"sources":["../components/Toggle/Toggle.tsx"],"sourcesContent":["import { forwardRef, type ReactNode, useCallback, useRef } from 'react';\nimport { useId } from 'react-aria';\nimport styled, { css } from 'styled-components';\n\nimport { Color, Spacing } from '@persona/design-tokens';\nimport useFormField from 'design-system/components/FormControl/useFormField';\nimport { Label } from 'design-system/components/Text';\nimport { isDisabled, isHovered, isNotDisabled } from 'design-system/lib/pseudoClass';\nimport { semanticColor, semanticTokens } from 'design-system/lib/semanticColor';\nimport useToggle from 'design-system/lib/useToggle';\nimport { focusOutlineControlled } from 'design-system/mixins/focus';\nimport { TransitionDuration } from 'design-system/variables/transitions';\n\ntype ToggleSize = 'md' | 'sm';\n\ninterface SwitchSizes {\n width: number;\n height: number;\n}\n\nconst SWITCH_SIZES: Record<ToggleSize, SwitchSizes> = {\n md: { width: 32, height: 18 },\n sm: { width: 28, height: parseInt(Spacing[4], 10) }, // 16px height from tokens\n};\n\ninterface SliderSizes {\n diameter: number;\n offset: number;\n}\n\nconst SLIDER_SIZES: Record<ToggleSize, SliderSizes> = {\n md: { diameter: 14, offset: 2 },\n sm: { diameter: parseInt(Spacing[3], 10), offset: 2 }, // 12px diameter from tokens\n};\n\nconst Container = styled.div`\n display: inline-flex;\n align-items: center;\n position: relative;\n`;\n\ntype SwitchProps = Pick<ToggleProps, 'disabled'> & {\n checked: boolean;\n focused: boolean;\n size: ToggleSize;\n};\nconst Switch = styled.div<SwitchProps>`\n transition: box-shadow ${TransitionDuration.Fast};\n position: relative;\n display: inline-flex;\n height: ${({ size }) => SWITCH_SIZES[size].height}px;\n width: ${({ size }) => SWITCH_SIZES[size].width}px;\n border-radius: 1000px;\n cursor: pointer;\n &${isDisabled} {\n cursor: not-allowed;\n }\n\n ${focusOutlineControlled}\n\n /* Background */\n &:before {\n position: absolute;\n content: '';\n height: ${({ size }) => SWITCH_SIZES[size].height}px;\n width: ${({ size }) => SWITCH_SIZES[size].width}px;\n top: 0;\n right: 0;\n bottom: 0;\n background-color: ${({ theme, checked, disabled }) => {\n const tokens = semanticTokens(theme);\n if (tokens) {\n if (disabled) {\n return checked ? tokens.InputSurfaceAccentDisabled : tokens.InputSurfaceDisabled;\n }\n return checked ? tokens.InputSurfaceAccent : tokens.InputBorderStrong;\n }\n if (disabled) {\n return checked ? Color.BackgroundInputActiveDisabled : Color.BackgroundInputDisabled;\n }\n return checked ? Color.BackgroundInputActive : Color.BackgroundInputToggle;\n }};\n\n transition: ${TransitionDuration.Medium};\n border-radius: 1000px;\n }\n\n &${isHovered}${isNotDisabled}:before {\n background-color: ${({ theme, checked }) =>\n checked\n ? semanticColor(theme, 'InputSurfaceAccentHover', Color.BackgroundInputActiveHover)\n : semanticColor(theme, 'InputBorderHoverStrong', Color.BackgroundInputToggleHover)};\n }\n\n /* Slider thumb */\n &:after {\n position: absolute;\n content: '';\n height: ${({ size }) => SLIDER_SIZES[size].diameter}px;\n width: ${({ size }) => SLIDER_SIZES[size].diameter}px;\n bottom: ${({ size }) => SLIDER_SIZES[size].offset}px;\n background-color: ${({ theme }) => semanticColor(theme, 'InputSurfaceInverseStatic', Color.BackgroundInputDefault)};\n transition: ${TransitionDuration.Medium};\n border-radius: 1000px;\n\n right: ${({ size }) => SLIDER_SIZES[size].offset}px;\n\n ${({ checked, size }) =>\n !checked &&\n css`\n transform: translateX(-${getSlideDistance(size)}px);\n `}\n }\n`;\n\nconst ToggleLabel = styled(Label)<Pick<ToggleProps, 'disabled' | 'size'>>`\n cursor: ${({ disabled }) => (disabled ? 'initial' : 'pointer')};\n color: ${({ theme }) => semanticColor(theme, 'FgSecondary', Color.TextSecondary)};\n\n padding: 0 ${Spacing[2]};\n white-space: nowrap;\n line-height: ${({ size = 'md' }) => `${SWITCH_SIZES[size].height}px`};\n\n ${({ theme, disabled }) =>\n disabled &&\n css`\n color: ${semanticColor(theme, 'FgDisabled', theme.color.text.disabled)};\n `}\n`;\n\nfunction getSlideDistance(size: ToggleSize) {\n const switchSize = SWITCH_SIZES[size];\n const sliderSize = SLIDER_SIZES[size];\n return switchSize.width - sliderSize.diameter - sliderSize.offset * 2;\n}\n\nconst HiddenInput = styled.input`\n height: 0;\n width: 0;\n margin: -1px;\n border: 0;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n position: absolute;\n`;\n\nexport interface ToggleProps {\n className?: string;\n /** Disables interaction and renders the toggle in a muted style. */\n disabled?: boolean;\n /**\n * Tooltip / title shown on the root element when the toggle is off.\n * @defaultValue 'Off'\n */\n titleOff?: string;\n /**\n * Tooltip / title shown on the root element when the toggle is on.\n * @defaultValue 'On'\n */\n titleOn?: string;\n /**\n * Called with the new boolean value when the user clicks the toggle.\n * The component is fully controlled — you must update `value` in response.\n */\n onChange?: (value: boolean) => void;\n /**\n * Current on/off state. Falsy values (`false`, `null`, `undefined`, `''`)\n * are treated as off; `true` is treated as on.\n */\n value: boolean | null | undefined | '';\n /** `id` forwarded to the visible switch element. */\n id?: string;\n /** Label node rendered to the left of the switch when the toggle is on. */\n labelOn?: ReactNode;\n /**\n * Label node rendered to the left of the switch when the toggle is off.\n * Falls back to `labelOn` when not provided.\n */\n labelOff?: ReactNode;\n 'data-test'?: string;\n /**\n * Accessible label for the hidden `<input role=\"switch\">`.\n * Required when no visible label is provided via `labelOn` / `labelOff`.\n */\n 'aria-label'?: string;\n /**\n * Size of the toggle switch.\n * @defaultValue 'md'\n */\n size?: ToggleSize;\n}\n\nexport const Toggle = forwardRef<HTMLDivElement, ToggleProps>(function Toggle(\n {\n className,\n disabled,\n titleOff = 'Off',\n titleOn = 'On',\n onChange = () => undefined,\n value,\n id,\n labelOn,\n labelOff,\n 'data-test': dataTest,\n 'aria-label': ariaLabel,\n size = 'md',\n },\n ref,\n) {\n const field = useFormField({ disabled });\n const generatedId = useId();\n const label = value ? labelOn : labelOff || labelOn;\n\n const [focused, { enable: setFocus, disable: clearFocus }] = useToggle();\n\n const handleChange = useCallback(() => {\n onChange(!value);\n inputRef.current?.focus();\n }, [onChange, value]);\n\n const inputRef = useRef<HTMLInputElement>();\n\n return (\n <Container\n className={className}\n data-test={dataTest}\n title={value ? titleOn : titleOff}\n ref={ref}\n >\n {label != null && (\n <ToggleLabel htmlFor={generatedId} disabled={field.disabled} size={size}>\n {label}\n </ToggleLabel>\n )}\n <Switch\n id={id}\n checked={!!value}\n disabled={field.disabled}\n focused={focused}\n onClick={field.disabled ? undefined : handleChange}\n size={size}\n />\n <HiddenInput\n id={generatedId}\n /* @ts-expect-error [strict-migration] The following line is not strict; please fix! */\n ref={inputRef}\n data-test-toggle-status={value ? 'on' : 'off'}\n disabled={field.disabled}\n type='checkbox'\n checked={!!value}\n readOnly={true}\n onChange={disabled ? undefined : handleChange}\n onFocus={setFocus}\n onBlur={clearFocus}\n aria-checked={!!value}\n role='switch'\n aria-readonly={field.disabled}\n {...(label\n ? { 'aria-labelledby': generatedId }\n : { 'aria-label': ariaLabel ?? (value ? 'Toggle on' : 'Toggle off') })}\n />\n </Container>\n );\n});\n\nexport default Toggle;\n"],"mappings":";;;;;;;;;;;;;AAoBA,MAAM,eAAgD;CACpD,IAAI;EAAE,OAAO;EAAI,QAAQ;EAAI;CAC7B,IAAI;EAAE,OAAO;EAAI,QAAQ,SAAS,QAAQ,IAAI,GAAG;EAAE;CACpD;AAOD,MAAM,eAAgD;CACpD,IAAI;EAAE,UAAU;EAAI,QAAQ;EAAG;CAC/B,IAAI;EAAE,UAAU,SAAS,QAAQ,IAAI,GAAG;EAAE,QAAQ;EAAG;CACtD;AAED,MAAM,YAAY,OAAO,GAAG;;;;;AAW5B,MAAM,SAAS,OAAO,GAAgB;mCACa;;;aAGtC,EAAE,WAAW,aAAa,MAAM,OAAO;YACxC,EAAE,WAAW,aAAa,MAAM,MAAM;;;KAG7C,WAAW;;;;IAIZ,uBAAuB;;;;;;eAMZ,EAAE,WAAW,aAAa,MAAM,OAAO;cACxC,EAAE,WAAW,aAAa,MAAM,MAAM;;;;yBAI3B,EAAE,OAAO,SAAS,eAAe;CACpD,MAAM,SAAS,eAAe,MAAM;AACpC,KAAI,QAAQ;AACV,MAAI,SACF,QAAO,UAAU,OAAO,6BAA6B,O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,EAAE,UAAU,CAAC;CACxC,MAAM,cAAc,OAAO;CAC3B,MAAM,QAAQ,QAAQ,UAAU,YAAY;CAE5C,MAAM,CAAC,SAAS,EAAE,QAAQ,UAAU,SAAS,gBAAgB,WAAW;CAExE,MAAM,eAAe,kBAAkB;AACrC,WAAS,CAAC,MAAM;AAChB,WAAS,SAAS,OAAO;IACxB,CAAC,UAAU,MAAM,CAAC;CAErB,MAAM,WAAW,QAA0B;AAE3C,QACE,qBAAC,WAAD;EACa;EACX,aAAW;EACX,OAAO,QAAQ,UAAU;EACpB;YAJP;GAMG,SAAS,QACR,oBAAC,aAAD;IAAa,SAAS;IAAa,UAAU,MAAM;IAAgB;cAChE;IACW,CAAA;GAEhB,oBAAC,QAAD;IACM;IACJ,SAAS,CAAC,CAAC;IACX,UAAU,MAAM;IACP;IACT,SAAS,MAAM,WAAW,KAAA,IAAY;IAChC;IACN,CAAA;GACF,oBAAC,aAAD;IACE,IAAI;IAEJ,KAAK;IACL,2BAAyB,QAAQ,OAAO;IACxC,UAAU,MAAM;IAChB,MAAK;IACL,SAAS,CAAC,CAAC;IACX,UAAU;IACV,UAAU,WAAW,KAAA,IAAY;IACjC,SAAS;IACT,QAAQ;IACR,gBAAc,CAAC,CAAC;IAChB,MAAK;IACL,iBAAe,MAAM;IACrB,GAAK,QACD,EAAE,mBAAmB,aAAa,GAClC,EAAE,cAAc,cAAc,QAAQ,cAAc,eAAe;IACvE,CAAA;GACQ;;EAEd"}
|
|
@@ -3,7 +3,7 @@ import { useResizablePanel } from "../../lib/useResizablePanel.mjs";
|
|
|
3
3
|
import { Z_INDICES } from "../../lib/zindex.mjs";
|
|
4
4
|
import { t as IconButton } from "../../IconButton-CnJNIJVQ.mjs";
|
|
5
5
|
import { t as Badge } from "../../Badge-BtNIvtDZ.mjs";
|
|
6
|
-
import { i as TabBar, r as Tab } from "../../TabBar-
|
|
6
|
+
import { i as TabBar, r as Tab } from "../../TabBar-Dw3xE_B-.mjs";
|
|
7
7
|
import { Color, Spacing } from "@persona/design-tokens";
|
|
8
8
|
import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Breadcrumbs } from "../../Breadcrumbs-
|
|
1
|
+
import { t as Breadcrumbs } from "../../Breadcrumbs-CR-xdruP.mjs";
|
|
2
2
|
export { Breadcrumbs, Breadcrumbs as default };
|
|
@@ -2,7 +2,7 @@ import { a as styled, r as css } from "../../styledComponentsInterop-NxwFjeA4.mj
|
|
|
2
2
|
import { semanticOnly } from "../../lib/semanticColor.mjs";
|
|
3
3
|
import { withAlpha } from "../../lib/color.mjs";
|
|
4
4
|
import { o as buttonPalette, t as IconButton } from "../../IconButton-CnJNIJVQ.mjs";
|
|
5
|
-
import { n as useFormField } from "../../useFormField-
|
|
5
|
+
import { n as useFormField } from "../../useFormField-DhYd6bNn.mjs";
|
|
6
6
|
import { BorderRadius } from "@persona/design-tokens";
|
|
7
7
|
import { forwardRef } from "react";
|
|
8
8
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as CARD_HEADING_STICKY_OFFSET, t as Card_default } from "../../CardV2-
|
|
1
|
+
import { n as CARD_HEADING_STICKY_OFFSET, t as Card_default } from "../../CardV2-CBjhsfrn.mjs";
|
|
2
2
|
export { CARD_HEADING_STICKY_OFFSET, Card_default as Card, Card_default as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Checkbox } from "../../Checkbox-
|
|
1
|
+
import { t as Checkbox } from "../../Checkbox-BHZ7c7_6.mjs";
|
|
2
2
|
export { Checkbox, Checkbox as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { D as flattenOptions, a as ComboboxOptionGroup, i as ComboboxOption, o as ComboboxOptionsOrGroups, t as CaretButton } from "../../ComboboxBase-
|
|
2
|
-
import { n as ComboboxProps, t as Combobox } from "../../Combobox-
|
|
1
|
+
import { D as flattenOptions, a as ComboboxOptionGroup, i as ComboboxOption, o as ComboboxOptionsOrGroups, t as CaretButton } from "../../ComboboxBase-DBLJYQrh.mjs";
|
|
2
|
+
import { n as ComboboxProps, t as Combobox } from "../../Combobox-DMN3nc7E.mjs";
|
|
3
3
|
export { CaretButton, Combobox, Combobox as default, ComboboxOption, ComboboxOptionGroup, ComboboxOptionsOrGroups, ComboboxProps, flattenOptions };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as CaretButton, r as flattenOptions, t as Combobox } from "../../Combobox-
|
|
1
|
+
import { n as CaretButton, r as flattenOptions, t as Combobox } from "../../Combobox-BCYLeZDP.mjs";
|
|
2
2
|
export { CaretButton, Combobox, Combobox as default, flattenOptions };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as useFormGroup, t as FormGroupContext } from "../../useFormGroup-
|
|
2
|
-
import { t as ConfigFormGroup } from "../../ConfigFormGroup-
|
|
1
|
+
import { n as useFormGroup, t as FormGroupContext } from "../../useFormGroup-DWVW7A9f.mjs";
|
|
2
|
+
import { t as ConfigFormGroup } from "../../ConfigFormGroup-BnRDAs0j.mjs";
|
|
3
3
|
export { ConfigFormGroup, ConfigFormGroup as default, FormGroupContext, useFormGroup };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as TableControlsProvider, C as getOperatorsForType, D as reconcileValueForOperator, E as isValuelessOperator, F as ControlBar, I as DataTableCompactBar, M as TableViewConfiguration, N as TableViewConfigurationDropdown, O as dateRuleIntent, P as TableControls, S as getOperatorsForField, T as isRangeOperator, _ as FILTER_SIZE_TOKENS, a as encodeFilterStateToUrlParam, b as emptyValueForRule, c as FilterBar_default, d as isFilterStateV2, f as pruneToRegistry, g as resolveValueControl, h as PillShell, i as decodeFilterStateFromUrl, j as useTableControls, k as TableControlsContext, l as useFilterStateV2, m as isEmptyState, n as applyFilterStateToSearchParams, o as FieldRegistry, p as EMPTY_FILTER_STATE, r as decodeFilterStateFromString, s as buildFieldRegistry, t as FILTER_STATE_URL_PARAM, u as hasCompleteValue, v as useFilterBarSize, w as isCompleteDateRange, x as getDefaultOperatorForType, y as resolveDateRangeRuleValue } from "../../../TableControls-
|
|
1
|
+
import { A as TableControlsProvider, C as getOperatorsForType, D as reconcileValueForOperator, E as isValuelessOperator, F as ControlBar, I as DataTableCompactBar, M as TableViewConfiguration, N as TableViewConfigurationDropdown, O as dateRuleIntent, P as TableControls, S as getOperatorsForField, T as isRangeOperator, _ as FILTER_SIZE_TOKENS, a as encodeFilterStateToUrlParam, b as emptyValueForRule, c as FilterBar_default, d as isFilterStateV2, f as pruneToRegistry, g as resolveValueControl, h as PillShell, i as decodeFilterStateFromUrl, j as useTableControls, k as TableControlsContext, l as useFilterStateV2, m as isEmptyState, n as applyFilterStateToSearchParams, o as FieldRegistry, p as EMPTY_FILTER_STATE, r as decodeFilterStateFromString, s as buildFieldRegistry, t as FILTER_STATE_URL_PARAM, u as hasCompleteValue, v as useFilterBarSize, w as isCompleteDateRange, x as getDefaultOperatorForType, y as resolveDateRangeRuleValue } from "../../../TableControls-C-yb5EYU.mjs";
|
|
2
2
|
export { ControlBar, DataTableCompactBar, EMPTY_FILTER_STATE, FILTER_SIZE_TOKENS, FILTER_STATE_URL_PARAM, FieldRegistry, FilterBar_default as FilterBar, PillShell, TableControlsContext, TableControlsProvider, TableViewConfiguration, TableViewConfigurationDropdown, applyFilterStateToSearchParams, buildFieldRegistry, dateRuleIntent, decodeFilterStateFromString, decodeFilterStateFromUrl, TableControls as default, emptyValueForRule, encodeFilterStateToUrlParam, getDefaultOperatorForType, getOperatorsForField, getOperatorsForType, hasCompleteValue, isCompleteDateRange, isEmptyState, isFilterStateV2, isRangeOperator, isValuelessOperator, pruneToRegistry, reconcileValueForOperator, resolveDateRangeRuleValue, resolveValueControl, useFilterBarSize, useFilterStateV2, useTableControls };
|
|
@@ -10,13 +10,13 @@ import "../../variables/effect.mjs";
|
|
|
10
10
|
import { t as HStack } from "../../Stack-BqQndGI9.mjs";
|
|
11
11
|
import { n as Button, t as IconButton } from "../../IconButton-CnJNIJVQ.mjs";
|
|
12
12
|
import { n as Sticker } from "../../Sticker-BDyejPZa.mjs";
|
|
13
|
-
import { n as DropdownMenu_default } from "../../DropdownMenu-
|
|
14
|
-
import { t as Checkbox } from "../../Checkbox-
|
|
15
|
-
import { t as Pagination_default } from "../../Pagination-
|
|
16
|
-
import { a as StickyTH, d as TableTR, f as TableTH, i as StickyTD, o as TableActionTD, p as TableRow, s as TableCell, t as TableLayout, u as TableTD } from "../../Table-
|
|
17
|
-
import { t as HoverCopyableField } from "../../HoverCopyableField-
|
|
18
|
-
import { t as Pii_default } from "../../Pii-
|
|
19
|
-
import { N as TableViewConfigurationDropdown, P as TableControls } from "../../TableControls-
|
|
13
|
+
import { n as DropdownMenu_default } from "../../DropdownMenu-C0WK4bM0.mjs";
|
|
14
|
+
import { t as Checkbox } from "../../Checkbox-BHZ7c7_6.mjs";
|
|
15
|
+
import { t as Pagination_default } from "../../Pagination-DgA0U1fa.mjs";
|
|
16
|
+
import { a as StickyTH, d as TableTR, f as TableTH, i as StickyTD, o as TableActionTD, p as TableRow, s as TableCell, t as TableLayout, u as TableTD } from "../../Table-ELLvSvH4.mjs";
|
|
17
|
+
import { t as HoverCopyableField } from "../../HoverCopyableField-CeJ0UP87.mjs";
|
|
18
|
+
import { t as Pii_default } from "../../Pii-bxG0qu3t.mjs";
|
|
19
|
+
import { N as TableViewConfigurationDropdown, P as TableControls } from "../../TableControls-C-yb5EYU.mjs";
|
|
20
20
|
import "./types.mjs";
|
|
21
21
|
import { BorderRadius, Color, Spacing } from "@persona/design-tokens";
|
|
22
22
|
import { createElement, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as MenuItemProps } from "../../Menu-
|
|
1
|
+
import { l as MenuItemProps } from "../../Menu-DdHN-drQ.mjs";
|
|
2
2
|
import { o as StickerProps } from "../../Sticker-qvWkqEMw.mjs";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
import { Column, DeepKeys, FilterFnOption, Header, RowData, SortingState, Table } from "@tanstack/react-table";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as Calendar, n as DatePicker, r as DateField, t as DateRangePicker } from "../../DatePicker-
|
|
1
|
+
import { i as Calendar, n as DatePicker, r as DateField, t as DateRangePicker } from "../../DatePicker-BcjrAr7o.mjs";
|
|
2
2
|
export { Calendar, DateField, DatePicker, DatePicker as default, DateRangePicker };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as DropdownButton } from "../../DropdownButton-
|
|
1
|
+
import { t as DropdownButton } from "../../DropdownButton-l-fzkb5_.mjs";
|
|
2
2
|
export { DropdownButton, DropdownButton as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as DropdownMenuProps, r as _default, t as DropdownMenu } from "../../DropdownMenu-
|
|
1
|
+
import { n as DropdownMenuProps, r as _default, t as DropdownMenu } from "../../DropdownMenu-Bg68vvxx.mjs";
|
|
2
2
|
export { DropdownMenu, DropdownMenuProps, _default as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as DropdownMenu_default, t as DropdownMenu } from "../../DropdownMenu-
|
|
1
|
+
import { n as DropdownMenu_default, t as DropdownMenu } from "../../DropdownMenu-C0WK4bM0.mjs";
|
|
2
2
|
export { DropdownMenu, DropdownMenu_default as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as useFormField } from "../../useFormField-
|
|
2
|
-
import { a as FormLabel, i as FormInputContainer, n as ErrorText, o as HelperText, r as FormControl, s as WarningText, t as Container } from "../../FormControl-
|
|
1
|
+
import { n as useFormField } from "../../useFormField-DhYd6bNn.mjs";
|
|
2
|
+
import { a as FormLabel, i as FormInputContainer, n as ErrorText, o as HelperText, r as FormControl, s as WarningText, t as Container } from "../../FormControl-BzMbbgr0.mjs";
|
|
3
3
|
export { Container, ErrorText, FormControl, FormControl as default, FormInputContainer, FormLabel, HelperText, WarningText, useFormField };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as CheckboxField, c as SegmentedControlField, d as TextField, f as ToggleField, i as CheckboxGroupField, l as SelectField, m as FormField, n as TableBoxField, o as ComboboxField, p as splitOutFormFieldProps, r as ListBoxField, s as RadioGroupField, t as TABLE_BOX_FIELD_ADD_BUTTON_ARIA_LABEL, u as TextAreaField } from "../../FormField-
|
|
1
|
+
import { a as CheckboxField, c as SegmentedControlField, d as TextField, f as ToggleField, i as CheckboxGroupField, l as SelectField, m as FormField, n as TableBoxField, o as ComboboxField, p as splitOutFormFieldProps, r as ListBoxField, s as RadioGroupField, t as TABLE_BOX_FIELD_ADD_BUTTON_ARIA_LABEL, u as TextAreaField } from "../../FormField-2sNS5PzN.mjs";
|
|
2
2
|
export { CheckboxField, CheckboxGroupField, ComboboxField, FormField, FormField as default, ListBoxField, RadioGroupField, SegmentedControlField, SelectField, TABLE_BOX_FIELD_ADD_BUTTON_ARIA_LABEL, TableBoxField, TextAreaField, TextField, ToggleField, splitOutFormFieldProps };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as HoverCopyableField } from "../../HoverCopyableField-
|
|
1
|
+
import { t as HoverCopyableField } from "../../HoverCopyableField-CeJ0UP87.mjs";
|
|
2
2
|
export { HoverCopyableField as default };
|
|
@@ -6,9 +6,9 @@ import { a as Tooltip } from "../../Tooltip-BsuYG0fw.mjs";
|
|
|
6
6
|
import { focusOutline } from "../../mixins/focus.mjs";
|
|
7
7
|
import { n as Stack } from "../../Stack-BqQndGI9.mjs";
|
|
8
8
|
import { t as IconButton } from "../../IconButton-CnJNIJVQ.mjs";
|
|
9
|
-
import { n as DropdownMenu_default } from "../../DropdownMenu-
|
|
10
|
-
import { t as LoadingShimmer } from "../../LoadingShimmer-
|
|
11
|
-
import { t as Checkbox } from "../../Checkbox-
|
|
9
|
+
import { n as DropdownMenu_default } from "../../DropdownMenu-C0WK4bM0.mjs";
|
|
10
|
+
import { t as LoadingShimmer } from "../../LoadingShimmer-ZyzJs5Vi.mjs";
|
|
11
|
+
import { t as Checkbox } from "../../Checkbox-BHZ7c7_6.mjs";
|
|
12
12
|
import { Color, Spacing } from "@persona/design-tokens";
|
|
13
13
|
import { useEffect, useState } from "react";
|
|
14
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as useListBoxContext, n as ListBoxItemProps, r as ListBoxProps } from "../../ListBox-
|
|
2
|
-
import { n as LogicRowProps } from "../../LogicRow-
|
|
3
|
-
import { t as ListBox } from "../../index-
|
|
1
|
+
import { i as useListBoxContext, n as ListBoxItemProps, r as ListBoxProps } from "../../ListBox-Awtw7Xy_.mjs";
|
|
2
|
+
import { n as LogicRowProps } from "../../LogicRow-DIn0gLEq.mjs";
|
|
3
|
+
import { t as ListBox } from "../../index-CBWvk6Ch.mjs";
|
|
4
4
|
export { ListBox, ListBox as default, ListBoxItemProps, ListBoxProps, LogicRowProps, useListBoxContext };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as useListBoxContext, t as ListBox } from "../../ListBox-
|
|
1
|
+
import { n as useListBoxContext, t as ListBox } from "../../ListBox-DqII8giL.mjs";
|
|
2
2
|
export { ListBox, ListBox as default, useListBoxContext };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as MaybeLoadingShimmer, n as LoadingShimmerHeading, r as LoadingShimmerParagraph, t as LoadingShimmer } from "../../LoadingShimmer-
|
|
1
|
+
import { i as MaybeLoadingShimmer, n as LoadingShimmerHeading, r as LoadingShimmerParagraph, t as LoadingShimmer } from "../../LoadingShimmer-ZyzJs5Vi.mjs";
|
|
2
2
|
export { LoadingShimmer, LoadingShimmerHeading, LoadingShimmerParagraph, MaybeLoadingShimmer };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as MenuDivider, c as MenuItem, d as MenuList, f as MenuProps, i as Menu, l as MenuItemProps, n as IconContainer, o as MenuHeading, r as ListItem, s as MenuHeadingProps, t as FloatingCard, u as MenuItemType } from "../../Menu-
|
|
1
|
+
import { a as MenuDivider, c as MenuItem, d as MenuList, f as MenuProps, i as Menu, l as MenuItemProps, n as IconContainer, o as MenuHeading, r as ListItem, s as MenuHeadingProps, t as FloatingCard, u as MenuItemType } from "../../Menu-DdHN-drQ.mjs";
|
|
2
2
|
export { FloatingCard, IconContainer, ListItem, Menu, Menu as default, MenuDivider, MenuHeading, MenuHeadingProps, MenuItem, MenuItemProps, MenuItemType, MenuList, MenuProps };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as MenuDivider, c as MenuList, i as Menu, n as IconContainer, o as MenuHeading, r as ListItem, s as MenuItem, t as FloatingCard } from "../../Menu-
|
|
1
|
+
import { a as MenuDivider, c as MenuList, i as Menu, n as IconContainer, o as MenuHeading, r as ListItem, s as MenuItem, t as FloatingCard } from "../../Menu-CeV3lL2g.mjs";
|
|
2
2
|
export { FloatingCard, IconContainer, ListItem, Menu, Menu as default, MenuDivider, MenuHeading, MenuItem, MenuList };
|
|
@@ -3,77 +3,15 @@ import { semanticColor, semanticOnly } from "../../lib/semanticColor.mjs";
|
|
|
3
3
|
import { t as Card_default } from "../../Card-vQIPtdXi.mjs";
|
|
4
4
|
import { n as Heading$1 } from "../../Text-Dn_p7ZvT.mjs";
|
|
5
5
|
import useEmbeddedSurface, { useEmbeddedSurfaceGate, useEmbeddedSurfaceId } from "../../lib/useEmbeddedSurface.mjs";
|
|
6
|
+
import useModalInsetRight from "../../lib/useModalInsetRight.mjs";
|
|
6
7
|
import { n as Stack, t as HStack } from "../../Stack-BqQndGI9.mjs";
|
|
7
8
|
import { n as Button$1 } from "../../IconButton-CnJNIJVQ.mjs";
|
|
8
|
-
import { i as TabBar, r as Tab } from "../../TabBar-
|
|
9
|
+
import { i as TabBar, r as Tab } from "../../TabBar-Dw3xE_B-.mjs";
|
|
9
10
|
import { Color, Spacing } from "@persona/design-tokens";
|
|
10
|
-
import { forwardRef, useContext, useEffect,
|
|
11
|
+
import { forwardRef, useContext, useEffect, useState } from "react";
|
|
11
12
|
import { Button, Dialog, DialogTrigger, Heading, Modal, ModalOverlay, OverlayTriggerStateContext, Pressable } from "react-aria-components";
|
|
12
13
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
14
|
import { XIcon } from "@persona/icons";
|
|
14
|
-
//#region lib/useModalInsetRight.ts
|
|
15
|
-
const CSS_VAR = "--modal-inset-right";
|
|
16
|
-
const getModalInsetRight = () => getComputedStyle(document.documentElement).getPropertyValue(CSS_VAR).trim() || "0px";
|
|
17
|
-
const prefersReducedMotion = () => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
18
|
-
/**
|
|
19
|
-
* Returns the current value of --modal-inset-right from :root, reactively updating
|
|
20
|
-
* as the agents side panel animates open/closed or is resized. Also tracks whether
|
|
21
|
-
* the panel is opening, open, closing, or closed.
|
|
22
|
-
*
|
|
23
|
-
* panelState stays 'opening'/'closing' for the full transition duration so that
|
|
24
|
-
* CSS transitions on consumers have time to animate.
|
|
25
|
-
*/
|
|
26
|
-
const useModalInsetRight = () => {
|
|
27
|
-
const [insetRight, setInsetRight] = useState(getModalInsetRight);
|
|
28
|
-
const [panelState, setPanelState] = useState(() => getModalInsetRight() !== "0px" ? "open" : "closed");
|
|
29
|
-
const prevInsetRight = useRef(getModalInsetRight());
|
|
30
|
-
const transitionTimerRef = useRef(null);
|
|
31
|
-
const rafRef = useRef(null);
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
const observer = new MutationObserver(() => {
|
|
34
|
-
const prev = prevInsetRight.current;
|
|
35
|
-
const next = getModalInsetRight();
|
|
36
|
-
prevInsetRight.current = next;
|
|
37
|
-
if (prev === "0px" && next !== "0px") if (prefersReducedMotion()) {
|
|
38
|
-
setInsetRight(next);
|
|
39
|
-
setPanelState("open");
|
|
40
|
-
} else {
|
|
41
|
-
if (rafRef.current) cancelAnimationFrame(rafRef.current);
|
|
42
|
-
if (transitionTimerRef.current) clearTimeout(transitionTimerRef.current);
|
|
43
|
-
setInsetRight("0px");
|
|
44
|
-
setPanelState("opening");
|
|
45
|
-
rafRef.current = requestAnimationFrame(() => setInsetRight(next));
|
|
46
|
-
transitionTimerRef.current = setTimeout(() => setPanelState("open"), 425);
|
|
47
|
-
}
|
|
48
|
-
else if (prev !== "0px" && next === "0px") if (prefersReducedMotion()) {
|
|
49
|
-
setInsetRight("0px");
|
|
50
|
-
setPanelState("closed");
|
|
51
|
-
} else {
|
|
52
|
-
if (rafRef.current) cancelAnimationFrame(rafRef.current);
|
|
53
|
-
if (transitionTimerRef.current) clearTimeout(transitionTimerRef.current);
|
|
54
|
-
setInsetRight(prev);
|
|
55
|
-
setPanelState("closing");
|
|
56
|
-
rafRef.current = requestAnimationFrame(() => setInsetRight("0px"));
|
|
57
|
-
transitionTimerRef.current = setTimeout(() => setPanelState("closed"), 200);
|
|
58
|
-
}
|
|
59
|
-
else setInsetRight(next);
|
|
60
|
-
});
|
|
61
|
-
observer.observe(document.documentElement, {
|
|
62
|
-
attributes: true,
|
|
63
|
-
attributeFilter: ["style"]
|
|
64
|
-
});
|
|
65
|
-
return () => {
|
|
66
|
-
observer.disconnect();
|
|
67
|
-
if (transitionTimerRef.current) clearTimeout(transitionTimerRef.current);
|
|
68
|
-
if (rafRef.current) cancelAnimationFrame(rafRef.current);
|
|
69
|
-
};
|
|
70
|
-
}, []);
|
|
71
|
-
return {
|
|
72
|
-
insetRight,
|
|
73
|
-
panelState
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
//#endregion
|
|
77
15
|
//#region components/Modal/Modal.tsx
|
|
78
16
|
const StyledModalOverlay = styled(ModalOverlay)`
|
|
79
17
|
@keyframes overlayShow {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["AriaModal","Button","AriaButton","Heading","AriaHeading","Card","Modal"],"sources":["../../../lib/useModalInsetRight.ts","../../../components/Modal/Modal.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\nconst CSS_VAR = '--modal-inset-right';\n\n// Match AgentsPanel sidebar transition durations\nexport const SIDEBAR_OPEN_TRANSITION_MS = 425;\nexport const SIDEBAR_CLOSE_TRANSITION_MS = 200;\n\nconst getModalInsetRight = () =>\n getComputedStyle(document.documentElement).getPropertyValue(CSS_VAR).trim() || '0px';\n\nconst prefersReducedMotion = () =>\n typeof window !== 'undefined' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n\nexport type PanelInsetState = 'closed' | 'opening' | 'open' | 'closing';\n\nexport interface ModalInsetRight {\n /** Animated inset value — starts at 0px on panel open so CSS transition fires */\n insetRight: string;\n panelState: PanelInsetState;\n}\n\n/**\n * Returns the current value of --modal-inset-right from :root, reactively updating\n * as the agents side panel animates open/closed or is resized. Also tracks whether\n * the panel is opening, open, closing, or closed.\n *\n * panelState stays 'opening'/'closing' for the full transition duration so that\n * CSS transitions on consumers have time to animate.\n */\nconst useModalInsetRight = (): ModalInsetRight => {\n const [insetRight, setInsetRight] = useState(getModalInsetRight);\n const [panelState, setPanelState] = useState<PanelInsetState>(() =>\n getModalInsetRight() !== '0px' ? 'open' : 'closed',\n );\n const prevInsetRight = useRef(getModalInsetRight());\n const transitionTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const rafRef = useRef<number | null>(null);\n\n useEffect(() => {\n const observer = new MutationObserver(() => {\n const prev = prevInsetRight.current;\n const next = getModalInsetRight();\n prevInsetRight.current = next;\n\n if (prev === '0px' && next !== '0px') {\n if (prefersReducedMotion()) {\n setInsetRight(next);\n setPanelState('open');\n } else {\n if (rafRef.current) {\n cancelAnimationFrame(rafRef.current);\n }\n if (transitionTimerRef.current) {\n clearTimeout(transitionTimerRef.current);\n }\n setInsetRight('0px');\n setPanelState('opening');\n rafRef.current = requestAnimationFrame(() => setInsetRight(next));\n transitionTimerRef.current = setTimeout(\n () => setPanelState('open'),\n SIDEBAR_OPEN_TRANSITION_MS,\n );\n }\n } else if (prev !== '0px' && next === '0px') {\n if (prefersReducedMotion()) {\n setInsetRight('0px');\n setPanelState('closed');\n } else {\n if (rafRef.current) {\n cancelAnimationFrame(rafRef.current);\n }\n if (transitionTimerRef.current) {\n clearTimeout(transitionTimerRef.current);\n }\n setInsetRight(prev);\n setPanelState('closing');\n rafRef.current = requestAnimationFrame(() => setInsetRight('0px'));\n transitionTimerRef.current = setTimeout(\n () => setPanelState('closed'),\n SIDEBAR_CLOSE_TRANSITION_MS,\n );\n }\n } else {\n setInsetRight(next);\n }\n });\n\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['style'],\n });\n\n return () => {\n observer.disconnect();\n if (transitionTimerRef.current) {\n clearTimeout(transitionTimerRef.current);\n }\n if (rafRef.current) {\n cancelAnimationFrame(rafRef.current);\n }\n };\n }, []);\n\n return { insetRight, panelState };\n};\n\nexport default useModalInsetRight;\n","import {\n forwardRef,\n type ComponentProps,\n type ComponentPropsWithoutRef,\n type ReactNode,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport {\n Button as AriaButton,\n Dialog,\n DialogTrigger,\n Heading as AriaHeading,\n Modal as AriaModal,\n ModalOverlay,\n type ModalOverlayProps,\n OverlayTriggerStateContext,\n Pressable,\n} from 'react-aria-components';\nimport styled from 'styled-components';\n\nimport Button, { type ButtonProps } from '@persona/design-system/components/Button';\nimport Card from '@persona/design-system/components/Card';\nimport Stack, { HStack } from '@persona/design-system/components/Stack';\nimport TabBar, { Tab } from '@persona/design-system/components/TabBar';\nimport { Heading } from '@persona/design-system/components/Text';\nimport { Color, Spacing } from '@persona/design-tokens';\nimport { XIcon } from '@persona/icons';\nimport { semanticColor, semanticOnly } from 'design-system/lib/semanticColor';\nimport useEmbeddedSurface, {\n useEmbeddedSurfaceGate,\n useEmbeddedSurfaceId,\n} from 'design-system/lib/useEmbeddedSurface';\nimport useModalInsetRight, {\n SIDEBAR_CLOSE_TRANSITION_MS,\n SIDEBAR_OPEN_TRANSITION_MS,\n} from 'design-system/lib/useModalInsetRight';\n\nconst StyledModalOverlay = styled(ModalOverlay)<{\n $hostPending: boolean;\n $animationDelayMs: number;\n $insetRight: string;\n $transitionMs: number;\n}>`\n @keyframes overlayShow {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n background-color: rgba(0, 0, 0, 0.5);\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: ${({ $insetRight }) => $insetRight};\n transition: right ${({ $transitionMs }) => $transitionMs}ms ease-out;\n animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);\n animation-delay: ${({ $animationDelayMs }) => $animationDelayMs}ms;\n animation-fill-mode: both;\n ${({ $hostPending }) =>\n $hostPending &&\n `\n animation-play-state: paused;\n `}\n @media (prefers-reduced-motion: reduce) {\n animation-duration: 0ms;\n animation-delay: 0ms;\n animation-play-state: running;\n }\n z-index: 10000;\n display: flex;\n align-items: center;\n justify-content: center;\n`;\n\nconst StyledModal = styled(AriaModal)`\n z-index: 10001;\n outline: none;\n width: fit-content;\n max-width: 100%;\n ${semanticOnly((tokens) => `color: ${tokens.FgPrimary};`)}\n`;\n\n/**\n * React Aria keeps the overlay mounted through the exit animation, so announcing the surface from\n * here — rather than from the persistent gate below — releases the host's backdrop exactly when the\n * modal stops being painted.\n */\nconst EmbeddedSurfaceModal = forwardRef<HTMLDivElement, { children: ReactNode; surfaceId: string }>(\n function EmbeddedSurfaceModal({ children, surfaceId }, ref) {\n useEmbeddedSurface(surfaceId);\n return <StyledModal ref={ref}>{children}</StyledModal>;\n },\n);\n\ntype EmbeddedSurfaceOverlayProps = ModalOverlayProps & {\n $insetRight: string;\n $transitionMs: number;\n surfaceId: string;\n};\n\nconst EmbeddedSurfaceOverlay = ({ surfaceId, ...props }: EmbeddedSurfaceOverlayProps) => {\n const state = useContext(OverlayTriggerStateContext);\n const isOpen = state?.isOpen ?? false;\n const { ready, animationDelayMs } = useEmbeddedSurfaceGate(surfaceId, isOpen);\n\n const { $insetRight, $transitionMs, ...overlayProps } = props;\n return (\n <StyledModalOverlay\n {...overlayProps}\n $insetRight={$insetRight}\n $transitionMs={$transitionMs}\n $animationDelayMs={animationDelayMs}\n $hostPending={isOpen && !ready}\n />\n );\n};\n\nconst ModalCloseButton = styled(Button)`\n display: inline-flex;\n padding: ${Spacing[2]};\n border-radius: ${Spacing[1]};\n width: fit-content;\n min-width: unset;\n`;\n\nconst ModalFooter = styled(HStack).attrs({\n justify: 'flex-end',\n align: 'center',\n spacing: Spacing[2],\n})`\n padding: ${Spacing[3]} ${Spacing[4]};\n border-top: 1px solid ${({ theme }) => semanticColor(theme, 'BorderSubtle', Color.BorderDivider)};\n`;\n\nconst ModalHeaderTitle = styled.div`\n flex: 1;\n`;\n\nexport const ModalTrigger = DialogTrigger;\nexport const ModalContent = StyledModal;\n\nexport const ModalClose = (props: ButtonProps) => {\n return (\n <AriaButton slot='close' style={{ all: 'unset', display: 'contents' }}>\n <ModalCloseButton variant='text' width='icon' size='md' {...props}>\n <XIcon />\n </ModalCloseButton>\n </AriaButton>\n );\n};\n\nexport interface ModalTitleProps {\n children: ReactNode;\n className?: string;\n}\n\n/** Props passed to modal content render functions. */\nexport interface ModalRenderProps {\n /** Element that floating content should use as its portal container. */\n portalContainer: HTMLDivElement | null;\n}\n\ntype ModalRenderable = ReactNode | ((props: ModalRenderProps) => ReactNode);\n\nconst ModalTitle = ({ children, ...props }: ModalTitleProps) => {\n return (\n <Heading size='sm' color='primary' as={AriaHeading} slot='title' {...props}>\n {children}\n </Heading>\n );\n};\n\nconst ModalHeader = styled(HStack)<{ $hasTabs: boolean }>`\n border-bottom: ${({ $hasTabs, theme }) =>\n $hasTabs ? 'none' : `1px solid ${semanticColor(theme, 'BorderSubtle', Color.BorderDivider)}`};\n padding: ${({ $hasTabs }) =>\n $hasTabs\n ? `${Spacing[3]} ${Spacing[2]} ${Spacing[1]} ${Spacing[4]}`\n : `${Spacing[3]} ${Spacing[2]} ${Spacing[3]} ${Spacing[4]}`};\n`;\n\nconst ModalTabBar = styled(TabBar)`\n padding-left: ${Spacing[4]};\n`;\n\nconst StyledDialog = styled(Dialog)`\n outline: none;\n`;\n\nconst StyledCard = styled(Card)<{ $size?: 'auto' | 'md' | 'lg' | 'xl' | 'full' }>`\n position: relative;\n width: ${({ $size }) => {\n switch ($size) {\n case 'auto':\n return 'auto';\n case 'full':\n return 'calc(100vw - 160px)';\n default:\n return '90vw';\n }\n }};\n max-width: ${({ theme, $size }) => {\n switch ($size) {\n case 'auto':\n return 'auto';\n case 'full':\n return 'calc(100vw - 160px)';\n default:\n return theme.modal.width[$size];\n }\n }};\n /* TODO: Use breakpoints to make this responsive */\n max-height: ${({ $size }) => ($size === 'full' ? 'calc(100vh - 160px)' : '85vh')};\n display: flex;\n flex-direction: column;\n overflow: hidden;\n ${({ $size }) =>\n $size === 'full' &&\n `\n height: calc(100vh - 160px);\n `}\n margin-bottom: 0;\n`;\n\ninterface ModalCardProps extends ComponentPropsWithoutRef<typeof Dialog> {\n /**\n * Display X button to close popover\n */\n showCloseButton?: boolean;\n\n /**\n * Max width of the modal\n */\n size?: 'auto' | 'md' | 'lg' | 'xl' | 'full';\n\n /**\n * Footer content\n */\n footer?: ReactNode;\n\n /**\n * Renders tabs within the modal.\n * Adds a tab bar and will render the contents of the selected tab in a tabpanel.\n * Overrides `children`.\n * Tab contents can be render functions that receive the modal portal container.\n */\n tabs?: TabView[];\n\n /**\n * Title of the modal\n */\n title?: ReactNode;\n\n /**\n * Children content\n */\n children?: ReactNode;\n\n /**\n * When true, removes horizontal and vertical padding from the body. Defaults to false.\n */\n noBodyPadding?: boolean;\n\n /**\n * Additional props for the Dialog element\n */\n className?: string;\n}\n\ninterface ModalCardInternalProps extends ModalCardProps {\n portalContainer: HTMLDivElement | null;\n}\n\nconst StyledModalCardBody = styled(Card.Body)<{\n $noPadding?: boolean;\n $hidden?: boolean;\n}>`\n overflow-y: auto;\n flex: 1;\n min-height: 0;\n ${({ $noPadding }) =>\n $noPadding\n ? 'padding: 0;'\n : `\n padding-left: ${Spacing[4]};\n padding-right: ${Spacing[4]};\n `}\n ${({ $hidden }) => $hidden && 'display: none;'}\n`;\n\n/**\n * Card to be used in Modal contexts. Inherits props from react-aria-components Dialog.\n */\nconst ModalCard = forwardRef<HTMLDivElement, ModalCardInternalProps>(function ModalCard(\n {\n title,\n children,\n showCloseButton = true,\n size,\n footer,\n tabs,\n noBodyPadding = false,\n portalContainer,\n ...props\n },\n ref,\n) {\n const [selectedTabIdx, setSelectedTabIdx] = useState(0);\n const tabCount = tabs?.length ?? 0;\n\n useEffect(() => {\n setSelectedTabIdx(0);\n }, [tabCount]);\n\n const titleAndClose = (\n <ModalHeader justify='flex-start' align='center' spacing={Spacing[2]} $hasTabs={Boolean(tabs)}>\n <ModalHeaderTitle>{title ? <ModalTitle>{title}</ModalTitle> : null}</ModalHeaderTitle>\n {showCloseButton && <ModalClose aria-label='Close' />}\n </ModalHeader>\n );\n\n const modalHeader = tabs ? (\n <Stack>\n {titleAndClose}\n <ModalTabBar>\n {tabs.map((tab, idx) => (\n <Tab\n key={tab.name}\n selected={selectedTabIdx === idx}\n id={`pds-modal_tab-${idx}`}\n onClick={() => setSelectedTabIdx(idx)}\n aria-controls={`pds-modal_tab-panel-${idx}`}\n >\n {tab.name}\n </Tab>\n ))}\n </ModalTabBar>\n </Stack>\n ) : (\n titleAndClose\n );\n\n return (\n <StyledDialog {...props} ref={ref}>\n <StyledCard elevated $size={size}>\n {(showCloseButton || title) && modalHeader}\n {tabs ? (\n tabs.map((tab, idx) => (\n <StyledModalCardBody\n key={tab.name}\n $noPadding={noBodyPadding}\n $hidden={selectedTabIdx !== idx}\n role={tabs ? 'tabpanel' : undefined}\n id={`pds-modal_tab-panel-${tab.name}`}\n aria-labelledby={`pds-modal_tab-${tab.name}`}\n >\n {typeof tab.contents === 'function'\n ? tab.contents({ portalContainer })\n : tab.contents}\n </StyledModalCardBody>\n ))\n ) : (\n <StyledModalCardBody\n $noPadding={noBodyPadding}\n role={tabs ? 'tabpanel' : undefined}\n id={`pds-modal_tab-panel-${selectedTabIdx}`}\n aria-labelledby={`pds-modal_tab-${selectedTabIdx}`}\n >\n {children}\n </StyledModalCardBody>\n )}\n\n {footer && <ModalFooter>{footer}</ModalFooter>}\n </StyledCard>\n </StyledDialog>\n );\n});\n\ninterface TabView {\n name: string;\n contents: ModalRenderable;\n badge?: React.ReactElement;\n disabled?: boolean;\n 'data-tour-target'?: string;\n}\n\nexport interface ModalProps {\n /**\n * Title of the Card\n */\n title?: string;\n\n /**\n * Component to use as trigger. React Aria trigger props will be merged with this element.\n */\n trigger?: ComponentProps<typeof Pressable>['children'];\n\n /**\n * Props to apply to Modal.Card within\n */\n contentProps?: ModalCardProps;\n\n /**\n * Max width of the modal\n */\n size?: 'auto' | 'md' | 'lg' | 'xl' | 'full';\n\n /**\n * Footer section intended for actions.\n * You can pass in Buttons directly and they will render in a HStack.\n */\n footer?: ReactNode;\n\n /**\n * Renders tabs within the modal.\n * Adds a tab bar and will render the contents of the selected tab in a tabpanel.\n * Overrides `children`.\n */\n tabs?: TabView[];\n\n /**\n * Children content\n */\n children?: ModalRenderable;\n\n /**\n * When true, removes horizontal and vertical padding from the body. Defaults to false.\n * Can also be set via contentProps.noBodyPadding.\n */\n noBodyPadding?: boolean;\n\n /**\n * Controls whether the modal is open (controlled)\n */\n open?: boolean;\n\n /**\n * Default open state (uncontrolled)\n */\n defaultOpen?: boolean;\n\n /**\n * Handler called when open state changes\n */\n onOpenChange?: (isOpen: boolean) => void;\n\n /**\n * Whether the modal can be dismissed by clicking outside or pressing escape\n */\n isDismissable?: boolean;\n\n /**\n * Whether pressing the escape key closes the modal\n */\n isKeyboardDismissDisabled?: boolean;\n}\n\nconst Modal = ({\n children,\n trigger,\n contentProps,\n noBodyPadding = false,\n size = 'md',\n title,\n footer,\n tabs,\n defaultOpen,\n onOpenChange,\n isDismissable = false,\n isKeyboardDismissDisabled = false,\n open,\n}: ModalProps) => {\n const [portalContainer, setPortalContainer] = useState<HTMLDivElement | null>(null);\n const surfaceId = useEmbeddedSurfaceId();\n const { insetRight: modalInsetRight, panelState } = useModalInsetRight();\n const transitionMs =\n panelState === 'opening'\n ? SIDEBAR_OPEN_TRANSITION_MS\n : panelState === 'closing'\n ? SIDEBAR_CLOSE_TRANSITION_MS\n : 0;\n\n const content = (\n <ModalCard\n size={size}\n title={title}\n footer={footer}\n tabs={tabs}\n noBodyPadding={noBodyPadding}\n {...contentProps}\n portalContainer={portalContainer}\n >\n {typeof children === 'function' ? children({ portalContainer }) : children}\n </ModalCard>\n );\n\n // Wrap trigger element to ensure it works with react-aria-components\n const wrappedTrigger = trigger ? <Pressable>{trigger}</Pressable> : null;\n\n return (\n <DialogTrigger isOpen={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>\n {wrappedTrigger}\n <EmbeddedSurfaceOverlay\n surfaceId={surfaceId}\n $insetRight={modalInsetRight}\n $transitionMs={transitionMs}\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n shouldCloseOnInteractOutside={(element) => !element.closest('[data-react-aria-top-layer]')}\n >\n <EmbeddedSurfaceModal ref={setPortalContainer} surfaceId={surfaceId}>\n {content}\n </EmbeddedSurfaceModal>\n </EmbeddedSurfaceOverlay>\n </DialogTrigger>\n );\n};\n\nexport default Object.assign(Modal, {\n Title: ModalTitle,\n});\n"],"mappings":";;;;;;;;;;;;;;AAEA,MAAM,UAAU;AAMhB,MAAM,2BACJ,iBAAiB,SAAS,gBAAgB,CAAC,iBAAiB,QAAQ,CAAC,MAAM,IAAI;AAEjF,MAAM,6BACJ,OAAO,WAAW,eAAe,OAAO,WAAW,mCAAmC,CAAC;;;;;;;;;AAkBzF,MAAM,2BAA4C;CAChD,MAAM,CAAC,YAAY,iBAAiB,SAAS,mBAAmB;CAChE,MAAM,CAAC,YAAY,iBAAiB,eAClC,oBAAoB,KAAK,QAAQ,SAAS,SAC3C;CACD,MAAM,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AO,MACP,OACA,QACA,MACA,aACA,cACA,gBAAgB,OAChB,4BAA4B,OAC5B,WACgB;CAChB,MAAM,CAAC,iBAAiB,sBAAsB,SAAgC,KAAK;CACnF,MAAM,YAAY,sBAAsB;CACxC,MAAM,EAAE,YAAY,iBAAiB,eAAe,oBAAoB;CACxE,MAAM,eACJ,eAAe,YAAA,MAEX,eAAe,YAAA,MAEb;CAER,MAAM,UACJ,oBAAC,WAAD;EACQ;EACC;EACC;EACF;EACS;EACf,GAAI;EACa;YAEhB,OAAO,aAAa,aAAa,SAAS,EAAE,iBAAiB,CAAC,GAAG;EACxD,CAAA;AAMd,QACE,qBAAC,eAAD;EAAe,QAAQ;EAAmB;EAA2B;YAArE,CAHqB,UAAU,oBAAC,WAAD,EAAA,UAAY,SAAoB,CAAA,GAAG,MAKhE,oBAAC,wBAAD;GACa;GACX,aAAa;GACb,eAAe;GACA;GACY;GAC3B,+BAA+B,YAAY,CAAC,QAAQ,QAAQ,8BAA8B;aAE1F,oBAAC,sBAAD;IAAsB,KAAK;IAA+B;cACvD;IACoB,CAAA;GACA,CAAA,CACX;;;AAIpB,IAAA,gBAAe,OAAO,OAAOA,SAAO,EAClC,OAAO,YACR,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["AriaModal","Button","AriaButton","Heading","AriaHeading","Card","Modal"],"sources":["../../../components/Modal/Modal.tsx"],"sourcesContent":["import {\n forwardRef,\n type ComponentProps,\n type ComponentPropsWithoutRef,\n type ReactNode,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport {\n Button as AriaButton,\n Dialog,\n DialogTrigger,\n Heading as AriaHeading,\n Modal as AriaModal,\n ModalOverlay,\n type ModalOverlayProps,\n OverlayTriggerStateContext,\n Pressable,\n} from 'react-aria-components';\nimport styled from 'styled-components';\n\nimport Button, { type ButtonProps } from '@persona/design-system/components/Button';\nimport Card from '@persona/design-system/components/Card';\nimport Stack, { HStack } from '@persona/design-system/components/Stack';\nimport TabBar, { Tab } from '@persona/design-system/components/TabBar';\nimport { Heading } from '@persona/design-system/components/Text';\nimport { Color, Spacing } from '@persona/design-tokens';\nimport { XIcon } from '@persona/icons';\nimport { semanticColor, semanticOnly } from 'design-system/lib/semanticColor';\nimport useEmbeddedSurface, {\n useEmbeddedSurfaceGate,\n useEmbeddedSurfaceId,\n} from 'design-system/lib/useEmbeddedSurface';\nimport useModalInsetRight, {\n SIDEBAR_CLOSE_TRANSITION_MS,\n SIDEBAR_OPEN_TRANSITION_MS,\n} from 'design-system/lib/useModalInsetRight';\n\nconst StyledModalOverlay = styled(ModalOverlay)<{\n $hostPending: boolean;\n $animationDelayMs: number;\n $insetRight: string;\n $transitionMs: number;\n}>`\n @keyframes overlayShow {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n background-color: rgba(0, 0, 0, 0.5);\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: ${({ $insetRight }) => $insetRight};\n transition: right ${({ $transitionMs }) => $transitionMs}ms ease-out;\n animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);\n animation-delay: ${({ $animationDelayMs }) => $animationDelayMs}ms;\n animation-fill-mode: both;\n ${({ $hostPending }) =>\n $hostPending &&\n `\n animation-play-state: paused;\n `}\n @media (prefers-reduced-motion: reduce) {\n animation-duration: 0ms;\n animation-delay: 0ms;\n animation-play-state: running;\n }\n z-index: 10000;\n display: flex;\n align-items: center;\n justify-content: center;\n`;\n\nconst StyledModal = styled(AriaModal)`\n z-index: 10001;\n outline: none;\n width: fit-content;\n max-width: 100%;\n ${semanticOnly((tokens) => `color: ${tokens.FgPrimary};`)}\n`;\n\n/**\n * React Aria keeps the overlay mounted through the exit animation, so announcing the surface from\n * here — rather than from the persistent gate below — releases the host's backdrop exactly when the\n * modal stops being painted.\n */\nconst EmbeddedSurfaceModal = forwardRef<HTMLDivElement, { children: ReactNode; surfaceId: string }>(\n function EmbeddedSurfaceModal({ children, surfaceId }, ref) {\n useEmbeddedSurface(surfaceId);\n return <StyledModal ref={ref}>{children}</StyledModal>;\n },\n);\n\ntype EmbeddedSurfaceOverlayProps = ModalOverlayProps & {\n $insetRight: string;\n $transitionMs: number;\n surfaceId: string;\n};\n\nconst EmbeddedSurfaceOverlay = ({ surfaceId, ...props }: EmbeddedSurfaceOverlayProps) => {\n const state = useContext(OverlayTriggerStateContext);\n const isOpen = state?.isOpen ?? false;\n const { ready, animationDelayMs } = useEmbeddedSurfaceGate(surfaceId, isOpen);\n\n const { $insetRight, $transitionMs, ...overlayProps } = props;\n return (\n <StyledModalOverlay\n {...overlayProps}\n $insetRight={$insetRight}\n $transitionMs={$transitionMs}\n $animationDelayMs={animationDelayMs}\n $hostPending={isOpen && !ready}\n />\n );\n};\n\nconst ModalCloseButton = styled(Button)`\n display: inline-flex;\n padding: ${Spacing[2]};\n border-radius: ${Spacing[1]};\n width: fit-content;\n min-width: unset;\n`;\n\nconst ModalFooter = styled(HStack).attrs({\n justify: 'flex-end',\n align: 'center',\n spacing: Spacing[2],\n})`\n padding: ${Spacing[3]} ${Spacing[4]};\n border-top: 1px solid ${({ theme }) => semanticColor(theme, 'BorderSubtle', Color.BorderDivider)};\n`;\n\nconst ModalHeaderTitle = styled.div`\n flex: 1;\n`;\n\nexport const ModalTrigger = DialogTrigger;\nexport const ModalContent = StyledModal;\n\nexport const ModalClose = (props: ButtonProps) => {\n return (\n <AriaButton slot='close' style={{ all: 'unset', display: 'contents' }}>\n <ModalCloseButton variant='text' width='icon' size='md' {...props}>\n <XIcon />\n </ModalCloseButton>\n </AriaButton>\n );\n};\n\nexport interface ModalTitleProps {\n children: ReactNode;\n className?: string;\n}\n\n/** Props passed to modal content render functions. */\nexport interface ModalRenderProps {\n /** Element that floating content should use as its portal container. */\n portalContainer: HTMLDivElement | null;\n}\n\ntype ModalRenderable = ReactNode | ((props: ModalRenderProps) => ReactNode);\n\nconst ModalTitle = ({ children, ...props }: ModalTitleProps) => {\n return (\n <Heading size='sm' color='primary' as={AriaHeading} slot='title' {...props}>\n {children}\n </Heading>\n );\n};\n\nconst ModalHeader = styled(HStack)<{ $hasTabs: boolean }>`\n border-bottom: ${({ $hasTabs, theme }) =>\n $hasTabs ? 'none' : `1px solid ${semanticColor(theme, 'BorderSubtle', Color.BorderDivider)}`};\n padding: ${({ $hasTabs }) =>\n $hasTabs\n ? `${Spacing[3]} ${Spacing[2]} ${Spacing[1]} ${Spacing[4]}`\n : `${Spacing[3]} ${Spacing[2]} ${Spacing[3]} ${Spacing[4]}`};\n`;\n\nconst ModalTabBar = styled(TabBar)`\n padding-left: ${Spacing[4]};\n`;\n\nconst StyledDialog = styled(Dialog)`\n outline: none;\n`;\n\nconst StyledCard = styled(Card)<{ $size?: 'auto' | 'md' | 'lg' | 'xl' | 'full' }>`\n position: relative;\n width: ${({ $size }) => {\n switch ($size) {\n case 'auto':\n return 'auto';\n case 'full':\n return 'calc(100vw - 160px)';\n default:\n return '90vw';\n }\n }};\n max-width: ${({ theme, $size }) => {\n switch ($size) {\n case 'auto':\n return 'auto';\n case 'full':\n return 'calc(100vw - 160px)';\n default:\n return theme.modal.width[$size];\n }\n }};\n /* TODO: Use breakpoints to make this responsive */\n max-height: ${({ $size }) => ($size === 'full' ? 'calc(100vh - 160px)' : '85vh')};\n display: flex;\n flex-direction: column;\n overflow: hidden;\n ${({ $size }) =>\n $size === 'full' &&\n `\n height: calc(100vh - 160px);\n `}\n margin-bottom: 0;\n`;\n\ninterface ModalCardProps extends ComponentPropsWithoutRef<typeof Dialog> {\n /**\n * Display X button to close popover\n */\n showCloseButton?: boolean;\n\n /**\n * Max width of the modal\n */\n size?: 'auto' | 'md' | 'lg' | 'xl' | 'full';\n\n /**\n * Footer content\n */\n footer?: ReactNode;\n\n /**\n * Renders tabs within the modal.\n * Adds a tab bar and will render the contents of the selected tab in a tabpanel.\n * Overrides `children`.\n * Tab contents can be render functions that receive the modal portal container.\n */\n tabs?: TabView[];\n\n /**\n * Title of the modal\n */\n title?: ReactNode;\n\n /**\n * Children content\n */\n children?: ReactNode;\n\n /**\n * When true, removes horizontal and vertical padding from the body. Defaults to false.\n */\n noBodyPadding?: boolean;\n\n /**\n * Additional props for the Dialog element\n */\n className?: string;\n}\n\ninterface ModalCardInternalProps extends ModalCardProps {\n portalContainer: HTMLDivElement | null;\n}\n\nconst StyledModalCardBody = styled(Card.Body)<{\n $noPadding?: boolean;\n $hidden?: boolean;\n}>`\n overflow-y: auto;\n flex: 1;\n min-height: 0;\n ${({ $noPadding }) =>\n $noPadding\n ? 'padding: 0;'\n : `\n padding-left: ${Spacing[4]};\n padding-right: ${Spacing[4]};\n `}\n ${({ $hidden }) => $hidden && 'display: none;'}\n`;\n\n/**\n * Card to be used in Modal contexts. Inherits props from react-aria-components Dialog.\n */\nconst ModalCard = forwardRef<HTMLDivElement, ModalCardInternalProps>(function ModalCard(\n {\n title,\n children,\n showCloseButton = true,\n size,\n footer,\n tabs,\n noBodyPadding = false,\n portalContainer,\n ...props\n },\n ref,\n) {\n const [selectedTabIdx, setSelectedTabIdx] = useState(0);\n const tabCount = tabs?.length ?? 0;\n\n useEffect(() => {\n setSelectedTabIdx(0);\n }, [tabCount]);\n\n const titleAndClose = (\n <ModalHeader justify='flex-start' align='center' spacing={Spacing[2]} $hasTabs={Boolean(tabs)}>\n <ModalHeaderTitle>{title ? <ModalTitle>{title}</ModalTitle> : null}</ModalHeaderTitle>\n {showCloseButton && <ModalClose aria-label='Close' />}\n </ModalHeader>\n );\n\n const modalHeader = tabs ? (\n <Stack>\n {titleAndClose}\n <ModalTabBar>\n {tabs.map((tab, idx) => (\n <Tab\n key={tab.name}\n selected={selectedTabIdx === idx}\n id={`pds-modal_tab-${idx}`}\n onClick={() => setSelectedTabIdx(idx)}\n aria-controls={`pds-modal_tab-panel-${idx}`}\n >\n {tab.name}\n </Tab>\n ))}\n </ModalTabBar>\n </Stack>\n ) : (\n titleAndClose\n );\n\n return (\n <StyledDialog {...props} ref={ref}>\n <StyledCard elevated $size={size}>\n {(showCloseButton || title) && modalHeader}\n {tabs ? (\n tabs.map((tab, idx) => (\n <StyledModalCardBody\n key={tab.name}\n $noPadding={noBodyPadding}\n $hidden={selectedTabIdx !== idx}\n role={tabs ? 'tabpanel' : undefined}\n id={`pds-modal_tab-panel-${tab.name}`}\n aria-labelledby={`pds-modal_tab-${tab.name}`}\n >\n {typeof tab.contents === 'function'\n ? tab.contents({ portalContainer })\n : tab.contents}\n </StyledModalCardBody>\n ))\n ) : (\n <StyledModalCardBody\n $noPadding={noBodyPadding}\n role={tabs ? 'tabpanel' : undefined}\n id={`pds-modal_tab-panel-${selectedTabIdx}`}\n aria-labelledby={`pds-modal_tab-${selectedTabIdx}`}\n >\n {children}\n </StyledModalCardBody>\n )}\n\n {footer && <ModalFooter>{footer}</ModalFooter>}\n </StyledCard>\n </StyledDialog>\n );\n});\n\ninterface TabView {\n name: string;\n contents: ModalRenderable;\n badge?: React.ReactElement;\n disabled?: boolean;\n 'data-tour-target'?: string;\n}\n\nexport interface ModalProps {\n /**\n * Title of the Card\n */\n title?: string;\n\n /**\n * Component to use as trigger. React Aria trigger props will be merged with this element.\n */\n trigger?: ComponentProps<typeof Pressable>['children'];\n\n /**\n * Props to apply to Modal.Card within\n */\n contentProps?: ModalCardProps;\n\n /**\n * Max width of the modal\n */\n size?: 'auto' | 'md' | 'lg' | 'xl' | 'full';\n\n /**\n * Footer section intended for actions.\n * You can pass in Buttons directly and they will render in a HStack.\n */\n footer?: ReactNode;\n\n /**\n * Renders tabs within the modal.\n * Adds a tab bar and will render the contents of the selected tab in a tabpanel.\n * Overrides `children`.\n */\n tabs?: TabView[];\n\n /**\n * Children content\n */\n children?: ModalRenderable;\n\n /**\n * When true, removes horizontal and vertical padding from the body. Defaults to false.\n * Can also be set via contentProps.noBodyPadding.\n */\n noBodyPadding?: boolean;\n\n /**\n * Controls whether the modal is open (controlled)\n */\n open?: boolean;\n\n /**\n * Default open state (uncontrolled)\n */\n defaultOpen?: boolean;\n\n /**\n * Handler called when open state changes\n */\n onOpenChange?: (isOpen: boolean) => void;\n\n /**\n * Whether the modal can be dismissed by clicking outside or pressing escape\n */\n isDismissable?: boolean;\n\n /**\n * Whether pressing the escape key closes the modal\n */\n isKeyboardDismissDisabled?: boolean;\n}\n\nconst Modal = ({\n children,\n trigger,\n contentProps,\n noBodyPadding = false,\n size = 'md',\n title,\n footer,\n tabs,\n defaultOpen,\n onOpenChange,\n isDismissable = false,\n isKeyboardDismissDisabled = false,\n open,\n}: ModalProps) => {\n const [portalContainer, setPortalContainer] = useState<HTMLDivElement | null>(null);\n const surfaceId = useEmbeddedSurfaceId();\n const { insetRight: modalInsetRight, panelState } = useModalInsetRight();\n const transitionMs =\n panelState === 'opening'\n ? SIDEBAR_OPEN_TRANSITION_MS\n : panelState === 'closing'\n ? SIDEBAR_CLOSE_TRANSITION_MS\n : 0;\n\n const content = (\n <ModalCard\n size={size}\n title={title}\n footer={footer}\n tabs={tabs}\n noBodyPadding={noBodyPadding}\n {...contentProps}\n portalContainer={portalContainer}\n >\n {typeof children === 'function' ? children({ portalContainer }) : children}\n </ModalCard>\n );\n\n // Wrap trigger element to ensure it works with react-aria-components\n const wrappedTrigger = trigger ? <Pressable>{trigger}</Pressable> : null;\n\n return (\n <DialogTrigger isOpen={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>\n {wrappedTrigger}\n <EmbeddedSurfaceOverlay\n surfaceId={surfaceId}\n $insetRight={modalInsetRight}\n $transitionMs={transitionMs}\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n shouldCloseOnInteractOutside={(element) => !element.closest('[data-react-aria-top-layer]')}\n >\n <EmbeddedSurfaceModal ref={setPortalContainer} surfaceId={surfaceId}>\n {content}\n </EmbeddedSurfaceModal>\n </EmbeddedSurfaceOverlay>\n </DialogTrigger>\n );\n};\n\nexport default Object.assign(Modal, {\n Title: ModalTitle,\n});\n"],"mappings":";;;;;;;;;;;;;;;AAuCA,MAAM,qBAAqB,OAAO,aAAa;;;;;;;;;;;;;;YAmBnC,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