@audius/harmony 0.4.2 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/assets/icons/ArtistCoin.svg.js +86 -0
- package/dist/assets/icons/ArtistCoin.svg.js.map +1 -0
- package/dist/assets/icons/CoinGatedLabel.svg.js +93 -0
- package/dist/assets/icons/CoinGatedLabel.svg.js.map +1 -0
- package/dist/components/artwork/Artwork.d.ts +1 -0
- package/dist/components/artwork/Artwork.d.ts.map +1 -1
- package/dist/components/artwork/Artwork.js +5 -2
- package/dist/components/artwork/Artwork.js.map +1 -1
- package/dist/components/button/BaseButton/BaseButton.d.ts.map +1 -1
- package/dist/components/button/BaseButton/BaseButton.js +1 -1
- package/dist/components/button/BaseButton/BaseButton.js.map +1 -1
- package/dist/components/button/Button/Button.d.ts +2 -1
- package/dist/components/button/Button/Button.d.ts.map +1 -1
- package/dist/components/button/Button/Button.js +18 -21
- package/dist/components/button/Button/Button.js.map +1 -1
- package/dist/components/button/Button/types.d.ts +4 -0
- package/dist/components/button/Button/types.d.ts.map +1 -1
- package/dist/components/button/FollowButton/FollowButton.js +1 -0
- package/dist/components/button/FollowButton/FollowButton.js.map +1 -1
- package/dist/components/button/SocialButton/SocialButton.js +1 -0
- package/dist/components/button/SocialButton/SocialButton.js.map +1 -1
- package/dist/components/button/index.d.ts +1 -0
- package/dist/components/button/index.d.ts.map +1 -1
- package/dist/components/completion-check/CompletionCheck.js +1 -0
- package/dist/components/completion-check/CompletionCheck.js.map +1 -1
- package/dist/components/expandable-nav-item/ExpandableNavItem.js +1 -0
- package/dist/components/expandable-nav-item/ExpandableNavItem.js.map +1 -1
- package/dist/components/hint/Hint.d.ts +1 -0
- package/dist/components/hint/Hint.d.ts.map +1 -1
- package/dist/components/hint/Hint.js +3 -2
- package/dist/components/hint/Hint.js.map +1 -1
- package/dist/components/hover-card/HoverCard.d.ts +1 -1
- package/dist/components/hover-card/HoverCard.d.ts.map +1 -1
- package/dist/components/hover-card/HoverCard.js +10 -4
- package/dist/components/hover-card/HoverCard.js.map +1 -1
- package/dist/components/hover-card/HoverCardHeader.d.ts +1 -1
- package/dist/components/hover-card/HoverCardHeader.d.ts.map +1 -1
- package/dist/components/hover-card/HoverCardHeader.js +9 -3
- package/dist/components/hover-card/HoverCardHeader.js.map +1 -1
- package/dist/components/hover-card/types.d.ts +9 -0
- package/dist/components/hover-card/types.d.ts.map +1 -1
- package/dist/components/input/PasswordInput/PasswordInput.js +1 -0
- package/dist/components/input/PasswordInput/PasswordInput.js.map +1 -1
- package/dist/components/input/TextInput/TextInput.d.ts.map +1 -1
- package/dist/components/input/TextInput/TextInput.js +16 -5
- package/dist/components/input/TextInput/TextInput.js.map +1 -1
- package/dist/components/input/TextInput/TextInput.module.css.js +1 -1
- package/dist/components/input/TextInput/types.d.ts +2 -1
- package/dist/components/input/TextInput/types.d.ts.map +1 -1
- package/dist/components/input/TextInput/types.js +1 -0
- package/dist/components/input/TextInput/types.js.map +1 -1
- package/dist/components/input/TokenAmountInput/TokenAmountInput.d.ts +2 -1
- package/dist/components/input/TokenAmountInput/TokenAmountInput.d.ts.map +1 -1
- package/dist/components/input/TokenAmountInput/TokenAmountInput.js +4 -2
- package/dist/components/input/TokenAmountInput/TokenAmountInput.js.map +1 -1
- package/dist/components/input/TokenAmountInput/types.d.ts +7 -1
- package/dist/components/input/TokenAmountInput/types.d.ts.map +1 -1
- package/dist/components/modal/Modal.js +1 -0
- package/dist/components/modal/Modal.js.map +1 -1
- package/dist/components/modal/ModalFooter.d.ts +1 -2
- package/dist/components/modal/ModalFooter.d.ts.map +1 -1
- package/dist/components/modal/ModalFooter.js +3 -4
- package/dist/components/modal/ModalFooter.js.map +1 -1
- package/dist/components/modal/ModalHeader.js +1 -0
- package/dist/components/modal/ModalHeader.js.map +1 -1
- package/dist/components/modal/types.d.ts +2 -1
- package/dist/components/modal/types.d.ts.map +1 -1
- package/dist/components/modal/types.js.map +1 -1
- package/dist/components/pill/Pill.d.ts +2 -2
- package/dist/components/pill/Pill.d.ts.map +1 -1
- package/dist/components/pill/Pill.js +4 -0
- package/dist/components/pill/Pill.js.map +1 -1
- package/dist/components/popup/Popup.d.ts.map +1 -1
- package/dist/components/popup/Popup.js +4 -2
- package/dist/components/popup/Popup.js.map +1 -1
- package/dist/components/popup-menu/PopupMenu.d.ts +1 -1
- package/dist/components/popup-menu/PopupMenu.js +3 -3
- package/dist/components/popup-menu/PopupMenu.js.map +1 -1
- package/dist/components/popup-menu/types.d.ts +1 -1
- package/dist/components/popup-menu/types.d.ts.map +1 -1
- package/dist/components/radio/Radio.d.ts +1 -0
- package/dist/components/radio/Radio.d.ts.map +1 -1
- package/dist/components/radio/Radio.js +4 -2
- package/dist/components/radio/Radio.js.map +1 -1
- package/dist/components/segmented-control/SegmentedControl.d.ts.map +1 -1
- package/dist/components/segmented-control/SegmentedControl.js +21 -9
- package/dist/components/segmented-control/SegmentedControl.js.map +1 -1
- package/dist/components/segmented-control/types.d.ts +2 -0
- package/dist/components/segmented-control/types.d.ts.map +1 -1
- package/dist/components/select/Select/Select.js +1 -0
- package/dist/components/select/Select/Select.js.map +1 -1
- package/dist/components/send-icon/SendIcon.js +1 -0
- package/dist/components/send-icon/SendIcon.js.map +1 -1
- package/dist/components/text/Text.d.ts.map +1 -1
- package/dist/components/text/Text.js +46 -5
- package/dist/components/text/Text.js.map +1 -1
- package/dist/components/text/types.d.ts +1 -0
- package/dist/components/text/types.d.ts.map +1 -1
- package/dist/foundations/color/color.d.ts +21 -0
- package/dist/foundations/color/color.d.ts.map +1 -1
- package/dist/foundations/color/primitive.d.ts +12 -0
- package/dist/foundations/color/primitive.d.ts.map +1 -1
- package/dist/foundations/color/primitive.js +12 -0
- package/dist/foundations/color/primitive.js.map +1 -1
- package/dist/foundations/color/semantic.d.ts +9 -0
- package/dist/foundations/color/semantic.d.ts.map +1 -1
- package/dist/foundations/color/semantic.js +5 -2
- package/dist/foundations/color/semantic.js.map +1 -1
- package/dist/harmony.css +1 -1
- package/dist/icons/SVGDefs.d.ts.map +1 -1
- package/dist/icons/SVGDefs.js +1 -1
- package/dist/icons/SVGDefs.js.map +1 -1
- package/dist/icons/utilityIcons.d.ts +2 -0
- package/dist/icons/utilityIcons.d.ts.map +1 -1
- package/dist/icons/utilityIcons.js +5 -1
- package/dist/icons/utilityIcons.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/createImageIcon.js +1 -0
- package/dist/utils/createImageIcon.js.map +1 -1
- package/dist/utils/formatCount.d.ts +1 -1
- package/dist/utils/formatCount.d.ts.map +1 -1
- package/dist/utils/formatCount.js +3 -2
- package/dist/utils/formatCount.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/modal/ModalFooter.module.css.js +0 -4
- package/dist/components/modal/ModalFooter.module.css.js.map +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { CSSObject } from '@emotion/react';
|
|
3
3
|
import { BaseButtonProps } from '../button/BaseButton/types';
|
|
4
4
|
export type PillProps = BaseButtonProps & {
|
|
5
|
-
variant?: 'default' | 'active' | 'custom';
|
|
5
|
+
variant?: 'default' | 'active' | 'primary' | 'custom';
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
8
|
* The Pill button is located in the sidebar and is used to open the
|
|
@@ -27,6 +27,6 @@ export declare const Pill: (props: {
|
|
|
27
27
|
_isHovered?: boolean | undefined;
|
|
28
28
|
_isPressed?: boolean | undefined;
|
|
29
29
|
} & {
|
|
30
|
-
variant?: "default" | "active" | "custom" | undefined;
|
|
30
|
+
variant?: "default" | "active" | "primary" | "custom" | undefined;
|
|
31
31
|
} & import("react").RefAttributes<HTMLButtonElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
|
|
32
32
|
//# sourceMappingURL=Pill.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pill.d.ts","sourceRoot":"","sources":["../../../src/components/pill/Pill.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAY,MAAM,gBAAgB,CAAA;AAGpD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAG5D,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG;IACxC,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"Pill.d.ts","sourceRoot":"","sources":["../../../src/components/pill/Pill.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAY,MAAM,gBAAgB,CAAA;AAGpD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAG5D,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG;IACxC,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAA;CACtD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;sJAmEhB,CAAA"}
|
|
@@ -17,21 +17,25 @@ var Pill = forwardRef(function (props, ref) {
|
|
|
17
17
|
var backgroundColors = {
|
|
18
18
|
default: color.background.surface2,
|
|
19
19
|
active: color.background.accent,
|
|
20
|
+
primary: color.background.primary,
|
|
20
21
|
custom: undefined
|
|
21
22
|
};
|
|
22
23
|
var hoverBackgroundColors = {
|
|
23
24
|
default: color.background.accent,
|
|
24
25
|
active: color.background.accent,
|
|
26
|
+
primary: color.background.accent,
|
|
25
27
|
custom: undefined
|
|
26
28
|
};
|
|
27
29
|
var textColors = {
|
|
28
30
|
default: color.text.subdued,
|
|
29
31
|
active: color.text.white,
|
|
32
|
+
primary: color.text.white,
|
|
30
33
|
custom: color.text.white
|
|
31
34
|
};
|
|
32
35
|
var hoverTextColors = {
|
|
33
36
|
default: color.text.white,
|
|
34
37
|
active: color.text.white,
|
|
38
|
+
primary: color.text.white,
|
|
35
39
|
custom: color.text.white
|
|
36
40
|
};
|
|
37
41
|
var buttonCss = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pill.js","sources":["../../../src/components/pill/Pill.tsx"],"sourcesContent":["import { Ref, forwardRef } from 'react'\n\nimport { CSSObject, useTheme } from '@emotion/react'\n\nimport { BaseButton } from '../button/BaseButton/BaseButton'\nimport { BaseButtonProps } from '../button/BaseButton/types'\nimport { Text } from '../text'\n\nexport type PillProps = BaseButtonProps & {\n variant?: 'default' | 'active' | 'custom'\n}\n\n/**\n * The Pill button is located in the sidebar and is used to open the\n * Add Playlist/Add Folder popover menu.\n * It can also be used in the NEW pill in the notification card.\n */\nexport const Pill = forwardRef(\n (props: PillProps, ref: Ref<HTMLButtonElement>) => {\n const { variant = 'default', children, ...other } = props\n const { onClick } = other\n const { color, spacing, cornerRadius } = useTheme()\n\n const backgroundColors = {\n default: color.background.surface2,\n active: color.background.accent,\n custom: undefined\n }\n\n const hoverBackgroundColors = {\n default: color.background.accent,\n active: color.background.accent,\n custom: undefined\n }\n\n const textColors = {\n default: color.text.subdued,\n active: color.text.white,\n custom: color.text.white\n }\n\n const hoverTextColors = {\n default: color.text.white,\n active: color.text.white,\n custom: color.text.white\n }\n\n const buttonCss: CSSObject = {\n gap: spacing['2xs'],\n paddingInline: 6,\n paddingBlock: spacing.xs,\n borderWidth: 0,\n borderRadius: cornerRadius.circle,\n backgroundColor: backgroundColors[variant],\n color: textColors[variant],\n '&:hover': {\n backgroundColor: hoverBackgroundColors[variant],\n color: hoverTextColors[variant]\n },\n pointerEvents: onClick ? 'auto' : 'none'\n }\n\n const iconCss = {\n height: 10,\n width: 10\n }\n\n return (\n <BaseButton\n ref={ref}\n styles={{ button: buttonCss, icon: iconCss }}\n asChild={!onClick}\n {...other}\n >\n <Text variant='label' size='s'>\n {children}\n </Text>\n </BaseButton>\n )\n }\n)\n"],"names":["_jsx"],"mappings":";;;;;;;AAYA;;;;AAIG;IACU,IAAI,GAAG,UAAU,CAC5B,UAAC,KAAgB,EAAE,GAA2B,EAAA;IACpC,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,SAAS,GAAc;AAC3B,QAAA,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC;AACnB,QAAA,aAAa,EAAE,CAAC;QAChB,YAAY,EAAE,OAAO,CAAC,EAAE;AACxB,QAAA,WAAW,EAAE,CAAC;QACd,YAAY,EAAE,YAAY,CAAC,MAAM;AACjC,QAAA,eAAe,EAAE,gBAAgB,CAAC,OAAO,CAAC;AAC1C,QAAA,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;AAC1B,QAAA,SAAS,EAAE;AACT,YAAA,eAAe,EAAE,qBAAqB,CAAC,OAAO,CAAC;AAC/C,YAAA,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC;AAChC,SAAA;QACD,aAAa,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM;KACzC,CAAA;AAED,IAAA,IAAM,OAAO,GAAG;AACd,QAAA,MAAM,EAAE,EAAE;AACV,QAAA,KAAK,EAAE,EAAE;KACV,CAAA;AAED,IAAA,QACEA,GAAC,CAAA,UAAU,aACT,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,EAC5C,OAAO,EAAE,CAAC,OAAO,EACb,EAAA,KAAK,cAETA,GAAC,CAAA,IAAI,aAAC,OAAO,EAAC,OAAO,EAAC,IAAI,EAAC,GAAG,EAAA,EAAA,EAAA,QAAA,EAC3B,QAAQ,EACJ,CAAA,CAAA,EAAA,CAAA,CACI,EACd;AACH,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Pill.js","sources":["../../../src/components/pill/Pill.tsx"],"sourcesContent":["import { Ref, forwardRef } from 'react'\n\nimport { CSSObject, useTheme } from '@emotion/react'\n\nimport { BaseButton } from '../button/BaseButton/BaseButton'\nimport { BaseButtonProps } from '../button/BaseButton/types'\nimport { Text } from '../text'\n\nexport type PillProps = BaseButtonProps & {\n variant?: 'default' | 'active' | 'primary' | 'custom'\n}\n\n/**\n * The Pill button is located in the sidebar and is used to open the\n * Add Playlist/Add Folder popover menu.\n * It can also be used in the NEW pill in the notification card.\n */\nexport const Pill = forwardRef(\n (props: PillProps, ref: Ref<HTMLButtonElement>) => {\n const { variant = 'default', children, ...other } = props\n const { onClick } = other\n const { color, spacing, cornerRadius } = useTheme()\n\n const backgroundColors = {\n default: color.background.surface2,\n active: color.background.accent,\n primary: color.background.primary,\n custom: undefined\n }\n\n const hoverBackgroundColors = {\n default: color.background.accent,\n active: color.background.accent,\n primary: color.background.accent,\n custom: undefined\n }\n\n const textColors = {\n default: color.text.subdued,\n active: color.text.white,\n primary: color.text.white,\n custom: color.text.white\n }\n\n const hoverTextColors = {\n default: color.text.white,\n active: color.text.white,\n primary: color.text.white,\n custom: color.text.white\n }\n\n const buttonCss: CSSObject = {\n gap: spacing['2xs'],\n paddingInline: 6,\n paddingBlock: spacing.xs,\n borderWidth: 0,\n borderRadius: cornerRadius.circle,\n backgroundColor: backgroundColors[variant],\n color: textColors[variant],\n '&:hover': {\n backgroundColor: hoverBackgroundColors[variant],\n color: hoverTextColors[variant]\n },\n pointerEvents: onClick ? 'auto' : 'none'\n }\n\n const iconCss = {\n height: 10,\n width: 10\n }\n\n return (\n <BaseButton\n ref={ref}\n styles={{ button: buttonCss, icon: iconCss }}\n asChild={!onClick}\n {...other}\n >\n <Text variant='label' size='s'>\n {children}\n </Text>\n </BaseButton>\n )\n }\n)\n"],"names":["_jsx"],"mappings":";;;;;;;AAYA;;;;AAIG;IACU,IAAI,GAAG,UAAU,CAC5B,UAAC,KAAgB,EAAE,GAA2B,EAAA;IACpC,IAAA,EAAA,GAA4C,KAAK,CAA9B,OAAA,EAAnB,OAAO,GAAG,EAAA,KAAA,KAAA,CAAA,GAAA,SAAS,KAAA,EAAE,QAAQ,GAAe,KAAK,CAAA,QAApB,EAAK,KAAK,GAAA,MAAA,CAAK,KAAK,EAAnD,CAAA,SAAA,EAAA,UAAA,CAA2C,CAAF,CAAU;AACjD,IAAA,IAAA,OAAO,GAAK,KAAK,CA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BACC,eAAe,UAAU,CAAC,KAAK,IAAI;
|
|
1
|
+
{"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["../../../src/components/popup/Popup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,cAAc,EAKf,MAAM,OAAO,CAAA;AAUd,OAAO,EAAE,UAAU,EAAE,+BAAiC;AAMtD,OAAO,KAAK,EAAE,UAAU,EAAU,MAAM,SAAS,CAAA;AAkHjD;;;;;GAKG;AACH,eAAO,MAAM,KAAK,sKAwBhB,CAAA;AAEF,eAAO,MAAM,aAAa;gBAGV,UAAU;2BACC,eAAe,UAAU,CAAC,KAAK,IAAI;mJAuR5D,CAAA"}
|
|
@@ -26,6 +26,7 @@ import '../button/IconButton/IconButton.js';
|
|
|
26
26
|
import '../button/UnstyledButton.js';
|
|
27
27
|
import '../button/FilterButton/FilterButton.js';
|
|
28
28
|
import '../button/FilterButton/FilterButtonOption.js';
|
|
29
|
+
import '../button/BaseButton/BaseButton.js';
|
|
29
30
|
import '@react-spring/web';
|
|
30
31
|
import '../text-link/TextLink.js';
|
|
31
32
|
import '../switch/Switch.js';
|
|
@@ -269,11 +270,12 @@ var PopupInternal = forwardRef(function Popup(props, ref) {
|
|
|
269
270
|
if (isVisible) {
|
|
270
271
|
var escapeListener_1 = function (e) {
|
|
271
272
|
if (e.code === 'Escape') {
|
|
273
|
+
e.stopPropagation();
|
|
272
274
|
handleClose();
|
|
273
275
|
}
|
|
274
276
|
};
|
|
275
|
-
|
|
276
|
-
return function () { return
|
|
277
|
+
document.addEventListener('keydown', escapeListener_1, true);
|
|
278
|
+
return function () { return document.removeEventListener('keydown', escapeListener_1, true); };
|
|
277
279
|
}
|
|
278
280
|
return function () { };
|
|
279
281
|
}, [isVisible, handleClose]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popup.js","sources":["../../../src/components/popup/Popup.tsx"],"sourcesContent":["import {\n forwardRef,\n MutableRefObject,\n Ref,\n SetStateAction,\n useCallback,\n useEffect,\n useRef,\n useState\n} from 'react'\n\nimport { useTheme } from '@emotion/react'\nimport cn from 'classnames'\nimport ReactDOM from 'react-dom'\nimport { useTransition, animated } from 'react-spring'\nimport { usePrevious } from 'react-use'\n\nimport { PlainButton } from '~harmony/components/button/PlainButton/PlainButton'\nimport { IconClose } from '~harmony/icons'\nimport { ModalState } from '~harmony/utils/modalState'\n\nimport { useClickOutside } from '../../hooks/useClickOutside'\nimport { getScrollParent } from '../../utils/getScrollParent'\n\nimport styles from './Popup.module.css'\nimport type { PopupProps, Origin } from './types'\n\nconst messages = {\n close: 'close popup'\n}\n\n/**\n * Number of pixels between the edge of the container and the popup\n * before the popup needs to reposition itself to be in view.\n */\nconst CONTAINER_INSET_PADDING = 16\n\n/**\n * Figures out whether the specified position would overflow the window\n * and picks a better position accordingly\n * @param {Origin} anchorOrigin where the origin is on the trigger\n * @param {Origin} transformOrigin where the origin is on the popup\n * @param {DOMRect} anchorRect the position and size of the trigger\n * @param {DOMRect} wrapperRect the position and size of the popup\n * @return {{ anchorOrigin: Origin, transformOrigin: Origin }} the new origin after accounting for overflow\n */\nconst getComputedOrigins = (\n anchorOrigin: Origin,\n transformOrigin: Origin,\n anchorRect: DOMRect,\n wrapperRect: DOMRect,\n portal: HTMLElement,\n containerRef?: MutableRefObject<HTMLDivElement | undefined>\n) => {\n if (!anchorRect || !wrapperRect) return { anchorOrigin, transformOrigin }\n\n let containerWidth, containerHeight\n if (containerRef && containerRef.current) {\n const containerRect = containerRef.current.getBoundingClientRect()\n containerWidth =\n containerRect.width + containerRect.x - CONTAINER_INSET_PADDING\n containerHeight =\n containerRect.height + containerRect.y - CONTAINER_INSET_PADDING\n } else {\n const portalRect = portal.getBoundingClientRect()\n containerWidth = portalRect.width + portalRect.x - CONTAINER_INSET_PADDING\n containerHeight = portalRect.height + portalRect.y - CONTAINER_INSET_PADDING\n }\n\n // Get new wrapper position\n const anchorTranslation = getOriginTranslation(anchorOrigin, anchorRect)\n const wrapperTranslation = getOriginTranslation(transformOrigin, wrapperRect)\n const wrapperX = anchorRect.x + anchorTranslation.x - wrapperTranslation.x\n const wrapperY = anchorRect.y + anchorTranslation.y - wrapperTranslation.y\n\n // Check bounds of the wrapper in new position are inside container\n const overflowRight = wrapperX + wrapperRect.width > containerWidth\n const overflowLeft = wrapperX < 0\n const overflowBottom = wrapperY + wrapperRect.height > containerHeight\n const overflowTop = wrapperY < 0\n\n // For all overflows, flip the position\n if (overflowRight) {\n anchorOrigin.horizontal = 'left'\n transformOrigin.horizontal = 'right'\n }\n if (overflowLeft) {\n anchorOrigin.horizontal = 'right'\n transformOrigin.horizontal = 'left'\n }\n if (overflowTop) {\n anchorOrigin.vertical = 'bottom'\n transformOrigin.vertical = 'top'\n }\n if (overflowBottom) {\n anchorOrigin.vertical = 'top'\n transformOrigin.vertical = 'bottom'\n }\n return { anchorOrigin, transformOrigin }\n}\n\n/**\n * Gets the x, y offsets for the given origin using the dimensions\n * @param origin the relative origin\n * @param dimensions the dimensions to use with the relative origin\n * @returns the x and y coordinates of the new origin relative to the old one\n */\nconst getOriginTranslation = (\n origin: Origin,\n dimensions: { width: number; height: number }\n) => {\n let x = 0\n let y = 0\n const { width, height } = dimensions\n if (origin.horizontal === 'center') {\n x += width / 2\n } else if (origin.horizontal === 'right') {\n x += width\n }\n if (origin.vertical === 'center') {\n y += height / 2\n } else if (origin.vertical === 'bottom') {\n y += height\n }\n return { x, y }\n}\n\nconst defaultAnchorOrigin: Origin = {\n horizontal: 'center',\n vertical: 'bottom'\n}\n\nconst defaultTransformOrigin: Origin = {\n horizontal: 'center',\n vertical: 'top'\n}\n\nconst closingAnimationDuration = 90\n\n/**\n * A popup is an in-place container that shows on top of the UI. A popup does\n * not impact the rest of the UI (e.g. dimming background or shifting elements).\n * It differs from modals, which do take over the whole UI and are usually\n * center-screened.\n */\nexport const Popup = forwardRef<HTMLDivElement, PopupProps>(function Popup(\n props: PopupProps,\n ref: Ref<HTMLDivElement>\n) {\n const { isVisible: isVisibleProp } = props\n const [popupState, setPopupState] = useState<ModalState>('closed')\n\n const isVisible = popupState !== 'closed'\n useEffect(() => {\n if (popupState === 'closed' && isVisibleProp) {\n setPopupState('opening')\n } else if (popupState === 'open' && !isVisibleProp) {\n setPopupState('closing')\n }\n }, [isVisibleProp, popupState])\n\n return isVisible ? (\n <PopupInternal\n ref={ref}\n popupState={popupState}\n setPopupState={setPopupState}\n {...props}\n />\n ) : null\n})\n\nexport const PopupInternal = forwardRef<\n HTMLDivElement,\n PopupProps & {\n popupState: ModalState\n setPopupState: (value: SetStateAction<ModalState>) => void\n }\n>(function Popup(\n props: PopupProps & {\n popupState: ModalState\n setPopupState: (value: SetStateAction<ModalState>) => void\n },\n ref: Ref<HTMLDivElement>\n) {\n const {\n popupState,\n setPopupState,\n anchorRef,\n checkIfClickInside,\n children,\n className,\n isVisible: isVisibleProp,\n onAfterClose,\n onClose,\n anchorOrigin: anchorOriginProp = defaultAnchorOrigin,\n transformOrigin: transformOriginProp = defaultTransformOrigin,\n dismissOnMouseLeave,\n hideCloseButton = false,\n showHeader,\n title,\n zIndex,\n containerRef,\n portalLocation = document.body,\n shadow = 'mid',\n fixed,\n takeWidthOfAnchor\n } = props\n const { spring, shadows } = useTheme()\n\n const isVisible = popupState !== 'closed'\n const previousIsVisible = usePrevious(isVisible)\n\n const handleClose = useCallback(() => {\n onClose?.()\n setTimeout(() => {\n if (onAfterClose) {\n onAfterClose()\n }\n }, closingAnimationDuration)\n }, [onClose, onAfterClose])\n\n const [anchorOrigin, transformOrigin] = [\n anchorOriginProp,\n transformOriginProp\n ]\n\n const popupRef: React.MutableRefObject<HTMLDivElement> = useClickOutside(\n handleClose,\n isVisible,\n checkIfClickInside,\n typeof ref === 'function' ? undefined : ref,\n anchorRef\n )\n\n const wrapperRef = useRef<HTMLDivElement>(null)\n const originalTopPosition = useRef<number>(0)\n const [computedTransformOrigin, setComputedTransformOrigin] =\n useState(anchorOrigin)\n\n const wrapperHeight = wrapperRef?.current?.offsetHeight ?? null\n const wrapperWidth = wrapperRef?.current?.offsetWidth ?? null\n const previousHeight = usePrevious(wrapperHeight)\n const previousWidth = usePrevious(wrapperWidth)\n const wrapperSizeChange =\n wrapperHeight !== previousHeight || wrapperWidth !== previousWidth\n\n // On visible, set the position\n useEffect(() => {\n if ((isVisible && !previousIsVisible) || wrapperSizeChange) {\n const [anchorRect, wrapperRect] = [anchorRef, wrapperRef].map((r) =>\n r?.current?.getBoundingClientRect()\n )\n if (!anchorRect || !wrapperRect) return\n\n // Add a small delay to ensure content is rendered\n requestAnimationFrame(() => {\n const {\n anchorOrigin: anchorOriginComputed,\n transformOrigin: transformOriginComputed\n } = getComputedOrigins(\n anchorOrigin,\n transformOrigin,\n anchorRect,\n wrapperRect,\n portalLocation,\n containerRef\n )\n setComputedTransformOrigin(transformOriginComputed)\n\n const anchorTranslation = getOriginTranslation(\n anchorOriginComputed,\n anchorRect\n )\n const wrapperTranslation = getOriginTranslation(\n transformOriginComputed,\n wrapperRect\n )\n\n const top = anchorRect.y + anchorTranslation.y - wrapperTranslation.y\n const left = anchorRect.x + anchorTranslation.x - wrapperTranslation.x\n\n // Ensure popup stays within viewport bounds\n const viewportHeight = window.innerHeight\n const viewportWidth = window.innerWidth\n const adjustedTop = Math.min(\n Math.max(0, top),\n viewportHeight - wrapperRect.height\n )\n const adjustedLeft = Math.min(\n Math.max(0, left),\n viewportWidth - wrapperRect.width\n )\n\n if (wrapperRef.current) {\n wrapperRef.current.style.top = `${adjustedTop}px`\n wrapperRef.current.style.left = `${adjustedLeft}px`\n }\n\n originalTopPosition.current = adjustedTop\n })\n }\n }, [\n isVisible,\n wrapperRef,\n anchorRef,\n anchorOrigin,\n transformOrigin,\n setComputedTransformOrigin,\n originalTopPosition,\n portalLocation,\n containerRef,\n previousIsVisible,\n previousHeight,\n wrapperSizeChange\n ])\n\n // Callback invoked on each scroll. Uses original top position to scroll with content.\n // Takes scrollParent to get the current scroll position as well as the intitial scroll position\n // when the popup became visible.\n const watchScroll = useCallback(\n (scrollParent: Element, initialScrollPosition: number) => {\n const scrollTop = scrollParent.scrollTop\n if (wrapperRef.current) {\n wrapperRef.current.style.top = `${\n originalTopPosition.current - scrollTop + initialScrollPosition\n }px`\n }\n },\n [wrapperRef, originalTopPosition]\n )\n\n // Set up scroll listeners\n useEffect(() => {\n if (isVisible && anchorRef.current) {\n const scrollParent = getScrollParent(anchorRef.current)\n if (!scrollParent) return\n\n const initialScrollPosition = scrollParent.scrollTop\n const listener = () => watchScroll(scrollParent, initialScrollPosition)\n scrollParent.addEventListener('scroll', listener)\n return () => {\n scrollParent.removeEventListener('scroll', listener)\n }\n }\n\n return () => {}\n }, [isVisible, watchScroll, anchorRef])\n\n // Set up key listeners\n useEffect(() => {\n if (isVisible) {\n const escapeListener = (e: KeyboardEvent) => {\n if (e.code === 'Escape') {\n handleClose()\n }\n }\n\n window.addEventListener('keydown', escapeListener)\n\n return () => window.removeEventListener('keydown', escapeListener)\n }\n return () => {}\n }, [isVisible, handleClose])\n\n useEffect(() => {\n if (popupState === 'closed' && isVisibleProp) {\n } else if (popupState === 'open' && !isVisibleProp) {\n anchorRef.current?.focus()\n }\n }, [anchorRef, isVisibleProp, popupState])\n\n const transitions = useTransition(isVisibleProp, null, {\n from: {\n transform: `scale(0)`,\n opacity: 0\n },\n enter: {\n transform: `scale(1)`,\n opacity: 1\n },\n leave: {\n transform: `scale(0)`,\n opacity: 0\n },\n config: spring.standard,\n unique: true,\n onDestroyed: (isDestroyed) => {\n setPopupState(isDestroyed ? 'closed' : 'open')\n }\n })\n\n const rootStyle = {\n zIndex,\n position: fixed ? ('fixed' as const) : undefined,\n width: takeWidthOfAnchor ? anchorRef.current?.clientWidth : undefined\n }\n\n const handleMouseLeave = useCallback(() => {\n if (dismissOnMouseLeave) {\n onClose?.()\n }\n }, [dismissOnMouseLeave, onClose])\n\n return (\n <>\n {/* Portal the popup out of the dom structure so that it has a separate stacking context */}\n {popupState !== 'closed'\n ? ReactDOM.createPortal(\n <div\n ref={wrapperRef}\n className={styles.root}\n style={rootStyle}\n onMouseLeave={handleMouseLeave}\n >\n {transitions.map(({ item, key, props }) =>\n item ? (\n <animated.div\n className={cn(styles.popup, className)}\n css={{ boxShadow: shadows[shadow] }}\n ref={popupRef}\n key={key}\n style={{\n ...props,\n transformOrigin: `${computedTransformOrigin.horizontal} ${computedTransformOrigin.vertical}`\n }}\n >\n {showHeader && (\n <div\n className={cn(styles.header, {\n [styles.noAfter]: hideCloseButton\n })}\n >\n {hideCloseButton ? null : (\n <PlainButton\n variant='subdued'\n aria-label={messages.close}\n onClick={handleClose}\n iconLeft={IconClose}\n />\n )}\n <div className={styles.title}>{title}</div>\n </div>\n )}\n {children}\n </animated.div>\n ) : null\n )}\n </div>,\n portalLocation\n )\n : null}\n </>\n )\n})\n"],"names":["_jsx","_Fragment","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAM,QAAQ,GAAG;AACf,IAAA,KAAK,EAAE,aAAa;CACrB,CAAA;AAED;;;AAGG;AACH,IAAM,uBAAuB,GAAG,EAAE,CAAA;AAElC;;;;;;;;AAQG;AACH,IAAM,kBAAkB,GAAG,UACzB,YAAoB,EACpB,eAAuB,EACvB,UAAmB,EACnB,WAAoB,EACpB,MAAmB,EACnB,YAA2D,EAAA;AAE3D,IAAA,IAAI,CAAC,UAAU,IAAI,CAAC,WAAW;AAAE,QAAA,OAAO,EAAE,YAAY,EAAA,YAAA,EAAE,eAAe,EAAA,eAAA,EAAE,CAAA;IAEzE,IAAI,cAAc,EAAE,eAAe,CAAA;AACnC,IAAA,IAAI,YAAY,IAAI,YAAY,CAAC,OAAO,EAAE;QACxC,IAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAA;QAClE,cAAc;YACZ,aAAa,CAAC,KAAK,GAAG,aAAa,CAAC,CAAC,GAAG,uBAAuB,CAAA;QACjE,eAAe;YACb,aAAa,CAAC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,SAAS,CAAC,EACtC,GAAG,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,EACnC,GAAG,EAAE,QAAQ,EAEb,KAAK,EACA,QAAA,CAAA,QAAA,CAAA,EAAA,EAAA,KAAK,CACR,EAAA,EAAA,eAAe,EAAE,EAAA,CAAA,MAAA,CAAG,uBAAuB,CAAC,UAAU,EAAA,GAAA,CAAA,CAAA,MAAA,CAAI,uBAAuB,CAAC,QAAQ,CAAE,EAG7F,CAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA,UAAU,KACTA,IACE,CAAA,KAAA,EAAA,QAAA,CAAA,EAAA,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,GAAA,EAAA,GAAA,EAAA;AACzB,oCAAA,EAAA,CAAC,MAAM,CAAC,OAAO,CAAA,GAAG,eAAe;wCACjC,EAED,EAAA,EAAA,QAAA,EAAA,CAAA,eAAe,GAAG,IAAI,IACrBF,GAAC,CAAA,WAAW,IACV,OAAO,EAAC,SAAS,EAAA,YAAA,EACL,QAAQ,CAAC,KAAK,EAC1B,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,SAAS,EAAA,CACnB,CACH,EACDA,GAAA,CAAA,KAAA,EAAA,QAAA,CAAA,EAAK,SAAS,EAAE,MAAM,CAAC,KAAK,EAAG,EAAA,EAAA,QAAA,EAAA,KAAK,IAAO,CACvC,EAAA,CAAA,CAAA,CACP,EACA,QAAQ,CAvBJ,EAAA,CAAA,EAAA,GAAG,CAwBK,IACb,IAAI,CAAA;AA9BR,iBA8BQ,CACT,EAAA,CAAA,CACG,EACN,cAAc,CACf;AACH,cAAE,IAAI,EACP,CAAA,EACJ;AACH,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Popup.js","sources":["../../../src/components/popup/Popup.tsx"],"sourcesContent":["import {\n forwardRef,\n MutableRefObject,\n Ref,\n SetStateAction,\n useCallback,\n useEffect,\n useRef,\n useState\n} from 'react'\n\nimport { useTheme } from '@emotion/react'\nimport cn from 'classnames'\nimport ReactDOM from 'react-dom'\nimport { useTransition, animated } from 'react-spring'\nimport { usePrevious } from 'react-use'\n\nimport { PlainButton } from '~harmony/components/button/PlainButton/PlainButton'\nimport { IconClose } from '~harmony/icons'\nimport { ModalState } from '~harmony/utils/modalState'\n\nimport { useClickOutside } from '../../hooks/useClickOutside'\nimport { getScrollParent } from '../../utils/getScrollParent'\n\nimport styles from './Popup.module.css'\nimport type { PopupProps, Origin } from './types'\n\nconst messages = {\n close: 'close popup'\n}\n\n/**\n * Number of pixels between the edge of the container and the popup\n * before the popup needs to reposition itself to be in view.\n */\nconst CONTAINER_INSET_PADDING = 16\n\n/**\n * Figures out whether the specified position would overflow the window\n * and picks a better position accordingly\n * @param {Origin} anchorOrigin where the origin is on the trigger\n * @param {Origin} transformOrigin where the origin is on the popup\n * @param {DOMRect} anchorRect the position and size of the trigger\n * @param {DOMRect} wrapperRect the position and size of the popup\n * @return {{ anchorOrigin: Origin, transformOrigin: Origin }} the new origin after accounting for overflow\n */\nconst getComputedOrigins = (\n anchorOrigin: Origin,\n transformOrigin: Origin,\n anchorRect: DOMRect,\n wrapperRect: DOMRect,\n portal: HTMLElement,\n containerRef?: MutableRefObject<HTMLDivElement | undefined>\n) => {\n if (!anchorRect || !wrapperRect) return { anchorOrigin, transformOrigin }\n\n let containerWidth, containerHeight\n if (containerRef && containerRef.current) {\n const containerRect = containerRef.current.getBoundingClientRect()\n containerWidth =\n containerRect.width + containerRect.x - CONTAINER_INSET_PADDING\n containerHeight =\n containerRect.height + containerRect.y - CONTAINER_INSET_PADDING\n } else {\n const portalRect = portal.getBoundingClientRect()\n containerWidth = portalRect.width + portalRect.x - CONTAINER_INSET_PADDING\n containerHeight = portalRect.height + portalRect.y - CONTAINER_INSET_PADDING\n }\n\n // Get new wrapper position\n const anchorTranslation = getOriginTranslation(anchorOrigin, anchorRect)\n const wrapperTranslation = getOriginTranslation(transformOrigin, wrapperRect)\n const wrapperX = anchorRect.x + anchorTranslation.x - wrapperTranslation.x\n const wrapperY = anchorRect.y + anchorTranslation.y - wrapperTranslation.y\n\n // Check bounds of the wrapper in new position are inside container\n const overflowRight = wrapperX + wrapperRect.width > containerWidth\n const overflowLeft = wrapperX < 0\n const overflowBottom = wrapperY + wrapperRect.height > containerHeight\n const overflowTop = wrapperY < 0\n\n // For all overflows, flip the position\n if (overflowRight) {\n anchorOrigin.horizontal = 'left'\n transformOrigin.horizontal = 'right'\n }\n if (overflowLeft) {\n anchorOrigin.horizontal = 'right'\n transformOrigin.horizontal = 'left'\n }\n if (overflowTop) {\n anchorOrigin.vertical = 'bottom'\n transformOrigin.vertical = 'top'\n }\n if (overflowBottom) {\n anchorOrigin.vertical = 'top'\n transformOrigin.vertical = 'bottom'\n }\n return { anchorOrigin, transformOrigin }\n}\n\n/**\n * Gets the x, y offsets for the given origin using the dimensions\n * @param origin the relative origin\n * @param dimensions the dimensions to use with the relative origin\n * @returns the x and y coordinates of the new origin relative to the old one\n */\nconst getOriginTranslation = (\n origin: Origin,\n dimensions: { width: number; height: number }\n) => {\n let x = 0\n let y = 0\n const { width, height } = dimensions\n if (origin.horizontal === 'center') {\n x += width / 2\n } else if (origin.horizontal === 'right') {\n x += width\n }\n if (origin.vertical === 'center') {\n y += height / 2\n } else if (origin.vertical === 'bottom') {\n y += height\n }\n return { x, y }\n}\n\nconst defaultAnchorOrigin: Origin = {\n horizontal: 'center',\n vertical: 'bottom'\n}\n\nconst defaultTransformOrigin: Origin = {\n horizontal: 'center',\n vertical: 'top'\n}\n\nconst closingAnimationDuration = 90\n\n/**\n * A popup is an in-place container that shows on top of the UI. A popup does\n * not impact the rest of the UI (e.g. dimming background or shifting elements).\n * It differs from modals, which do take over the whole UI and are usually\n * center-screened.\n */\nexport const Popup = forwardRef<HTMLDivElement, PopupProps>(function Popup(\n props: PopupProps,\n ref: Ref<HTMLDivElement>\n) {\n const { isVisible: isVisibleProp } = props\n const [popupState, setPopupState] = useState<ModalState>('closed')\n\n const isVisible = popupState !== 'closed'\n useEffect(() => {\n if (popupState === 'closed' && isVisibleProp) {\n setPopupState('opening')\n } else if (popupState === 'open' && !isVisibleProp) {\n setPopupState('closing')\n }\n }, [isVisibleProp, popupState])\n\n return isVisible ? (\n <PopupInternal\n ref={ref}\n popupState={popupState}\n setPopupState={setPopupState}\n {...props}\n />\n ) : null\n})\n\nexport const PopupInternal = forwardRef<\n HTMLDivElement,\n PopupProps & {\n popupState: ModalState\n setPopupState: (value: SetStateAction<ModalState>) => void\n }\n>(function Popup(\n props: PopupProps & {\n popupState: ModalState\n setPopupState: (value: SetStateAction<ModalState>) => void\n },\n ref: Ref<HTMLDivElement>\n) {\n const {\n popupState,\n setPopupState,\n anchorRef,\n checkIfClickInside,\n children,\n className,\n isVisible: isVisibleProp,\n onAfterClose,\n onClose,\n anchorOrigin: anchorOriginProp = defaultAnchorOrigin,\n transformOrigin: transformOriginProp = defaultTransformOrigin,\n dismissOnMouseLeave,\n hideCloseButton = false,\n showHeader,\n title,\n zIndex,\n containerRef,\n portalLocation = document.body,\n shadow = 'mid',\n fixed,\n takeWidthOfAnchor\n } = props\n const { spring, shadows } = useTheme()\n\n const isVisible = popupState !== 'closed'\n const previousIsVisible = usePrevious(isVisible)\n\n const handleClose = useCallback(() => {\n onClose?.()\n setTimeout(() => {\n if (onAfterClose) {\n onAfterClose()\n }\n }, closingAnimationDuration)\n }, [onClose, onAfterClose])\n\n const [anchorOrigin, transformOrigin] = [\n anchorOriginProp,\n transformOriginProp\n ]\n\n const popupRef: React.MutableRefObject<HTMLDivElement> = useClickOutside(\n handleClose,\n isVisible,\n checkIfClickInside,\n typeof ref === 'function' ? undefined : ref,\n anchorRef\n )\n\n const wrapperRef = useRef<HTMLDivElement>(null)\n const originalTopPosition = useRef<number>(0)\n const [computedTransformOrigin, setComputedTransformOrigin] =\n useState(anchorOrigin)\n\n const wrapperHeight = wrapperRef?.current?.offsetHeight ?? null\n const wrapperWidth = wrapperRef?.current?.offsetWidth ?? null\n const previousHeight = usePrevious(wrapperHeight)\n const previousWidth = usePrevious(wrapperWidth)\n const wrapperSizeChange =\n wrapperHeight !== previousHeight || wrapperWidth !== previousWidth\n\n // On visible, set the position\n useEffect(() => {\n if ((isVisible && !previousIsVisible) || wrapperSizeChange) {\n const [anchorRect, wrapperRect] = [anchorRef, wrapperRef].map((r) =>\n r?.current?.getBoundingClientRect()\n )\n if (!anchorRect || !wrapperRect) return\n\n // Add a small delay to ensure content is rendered\n requestAnimationFrame(() => {\n const {\n anchorOrigin: anchorOriginComputed,\n transformOrigin: transformOriginComputed\n } = getComputedOrigins(\n anchorOrigin,\n transformOrigin,\n anchorRect,\n wrapperRect,\n portalLocation,\n containerRef\n )\n setComputedTransformOrigin(transformOriginComputed)\n\n const anchorTranslation = getOriginTranslation(\n anchorOriginComputed,\n anchorRect\n )\n const wrapperTranslation = getOriginTranslation(\n transformOriginComputed,\n wrapperRect\n )\n\n const top = anchorRect.y + anchorTranslation.y - wrapperTranslation.y\n const left = anchorRect.x + anchorTranslation.x - wrapperTranslation.x\n\n // Ensure popup stays within viewport bounds\n const viewportHeight = window.innerHeight\n const viewportWidth = window.innerWidth\n const adjustedTop = Math.min(\n Math.max(0, top),\n viewportHeight - wrapperRect.height\n )\n const adjustedLeft = Math.min(\n Math.max(0, left),\n viewportWidth - wrapperRect.width\n )\n\n if (wrapperRef.current) {\n wrapperRef.current.style.top = `${adjustedTop}px`\n wrapperRef.current.style.left = `${adjustedLeft}px`\n }\n\n originalTopPosition.current = adjustedTop\n })\n }\n }, [\n isVisible,\n wrapperRef,\n anchorRef,\n anchorOrigin,\n transformOrigin,\n setComputedTransformOrigin,\n originalTopPosition,\n portalLocation,\n containerRef,\n previousIsVisible,\n previousHeight,\n wrapperSizeChange\n ])\n\n // Callback invoked on each scroll. Uses original top position to scroll with content.\n // Takes scrollParent to get the current scroll position as well as the intitial scroll position\n // when the popup became visible.\n const watchScroll = useCallback(\n (scrollParent: Element, initialScrollPosition: number) => {\n const scrollTop = scrollParent.scrollTop\n if (wrapperRef.current) {\n wrapperRef.current.style.top = `${\n originalTopPosition.current - scrollTop + initialScrollPosition\n }px`\n }\n },\n [wrapperRef, originalTopPosition]\n )\n\n // Set up scroll listeners\n useEffect(() => {\n if (isVisible && anchorRef.current) {\n const scrollParent = getScrollParent(anchorRef.current)\n if (!scrollParent) return\n\n const initialScrollPosition = scrollParent.scrollTop\n const listener = () => watchScroll(scrollParent, initialScrollPosition)\n scrollParent.addEventListener('scroll', listener)\n return () => {\n scrollParent.removeEventListener('scroll', listener)\n }\n }\n\n return () => {}\n }, [isVisible, watchScroll, anchorRef])\n\n // Set up key listeners\n useEffect(() => {\n if (isVisible) {\n const escapeListener = (e: KeyboardEvent) => {\n if (e.code === 'Escape') {\n e.stopPropagation()\n handleClose()\n }\n }\n\n document.addEventListener('keydown', escapeListener, true)\n\n return () => document.removeEventListener('keydown', escapeListener, true)\n }\n return () => {}\n }, [isVisible, handleClose])\n\n useEffect(() => {\n if (popupState === 'closed' && isVisibleProp) {\n } else if (popupState === 'open' && !isVisibleProp) {\n anchorRef.current?.focus()\n }\n }, [anchorRef, isVisibleProp, popupState])\n\n const transitions = useTransition(isVisibleProp, null, {\n from: {\n transform: `scale(0)`,\n opacity: 0\n },\n enter: {\n transform: `scale(1)`,\n opacity: 1\n },\n leave: {\n transform: `scale(0)`,\n opacity: 0\n },\n config: spring.standard,\n unique: true,\n onDestroyed: (isDestroyed) => {\n setPopupState(isDestroyed ? 'closed' : 'open')\n }\n })\n\n const rootStyle = {\n zIndex,\n position: fixed ? ('fixed' as const) : undefined,\n width: takeWidthOfAnchor ? anchorRef.current?.clientWidth : undefined\n }\n\n const handleMouseLeave = useCallback(() => {\n if (dismissOnMouseLeave) {\n onClose?.()\n }\n }, [dismissOnMouseLeave, onClose])\n\n return (\n <>\n {/* Portal the popup out of the dom structure so that it has a separate stacking context */}\n {popupState !== 'closed'\n ? ReactDOM.createPortal(\n <div\n ref={wrapperRef}\n className={styles.root}\n style={rootStyle}\n onMouseLeave={handleMouseLeave}\n >\n {transitions.map(({ item, key, props }) =>\n item ? (\n <animated.div\n className={cn(styles.popup, className)}\n css={{ boxShadow: shadows[shadow] }}\n ref={popupRef}\n key={key}\n style={{\n ...props,\n transformOrigin: `${computedTransformOrigin.horizontal} ${computedTransformOrigin.vertical}`\n }}\n >\n {showHeader && (\n <div\n className={cn(styles.header, {\n [styles.noAfter]: hideCloseButton\n })}\n >\n {hideCloseButton ? null : (\n <PlainButton\n variant='subdued'\n aria-label={messages.close}\n onClick={handleClose}\n iconLeft={IconClose}\n />\n )}\n <div className={styles.title}>{title}</div>\n </div>\n )}\n {children}\n </animated.div>\n ) : null\n )}\n </div>,\n portalLocation\n )\n : null}\n </>\n )\n})\n"],"names":["_jsx","_Fragment","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAM,QAAQ,GAAG;AACf,IAAA,KAAK,EAAE,aAAa;CACrB,CAAA;AAED;;;AAGG;AACH,IAAM,uBAAuB,GAAG,EAAE,CAAA;AAElC;;;;;;;;AAQG;AACH,IAAM,kBAAkB,GAAG,UACzB,YAAoB,EACpB,eAAuB,EACvB,UAAmB,EACnB,WAAoB,EACpB,MAAmB,EACnB,YAA2D,EAAA;AAE3D,IAAA,IAAI,CAAC,UAAU,IAAI,CAAC,WAAW;AAAE,QAAA,OAAO,EAAE,YAAY,EAAA,YAAA,EAAE,eAAe,EAAA,eAAA,EAAE,CAAA;IAEzE,IAAI,cAAc,EAAE,eAAe,CAAA;AACnC,IAAA,IAAI,YAAY,IAAI,YAAY,CAAC,OAAO,EAAE;QACxC,IAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAA;QAClE,cAAc;YACZ,aAAa,CAAC,KAAK,GAAG,aAAa,CAAC,CAAC,GAAG,uBAAuB,CAAA;QACjE,eAAe;YACb,aAAa,CAAC,MAAM,GAAG,aAAa,C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eave?: boolean | undefined;
|
|
11
11
|
overrideIconColor?: boolean | undefined;
|
|
12
|
-
renderTrigger: (anchorRef: import("react").MutableRefObject<any>, triggerPopup: (onMouseEnter?: boolean | undefined) => void, triggerProps:
|
|
12
|
+
renderTrigger: (anchorRef: import("react").MutableRefObject<any>, triggerPopup: (onMouseEnter?: boolean | undefined) => void, triggerProps: Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "id" | "aria-controls" | "aria-expanded" | "aria-haspopup">) => import("react").ReactNode;
|
|
13
13
|
id?: string | undefined;
|
|
14
14
|
} & {
|
|
15
15
|
title?: string | undefined;
|
|
@@ -52,14 +52,14 @@ var PopupMenu = forwardRef(function PopupMenu(props, ref) {
|
|
|
52
52
|
color: color.text.white,
|
|
53
53
|
background: color.secondary.s300,
|
|
54
54
|
path: {
|
|
55
|
-
fill: color.
|
|
55
|
+
fill: color.icon.white
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
'&.destructive': {
|
|
59
59
|
color: color.status.error,
|
|
60
60
|
'&:hover': {
|
|
61
61
|
background: color.status.error,
|
|
62
|
-
color: color.
|
|
62
|
+
color: color.icon.white
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
};
|
|
@@ -73,7 +73,7 @@ var PopupMenu = forwardRef(function PopupMenu(props, ref) {
|
|
|
73
73
|
return clickInsideRef.current.contains(target);
|
|
74
74
|
}
|
|
75
75
|
return false;
|
|
76
|
-
}, isVisible: isPopupVisible, showHeader: Boolean(title), hideCloseButton: hideCloseButton, onClose: handlePopupClose, ref: ref, title: title
|
|
76
|
+
}, isVisible: isPopupVisible, showHeader: Boolean(title), hideCloseButton: hideCloseButton, onClose: handlePopupClose, ref: ref, title: title !== null && title !== void 0 ? title : '', zIndex: zIndex, containerRef: containerRef, transformOrigin: transformOrigin, anchorOrigin: anchorOrigin, className: className, css: popupCss, dismissOnMouseLeave: dismissOnMouseLeave, fixed: fixed }, { children: renderMenu ? (renderMenu(items)) : (jsx(Box, __assign({ as: 'ul', role: 'menu', "aria-labelledby": triggerId, tabIndex: -1, css: { all: 'unset' } }, { children: items.map(function (item, i) { return (jsxs(Flex, __assign({ as: 'li', role: 'menuitem', className: cn(item.className, {
|
|
77
77
|
destructive: item.destructive
|
|
78
78
|
}), onClick: handleMenuItemClick(item), tabIndex: i === 0 ? 0 : -1, css: menuItemCss, alignItems: 'center', gap: 's', p: 's', ph: 'm', borderRadius: 's' }, { children: [item.icon ? (jsx(Flex, __assign({ css: iconCss, className: item.iconClassName, alignItems: 'center', justifyContent: 'center', w: 'unit5', h: 'unit5' }, { children: item.icon }))) : null, item.text] }), typeof item.text === 'string' ? item.text : i)); }) }))) }))] })));
|
|
79
79
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupMenu.js","sources":["../../../src/components/popup-menu/PopupMenu.tsx"],"sourcesContent":["import { forwardRef, useCallback, useRef, useState, MouseEvent } from 'react'\n\nimport { useTheme } from '@emotion/react'\nimport cn from 'classnames'\n\nimport { Box } from '../layout/Box'\nimport { Flex } from '../layout/Flex'\nimport { Popup } from '../popup'\n\nimport { PopupMenuItem, PopupMenuProps } from './types'\n\n/**\n * A menu that shows on top of the UI. Ideal for overflow menus, dropdowns, etc\n */\nexport const PopupMenu = forwardRef<HTMLDivElement, PopupMenuProps>(\n function PopupMenu(props, ref) {\n const {\n items,\n onClose,\n renderMenu,\n renderTrigger,\n dismissOnMouseLeave,\n hideCloseButton,\n title,\n className,\n zIndex,\n containerRef,\n anchorOrigin,\n transformOrigin,\n id,\n fixed,\n overrideIconColor\n } = props\n\n const { spacing, typography, color } = useTheme()\n const clickInsideRef = useRef<any>()\n const anchorRef = useRef<HTMLElement>(null)\n\n const [isPopupVisible, setIsPopupVisible] = useState<boolean>(false)\n\n const triggerPopup = useCallback(\n (onMouseEnter?: boolean) => {\n if (onMouseEnter && isPopupVisible) return\n setIsPopupVisible(!isPopupVisible)\n },\n [isPopupVisible, setIsPopupVisible]\n )\n\n const handlePopupClose = useCallback(() => {\n setIsPopupVisible(false)\n if (onClose) onClose()\n }, [setIsPopupVisible, onClose])\n\n const handleMenuItemClick = useCallback(\n (item: PopupMenuItem) => (e: MouseEvent<HTMLElement>) => {\n e.stopPropagation()\n item.onClick(e)\n handlePopupClose()\n },\n [handlePopupClose]\n )\n\n const triggerId = id ? `${id}-trigger` : undefined\n\n const triggerProps = {\n 'aria-controls': isPopupVisible ? id : undefined,\n 'aria-haspopup': true,\n 'aria-expanded': isPopupVisible ? ('true' as const) : undefined,\n id: triggerId\n }\n\n const popupCss = {\n margin: spacing.s,\n padding: spacing.s,\n border: `1px solid ${color.border.strong}`\n }\n\n const menuItemCss = {\n fontSize: typography.size.m,\n fontWeight: typography.weight.demiBold,\n color: color.text.default,\n cursor: 'pointer',\n '&:hover': {\n color: color.text.white,\n background: color.secondary.s300,\n path: {\n fill: color.
|
|
1
|
+
{"version":3,"file":"PopupMenu.js","sources":["../../../src/components/popup-menu/PopupMenu.tsx"],"sourcesContent":["import { forwardRef, useCallback, useRef, useState, MouseEvent } from 'react'\n\nimport { useTheme } from '@emotion/react'\nimport cn from 'classnames'\n\nimport { Box } from '../layout/Box'\nimport { Flex } from '../layout/Flex'\nimport { Popup } from '../popup'\n\nimport { PopupMenuItem, PopupMenuProps } from './types'\n\n/**\n * A menu that shows on top of the UI. Ideal for overflow menus, dropdowns, etc\n */\nexport const PopupMenu = forwardRef<HTMLDivElement, PopupMenuProps>(\n function PopupMenu(props, ref) {\n const {\n items,\n onClose,\n renderMenu,\n renderTrigger,\n dismissOnMouseLeave,\n hideCloseButton,\n title,\n className,\n zIndex,\n containerRef,\n anchorOrigin,\n transformOrigin,\n id,\n fixed,\n overrideIconColor\n } = props\n\n const { spacing, typography, color } = useTheme()\n const clickInsideRef = useRef<any>()\n const anchorRef = useRef<HTMLElement>(null)\n\n const [isPopupVisible, setIsPopupVisible] = useState<boolean>(false)\n\n const triggerPopup = useCallback(\n (onMouseEnter?: boolean) => {\n if (onMouseEnter && isPopupVisible) return\n setIsPopupVisible(!isPopupVisible)\n },\n [isPopupVisible, setIsPopupVisible]\n )\n\n const handlePopupClose = useCallback(() => {\n setIsPopupVisible(false)\n if (onClose) onClose()\n }, [setIsPopupVisible, onClose])\n\n const handleMenuItemClick = useCallback(\n (item: PopupMenuItem) => (e: MouseEvent<HTMLElement>) => {\n e.stopPropagation()\n item.onClick(e)\n handlePopupClose()\n },\n [handlePopupClose]\n )\n\n const triggerId = id ? `${id}-trigger` : undefined\n\n const triggerProps = {\n 'aria-controls': isPopupVisible ? id : undefined,\n 'aria-haspopup': true,\n 'aria-expanded': isPopupVisible ? ('true' as const) : undefined,\n id: triggerId\n }\n\n const popupCss = {\n margin: spacing.s,\n padding: spacing.s,\n border: `1px solid ${color.border.strong}`\n }\n\n const menuItemCss = {\n fontSize: typography.size.m,\n fontWeight: typography.weight.demiBold,\n color: color.text.default,\n cursor: 'pointer',\n '&:hover': {\n color: color.text.white,\n background: color.secondary.s300,\n path: {\n fill: color.icon.white\n }\n },\n '&.destructive': {\n color: color.status.error,\n '&:hover': {\n background: color.status.error,\n color: color.icon.white\n }\n }\n }\n\n const iconCss = {\n path: {\n fill: overrideIconColor ? undefined : color.text.default\n }\n }\n\n return (\n <Box ref={clickInsideRef}>\n {renderTrigger(anchorRef, triggerPopup, triggerProps)}\n <Popup\n anchorRef={anchorRef}\n checkIfClickInside={(target: EventTarget) => {\n if (target instanceof Element && clickInsideRef) {\n return clickInsideRef.current.contains(target)\n }\n return false\n }}\n isVisible={isPopupVisible}\n showHeader={Boolean(title)}\n hideCloseButton={hideCloseButton}\n onClose={handlePopupClose}\n ref={ref}\n title={title ?? ''}\n zIndex={zIndex}\n containerRef={containerRef}\n transformOrigin={transformOrigin}\n anchorOrigin={anchorOrigin}\n className={className}\n css={popupCss}\n dismissOnMouseLeave={dismissOnMouseLeave}\n fixed={fixed}\n >\n {renderMenu ? (\n renderMenu(items)\n ) : (\n <Box\n as='ul'\n role='menu'\n aria-labelledby={triggerId}\n tabIndex={-1}\n css={{ all: 'unset' }}\n >\n {items.map((item, i) => (\n <Flex\n as='li'\n key={typeof item.text === 'string' ? item.text : i}\n role='menuitem'\n className={cn(item.className, {\n destructive: item.destructive\n })}\n onClick={handleMenuItemClick(item)}\n tabIndex={i === 0 ? 0 : -1}\n css={menuItemCss}\n alignItems='center'\n gap='s'\n p='s'\n ph='m'\n borderRadius='s'\n >\n {item.icon ? (\n <Flex\n css={iconCss}\n className={item.iconClassName}\n alignItems='center'\n justifyContent='center'\n w='unit5'\n h='unit5'\n >\n {item.icon}\n </Flex>\n ) : null}\n {item.text}\n </Flex>\n ))}\n </Box>\n )}\n </Popup>\n </Box>\n )\n }\n)\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;AAWA;;AAEG;AACU,IAAA,SAAS,GAAG,UAAU,CACjC,SAAS,SAAS,CAAC,KAAK,EAAE,GAAG,EAAA;AAEzB,IAAA,IAAA,KAAK,GAeH,KAAK,CAAA,KAfF,EACL,OAAO,GAcL,KAAK,CAAA,OAdA,EACP,UAAU,GAaR,KAAK,CAAA,UAbG,EACV,aAAa,GAYX,KAAK,CAAA,aAZM,EACb,mBAAmB,GAWjB,KAAK,CAAA,mBAXY,EACnB,eAAe,GAUb,KAAK,CAAA,eAVQ,EACf,KAAK,GASH,KAAK,CAAA,KATF,EACL,SAAS,GAQP,KAAK,CAAA,SARE,EACT,MAAM,GAOJ,KAAK,OAPD,EACN,YAAY,GAMV,KAAK,aANK,EACZ,YAAY,GAKV,KAAK,aALK,EACZ,eAAe,GAIb,KAAK,gBAJQ,EACf,EAAE,GAGA,KAAK,GAHL,EACF,KAAK,GAEH,KAAK,MAFF,EACL,iBAAiB,GACf,KAAK,kBADU,CACV;AAEH,IAAA,IAAA,EAAiC,GAAA,QAAQ,EAAE,EAAzC,OAAO,GAAA,EAAA,CAAA,OAAA,EAAE,UAAU,GAAA,EAAA,CAAA,UAAA,EAAE,KAAK,GAA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,WAAW;yBAC9B,CAAC,EACF,OAAO,EAAE,mBAAmB,CAAC,IAAI,CAAC,EAClC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAC1B,GAAG,EAAE,WAAW,EAChB,UAAU,EAAC,QAAQ,EACnB,GAAG,EAAC,GAAG,EACP,CAAC,EAAC,GAAG,EACL,EAAE,EAAC,GAAG,EACN,YAAY,EAAC,GAAG,EAAA,EAAA,EAAA,QAAA,EAAA,CAEf,IAAI,CAAC,IAAI,IACRC,GAAA,CAAC,IAAI,EAAA,QAAA,CAAA,EACH,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,IAAI,CAAC,aAAa,EAC7B,UAAU,EAAC,QAAQ,EACnB,cAAc,EAAC,QAAQ,EACvB,CAAC,EAAC,OAAO,EACT,CAAC,EAAC,OAAO,EAAA,EAAA,EAAA,QAAA,EAER,IAAI,CAAC,IAAI,EAAA,CAAA,CACL,IACL,IAAI,EACP,IAAI,CAAC,IAAI,CAAA,EAAA,CAAA,EA1BL,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,CA2B7C,EA9Be,EA+BvB,CAAC,EAAA,CAAA,CACE,CACP,EAAA,CAAA,CACK,CACJ,EAAA,CAAA,CAAA,EACP;AACH,CAAC;;;;"}
|
|
@@ -27,7 +27,7 @@ export type PopupMenuProps = {
|
|
|
27
27
|
* - An anchorRef for positioning the menu
|
|
28
28
|
* - A triggerPopup function that will show/hide the popup
|
|
29
29
|
*/
|
|
30
|
-
renderTrigger: (anchorRef: React.MutableRefObject<any>, triggerPopup: (onMouseEnter?: boolean) => void, triggerProps:
|
|
30
|
+
renderTrigger: (anchorRef: React.MutableRefObject<any>, triggerPopup: (onMouseEnter?: boolean) => void, triggerProps: Pick<ComponentProps<'button'>, 'aria-controls' | 'aria-haspopup' | 'aria-expanded' | 'id'>) => React.ReactNode;
|
|
31
31
|
/**
|
|
32
32
|
* Providing an id is necessary for proper a11y
|
|
33
33
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/popup-menu/types.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC,KAAK,oBAAoB,GAAG,IAAI,CAC9B,UAAU,EACR,OAAO,GACP,WAAW,GACX,iBAAiB,GACjB,QAAQ,GACR,cAAc,GACd,iBAAiB,GACjB,cAAc,GACd,OAAO,CACV,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,KAAK,EAAE,aAAa,EAAE,CAAA;IAEtB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IAEpB;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,aAAa,EAAE,KAAK,GAAG,CAAC,OAAO,CAAA;IAExD;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAE7B;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAE3B;;;;OAIG;IACH,aAAa,EAAE,CACb,SAAS,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,EACtC,YAAY,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,KAAK,IAAI,EAC9C,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/popup-menu/types.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC,KAAK,oBAAoB,GAAG,IAAI,CAC9B,UAAU,EACR,OAAO,GACP,WAAW,GACX,iBAAiB,GACjB,QAAQ,GACR,cAAc,GACd,iBAAiB,GACjB,cAAc,GACd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
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../../src/components/radio/Radio.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAA;AAMhD,MAAM,MAAM,UAAU,GAAG,wBAAwB,CAAC,OAAO,CAAC,GAAG;IAC3D,cAAc,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../../src/components/radio/Radio.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAA;AAMhD,MAAM,MAAM,UAAU,GAAG,wBAAwB,CAAC,OAAO,CAAC,GAAG;IAC3D,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,UAAW,UAAU,qDAoEtC,CAAA"}
|
|
@@ -8,7 +8,7 @@ import { useRadioGroup } from '../radio-group/useRadioGroup.js';
|
|
|
8
8
|
* TODO: Add label + icon support
|
|
9
9
|
*/
|
|
10
10
|
var Radio = function (props) {
|
|
11
|
-
var className = props.className, inputClassName = props.inputClassName, onChangeProp = props.onChange, nameProp = props.name, checkedProp = props.checked, disabled = props.disabled, other = __rest(props, ["className", "inputClassName", "onChange", "name", "checked", "disabled"]);
|
|
11
|
+
var className = props.className, inputClassName = props.inputClassName, onChangeProp = props.onChange, nameProp = props.name, checkedProp = props.checked, disabled = props.disabled, error = props.error, other = __rest(props, ["className", "inputClassName", "onChange", "name", "checked", "disabled", "error"]);
|
|
12
12
|
var _a = useTheme(), spacing = _a.spacing, color = _a.color;
|
|
13
13
|
var _b = useRadioGroup({
|
|
14
14
|
name: nameProp,
|
|
@@ -20,11 +20,13 @@ var Radio = function (props) {
|
|
|
20
20
|
position: 'relative',
|
|
21
21
|
height: spacing.unit6,
|
|
22
22
|
width: spacing.unit6,
|
|
23
|
-
'::before': __assign(__assign({ position: 'absolute', width: spacing.unit6, height: spacing.unit6, borderRadius: '50%', content: "' '", background: color.neutral.n200, boxShadow: 'inset 2px 2px 2px rgba(0, 0, 0, 0.1)', boxSizing: 'border-box' }, (checked && {
|
|
23
|
+
'::before': __assign(__assign(__assign({ position: 'absolute', width: spacing.unit6, height: spacing.unit6, borderRadius: '50%', content: "' '", background: color.neutral.n200, boxShadow: 'inset 2px 2px 2px rgba(0, 0, 0, 0.1)', boxSizing: 'border-box' }, (checked && {
|
|
24
24
|
background: color.special.white,
|
|
25
25
|
border: "6px solid ".concat(color.secondary.secondary)
|
|
26
26
|
})), (disabled && {
|
|
27
27
|
background: color.neutral.n150
|
|
28
|
+
})), (error && {
|
|
29
|
+
border: "2px solid ".concat(color.status.danger)
|
|
28
30
|
}))
|
|
29
31
|
};
|
|
30
32
|
var inputCss = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.js","sources":["../../../src/components/radio/Radio.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef } from 'react'\n\nimport { CSSObject, useTheme } from '@emotion/react'\n\nimport { useRadioGroup } from '../radio-group/useRadioGroup'\n\nexport type RadioProps = ComponentPropsWithoutRef<'input'> & {\n inputClassName?: string\n}\n\n/**\n * Radio buttons allow a user to select a single option from a list of predefined options.\n * TODO: Add label + icon support\n */\nexport const Radio = (props: RadioProps) => {\n const {\n className,\n inputClassName,\n onChange: onChangeProp,\n name: nameProp,\n checked: checkedProp,\n disabled,\n ...other\n } = props\n const { spacing, color } = useTheme()\n\n const { name, checked, onChange } = useRadioGroup({\n name: nameProp,\n checked: checkedProp,\n value: other.value,\n onChange: onChangeProp\n })\n\n const rootCss: CSSObject = {\n position: 'relative',\n height: spacing.unit6,\n width: spacing.unit6,\n '::before': {\n position: 'absolute',\n width: spacing.unit6,\n height: spacing.unit6,\n borderRadius: '50%',\n content: \"' '\",\n background: color.neutral.n200,\n boxShadow: 'inset 2px 2px 2px rgba(0, 0, 0, 0.1)',\n boxSizing: 'border-box',\n ...(checked && {\n background: color.special.white,\n border: `6px solid ${color.secondary.secondary}`\n }),\n ...(disabled && {\n background: color.neutral.n150\n })\n }\n }\n\n const inputCss = {\n opacity: 0,\n margin: 0,\n width: '100%',\n height: '100%',\n cursor: disabled ? 'default' : 'pointer'\n }\n\n return (\n <div css={rootCss} className={className}>\n <input\n css={inputCss}\n className={inputClassName}\n name={name}\n checked={checked}\n type='radio'\n onChange={onChange}\n disabled={disabled}\n {...other}\n />\n </div>\n )\n}\n"],"names":["_jsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"Radio.js","sources":["../../../src/components/radio/Radio.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef } from 'react'\n\nimport { CSSObject, useTheme } from '@emotion/react'\n\nimport { useRadioGroup } from '../radio-group/useRadioGroup'\n\nexport type RadioProps = ComponentPropsWithoutRef<'input'> & {\n inputClassName?: string\n error?: boolean\n}\n\n/**\n * Radio buttons allow a user to select a single option from a list of predefined options.\n * TODO: Add label + icon support\n */\nexport const Radio = (props: RadioProps) => {\n const {\n className,\n inputClassName,\n onChange: onChangeProp,\n name: nameProp,\n checked: checkedProp,\n disabled,\n error,\n ...other\n } = props\n const { spacing, color } = useTheme()\n\n const { name, checked, onChange } = useRadioGroup({\n name: nameProp,\n checked: checkedProp,\n value: other.value,\n onChange: onChangeProp\n })\n\n const rootCss: CSSObject = {\n position: 'relative',\n height: spacing.unit6,\n width: spacing.unit6,\n '::before': {\n position: 'absolute',\n width: spacing.unit6,\n height: spacing.unit6,\n borderRadius: '50%',\n content: \"' '\",\n background: color.neutral.n200,\n boxShadow: 'inset 2px 2px 2px rgba(0, 0, 0, 0.1)',\n boxSizing: 'border-box',\n ...(checked && {\n background: color.special.white,\n border: `6px solid ${color.secondary.secondary}`\n }),\n ...(disabled && {\n background: color.neutral.n150\n }),\n ...(error && {\n border: `2px solid ${color.status.danger}`\n })\n }\n }\n\n const inputCss = {\n opacity: 0,\n margin: 0,\n width: '100%',\n height: '100%',\n cursor: disabled ? 'default' : 'pointer'\n }\n\n return (\n <div css={rootCss} className={className}>\n <input\n css={inputCss}\n className={inputClassName}\n name={name}\n checked={checked}\n type='radio'\n onChange={onChange}\n disabled={disabled}\n {...other}\n />\n </div>\n )\n}\n"],"names":["_jsx"],"mappings":";;;;;AAWA;;;AAGG;AACI,IAAM,KAAK,GAAG,UAAC,KAAiB,EAAA;AAEnC,IAAA,IAAA,SAAS,GAQP,KAAK,UARE,EACT,cAAc,GAOZ,KAAK,CAAA,cAPO,EACJ,YAAY,GAMpB,KAAK,CAAA,QANe,EAChB,QAAQ,GAKZ,KAAK,CALO,IAAA,EACL,WAAW,GAIlB,KAAK,CAJa,OAAA,EACpB,QAAQ,GAGN,KAAK,SAHC,EACR,KAAK,GAEH,KAAK,CAAA,KAFF,EACF,KAAK,GAAA,MAAA,CACN,KAAK,EATH,CAAA,WAAA,EAAA,gBAAA,EAAA,UAAA,EAAA,MAAA,EAAA,SAAA,EAAA,UAAA,EAAA,OAAA,CASL,CADS,CACD;IACH,IAAA,EAAA,GAAqB,QAAQ,EAAE,EAA7B,OAAO,GAAA,EAAA,CAAA,OAAA,EAAE,KAAK,GAAA,EAAA,CAAA,KAAe,CAAA;IAE/B,IAAA,EAAA,GAA8B,aAAa,CAAC;AAChD,QAAA,IAAI,EAAE,QAAQ;AACd,QAAA,OAAO,EAAE,WAAW;QACpB,KAAK,EAAE,KAAK,CAAC,KAAK;AAClB,QAAA,QAAQ,EAAE,YAAY;KACvB,CAAC,EALM,IAAI,GAAA,EAAA,CAAA,IAAA,EAAE,OAAO,GAAA,EAAA,CAAA,OAAA,EAAE,QAAQ,GAAA,EAAA,CAAA,QAK7B,CAAA;AAEF,IAAA,IAAM,OAAO,GAAc;AACzB,QAAA,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,OAAO,CAAC,KAAK;QACrB,KAAK,EAAE,OAAO,CAAC,KAAK;AACpB,QAAA,UAAU,+BACR,QAAQ,EAAE,UAAU,EACpB,KAA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Control.d.ts","sourceRoot":"","sources":["../../../src/components/segmented-control/SegmentedControl.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAE/C;;;GAGG;AACH,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"SegmentedControl.d.ts","sourceRoot":"","sources":["../../../src/components/segmented-control/SegmentedControl.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAE/C;;;GAGG;AACH,eAAO,MAAM,gBAAgB,yGA4K5B,CAAA"}
|
|
@@ -15,10 +15,11 @@ import styles from './SegmentedControl.module.css.js';
|
|
|
15
15
|
*/
|
|
16
16
|
var SegmentedControl = function (props) {
|
|
17
17
|
var _a;
|
|
18
|
+
var _b, _c;
|
|
18
19
|
var options = props.options, selected = props.selected, onSelectOption = props.onSelectOption, className = props.className, fullWidth = props.fullWidth, isMobile = props.isMobile, disabled = props.disabled, label = props.label, ariaLabelledBy = props["aria-labelledby"], equalWidth = props.equalWidth, forceRefreshAfterMs = props.forceRefreshAfterMs;
|
|
19
20
|
var optionRefs = useRef(options.map(function (_) { return createRef(); }));
|
|
20
|
-
var
|
|
21
|
-
var
|
|
21
|
+
var _d = useState((_c = (_b = options[0]) === null || _b === void 0 ? void 0 : _b.key) !== null && _c !== void 0 ? _c : ''), localSelected = _d[0], setLocalSelected = _d[1];
|
|
22
|
+
var _e = useState(0), maxOptionWidth = _e[0], setMaxOptionWidth = _e[1];
|
|
22
23
|
var selectedOption = selected || localSelected;
|
|
23
24
|
var onSetSelected = function (option) {
|
|
24
25
|
// Call props function if controlled
|
|
@@ -26,22 +27,33 @@ var SegmentedControl = function (props) {
|
|
|
26
27
|
onSelectOption(option);
|
|
27
28
|
setLocalSelected(option);
|
|
28
29
|
};
|
|
29
|
-
var
|
|
30
|
+
var _f = useSpring(function () { return ({
|
|
30
31
|
to: { left: '0px', width: '0px' }
|
|
31
|
-
}); }), tabProps =
|
|
32
|
+
}); }), tabProps = _f[0], tabApi = _f[1];
|
|
33
|
+
// Update refs when options change
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
optionRefs.current = options.map(function (_) { return createRef(); });
|
|
36
|
+
}, [options]);
|
|
37
|
+
// Update localSelected if current selection is no longer valid
|
|
38
|
+
useEffect(function () {
|
|
39
|
+
if (options.length > 0 &&
|
|
40
|
+
!options.some(function (option) { return option.key === localSelected; })) {
|
|
41
|
+
setLocalSelected(options[0].key);
|
|
42
|
+
}
|
|
43
|
+
}, [options, localSelected]);
|
|
32
44
|
useEffect(function () {
|
|
33
45
|
setMaxOptionWidth(optionRefs.current.reduce(function (currentMax, ref) {
|
|
34
46
|
var _a, _b;
|
|
35
47
|
var rect = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
36
48
|
return Math.max((_b = rect === null || rect === void 0 ? void 0 : rect.width) !== null && _b !== void 0 ? _b : 0, currentMax);
|
|
37
49
|
}, 0));
|
|
38
|
-
}, []);
|
|
50
|
+
}, [options]);
|
|
39
51
|
// Watch for resizes and repositions so that we move and resize the slider appropriately
|
|
40
|
-
var
|
|
52
|
+
var _g = useMeasure({
|
|
41
53
|
offsetSize: true,
|
|
42
54
|
polyfill: ResizeObserver
|
|
43
|
-
}), selectedRef =
|
|
44
|
-
var
|
|
55
|
+
}), selectedRef = _g[0], bounds = _g[1];
|
|
56
|
+
var _h = useState(false), forceRefresh = _h[0], setForceRefresh = _h[1];
|
|
45
57
|
useEffect(function () {
|
|
46
58
|
setTimeout(function () {
|
|
47
59
|
setForceRefresh(!forceRefresh);
|
|
@@ -84,7 +96,7 @@ var SegmentedControl = function (props) {
|
|
|
84
96
|
_a[styles.isMobile] = isMobile,
|
|
85
97
|
_a)), style: equalWidth && maxOptionWidth
|
|
86
98
|
? { width: "".concat(maxOptionWidth, "px") }
|
|
87
|
-
: undefined }, { children: [option.icon, jsx("input", { type: 'radio', checked: isSelected, onChange: function () {
|
|
99
|
+
: undefined }, { children: [option.leftIcon && (jsx(option.leftIcon, { size: 's', color: isSelected ? 'default' : 'subdued' })), option.icon, jsx("input", { type: 'radio', checked: isSelected, onChange: function () {
|
|
88
100
|
onSetSelected(option.key);
|
|
89
101
|
}, disabled: isOptionDisabled }), jsx(Text, __assign({ variant: 'body', strength: 'strong', color: isSelected ? 'default' : 'subdued', lineHeight: 'single' }, { children: option.text }))] })), idx !== options.length - 1 ? (jsx("div", { className: cn(styles.separator, (_b = {},
|
|
90
102
|
_b[styles.invisible] =
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControl.js","sources":["../../../src/components/segmented-control/SegmentedControl.tsx"],"sourcesContent":["import { createRef, Fragment, useState, useRef, useEffect } from 'react'\n\nimport { ResizeObserver } from '@juggle/resize-observer'\nimport { useSpring, animated } from '@react-spring/web'\nimport cn from 'classnames'\nimport { mergeRefs } from 'react-merge-refs'\nimport useMeasure from 'react-use-measure'\n\nimport { Text } from '~harmony/components/text'\n\nimport styles from './SegmentedControl.module.css'\nimport { SegmentedControlProps } from './types'\n\n/**\n * A hybrid somewhere between a button group, radio buttons, and tabs;\n * segmented controls are used to switch between different options or views.\n */\nexport const SegmentedControl = <T extends string>(\n props: SegmentedControlProps<T>\n) => {\n const {\n options,\n selected,\n onSelectOption,\n className,\n fullWidth,\n isMobile,\n disabled,\n label,\n 'aria-labelledby': ariaLabelledBy,\n equalWidth,\n forceRefreshAfterMs\n } = props\n const optionRefs = useRef(options.map((_) => createRef<HTMLLabelElement>()))\n const [localSelected, setLocalSelected] = useState(options[0].key)\n const [maxOptionWidth, setMaxOptionWidth] = useState(0)\n\n const selectedOption = selected || localSelected\n\n const onSetSelected = (option: T) => {\n // Call props function if controlled\n if (onSelectOption) onSelectOption(option)\n setLocalSelected(option)\n }\n\n const [tabProps, tabApi] = useSpring(() => ({\n to: { left: '0px', width: '0px' }\n }))\n\n useEffect(() => {\n setMaxOptionWidth(\n optionRefs.current.reduce((currentMax, ref) => {\n const rect = ref.current?.getBoundingClientRect()\n return Math.max(rect?.width ?? 0, currentMax)\n }, 0)\n )\n }, [])\n\n // Watch for resizes and repositions so that we move and resize the slider appropriately\n const [selectedRef, bounds] = useMeasure({\n offsetSize: true,\n polyfill: ResizeObserver\n })\n\n const [forceRefresh, setForceRefresh] = useState(false)\n useEffect(() => {\n setTimeout(() => {\n setForceRefresh(!forceRefresh)\n }, forceRefreshAfterMs)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n useEffect(() => {\n let selectedRefIdx = options.findIndex(\n (option) => option.key === selectedOption\n )\n if (selectedRefIdx === -1) selectedRefIdx = 0\n\n const { clientWidth: width, offsetLeft: left } = optionRefs.current[\n selectedRefIdx\n ]?.current ?? { clientWidth: 0, offsetLeft: 0 }\n\n tabApi.start({\n to: { left: `${left}px`, width: `${width}px` }\n })\n }, [\n options,\n equalWidth,\n selectedOption,\n selected,\n tabApi,\n localSelected,\n optionRefs,\n bounds,\n forceRefresh\n ])\n\n return (\n <div\n className={cn(styles.tabs, className, {\n [styles.containerFullWidth]: !!fullWidth,\n [styles.isMobile]: isMobile,\n [styles.disabled]: disabled\n })}\n role='radiogroup'\n aria-label={label}\n aria-labelledby={ariaLabelledBy}\n >\n <animated.div className={styles.tabBackground} style={tabProps} />\n {options.map((option, idx) => {\n const isOptionDisabled = disabled || option.disabled\n const isSelected = option.key === selectedOption\n\n return (\n <Fragment key={option.key}>\n <label\n ref={\n isSelected\n ? mergeRefs([optionRefs.current[idx], selectedRef])\n : optionRefs.current[idx]\n }\n className={cn(styles.tab, {\n [styles.tabFullWidth]: !!fullWidth,\n [styles.disabled]: !disabled && option.disabled,\n [styles.isMobile]: isMobile\n })}\n style={\n equalWidth && maxOptionWidth\n ? { width: `${maxOptionWidth}px` }\n : undefined\n }\n >\n {option.icon}\n <input\n type='radio'\n checked={isSelected}\n onChange={() => {\n onSetSelected(option.key)\n }}\n disabled={isOptionDisabled}\n />\n <Text\n variant='body'\n strength='strong'\n color={isSelected ? 'default' : 'subdued'}\n lineHeight='single'\n >\n {option.text}\n </Text>\n </label>\n {idx !== options.length - 1 ? (\n <div\n className={cn(styles.separator, {\n [styles.invisible]:\n // Hide separator right of the selected option\n selectedOption === option.key ||\n // Hide separator right of the last option\n idx === options.length - 1 ||\n // Hide separator right of an option if the next one is selected\n selectedOption === options[idx + 1].key\n })}\n />\n ) : null}\n </Fragment>\n )\n })}\n </div>\n )\n}\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;AAaA;;;AAGG;AACI,IAAM,gBAAgB,GAAG,UAC9B,KAA+B,EAAA;;IAG7B,IAAA,OAAO,GAWL,KAAK,CAXA,OAAA,EACP,QAAQ,GAUN,KAAK,CAVC,QAAA,EACR,cAAc,GASZ,KAAK,CATO,cAAA,EACd,SAAS,GAQP,KAAK,CAAA,SARE,EACT,SAAS,GAOP,KAAK,CAPE,SAAA,EACT,QAAQ,GAMN,KAAK,CANC,QAAA,EACR,QAAQ,GAKN,KAAK,CAAA,QALC,EACR,KAAK,GAIH,KAAK,CAAA,KAJF,EACc,cAAc,GAG/B,KAAK,CAAA,iBAAA,CAH0B,EACjC,UAAU,GAER,KAAK,CAFG,UAAA,EACV,mBAAmB,GACjB,KAAK,CAAA,mBADY,CACZ;AACT,IAAA,IAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,UAAC,CAAC,EAAA,EAAK,OAAA,SAAS,EAAoB,GAAA,CAAC,CAAC,CAAA;AACtE,IAAA,IAAA,KAAoC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAA3D,aAAa,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,gBAAgB,QAA4B,CAAA;IAC5D,IAAA,EAAA,GAAsC,QAAQ,CAAC,CAAC,CAAC,EAAhD,cAAc,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,iBAAiB,GAAA,EAAA,CAAA,CAAA,CAAe,CAAA;AAEvD,IAAA,IAAM,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ACE,EAAA,CAAA,CAAA,EACP;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"SegmentedControl.js","sources":["../../../src/components/segmented-control/SegmentedControl.tsx"],"sourcesContent":["import { createRef, Fragment, useState, useRef, useEffect } from 'react'\n\nimport { ResizeObserver } from '@juggle/resize-observer'\nimport { useSpring, animated } from '@react-spring/web'\nimport cn from 'classnames'\nimport { mergeRefs } from 'react-merge-refs'\nimport useMeasure from 'react-use-measure'\n\nimport { Text } from '~harmony/components/text'\n\nimport styles from './SegmentedControl.module.css'\nimport { SegmentedControlProps } from './types'\n\n/**\n * A hybrid somewhere between a button group, radio buttons, and tabs;\n * segmented controls are used to switch between different options or views.\n */\nexport const SegmentedControl = <T extends string>(\n props: SegmentedControlProps<T>\n) => {\n const {\n options,\n selected,\n onSelectOption,\n className,\n fullWidth,\n isMobile,\n disabled,\n label,\n 'aria-labelledby': ariaLabelledBy,\n equalWidth,\n forceRefreshAfterMs\n } = props\n const optionRefs = useRef(options.map((_) => createRef<HTMLLabelElement>()))\n const [localSelected, setLocalSelected] = useState(options[0]?.key ?? '')\n const [maxOptionWidth, setMaxOptionWidth] = useState(0)\n\n const selectedOption = selected || localSelected\n\n const onSetSelected = (option: T) => {\n // Call props function if controlled\n if (onSelectOption) onSelectOption(option)\n setLocalSelected(option)\n }\n\n const [tabProps, tabApi] = useSpring(() => ({\n to: { left: '0px', width: '0px' }\n }))\n\n // Update refs when options change\n useEffect(() => {\n optionRefs.current = options.map((_) => createRef<HTMLLabelElement>())\n }, [options])\n\n // Update localSelected if current selection is no longer valid\n useEffect(() => {\n if (\n options.length > 0 &&\n !options.some((option) => option.key === localSelected)\n ) {\n setLocalSelected(options[0].key)\n }\n }, [options, localSelected])\n\n useEffect(() => {\n setMaxOptionWidth(\n optionRefs.current.reduce((currentMax, ref) => {\n const rect = ref.current?.getBoundingClientRect()\n return Math.max(rect?.width ?? 0, currentMax)\n }, 0)\n )\n }, [options])\n\n // Watch for resizes and repositions so that we move and resize the slider appropriately\n const [selectedRef, bounds] = useMeasure({\n offsetSize: true,\n polyfill: ResizeObserver\n })\n\n const [forceRefresh, setForceRefresh] = useState(false)\n useEffect(() => {\n setTimeout(() => {\n setForceRefresh(!forceRefresh)\n }, forceRefreshAfterMs)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n useEffect(() => {\n let selectedRefIdx = options.findIndex(\n (option) => option.key === selectedOption\n )\n if (selectedRefIdx === -1) selectedRefIdx = 0\n\n const { clientWidth: width, offsetLeft: left } = optionRefs.current[\n selectedRefIdx\n ]?.current ?? { clientWidth: 0, offsetLeft: 0 }\n\n tabApi.start({\n to: { left: `${left}px`, width: `${width}px` }\n })\n }, [\n options,\n equalWidth,\n selectedOption,\n selected,\n tabApi,\n localSelected,\n optionRefs,\n bounds,\n forceRefresh\n ])\n\n return (\n <div\n className={cn(styles.tabs, className, {\n [styles.containerFullWidth]: !!fullWidth,\n [styles.isMobile]: isMobile,\n [styles.disabled]: disabled\n })}\n role='radiogroup'\n aria-label={label}\n aria-labelledby={ariaLabelledBy}\n >\n <animated.div className={styles.tabBackground} style={tabProps} />\n {options.map((option, idx) => {\n const isOptionDisabled = disabled || option.disabled\n const isSelected = option.key === selectedOption\n\n return (\n <Fragment key={option.key}>\n <label\n ref={\n isSelected\n ? mergeRefs([optionRefs.current[idx], selectedRef])\n : optionRefs.current[idx]\n }\n className={cn(styles.tab, {\n [styles.tabFullWidth]: !!fullWidth,\n [styles.disabled]: !disabled && option.disabled,\n [styles.isMobile]: isMobile\n })}\n style={\n equalWidth && maxOptionWidth\n ? { width: `${maxOptionWidth}px` }\n : undefined\n }\n >\n {option.leftIcon && (\n <option.leftIcon\n size='s'\n color={isSelected ? 'default' : 'subdued'}\n />\n )}\n {option.icon}\n <input\n type='radio'\n checked={isSelected}\n onChange={() => {\n onSetSelected(option.key)\n }}\n disabled={isOptionDisabled}\n />\n <Text\n variant='body'\n strength='strong'\n color={isSelected ? 'default' : 'subdued'}\n lineHeight='single'\n >\n {option.text}\n </Text>\n </label>\n {idx !== options.length - 1 ? (\n <div\n className={cn(styles.separator, {\n [styles.invisible]:\n // Hide separator right of the selected option\n selectedOption === option.key ||\n // Hide separator right of the last option\n idx === options.length - 1 ||\n // Hide separator right of an option if the next one is selected\n selectedOption === options[idx + 1].key\n })}\n />\n ) : null}\n </Fragment>\n )\n })}\n </div>\n )\n}\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;AAaA;;;AAGG;AACI,IAAM,gBAAgB,GAAG,UAC9B,KAA+B,EAAA;;;IAG7B,IAAA,OAAO,GAWL,KAAK,CAXA,OAAA,EACP,QAAQ,GAUN,KAAK,CAVC,QAAA,EACR,cAAc,GASZ,KAAK,CATO,cAAA,EACd,SAAS,GAQP,KAAK,CAAA,SARE,EACT,SAAS,GAOP,KAAK,CAPE,SAAA,EACT,QAAQ,GAMN,KAAK,CANC,QAAA,EACR,QAAQ,GAKN,KAAK,CAAA,QALC,EACR,KAAK,GAIH,KAAK,CAAA,KAJF,EACc,cAAc,GAG/B,KAAK,CAAA,iBAAA,CAH0B,EACjC,UAAU,GAER,KAAK,CAFG,UAAA,EACV,mBAAmB,GACjB,KAAK,CAAA,mBADY,CACZ;AACT,IAAA,IAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,UAAC,CAAC,EAAA,EAAK,OAAA,SAAS,EAAoB,GAAA,CAAC,CAAC,CAAA;IACtE,IAAA,EAAA,GAAoC,QAAQ,CAAC,CAAA,EAAA,GAAA,MAAA,OAAO,CAAC,CAAC,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,GAAG,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,EAAE,CAAC,EAAlE,aAAa,QAAA,EAAE,gBAAgB,QAAmC,CAAA;IACnE,IAAA,EAAA,GAAsC,QAAQ,CAAC,CAAC,CAAC,EAAhD,cAA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,EAAE,MAAM,CAAA;IAGhB,cAAc,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAA;IAEhC;;4BAEwB;IACxB,SAAS,CAAC,EAAE,OAAO,CAAA;IAEnB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IAEpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAE5B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAE1B;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC7B,CAAA"}
|
|
@@ -24,6 +24,7 @@ import '../../button/IconButton/IconButton.js';
|
|
|
24
24
|
import '../../button/UnstyledButton.js';
|
|
25
25
|
import '../../button/FilterButton/FilterButton.js';
|
|
26
26
|
import '../../button/FilterButton/FilterButtonOption.js';
|
|
27
|
+
import '../../button/BaseButton/BaseButton.js';
|
|
27
28
|
import '@react-spring/web';
|
|
28
29
|
import 'classnames';
|
|
29
30
|
import '../../text-link/TextLink.js';
|