@procore/core-react 11.33.0 → 12.1.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/README.md +7 -1
- package/dist/AnchorNavigation/AnchorNavigation.styles.js +3 -3
- package/dist/Avatar/Avatar.styles.js +5 -5
- package/dist/Avatar/Avatar.types.d.ts +1 -1
- package/dist/Avatar/Avatar.types.js.map +1 -1
- package/dist/AvatarStack/AvatarStack.styles.js +7 -7
- package/dist/Badge/Badge.styles.js +2 -2
- package/dist/Banner/Banner.d.ts +0 -5
- package/dist/Banner/Banner.js +11 -30
- package/dist/Banner/Banner.js.map +1 -1
- package/dist/Banner/Banner.styles.js +10 -20
- package/dist/Banner/Banner.styles.js.map +1 -1
- package/dist/Banner/Banner.types.d.ts +1 -5
- package/dist/Banner/Banner.types.js.map +1 -1
- package/dist/Banner/index.d.ts +1 -1
- package/dist/Banner/index.js +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/Breadcrumbs/Breadcrumbs.types.d.ts +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.types.js.map +1 -1
- package/dist/Button/Button.styles.js +5 -5
- package/dist/Calendar/Calendar.d.ts +72 -0
- package/dist/Calendar/Calendar.js +81 -0
- package/dist/Calendar/Calendar.js.map +1 -1
- package/dist/Calendar/Calendar.styles.js +8 -8
- package/dist/Card/Card.styles.js +1 -1
- package/dist/Checkbox/Checkbox.js +3 -2
- package/dist/Checkbox/Checkbox.js.map +1 -1
- package/dist/Checkbox/Checkbox.styles.js +6 -6
- package/dist/Checkbox/CheckboxTooltip.d.ts +4 -0
- package/dist/Checkbox/CheckboxTooltip.js +26 -0
- package/dist/Checkbox/CheckboxTooltip.js.map +1 -0
- package/dist/ContactItem/ContactItem.styles.js +5 -5
- package/dist/Content/Content.styles.js +4 -4
- package/dist/Content/Content.styles.js.map +1 -1
- package/dist/DateInput/DateInput.styles.js +6 -6
- package/dist/DetailPage/DetailPage.styles.js +7 -7
- package/dist/Dropdown/Dropdown.styles.js +3 -3
- package/dist/DropdownFlyout/DropdownFlyout.styles.js +4 -4
- package/dist/Dropzone/Dropzone.d.ts +1 -1
- package/dist/Dropzone/Dropzone.js +3 -3
- package/dist/Dropzone/Dropzone.js.map +1 -1
- package/dist/Dropzone/Dropzone.styles.js +9 -9
- package/dist/Dropzone/index.d.ts +14 -2
- package/dist/Dropzone/index.js +13 -1
- package/dist/Dropzone/index.js.map +1 -1
- 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.styles.js +3 -3
- package/dist/FileSelect/FileSelect.styles.js +2 -2
- package/dist/FileSelect/FileSelectDropzone/FileSelectDropzone.styles.d.ts +1 -1
- package/dist/FileSelect/FileSelectDropzone/FileSelectDropzone.styles.js +3 -3
- package/dist/FileSelect/FileTokenList/FileTokenList.styles.js +2 -2
- package/dist/FileSelect/GridSource/GridSource.styles.js +6 -6
- package/dist/FileSelect/LocalSource/LocalSource.js +2 -2
- package/dist/FileSelect/LocalSource/LocalSource.js.map +1 -1
- package/dist/FileSelect/LocalSource/LocalSource.styles.d.ts +1 -1
- package/dist/FileSelect/LocalSource/LocalSource.styles.js +4 -4
- package/dist/FileSelect/SourceItem/SourceItem.styles.js +3 -3
- package/dist/FileSelect/ThumbnailList/ThumbnailList.styles.js +6 -6
- package/dist/FileSelect/ThumbnailList/index.d.ts +1 -0
- package/dist/FileSelect/ThumbnailList/index.js.map +1 -1
- package/dist/FileSelect/TreeSource/TreeSource.styles.js +1 -1
- package/dist/FileSelect/TreeSource/TreeSource.types.d.ts +1 -1
- package/dist/FileSelect/TreeSource/TreeSource.types.js.map +1 -1
- package/dist/FileSelect/index.d.ts +1 -1
- package/dist/FileSelect/index.js.map +1 -1
- package/dist/FileSelect/storyHelpers.d.ts +2 -2
- package/dist/FileSelect/storyHelpers.js.map +1 -1
- package/dist/FileToken/FileToken.styles.js +4 -4
- package/dist/FilterToken/FilterToken.styles.js +2 -2
- package/dist/FlexList/FlexList.styles.js +1 -1
- package/dist/Form/Form.d.ts +1 -1
- package/dist/Form/Form.js +5 -4
- package/dist/Form/Form.js.map +1 -1
- package/dist/Form/Form.styles.d.ts +1 -5
- package/dist/Form/Form.styles.js +20 -33
- package/dist/Form/Form.styles.js.map +1 -1
- package/dist/Form/Form.types.d.ts +7 -1
- package/dist/Form/Form.types.js.map +1 -1
- package/dist/Form/StyledFormikForm.styles.d.ts +6 -0
- package/dist/Form/StyledFormikForm.styles.js +17 -0
- package/dist/Form/StyledFormikForm.styles.js.map +1 -0
- package/dist/Form/index.d.ts +3 -2
- package/dist/Form/index.js +2 -1
- package/dist/Form/index.js.map +1 -1
- 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/Menu/index.d.ts +1 -1
- package/dist/Menu/index.js.map +1 -1
- package/dist/MenuImperative/MenuImperative.styles.js +10 -10
- package/dist/Modal/Modal.js +1 -1
- package/dist/Modal/Modal.js.map +1 -1
- package/dist/Modal/Modal.styles.js +13 -13
- package/dist/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/MultiSelect/MultiSelect.styles.js +6 -6
- package/dist/MultiSelect/MultiSelect.types.d.ts +4 -4
- package/dist/MultiSelect/MultiSelect.types.js.map +1 -1
- package/dist/MultiSelect/index.d.ts +1 -1
- package/dist/MultiSelect/index.js.map +1 -1
- package/dist/NextMenu/NextMenu.styles.js +3 -3
- package/dist/Notation/Notation.js +1 -1
- package/dist/NumberInput/NumberInput.js +2 -3
- package/dist/NumberInput/NumberInput.js.map +1 -1
- package/dist/NumberInput/NumberInput.styles.js +7 -7
- package/dist/NumberInput/NumberInput.types.d.ts +15 -11
- package/dist/NumberInput/NumberInput.types.js.map +1 -1
- package/dist/NumberInput/index.d.ts +1 -1
- package/dist/NumberInput/index.js.map +1 -1
- package/dist/Overlay/OverlayArrow.styles.js +1 -1
- package/dist/OverlayTrigger/OverlayTrigger.js +0 -4
- package/dist/OverlayTrigger/OverlayTrigger.js.map +1 -1
- package/dist/PageLayout/PageLayout.d.ts +53 -0
- package/dist/PageLayout/PageLayout.js +63 -8
- package/dist/PageLayout/PageLayout.js.map +1 -1
- package/dist/PageLayout/PageLayout.styles.d.ts +1 -4
- package/dist/PageLayout/PageLayout.styles.js +26 -26
- package/dist/PageLayout/PageLayout.styles.js.map +1 -1
- package/dist/Pagination/Pagination.styles.js +5 -5
- package/dist/Pagination/index.d.ts +1 -1
- package/dist/Pagination/index.js.map +1 -1
- package/dist/Panel/Panel.styles.js +11 -11
- package/dist/Pill/Pill.styles.js +2 -2
- package/dist/PillSelect/PillSelect.styles.js +4 -4
- package/dist/PillSelect/index.d.ts +1 -1
- package/dist/PillSelect/index.js.map +1 -1
- package/dist/Popover/Popover.styles.js +2 -2
- package/dist/Portal/Portal.styles.js +1 -1
- package/dist/Portal/index.d.ts +1 -0
- package/dist/Portal/index.js.map +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 +6 -6
- package/dist/SegmentedController/SegmentedController.styles.js +4 -4
- package/dist/Select/Select.styles.js +7 -7
- package/dist/Semantic/Semantic.styles.js +9 -9
- package/dist/Slider/Slider.styles.js +5 -5
- package/dist/Spinner/Spinner.styles.js +7 -7
- package/dist/SuperSelect/SuperSelect.presets.styles.js +1 -1
- package/dist/SuperSelect/SuperSelect.styles.js +37 -37
- package/dist/SuperSelect/index.d.ts +1 -1
- package/dist/SuperSelect/index.js.map +1 -1
- package/dist/Switch/Switch.styles.js +4 -4
- package/dist/Table/Table.d.ts +5 -5
- package/dist/Table/Table.js.map +1 -1
- package/dist/Table/Table.styles.js +28 -28
- package/dist/Table/Table.types.d.ts +2 -2
- package/dist/Table/Table.types.js.map +1 -1
- package/dist/Table/index.d.ts +1 -1
- package/dist/Table/index.js.map +1 -1
- package/dist/TableShelf/TableShelf.styles.js +5 -5
- package/dist/Tabs/Tabs.styles.js +8 -8
- package/dist/Tearsheet/Tearsheet.js +1 -1
- package/dist/Tearsheet/Tearsheet.js.map +1 -1
- package/dist/Tearsheet/Tearsheet.styles.js +5 -5
- 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/Thumbnail/index.d.ts +1 -1
- package/dist/Thumbnail/index.js.map +1 -1
- package/dist/ThumbnailGrid/ThumbnailGrid.styles.js +7 -7
- package/dist/TieredSelect/TieredSelect.styles.js +9 -9
- package/dist/TieredSelect/index.d.ts +1 -1
- package/dist/TieredSelect/index.js.map +1 -1
- package/dist/Tile/Tile.styles.js +10 -10
- package/dist/Tile/Tile.styles.js.map +1 -1
- package/dist/Title/Title.styles.js +7 -7
- package/dist/Toast/Toast.styles.js +3 -3
- package/dist/Toast/index.d.ts +1 -1
- package/dist/Toast/index.js.map +1 -1
- 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/Tooltip/Tooltip.styles.js +2 -2
- package/dist/Tree/Tree.js.map +1 -1
- package/dist/Tree/Tree.styles.js +9 -9
- package/dist/Tree/Tree.types.d.ts +1 -1
- package/dist/Tree/Tree.types.js.map +1 -1
- package/dist/Tree/index.d.ts +1 -1
- package/dist/Tree/index.js.map +1 -1
- package/dist/Typeahead/Typeahead.styles.js +3 -3
- package/dist/Typography/Typography.js +4 -2
- package/dist/Typography/Typography.js.map +1 -1
- package/dist/Typography/Typography.styles.js +6 -3
- package/dist/Typography/Typography.styles.js.map +1 -1
- package/dist/Typography/Typography.table.story.js +2 -2
- package/dist/Typography/Typography.types.d.ts +5 -0
- package/dist/Typography/Typography.types.js.map +1 -1
- package/dist/Typography/index.d.ts +1 -1
- package/dist/Typography/index.js +1 -1
- package/dist/Typography/index.js.map +1 -1
- package/dist/_hooks/Anchor.d.ts +0 -15
- package/dist/_hooks/Anchor.js +1 -29
- package/dist/_hooks/Anchor.js.map +1 -1
- package/dist/_hooks/Buffer.d.ts +0 -19
- package/dist/_hooks/Buffer.js +1 -41
- package/dist/_hooks/Buffer.js.map +1 -1
- package/dist/_hooks/DateTime/index.d.ts +1 -1
- package/dist/_hooks/DateTime/index.js +1 -1
- package/dist/_hooks/DateTime/index.js.map +1 -1
- package/dist/_hooks/InjectedScript.d.ts +0 -18
- package/dist/_hooks/InjectedScript.js +1 -39
- package/dist/_hooks/InjectedScript.js.map +1 -1
- package/dist/_hooks/ListNavigation.d.ts +0 -35
- package/dist/_hooks/ListNavigation.js +1 -53
- package/dist/_hooks/ListNavigation.js.map +1 -1
- package/dist/_hooks/ResizeObserver.js +1 -5
- package/dist/_hooks/ResizeObserver.js.map +1 -1
- package/dist/_hooks/TextEntry.d.ts +1 -29
- package/dist/_hooks/TextEntry.js +1 -42
- package/dist/_hooks/TextEntry.js.map +1 -1
- package/dist/_hooks/Timer.d.ts +0 -19
- package/dist/_hooks/Timer.js +0 -38
- package/dist/_hooks/Timer.js.map +1 -1
- package/dist/_hooks/Trigger.d.ts +0 -20
- package/dist/_hooks/Trigger.js +1 -47
- package/dist/_hooks/Trigger.js.map +1 -1
- package/dist/_hooks/Visibility.d.ts +0 -18
- package/dist/_hooks/Visibility.js +1 -41
- package/dist/_hooks/Visibility.js.map +1 -1
- package/dist/_typedoc/Avatar/Avatar.types.json +22 -22
- package/dist/_typedoc/AvatarStack/AvatarStack.types.json +23 -23
- package/dist/_typedoc/Badge/Badge.types.json +6 -6
- package/dist/_typedoc/Banner/Banner.types.json +16 -16
- package/dist/_typedoc/Box/Box.types.json +68 -68
- package/dist/_typedoc/Breadcrumbs/Breadcrumbs.types.json +12 -12
- package/dist/_typedoc/Button/Button.types.json +12 -12
- package/dist/_typedoc/Calendar/Calendar.json +68 -0
- 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 +9 -9
- 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 +4 -4
- package/dist/_typedoc/Dropdown/Dropdown.types.json +37 -37
- package/dist/_typedoc/DropdownFlyout/DropdownFlyout.types.json +29 -29
- package/dist/_typedoc/Dropzone/Dropzone.types.json +41 -41
- package/dist/_typedoc/EmptyState/EmptyState.types.json +14 -14
- package/dist/_typedoc/FileList/FileList.types.json +9 -9
- package/dist/_typedoc/FileSelect/FileSelect.types.json +26 -26
- 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 +11 -11
- 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 +746 -765
- package/dist/_typedoc/Grid/Grid.types.json +8 -8
- package/dist/_typedoc/GroupSelect/GroupSelect.types.json +53 -53
- package/dist/_typedoc/Input/Input.types.json +2 -2
- package/dist/_typedoc/Link/Link.types.json +4 -4
- 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 +74 -74
- package/dist/_typedoc/Modal/Modal.types.json +41 -41
- package/dist/_typedoc/MultiSelect/MultiSelect.types.json +32 -32
- package/dist/_typedoc/Notation/Notation.types.json +4 -4
- package/dist/_typedoc/NumberInput/NumberInput.types.json +71 -88
- package/dist/_typedoc/OverlayTrigger/OverlayTrigger.types.json +31 -31
- package/dist/_typedoc/PageLayout/PageLayout.json +36 -0
- 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 +27 -27
- package/dist/_typedoc/Pill/Pill.types.json +2 -2
- package/dist/_typedoc/PillSelect/PillSelect.types.json +47 -47
- package/dist/_typedoc/Popover/Popover.types.json +14 -14
- package/dist/_typedoc/ProgressBar/ProgressBar.types.json +6 -6
- 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 +14 -14
- package/dist/_typedoc/SegmentedController/SegmentedController.types.json +20 -20
- package/dist/_typedoc/Select/Select.types.json +57 -57
- package/dist/_typedoc/Slider/Slider.types.json +6 -6
- package/dist/_typedoc/Spinner/Spinner.types.json +9 -9
- package/dist/_typedoc/Switch/Switch.types.json +3 -3
- package/dist/_typedoc/Table/Table.types.json +99 -99
- package/dist/_typedoc/Tabs/Tabs.types.json +17 -17
- package/dist/_typedoc/Tearsheet/Tearsheet.types.json +16 -16
- package/dist/_typedoc/TextArea/TextArea.types.json +3 -3
- package/dist/_typedoc/TextEditor/TextEditor.types.json +9 -9
- 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 +42 -42
- package/dist/_typedoc/TieredSelect/TieredSelect.types.json +28 -28
- package/dist/_typedoc/Tile/Tile.types.json +30 -30
- 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 +3 -3
- package/dist/_typedoc/Token/Token.types.json +4 -4
- package/dist/_typedoc/ToolHeader/ToolHeader.types.json +10 -10
- package/dist/_typedoc/Tooltip/Tooltip.types.json +13 -13
- package/dist/_typedoc/Tree/Tree.types.json +128 -128
- package/dist/_typedoc/Typeahead/Typeahead.types.json +2 -2
- package/dist/_typedoc/Typography/Typography.types.json +18 -8
- package/dist/_typedoc/_utils/types.json +3 -3
- package/dist/_typedoc/deprecations.json +1 -1
- package/dist/_utils/closeWithConfirm.js.map +1 -0
- package/dist/_utils/propsTypedoc.d.ts +3 -1
- package/dist/_utils/propsTypedoc.js +2 -0
- package/dist/_utils/propsTypedoc.js.map +1 -1
- package/dist/index.d.ts +1 -5
- package/dist/index.js +4 -9
- package/dist/index.js.map +1 -1
- package/package.json +15 -5
- package/dist/Form/closeWithConfirm.js.map +0 -1
- package/dist/Sidebar/Sidebar.d.ts +0 -50
- package/dist/Sidebar/Sidebar.js +0 -117
- package/dist/Sidebar/Sidebar.js.map +0 -1
- package/dist/Sidebar/Sidebar.styles.d.ts +0 -9
- package/dist/Sidebar/Sidebar.styles.js +0 -38
- package/dist/Sidebar/Sidebar.styles.js.map +0 -1
- package/dist/Sidebar/index.d.ts +0 -1
- package/dist/Sidebar/index.js +0 -2
- package/dist/Sidebar/index.js.map +0 -1
- package/dist/_hooks/Analytics.d.ts +0 -36
- package/dist/_hooks/Analytics.js +0 -54
- package/dist/_hooks/Analytics.js.map +0 -1
- package/dist/_hooks/Autofocus.d.ts +0 -32
- package/dist/_hooks/Autofocus.js +0 -70
- package/dist/_hooks/Autofocus.js.map +0 -1
- package/dist/_hooks/BoundingRect.d.ts +0 -41
- package/dist/_hooks/BoundingRect.js +0 -90
- package/dist/_hooks/BoundingRect.js.map +0 -1
- package/dist/_hooks/Event.d.ts +0 -42
- package/dist/_hooks/Event.js +0 -83
- package/dist/_hooks/Event.js.map +0 -1
- package/dist/_utils/genericAnalyticsClient.d.ts +0 -25
- package/dist/_utils/genericAnalyticsClient.js +0 -46
- package/dist/_utils/genericAnalyticsClient.js.map +0 -1
- /package/dist/{Form → _utils}/closeWithConfirm.d.ts +0 -0
- /package/dist/{Form → _utils}/closeWithConfirm.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Typography.styles.js","names":["styled","css","colors","typographyWeights","regular","semibold","bold","typographyLineHeight","small","body","h1","h2","h3","label","typographyIntents","getTypographyIntent","intent","semiboldRules","StyledTypography","span","withConfig","displayName","componentId","_ref","_ref$intent","_ref2","_ref2$$color","$color","_ref3","_ref3$italic","italic","_ref4","weight"],"sources":["../../src/Typography/Typography.styles.ts"],"sourcesContent":["import type { FlattenSimpleInterpolation } from 'styled-components'\nimport styled, { css } from 'styled-components'\nimport { colors } from '../_styles/colors'\nimport type { Intent, TypographyProps, Weight } from './Typography.types'\n\nexport interface StyledTypographyProps extends Omit<TypographyProps, 'color'> {\n $color?: TypographyProps['color']\n}\n\nexport const typographyWeights: {\n [key in Weight]: number\n} = {\n regular: 400,\n semibold: 600,\n bold: 700,\n}\n\nexport const typographyLineHeight: Record<Intent, number> = {\n small: 16,\n body: 20,\n h1: 32,\n h2: 28,\n h3: 24,\n label: 20,\n}\n\nconst body = css`\n font-family: inherit;\n font-size: 14px;\n font-weight: ${typographyWeights.regular};\n letter-spacing: 0.15px;\n line-height: ${typographyLineHeight.body}px;\n`\n\nconst h1 = css`\n font-family: inherit;\n font-size: 24px;\n font-weight: ${typographyWeights.bold};\n letter-spacing: 0.15px;\n line-height: ${typographyLineHeight.h1}px;\n`\n\nconst h2 = css`\n font-family: inherit;\n font-size: 20px;\n font-weight: ${typographyWeights.semibold};\n letter-spacing: 0.15px;\n line-height: ${typographyLineHeight.h2}px;\n`\n\nconst h3 = css`\n font-family: inherit;\n font-size: 16px;\n font-weight: ${typographyWeights.semibold};\n letter-spacing: 0.15px;\n line-height: ${typographyLineHeight.h3}px;\n`\n\nconst small = css`\n font-family: inherit;\n font-size: 12px;\n font-weight: ${typographyWeights.regular};\n letter-spacing: 0.25px;\n line-height: ${typographyLineHeight.small}px;\n`\n\nconst label = css`\n font-family: inherit;\n font-size: 14px;\n font-weight: ${typographyWeights.bold};\n letter-spacing: 0.15px;\n line-height: ${typographyLineHeight.label}px;\n`\n\nconst typographyIntents: {\n [key in Intent]: FlattenSimpleInterpolation\n} = {\n body,\n h1,\n h2,\n h3,\n small,\n label,\n}\n\nexport function getTypographyIntent(intent: Intent) {\n return typographyIntents[intent]\n}\n\nexport const semiboldRules = () => {\n return css`\n & > strong,\n > b {\n font-weight: 600;\n }\n `\n}\n\nexport const StyledTypography = styled.span<StyledTypographyProps>`\n ${({ intent = 'body' }) => typographyIntents[intent]}\n color: ${({ $color = 'gray15' }) => colors[$color]};\n font-style: ${({ italic = false }) => (italic ? 'italic' : 'inherit')};\n font-weight: ${({ weight }) => weight && typographyWeights[weight]};\n ${semiboldRules}\n\n em,\n i {\n font-style: italic;\n }\n`\n"],"mappings":"AACA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAC/C,SAASC,MAAM,QAAQ,mBAAmB;AAO1C,OAAO,IAAMC,iBAEZ,GAAG;EACFC,OAAO,EAAE,GAAG;EACZC,QAAQ,EAAE,GAAG;EACbC,IAAI,EAAE;AACR,CAAC;AAED,OAAO,IAAMC,oBAA4C,GAAG;EAC1DC,KAAK,EAAE,EAAE;EACTC,IAAI,EAAE,EAAE;EACRC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE,EAAE;EACNC,KAAK,EAAE;AACT,CAAC;AAED,IAAMJ,IAAI,gBAAGR,GAAG,oGAGCE,iBAAiB,CAACC,OAAO,EAEzBG,oBAAoB,CAACE,IAAI,CACzC;AAED,IAAMC,EAAE,gBAAGT,GAAG,oGAGGE,iBAAiB,CAACG,IAAI,EAEtBC,oBAAoB,CAACG,EAAE,CACvC;AAED,IAAMC,EAAE,gBAAGV,GAAG,oGAGGE,iBAAiB,CAACE,QAAQ,EAE1BE,oBAAoB,CAACI,EAAE,CACvC;AAED,IAAMC,EAAE,gBAAGX,GAAG,oGAGGE,iBAAiB,CAACE,QAAQ,EAE1BE,oBAAoB,CAACK,EAAE,CACvC;AAED,IAAMJ,KAAK,gBAAGP,GAAG,oGAGAE,iBAAiB,CAACC,OAAO,EAEzBG,oBAAoB,CAACC,KAAK,CAC1C;AAED,IAAMK,KAAK,gBAAGZ,GAAG,oGAGAE,iBAAiB,CAACG,IAAI,EAEtBC,oBAAoB,CAACM,KAAK,CAC1C;AAED,IAAMC,iBAEL,GAAG;EACFL,IAAI,EAAJA,IAAI;EACJC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFJ,KAAK,EAALA,KAAK;EACLK,KAAK,EAALA;AACF,CAAC;AAED,OAAO,SAASE,mBAAmBA,CAACC,MAAc,EAAE;EAClD,OAAOF,iBAAiB,CAACE,MAAM,CAAC;AAClC;AAEA,OAAO,IAAMC,aAAa,GAAG,SAAhBA,aAAaA,CAAA,EAAS;EACjC,OAAOhB,GAAG;AAMZ,CAAC;AAED,OAAO,IAAMiB,gBAAgB,gBAAGlB,MAAM,CAACmB,IAAI,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"Typography.styles.js","names":["styled","css","colors","typographyWeights","regular","semibold","bold","typographyLineHeight","small","body","h1","h2","h3","label","typographyIntents","getTypographyIntent","intent","semiboldRules","StyledTypography","span","withConfig","displayName","componentId","_ref","_ref$intent","_ref2","_ref2$$color","$color","_ref3","_ref3$italic","italic","_ref4","weight","_ref5","breakWord"],"sources":["../../src/Typography/Typography.styles.ts"],"sourcesContent":["import type { FlattenSimpleInterpolation } from 'styled-components'\nimport styled, { css } from 'styled-components'\nimport { colors } from '../_styles/colors'\nimport type { Intent, TypographyProps, Weight } from './Typography.types'\n\nexport interface StyledTypographyProps extends Omit<TypographyProps, 'color'> {\n $color?: TypographyProps['color']\n}\n\nexport const typographyWeights: {\n [key in Weight]: number\n} = {\n regular: 400,\n semibold: 600,\n bold: 700,\n}\n\nexport const typographyLineHeight: Record<Intent, number> = {\n small: 16,\n body: 20,\n h1: 32,\n h2: 28,\n h3: 24,\n label: 20,\n}\n\nconst body = css`\n font-family: inherit;\n font-size: 14px;\n font-weight: ${typographyWeights.regular};\n letter-spacing: 0.15px;\n line-height: ${typographyLineHeight.body}px;\n`\n\nconst h1 = css`\n font-family: inherit;\n font-size: 24px;\n font-weight: ${typographyWeights.bold};\n letter-spacing: 0.15px;\n line-height: ${typographyLineHeight.h1}px;\n`\n\nconst h2 = css`\n font-family: inherit;\n font-size: 20px;\n font-weight: ${typographyWeights.semibold};\n letter-spacing: 0.15px;\n line-height: ${typographyLineHeight.h2}px;\n`\n\nconst h3 = css`\n font-family: inherit;\n font-size: 16px;\n font-weight: ${typographyWeights.semibold};\n letter-spacing: 0.15px;\n line-height: ${typographyLineHeight.h3}px;\n`\n\nconst small = css`\n font-family: inherit;\n font-size: 12px;\n font-weight: ${typographyWeights.regular};\n letter-spacing: 0.25px;\n line-height: ${typographyLineHeight.small}px;\n`\n\nconst label = css`\n font-family: inherit;\n font-size: 14px;\n font-weight: ${typographyWeights.bold};\n letter-spacing: 0.15px;\n line-height: ${typographyLineHeight.label}px;\n`\n\nconst typographyIntents: {\n [key in Intent]: FlattenSimpleInterpolation\n} = {\n body,\n h1,\n h2,\n h3,\n small,\n label,\n}\n\nexport function getTypographyIntent(intent: Intent) {\n return typographyIntents[intent]\n}\n\nexport const semiboldRules = () => {\n return css`\n & > strong,\n > b {\n font-weight: 600;\n }\n `\n}\n\nexport const StyledTypography = styled.span<StyledTypographyProps>`\n ${({ intent = 'body' }) => typographyIntents[intent]}\n color: ${({ $color = 'gray15' }) => colors[$color]};\n font-style: ${({ italic = false }) => (italic ? 'italic' : 'inherit')};\n font-weight: ${({ weight }) => weight && typographyWeights[weight]};\n ${semiboldRules}\n ${({ breakWord }) =>\n breakWord &&\n `\n word-wrap: break-word;\n word-break: break-word;\n`}\n em,\n i {\n font-style: italic;\n }\n`\n"],"mappings":"AACA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAC/C,SAASC,MAAM,QAAQ,mBAAmB;AAO1C,OAAO,IAAMC,iBAEZ,GAAG;EACFC,OAAO,EAAE,GAAG;EACZC,QAAQ,EAAE,GAAG;EACbC,IAAI,EAAE;AACR,CAAC;AAED,OAAO,IAAMC,oBAA4C,GAAG;EAC1DC,KAAK,EAAE,EAAE;EACTC,IAAI,EAAE,EAAE;EACRC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE,EAAE;EACNC,KAAK,EAAE;AACT,CAAC;AAED,IAAMJ,IAAI,gBAAGR,GAAG,oGAGCE,iBAAiB,CAACC,OAAO,EAEzBG,oBAAoB,CAACE,IAAI,CACzC;AAED,IAAMC,EAAE,gBAAGT,GAAG,oGAGGE,iBAAiB,CAACG,IAAI,EAEtBC,oBAAoB,CAACG,EAAE,CACvC;AAED,IAAMC,EAAE,gBAAGV,GAAG,oGAGGE,iBAAiB,CAACE,QAAQ,EAE1BE,oBAAoB,CAACI,EAAE,CACvC;AAED,IAAMC,EAAE,gBAAGX,GAAG,oGAGGE,iBAAiB,CAACE,QAAQ,EAE1BE,oBAAoB,CAACK,EAAE,CACvC;AAED,IAAMJ,KAAK,gBAAGP,GAAG,oGAGAE,iBAAiB,CAACC,OAAO,EAEzBG,oBAAoB,CAACC,KAAK,CAC1C;AAED,IAAMK,KAAK,gBAAGZ,GAAG,oGAGAE,iBAAiB,CAACG,IAAI,EAEtBC,oBAAoB,CAACM,KAAK,CAC1C;AAED,IAAMC,iBAEL,GAAG;EACFL,IAAI,EAAJA,IAAI;EACJC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFJ,KAAK,EAALA,KAAK;EACLK,KAAK,EAALA;AACF,CAAC;AAED,OAAO,SAASE,mBAAmBA,CAACC,MAAc,EAAE;EAClD,OAAOF,iBAAiB,CAACE,MAAM,CAAC;AAClC;AAEA,OAAO,IAAMC,aAAa,GAAG,SAAhBA,aAAaA,CAAA,EAAS;EACjC,OAAOhB,GAAG;AAMZ,CAAC;AAED,OAAO,IAAMiB,gBAAgB,gBAAGlB,MAAM,CAACmB,IAAI,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,4FACvC,UAAAC,IAAA;EAAA,IAAAC,WAAA,GAAAD,IAAA,CAAGP,MAAM;IAANA,MAAM,GAAAQ,WAAA,cAAG,MAAM,GAAAA,WAAA;EAAA,OAAOV,iBAAiB,CAACE,MAAM,CAAC;AAAA,GAC3C,UAAAS,KAAA;EAAA,IAAAC,YAAA,GAAAD,KAAA,CAAGE,MAAM;IAANA,MAAM,GAAAD,YAAA,cAAG,QAAQ,GAAAA,YAAA;EAAA,OAAOxB,MAAM,CAACyB,MAAM,CAAC;AAAA,GACpC,UAAAC,KAAA;EAAA,IAAAC,YAAA,GAAAD,KAAA,CAAGE,MAAM;IAANA,MAAM,GAAAD,YAAA,cAAG,KAAK,GAAAA,YAAA;EAAA,OAAQC,MAAM,GAAG,QAAQ,GAAG,SAAS;AAAA,CAAC,EACtD,UAAAC,KAAA;EAAA,IAAGC,MAAM,GAAAD,KAAA,CAANC,MAAM;EAAA,OAAOA,MAAM,IAAI7B,iBAAiB,CAAC6B,MAAM,CAAC;AAAA,GAChEf,aAAa,EACb,UAAAgB,KAAA;EAAA,IAAGC,SAAS,GAAAD,KAAA,CAATC,SAAS;EAAA,OACZA,SAAS,6DAIZ;AAAA,EAKA"}
|
|
@@ -5,11 +5,11 @@ import { colors } from '../_styles/colors';
|
|
|
5
5
|
import { getTypographyIntent } from './Typography.styles';
|
|
6
6
|
var StyledBodyCell = /*#__PURE__*/styled(Table.BodyCell).withConfig({
|
|
7
7
|
displayName: "StyledBodyCell",
|
|
8
|
-
componentId: "core-
|
|
8
|
+
componentId: "core-12_1_0__sc-p4v7d-0"
|
|
9
9
|
})([""]);
|
|
10
10
|
var StyledTextCell = /*#__PURE__*/styled(Table.TextCell).withConfig({
|
|
11
11
|
displayName: "StyledTextCell",
|
|
12
|
-
componentId: "core-
|
|
12
|
+
componentId: "core-12_1_0__sc-p4v7d-1"
|
|
13
13
|
})(["", " color:", ";"], getTypographyIntent('body'), colors.blue50);
|
|
14
14
|
function BodyCell() {
|
|
15
15
|
return /*#__PURE__*/React.createElement(StyledBodyCell, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Typography.types.js","names":[],"sources":["../../src/Typography/Typography.types.ts"],"sourcesContent":["import type { Color } from '../_styles/colors'\nimport type { Props } from '../_utils/types'\n\nexport type Intent = 'h1' | 'h2' | 'h3' | 'body' | 'small' | 'label'\n\nexport type Weight = 'regular' | 'semibold' | 'bold'\n\nexport interface TypographyProps extends Props {\n /**\n * When children are a string or multiple elements, they will be wrapped\n * by a `span`. When it is a single element, classnames will\n * be added to it instead\n * @since 10.19.0\n * */\n children: React.ReactNode\n\n /**\n * Change the HTML tag. This\n * [prop is from styled-components](https://styled-components.com/docs/api#as-polymorphic-prop)\n * __Warning__: If using TypeScript, it will not switch types and\n * some props may error. You can add `@ts-expect-error`.\n * See [styled-components issue](https://github.com/DefinitelyTyped/DefinitelyTyped/issues/30117)\n * @default 'span'\n * @since 10.19.0\n */\n as?: string | React.ComponentType<any> // styled-components as\n\n /**\n * Changes font color, can be any of the `colors` object HSL Palette\n * @default 'gray15'\n * @since 10.19.0\n */\n color?: Color\n\n /**\n * Changes the size of the font\n * @since 10.19.0\n */\n intent?: Intent\n\n /**\n * Applies `font-style: italic` if enabled\n * @since 10.19.0\n */\n italic?: boolean\n\n /**\n * Changes font weight if it is supported in the design system\n * @since 10.19.0\n */\n weight?: Weight\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"Typography.types.js","names":[],"sources":["../../src/Typography/Typography.types.ts"],"sourcesContent":["import type { Color } from '../_styles/colors'\nimport type { Props } from '../_utils/types'\n\nexport type Intent = 'h1' | 'h2' | 'h3' | 'body' | 'small' | 'label'\n\nexport type Weight = 'regular' | 'semibold' | 'bold'\n\nexport interface TypographyProps extends Props {\n /**\n * When children are a string or multiple elements, they will be wrapped\n * by a `span`. When it is a single element, classnames will\n * be added to it instead\n * @since 10.19.0\n * */\n children: React.ReactNode\n\n /**\n * Change the HTML tag. This\n * [prop is from styled-components](https://styled-components.com/docs/api#as-polymorphic-prop)\n * __Warning__: If using TypeScript, it will not switch types and\n * some props may error. You can add `@ts-expect-error`.\n * See [styled-components issue](https://github.com/DefinitelyTyped/DefinitelyTyped/issues/30117)\n * @default 'span'\n * @since 10.19.0\n */\n as?: string | React.ComponentType<any> // styled-components as\n\n /**\n * Changes font color, can be any of the `colors` object HSL Palette\n * @default 'gray15'\n * @since 10.19.0\n */\n color?: Color\n\n /**\n * Changes the size of the font\n * @since 10.19.0\n */\n intent?: Intent\n\n /**\n * Applies `font-style: italic` if enabled\n * @since 10.19.0\n */\n italic?: boolean\n\n /**\n * Changes font weight if it is supported in the design system\n * @since 10.19.0\n */\n weight?: Weight\n\n /**\n * Enables word wrapping and breaking within the component\n * @since 12.0.0\n */\n breakWord?: boolean\n}\n"],"mappings":""}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { Typography } from './Typography';
|
|
2
|
-
export { typographyWeights } from './Typography.styles';
|
|
2
|
+
export { getTypographyIntent, typographyWeights } from './Typography.styles';
|
|
3
3
|
export type { Intent as TypographyIntent, TypographyProps, Weight as TypographyWeight, } from './Typography.types';
|
package/dist/Typography/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Typography","typographyWeights"],"sources":["../../src/Typography/index.ts"],"sourcesContent":["export { Typography } from './Typography'\nexport { typographyWeights } from './Typography.styles'\nexport type {\n Intent as TypographyIntent,\n TypographyProps,\n Weight as TypographyWeight,\n} from './Typography.types'\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,iBAAiB,QAAQ,qBAAqB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["Typography","getTypographyIntent","typographyWeights"],"sources":["../../src/Typography/index.ts"],"sourcesContent":["export { Typography } from './Typography'\nexport { getTypographyIntent, typographyWeights } from './Typography.styles'\nexport type {\n Intent as TypographyIntent,\n TypographyProps,\n Weight as TypographyWeight,\n} from './Typography.types'\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,mBAAmB,EAAEC,iBAAiB,QAAQ,qBAAqB"}
|
package/dist/_hooks/Anchor.d.ts
CHANGED
|
@@ -54,18 +54,3 @@ export declare function useAnchor({ canFlip, dependencies, onLayout, padding, pl
|
|
|
54
54
|
* @deprecated Never officially documented/supported
|
|
55
55
|
*/
|
|
56
56
|
export declare function Anchor({ children, overlayRef, targetRef, ...props }: AnchorProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
57
|
-
/**
|
|
58
|
-
* @deprecatedSince 9
|
|
59
|
-
* @deprecated Never officially documented/supported
|
|
60
|
-
*/
|
|
61
|
-
export declare const AnchorContext: React.Context<AnchorApi>;
|
|
62
|
-
/**
|
|
63
|
-
* @deprecatedSince 9
|
|
64
|
-
* @deprecated Never officially documented/supported
|
|
65
|
-
*/
|
|
66
|
-
export declare function AnchorProvider({ children, ...props }: AnchorProps): React.JSX.Element;
|
|
67
|
-
/**
|
|
68
|
-
* @deprecatedSince 9
|
|
69
|
-
* @deprecated Never officially documented/supported
|
|
70
|
-
*/
|
|
71
|
-
export declare function useAnchorContext(): AnchorApi;
|
package/dist/_hooks/Anchor.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
var _excluded = ["children", "overlayRef", "targetRef"]
|
|
3
|
-
_excluded2 = ["children"];
|
|
2
|
+
var _excluded = ["children", "overlayRef", "targetRef"];
|
|
4
3
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
5
4
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
5
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
@@ -132,31 +131,4 @@ export function Anchor(_ref2) {
|
|
|
132
131
|
ref: overlayRef
|
|
133
132
|
}));
|
|
134
133
|
}
|
|
135
|
-
|
|
136
|
-
/* CONTEXT */
|
|
137
|
-
/**
|
|
138
|
-
* @deprecatedSince 9
|
|
139
|
-
* @deprecated Never officially documented/supported
|
|
140
|
-
*/
|
|
141
|
-
export var AnchorContext = /*#__PURE__*/React.createContext(initAnchor);
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* @deprecatedSince 9
|
|
145
|
-
* @deprecated Never officially documented/supported
|
|
146
|
-
*/
|
|
147
|
-
export function AnchorProvider(_ref3) {
|
|
148
|
-
var children = _ref3.children,
|
|
149
|
-
props = _objectWithoutProperties(_ref3, _excluded2);
|
|
150
|
-
return /*#__PURE__*/React.createElement(AnchorContext.Provider, {
|
|
151
|
-
value: useAnchor(props)
|
|
152
|
-
}, children);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* @deprecatedSince 9
|
|
157
|
-
* @deprecated Never officially documented/supported
|
|
158
|
-
*/
|
|
159
|
-
export function useAnchorContext() {
|
|
160
|
-
return React.useContext(AnchorContext);
|
|
161
|
-
}
|
|
162
134
|
//# sourceMappingURL=Anchor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Anchor.js","names":["React","getBoundingRect","getAnchorPosition","useLayoutEventListener","initAnchor","left","minWidth","placement","top","useAnchor","_ref","_ref$canFlip","canFlip","_ref$dependencies","dependencies","_ref$onLayout","onLayout","_ref$padding","padding","_ref$placement","overlayRef","targetRef","_ref$shrinkOverlay","shrinkOverlay","_ref$isFlyout","isFlyout","_React$useState","useState","_objectSpread","_React$useState2","_slicedToArray","anchor","setAnchor","viewChangeHandler","current","target","style","concat","width","newAnchor","undefined","event","handler","options","capture","useLayoutEffect","_toConsumableArray","Anchor","_ref2","children","props","_objectWithoutProperties","_excluded","content","cloneElement","ref"
|
|
1
|
+
{"version":3,"file":"Anchor.js","names":["React","getBoundingRect","getAnchorPosition","useLayoutEventListener","initAnchor","left","minWidth","placement","top","useAnchor","_ref","_ref$canFlip","canFlip","_ref$dependencies","dependencies","_ref$onLayout","onLayout","_ref$padding","padding","_ref$placement","overlayRef","targetRef","_ref$shrinkOverlay","shrinkOverlay","_ref$isFlyout","isFlyout","_React$useState","useState","_objectSpread","_React$useState2","_slicedToArray","anchor","setAnchor","viewChangeHandler","current","target","style","concat","width","newAnchor","undefined","event","handler","options","capture","useLayoutEffect","_toConsumableArray","Anchor","_ref2","children","props","_objectWithoutProperties","_excluded","content","cloneElement","ref"],"sources":["../../src/_hooks/Anchor.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react'\nimport React from 'react'\nimport { getBoundingRect } from '../_utils/dom'\nimport { getAnchorPosition } from '../_utils/getAnchorPosition'\nimport type { Placement } from '../_utils/types'\nimport { useLayoutEventListener } from './EventListener'\n\n/* TYPES */\n\n/**\n * @deprecatedSince 9\n * @deprecated Never officially documented/supported\n */\nexport interface AnchorConfig {\n canFlip?: boolean\n dependencies?: Array<any>\n onLayout?: (anchor: AnchorApi) => any\n overlayRef: React.RefObject<HTMLElement>\n padding?: number\n placement?: Placement\n targetRef: React.RefObject<HTMLElement>\n shrinkOverlay?: boolean\n isFlyout?: boolean\n}\n\n/**\n * @deprecatedSince 9\n * @deprecated Never officially documented/supported\n */\nexport interface AnchorProps extends PropsWithChildren<AnchorConfig> {}\n\n/**\n * @deprecatedSince 9\n * @deprecated Never officially documented/supported\n */\nexport interface AnchorApi {\n left: number\n /**\n * @deprecated\n *\n * use `shrinkOverlay` boolean property to set `minWidth`\n *\n * @deprecatedSince 10.20.0\n */\n minWidth: number\n placement: Placement\n top: number\n}\n\n/**\n * @deprecatedSince 9\n * @deprecated Never officially documented/supported\n */\nexport const initAnchor: AnchorApi = {\n left: 0,\n minWidth: 0,\n placement: 'bottom-left',\n top: 0,\n}\n\n/* HOOK */\n/**\n * @deprecatedSince 9\n * @deprecated Never officially documented/supported\n */\nexport function useAnchor({\n canFlip = true,\n dependencies = [],\n onLayout = () => {},\n padding = 0,\n placement = 'bottom-left',\n overlayRef,\n targetRef,\n shrinkOverlay = false,\n isFlyout = false,\n}: AnchorConfig): AnchorApi {\n const [anchor, setAnchor] = React.useState<AnchorApi>({\n ...initAnchor,\n placement,\n })\n\n const viewChangeHandler = () => {\n if (overlayRef.current && targetRef.current) {\n const target = getBoundingRect(targetRef.current)\n\n if (!shrinkOverlay) {\n // we should set minWidth before calculation\n overlayRef.current.style.minWidth = `${target.width}px`\n }\n\n const newAnchor = getAnchorPosition(\n placement,\n padding,\n undefined,\n target,\n getBoundingRect(overlayRef.current),\n canFlip,\n isFlyout\n )\n if (newAnchor.placement !== anchor.placement) {\n setAnchor(newAnchor)\n }\n onLayout(newAnchor)\n }\n }\n\n useLayoutEventListener({\n event: 'scroll',\n handler: viewChangeHandler,\n options: {\n capture: true,\n },\n })\n\n useLayoutEventListener({\n event: 'resize',\n handler: viewChangeHandler,\n })\n\n useLayoutEventListener({\n event: 'load',\n handler: viewChangeHandler,\n })\n\n React.useLayoutEffect(() => {\n viewChangeHandler()\n }, [overlayRef, ...dependencies])\n\n return anchor\n}\n\n/* RENDER PROP */\n\n/**\n * @deprecatedSince 9\n * @deprecated Never officially documented/supported\n */\nexport function Anchor({\n children,\n overlayRef,\n targetRef,\n ...props\n}: AnchorProps) {\n const anchor = useAnchor({\n ...props,\n overlayRef,\n targetRef,\n })\n\n const content =\n typeof children === 'function'\n ? (children as (props: AnchorApi) => React.ReactElement)(anchor)\n : (children as React.ReactElement)\n\n return (\n content &&\n React.cloneElement(content, {\n ...content.props,\n placement: anchor.placement,\n ref: overlayRef,\n })\n )\n}\n"],"mappings":"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"}
|
package/dist/_hooks/Buffer.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
interface BufferConfig {
|
|
3
2
|
initialValue: string;
|
|
4
3
|
}
|
|
@@ -8,9 +7,6 @@ interface BufferApi {
|
|
|
8
7
|
update: (value: string) => void;
|
|
9
8
|
value: string;
|
|
10
9
|
}
|
|
11
|
-
interface Props extends BufferConfig {
|
|
12
|
-
children?: React.ReactNode;
|
|
13
|
-
}
|
|
14
10
|
interface RenderProps extends BufferConfig {
|
|
15
11
|
children: (props: BufferApi) => {};
|
|
16
12
|
}
|
|
@@ -44,19 +40,4 @@ export declare function useBuffer({ initialValue }: BufferConfig): BufferApi;
|
|
|
44
40
|
* @deprecated
|
|
45
41
|
*/
|
|
46
42
|
export declare function Buffer({ children, ...props }: RenderProps): {};
|
|
47
|
-
/**
|
|
48
|
-
* @deprecatedSince 9.7.0
|
|
49
|
-
* @deprecated
|
|
50
|
-
*/
|
|
51
|
-
export declare const BufferContext: React.Context<BufferApi>;
|
|
52
|
-
/**
|
|
53
|
-
* @deprecatedSince 9.7.0
|
|
54
|
-
* @deprecated
|
|
55
|
-
*/
|
|
56
|
-
export declare function BufferProvider({ children, ...props }: Props): React.JSX.Element;
|
|
57
|
-
/**
|
|
58
|
-
* @deprecatedSince 9.7.0
|
|
59
|
-
* @deprecated
|
|
60
|
-
*/
|
|
61
|
-
export declare function useBufferContext(): BufferApi;
|
|
62
43
|
export {};
|
package/dist/_hooks/Buffer.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
var _excluded = ["children"]
|
|
2
|
-
_excluded2 = ["children"];
|
|
1
|
+
var _excluded = ["children"];
|
|
3
2
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
4
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -73,43 +72,4 @@ export function Buffer(_ref2) {
|
|
|
73
72
|
var buffer = useBuffer(props);
|
|
74
73
|
return typeof children === 'function' ? children(buffer) : children;
|
|
75
74
|
}
|
|
76
|
-
|
|
77
|
-
/* CONTEXT */
|
|
78
|
-
|
|
79
|
-
var noop = function noop(method) {
|
|
80
|
-
return function () {
|
|
81
|
-
return console.warn("Could not call `".concat(method, "`, please wrap your component in a `<BufferProvider>`"));
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* @deprecatedSince 9.7.0
|
|
87
|
-
* @deprecated
|
|
88
|
-
*/
|
|
89
|
-
export var BufferContext = /*#__PURE__*/React.createContext({
|
|
90
|
-
value: '',
|
|
91
|
-
clear: noop('clear'),
|
|
92
|
-
reset: noop('reset'),
|
|
93
|
-
update: noop('update')
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* @deprecatedSince 9.7.0
|
|
98
|
-
* @deprecated
|
|
99
|
-
*/
|
|
100
|
-
export function BufferProvider(_ref3) {
|
|
101
|
-
var children = _ref3.children,
|
|
102
|
-
props = _objectWithoutProperties(_ref3, _excluded2);
|
|
103
|
-
return /*#__PURE__*/React.createElement(BufferContext.Provider, {
|
|
104
|
-
value: useBuffer(props)
|
|
105
|
-
}, children);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* @deprecatedSince 9.7.0
|
|
110
|
-
* @deprecated
|
|
111
|
-
*/
|
|
112
|
-
export function useBufferContext() {
|
|
113
|
-
return React.useContext(BufferContext);
|
|
114
|
-
}
|
|
115
75
|
//# sourceMappingURL=Buffer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Buffer.js","names":["React","useBuffer","_ref","_ref$initialValue","initialValue","_React$useState","useState","_React$useState2","_slicedToArray","value","setValue","clear","reset","update","Buffer","_ref2","children","props","_objectWithoutProperties","_excluded","buffer"
|
|
1
|
+
{"version":3,"file":"Buffer.js","names":["React","useBuffer","_ref","_ref$initialValue","initialValue","_React$useState","useState","_React$useState2","_slicedToArray","value","setValue","clear","reset","update","Buffer","_ref2","children","props","_objectWithoutProperties","_excluded","buffer"],"sources":["../../src/_hooks/Buffer.tsx"],"sourcesContent":["import React from 'react'\n\n/* TYPES */\n\ninterface BufferConfig {\n initialValue: string\n}\n\ninterface BufferApi {\n clear: () => void\n reset: () => void\n update: (value: string) => void\n value: string\n}\n\ninterface Props extends BufferConfig {\n children?: React.ReactNode\n}\n\ninterface RenderProps extends BufferConfig {\n children: (props: BufferApi) => {}\n}\n\n/* HOOK */\n\n/**\n * @deprecatedSince 9.7.0\n * @deprecated A trivial hook for storing a string. Write your own or use a hook utility lib.\n * \n * **Source:**\n * ```\n export function useBuffer({ initialValue = '' }) {\n const [value, setValue] = React.useState(initialValue)\n\n const clear = () => setValue('')\n\n const reset = () => setValue(initialValue)\n\n const update = (value: string) => setValue(value)\n\n return {\n clear,\n reset,\n update,\n value,\n }\n}\n```\n */\nexport function useBuffer({ initialValue = '' }: BufferConfig): BufferApi {\n const [value, setValue] = React.useState(initialValue)\n\n const clear = () => setValue('')\n const reset = () => setValue(initialValue)\n const update = (value: string) => setValue(value)\n\n return {\n clear,\n reset,\n update,\n value,\n }\n}\n\n/* RENDER PROP */\n\n/**\n * @deprecatedSince 9.7.0\n * @deprecated\n */\nexport function Buffer({ children, ...props }: RenderProps) {\n const buffer = useBuffer(props)\n\n return typeof children === 'function' ? children(buffer) : children\n}\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;;AAEzB;;AAqBA;AAEA;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,SAASC,SAASA,CAAAC,IAAA,EAAiD;EAAA,IAAAC,iBAAA,GAAAD,IAAA,CAA9CE,YAAY;IAAZA,YAAY,GAAAD,iBAAA,cAAG,EAAE,GAAAA,iBAAA;EAC3C,IAAAE,eAAA,GAA0BL,KAAK,CAACM,QAAQ,CAACF,YAAY,CAAC;IAAAG,gBAAA,GAAAC,cAAA,CAAAH,eAAA;IAA/CI,KAAK,GAAAF,gBAAA;IAAEG,QAAQ,GAAAH,gBAAA;EAEtB,IAAMI,KAAK,GAAG,SAARA,KAAKA,CAAA;IAAA,OAASD,QAAQ,CAAC,EAAE,CAAC;EAAA;EAChC,IAAME,KAAK,GAAG,SAARA,KAAKA,CAAA;IAAA,OAASF,QAAQ,CAACN,YAAY,CAAC;EAAA;EAC1C,IAAMS,MAAM,GAAG,SAATA,MAAMA,CAAIJ,KAAa;IAAA,OAAKC,QAAQ,CAACD,KAAK,CAAC;EAAA;EAEjD,OAAO;IACLE,KAAK,EAALA,KAAK;IACLC,KAAK,EAALA,KAAK;IACLC,MAAM,EAANA,MAAM;IACNJ,KAAK,EAALA;EACF,CAAC;AACH;;AAEA;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASK,MAAMA,CAAAC,KAAA,EAAsC;EAAA,IAAnCC,QAAQ,GAAAD,KAAA,CAARC,QAAQ;IAAKC,KAAK,GAAAC,wBAAA,CAAAH,KAAA,EAAAI,SAAA;EACzC,IAAMC,MAAM,GAAGnB,SAAS,CAACgB,KAAK,CAAC;EAE/B,OAAO,OAAOD,QAAQ,KAAK,UAAU,GAAGA,QAAQ,CAACI,MAAM,CAAC,GAAGJ,QAAQ;AACrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { DateTimeProvider, useDateTime, type DateTimeContextConfig, type DateTimeFormatTypes, type DateTimeProviderProps, } from './DateTime';
|
|
1
|
+
export { dateTimeFormats, DateTimeProvider, useDateTime, type DateTimeContextConfig, type DateTimeFormatTypes, type DateTimeProviderProps, } from './DateTime';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { DateTimeProvider, useDateTime } from './DateTime';
|
|
1
|
+
export { dateTimeFormats, DateTimeProvider, useDateTime } from './DateTime';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["DateTimeProvider","useDateTime"],"sources":["../../../src/_hooks/DateTime/index.ts"],"sourcesContent":["export {\n DateTimeProvider,\n useDateTime,\n type DateTimeContextConfig,\n type DateTimeFormatTypes,\n type DateTimeProviderProps,\n} from './DateTime'\n"],"mappings":"AAAA,SACEA,gBAAgB,EAChBC,WAAW,QAIN,YAAY"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["dateTimeFormats","DateTimeProvider","useDateTime"],"sources":["../../../src/_hooks/DateTime/index.ts"],"sourcesContent":["export {\n dateTimeFormats,\n DateTimeProvider,\n useDateTime,\n type DateTimeContextConfig,\n type DateTimeFormatTypes,\n type DateTimeProviderProps,\n} from './DateTime'\n"],"mappings":"AAAA,SACEA,eAAe,EACfC,gBAAgB,EAChBC,WAAW,QAIN,YAAY"}
|
|
@@ -7,9 +7,6 @@ interface InjectedScriptApi {
|
|
|
7
7
|
isLoaded: boolean;
|
|
8
8
|
setLoaded: (isLoaded: boolean) => void;
|
|
9
9
|
}
|
|
10
|
-
interface Props extends InjectedScriptConfig {
|
|
11
|
-
children?: React.ReactNode;
|
|
12
|
-
}
|
|
13
10
|
interface RenderProps extends InjectedScriptConfig {
|
|
14
11
|
children?: ((props: InjectedScriptApi) => React.ReactNode) | null;
|
|
15
12
|
}
|
|
@@ -26,19 +23,4 @@ export declare function useInjectedScript({ id, src }: InjectedScriptConfig): {
|
|
|
26
23
|
* @deprecated Not a concern of the Design System. See source to duplicate https://github.com/procore/core/blob/%40procore/core-react%4010.30.0/packages/core-react/src/state/InjectedScript.tsx#L25
|
|
27
24
|
*/
|
|
28
25
|
export declare function InjectedScript({ children, ...props }: RenderProps): React.ReactNode;
|
|
29
|
-
/**
|
|
30
|
-
* @deprecatedSince 9
|
|
31
|
-
* @deprecated Never officially documented/supported
|
|
32
|
-
*/
|
|
33
|
-
export declare const InjectedScriptContext: React.Context<InjectedScriptApi>;
|
|
34
|
-
/**
|
|
35
|
-
* @deprecatedSince 9
|
|
36
|
-
* @deprecated Never officially documented/supported
|
|
37
|
-
*/
|
|
38
|
-
export declare function InjectedScriptProvider({ children, ...props }: Props): React.JSX.Element;
|
|
39
|
-
/**
|
|
40
|
-
* @deprecatedSince 9
|
|
41
|
-
* @deprecated Never officially documented/supported
|
|
42
|
-
*/
|
|
43
|
-
export declare function useInjectedScriptContext(): InjectedScriptApi;
|
|
44
26
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
var _excluded = ["children"]
|
|
2
|
-
_excluded2 = ["children"];
|
|
1
|
+
var _excluded = ["children"];
|
|
3
2
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
4
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -58,41 +57,4 @@ export function InjectedScript(_ref2) {
|
|
|
58
57
|
var injectedScript = useInjectedScript(props);
|
|
59
58
|
return typeof children === 'function' ? children(injectedScript) : children;
|
|
60
59
|
}
|
|
61
|
-
|
|
62
|
-
/* CONTEXT */
|
|
63
|
-
|
|
64
|
-
var noop = function noop(method) {
|
|
65
|
-
return function () {
|
|
66
|
-
return console.warn("Could not call `".concat(method, "`, please wrap your component in a `<InjectedScriptProvider>`"));
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* @deprecatedSince 9
|
|
72
|
-
* @deprecated Never officially documented/supported
|
|
73
|
-
*/
|
|
74
|
-
export var InjectedScriptContext = /*#__PURE__*/React.createContext({
|
|
75
|
-
isLoaded: false,
|
|
76
|
-
setLoaded: noop('setLoaded')
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* @deprecatedSince 9
|
|
81
|
-
* @deprecated Never officially documented/supported
|
|
82
|
-
*/
|
|
83
|
-
export function InjectedScriptProvider(_ref3) {
|
|
84
|
-
var children = _ref3.children,
|
|
85
|
-
props = _objectWithoutProperties(_ref3, _excluded2);
|
|
86
|
-
return /*#__PURE__*/React.createElement(InjectedScriptContext.Provider, {
|
|
87
|
-
value: useInjectedScript(props)
|
|
88
|
-
}, children);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* @deprecatedSince 9
|
|
93
|
-
* @deprecated Never officially documented/supported
|
|
94
|
-
*/
|
|
95
|
-
export function useInjectedScriptContext() {
|
|
96
|
-
return React.useContext(InjectedScriptContext);
|
|
97
|
-
}
|
|
98
60
|
//# sourceMappingURL=InjectedScript.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InjectedScript.js","names":["React","useInjectedScript","_ref","id","src","_React$useState","useState","_React$useState2","_slicedToArray","isLoaded","setLoaded","useEffect","existingScript","document","getElementById","script","createElement","type","async","onload","head","appendChild","InjectedScript","_ref2","_ref2$children","children","props","_objectWithoutProperties","_excluded","injectedScript"
|
|
1
|
+
{"version":3,"file":"InjectedScript.js","names":["React","useInjectedScript","_ref","id","src","_React$useState","useState","_React$useState2","_slicedToArray","isLoaded","setLoaded","useEffect","existingScript","document","getElementById","script","createElement","type","async","onload","head","appendChild","InjectedScript","_ref2","_ref2$children","children","props","_objectWithoutProperties","_excluded","injectedScript"],"sources":["../../src/_hooks/InjectedScript.tsx"],"sourcesContent":["import React from 'react'\n\n/* TYPES */\n\ninterface InjectedScriptConfig {\n id: string\n src: string\n}\n\ninterface InjectedScriptApi {\n isLoaded: boolean\n setLoaded: (isLoaded: boolean) => void\n}\n\ninterface Props extends InjectedScriptConfig {\n children?: React.ReactNode\n}\n\ninterface RenderProps extends InjectedScriptConfig {\n children?: ((props: InjectedScriptApi) => React.ReactNode) | null\n}\n\n/* HOOK */\n\n/**\n * @deprecatedSince 11\n * @deprecated Not a concern of the Design System. See source to duplicate https://github.com/procore/core/blob/%40procore/core-react%4010.30.0/packages/core-react/src/state/InjectedScript.tsx#L25\n */\nexport function useInjectedScript({ id, src }: InjectedScriptConfig) {\n const [isLoaded, setLoaded] = React.useState(false)\n\n React.useEffect(() => {\n const existingScript = document.getElementById(id)\n\n if (existingScript) {\n setLoaded(true)\n } else {\n const script = document.createElement('script')\n script.type = 'text/javascript'\n script.async = true\n script.id = id\n script.onload = () => {\n setLoaded(true)\n }\n script.src = src\n\n document.head && document.head.appendChild(script)\n }\n }, [id, src])\n\n return { isLoaded, setLoaded }\n}\n\n/* RENDER PROP */\n/**\n * @deprecatedSince 11\n * @deprecated Not a concern of the Design System. See source to duplicate https://github.com/procore/core/blob/%40procore/core-react%4010.30.0/packages/core-react/src/state/InjectedScript.tsx#L25\n */\nexport function InjectedScript({ children = null, ...props }: RenderProps) {\n const injectedScript = useInjectedScript(props)\n\n return typeof children === 'function' ? children(injectedScript) : children\n}\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;;AAEzB;;AAoBA;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAAAC,IAAA,EAAoC;EAAA,IAAjCC,EAAE,GAAAD,IAAA,CAAFC,EAAE;IAAEC,GAAG,GAAAF,IAAA,CAAHE,GAAG;EACzC,IAAAC,eAAA,GAA8BL,KAAK,CAACM,QAAQ,CAAC,KAAK,CAAC;IAAAC,gBAAA,GAAAC,cAAA,CAAAH,eAAA;IAA5CI,QAAQ,GAAAF,gBAAA;IAAEG,SAAS,GAAAH,gBAAA;EAE1BP,KAAK,CAACW,SAAS,CAAC,YAAM;IACpB,IAAMC,cAAc,GAAGC,QAAQ,CAACC,cAAc,CAACX,EAAE,CAAC;IAElD,IAAIS,cAAc,EAAE;MAClBF,SAAS,CAAC,IAAI,CAAC;IACjB,CAAC,MAAM;MACL,IAAMK,MAAM,GAAGF,QAAQ,CAACG,aAAa,CAAC,QAAQ,CAAC;MAC/CD,MAAM,CAACE,IAAI,GAAG,iBAAiB;MAC/BF,MAAM,CAACG,KAAK,GAAG,IAAI;MACnBH,MAAM,CAACZ,EAAE,GAAGA,EAAE;MACdY,MAAM,CAACI,MAAM,GAAG,YAAM;QACpBT,SAAS,CAAC,IAAI,CAAC;MACjB,CAAC;MACDK,MAAM,CAACX,GAAG,GAAGA,GAAG;MAEhBS,QAAQ,CAACO,IAAI,IAAIP,QAAQ,CAACO,IAAI,CAACC,WAAW,CAACN,MAAM,CAAC;IACpD;EACF,CAAC,EAAE,CAACZ,EAAE,EAAEC,GAAG,CAAC,CAAC;EAEb,OAAO;IAAEK,QAAQ,EAARA,QAAQ;IAAEC,SAAS,EAATA;EAAU,CAAC;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASY,cAAcA,CAAAC,KAAA,EAA6C;EAAA,IAAAC,cAAA,GAAAD,KAAA,CAA1CE,QAAQ;IAARA,QAAQ,GAAAD,cAAA,cAAG,IAAI,GAAAA,cAAA;IAAKE,KAAK,GAAAC,wBAAA,CAAAJ,KAAA,EAAAK,SAAA;EACxD,IAAMC,cAAc,GAAG5B,iBAAiB,CAACyB,KAAK,CAAC;EAE/C,OAAO,OAAOD,QAAQ,KAAK,UAAU,GAAGA,QAAQ,CAACI,cAAc,CAAC,GAAGJ,QAAQ;AAC7E"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
/**
|
|
3
2
|
* @deprecatedSince 9
|
|
4
3
|
* @deprecated Never officially documented/supported
|
|
@@ -24,9 +23,6 @@ export interface ListNavigationApi {
|
|
|
24
23
|
setSize: (index: number) => void;
|
|
25
24
|
size: number;
|
|
26
25
|
}
|
|
27
|
-
interface Props extends ListNavigationConfig {
|
|
28
|
-
children?: React.ReactNode;
|
|
29
|
-
}
|
|
30
26
|
interface RenderProps extends ListNavigationConfig {
|
|
31
27
|
children: (props: ListNavigationApi) => {};
|
|
32
28
|
}
|
|
@@ -40,35 +36,4 @@ export declare function useListNavigation({ circular, initialIndex, size: initia
|
|
|
40
36
|
* @deprecated Never officially documented/supported
|
|
41
37
|
*/
|
|
42
38
|
export declare function ListNavigation({ children, ...props }: RenderProps): {};
|
|
43
|
-
/**
|
|
44
|
-
* @deprecatedSince 9
|
|
45
|
-
* @deprecated Never officially documented/supported
|
|
46
|
-
*/
|
|
47
|
-
export declare const defaultApi: {
|
|
48
|
-
clear: () => void;
|
|
49
|
-
decrement: () => void;
|
|
50
|
-
decrementBy: () => void;
|
|
51
|
-
increment: () => void;
|
|
52
|
-
incrementBy: () => void;
|
|
53
|
-
index: number;
|
|
54
|
-
reset: () => void;
|
|
55
|
-
set: () => void;
|
|
56
|
-
setSize: () => void;
|
|
57
|
-
size: number;
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* @deprecatedSince 9
|
|
61
|
-
* @deprecated Never officially documented/supported
|
|
62
|
-
*/
|
|
63
|
-
export declare const ListNavigationContext: React.Context<ListNavigationApi>;
|
|
64
|
-
/**
|
|
65
|
-
* @deprecatedSince 9
|
|
66
|
-
* @deprecated Never officially documented/supported
|
|
67
|
-
*/
|
|
68
|
-
export declare function ListNavigationProvider({ children, ...props }: Props): React.JSX.Element;
|
|
69
|
-
/**
|
|
70
|
-
* @deprecatedSince 9
|
|
71
|
-
* @deprecated Never officially documented/supported
|
|
72
|
-
*/
|
|
73
|
-
export declare const useListNavigationContext: () => ListNavigationApi;
|
|
74
39
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
var _excluded = ["children"]
|
|
2
|
-
_excluded2 = ["children"];
|
|
1
|
+
var _excluded = ["children"];
|
|
3
2
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
4
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -100,55 +99,4 @@ export function ListNavigation(_ref2) {
|
|
|
100
99
|
var listNavigation = useListNavigation(props);
|
|
101
100
|
return typeof children === 'function' ? children(listNavigation) : children;
|
|
102
101
|
}
|
|
103
|
-
|
|
104
|
-
/* CONTEXT */
|
|
105
|
-
|
|
106
|
-
var noop = function noop(method) {
|
|
107
|
-
return function () {
|
|
108
|
-
return console.warn("Could not call `".concat(method, "`, please wrap your component in a `<ListNavigationProvider>`"));
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* @deprecatedSince 9
|
|
114
|
-
* @deprecated Never officially documented/supported
|
|
115
|
-
*/
|
|
116
|
-
export var defaultApi = {
|
|
117
|
-
clear: noop('clear'),
|
|
118
|
-
decrement: noop('decrement'),
|
|
119
|
-
decrementBy: noop('decrementBy'),
|
|
120
|
-
increment: noop('increment'),
|
|
121
|
-
incrementBy: noop('incrementBy'),
|
|
122
|
-
index: -1,
|
|
123
|
-
reset: noop('reset'),
|
|
124
|
-
set: noop('set'),
|
|
125
|
-
setSize: noop('setSize'),
|
|
126
|
-
size: 0
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* @deprecatedSince 9
|
|
131
|
-
* @deprecated Never officially documented/supported
|
|
132
|
-
*/
|
|
133
|
-
export var ListNavigationContext = /*#__PURE__*/React.createContext(defaultApi);
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* @deprecatedSince 9
|
|
137
|
-
* @deprecated Never officially documented/supported
|
|
138
|
-
*/
|
|
139
|
-
export function ListNavigationProvider(_ref3) {
|
|
140
|
-
var children = _ref3.children,
|
|
141
|
-
props = _objectWithoutProperties(_ref3, _excluded2);
|
|
142
|
-
return /*#__PURE__*/React.createElement(ListNavigationContext.Provider, {
|
|
143
|
-
value: useListNavigation(props)
|
|
144
|
-
}, children);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* @deprecatedSince 9
|
|
149
|
-
* @deprecated Never officially documented/supported
|
|
150
|
-
*/
|
|
151
|
-
export var useListNavigationContext = function useListNavigationContext() {
|
|
152
|
-
return React.useContext(ListNavigationContext);
|
|
153
|
-
};
|
|
154
102
|
//# sourceMappingURL=ListNavigation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListNavigation.js","names":["React","clamp","max","n","Math","min","wrap","useListNavigation","_ref","_ref$circular","circular","_ref$initialIndex","initialIndex","_ref$size","size","initialSize","_React$useState","useState","_React$useState2","_slicedToArray","index","setIndex","_React$useState3","_React$useState4","setSize","set","useCallback","i","clear","increment","incrementBy","amount","decrement","decrementBy","reset","ListNavigation","_ref2","children","props","_objectWithoutProperties","_excluded","listNavigation"
|
|
1
|
+
{"version":3,"file":"ListNavigation.js","names":["React","clamp","max","n","Math","min","wrap","useListNavigation","_ref","_ref$circular","circular","_ref$initialIndex","initialIndex","_ref$size","size","initialSize","_React$useState","useState","_React$useState2","_slicedToArray","index","setIndex","_React$useState3","_React$useState4","setSize","set","useCallback","i","clear","increment","incrementBy","amount","decrement","decrementBy","reset","ListNavigation","_ref2","children","props","_objectWithoutProperties","_excluded","listNavigation"],"sources":["../../src/_hooks/ListNavigation.tsx"],"sourcesContent":["import React from 'react'\n\n/* TYPES */\n\n/**\n * @deprecatedSince 9\n * @deprecated Never officially documented/supported\n */\nexport interface ListNavigationConfig {\n circular?: boolean\n initialIndex?: number\n size?: number\n}\n\n/**\n * @deprecatedSince 9\n * @deprecated Never officially documented/supported\n */\nexport interface ListNavigationApi {\n clear: () => void\n decrement: () => void\n decrementBy: (amount: number) => void\n increment: () => void\n incrementBy: (amount: number) => void\n index: number\n reset: () => void\n set: (index: number) => void\n setSize: (index: number) => void\n size: number\n}\n\ninterface Props extends ListNavigationConfig {\n children?: React.ReactNode\n}\n\ninterface RenderProps extends ListNavigationConfig {\n children: (props: ListNavigationApi) => {}\n}\n\nfunction clamp(max: number, n: number) {\n return Math.min(max - 1, Math.max(0, n))\n}\n\nfunction wrap(max: number, n: number) {\n if (max === 0) {\n return n\n }\n\n return n < 0 ? max + n : n % max\n}\n\n/**\n * @deprecatedSince 9\n * @deprecated Never officially documented/supported\n */\nexport function useListNavigation({\n circular = false,\n initialIndex = 0,\n size: initialSize = 0,\n}: ListNavigationConfig): ListNavigationApi {\n const [index, setIndex] = React.useState(initialIndex)\n\n const [size, setSize] = React.useState(initialSize)\n\n const set = React.useCallback(\n function (i: number) {\n if (size === 0) {\n setIndex(i)\n } else {\n setIndex(clamp(size, circular ? wrap(size, i) : i))\n }\n },\n [circular, size]\n )\n\n function clear() {\n set(0)\n }\n\n function increment() {\n set(index + 1)\n }\n\n function incrementBy(amount: number) {\n set(index + amount)\n }\n\n function decrement() {\n set(index - 1)\n }\n\n function decrementBy(amount: number) {\n set(index - amount)\n }\n\n function reset() {\n set(initialIndex)\n }\n\n return {\n clear,\n decrement,\n decrementBy,\n increment,\n incrementBy,\n index,\n reset,\n set,\n setSize,\n size,\n }\n}\n\n/* RENDER PROP */\n\n/**\n * @deprecatedSince 9\n * @deprecated Never officially documented/supported\n */\nexport function ListNavigation({ children, ...props }: RenderProps) {\n const listNavigation = useListNavigation(props)\n\n return typeof children === 'function' ? children(listNavigation) : children\n}\n"],"mappings":"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"}
|
|
@@ -5,10 +5,6 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5
5
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import ResizeObserverPolyfill from 'resize-observer-polyfill';
|
|
9
|
-
if (!(globalThis !== null && globalThis !== void 0 && globalThis.ResizeObserver)) {
|
|
10
|
-
globalThis.ResizeObserver = ResizeObserverPolyfill;
|
|
11
|
-
}
|
|
12
8
|
export function useResizeObserver(callback) {
|
|
13
9
|
var _React$useState = React.useState(null),
|
|
14
10
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -18,7 +14,7 @@ export function useResizeObserver(callback) {
|
|
|
18
14
|
if (!el || !callback) {
|
|
19
15
|
return;
|
|
20
16
|
}
|
|
21
|
-
var resizeObserver = new
|
|
17
|
+
var resizeObserver = new ResizeObserver(callback);
|
|
22
18
|
resizeObserver.observe(el);
|
|
23
19
|
return function () {
|
|
24
20
|
resizeObserver.disconnect();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResizeObserver.js","names":["React","
|
|
1
|
+
{"version":3,"file":"ResizeObserver.js","names":["React","useResizeObserver","callback","_React$useState","useState","_React$useState2","_slicedToArray","el","setEl","useEffect","resizeObserver","ResizeObserver","observe","disconnect"],"sources":["../../src/_hooks/ResizeObserver.ts"],"sourcesContent":["import React from 'react'\n\nexport function useResizeObserver<T extends Element = HTMLElement>(\n callback: ResizeObserverCallback\n): (el: T | null) => void {\n const [el, setEl] = React.useState<T | null>(null)\n\n React.useEffect(() => {\n if (!el || !callback) {\n return\n }\n\n const resizeObserver = new ResizeObserver(callback)\n resizeObserver.observe(el)\n\n return () => {\n resizeObserver.disconnect()\n }\n }, [el, callback])\n\n return setEl\n}\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAO,SAASC,iBAAiBA,CAC/BC,QAAgC,EACR;EACxB,IAAAC,eAAA,GAAoBH,KAAK,CAACI,QAAQ,CAAW,IAAI,CAAC;IAAAC,gBAAA,GAAAC,cAAA,CAAAH,eAAA;IAA3CI,EAAE,GAAAF,gBAAA;IAAEG,KAAK,GAAAH,gBAAA;EAEhBL,KAAK,CAACS,SAAS,CAAC,YAAM;IACpB,IAAI,CAACF,EAAE,IAAI,CAACL,QAAQ,EAAE;MACpB;IACF;IAEA,IAAMQ,cAAc,GAAG,IAAIC,cAAc,CAACT,QAAQ,CAAC;IACnDQ,cAAc,CAACE,OAAO,CAACL,EAAE,CAAC;IAE1B,OAAO,YAAM;MACXG,cAAc,CAACG,UAAU,CAAC,CAAC;IAC7B,CAAC;EACH,CAAC,EAAE,CAACN,EAAE,EAAEL,QAAQ,CAAC,CAAC;EAElB,OAAOM,KAAK;AACd"}
|