@activecollab/components 2.0.568 → 2.0.570
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Chip/ChipGroupStyles.js +1 -1
- package/dist/cjs/components/Chip/ChipGroupStyles.js.map +1 -1
- package/dist/cjs/components/Chip/Styles.js +2 -2
- package/dist/cjs/components/Chip/Styles.js.map +1 -1
- package/dist/cjs/components/ListSection/Styles.js +1 -1
- package/dist/cjs/components/ListSection/Styles.js.map +1 -1
- package/dist/cjs/components/MainMenu/MainMenu.js +0 -22
- package/dist/cjs/components/MainMenu/MainMenu.js.map +1 -1
- package/dist/cjs/components/Menu/Menu.js +3 -0
- package/dist/cjs/components/Menu/Menu.js.map +1 -1
- package/dist/cjs/components/NoteCard/NoteCard.js +23 -18
- package/dist/cjs/components/NoteCard/NoteCard.js.map +1 -1
- package/dist/cjs/components/NoteCard/Styles.js +62 -49
- package/dist/cjs/components/NoteCard/Styles.js.map +1 -1
- package/dist/cjs/components/NotebookCard/NotebookCard.js +45 -0
- package/dist/cjs/components/NotebookCard/NotebookCard.js.map +1 -0
- package/dist/cjs/components/NotebookCard/Styles.js +49 -0
- package/dist/cjs/components/NotebookCard/Styles.js.map +1 -0
- package/dist/cjs/components/NotebookCard/index.js +17 -0
- package/dist/cjs/components/NotebookCard/index.js.map +1 -0
- package/dist/cjs/components/PillButton/PillButton.js.map +1 -1
- package/dist/cjs/components/PillButton/Styles.js +5 -1
- package/dist/cjs/components/PillButton/Styles.js.map +1 -1
- package/dist/cjs/components/Popper/Popper.js +18 -1
- package/dist/cjs/components/Popper/Popper.js.map +1 -1
- package/dist/cjs/components/PropertyList/PropertyListPopover.js +3 -0
- package/dist/cjs/components/PropertyList/PropertyListPopover.js.map +1 -1
- package/dist/cjs/components/Select/Select.js +4 -2
- package/dist/cjs/components/Select/Select.js.map +1 -1
- package/dist/cjs/components/ViewSwitcher/Styles.js +22 -18
- package/dist/cjs/components/ViewSwitcher/Styles.js.map +1 -1
- package/dist/cjs/components/ViewSwitcher/ViewSwitcher.js +131 -144
- package/dist/cjs/components/ViewSwitcher/ViewSwitcher.js.map +1 -1
- package/dist/cjs/components/ViewSwitcher/index.js +0 -11
- package/dist/cjs/components/ViewSwitcher/index.js.map +1 -1
- package/dist/cjs/components/index.js +12 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/presentation/invoicing/invoiceObjectList.js +2 -4
- package/dist/cjs/presentation/invoicing/invoiceObjectList.js.map +1 -1
- package/dist/cjs/presentation/shared/ActivityFeed.js +2 -4
- package/dist/cjs/presentation/shared/ActivityFeed.js.map +1 -1
- package/dist/cjs/presentation/shared/PageViewSwitcher.js +5 -10
- package/dist/cjs/presentation/shared/PageViewSwitcher.js.map +1 -1
- package/dist/cjs/presentation/shared/TaskListSettingsDialog.js +3 -2
- package/dist/cjs/presentation/shared/TaskListSettingsDialog.js.map +1 -1
- package/dist/cjs/presentation/shared/headers.js +4 -8
- package/dist/cjs/presentation/shared/headers.js.map +1 -1
- package/dist/cjs/presentation/shared/systemSettingsDialog.js +13 -8
- package/dist/cjs/presentation/shared/systemSettingsDialog.js.map +1 -1
- package/dist/esm/components/Chip/ChipGroupStyles.js +2 -2
- package/dist/esm/components/Chip/ChipGroupStyles.js.map +1 -1
- package/dist/esm/components/Chip/Styles.d.ts +5 -0
- package/dist/esm/components/Chip/Styles.d.ts.map +1 -1
- package/dist/esm/components/Chip/Styles.js +1 -1
- package/dist/esm/components/Chip/Styles.js.map +1 -1
- package/dist/esm/components/ListSection/Styles.js +1 -1
- package/dist/esm/components/ListSection/Styles.js.map +1 -1
- package/dist/esm/components/MainMenu/MainMenu.d.ts.map +1 -1
- package/dist/esm/components/MainMenu/MainMenu.js +0 -20
- package/dist/esm/components/MainMenu/MainMenu.js.map +1 -1
- package/dist/esm/components/Menu/Menu.d.ts +2 -0
- package/dist/esm/components/Menu/Menu.d.ts.map +1 -1
- package/dist/esm/components/Menu/Menu.js +3 -0
- package/dist/esm/components/Menu/Menu.js.map +1 -1
- package/dist/esm/components/NoteCard/NoteCard.d.ts +13 -7
- package/dist/esm/components/NoteCard/NoteCard.d.ts.map +1 -1
- package/dist/esm/components/NoteCard/NoteCard.js +24 -19
- package/dist/esm/components/NoteCard/NoteCard.js.map +1 -1
- package/dist/esm/components/NoteCard/Styles.d.ts +7 -6
- package/dist/esm/components/NoteCard/Styles.d.ts.map +1 -1
- package/dist/esm/components/NoteCard/Styles.js +59 -48
- package/dist/esm/components/NoteCard/Styles.js.map +1 -1
- package/dist/esm/components/NotebookCard/NotebookCard.d.ts +21 -0
- package/dist/esm/components/NotebookCard/NotebookCard.d.ts.map +1 -0
- package/dist/esm/components/NotebookCard/NotebookCard.js +35 -0
- package/dist/esm/components/NotebookCard/NotebookCard.js.map +1 -0
- package/dist/esm/components/NotebookCard/Styles.d.ts +11 -0
- package/dist/esm/components/NotebookCard/Styles.d.ts.map +1 -0
- package/dist/esm/components/NotebookCard/Styles.js +42 -0
- package/dist/esm/components/NotebookCard/Styles.js.map +1 -0
- package/dist/esm/components/NotebookCard/index.d.ts +2 -0
- package/dist/esm/components/NotebookCard/index.d.ts.map +1 -0
- package/dist/esm/components/NotebookCard/index.js +2 -0
- package/dist/esm/components/NotebookCard/index.js.map +1 -0
- package/dist/esm/components/PillButton/PillButton.d.ts +2 -2
- package/dist/esm/components/PillButton/PillButton.d.ts.map +1 -1
- package/dist/esm/components/PillButton/PillButton.js.map +1 -1
- package/dist/esm/components/PillButton/Styles.d.ts.map +1 -1
- package/dist/esm/components/PillButton/Styles.js +3 -1
- package/dist/esm/components/PillButton/Styles.js.map +1 -1
- package/dist/esm/components/Popper/Popper.d.ts +2 -0
- package/dist/esm/components/Popper/Popper.d.ts.map +1 -1
- package/dist/esm/components/Popper/Popper.js +16 -1
- package/dist/esm/components/Popper/Popper.js.map +1 -1
- package/dist/esm/components/PropertyList/PropertyListPopover.d.ts +3 -1
- package/dist/esm/components/PropertyList/PropertyListPopover.d.ts.map +1 -1
- package/dist/esm/components/PropertyList/PropertyListPopover.js +3 -0
- package/dist/esm/components/PropertyList/PropertyListPopover.js.map +1 -1
- package/dist/esm/components/Select/Select.d.ts +2 -0
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js +4 -2
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/ViewSwitcher/Styles.d.ts +6 -3
- package/dist/esm/components/ViewSwitcher/Styles.d.ts.map +1 -1
- package/dist/esm/components/ViewSwitcher/Styles.js +20 -16
- package/dist/esm/components/ViewSwitcher/Styles.js.map +1 -1
- package/dist/esm/components/ViewSwitcher/ViewSwitcher.d.ts +9 -12
- package/dist/esm/components/ViewSwitcher/ViewSwitcher.d.ts.map +1 -1
- package/dist/esm/components/ViewSwitcher/ViewSwitcher.js +124 -139
- package/dist/esm/components/ViewSwitcher/ViewSwitcher.js.map +1 -1
- package/dist/esm/components/ViewSwitcher/index.d.ts +0 -1
- package/dist/esm/components/ViewSwitcher/index.d.ts.map +1 -1
- package/dist/esm/components/ViewSwitcher/index.js +0 -1
- package/dist/esm/components/ViewSwitcher/index.js.map +1 -1
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/presentation/invoicing/invoiceObjectList.d.ts.map +1 -1
- package/dist/esm/presentation/invoicing/invoiceObjectList.js +2 -4
- package/dist/esm/presentation/invoicing/invoiceObjectList.js.map +1 -1
- package/dist/esm/presentation/shared/ActivityFeed.d.ts.map +1 -1
- package/dist/esm/presentation/shared/ActivityFeed.js +2 -4
- package/dist/esm/presentation/shared/ActivityFeed.js.map +1 -1
- package/dist/esm/presentation/shared/PageViewSwitcher.d.ts.map +1 -1
- package/dist/esm/presentation/shared/PageViewSwitcher.js +5 -10
- package/dist/esm/presentation/shared/PageViewSwitcher.js.map +1 -1
- package/dist/esm/presentation/shared/TaskListSettingsDialog.d.ts.map +1 -1
- package/dist/esm/presentation/shared/TaskListSettingsDialog.js +3 -2
- package/dist/esm/presentation/shared/TaskListSettingsDialog.js.map +1 -1
- package/dist/esm/presentation/shared/headers.d.ts.map +1 -1
- package/dist/esm/presentation/shared/headers.js +4 -8
- package/dist/esm/presentation/shared/headers.js.map +1 -1
- package/dist/esm/presentation/shared/systemSettingsDialog.d.ts +22 -1
- package/dist/esm/presentation/shared/systemSettingsDialog.d.ts.map +1 -1
- package/dist/esm/presentation/shared/systemSettingsDialog.js +12 -7
- package/dist/esm/presentation/shared/systemSettingsDialog.js.map +1 -1
- package/dist/index.js +469 -493
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/components/ViewSwitcher/ViewIllustration.js +0 -127
- package/dist/cjs/components/ViewSwitcher/ViewIllustration.js.map +0 -1
- package/dist/esm/components/ViewSwitcher/ViewIllustration.d.ts +0 -20
- package/dist/esm/components/ViewSwitcher/ViewIllustration.d.ts.map +0 -1
- package/dist/esm/components/ViewSwitcher/ViewIllustration.js +0 -91
- package/dist/esm/components/ViewSwitcher/ViewIllustration.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.js","names":["styled","css","BoxSizingStyle","FontStyle","StyledPillIcon","span","withConfig","displayName","componentId","StyledPillPlaceholder","ACTIVE_COLORS","alert","warning","activeColors","tone","activeStyle","hoverTextStyle","toneStyle","compactStyle","PILL_HEIGHTS","xsmall","small","medium","xsmallStyle","StyledPillButton","button","props","$size","$inset","$empty","$dimDisabled","$tone","$iconOnly","$compact","$active"],"sources":["../../../../src/components/PillButton/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { PillButtonProps } from \"./PillButton\";\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { FontStyle } from \"../FontStyle\";\n\ninterface StyledPillButtonProps {\n $tone: NonNullable<PillButtonProps[\"tone\"]>;\n $active: boolean;\n $empty: boolean;\n $iconOnly: boolean;\n $compact: PillButtonProps[\"compact\"];\n $size: NonNullable<PillButtonProps[\"size\"]>;\n $inset: NonNullable<PillButtonProps[\"inset\"]>;\n $dimDisabled: boolean;\n}\n\nexport const StyledPillIcon = styled.span`\n display: inline-flex;\n flex-shrink: 0;\n color: var(--color-theme-600);\n\n svg {\n width: 18px;\n height: 18px;\n fill: currentColor;\n }\n`;\n\nStyledPillIcon.displayName = \"StyledPillIcon\";\n\nexport const StyledPillPlaceholder = styled.span`\n overflow: hidden;\n text-overflow: ellipsis;\n`;\n\nStyledPillPlaceholder.displayName = \"StyledPillPlaceholder\";\n\nconst ACTIVE_COLORS = {\n alert: [\"var(--alert-surface-subtle)\", \"var(--red-alert)\"],\n warning: [\"var(--note-bg)\", \"var(--warning-text)\"],\n};\n\nconst activeColors = (tone: StyledPillButtonProps[\"$tone\"]) =>\n tone === \"alert\" || tone === \"warning\"\n ? ACTIVE_COLORS[tone]\n : [\"var(--pill-background-active)\", \"var(--color-primary)\"];\n\nconst activeStyle = (tone: StyledPillButtonProps[\"$tone\"]) => css`\n background-color: ${activeColors(tone)[0]};\n color: ${activeColors(tone)[1]};\n\n ${StyledPillIcon} {\n color: ${activeColors(tone)[1]};\n }\n\n /* An icon in the value takes the color of the text too, its outline as well. */\n svg {\n fill: currentColor;\n }\n\n svg [stroke]:not([stroke=\"none\"]) {\n stroke: currentColor;\n }\n`;\n\nconst hoverTextStyle = css`\n color: var(--color-theme-900);\n\n ${StyledPillIcon} {\n color: var(--color-theme-900);\n }\n`;\n\nconst toneStyle = (tone: StyledPillButtonProps[\"$tone\"]) => {\n switch (tone) {\n case \"alternate\":\n return css`\n background-color: var(--color-theme-300);\n\n &:hover,\n &:focus-visible {\n background-color: var(--color-theme-400);\n ${hoverTextStyle}\n }\n `;\n case \"accent\":\n return css`\n background-color: color-mix(\n in srgb,\n var(--color-primary) 15%,\n transparent\n );\n color: var(--color-primary);\n\n ${StyledPillIcon} {\n color: var(--color-primary);\n }\n\n &:hover,\n &:focus-visible {\n background-color: color-mix(\n in srgb,\n var(--color-primary) 25%,\n transparent\n );\n color: var(--color-primary);\n }\n `;\n case \"ghost\":\n return css`\n background-color: transparent;\n\n .c-pill-host:hover &.c-pill-button--ghost,\n &:focus-visible {\n background-color: var(--pill-background);\n }\n\n .c-pill-host:hover &.c-pill-button--ghost:hover,\n &:hover {\n background-color: var(--pill-background-hover);\n ${hoverTextStyle}\n }\n `;\n case \"outlined\":\n return css`\n background-color: transparent;\n border: 1px solid var(--color-theme-700);\n\n &:hover,\n &:focus-visible {\n border-color: var(--color-primary);\n color: var(--color-primary);\n\n ${StyledPillIcon} {\n color: var(--color-primary);\n }\n }\n `;\n default:\n return css`\n background-color: var(--pill-background);\n\n &:hover,\n &:focus-visible {\n background-color: var(--pill-background-hover);\n ${hoverTextStyle}\n }\n `;\n }\n};\n\nconst compactStyle = css`\n ${StyledPillPlaceholder} {\n display: none;\n }\n`;\n\nconst PILL_HEIGHTS = {
|
|
1
|
+
{"version":3,"file":"Styles.js","names":["styled","css","BoxSizingStyle","FontStyle","StyledPillIcon","span","withConfig","displayName","componentId","StyledPillPlaceholder","ACTIVE_COLORS","alert","warning","activeColors","tone","activeStyle","hoverTextStyle","toneStyle","compactStyle","PILL_HEIGHTS","xsmall","small","dense","medium","denseStyle","xsmallStyle","StyledPillButton","button","props","$size","$inset","$empty","$dimDisabled","$tone","$iconOnly","$compact","$active"],"sources":["../../../../src/components/PillButton/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { PillButtonProps } from \"./PillButton\";\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { FontStyle } from \"../FontStyle\";\n\ninterface StyledPillButtonProps {\n $tone: NonNullable<PillButtonProps[\"tone\"]>;\n $active: boolean;\n $empty: boolean;\n $iconOnly: boolean;\n $compact: PillButtonProps[\"compact\"];\n $size: NonNullable<PillButtonProps[\"size\"]>;\n $inset: NonNullable<PillButtonProps[\"inset\"]>;\n $dimDisabled: boolean;\n}\n\nexport const StyledPillIcon = styled.span`\n display: inline-flex;\n flex-shrink: 0;\n color: var(--color-theme-600);\n\n svg {\n width: 18px;\n height: 18px;\n fill: currentColor;\n }\n`;\n\nStyledPillIcon.displayName = \"StyledPillIcon\";\n\nexport const StyledPillPlaceholder = styled.span`\n overflow: hidden;\n text-overflow: ellipsis;\n`;\n\nStyledPillPlaceholder.displayName = \"StyledPillPlaceholder\";\n\nconst ACTIVE_COLORS = {\n alert: [\"var(--alert-surface-subtle)\", \"var(--red-alert)\"],\n warning: [\"var(--note-bg)\", \"var(--warning-text)\"],\n};\n\nconst activeColors = (tone: StyledPillButtonProps[\"$tone\"]) =>\n tone === \"alert\" || tone === \"warning\"\n ? ACTIVE_COLORS[tone]\n : [\"var(--pill-background-active)\", \"var(--color-primary)\"];\n\nconst activeStyle = (tone: StyledPillButtonProps[\"$tone\"]) => css`\n background-color: ${activeColors(tone)[0]};\n color: ${activeColors(tone)[1]};\n\n ${StyledPillIcon} {\n color: ${activeColors(tone)[1]};\n }\n\n /* An icon in the value takes the color of the text too, its outline as well. */\n svg {\n fill: currentColor;\n }\n\n svg [stroke]:not([stroke=\"none\"]) {\n stroke: currentColor;\n }\n`;\n\nconst hoverTextStyle = css`\n color: var(--color-theme-900);\n\n ${StyledPillIcon} {\n color: var(--color-theme-900);\n }\n`;\n\nconst toneStyle = (tone: StyledPillButtonProps[\"$tone\"]) => {\n switch (tone) {\n case \"alternate\":\n return css`\n background-color: var(--color-theme-300);\n\n &:hover,\n &:focus-visible {\n background-color: var(--color-theme-400);\n ${hoverTextStyle}\n }\n `;\n case \"accent\":\n return css`\n background-color: color-mix(\n in srgb,\n var(--color-primary) 15%,\n transparent\n );\n color: var(--color-primary);\n\n ${StyledPillIcon} {\n color: var(--color-primary);\n }\n\n &:hover,\n &:focus-visible {\n background-color: color-mix(\n in srgb,\n var(--color-primary) 25%,\n transparent\n );\n color: var(--color-primary);\n }\n `;\n case \"ghost\":\n return css`\n background-color: transparent;\n\n .c-pill-host:hover &.c-pill-button--ghost,\n &:focus-visible {\n background-color: var(--pill-background);\n }\n\n .c-pill-host:hover &.c-pill-button--ghost:hover,\n &:hover {\n background-color: var(--pill-background-hover);\n ${hoverTextStyle}\n }\n `;\n case \"outlined\":\n return css`\n background-color: transparent;\n border: 1px solid var(--color-theme-700);\n\n &:hover,\n &:focus-visible {\n border-color: var(--color-primary);\n color: var(--color-primary);\n\n ${StyledPillIcon} {\n color: var(--color-primary);\n }\n }\n `;\n default:\n return css`\n background-color: var(--pill-background);\n\n &:hover,\n &:focus-visible {\n background-color: var(--pill-background-hover);\n ${hoverTextStyle}\n }\n `;\n }\n};\n\nconst compactStyle = css`\n ${StyledPillPlaceholder} {\n display: none;\n }\n`;\n\nconst PILL_HEIGHTS = {\n xsmall: \"18px\",\n small: \"24px\",\n dense: \"24px\",\n medium: \"26px\",\n};\n\nconst denseStyle = css`\n gap: 4px;\n --c-pill-padding-x: 11px;\n font-size: calc(0.75rem * var(--text-scale, 1));\n\n ${StyledPillIcon} svg {\n width: 12px;\n height: 12px;\n }\n`;\n\n/* The size of a type chip: small caps of an object type or a state switch. */\nconst xsmallStyle = css`\n gap: 3px;\n --c-pill-padding-x: 6px;\n font-size: calc(0.625rem * var(--text-scale, 1));\n font-weight: 600;\n\n ${StyledPillIcon} svg {\n width: 12px;\n height: 12px;\n }\n`;\n\nexport const StyledPillButton = styled.button<StyledPillButtonProps>`\n ${FontStyle}\n ${BoxSizingStyle}\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n flex-shrink: 0;\n max-width: 100%;\n height: ${(props) => PILL_HEIGHTS[props.$size]};\n margin: 0;\n --c-pill-padding-x: ${(props) => (props.$inset === \"tight\" ? \"6px\" : \"10px\")};\n padding: 0 var(--c-pill-padding-x);\n border: none;\n border-radius: var(--ac-br-rounded);\n font-size: calc(0.875rem * var(--text-scale, 1));\n font-weight: 500;\n line-height: 1;\n white-space: nowrap;\n color: ${(props) =>\n props.$empty ? \"var(--color-theme-700)\" : \"var(--color-theme-800)\"};\n cursor: pointer;\n user-select: none;\n\n &:focus {\n outline: none;\n }\n\n &:disabled {\n cursor: default;\n opacity: ${(props) => (props.$dimDisabled ? \"50%\" : \"100%\")};\n pointer-events: none;\n }\n\n ${(props) => toneStyle(props.$tone)}\n\n ${(props) =>\n props.$tone === \"ghost\" &&\n props.$empty &&\n css`\n ${StyledPillIcon}, ${StyledPillPlaceholder} {\n opacity: 0;\n }\n\n .c-pill-host:hover &.c-pill-button--ghost,\n &:hover,\n &:focus-visible,\n &[aria-expanded=\"true\"] {\n ${StyledPillIcon}, ${StyledPillPlaceholder} {\n opacity: 1;\n }\n }\n `}\n\n ${(props) =>\n props.$iconOnly &&\n css`\n width: 36px;\n padding: 0;\n\n ${StyledPillIcon} svg {\n width: 16px;\n height: 16px;\n }\n `}\n\n ${(props) => props.$size === \"xsmall\" && xsmallStyle}\n\n ${(props) => props.$size === \"dense\" && denseStyle}\n\n ${(props) => props.$compact === true && compactStyle}\n\n ${(props) =>\n props.$compact === \"mobile\" &&\n css`\n @media (max-width: 768px) {\n ${compactStyle}\n }\n `}\n\n /* An active pill keeps its look on hover and focus. */\n ${(props) =>\n props.$active &&\n css`\n &,\n &:hover,\n &:focus-visible {\n ${activeStyle(props.$tone)}\n }\n `}\n\n /* Last, so an open trigger shows the active look in every tone. */\n &[aria-haspopup][aria-expanded=\"true\"],\n .c-pill-host:hover &[aria-haspopup][aria-expanded=\"true\"] {\n ${(props) => activeStyle(props.$tone)}\n }\n`;\n\nStyledPillButton.displayName = \"StyledPillButton\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAG/C,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,SAAS,QAAQ,cAAc;AAaxC,OAAO,MAAMC,cAAc,GAAGJ,MAAM,CAACK,IAAI,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,qHA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AKEL,KAAK,IAAKb,WAAW,CAACa,KAAK,CAACK,KAAK,CAAC,CAExC;AAEDP,gBAAgB,CAACnB,WAAW,GAAG,kBAAkB","ignoreList":[]}
|
|
@@ -28,6 +28,8 @@ interface PopperProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
|
28
28
|
strategy?: PositioningStrategy;
|
|
29
29
|
/** After Write callback */
|
|
30
30
|
afterWrite?: (...args: any[]) => void;
|
|
31
|
+
/** Follow the anchor when it changes size while the popper is open. Off by default. */
|
|
32
|
+
followAnchor?: boolean;
|
|
31
33
|
/** Extra Popper.js modifiers, merged with the built-in ones */
|
|
32
34
|
modifiers?: PopperModifier[];
|
|
33
35
|
/** Component children */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popper.d.ts","sourceRoot":"","sources":["../../../../src/components/Popper/Popper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAMZ,aAAa,EACb,SAAS,EACT,cAAc,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAGL,QAAQ,EAER,mBAAmB,EAEpB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC;AAI9B,MAAM,MAAM,cAAc,GAAG,OAAO,CAClC,QAAQ,CAAC,MAAM,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC,CAC7C,CAAC;AAEF,UAAU,eAAe;IACvB,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AACD,UAAU,WAAW;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CAC3C;AAED,UAAU,WAAY,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IAC5E,sBAAsB;IACtB,QAAQ,CAA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AU,WAAY,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IAC5E,sBAAsB;IACtB,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC1B,WAAW;IACX,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,mBAAmB;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,4BAA4B;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB;IAChB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,eAAe;IACf,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,2BAA2B;IAC3B,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,OAAA,KAAK,IAAI,CAAC;IAC/B,uFAAuF;IACvF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;IAE7B,yBAAyB;IACzB,QAAQ,CAAC,EAAE,SAAS,GAAG,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;CACvD;AAED,eAAO,MAAM,MAAM,oFA+KlB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["children", "anchorEl", "open", "style", "transition", "placement", "strategy", "afterWrite", "modifiers"];
|
|
3
|
+
const _excluded = ["children", "anchorEl", "open", "style", "transition", "placement", "strategy", "afterWrite", "followAnchor", "modifiers"];
|
|
4
4
|
import React, { forwardRef, useCallback, useRef, useEffect, useState } from "react";
|
|
5
5
|
import { createPopper } from "@popperjs/core";
|
|
6
6
|
import { StyledPopper } from "./Styles";
|
|
@@ -18,6 +18,8 @@ export const Popper = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
18
18
|
_ref$strategy = _ref.strategy,
|
|
19
19
|
strategy = _ref$strategy === void 0 ? "absolute" : _ref$strategy,
|
|
20
20
|
afterWrite = _ref.afterWrite,
|
|
21
|
+
_ref$followAnchor = _ref.followAnchor,
|
|
22
|
+
followAnchor = _ref$followAnchor === void 0 ? false : _ref$followAnchor,
|
|
21
23
|
extraModifiers = _ref.modifiers,
|
|
22
24
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
23
25
|
const _useState = useState(true),
|
|
@@ -106,6 +108,19 @@ export const Popper = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
106
108
|
handleClose();
|
|
107
109
|
}
|
|
108
110
|
}, [open, transition]);
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
if (!followAnchor || !open || !anchorEl || typeof ResizeObserver === "undefined") {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// eslint-disable-next-line compat/compat -- guarded above
|
|
117
|
+
const observer = new ResizeObserver(() => {
|
|
118
|
+
var _popperRef$current;
|
|
119
|
+
(_popperRef$current = popperRef.current) == null || _popperRef$current.update();
|
|
120
|
+
});
|
|
121
|
+
observer.observe(anchorEl);
|
|
122
|
+
return () => observer.disconnect();
|
|
123
|
+
}, [anchorEl, followAnchor, open]);
|
|
109
124
|
useEffect(() => {
|
|
110
125
|
if (popperRef.current) {
|
|
111
126
|
popperRef.current.update();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popper.js","names":["React","forwardRef","useCallback","useRef","useEffect","useState","createPopper","StyledPopper","useForkRef","Popper","_ref","ref","children","anchorEl","_ref$open","open","style","_ref$transition","transition","_ref$placement","placement","initialPlacement","_ref$strategy","strategy","afterWrite","extraModifiers","modifiers","rest","_objectWithoutPropertiesLoose","_excluded","_useState","exited","setExited","_useState2","setPlacement","ownRef","popperRef","handleInnerRef","handlePopperUpdate","data","handleOpen","current","destroy","name","enabled","phase","fn","referenceElement","currentElement","isHidden","computedStyle","getComputedStyle","display","visibility","parentElement","_ownRef$current","setAttribute","_ownRef$current2","removeAttribute","push","onFirstUpdate","handleClose","handleRef","node","handleEnter","handleExited","update","childProps","transitionProps","in","onEnter","onExited","createElement","_extends","displayName"],"sources":["../../../../src/components/Popper/Popper.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useRef,\n useEffect,\n useState,\n CSSProperties,\n ReactNode,\n HTMLAttributes,\n} from \"react\";\n\nimport {\n createPopper,\n Instance,\n Modifier,\n Options as PopperOptions,\n PositioningStrategy,\n State,\n} from \"@popperjs/core\";\n\nimport { Placement } from \".\";\nimport { StyledPopper } from \"./Styles\";\nimport useForkRef from \"../../utils/useForkRef\";\ntype CustomModifier = Modifier<string, PopperOptions>;\nexport type PopperModifier = Partial<\n Modifier<string, { [key: string]: unknown }>\n>;\n\ninterface TransitionProps {\n in: boolean;\n onEnter: () => void;\n onExited: () => void;\n}\ninterface IChildProps {\n placement: Placement;\n transitionProps: Partial<TransitionProps>;\n}\n\ninterface PopperProps extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\n /** Anchor Element. */\n anchorEl?: Element | null;\n /** Open */\n open?: boolean;\n /** Inline style */\n style?: CSSProperties;\n /** Child with transition */\n transition?: boolean;\n /** Placement */\n placement?: Placement;\n /** Strategy */\n strategy?: PositioningStrategy;\n /** After Write callback */\n afterWrite?: (...args) => void;\n /** Extra Popper.js modifiers, merged with the built-in ones */\n modifiers?: PopperModifier[];\n\n /** Component children */\n children?: ReactNode | React.FC<Partial<IChildProps>>;\n}\n\nexport const Popper = forwardRef<HTMLDivElement, PopperProps>(\n (\n {\n children,\n anchorEl,\n open = false,\n style,\n transition = false,\n placement: initialPlacement = \"bottom\",\n strategy = \"absolute\",\n afterWrite,\n modifiers: extraModifiers,\n ...rest\n },\n ref\n ) => {\n const [exited, setExited] = useState(true);\n const [placement, setPlacement] = useState(initialPlacement);\n const ownRef = useRef<HTMLDivElement | null>(null);\n const popperRef = useRef<Instance>();\n\n const handleInnerRef = useForkRef(ownRef, ref);\n\n const handlePopperUpdate = (data: Partial<State>): void => {\n setPlacement(data.placement || \"bottom\");\n };\n\n const handleOpen = useCallback(() => {\n if (!ownRef.current || !anchorEl || !open) {\n return;\n }\n\n if (popperRef.current) {\n popperRef.current.destroy();\n }\n\n const modifiers: (CustomModifier | PopperModifier)[] = [\n ...(extraModifiers || []),\n {\n name: \"hide\",\n enabled: true,\n phase: \"main\",\n fn: () => {\n const referenceElement = anchorEl as HTMLElement;\n\n let currentElement: HTMLElement | null = referenceElement;\n let isHidden = false;\n while (currentElement) {\n const computedStyle = getComputedStyle(currentElement);\n if (\n computedStyle.display === \"none\" ||\n computedStyle.visibility === \"hidden\"\n ) {\n isHidden = true;\n break;\n }\n currentElement = currentElement.parentElement;\n }\n\n if (isHidden) {\n ownRef.current?.setAttribute(\"data-popper-reference-hidden\", \"\");\n } else {\n ownRef.current?.removeAttribute(\"data-popper-reference-hidden\");\n }\n },\n },\n ];\n\n if (typeof afterWrite === \"function\") {\n modifiers.push({\n phase: \"afterWrite\",\n enabled: true,\n name: \"popper-after-write\",\n fn: afterWrite,\n });\n }\n\n popperRef.current = createPopper(anchorEl, ownRef.current, {\n placement,\n onFirstUpdate: handlePopperUpdate,\n strategy,\n modifiers,\n });\n }, [afterWrite, anchorEl, extraModifiers, open, placement, strategy]);\n\n const handleClose = (): void => {\n if (!popperRef.current) {\n return;\n }\n\n popperRef.current.destroy();\n };\n\n const handleRef = useCallback(\n (node: HTMLDivElement) => {\n handleInnerRef(node);\n handleOpen();\n },\n [handleOpen, handleInnerRef]\n );\n\n const handleEnter = (): void => {\n setExited(false);\n };\n\n const handleExited = (): void => {\n setExited(true);\n handleClose();\n };\n\n useEffect(() => {\n return (): void => {\n handleClose();\n };\n }, []);\n\n useEffect(() => {\n if (!open && !transition) {\n handleClose();\n }\n }, [open, transition]);\n\n useEffect(() => {\n if (popperRef.current) {\n popperRef.current.update();\n }\n });\n\n if (!open && (!transition || exited)) {\n return null;\n }\n\n const childProps: Partial<IChildProps> = { placement };\n\n if (transition) {\n childProps.transitionProps = {\n in: open,\n onEnter: handleEnter,\n onExited: handleExited,\n };\n }\n\n return (\n <StyledPopper\n ref={handleRef}\n {...rest}\n style={{\n ...style,\n }}\n >\n {typeof children === \"function\" ? children(childProps) : children}\n </StyledPopper>\n );\n }\n);\n\nPopper.displayName = \"Popper\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IACVC,UAAU,EACVC,WAAW,EACXC,MAAM,EACNC,SAAS,EACTC,QAAQ,QAIH,OAAO;AAEd,SACEC,YAAY,QAMP,gBAAgB;AAGvB,SAASC,YAAY,QAAQ,UAAU;AACvC,OAAOC,UAAU,MAAM,wBAAwB;AAsC/C,OAAO,MAAMC,MAAM,gBAAGR,UAAU,CAC9B,CAAAS,IAAA,EAaEC,GAAG,KACA;EAAA,IAZDC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IAAAC,SAAA,GAAAJ,IAAA,CACRK,IAAI;IAAJA,IAAI,GAAAD,SAAA,cAAG,KAAK,GAAAA,SAAA;IACZE,KAAK,GAAAN,IAAA,CAALM,KAAK;IAAAC,eAAA,GAAAP,IAAA,CACLQ,UAAU;IAAVA,UAAU,GAAAD,eAAA,cAAG,KAAK,GAAAA,eAAA;IAAAE,cAAA,GAAAT,IAAA,CAClBU,SAAS;IAAEC,gBAAgB,GAAAF,cAAA,cAAG,QAAQ,GAAAA,cAAA;IAAAG,aAAA,GAAAZ,IAAA,CACtCa,QAAQ;IAARA,QAAQ,GAAAD,aAAA,cAAG,UAAU,GAAAA,aAAA;IACrBE,UAAU,GAAAd,IAAA,CAAVc,UAAU;IACCC,cAAc,GAAAf,IAAA,CAAzBgB,SAAS;IACNC,IAAI,GAAAC,6BAAA,CAAAlB,IAAA,EAAAmB,SAAA;EAIT,MAAAC,SAAA,GAA4BzB,QAAQ,CAAC,IAAI,CAAC;IAAnC0B,MAAM,GAAAD,SAAA;IAA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CAAC,CAAC;EACf,CAAC;EAEDzD,SAAS,CAAC,MAAM;IACd,OAAO,MAAY;MACjByD,WAAW,CAAC,CAAC;IACf,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAENzD,SAAS,CAAC,MAAM;IACd,IAAI,CAACW,IAAI,IAAI,CAACG,UAAU,EAAE;MACxB2C,WAAW,CAAC,CAAC;IACf;EACF,CAAC,EAAE,CAAC9C,IAAI,EAAEG,UAAU,CAAC,CAAC;EAEtBd,SAAS,CAAC,MAAM;IACd,IAAIgC,SAAS,CAACK,OAAO,EAAE;MACrBL,SAAS,CAACK,OAAO,CAACyB,MAAM,CAAC,CAAC;IAC5B;EACF,CAAC,CAAC;EAEF,IAAI,CAACnD,IAAI,KAAK,CAACG,UAAU,IAAIa,MAAM,CAAC,EAAE;IACpC,OAAO,IAAI;EACb;EAEA,MAAMoC,UAAgC,GAAG;IAAE/C;EAAU,CAAC;EAEtD,IAAIF,UAAU,EAAE;IACdiD,UAAU,CAACC,eAAe,GAAG;MAC3BC,EAAE,EAAEtD,IAAI;MACRuD,OAAO,EAAEN,WAAW;MACpBO,QAAQ,EAAEN;IACZ,CAAC;EACH;EAEA,oBACEjE,KAAA,CAAAwE,aAAA,CAACjE,YAAY,EAAAkE,QAAA;IACX9D,GAAG,EAAEmD;EAAU,GACXnC,IAAI;IACRX,KAAK,EAAAyD,QAAA,KACAzD,KAAK;EACR,IAED,OAAOJ,QAAQ,KAAK,UAAU,GAAGA,QAAQ,CAACuD,UAAU,CAAC,GAAGvD,QAC7C,CAAC;AAEnB,CACF,CAAC;AAEDH,MAAM,CAACiE,WAAW,GAAG,QAAQ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Popper.js","names":["React","forwardRef","useCallback","useRef","useEffect","useState","createPopper","StyledPopper","useForkRef","Popper","_ref","ref","children","anchorEl","_ref$open","open","style","_ref$transition","transition","_ref$placement","placement","initialPlacement","_ref$strategy","strategy","afterWrite","_ref$followAnchor","followAnchor","extraModifiers","modifiers","rest","_objectWithoutPropertiesLoose","_excluded","_useState","exited","setExited","_useState2","setPlacement","ownRef","popperRef","handleInnerRef","handlePopperUpdate","data","handleOpen","current","destroy","name","enabled","phase","fn","referenceElement","currentElement","isHidden","computedStyle","getComputedStyle","display","visibility","parentElement","_ownRef$current","setAttribute","_ownRef$current2","removeAttribute","push","onFirstUpdate","handleClose","handleRef","node","handleEnter","handleExited","ResizeObserver","undefined","observer","_popperRef$current","update","observe","disconnect","childProps","transitionProps","in","onEnter","onExited","createElement","_extends","displayName"],"sources":["../../../../src/components/Popper/Popper.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useRef,\n useEffect,\n useState,\n CSSProperties,\n ReactNode,\n HTMLAttributes,\n} from \"react\";\n\nimport {\n createPopper,\n Instance,\n Modifier,\n Options as PopperOptions,\n PositioningStrategy,\n State,\n} from \"@popperjs/core\";\n\nimport { Placement } from \".\";\nimport { StyledPopper } from \"./Styles\";\nimport useForkRef from \"../../utils/useForkRef\";\ntype CustomModifier = Modifier<string, PopperOptions>;\nexport type PopperModifier = Partial<\n Modifier<string, { [key: string]: unknown }>\n>;\n\ninterface TransitionProps {\n in: boolean;\n onEnter: () => void;\n onExited: () => void;\n}\ninterface IChildProps {\n placement: Placement;\n transitionProps: Partial<TransitionProps>;\n}\n\ninterface PopperProps extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\n /** Anchor Element. */\n anchorEl?: Element | null;\n /** Open */\n open?: boolean;\n /** Inline style */\n style?: CSSProperties;\n /** Child with transition */\n transition?: boolean;\n /** Placement */\n placement?: Placement;\n /** Strategy */\n strategy?: PositioningStrategy;\n /** After Write callback */\n afterWrite?: (...args) => void;\n /** Follow the anchor when it changes size while the popper is open. Off by default. */\n followAnchor?: boolean;\n /** Extra Popper.js modifiers, merged with the built-in ones */\n modifiers?: PopperModifier[];\n\n /** Component children */\n children?: ReactNode | React.FC<Partial<IChildProps>>;\n}\n\nexport const Popper = forwardRef<HTMLDivElement, PopperProps>(\n (\n {\n children,\n anchorEl,\n open = false,\n style,\n transition = false,\n placement: initialPlacement = \"bottom\",\n strategy = \"absolute\",\n afterWrite,\n followAnchor = false,\n modifiers: extraModifiers,\n ...rest\n },\n ref\n ) => {\n const [exited, setExited] = useState(true);\n const [placement, setPlacement] = useState(initialPlacement);\n const ownRef = useRef<HTMLDivElement | null>(null);\n const popperRef = useRef<Instance>();\n\n const handleInnerRef = useForkRef(ownRef, ref);\n\n const handlePopperUpdate = (data: Partial<State>): void => {\n setPlacement(data.placement || \"bottom\");\n };\n\n const handleOpen = useCallback(() => {\n if (!ownRef.current || !anchorEl || !open) {\n return;\n }\n\n if (popperRef.current) {\n popperRef.current.destroy();\n }\n\n const modifiers: (CustomModifier | PopperModifier)[] = [\n ...(extraModifiers || []),\n {\n name: \"hide\",\n enabled: true,\n phase: \"main\",\n fn: () => {\n const referenceElement = anchorEl as HTMLElement;\n\n let currentElement: HTMLElement | null = referenceElement;\n let isHidden = false;\n while (currentElement) {\n const computedStyle = getComputedStyle(currentElement);\n if (\n computedStyle.display === \"none\" ||\n computedStyle.visibility === \"hidden\"\n ) {\n isHidden = true;\n break;\n }\n currentElement = currentElement.parentElement;\n }\n\n if (isHidden) {\n ownRef.current?.setAttribute(\"data-popper-reference-hidden\", \"\");\n } else {\n ownRef.current?.removeAttribute(\"data-popper-reference-hidden\");\n }\n },\n },\n ];\n\n if (typeof afterWrite === \"function\") {\n modifiers.push({\n phase: \"afterWrite\",\n enabled: true,\n name: \"popper-after-write\",\n fn: afterWrite,\n });\n }\n\n popperRef.current = createPopper(anchorEl, ownRef.current, {\n placement,\n onFirstUpdate: handlePopperUpdate,\n strategy,\n modifiers,\n });\n }, [afterWrite, anchorEl, extraModifiers, open, placement, strategy]);\n\n const handleClose = (): void => {\n if (!popperRef.current) {\n return;\n }\n\n popperRef.current.destroy();\n };\n\n const handleRef = useCallback(\n (node: HTMLDivElement) => {\n handleInnerRef(node);\n handleOpen();\n },\n [handleOpen, handleInnerRef]\n );\n\n const handleEnter = (): void => {\n setExited(false);\n };\n\n const handleExited = (): void => {\n setExited(true);\n handleClose();\n };\n\n useEffect(() => {\n return (): void => {\n handleClose();\n };\n }, []);\n\n useEffect(() => {\n if (!open && !transition) {\n handleClose();\n }\n }, [open, transition]);\n\n useEffect(() => {\n if (\n !followAnchor ||\n !open ||\n !anchorEl ||\n typeof ResizeObserver === \"undefined\"\n ) {\n return undefined;\n }\n\n // eslint-disable-next-line compat/compat -- guarded above\n const observer = new ResizeObserver(() => {\n popperRef.current?.update();\n });\n\n observer.observe(anchorEl);\n\n return () => observer.disconnect();\n }, [anchorEl, followAnchor, open]);\n\n useEffect(() => {\n if (popperRef.current) {\n popperRef.current.update();\n }\n });\n\n if (!open && (!transition || exited)) {\n return null;\n }\n\n const childProps: Partial<IChildProps> = { placement };\n\n if (transition) {\n childProps.transitionProps = {\n in: open,\n onEnter: handleEnter,\n onExited: handleExited,\n };\n }\n\n return (\n <StyledPopper\n ref={handleRef}\n {...rest}\n style={{\n ...style,\n }}\n >\n {typeof children === \"function\" ? children(childProps) : children}\n </StyledPopper>\n );\n }\n);\n\nPopper.displayName = \"Popper\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IACVC,UAAU,EACVC,WAAW,EACXC,MAAM,EACNC,SAAS,EACTC,QAAQ,QAIH,OAAO;AAEd,SACEC,YAAY,QAMP,gBAAgB;AAGvB,SAASC,YAAY,QAAQ,UAAU;AACvC,OAAOC,UAAU,MAAM,wBAAwB;AAwC/C,OAAO,MAAMC,MAAM,gBAAGR,UAAU,CAC9B,CAAAS,IAAA,EAcEC,GAAG,KACA;EAAA,IAbDC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IAAAC,SAAA,GAAAJ,IAAA,CACRK,IAAI;IAAJA,IAAI,GAAAD,SAAA,cAAG,KAAK,GAAAA,SAAA;IACZE,KAAK,GAAAN,IAAA,CAALM,KAAK;IAAAC,eAAA,GAAA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AO,CAAC5D,QAAQ,CAAC;IAE1B,OAAO,MAAMyD,QAAQ,CAACI,UAAU,CAAC,CAAC;EACpC,CAAC,EAAE,CAAC7D,QAAQ,EAAEa,YAAY,EAAEX,IAAI,CAAC,CAAC;EAElCX,SAAS,CAAC,MAAM;IACd,IAAIkC,SAAS,CAACK,OAAO,EAAE;MACrBL,SAAS,CAACK,OAAO,CAAC6B,MAAM,CAAC,CAAC;IAC5B;EACF,CAAC,CAAC;EAEF,IAAI,CAACzD,IAAI,KAAK,CAACG,UAAU,IAAIe,MAAM,CAAC,EAAE;IACpC,OAAO,IAAI;EACb;EAEA,MAAM0C,UAAgC,GAAG;IAAEvD;EAAU,CAAC;EAEtD,IAAIF,UAAU,EAAE;IACdyD,UAAU,CAACC,eAAe,GAAG;MAC3BC,EAAE,EAAE9D,IAAI;MACR+D,OAAO,EAAEZ,WAAW;MACpBa,QAAQ,EAAEZ;IACZ,CAAC;EACH;EAEA,oBACEnE,KAAA,CAAAgF,aAAA,CAACzE,YAAY,EAAA0E,QAAA;IACXtE,GAAG,EAAEqD;EAAU,GACXnC,IAAI;IACRb,KAAK,EAAAiE,QAAA,KACAjE,KAAK;EACR,IAED,OAAOJ,QAAQ,KAAK,UAAU,GAAGA,QAAQ,CAAC+D,UAAU,CAAC,GAAG/D,QAC7C,CAAC;AAEnB,CACF,CAAC;AAEDH,MAAM,CAACyE,WAAW,GAAG,QAAQ","ignoreList":[]}
|
|
@@ -16,6 +16,8 @@ export interface IPropertyListPopoverProps {
|
|
|
16
16
|
onClickAway?: () => boolean | void;
|
|
17
17
|
/** A fixed width in pixels. By default the popover is as wide as the row up to 299px, 299px in a ticket, and half the list (at least 280px) in a table. */
|
|
18
18
|
width?: number;
|
|
19
|
+
/** The popover follows its row when the row changes size while it is open, for a row that grows under itself. Off by default. */
|
|
20
|
+
followRow?: boolean;
|
|
19
21
|
/** A class on the content of the popover. */
|
|
20
22
|
className?: string;
|
|
21
23
|
/** The test id of the content. */
|
|
@@ -26,7 +28,7 @@ export interface IPropertyListPopoverProps {
|
|
|
26
28
|
children?: ReactNode;
|
|
27
29
|
}
|
|
28
30
|
/** The popover of a rail picker: opens under the start of its row, on the raised surface. */
|
|
29
|
-
export declare const PropertyListPopover: ({ row, open, onOpen, onClose, onClickAway, width: fixedWidth, className, "data-testid": testId, typeToFilter, children, }: IPropertyListPopoverProps) => React.JSX.Element;
|
|
31
|
+
export declare const PropertyListPopover: ({ row, open, onOpen, onClose, onClickAway, width: fixedWidth, followRow, className, "data-testid": testId, typeToFilter, children, }: IPropertyListPopoverProps) => React.JSX.Element;
|
|
30
32
|
export interface IPropertyListPopoverFooterLabels {
|
|
31
33
|
set: string;
|
|
32
34
|
cancel: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyListPopover.d.ts","sourceRoot":"","sources":["../../../../src/components/PropertyList/PropertyListPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAGZ,YAAY,EACZ,SAAS,EAKV,MAAM,OAAO,CAAC;AAaf,4DAA4D;AAC5D,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAC/C,uDAAuD;AACvD,eAAO,MAAM,qCAAqC,MAAM,CAAC;AAEzD,MAAM,WAAW,yBAAyB;IACxC,qEAAqE;IACrE,GAAG,EAAE,YAAY,CAAC;IAClB,2BAA2B;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,0BAA0B;IAC1B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,6DAA6D;IAC7D,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,qIAAqI;IACrI,WAAW,CAAC,EAAE,MAAM,OAAO,GAAG,IAAI,CAAC;IACnC,2JAA2J;IAC3J,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qGAAqG;IACrG,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAqBD,6FAA6F;AAC7F,eAAO,MAAM,mBAAmB,GAAI,
|
|
1
|
+
{"version":3,"file":"PropertyListPopover.d.ts","sourceRoot":"","sources":["../../../../src/components/PropertyList/PropertyListPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAGZ,YAAY,EACZ,SAAS,EAKV,MAAM,OAAO,CAAC;AAaf,4DAA4D;AAC5D,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAC/C,uDAAuD;AACvD,eAAO,MAAM,qCAAqC,MAAM,CAAC;AAEzD,MAAM,WAAW,yBAAyB;IACxC,qEAAqE;IACrE,GAAG,EAAE,YAAY,CAAC;IAClB,2BAA2B;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,0BAA0B;IAC1B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,6DAA6D;IAC7D,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,qIAAqI;IACrI,WAAW,CAAC,EAAE,MAAM,OAAO,GAAG,IAAI,CAAC;IACnC,2JAA2J;IAC3J,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iIAAiI;IACjI,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qGAAqG;IACrG,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAqBD,6FAA6F;AAC7F,eAAO,MAAM,mBAAmB,GAAI,sIAYjC,yBAAyB,sBA+J3B,CAAC;AAEF,MAAM,WAAW,gCAAgC;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAQD,MAAM,WAAW,+BAA+B;IAC9C,8BAA8B;IAC9B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,+BAA+B;IAC/B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,yGAAyG;IACzG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4BAA4B;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC,gCAAgC,CAAC,CAAC;CACpD;AAED,8DAA8D;AAC9D,eAAO,MAAM,yBAAyB,GAAI,mEAOvC,+BAA+B,sBA8BjC,CAAC"}
|
|
@@ -34,6 +34,8 @@ export const PropertyListPopover = _ref => {
|
|
|
34
34
|
onClose = _ref.onClose,
|
|
35
35
|
onClickAway = _ref.onClickAway,
|
|
36
36
|
fixedWidth = _ref.width,
|
|
37
|
+
_ref$followRow = _ref.followRow,
|
|
38
|
+
followRow = _ref$followRow === void 0 ? false : _ref$followRow,
|
|
37
39
|
className = _ref.className,
|
|
38
40
|
testId = _ref["data-testid"],
|
|
39
41
|
_ref$typeToFilter = _ref.typeToFilter,
|
|
@@ -132,6 +134,7 @@ export const PropertyListPopover = _ref => {
|
|
|
132
134
|
onBeforeClose: handleBeforeClose,
|
|
133
135
|
onClose: onClose,
|
|
134
136
|
position: isTable ? "bottom" : "bottom-start",
|
|
137
|
+
followTarget: followRow,
|
|
135
138
|
width: fixedWidth != null ? fixedWidth : width,
|
|
136
139
|
menuClassName: POPOVER_CLASS,
|
|
137
140
|
target: /*#__PURE__*/cloneElement(row, _extends({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyListPopover.js","names":["React","cloneElement","useCallback","useEffect","useRef","useState","classnames","StyledPropertyListPopoverContent","usePropertyListLayout","useContainerCss","useForkRef","Menu","MenuFooter","POPOVER_CLASS","POPOVER_CSS","PROPERTY_LIST_POPOVER_WIDTH","PROPERTY_LIST_POPOVER_TABLE_MIN_WIDTH","SEARCH_INPUT","typeInto","input","text","_Object$getOwnPropert","Object","getOwnPropertyDescriptor","window","HTMLInputElement","prototype","set","call","dispatchEvent","Event","bubbles","focus","isCharacterKey","event","key","length","ctrlKey","metaKey","altKey","PropertyListPopover","_ref","row","open","onOpen","onClose","onClickAway","fixedWidth","width","className","testId","_ref$typeToFilter","typeToFilter","children","typedText","contentNode","layout","isTable","isTicket","rowRef","closedByEscape","_useState","setWidth","handleRowRef","ref","measure","node","current","card","closest","Math","max","offsetWidth","min","undefined","handleOpen","markEscape","document","addEventListener","removeEventListener","handleBeforeClose","rowProps","props","handleRowKeyDown","_contentNode$current","onKeyDown","defaultPrevented","preventDefault","querySelector","value","takeTypedText","handleKeyDown","createElement","onBeforeClose","position","menuClassName","target","_extends","role","FOOTER_LABELS","cancel","remove","PropertyListPopoverFooter","_ref2","onSet","onCancel","onRemove","_ref2$setDisabled","setDisabled","testIdPrefix","labels","testIdOf","name","primary","label","onClick","disabled","secondary","tertiary"],"sources":["../../../../src/components/PropertyList/PropertyListPopover.tsx"],"sourcesContent":["import React, {\n cloneElement,\n KeyboardEvent,\n ReactElement,\n ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { StyledPropertyListPopoverContent } from \"./PopoverStyles\";\nimport { usePropertyListLayout } from \"./PropertyList\";\nimport { useContainerCss } from \"../../utils/useContainerCss\";\nimport useForkRef from \"../../utils/useForkRef\";\nimport { Menu, MenuFooter } from \"../Menu\";\n\nconst POPOVER_CLASS = \"c-property-list-popover\";\nconst POPOVER_CSS = `.c-simple-menu__paper.${POPOVER_CLASS} { background-color: var(--surface-raised); }`;\n\n/** The width of a picker in the column of the task form. */\nexport const PROPERTY_LIST_POPOVER_WIDTH = 299;\n/** The least width of a picker in the table layout. */\nexport const PROPERTY_LIST_POPOVER_TABLE_MIN_WIDTH = 280;\n\nexport interface IPropertyListPopoverProps {\n /** The row that opens the popover, for example a PropertyListRow. */\n row: ReactElement;\n /** The popover is open. */\n open: boolean;\n /** A click on the row. */\n onOpen: () => void;\n /** Esc, a click outside or a click on the row while open. */\n onClose: () => void;\n /** A click outside, before the popover closes. Return false to keep it open, for a value that cannot be saved. Esc always closes. */\n onClickAway?: () => boolean | void;\n /** A fixed width in pixels. By default the popover is as wide as the row up to 299px, 299px in a ticket, and half the list (at least 280px) in a table. */\n width?: number;\n /** A class on the content of the popover. */\n className?: string;\n /** The test id of the content. */\n \"data-testid\"?: string;\n /** A character typed on the focused row opens the popover and goes into the filter of its select. */\n typeToFilter?: boolean;\n /** The picker, and a PropertyListPopoverFooter under it. */\n children?: ReactNode;\n}\n\nconst SEARCH_INPUT = \"[class~=c-select] input\";\n\n// React reads the value of an input through its own setter, so a typed text goes in through the native one.\nconst typeInto = (input: HTMLInputElement, text: string) => {\n Object.getOwnPropertyDescriptor(\n window.HTMLInputElement.prototype,\n \"value\"\n )?.set?.call(input, text);\n input.dispatchEvent(new Event(\"input\", { bubbles: true }));\n input.focus();\n};\n\nconst isCharacterKey = (event: KeyboardEvent) =>\n event.key.length === 1 &&\n event.key !== \" \" &&\n !event.ctrlKey &&\n !event.metaKey &&\n !event.altKey;\n\n/** The popover of a rail picker: opens under the start of its row, on the raised surface. */\nexport const PropertyListPopover = ({\n row,\n open,\n onOpen,\n onClose,\n onClickAway,\n width: fixedWidth,\n className,\n \"data-testid\": testId,\n typeToFilter = false,\n children,\n}: IPropertyListPopoverProps) => {\n const typedText = useRef(\"\");\n const contentNode = useRef<HTMLDivElement | null>(null);\n const layout = usePropertyListLayout();\n const isTable = layout === \"table\";\n const isTicket = layout === \"ticket\";\n const rowRef = useRef<HTMLElement>(null);\n const closedByEscape = useRef(false);\n const [width, setWidth] = useState<number>();\n const handleRowRef = useForkRef(\n (row as ReactElement & { ref?: React.Ref<HTMLElement> }).ref,\n rowRef\n );\n\n useContainerCss(`${POPOVER_CLASS}-css`, POPOVER_CSS);\n\n const measure = useCallback(() => {\n const node = rowRef.current;\n const card = isTable\n ? node?.closest<HTMLElement>(\".c-property-list\")\n : null;\n\n if (card) {\n setWidth(\n Math.max(PROPERTY_LIST_POPOVER_TABLE_MIN_WIDTH, card.offsetWidth / 2)\n );\n } else if (isTicket) {\n setWidth(PROPERTY_LIST_POPOVER_WIDTH);\n } else {\n setWidth(\n node?.offsetWidth\n ? Math.min(node.offsetWidth, PROPERTY_LIST_POPOVER_WIDTH)\n : undefined\n );\n }\n }, [isTable, isTicket]);\n\n const handleOpen = useCallback(() => {\n measure();\n closedByEscape.current = false;\n onOpen();\n }, [measure, onOpen]);\n\n // A popover that a story or a parent opens has no click on the row, so it measures here.\n useEffect(() => {\n if (open && width === undefined) {\n measure();\n }\n }, [measure, open, width]);\n\n // The menu reports Esc and a click outside in the same way, so the key is seen here first.\n useEffect(() => {\n if (!open) {\n return undefined;\n }\n\n const markEscape = (event: globalThis.KeyboardEvent) => {\n if (event.key === \"Escape\") {\n closedByEscape.current = true;\n }\n };\n\n document.addEventListener(\"keydown\", markEscape, true);\n\n return () => document.removeEventListener(\"keydown\", markEscape, true);\n }, [open]);\n\n const handleBeforeClose = useCallback(\n () => !onClickAway || closedByEscape.current || onClickAway() !== false,\n [onClickAway]\n );\n\n const rowProps = row.props as {\n onKeyDown?: (event: KeyboardEvent<HTMLElement>) => void;\n };\n\n const handleRowKeyDown = useCallback(\n (event: KeyboardEvent<HTMLElement>) => {\n rowProps.onKeyDown?.(event);\n\n if (!typeToFilter || event.defaultPrevented || !isCharacterKey(event)) {\n return;\n }\n\n event.preventDefault();\n\n // A fast typist sends the next character before the focus leaves the row.\n const input =\n contentNode.current?.querySelector<HTMLInputElement>(SEARCH_INPUT);\n\n if (input) {\n typeInto(input, `${input.value}${event.key}`);\n\n return;\n }\n\n typedText.current += event.key;\n\n if (!open) {\n handleOpen();\n }\n },\n [handleOpen, open, rowProps, typeToFilter]\n );\n\n // The list is in the page when its wrapper gets its node, so the typed text can go into the filter there.\n const takeTypedText = useCallback((node: HTMLDivElement | null) => {\n contentNode.current = node;\n\n const input = typedText.current\n ? node?.querySelector<HTMLInputElement>(SEARCH_INPUT)\n : null;\n\n if (input) {\n typeInto(input, typedText.current);\n }\n\n if (node) {\n typedText.current = \"\";\n }\n }, []);\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key === \"Escape\") {\n onClose();\n }\n },\n [onClose]\n );\n\n return (\n <Menu\n open={open}\n onOpen={handleOpen}\n onBeforeClose={handleBeforeClose}\n onClose={onClose}\n position={isTable ? \"bottom\" : \"bottom-start\"}\n width={fixedWidth ?? width}\n menuClassName={POPOVER_CLASS}\n target={cloneElement(row, {\n ref: handleRowRef,\n ...(typeToFilter ? { onKeyDown: handleRowKeyDown } : null),\n })}\n >\n {open ? (\n <StyledPropertyListPopoverContent\n ref={takeTypedText}\n role=\"presentation\"\n className={classnames(`${POPOVER_CLASS}__content`, className)}\n onKeyDown={handleKeyDown}\n data-testid={testId}\n >\n {children}\n </StyledPropertyListPopoverContent>\n ) : null}\n </Menu>\n );\n};\n\nexport interface IPropertyListPopoverFooterLabels {\n set: string;\n cancel: string;\n remove: string;\n}\n\nconst FOOTER_LABELS: IPropertyListPopoverFooterLabels = {\n set: \"Set\",\n cancel: \"Cancel\",\n remove: \"Remove\",\n};\n\nexport interface IPropertyListPopoverFooterProps {\n /** Saves the picked value. */\n onSet: () => void;\n /** Closes the popover without a change. */\n onCancel: () => void;\n /** Clears the value. Leave it out to hide the Remove button. */\n onRemove?: () => void;\n /** Disables the Set button. */\n setDisabled?: boolean;\n /** A prefix for the test ids of the buttons: \"<prefix>-set\", \"<prefix>-cancel\" and \"<prefix>-remove\". */\n testIdPrefix?: string;\n /** Texts of the buttons. */\n labels?: Partial<IPropertyListPopoverFooterLabels>;\n}\n\n/** The Set, Cancel and Remove buttons under a rail picker. */\nexport const PropertyListPopoverFooter = ({\n onSet,\n onCancel,\n onRemove,\n setDisabled = false,\n testIdPrefix,\n labels,\n}: IPropertyListPopoverFooterProps) => {\n const text = { ...FOOTER_LABELS, ...labels };\n const testIdOf = (name: string) =>\n testIdPrefix ? `${testIdPrefix}-${name}` : undefined;\n\n return (\n <MenuFooter\n className=\"c-property-list-popover__footer\"\n primary={{\n label: text.set,\n onClick: onSet,\n disabled: setDisabled,\n \"data-testid\": testIdOf(\"set\"),\n }}\n secondary={{\n label: text.cancel,\n onClick: onCancel,\n \"data-testid\": testIdOf(\"cancel\"),\n }}\n tertiary={\n onRemove\n ? {\n label: text.remove,\n onClick: onRemove,\n \"data-testid\": testIdOf(\"remove\"),\n }\n : undefined\n }\n />\n );\n};\n"],"mappings":";AAAA,OAAOA,KAAK,IACVC,YAAY,EAIZC,WAAW,EACXC,SAAS,EACTC,MAAM,EACNC,QAAQ,QACH,OAAO;AAEd,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,gCAAgC,QAAQ,iBAAiB;AAClE,SAASC,qBAAqB,QAAQ,gBAAgB;AACtD,SAASC,eAAe,QAAQ,6BAA6B;AAC7D,OAAOC,UAAU,MAAM,wBAAwB;AAC/C,SAASC,IAAI,EAAEC,UAAU,QAAQ,SAAS;AAE1C,MAAMC,aAAa,GAAG,yBAAyB;AAC/C,MAAMC,WAAW,8BAA4BD,aAAa,kDAA+C;;AAEzG;AACA,OAAO,MAAME,2BAA2B,GAAG,GAAG;AAC9C;AACA,OAAO,MAAMC,qCAAqC,GAAG,GAAG;AAyBxD,MAAMC,YAAY,GAAG,yBAAyB;;AAE9C;AACA,MAAMC,QAAQ,GAAGA,CAACC,KAAuB,EAAEC,IAAY,KAAK;EAAA,IAAAC,qBAAA;EAC1D,CAAAA,qBAAA,GAAAC,MAAM,CAACC,wBAAwB,CAC7BC,MAAM,CAACC,gBAAgB,CAACC,SAAS,EACjC,OACF,CAAC,cAAAL,qBAAA,GAHDA,qBAAA,CAGGM,GAAG,aAHNN,qBAAA,CAGQO,IAAI,CAACT,KAAK,EAAEC,IAAI,CAAC;EACzBD,KA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E;IACFO,QAAQ,EACNZ,QAAQ,GACJ;MACEQ,KAAK,EAAE9F,IAAI,CAACiF,MAAM;MAClBc,OAAO,EAAET,QAAQ;MACjB,aAAa,EAAEK,QAAQ,CAAC,QAAQ;IAClC,CAAC,GACDrC;EACL,CACF,CAAC;AAEN,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"PropertyListPopover.js","names":["React","cloneElement","useCallback","useEffect","useRef","useState","classnames","StyledPropertyListPopoverContent","usePropertyListLayout","useContainerCss","useForkRef","Menu","MenuFooter","POPOVER_CLASS","POPOVER_CSS","PROPERTY_LIST_POPOVER_WIDTH","PROPERTY_LIST_POPOVER_TABLE_MIN_WIDTH","SEARCH_INPUT","typeInto","input","text","_Object$getOwnPropert","Object","getOwnPropertyDescriptor","window","HTMLInputElement","prototype","set","call","dispatchEvent","Event","bubbles","focus","isCharacterKey","event","key","length","ctrlKey","metaKey","altKey","PropertyListPopover","_ref","row","open","onOpen","onClose","onClickAway","fixedWidth","width","_ref$followRow","followRow","className","testId","_ref$typeToFilter","typeToFilter","children","typedText","contentNode","layout","isTable","isTicket","rowRef","closedByEscape","_useState","setWidth","handleRowRef","ref","measure","node","current","card","closest","Math","max","offsetWidth","min","undefined","handleOpen","markEscape","document","addEventListener","removeEventListener","handleBeforeClose","rowProps","props","handleRowKeyDown","_contentNode$current","onKeyDown","defaultPrevented","preventDefault","querySelector","value","takeTypedText","handleKeyDown","createElement","onBeforeClose","position","followTarget","menuClassName","target","_extends","role","FOOTER_LABELS","cancel","remove","PropertyListPopoverFooter","_ref2","onSet","onCancel","onRemove","_ref2$setDisabled","setDisabled","testIdPrefix","labels","testIdOf","name","primary","label","onClick","disabled","secondary","tertiary"],"sources":["../../../../src/components/PropertyList/PropertyListPopover.tsx"],"sourcesContent":["import React, {\n cloneElement,\n KeyboardEvent,\n ReactElement,\n ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { StyledPropertyListPopoverContent } from \"./PopoverStyles\";\nimport { usePropertyListLayout } from \"./PropertyList\";\nimport { useContainerCss } from \"../../utils/useContainerCss\";\nimport useForkRef from \"../../utils/useForkRef\";\nimport { Menu, MenuFooter } from \"../Menu\";\n\nconst POPOVER_CLASS = \"c-property-list-popover\";\nconst POPOVER_CSS = `.c-simple-menu__paper.${POPOVER_CLASS} { background-color: var(--surface-raised); }`;\n\n/** The width of a picker in the column of the task form. */\nexport const PROPERTY_LIST_POPOVER_WIDTH = 299;\n/** The least width of a picker in the table layout. */\nexport const PROPERTY_LIST_POPOVER_TABLE_MIN_WIDTH = 280;\n\nexport interface IPropertyListPopoverProps {\n /** The row that opens the popover, for example a PropertyListRow. */\n row: ReactElement;\n /** The popover is open. */\n open: boolean;\n /** A click on the row. */\n onOpen: () => void;\n /** Esc, a click outside or a click on the row while open. */\n onClose: () => void;\n /** A click outside, before the popover closes. Return false to keep it open, for a value that cannot be saved. Esc always closes. */\n onClickAway?: () => boolean | void;\n /** A fixed width in pixels. By default the popover is as wide as the row up to 299px, 299px in a ticket, and half the list (at least 280px) in a table. */\n width?: number;\n /** The popover follows its row when the row changes size while it is open, for a row that grows under itself. Off by default. */\n followRow?: boolean;\n /** A class on the content of the popover. */\n className?: string;\n /** The test id of the content. */\n \"data-testid\"?: string;\n /** A character typed on the focused row opens the popover and goes into the filter of its select. */\n typeToFilter?: boolean;\n /** The picker, and a PropertyListPopoverFooter under it. */\n children?: ReactNode;\n}\n\nconst SEARCH_INPUT = \"[class~=c-select] input\";\n\n// React reads the value of an input through its own setter, so a typed text goes in through the native one.\nconst typeInto = (input: HTMLInputElement, text: string) => {\n Object.getOwnPropertyDescriptor(\n window.HTMLInputElement.prototype,\n \"value\"\n )?.set?.call(input, text);\n input.dispatchEvent(new Event(\"input\", { bubbles: true }));\n input.focus();\n};\n\nconst isCharacterKey = (event: KeyboardEvent) =>\n event.key.length === 1 &&\n event.key !== \" \" &&\n !event.ctrlKey &&\n !event.metaKey &&\n !event.altKey;\n\n/** The popover of a rail picker: opens under the start of its row, on the raised surface. */\nexport const PropertyListPopover = ({\n row,\n open,\n onOpen,\n onClose,\n onClickAway,\n width: fixedWidth,\n followRow = false,\n className,\n \"data-testid\": testId,\n typeToFilter = false,\n children,\n}: IPropertyListPopoverProps) => {\n const typedText = useRef(\"\");\n const contentNode = useRef<HTMLDivElement | null>(null);\n const layout = usePropertyListLayout();\n const isTable = layout === \"table\";\n const isTicket = layout === \"ticket\";\n const rowRef = useRef<HTMLElement>(null);\n const closedByEscape = useRef(false);\n const [width, setWidth] = useState<number>();\n const handleRowRef = useForkRef(\n (row as ReactElement & { ref?: React.Ref<HTMLElement> }).ref,\n rowRef\n );\n\n useContainerCss(`${POPOVER_CLASS}-css`, POPOVER_CSS);\n\n const measure = useCallback(() => {\n const node = rowRef.current;\n const card = isTable\n ? node?.closest<HTMLElement>(\".c-property-list\")\n : null;\n\n if (card) {\n setWidth(\n Math.max(PROPERTY_LIST_POPOVER_TABLE_MIN_WIDTH, card.offsetWidth / 2)\n );\n } else if (isTicket) {\n setWidth(PROPERTY_LIST_POPOVER_WIDTH);\n } else {\n setWidth(\n node?.offsetWidth\n ? Math.min(node.offsetWidth, PROPERTY_LIST_POPOVER_WIDTH)\n : undefined\n );\n }\n }, [isTable, isTicket]);\n\n const handleOpen = useCallback(() => {\n measure();\n closedByEscape.current = false;\n onOpen();\n }, [measure, onOpen]);\n\n // A popover that a story or a parent opens has no click on the row, so it measures here.\n useEffect(() => {\n if (open && width === undefined) {\n measure();\n }\n }, [measure, open, width]);\n\n // The menu reports Esc and a click outside in the same way, so the key is seen here first.\n useEffect(() => {\n if (!open) {\n return undefined;\n }\n\n const markEscape = (event: globalThis.KeyboardEvent) => {\n if (event.key === \"Escape\") {\n closedByEscape.current = true;\n }\n };\n\n document.addEventListener(\"keydown\", markEscape, true);\n\n return () => document.removeEventListener(\"keydown\", markEscape, true);\n }, [open]);\n\n const handleBeforeClose = useCallback(\n () => !onClickAway || closedByEscape.current || onClickAway() !== false,\n [onClickAway]\n );\n\n const rowProps = row.props as {\n onKeyDown?: (event: KeyboardEvent<HTMLElement>) => void;\n };\n\n const handleRowKeyDown = useCallback(\n (event: KeyboardEvent<HTMLElement>) => {\n rowProps.onKeyDown?.(event);\n\n if (!typeToFilter || event.defaultPrevented || !isCharacterKey(event)) {\n return;\n }\n\n event.preventDefault();\n\n // A fast typist sends the next character before the focus leaves the row.\n const input =\n contentNode.current?.querySelector<HTMLInputElement>(SEARCH_INPUT);\n\n if (input) {\n typeInto(input, `${input.value}${event.key}`);\n\n return;\n }\n\n typedText.current += event.key;\n\n if (!open) {\n handleOpen();\n }\n },\n [handleOpen, open, rowProps, typeToFilter]\n );\n\n // The list is in the page when its wrapper gets its node, so the typed text can go into the filter there.\n const takeTypedText = useCallback((node: HTMLDivElement | null) => {\n contentNode.current = node;\n\n const input = typedText.current\n ? node?.querySelector<HTMLInputElement>(SEARCH_INPUT)\n : null;\n\n if (input) {\n typeInto(input, typedText.current);\n }\n\n if (node) {\n typedText.current = \"\";\n }\n }, []);\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key === \"Escape\") {\n onClose();\n }\n },\n [onClose]\n );\n\n return (\n <Menu\n open={open}\n onOpen={handleOpen}\n onBeforeClose={handleBeforeClose}\n onClose={onClose}\n position={isTable ? \"bottom\" : \"bottom-start\"}\n followTarget={followRow}\n width={fixedWidth ?? width}\n menuClassName={POPOVER_CLASS}\n target={cloneElement(row, {\n ref: handleRowRef,\n ...(typeToFilter ? { onKeyDown: handleRowKeyDown } : null),\n })}\n >\n {open ? (\n <StyledPropertyListPopoverContent\n ref={takeTypedText}\n role=\"presentation\"\n className={classnames(`${POPOVER_CLASS}__content`, className)}\n onKeyDown={handleKeyDown}\n data-testid={testId}\n >\n {children}\n </StyledPropertyListPopoverContent>\n ) : null}\n </Menu>\n );\n};\n\nexport interface IPropertyListPopoverFooterLabels {\n set: string;\n cancel: string;\n remove: string;\n}\n\nconst FOOTER_LABELS: IPropertyListPopoverFooterLabels = {\n set: \"Set\",\n cancel: \"Cancel\",\n remove: \"Remove\",\n};\n\nexport interface IPropertyListPopoverFooterProps {\n /** Saves the picked value. */\n onSet: () => void;\n /** Closes the popover without a change. */\n onCancel: () => void;\n /** Clears the value. Leave it out to hide the Remove button. */\n onRemove?: () => void;\n /** Disables the Set button. */\n setDisabled?: boolean;\n /** A prefix for the test ids of the buttons: \"<prefix>-set\", \"<prefix>-cancel\" and \"<prefix>-remove\". */\n testIdPrefix?: string;\n /** Texts of the buttons. */\n labels?: Partial<IPropertyListPopoverFooterLabels>;\n}\n\n/** The Set, Cancel and Remove buttons under a rail picker. */\nexport const PropertyListPopoverFooter = ({\n onSet,\n onCancel,\n onRemove,\n setDisabled = false,\n testIdPrefix,\n labels,\n}: IPropertyListPopoverFooterProps) => {\n const text = { ...FOOTER_LABELS, ...labels };\n const testIdOf = (name: string) =>\n testIdPrefix ? `${testIdPrefix}-${name}` : undefined;\n\n return (\n <MenuFooter\n className=\"c-property-list-popover__footer\"\n primary={{\n label: text.set,\n onClick: onSet,\n disabled: setDisabled,\n \"data-testid\": testIdOf(\"set\"),\n }}\n secondary={{\n label: text.cancel,\n onClick: onCancel,\n \"data-testid\": testIdOf(\"cancel\"),\n }}\n tertiary={\n onRemove\n ? {\n label: text.remove,\n onClick: onRemove,\n \"data-testid\": testIdOf(\"remove\"),\n }\n : undefined\n }\n />\n );\n};\n"],"mappings":";AAAA,OAAOA,KAAK,IACVC,YAAY,EAIZC,WAAW,EACXC,SAAS,EACTC,MAAM,EACNC,QAAQ,QACH,OAAO;AAEd,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,gCAAgC,QAAQ,iBAAiB;AAClE,SAASC,qBAAqB,QAAQ,gBAAgB;AACtD,SAASC,eAAe,QAAQ,6BAA6B;AAC7D,OAAOC,UAAU,MAAM,wBAAwB;AAC/C,SAASC,IAAI,EAAEC,UAAU,QAAQ,SAAS;AAE1C,MAAMC,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IACnBE,YAAY,GAAAN,KAAA,CAAZM,YAAY;IACZC,MAAM,GAAAP,KAAA,CAANO,MAAM;EAEN,MAAM7F,IAAI,GAAAgF,QAAA,KAAQE,aAAa,EAAKW,MAAM,CAAE;EAC5C,MAAMC,QAAQ,GAAIC,IAAY,IAC5BH,YAAY,GAAMA,YAAY,SAAIG,IAAI,GAAKvC,SAAS;EAEtD,oBACE5E,KAAA,CAAA8F,aAAA,CAAClF,UAAU;IACTuC,SAAS,EAAC,iCAAiC;IAC3CiE,OAAO,EAAE;MACPC,KAAK,EAAEjG,IAAI,CAACO,GAAG;MACf2F,OAAO,EAAEX,KAAK;MACdY,QAAQ,EAAER,WAAW;MACrB,aAAa,EAAEG,QAAQ,CAAC,KAAK;IAC/B,CAAE;IACFM,SAAS,EAAE;MACTH,KAAK,EAAEjG,IAAI,CAACmF,MAAM;MAClBe,OAAO,EAAEV,QAAQ;MACjB,aAAa,EAAEM,QAAQ,CAAC,QAAQ;IAClC,CAAE;IACFO,QAAQ,EACNZ,QAAQ,GACJ;MACEQ,KAAK,EAAEjG,IAAI,CAACoF,MAAM;MAClBc,OAAO,EAAET,QAAQ;MACjB,aAAa,EAAEK,QAAQ,CAAC,QAAQ;IAClC,CAAC,GACDtC;EACL,CACF,CAAC;AAEN,CAAC","ignoreList":[]}
|
|
@@ -11,6 +11,8 @@ export interface ISelectProps extends Omit<IAutocompleteProps, "handleChange" |
|
|
|
11
11
|
target?: ElementWithRef<Element>;
|
|
12
12
|
/** Set Select position */
|
|
13
13
|
position?: Placement;
|
|
14
|
+
/** Keeps the menu on its target when the target moves or changes size. */
|
|
15
|
+
followTarget?: boolean;
|
|
14
16
|
/** onChange callback */
|
|
15
17
|
onChange?: (e: (string | number)[] | string | number) => void;
|
|
16
18
|
/** Placeholder for Select input */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/Select.tsx"],"names":[],"mappings":"AAAA,OAAc,E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QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAC9D,mCAAmC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC9C,gCAAgC;IAChC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,2BAA2B;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,4BAA4B;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qDAAqD;IACrD,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,oCAAoC;IACpC,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,qCAAqC;IACrC,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC5B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,6EAA6E;IAC7E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oHAAoH;IACpH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iHAAiH;IACjH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8KAA8K;IAC9K,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,YAAY,CAqWnC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["type", "mode", "target", "options", "selected", "mixed", "position", "onChange", "placeholder", "emptyAction", "disableSearch", "forceCloseMenu", "selectClassName", "keepSameOptionsOrder", "onSelectOpen", "onSelectClose", "renderOption", "handleDefaultOptionChange", "preselectDefaultValue", "startAdornment", "endAdornment", "focusInput", "disableVirtualization", "closeOnTab", "prerender", "scopedFocus", "handleScroll"];
|
|
3
|
+
const _excluded = ["type", "mode", "target", "options", "selected", "mixed", "position", "followTarget", "onChange", "placeholder", "emptyAction", "disableSearch", "forceCloseMenu", "selectClassName", "keepSameOptionsOrder", "onSelectOpen", "onSelectClose", "renderOption", "handleDefaultOptionChange", "preselectDefaultValue", "startAdornment", "endAdornment", "focusInput", "disableVirtualization", "closeOnTab", "prerender", "scopedFocus", "handleScroll"];
|
|
4
4
|
import React, { useCallback, useState, useMemo, useEffect, useRef } from "react";
|
|
5
5
|
import classNames from "classnames";
|
|
6
6
|
import { OptionContent } from "./OptionContent/OptionContent";
|
|
@@ -20,6 +20,7 @@ export const Select = _ref => {
|
|
|
20
20
|
mixed = _ref$mixed === void 0 ? [] : _ref$mixed,
|
|
21
21
|
_ref$position = _ref.position,
|
|
22
22
|
position = _ref$position === void 0 ? "bottom-start" : _ref$position,
|
|
23
|
+
followTarget = _ref.followTarget,
|
|
23
24
|
_ref$onChange = _ref.onChange,
|
|
24
25
|
onChange = _ref$onChange === void 0 ? () => null : _ref$onChange,
|
|
25
26
|
placeholder = _ref.placeholder,
|
|
@@ -151,6 +152,7 @@ export const Select = _ref => {
|
|
|
151
152
|
mode,
|
|
152
153
|
open,
|
|
153
154
|
position,
|
|
155
|
+
followTarget,
|
|
154
156
|
onPopperOpen,
|
|
155
157
|
closeOnTab,
|
|
156
158
|
prerender,
|
|
@@ -161,7 +163,7 @@ export const Select = _ref => {
|
|
|
161
163
|
return {
|
|
162
164
|
className: classNames("c-select", selectClassName)
|
|
163
165
|
};
|
|
164
|
-
}, [menuTarget, selectClassName, onClose, onOpen, mode, open, position, onPopperOpen, closeOnTab, prerender, scopedFocus, handleScroll]);
|
|
166
|
+
}, [menuTarget, selectClassName, onClose, onOpen, mode, open, position, followTarget, onPopperOpen, closeOnTab, prerender, scopedFocus, handleScroll]);
|
|
165
167
|
const handleEmptyAction = useCallback(value => {
|
|
166
168
|
emptyAction(value);
|
|
167
169
|
if (forceCloseMenu) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","names":["React","useCallback","useState","useMemo","useEffect","useRef","classNames","OptionContent","StyledSelectForm","StyledSelectInput","StyledCheckbox","StyledRadioButton","StyledStartAdornment","StyledEndAdornment","useForkRef","Autocomplete","isOptionGroup","isOptionSeparator","Menu","Select","_ref","_ref$type","type","mode","target","options","_ref$selected","selected","_ref$mixed","mixed","_ref$position","position","_ref$onChange","onChange","placeholder","_ref$emptyAction","emptyAction","_ref$disableSearch","disableSearch","forceCloseMenu","selectClassName","_ref$keepSameOptionsO","keepSameOptionsOrder","onSelectOpen","onSelectClose","renderOption","handleDefaultOptionChange","_ref$preselectDefault","preselectDefaultValue","startAdornment","endAdornment","_ref$focusInput","focusInput","disableVirtualization","closeOnTab","prerender","scopedFocus","handleScroll","prop","_objectWithoutPropertiesLoose","_excluded","console","warn","childNode","elementRef","pendingQuery","handleRef","Tag","_useState","open","setOpen","selectedOptions","Array","selectOptions","allOptionValues","reduce","acc","option","id","allGroupOptions","map","mixedOptions","length","removeFromMixedOptions","idsToRemove","current","filter","mixedOption","includes","isAllOptionsChecked","every","someOptionsChecked","some","_childNode$current","focus","handleChange","selectedValue","undefined","onClose","onOpen","onPopperOpen","input","value","dispatchEvent","Event","bubbles","handleTargetKeyDown","event","_target$props","props","onKeyDown","defaultPrevented","key","metaKey","ctrlKey","altKey","preventDefault","menuTarget","cloneElement","menuClassName","className","handleEmptyAction","handleDefaultOptionChangeCallback","handleRenderOption","icon","image","createElement","Fragment","imageUrl","color","textColor","paletteColor","name","additionalInfo","_extends","checked","autoComplete","ref","clearInputOnSelect","inputEl","displayName"],"sources":["../../../../src/components/Select/Select.tsx"],"sourcesContent":["import React, {\n FC,\n useCallback,\n useState,\n ReactElement,\n useMemo,\n useEffect,\n useRef,\n Ref,\n ReactNode,\n} from \"react\";\n\nimport { Placement } from \"@popperjs/core\";\nimport classNames from \"classnames\";\n\nimport { OptionContent } from \"./OptionContent/OptionContent\";\nimport {\n StyledSelectForm,\n StyledSelectInput,\n StyledCheckbox,\n StyledRadioButton,\n StyledStartAdornment,\n StyledEndAdornment,\n} from \"./Styles\";\nimport useForkRef from \"../../utils/useForkRef\";\nimport {\n Autocomplete,\n isOptionGroup,\n isOptionSeparator,\n} from \"../Autocomplete\";\nimport {\n type AutocompleteOption,\n IAutocompleteProps,\n} from \"../Autocomplete/Autocomplete\";\nimport { Menu } from \"../Menu/Menu\";\n\nexport interface ElementWithRef<T> extends ReactElement {\n ref?: Ref<T>;\n}\n\nexport interface ISelectProps\n extends Omit<\n IAutocompleteProps,\n | \"handleChange\"\n | \"inputEl\"\n | \"handleEmptyAction\"\n | \"clearInputOnSelect\"\n | \"mixedOptions\"\n > {\n /** Menu width mode */\n mode?: \"normal\" | \"wider\" | \"tiny\";\n /** Set select target element */\n target?: ElementWithRef<Element>;\n /** Set Select position */\n position?: Placement;\n /** onChange callback */\n onChange?: (e: (string | number)[] | string | number) => void;\n /** Placeholder for Select input */\n placeholder?: string;\n /** Function that triggers when empty is clicked */\n emptyAction?: (e: string | undefined) => void;\n /** Removes input from Select */\n disableSearch?: boolean;\n /** Close menu on select */\n forceCloseMenu?: boolean;\n /** Set select classNames */\n selectClassName?: string;\n /** Callback called when the Select menu is opened */\n onSelectOpen?: () => void;\n /** Callback called when the Select menu is closed */\n onSelectClose?: () => void;\n /** Node element on the left side */\n startAdornment?: ReactNode;\n /** Node element on the right side */\n endAdornment?: ReactNode;\n /** Focus search input on inline select */\n focusInput?: boolean;\n /** Mixed options values */\n mixed?: (string | number)[];\n disableVirtualization?: boolean;\n /** Tab and Shift+Tab close the menu and move the focus on from the target */\n closeOnTab?: boolean;\n /** Render the menu content once, hidden, soon after this turns on, so the first open is as fast as the next ones */\n prerender?: boolean;\n /** Move the focus into the menu itself, so the focus lock never searches the whole page for a place to put it */\n scopedFocus?: boolean;\n /** Lock the page scroll while the menu is open. The overlay keeps the page still without it, and on a large page the lock costs a full page layout on every open and close */\n handleScroll?: boolean;\n}\n\nexport const Select: FC<ISelectProps> = ({\n type = \"single\",\n mode,\n target,\n options,\n selected = [],\n mixed = [],\n position = \"bottom-start\",\n onChange = () => null,\n placeholder,\n emptyAction = (): null => null,\n disableSearch = false,\n forceCloseMenu,\n selectClassName,\n keepSameOptionsOrder = false,\n onSelectOpen,\n onSelectClose,\n renderOption,\n handleDefaultOptionChange,\n preselectDefaultValue = type === \"single\",\n startAdornment,\n endAdornment,\n focusInput = false,\n disableVirtualization,\n closeOnTab,\n prerender,\n scopedFocus,\n handleScroll,\n ...prop\n}) => {\n if (disableSearch && (startAdornment || endAdornment)) {\n console.warn(\"Adornments are not visible when search bar is hidden\");\n }\n const childNode = useRef<HTMLInputElement | null>();\n const elementRef = useRef<HTMLInputElement | null>(null);\n const pendingQuery = useRef<string | null>(null);\n\n const handleRef = useForkRef(childNode, elementRef);\n\n const Tag = !target ? \"div\" : Menu;\n\n const [open, setOpen] = useState(false);\n\n const selectedOptions = useMemo(\n () => (selected instanceof Array ? selected : [selected]),\n [selected]\n );\n\n const selectOptions = useMemo(() => {\n if (!options) {\n return [];\n }\n return options;\n }, [options]);\n\n const allOptionValues = useMemo(() => {\n return selectOptions.reduce(\n (acc: (string | number)[], option: AutocompleteOption) => {\n if (isOptionSeparator(option)) {\n return acc;\n }\n if (!isOptionGroup(option)) {\n return [...acc, option.id];\n }\n const allGroupOptions = option.options.map((option) => option.id);\n return [...acc, ...allGroupOptions];\n },\n []\n );\n }, [selectOptions]);\n\n const mixedOptions = useRef(type === \"multiple\" && mixed.length ? mixed : []);\n\n const removeFromMixedOptions = useCallback(\n (idsToRemove: (string | number)[]) => {\n mixedOptions.current = mixedOptions.current.filter(\n (mixedOption) => !idsToRemove.includes(mixedOption)\n );\n },\n []\n );\n\n const isAllOptionsChecked = useMemo(\n () => allOptionValues.every((option) => selectedOptions.includes(option)),\n [allOptionValues, selectedOptions]\n );\n\n const someOptionsChecked = useMemo(\n () => allOptionValues.some((option) => selectedOptions.includes(option)),\n [allOptionValues, selectedOptions]\n );\n\n useEffect(() => {\n if ((open && target) || (!target && focusInput)) {\n childNode?.current?.focus();\n }\n }, [focusInput, open, target]);\n\n const handleChange = useCallback(\n (selectedValue) => {\n if (forceCloseMenu) {\n if (typeof onSelectClose === \"function\") onSelectClose();\n setOpen(false);\n }\n if (\n selectedValue !== undefined &&\n selectedValue !== selected &&\n !(selectedValue instanceof Array && selectedValue.includes(undefined))\n ) {\n onChange(selectedValue);\n type === \"multiple\" &&\n mixedOptions.current.length &&\n removeFromMixedOptions(selectedValue);\n }\n },\n [\n forceCloseMenu,\n selected,\n onSelectClose,\n onChange,\n type,\n removeFromMixedOptions,\n ]\n );\n\n const onClose = useCallback(() => {\n pendingQuery.current = null;\n setOpen(false);\n if (onSelectClose) {\n onSelectClose();\n }\n }, [onSelectClose]);\n\n const onOpen = useCallback(() => {\n setOpen(true);\n if (onSelectOpen) {\n onSelectOpen();\n }\n }, [onSelectOpen]);\n\n const onPopperOpen = useCallback(() => {\n const input = elementRef?.current;\n input?.focus();\n if (!input || !pendingQuery.current) {\n return;\n }\n input.value = pendingQuery.current;\n pendingQuery.current = null;\n input.dispatchEvent(new Event(\"input\", { bubbles: true }));\n }, []);\n\n const handleTargetKeyDown = useCallback(\n (event: React.KeyboardEvent) => {\n target?.props?.onKeyDown?.(event);\n if (open || disableSearch || event.defaultPrevented) {\n return;\n }\n // Space and Enter already activate the trigger, and a leading space is not a query.\n if (\n event.key.length !== 1 ||\n event.key === \" \" ||\n event.metaKey ||\n event.ctrlKey ||\n event.altKey\n ) {\n return;\n }\n event.preventDefault();\n pendingQuery.current = event.key;\n onOpen();\n },\n [disableSearch, onOpen, open, target?.props]\n );\n\n const menuTarget = useMemo(\n () =>\n target\n ? React.cloneElement(target, { onKeyDown: handleTargetKeyDown })\n : target,\n [handleTargetKeyDown, target]\n );\n\n const props = useMemo(() => {\n if (menuTarget) {\n return {\n menuClassName: classNames(\"c-select\", selectClassName),\n onClose,\n onOpen,\n target: menuTarget,\n mode,\n open,\n position,\n onPopperOpen,\n closeOnTab,\n prerender,\n scopedFocus,\n handleScroll,\n };\n }\n return { className: classNames(\"c-select\", selectClassName) };\n }, [\n menuTarget,\n selectClassName,\n onClose,\n onOpen,\n mode,\n open,\n position,\n onPopperOpen,\n closeOnTab,\n prerender,\n scopedFocus,\n handleScroll,\n ]);\n\n const handleEmptyAction = useCallback(\n (value) => {\n emptyAction(value);\n if (forceCloseMenu) {\n setOpen(false);\n }\n // Clear the search input without triggering form reset events\n if (elementRef?.current) {\n elementRef.current.value = \"\";\n }\n },\n [emptyAction, forceCloseMenu]\n );\n\n const handleDefaultOptionChangeCallback = useCallback(() => {\n if (type === \"multiple\") {\n if (selectedOptions.length === allOptionValues.length) {\n if (typeof handleDefaultOptionChange === \"function\") {\n handleDefaultOptionChange();\n } else {\n onChange([]);\n }\n } else {\n if (typeof handleDefaultOptionChange === \"function\") {\n handleDefaultOptionChange();\n } else {\n onChange(allOptionValues);\n }\n }\n } else {\n if (typeof handleDefaultOptionChange === \"function\") {\n handleDefaultOptionChange();\n } else {\n onChange(\"\");\n }\n }\n if (forceCloseMenu) {\n setOpen(false);\n }\n }, [\n onChange,\n type,\n forceCloseMenu,\n selectedOptions.length,\n allOptionValues,\n handleDefaultOptionChange,\n ]);\n\n const handleRenderOption = useCallback(\n (option, props) => {\n if (typeof renderOption === \"function\") {\n return renderOption(option, props);\n }\n if (option.icon && option.image) {\n console.warn(\n \"Option has both `icon` and `image` set; `icon` takes precedence and `image` is ignored.\"\n );\n }\n return (\n <>\n <OptionContent\n icon={option.icon}\n imageUrl={option.image}\n color={option.color}\n textColor={option.textColor}\n paletteColor={option.paletteColor}\n name={option.name}\n additionalInfo={option.additionalInfo}\n />\n {option.id === null ? (\n type === \"multiple\" ? (\n <StyledCheckbox\n checked={isAllOptionsChecked}\n mixed={someOptionsChecked && !isAllOptionsChecked}\n {...props}\n />\n ) : (\n <StyledRadioButton\n checked={selectedOptions.length < 1 || !selectedOptions[0]}\n {...props}\n />\n )\n ) : type === \"multiple\" ? (\n <StyledCheckbox\n mixed={mixedOptions.current.includes(option.id)}\n {...props}\n />\n ) : (\n <StyledRadioButton {...props} />\n )}\n </>\n );\n },\n [\n isAllOptionsChecked,\n renderOption,\n type,\n someOptionsChecked,\n selectedOptions,\n ]\n );\n\n return (\n <Tag {...props}>\n <div>\n {!disableSearch ? (\n <StyledSelectForm autoComplete=\"off\">\n {startAdornment ? (\n <StyledStartAdornment>{startAdornment}</StyledStartAdornment>\n ) : null}\n <StyledSelectInput\n ref={handleRef}\n placeholder={placeholder}\n autoComplete=\"off\"\n />\n {endAdornment ? (\n <StyledEndAdornment>{endAdornment}</StyledEndAdornment>\n ) : null}\n </StyledSelectForm>\n ) : null}\n <Autocomplete\n {...prop}\n clearInputOnSelect\n inputEl={disableSearch ? undefined : childNode}\n handleEmptyAction={handleEmptyAction}\n selected={selected}\n handleChange={handleChange}\n renderOption={handleRenderOption}\n options={options}\n mixedOptions={mixedOptions.current}\n handleDefaultOptionChange={handleDefaultOptionChangeCallback}\n type={type}\n preselectDefaultValue={preselectDefaultValue}\n keepSameOptionsOrder={keepSameOptionsOrder}\n disableVirtualization={disableVirtualization}\n />\n </div>\n </Tag>\n );\n};\n\nSelect.displayName = \"Select\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAEVC,WAAW,EACXC,QAAQ,EAERC,OAAO,EACPC,SAAS,EACTC,MAAM,QAGD,OAAO;AAGd,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,aAAa,QAAQ,+BAA+B;AAC7D,SACEC,gBAAgB,EAChBC,iBAAiB,EACjBC,cAAc,EACdC,iBAAiB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AA8H,aAAA,CAAC3D,GAAG,EAAK0C,KAAK,eACZ7G,KAAA,CAAA8H,aAAA,cACG,CAACxF,aAAa,gBACbtC,KAAA,CAAA8H,aAAA,CAACtH,gBAAgB;IAACgI,YAAY,EAAC;EAAK,GACjCvF,cAAc,gBACbjD,KAAA,CAAA8H,aAAA,CAAClH,oBAAoB,QAAEqC,cAAqC,CAAC,GAC3D,IAAI,eACRjD,KAAA,CAAA8H,aAAA,CAACrH,iBAAiB;IAChBgI,GAAG,EAAEvE,SAAU;IACfhC,WAAW,EAAEA,WAAY;IACzBsG,YAAY,EAAC;EAAK,CACnB,CAAC,EACDtF,YAAY,gBACXlD,KAAA,CAAA8H,aAAA,CAACjH,kBAAkB,QAAEqC,YAAiC,CAAC,GACrD,IACY,CAAC,GACjB,IAAI,eACRlD,KAAA,CAAA8H,aAAA,CAAC/G,YAAY,EAAAuH,QAAA,KACP5E,IAAI;IACRgF,kBAAkB;IAClBC,OAAO,EAAErG,aAAa,GAAG2D,SAAS,GAAGlC,SAAU;IAC/C0D,iBAAiB,EAAEA,iBAAkB;IACrC9F,QAAQ,EAAEA,QAAS;IACnBoE,YAAY,EAAEA,YAAa;IAC3BlD,YAAY,EAAE8E,kBAAmB;IACjClG,OAAO,EAAEA,OAAQ;IACjBwD,YAAY,EAAEA,YAAY,CAACI,OAAQ;IACnCvC,yBAAyB,EAAE4E,iCAAkC;IAC7DpG,IAAI,EAAEA,IAAK;IACX0B,qBAAqB,EAAEA,qBAAsB;IAC7CN,oBAAoB,EAAEA,oBAAqB;IAC3CW,qBAAqB,EAAEA;EAAsB,EAC9C,CACE,CACF,CAAC;AAEV,CAAC;AAEDlC,MAAM,CAACyH,WAAW,GAAG,QAAQ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Select.js","names":["React","useCallback","useState","useMemo","useEffect","useRef","classNames","OptionContent","StyledSelectForm","StyledSelectInput","StyledCheckbox","StyledRadioButton","StyledStartAdornment","StyledEndAdornment","useForkRef","Autocomplete","isOptionGroup","isOptionSeparator","Menu","Select","_ref","_ref$type","type","mode","target","options","_ref$selected","selected","_ref$mixed","mixed","_ref$position","position","followTarget","_ref$onChange","onChange","placeholder","_ref$emptyAction","emptyAction","_ref$disableSearch","disableSearch","forceCloseMenu","selectClassName","_ref$keepSameOptionsO","keepSameOptionsOrder","onSelectOpen","onSelectClose","renderOption","handleDefaultOptionChange","_ref$preselectDefault","preselectDefaultValue","startAdornment","endAdornment","_ref$focusInput","focusInput","disableVirtualization","closeOnTab","prerender","scopedFocus","handleScroll","prop","_objectWithoutPropertiesLoose","_excluded","console","warn","childNode","elementRef","pendingQuery","handleRef","Tag","_useState","open","setOpen","selectedOptions","Array","selectOptions","allOptionValues","reduce","acc","option","id","allGroupOptions","map","mixedOptions","length","removeFromMixedOptions","idsToRemove","current","filter","mixedOption","includes","isAllOptionsChecked","every","someOptionsChecked","some","_childNode$current","focus","handleChange","selectedValue","undefined","onClose","onOpen","onPopperOpen","input","value","dispatchEvent","Event","bubbles","handleTargetKeyDown","event","_target$props","props","onKeyDown","defaultPrevented","key","metaKey","ctrlKey","altKey","preventDefault","menuTarget","cloneElement","menuClassName","className","handleEmptyAction","handleDefaultOptionChangeCallback","handleRenderOption","icon","image","createElement","Fragment","imageUrl","color","textColor","paletteColor","name","additionalInfo","_extends","checked","autoComplete","ref","clearInputOnSelect","inputEl","displayName"],"sources":["../../../../src/components/Select/Select.tsx"],"sourcesContent":["import React, {\n FC,\n useCallback,\n useState,\n ReactElement,\n useMemo,\n useEffect,\n useRef,\n Ref,\n ReactNode,\n} from \"react\";\n\nimport { Placement } from \"@popperjs/core\";\nimport classNames from \"classnames\";\n\nimport { OptionContent } from \"./OptionContent/OptionContent\";\nimport {\n StyledSelectForm,\n StyledSelectInput,\n StyledCheckbox,\n StyledRadioButton,\n StyledStartAdornment,\n StyledEndAdornment,\n} from \"./Styles\";\nimport useForkRef from \"../../utils/useForkRef\";\nimport {\n Autocomplete,\n isOptionGroup,\n isOptionSeparator,\n} from \"../Autocomplete\";\nimport {\n type AutocompleteOption,\n IAutocompleteProps,\n} from \"../Autocomplete/Autocomplete\";\nimport { Menu } from \"../Menu/Menu\";\n\nexport interface ElementWithRef<T> extends ReactElement {\n ref?: Ref<T>;\n}\n\nexport interface ISelectProps\n extends Omit<\n IAutocompleteProps,\n | \"handleChange\"\n | \"inputEl\"\n | \"handleEmptyAction\"\n | \"clearInputOnSelect\"\n | \"mixedOptions\"\n > {\n /** Menu width mode */\n mode?: \"normal\" | \"wider\" | \"tiny\";\n /** Set select target element */\n target?: ElementWithRef<Element>;\n /** Set Select position */\n position?: Placement;\n /** Keeps the menu on its target when the target moves or changes size. */\n followTarget?: boolean;\n /** onChange callback */\n onChange?: (e: (string | number)[] | string | number) => void;\n /** Placeholder for Select input */\n placeholder?: string;\n /** Function that triggers when empty is clicked */\n emptyAction?: (e: string | undefined) => void;\n /** Removes input from Select */\n disableSearch?: boolean;\n /** Close menu on select */\n forceCloseMenu?: boolean;\n /** Set select classNames */\n selectClassName?: string;\n /** Callback called when the Select menu is opened */\n onSelectOpen?: () => void;\n /** Callback called when the Select menu is closed */\n onSelectClose?: () => void;\n /** Node element on the left side */\n startAdornment?: ReactNode;\n /** Node element on the right side */\n endAdornment?: ReactNode;\n /** Focus search input on inline select */\n focusInput?: boolean;\n /** Mixed options values */\n mixed?: (string | number)[];\n disableVirtualization?: boolean;\n /** Tab and Shift+Tab close the menu and move the focus on from the target */\n closeOnTab?: boolean;\n /** Render the menu content once, hidden, soon after this turns on, so the first open is as fast as the next ones */\n prerender?: boolean;\n /** Move the focus into the menu itself, so the focus lock never searches the whole page for a place to put it */\n scopedFocus?: boolean;\n /** Lock the page scroll while the menu is open. The overlay keeps the page still without it, and on a large page the lock costs a full page layout on every open and close */\n handleScroll?: boolean;\n}\n\nexport const Select: FC<ISelectProps> = ({\n type = \"single\",\n mode,\n target,\n options,\n selected = [],\n mixed = [],\n position = \"bottom-start\",\n followTarget,\n onChange = () => null,\n placeholder,\n emptyAction = (): null => null,\n disableSearch = false,\n forceCloseMenu,\n selectClassName,\n keepSameOptionsOrder = false,\n onSelectOpen,\n onSelectClose,\n renderOption,\n handleDefaultOptionChange,\n preselectDefaultValue = type === \"single\",\n startAdornment,\n endAdornment,\n focusInput = false,\n disableVirtualization,\n closeOnTab,\n prerender,\n scopedFocus,\n handleScroll,\n ...prop\n}) => {\n if (disableSearch && (startAdornment || endAdornment)) {\n console.warn(\"Adornments are not visible when search bar is hidden\");\n }\n const childNode = useRef<HTMLInputElement | null>();\n const elementRef = useRef<HTMLInputElement | null>(null);\n const pendingQuery = useRef<string | null>(null);\n\n const handleRef = useForkRef(childNode, elementRef);\n\n const Tag = !target ? \"div\" : Menu;\n\n const [open, setOpen] = useState(false);\n\n const selectedOptions = useMemo(\n () => (selected instanceof Array ? selected : [selected]),\n [selected]\n );\n\n const selectOptions = useMemo(() => {\n if (!options) {\n return [];\n }\n return options;\n }, [options]);\n\n const allOptionValues = useMemo(() => {\n return selectOptions.reduce(\n (acc: (string | number)[], option: AutocompleteOption) => {\n if (isOptionSeparator(option)) {\n return acc;\n }\n if (!isOptionGroup(option)) {\n return [...acc, option.id];\n }\n const allGroupOptions = option.options.map((option) => option.id);\n return [...acc, ...allGroupOptions];\n },\n []\n );\n }, [selectOptions]);\n\n const mixedOptions = useRef(type === \"multiple\" && mixed.length ? mixed : []);\n\n const removeFromMixedOptions = useCallback(\n (idsToRemove: (string | number)[]) => {\n mixedOptions.current = mixedOptions.current.filter(\n (mixedOption) => !idsToRemove.includes(mixedOption)\n );\n },\n []\n );\n\n const isAllOptionsChecked = useMemo(\n () => allOptionValues.every((option) => selectedOptions.includes(option)),\n [allOptionValues, selectedOptions]\n );\n\n const someOptionsChecked = useMemo(\n () => allOptionValues.some((option) => selectedOptions.includes(option)),\n [allOptionValues, selectedOptions]\n );\n\n useEffect(() => {\n if ((open && target) || (!target && focusInput)) {\n childNode?.current?.focus();\n }\n }, [focusInput, open, target]);\n\n const handleChange = useCallback(\n (selectedValue) => {\n if (forceCloseMenu) {\n if (typeof onSelectClose === \"function\") onSelectClose();\n setOpen(false);\n }\n if (\n selectedValue !== undefined &&\n selectedValue !== selected &&\n !(selectedValue instanceof Array && selectedValue.includes(undefined))\n ) {\n onChange(selectedValue);\n type === \"multiple\" &&\n mixedOptions.current.length &&\n removeFromMixedOptions(selectedValue);\n }\n },\n [\n forceCloseMenu,\n selected,\n onSelectClose,\n onChange,\n type,\n removeFromMixedOptions,\n ]\n );\n\n const onClose = useCallback(() => {\n pendingQuery.current = null;\n setOpen(false);\n if (onSelectClose) {\n onSelectClose();\n }\n }, [onSelectClose]);\n\n const onOpen = useCallback(() => {\n setOpen(true);\n if (onSelectOpen) {\n onSelectOpen();\n }\n }, [onSelectOpen]);\n\n const onPopperOpen = useCallback(() => {\n const input = elementRef?.current;\n input?.focus();\n if (!input || !pendingQuery.current) {\n return;\n }\n input.value = pendingQuery.current;\n pendingQuery.current = null;\n input.dispatchEvent(new Event(\"input\", { bubbles: true }));\n }, []);\n\n const handleTargetKeyDown = useCallback(\n (event: React.KeyboardEvent) => {\n target?.props?.onKeyDown?.(event);\n if (open || disableSearch || event.defaultPrevented) {\n return;\n }\n // Space and Enter already activate the trigger, and a leading space is not a query.\n if (\n event.key.length !== 1 ||\n event.key === \" \" ||\n event.metaKey ||\n event.ctrlKey ||\n event.altKey\n ) {\n return;\n }\n event.preventDefault();\n pendingQuery.current = event.key;\n onOpen();\n },\n [disableSearch, onOpen, open, target?.props]\n );\n\n const menuTarget = useMemo(\n () =>\n target\n ? React.cloneElement(target, { onKeyDown: handleTargetKeyDown })\n : target,\n [handleTargetKeyDown, target]\n );\n\n const props = useMemo(() => {\n if (menuTarget) {\n return {\n menuClassName: classNames(\"c-select\", selectClassName),\n onClose,\n onOpen,\n target: menuTarget,\n mode,\n open,\n position,\n followTarget,\n onPopperOpen,\n closeOnTab,\n prerender,\n scopedFocus,\n handleScroll,\n };\n }\n return { className: classNames(\"c-select\", selectClassName) };\n }, [\n menuTarget,\n selectClassName,\n onClose,\n onOpen,\n mode,\n open,\n position,\n followTarget,\n onPopperOpen,\n closeOnTab,\n prerender,\n scopedFocus,\n handleScroll,\n ]);\n\n const handleEmptyAction = useCallback(\n (value) => {\n emptyAction(value);\n if (forceCloseMenu) {\n setOpen(false);\n }\n // Clear the search input without triggering form reset events\n if (elementRef?.current) {\n elementRef.current.value = \"\";\n }\n },\n [emptyAction, forceCloseMenu]\n );\n\n const handleDefaultOptionChangeCallback = useCallback(() => {\n if (type === \"multiple\") {\n if (selectedOptions.length === allOptionValues.length) {\n if (typeof handleDefaultOptionChange === \"function\") {\n handleDefaultOptionChange();\n } else {\n onChange([]);\n }\n } else {\n if (typeof handleDefaultOptionChange === \"function\") {\n handleDefaultOptionChange();\n } else {\n onChange(allOptionValues);\n }\n }\n } else {\n if (typeof handleDefaultOptionChange === \"function\") {\n handleDefaultOptionChange();\n } else {\n onChange(\"\");\n }\n }\n if (forceCloseMenu) {\n setOpen(false);\n }\n }, [\n onChange,\n type,\n forceCloseMenu,\n selectedOptions.length,\n allOptionValues,\n handleDefaultOptionChange,\n ]);\n\n const handleRenderOption = useCallback(\n (option, props) => {\n if (typeof renderOption === \"function\") {\n return renderOption(option, props);\n }\n if (option.icon && option.image) {\n console.warn(\n \"Option has both `icon` and `image` set; `icon` takes precedence and `image` is ignored.\"\n );\n }\n return (\n <>\n <OptionContent\n icon={option.icon}\n imageUrl={option.image}\n color={option.color}\n textColor={option.textColor}\n paletteColor={option.paletteColor}\n name={option.name}\n additionalInfo={option.additionalInfo}\n />\n {option.id === null ? (\n type === \"multiple\" ? (\n <StyledCheckbox\n checked={isAllOptionsChecked}\n mixed={someOptionsChecked && !isAllOptionsChecked}\n {...props}\n />\n ) : (\n <StyledRadioButton\n checked={selectedOptions.length < 1 || !selectedOptions[0]}\n {...props}\n />\n )\n ) : type === \"multiple\" ? (\n <StyledCheckbox\n mixed={mixedOptions.current.includes(option.id)}\n {...props}\n />\n ) : (\n <StyledRadioButton {...props} />\n )}\n </>\n );\n },\n [\n isAllOptionsChecked,\n renderOption,\n type,\n someOptionsChecked,\n selectedOptions,\n ]\n );\n\n return (\n <Tag {...props}>\n <div>\n {!disableSearch ? (\n <StyledSelectForm autoComplete=\"off\">\n {startAdornment ? (\n <StyledStartAdornment>{startAdornment}</StyledStartAdornment>\n ) : null}\n <StyledSelectInput\n ref={handleRef}\n placeholder={placeholder}\n autoComplete=\"off\"\n />\n {endAdornment ? (\n <StyledEndAdornment>{endAdornment}</StyledEndAdornment>\n ) : null}\n </StyledSelectForm>\n ) : null}\n <Autocomplete\n {...prop}\n clearInputOnSelect\n inputEl={disableSearch ? undefined : childNode}\n handleEmptyAction={handleEmptyAction}\n selected={selected}\n handleChange={handleChange}\n renderOption={handleRenderOption}\n options={options}\n mixedOptions={mixedOptions.current}\n handleDefaultOptionChange={handleDefaultOptionChangeCallback}\n type={type}\n preselectDefaultValue={preselectDefaultValue}\n keepSameOptionsOrder={keepSameOptionsOrder}\n disableVirtualization={disableVirtualization}\n />\n </div>\n </Tag>\n );\n};\n\nSelect.displayName = \"Select\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAEVC,WAAW,EACXC,QAAQ,EAERC,OAAO,EACPC,SAAS,EACTC,MAAM,QAGD,OAAO;AAGd,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,aAAa,QAAQ,+BAA+B;AAC7D,SACEC,gBAAgB,EAChBC,iBAAiB,EACjBC,cAAc,EACdC,iBAAiB,EACjBC,oBAAoB,EACpBC,kBAAkB,QACb,UAAU;AACjB,OAAOC,UAAU,MAAM,wBAAwB;AAC/C,SACEC,YAAY,EACZC,aAAa,EACbC,iBAAiB,QACZ,iBAAiB;AAKxB,SAASC,IAAI,QAAQ,cAAc;AA0DnC,OAAO,MAAMC,MAAwB,GAAGC,IAAA,IA8BlC;EAAA,IAAAC,SAAA,GAAAD,IAAA,CA7BJE,IAAI;IAAJA,IAAI,GAAAD,SAAA,cAAG,QAAQ,GAAAA,SAAA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lD,KAAA,CAAA+H,aAAA,CAACtH,iBAAiB;IAChBiI,GAAG,EAAEvE,SAAU;IACfhC,WAAW,EAAEA,WAAY;IACzBsG,YAAY,EAAC;EAAK,CACnB,CAAC,EACDtF,YAAY,gBACXnD,KAAA,CAAA+H,aAAA,CAAClH,kBAAkB,QAAEsC,YAAiC,CAAC,GACrD,IACY,CAAC,GACjB,IAAI,eACRnD,KAAA,CAAA+H,aAAA,CAAChH,YAAY,EAAAwH,QAAA,KACP5E,IAAI;IACRgF,kBAAkB;IAClBC,OAAO,EAAErG,aAAa,GAAG2D,SAAS,GAAGlC,SAAU;IAC/C0D,iBAAiB,EAAEA,iBAAkB;IACrC/F,QAAQ,EAAEA,QAAS;IACnBqE,YAAY,EAAEA,YAAa;IAC3BlD,YAAY,EAAE8E,kBAAmB;IACjCnG,OAAO,EAAEA,OAAQ;IACjByD,YAAY,EAAEA,YAAY,CAACI,OAAQ;IACnCvC,yBAAyB,EAAE4E,iCAAkC;IAC7DrG,IAAI,EAAEA,IAAK;IACX2B,qBAAqB,EAAEA,qBAAsB;IAC7CN,oBAAoB,EAAEA,oBAAqB;IAC3CW,qBAAqB,EAAEA;EAAsB,EAC9C,CACE,CACF,CAAC;AAEV,CAAC;AAEDnC,MAAM,CAAC0H,WAAW,GAAG,QAAQ","ignoreList":[]}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export declare const VIEW_SWITCHER_PROMPT_MS = 5000;
|
|
2
|
+
export declare const VIEW_SWITCHER_RESIZE_MS = 200;
|
|
3
|
+
export declare const VIEW_SWITCHER_APPLIED_MS = 900;
|
|
4
|
+
export declare const VIEW_SWITCHER_LEAVE_MS = 150;
|
|
1
5
|
export declare const StyledViewSwitcher: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
6
|
export declare const StyledViewSwitcherTrack: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
7
|
export declare const StyledViewSwitcherOption: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
@@ -15,7 +19,6 @@ export declare const StyledViewSwitcherMenuList: import("styled-components").Sty
|
|
|
15
19
|
};
|
|
16
20
|
}, any, {}, never>;
|
|
17
21
|
export declare const StyledViewSwitcherMenuLabel: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
18
|
-
export declare const
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const StyledViewSwitcherOffer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
22
|
+
export declare const StyledViewSwitcherPromptTitle: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
23
|
+
export declare const StyledViewSwitcherPrompt: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("..").PillGroupProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
|
|
21
24
|
//# sourceMappingURL=Styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/ViewSwitcher/Styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/ViewSwitcher/Styles.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAC5C,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAC5C,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,eAAO,MAAM,kBAAkB,oEAI9B,CAAC;AAIF,eAAO,MAAM,uBAAuB,oEAcnC,CAAC;AAIF,eAAO,MAAM,wBAAwB,uEA4CpC,CAAC;AAIF,eAAO,MAAM,4BAA4B,uEAwDxC,CAAC;AAIF,eAAO,MAAM,0BAA0B,qEAKtC,CAAC;AAIF,eAAO,MAAM,0BAA0B;;;;;;;;;;kBAEtC,CAAC;AAIF,eAAO,MAAM,2BAA2B,qEAOvC,CAAC;AAiCF,eAAO,MAAM,6BAA6B,qEAOzC,CAAC;AAIF,eAAO,MAAM,wBAAwB,qLAqEpC,CAAC"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
1
|
+
import styled, { keyframes } from "styled-components";
|
|
2
2
|
import { BoxSizingStyle } from "../BoxSizingStyle";
|
|
3
3
|
import { List } from "../List";
|
|
4
|
+
import { PillGroup } from "../PillGroup";
|
|
5
|
+
export const VIEW_SWITCHER_PROMPT_MS = 5000;
|
|
6
|
+
export const VIEW_SWITCHER_RESIZE_MS = 200;
|
|
7
|
+
export const VIEW_SWITCHER_APPLIED_MS = 900;
|
|
8
|
+
export const VIEW_SWITCHER_LEAVE_MS = 150;
|
|
4
9
|
export const StyledViewSwitcher = styled.div.withConfig({
|
|
5
10
|
displayName: "Styles__StyledViewSwitcher",
|
|
6
11
|
componentId: "sc-1cg2mte-0"
|
|
@@ -9,12 +14,12 @@ StyledViewSwitcher.displayName = "StyledViewSwitcher";
|
|
|
9
14
|
export const StyledViewSwitcherTrack = styled.div.withConfig({
|
|
10
15
|
displayName: "Styles__StyledViewSwitcherTrack",
|
|
11
16
|
componentId: "sc-1cg2mte-1"
|
|
12
|
-
})(["", " display:inline-flex;align-items:center;height:32px;padding:3px;border-radius:var(--ac-br-rounded);background-color:var(--color-theme-300);"], BoxSizingStyle);
|
|
17
|
+
})(["", " display:inline-flex;align-items:center;justify-content:flex-end;height:32px;padding:3px;border-radius:var(--ac-br-rounded);background-color:var(--color-theme-300);transition:width ", "ms cubic-bezier(0.4,0,0.2,1);@media (prefers-reduced-motion:reduce){transition:none;}"], BoxSizingStyle, VIEW_SWITCHER_RESIZE_MS);
|
|
13
18
|
StyledViewSwitcherTrack.displayName = "StyledViewSwitcherTrack";
|
|
14
19
|
export const StyledViewSwitcherOption = styled.button.withConfig({
|
|
15
20
|
displayName: "Styles__StyledViewSwitcherOption",
|
|
16
21
|
componentId: "sc-1cg2mte-2"
|
|
17
|
-
})(["", " display:inline-flex;align-items:center;justify-content:center;width:34px;height:26px;margin:0;padding:0;border:0;border-radius:var(--ac-br-rounded);background-color:transparent;cursor:pointer;outline:none;transition:background-color 150ms ease,box-shadow 150ms ease;svg{width:20px;height:20px;fill:var(--color-theme-700);}&:hover{background-color:color-mix( in srgb,var(--color-theme-900) 16%,transparent );}&[aria-checked=\"true\"]{background-color:var(--page-paper-main);box-shadow:var(--shadow-float);cursor:default;svg{fill:var(--color-theme-900);}}&:focus-visible{box-shadow:0 0 0 2px var(--color-primary);}"], BoxSizingStyle);
|
|
22
|
+
})(["", " display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:34px;height:26px;margin:0;padding:0;border:0;border-radius:var(--ac-br-rounded);background-color:transparent;cursor:pointer;outline:none;transition:background-color 150ms ease,box-shadow 150ms ease;svg{width:20px;height:20px;fill:var(--color-theme-700);}&:hover{background-color:color-mix( in srgb,var(--color-theme-900) 16%,transparent );}&[aria-checked=\"true\"]{background-color:var(--page-paper-main);box-shadow:var(--shadow-float);cursor:default;svg{fill:var(--color-theme-900);}}&:focus-visible{box-shadow:0 0 0 2px var(--color-primary);}"], BoxSizingStyle);
|
|
18
23
|
StyledViewSwitcherOption.displayName = "StyledViewSwitcherOption";
|
|
19
24
|
export const StyledViewSwitcherMenuOption = styled.button.withConfig({
|
|
20
25
|
displayName: "Styles__StyledViewSwitcherMenuOption",
|
|
@@ -36,19 +41,18 @@ export const StyledViewSwitcherMenuLabel = styled.span.withConfig({
|
|
|
36
41
|
componentId: "sc-1cg2mte-6"
|
|
37
42
|
})(["flex:1;&[data-selected=\"true\"]{font-weight:bold;color:var(--color-primary);}"]);
|
|
38
43
|
StyledViewSwitcherMenuLabel.displayName = "StyledViewSwitcherMenuLabel";
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
const promptIn = keyframes(["from{opacity:0;}"]);
|
|
45
|
+
const promptOut = keyframes(["to{opacity:0;transform:scale(0.96);}"]);
|
|
46
|
+
const promptTimeLeft = keyframes(["to{transform:scaleX(0);}"]);
|
|
47
|
+
const appliedIcon = keyframes(["from{opacity:0;transform:scale(0.4);}60%{transform:scale(1.2);}"]);
|
|
48
|
+
export const StyledViewSwitcherPromptTitle = styled.span.withConfig({
|
|
49
|
+
displayName: "Styles__StyledViewSwitcherPromptTitle",
|
|
41
50
|
componentId: "sc-1cg2mte-7"
|
|
42
|
-
})(["
|
|
43
|
-
|
|
44
|
-
export const
|
|
45
|
-
displayName: "
|
|
51
|
+
})(["position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;"]);
|
|
52
|
+
StyledViewSwitcherPromptTitle.displayName = "StyledViewSwitcherPromptTitle";
|
|
53
|
+
export const StyledViewSwitcherPrompt = styled(PillGroup).withConfig({
|
|
54
|
+
displayName: "Styles__StyledViewSwitcherPrompt",
|
|
46
55
|
componentId: "sc-1cg2mte-8"
|
|
47
|
-
})(["", " position:relative;width:
|
|
48
|
-
|
|
49
|
-
export const StyledViewSwitcherOffer = styled.div.withConfig({
|
|
50
|
-
displayName: "Styles__StyledViewSwitcherOffer",
|
|
51
|
-
componentId: "sc-1cg2mte-9"
|
|
52
|
-
})(["", " display:flex;flex-direction:column;gap:8px;width:260px;padding:10px 14px;border:1px solid var(--border-raised);border-radius:var(--ac-br-8);background-color:var(--page-paper-main);box-shadow:var(--shadow-popover);.c-view-switcher__offer-title{display:flex;align-items:center;gap:8px;}.c-view-switcher__offer-title svg{width:18px;height:18px;flex-shrink:0;fill:var(--color-primary);}.c-view-switcher__offer-action{align-self:flex-start;height:28px;padding:0 10px;border-color:var(--border-raised);border-radius:var(--ac-br-6);color:var(--color-theme-700);}"], BoxSizingStyle);
|
|
53
|
-
StyledViewSwitcherOffer.displayName = "StyledViewSwitcherOffer";
|
|
56
|
+
})(["flex:1 0 auto;max-width:none;animation:", " 150ms ease-out;.c-pill-button:not(.c-pill-button--icon-only){flex:1 0 auto;justify-content:center;font-size:calc(0.75rem * var(--text-scale,1));}& > .c-pill-button:not(.c-pill-button--icon-only){white-space:nowrap;}.c-view-switcher__dismiss{position:relative;width:32px;overflow:hidden;}.c-view-switcher__dismiss::before{content:\"\";position:absolute;inset:0;background-color:color-mix(in srgb,var(--color-primary) 25%,transparent);transform-origin:left;animation:", " ", "ms linear forwards;}.c-view-switcher__dismiss > *{position:relative;}&[data-phase=\"applying\"]{pointer-events:none;.c-pill-button{opacity:0.7;}.c-view-switcher__dismiss::before{animation-play-state:paused;}}&[data-phase=\"applied\"]{pointer-events:none;.c-pill-button{background-color:color-mix( in srgb,var(--color-primary) 30%,transparent );}.c-pill-button svg{width:16px;height:16px;animation:", " 250ms ease-out;}}&[data-phase=\"leaving\"]{pointer-events:none;animation:", " ", "ms ease-in forwards;}"], promptIn, promptTimeLeft, VIEW_SWITCHER_PROMPT_MS, appliedIcon, promptOut, VIEW_SWITCHER_LEAVE_MS);
|
|
57
|
+
StyledViewSwitcherPrompt.displayName = "StyledViewSwitcherPrompt";
|
|
54
58
|
//# sourceMappingURL=Styles.js.map
|