@procore/core-react 12.36.0 → 12.38.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 +46 -0
- package/dist/AnchorNavigation/AnchorNavigation.styles.js +3 -3
- package/dist/Avatar/Avatar.styles.js +5 -5
- package/dist/AvatarStack/AvatarStack.styles.js +7 -7
- package/dist/Badge/Badge.styles.js +2 -2
- package/dist/BadgePill/BadgePill.styles.js +4 -4
- package/dist/Banner/Banner.d.ts +2 -1
- package/dist/Banner/Banner.js +53 -34
- package/dist/Banner/Banner.js.map +1 -1
- package/dist/Banner/Banner.styles.js +10 -10
- package/dist/Banner/Banner.types.d.ts +6 -0
- package/dist/Banner/Banner.types.js.map +1 -1
- package/dist/Banner/index.d.ts +1 -1
- package/dist/Banner/index.js.map +1 -1
- package/dist/Box/Box.styles.js +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.styles.js +4 -4
- package/dist/Button/Button.js +0 -1
- package/dist/Button/Button.js.map +1 -1
- package/dist/Button/Button.styles.js +5 -5
- package/dist/Calendar/Calendar.styles.js +9 -9
- package/dist/Card/Card.styles.js +1 -1
- package/dist/Checkbox/Checkbox.styles.js +6 -6
- package/dist/Checkbox/CheckboxTooltip.js +1 -1
- package/dist/ContactItem/ContactItem.styles.js +5 -5
- package/dist/Content/Content.styles.js +2 -2
- package/dist/DateInput/DateInput.js +2 -3
- package/dist/DateInput/DateInput.js.map +1 -1
- package/dist/DateInput/DateInput.styles.js +6 -6
- package/dist/DateSelect/DateSelect.js +1 -1
- package/dist/DateSelect/DateSelect.js.map +1 -1
- package/dist/DetailPage/DetailPage.styles.js +7 -7
- package/dist/Dropdown/Dropdown.js +0 -4
- package/dist/Dropdown/Dropdown.js.map +1 -1
- package/dist/Dropdown/Dropdown.styles.js +3 -3
- package/dist/DropdownFlyout/DropdownFlyout.js +8 -3
- package/dist/DropdownFlyout/DropdownFlyout.js.map +1 -1
- package/dist/DropdownFlyout/DropdownFlyout.styles.js +4 -4
- package/dist/DropdownFlyout/DropdownFlyout.types.d.ts +1 -0
- package/dist/DropdownFlyout/DropdownFlyout.types.js.map +1 -1
- package/dist/Dropzone/Dropzone.js +1 -1
- package/dist/Dropzone/Dropzone.styles.js +9 -9
- package/dist/EmptyState/EmptyState.styles.js +6 -6
- package/dist/Field/Field.styles.js +3 -3
- package/dist/FileList/FileList.styles.js +4 -4
- package/dist/FileSelect/FileExplorer/FileExplorer.styles.js +9 -9
- package/dist/FileSelect/FileExplorer/FileExplorerSidebar.js +3 -1
- package/dist/FileSelect/FileExplorer/FileExplorerSidebar.js.map +1 -1
- package/dist/FileSelect/FileExplorer/FileExplorerSidebar.styles.js +3 -3
- package/dist/FileSelect/FileSelect.styles.js +2 -2
- package/dist/FileSelect/FileSelectDropzone/FileSelectDropzone.styles.js +3 -3
- package/dist/FileSelect/FileTokenList/FileTokenList.styles.js +2 -2
- package/dist/FileSelect/GridSource/GridSource.js +2 -1
- package/dist/FileSelect/GridSource/GridSource.js.map +1 -1
- package/dist/FileSelect/GridSource/GridSource.styles.js +6 -6
- package/dist/FileSelect/LocalSource/LocalSource.styles.js +4 -4
- package/dist/FileSelect/SourceItem/SourceItem.js +29 -21
- package/dist/FileSelect/SourceItem/SourceItem.js.map +1 -1
- package/dist/FileSelect/SourceItem/SourceItem.styles.js +3 -3
- package/dist/FileSelect/ThumbnailList/ThumbnailList.styles.js +6 -6
- package/dist/FileSelect/TreeSource/TreeSource.styles.js +1 -1
- package/dist/FileToken/FileToken.styles.js +4 -4
- package/dist/FilterToken/FilterToken.styles.js +5 -5
- package/dist/FlexList/FlexList.styles.js +1 -1
- package/dist/Form/Form.styles.js +14 -14
- package/dist/Form/StyledFormikForm.styles.js +2 -2
- package/dist/Form/stories/util.js +1 -12
- package/dist/Form/stories/util.js.map +1 -1
- package/dist/GhostPlaceholder/GhostPlaceholder.styles.js +2 -2
- package/dist/Grid/Grid.styles.js +2 -2
- package/dist/GroupSelect/GroupSelect.styles.js +1 -1
- package/dist/Input/Input.styles.js +1 -1
- package/dist/Link/Link.styles.js +1 -1
- package/dist/ListPage/ListPage.styles.js +8 -8
- package/dist/Loader/Loader.styles.js +2 -2
- package/dist/MenuImperative/MenuImperative.styles.js +10 -10
- package/dist/Modal/Modal.styles.js +13 -13
- package/dist/MultiSelect/MultiSelect.js +3 -3
- package/dist/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/MultiSelect/MultiSelect.styles.d.ts +7 -4
- package/dist/MultiSelect/MultiSelect.styles.js +18 -10
- package/dist/MultiSelect/MultiSelect.styles.js.map +1 -1
- package/dist/NextMenu/NextMenu.styles.js +3 -3
- package/dist/Notation/Notation.js +1 -1
- package/dist/NumberInput/NumberInput.styles.js +7 -7
- package/dist/Overlay/OverlayArrow.styles.js +1 -1
- package/dist/OverlayTrigger/OverlayTrigger.js +4 -2
- package/dist/OverlayTrigger/OverlayTrigger.js.map +1 -1
- package/dist/OverlayTrigger/OverlayTrigger.types.d.ts +8 -0
- package/dist/OverlayTrigger/OverlayTrigger.types.js.map +1 -1
- package/dist/PageLayout/PageLayout.styles.d.ts +1 -0
- package/dist/PageLayout/PageLayout.styles.js +17 -17
- package/dist/PageLayout/PageLayout.styles.js.map +1 -1
- package/dist/PageTemplate/PageFooterTemplate/PageFooterTemplate.styles.js +1 -1
- package/dist/PageTemplate/PageHeaderTemplate/PageHeaderTemplate.styles.js +3 -3
- package/dist/PageTemplate/PagePaneTemplate/PagePaneTemplate.styles.js +2 -2
- package/dist/PageTemplate/PageTemplate/PageTemplate.styles.js +3 -3
- package/dist/Pagination/Pagination.styles.js +5 -5
- package/dist/Panel/Panel.styles.js +11 -11
- package/dist/Pill/Pill.styles.js +3 -3
- package/dist/PillSelect/PillSelect.styles.js +4 -4
- package/dist/Popover/Popover.js +2 -1
- package/dist/Popover/Popover.js.map +1 -1
- package/dist/Popover/Popover.styles.js +2 -2
- package/dist/Portal/Portal.styles.js +1 -1
- package/dist/ProgressBar/ProgressBar.styles.js +2 -2
- package/dist/RadioButton/RadioButton.styles.js +3 -3
- package/dist/Required/Required.styles.js +3 -3
- package/dist/Search/Search.styles.js +5 -5
- package/dist/Section/Section.styles.js +7 -7
- package/dist/SegmentedController/SegmentedController.js +1 -1
- package/dist/SegmentedController/SegmentedController.js.map +1 -1
- package/dist/SegmentedController/SegmentedController.styles.js +4 -4
- package/dist/Select/Select.js +46 -20
- package/dist/Select/Select.js.map +1 -1
- package/dist/Select/Select.styles.d.ts +5 -1
- package/dist/Select/Select.styles.js +45 -35
- package/dist/Select/Select.styles.js.map +1 -1
- package/dist/Select/Select.types.d.ts +13 -0
- package/dist/Select/Select.types.js.map +1 -1
- package/dist/Semantic/Semantic.styles.d.ts +4 -4
- package/dist/Semantic/Semantic.styles.js +9 -9
- package/dist/Slider/Slider.styles.js +5 -5
- package/dist/Spinner/Spinner.js +21 -6
- package/dist/Spinner/Spinner.js.map +1 -1
- package/dist/Spinner/Spinner.styles.js +7 -7
- package/dist/SplitViewCard/SplitViewCard.styles.js +8 -8
- package/dist/SuperSelect/SuperSelect.components.js +1 -3
- package/dist/SuperSelect/SuperSelect.components.js.map +1 -1
- package/dist/SuperSelect/SuperSelect.presets.styles.js +1 -1
- package/dist/SuperSelect/SuperSelect.styles.js +39 -39
- package/dist/SuperSelect/SuperSelect.styles.js.map +1 -1
- package/dist/SuperSelect/SuperSelect.types.d.ts +1 -0
- package/dist/SuperSelect/SuperSelect.types.js.map +1 -1
- package/dist/SuperSelect/SuperSelect.utils.d.ts +2 -1
- package/dist/SuperSelect/SuperSelect.utils.js +17 -0
- package/dist/SuperSelect/SuperSelect.utils.js.map +1 -1
- package/dist/SuperSelect/useSuperSelect.d.ts +1 -1
- package/dist/SuperSelect/useSuperSelect.js +26 -30
- package/dist/SuperSelect/useSuperSelect.js.map +1 -1
- package/dist/Switch/Switch.styles.js +4 -4
- package/dist/Table/Table.styles.js +62 -59
- package/dist/Table/Table.styles.js.map +1 -1
- package/dist/TableShelf/TableShelf.styles.js +5 -5
- package/dist/Tabs/Tabs.styles.js +15 -15
- package/dist/Tearsheet/Tearsheet.styles.js +5 -5
- package/dist/Tearsheet/storybook/PageLayoutDemo.js +4 -1
- package/dist/Tearsheet/storybook/PageLayoutDemo.js.map +1 -1
- package/dist/TextArea/TextArea.styles.js +1 -1
- package/dist/TextEditorOutput/TextEditorOutput.styles.js +1 -1
- package/dist/Thumbnail/Thumbnail.styles.js +17 -17
- package/dist/ThumbnailGrid/ThumbnailGrid.styles.js +7 -7
- package/dist/TieredSelect/TierSelectionTieredSelect.js +12 -2
- package/dist/TieredSelect/TierSelectionTieredSelect.js.map +1 -1
- package/dist/TieredSelect/TieredSelect.js +18 -5
- package/dist/TieredSelect/TieredSelect.js.map +1 -1
- package/dist/TieredSelect/TieredSelect.styles.js +9 -9
- package/dist/TieredSelect/TieredSelectMenu.js +9 -2
- package/dist/TieredSelect/TieredSelectMenu.js.map +1 -1
- package/dist/Tile/Tile.styles.js +8 -8
- package/dist/Title/Title.styles.js +7 -7
- package/dist/Toast/Toast.styles.js +3 -3
- package/dist/ToggleButton/ToggleButton.styles.js +1 -1
- package/dist/Token/Token.styles.js +3 -3
- package/dist/ToolHeader/ToolHeader.styles.js +6 -6
- package/dist/ToolLandingPage/ToolLandingPage.styles.js +3 -3
- package/dist/Tooltip/Tooltip.styles.js +2 -2
- package/dist/Tooltip/Tooltip.types.d.ts +4 -0
- package/dist/Tooltip/Tooltip.types.js.map +1 -1
- package/dist/Tree/Tree.js +1 -1
- package/dist/Tree/Tree.styles.js +10 -10
- package/dist/Typeahead/Typeahead.styles.js +3 -3
- package/dist/Typography/Typography.styles.js +1 -1
- package/dist/Typography/Typography.table.story.js +2 -2
- package/dist/_hooks/I18n.d.ts +4 -41
- package/dist/_locales/de-DE.json +2 -2
- package/dist/_locales/en-AU.json +1 -1
- package/dist/_locales/en-CA.json +1 -1
- package/dist/_locales/en-GB.json +1 -1
- package/dist/_locales/en.json +3 -1
- package/dist/_locales/es-ES.json +1 -1
- package/dist/_locales/es.json +3 -3
- package/dist/_locales/fr-CA.json +2 -2
- package/dist/_locales/fr-FR.json +4 -4
- package/dist/_locales/is-IS.json +2 -2
- package/dist/_locales/it-IT.json +47 -47
- package/dist/_locales/ja-JP.json +4 -4
- package/dist/_locales/pl-PL.json +1 -1
- package/dist/_locales/pseudo.json +3 -1
- package/dist/_locales/pt-BR.json +4 -4
- package/dist/_locales/pt-PT.json +11 -11
- package/dist/_locales/th-TH.json +4 -4
- package/dist/_locales/zh-SG.json +1 -1
- package/dist/_locales/zh-TW.json +5 -5
- package/dist/_storyHelpers_/components/Deprecation.styles.js +1 -1
- package/dist/_storyHelpers_/components/StoryGrid.js +3 -3
- package/dist/_styles/colors.js +7 -3
- package/dist/_styles/colors.js.map +1 -1
- package/dist/_typedoc/AnchorNavigation/AnchorNavigation.types.json +3 -3
- package/dist/_typedoc/Avatar/Avatar.types.json +20 -20
- package/dist/_typedoc/AvatarStack/AvatarStack.types.json +24 -24
- package/dist/_typedoc/Badge/Badge.types.json +6 -6
- package/dist/_typedoc/Banner/Banner.types.json +39 -13
- package/dist/_typedoc/Box/Box.types.json +68 -68
- package/dist/_typedoc/Breadcrumbs/Breadcrumbs.types.json +10 -10
- package/dist/_typedoc/Button/Button.types.json +13 -13
- package/dist/_typedoc/Calendar/Calendar.types.json +80 -80
- package/dist/_typedoc/Card/Card.types.json +6 -6
- package/dist/_typedoc/Checkbox/Checkbox.types.json +8 -8
- package/dist/_typedoc/ContactItem/ContactItem.types.json +9 -9
- package/dist/_typedoc/DateInput/DateInput.types.json +35 -35
- package/dist/_typedoc/DateSelect/DateSelect.types.json +13 -13
- package/dist/_typedoc/DetailPage/DetailPage.types.json +5 -5
- package/dist/_typedoc/Dropdown/Dropdown.types.json +37 -37
- package/dist/_typedoc/DropdownFlyout/DropdownFlyout.types.json +40 -30
- package/dist/_typedoc/Dropzone/Dropzone.types.json +44 -44
- package/dist/_typedoc/EmptyState/EmptyState.types.json +16 -16
- package/dist/_typedoc/FileList/FileList.types.json +9 -9
- package/dist/_typedoc/FileSelect/FileSelect.types.json +27 -27
- package/dist/_typedoc/FileSelect/GridSource/GridSource.types.json +20 -20
- package/dist/_typedoc/FileSelect/LocalSource/LocalSource.types.json +14 -14
- package/dist/_typedoc/FileSelect/TreeSource/TreeSource.types.json +9 -9
- package/dist/_typedoc/Flex/Flex.types.json +27 -27
- package/dist/_typedoc/FlexList/FlexList.types.json +30 -30
- package/dist/_typedoc/Form/Form.types.json +750 -750
- package/dist/_typedoc/GhostPlaceholder/GhostPlaceholder.types.json +12 -12
- package/dist/_typedoc/Grid/Grid.types.json +8 -8
- package/dist/_typedoc/GroupSelect/GroupSelect.types.json +52 -52
- package/dist/_typedoc/Input/Input.types.json +2 -2
- package/dist/_typedoc/Link/Link.types.json +1 -1
- package/dist/_typedoc/ListPage/ListPage.types.json +13 -13
- package/dist/_typedoc/Menu/Menu.types.json +62 -62
- package/dist/_typedoc/MenuImperative/MenuImperative.types.json +77 -77
- package/dist/_typedoc/Modal/Modal.types.json +46 -46
- package/dist/_typedoc/MultiSelect/MultiSelect.types.json +31 -31
- package/dist/_typedoc/NextTile/NextTile.types.json +32 -32
- package/dist/_typedoc/Notation/Notation.types.json +4 -4
- package/dist/_typedoc/NumberInput/NumberInput.types.json +48 -48
- package/dist/_typedoc/OverlayTrigger/OverlayTrigger.types.json +42 -32
- package/dist/_typedoc/PageLayout/PageLayout.types.json +26 -26
- package/dist/_typedoc/Pagination/Pagination.types.json +7 -7
- package/dist/_typedoc/Panel/Panel.types.json +30 -30
- package/dist/_typedoc/Pill/Pill.types.json +2 -2
- package/dist/_typedoc/PillSelect/PillSelect.types.json +49 -49
- package/dist/_typedoc/Popover/Popover.types.json +15 -15
- package/dist/_typedoc/ProgressBar/ProgressBar.types.json +7 -7
- package/dist/_typedoc/RadioButton/RadioButton.types.json +6 -6
- package/dist/_typedoc/Required/Required.types.json +5 -5
- package/dist/_typedoc/Search/Search.types.json +18 -18
- package/dist/_typedoc/Section/Section.types.json +15 -15
- package/dist/_typedoc/SegmentedController/SegmentedController.types.json +21 -21
- package/dist/_typedoc/Select/Select.types.json +95 -60
- package/dist/_typedoc/SettingsPage/SettingsPage.types.json +10 -10
- package/dist/_typedoc/Slider/Slider.types.json +6 -6
- package/dist/_typedoc/Spinner/Spinner.types.json +9 -9
- package/dist/_typedoc/SplitViewCard/SplitViewCard.types.json +14 -14
- package/dist/_typedoc/Table/Table.types.json +102 -102
- package/dist/_typedoc/Tabs/Tabs.types.json +20 -20
- package/dist/_typedoc/Tearsheet/Tearsheet.types.json +17 -17
- package/dist/_typedoc/TextArea/TextArea.types.json +3 -3
- package/dist/_typedoc/TextEditor/TextEditor.types.json +11 -11
- package/dist/_typedoc/TextEditorOutput/TextEditorOutput.types.json +4 -4
- package/dist/_typedoc/Thumbnail/Thumbnail.types.json +19 -19
- package/dist/_typedoc/TieredDropdown/TieredDropdown.types.json +43 -43
- package/dist/_typedoc/TieredSelect/TieredSelect.types.json +29 -29
- package/dist/_typedoc/Tile/Tile.types.json +8 -8
- package/dist/_typedoc/Title/Title.types.json +1 -1
- package/dist/_typedoc/Toast/Toast.types.json +4 -4
- package/dist/_typedoc/ToggleButton/ToggleButton.types.json +4 -4
- package/dist/_typedoc/Token/Token.types.json +7 -7
- package/dist/_typedoc/ToolHeader/ToolHeader.types.json +10 -10
- package/dist/_typedoc/ToolLandingPage/ToolLandingPage.types.json +8 -8
- package/dist/_typedoc/Tooltip/Tooltip.types.json +23 -13
- package/dist/_typedoc/Tree/Tree.types.json +88 -88
- package/dist/_typedoc/Typeahead/Typeahead.types.json +2 -2
- package/dist/_typedoc/Typography/Typography.types.json +9 -9
- package/dist/_typedoc/_utils/types.json +3 -3
- package/dist/_utils/storybookTooltip.d.ts +2 -0
- package/dist/_utils/storybookTooltip.js +12 -0
- package/dist/_utils/storybookTooltip.js.map +1 -0
- package/dist/_utils/triggerListeners.js +2 -2
- package/dist/_utils/triggerListeners.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.js","names":["React","OverlayTrigger","addSubcomponents","isReactElement","StyledPopover","StyledPopoverContent","Content","forwardRef","_ref","ref","children","_ref$block","block","_ref$fluid","fluid","_ref$placement","placement","props","_objectWithoutProperties","_excluded","createElement","_extends","$block","$fluid","$placement","PopoverInner","_ref2","_ref2$initialIsVisibl","initialIsVisible","_ref2$restoreFocusOnH","restoreFocusOnHide","_ref2$placement","overlay","overlayRef","role","_excluded2","overlayNode","cloneElement","Fragment","_objectSpread","shrinkOverlay","arrow","Popover_","displayName","Popover"],"sources":["../../src/Popover/Popover.tsx"],"sourcesContent":["import React from 'react'\nimport { OverlayTrigger } from '../OverlayTrigger/OverlayTrigger'\nimport { addSubcomponents } from '../_utils/addSubcomponents'\nimport { isReactElement } from '../_utils/isReactElement'\nimport { StyledPopover, StyledPopoverContent } from './Popover.styles'\nimport type {\n PopoverContentProps,\n PopoverProps,\n PopoverRole,\n} from './Popover.types'\n\nconst Content = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & PopoverContentProps\n>(function Content(\n { children, block = false, fluid = false, placement = 'top', ...props },\n ref\n) {\n return (\n <StyledPopover ref={ref}>\n <StyledPopoverContent\n {...props}\n $block={block}\n $fluid={fluid}\n $placement={placement}\n >\n {children}\n </StyledPopoverContent>\n </StyledPopover>\n )\n})\n\nfunction PopoverInner<Role extends PopoverRole>(\n {\n children,\n initialIsVisible = false,\n restoreFocusOnHide = false,\n placement = 'top',\n overlay,\n overlayRef,\n role,\n ...props\n }: PopoverProps<Role>,\n ref: React.ForwardedRef<HTMLElement>\n) {\n const overlayNode = isReactElement(overlay) ? (\n React.cloneElement(overlay, { placement })\n ) : (\n <React.Fragment />\n )\n\n return (\n <OverlayTrigger\n {...{\n ...props,\n initialIsVisible,\n overlay: overlayNode,\n placement,\n role,\n ref,\n restoreFocusOnHide,\n shrinkOverlay: true,\n arrow: true,\n overlayRef,\n }}\n >\n {children}\n </OverlayTrigger>\n )\n}\n\nconst Popover_ = React.forwardRef(PopoverInner) as <Role extends PopoverRole>(\n props: PopoverProps<Role>\n) => ReturnType<typeof PopoverInner>\n\n// @ts-expect-error\nPopover_.displayName = 'Popover'\n\nContent.displayName = 'Popover.Content'\n\n/**\n\n We use popovers to display more of an item’s information or details on hover.\n This may be used to show additional fields in an item’s form that aren’t shown\n by default in the UI. Oftentimes, there will be a visual queue to indicate that\n more information is available.\n\n Do not use popovers to display large amounts of information, perform data\n entry, or use as a replacement for an overflow, menu, or modal.\n\n If you want to show descriptive / educational information about an item,\n use a tooltip.\n\n @since 10.19.0\n\n @see [Storybook](https://stories.core.procore.com/?path=/story/core-react_demos-popover--demo)\n\n @see [Design Guidelines](https://design.procore.com/popover)\n\n*/\nexport const Popover = addSubcomponents({ Content }, Popover_)\n"],"mappings":";;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,QAAQ,kCAAkC;AACjE,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,aAAa,EAAEC,oBAAoB,QAAQ,kBAAkB;AAOtE,IAAMC,OAAO,gBAAGN,KAAK,CAACO,UAAU,CAG9B,SAASD,OAAOA,CAAAE,IAAA,EAEhBC,GAAG,EACH;EAAA,IAFEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAAC,UAAA,GAAAH,IAAA,CAAEI,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAG,KAAK,GAAAA,UAAA;IAAAE,UAAA,GAAAL,IAAA,CAAEM,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAG,KAAK,GAAAA,UAAA;IAAAE,cAAA,GAAAP,IAAA,CAAEQ,SAAS;IAATA,SAAS,GAAAD,cAAA,cAAG,KAAK,GAAAA,cAAA;IAAKE,KAAK,GAAAC,wBAAA,CAAAV,IAAA,EAAAW,SAAA;EAGrE,oBACEnB,KAAA,CAAAoB,aAAA,CAACh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B,kBAAkB,EAAlBA,kBAAkB;IAClBU,aAAa,EAAE,IAAI;IACnBC,KAAK,EAAE,IAAI;IACXR,UAAU,EAAVA;
|
|
1
|
+
{"version":3,"file":"Popover.js","names":["React","OverlayTrigger","addSubcomponents","isReactElement","StyledPopover","StyledPopoverContent","Content","forwardRef","_ref","ref","children","_ref$block","block","_ref$fluid","fluid","_ref$placement","placement","props","_objectWithoutProperties","_excluded","createElement","_extends","$block","$fluid","$placement","PopoverInner","_ref2","_ref2$initialIsVisibl","initialIsVisible","_ref2$restoreFocusOnH","restoreFocusOnHide","_ref2$placement","overlay","overlayRef","role","_excluded2","overlayNode","cloneElement","Fragment","_objectSpread","shrinkOverlay","arrow","trackAriaExpanded","Popover_","displayName","Popover"],"sources":["../../src/Popover/Popover.tsx"],"sourcesContent":["import React from 'react'\nimport { OverlayTrigger } from '../OverlayTrigger/OverlayTrigger'\nimport { addSubcomponents } from '../_utils/addSubcomponents'\nimport { isReactElement } from '../_utils/isReactElement'\nimport { StyledPopover, StyledPopoverContent } from './Popover.styles'\nimport type {\n PopoverContentProps,\n PopoverProps,\n PopoverRole,\n} from './Popover.types'\n\nconst Content = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & PopoverContentProps\n>(function Content(\n { children, block = false, fluid = false, placement = 'top', ...props },\n ref\n) {\n return (\n <StyledPopover ref={ref}>\n <StyledPopoverContent\n {...props}\n $block={block}\n $fluid={fluid}\n $placement={placement}\n >\n {children}\n </StyledPopoverContent>\n </StyledPopover>\n )\n})\n\nfunction PopoverInner<Role extends PopoverRole>(\n {\n children,\n initialIsVisible = false,\n restoreFocusOnHide = false,\n placement = 'top',\n overlay,\n overlayRef,\n role,\n ...props\n }: PopoverProps<Role>,\n ref: React.ForwardedRef<HTMLElement>\n) {\n const overlayNode = isReactElement(overlay) ? (\n React.cloneElement(overlay, { placement })\n ) : (\n <React.Fragment />\n )\n\n return (\n <OverlayTrigger\n {...{\n ...props,\n initialIsVisible,\n overlay: overlayNode,\n placement,\n role,\n ref,\n restoreFocusOnHide,\n shrinkOverlay: true,\n arrow: true,\n overlayRef,\n trackAriaExpanded: true,\n }}\n >\n {children}\n </OverlayTrigger>\n )\n}\n\nconst Popover_ = React.forwardRef(PopoverInner) as <Role extends PopoverRole>(\n props: PopoverProps<Role>\n) => ReturnType<typeof PopoverInner>\n\n// @ts-expect-error\nPopover_.displayName = 'Popover'\n\nContent.displayName = 'Popover.Content'\n\n/**\n\n We use popovers to display more of an item’s information or details on hover.\n This may be used to show additional fields in an item’s form that aren’t shown\n by default in the UI. Oftentimes, there will be a visual queue to indicate that\n more information is available.\n\n Do not use popovers to display large amounts of information, perform data\n entry, or use as a replacement for an overflow, menu, or modal.\n\n If you want to show descriptive / educational information about an item,\n use a tooltip.\n\n @since 10.19.0\n\n @see [Storybook](https://stories.core.procore.com/?path=/story/core-react_demos-popover--demo)\n\n @see [Design Guidelines](https://design.procore.com/popover)\n\n*/\nexport const Popover = addSubcomponents({ Content }, Popover_)\n"],"mappings":";;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,QAAQ,kCAAkC;AACjE,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,aAAa,EAAEC,oBAAoB,QAAQ,kBAAkB;AAOtE,IAAMC,OAAO,gBAAGN,KAAK,CAACO,UAAU,CAG9B,SAASD,OAAOA,CAAAE,IAAA,EAEhBC,GAAG,EACH;EAAA,IAFEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAAC,UAAA,GAAAH,IAAA,CAAEI,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAG,KAAK,GAAAA,UAAA;IAAAE,UAAA,GAAAL,IAAA,CAAEM,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAG,KAAK,GAAAA,UAAA;IAAAE,cAAA,GAAAP,IAAA,CAAEQ,SAAS;IAATA,SAAS,GAAAD,cAAA,cAAG,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gB;IAChBI,OAAO,EAAEI,WAAW;IACpBpB,SAAS,EAATA,SAAS;IACTkB,IAAI,EAAJA,IAAI;IACJzB,GAAG,EAAHA,GAAG;IACHqB,kBAAkB,EAAlBA,kBAAkB;IAClBU,aAAa,EAAE,IAAI;IACnBC,KAAK,EAAE,IAAI;IACXR,UAAU,EAAVA,UAAU;IACVS,iBAAiB,EAAE;EAAI,IAGxBhC,QACa,CAAC;AAErB;AAEA,IAAMiC,QAAQ,gBAAG3C,KAAK,CAACO,UAAU,CAACkB,YAAY,CAEV;;AAEpC;AACAkB,QAAQ,CAACC,WAAW,GAAG,SAAS;AAEhCtC,OAAO,CAACsC,WAAW,GAAG,iBAAiB;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,OAAO,GAAG3C,gBAAgB,CAAC;EAAEI,OAAO,EAAPA;AAAQ,CAAC,EAAEqC,QAAQ,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { getShadow } from '../_styles/shadows';
|
|
|
5
5
|
export var popoverArrowSize = 6;
|
|
6
6
|
export var StyledPopoverContent = /*#__PURE__*/styled.span.withConfig({
|
|
7
7
|
displayName: "StyledPopoverContent",
|
|
8
|
-
componentId: "core-
|
|
8
|
+
componentId: "core-12_38_0__sc-1cd0ihn-0"
|
|
9
9
|
})(["background-color:", ";border-radius:inherit;color:", ";display:inline-block;max-width:250px;position:relative;", ""], colors.white, colors.gray15, function (_ref) {
|
|
10
10
|
var $block = _ref.$block,
|
|
11
11
|
$fluid = _ref.$fluid;
|
|
@@ -15,6 +15,6 @@ export var StyledPopoverContent = /*#__PURE__*/styled.span.withConfig({
|
|
|
15
15
|
});
|
|
16
16
|
export var StyledPopover = /*#__PURE__*/styled.div.withConfig({
|
|
17
17
|
displayName: "StyledPopover",
|
|
18
|
-
componentId: "core-
|
|
18
|
+
componentId: "core-12_38_0__sc-1cd0ihn-1"
|
|
19
19
|
})(["display:inline-block;border-radius:", "px;", " & + [data-overlay-arrow]{background:", ";}"], borderRadius.md, getShadow(3), colors.white);
|
|
20
20
|
//# sourceMappingURL=Popover.styles.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
export var StyledPortal = /*#__PURE__*/styled.div.withConfig({
|
|
3
3
|
displayName: "StyledPortal",
|
|
4
|
-
componentId: "core-
|
|
4
|
+
componentId: "core-12_38_0__sc-15o1h2-0"
|
|
5
5
|
})(["left:0;pointer-events:none;position:fixed;top:0;> *{pointer-events:all;}"]);
|
|
6
6
|
//# sourceMappingURL=Portal.styles.js.map
|
|
@@ -7,11 +7,11 @@ var animationDelay = '300ms';
|
|
|
7
7
|
var fadeIn = /*#__PURE__*/keyframes(["from{opacity:1;}to{opacity:0;}"]);
|
|
8
8
|
export var StyledProgressBarLoader = /*#__PURE__*/styled(Loader).withConfig({
|
|
9
9
|
displayName: "StyledProgressBarLoader",
|
|
10
|
-
componentId: "core-
|
|
10
|
+
componentId: "core-12_38_0__sc-vdy2wl-0"
|
|
11
11
|
})([""]);
|
|
12
12
|
export var StyledProgressBar = /*#__PURE__*/styled.div.withConfig({
|
|
13
13
|
displayName: "StyledProgressBar",
|
|
14
|
-
componentId: "core-
|
|
14
|
+
componentId: "core-12_38_0__sc-vdy2wl-1"
|
|
15
15
|
})(["overflow:hidden;position:relative;display:block;height:", "px;background-color:", ";border-radius:", "px;margin:", "px 0;transition:background-color 0s linear;", " ", ""], loaderGridUnit, function (_ref) {
|
|
16
16
|
var $complete = _ref.$complete;
|
|
17
17
|
return $complete ? colors.blue50 : colors.gray94;
|
|
@@ -9,7 +9,7 @@ export var dataQa = {
|
|
|
9
9
|
var radioButtonSize = 20;
|
|
10
10
|
export var StyledRadioButton = /*#__PURE__*/styled.label.withConfig({
|
|
11
11
|
displayName: "StyledRadioButton",
|
|
12
|
-
componentId: "core-
|
|
12
|
+
componentId: "core-12_38_0__sc-nd95zs-0"
|
|
13
13
|
})(["color:", ";display:flex;position:relative;vertical-align:middle;& + &{margin-top:", "px;}", " ", ""], colors.gray15, spacing.md, function (_ref) {
|
|
14
14
|
var $error = _ref.$error;
|
|
15
15
|
return $error && css(["", ":before,", ":checked:not(:disabled) + ", ":before{border-color:", ";}", ":checked:disabled + ", ":before{border-color:", ";}"], StyledRadioButtonLabel, StyledRadioButtonInput, StyledRadioButtonLabel, colors.red50, StyledRadioButtonInput, StyledRadioButtonLabel, colors.gray85);
|
|
@@ -19,10 +19,10 @@ export var StyledRadioButton = /*#__PURE__*/styled.label.withConfig({
|
|
|
19
19
|
});
|
|
20
20
|
export var StyledRadioButtonLabel = /*#__PURE__*/styled.span.withConfig({
|
|
21
21
|
displayName: "StyledRadioButtonLabel",
|
|
22
|
-
componentId: "core-
|
|
22
|
+
componentId: "core-12_38_0__sc-nd95zs-1"
|
|
23
23
|
})(["", ";cursor:default;display:flex;&:before{background:", ";border-radius:100%;border:2px solid ", ";content:'';display:inline-block;flex:0;height:", "px;min-width:", "px;width:", "px;}"], getTypographyIntent('body'), colors.white, colors.gray50, radioButtonSize, radioButtonSize, radioButtonSize);
|
|
24
24
|
export var StyledRadioButtonInput = /*#__PURE__*/styled.input.withConfig({
|
|
25
25
|
displayName: "StyledRadioButtonInput",
|
|
26
|
-
componentId: "core-
|
|
26
|
+
componentId: "core-12_38_0__sc-nd95zs-2"
|
|
27
27
|
})(["left:0;margin:0;opacity:0;padding:0;position:absolute;top:0;&:focus:not(:checked),&[data-qa=", "]:not(:checked){&:not(:disabled) + ", ":before{", "}}&:focus:checked:not(:disabled),&[data-qa=", "]:checked:not(:disabled){+ ", ":before{box-shadow:0 0 0 2px ", ";}}&:checked + ", ":before{border:6px solid ", ";}&:disabled + ", ":before{border-color:", ";}&:disabled:checked + ", ":before{border-color:", ";}"], dataQa.focused, StyledRadioButtonLabel, getFocus(), dataQa.focused, StyledRadioButtonLabel, colors.blue40, StyledRadioButtonLabel, colors.blue50, StyledRadioButtonLabel, colors.gray85, StyledRadioButtonLabel, colors.blue85);
|
|
28
28
|
//# sourceMappingURL=RadioButton.styles.js.map
|
|
@@ -5,7 +5,7 @@ import { colors } from '../_styles/colors';
|
|
|
5
5
|
import { spacing } from '../_styles/spacing';
|
|
6
6
|
export var StyledRequiredMark = /*#__PURE__*/styled.span.withConfig({
|
|
7
7
|
displayName: "StyledRequiredMark",
|
|
8
|
-
componentId: "core-
|
|
8
|
+
componentId: "core-12_38_0__sc-bja1ql-0"
|
|
9
9
|
})(["color:", ";", ""], colors.red50, function (_ref) {
|
|
10
10
|
var $showLabel = _ref.$showLabel;
|
|
11
11
|
if ($showLabel) {
|
|
@@ -15,10 +15,10 @@ export var StyledRequiredMark = /*#__PURE__*/styled.span.withConfig({
|
|
|
15
15
|
});
|
|
16
16
|
export var StyledRequiredContainer = /*#__PURE__*/styled.span.withConfig({
|
|
17
17
|
displayName: "StyledRequiredContainer",
|
|
18
|
-
componentId: "core-
|
|
18
|
+
componentId: "core-12_38_0__sc-bja1ql-1"
|
|
19
19
|
})(["", " ", " > &{margin-left:", "px;}"], getTypographyIntent('small'), StyledCheckboxLabel, spacing.xs);
|
|
20
20
|
export var StyledRequiredText = /*#__PURE__*/styled.span.withConfig({
|
|
21
21
|
displayName: "StyledRequiredText",
|
|
22
|
-
componentId: "core-
|
|
22
|
+
componentId: "core-12_38_0__sc-bja1ql-2"
|
|
23
23
|
})(["font-style:italic;color:", ";margin-left:4px;"], colors.gray45);
|
|
24
24
|
//# sourceMappingURL=Required.styles.js.map
|
|
@@ -33,22 +33,22 @@ export function getSearchInputStyles() {
|
|
|
33
33
|
}
|
|
34
34
|
export var StyledInput = /*#__PURE__*/styled.input.withConfig({
|
|
35
35
|
displayName: "StyledInput",
|
|
36
|
-
componentId: "core-
|
|
36
|
+
componentId: "core-12_38_0__sc-3j8khv-0"
|
|
37
37
|
})(["", ""], getSearchInputStyles);
|
|
38
38
|
var StyledButton = /*#__PURE__*/styled(Button).withConfig({
|
|
39
39
|
displayName: "StyledButton",
|
|
40
|
-
componentId: "core-
|
|
40
|
+
componentId: "core-12_38_0__sc-3j8khv-1"
|
|
41
41
|
})(["position:absolute;top:", "px;"], buttonTop);
|
|
42
42
|
export var StyledSearchButton = /*#__PURE__*/styled(StyledButton).withConfig({
|
|
43
43
|
displayName: "StyledSearchButton",
|
|
44
|
-
componentId: "core-
|
|
44
|
+
componentId: "core-12_38_0__sc-3j8khv-2"
|
|
45
45
|
})([""]);
|
|
46
46
|
export var StyledClearButton = /*#__PURE__*/styled(StyledButton).withConfig({
|
|
47
47
|
displayName: "StyledClearButton",
|
|
48
|
-
componentId: "core-
|
|
48
|
+
componentId: "core-12_38_0__sc-3j8khv-3"
|
|
49
49
|
})([""]);
|
|
50
50
|
export var StyledSearch = /*#__PURE__*/styled.div.withConfig({
|
|
51
51
|
displayName: "StyledSearch",
|
|
52
|
-
componentId: "core-
|
|
52
|
+
componentId: "core-12_38_0__sc-3j8khv-4"
|
|
53
53
|
})(["position:relative;width:100%;", "{padding-right:", "px;}", "{right:", "px;}", "{right:", "px;}"], StyledInput, inputRight, StyledSearchButton, searchRight, StyledClearButton, clearRight);
|
|
54
54
|
//# sourceMappingURL=Search.styles.js.map
|
|
@@ -6,15 +6,15 @@ import { getFocus } from '../_styles/mixins';
|
|
|
6
6
|
import { spacing } from '../_styles/spacing';
|
|
7
7
|
export var StyledSectionBanner = /*#__PURE__*/styled.div.withConfig({
|
|
8
8
|
displayName: "StyledSectionBanner",
|
|
9
|
-
componentId: "core-
|
|
9
|
+
componentId: "core-12_38_0__sc-1lxbrwv-0"
|
|
10
10
|
})(["margin-bottom:", "px;> * + *{margin-top:", "px;}"], spacing.sm, spacing.sm);
|
|
11
11
|
export var StyledSectionInner = /*#__PURE__*/styled.div.withConfig({
|
|
12
12
|
displayName: "StyledSectionInner",
|
|
13
|
-
componentId: "core-
|
|
13
|
+
componentId: "core-12_38_0__sc-1lxbrwv-1"
|
|
14
14
|
})([""]);
|
|
15
15
|
export var StyledSectionCollapseHeading = /*#__PURE__*/styled.div.withConfig({
|
|
16
16
|
displayName: "StyledSectionCollapseHeading",
|
|
17
|
-
componentId: "core-
|
|
17
|
+
componentId: "core-12_38_0__sc-1lxbrwv-2"
|
|
18
18
|
})(["align-self:flex-start;margin-right:", "px;"], spacing.sm);
|
|
19
19
|
export var sectionClassnames = {
|
|
20
20
|
divide: 'section--divide',
|
|
@@ -25,11 +25,11 @@ export var sectionClassnames = {
|
|
|
25
25
|
};
|
|
26
26
|
export var StyledSection = /*#__PURE__*/styled.div.withConfig({
|
|
27
27
|
displayName: "StyledSection",
|
|
28
|
-
componentId: "core-
|
|
28
|
+
componentId: "core-12_38_0__sc-1lxbrwv-3"
|
|
29
29
|
})(["padding-left:", "px;padding-right:", "px;padding-bottom:", "px;& > ", "{padding-top:", "px;}&.", "{& > ", "{border-top:1px solid ", ";}}&:first-child > ", "{border-top:0;}& &{padding-left:0;padding-right:0;&:first-child > ", "{border-top:1px solid ", ";}&:last-child{padding-bottom:0;}}", ":last-of-type{margin-bottom:", "px;}", " + &&&{padding-top:", "px;}"], spacing.lg, spacing.lg, spacing.lg, StyledSectionInner, spacing.lg, sectionClassnames.divide, StyledSectionInner, colors.gray85, StyledSectionInner, StyledSectionInner, colors.gray85, StyledFormRow, spacing.lg * -1, StyledFormRow, spacing.xs);
|
|
30
30
|
export var StyledSectionContentRegion = /*#__PURE__*/styled.div.withConfig({
|
|
31
31
|
displayName: "StyledSectionContentRegion",
|
|
32
|
-
componentId: "core-
|
|
32
|
+
componentId: "core-12_38_0__sc-1lxbrwv-4"
|
|
33
33
|
})(["padding-top:", "px;&:focus-visible{", "}", " ", " & > :not(", ") + ", "{padding-top:", "px;}", " ", " &:last-of-type{padding-bottom:0;}"], spacing.sm, getFocus(), function (_ref) {
|
|
34
34
|
var $closed = _ref.$closed;
|
|
35
35
|
return $closed && css(["padding-top:0;"]);
|
|
@@ -39,10 +39,10 @@ export var StyledSectionContentRegion = /*#__PURE__*/styled.div.withConfig({
|
|
|
39
39
|
}, StyledSection, StyledSection, spacing.xl, StyledSection, StyledSection);
|
|
40
40
|
export var StyledSectionHeader = /*#__PURE__*/styled.div.withConfig({
|
|
41
41
|
displayName: "StyledSectionHeader",
|
|
42
|
-
componentId: "core-
|
|
42
|
+
componentId: "core-12_38_0__sc-1lxbrwv-5"
|
|
43
43
|
})(["align-items:center;display:flex;min-height:36px;word-break:break-word;"]);
|
|
44
44
|
export var StyledTitle = /*#__PURE__*/styled(Title).withConfig({
|
|
45
45
|
displayName: "StyledTitle",
|
|
46
|
-
componentId: "core-
|
|
46
|
+
componentId: "core-12_38_0__sc-1lxbrwv-6"
|
|
47
47
|
})(["width:100%;"]);
|
|
48
48
|
//# sourceMappingURL=Section.styles.js.map
|
|
@@ -236,7 +236,7 @@ export var Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(_ref7, ref)
|
|
|
236
236
|
return overlay ? /*#__PURE__*/React.createElement(TooltipBase, _extends({}, props, {
|
|
237
237
|
overlay: overlay,
|
|
238
238
|
ref: ref,
|
|
239
|
-
trigger:
|
|
239
|
+
trigger: ['hover', 'focus']
|
|
240
240
|
}), children) : /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
241
241
|
});
|
|
242
242
|
var withState = function withState(config) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedController.js","names":["useFocusRing","useRadio","useRadioGroup","mergeProps","useId","VisuallyHidden","React","useRadioGroupState","Tooltip","TooltipBase","addSubcomponents","StyledContainer","StyledLabel","StyledSegment","StyledSegmentDisabledInteractiveWrapper","isSegment","node","isValidElement","type","Segment","determineSelectedState","_ref","active","selected","isSelected","undefined","RadioButtonContext","createContext","SegmentedController_","forwardRef","SegmentedController","_ref2","ref","ariaLabel","ariaLabelledby","children","_ref2$block","block","disabled","onChange","props","_objectWithoutProperties","_excluded","name","radioGroupState","isDisabled","rawValue","num","Number","value","isNaN","_useRadioGroup","orientation","radioGroupProps","createElement","_extends","$block","Provider","Children","toArray","filter","child","map","index","cloneElement","internalIndex","SegmentWithGroup","_ref3","_ref3$placement","placement","tooltip","state","_excluded2","adjustedValue","String","innerRef","useRef","actualRef","_useRadio","inputProps","_useFocusRing","focusProps","isFocusVisible","useEffect","setSelectedValue","overlay","$focused","$disabled","$selected","StandaloneSegment","_ref4","_ref5","_ref6","_ref4$placement","_excluded3","_useFocusRing2","isControlled","_React$useState","useState","_React$useState2","_slicedToArray","uncontrolledSelected","setUncontrolledSelected","handleChange","e","_props$onChange","target","checked","call","useContext","_ref7","_excluded4","trigger","Fragment","withState","config","Component","_React$useState3","_React$useState4","selectedIndex","setSelected","_objectSpread","State","_ref8","_excluded5","displayName"],"sources":["../../src/SegmentedController/SegmentedController.tsx"],"sourcesContent":["import { useFocusRing } from '@react-aria/focus'\nimport { useRadio, useRadioGroup } from '@react-aria/radio'\nimport { mergeProps, useId } from '@react-aria/utils'\nimport { VisuallyHidden } from '@react-aria/visually-hidden'\nimport React from 'react'\nimport type { RadioGroupState } from 'react-stately'\nimport { useRadioGroupState } from 'react-stately'\nimport { Tooltip as TooltipBase } from '../Tooltip/Tooltip'\nimport { addSubcomponents } from '../_utils/addSubcomponents'\nimport {\n StyledContainer,\n StyledLabel,\n StyledSegment,\n StyledSegmentDisabledInteractiveWrapper,\n} from './SegmentedController.styles'\nimport type {\n SegmentedControllerProps,\n SegmentedControllerSegmentProps,\n SegmentedControllerTooltipProps,\n} from './SegmentedController.types'\n\nfunction isSegment(\n node: unknown\n): node is React.ReactElement<HTMLInputElement> {\n return (\n React.isValidElement(node as React.ReactElement) &&\n (node as React.ReactElement).type === Segment\n )\n}\n\nexport function determineSelectedState({\n active,\n selected,\n isSelected,\n}: {\n active?: boolean\n isSelected: boolean\n selected?: boolean\n}): boolean {\n // Selected is a prop, so it should be the source of truth\n if (selected !== undefined) {\n return selected\n }\n // Active is a prop, so it should be the source of truth\n if (active !== undefined) {\n return active\n }\n // If neither props are passed in, use the react-stately state\n return isSelected\n}\n\nconst RadioButtonContext = React.createContext<RadioGroupState | null>(null)\n\nconst SegmentedController_ = React.forwardRef<\n HTMLDivElement,\n SegmentedControllerProps\n>(function SegmentedController(\n {\n // TODO make label props required in type?\n // React Aria logs warnings without 1 of 2. Axe does not fail\n ['aria-label']: ariaLabel,\n ['aria-labelledby']: ariaLabelledby,\n children,\n block = false,\n disabled,\n onChange,\n ...props\n },\n ref\n) {\n const name = useId()\n const radioGroupState = useRadioGroupState({\n name,\n isDisabled: disabled,\n onChange: (rawValue) => {\n const num = Number(rawValue)\n const value = !isNaN(num) ? num : rawValue\n onChange?.(value as number)\n },\n })\n const { radioGroupProps } = useRadioGroup(\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n orientation: 'horizontal',\n },\n radioGroupState\n )\n return (\n <StyledContainer ref={ref} $block={block} {...radioGroupProps} {...props}>\n <RadioButtonContext.Provider value={radioGroupState}>\n {React.Children.toArray(children)\n .filter((child) => isSegment(child))\n .map((child, index) =>\n React.cloneElement(child as React.ReactElement, {\n internalIndex: index,\n })\n )}\n </RadioButtonContext.Provider>\n </StyledContainer>\n )\n})\n\n// Segment with RadioGroup context\nconst SegmentWithGroup = React.forwardRef<\n HTMLInputElement,\n React.InputHTMLAttributes<HTMLInputElement> &\n SegmentedControllerSegmentProps & { state: RadioGroupState }\n>(function SegmentWithGroup(\n {\n active,\n children,\n placement = 'top',\n tooltip,\n disabled,\n value,\n internalIndex,\n selected,\n state,\n ...props\n },\n ref\n) {\n const adjustedValue = String(value ?? internalIndex)\n const innerRef = React.useRef<HTMLInputElement>(null)\n const actualRef = ref ?? innerRef\n\n const { inputProps, isSelected, isDisabled } = useRadio(\n {\n isDisabled: disabled ?? state.isDisabled,\n value: adjustedValue as string,\n children,\n },\n state,\n actualRef as unknown as React.RefObject<HTMLInputElement>\n )\n const { focusProps, isFocusVisible } = useFocusRing()\n\n React.useEffect(() => {\n if (active || selected) {\n state.setSelectedValue(adjustedValue)\n }\n }, [active, state, adjustedValue, selected])\n\n return (\n <Tooltip overlay={tooltip} placement={placement}>\n <StyledSegmentDisabledInteractiveWrapper>\n <StyledSegment\n $focused={isFocusVisible}\n $disabled={isDisabled}\n $selected={determineSelectedState({ active, selected, isSelected })}\n >\n <VisuallyHidden>\n <input\n {...mergeProps(props, inputProps, focusProps)}\n ref={actualRef}\n />\n </VisuallyHidden>\n <StyledLabel>{children}</StyledLabel>\n </StyledSegment>\n </StyledSegmentDisabledInteractiveWrapper>\n </Tooltip>\n )\n})\n\n// Standalone segment\nconst StandaloneSegment = React.forwardRef<\n HTMLInputElement,\n React.InputHTMLAttributes<HTMLInputElement> & SegmentedControllerSegmentProps\n>(function StandaloneSegment(\n {\n active,\n children,\n placement = 'top',\n tooltip,\n disabled,\n value,\n internalIndex,\n selected,\n ...props\n },\n ref\n) {\n const adjustedValue = String(value ?? internalIndex)\n const innerRef = React.useRef<HTMLInputElement>(null)\n const actualRef = ref ?? innerRef\n const { focusProps, isFocusVisible } = useFocusRing()\n\n const isControlled = selected !== undefined || active !== undefined\n const [uncontrolledSelected, setUncontrolledSelected] = React.useState(\n selected ?? active ?? false\n )\n const isSelected = selected ?? active ?? uncontrolledSelected\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (!isControlled) {\n setUncontrolledSelected(e.target.checked)\n }\n props.onChange?.(e)\n }\n\n return (\n <Tooltip overlay={tooltip} placement={placement}>\n <StyledSegmentDisabledInteractiveWrapper>\n <StyledSegment\n $focused={isFocusVisible}\n $disabled={disabled ?? false}\n $selected={isSelected}\n >\n <VisuallyHidden>\n <input\n {...mergeProps(props, focusProps)}\n ref={actualRef}\n type=\"radio\"\n value={adjustedValue}\n checked={isSelected}\n disabled={disabled}\n onChange={handleChange}\n />\n </VisuallyHidden>\n <StyledLabel>{children}</StyledLabel>\n </StyledSegment>\n </StyledSegmentDisabledInteractiveWrapper>\n </Tooltip>\n )\n})\n\n// Wrapper that chooses the right implementation\nexport const Segment = React.forwardRef<\n HTMLInputElement,\n React.InputHTMLAttributes<HTMLInputElement> & SegmentedControllerSegmentProps\n>(function Segment(props, ref) {\n const state = React.useContext(RadioButtonContext)\n\n if (state) {\n return <SegmentWithGroup {...props} state={state} ref={ref} />\n }\n\n return <StandaloneSegment {...props} ref={ref} />\n})\n\n/**\n * @deprecated\n *\n * The `SegmentedController.Tooltip` component has been deprecated will be\n * removed in a future version.\n *\n * Tooltips are now built into `SegmentedController.Segment`s, and can be added\n * by configuring the `tooltip` prop.\n *\n * **Before**\n *\n * ```\n * <SegmentedController>\n * <SegmentedController.Tooltip tooltip=\"Item 1 is the first item\">\n * <SegmentedController.Segment>\n * Item 1\n * </SegmentedController.Segment>\n * </SegmentedController.Tooltip>\n * </SegmentedController>\n * ```\n *\n * **After**\n *\n * ```\n * <SegmentedController>\n * <SegmentedController.Segment tooltip=\"Item 1 is the first item\">\n * Item 1\n * </SegmentedController.Segment>\n * </SegmentedController>\n * ```\n *\n * @deprecatedSince 10.20.0\n */\nexport const Tooltip = React.forwardRef<\n HTMLElement,\n SegmentedControllerTooltipProps\n>(function Tooltip({ children, overlay, ...props }, ref) {\n return overlay ? (\n <TooltipBase {...props} overlay={overlay} ref={ref} trigger=\"hover\">\n {children}\n </TooltipBase>\n ) : (\n <>{children}</>\n )\n})\n\nconst withState = (config: any) => (Component: any) => (props: any) => {\n const [selectedIndex, setSelected] = React.useState(0)\n\n return <Component {...{ ...props, selectedIndex, setSelected }} />\n}\n\n/**\n * @deprecated\n *\n * This `SegmentedController.State` utility has been deprecated. Please just\n * use a simple state management hook instead.\n *\n *\n * **Before**\n *\n * ```\n * <SegmentedController.State>\n * {({ selectedIndex, setSelected }) => (\n * <SegmentedController>\n * <SegmentedController.Segment onClick={() => setSelected(0)} active={selectedIndex === 0}>\n * Item 1\n * </SegmentedController.Segment>\n * </SegmentedController>\n * )}\n * </SegmentedController.State>\n * ```\n *\n * **After**\n *\n * ```\n * const [selected, setSelected] = React.useState(0)\n *\n * <SegmentedController onChange={setSelected}>\n * <SegmentedController.Segment active={selectedIndex === 0}>\n * Item 1\n * </SegmentedController.Segment>\n * </SegmentedController>\n * ```\n *\n * @deprecatedSince 10.20.0\n */\nexport const State = withState({})(({ children, ...props }: any) =>\n children(props)\n)\n\nSegmentedController_.displayName = 'SegmentedController'\n\nSegment.displayName = 'SegmentedController.Segment'\n\nTooltip.displayName = 'SegmentedController.Tooltip'\n\n/**\n\n Segmented controllers allow users to switch between related but mutually\n exclusive content or actions.\n\n @since 10.19.0\n\n @see [Storybook](https://stories.core.procore.com/?path=/story/core-react_demos-segmentedcontroller--demo)\n\n @see [Design Guidelines](https://design.procore.com/segmented-controller)\n\n */\nexport const SegmentedController = addSubcomponents(\n {\n Segment,\n State,\n Tooltip,\n },\n SegmentedController_\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,SAASA,YAAY,QAAQ,mBAAmB;AAChD,SAASC,QAAQ,EAAEC,aAAa,QAAQ,mBAAmB;AAC3D,SAASC,UAAU,EAAEC,KAAK,QAAQ,mBAAmB;AACrD,SAASC,cAAc,QAAQ,6BAA6B;AAC5D,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAASC,kBAAkB,QAAQ,eAAe;AAClD,SAASC,OAAO,IAAIC,WAAW,QAAQ,oBAAoB;AAC3D,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SACEC,eAAe,EACfC,WAAW,EACXC,aAAa,EACbC,uCAAuC,QAClC,8BAA8B;AAOrC,SAASC,SAASA,CAChBC,IAAa,EACiC;EAC9C,OACE,aAAAV,KAAK,CAACW,cAAc,CAACD,IAA0B,CAAC,IAC/CA,IAAI,CAAwBE,IAAI,KAAKC,OAAO;AAEjD;AAEA,OAAO,SAASC,sBAAsBA,CAAAC,IAAA,EAQ1B;EAAA,IAPVC,MAAM,GAAAD,IAAA,CAANC,MAAM;IACNC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,UAAU,GAAAH,IAAA,CAAVG,UAAU;EAMV;EACA,IAAID,QA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ACiG,WAAW,GAAG,qBAAqB;AAExD1G,OAAO,CAAC0G,WAAW,GAAG,6BAA6B;AAEnDrH,OAAO,CAACqH,WAAW,GAAG,6BAA6B;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAM/F,mBAAmB,GAAGpB,gBAAgB,CACjD;EACES,OAAO,EAAPA,OAAO;EACPuG,KAAK,EAALA,KAAK;EACLlH,OAAO,EAAPA;AACF,CAAC,EACDoB,oBACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"SegmentedController.js","names":["useFocusRing","useRadio","useRadioGroup","mergeProps","useId","VisuallyHidden","React","useRadioGroupState","Tooltip","TooltipBase","addSubcomponents","StyledContainer","StyledLabel","StyledSegment","StyledSegmentDisabledInteractiveWrapper","isSegment","node","isValidElement","type","Segment","determineSelectedState","_ref","active","selected","isSelected","undefined","RadioButtonContext","createContext","SegmentedController_","forwardRef","SegmentedController","_ref2","ref","ariaLabel","ariaLabelledby","children","_ref2$block","block","disabled","onChange","props","_objectWithoutProperties","_excluded","name","radioGroupState","isDisabled","rawValue","num","Number","value","isNaN","_useRadioGroup","orientation","radioGroupProps","createElement","_extends","$block","Provider","Children","toArray","filter","child","map","index","cloneElement","internalIndex","SegmentWithGroup","_ref3","_ref3$placement","placement","tooltip","state","_excluded2","adjustedValue","String","innerRef","useRef","actualRef","_useRadio","inputProps","_useFocusRing","focusProps","isFocusVisible","useEffect","setSelectedValue","overlay","$focused","$disabled","$selected","StandaloneSegment","_ref4","_ref5","_ref6","_ref4$placement","_excluded3","_useFocusRing2","isControlled","_React$useState","useState","_React$useState2","_slicedToArray","uncontrolledSelected","setUncontrolledSelected","handleChange","e","_props$onChange","target","checked","call","useContext","_ref7","_excluded4","trigger","Fragment","withState","config","Component","_React$useState3","_React$useState4","selectedIndex","setSelected","_objectSpread","State","_ref8","_excluded5","displayName"],"sources":["../../src/SegmentedController/SegmentedController.tsx"],"sourcesContent":["import { useFocusRing } from '@react-aria/focus'\nimport { useRadio, useRadioGroup } from '@react-aria/radio'\nimport { mergeProps, useId } from '@react-aria/utils'\nimport { VisuallyHidden } from '@react-aria/visually-hidden'\nimport React from 'react'\nimport type { RadioGroupState } from 'react-stately'\nimport { useRadioGroupState } from 'react-stately'\nimport { Tooltip as TooltipBase } from '../Tooltip/Tooltip'\nimport { addSubcomponents } from '../_utils/addSubcomponents'\nimport {\n StyledContainer,\n StyledLabel,\n StyledSegment,\n StyledSegmentDisabledInteractiveWrapper,\n} from './SegmentedController.styles'\nimport type {\n SegmentedControllerProps,\n SegmentedControllerSegmentProps,\n SegmentedControllerTooltipProps,\n} from './SegmentedController.types'\n\nfunction isSegment(\n node: unknown\n): node is React.ReactElement<HTMLInputElement> {\n return (\n React.isValidElement(node as React.ReactElement) &&\n (node as React.ReactElement).type === Segment\n )\n}\n\nexport function determineSelectedState({\n active,\n selected,\n isSelected,\n}: {\n active?: boolean\n isSelected: boolean\n selected?: boolean\n}): boolean {\n // Selected is a prop, so it should be the source of truth\n if (selected !== undefined) {\n return selected\n }\n // Active is a prop, so it should be the source of truth\n if (active !== undefined) {\n return active\n }\n // If neither props are passed in, use the react-stately state\n return isSelected\n}\n\nconst RadioButtonContext = React.createContext<RadioGroupState | null>(null)\n\nconst SegmentedController_ = React.forwardRef<\n HTMLDivElement,\n SegmentedControllerProps\n>(function SegmentedController(\n {\n // TODO make label props required in type?\n // React Aria logs warnings without 1 of 2. Axe does not fail\n ['aria-label']: ariaLabel,\n ['aria-labelledby']: ariaLabelledby,\n children,\n block = false,\n disabled,\n onChange,\n ...props\n },\n ref\n) {\n const name = useId()\n const radioGroupState = useRadioGroupState({\n name,\n isDisabled: disabled,\n onChange: (rawValue) => {\n const num = Number(rawValue)\n const value = !isNaN(num) ? num : rawValue\n onChange?.(value as number)\n },\n })\n const { radioGroupProps } = useRadioGroup(\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n orientation: 'horizontal',\n },\n radioGroupState\n )\n return (\n <StyledContainer ref={ref} $block={block} {...radioGroupProps} {...props}>\n <RadioButtonContext.Provider value={radioGroupState}>\n {React.Children.toArray(children)\n .filter((child) => isSegment(child))\n .map((child, index) =>\n React.cloneElement(child as React.ReactElement, {\n internalIndex: index,\n })\n )}\n </RadioButtonContext.Provider>\n </StyledContainer>\n )\n})\n\n// Segment with RadioGroup context\nconst SegmentWithGroup = React.forwardRef<\n HTMLInputElement,\n React.InputHTMLAttributes<HTMLInputElement> &\n SegmentedControllerSegmentProps & { state: RadioGroupState }\n>(function SegmentWithGroup(\n {\n active,\n children,\n placement = 'top',\n tooltip,\n disabled,\n value,\n internalIndex,\n selected,\n state,\n ...props\n },\n ref\n) {\n const adjustedValue = String(value ?? internalIndex)\n const innerRef = React.useRef<HTMLInputElement>(null)\n const actualRef = ref ?? innerRef\n\n const { inputProps, isSelected, isDisabled } = useRadio(\n {\n isDisabled: disabled ?? state.isDisabled,\n value: adjustedValue as string,\n children,\n },\n state,\n actualRef as unknown as React.RefObject<HTMLInputElement>\n )\n const { focusProps, isFocusVisible } = useFocusRing()\n\n React.useEffect(() => {\n if (active || selected) {\n state.setSelectedValue(adjustedValue)\n }\n }, [active, state, adjustedValue, selected])\n\n return (\n <Tooltip overlay={tooltip} placement={placement}>\n <StyledSegmentDisabledInteractiveWrapper>\n <StyledSegment\n $focused={isFocusVisible}\n $disabled={isDisabled}\n $selected={determineSelectedState({ active, selected, isSelected })}\n >\n <VisuallyHidden>\n <input\n {...mergeProps(props, inputProps, focusProps)}\n ref={actualRef}\n />\n </VisuallyHidden>\n <StyledLabel>{children}</StyledLabel>\n </StyledSegment>\n </StyledSegmentDisabledInteractiveWrapper>\n </Tooltip>\n )\n})\n\n// Standalone segment\nconst StandaloneSegment = React.forwardRef<\n HTMLInputElement,\n React.InputHTMLAttributes<HTMLInputElement> & SegmentedControllerSegmentProps\n>(function StandaloneSegment(\n {\n active,\n children,\n placement = 'top',\n tooltip,\n disabled,\n value,\n internalIndex,\n selected,\n ...props\n },\n ref\n) {\n const adjustedValue = String(value ?? internalIndex)\n const innerRef = React.useRef<HTMLInputElement>(null)\n const actualRef = ref ?? innerRef\n const { focusProps, isFocusVisible } = useFocusRing()\n\n const isControlled = selected !== undefined || active !== undefined\n const [uncontrolledSelected, setUncontrolledSelected] = React.useState(\n selected ?? active ?? false\n )\n const isSelected = selected ?? active ?? uncontrolledSelected\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (!isControlled) {\n setUncontrolledSelected(e.target.checked)\n }\n props.onChange?.(e)\n }\n\n return (\n <Tooltip overlay={tooltip} placement={placement}>\n <StyledSegmentDisabledInteractiveWrapper>\n <StyledSegment\n $focused={isFocusVisible}\n $disabled={disabled ?? false}\n $selected={isSelected}\n >\n <VisuallyHidden>\n <input\n {...mergeProps(props, focusProps)}\n ref={actualRef}\n type=\"radio\"\n value={adjustedValue}\n checked={isSelected}\n disabled={disabled}\n onChange={handleChange}\n />\n </VisuallyHidden>\n <StyledLabel>{children}</StyledLabel>\n </StyledSegment>\n </StyledSegmentDisabledInteractiveWrapper>\n </Tooltip>\n )\n})\n\n// Wrapper that chooses the right implementation\nexport const Segment = React.forwardRef<\n HTMLInputElement,\n React.InputHTMLAttributes<HTMLInputElement> & SegmentedControllerSegmentProps\n>(function Segment(props, ref) {\n const state = React.useContext(RadioButtonContext)\n\n if (state) {\n return <SegmentWithGroup {...props} state={state} ref={ref} />\n }\n\n return <StandaloneSegment {...props} ref={ref} />\n})\n\n/**\n * @deprecated\n *\n * The `SegmentedController.Tooltip` component has been deprecated will be\n * removed in a future version.\n *\n * Tooltips are now built into `SegmentedController.Segment`s, and can be added\n * by configuring the `tooltip` prop.\n *\n * **Before**\n *\n * ```\n * <SegmentedController>\n * <SegmentedController.Tooltip tooltip=\"Item 1 is the first item\">\n * <SegmentedController.Segment>\n * Item 1\n * </SegmentedController.Segment>\n * </SegmentedController.Tooltip>\n * </SegmentedController>\n * ```\n *\n * **After**\n *\n * ```\n * <SegmentedController>\n * <SegmentedController.Segment tooltip=\"Item 1 is the first item\">\n * Item 1\n * </SegmentedController.Segment>\n * </SegmentedController>\n * ```\n *\n * @deprecatedSince 10.20.0\n */\nexport const Tooltip = React.forwardRef<\n HTMLElement,\n SegmentedControllerTooltipProps\n>(function Tooltip({ children, overlay, ...props }, ref) {\n return overlay ? (\n <TooltipBase\n {...props}\n overlay={overlay}\n ref={ref}\n trigger={['hover', 'focus']}\n >\n {children}\n </TooltipBase>\n ) : (\n <>{children}</>\n )\n})\n\nconst withState = (config: any) => (Component: any) => (props: any) => {\n const [selectedIndex, setSelected] = React.useState(0)\n\n return <Component {...{ ...props, selectedIndex, setSelected }} />\n}\n\n/**\n * @deprecated\n *\n * This `SegmentedController.State` utility has been deprecated. Please just\n * use a simple state management hook instead.\n *\n *\n * **Before**\n *\n * ```\n * <SegmentedController.State>\n * {({ selectedIndex, setSelected }) => (\n * <SegmentedController>\n * <SegmentedController.Segment onClick={() => setSelected(0)} active={selectedIndex === 0}>\n * Item 1\n * </SegmentedController.Segment>\n * </SegmentedController>\n * )}\n * </SegmentedController.State>\n * ```\n *\n * **After**\n *\n * ```\n * const [selected, setSelected] = React.useState(0)\n *\n * <SegmentedController onChange={setSelected}>\n * <SegmentedController.Segment active={selectedIndex === 0}>\n * Item 1\n * </SegmentedController.Segment>\n * </SegmentedController>\n * ```\n *\n * @deprecatedSince 10.20.0\n */\nexport const State = withState({})(({ children, ...props }: any) =>\n children(props)\n)\n\nSegmentedController_.displayName = 'SegmentedController'\n\nSegment.displayName = 'SegmentedController.Segment'\n\nTooltip.displayName = 'SegmentedController.Tooltip'\n\n/**\n\n Segmented controllers allow users to switch between related but mutually\n exclusive content or actions.\n\n @since 10.19.0\n\n @see [Storybook](https://stories.core.procore.com/?path=/story/core-react_demos-segmentedcontroller--demo)\n\n @see [Design Guidelines](https://design.procore.com/segmented-controller)\n\n */\nexport const SegmentedController = addSubcomponents(\n {\n Segment,\n State,\n Tooltip,\n },\n SegmentedController_\n)\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AAA6E,gBAAA,GAAqC/G,KAAK,CAAC4F,QAAQ,CAAC,CAAC,CAAC;QAAAoB,gBAAA,GAAAlB,cAAA,CAAAiB,gBAAA;QAA/CE,aAAa,GAAAD,gBAAA;QAAEE,WAAW,GAAAF,gBAAA;MAEjC,oBAAOhH,KAAA,CAAAgD,aAAA,CAAC8D,SAAS,EAAAK,aAAA,CAAAA,aAAA,KAAUjF,KAAK;QAAE+E,aAAa,EAAbA,aAAa;QAAEC,WAAW,EAAXA;MAAW,EAAK,CAAC;IACpE,CAAC;EAAA;AAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAME,KAAK,GAAGR,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,UAAAS,KAAA;EAAA,IAAGxF,QAAQ,GAAAwF,KAAA,CAARxF,QAAQ;IAAKK,KAAK,GAAAC,wBAAA,CAAAkF,KAAA,EAAAC,UAAA;EAAA,OACtDzF,QAAQ,CAACK,KAAK,CAAC;AAAA,CACjB,CAAC;AAEDZ,oBAAoB,CAACiG,WAAW,GAAG,qBAAqB;AAExD1G,OAAO,CAAC0G,WAAW,GAAG,6BAA6B;AAEnDrH,OAAO,CAACqH,WAAW,GAAG,6BAA6B;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAM/F,mBAAmB,GAAGpB,gBAAgB,CACjD;EACES,OAAO,EAAPA,OAAO;EACPuG,KAAK,EAALA,KAAK;EACLlH,OAAO,EAAPA;AACF,CAAC,EACDoB,oBACF,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { colors } from '../_styles/colors';
|
|
|
5
5
|
import { spacing } from '../_styles/spacing';
|
|
6
6
|
export var StyledContainer = /*#__PURE__*/styled.div.withConfig({
|
|
7
7
|
displayName: "StyledContainer",
|
|
8
|
-
componentId: "core-
|
|
8
|
+
componentId: "core-12_38_0__sc-ocai3-0"
|
|
9
9
|
})(["align-items:center;display:", ";height:36px;justify-content:center;width:", ";"], function (_ref) {
|
|
10
10
|
var $block = _ref.$block;
|
|
11
11
|
return $block ? 'flex' : 'inline-flex';
|
|
@@ -15,7 +15,7 @@ export var StyledContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
15
15
|
});
|
|
16
16
|
export var StyledSegment = /*#__PURE__*/styled.label.withConfig({
|
|
17
17
|
displayName: "StyledSegment",
|
|
18
|
-
componentId: "core-
|
|
18
|
+
componentId: "core-12_38_0__sc-ocai3-1"
|
|
19
19
|
})(["align-items:center;border-radius:0;border:1px solid ", ";cursor:pointer;display:flex;flex:1 1 auto;height:100%;justify-content:center;min-width:0;outline:0;padding:0 ", "px;position:relative;background-color:", ";color:", ";&:hover{background-color:", ";border-color:", ";color:", ";}", " ", ";"], colors.gray85, spacing.md, colors.white, colors.gray45, colors.gray94, colors.gray85, colors.gray45, function (_ref3) {
|
|
20
20
|
var _ref3$$focused = _ref3.$focused,
|
|
21
21
|
$focused = _ref3$$focused === void 0 ? false : _ref3$$focused;
|
|
@@ -37,10 +37,10 @@ export var StyledSegment = /*#__PURE__*/styled.label.withConfig({
|
|
|
37
37
|
});
|
|
38
38
|
export var StyledSegmentDisabledInteractiveWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
39
39
|
displayName: "StyledSegmentDisabledInteractiveWrapper",
|
|
40
|
-
componentId: "core-
|
|
40
|
+
componentId: "core-12_38_0__sc-ocai3-2"
|
|
41
41
|
})(["display:flex;flex:1 1 auto;min-width:0;height:100%;margin-right:-1px;&:first-child ", "{border-bottom-left-radius:", "px;border-top-left-radius:", "px;}&:last-child ", "{border-bottom-right-radius:", "px;border-top-right-radius:", "px;}"], StyledSegment, borderRadius.md, borderRadius.md, StyledSegment, borderRadius.md, borderRadius.md);
|
|
42
42
|
export var StyledLabel = /*#__PURE__*/styled.span.withConfig({
|
|
43
43
|
displayName: "StyledLabel",
|
|
44
|
-
componentId: "core-
|
|
44
|
+
componentId: "core-12_38_0__sc-ocai3-3"
|
|
45
45
|
})(["", ";display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"], getTypographyIntent('body'));
|
|
46
46
|
//# sourceMappingURL=SegmentedController.styles.js.map
|
package/dist/Select/Select.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _excluded = ["value"],
|
|
2
|
-
_excluded2 = ["block", "children", "className", "clearRef", "disabled", "error", "focus", "label", "loading", "onClear", "open", "placeholder", "qa", "tabIndex", "isMenuOpened"],
|
|
3
|
-
_excluded3 = ["onSearch", "header", "footer", "emptyMessage", "optionsRef", "children", "i18nScope", "onSelect", "menuRef"],
|
|
2
|
+
_excluded2 = ["block", "children", "className", "clearRef", "disabled", "error", "focus", "label", "loading", "onClear", "open", "placeholder", "qa", "tabIndex", "isMenuOpened", "isListboxOnly", "menuId", "aria-expanded", "style"],
|
|
3
|
+
_excluded3 = ["onSearch", "header", "footer", "emptyMessage", "optionsRef", "children", "i18nScope", "onSelect", "menuRef", "menuId"],
|
|
4
4
|
_excluded4 = ["afterHide", "afterShow", "beforeHide", "beforeShow", "block", "children", "className", "container", "disabled", "emptyMessage", "error", "header", "footer", "hideDelay", "i18nScope", "label", "loading", "onClear", "onKeyDown", "onScrollBottom", "onSearch", "onSelect", "optionsRef", "placeholder", "placement", "restoreFocusOnHide", "showDelay", "tabIndex", "qa"];
|
|
5
5
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
6
6
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -12,6 +12,7 @@ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i
|
|
|
12
12
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
13
13
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
14
14
|
import { Clear } from '@procore/core-icons/dist';
|
|
15
|
+
import { useId } from '@react-aria/utils';
|
|
15
16
|
import classNames from 'classnames';
|
|
16
17
|
import { isNil } from 'ramda';
|
|
17
18
|
import React from 'react';
|
|
@@ -24,7 +25,7 @@ import { Tooltip } from '../Tooltip';
|
|
|
24
25
|
import { useI18nContext } from '../_hooks/I18n';
|
|
25
26
|
import { OverflowObserver } from '../_hooks/OverflowObserver';
|
|
26
27
|
import { addSubcomponents } from '../_utils/addSubcomponents';
|
|
27
|
-
import { StyledSelectArrow, StyledSelectArrowContainer, StyledSelectButton, StyledSelectButtonLabel, StyledSelectClearIcon, StyledSelectMenu, StyledSelectSpinner } from './Select.styles';
|
|
28
|
+
import { StyledSelectArrow, StyledSelectArrowContainer, StyledSelectButton, StyledSelectButtonLabel, StyledSelectButtonWrapper, StyledSelectClearIcon, StyledSelectMenu, StyledSelectSpinner } from './Select.styles';
|
|
28
29
|
function noop() {}
|
|
29
30
|
function isFunction(obj) {
|
|
30
31
|
return typeof obj === 'function';
|
|
@@ -73,24 +74,31 @@ export var Button = /*#__PURE__*/React.forwardRef(function Button(_ref3, ref) {
|
|
|
73
74
|
tabIndex = _ref3$tabIndex === void 0 ? 0 : _ref3$tabIndex,
|
|
74
75
|
_ref3$isMenuOpened = _ref3.isMenuOpened,
|
|
75
76
|
isMenuOpened = _ref3$isMenuOpened === void 0 ? false : _ref3$isMenuOpened,
|
|
77
|
+
_ref3$isListboxOnly = _ref3.isListboxOnly,
|
|
78
|
+
isListboxOnly = _ref3$isListboxOnly === void 0 ? false : _ref3$isListboxOnly,
|
|
79
|
+
menuId = _ref3.menuId,
|
|
80
|
+
ariaExpandedProp = _ref3['aria-expanded'],
|
|
81
|
+
style = _ref3.style,
|
|
76
82
|
props = _objectWithoutProperties(_ref3, _excluded2);
|
|
77
83
|
var i18n = useI18nContext();
|
|
78
|
-
var hasClearIcon =
|
|
84
|
+
var hasClearIcon = Boolean(onClear);
|
|
85
|
+
var showClearIcon = !disabled && !loading && Boolean(label);
|
|
86
|
+
var labelId = useId();
|
|
87
|
+
var triggerRole = isListboxOnly ? 'combobox' : 'button';
|
|
79
88
|
var content = children || label || placeholder;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
focus: isFunction(focus) ? focus({
|
|
83
|
-
open: open
|
|
84
|
-
}) : focus
|
|
85
|
-
}),
|
|
89
|
+
var ariaExpanded = disabled ? undefined : isListboxOnly ? ariaExpandedProp : open;
|
|
90
|
+
var button = /*#__PURE__*/React.createElement(StyledSelectButton, _extends({
|
|
86
91
|
ref: ref,
|
|
87
|
-
role:
|
|
92
|
+
role: triggerRole,
|
|
88
93
|
"aria-disabled": disabled,
|
|
89
94
|
tabIndex: disabled ? -1 : tabIndex,
|
|
95
|
+
"aria-expanded": ariaExpanded,
|
|
96
|
+
"aria-labelledby": isListboxOnly ? labelId : undefined,
|
|
90
97
|
$block: block,
|
|
91
98
|
$error: error,
|
|
92
99
|
$disabled: disabled,
|
|
93
100
|
$hasClearIcon: hasClearIcon,
|
|
101
|
+
$showClearIcon: showClearIcon,
|
|
94
102
|
$loading: loading,
|
|
95
103
|
$open: open,
|
|
96
104
|
$placeholder: !label
|
|
@@ -99,6 +107,7 @@ export var Button = /*#__PURE__*/React.forwardRef(function Button(_ref3, ref) {
|
|
|
99
107
|
overflowRef = _ref4.ref;
|
|
100
108
|
var showTooltip = !disabled && isOverflowingX && !isMenuOpened;
|
|
101
109
|
var trigger = /*#__PURE__*/React.createElement(StyledSelectButtonLabel, {
|
|
110
|
+
id: labelId,
|
|
102
111
|
"data-qa": qa === null || qa === void 0 ? void 0 : qa.label,
|
|
103
112
|
$hoverable: showTooltip,
|
|
104
113
|
ref: overflowRef
|
|
@@ -107,9 +116,19 @@ export var Button = /*#__PURE__*/React.forwardRef(function Button(_ref3, ref) {
|
|
|
107
116
|
trigger: "hover",
|
|
108
117
|
overlay: content
|
|
109
118
|
}, trigger) : trigger;
|
|
110
|
-
}),
|
|
111
|
-
|
|
112
|
-
|
|
119
|
+
}), loading ? /*#__PURE__*/React.createElement(StyledSelectSpinner, null, /*#__PURE__*/React.createElement(Spinner, {
|
|
120
|
+
color: "blue50",
|
|
121
|
+
size: "xs"
|
|
122
|
+
})) : /*#__PURE__*/React.createElement(StyledSelectArrowContainer, null, /*#__PURE__*/React.createElement(StyledSelectArrow, null)));
|
|
123
|
+
return /*#__PURE__*/React.createElement(StyledSelectButtonWrapper, {
|
|
124
|
+
$block: block,
|
|
125
|
+
className: classNames(className, {
|
|
126
|
+
focus: isFunction(focus) ? focus({
|
|
127
|
+
open: open
|
|
128
|
+
}) : focus
|
|
129
|
+
}),
|
|
130
|
+
style: style
|
|
131
|
+
}, button, onClear ? /*#__PURE__*/React.createElement(StyledSelectClearIcon, {
|
|
113
132
|
"aria-label": i18n.t('core.select.clear'),
|
|
114
133
|
ref: clearRef,
|
|
115
134
|
"data-qa": (qa === null || qa === void 0 ? void 0 : qa.clear) || 'core-select-clear',
|
|
@@ -121,11 +140,8 @@ export var Button = /*#__PURE__*/React.forwardRef(function Button(_ref3, ref) {
|
|
|
121
140
|
return e.preventDefault();
|
|
122
141
|
} // prevents an element from getting the focus
|
|
123
142
|
,
|
|
124
|
-
tabIndex:
|
|
125
|
-
})
|
|
126
|
-
color: "blue50",
|
|
127
|
-
size: "xs"
|
|
128
|
-
})) : /*#__PURE__*/React.createElement(StyledSelectArrowContainer, null, /*#__PURE__*/React.createElement(StyledSelectArrow, null)));
|
|
143
|
+
tabIndex: showClearIcon ? 0 : -1
|
|
144
|
+
}) : null);
|
|
129
145
|
});
|
|
130
146
|
var SelectMenu = /*#__PURE__*/React.forwardRef(function SelectMenu(_ref5, ref) {
|
|
131
147
|
var onSearch_ = _ref5.onSearch,
|
|
@@ -138,6 +154,7 @@ var SelectMenu = /*#__PURE__*/React.forwardRef(function SelectMenu(_ref5, ref) {
|
|
|
138
154
|
_ref5$onSelect = _ref5.onSelect,
|
|
139
155
|
onSelect_ = _ref5$onSelect === void 0 ? noop : _ref5$onSelect,
|
|
140
156
|
menuRef = _ref5.menuRef,
|
|
157
|
+
menuId = _ref5.menuId,
|
|
141
158
|
props = _objectWithoutProperties(_ref5, _excluded3);
|
|
142
159
|
var ctx = useOverlayTriggerContext();
|
|
143
160
|
var _React$useState = React.useState(''),
|
|
@@ -183,6 +200,7 @@ var SelectMenu = /*#__PURE__*/React.forwardRef(function SelectMenu(_ref5, ref) {
|
|
|
183
200
|
role: "listbox",
|
|
184
201
|
onKeyDown: onKeyDown,
|
|
185
202
|
onSelect: onSelect,
|
|
203
|
+
id: menuId,
|
|
186
204
|
circular: true
|
|
187
205
|
}), onSearch_ && /*#__PURE__*/React.createElement(MenuImperative.Search, _extends({
|
|
188
206
|
autoComplete: "false",
|
|
@@ -257,6 +275,8 @@ var Select_ = /*#__PURE__*/React.forwardRef(function Select(_ref6, forwardRef) {
|
|
|
257
275
|
isMenuOpened = _React$useState4[0],
|
|
258
276
|
setIsMenuOpened = _React$useState4[1];
|
|
259
277
|
var clearRef = React.useRef(null);
|
|
278
|
+
var menuId = useId();
|
|
279
|
+
var isListboxOnly = !onSearch && !header && !footer;
|
|
260
280
|
var emptyMessageText = emptyMessage !== null && emptyMessage !== void 0 ? emptyMessage : i18n.t('noResult', {
|
|
261
281
|
scope: i18nScope
|
|
262
282
|
});
|
|
@@ -295,6 +315,9 @@ var Select_ = /*#__PURE__*/React.forwardRef(function Select(_ref6, forwardRef) {
|
|
|
295
315
|
container: container,
|
|
296
316
|
hideDelay: hideDelay,
|
|
297
317
|
restoreFocusOnHide: restoreFocusOnHide,
|
|
318
|
+
role: isListboxOnly ? 'listbox' : undefined,
|
|
319
|
+
passA11yPropsToOverlay: isListboxOnly,
|
|
320
|
+
overlayId: menuId,
|
|
298
321
|
overlay: /*#__PURE__*/React.createElement(SelectMenu, {
|
|
299
322
|
onSearch: onSearch,
|
|
300
323
|
header: header,
|
|
@@ -304,7 +327,8 @@ var Select_ = /*#__PURE__*/React.forwardRef(function Select(_ref6, forwardRef) {
|
|
|
304
327
|
i18nScope: i18nScope,
|
|
305
328
|
onSelect: onSelect,
|
|
306
329
|
onScrollBottom: onScrollBottom,
|
|
307
|
-
menuRef: menuRef
|
|
330
|
+
menuRef: menuRef,
|
|
331
|
+
menuId: menuId
|
|
308
332
|
}, children),
|
|
309
333
|
placement: placement,
|
|
310
334
|
ref: ref,
|
|
@@ -324,6 +348,8 @@ var Select_ = /*#__PURE__*/React.forwardRef(function Select(_ref6, forwardRef) {
|
|
|
324
348
|
onClear: isNil(onClear_) ? onClear_ : onClear,
|
|
325
349
|
isMenuOpened: isMenuOpened,
|
|
326
350
|
tabIndex: tabIndex,
|
|
351
|
+
isListboxOnly: isListboxOnly,
|
|
352
|
+
menuId: menuId,
|
|
327
353
|
qa: qa
|
|
328
354
|
})));
|
|
329
355
|
});
|