@audius/harmony 0.0.28 → 0.0.33
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 +1 -7
- package/dist/assets/icons/{PenSquare.svg.js → CoinbasePay.svg.js} +12 -10
- package/dist/assets/icons/CoinbasePay.svg.js.map +1 -0
- package/dist/components/button/BaseButton/BaseButton.d.ts +2 -2
- package/dist/components/button/BaseButton/types.d.ts +2 -2
- package/dist/components/button/BaseButton/types.d.ts.map +1 -1
- package/dist/components/button/Button/Button.d.ts.map +1 -1
- package/dist/components/button/Button/Button.js +7 -13
- package/dist/components/button/Button/Button.js.map +1 -1
- package/dist/components/button/FilterButton/FilterButton.stories.d.ts.map +1 -1
- package/dist/components/button/FollowButton/FollowButton.d.ts +2 -1
- package/dist/components/button/FollowButton/FollowButton.d.ts.map +1 -1
- package/dist/components/button/FollowButton/FollowButton.js +52 -20
- package/dist/components/button/FollowButton/FollowButton.js.map +1 -1
- package/dist/components/button/FollowButton/types.d.ts +6 -0
- package/dist/components/button/FollowButton/types.d.ts.map +1 -1
- package/dist/components/button/IconButton/IconButton.d.ts +2 -2
- package/dist/components/button/IconButton/IconButton.d.ts.map +1 -1
- package/dist/components/button/IconButton/IconButton.js +20 -5
- package/dist/components/button/IconButton/IconButton.js.map +1 -1
- package/dist/components/button/SocialButton/SocialButton.d.ts +1 -5
- package/dist/components/button/SocialButton/SocialButton.d.ts.map +1 -1
- package/dist/components/button/SocialButton/SocialButton.js +1 -1
- package/dist/components/button/SocialButton/SocialButton.js.map +1 -1
- package/dist/components/button/index.d.ts +1 -1
- package/dist/components/button/index.d.ts.map +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/layout/Paper/Paper.d.ts +1 -6
- package/dist/components/layout/Paper/Paper.d.ts.map +1 -1
- package/dist/components/layout/Paper/Paper.js +23 -9
- package/dist/components/layout/Paper/Paper.js.map +1 -1
- package/dist/components/layout/Paper/Paper.stories.d.ts +1 -0
- package/dist/components/layout/Paper/Paper.stories.d.ts.map +1 -1
- package/dist/components/layout/Paper/types.d.ts +2 -0
- package/dist/components/layout/Paper/types.d.ts.map +1 -1
- package/dist/components/layout/Popup/Popup.d.ts.map +1 -1
- package/dist/components/layout/Popup/Popup.js +29 -14
- package/dist/components/layout/Popup/Popup.js.map +1 -1
- package/dist/components/modal/Modal.d.ts.map +1 -1
- package/dist/components/modal/Modal.js +40 -28
- package/dist/components/modal/Modal.js.map +1 -1
- package/dist/components/popup-menu/PopupMenu.js +1 -1
- package/dist/components/popup-menu/PopupMenu.js.map +1 -1
- package/dist/components/progress-bar/ProgressBar.d.ts +3 -0
- package/dist/components/progress-bar/ProgressBar.d.ts.map +1 -0
- package/dist/components/progress-bar/ProgressBar.js +40 -0
- package/dist/components/progress-bar/ProgressBar.js.map +1 -0
- package/dist/components/progress-bar/ProgressBar.module.css.js +4 -0
- package/dist/components/progress-bar/ProgressBar.module.css.js.map +1 -0
- package/dist/components/progress-bar/index.d.ts +3 -0
- package/dist/components/progress-bar/index.d.ts.map +1 -0
- package/dist/components/progress-bar/types.d.ts +20 -0
- package/dist/components/progress-bar/types.d.ts.map +1 -0
- package/dist/components/scrubber/Scrubber.d.ts +17 -0
- package/dist/components/scrubber/Scrubber.d.ts.map +1 -0
- package/dist/components/scrubber/Scrubber.js +61 -0
- package/dist/components/scrubber/Scrubber.js.map +1 -0
- package/dist/components/scrubber/Scrubber.module.css.js +4 -0
- package/dist/components/scrubber/Scrubber.module.css.js.map +1 -0
- package/dist/components/scrubber/Slider.d.ts +7 -0
- package/dist/components/scrubber/Slider.d.ts.map +1 -0
- package/dist/components/scrubber/Slider.js +230 -0
- package/dist/components/scrubber/Slider.js.map +1 -0
- package/dist/components/scrubber/Slider.module.css.js +4 -0
- package/dist/components/scrubber/Slider.module.css.js.map +1 -0
- package/dist/components/scrubber/hooks.d.ts +11 -0
- package/dist/components/scrubber/hooks.d.ts.map +1 -0
- package/dist/components/scrubber/hooks.js +63 -0
- package/dist/components/scrubber/hooks.js.map +1 -0
- package/dist/components/scrubber/index.d.ts +2 -0
- package/dist/components/scrubber/index.d.ts.map +1 -0
- package/dist/components/scrubber/types.d.ts +86 -0
- package/dist/components/scrubber/types.d.ts.map +1 -0
- package/dist/components/scrubber/types.js +11 -0
- package/dist/components/scrubber/types.js.map +1 -0
- package/dist/components/text/Text/Text.d.ts.map +1 -1
- package/dist/components/text/Text/Text.js +3 -3
- package/dist/components/text/Text/Text.js.map +1 -1
- package/dist/components/text/Text/constants.d.ts +13 -0
- package/dist/components/text/Text/constants.d.ts.map +1 -1
- package/dist/components/text/Text/constants.js +13 -0
- package/dist/components/text/Text/constants.js.map +1 -1
- package/dist/components/text/Text/types.d.ts +1 -0
- package/dist/components/text/Text/types.d.ts.map +1 -1
- package/dist/foundations/theme/ThemeProvider.d.ts +1 -1
- package/dist/foundations/theme/ThemeProvider.d.ts.map +1 -1
- package/dist/foundations/theme/ThemeProvider.js +6 -0
- package/dist/foundations/theme/ThemeProvider.js.map +1 -1
- package/dist/harmony.css +1 -1
- package/dist/hooks/useHotKeys.d.ts +3 -3
- package/dist/hooks/useHotKeys.d.ts.map +1 -1
- package/dist/hooks/useHotKeys.js +11 -5
- package/dist/hooks/useHotKeys.js.map +1 -1
- package/dist/icons/logos.d.ts +1 -0
- package/dist/icons/logos.d.ts.map +1 -1
- package/dist/icons/logos.js +3 -1
- package/dist/icons/logos.js.map +1 -1
- package/dist/icons/specialIcons.d.ts +0 -2
- package/dist/icons/specialIcons.d.ts.map +1 -1
- package/dist/icons/specialIcons.js +1 -5
- package/dist/icons/specialIcons.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.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/utils/modalState.d.ts +2 -0
- package/dist/utils/modalState.d.ts.map +1 -0
- package/package.json +6 -21
- package/dist/2fdaa2b95a34d549.svg +0 -9
- package/dist/5f91e9bafd9a9e2b.svg +0 -9
- package/dist/assets/icons/PenSquare.svg.js.map +0 -1
- package/dist/avenir.css +0 -44
- package/dist/components/button/BaseButton/BaseButton.module.css.js +0 -4
- package/dist/components/button/BaseButton/BaseButton.module.css.js.map +0 -1
- package/dist/components/button/BaseButton.d.ts +0 -21
- package/dist/components/button/BaseButton.d.ts.map +0 -1
- package/dist/components/button/Button/Button.module.css.js +0 -4
- package/dist/components/button/Button/Button.module.css.js.map +0 -1
- package/dist/components/button/Button.d.ts +0 -13
- package/dist/components/button/Button.d.ts.map +0 -1
- package/dist/components/button/Button.stories.d.ts +0 -11
- package/dist/components/button/Button.stories.d.ts.map +0 -1
- package/dist/components/button/PlainButton/PlainButton.module.css.js +0 -4
- package/dist/components/button/PlainButton/PlainButton.module.css.js.map +0 -1
- package/dist/components/button/PlainButton.d.ts +0 -11
- package/dist/components/button/PlainButton.d.ts.map +0 -1
- package/dist/components/button/PlainButton.stories.d.ts +0 -20
- package/dist/components/button/PlainButton.stories.d.ts.map +0 -1
- package/dist/components/button/SocialButton/SocialButton.module.css.js +0 -4
- package/dist/components/button/SocialButton/SocialButton.module.css.js.map +0 -1
- package/dist/components/button/types.d.ts +0 -194
- package/dist/components/button/types.d.ts.map +0 -1
- package/dist/components/button/types.js +0 -43
- package/dist/components/button/types.js.map +0 -1
- package/dist/components/icon/Icon.d.ts +0 -33
- package/dist/components/icon/Icon.d.ts.map +0 -1
- package/dist/components/icon/Icon.js +0 -39
- package/dist/components/icon/Icon.js.map +0 -1
- package/dist/components/icon/index.d.ts +0 -2
- package/dist/components/icon/index.d.ts.map +0 -1
- package/dist/components/icon.js +0 -11
- package/dist/components/icon.js.map +0 -1
- package/dist/components/input/PasswordInput/PasswordInput.modules.css.js +0 -4
- package/dist/components/input/PasswordInput/PasswordInput.modules.css.js.map +0 -1
- package/dist/components/input/SelectablePill/SelectablePill.module.css.js +0 -4
- package/dist/components/input/SelectablePill/SelectablePill.module.css.js.map +0 -1
- package/dist/components/link/Link.d.ts +0 -8
- package/dist/components/link/Link.d.ts.map +0 -1
- package/dist/components/link/Link.js +0 -19
- package/dist/components/link/Link.js.map +0 -1
- package/dist/components/link/Link.module.css.js +0 -4
- package/dist/components/link/Link.module.css.js.map +0 -1
- package/dist/components/link/TextLink.d.ts +0 -6
- package/dist/components/link/TextLink.d.ts.map +0 -1
- package/dist/components/link/TextLink.stories.d.ts +0 -12
- package/dist/components/link/TextLink.stories.d.ts.map +0 -1
- package/dist/components/link/index.d.ts +0 -2
- package/dist/components/link/index.d.ts.map +0 -1
- package/dist/components/link/types.d.ts +0 -37
- package/dist/components/link/types.d.ts.map +0 -1
- package/dist/components/text/Text/typography.module.css.js +0 -4
- package/dist/components/text/Text/typography.module.css.js.map +0 -1
- package/dist/components/typography/Icons/Icon.d.ts +0 -22
- package/dist/components/typography/Icons/Icon.d.ts.map +0 -1
- package/dist/components/typography/Icons/Icon.js +0 -34
- package/dist/components/typography/Icons/Icon.js.map +0 -1
- package/dist/components/typography/Icons/Icon.module.css.js +0 -4
- package/dist/components/typography/Icons/Icon.module.css.js.map +0 -1
- package/dist/components/typography/Icons/index.d.ts +0 -208
- package/dist/components/typography/Icons/index.d.ts.map +0 -1
- package/dist/components/typography/Icons/types.d.ts +0 -5
- package/dist/components/typography/Icons/types.d.ts.map +0 -1
- package/dist/components/typography/Text/Text.d.ts +0 -3
- package/dist/components/typography/Text/Text.d.ts.map +0 -1
- package/dist/components/typography/Text/Text.js +0 -24
- package/dist/components/typography/Text/Text.js.map +0 -1
- package/dist/components/typography/Text/Text.stories.d.ts +0 -12
- package/dist/components/typography/Text/Text.stories.d.ts.map +0 -1
- package/dist/components/typography/Text/constants.d.ts +0 -3
- package/dist/components/typography/Text/constants.d.ts.map +0 -1
- package/dist/components/typography/Text/constants.js +0 -36
- package/dist/components/typography/Text/constants.js.map +0 -1
- package/dist/components/typography/Text/index.d.ts +0 -3
- package/dist/components/typography/Text/index.d.ts.map +0 -1
- package/dist/components/typography/Text/types.d.ts +0 -19
- package/dist/components/typography/Text/types.d.ts.map +0 -1
- package/dist/components/typography/Text/typography.module.css.js +0 -4
- package/dist/components/typography/Text/typography.module.css.js.map +0 -1
- package/dist/components/typography/index.d.ts +0 -4
- package/dist/components/typography/index.d.ts.map +0 -1
- package/dist/d2608cfebdf74ed2.svg +0 -21
- package/dist/foundations/color/colors.stories.d.ts +0 -7
- package/dist/foundations/color/colors.stories.d.ts.map +0 -1
- package/dist/icons/icons.d.ts +0 -189
- package/dist/icons/icons.d.ts.map +0 -1
- package/dist/index.es.js +0 -6383
- package/dist/index.es.js.map +0 -1
- package/dist/storybook/colors.stories.d.ts +0 -7
- package/dist/storybook/colors.stories.d.ts.map +0 -1
- package/dist/storybook/components/CardLink.d.ts +0 -10
- package/dist/storybook/components/CardLink.d.ts.map +0 -1
- package/dist/storybook/components/ColorPalette/ColorPalette.d.ts +0 -7
- package/dist/storybook/components/ColorPalette/ColorPalette.d.ts.map +0 -1
- package/dist/storybook/components/ColorPalette/index.d.ts +0 -2
- package/dist/storybook/components/ColorPalette/index.d.ts.map +0 -1
- package/dist/storybook/components/ColorSwatch/ColorSwatch.d.ts +0 -8
- package/dist/storybook/components/ColorSwatch/ColorSwatch.d.ts.map +0 -1
- package/dist/storybook/components/ColorSwatch/index.d.ts +0 -2
- package/dist/storybook/components/ColorSwatch/index.d.ts.map +0 -1
- package/dist/styles/theme.d.ts +0 -3
- package/dist/styles/theme.d.ts.map +0 -1
- package/dist/styles/types.d.ts +0 -55
- package/dist/styles/types.d.ts.map +0 -1
- package/dist/types/colors.d.ts +0 -2
- package/dist/types/colors.d.ts.map +0 -1
- package/dist/types/styles.d.ts +0 -19
- package/dist/types/styles.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Slider.js","sources":["../../../src/components/scrubber/Slider.tsx"],"sourcesContent":["import { useState, useEffect, useCallback, useRef, CSSProperties } from 'react'\nimport * as React from 'react'\n\nimport cn from 'classnames'\n\nimport styles from './Slider.module.css'\nimport { useAnimations } from './hooks'\nimport { ScrubberProps } from './types'\n\n/** Gets the X-position of a div. */\nconst getXPosition = (element: HTMLDivElement) => {\n const coords = element.getBoundingClientRect()\n return window.pageXOffset + coords.left\n}\n\n/**\n * A smooth scrubbable slider that relies on CSS animations rather\n * than progress ticks to achieve fluidity.\n */\nexport const Slider = ({\n mediaKey,\n isPlaying,\n isMobile,\n isDisabled,\n elapsedSeconds,\n totalSeconds,\n playbackRate,\n onScrub,\n onScrubRelease,\n includeExpandedTargets = true,\n style\n}: ScrubberProps) => {\n const [previousMediaKey, setPreviousMediaKey] = useState('')\n\n // Percentage of the complete scrubber being dragged to.\n // e.g. 0.25 means the user has dragged the scrubber 1/4th of the way.\n const dragPercent = useRef<number | null>(0)\n\n // Refs to handle event listeners\n const mouseMoveRef = useRef<((this: Document, ev: MouseEvent) => any) | null>(\n null\n )\n const mouseUpRef = useRef<((this: Document, ev: MouseEvent) => any) | null>(\n null\n )\n const touchMoveRef = useRef<((e: TouchEvent) => any) | null>(null)\n const touchEndRef = useRef<((e: TouchEvent) => any) | null>(null)\n\n // Div refs\n const railRef = useRef<HTMLDivElement>(null)\n const trackRef = useRef<HTMLDivElement>(null)\n const handleRef = useRef<HTMLDivElement>(null)\n\n const { play, pause, setPercent } = useAnimations(\n trackRef,\n handleRef,\n elapsedSeconds,\n totalSeconds,\n playbackRate\n )\n\n /**\n * Sets the percentage across the scrubber for a given pageX position.\n */\n const setDragPercent = useCallback(\n (pageX: number) => {\n if (railRef.current) {\n const clickPosition = pageX - getXPosition(railRef.current)\n const railWidth = railRef.current.offsetWidth\n const percent =\n Math.min(Math.max(0, clickPosition), railWidth) / railWidth\n dragPercent.current = percent\n }\n },\n [dragPercent]\n )\n\n /**\n * Sets the percentage across the scrubber for a given mouse event.\n */\n const setDragPercentMouse = useCallback(\n (e: React.MouseEvent | MouseEvent) => {\n setDragPercent(e.pageX)\n },\n [setDragPercent]\n )\n\n /**\n * Sets the percentage across the scurbber for a given touch event.\n */\n const setDragPercentTouch = useCallback(\n (e: React.TouchEvent | TouchEvent) => {\n setDragPercent(e.touches[0].pageX)\n },\n [setDragPercent]\n )\n\n /**\n * Watches user mouse movements while the scrubber handle is being dragged.\n */\n const onMouseMove = useCallback(\n (e: MouseEvent) => {\n e.stopPropagation()\n e.preventDefault()\n\n setDragPercentMouse(e)\n if (dragPercent.current !== null) {\n setPercent(dragPercent.current)\n const seconds = dragPercent.current * totalSeconds\n if (onScrub) {\n onScrub(seconds)\n }\n }\n },\n [dragPercent, setDragPercentMouse, totalSeconds, setPercent, onScrub]\n )\n\n /**\n * Watches user touch movements while the scrubber handle is being dragged.\n */\n const onTouchMove = useCallback(\n (e: TouchEvent) => {\n e.stopPropagation()\n e.preventDefault()\n\n setDragPercentTouch(e)\n if (dragPercent.current !== null) {\n setPercent(dragPercent.current)\n\n const seconds = dragPercent.current * totalSeconds\n if (onScrub) {\n onScrub(seconds)\n }\n }\n },\n [dragPercent, setDragPercentTouch, totalSeconds, setPercent, onScrub]\n )\n\n /**\n * Watches for a mouse-up action (which may not occur on the scrubber itself),\n * calls the release callback, and resets dragging state.\n */\n const onMouseUp = useCallback(() => {\n if (mouseMoveRef.current) {\n document.removeEventListener('mousemove', mouseMoveRef.current)\n }\n if (mouseUpRef.current) {\n document.removeEventListener('mouseup', mouseUpRef.current)\n }\n\n if (dragPercent.current !== null) {\n const seconds = dragPercent.current * totalSeconds\n if (onScrubRelease) {\n onScrubRelease(seconds)\n }\n\n dragPercent.current = null\n }\n }, [mouseMoveRef, mouseUpRef, dragPercent, totalSeconds, onScrubRelease])\n\n /**\n * Watches for a touch-end action (which may not occur on the scrubber itself),\n * calls the release callback, and resets dragging state.\n */\n const onTouchEnd = useCallback(() => {\n if (touchMoveRef.current) {\n document.removeEventListener('touchmove', touchMoveRef.current)\n }\n if (touchEndRef.current) {\n document.removeEventListener('touchend', touchEndRef.current)\n }\n\n if (dragPercent.current !== null) {\n const seconds = dragPercent.current * totalSeconds\n if (onScrubRelease) {\n onScrubRelease(seconds)\n }\n\n dragPercent.current = null\n }\n }, [touchMoveRef, touchEndRef, dragPercent, totalSeconds, onScrubRelease])\n\n /**\n * Attaches mouse-move and mouse-up event listeners and sets dragging state.\n */\n const onMouseDown = (e: React.MouseEvent) => {\n // Cancel mouse down if touch was fired.\n if (e.button !== 0 || touchMoveRef.current) return\n\n mouseMoveRef.current = onMouseMove\n mouseUpRef.current = onMouseUp\n document.addEventListener('mousemove', mouseMoveRef.current)\n document.addEventListener('mouseup', mouseUpRef.current)\n\n setDragPercentMouse(e)\n if (dragPercent.current !== null) {\n setPercent(dragPercent.current)\n }\n }\n\n /**\n * Attaches touch-move and touch-end event listeners and sets dragging state.\n */\n const onTouchStart = (e: React.TouchEvent) => {\n touchMoveRef.current = onTouchMove\n touchEndRef.current = onTouchEnd\n document.addEventListener('touchmove', touchMoveRef.current)\n document.addEventListener('touchend', touchEndRef.current)\n\n setDragPercentTouch(e)\n if (dragPercent.current !== null) {\n setPercent(dragPercent.current)\n }\n }\n\n // Watch interactions to the scrubber and call to animate\n useEffect(() => {\n if (!dragPercent.current) {\n if (isPlaying) play()\n else pause()\n }\n }, [isPlaying, dragPercent, play, pause])\n\n useEffect(() => {\n setPercent(elapsedSeconds / totalSeconds)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [playbackRate])\n\n // When the key changes, reset the animation\n useEffect(() => {\n if (mediaKey !== previousMediaKey) {\n if (!totalSeconds) {\n setPercent(0)\n } else {\n setPercent(elapsedSeconds / totalSeconds)\n }\n setPreviousMediaKey(mediaKey)\n }\n }, [\n mediaKey,\n previousMediaKey,\n setPreviousMediaKey,\n setPercent,\n elapsedSeconds,\n totalSeconds\n ])\n\n const getShowHandle = () =>\n !style || style.showHandle === undefined ? true : style.showHandle\n\n const getRailStyle = () => {\n const s: CSSProperties = {}\n if (style && style.railUnlistenedColor) {\n s.background = style.railUnlistenedColor\n }\n return s\n }\n\n const getTrackStyle = () => {\n const s: CSSProperties = {}\n if (style && style.railListenedColor) {\n s.background = style.railListenedColor\n }\n\n if (style && style.railListenedColor) {\n s.borderRadius = 'var(--unit-half)'\n }\n return s\n }\n\n const getSliderStyle = () => {\n if (style && style.sliderMargin) return { margin: style.sliderMargin }\n return {}\n }\n\n const getHandleStyle = () => {\n const s: CSSProperties = {}\n if (style) {\n if (style.handleColor) s.background = style.handleColor\n if (style.handleShadow) s.boxShadow = style.handleShadow\n }\n return s\n }\n\n return (\n <div\n className={cn(styles.slider, {\n [styles.isMobile]: isMobile,\n [styles.isDisabled]: isDisabled,\n [styles.showHandle]: getShowHandle(),\n [styles.expandedTargets]: includeExpandedTargets\n })}\n onMouseDown={isDisabled ? () => {} : onMouseDown}\n onTouchStart={isDisabled ? () => {} : onTouchStart}\n style={getSliderStyle()}\n >\n <div ref={railRef} className={styles.rail} style={getRailStyle()}>\n <div ref={trackRef} className={styles.trackWrapper}>\n <div\n ref={trackRef}\n className={styles.track}\n style={getTrackStyle()}\n />\n </div>\n </div>\n <div ref={handleRef} className={styles.handleWrapper}>\n <div\n ref={handleRef}\n className={styles.handle}\n style={getHandleStyle()}\n />\n </div>\n </div>\n )\n}\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;AASA;AACA,IAAM,YAAY,GAAG,UAAC,OAAuB,EAAA;AAC3C,IAAA,IAAM,MAAM,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAA;AAC9C,IAAA,OAAO,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC,IAAI,CAAA;AACzC,CAAC,CAAA;AAED;;;AAGG;AACI,IAAM,MAAM,GAAG,UAAC,EAYP,EAAA;;AAXd,IAAA,IAAA,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,QAAQ,GAAA,EAAA,CAAA,Q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,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,aAAa,EAAA,EAAA,EAAA,QAAA,EAClDA,aACE,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,MAAM,CAAC,MAAM,EACxB,KAAK,EAAE,cAAc,EAAE,EACvB,CAAA,EAAA,CAAA,CACE,CACF,EAAA,CAAA,CAAA,EACP;AACH;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var styles = {"slider":"Slider-module_slider__o61n-","isMobile":"Slider-module_isMobile__1VIZX","isDisabled":"Slider-module_isDisabled__o0j3C","expandedTargets":"Slider-module_expandedTargets__c3Kfk","rail":"Slider-module_rail__sCKx8","trackWrapper":"Slider-module_trackWrapper__eH1F9","track":"Slider-module_track__owNQp","handleWrapper":"Slider-module_handleWrapper__mFanB","handleContainer":"Slider-module_handleContainer__YUtKx","handle":"Slider-module_handle__CP-aM","showHandle":"Slider-module_showHandle__nxgIi"};
|
|
2
|
+
|
|
3
|
+
export { styles as default };
|
|
4
|
+
//# sourceMappingURL=Slider.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Slider.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Hook for initializing animations for a scrubber.
|
|
4
|
+
* const animations = useAnimations()
|
|
5
|
+
*/
|
|
6
|
+
export declare const useAnimations: (trackRef: React.MutableRefObject<HTMLDivElement | null>, handleRef: React.MutableRefObject<HTMLDivElement | null>, elapsedSeconds: number, totalSeconds: number, playbackRate?: number) => {
|
|
7
|
+
play: () => void;
|
|
8
|
+
pause: () => void;
|
|
9
|
+
setPercent: (percentComplete: number) => void;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/components/scrubber/hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAoB9B;;;GAGG;AACH,eAAO,MAAM,aAAa,aACd,MAAM,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,aAC5C,MAAM,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,kBACxC,MAAM,gBACR,MAAM;;;kCAwCA,MAAM;CA8B3B,CAAA"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { useCallback, useRef, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
/** Sets animation properties on the handle and track. */
|
|
4
|
+
var animate = function (trackRef, handleRef, transition, transform) {
|
|
5
|
+
if (handleRef.current && trackRef.current) {
|
|
6
|
+
handleRef.current.style.transition = transition;
|
|
7
|
+
handleRef.current.style.transform = transform;
|
|
8
|
+
trackRef.current.style.transition = transition;
|
|
9
|
+
trackRef.current.style.transform = transform;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Hook for initializing animations for a scrubber.
|
|
14
|
+
* const animations = useAnimations()
|
|
15
|
+
*/
|
|
16
|
+
var useAnimations = function (trackRef, handleRef, elapsedSeconds, totalSeconds, playbackRate) {
|
|
17
|
+
if (playbackRate === void 0) { playbackRate = 1; }
|
|
18
|
+
/** Animates from the current position to the end over the remaining seconds. */
|
|
19
|
+
var play = useCallback(function () {
|
|
20
|
+
var timeRemaining = (totalSeconds - elapsedSeconds) / playbackRate;
|
|
21
|
+
animate(trackRef, handleRef, "transform ".concat(timeRemaining, "s linear"), 'translate(100%)');
|
|
22
|
+
}, [totalSeconds, elapsedSeconds, playbackRate, trackRef, handleRef]);
|
|
23
|
+
/**
|
|
24
|
+
* Pauses the animation at the current position.
|
|
25
|
+
* NOTE: We derive the current position from the actual animation position
|
|
26
|
+
* rather than the remaining time so that pausing the scrubber does not
|
|
27
|
+
* cause jumping if elapsed seconds doesn't precisely reflect the animation.
|
|
28
|
+
*/
|
|
29
|
+
var pause = useCallback(function () {
|
|
30
|
+
if (trackRef.current) {
|
|
31
|
+
var trackWidth = trackRef.current.offsetWidth;
|
|
32
|
+
var trackTransform = window
|
|
33
|
+
.getComputedStyle(trackRef.current)
|
|
34
|
+
.getPropertyValue('transform');
|
|
35
|
+
var trackPosition = parseFloat(trackTransform.split(',')[4]);
|
|
36
|
+
var percentComplete = trackPosition / trackWidth;
|
|
37
|
+
animate(trackRef, handleRef, 'none', "translate(".concat(percentComplete * 100, "%)"));
|
|
38
|
+
}
|
|
39
|
+
}, [trackRef, handleRef]);
|
|
40
|
+
/** Sets the animation to a given percentage: [0, 1]. */
|
|
41
|
+
var setPercent = useCallback(function (percentComplete) {
|
|
42
|
+
animate(trackRef, handleRef, 'none', "translate(".concat(percentComplete * 100, "%)"));
|
|
43
|
+
}, [trackRef, handleRef]);
|
|
44
|
+
/**
|
|
45
|
+
* Handle window focus events so that the scrubber can repair itself
|
|
46
|
+
* if/when the browser loses focus and kills animations.
|
|
47
|
+
*/
|
|
48
|
+
var timeData = useRef();
|
|
49
|
+
timeData.current = { elapsedSeconds: elapsedSeconds, totalSeconds: totalSeconds };
|
|
50
|
+
useEffect(function () {
|
|
51
|
+
var onWindowFocus = function () {
|
|
52
|
+
if (timeData.current) {
|
|
53
|
+
setPercent(timeData.current.elapsedSeconds / timeData.current.totalSeconds);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
window.addEventListener('focus', onWindowFocus);
|
|
57
|
+
return function () { return window.removeEventListener('focus', onWindowFocus); };
|
|
58
|
+
}, [timeData, setPercent]);
|
|
59
|
+
return { play: play, pause: pause, setPercent: setPercent };
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export { useAnimations };
|
|
63
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sources":["../../../src/components/scrubber/hooks.ts"],"sourcesContent":["import { useRef, useCallback, useEffect } from 'react'\nimport * as React from 'react'\n\nimport { TimeData } from './types'\n\n/** Sets animation properties on the handle and track. */\nconst animate = (\n trackRef: React.MutableRefObject<HTMLDivElement | null>,\n handleRef: React.MutableRefObject<HTMLDivElement | null>,\n transition: string,\n transform: string\n) => {\n if (handleRef.current && trackRef.current) {\n handleRef.current.style.transition = transition\n handleRef.current.style.transform = transform\n\n trackRef.current.style.transition = transition\n trackRef.current.style.transform = transform\n }\n}\n\n/**\n * Hook for initializing animations for a scrubber.\n * const animations = useAnimations()\n */\nexport const useAnimations = (\n trackRef: React.MutableRefObject<HTMLDivElement | null>,\n handleRef: React.MutableRefObject<HTMLDivElement | null>,\n elapsedSeconds: number,\n totalSeconds: number,\n playbackRate = 1\n) => {\n /** Animates from the current position to the end over the remaining seconds. */\n const play = useCallback(() => {\n const timeRemaining = (totalSeconds - elapsedSeconds) / playbackRate\n animate(\n trackRef,\n handleRef,\n `transform ${timeRemaining}s linear`,\n 'translate(100%)'\n )\n }, [totalSeconds, elapsedSeconds, playbackRate, trackRef, handleRef])\n\n /**\n * Pauses the animation at the current position.\n * NOTE: We derive the current position from the actual animation position\n * rather than the remaining time so that pausing the scrubber does not\n * cause jumping if elapsed seconds doesn't precisely reflect the animation.\n */\n const pause = useCallback(() => {\n if (trackRef.current) {\n const trackWidth = trackRef.current.offsetWidth\n const trackTransform = window\n .getComputedStyle(trackRef.current)\n .getPropertyValue('transform')\n\n const trackPosition = parseFloat(trackTransform.split(',')[4])\n const percentComplete = trackPosition / trackWidth\n animate(\n trackRef,\n handleRef,\n 'none',\n `translate(${percentComplete * 100}%)`\n )\n }\n }, [trackRef, handleRef])\n\n /** Sets the animation to a given percentage: [0, 1]. */\n const setPercent = useCallback(\n (percentComplete: number) => {\n animate(\n trackRef,\n handleRef,\n 'none',\n `translate(${percentComplete * 100}%)`\n )\n },\n [trackRef, handleRef]\n )\n\n /**\n * Handle window focus events so that the scrubber can repair itself\n * if/when the browser loses focus and kills animations.\n */\n const timeData = useRef<TimeData>()\n timeData.current = { elapsedSeconds, totalSeconds }\n useEffect(() => {\n const onWindowFocus = () => {\n if (timeData.current) {\n setPercent(\n timeData.current.elapsedSeconds / timeData.current.totalSeconds\n )\n }\n }\n window.addEventListener('focus', onWindowFocus)\n return () => window.removeEventListener('focus', onWindowFocus)\n }, [timeData, setPercent])\n\n return { play, pause, setPercent }\n}\n"],"names":[],"mappings":";;AAKA;AACA,IAAM,OAAO,GAAG,UACd,QAAuD,EACvD,SAAwD,EACxD,UAAkB,EAClB,SAAiB,EAAA;AAEjB,IAAA,IAAI,SAAS,CAAC,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE;QACzC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,UAAU,CAAA;QAC/C,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,SAAS,CAAA;QAE7C,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,UAAU,CAAA;QAC9C,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,SAAS,CAAA;AAC7C,KAAA;AACH,CAAC,CAAA;AAED;;;AAGG;AACI,IAAM,aAAa,GAAG,UAC3B,QAAuD,EACvD,SAAwD,EACxD,cAAsB,EACtB,YAAoB,EACpB,YAAgB,EAAA;AAAhB,IAAA,IAAA,YAAA,KAAA,KAAA,CAAA,EAAA,EAAA,YAAgB,GAAA,CAAA,CAAA,EAAA;;IAGhB,IAAM,IAAI,GAAG,WAAW,CAAC,YAAA;QACvB,IAAM,aAAa,GAAG,CAAC,YAAY,GAAG,cAAc,IAAI,YAAY,CAAA;QACpE,OAAO,CACL,QAAQ,EACR,SAAS,EACT,YAAa,CAAA,MAAA,CAAA,aAAa,EAAU,UAAA,CAAA,EACpC,iBAAiB,CAClB,CAAA;AACH,KAAC,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAA;AAErE;;;;;AAKG;IACH,IAAM,KAA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,aAAA;AACH,SAAC,CAAA;AACD,QAAA,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;AAC/C,QAAA,OAAO,YAAM,EAAA,OAAA,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAlD,EAAkD,CAAA;AACjE,KAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAA;IAE1B,OAAO,EAAE,IAAI,EAAA,IAAA,EAAE,KAAK,OAAA,EAAE,UAAU,EAAA,UAAA,EAAE,CAAA;AACpC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/scrubber/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export type ScrubberProps = {
|
|
2
|
+
/**
|
|
3
|
+
* A unique identifier for the media being scrubbed.
|
|
4
|
+
* Usually a "track id" suffices here. This property
|
|
5
|
+
* is similar to a `key` in React and is used to
|
|
6
|
+
* reset the scrubber animation for a new media item.
|
|
7
|
+
*/
|
|
8
|
+
mediaKey: string;
|
|
9
|
+
/**
|
|
10
|
+
* Whether or not the media being scrubbed is playing (or paused).
|
|
11
|
+
*/
|
|
12
|
+
isPlaying: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Whether or not the scrubber should be disabled. For example,
|
|
15
|
+
* this is useful when no content is playing.
|
|
16
|
+
*/
|
|
17
|
+
isDisabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Whether or not to display a mobile-friendly variant.
|
|
20
|
+
*/
|
|
21
|
+
isMobile?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether or not timestamps are shown on the sides of the scrubber.
|
|
24
|
+
*/
|
|
25
|
+
includeTimestamps?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The current progress of the media being scrubbed.
|
|
28
|
+
* The scrubber reacts to changes in the elapsed seconds
|
|
29
|
+
* to re-calibrate. This value should be updated relatively frequently
|
|
30
|
+
* (0.1s < x < 1s).
|
|
31
|
+
*/
|
|
32
|
+
elapsedSeconds: number;
|
|
33
|
+
/**
|
|
34
|
+
* Total duration of the media being scrubbed.
|
|
35
|
+
*/
|
|
36
|
+
totalSeconds: number;
|
|
37
|
+
/**
|
|
38
|
+
* The speed that the media is being played at
|
|
39
|
+
*/
|
|
40
|
+
playbackRate: number;
|
|
41
|
+
/**
|
|
42
|
+
* Fired incrementally as the user drags the scrubber.
|
|
43
|
+
*/
|
|
44
|
+
onScrub?: (seconds: number) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Fired effectively on "mouse up" when the user is done scrubbing.
|
|
47
|
+
*/
|
|
48
|
+
onScrubRelease?: (seconds: number) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Individually exposed styling options.
|
|
51
|
+
*/
|
|
52
|
+
style?: {
|
|
53
|
+
railListenedColor?: string;
|
|
54
|
+
railUnlistenedColor?: string;
|
|
55
|
+
showHandle?: boolean;
|
|
56
|
+
handleColor?: string;
|
|
57
|
+
handleShadow?: string;
|
|
58
|
+
sliderMargin?: string;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Include larger click targets to that it's hard to misclick
|
|
62
|
+
* Defaults to true
|
|
63
|
+
*/
|
|
64
|
+
includeExpandedTargets?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Escape hatch for styles.
|
|
67
|
+
*/
|
|
68
|
+
className?: string;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Encapsulates time-data for detecting and animating the position
|
|
72
|
+
* of a scrubber.
|
|
73
|
+
*/
|
|
74
|
+
export type TimeData = {
|
|
75
|
+
elapsedSeconds: number;
|
|
76
|
+
totalSeconds: number;
|
|
77
|
+
};
|
|
78
|
+
export declare const defaultScrubberProps: {
|
|
79
|
+
isPlaying: boolean;
|
|
80
|
+
isDisabled: boolean;
|
|
81
|
+
isMobile: boolean;
|
|
82
|
+
includeTimestamps: boolean;
|
|
83
|
+
onScrub: () => void;
|
|
84
|
+
onScrubRelease: () => void;
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/scrubber/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAA;IAElB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IAEpB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAE3B;;;;;OAKG;IACH,cAAc,EAAE,MAAM,CAAA;IAEtB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAA;IAEpB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAA;IAEpB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAEnC;;OAEG;IACH,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAE1C;;OAEG;IACH,KAAK,CAAC,EAAE;QACN,iBAAiB,CAAC,EAAE,MAAM,CAAA;QAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAA;QAC5B,UAAU,CAAC,EAAE,OAAO,CAAA;QACpB,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,YAAY,CAAC,EAAE,MAAM,CAAA;KACtB,CAAA;IAED;;;OAGG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAEhC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,oBAAoB;;;;;;;CAOhC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../src/components/scrubber/types.ts"],"sourcesContent":["export type ScrubberProps = {\n /**\n * A unique identifier for the media being scrubbed.\n * Usually a \"track id\" suffices here. This property\n * is similar to a `key` in React and is used to\n * reset the scrubber animation for a new media item.\n */\n mediaKey: string\n\n /**\n * Whether or not the media being scrubbed is playing (or paused).\n */\n isPlaying: boolean\n\n /**\n * Whether or not the scrubber should be disabled. For example,\n * this is useful when no content is playing.\n */\n isDisabled?: boolean\n\n /**\n * Whether or not to display a mobile-friendly variant.\n */\n isMobile?: boolean\n\n /**\n * Whether or not timestamps are shown on the sides of the scrubber.\n */\n includeTimestamps?: boolean\n\n /**\n * The current progress of the media being scrubbed.\n * The scrubber reacts to changes in the elapsed seconds\n * to re-calibrate. This value should be updated relatively frequently\n * (0.1s < x < 1s).\n */\n elapsedSeconds: number\n\n /**\n * Total duration of the media being scrubbed.\n */\n totalSeconds: number\n\n /**\n * The speed that the media is being played at\n */\n playbackRate: number\n\n /**\n * Fired incrementally as the user drags the scrubber.\n */\n onScrub?: (seconds: number) => void\n\n /**\n * Fired effectively on \"mouse up\" when the user is done scrubbing.\n */\n onScrubRelease?: (seconds: number) => void\n\n /**\n * Individually exposed styling options.\n */\n style?: {\n railListenedColor?: string\n railUnlistenedColor?: string\n showHandle?: boolean\n handleColor?: string\n handleShadow?: string\n sliderMargin?: string\n }\n\n /**\n * Include larger click targets to that it's hard to misclick\n * Defaults to true\n */\n includeExpandedTargets?: boolean\n\n /**\n * Escape hatch for styles.\n */\n className?: string\n}\n\n/**\n * Encapsulates time-data for detecting and animating the position\n * of a scrubber.\n */\nexport type TimeData = {\n elapsedSeconds: number\n totalSeconds: number\n}\n\nexport const defaultScrubberProps = {\n isPlaying: false,\n isDisabled: false,\n isMobile: false,\n includeTimestamps: true,\n onScrub: () => {},\n onScrubRelease: () => {}\n}\n"],"names":[],"mappings":"AA2Fa,IAAA,oBAAoB,GAAG;AAClC,IAAA,SAAS,EAAE,KAAK;AAChB,IAAA,UAAU,EAAE,KAAK;AACjB,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,iBAAiB,EAAE,IAAI;IACvB,OAAO,EAAE,eAAQ;IACjB,cAAc,EAAE,eAAQ;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../../src/components/text/Text/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA4B,MAAM,OAAO,CAAA;AAU7D,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../../src/components/text/Text/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA4B,MAAM,OAAO,CAAA;AAU7D,eAAO,MAAM,IAAI,4WAsEhB,CAAA"}
|
|
@@ -8,10 +8,10 @@ import { variantTagMap, variantStylesMap } from './constants.js';
|
|
|
8
8
|
|
|
9
9
|
var Text = forwardRef(function (props, ref) {
|
|
10
10
|
var _a, _b;
|
|
11
|
-
var children = props.children, variant = props.variant, _c = props.strength, strength = _c === void 0 ? 'default' : _c, _d = props.size, size = _d === void 0 ? 'm' : _d, color = props.color, shadow = props.shadow, tag = props.tag, asChild = props.asChild, textAlign = props.textAlign, ellipses = props.ellipses, other = __rest(props, ["children", "variant", "strength", "size", "color", "shadow", "tag", "asChild", "textAlign", "ellipses"]);
|
|
11
|
+
var children = props.children, variant = props.variant, _c = props.strength, strength = _c === void 0 ? 'default' : _c, _d = props.size, size = _d === void 0 ? 'm' : _d, color = props.color, shadow = props.shadow, tag = props.tag, asChild = props.asChild, textAlign = props.textAlign, textTransform = props.textTransform, ellipses = props.ellipses, other = __rest(props, ["children", "variant", "strength", "size", "color", "shadow", "tag", "asChild", "textAlign", "textTransform", "ellipses"]);
|
|
12
12
|
var theme = useTheme();
|
|
13
13
|
var variantConfig = variant && variantStylesMap[variant];
|
|
14
|
-
var css = __assign(__assign(__assign(__assign(__assign(__assign({ fontFamily: "'Avenir Next LT Pro', 'Helvetica Neue', Helvetica,\n Arial, sans-serif", position: 'relative', boxSizing: 'border-box' }, (color &&
|
|
14
|
+
var css = __assign(__assign(__assign(__assign(__assign(__assign(__assign({ fontFamily: "'Avenir Next LT Pro', 'Helvetica Neue', Helvetica,\n Arial, sans-serif", position: 'relative', boxSizing: 'border-box' }, (color &&
|
|
15
15
|
color === 'heading' && {
|
|
16
16
|
// inline is necessary to prevent text clipping
|
|
17
17
|
display: 'inline',
|
|
@@ -27,7 +27,7 @@ var Text = forwardRef(function (props, ref) {
|
|
|
27
27
|
// @ts-ignore
|
|
28
28
|
fontWeight: typography.weight[variantConfig.fontWeight[strength]] }, ('css' in variantConfig && variantConfig.css)))), (shadow && {
|
|
29
29
|
textShadow: typography.shadow[shadow]
|
|
30
|
-
})), { textAlign: textAlign }), (ellipses && {
|
|
30
|
+
})), { textAlign: textAlign }), (textTransform && { textTransform: textTransform })), (ellipses && {
|
|
31
31
|
overflow: 'hidden',
|
|
32
32
|
textOverflow: 'ellipsis',
|
|
33
33
|
whiteSpace: 'nowrap'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","sources":["../../../../src/components/text/Text/Text.tsx"],"sourcesContent":["import { ElementType, ForwardedRef, forwardRef } from 'react'\n\nimport { useTheme } from '@emotion/react'\nimport { Slot } from '@radix-ui/react-slot'\n\nimport { typography } from '../../../foundations/typography'\n\nimport { variantStylesMap, variantTagMap } from './constants'\nimport type { TextProps } from './types'\n\nexport const Text = forwardRef(\n <TextComponentType extends ElementType = 'p'>(\n props: TextProps<TextComponentType>,\n ref: ForwardedRef<TextComponentType>\n ) => {\n const {\n children,\n variant,\n strength = 'default',\n size = 'm',\n color,\n shadow,\n tag,\n asChild,\n textAlign,\n ellipses,\n ...other\n } = props\n\n const theme = useTheme()\n\n const variantConfig = variant && variantStylesMap[variant]\n const css = {\n fontFamily: `'Avenir Next LT Pro', 'Helvetica Neue', Helvetica,\n Arial, sans-serif`,\n position: 'relative',\n boxSizing: 'border-box',\n ...(color &&\n color === 'heading' && {\n // inline is necessary to prevent text clipping\n display: 'inline',\n color: theme.color.secondary.secondary,\n WebkitTextFillColor: 'transparent',\n backgroundClip: 'text',\n backgroundImage: theme.color.text.heading\n }),\n ...(color && color !== 'heading' && { color: theme.color.text[color] }),\n ...(variantConfig && {\n // @ts-ignore\n fontSize: typography.size[variantConfig.fontSize[size]],\n // @ts-ignore\n lineHeight: typography.lineHeight[variantConfig.lineHeight[size]],\n // @ts-ignore\n fontWeight: typography.weight[variantConfig.fontWeight[strength]],\n ...('css' in variantConfig && variantConfig.css)\n }),\n ...(shadow && {\n textShadow: typography.shadow[shadow]\n }),\n textAlign,\n ...(ellipses && {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap'\n })\n }\n\n // @ts-ignore\n const variantTag = variant && variantTagMap[variant]?.[size]\n\n const Tag: ElementType = asChild ? Slot : tag ?? variantTag ?? 'span'\n\n return (\n <Tag ref={ref} css={css} {...other}>\n {children}\n </Tag>\n )\n }\n)\n"],"names":["_jsx"],"mappings":";;;;;;;;IAUa,IAAI,GAAG,UAAU,CAC5B,UACE,KAAmC,EACnC,GAAoC,EAAA;;AAGlC,IAAA,IAAA,QAAQ,
|
|
1
|
+
{"version":3,"file":"Text.js","sources":["../../../../src/components/text/Text/Text.tsx"],"sourcesContent":["import { ElementType, ForwardedRef, forwardRef } from 'react'\n\nimport { useTheme } from '@emotion/react'\nimport { Slot } from '@radix-ui/react-slot'\n\nimport { typography } from '../../../foundations/typography'\n\nimport { variantStylesMap, variantTagMap } from './constants'\nimport type { TextProps } from './types'\n\nexport const Text = forwardRef(\n <TextComponentType extends ElementType = 'p'>(\n props: TextProps<TextComponentType>,\n ref: ForwardedRef<TextComponentType>\n ) => {\n const {\n children,\n variant,\n strength = 'default',\n size = 'm',\n color,\n shadow,\n tag,\n asChild,\n textAlign,\n textTransform,\n ellipses,\n ...other\n } = props\n\n const theme = useTheme()\n\n const variantConfig = variant && variantStylesMap[variant]\n const css = {\n fontFamily: `'Avenir Next LT Pro', 'Helvetica Neue', Helvetica,\n Arial, sans-serif`,\n position: 'relative',\n boxSizing: 'border-box',\n ...(color &&\n color === 'heading' && {\n // inline is necessary to prevent text clipping\n display: 'inline',\n color: theme.color.secondary.secondary,\n WebkitTextFillColor: 'transparent',\n backgroundClip: 'text',\n backgroundImage: theme.color.text.heading\n }),\n ...(color && color !== 'heading' && { color: theme.color.text[color] }),\n ...(variantConfig && {\n // @ts-ignore\n fontSize: typography.size[variantConfig.fontSize[size]],\n // @ts-ignore\n lineHeight: typography.lineHeight[variantConfig.lineHeight[size]],\n // @ts-ignore\n fontWeight: typography.weight[variantConfig.fontWeight[strength]],\n ...('css' in variantConfig && variantConfig.css)\n }),\n ...(shadow && {\n textShadow: typography.shadow[shadow]\n }),\n textAlign,\n ...(textTransform && { textTransform }),\n ...(ellipses && {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap'\n })\n }\n\n // @ts-ignore\n const variantTag = variant && variantTagMap[variant]?.[size]\n\n const Tag: ElementType = asChild ? Slot : tag ?? variantTag ?? 'span'\n\n return (\n <Tag ref={ref} css={css} {...other}>\n {children}\n </Tag>\n )\n }\n)\n"],"names":["_jsx"],"mappings":";;;;;;;;IAUa,IAAI,GAAG,UAAU,CAC5B,UACE,KAAmC,EACnC,GAAoC,EAAA;;AAGlC,IAAA,IAAA,QAAQ,GAYN,KAAK,CAAA,QAZC,EACR,OAAO,GAWL,KAAK,CAAA,OAXA,EACP,EAAA,GAUE,KAAK,CAAA,QAVa,EAApB,QAAQ,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,SAAS,GAAA,EAA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H,CAAC;;;;"}
|
|
@@ -11,6 +11,19 @@ export declare const variantTagMap: {
|
|
|
11
11
|
m: string;
|
|
12
12
|
s: string;
|
|
13
13
|
};
|
|
14
|
+
title: {
|
|
15
|
+
xl: string;
|
|
16
|
+
l: string;
|
|
17
|
+
m: string;
|
|
18
|
+
s: string;
|
|
19
|
+
};
|
|
20
|
+
label: {
|
|
21
|
+
xl: string;
|
|
22
|
+
l: string;
|
|
23
|
+
m: string;
|
|
24
|
+
s: string;
|
|
25
|
+
xs: string;
|
|
26
|
+
};
|
|
14
27
|
};
|
|
15
28
|
export declare const variantStylesMap: {
|
|
16
29
|
display: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/components/text/Text/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/components/text/Text/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BzB,CAAA;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2B5B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../../../src/components/text/Text/constants.ts"],"sourcesContent":["export const variantTagMap = {\n display: {\n xl: 'h1',\n l: 'h1',\n m: 'h1',\n s: 'h1'\n },\n heading: {\n xl: 'h1',\n l: 'h2',\n m: 'h3',\n s: 'h4'\n }\n}\n\nexport const variantStylesMap = {\n display: {\n fontSize: { s: '6xl', m: '7xl', l: '8xl', xl: '9xl' },\n lineHeight: { s: '3xl', m: '4xl', l: '5xl', xl: '6xl' },\n fontWeight: { default: 'bold', strong: 'heavy' }\n },\n heading: {\n fontSize: { s: 'xl', m: '2xl', l: '3xl', xl: '5xl' },\n lineHeight: { s: 'l', m: 'xl', l: 'xl', xl: '2xl' },\n fontWeight: { default: 'bold', strong: 'heavy' }\n },\n title: {\n fontSize: { xs: 'xs', s: 's', m: 'm', l: 'l' },\n lineHeight: { xs: 's', s: 's', m: 'm', l: 'l' },\n fontWeight: { weak: 'demiBold', default: 'bold', strong: 'heavy' }\n },\n label: {\n fontSize: { xs: '2xs', s: 'xs', m: 's', l: 'm', xl: 'xl' },\n lineHeight: { xs: 'xs', s: 's', m: 's', l: 'm', xl: 'l' },\n fontWeight: { default: 'bold', strong: 'heavy' },\n css: { textTransform: 'uppercase' as const, letterSpacing: 0.5 }\n },\n body: {\n fontSize: { xs: 'xs', s: 's', m: 'm', l: 'l' },\n lineHeight: { xs: 's', s: 'm', m: 'm', l: 'l' },\n fontWeight: { default: 'medium', strong: 'demiBold' }\n }\n}\n"],"names":[],"mappings":"AAAa,IAAA,aAAa,GAAG;AAC3B,IAAA,OAAO,EAAE;AACP,QAAA,EAAE,EAAE,IAAI;AACR,QAAA,CAAC,EAAE,IAAI;AACP,QAAA,CAAC,EAAE,IAAI;AACP,QAAA,CAAC,EAAE,IAAI;AACR,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,EAAE,EAAE,IAAI;AACR,QAAA,CAAC,EAAE,IAAI;AACP,QAAA,CAAC,EAAE,IAAI;AACP,QAAA,CAAC,EAAE,IAAI;AACR,KAAA;EACF;AAEY,IAAA,gBAAgB,GAAG;AAC9B,IAAA,OAAO,EAAE;AACP,QAAA,QAAQ,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE;AACrD,QAAA,UAAU,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE;QACvD,UAAU,EAAE,EAAE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E,WAAoB,EAAE,aAAa,EAAE,GAAG,EAAE;AACjE,KAAA;AACD,IAAA,IAAI,EAAE;AACJ,QAAA,QAAQ,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE;AAC9C,QAAA,UAAU,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE;QAC/C,UAAU,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE;AACtD,KAAA;;;;;"}
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../src/components/text/Text/constants.ts"],"sourcesContent":["export const variantTagMap = {\n display: {\n xl: 'h1',\n l: 'h1',\n m: 'h1',\n s: 'h1'\n },\n heading: {\n xl: 'h1',\n l: 'h2',\n m: 'h3',\n s: 'h4'\n },\n title: {\n xl: 'h5',\n l: 'h5',\n m: 'h5',\n s: 'h5'\n },\n label: {\n xl: 'p',\n l: 'p',\n m: 'p',\n s: 'p',\n xs: 'p'\n }\n}\n\nexport const variantStylesMap = {\n display: {\n fontSize: { s: '6xl', m: '7xl', l: '8xl', xl: '9xl' },\n lineHeight: { s: '3xl', m: '4xl', l: '5xl', xl: '6xl' },\n fontWeight: { default: 'bold', strong: 'heavy' }\n },\n heading: {\n fontSize: { s: 'xl', m: '2xl', l: '3xl', xl: '5xl' },\n lineHeight: { s: 'l', m: 'xl', l: 'xl', xl: '2xl' },\n fontWeight: { default: 'bold', strong: 'heavy' }\n },\n title: {\n fontSize: { xs: 'xs', s: 's', m: 'm', l: 'l' },\n lineHeight: { xs: 's', s: 's', m: 'm', l: 'l' },\n fontWeight: { weak: 'demiBold', default: 'bold', strong: 'heavy' }\n },\n label: {\n fontSize: { xs: '2xs', s: 'xs', m: 's', l: 'm', xl: 'xl' },\n lineHeight: { xs: 'xs', s: 's', m: 's', l: 'm', xl: 'l' },\n fontWeight: { default: 'bold', strong: 'heavy' },\n css: { textTransform: 'uppercase' as const, letterSpacing: 0.5 }\n },\n body: {\n fontSize: { xs: 'xs', s: 's', m: 'm', l: 'l' },\n lineHeight: { xs: 's', s: 'm', m: 'm', l: 'l' },\n fontWeight: { default: 'medium', strong: 'demiBold' }\n }\n}\n"],"names":[],"mappings":"AAAa,IAAA,aAAa,GAAG;AAC3B,IAAA,OAAO,EAAE;AACP,QAAA,EAAE,EAAE,IAAI;AACR,QAAA,CAAC,EAAE,IAAI;AACP,QAAA,CAAC,EAAE,IAAI;AACP,QAAA,CAAC,EAAE,IAAI;AACR,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,EAAE,EAAE,IAAI;AACR,QAAA,CAAC,EAAE,IAAI;AACP,QAAA,CAAC,EAAE,IAAI;AACP,QAAA,CAAC,EAAE,IAAI;AACR,KAAA;AACD,IAAA,KAAK,EAAE;AACL,QAAA,EAAE,EAAE,IAAI;AACR,QAAA,CAAC,EAAE,IAAI;AACP,QAAA,CAAC,EAAE,IAAI;AACP,QAAA,CAAC,EAAE,IAAI;AACR,KAAA;AACD,IAAA,KAAK,EAAE;AACL,QAAA,EAAE,EAAE,GAAG;AACP,QAAA,CAAC,EAAE,GAAG;AACN,QAAA,CAAC,EAAE,GAAG;AACN,QAAA,CAAC,EAAE,GAAG;AACN,QAAA,EAAE,EAAE,GAAG;AACR,KAAA;EACF;AAEY,IAAA,gBAAgB,GAAG;AAC9B,IAAA,OAAO,EAAE;AACP,QAAA,QAAQ,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE;AACrD,QAAA,UAAU,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE;QACvD,UAAU,EAAE,EAA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AE,WAAoB,EAAE,aAAa,EAAE,GAAG,EAAE;AACjE,KAAA;AACD,IAAA,IAAI,EAAE;AACJ,QAAA,QAAQ,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE;AAC9C,QAAA,UAAU,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE;QAC/C,UAAU,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE;AACtD,KAAA;;;;;"}
|
|
@@ -12,6 +12,7 @@ export type BaseTextProps<TextComponentType extends ElementType = 'p'> = {
|
|
|
12
12
|
asChild?: boolean;
|
|
13
13
|
textAlign?: CSSProperties['textAlign'];
|
|
14
14
|
ellipses?: boolean;
|
|
15
|
+
textTransform?: CSSProperties['textTransform'];
|
|
15
16
|
};
|
|
16
17
|
export type TextProps<TextComponentType extends ElementType = 'p'> = BaseTextProps<TextComponentType> & Omit<ComponentProps<TextComponentType>, keyof BaseTextProps | 'ref'>;
|
|
17
18
|
export type TextStrength = 'weak' | 'default' | 'strong';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/text/Text/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,WAAW,EACX,SAAS,EACV,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAA;AAErE,MAAM,MAAM,aAAa,CAAC,iBAAiB,SAAS,WAAW,GAAG,GAAG,IAAI;IACvE,GAAG,CAAC,EAAE,iBAAiB,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,OAAO,CAAC,EAAE,WAAW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K,CAAC,CAAA;AAExE,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAA;AAExD,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAA;AAEpD,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;AAC5E,MAAM,MAAM,UAAU,GAAG,UAAU,CAAA;AACnC,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../src/foundations/theme/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../src/foundations/theme/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAKjD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,KAAK,kBAAkB,GAAG;IACxB,KAAK,EAAE,KAAK,CAAA;IACZ,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,aAAa,UAAW,kBAAkB,qDActD,CAAA"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { __assign } from '../../_virtual/_tslib.js';
|
|
2
2
|
import { jsx } from '@emotion/react/jsx-runtime';
|
|
3
|
+
import { useEffect } from 'react';
|
|
3
4
|
import { ThemeProvider as ThemeProvider$1 } from '@emotion/react';
|
|
4
5
|
import { themes } from './theme.js';
|
|
5
6
|
|
|
6
7
|
var ThemeProvider = function (props) {
|
|
7
8
|
var children = props.children, theme = props.theme;
|
|
9
|
+
useEffect(function () {
|
|
10
|
+
if (typeof document !== 'undefined') {
|
|
11
|
+
document.documentElement.setAttribute('data-theme', theme);
|
|
12
|
+
}
|
|
13
|
+
}, [theme]);
|
|
8
14
|
return (jsx(ThemeProvider$1, __assign({ theme: themes[theme] }, { children: children })));
|
|
9
15
|
};
|
|
10
16
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.js","sources":["../../../src/foundations/theme/ThemeProvider.tsx"],"sourcesContent":["import type
|
|
1
|
+
{"version":3,"file":"ThemeProvider.js","sources":["../../../src/foundations/theme/ThemeProvider.tsx"],"sourcesContent":["import { useEffect, type ReactNode } from 'react'\n\nimport { ThemeProvider as EmotionThemeProvider } from '@emotion/react'\n\nimport { themes } from './theme'\nimport type { Theme } from './types'\n\ntype ThemeProviderProps = {\n theme: Theme\n children: ReactNode\n}\n\nexport const ThemeProvider = (props: ThemeProviderProps) => {\n const { children, theme } = props\n\n useEffect(() => {\n if (typeof document !== 'undefined') {\n document.documentElement.setAttribute('data-theme', theme)\n }\n }, [theme])\n\n return (\n <EmotionThemeProvider theme={themes[theme]}>\n {children}\n </EmotionThemeProvider>\n )\n}\n"],"names":["_jsx","EmotionThemeProvider"],"mappings":";;;;;;AAYO,IAAM,aAAa,GAAG,UAAC,KAAyB,EAAA;IAC7C,IAAA,QAAQ,GAAY,KAAK,CAAA,QAAjB,EAAE,KAAK,GAAK,KAAK,CAAA,KAAV,CAAU;AAEjC,IAAA,SAAS,CAAC,YAAA;AACR,QAAA,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;YACnC,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,YAAY,EAAE,KAAK,CAAC,CAAA;AAC3D,SAAA;AACH,KAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;AAEX,IAAA,QACEA,GAAA,CAACC,eAAoB,EAAA,QAAA,CAAA,EAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAA,EAAA,EAAA,QAAA,EACvC,QAAQ,EAAA,CAAA,CACY,EACxB;AACH;;;;"}
|