@artsy/palette 45.14.0-canary.1497.33065.0 → 45.14.0-canary.1497.33070.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/elements/FilterSelect/index.d.ts +1 -1
- package/dist/cjs/elements/FilterSelect/index.js +7 -0
- package/dist/cjs/elements/FilterSelect/index.js.map +1 -1
- package/dist/esm/Theme.js +1 -1
- package/dist/esm/Theme.js.map +1 -1
- package/dist/esm/elements/AutocompleteInput/AutocompleteInput.js +2 -0
- package/dist/esm/elements/AutocompleteInput/AutocompleteInput.js.map +1 -1
- package/dist/esm/elements/AutocompleteInput/AutocompleteInputOption.js +1 -1
- package/dist/esm/elements/AutocompleteInput/AutocompleteInputOption.js.map +1 -1
- package/dist/esm/elements/AutocompleteInput/AutocompleteInputOptionLabel.js +1 -1
- package/dist/esm/elements/AutocompleteInput/AutocompleteInputOptionLabel.js.map +1 -1
- package/dist/esm/elements/Avatar/Avatar.js +3 -2
- package/dist/esm/elements/Avatar/Avatar.js.map +1 -1
- package/dist/esm/elements/Banner/Banner.js +1 -1
- package/dist/esm/elements/Banner/Banner.js.map +1 -1
- package/dist/esm/elements/BaseTabs/BaseTab.js +2 -1
- package/dist/esm/elements/BaseTabs/BaseTab.js.map +1 -1
- package/dist/esm/elements/BaseTabs/BaseTabs.js +1 -1
- package/dist/esm/elements/BaseTabs/BaseTabs.js.map +1 -1
- package/dist/esm/elements/BorderBox/BorderBox.js +1 -1
- package/dist/esm/elements/BorderBox/BorderBox.js.map +1 -1
- package/dist/esm/elements/BorderBox/BorderBoxBase.js +1 -1
- package/dist/esm/elements/BorderBox/BorderBoxBase.js.map +1 -1
- package/dist/esm/elements/BorderedRadio/BorderedRadio.js +1 -1
- package/dist/esm/elements/BorderedRadio/BorderedRadio.js.map +1 -1
- package/dist/esm/elements/Box/Box.js +2 -2
- package/dist/esm/elements/Box/Box.js.map +1 -1
- package/dist/esm/elements/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/esm/elements/Breadcrumbs/Breadcrumbs.js.map +1 -1
- package/dist/esm/elements/Button/Button.js +5 -3
- package/dist/esm/elements/Button/Button.js.map +1 -1
- package/dist/esm/elements/Button/tokens.js +2 -0
- package/dist/esm/elements/Button/tokens.js.map +1 -1
- package/dist/esm/elements/CSSGrid/CSSGrid.js +2 -2
- package/dist/esm/elements/CSSGrid/CSSGrid.js.map +1 -1
- package/dist/esm/elements/Cards/Card.js +2 -2
- package/dist/esm/elements/Cards/Card.js.map +1 -1
- package/dist/esm/elements/Cards/TriptychCard.js +2 -2
- package/dist/esm/elements/Cards/TriptychCard.js.map +1 -1
- package/dist/esm/elements/Carousel/Carousel.js +4 -3
- package/dist/esm/elements/Carousel/Carousel.js.map +1 -1
- package/dist/esm/elements/Carousel/Carousel.story.js +1 -1
- package/dist/esm/elements/Carousel/Carousel.story.js.map +1 -1
- package/dist/esm/elements/Carousel/CarouselNavigation.js +2 -1
- package/dist/esm/elements/Carousel/CarouselNavigation.js.map +1 -1
- package/dist/esm/elements/CarouselBar/CarouselBar.js +1 -1
- package/dist/esm/elements/CarouselBar/CarouselBar.js.map +1 -1
- package/dist/esm/elements/Checkbox/Checkbox.js +1 -1
- package/dist/esm/elements/Checkbox/Checkbox.js.map +1 -1
- package/dist/esm/elements/CleanTag/CleanTag.js +1 -1
- package/dist/esm/elements/CleanTag/CleanTag.js.map +1 -1
- package/dist/esm/elements/Clickable/Clickable.js +3 -2
- package/dist/esm/elements/Clickable/Clickable.js.map +1 -1
- package/dist/esm/elements/Drawer/Drawer.js +1 -1
- package/dist/esm/elements/Drawer/Drawer.js.map +1 -1
- package/dist/esm/elements/Dropdown/Dropdown.js +2 -2
- package/dist/esm/elements/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/elements/Dropdown/Dropdown.story.js +1 -0
- package/dist/esm/elements/Dropdown/Dropdown.story.js.map +1 -1
- package/dist/esm/elements/EntityHeader/EntityHeader.js +3 -2
- package/dist/esm/elements/EntityHeader/EntityHeader.js.map +1 -1
- package/dist/esm/elements/Expandable/Expandable.js +1 -1
- package/dist/esm/elements/Expandable/Expandable.js.map +1 -1
- package/dist/esm/elements/FilterSelect/Components/FilterInput.js +1 -0
- package/dist/esm/elements/FilterSelect/Components/FilterInput.js.map +1 -1
- package/dist/esm/elements/FilterSelect/Components/FilterSelectResultItem.js +1 -1
- package/dist/esm/elements/FilterSelect/Components/FilterSelectResultItem.js.map +1 -1
- package/dist/esm/elements/FilterSelect/FilterSelect.js +1 -1
- package/dist/esm/elements/FilterSelect/FilterSelect.js.map +1 -1
- package/dist/esm/elements/FilterSelect/index.js +1 -1
- package/dist/esm/elements/FilterSelect/index.js.map +1 -1
- package/dist/esm/elements/Flex/Flex.js +1 -1
- package/dist/esm/elements/Flex/Flex.js.map +1 -1
- package/dist/esm/elements/FullBleed/FullBleed.js +1 -1
- package/dist/esm/elements/FullBleed/FullBleed.js.map +1 -1
- package/dist/esm/elements/GridColumns/GridColumns.js +4 -4
- package/dist/esm/elements/GridColumns/GridColumns.js.map +1 -1
- package/dist/esm/elements/HTML/HTML.js +2 -2
- package/dist/esm/elements/HTML/HTML.js.map +1 -1
- package/dist/esm/elements/HorizontalOverflow/HorizontalOverflow.js +2 -2
- package/dist/esm/elements/HorizontalOverflow/HorizontalOverflow.js.map +1 -1
- package/dist/esm/elements/Image/Image.js +1 -1
- package/dist/esm/elements/Image/Image.js.map +1 -1
- package/dist/esm/elements/Input/Input.js +1 -1
- package/dist/esm/elements/Input/Input.js.map +1 -1
- package/dist/esm/elements/Input/tokens.js +1 -0
- package/dist/esm/elements/Input/tokens.js.map +1 -1
- package/dist/esm/elements/Label/Label.js +1 -1
- package/dist/esm/elements/Label/Label.js.map +1 -1
- package/dist/esm/elements/Label/Label.story.js +1 -1
- package/dist/esm/elements/Label/Label.story.js.map +1 -1
- package/dist/esm/elements/LabeledInput/LabeledInput.js +1 -1
- package/dist/esm/elements/LabeledInput/LabeledInput.js.map +1 -1
- package/dist/esm/elements/Link/Link.js +2 -2
- package/dist/esm/elements/Link/Link.js.map +1 -1
- package/dist/esm/elements/Marquee/Marquee.js +1 -1
- package/dist/esm/elements/Marquee/Marquee.js.map +1 -1
- package/dist/esm/elements/Message/Message.js +1 -1
- package/dist/esm/elements/Message/Message.js.map +1 -1
- package/dist/esm/elements/Message/Message.story.js +1 -1
- package/dist/esm/elements/Message/Message.story.js.map +1 -1
- package/dist/esm/elements/Modal/ModalBase.js +2 -2
- package/dist/esm/elements/Modal/ModalBase.js.map +1 -1
- package/dist/esm/elements/Modal/ModalBase.story.js +1 -1
- package/dist/esm/elements/Modal/ModalBase.story.js.map +1 -1
- package/dist/esm/elements/ModalDialog/ModalDialog.js +2 -2
- package/dist/esm/elements/ModalDialog/ModalDialog.js.map +1 -1
- package/dist/esm/elements/ModalDialog/ModalDialogContent.js +3 -3
- package/dist/esm/elements/ModalDialog/ModalDialogContent.js.map +1 -1
- package/dist/esm/elements/MultiSelect/MultiSelect.js +2 -2
- package/dist/esm/elements/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/esm/elements/MultiSelect/tokens.js +2 -1
- package/dist/esm/elements/MultiSelect/tokens.js.map +1 -1
- package/dist/esm/elements/Pagination/Pagination.js +3 -3
- package/dist/esm/elements/Pagination/Pagination.js.map +1 -1
- package/dist/esm/elements/PasswordInput/PasswordInput.js +1 -0
- package/dist/esm/elements/PasswordInput/PasswordInput.js.map +1 -1
- package/dist/esm/elements/Pill/Pill.js +3 -1
- package/dist/esm/elements/Pill/Pill.js.map +1 -1
- package/dist/esm/elements/Pill/Pill.story.js +1 -1
- package/dist/esm/elements/Pill/Pill.story.js.map +1 -1
- package/dist/esm/elements/Pill/tokens.js +2 -1
- package/dist/esm/elements/Pill/tokens.js.map +1 -1
- package/dist/esm/elements/Pointer/Pointer.js +2 -1
- package/dist/esm/elements/Pointer/Pointer.js.map +1 -1
- package/dist/esm/elements/Popover/Popover.js +2 -2
- package/dist/esm/elements/Popover/Popover.js.map +1 -1
- package/dist/esm/elements/Popover/Popover.story.js +2 -2
- package/dist/esm/elements/Popover/Popover.story.js.map +1 -1
- package/dist/esm/elements/ProgressBar/ProgressBar.js +2 -1
- package/dist/esm/elements/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/esm/elements/ProgressDots/ProgressDots.js +1 -1
- package/dist/esm/elements/ProgressDots/ProgressDots.js.map +1 -1
- package/dist/esm/elements/Radio/Radio.js +1 -1
- package/dist/esm/elements/Radio/Radio.js.map +1 -1
- package/dist/esm/elements/Radio/tokens.js +2 -0
- package/dist/esm/elements/Radio/tokens.js.map +1 -1
- package/dist/esm/elements/RadioGroup/RadioGroup.js +2 -1
- package/dist/esm/elements/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/esm/elements/Range/Range.js +1 -1
- package/dist/esm/elements/Range/Range.js.map +1 -1
- package/dist/esm/elements/ResponsiveBox/ResponsiveBox.js +1 -1
- package/dist/esm/elements/ResponsiveBox/ResponsiveBox.js.map +1 -1
- package/dist/esm/elements/ResponsiveBox/ResponsiveBox.story.js +1 -1
- package/dist/esm/elements/ResponsiveBox/ResponsiveBox.story.js.map +1 -1
- package/dist/esm/elements/Select/Select.js +2 -2
- package/dist/esm/elements/Select/Select.js.map +1 -1
- package/dist/esm/elements/Select/tokens.js +2 -1
- package/dist/esm/elements/Select/tokens.js.map +1 -1
- package/dist/esm/elements/SelectInput/SelectInput.js +4 -3
- package/dist/esm/elements/SelectInput/SelectInput.js.map +1 -1
- package/dist/esm/elements/SelectInput/SelectInputList.js +2 -1
- package/dist/esm/elements/SelectInput/SelectInputList.js.map +1 -1
- package/dist/esm/elements/Separator/Separator.js +1 -1
- package/dist/esm/elements/Separator/Separator.js.map +1 -1
- package/dist/esm/elements/Shelf/Shelf.js +2 -1
- package/dist/esm/elements/Shelf/Shelf.js.map +1 -1
- package/dist/esm/elements/Shelf/ShelfNavigation.js +1 -1
- package/dist/esm/elements/Shelf/ShelfNavigation.js.map +1 -1
- package/dist/esm/elements/Shelf/ShelfScrollBar.js +1 -1
- package/dist/esm/elements/Shelf/ShelfScrollBar.js.map +1 -1
- package/dist/esm/elements/ShowMore/ShowMore.js +2 -2
- package/dist/esm/elements/ShowMore/ShowMore.js.map +1 -1
- package/dist/esm/elements/Skeleton/Skeleton.js +3 -3
- package/dist/esm/elements/Skeleton/Skeleton.js.map +1 -1
- package/dist/esm/elements/Skip/Skip.js +1 -1
- package/dist/esm/elements/Skip/Skip.js.map +1 -1
- package/dist/esm/elements/Spacer/Spacer.js +1 -1
- package/dist/esm/elements/Spacer/Spacer.js.map +1 -1
- package/dist/esm/elements/Spinner/Spinner.js +2 -2
- package/dist/esm/elements/Spinner/Spinner.js.map +1 -1
- package/dist/esm/elements/Stack/Stack.js +2 -1
- package/dist/esm/elements/Stack/Stack.js.map +1 -1
- package/dist/esm/elements/StackableBorderBox/StackableBorderBox.js +1 -1
- package/dist/esm/elements/StackableBorderBox/StackableBorderBox.js.map +1 -1
- package/dist/esm/elements/Stepper/Stepper.js +1 -1
- package/dist/esm/elements/Stepper/Stepper.js.map +1 -1
- package/dist/esm/elements/Sup/Sup.js +1 -1
- package/dist/esm/elements/Sup/Sup.js.map +1 -1
- package/dist/esm/elements/Swiper/Swiper.js +1 -1
- package/dist/esm/elements/Swiper/Swiper.js.map +1 -1
- package/dist/esm/elements/Swiper/Swiper.story.js +1 -1
- package/dist/esm/elements/Swiper/Swiper.story.js.map +1 -1
- package/dist/esm/elements/Tabs/Tabs.js +1 -1
- package/dist/esm/elements/Tabs/Tabs.js.map +1 -1
- package/dist/esm/elements/Text/Text.js +4 -3
- package/dist/esm/elements/Text/Text.js.map +1 -1
- package/dist/esm/elements/TextArea/TextArea.js +1 -1
- package/dist/esm/elements/TextArea/TextArea.js.map +1 -1
- package/dist/esm/elements/TextArea/tokens.js +1 -0
- package/dist/esm/elements/TextArea/tokens.js.map +1 -1
- package/dist/esm/elements/Toasts/Toast.js +1 -1
- package/dist/esm/elements/Toasts/Toast.js.map +1 -1
- package/dist/esm/elements/Toasts/Toasts.js +1 -1
- package/dist/esm/elements/Toasts/Toasts.js.map +1 -1
- package/dist/esm/elements/Toasts/Toasts.story.js +1 -1
- package/dist/esm/elements/Toasts/Toasts.story.js.map +1 -1
- package/dist/esm/elements/Toasts/useToasts.js +1 -0
- package/dist/esm/elements/Toasts/useToasts.js.map +1 -1
- package/dist/esm/elements/Toggle/Toggle.js +1 -1
- package/dist/esm/elements/Toggle/Toggle.js.map +1 -1
- package/dist/esm/elements/Tooltip/Tooltip.js +2 -2
- package/dist/esm/elements/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/elements/Tooltip/Tooltip.story.js +2 -2
- package/dist/esm/elements/Tooltip/Tooltip.story.js.map +1 -1
- package/dist/esm/elements/VisuallyHidden/VisuallyHidden.js +1 -1
- package/dist/esm/elements/VisuallyHidden/VisuallyHidden.js.map +1 -1
- package/dist/esm/helpers/color.js +1 -1
- package/dist/esm/helpers/color.js.map +1 -1
- package/dist/esm/helpers/injectGlobalStyles.js +1 -1
- package/dist/esm/helpers/injectGlobalStyles.js.map +1 -1
- package/dist/esm/helpers/isText.js +1 -1
- package/dist/esm/helpers/isText.js.map +1 -1
- package/dist/esm/helpers/space.js +1 -1
- package/dist/esm/helpers/space.js.map +1 -1
- package/dist/esm/shared/RequiredField.js +1 -1
- package/dist/esm/shared/RequiredField.js.map +1 -1
- package/dist/esm/themes/Themes.story.js +2 -1
- package/dist/esm/themes/Themes.story.js.map +1 -1
- package/dist/esm/utils/splitProps.js +1 -0
- package/dist/esm/utils/splitProps.js.map +1 -1
- package/dist/esm/utils/usePortal.js +1 -1
- package/dist/esm/utils/usePortal.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Checkbox } from "../../Checkbox";
|
|
3
|
-
import { useFilterSelectContext } from "./FilterSelectContext";
|
|
3
|
+
import { Item, useFilterSelectContext } from "./FilterSelectContext";
|
|
4
4
|
import { Radio } from "../../Radio";
|
|
5
5
|
export var FilterSelectResultItem = function FilterSelectResultItem(props) {
|
|
6
6
|
var _useFilterSelectConte = useFilterSelectContext(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterSelectResultItem.js","names":["React","Checkbox","useFilterSelectContext","Radio","FilterSelectResultItem","props","_useFilterSelectConte","renderItemLabel","selectedItems","toggleSelectedItem","multiselect","isSelected","find","item","value","label","Component","createElement","onSelect","selected","key","my","displayName"],"sources":["../../../../../src/elements/FilterSelect/Components/FilterSelectResultItem.tsx"],"sourcesContent":["import React from \"react\"\nimport { Checkbox } from \"../../Checkbox\"\nimport { Item, useFilterSelectContext } from \"./FilterSelectContext\"\nimport { Radio } from \"../../Radio\"\n\nexport const FilterSelectResultItem: React.FC<React.PropsWithChildren<Item>> = (props) => {\n const {\n renderItemLabel,\n selectedItems,\n toggleSelectedItem,\n multiselect,\n } = useFilterSelectContext()\n\n const isSelected = !!selectedItems.find(\n (item: Item) => item.value === props.value\n )\n const label = renderItemLabel ? renderItemLabel(props) : props.label\n const Component = multiselect ? Checkbox : Radio\n\n return (\n <Component\n onSelect={() => toggleSelectedItem(props)}\n selected={isSelected}\n key={props.value}\n my={1}\n >\n {label}\n </Component>\n )\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ;AACjB,
|
|
1
|
+
{"version":3,"file":"FilterSelectResultItem.js","names":["React","Checkbox","Item","useFilterSelectContext","Radio","FilterSelectResultItem","props","_useFilterSelectConte","renderItemLabel","selectedItems","toggleSelectedItem","multiselect","isSelected","find","item","value","label","Component","createElement","onSelect","selected","key","my","displayName"],"sources":["../../../../../src/elements/FilterSelect/Components/FilterSelectResultItem.tsx"],"sourcesContent":["import React from \"react\"\nimport { Checkbox } from \"../../Checkbox\"\nimport { Item, useFilterSelectContext } from \"./FilterSelectContext\"\nimport { Radio } from \"../../Radio\"\n\nexport const FilterSelectResultItem: React.FC<React.PropsWithChildren<Item>> = (props) => {\n const {\n renderItemLabel,\n selectedItems,\n toggleSelectedItem,\n multiselect,\n } = useFilterSelectContext()\n\n const isSelected = !!selectedItems.find(\n (item: Item) => item.value === props.value\n )\n const label = renderItemLabel ? renderItemLabel(props) : props.label\n const Component = multiselect ? Checkbox : Radio\n\n return (\n <Component\n onSelect={() => toggleSelectedItem(props)}\n selected={isSelected}\n key={props.value}\n my={1}\n >\n {label}\n </Component>\n )\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ;AACjB,SAASC,IAAI,EAAEC,sBAAsB;AACrC,SAASC,KAAK;AAEd,OAAO,IAAMC,sBAA+D,GAAG,SAAlEA,sBAA+DA,CAAIC,KAAK,EAAK;EACxF,IAAAC,qBAAA,GAKIJ,sBAAsB,EAAE;IAJ1BK,eAAe,GAAAD,qBAAA,CAAfC,eAAe;IACfC,aAAa,GAAAF,qBAAA,CAAbE,aAAa;IACbC,kBAAkB,GAAAH,qBAAA,CAAlBG,kBAAkB;IAClBC,WAAW,GAAAJ,qBAAA,CAAXI,WAAW;EAGb,IAAMC,UAAU,GAAG,CAAC,CAACH,aAAa,CAACI,IAAI,CACrC,UAACC,IAAU;IAAA,OAAKA,IAAI,CAACC,KAAK,KAAKT,KAAK,CAACS,KAAK;EAAA,EAC3C;EACD,IAAMC,KAAK,GAAGR,eAAe,GAAGA,eAAe,CAACF,KAAK,CAAC,GAAGA,KAAK,CAACU,KAAK;EACpE,IAAMC,SAAS,GAAGN,WAAW,GAAGV,QAAQ,GAAGG,KAAK;EAEhD,oBACEJ,KAAA,CAAAkB,aAAA,CAACD,SAAS;IACRE,QAAQ,EAAE,SAAVA,QAAQA,CAAA;MAAA,OAAQT,kBAAkB,CAACJ,KAAK,CAAC;IAAA,CAAC;IAC1Cc,QAAQ,EAAER,UAAW;IACrBS,GAAG,EAAEf,KAAK,CAACS,KAAM;IACjBO,EAAE,EAAE;EAAE,GAELN,KAAK,CACI;AAEhB,CAAC;AAxBYX,sBAA+D,CAAAkB,WAAA"}
|
|
@@ -10,7 +10,7 @@ import * as React from "react";
|
|
|
10
10
|
import { ShowMore } from "../ShowMore";
|
|
11
11
|
import { Flex } from "../Flex";
|
|
12
12
|
import { FilterSelectResultItem } from "./Components/FilterSelectResultItem";
|
|
13
|
-
import { FilterSelectContextProvider, useFilterSelectContext } from "./Components/FilterSelectContext";
|
|
13
|
+
import { FilterSelectContextProvider, FilterSelectState, Items, useFilterSelectContext } from "./Components/FilterSelectContext";
|
|
14
14
|
import { FilterInput } from "./Components/FilterInput";
|
|
15
15
|
import { VisuallyHidden } from "../VisuallyHidden";
|
|
16
16
|
import { Text } from "../Text";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterSelect.js","names":["intersection","orderBy","uniqBy","React","ShowMore","Flex","FilterSelectResultItem","FilterSelectContextProvider","useFilterSelectContext","FilterInput","VisuallyHidden","Text","INITIAL_ITEMS_TO_SHOW","useUpdateEffect","Box","Clickable","Stack","FilterSelect","props","createElement","_FilterSelect","displayName","_useFilterSelectConte","enableSelectAll","filteredItems","initialItemsToShow","isFiltered","items","moveSelectedToTop","multiselect","onChange","order","query","selectedItems","console","error","length","orderItems","_toConsumableArray","itemsOrdered","filteredItemsOrdered","itemsSorted","concat","x","value","expanded","isBelowTheFoldSelected","showNoResults","showSelectAll","flexDirection","mb","variant","Fragment","SelectAll","map","item","_extends","key","initial","textDecoration","mt","textAlign","resultsSorted","selected","_ref","results","slice","_ref2","isSelected","_useFilterSelectConte2","onSelectAll","setSelectedItems","isClearDisabled","my","gap","className","onClick","disabled","color"],"sources":["../../../../src/elements/FilterSelect/FilterSelect.tsx"],"sourcesContent":["import { intersection, orderBy, uniqBy } from \"es-toolkit\"\nimport * as React from \"react\"\nimport { ShowMore } from \"../ShowMore\"\nimport { Flex } from \"../Flex\"\nimport { FilterSelectResultItem } from \"./Components/FilterSelectResultItem\"\nimport {\n FilterSelectContextProvider,\n FilterSelectState,\n Items,\n useFilterSelectContext,\n} from \"./Components/FilterSelectContext\"\nimport { FilterInput } from \"./Components/FilterInput\"\nimport { VisuallyHidden } from \"../VisuallyHidden\"\nimport { Text } from \"../Text\"\nimport { INITIAL_ITEMS_TO_SHOW } from \"../ShowMore\"\nimport { useUpdateEffect } from \"../../utils\"\nimport { Box } from \"../Box\"\nimport { Clickable } from \"../Clickable\"\nimport { Stack } from \"../Stack\"\n\nexport type FilterSelectProps = Partial<FilterSelectState>\n\nexport const FilterSelect: React.FC<\n React.PropsWithChildren<FilterSelectProps>\n> = (props) => {\n return (\n <FilterSelectContextProvider {...props}>\n <_FilterSelect />\n </FilterSelectContextProvider>\n )\n}\n\nconst _FilterSelect: React.FC<React.PropsWithChildren<unknown>> = () => {\n const {\n enableSelectAll,\n filteredItems,\n initialItemsToShow,\n isFiltered,\n items,\n moveSelectedToTop,\n multiselect,\n onChange,\n order,\n query,\n selectedItems,\n } = useFilterSelectContext()\n\n if (!multiselect && enableSelectAll) {\n console.error(\n \"FilterSelect: enableSelectAll is only available with multiselect mode.\"\n )\n }\n\n // Dispatch change event\n useUpdateEffect(() => {\n if (onChange) {\n onChange({\n items,\n filteredItems,\n selectedItems,\n query,\n })\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [onChange, selectedItems])\n\n if (items.length === 0) {\n return null\n }\n\n const orderItems = (items: Items) => orderBy([...items], order[0], order[1])\n const itemsOrdered = orderItems(items)\n const filteredItemsOrdered = orderItems(filteredItems)\n const itemsSorted =\n multiselect && moveSelectedToTop\n ? // Move selected items to the top\n uniqBy(selectedItems.concat(itemsOrdered), (x) => x.value)\n : itemsOrdered\n const expanded = isBelowTheFoldSelected(selectedItems, itemsSorted)\n const showNoResults = filteredItems.length === 0 && query !== \"\"\n const showSelectAll = multiselect && enableSelectAll && !showNoResults\n\n return (\n <Flex flexDirection=\"column\">\n <FilterInput mb={1} />\n\n {query !== \"\" && (\n <VisuallyHidden aria-live=\"polite\">\n {`${filteredItems.length} result${\n filteredItems.length === 1 ? \"\" : \"s\"\n }`}\n </VisuallyHidden>\n )}\n\n {showNoResults && <Text variant=\"sm\">No results.</Text>}\n\n {isFiltered ? (\n <>\n {showSelectAll && <SelectAll />}\n {filteredItemsOrdered.map((item) => (\n <FilterSelectResultItem key={item.value} {...item} />\n ))}\n </>\n ) : (\n <ShowMore\n expanded={expanded}\n initial={initialItemsToShow}\n variant={\"xs\"}\n textDecoration=\"underline\"\n mt={1}\n textAlign=\"left\"\n >\n {itemsSorted.map((item) => {\n return <FilterSelectResultItem key={item.value} {...item} />\n })}\n </ShowMore>\n )}\n </Flex>\n )\n}\n\nexport const isBelowTheFoldSelected = (selectedItems, resultsSorted) => {\n const selected = selectedItems.map(({ value }) => value)\n const results = resultsSorted\n .slice(INITIAL_ITEMS_TO_SHOW)\n .map(({ value }) => value)\n const isSelected = intersection(selected, results).length > 0\n return isSelected\n}\n\nconst SelectAll: React.FC = () => {\n const {\n items,\n filteredItems,\n onSelectAll,\n query,\n selectedItems,\n setSelectedItems,\n } = useFilterSelectContext()\n\n const isClearDisabled = selectedItems.length === 0\n\n return (\n <Box my={1}>\n <Stack gap={2} flexDirection={\"row\"}>\n <Clickable\n data-testid=\"filterSelect-selectAll\"\n className=\"selectAll\"\n onClick={() => {\n setSelectedItems(filteredItems)\n onSelectAll?.({\n items,\n filteredItems,\n selectedItems: filteredItems,\n query,\n })\n }}\n textDecoration=\"underline\"\n >\n <Text variant=\"xs\">Select all</Text>\n </Clickable>\n\n <Clickable\n data-testid=\"filterSelect-clear\"\n className=\"clear\"\n onClick={() => setSelectedItems([])}\n textDecoration=\"underline\"\n disabled={isClearDisabled}\n color={isClearDisabled ? \"mono60\" : \"mono100\"}\n >\n <Text variant=\"xs\">Clear</Text>\n </Clickable>\n </Stack>\n </Box>\n )\n}\n"],"mappings":";;;;;;;AAAA,SAASA,YAAY,EAAEC,OAAO,EAAEC,MAAM,QAAQ,YAAY;AAC1D,OAAO,KAAKC,KAAK,MAAM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O,EAAC;EAAI,GAAC,YAAU,CAAO,CAC1B,eAEZhD,KAAA,CAAAgB,aAAA,CAACJ,SAAS;IACR,eAAY,oBAAoB;IAChC4D,SAAS,EAAC,OAAO;IACjBC,OAAO,EAAE,SAATA,OAAOA,CAAA;MAAA,OAAQL,gBAAgB,CAAC,EAAE,CAAC;IAAA,CAAC;IACpCZ,cAAc,EAAC,WAAW;IAC1BkB,QAAQ,EAAEL,eAAgB;IAC1BM,KAAK,EAAEN,eAAe,GAAG,QAAQ,GAAG;EAAU,gBAE9CrE,KAAA,CAAAgB,aAAA,CAACR,IAAI;IAACwC,OAAO,EAAC;EAAI,GAAC,OAAK,CAAO,CACrB,CACN,CACJ;AAEV,CAAC;AA7CKE,SAAmB,CAAAhC,WAAA"}
|
|
1
|
+
{"version":3,"file":"FilterSelect.js","names":["intersection","orderBy","uniqBy","React","ShowMore","Flex","FilterSelectResultItem","FilterSelectContextProvider","FilterSelectState","Items","useFilterSelectContext","FilterInput","VisuallyHidden","Text","INITIAL_ITEMS_TO_SHOW","useUpdateEffect","Box","Clickable","Stack","FilterSelect","props","createElement","_FilterSelect","displayName","_useFilterSelectConte","enableSelectAll","filteredItems","initialItemsToShow","isFiltered","items","moveSelectedToTop","multiselect","onChange","order","query","selectedItems","console","error","length","orderItems","_toConsumableArray","itemsOrdered","filteredItemsOrdered","itemsSorted","concat","x","value","expanded","isBelowTheFoldSelected","showNoResults","showSelectAll","flexDirection","mb","variant","Fragment","SelectAll","map","item","_extends","key","initial","textDecoration","mt","textAlign","resultsSorted","selected","_ref","results","slice","_ref2","isSelected","_useFilterSelectConte2","onSelectAll","setSelectedItems","isClearDisabled","my","gap","className","onClick","disabled","color"],"sources":["../../../../src/elements/FilterSelect/FilterSelect.tsx"],"sourcesContent":["import { intersection, orderBy, uniqBy } from \"es-toolkit\"\nimport * as React from \"react\"\nimport { ShowMore } from \"../ShowMore\"\nimport { Flex } from \"../Flex\"\nimport { FilterSelectResultItem } from \"./Components/FilterSelectResultItem\"\nimport {\n FilterSelectContextProvider,\n FilterSelectState,\n Items,\n useFilterSelectContext,\n} from \"./Components/FilterSelectContext\"\nimport { FilterInput } from \"./Components/FilterInput\"\nimport { VisuallyHidden } from \"../VisuallyHidden\"\nimport { Text } from \"../Text\"\nimport { INITIAL_ITEMS_TO_SHOW } from \"../ShowMore\"\nimport { useUpdateEffect } from \"../../utils\"\nimport { Box } from \"../Box\"\nimport { Clickable } from \"../Clickable\"\nimport { Stack } from \"../Stack\"\n\nexport type FilterSelectProps = Partial<FilterSelectState>\n\nexport const FilterSelect: React.FC<\n React.PropsWithChildren<FilterSelectProps>\n> = (props) => {\n return (\n <FilterSelectContextProvider {...props}>\n <_FilterSelect />\n </FilterSelectContextProvider>\n )\n}\n\nconst _FilterSelect: React.FC<React.PropsWithChildren<unknown>> = () => {\n const {\n enableSelectAll,\n filteredItems,\n initialItemsToShow,\n isFiltered,\n items,\n moveSelectedToTop,\n multiselect,\n onChange,\n order,\n query,\n selectedItems,\n } = useFilterSelectContext()\n\n if (!multiselect && enableSelectAll) {\n console.error(\n \"FilterSelect: enableSelectAll is only available with multiselect mode.\"\n )\n }\n\n // Dispatch change event\n useUpdateEffect(() => {\n if (onChange) {\n onChange({\n items,\n filteredItems,\n selectedItems,\n query,\n })\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [onChange, selectedItems])\n\n if (items.length === 0) {\n return null\n }\n\n const orderItems = (items: Items) => orderBy([...items], order[0], order[1])\n const itemsOrdered = orderItems(items)\n const filteredItemsOrdered = orderItems(filteredItems)\n const itemsSorted =\n multiselect && moveSelectedToTop\n ? // Move selected items to the top\n uniqBy(selectedItems.concat(itemsOrdered), (x) => x.value)\n : itemsOrdered\n const expanded = isBelowTheFoldSelected(selectedItems, itemsSorted)\n const showNoResults = filteredItems.length === 0 && query !== \"\"\n const showSelectAll = multiselect && enableSelectAll && !showNoResults\n\n return (\n <Flex flexDirection=\"column\">\n <FilterInput mb={1} />\n\n {query !== \"\" && (\n <VisuallyHidden aria-live=\"polite\">\n {`${filteredItems.length} result${\n filteredItems.length === 1 ? \"\" : \"s\"\n }`}\n </VisuallyHidden>\n )}\n\n {showNoResults && <Text variant=\"sm\">No results.</Text>}\n\n {isFiltered ? (\n <>\n {showSelectAll && <SelectAll />}\n {filteredItemsOrdered.map((item) => (\n <FilterSelectResultItem key={item.value} {...item} />\n ))}\n </>\n ) : (\n <ShowMore\n expanded={expanded}\n initial={initialItemsToShow}\n variant={\"xs\"}\n textDecoration=\"underline\"\n mt={1}\n textAlign=\"left\"\n >\n {itemsSorted.map((item) => {\n return <FilterSelectResultItem key={item.value} {...item} />\n })}\n </ShowMore>\n )}\n </Flex>\n )\n}\n\nexport const isBelowTheFoldSelected = (selectedItems, resultsSorted) => {\n const selected = selectedItems.map(({ value }) => value)\n const results = resultsSorted\n .slice(INITIAL_ITEMS_TO_SHOW)\n .map(({ value }) => value)\n const isSelected = intersection(selected, results).length > 0\n return isSelected\n}\n\nconst SelectAll: React.FC = () => {\n const {\n items,\n filteredItems,\n onSelectAll,\n query,\n selectedItems,\n setSelectedItems,\n } = useFilterSelectContext()\n\n const isClearDisabled = selectedItems.length === 0\n\n return (\n <Box my={1}>\n <Stack gap={2} flexDirection={\"row\"}>\n <Clickable\n data-testid=\"filterSelect-selectAll\"\n className=\"selectAll\"\n onClick={() => {\n setSelectedItems(filteredItems)\n onSelectAll?.({\n items,\n filteredItems,\n selectedItems: filteredItems,\n query,\n })\n }}\n textDecoration=\"underline\"\n >\n <Text variant=\"xs\">Select all</Text>\n </Clickable>\n\n <Clickable\n data-testid=\"filterSelect-clear\"\n className=\"clear\"\n onClick={() => setSelectedItems([])}\n textDecoration=\"underline\"\n disabled={isClearDisabled}\n color={isClearDisabled ? \"mono60\" : \"mono100\"}\n >\n <Text variant=\"xs\">Clear</Text>\n </Clickable>\n </Stack>\n </Box>\n )\n}\n"],"mappings":";;;;;;;AAAA,SAASA,YAAY,EAAEC,OAAO,EAAEC,MAAM,QAAQ,YAAY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EAAW,gBAE1B1D,KAAA,CAAAkB,aAAA,CAACR,IAAI;IAACwC,OAAO,EAAC;EAAI,GAAC,YAAU,CAAO,CAC1B,eAEZlD,KAAA,CAAAkB,aAAA,CAACJ,SAAS;IACR,eAAY,oBAAoB;IAChC4D,SAAS,EAAC,OAAO;IACjBC,OAAO,EAAE,SAATA,OAAOA,CAAA;MAAA,OAAQL,gBAAgB,CAAC,EAAE,CAAC;IAAA,CAAC;IACpCZ,cAAc,EAAC,WAAW;IAC1BkB,QAAQ,EAAEL,eAAgB;IAC1BM,KAAK,EAAEN,eAAe,GAAG,QAAQ,GAAG;EAAU,gBAE9CvE,KAAA,CAAAkB,aAAA,CAACR,IAAI;IAACwC,OAAO,EAAC;EAAI,GAAC,OAAK,CAAO,CACrB,CACN,CACJ;AAEV,CAAC;AA7CKE,SAAmB,CAAAhC,WAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { FilterSelectChangeState, Items as FilterSelectItems } from "./Components/FilterSelectContext";
|
|
1
|
+
export { FilterSelectChangeState, Item as FilterSelectItem, Items as FilterSelectItems } from "./Components/FilterSelectContext";
|
|
2
2
|
export * from "./FilterSelect";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["FilterSelectChangeState","Items","FilterSelectItems"],"sources":["../../../../src/elements/FilterSelect/index.tsx"],"sourcesContent":["export {\n FilterSelectChangeState,\n Items as FilterSelectItems,\n} from \"./Components/FilterSelectContext\"\nexport * from \"./FilterSelect\"\n"],"mappings":"AAAA,SACEA,uBAAuB,EACvBC,KAAK,IAAIC,iBAAiB;AAE5B"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["FilterSelectChangeState","Item","FilterSelectItem","Items","FilterSelectItems"],"sources":["../../../../src/elements/FilterSelect/index.tsx"],"sourcesContent":["export {\n FilterSelectChangeState,\n Item as FilterSelectItem,\n Items as FilterSelectItems,\n} from \"./Components/FilterSelectContext\"\nexport * from \"./FilterSelect\"\n"],"mappings":"AAAA,SACEA,uBAAuB,EACvBC,IAAI,IAAIC,gBAAgB,EACxBC,KAAK,IAAIC,iBAAiB;AAE5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Flex.js","names":["styled","Box","Flex","withConfig","displayName","componentId","defaultProps","display"],"sources":["../../../../src/elements/Flex/Flex.tsx"],"sourcesContent":["import styled from \"styled-components\"\nimport { Box, BoxProps } from \"../Box\"\n\n/**\n * Flex is Box with display: flex\n */\nexport type FlexProps = BoxProps\n\n/**\n * Flex is Box with display: flex\n */\nexport const Flex = styled(Box)<FlexProps>``\n\nFlex.defaultProps = {\n display: \"flex\",\n}\n\nFlex.displayName = \"Flex\"\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AACtC,SAASC,GAAG;;
|
|
1
|
+
{"version":3,"file":"Flex.js","names":["styled","Box","BoxProps","Flex","withConfig","displayName","componentId","defaultProps","display"],"sources":["../../../../src/elements/Flex/Flex.tsx"],"sourcesContent":["import styled from \"styled-components\"\nimport { Box, BoxProps } from \"../Box\"\n\n/**\n * Flex is Box with display: flex\n */\nexport type FlexProps = BoxProps\n\n/**\n * Flex is Box with display: flex\n */\nexport const Flex = styled(Box)<FlexProps>``\n\nFlex.defaultProps = {\n display: \"flex\",\n}\n\nFlex.displayName = \"Flex\"\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AACtC,SAASC,GAAG,EAAEC,QAAQ;;AAEtB;AACA;AACA;;AAGA;AACA;AACA;AACA,OAAO,IAAMC,IAAI,GAAGH,MAAM,CAACC,GAAG,CAAC,CAAAG,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,QAAa;AAE5CH,IAAI,CAACI,YAAY,GAAG;EAClBC,OAAO,EAAE;AACX,CAAC;AAEDL,IAAI,CAACE,WAAW,GAAG,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FullBleed.js","names":["styled","Box","FullBleed","withConfig","displayName","componentId","defaultProps","position","left","right","width","maxWidth","marginLeft","marginRight"],"sources":["../../../../src/elements/FullBleed/FullBleed.tsx"],"sourcesContent":["import styled from \"styled-components\"\nimport { Box, BoxProps } from \"../Box\"\n\n/** FullBleedProps */\nexport type FullBleedProps = BoxProps\n\n/**\n * Utility to break out of parent containers\n */\nexport const FullBleed = styled(Box)``\n\nFullBleed.defaultProps = {\n position: \"relative\",\n left: \"50%\",\n right: \"50%\",\n width: \"100vw\",\n maxWidth: \"100vw\",\n marginLeft: \"-50vw\",\n marginRight: \"-50vw\",\n}\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AACtC,SAASC,GAAG;;
|
|
1
|
+
{"version":3,"file":"FullBleed.js","names":["styled","Box","BoxProps","FullBleed","withConfig","displayName","componentId","defaultProps","position","left","right","width","maxWidth","marginLeft","marginRight"],"sources":["../../../../src/elements/FullBleed/FullBleed.tsx"],"sourcesContent":["import styled from \"styled-components\"\nimport { Box, BoxProps } from \"../Box\"\n\n/** FullBleedProps */\nexport type FullBleedProps = BoxProps\n\n/**\n * Utility to break out of parent containers\n */\nexport const FullBleed = styled(Box)``\n\nFullBleed.defaultProps = {\n position: \"relative\",\n left: \"50%\",\n right: \"50%\",\n width: \"100vw\",\n maxWidth: \"100vw\",\n marginLeft: \"-50vw\",\n marginRight: \"-50vw\",\n}\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AACtC,SAASC,GAAG,EAAEC,QAAQ;;AAEtB;;AAGA;AACA;AACA;AACA,OAAO,IAAMC,SAAS,GAAGH,MAAM,CAACC,GAAG,CAAC,CAAAG,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,QAAE;AAEtCH,SAAS,CAACI,YAAY,GAAG;EACvBC,QAAQ,EAAE,UAAU;EACpBC,IAAI,EAAE,KAAK;EACXC,KAAK,EAAE,KAAK;EACZC,KAAK,EAAE,OAAO;EACdC,QAAQ,EAAE,OAAO;EACjBC,UAAU,EAAE,OAAO;EACnBC,WAAW,EAAE;AACf,CAAC"}
|
|
@@ -4,10 +4,10 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
4
4
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
5
|
import React, { useMemo } from "react";
|
|
6
6
|
import styled from "styled-components";
|
|
7
|
-
import { gridColumn } from "styled-system";
|
|
8
|
-
import { Box } from "../Box";
|
|
9
|
-
import { CSSGrid } from "../CSSGrid";
|
|
10
|
-
import { calculateGridColumn, GRID_COLUMN_FULL_WIDTHS } from "./calculateGridColumn";
|
|
7
|
+
import { gridColumn, GridColumnProps } from "styled-system";
|
|
8
|
+
import { Box, BoxProps } from "../Box";
|
|
9
|
+
import { CSSGrid, CSSGridProps } from "../CSSGrid";
|
|
10
|
+
import { calculateGridColumn, ColumnCell, GRID_COLUMN_FULL_WIDTHS } from "./calculateGridColumn";
|
|
11
11
|
|
|
12
12
|
/** GridColumns implements `Box` and the common grid properties */
|
|
13
13
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridColumns.js","names":["React","useMemo","styled","gridColumn","Box","CSSGrid","calculateGridColumn","GRID_COLUMN_FULL_WIDTHS","GridColumns","withConfig","displayName","componentId","defaultProps","gridColumnGap","gridRowGap","Cell","Column","_ref","span","start","wrap","rest","_objectWithoutProperties","_excluded","gridColumnValue","createElement","Fragment","_extends","ColumnWrap","_ref2","display","map","value","includes"],"sources":["../../../../src/elements/GridColumns/GridColumns.tsx"],"sourcesContent":["import React, { useMemo } from \"react\"\nimport styled from \"styled-components\"\nimport { gridColumn, GridColumnProps } from \"styled-system\"\nimport { Box, BoxProps } from \"../Box\"\nimport { CSSGrid, CSSGridProps } from \"../CSSGrid\"\nimport {\n calculateGridColumn,\n ColumnCell,\n GRID_COLUMN_FULL_WIDTHS,\n} from \"./calculateGridColumn\"\n\n/** GridColumns implements `Box` and the common grid properties */\nexport type GridColumnsProps = Omit<CSSGridProps, \"gridTemplateColumns\">\n\n/**\n * A 12-column fluid grid\n */\nexport const GridColumns = styled(CSSGrid)`\n grid-template-columns: repeat(12, 1fr);\n`\n\nGridColumns.defaultProps = {\n gridColumnGap: [1, 2],\n gridRowGap: [1, 2],\n}\n\ntype CellProps = ColumnCell & GridColumnProps & BoxProps\n\nconst Cell = styled(Box)<CellProps>`\n ${gridColumn}\n`\n\n/** Column implements `Box` and `gridColumn` */\nexport type ColumnProps = CellProps & {\n /** denotes whether or not to break to a new row after column */\n wrap?: boolean\n children?: React.ReactNode\n}\n\n/**\n * A column sits within the GridColumns and spans the columns,\n * sitting between gutters.\n */\nexport const Column: React.FC<React.PropsWithChildren<ColumnProps>> = ({\n span,\n start,\n wrap,\n ...rest\n}) => {\n const gridColumnValue = useMemo(() => {\n return calculateGridColumn({ span, start })\n }, [span, start])\n\n return (\n <>\n <Cell gridColumn={gridColumnValue} {...rest} />\n {wrap && <ColumnWrap gridColumnValue={gridColumnValue} />}\n </>\n )\n}\n\nconst ColumnWrap: React.FC<React.PropsWithChildren<{ gridColumnValue: string[] }>> = ({\n gridColumnValue,\n}) => {\n return (\n <Cell\n // Spans the remainder of the columns until the end\n gridColumn={[\"auto / -1\"]}\n // Hides the break if the value presented is going to span the full\n // width of the column anyway. Prevents duplicated row gaps.\n display={gridColumnValue.map((value) => {\n return GRID_COLUMN_FULL_WIDTHS.includes(value) ? \"none\" : \"block\"\n })}\n />\n )\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SAASC,UAAU,
|
|
1
|
+
{"version":3,"file":"GridColumns.js","names":["React","useMemo","styled","gridColumn","GridColumnProps","Box","BoxProps","CSSGrid","CSSGridProps","calculateGridColumn","ColumnCell","GRID_COLUMN_FULL_WIDTHS","GridColumns","withConfig","displayName","componentId","defaultProps","gridColumnGap","gridRowGap","Cell","Column","_ref","span","start","wrap","rest","_objectWithoutProperties","_excluded","gridColumnValue","createElement","Fragment","_extends","ColumnWrap","_ref2","display","map","value","includes"],"sources":["../../../../src/elements/GridColumns/GridColumns.tsx"],"sourcesContent":["import React, { useMemo } from \"react\"\nimport styled from \"styled-components\"\nimport { gridColumn, GridColumnProps } from \"styled-system\"\nimport { Box, BoxProps } from \"../Box\"\nimport { CSSGrid, CSSGridProps } from \"../CSSGrid\"\nimport {\n calculateGridColumn,\n ColumnCell,\n GRID_COLUMN_FULL_WIDTHS,\n} from \"./calculateGridColumn\"\n\n/** GridColumns implements `Box` and the common grid properties */\nexport type GridColumnsProps = Omit<CSSGridProps, \"gridTemplateColumns\">\n\n/**\n * A 12-column fluid grid\n */\nexport const GridColumns = styled(CSSGrid)`\n grid-template-columns: repeat(12, 1fr);\n`\n\nGridColumns.defaultProps = {\n gridColumnGap: [1, 2],\n gridRowGap: [1, 2],\n}\n\ntype CellProps = ColumnCell & GridColumnProps & BoxProps\n\nconst Cell = styled(Box)<CellProps>`\n ${gridColumn}\n`\n\n/** Column implements `Box` and `gridColumn` */\nexport type ColumnProps = CellProps & {\n /** denotes whether or not to break to a new row after column */\n wrap?: boolean\n children?: React.ReactNode\n}\n\n/**\n * A column sits within the GridColumns and spans the columns,\n * sitting between gutters.\n */\nexport const Column: React.FC<React.PropsWithChildren<ColumnProps>> = ({\n span,\n start,\n wrap,\n ...rest\n}) => {\n const gridColumnValue = useMemo(() => {\n return calculateGridColumn({ span, start })\n }, [span, start])\n\n return (\n <>\n <Cell gridColumn={gridColumnValue} {...rest} />\n {wrap && <ColumnWrap gridColumnValue={gridColumnValue} />}\n </>\n )\n}\n\nconst ColumnWrap: React.FC<React.PropsWithChildren<{ gridColumnValue: string[] }>> = ({\n gridColumnValue,\n}) => {\n return (\n <Cell\n // Spans the remainder of the columns until the end\n gridColumn={[\"auto / -1\"]}\n // Hides the break if the value presented is going to span the full\n // width of the column anyway. Prevents duplicated row gaps.\n display={gridColumnValue.map((value) => {\n return GRID_COLUMN_FULL_WIDTHS.includes(value) ? \"none\" : \"block\"\n })}\n />\n )\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SAASC,UAAU,EAAEC,eAAe,QAAQ,eAAe;AAC3D,SAASC,GAAG,EAAEC,QAAQ;AACtB,SAASC,OAAO,EAAEC,YAAY;AAC9B,SACEC,mBAAmB,EACnBC,UAAU,EACVC,uBAAuB;;AAGzB;;AAGA;AACA;AACA;AACA,OAAO,IAAMC,WAAW,GAAGV,MAAM,CAACK,OAAO,CAAC,CAAAM,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,6CAEzC;AAEDH,WAAW,CAACI,YAAY,GAAG;EACzBC,aAAa,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;EACrBC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC;AACnB,CAAC;AAID,IAAMC,IAAI,GAAGjB,MAAM,CAACG,GAAG,CAAC,CAAAQ,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,aACpBZ,UAAU,CACb;;AAED;;AAOA;AACA;AACA;AACA;AACA,OAAO,IAAMiB,MAAsD,GAAG,SAAzDA,MAAsDA,CAAAC,IAAA,EAK7D;EAAA,IAJJC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,IAAI,GAAAH,IAAA,CAAJG,IAAI;IACDC,IAAI,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA;EAEP,IAAMC,eAAe,GAAG3B,OAAO,CAAC,YAAM;IACpC,OAAOQ,mBAAmB,CAAC;MAAEa,IAAI,EAAJA,IAAI;MAAEC,KAAK,EAALA;IAAM,CAAC,CAAC;EAC7C,CAAC,EAAE,CAACD,IAAI,EAAEC,KAAK,CAAC,CAAC;EAEjB,oBACEvB,KAAA,CAAA6B,aAAA,CAAA7B,KAAA,CAAA8B,QAAA,qBACE9B,KAAA,CAAA6B,aAAA,CAACV,IAAI,EAAAY,QAAA;IAAC5B,UAAU,EAAEyB;EAAgB,GAAKH,IAAI,EAAI,EAC9CD,IAAI,iBAAIxB,KAAA,CAAA6B,aAAA,CAACG,UAAU;IAACJ,eAAe,EAAEA;EAAgB,EAAG,CACxD;AAEP,CAAC;AAED,IAAMI,UAA4E,GAAG,SAA/EA,UAA4EA,CAAAC,KAAA,EAE5E;EAAA,IADJL,eAAe,GAAAK,KAAA,CAAfL,eAAe;EAEf,oBACE5B,KAAA,CAAA6B,aAAA,CAACV;EACC;EAAA;IACAhB,UAAU,EAAE,CAAC,WAAW;IACxB;IACA;IAAA;IACA+B,OAAO,EAAEN,eAAe,CAACO,GAAG,CAAC,UAACC,KAAK,EAAK;MACtC,OAAOzB,uBAAuB,CAAC0B,QAAQ,CAACD,KAAK,CAAC,GAAG,MAAM,GAAG,OAAO;IACnE,CAAC;EAAE,EACH;AAEN,CAAC;AAdKJ,UAA4E,CAAAlB,WAAA"}
|
|
@@ -4,9 +4,9 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
4
4
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
5
5
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
6
|
import { themeGet } from "@styled-system/theme-get";
|
|
7
|
-
import React from "react";
|
|
7
|
+
import React, { HTMLAttributes } from "react";
|
|
8
8
|
import styled, { css } from "styled-components";
|
|
9
|
-
import { Text } from "../Text";
|
|
9
|
+
import { Text, TextProps } from "../Text";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* HTML
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HTML.js","names":["themeGet","React","styled","css","Text","htmlMixin","Container","withConfig","displayName","componentId","defaultProps","variant","HTML","props","html","htmlRest","_objectWithoutProperties","_excluded","createElement","_extends","dangerouslySetInnerHTML","__html","children","childrenRest","_excluded2"],"sources":["../../../../src/elements/HTML/HTML.tsx"],"sourcesContent":["import { themeGet } from \"@styled-system/theme-get\"\nimport React, { HTMLAttributes } from \"react\"\nimport styled, { css } from \"styled-components\"\nimport { Text, TextProps } from \"../Text\"\n\n/**\n * HTML\n */\nexport type HTMLProps = TextProps &\n HTMLAttributes<HTMLDivElement | HTMLHeadingElement | HTMLParagraphElement> &\n ({ html: string } | { children: React.ReactNode })\n\n/**\n * Sets reasonable defaults for tags that we might encounter in Markdown output.\n */\nexport const htmlMixin = css`\n h1,\n h2,\n h3,\n h4,\n h5,\n ul,\n ol,\n p,\n blockquote,\n pre,\n hr {\n margin: ${themeGet(\"space.1\")} 0;\n\n &:first-child {\n margin-top: 0;\n }\n\n &:last-child {\n margin-bottom: 0;\n }\n }\n\n hr {\n height: 1px;\n width: 100%;\n border: 0;\n background-color: ${themeGet(\"colors.mono10\")};\n }\n`\n\nconst Container = styled(Text)`\n ${htmlMixin}\n`\n\nContainer.defaultProps = {\n variant: \"sm\",\n}\n\n/**\n * Sets reasonable defaults for tags that we might encounter in Markdown output.\n * If `html` prop is passed; it's set as innerHTML, otherwise contents are wrapped\n * with default HTML styling.\n */\nexport const HTML: React.FC<React.PropsWithChildren<HTMLProps>> = (props) => {\n if (\"html\" in props) {\n const { html, ...htmlRest } = props\n return (\n <Container dangerouslySetInnerHTML={{ __html: html }} {...htmlRest} />\n )\n }\n\n const { children, ...childrenRest } = props\n return <Container {...childrenRest}>{children}</Container>\n}\n\nHTML.displayName = \"HTML\"\n"],"mappings":";;;;;AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,OAAOC,KAAK,
|
|
1
|
+
{"version":3,"file":"HTML.js","names":["themeGet","React","HTMLAttributes","styled","css","Text","TextProps","htmlMixin","Container","withConfig","displayName","componentId","defaultProps","variant","HTML","props","html","htmlRest","_objectWithoutProperties","_excluded","createElement","_extends","dangerouslySetInnerHTML","__html","children","childrenRest","_excluded2"],"sources":["../../../../src/elements/HTML/HTML.tsx"],"sourcesContent":["import { themeGet } from \"@styled-system/theme-get\"\nimport React, { HTMLAttributes } from \"react\"\nimport styled, { css } from \"styled-components\"\nimport { Text, TextProps } from \"../Text\"\n\n/**\n * HTML\n */\nexport type HTMLProps = TextProps &\n HTMLAttributes<HTMLDivElement | HTMLHeadingElement | HTMLParagraphElement> &\n ({ html: string } | { children: React.ReactNode })\n\n/**\n * Sets reasonable defaults for tags that we might encounter in Markdown output.\n */\nexport const htmlMixin = css`\n h1,\n h2,\n h3,\n h4,\n h5,\n ul,\n ol,\n p,\n blockquote,\n pre,\n hr {\n margin: ${themeGet(\"space.1\")} 0;\n\n &:first-child {\n margin-top: 0;\n }\n\n &:last-child {\n margin-bottom: 0;\n }\n }\n\n hr {\n height: 1px;\n width: 100%;\n border: 0;\n background-color: ${themeGet(\"colors.mono10\")};\n }\n`\n\nconst Container = styled(Text)`\n ${htmlMixin}\n`\n\nContainer.defaultProps = {\n variant: \"sm\",\n}\n\n/**\n * Sets reasonable defaults for tags that we might encounter in Markdown output.\n * If `html` prop is passed; it's set as innerHTML, otherwise contents are wrapped\n * with default HTML styling.\n */\nexport const HTML: React.FC<React.PropsWithChildren<HTMLProps>> = (props) => {\n if (\"html\" in props) {\n const { html, ...htmlRest } = props\n return (\n <Container dangerouslySetInnerHTML={{ __html: html }} {...htmlRest} />\n )\n }\n\n const { children, ...childrenRest } = props\n return <Container {...childrenRest}>{children}</Container>\n}\n\nHTML.displayName = \"HTML\"\n"],"mappings":";;;;;AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,OAAOC,KAAK,IAAIC,cAAc,QAAQ,OAAO;AAC7C,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAC/C,SAASC,IAAI,EAAEC,SAAS;;AAExB;AACA;AACA;;AAKA;AACA;AACA;AACA,OAAO,IAAMC,SAAS,GAAGH,GAAG,kLAYdJ,QAAQ,CAAC,SAAS,CAAC,EAeTA,QAAQ,CAAC,eAAe,CAAC,CAEhD;AAED,IAAMQ,SAAS,GAAGL,MAAM,CAACE,IAAI,CAAC,CAAAI,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,aAC1BJ,SAAS,CACZ;AAEDC,SAAS,CAACI,YAAY,GAAG;EACvBC,OAAO,EAAE;AACX,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,IAAkD,GAAG,SAArDA,IAAkDA,CAAIC,KAAK,EAAK;EAC3E,IAAI,MAAM,IAAIA,KAAK,EAAE;IACnB,IAAQC,IAAI,GAAkBD,KAAK,CAA3BC,IAAI;MAAKC,QAAQ,GAAAC,wBAAA,CAAKH,KAAK,EAAAI,SAAA;IACnC,oBACElB,KAAA,CAAAmB,aAAA,CAACZ,SAAS,EAAAa,QAAA;MAACC,uBAAuB,EAAE;QAAEC,MAAM,EAAEP;MAAK;IAAE,GAAKC,QAAQ,EAAI;EAE1E;EAEA,IAAQO,QAAQ,GAAsBT,KAAK,CAAnCS,QAAQ;IAAKC,YAAY,GAAAP,wBAAA,CAAKH,KAAK,EAAAW,UAAA;EAC3C,oBAAOzB,KAAA,CAAAmB,aAAA,CAACZ,SAAS,EAAKiB,YAAY,EAAGD,QAAQ,CAAa;AAC5D,CAAC;AAVYV,IAAkD,CAAAJ,WAAA;AAY/DI,IAAI,CAACJ,WAAW,GAAG,MAAM"}
|
|
@@ -13,10 +13,10 @@ import composeRefs from "@seznam/compose-react-refs";
|
|
|
13
13
|
import { themeGet } from "@styled-system/theme-get";
|
|
14
14
|
import React, { forwardRef, useEffect, useRef, useState } from "react";
|
|
15
15
|
import styled from "styled-components";
|
|
16
|
-
import { border, compose, justifyContent, padding } from "styled-system";
|
|
16
|
+
import { border, BorderProps, compose, justifyContent, JustifyContentProps, padding, PaddingProps } from "styled-system";
|
|
17
17
|
import { visuallyDisableScrollbar } from "../../helpers/visuallyDisableScrollbar";
|
|
18
18
|
import { splitProps } from "../../utils/splitProps";
|
|
19
|
-
import { Box } from "../Box";
|
|
19
|
+
import { Box, BoxProps } from "../Box";
|
|
20
20
|
var splitRailProps = splitProps(compose(padding, justifyContent, border));
|
|
21
21
|
var Overlay = styled(Box).withConfig({
|
|
22
22
|
displayName: "HorizontalOverflow__Overlay",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HorizontalOverflow.js","names":["composeRefs","themeGet","React","forwardRef","useEffect","useRef","useState","styled","border","compose","justifyContent","padding","visuallyDisableScrollbar","splitProps","Box","splitRailProps","Overlay","withConfig","displayName","componentId","_ref2","atEnd","Viewport","Rail","HorizontalOverflow","_ref3","forwardedRef","children","rest","_objectWithoutProperties","_excluded","ref","updateAtEnd","window","addEventListener","removeEventListener","_splitRailProps","_splitRailProps2","_slicedToArray","railProps","_splitRailProps2$","_ref","boxProps","_excluded2","_useState","_useState2","setAtEnd","current","_ref$current","scrollLeft","scrollWidth","clientWidth","Math","abs","createElement","_extends","onScroll","display","verticalAlign"],"sources":["../../../../src/elements/HorizontalOverflow/HorizontalOverflow.tsx"],"sourcesContent":["import composeRefs from \"@seznam/compose-react-refs\"\nimport { themeGet } from \"@styled-system/theme-get\"\nimport React, { forwardRef, useEffect, useRef, useState } from \"react\"\nimport styled from \"styled-components\"\nimport {\n border,\n BorderProps,\n compose,\n justifyContent,\n JustifyContentProps,\n padding,\n PaddingProps,\n} from \"styled-system\"\nimport { visuallyDisableScrollbar } from \"../../helpers/visuallyDisableScrollbar\"\nimport { splitProps } from \"../../utils/splitProps\"\nimport { Box, BoxProps } from \"../Box\"\n\nconst splitRailProps = splitProps<\n PaddingProps & JustifyContentProps & BorderProps\n>(compose(padding, justifyContent, border))\n\nconst Overlay = styled(Box)<{ atEnd: boolean }>`\n position: relative;\n\n /* Fade-out gradient */\n &::after {\n display: block;\n content: \"\";\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n width: ${themeGet(\"space.6\")};\n z-index: 1;\n pointer-events: none;\n background: ${themeGet(\"effects.fadeRight\")};\n /* Hide when scrolled all the way over */\n transition: opacity 250ms;\n opacity: ${({ atEnd }) => (atEnd ? 0 : 1)};\n }\n`\n\nconst Viewport = styled(Box)`\n height: 100%;\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n ${visuallyDisableScrollbar}\n`\n\nconst Rail = styled(Box)`\n white-space: nowrap;\n min-width: 100%;\n height: 100%;\n`\n\nexport type HorizontalOverflowProps = BoxProps & { children: React.ReactNode }\n\nexport const HorizontalOverflow = forwardRef<\n HTMLDivElement,\n HorizontalOverflowProps\n>(({ children, ...rest }, forwardedRef) => {\n const ref = useRef<HTMLDivElement | null>()\n\n useEffect(() => {\n updateAtEnd()\n window.addEventListener(\"resize\", updateAtEnd)\n return () => {\n window.removeEventListener(\"resize\", updateAtEnd)\n }\n }, [])\n\n // FIXME: REACT_18_UPGRADE\n // @ts-ignore\n const [railProps, { ref: _ref, ...boxProps }] = splitRailProps(rest)\n\n const [atEnd, setAtEnd] = useState(false)\n\n const updateAtEnd = () => {\n if (!ref.current) return\n\n const {\n current: { scrollLeft, scrollWidth, clientWidth },\n } = ref\n\n // Check if we're at the end of the scroll (within 1px)\n if (Math.abs(scrollLeft + clientWidth - scrollWidth) <= 1) {\n setAtEnd(true)\n return\n }\n\n setAtEnd(false)\n }\n\n return (\n <Overlay atEnd={atEnd} {...boxProps}>\n <Viewport\n ref={composeRefs(ref, forwardedRef) as any}\n onScroll={updateAtEnd}\n >\n <Rail display=\"inline-flex\" verticalAlign=\"top\" {...railProps}>\n {children}\n </Rail>\n </Viewport>\n </Overlay>\n )\n})\n\nHorizontalOverflow.displayName = \"HorizontalOverflow\"\n"],"mappings":";;;;;;;;;;;AAAA,OAAOA,WAAW,MAAM,4BAA4B;AACpD,SAASC,QAAQ,QAAQ,0BAA0B;AACnD,OAAOC,KAAK,IAAIC,UAAU,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACtE,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SACEC,MAAM,
|
|
1
|
+
{"version":3,"file":"HorizontalOverflow.js","names":["composeRefs","themeGet","React","forwardRef","useEffect","useRef","useState","styled","border","BorderProps","compose","justifyContent","JustifyContentProps","padding","PaddingProps","visuallyDisableScrollbar","splitProps","Box","BoxProps","splitRailProps","Overlay","withConfig","displayName","componentId","_ref2","atEnd","Viewport","Rail","HorizontalOverflow","_ref3","forwardedRef","children","rest","_objectWithoutProperties","_excluded","ref","updateAtEnd","window","addEventListener","removeEventListener","_splitRailProps","_splitRailProps2","_slicedToArray","railProps","_splitRailProps2$","_ref","boxProps","_excluded2","_useState","_useState2","setAtEnd","current","_ref$current","scrollLeft","scrollWidth","clientWidth","Math","abs","createElement","_extends","onScroll","display","verticalAlign"],"sources":["../../../../src/elements/HorizontalOverflow/HorizontalOverflow.tsx"],"sourcesContent":["import composeRefs from \"@seznam/compose-react-refs\"\nimport { themeGet } from \"@styled-system/theme-get\"\nimport React, { forwardRef, useEffect, useRef, useState } from \"react\"\nimport styled from \"styled-components\"\nimport {\n border,\n BorderProps,\n compose,\n justifyContent,\n JustifyContentProps,\n padding,\n PaddingProps,\n} from \"styled-system\"\nimport { visuallyDisableScrollbar } from \"../../helpers/visuallyDisableScrollbar\"\nimport { splitProps } from \"../../utils/splitProps\"\nimport { Box, BoxProps } from \"../Box\"\n\nconst splitRailProps = splitProps<\n PaddingProps & JustifyContentProps & BorderProps\n>(compose(padding, justifyContent, border))\n\nconst Overlay = styled(Box)<{ atEnd: boolean }>`\n position: relative;\n\n /* Fade-out gradient */\n &::after {\n display: block;\n content: \"\";\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n width: ${themeGet(\"space.6\")};\n z-index: 1;\n pointer-events: none;\n background: ${themeGet(\"effects.fadeRight\")};\n /* Hide when scrolled all the way over */\n transition: opacity 250ms;\n opacity: ${({ atEnd }) => (atEnd ? 0 : 1)};\n }\n`\n\nconst Viewport = styled(Box)`\n height: 100%;\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n ${visuallyDisableScrollbar}\n`\n\nconst Rail = styled(Box)`\n white-space: nowrap;\n min-width: 100%;\n height: 100%;\n`\n\nexport type HorizontalOverflowProps = BoxProps & { children: React.ReactNode }\n\nexport const HorizontalOverflow = forwardRef<\n HTMLDivElement,\n HorizontalOverflowProps\n>(({ children, ...rest }, forwardedRef) => {\n const ref = useRef<HTMLDivElement | null>()\n\n useEffect(() => {\n updateAtEnd()\n window.addEventListener(\"resize\", updateAtEnd)\n return () => {\n window.removeEventListener(\"resize\", updateAtEnd)\n }\n }, [])\n\n // FIXME: REACT_18_UPGRADE\n // @ts-ignore\n const [railProps, { ref: _ref, ...boxProps }] = splitRailProps(rest)\n\n const [atEnd, setAtEnd] = useState(false)\n\n const updateAtEnd = () => {\n if (!ref.current) return\n\n const {\n current: { scrollLeft, scrollWidth, clientWidth },\n } = ref\n\n // Check if we're at the end of the scroll (within 1px)\n if (Math.abs(scrollLeft + clientWidth - scrollWidth) <= 1) {\n setAtEnd(true)\n return\n }\n\n setAtEnd(false)\n }\n\n return (\n <Overlay atEnd={atEnd} {...boxProps}>\n <Viewport\n ref={composeRefs(ref, forwardedRef) as any}\n onScroll={updateAtEnd}\n >\n <Rail display=\"inline-flex\" verticalAlign=\"top\" {...railProps}>\n {children}\n </Rail>\n </Viewport>\n </Overlay>\n )\n})\n\nHorizontalOverflow.displayName = \"HorizontalOverflow\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AChC,QAAQ;IACPS,GAAG,EAAEnC,WAAW,CAACmC,GAAG,EAAEL,YAAY,CAAS;IAC3C8B,QAAQ,EAAExB;EAAY,gBAEtBlC,KAAA,CAAAwD,aAAA,CAAC/B,IAAI,EAAAgC,QAAA;IAACE,OAAO,EAAC,aAAa;IAACC,aAAa,EAAC;EAAK,GAAKnB,SAAS,GAC1DZ,QAAQ,CACJ,CACE,CACH;AAEd,CAAC,CAAC;AAEFH,kBAAkB,CAACN,WAAW,GAAG,oBAAoB"}
|
|
@@ -15,7 +15,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
15
15
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
16
16
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
17
17
|
import React, { useState, useRef, useEffect } from "react";
|
|
18
|
-
import { Box, splitBoxProps } from "../Box";
|
|
18
|
+
import { Box, BoxProps, splitBoxProps } from "../Box";
|
|
19
19
|
import styled from "styled-components";
|
|
20
20
|
import isPropValid from "@emotion/is-prop-valid";
|
|
21
21
|
export var Image = function Image(_ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.js","names":["React","useState","useRef","useEffect","Box","splitBoxProps","styled","isPropValid","Image","_ref","className","height","_ref$lazyLoad","lazyLoad","onLoad","placeHolderURL","_ref$preventRightClic","preventRightClick","style","width","rest","_objectWithoutProperties","_excluded","_useState","_useState2","_slicedToArray","mode","setMode","imageRef","_imageRef$current","current","complete","_splitBoxProps","_splitBoxProps2","boxProps","imageProps","commonImgProps","_objectSpread","ref","loading","undefined","event","onContextMenu","e","preventDefault","lazyLoadStyle","transition","opacity","createElement","_extends","position","bg","backgroundImage","concat","backgroundSize","backgroundPosition","Img","as","top","left","display","displayName","withConfig","shouldForwardProp","prop","componentId"],"sources":["../../../../src/elements/Image/Image.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect } from \"react\"\nimport { Box, BoxProps, splitBoxProps } from \"../Box\"\nimport styled from \"styled-components\"\nimport isPropValid from \"@emotion/is-prop-valid\"\n\nexport interface ImageProps\n extends Omit<React.ImgHTMLAttributes<HTMLImageElement>, \"width\" | \"height\">,\n BoxProps {\n /** Flag for if image should be lazy loaded */\n lazyLoad?: boolean\n /** Flag indicating that right clicks should be prevented */\n preventRightClick?: boolean\n /** Currently, this is used by clients for BlurHash data,\n decoded and represented as a data URL */\n placeHolderURL?: string\n}\n\nexport const Image: React.FC<ImageProps> = ({\n className,\n height,\n lazyLoad = false,\n onLoad,\n placeHolderURL,\n preventRightClick = false,\n style,\n width,\n ...rest\n}) => {\n const [mode, setMode] = useState<\"Pending\" | \"Ready\">(\"Pending\")\n const imageRef = useRef<HTMLImageElement>(null)\n\n useEffect(() => {\n if (imageRef.current?.complete) {\n setMode(\"Ready\")\n }\n }, [])\n\n const [boxProps, imageProps] = splitBoxProps(rest)\n\n // Common image props\n const commonImgProps = {\n ref: imageRef as any,\n loading: lazyLoad ? (\"lazy\" as const) : undefined,\n onLoad: (event: React.SyntheticEvent<HTMLImageElement, Event>) => {\n setMode(\"Ready\")\n onLoad?.(event)\n },\n onContextMenu: preventRightClick ? (e) => e.preventDefault() : undefined,\n ...imageProps,\n }\n\n // Common lazy loading style\n const lazyLoadStyle = lazyLoad\n ? {\n transition: \"opacity 0.2s ease-in-out\",\n opacity: mode === \"Ready\" ? 1 : 0,\n }\n : {}\n\n // If there's a placeholder URL or lazy loading is enabled, use a wrapper container\n if (placeHolderURL || lazyLoad) {\n return (\n <Box\n className={className}\n position=\"relative\"\n width={width || \"100%\"}\n height={height || \"100%\"}\n bg={lazyLoad && !placeHolderURL ? \"mono10\" : undefined}\n {...boxProps}\n style={{\n ...(placeHolderURL && {\n backgroundImage: `url(${placeHolderURL})`,\n backgroundSize: \"cover\",\n backgroundPosition: \"center\",\n }),\n }}\n >\n <Img\n as=\"img\"\n position=\"absolute\"\n top={0}\n left={0}\n width=\"100%\"\n height=\"100%\"\n display=\"block\"\n style={{ ...lazyLoadStyle, ...style }}\n {...commonImgProps}\n />\n </Box>\n )\n }\n\n // If no placeholder and no lazy loading, render a direct img element\n return (\n <Img\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n as=\"img\"\n className={className}\n width={width}\n height={height}\n display=\"block\"\n style={style}\n {...boxProps}\n {...commonImgProps}\n />\n )\n}\n\n// Can be removed when styled-components is updated in Force\n// https://github.com/emotion-js/emotion/blob/b882bcba85132554992e4bd49e94c95939bbf810/packages/is-prop-valid/CHANGELOG.md#patch-changes\nconst Img = styled(Box).withConfig({\n shouldForwardProp: (prop) => isPropValid(prop) || prop === \"fetchPriority\",\n})``\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,MAAM,EAAEC,SAAS,QAAQ,OAAO;AAC1D,SAASC,GAAG,
|
|
1
|
+
{"version":3,"file":"Image.js","names":["React","useState","useRef","useEffect","Box","BoxProps","splitBoxProps","styled","isPropValid","Image","_ref","className","height","_ref$lazyLoad","lazyLoad","onLoad","placeHolderURL","_ref$preventRightClic","preventRightClick","style","width","rest","_objectWithoutProperties","_excluded","_useState","_useState2","_slicedToArray","mode","setMode","imageRef","_imageRef$current","current","complete","_splitBoxProps","_splitBoxProps2","boxProps","imageProps","commonImgProps","_objectSpread","ref","loading","undefined","event","onContextMenu","e","preventDefault","lazyLoadStyle","transition","opacity","createElement","_extends","position","bg","backgroundImage","concat","backgroundSize","backgroundPosition","Img","as","top","left","display","displayName","withConfig","shouldForwardProp","prop","componentId"],"sources":["../../../../src/elements/Image/Image.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect } from \"react\"\nimport { Box, BoxProps, splitBoxProps } from \"../Box\"\nimport styled from \"styled-components\"\nimport isPropValid from \"@emotion/is-prop-valid\"\n\nexport interface ImageProps\n extends Omit<React.ImgHTMLAttributes<HTMLImageElement>, \"width\" | \"height\">,\n BoxProps {\n /** Flag for if image should be lazy loaded */\n lazyLoad?: boolean\n /** Flag indicating that right clicks should be prevented */\n preventRightClick?: boolean\n /** Currently, this is used by clients for BlurHash data,\n decoded and represented as a data URL */\n placeHolderURL?: string\n}\n\nexport const Image: React.FC<ImageProps> = ({\n className,\n height,\n lazyLoad = false,\n onLoad,\n placeHolderURL,\n preventRightClick = false,\n style,\n width,\n ...rest\n}) => {\n const [mode, setMode] = useState<\"Pending\" | \"Ready\">(\"Pending\")\n const imageRef = useRef<HTMLImageElement>(null)\n\n useEffect(() => {\n if (imageRef.current?.complete) {\n setMode(\"Ready\")\n }\n }, [])\n\n const [boxProps, imageProps] = splitBoxProps(rest)\n\n // Common image props\n const commonImgProps = {\n ref: imageRef as any,\n loading: lazyLoad ? (\"lazy\" as const) : undefined,\n onLoad: (event: React.SyntheticEvent<HTMLImageElement, Event>) => {\n setMode(\"Ready\")\n onLoad?.(event)\n },\n onContextMenu: preventRightClick ? (e) => e.preventDefault() : undefined,\n ...imageProps,\n }\n\n // Common lazy loading style\n const lazyLoadStyle = lazyLoad\n ? {\n transition: \"opacity 0.2s ease-in-out\",\n opacity: mode === \"Ready\" ? 1 : 0,\n }\n : {}\n\n // If there's a placeholder URL or lazy loading is enabled, use a wrapper container\n if (placeHolderURL || lazyLoad) {\n return (\n <Box\n className={className}\n position=\"relative\"\n width={width || \"100%\"}\n height={height || \"100%\"}\n bg={lazyLoad && !placeHolderURL ? \"mono10\" : undefined}\n {...boxProps}\n style={{\n ...(placeHolderURL && {\n backgroundImage: `url(${placeHolderURL})`,\n backgroundSize: \"cover\",\n backgroundPosition: \"center\",\n }),\n }}\n >\n <Img\n as=\"img\"\n position=\"absolute\"\n top={0}\n left={0}\n width=\"100%\"\n height=\"100%\"\n display=\"block\"\n style={{ ...lazyLoadStyle, ...style }}\n {...commonImgProps}\n />\n </Box>\n )\n }\n\n // If no placeholder and no lazy loading, render a direct img element\n return (\n <Img\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n as=\"img\"\n className={className}\n width={width}\n height={height}\n display=\"block\"\n style={style}\n {...boxProps}\n {...commonImgProps}\n />\n )\n}\n\n// Can be removed when styled-components is updated in Force\n// https://github.com/emotion-js/emotion/blob/b882bcba85132554992e4bd49e94c95939bbf810/packages/is-prop-valid/CHANGELOG.md#patch-changes\nconst Img = styled(Box).withConfig({\n shouldForwardProp: (prop) => isPropValid(prop) || prop === \"fetchPriority\",\n})``\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,MAAM,EAAEC,SAAS,QAAQ,OAAO;AAC1D,SAASC,GAAG,EAAEC,QAAQ,EAAEC,aAAa;AACrC,OAAOC,MAAM,MAAM,mBAAmB;AACtC,OAAOC,WAAW,MAAM,wBAAwB;AAchD,OAAO,IAAMC,KAA2B,GAAG,SAA9BA,KAA2BA,CAAAC,IAAA,EAUlC;EAAA,IATJC,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTC,MAAM,GAAAF,IAAA,CAANE,MAAM;IAAAC,aAAA,GAAAH,IAAA,CACNI,QAAQ;IAARA,QAAQ,GAAAD,aAAA,cAAG,KAAK,GAAAA,aAAA;IAChBE,OAAM,GAAAL,IAAA,CAANK,MAAM;IACNC,cAAc,GAAAN,IAAA,CAAdM,cAAc;IAAAC,qBAAA,GAAAP,IAAA,CACdQ,iBAAiB;IAAjBA,iBAAiB,GAAAD,qBAAA,cAAG,KAAK,GAAAA,qBAAA;IACzBE,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U,CAAC;EACjCC,iBAAiB,EAAE,SAAnBA,iBAAiBA,CAAGC,IAAI;IAAA,OAAKzD,WAAW,CAACyD,IAAI,CAAC,IAAIA,IAAI,KAAK,eAAe;EAAA;AAC5E,CAAC,CAAC,CAAAF,UAAA;EAAAD,WAAA;EAAAI,WAAA;AAAA,QAAE"}
|
|
@@ -13,7 +13,7 @@ import React, { useCallback } from "react";
|
|
|
13
13
|
import styled, { css } from "styled-components";
|
|
14
14
|
import { height as systemHeight } from "styled-system";
|
|
15
15
|
import { RequiredField } from "../../shared/RequiredField";
|
|
16
|
-
import { Box, splitBoxProps } from "../Box";
|
|
16
|
+
import { Box, BoxProps, splitBoxProps } from "../Box";
|
|
17
17
|
import { Text } from "../Text";
|
|
18
18
|
import { Tooltip } from "../Tooltip";
|
|
19
19
|
import { INPUT_STATES } from "./tokens";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","names":["themeGet","React","useCallback","styled","css","height","systemHeight","RequiredField","Box","splitBoxProps","Text","Tooltip","INPUT_STATES","FORM_ELEMENT_TRANSITION","Input","forwardRef","_ref","ref","children","className","description","disabled","error","required","focus","hover","title","labelOffset","showCounter","_ref$defaultValue","defaultValue","onChange","rest","_objectWithoutProperties","_excluded","_splitBoxProps","_splitBoxProps2","_slicedToArray","boxProps","inputProps","_React$useState","useState","value","_React$useState2","setValue","handleChange","event","nextValue","currentTarget","createElement","_extends","width","pointer","content","placement","variant","color","textAlign","position","mt","StyledInput","name","undefined","placeholder","StyledLabel","htmlFor","maxLength","display","mx","flex","String","length","ml","displayName","input","withConfig","componentId","props","default","active","completed","label","_ref2"],"sources":["../../../../src/elements/Input/Input.tsx"],"sourcesContent":["import { themeGet } from \"@styled-system/theme-get\"\nimport React, { useCallback } from \"react\"\nimport styled, { css } from \"styled-components\"\nimport { height as systemHeight } from \"styled-system\"\nimport { RequiredField } from \"../../shared/RequiredField\"\nimport { Box, BoxProps, splitBoxProps } from \"../Box\"\nimport { Text } from \"../Text\"\nimport { Tooltip } from \"../Tooltip\"\nimport { INPUT_STATES } from \"./tokens\"\nimport { FORM_ELEMENT_TRANSITION } from \"../../helpers\"\n\nexport interface InputProps\n extends BoxProps,\n Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n \"size\" | \"width\" | \"height\" | \"capture\"\n > {\n active?: boolean\n description?: string\n disabled?: boolean\n error?: string | boolean\n focus?: boolean\n hover?: boolean\n required?: boolean\n title?: string\n labelOffset?: number\n showCounter?: boolean\n}\n\n/** Input component */\nexport const Input = React.forwardRef<HTMLInputElement, InputProps>(\n (\n {\n children,\n className,\n description,\n disabled,\n error,\n required,\n focus,\n hover,\n title,\n height,\n labelOffset,\n showCounter,\n defaultValue = \"\",\n onChange,\n ...rest\n },\n ref\n ) => {\n const [boxProps, inputProps] = splitBoxProps(rest)\n const [value, setValue] = React.useState(inputProps.value || defaultValue)\n\n const handleChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const nextValue = event.currentTarget.value\n setValue(nextValue)\n onChange?.(event)\n },\n [onChange]\n )\n\n return (\n <Box width=\"100%\" className={className} {...boxProps}>\n {!!description && (\n <Tooltip pointer content={description} placement=\"top-end\">\n <Text variant=\"xs\" color=\"mono60\" textAlign=\"right\">\n <u>What is this?</u>\n </Text>\n </Tooltip>\n )}\n\n <Box position=\"relative\" mt={!!title && !description ? 1 : 0}>\n <StyledInput\n ref={ref as any}\n disabled={disabled}\n focus={focus}\n hover={hover}\n error={!!error}\n required={required}\n height={(height ?? 50) as any}\n name={inputProps.name}\n title={title}\n labelOffset={labelOffset}\n defaultValue={defaultValue || undefined}\n onChange={handleChange}\n placeholder={inputProps.placeholder || \" \"}\n {...inputProps}\n />\n\n {!!title && (\n <StyledLabel labelOffset={labelOffset} htmlFor={inputProps.name}>\n {title}\n <span />\n </StyledLabel>\n )}\n\n {children}\n </Box>\n\n {(required || (inputProps?.maxLength && showCounter)) &&\n !(error && typeof error === \"string\") && (\n <Box display=\"flex\" mt={0.5} mx={1}>\n {required && <RequiredField disabled={disabled} flex={1} />}\n\n {!!inputProps?.maxLength && showCounter && (\n <Text flex={1} variant=\"xs\" color=\"mono60\" textAlign=\"right\">\n {String(value).length}/{inputProps.maxLength}\n </Text>\n )}\n </Box>\n )}\n\n {error && typeof error === \"string\" && (\n <Text variant=\"xs\" mt={0.5} ml={1} color=\"red100\">\n {error}\n </Text>\n )}\n </Box>\n )\n }\n)\n\nInput.displayName = \"Input\"\n\ntype StyledInputProps = Pick<\n InputProps,\n \"disabled\" | \"error\" | \"hover\" | \"focus\" | \"active\" | \"title\" | \"labelOffset\"\n>\n\nconst StyledInput = styled.input<StyledInputProps>`\n width: 100%;\n padding: 0 ${themeGet(\"space.1\")};\n appearance: none;\n line-height: 1;\n border: 1px solid;\n border-radius: 3px;\n transition: border-color 0.25s, color 0.25s;\n font-family: ${themeGet(\"fonts.sans\")};\n ${systemHeight};\n\n ::placeholder {\n transition: color 0.25s, opacity 0.25s;\n }\n\n ${(props) => {\n return css`\n ${INPUT_STATES.default}\n ${props.hover && INPUT_STATES.hover}\n ${props.focus && INPUT_STATES.focus}\n ${props.active && INPUT_STATES.active}\n ${props.disabled && INPUT_STATES.disabled}\n ${props.error && INPUT_STATES.error}\n\n &:hover {\n ${INPUT_STATES.hover}\n }\n\n &:not(:placeholder-shown) {\n ${INPUT_STATES.completed}\n ${props.error && INPUT_STATES.error}\n }\n\n &:focus {\n outline: none;\n ${INPUT_STATES.focus}\n\n &::placeholder {\n transition: ${FORM_ELEMENT_TRANSITION};\n opacity: 1;\n }\n\n :not(:placeholder-shown) {\n ${INPUT_STATES.active}\n ${props.error && INPUT_STATES.error}\n }\n }\n\n &:disabled {\n cursor: default;\n ${INPUT_STATES.disabled}\n }\n\n ${props.title &&\n css`\n &::placeholder {\n transition: ${FORM_ELEMENT_TRANSITION};\n opacity: 0;\n }\n `}\n `\n }};\n`\n\nconst StyledLabel = styled.label<StyledInputProps>`\n position: absolute;\n top: 50%;\n left: 5px;\n padding: 0 5px;\n background-color: transparent;\n transform: translateY(-50%);\n transition: ${FORM_ELEMENT_TRANSITION};\n transition-property: color, transform, padding, font-size;\n font-family: ${themeGet(\"fonts.sans\")};\n pointer-events: none;\n\n & > span {\n background-color: ${themeGet(\"colors.mono0\")};\n height: 100%;\n width: 100%;\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n z-index: -1;\n transition: ${FORM_ELEMENT_TRANSITION};\n transition-property: height, top;\n transition-delay: 0.1s;\n }\n\n ${({ labelOffset }) =>\n !!labelOffset &&\n css`\n padding-left: ${labelOffset - 5}px;\n `}\n`\n"],"mappings":";;;;;;;;;;AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,OAAOC,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAC1C,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAC/C,SAASC,MAAM,IAAIC,YAAY,QAAQ,eAAe;AACtD,SAASC,aAAa;AACtB,SAASC,GAAG,EAAYC,aAAa;AACrC,SAASC,IAAI;AACb,SAASC,OAAO;AAChB,SAASC,YAAY;AACrB,SAASC,uBAAuB;AAoBhC;AACA,OAAO,IAAMC,KAAK,gBAAGb,KAAK,CAACc,UAAU,CACnC,UAAAC,IAAA,EAkBEC,GAAG,EACA;EAAA,IAjBDC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,WAAW,GAAAJ,IAAA,CAAXI,WAAW;IACXC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IACRC,KAAK,GAAAN,IAAA,CAALM,KAAK;IACLC,QAAQ,GAAAP,IAAA,CAARO,QAAQ;IACRC,KAAK,GAAAR,IAAA,CAALQ,KAAK;IACLC,KAAK,GAAAT,IAAA,CAALS,KAAK;IACLC,KAAK,GAAAV,IAAA,CAALU,KAAK;IACLrB,MAAM,GAAAW,IAAA,CAANX,MAAM;IACNsB,WAAW,GAAAX,IAAA,CAAXW,WAAW;IACXC,WAAW,GAA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tBH,KAAK,CAACvD,KAAK,IAAIV,YAAY,CAACU,KAAK,EAKjCV,YAAY,CAACY,KAAK,EAGJX,uBAAuB,EAKnCD,YAAY,CAACmE,MAAM,EACnBF,KAAK,CAACvD,KAAK,IAAIV,YAAY,CAACU,KAAK,EAMnCV,YAAY,CAACS,QAAQ,EAGvBwD,KAAK,CAACnD,KAAK,IACbtB,GAAG,iDAEeS,uBAAuB,CAGxC;AAEL,CAAC,CACF;AAED,IAAMmD,WAAW,GAAG7D,MAAM,CAAC8E,KAAK,CAAAN,UAAA;EAAAF,WAAA;EAAAG,WAAA;AAAA,qZAOhB/D,uBAAuB,EAEtBb,QAAQ,CAAC,YAAY,CAAC,EAIfA,QAAQ,CAAC,cAAc,CAAC,EAQ9Ba,uBAAuB,EAKrC,UAAAqE,KAAA;EAAA,IAAGvD,WAAW,GAAAuD,KAAA,CAAXvD,WAAW;EAAA,OACd,CAAC,CAACA,WAAW,IACbvB,GAAG,2BACeuB,WAAW,GAAG,CAAC,CAChC;AAAA,EACJ"}
|
|
1
|
+
{"version":3,"file":"Input.js","names":["themeGet","React","useCallback","styled","css","height","systemHeight","RequiredField","Box","BoxProps","splitBoxProps","Text","Tooltip","INPUT_STATES","FORM_ELEMENT_TRANSITION","Input","forwardRef","_ref","ref","children","className","description","disabled","error","required","focus","hover","title","labelOffset","showCounter","_ref$defaultValue","defaultValue","onChange","rest","_objectWithoutProperties","_excluded","_splitBoxProps","_splitBoxProps2","_slicedToArray","boxProps","inputProps","_React$useState","useState","value","_React$useState2","setValue","handleChange","event","nextValue","currentTarget","createElement","_extends","width","pointer","content","placement","variant","color","textAlign","position","mt","StyledInput","name","undefined","placeholder","StyledLabel","htmlFor","maxLength","display","mx","flex","String","length","ml","displayName","input","withConfig","componentId","props","default","active","completed","label","_ref2"],"sources":["../../../../src/elements/Input/Input.tsx"],"sourcesContent":["import { themeGet } from \"@styled-system/theme-get\"\nimport React, { useCallback } from \"react\"\nimport styled, { css } from \"styled-components\"\nimport { height as systemHeight } from \"styled-system\"\nimport { RequiredField } from \"../../shared/RequiredField\"\nimport { Box, BoxProps, splitBoxProps } from \"../Box\"\nimport { Text } from \"../Text\"\nimport { Tooltip } from \"../Tooltip\"\nimport { INPUT_STATES } from \"./tokens\"\nimport { FORM_ELEMENT_TRANSITION } from \"../../helpers\"\n\nexport interface InputProps\n extends BoxProps,\n Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n \"size\" | \"width\" | \"height\" | \"capture\"\n > {\n active?: boolean\n description?: string\n disabled?: boolean\n error?: string | boolean\n focus?: boolean\n hover?: boolean\n required?: boolean\n title?: string\n labelOffset?: number\n showCounter?: boolean\n}\n\n/** Input component */\nexport const Input = React.forwardRef<HTMLInputElement, InputProps>(\n (\n {\n children,\n className,\n description,\n disabled,\n error,\n required,\n focus,\n hover,\n title,\n height,\n labelOffset,\n showCounter,\n defaultValue = \"\",\n onChange,\n ...rest\n },\n ref\n ) => {\n const [boxProps, inputProps] = splitBoxProps(rest)\n const [value, setValue] = React.useState(inputProps.value || defaultValue)\n\n const handleChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const nextValue = event.currentTarget.value\n setValue(nextValue)\n onChange?.(event)\n },\n [onChange]\n )\n\n return (\n <Box width=\"100%\" className={className} {...boxProps}>\n {!!description && (\n <Tooltip pointer content={description} placement=\"top-end\">\n <Text variant=\"xs\" color=\"mono60\" textAlign=\"right\">\n <u>What is this?</u>\n </Text>\n </Tooltip>\n )}\n\n <Box position=\"relative\" mt={!!title && !description ? 1 : 0}>\n <StyledInput\n ref={ref as any}\n disabled={disabled}\n focus={focus}\n hover={hover}\n error={!!error}\n required={required}\n height={(height ?? 50) as any}\n name={inputProps.name}\n title={title}\n labelOffset={labelOffset}\n defaultValue={defaultValue || undefined}\n onChange={handleChange}\n placeholder={inputProps.placeholder || \" \"}\n {...inputProps}\n />\n\n {!!title && (\n <StyledLabel labelOffset={labelOffset} htmlFor={inputProps.name}>\n {title}\n <span />\n </StyledLabel>\n )}\n\n {children}\n </Box>\n\n {(required || (inputProps?.maxLength && showCounter)) &&\n !(error && typeof error === \"string\") && (\n <Box display=\"flex\" mt={0.5} mx={1}>\n {required && <RequiredField disabled={disabled} flex={1} />}\n\n {!!inputProps?.maxLength && showCounter && (\n <Text flex={1} variant=\"xs\" color=\"mono60\" textAlign=\"right\">\n {String(value).length}/{inputProps.maxLength}\n </Text>\n )}\n </Box>\n )}\n\n {error && typeof error === \"string\" && (\n <Text variant=\"xs\" mt={0.5} ml={1} color=\"red100\">\n {error}\n </Text>\n )}\n </Box>\n )\n }\n)\n\nInput.displayName = \"Input\"\n\ntype StyledInputProps = Pick<\n InputProps,\n \"disabled\" | \"error\" | \"hover\" | \"focus\" | \"active\" | \"title\" | \"labelOffset\"\n>\n\nconst StyledInput = styled.input<StyledInputProps>`\n width: 100%;\n padding: 0 ${themeGet(\"space.1\")};\n appearance: none;\n line-height: 1;\n border: 1px solid;\n border-radius: 3px;\n transition: border-color 0.25s, color 0.25s;\n font-family: ${themeGet(\"fonts.sans\")};\n ${systemHeight};\n\n ::placeholder {\n transition: color 0.25s, opacity 0.25s;\n }\n\n ${(props) => {\n return css`\n ${INPUT_STATES.default}\n ${props.hover && INPUT_STATES.hover}\n ${props.focus && INPUT_STATES.focus}\n ${props.active && INPUT_STATES.active}\n ${props.disabled && INPUT_STATES.disabled}\n ${props.error && INPUT_STATES.error}\n\n &:hover {\n ${INPUT_STATES.hover}\n }\n\n &:not(:placeholder-shown) {\n ${INPUT_STATES.completed}\n ${props.error && INPUT_STATES.error}\n }\n\n &:focus {\n outline: none;\n ${INPUT_STATES.focus}\n\n &::placeholder {\n transition: ${FORM_ELEMENT_TRANSITION};\n opacity: 1;\n }\n\n :not(:placeholder-shown) {\n ${INPUT_STATES.active}\n ${props.error && INPUT_STATES.error}\n }\n }\n\n &:disabled {\n cursor: default;\n ${INPUT_STATES.disabled}\n }\n\n ${props.title &&\n css`\n &::placeholder {\n transition: ${FORM_ELEMENT_TRANSITION};\n opacity: 0;\n }\n `}\n `\n }};\n`\n\nconst StyledLabel = styled.label<StyledInputProps>`\n position: absolute;\n top: 50%;\n left: 5px;\n padding: 0 5px;\n background-color: transparent;\n transform: translateY(-50%);\n transition: ${FORM_ELEMENT_TRANSITION};\n transition-property: color, transform, padding, font-size;\n font-family: ${themeGet(\"fonts.sans\")};\n pointer-events: none;\n\n & > span {\n background-color: ${themeGet(\"colors.mono0\")};\n height: 100%;\n width: 100%;\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n z-index: -1;\n transition: ${FORM_ELEMENT_TRANSITION};\n transition-property: height, top;\n transition-delay: 0.1s;\n }\n\n ${({ labelOffset }) =>\n !!labelOffset &&\n css`\n padding-left: ${labelOffset - 5}px;\n `}\n`\n"],"mappings":";;;;;;;;;;AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,OAAOC,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAC1C,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAC/C,SAASC,MAAM,IAAIC,YAAY,QAAQ,eAAe;AACtD,SAASC,aAAa;AACtB,SAASC,GAAG,EAAEC,QAAQ,EAAEC,aAAa;AACrC,SAASC,IAAI;AACb,SAASC,OAAO;AAChB,SAASC,YAAY;AACrB,SAASC,uBAAuB;AAoBhC;AACA,OAAO,IAAMC,KAAK,gBAAGd,KAAK,CAACe,UAAU,CACnC,UAAAC,IAAA,EAkBEC,GAAG,EACA;EAAA,IAjBDC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,WAAW,GAAAJ,IAAA,CAAXI,WAAW;IACXC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IACRC,KAAK,GAAAN,IAAA,CAALM,KAAK;IACLC,QAAQ,GAAAP,IAAA,CAARO,QAAQ;IACRC,KAAK,GAAAR,IAAA,CAALQ,KAAK;IACLC,KAAK,GAAAT,IAAA,CAALS,KAAK;IACLC,KAAK,GAAA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S,QAAQ,EACvCwD,KAAK,CAACvD,KAAK,IAAIV,YAAY,CAACU,KAAK,EAG/BV,YAAY,CAACa,KAAK,EAIlBb,YAAY,CAACoE,SAAS,EACtBH,KAAK,CAACvD,KAAK,IAAIV,YAAY,CAACU,KAAK,EAKjCV,YAAY,CAACY,KAAK,EAGJX,uBAAuB,EAKnCD,YAAY,CAACmE,MAAM,EACnBF,KAAK,CAACvD,KAAK,IAAIV,YAAY,CAACU,KAAK,EAMnCV,YAAY,CAACS,QAAQ,EAGvBwD,KAAK,CAACnD,KAAK,IACbvB,GAAG,iDAEeU,uBAAuB,CAGxC;AAEL,CAAC,CACF;AAED,IAAMmD,WAAW,GAAG9D,MAAM,CAAC+E,KAAK,CAAAN,UAAA;EAAAF,WAAA;EAAAG,WAAA;AAAA,qZAOhB/D,uBAAuB,EAEtBd,QAAQ,CAAC,YAAY,CAAC,EAIfA,QAAQ,CAAC,cAAc,CAAC,EAQ9Bc,uBAAuB,EAKrC,UAAAqE,KAAA;EAAA,IAAGvD,WAAW,GAAAuD,KAAA,CAAXvD,WAAW;EAAA,OACd,CAAC,CAACA,WAAW,IACbxB,GAAG,2BACewB,WAAW,GAAG,CAAC,CAChC;AAAA,EACJ"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { themeGet } from "@styled-system/theme-get";
|
|
2
2
|
import { css } from "styled-components";
|
|
3
|
+
import { State } from "./types";
|
|
3
4
|
export var INPUT_STATES = {
|
|
4
5
|
default: css(["background-color:", ";font-size:", ";color:", ";border-color:", ";::placeholder{color:", ";}& + label{color:", ";font-size:", ";}"], themeGet("colors.mono0"), themeGet("textVariants.sm-display.fontSize"), themeGet("colors.mono100"), themeGet("colors.mono30"), themeGet("colors.mono60"), themeGet("colors.mono60"), themeGet("textVariants.sm-display.fontSize")),
|
|
5
6
|
focus: css(["color:", ";border-color:", ";::placeholder{color:", ";opacity:1;}& + label{color:", ";transform:translateY(-150%);font-size:", ";padding:0 5px;& > span{height:2px;top:50%;}}"], themeGet("colors.mono100"), themeGet("colors.blue100"), themeGet("colors.mono60"), themeGet("colors.blue100"), themeGet("textVariants.xs.fontSize")),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","names":["themeGet","css","INPUT_STATES","default","focus","hover","active","completed","disabled","error"],"sources":["../../../../src/elements/Input/tokens.ts"],"sourcesContent":["import { themeGet } from \"@styled-system/theme-get\"\nimport { css } from \"styled-components\"\nimport { State } from \"./types\"\n\nexport const INPUT_STATES: Record<State, any> = {\n default: css`\n background-color: ${themeGet(\"colors.mono0\")};\n font-size: ${themeGet(\"textVariants.sm-display.fontSize\")};\n color: ${themeGet(\"colors.mono100\")};\n border-color: ${themeGet(\"colors.mono30\")};\n\n ::placeholder {\n color: ${themeGet(\"colors.mono60\")};\n }\n\n & + label {\n color: ${themeGet(\"colors.mono60\")};\n font-size: ${themeGet(\"textVariants.sm-display.fontSize\")};\n }\n `,\n focus: css`\n color: ${themeGet(\"colors.mono100\")};\n border-color: ${themeGet(\"colors.blue100\")};\n\n ::placeholder {\n color: ${themeGet(\"colors.mono60\")};\n opacity: 1;\n }\n\n & + label {\n color: ${themeGet(\"colors.blue100\")};\n transform: translateY(-150%);\n font-size: ${themeGet(\"textVariants.xs.fontSize\")};\n padding: 0 5px;\n\n & > span {\n height: 2px;\n top: 50%;\n }\n }\n `,\n hover: css`\n color: ${themeGet(\"colors.mono100\")};\n border-color: ${themeGet(\"colors.mono60\")};\n\n ::placeholder {\n color: ${themeGet(\"colors.mono100\")};\n }\n\n & + label {\n color: ${themeGet(\"colors.mono100\")};\n }\n `,\n active: css`\n color: ${themeGet(\"colors.mono100\")};\n border-color: ${themeGet(\"colors.blue100\")};\n\n ::placeholder {\n color: ${themeGet(\"colors.mono100\")};\n }\n\n & + label {\n color: ${themeGet(\"colors.blue100\")};\n transform: translateY(-150%);\n font-size: ${themeGet(\"textVariants.xs.fontSize\")};\n padding: 0 5px;\n\n & > span {\n height: 2px;\n top: 50%;\n }\n }\n `,\n completed: css`\n color: ${themeGet(\"colors.mono100\")};\n border-color: ${themeGet(\"colors.mono60\")};\n\n & + label {\n color: ${themeGet(\"colors.blue60\")};\n transform: translateY(-150%);\n font-size: ${themeGet(\"textVariants.xs.fontSize\")};\n padding: 0 5px;\n\n & > span {\n height: 2px;\n top: 50%;\n }\n }\n `,\n disabled: css`\n color: ${themeGet(\"colors.mono30\")};\n border-color: ${themeGet(\"colors.mono30\")};\n background-color: transparent;\n /* For Safari: */\n -webkit-text-fill-color: ${themeGet(\"colors.mono30\")};\n /* For iOS */\n opacity: 1;\n\n ::placeholder {\n color: ${themeGet(\"colors.mono30\")};\n }\n\n &:not(:placeholder-shown) + label {\n color: ${themeGet(\"colors.mono30\")};\n transform: translateY(-150%);\n font-size: ${themeGet(\"textVariants.xs.fontSize\")};\n\n & > span {\n height: 2px;\n top: 50%;\n }\n }\n\n &:placeholder-shown + label {\n color: ${themeGet(\"colors.mono30\")};\n }\n `,\n error: css`\n border-color: ${themeGet(\"colors.red100\")};\n\n & + label {\n color: ${themeGet(\"colors.red100\")};\n transform: translateY(-150%);\n font-size: ${themeGet(\"textVariants.xs.fontSize\")};\n padding: 0 5px;\n\n & > span {\n height: 2px;\n top: 50%;\n }\n }\n `,\n}\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,SAASC,GAAG,QAAQ,mBAAmB;
|
|
1
|
+
{"version":3,"file":"tokens.js","names":["themeGet","css","State","INPUT_STATES","default","focus","hover","active","completed","disabled","error"],"sources":["../../../../src/elements/Input/tokens.ts"],"sourcesContent":["import { themeGet } from \"@styled-system/theme-get\"\nimport { css } from \"styled-components\"\nimport { State } from \"./types\"\n\nexport const INPUT_STATES: Record<State, any> = {\n default: css`\n background-color: ${themeGet(\"colors.mono0\")};\n font-size: ${themeGet(\"textVariants.sm-display.fontSize\")};\n color: ${themeGet(\"colors.mono100\")};\n border-color: ${themeGet(\"colors.mono30\")};\n\n ::placeholder {\n color: ${themeGet(\"colors.mono60\")};\n }\n\n & + label {\n color: ${themeGet(\"colors.mono60\")};\n font-size: ${themeGet(\"textVariants.sm-display.fontSize\")};\n }\n `,\n focus: css`\n color: ${themeGet(\"colors.mono100\")};\n border-color: ${themeGet(\"colors.blue100\")};\n\n ::placeholder {\n color: ${themeGet(\"colors.mono60\")};\n opacity: 1;\n }\n\n & + label {\n color: ${themeGet(\"colors.blue100\")};\n transform: translateY(-150%);\n font-size: ${themeGet(\"textVariants.xs.fontSize\")};\n padding: 0 5px;\n\n & > span {\n height: 2px;\n top: 50%;\n }\n }\n `,\n hover: css`\n color: ${themeGet(\"colors.mono100\")};\n border-color: ${themeGet(\"colors.mono60\")};\n\n ::placeholder {\n color: ${themeGet(\"colors.mono100\")};\n }\n\n & + label {\n color: ${themeGet(\"colors.mono100\")};\n }\n `,\n active: css`\n color: ${themeGet(\"colors.mono100\")};\n border-color: ${themeGet(\"colors.blue100\")};\n\n ::placeholder {\n color: ${themeGet(\"colors.mono100\")};\n }\n\n & + label {\n color: ${themeGet(\"colors.blue100\")};\n transform: translateY(-150%);\n font-size: ${themeGet(\"textVariants.xs.fontSize\")};\n padding: 0 5px;\n\n & > span {\n height: 2px;\n top: 50%;\n }\n }\n `,\n completed: css`\n color: ${themeGet(\"colors.mono100\")};\n border-color: ${themeGet(\"colors.mono60\")};\n\n & + label {\n color: ${themeGet(\"colors.blue60\")};\n transform: translateY(-150%);\n font-size: ${themeGet(\"textVariants.xs.fontSize\")};\n padding: 0 5px;\n\n & > span {\n height: 2px;\n top: 50%;\n }\n }\n `,\n disabled: css`\n color: ${themeGet(\"colors.mono30\")};\n border-color: ${themeGet(\"colors.mono30\")};\n background-color: transparent;\n /* For Safari: */\n -webkit-text-fill-color: ${themeGet(\"colors.mono30\")};\n /* For iOS */\n opacity: 1;\n\n ::placeholder {\n color: ${themeGet(\"colors.mono30\")};\n }\n\n &:not(:placeholder-shown) + label {\n color: ${themeGet(\"colors.mono30\")};\n transform: translateY(-150%);\n font-size: ${themeGet(\"textVariants.xs.fontSize\")};\n\n & > span {\n height: 2px;\n top: 50%;\n }\n }\n\n &:placeholder-shown + label {\n color: ${themeGet(\"colors.mono30\")};\n }\n `,\n error: css`\n border-color: ${themeGet(\"colors.red100\")};\n\n & + label {\n color: ${themeGet(\"colors.red100\")};\n transform: translateY(-150%);\n font-size: ${themeGet(\"textVariants.xs.fontSize\")};\n padding: 0 5px;\n\n & > span {\n height: 2px;\n top: 50%;\n }\n }\n `,\n}\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,SAASC,GAAG,QAAQ,mBAAmB;AACvC,SAASC,KAAK;AAEd,OAAO,IAAMC,YAAgC,GAAG;EAC9CC,OAAO,EAAEH,GAAG,wIACUD,QAAQ,CAAC,cAAc,CAAC,EAC/BA,QAAQ,CAAC,kCAAkC,CAAC,EAChDA,QAAQ,CAAC,gBAAgB,CAAC,EACnBA,QAAQ,CAAC,eAAe,CAAC,EAG9BA,QAAQ,CAAC,eAAe,CAAC,EAIzBA,QAAQ,CAAC,eAAe,CAAC,EACrBA,QAAQ,CAAC,kCAAkC,CAAC,CAE5D;EACDK,KAAK,EAAEJ,GAAG,oLACCD,QAAQ,CAAC,gBAAgB,CAAC,EACnBA,QAAQ,CAAC,gBAAgB,CAAC,EAG/BA,QAAQ,CAAC,eAAe,CAAC,EAKzBA,QAAQ,CAAC,gBAAgB,CAAC,EAEtBA,QAAQ,CAAC,0BAA0B,CAAC,CAQpD;EACDM,KAAK,EAAEL,GAAG,oFACCD,QAAQ,CAAC,gBAAgB,CAAC,EACnBA,QAAQ,CAAC,eAAe,CAAC,EAG9BA,QAAQ,CAAC,gBAAgB,CAAC,EAI1BA,QAAQ,CAAC,gBAAgB,CAAC,CAEtC;EACDO,MAAM,EAAEN,GAAG,0KACAD,QAAQ,CAAC,gBAAgB,CAAC,EACnBA,QAAQ,CAAC,gBAAgB,CAAC,EAG/BA,QAAQ,CAAC,gBAAgB,CAAC,EAI1BA,QAAQ,CAAC,gBAAgB,CAAC,EAEtBA,QAAQ,CAAC,0BAA0B,CAAC,CAQpD;EACDQ,SAAS,EAAEP,GAAG,gJACHD,QAAQ,CAAC,gBAAgB,CAAC,EACnBA,QAAQ,CAAC,eAAe,CAAC,EAG9BA,QAAQ,CAAC,eAAe,CAAC,EAErBA,QAAQ,CAAC,0BAA0B,CAAC,CAQpD;EACDS,QAAQ,EAAER,GAAG,gSACFD,QAAQ,CAAC,eAAe,CAAC,EAClBA,QAAQ,CAAC,eAAe,CAAC,EAGdA,QAAQ,CAAC,eAAe,CAAC,EAKzCA,QAAQ,CAAC,eAAe,CAAC,EAIzBA,QAAQ,CAAC,eAAe,CAAC,EAErBA,QAAQ,CAAC,0BAA0B,CAAC,EASxCA,QAAQ,CAAC,eAAe,CAAC,CAErC;EACDU,KAAK,EAAET,GAAG,qIACQD,QAAQ,CAAC,eAAe,CAAC,EAG9BA,QAAQ,CAAC,eAAe,CAAC,EAErBA,QAAQ,CAAC,0BAA0B,CAAC;AASvD,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { Text } from "../Text";
|
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import styled from "styled-components";
|
|
8
8
|
import { variant } from "styled-system";
|
|
9
|
-
import { Box } from "../Box";
|
|
9
|
+
import { Box, BoxProps } from "../Box";
|
|
10
10
|
export var LABEL_VARIANTS = {
|
|
11
11
|
light: {
|
|
12
12
|
backgroundColor: "mono10",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.js","names":["Text","React","styled","variant","Box","LABEL_VARIANTS","light","backgroundColor","color","dark","brand","Label","_ref","children","_ref$variant","rest","_objectWithoutProperties","_excluded","createElement","Container","_extends","display","maxWidth","px","overflowEllipsis","displayName","withConfig","componentId","variants"],"sources":["../../../../src/elements/Label/Label.tsx"],"sourcesContent":["import { Text } from \"../Text\"\nimport * as React from \"react\"\nimport styled from \"styled-components\"\nimport { variant } from \"styled-system\"\nimport { Box, BoxProps } from \"../Box\"\n\nexport const LABEL_VARIANTS = {\n light: {\n backgroundColor: \"mono10\",\n color: \"mono100\",\n },\n dark: {\n backgroundColor: \"mono100\",\n color: \"mono0\",\n },\n brand: {\n backgroundColor: \"blue100\",\n color: \"mono0\",\n },\n}\n\nexport type LabelVariant = keyof typeof LABEL_VARIANTS\n\nexport interface LabelProps extends BoxProps {\n variant?: LabelVariant\n children: React.ReactNode\n}\n\nexport const Label: React.FC<React.PropsWithChildren<LabelProps>> = ({\n children,\n variant = \"light\",\n ...rest\n}) => {\n return (\n <Container\n display=\"inline-flex\"\n maxWidth=\"100%\"\n variant={variant}\n {...rest}\n >\n <Text variant=\"xs\" px={0.5} overflowEllipsis>\n {children}\n </Text>\n </Container>\n )\n}\n\nconst Container = styled(Box)<{ variant: LabelVariant }>`\n ${variant({ variants: LABEL_VARIANTS })}\n`\n"],"mappings":";;;;AAAA,SAASA,IAAI;AACb,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,GAAG;
|
|
1
|
+
{"version":3,"file":"Label.js","names":["Text","React","styled","variant","Box","BoxProps","LABEL_VARIANTS","light","backgroundColor","color","dark","brand","Label","_ref","children","_ref$variant","rest","_objectWithoutProperties","_excluded","createElement","Container","_extends","display","maxWidth","px","overflowEllipsis","displayName","withConfig","componentId","variants"],"sources":["../../../../src/elements/Label/Label.tsx"],"sourcesContent":["import { Text } from \"../Text\"\nimport * as React from \"react\"\nimport styled from \"styled-components\"\nimport { variant } from \"styled-system\"\nimport { Box, BoxProps } from \"../Box\"\n\nexport const LABEL_VARIANTS = {\n light: {\n backgroundColor: \"mono10\",\n color: \"mono100\",\n },\n dark: {\n backgroundColor: \"mono100\",\n color: \"mono0\",\n },\n brand: {\n backgroundColor: \"blue100\",\n color: \"mono0\",\n },\n}\n\nexport type LabelVariant = keyof typeof LABEL_VARIANTS\n\nexport interface LabelProps extends BoxProps {\n variant?: LabelVariant\n children: React.ReactNode\n}\n\nexport const Label: React.FC<React.PropsWithChildren<LabelProps>> = ({\n children,\n variant = \"light\",\n ...rest\n}) => {\n return (\n <Container\n display=\"inline-flex\"\n maxWidth=\"100%\"\n variant={variant}\n {...rest}\n >\n <Text variant=\"xs\" px={0.5} overflowEllipsis>\n {children}\n </Text>\n </Container>\n )\n}\n\nconst Container = styled(Box)<{ variant: LabelVariant }>`\n ${variant({ variants: LABEL_VARIANTS })}\n`\n"],"mappings":";;;;AAAA,SAASA,IAAI;AACb,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,GAAG,EAAEC,QAAQ;AAEtB,OAAO,IAAMC,cAAc,GAAG;EAC5BC,KAAK,EAAE;IACLC,eAAe,EAAE,QAAQ;IACzBC,KAAK,EAAE;EACT,CAAC;EACDC,IAAI,EAAE;IACJF,eAAe,EAAE,SAAS;IAC1BC,KAAK,EAAE;EACT,CAAC;EACDE,KAAK,EAAE;IACLH,eAAe,EAAE,SAAS;IAC1BC,KAAK,EAAE;EACT;AACF,CAAC;AASD,OAAO,IAAMG,KAAoD,GAAG,SAAvDA,KAAoDA,CAAAC,IAAA,EAI3D;EAAA,IAHJC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAAC,YAAA,GAAAF,IAAA,CACRV,OAAO;IAAPA,OAAO,GAAAY,YAAA,cAAG,OAAO,GAAAA,YAAA;IACdC,IAAI,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA;EAEP,oBACEjB,KAAA,CAAAkB,aAAA,CAACC,SAAS,EAAAC,QAAA;IACRC,OAAO,EAAC,aAAa;IACrBC,QAAQ,EAAC,MAAM;IACfpB,OAAO,EAAEA;EAAQ,GACba,IAAI,gBAERf,KAAA,CAAAkB,aAAA,CAACnB,IAAI;IAACG,OAAO,EAAC,IAAI;IAACqB,EAAE,EAAE,GAAI;IAACC,gBAAgB;EAAA,GACzCX,QAAQ,CACJ,CACG;AAEhB,CAAC;AAjBYF,KAAoD,CAAAc,WAAA;AAmBjE,IAAMN,SAAS,GAAGlB,MAAM,CAACE,GAAG,CAAC,CAAAuB,UAAA;EAAAD,WAAA;EAAAE,WAAA;AAAA,aACzBzB,OAAO,CAAC;EAAE0B,QAAQ,EAAEvB;AAAe,CAAC,CAAC,CACxC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Label, LABEL_VARIANTS } from "./Label";
|
|
2
|
+
import { Label, LabelVariant, LABEL_VARIANTS } from "./Label";
|
|
3
3
|
import { Box } from "../Box";
|
|
4
4
|
import { STORYBOOK_PROPS_BLOCKLIST } from "../../utils/storybookBlocklist";
|
|
5
5
|
export default {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.story.js","names":["React","Label","LABEL_VARIANTS","Box","STORYBOOK_PROPS_BLOCKLIST","component","title","tags","parameters","docs","description","controls","exclude","Default","args","children","story","AllVariants","render","createElement","display","flexDirection","gap","Object","keys","map","variant","key","OverflowEllipsis","width","overflow"],"sources":["../../../../src/elements/Label/Label.story.tsx"],"sourcesContent":["import React from \"react\"\nimport { Label, LabelVariant, LABEL_VARIANTS } from \"./Label\"\nimport { Box } from \"../Box\"\nimport { STORYBOOK_PROPS_BLOCKLIST } from \"../../utils/storybookBlocklist\"\n\nexport default {\n component: Label,\n title: \"Components/Label\",\n tags: [\"autodocs\"],\n parameters: {\n docs: {\n description: {\n component:\n \"A label component with different visual variants for various use cases.\",\n },\n },\n controls: {\n exclude: STORYBOOK_PROPS_BLOCKLIST,\n },\n },\n}\n\nexport const Default = {\n args: {\n children: \"Example\",\n },\n parameters: {\n docs: {\n description: {\n story: \"Basic label component with default styling.\",\n },\n },\n },\n}\n\nexport const AllVariants = {\n render: () => (\n <Box display=\"flex\" flexDirection=\"column\" gap={1}>\n {Object.keys(LABEL_VARIANTS).map((variant) => (\n <Label key={variant} variant={variant as LabelVariant}>\n {variant} Label\n </Label>\n ))}\n </Box>\n ),\n parameters: {\n docs: {\n description: {\n story: \"All available label variants.\",\n },\n },\n },\n}\n\nexport const OverflowEllipsis = {\n render: () => (\n <Box display=\"flex\" flexDirection=\"column\" gap={1}>\n {Object.keys(LABEL_VARIANTS).map((variant) => (\n <Box key={variant} width={75} overflow=\"hidden\">\n <Label variant={variant as LabelVariant}>Longer Example</Label>\n </Box>\n ))}\n </Box>\n ),\n parameters: {\n docs: {\n description: {\n story: \"Labels with text overflow demonstrating ellipsis behavior.\",\n },\n },\n },\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,
|
|
1
|
+
{"version":3,"file":"Label.story.js","names":["React","Label","LabelVariant","LABEL_VARIANTS","Box","STORYBOOK_PROPS_BLOCKLIST","component","title","tags","parameters","docs","description","controls","exclude","Default","args","children","story","AllVariants","render","createElement","display","flexDirection","gap","Object","keys","map","variant","key","OverflowEllipsis","width","overflow"],"sources":["../../../../src/elements/Label/Label.story.tsx"],"sourcesContent":["import React from \"react\"\nimport { Label, LabelVariant, LABEL_VARIANTS } from \"./Label\"\nimport { Box } from \"../Box\"\nimport { STORYBOOK_PROPS_BLOCKLIST } from \"../../utils/storybookBlocklist\"\n\nexport default {\n component: Label,\n title: \"Components/Label\",\n tags: [\"autodocs\"],\n parameters: {\n docs: {\n description: {\n component:\n \"A label component with different visual variants for various use cases.\",\n },\n },\n controls: {\n exclude: STORYBOOK_PROPS_BLOCKLIST,\n },\n },\n}\n\nexport const Default = {\n args: {\n children: \"Example\",\n },\n parameters: {\n docs: {\n description: {\n story: \"Basic label component with default styling.\",\n },\n },\n },\n}\n\nexport const AllVariants = {\n render: () => (\n <Box display=\"flex\" flexDirection=\"column\" gap={1}>\n {Object.keys(LABEL_VARIANTS).map((variant) => (\n <Label key={variant} variant={variant as LabelVariant}>\n {variant} Label\n </Label>\n ))}\n </Box>\n ),\n parameters: {\n docs: {\n description: {\n story: \"All available label variants.\",\n },\n },\n },\n}\n\nexport const OverflowEllipsis = {\n render: () => (\n <Box display=\"flex\" flexDirection=\"column\" gap={1}>\n {Object.keys(LABEL_VARIANTS).map((variant) => (\n <Box key={variant} width={75} overflow=\"hidden\">\n <Label variant={variant as LabelVariant}>Longer Example</Label>\n </Box>\n ))}\n </Box>\n ),\n parameters: {\n docs: {\n description: {\n story: \"Labels with text overflow demonstrating ellipsis behavior.\",\n },\n },\n },\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,EAAEC,YAAY,EAAEC,cAAc;AAC5C,SAASC,GAAG;AACZ,SAASC,yBAAyB;AAElC,eAAe;EACbC,SAAS,EAAEL,KAAK;EAChBM,KAAK,EAAE,kBAAkB;EACzBC,IAAI,EAAE,CAAC,UAAU,CAAC;EAClBC,UAAU,EAAE;IACVC,IAAI,EAAE;MACJC,WAAW,EAAE;QACXL,SAAS,EACP;MACJ;IACF,CAAC;IACDM,QAAQ,EAAE;MACNC,OAAO,EAAER;IACX;EACJ;AACF,CAAC;AAED,OAAO,IAAMS,OAAO,GAAG;EACrBC,IAAI,EAAE;IACJC,QAAQ,EAAE;EACZ,CAAC;EACDP,UAAU,EAAE;IACVC,IAAI,EAAE;MACJC,WAAW,EAAE;QACXM,KAAK,EAAE;MACT;IACF;EACF;AACF,CAAC;AAED,OAAO,IAAMC,WAAW,GAAG;EACzBC,MAAM,EAAE,SAARA,MAAMA,CAAA;IAAA,oBACJnB,KAAA,CAAAoB,aAAA,CAAChB,GAAG;MAACiB,OAAO,EAAC,MAAM;MAACC,aAAa,EAAC,QAAQ;MAACC,GAAG,EAAE;IAAE,GAC/CC,MAAM,CAACC,IAAI,CAACtB,cAAc,CAAC,CAACuB,GAAG,CAAC,UAACC,OAAO;MAAA,oBACvC3B,KAAA,CAAAoB,aAAA,CAACnB,KAAK;QAAC2B,GAAG,EAAED,OAAQ;QAACA,OAAO,EAAEA;MAAwB,GACnDA,OAAO,EAAC,QACX,CAAQ;IAAA,CACT,CAAC,CACE;EAAA,CACP;EACDlB,UAAU,EAAE;IACVC,IAAI,EAAE;MACJC,WAAW,EAAE;QACXM,KAAK,EAAE;MACT;IACF;EACF;AACF,CAAC;AAED,OAAO,IAAMY,gBAAgB,GAAG;EAC9BV,MAAM,EAAE,SAARA,MAAMA,CAAA;IAAA,oBACJnB,KAAA,CAAAoB,aAAA,CAAChB,GAAG;MAACiB,OAAO,EAAC,MAAM;MAACC,aAAa,EAAC,QAAQ;MAACC,GAAG,EAAE;IAAE,GAC/CC,MAAM,CAACC,IAAI,CAACtB,cAAc,CAAC,CAACuB,GAAG,CAAC,UAACC,OAAO;MAAA,oBACvC3B,KAAA,CAAAoB,aAAA,CAAChB,GAAG;QAACwB,GAAG,EAAED,OAAQ;QAACG,KAAK,EAAE,EAAG;QAACC,QAAQ,EAAC;MAAQ,gBAC7C/B,KAAA,CAAAoB,aAAA,CAACnB,KAAK;QAAC0B,OAAO,EAAEA;MAAwB,GAAC,gBAAc,CAAQ,CAC3D;IAAA,CACP,CAAC,CACE;EAAA,CACP;EACDlB,UAAU,EAAE;IACVC,IAAI,EAAE;MACJC,WAAW,EAAE;QACXM,KAAK,EAAE;MACT;IACF;EACF;AACF,CAAC"}
|
|
@@ -15,7 +15,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
15
15
|
import React, { useEffect, useRef, useState } from "react";
|
|
16
16
|
import { isText as _isText } from "../../helpers/isText";
|
|
17
17
|
import { Box, splitBoxProps } from "../Box";
|
|
18
|
-
import { Input } from "../Input";
|
|
18
|
+
import { Input, InputProps } from "../Input";
|
|
19
19
|
import { Text } from "../Text";
|
|
20
20
|
/** Input with a right-aligned or left-aligned label */
|
|
21
21
|
export var LabeledInput = /*#__PURE__*/React.forwardRef(function (_ref, forwardedRef) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LabeledInput.js","names":["React","useEffect","useRef","useState","isText","_isText","Box","splitBoxProps","Input","Text","LabeledInput","forwardRef","_ref","forwardedRef","label","height","_ref$variant","variant","rest","_objectWithoutProperties","_excluded","labelRef","_useState","_useState2","_slicedToArray","offset","setOffset","current","offsetWidth","_splitBoxProps","_splitBoxProps2","boxProps","inputProps","isPrefix","createElement","_extends","position","ref","labelOffset","undefined","style","_defineProperty","display","alignItems","top","bottom","pointerEvents","color","lineHeight","displayName"],"sources":["../../../../src/elements/LabeledInput/LabeledInput.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\"\nimport { isText as _isText } from \"../../helpers/isText\"\nimport { Box, splitBoxProps } from \"../Box\"\nimport { Input, InputProps } from \"../Input\"\nimport { Text } from \"../Text\"\n\nexport interface LabeledInputProps extends InputProps {\n label: React.ReactNode\n variant?: \"suffix\" | \"prefix\"\n}\n\n/** Input with a right-aligned or left-aligned label */\nexport const LabeledInput = React.forwardRef<\n HTMLInputElement,\n LabeledInputProps\n>(({ label, height, variant = \"suffix\", ...rest }, forwardedRef) => {\n const labelRef = useRef<HTMLDivElement | null>(null)\n const [offset, setOffset] = useState(0)\n\n useEffect(() => {\n if (labelRef.current === null) return\n setOffset(labelRef.current.offsetWidth)\n }, [])\n\n const [boxProps, inputProps] = splitBoxProps(rest)\n\n const isText = _isText(label)\n\n const isPrefix = variant === \"prefix\"\n\n return (\n <Box position=\"relative\" {...boxProps}>\n <Input\n ref={forwardedRef}\n height={height}\n labelOffset={isPrefix ? offset + 15 : undefined}\n style={{ [isPrefix ? \"paddingLeft\" : \"paddingRight\"]: offset + 15 }}\n {...inputProps}\n >\n <Box\n ref={labelRef as any}\n position=\"absolute\"\n display=\"flex\"\n alignItems=\"center\"\n top={0}\n bottom={0}\n style={{ pointerEvents: isText ? \"none\" : undefined }}\n {...{ [isPrefix ? \"left\" : \"right\"]: 1 }}\n >\n {isText ? (\n <Text variant=\"sm-display\" color=\"mono60\" lineHeight={1}>\n {label}\n </Text>\n ) : (\n label\n )}\n </Box>\n </Input>\n </Box>\n )\n})\n\nLabeledInput.displayName = \"LabeledInput\"\n"],"mappings":";;;;;;;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC1D,SAASC,MAAM,IAAIC,OAAO;AAC1B,SAASC,GAAG,EAAEC,aAAa;AAC3B,SAASC,KAAK;
|
|
1
|
+
{"version":3,"file":"LabeledInput.js","names":["React","useEffect","useRef","useState","isText","_isText","Box","splitBoxProps","Input","InputProps","Text","LabeledInput","forwardRef","_ref","forwardedRef","label","height","_ref$variant","variant","rest","_objectWithoutProperties","_excluded","labelRef","_useState","_useState2","_slicedToArray","offset","setOffset","current","offsetWidth","_splitBoxProps","_splitBoxProps2","boxProps","inputProps","isPrefix","createElement","_extends","position","ref","labelOffset","undefined","style","_defineProperty","display","alignItems","top","bottom","pointerEvents","color","lineHeight","displayName"],"sources":["../../../../src/elements/LabeledInput/LabeledInput.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\"\nimport { isText as _isText } from \"../../helpers/isText\"\nimport { Box, splitBoxProps } from \"../Box\"\nimport { Input, InputProps } from \"../Input\"\nimport { Text } from \"../Text\"\n\nexport interface LabeledInputProps extends InputProps {\n label: React.ReactNode\n variant?: \"suffix\" | \"prefix\"\n}\n\n/** Input with a right-aligned or left-aligned label */\nexport const LabeledInput = React.forwardRef<\n HTMLInputElement,\n LabeledInputProps\n>(({ label, height, variant = \"suffix\", ...rest }, forwardedRef) => {\n const labelRef = useRef<HTMLDivElement | null>(null)\n const [offset, setOffset] = useState(0)\n\n useEffect(() => {\n if (labelRef.current === null) return\n setOffset(labelRef.current.offsetWidth)\n }, [])\n\n const [boxProps, inputProps] = splitBoxProps(rest)\n\n const isText = _isText(label)\n\n const isPrefix = variant === \"prefix\"\n\n return (\n <Box position=\"relative\" {...boxProps}>\n <Input\n ref={forwardedRef}\n height={height}\n labelOffset={isPrefix ? offset + 15 : undefined}\n style={{ [isPrefix ? \"paddingLeft\" : \"paddingRight\"]: offset + 15 }}\n {...inputProps}\n >\n <Box\n ref={labelRef as any}\n position=\"absolute\"\n display=\"flex\"\n alignItems=\"center\"\n top={0}\n bottom={0}\n style={{ pointerEvents: isText ? \"none\" : undefined }}\n {...{ [isPrefix ? \"left\" : \"right\"]: 1 }}\n >\n {isText ? (\n <Text variant=\"sm-display\" color=\"mono60\" lineHeight={1}>\n {label}\n </Text>\n ) : (\n label\n )}\n </Box>\n </Input>\n </Box>\n )\n})\n\nLabeledInput.displayName = \"LabeledInput\"\n"],"mappings":";;;;;;;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC1D,SAASC,MAAM,IAAIC,OAAO;AAC1B,SAASC,GAAG,EAAEC,aAAa;AAC3B,SAASC,KAAK,EAAEC,UAAU;AAC1B,SAASC,IAAI;AAOb;AACA,OAAO,IAAMC,YAAY,gBAAGX,KAAK,CAACY,UAAU,CAG1C,UAAAC,IAAA,EAAiDC,YAAY,EAAK;EAAA,IAA/DC,KAAK,GAAAF,IAAA,CAALE,KAAK;IAAEC,MAAM,GAAAH,IAAA,CAANG,MAAM;IAAAC,YAAA,GAAAJ,IAAA,CAAEK,OAAO;IAAPA,OAAO,GAAAD,YAAA,cAAG,QAAQ,GAAAA,YAAA;IAAKE,IAAI,GAAAC,wBAAA,CAAAP,IAAA,EAAAQ,SAAA;EAC7C,IAAMC,QAAQ,GAAGpB,MAAM,CAAwB,IAAI,CAAC;EACpD,IAAAqB,SAAA,GAA4BpB,QAAQ,CAAC,CAAC,CAAC;IAAAqB,UAAA,GAAAC,cAAA,CAAAF,SAAA;IAAhCG,MAAM,GAAAF,UAAA;IAAEG,SAAS,GAAAH,UAAA;EAExBvB,SAAS,CAAC,YAAM;IACd,IAAIqB,QAAQ,CAACM,OAAO,KAAK,IAAI,EAAE;IAC/BD,SAAS,CAACL,QAAQ,CAACM,OAAO,CAACC,WAAW,CAAC;EACzC,CAAC,EAAE,EAAE,C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cAAc"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { themeGet } from "@styled-system/theme-get";
|
|
2
2
|
import styled from "styled-components";
|
|
3
|
-
import { compose, system } from "styled-system";
|
|
4
|
-
import { boxMixin } from "../Box";
|
|
3
|
+
import { compose, ResponsiveValue, system } from "styled-system";
|
|
4
|
+
import { boxMixin, BoxProps } from "../Box";
|
|
5
5
|
var textDecoration = system({
|
|
6
6
|
textDecoration: true
|
|
7
7
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","names":["themeGet","styled","compose","system","boxMixin","textDecoration","linkMixin","Link","a","withConfig","displayName","componentId","defaultProps"],"sources":["../../../../src/elements/Link/Link.tsx"],"sourcesContent":["import { themeGet } from \"@styled-system/theme-get\"\nimport styled from \"styled-components\"\nimport { compose, ResponsiveValue, system } from \"styled-system\"\nimport { boxMixin, BoxProps } from \"../Box\"\n\nconst textDecoration = system({ textDecoration: true })\n\nexport interface LinkProps extends BoxProps {\n textDecoration?: ResponsiveValue<string>\n}\n\nconst linkMixin = compose(boxMixin, textDecoration)\n\n/**\n * Basic <a> tag styled with additional LinkProps\n *\n * Tip: If working on Force, please use <Link as={RouterLink}>.\n\n */\nexport const Link = styled.a<LinkProps>`\n color: currentColor;\n transition: color 0.25s;\n &:hover {\n color: ${themeGet(\"colors.blue100\")};\n }\n &:visited {\n color: ${themeGet(\"colors.blue150\")};\n }\n ${linkMixin};\n`\n\nLink.displayName = \"Link\"\n\nLink.defaultProps = {\n textDecoration: \"underline\",\n}\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SAASC,OAAO,
|
|
1
|
+
{"version":3,"file":"Link.js","names":["themeGet","styled","compose","ResponsiveValue","system","boxMixin","BoxProps","textDecoration","linkMixin","Link","a","withConfig","displayName","componentId","defaultProps"],"sources":["../../../../src/elements/Link/Link.tsx"],"sourcesContent":["import { themeGet } from \"@styled-system/theme-get\"\nimport styled from \"styled-components\"\nimport { compose, ResponsiveValue, system } from \"styled-system\"\nimport { boxMixin, BoxProps } from \"../Box\"\n\nconst textDecoration = system({ textDecoration: true })\n\nexport interface LinkProps extends BoxProps {\n textDecoration?: ResponsiveValue<string>\n}\n\nconst linkMixin = compose(boxMixin, textDecoration)\n\n/**\n * Basic <a> tag styled with additional LinkProps\n *\n * Tip: If working on Force, please use <Link as={RouterLink}>.\n\n */\nexport const Link = styled.a<LinkProps>`\n color: currentColor;\n transition: color 0.25s;\n &:hover {\n color: ${themeGet(\"colors.blue100\")};\n }\n &:visited {\n color: ${themeGet(\"colors.blue150\")};\n }\n ${linkMixin};\n`\n\nLink.displayName = \"Link\"\n\nLink.defaultProps = {\n textDecoration: \"underline\",\n}\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SAASC,OAAO,EAAEC,eAAe,EAAEC,MAAM,QAAQ,eAAe;AAChE,SAASC,QAAQ,EAAEC,QAAQ;AAE3B,IAAMC,cAAc,GAAGH,MAAM,CAAC;EAAEG,cAAc,EAAE;AAAK,CAAC,CAAC;AAMvD,IAAMC,SAAS,GAAGN,OAAO,CAACG,QAAQ,EAAEE,cAAc,CAAC;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAME,IAAI,GAAGR,MAAM,CAACS,CAAC,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,kGAIfb,QAAQ,CAAC,gBAAgB,CAAC,EAG1BA,QAAQ,CAAC,gBAAgB,CAAC,EAEnCQ,SAAS,CACZ;AAEDC,IAAI,CAACG,WAAW,GAAG,MAAM;AAEzBH,IAAI,CAACK,YAAY,GAAG;EAClBP,cAAc,EAAE;AAClB,CAAC"}
|
|
@@ -12,7 +12,7 @@ import React, { useState, useEffect, useRef } from "react";
|
|
|
12
12
|
import styled, { keyframes } from "styled-components";
|
|
13
13
|
import { variant } from "styled-system";
|
|
14
14
|
import { Flex } from "../Flex";
|
|
15
|
-
import { Box } from "../Box";
|
|
15
|
+
import { Box, BoxProps } from "../Box";
|
|
16
16
|
import { Text } from "../Text";
|
|
17
17
|
var VARIANTS = {
|
|
18
18
|
defaultLight: {
|