@helsenorge/designsystem-react 15.5.0 → 15.5.1
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/lib/AnchorLink.js.map +1 -1
- package/lib/Avatar.js.map +1 -1
- package/lib/Button.js.map +1 -1
- package/lib/CHANGELOG.md +8 -0
- package/lib/Checkbox.js +6 -4
- package/lib/Checkbox.js.map +1 -1
- package/lib/Checkbox2.js.map +1 -1
- package/lib/CheckboxMarker.js.map +1 -1
- package/lib/Chip.js.map +1 -1
- package/lib/Close.js.map +1 -1
- package/lib/Drawer.js.map +1 -1
- package/lib/DrawerNavigation.js.map +1 -1
- package/lib/Duolist.js.map +1 -1
- package/lib/ElementHeader.js.map +1 -1
- package/lib/ElementHeaderText.js.map +1 -1
- package/lib/ErrorWrapper.js +2 -1
- package/lib/ErrorWrapper.js.map +1 -1
- package/lib/Expander.js +2 -1
- package/lib/Expander.js.map +1 -1
- package/lib/FilterButton.js.map +1 -1
- package/lib/FilterButtonAndChipsWrapper.js.map +1 -1
- package/lib/FilterDrawer.js.map +1 -1
- package/lib/FilterLinkList.js +2 -1
- package/lib/FilterLinkList.js.map +1 -1
- package/lib/FilterOverviewSearch.js.map +1 -1
- package/lib/FilterResultCountAndSortWrapper.js.map +1 -1
- package/lib/FilterSearch.js.map +1 -1
- package/lib/FormFieldTag.js.map +1 -1
- package/lib/FormGroup.js.map +1 -1
- package/lib/FormLayout.js.map +1 -1
- package/lib/HelpDetails.js.map +1 -1
- package/lib/HelpTriggerIcon.js.map +1 -1
- package/lib/HelpTriggerStandalone.js.map +1 -1
- package/lib/HighlightPanel.js.map +1 -1
- package/lib/Highlighter.js.map +1 -1
- package/lib/HorizontalScroll.js.map +1 -1
- package/lib/Icon.js.map +1 -1
- package/lib/Illustration.js.map +1 -1
- package/lib/InfoTeaser.js.map +1 -1
- package/lib/Input.js.map +1 -1
- package/lib/LazyIcon.js.map +1 -1
- package/lib/LazyIllustration.js.map +1 -1
- package/lib/LinkList.js +31 -28
- package/lib/LinkList.js.map +1 -1
- package/lib/List.js +4 -2
- package/lib/List.js.map +1 -1
- package/lib/ListEditMode.js +5 -4
- package/lib/ListEditMode.js.map +1 -1
- package/lib/LoaderSpinner.js.map +1 -1
- package/lib/MaxCharacters.js.map +1 -1
- package/lib/PanelTitle.js.map +1 -1
- package/lib/PopOver.js +5 -2
- package/lib/PopOver.js.map +1 -1
- package/lib/Radio.js.map +1 -1
- package/lib/RadioButton.js.map +1 -1
- package/lib/RadioMarker.js +11 -10
- package/lib/RadioMarker.js.map +1 -1
- package/lib/Select.js.map +1 -1
- package/lib/SingleSelectItem.js.map +1 -1
- package/lib/Slider.js +0 -2
- package/lib/Slider.js.map +1 -1
- package/lib/Spacer.js +16 -15
- package/lib/Spacer.js.map +1 -1
- package/lib/StatusDot.js.map +1 -1
- package/lib/StatusDotList.js.map +1 -1
- package/lib/StepButtons.js.map +1 -1
- package/lib/TabList.js.map +1 -1
- package/lib/TabPanel.js +2 -1
- package/lib/TabPanel.js.map +1 -1
- package/lib/TableBody.js +2 -1
- package/lib/TableBody.js.map +1 -1
- package/lib/TableCell.js +2 -1
- package/lib/TableCell.js.map +1 -1
- package/lib/TableExpandedRow.js +6 -3
- package/lib/TableExpandedRow.js.map +1 -1
- package/lib/TableExpanderCell.js +2 -1
- package/lib/TableExpanderCell.js.map +1 -1
- package/lib/TableHead.js +7 -6
- package/lib/TableHead.js.map +1 -1
- package/lib/TableHeadCell.js.map +1 -1
- package/lib/TableRow.js +7 -5
- package/lib/TableRow.js.map +1 -1
- package/lib/Textarea.js.map +1 -1
- package/lib/Title.js +20 -17
- package/lib/Title.js.map +1 -1
- package/lib/Toast.js.map +1 -1
- package/lib/VisualCheckbox.js.map +1 -1
- package/lib/VisualRadio.js.map +1 -1
- package/lib/components/ArticleTeaser/index.js.map +1 -1
- package/lib/components/Dropdown/index.js.map +1 -1
- package/lib/components/DropdownOld/index.js.map +1 -1
- package/lib/components/EmptyState/index.js +1 -3
- package/lib/components/EmptyState/index.js.map +1 -1
- package/lib/components/ExpanderHierarchy/index.js +2 -1
- package/lib/components/ExpanderHierarchy/index.js.map +1 -1
- package/lib/components/ExpanderList/index.js +7 -6
- package/lib/components/ExpanderList/index.js.map +1 -1
- package/lib/components/EyebrowHeader/index.js.map +1 -1
- package/lib/components/FavoriteButton/index.js +9 -7
- package/lib/components/FavoriteButton/index.js.map +1 -1
- package/lib/components/HelpBubble/index.js.map +1 -1
- package/lib/components/HelpExpanderInline/index.js.map +1 -1
- package/lib/components/HelpExpanderStandalone/index.js.map +1 -1
- package/lib/components/HelpTooltip/index.js +6 -3
- package/lib/components/HelpTooltip/index.js.map +1 -1
- package/lib/components/HelpTriggerInline/index.js.map +1 -1
- package/lib/components/Icons/AlarmClock.js.map +1 -1
- package/lib/components/Icons/Bus.js.map +1 -1
- package/lib/components/Illustrations/BabyMobile.js +5 -4
- package/lib/components/Illustrations/BabyMobile.js.map +1 -1
- package/lib/components/Illustrations/BabyMobileMedium.js.map +1 -1
- package/lib/components/Illustrations/Child.js +5 -4
- package/lib/components/Illustrations/Child.js.map +1 -1
- package/lib/components/Illustrations/ChildMedium.js.map +1 -1
- package/lib/components/Illustrations/Doctor.js +10 -8
- package/lib/components/Illustrations/Doctor.js.map +1 -1
- package/lib/components/Illustrations/DoctorMedium.js.map +1 -1
- package/lib/components/Illustrations/DoctorSmall.js.map +1 -1
- package/lib/components/Illustrations/EyeContact.js +5 -4
- package/lib/components/Illustrations/EyeContact.js.map +1 -1
- package/lib/components/Illustrations/EyeContactMedium.js.map +1 -1
- package/lib/components/Illustrations/FacialRecognitionFingerprint.js +5 -4
- package/lib/components/Illustrations/FacialRecognitionFingerprint.js.map +1 -1
- package/lib/components/Illustrations/FacialRecognitionFingerprintMedium.js.map +1 -1
- package/lib/components/Illustrations/GiveBabyFood.js +5 -4
- package/lib/components/Illustrations/GiveBabyFood.js.map +1 -1
- package/lib/components/Illustrations/GiveBabyFoodMedium.js.map +1 -1
- package/lib/components/Illustrations/HealthcarePersonnel.js +10 -8
- package/lib/components/Illustrations/HealthcarePersonnel.js.map +1 -1
- package/lib/components/Illustrations/HealthcarePersonnelMedium.js.map +1 -1
- package/lib/components/Illustrations/HealthcarePersonnelSmall.js.map +1 -1
- package/lib/components/Illustrations/ReadLetters.js +5 -4
- package/lib/components/Illustrations/ReadLetters.js.map +1 -1
- package/lib/components/Illustrations/ReadLettersMedium.js.map +1 -1
- package/lib/components/Illustrations/SkinToSkin.js +5 -4
- package/lib/components/Illustrations/SkinToSkin.js.map +1 -1
- package/lib/components/Illustrations/SkinToSkinMedium.js.map +1 -1
- package/lib/components/Illustrations/Stork.js +5 -4
- package/lib/components/Illustrations/Stork.js.map +1 -1
- package/lib/components/Illustrations/StorkMedium.js.map +1 -1
- package/lib/components/Illustrations/Stroller.js +5 -4
- package/lib/components/Illustrations/Stroller.js.map +1 -1
- package/lib/components/Illustrations/StrollerMedium.js.map +1 -1
- package/lib/components/Illustrations/Support2.js +5 -4
- package/lib/components/Illustrations/Support2.js.map +1 -1
- package/lib/components/Illustrations/Support2Medium.js.map +1 -1
- package/lib/components/Illustrations/Thinking.js +5 -4
- package/lib/components/Illustrations/Thinking.js.map +1 -1
- package/lib/components/Illustrations/ThinkingMedium.js.map +1 -1
- package/lib/components/Loader/index.js +14 -13
- package/lib/components/Loader/index.js.map +1 -1
- package/lib/components/Logo/index.js.map +1 -1
- package/lib/components/Modal/index.js.map +1 -1
- package/lib/components/NotificationPanel/index.js +7 -4
- package/lib/components/NotificationPanel/index.js.map +1 -1
- package/lib/components/Panel/index.js +17 -16
- package/lib/components/Panel/index.js.map +1 -1
- package/lib/components/PanelList/index.js.map +1 -1
- package/lib/components/PopMenu/index.js.map +1 -1
- package/lib/components/Progressbar/index.js +6 -5
- package/lib/components/Progressbar/index.js.map +1 -1
- package/lib/components/PromoPanel/index.js.map +1 -1
- package/lib/components/ServiceMessage/index.js +2 -1
- package/lib/components/ServiceMessage/index.js.map +1 -1
- package/lib/components/SharingStatus/index.js.map +1 -1
- package/lib/components/Step/index.js.map +1 -1
- package/lib/components/Stepper/index.js +4 -2
- package/lib/components/Stepper/index.js.map +1 -1
- package/lib/components/StickyNote/index.js.map +1 -1
- package/lib/components/Table/index.js +2 -5
- package/lib/components/Table/index.js.map +1 -1
- package/lib/components/Tabs/index.js.map +1 -1
- package/lib/components/Tag/index.js +2 -1
- package/lib/components/Tag/index.js.map +1 -1
- package/lib/components/TagList/index.js.map +1 -1
- package/lib/components/Tile/index.js +5 -4
- package/lib/components/Tile/index.js.map +1 -1
- package/lib/components/ToastList/index.js +2 -1
- package/lib/components/ToastList/index.js.map +1 -1
- package/lib/components/Toggle/index.js +7 -4
- package/lib/components/Toggle/index.js.map +1 -1
- package/lib/components/Validation/index.js.map +1 -1
- package/lib/components/VisualCheckboxCloud/index.js.map +1 -1
- package/lib/components/VisualCheckboxGroup/index.js.map +1 -1
- package/lib/components/VisualContentgroupWithImage/index.js.map +1 -1
- package/lib/components/VisualRadioCloud/index.js.map +1 -1
- package/lib/components/VisualRadioGroup/index.js.map +1 -1
- package/lib/floating-ui.react.js +91 -111
- package/lib/floating-ui.react.js.map +1 -1
- package/lib/getFilterChips.js.map +1 -1
- package/lib/theme/spacers.js +2 -2
- package/lib/theme/spacers.js.map +1 -1
- package/lib/utils2.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/VisualRadioGroup/VisualRadioGroup.tsx","../../../src/components/VisualRadioGroup/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport type { VisualRadioProps, VisualRadioVariant } from './VisualRadio/VisualRadio';\n\nimport VisualRadio from './VisualRadio/VisualRadio';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport { isComponent } from '../../utils/component';\nimport ErrorWrapper from '../ErrorWrapper';\n\nimport styles from './styles.module.scss';\n\nexport interface VisualRadioGroupProps {\n /** Items in the group. Should be VisualRadioGroup.VisualRadio elements. */\n children?: React.ReactNode;\n /** Name shared by all child VisualRadio elements (overridable per child). Auto-generated if omitted. */\n name?: string;\n /** Selected value (controlled). */\n value?: string;\n /** Initial selected value (uncontrolled). */\n defaultValue?: string;\n /** Called when the selected value changes. */\n onChange?: (event: React.ChangeEvent<HTMLInputElement>, value: string) => void;\n /** Variant applied to all child VisualRadio elements (overridable per child). */\n variant?: VisualRadioVariant;\n /** When set and the number of VisualRadio children exceeds this limit on the mobile breakpoint, the variant is forced to `line`. */\n mobileLineVariantLimit?: number;\n /** Error message shown above the group */\n error?: string;\n /** Error text id (auto-generated if omitted) */\n errorTextId?: string;\n /** Renders the error component (Default: true) */\n renderError?: boolean;\n /** Ref passed to the error message element */\n errorMessageRef?: React.Ref<HTMLDivElement | null>;\n /** Adds custom classes to the root element. */\n className?: string;\n /** Adds custom classes to the errorWrapper */\n errorWrapperClassName?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets the data-testid attribute for the error wrapper */\n errorWrapperTestId?: string;\n}\n\ninterface VisualRadioGroupComponent extends React.FC<VisualRadioGroupProps> {\n VisualRadio: typeof VisualRadio;\n}\n\nexport const VisualRadioGroup: VisualRadioGroupComponent = props => {\n const {\n children,\n name: nameProp,\n value,\n defaultValue,\n onChange,\n variant = 'rectangle',\n mobileLineVariantLimit,\n error,\n errorTextId: errorTextIdProp,\n renderError = true,\n errorMessageRef,\n className,\n errorWrapperClassName,\n testId,\n errorWrapperTestId,\n } = props;\n\n const errorTextId = useIdWithFallback(errorTextIdProp);\n const name = useIdWithFallback(nameProp);\n const isMobile = useIsMobileBreakpoint();\n\n const childArray = React.Children.toArray(children);\n const radioChildren = childArray.filter((child): child is React.ReactElement<VisualRadioProps> =>\n isComponent<VisualRadioProps>(child, VisualRadio)\n );\n\n const initialSelected =\n value ?? defaultValue ?? radioChildren.find(child => child.props.defaultChecked || child.props.checked)?.props.value?.toString();\n\n const [selectedValue, setSelectedValue] = React.useState<string | undefined>(initialSelected);\n const [prevValue, setPrevValue] = React.useState<string | undefined>(value);\n if (prevValue !== value) {\n setPrevValue(value);\n if (value !== undefined && value !== selectedValue) {\n setSelectedValue(value);\n }\n }\n\n const effectiveVariant: VisualRadioVariant | undefined =\n isMobile && mobileLineVariantLimit !== undefined && radioChildren.length > mobileLineVariantLimit ? 'line' : variant;\n\n const mapChild = (child: React.ReactNode): React.ReactNode => {\n if (isComponent<VisualRadioProps>(child, VisualRadio)) {\n const childValue = child.props.value?.toString();\n const isSelected = selectedValue !== undefined && childValue !== undefined && childValue === selectedValue;\n const childOnChange = child.props.onChange;\n\n return React.cloneElement(child, {\n name: child.props.name ?? name,\n variant: child.props.variant ?? effectiveVariant,\n error: !!error || child.props.error,\n errorTextId: child.props.errorTextId ?? errorTextId,\n checked: isSelected,\n onChange: (e: React.ChangeEvent<HTMLInputElement>): void => {\n if (childValue !== undefined) {\n setSelectedValue(childValue);\n }\n childOnChange?.(e);\n if (childValue !== undefined) {\n onChange?.(e, childValue);\n }\n },\n });\n }\n return child;\n };\n\n return (\n <ErrorWrapper\n className={classNames(errorWrapperClassName, className)}\n errorText={error}\n errorTextId={errorTextId}\n renderError={renderError}\n errorMessageRef={errorMessageRef}\n testId={errorWrapperTestId}\n >\n <div\n className={classNames(styles['visual-radio-group'], {\n [styles['visual-radio-group--variant-line']]: effectiveVariant === 'line',\n })}\n data-testid={testId}\n role={'radiogroup'}\n >\n {React.Children.map(children, mapChild)}\n </div>\n </ErrorWrapper>\n );\n};\n\nVisualRadioGroup.VisualRadio = VisualRadio;\n\nexport default VisualRadioGroup;\n","import VisualRadioGroup from './VisualRadioGroup';\nexport * from './VisualRadioGroup';\nexport default VisualRadioGroup;\n"],"mappings":";;;;;;;;;;AAmDA,IAAa,oBAA8C,UAAS;CAClE,MAAM,EACJ,UACA,MAAM,UACN,OACA,cACA,UACA,UAAU,aACV,wBACA,OACA,aAAa,iBACb,cAAc,MACd,iBACA,WACA,uBACA,QACA,uBACE;CAEJ,MAAM,cAAc,kBAAkB,eAAe;CACrD,MAAM,OAAO,kBAAkB,QAAQ;CACvC,MAAM,WAAW,sBAAsB;CAGvC,MAAM,gBADa,MAAM,SAAS,QAAQ,QACpB,CAAA,CAAW,QAAQ,UACvC,YAA8B,OAAO,WAAW,CAClD;CAEA,MAAM,kBACJ,SAAS,gBAAgB,cAAc,MAAK,UAAS,MAAM,MAAM,kBAAkB,MAAM,MAAM,OAAO,CAAC,EAAE,MAAM,OAAO,SAAS;CAEjI,MAAM,CAAC,eAAe,oBAAoB,MAAM,SAA6B,eAAe;CAC5F,MAAM,CAAC,WAAW,gBAAgB,MAAM,SAA6B,KAAK;CAC1E,IAAI,cAAc,OAAO;EACvB,aAAa,KAAK;EAClB,IAAI,UAAU,KAAA,KAAa,UAAU,eACnC,iBAAiB,KAAK;CAE1B;CAEA,MAAM,mBACJ,YAAY,2BAA2B,KAAA,KAAa,cAAc,SAAS,yBAAyB,SAAS;CAE/G,MAAM,YAAY,UAA4C;EAC5D,IAAI,YAA8B,OAAO,WAAW,GAAG;GACrD,MAAM,aAAa,MAAM,MAAM,OAAO,SAAS;GAC/C,MAAM,aAAa,kBAAkB,KAAA,KAAa,eAAe,KAAA,KAAa,eAAe;GAC7F,MAAM,gBAAgB,MAAM,MAAM;GAElC,OAAO,MAAM,aAAa,OAAO;IAC/B,MAAM,MAAM,MAAM,QAAQ;IAC1B,SAAS,MAAM,MAAM,WAAW;IAChC,OAAO,CAAC,CAAC,SAAS,MAAM,MAAM;IAC9B,aAAa,MAAM,MAAM,eAAe;IACxC,SAAS;IACT,WAAW,MAAiD;KAC1D,IAAI,eAAe,KAAA,GACjB,iBAAiB,UAAU;KAE7B,gBAAgB,CAAC;KACjB,IAAI,eAAe,KAAA,GACjB,WAAW,GAAG,UAAU;IAE5B;GACF,CAAC;EACH;EACA,OAAO;CACT;CAEA,OACE,oBAAC,sBAAD;EACE,WAAW,WAAW,uBAAuB,SAAS;EACtD,WAAW;EACE;EACA;EACI;EACjB,QAAQ;
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/VisualRadioGroup/VisualRadioGroup.tsx","../../../src/components/VisualRadioGroup/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport type { VisualRadioProps, VisualRadioVariant } from './VisualRadio/VisualRadio';\n\nimport VisualRadio from './VisualRadio/VisualRadio';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport { isComponent } from '../../utils/component';\nimport ErrorWrapper from '../ErrorWrapper';\n\nimport styles from './styles.module.scss';\n\nexport interface VisualRadioGroupProps {\n /** Items in the group. Should be VisualRadioGroup.VisualRadio elements. */\n children?: React.ReactNode;\n /** Name shared by all child VisualRadio elements (overridable per child). Auto-generated if omitted. */\n name?: string;\n /** Selected value (controlled). */\n value?: string;\n /** Initial selected value (uncontrolled). */\n defaultValue?: string;\n /** Called when the selected value changes. */\n onChange?: (event: React.ChangeEvent<HTMLInputElement>, value: string) => void;\n /** Variant applied to all child VisualRadio elements (overridable per child). */\n variant?: VisualRadioVariant;\n /** When set and the number of VisualRadio children exceeds this limit on the mobile breakpoint, the variant is forced to `line`. */\n mobileLineVariantLimit?: number;\n /** Error message shown above the group */\n error?: string;\n /** Error text id (auto-generated if omitted) */\n errorTextId?: string;\n /** Renders the error component (Default: true) */\n renderError?: boolean;\n /** Ref passed to the error message element */\n errorMessageRef?: React.Ref<HTMLDivElement | null>;\n /** Adds custom classes to the root element. */\n className?: string;\n /** Adds custom classes to the errorWrapper */\n errorWrapperClassName?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets the data-testid attribute for the error wrapper */\n errorWrapperTestId?: string;\n}\n\ninterface VisualRadioGroupComponent extends React.FC<VisualRadioGroupProps> {\n VisualRadio: typeof VisualRadio;\n}\n\nexport const VisualRadioGroup: VisualRadioGroupComponent = props => {\n const {\n children,\n name: nameProp,\n value,\n defaultValue,\n onChange,\n variant = 'rectangle',\n mobileLineVariantLimit,\n error,\n errorTextId: errorTextIdProp,\n renderError = true,\n errorMessageRef,\n className,\n errorWrapperClassName,\n testId,\n errorWrapperTestId,\n } = props;\n\n const errorTextId = useIdWithFallback(errorTextIdProp);\n const name = useIdWithFallback(nameProp);\n const isMobile = useIsMobileBreakpoint();\n\n const childArray = React.Children.toArray(children);\n const radioChildren = childArray.filter((child): child is React.ReactElement<VisualRadioProps> =>\n isComponent<VisualRadioProps>(child, VisualRadio)\n );\n\n const initialSelected =\n value ?? defaultValue ?? radioChildren.find(child => child.props.defaultChecked || child.props.checked)?.props.value?.toString();\n\n const [selectedValue, setSelectedValue] = React.useState<string | undefined>(initialSelected);\n const [prevValue, setPrevValue] = React.useState<string | undefined>(value);\n if (prevValue !== value) {\n setPrevValue(value);\n if (value !== undefined && value !== selectedValue) {\n setSelectedValue(value);\n }\n }\n\n const effectiveVariant: VisualRadioVariant | undefined =\n isMobile && mobileLineVariantLimit !== undefined && radioChildren.length > mobileLineVariantLimit ? 'line' : variant;\n\n const mapChild = (child: React.ReactNode): React.ReactNode => {\n if (isComponent<VisualRadioProps>(child, VisualRadio)) {\n const childValue = child.props.value?.toString();\n const isSelected = selectedValue !== undefined && childValue !== undefined && childValue === selectedValue;\n const childOnChange = child.props.onChange;\n\n return React.cloneElement(child, {\n name: child.props.name ?? name,\n variant: child.props.variant ?? effectiveVariant,\n error: !!error || child.props.error,\n errorTextId: child.props.errorTextId ?? errorTextId,\n checked: isSelected,\n onChange: (e: React.ChangeEvent<HTMLInputElement>): void => {\n if (childValue !== undefined) {\n setSelectedValue(childValue);\n }\n childOnChange?.(e);\n if (childValue !== undefined) {\n onChange?.(e, childValue);\n }\n },\n });\n }\n return child;\n };\n\n return (\n <ErrorWrapper\n className={classNames(errorWrapperClassName, className)}\n errorText={error}\n errorTextId={errorTextId}\n renderError={renderError}\n errorMessageRef={errorMessageRef}\n testId={errorWrapperTestId}\n >\n <div\n className={classNames(styles['visual-radio-group'], {\n [styles['visual-radio-group--variant-line']]: effectiveVariant === 'line',\n })}\n data-testid={testId}\n role={'radiogroup'}\n >\n {React.Children.map(children, mapChild)}\n </div>\n </ErrorWrapper>\n );\n};\n\nVisualRadioGroup.VisualRadio = VisualRadio;\n\nexport default VisualRadioGroup;\n","import VisualRadioGroup from './VisualRadioGroup';\nexport * from './VisualRadioGroup';\nexport default VisualRadioGroup;\n"],"mappings":";;;;;;;;;;AAmDA,IAAa,oBAA8C,UAAS;CAClE,MAAM,EACJ,UACA,MAAM,UACN,OACA,cACA,UACA,UAAU,aACV,wBACA,OACA,aAAa,iBACb,cAAc,MACd,iBACA,WACA,uBACA,QACA,uBACE;CAEJ,MAAM,cAAc,kBAAkB,eAAe;CACrD,MAAM,OAAO,kBAAkB,QAAQ;CACvC,MAAM,WAAW,sBAAsB;CAGvC,MAAM,gBADa,MAAM,SAAS,QAAQ,QACpB,CAAA,CAAW,QAAQ,UACvC,YAA8B,OAAO,WAAW,CAClD;CAEA,MAAM,kBACJ,SAAS,gBAAgB,cAAc,MAAK,UAAS,MAAM,MAAM,kBAAkB,MAAM,MAAM,OAAO,CAAC,EAAE,MAAM,OAAO,SAAS;CAEjI,MAAM,CAAC,eAAe,oBAAoB,MAAM,SAA6B,eAAe;CAC5F,MAAM,CAAC,WAAW,gBAAgB,MAAM,SAA6B,KAAK;CAC1E,IAAI,cAAc,OAAO;EACvB,aAAa,KAAK;EAClB,IAAI,UAAU,KAAA,KAAa,UAAU,eACnC,iBAAiB,KAAK;CAE1B;CAEA,MAAM,mBACJ,YAAY,2BAA2B,KAAA,KAAa,cAAc,SAAS,yBAAyB,SAAS;CAE/G,MAAM,YAAY,UAA4C;EAC5D,IAAI,YAA8B,OAAO,WAAW,GAAG;GACrD,MAAM,aAAa,MAAM,MAAM,OAAO,SAAS;GAC/C,MAAM,aAAa,kBAAkB,KAAA,KAAa,eAAe,KAAA,KAAa,eAAe;GAC7F,MAAM,gBAAgB,MAAM,MAAM;GAElC,OAAO,MAAM,aAAa,OAAO;IAC/B,MAAM,MAAM,MAAM,QAAQ;IAC1B,SAAS,MAAM,MAAM,WAAW;IAChC,OAAO,CAAC,CAAC,SAAS,MAAM,MAAM;IAC9B,aAAa,MAAM,MAAM,eAAe;IACxC,SAAS;IACT,WAAW,MAAiD;KAC1D,IAAI,eAAe,KAAA,GACjB,iBAAiB,UAAU;KAE7B,gBAAgB,CAAC;KACjB,IAAI,eAAe,KAAA,GACjB,WAAW,GAAG,UAAU;IAE5B;GACF,CAAC;EACH;EACA,OAAO;CACT;CAEA,OACE,oBAAC,sBAAD;EACE,WAAW,WAAW,uBAAuB,SAAS;EACtD,WAAW;EACE;EACA;EACI;EACjB,QAAQ;EAER,UAAA,oBAAC,OAAD;GACE,WAAW,WAAW,OAAO,uBAAuB,GACjD,OAAO,sCAAsC,qBAAqB,OACrE,CAAC;GACD,eAAa;GACb,MAAM;GAEL,UAAA,MAAM,SAAS,IAAI,UAAU,QAAQ;EACnC,CAAA;CACO,CAAA;AAElB;AAEA,iBAAiB,cAAc;;;AC5I/B,IAAA,2BAAe"}
|
package/lib/floating-ui.react.js
CHANGED
|
@@ -95,7 +95,7 @@ function getParentNode(node) {
|
|
|
95
95
|
}
|
|
96
96
|
function getNearestOverflowAncestor(node) {
|
|
97
97
|
const parentNode = getParentNode(node);
|
|
98
|
-
if (isLastTraversableNode(parentNode)) return node.ownerDocument
|
|
98
|
+
if (isLastTraversableNode(parentNode)) return (node.ownerDocument || node).body;
|
|
99
99
|
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) return parentNode;
|
|
100
100
|
return getNearestOverflowAncestor(parentNode);
|
|
101
101
|
}
|
|
@@ -214,12 +214,12 @@ function getOppositePlacement(placement) {
|
|
|
214
214
|
return oppositeSideMap[side] + placement.slice(side.length);
|
|
215
215
|
}
|
|
216
216
|
function expandPaddingObject(padding) {
|
|
217
|
+
var _padding$top, _padding$right, _padding$bottom, _padding$left;
|
|
217
218
|
return {
|
|
218
|
-
top: 0,
|
|
219
|
-
right: 0,
|
|
220
|
-
bottom: 0,
|
|
221
|
-
left: 0
|
|
222
|
-
...padding
|
|
219
|
+
top: (_padding$top = padding.top) != null ? _padding$top : 0,
|
|
220
|
+
right: (_padding$right = padding.right) != null ? _padding$right : 0,
|
|
221
|
+
bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0,
|
|
222
|
+
left: (_padding$left = padding.left) != null ? _padding$left : 0
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
225
|
function getPaddingObject(padding) {
|
|
@@ -792,14 +792,8 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
792
792
|
y: reference.y
|
|
793
793
|
};
|
|
794
794
|
}
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
798
|
-
break;
|
|
799
|
-
case "end":
|
|
800
|
-
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
801
|
-
break;
|
|
802
|
-
}
|
|
795
|
+
const alignment = getAlignment(placement);
|
|
796
|
+
if (alignment) coords[alignmentAxis] += commonAlign * (alignment === "end" ? 1 : -1) * (rtl && isVertical ? -1 : 1);
|
|
803
797
|
return coords;
|
|
804
798
|
}
|
|
805
799
|
/**
|
|
@@ -830,10 +824,7 @@ async function detectOverflow(state, options) {
|
|
|
830
824
|
height: rects.floating.height
|
|
831
825
|
} : rects.reference;
|
|
832
826
|
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
833
|
-
const offsetScale = await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))
|
|
834
|
-
x: 1,
|
|
835
|
-
y: 1
|
|
836
|
-
} : {
|
|
827
|
+
const offsetScale = await (platform.isElement == null ? void 0 : platform.isElement(offsetParent)) && await (platform.getScale == null ? void 0 : platform.getScale(offsetParent)) || {
|
|
837
828
|
x: 1,
|
|
838
829
|
y: 1
|
|
839
830
|
};
|
|
@@ -953,12 +944,11 @@ var arrow$3 = (options) => ({
|
|
|
953
944
|
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
|
|
954
945
|
const minPadding = min(paddingObject[minProp], largestPossiblePadding);
|
|
955
946
|
const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
|
|
956
|
-
const min$1 = minPadding;
|
|
957
947
|
const max = clientSize - arrowDimensions[length] - maxPadding;
|
|
958
948
|
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
959
|
-
const offset = clamp(
|
|
960
|
-
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center <
|
|
961
|
-
const alignmentOffset = shouldAddOffset ? center <
|
|
949
|
+
const offset = clamp(minPadding, center, max);
|
|
950
|
+
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < minPadding ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
951
|
+
const alignmentOffset = shouldAddOffset ? center < minPadding ? center - minPadding : center - max : 0;
|
|
962
952
|
return {
|
|
963
953
|
[axis]: coords[axis] + alignmentOffset,
|
|
964
954
|
data: {
|
|
@@ -1033,9 +1023,7 @@ var flip$2 = function(options) {
|
|
|
1033
1023
|
if (placement) resetPlacement = placement;
|
|
1034
1024
|
break;
|
|
1035
1025
|
}
|
|
1036
|
-
case "initialPlacement":
|
|
1037
|
-
resetPlacement = initialPlacement;
|
|
1038
|
-
break;
|
|
1026
|
+
case "initialPlacement": resetPlacement = initialPlacement;
|
|
1039
1027
|
}
|
|
1040
1028
|
if (placement !== resetPlacement) return { reset: { placement: resetPlacement } };
|
|
1041
1029
|
}
|
|
@@ -1173,24 +1161,13 @@ var shift$2 = function(options) {
|
|
|
1173
1161
|
y
|
|
1174
1162
|
};
|
|
1175
1163
|
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
1176
|
-
const crossAxis = getSideAxis(
|
|
1164
|
+
const crossAxis = getSideAxis(placement);
|
|
1177
1165
|
const mainAxis = getOppositeAxis(crossAxis);
|
|
1178
1166
|
let mainAxisCoord = coords[mainAxis];
|
|
1179
1167
|
let crossAxisCoord = coords[crossAxis];
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
const min = mainAxisCoord + overflow[minSide];
|
|
1184
|
-
const max = mainAxisCoord - overflow[maxSide];
|
|
1185
|
-
mainAxisCoord = clamp(min, mainAxisCoord, max);
|
|
1186
|
-
}
|
|
1187
|
-
if (checkCrossAxis) {
|
|
1188
|
-
const minSide = crossAxis === "y" ? "top" : "left";
|
|
1189
|
-
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
1190
|
-
const min = crossAxisCoord + overflow[minSide];
|
|
1191
|
-
const max = crossAxisCoord - overflow[maxSide];
|
|
1192
|
-
crossAxisCoord = clamp(min, crossAxisCoord, max);
|
|
1193
|
-
}
|
|
1168
|
+
const clampCoord = (axis, coord) => clamp(coord + overflow[axis === "y" ? "top" : "left"], coord, coord - overflow[axis === "y" ? "bottom" : "right"]);
|
|
1169
|
+
if (checkMainAxis) mainAxisCoord = clampCoord(mainAxis, mainAxisCoord);
|
|
1170
|
+
if (checkCrossAxis) crossAxisCoord = clampCoord(crossAxis, crossAxisCoord);
|
|
1194
1171
|
const limitedCoords = limiter.fn({
|
|
1195
1172
|
...state,
|
|
1196
1173
|
[mainAxis]: mainAxisCoord,
|
|
@@ -1222,7 +1199,6 @@ var size$2 = function(options) {
|
|
|
1222
1199
|
name: "size",
|
|
1223
1200
|
options,
|
|
1224
1201
|
async fn(state) {
|
|
1225
|
-
var _state$middlewareData, _state$middlewareData2;
|
|
1226
1202
|
const { placement, rects, platform, elements } = state;
|
|
1227
1203
|
const { apply = () => {}, ...detectOverflowOptions } = evaluate(options, state);
|
|
1228
1204
|
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
@@ -1243,18 +1219,15 @@ var size$2 = function(options) {
|
|
|
1243
1219
|
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
1244
1220
|
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
|
|
1245
1221
|
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
|
|
1246
|
-
const
|
|
1222
|
+
const shiftData = state.middlewareData.shift;
|
|
1223
|
+
const noShift = !shiftData;
|
|
1247
1224
|
let availableHeight = overflowAvailableHeight;
|
|
1248
1225
|
let availableWidth = overflowAvailableWidth;
|
|
1249
|
-
if (
|
|
1250
|
-
if (
|
|
1226
|
+
if (shiftData != null && shiftData.enabled.x) availableWidth = maximumClippingWidth;
|
|
1227
|
+
if (shiftData != null && shiftData.enabled.y) availableHeight = maximumClippingHeight;
|
|
1251
1228
|
if (noShift && !alignment) {
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
const yMin = max(overflow.top, 0);
|
|
1255
|
-
const yMax = max(overflow.bottom, 0);
|
|
1256
|
-
if (isYAxis) availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
1257
|
-
else availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
1229
|
+
if (isYAxis) availableWidth = width - 2 * max(overflow.left, overflow.right);
|
|
1230
|
+
else availableHeight = height - 2 * max(overflow.top, overflow.bottom);
|
|
1258
1231
|
}
|
|
1259
1232
|
await apply({
|
|
1260
1233
|
...state,
|
|
@@ -1315,8 +1288,7 @@ function getVisualOffsets(element) {
|
|
|
1315
1288
|
}
|
|
1316
1289
|
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
1317
1290
|
if (isFixed === void 0) isFixed = false;
|
|
1318
|
-
|
|
1319
|
-
return isFixed;
|
|
1291
|
+
return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element);
|
|
1320
1292
|
}
|
|
1321
1293
|
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
1322
1294
|
if (includeScale === void 0) includeScale = false;
|
|
@@ -1324,20 +1296,22 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1324
1296
|
const clientRect = element.getBoundingClientRect();
|
|
1325
1297
|
const domElement = unwrapElement(element);
|
|
1326
1298
|
let scale = createCoords(1);
|
|
1327
|
-
if (includeScale)
|
|
1328
|
-
if (
|
|
1329
|
-
|
|
1299
|
+
if (includeScale) {
|
|
1300
|
+
if (offsetParent) {
|
|
1301
|
+
if (isElement(offsetParent)) scale = getScale(offsetParent);
|
|
1302
|
+
} else scale = getScale(element);
|
|
1303
|
+
}
|
|
1330
1304
|
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
1331
1305
|
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
1332
1306
|
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
1333
1307
|
let width = clientRect.width / scale.x;
|
|
1334
1308
|
let height = clientRect.height / scale.y;
|
|
1335
|
-
if (domElement) {
|
|
1309
|
+
if (domElement && offsetParent) {
|
|
1336
1310
|
const win = getWindow(domElement);
|
|
1337
|
-
const offsetWin =
|
|
1311
|
+
const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
1338
1312
|
let currentWin = win;
|
|
1339
1313
|
let currentIFrame = getFrameElement(currentWin);
|
|
1340
|
-
while (currentIFrame &&
|
|
1314
|
+
while (currentIFrame && offsetWin !== currentWin) {
|
|
1341
1315
|
const iframeScale = getScale(currentIFrame);
|
|
1342
1316
|
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
1343
1317
|
const css = getComputedStyle$1(currentIFrame);
|
|
@@ -1385,7 +1359,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
1385
1359
|
let scale = createCoords(1);
|
|
1386
1360
|
const offsets = createCoords(0);
|
|
1387
1361
|
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1388
|
-
if (isOffsetParentAnElement || !
|
|
1362
|
+
if (isOffsetParentAnElement || !isFixed) {
|
|
1389
1363
|
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) scroll = getNodeScroll(offsetParent);
|
|
1390
1364
|
if (isOffsetParentAnElement) {
|
|
1391
1365
|
const offsetRect = getBoundingClientRect(offsetParent);
|
|
@@ -1403,15 +1377,14 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
1403
1377
|
};
|
|
1404
1378
|
}
|
|
1405
1379
|
function getClientRects(element) {
|
|
1406
|
-
return Array.from(element.getClientRects());
|
|
1380
|
+
return element.getClientRects ? Array.from(element.getClientRects()) : [];
|
|
1407
1381
|
}
|
|
1408
|
-
function getDocumentRect(
|
|
1409
|
-
const
|
|
1410
|
-
const
|
|
1411
|
-
const body = element.ownerDocument.body;
|
|
1382
|
+
function getDocumentRect(html) {
|
|
1383
|
+
const scroll = getNodeScroll(html);
|
|
1384
|
+
const body = html.ownerDocument.body;
|
|
1412
1385
|
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
1413
1386
|
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
1414
|
-
let x = -scroll.scrollLeft + getWindowScrollBarX(
|
|
1387
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(html);
|
|
1415
1388
|
const y = -scroll.scrollTop;
|
|
1416
1389
|
if (getComputedStyle$1(body).direction === "rtl") x += max(html.clientWidth, body.clientWidth) - width;
|
|
1417
1390
|
return {
|
|
@@ -1422,7 +1395,9 @@ function getDocumentRect(element) {
|
|
|
1422
1395
|
};
|
|
1423
1396
|
}
|
|
1424
1397
|
var SCROLLBAR_MAX = 25;
|
|
1425
|
-
function getViewportRect(element, strategy) {
|
|
1398
|
+
function getViewportRect(element, strategy, rootBoundary) {
|
|
1399
|
+
if (rootBoundary === void 0) rootBoundary = "viewport";
|
|
1400
|
+
const isLayoutViewport = rootBoundary === "layoutViewport";
|
|
1426
1401
|
const win = getWindow(element);
|
|
1427
1402
|
const html = getDocumentElement(element);
|
|
1428
1403
|
const visualViewport = win.visualViewport;
|
|
@@ -1431,23 +1406,30 @@ function getViewportRect(element, strategy) {
|
|
|
1431
1406
|
let x = 0;
|
|
1432
1407
|
let y = 0;
|
|
1433
1408
|
if (visualViewport) {
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1409
|
+
const layoutRelativeClientCoords = !isWebKit() || strategy === "fixed";
|
|
1410
|
+
if (isLayoutViewport) {
|
|
1411
|
+
if (!layoutRelativeClientCoords) {
|
|
1412
|
+
x = -visualViewport.offsetLeft;
|
|
1413
|
+
y = -visualViewport.offsetTop;
|
|
1414
|
+
}
|
|
1415
|
+
} else {
|
|
1416
|
+
width = visualViewport.width;
|
|
1417
|
+
height = visualViewport.height;
|
|
1418
|
+
if (layoutRelativeClientCoords) {
|
|
1419
|
+
x = visualViewport.offsetLeft;
|
|
1420
|
+
y = visualViewport.offsetTop;
|
|
1421
|
+
}
|
|
1440
1422
|
}
|
|
1441
1423
|
}
|
|
1442
|
-
|
|
1443
|
-
if (windowScrollbarX <= 0) {
|
|
1424
|
+
if (getWindowScrollBarX(html) <= 0) {
|
|
1444
1425
|
const doc = html.ownerDocument;
|
|
1445
1426
|
const body = doc.body;
|
|
1446
1427
|
const bodyStyles = getComputedStyle(body);
|
|
1447
1428
|
const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
1448
|
-
const
|
|
1449
|
-
|
|
1450
|
-
|
|
1429
|
+
const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
1430
|
+
const gutter = getComputedStyle(html).scrollbarGutter === "stable both-edges" ? reservedWidth / 2 : reservedWidth;
|
|
1431
|
+
if (gutter <= SCROLLBAR_MAX) width -= gutter;
|
|
1432
|
+
}
|
|
1451
1433
|
return {
|
|
1452
1434
|
width,
|
|
1453
1435
|
height,
|
|
@@ -1459,7 +1441,7 @@ function getInnerBoundingClientRect(element, strategy) {
|
|
|
1459
1441
|
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
|
1460
1442
|
const top = clientRect.top + element.clientTop;
|
|
1461
1443
|
const left = clientRect.left + element.clientLeft;
|
|
1462
|
-
const scale =
|
|
1444
|
+
const scale = getScale(element);
|
|
1463
1445
|
return {
|
|
1464
1446
|
width: element.clientWidth * scale.x,
|
|
1465
1447
|
height: element.clientHeight * scale.y,
|
|
@@ -1469,7 +1451,7 @@ function getInnerBoundingClientRect(element, strategy) {
|
|
|
1469
1451
|
}
|
|
1470
1452
|
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
1471
1453
|
let rect;
|
|
1472
|
-
if (clippingAncestor === "viewport") rect = getViewportRect(element, strategy);
|
|
1454
|
+
if (clippingAncestor === "viewport" || clippingAncestor === "layoutViewport") rect = getViewportRect(element, strategy, clippingAncestor);
|
|
1473
1455
|
else if (clippingAncestor === "document") rect = getDocumentRect(getDocumentElement(element));
|
|
1474
1456
|
else if (isElement(clippingAncestor)) rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
1475
1457
|
else {
|
|
@@ -1483,24 +1465,19 @@ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy)
|
|
|
1483
1465
|
}
|
|
1484
1466
|
return rectToClientRect(rect);
|
|
1485
1467
|
}
|
|
1486
|
-
function hasFixedPositionAncestor(element, stopNode) {
|
|
1487
|
-
const parentNode = getParentNode(element);
|
|
1488
|
-
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) return false;
|
|
1489
|
-
return getComputedStyle$1(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
|
|
1490
|
-
}
|
|
1491
1468
|
function getClippingElementAncestors(element, cache) {
|
|
1492
1469
|
const cachedResult = cache.get(element);
|
|
1493
1470
|
if (cachedResult) return cachedResult;
|
|
1494
1471
|
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
|
1495
|
-
let
|
|
1472
|
+
let lastKeptComputedStyle = null;
|
|
1496
1473
|
const elementIsFixed = getComputedStyle$1(element).position === "fixed";
|
|
1497
1474
|
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
1498
1475
|
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1499
1476
|
const computedStyle = getComputedStyle$1(currentNode);
|
|
1500
1477
|
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
1501
|
-
|
|
1502
|
-
if (
|
|
1503
|
-
else
|
|
1478
|
+
const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? "fixed" : "";
|
|
1479
|
+
if (!currentNodeIsContaining && (lastPosition === "fixed" || lastPosition === "absolute" && computedStyle.position === "static")) result = result.filter((ancestor) => ancestor !== currentNode);
|
|
1480
|
+
else lastKeptComputedStyle = computedStyle;
|
|
1504
1481
|
currentNode = getParentNode(currentNode);
|
|
1505
1482
|
}
|
|
1506
1483
|
cache.set(element, result);
|
|
@@ -1545,18 +1522,15 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
|
1545
1522
|
scrollTop: 0
|
|
1546
1523
|
};
|
|
1547
1524
|
const offsets = createCoords(0);
|
|
1548
|
-
|
|
1549
|
-
offsets.x = getWindowScrollBarX(documentElement);
|
|
1550
|
-
}
|
|
1551
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1525
|
+
if (isOffsetParentAnElement || !isFixed) {
|
|
1552
1526
|
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) scroll = getNodeScroll(offsetParent);
|
|
1553
1527
|
if (isOffsetParentAnElement) {
|
|
1554
1528
|
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
1555
1529
|
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1556
1530
|
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1557
|
-
}
|
|
1531
|
+
}
|
|
1558
1532
|
}
|
|
1559
|
-
if (
|
|
1533
|
+
if (!isOffsetParentAnElement && documentElement) offsets.x = getWindowScrollBarX(documentElement);
|
|
1560
1534
|
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
1561
1535
|
return {
|
|
1562
1536
|
x: rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x,
|
|
@@ -1623,7 +1597,7 @@ var platform = {
|
|
|
1623
1597
|
function rectsAreEqual(a, b) {
|
|
1624
1598
|
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
1625
1599
|
}
|
|
1626
|
-
function observeMove(element, onMove) {
|
|
1600
|
+
function observeMove(element, onMove, ancestorResize) {
|
|
1627
1601
|
let io = null;
|
|
1628
1602
|
let timeoutId;
|
|
1629
1603
|
const root = getDocumentElement(element);
|
|
@@ -1652,6 +1626,7 @@ function observeMove(element, onMove) {
|
|
|
1652
1626
|
let isFirstUpdate = true;
|
|
1653
1627
|
function handleObserve(entries) {
|
|
1654
1628
|
const ratio = entries[0].intersectionRatio;
|
|
1629
|
+
if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) return refresh();
|
|
1655
1630
|
if (ratio !== threshold) {
|
|
1656
1631
|
if (!isFirstUpdate) return refresh();
|
|
1657
1632
|
if (!ratio) timeoutId = setTimeout(() => {
|
|
@@ -1659,7 +1634,6 @@ function observeMove(element, onMove) {
|
|
|
1659
1634
|
}, 1e3);
|
|
1660
1635
|
else refresh(false, ratio);
|
|
1661
1636
|
}
|
|
1662
|
-
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) refresh();
|
|
1663
1637
|
isFirstUpdate = false;
|
|
1664
1638
|
}
|
|
1665
1639
|
try {
|
|
@@ -1672,8 +1646,14 @@ function observeMove(element, onMove) {
|
|
|
1672
1646
|
}
|
|
1673
1647
|
io.observe(element);
|
|
1674
1648
|
}
|
|
1649
|
+
const win = getWindow(element);
|
|
1650
|
+
const handleResize = () => refresh(ancestorResize);
|
|
1651
|
+
win.addEventListener("resize", handleResize);
|
|
1675
1652
|
refresh(true);
|
|
1676
|
-
return
|
|
1653
|
+
return () => {
|
|
1654
|
+
win.removeEventListener("resize", handleResize);
|
|
1655
|
+
cleanup();
|
|
1656
|
+
};
|
|
1677
1657
|
}
|
|
1678
1658
|
/**
|
|
1679
1659
|
* Automatically updates the position of the floating element when necessary.
|
|
@@ -1689,10 +1669,10 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
1689
1669
|
const referenceEl = unwrapElement(reference);
|
|
1690
1670
|
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
|
|
1691
1671
|
ancestors.forEach((ancestor) => {
|
|
1692
|
-
ancestorScroll && ancestor.addEventListener("scroll", update
|
|
1672
|
+
ancestorScroll && ancestor.addEventListener("scroll", update);
|
|
1693
1673
|
ancestorResize && ancestor.addEventListener("resize", update);
|
|
1694
1674
|
});
|
|
1695
|
-
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
1675
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update, ancestorResize) : null;
|
|
1696
1676
|
let reobserveFrame = -1;
|
|
1697
1677
|
let resizeObserver = null;
|
|
1698
1678
|
if (elementResize) {
|
|
@@ -1779,11 +1759,9 @@ var arrow$2 = arrow$3;
|
|
|
1779
1759
|
*/
|
|
1780
1760
|
var computePosition = (reference, floating, options) => {
|
|
1781
1761
|
const cache = /* @__PURE__ */ new Map();
|
|
1782
|
-
const mergedOptions = {
|
|
1783
|
-
platform,
|
|
1784
|
-
...options
|
|
1785
|
-
};
|
|
1762
|
+
const mergedOptions = options != null ? options : {};
|
|
1786
1763
|
const platformWithCache = {
|
|
1764
|
+
...platform,
|
|
1787
1765
|
...mergedOptions.platform,
|
|
1788
1766
|
_c: cache
|
|
1789
1767
|
};
|
|
@@ -3280,8 +3258,10 @@ function useClick(context, props) {
|
|
|
3280
3258
|
didKeyDownRef.current = true;
|
|
3281
3259
|
}
|
|
3282
3260
|
if (isAnchorTarget(event)) return;
|
|
3283
|
-
if (event.key === "Enter")
|
|
3284
|
-
|
|
3261
|
+
if (event.key === "Enter") {
|
|
3262
|
+
if (open && toggle) onOpenChange(false, event.nativeEvent, "click");
|
|
3263
|
+
else onOpenChange(true, event.nativeEvent, "click");
|
|
3264
|
+
}
|
|
3285
3265
|
},
|
|
3286
3266
|
onKeyUp(event) {
|
|
3287
3267
|
if (event.defaultPrevented || !keyboardHandlers || isButtonTarget(event) || isSpaceIgnored(domReference)) return;
|
|
@@ -3464,7 +3444,7 @@ function useDismiss(context, props) {
|
|
|
3464
3444
|
return ancestor !== ((_doc$defaultView = doc.defaultView) == null ? void 0 : _doc$defaultView.visualViewport);
|
|
3465
3445
|
});
|
|
3466
3446
|
ancestors.forEach((ancestor) => {
|
|
3467
|
-
ancestor.addEventListener("scroll", onScroll
|
|
3447
|
+
ancestor.addEventListener("scroll", onScroll);
|
|
3468
3448
|
});
|
|
3469
3449
|
return () => {
|
|
3470
3450
|
if (escapeKey) {
|
|
@@ -3599,15 +3579,15 @@ function useFloatingRootContext(options) {
|
|
|
3599
3579
|
* Provides data to position a floating element and context to add interactions.
|
|
3600
3580
|
* @see https://floating-ui.com/docs/useFloating
|
|
3601
3581
|
*/
|
|
3602
|
-
function useFloating(
|
|
3603
|
-
|
|
3582
|
+
function useFloating(_temp) {
|
|
3583
|
+
var _elementsOption$refer, _elementsOption$float;
|
|
3584
|
+
let { elements: elementsOption, ...options } = _temp === void 0 ? {} : _temp;
|
|
3604
3585
|
const { nodeId } = options;
|
|
3605
3586
|
const internalRootContext = useFloatingRootContext({
|
|
3606
3587
|
...options,
|
|
3607
3588
|
elements: {
|
|
3608
|
-
reference: null,
|
|
3609
|
-
floating: null
|
|
3610
|
-
...options.elements
|
|
3589
|
+
reference: (_elementsOption$refer = elementsOption == null ? void 0 : elementsOption.reference) != null ? _elementsOption$refer : null,
|
|
3590
|
+
floating: (_elementsOption$float = elementsOption == null ? void 0 : elementsOption.floating) != null ? _elementsOption$float : null
|
|
3611
3591
|
}
|
|
3612
3592
|
});
|
|
3613
3593
|
const rootContext = options.rootContext || internalRootContext;
|