@charcoal-ui/react 2.2.1 → 2.3.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/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.story.d.ts.map +1 -1
- package/dist/components/Modal/index.d.ts +5 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/core/CharcoalProvider.d.ts +12 -0
- package/dist/core/CharcoalProvider.d.ts.map +1 -0
- package/dist/core/ComponentAbstraction.d.ts +1 -1
- package/dist/core/ComponentAbstraction.d.ts.map +1 -1
- package/dist/index.cjs +298 -2609
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +127 -2440
- package/dist/index.js.map +1 -1
- package/dist/styled.d.ts +3 -3
- package/package.json +8 -6
- package/src/components/Checkbox/index.story.tsx +29 -11
- package/src/components/Checkbox/index.tsx +16 -6
- package/src/components/Modal/index.tsx +6 -6
- package/src/components/Switch/index.tsx +7 -3
- package/src/core/CharcoalProvider.tsx +35 -0
- package/src/core/ComponentAbstraction.tsx +1 -1
- package/src/index.ts +4 -0
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/ComponentAbstraction.tsx","../src/core/SSRProvider.tsx","../src/core/OverlayProvider.tsx","../src/components/Button/index.tsx","../src/_lib/index.ts","../src/styled.ts","../src/components/Clickable/index.tsx","../src/components/IconButton/index.tsx","../src/components/Radio/index.tsx","../src/components/MultiSelect/index.tsx","../src/components/MultiSelect/context.ts","../src/components/Switch/index.tsx","../src/components/TextField/index.tsx","../src/components/FieldLabel/index.tsx","../src/components/Icon/index.tsx","../src/components/Modal/index.tsx","../../foundation/src/grid.ts","../src/components/Modal/ModalPlumbing.tsx","../src/components/LoadingSpinner/index.tsx","../src/components/DropdownSelector/index.tsx","../src/components/DropdownSelector/Listbox.tsx","../../../node_modules/clsx/dist/clsx.m.js","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/index.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/useId.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/useLayoutEffect.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/chain.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/mergeProps.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/mergeRefs.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/filterDOMProps.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/focusWithoutScrolling.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/getOffset.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/runAfterTransition.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/useDrag1D.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/useGlobalListeners.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/useLabels.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/useObjectRef.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/useUpdateEffect.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/useResizeObserver.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/useSyncRef.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/getScrollParent.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/useViewportSize.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/useDescription.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/platform.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/useEvent.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/useValueEffect.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/scrollIntoView.ts","../../../node_modules/@react-aria/utils/dist/packages/@react-aria/utils/src/isVirtualEvent.ts","../../../node_modules/@react-aria/interactions/dist/packages/@react-aria/interactions/src/index.ts","../../../node_modules/@react-aria/interactions/dist/packages/@react-aria/interactions/src/Pressable.tsx","../../../node_modules/@react-aria/interactions/dist/packages/@react-aria/interactions/src/usePress.ts","../../../node_modules/@react-aria/interactions/dist/packages/@react-aria/interactions/src/textSelection.ts","../../../node_modules/@react-aria/interactions/dist/packages/@react-aria/interactions/src/context.ts","../../../node_modules/@react-aria/interactions/dist/packages/@react-aria/interactions/src/PressResponder.tsx","../../../node_modules/@react-aria/interactions/dist/packages/@react-aria/interactions/src/useFocus.ts","../../../node_modules/@react-aria/interactions/dist/packages/@react-aria/interactions/src/utils.ts","../../../node_modules/@react-aria/interactions/dist/packages/@react-aria/interactions/src/useFocusVisible.ts","../../../node_modules/@react-aria/interactions/dist/packages/@react-aria/interactions/src/useFocusWithin.ts","../../../node_modules/@react-aria/interactions/dist/packages/@react-aria/interactions/src/useHover.ts","../../../node_modules/@react-aria/interactions/dist/packages/@react-aria/interactions/src/useInteractOutside.ts","../../../node_modules/@react-aria/interactions/dist/packages/@react-aria/interactions/src/useKeyboard.ts","../../../node_modules/@react-aria/interactions/dist/packages/@react-aria/interactions/src/createEventHandler.ts","../../../node_modules/@react-aria/interactions/dist/packages/@react-aria/interactions/src/useMove.ts","../../../node_modules/@react-aria/interactions/dist/packages/@react-aria/interactions/src/useScrollWheel.ts","../../../node_modules/@react-aria/interactions/dist/packages/@react-aria/interactions/src/useLongPress.ts","../../../node_modules/@react-aria/label/dist/packages/@react-aria/label/src/index.ts","../../../node_modules/@react-aria/label/dist/packages/@react-aria/label/src/useField.ts","../../../node_modules/@react-aria/label/dist/packages/@react-aria/label/src/useLabel.ts","../../../node_modules/@react-aria/i18n/dist/packages/@react-aria/i18n/src/index.ts","../../../node_modules/@react-aria/i18n/dist/packages/@react-aria/i18n/src/context.tsx","../../../node_modules/@react-aria/i18n/dist/packages/@react-aria/i18n/src/utils.ts","../../../node_modules/@react-aria/i18n/dist/packages/@react-aria/i18n/src/useDefaultLocale.ts","../../../node_modules/@react-aria/i18n/dist/node_modules/@parcel/node-resolver-core/lib/_empty.js","../../../node_modules/@react-aria/i18n/dist/packages/@react-aria/i18n/src/useLocalizedStringFormatter.ts","../../../node_modules/@react-aria/i18n/dist/packages/@react-aria/i18n/src/useListFormatter.tsx","../../../node_modules/@react-aria/i18n/dist/packages/@react-aria/i18n/src/useDateFormatter.ts","../../../node_modules/@react-aria/i18n/dist/packages/@react-aria/i18n/src/useNumberFormatter.ts","../../../node_modules/@react-aria/i18n/dist/packages/@react-aria/i18n/src/useCollator.ts","../../../node_modules/@react-aria/i18n/dist/packages/@react-aria/i18n/src/useFilter.ts","../../../node_modules/@react-aria/selection/dist/packages/@react-aria/selection/src/index.ts","../../../node_modules/@react-aria/selection/dist/packages/@react-aria/selection/src/useSelectableCollection.ts","../../../node_modules/@react-aria/selection/dist/packages/@react-aria/selection/src/utils.ts","../../../node_modules/@react-aria/selection/dist/packages/@react-aria/selection/src/useTypeSelect.ts","../../../node_modules/@react-aria/selection/dist/packages/@react-aria/selection/src/useSelectableItem.ts","../../../node_modules/@react-aria/selection/dist/packages/@react-aria/selection/src/useSelectableList.ts","../../../node_modules/@react-aria/selection/dist/packages/@react-aria/selection/src/ListKeyboardDelegate.ts","../../../node_modules/@react-stately/collections/dist/packages/@react-stately/collections/src/index.ts","../../../node_modules/@react-stately/collections/dist/packages/@react-stately/collections/src/Item.ts","../../../node_modules/@react-stately/collections/dist/packages/@react-stately/collections/src/Section.ts","../../../node_modules/@react-stately/collections/dist/packages/@react-stately/collections/src/useCollection.ts","../../../node_modules/@react-stately/collections/dist/packages/@react-stately/collections/src/CollectionBuilder.ts","../../../node_modules/@react-stately/collections/dist/packages/@react-stately/collections/src/getItemCount.ts","../../../node_modules/@react-aria/listbox/dist/packages/@react-aria/listbox/src/index.ts","../../../node_modules/@react-aria/listbox/dist/packages/@react-aria/listbox/src/useListBox.ts","../../../node_modules/@react-aria/listbox/dist/packages/@react-aria/listbox/src/utils.ts","../../../node_modules/@react-aria/listbox/dist/packages/@react-aria/listbox/src/useOption.ts","../../../node_modules/@react-aria/listbox/dist/packages/@react-aria/listbox/src/useListBoxSection.ts","../src/components/DropdownSelector/Popover.tsx","../src/components/SegmentedControl/index.tsx","../src/components/SegmentedControl/RadioGroupContext.tsx","../src/components/Checkbox/index.tsx","../src/components/TagItem/index.tsx"],"sourcesContent":["import React, { useContext } from 'react'\n\nexport type LinkProps = {\n /**\n * リンクのURL\n */\n to: string\n} & Omit<React.ComponentPropsWithoutRef<'a'>, 'href'>\n\nexport const DefaultLink = React.forwardRef<HTMLAnchorElement, LinkProps>(\n function DefaultLink({ to, children, ...rest }, ref) {\n return (\n <a href={to} ref={ref} {...rest}>\n {children}\n </a>\n )\n }\n)\n\ninterface Components {\n Link: React.ComponentType<React.ComponentPropsWithRef<typeof DefaultLink>>\n}\n\nconst DefaultValue: Components = {\n Link: DefaultLink,\n}\n\nconst ComponentAbstractionContext = React.createContext(DefaultValue)\n\ninterface Props {\n children: React.ReactNode\n components: Partial<Components>\n}\n\nexport default function ComponentAbstraction({ children, components }: Props) {\n return (\n <ComponentAbstractionContext.Provider\n value={{ ...DefaultValue, ...components }}\n >\n {children}\n </ComponentAbstractionContext.Provider>\n )\n}\n\nexport function useComponentAbstraction() {\n return useContext(ComponentAbstractionContext)\n}\n","export { SSRProvider } from '@react-aria/ssr'\n","export { OverlayProvider } from '@react-aria/overlays'\n","import React from 'react'\nimport styled from 'styled-components'\nimport { unreachable } from '../../_lib'\nimport { theme } from '../../styled'\nimport Clickable, { ClickableElement, ClickableProps } from '../Clickable'\n\ntype Variant = 'Primary' | 'Default' | 'Overlay' | 'Danger' | 'Navigation'\ntype Size = 'S' | 'M'\n\ninterface StyledProps {\n /**\n * ボタンのスタイル\n */\n variant: Variant\n /**\n * ボタンのサイズ\n */\n size: Size\n /**\n * 幅を最大まで広げて描画\n */\n fixed: boolean\n}\n\nexport type ButtonProps = Partial<StyledProps> & ClickableProps\n\nconst Button = React.forwardRef<ClickableElement, ButtonProps>(function Button(\n {\n children,\n variant = 'Default',\n size = 'M',\n fixed = false,\n disabled = false,\n ...rest\n },\n ref\n) {\n return (\n <StyledButton\n {...rest}\n disabled={disabled}\n variant={variant}\n size={size}\n fixed={fixed}\n ref={ref}\n >\n {children}\n </StyledButton>\n )\n})\nexport default Button\n\nconst StyledButton = styled(Clickable)\n .withConfig<StyledProps>({\n shouldForwardProp(prop) {\n // fixed は <button> 要素に渡ってはいけない\n return prop !== 'fixed'\n },\n })\n .attrs<StyledProps, ReturnType<typeof styledProps>>(styledProps)`\n width: ${(p) => (p.fixed ? 'stretch' : 'min-content')};\n display: inline-grid;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n user-select: none;\n white-space: nowrap;\n\n ${(p) =>\n theme((o) => [\n o.font[p.font].hover.press,\n o.bg[p.background].hover.press,\n o.typography(14).bold.preserveHalfLeading,\n o.padding.horizontal(p.padding),\n o.disabled,\n o.borderRadius('oval'),\n o.outline.default.focus,\n ])}\n\n /* よく考えたらheight=32って定義が存在しないな... */\n height: ${(p) => p.height}px;\n`\n\nfunction styledProps(props: StyledProps) {\n return {\n ...props,\n ...variantToProps(props.variant),\n ...sizeToProps(props.size),\n }\n}\n\nfunction variantToProps(variant: Variant) {\n switch (variant) {\n case 'Overlay':\n return { font: 'text5', background: 'surface4' } as const\n case 'Default':\n return { font: 'text2', background: 'surface3' } as const\n case 'Primary':\n return { font: 'text5', background: 'brand' } as const\n case 'Navigation':\n return { font: 'text5', background: 'surface6' } as const\n case 'Danger':\n return { font: 'text5', background: 'assertive' } as const\n default:\n return unreachable(variant)\n }\n}\n\nfunction sizeToProps(size: Size) {\n switch (size) {\n case 'S':\n return {\n height: 32,\n padding: 16,\n } as const\n case 'M':\n return {\n height: 40,\n padding: 24,\n } as const\n }\n}\n","/**\n * 今後ポートされる予定の汎用的な関数群\n */\n\n/**\n * Function used to assert a given code path is unreachable\n */\nexport function unreachable(): never\n/**\n * Function used to assert a given code path is unreachable.\n * Very useful for ensuring switches are exhaustive:\n *\n * ```ts\n * switch (a.type) {\n * case Types.A:\n * case Types.B:\n * break\n * default:\n * unreachable(a) // will cause a build error if there was\n * // a Types.C that was not checked\n * }\n * ```\n *\n * @param value Value to be asserted as unreachable\n */\n// NOTE: Uses separate overloads, _not_ `value?: never`, to not allow `undefined` to be passed\n// eslint-disable-next-line @typescript-eslint/unified-signatures\nexport function unreachable(value: never): never\nexport function unreachable(value?: never): never {\n throw new Error(\n arguments.length === 0\n ? 'unreachable'\n : `unreachable (${JSON.stringify(value)})`\n )\n}\n","import styled from 'styled-components'\nimport { createTheme } from '@charcoal-ui/styled'\nexport const theme = createTheme(styled)\n","import React from 'react'\nimport styled, { css } from 'styled-components'\nimport {\n LinkProps,\n useComponentAbstraction,\n} from '../../core/ComponentAbstraction'\nimport { disabledSelector } from '@charcoal-ui/utils'\n\ninterface BaseProps {\n /**\n * クリックの無効化\n */\n disabled?: boolean\n}\n\ninterface LinkBaseProps {\n /**\n * リンクのURL。指定するとbuttonタグではなくaタグとして描画される\n */\n to: string\n}\n\nexport type ClickableProps =\n | (BaseProps & Omit<React.ComponentPropsWithoutRef<'button'>, 'disabled'>)\n | (BaseProps & LinkBaseProps & Omit<LinkProps, 'to'>)\nexport type ClickableElement = HTMLButtonElement & HTMLAnchorElement\n\nconst Clickable = React.forwardRef<ClickableElement, ClickableProps>(\n function Clickable(props, ref) {\n const { Link } = useComponentAbstraction()\n if ('to' in props) {\n const { onClick, disabled = false, ...rest } = props\n return (\n <A<typeof Link>\n {...rest}\n as={disabled ? undefined : Link}\n onClick={disabled ? undefined : onClick}\n aria-disabled={disabled}\n ref={ref}\n />\n )\n } else {\n return <Button {...props} ref={ref} />\n }\n }\n)\nexport default Clickable\n\nconst clickableCss = css`\n /* Clickable style */\n cursor: pointer;\n\n ${disabledSelector} {\n cursor: default;\n }\n`\n\nconst Button = styled.button`\n /* Reset button appearance */\n appearance: none;\n background: transparent;\n padding: 0;\n border-style: none;\n outline: none;\n color: inherit;\n text-rendering: inherit;\n letter-spacing: inherit;\n word-spacing: inherit;\n\n &:focus {\n outline: none;\n }\n\n /* Change the font styles in all browsers. */\n font: inherit;\n\n /* Remove the margin in Firefox and Safari. */\n margin: 0;\n\n /* Show the overflow in Edge. */\n overflow: visible;\n\n /* Remove the inheritance of text transform in Firefox. */\n text-transform: none;\n\n /* Remove the inner border and padding in Firefox. */\n &::-moz-focus-inner {\n border-style: none;\n padding: 0;\n }\n\n ${clickableCss}\n`\n\nconst A = styled.span`\n /* Reset a-tag appearance */\n color: inherit;\n\n &:focus {\n outline: none;\n }\n\n .text {\n top: calc(1em + 2em);\n }\n\n ${clickableCss}\n`\n","import React from 'react'\nimport styled from 'styled-components'\nimport { theme } from '../../styled'\nimport Clickable, { ClickableElement, ClickableProps } from '../Clickable'\nimport type { KnownIconType } from '@charcoal-ui/icons'\n\ntype Variant = 'Default' | 'Overlay'\ntype Size = 'XS' | 'S' | 'M'\n\ninterface StyledProps {\n readonly variant?: Variant\n readonly size?: Size\n readonly icon: keyof KnownIconType\n}\n\nexport type IconButtonProps = StyledProps & ClickableProps\n\nconst IconButton = React.forwardRef<ClickableElement, IconButtonProps>(\n function IconButtonInner(\n { variant = 'Default', size = 'M', icon, ...rest }: IconButtonProps,\n ref\n ) {\n validateIconSize(size, icon)\n return (\n <StyledIconButton {...rest} ref={ref} variant={variant} size={size}>\n <pixiv-icon name={icon} />\n </StyledIconButton>\n )\n }\n)\n\nexport default IconButton\n\nconst StyledIconButton = styled(Clickable).attrs<\n Required<StyledProps>,\n ReturnType<typeof styledProps>\n>(styledProps)`\n user-select: none;\n\n width: ${(p) => p.width}px;\n height: ${(p) => p.height}px;\n display: flex;\n align-items: center;\n justify-content: center;\n\n ${({ font, background }) =>\n theme((o) => [\n o.font[font],\n o.bg[background].hover.press,\n o.disabled,\n o.borderRadius('oval'),\n o.outline.default.focus,\n ])}\n`\n\nfunction styledProps(props: Required<StyledProps>) {\n return {\n ...props,\n ...variantToProps(props.variant),\n ...sizeToProps(props.size),\n }\n}\n\nfunction variantToProps(variant: Variant) {\n switch (variant) {\n case 'Default':\n return { font: 'text3', background: 'transparent' } as const\n case 'Overlay':\n return { font: 'text5', background: 'surface4' } as const\n }\n}\n\nfunction sizeToProps(size: Size) {\n switch (size) {\n case 'XS':\n return {\n width: 20,\n height: 20,\n }\n case 'S':\n return {\n width: 32,\n height: 32,\n }\n case 'M':\n return {\n width: 40,\n height: 40,\n }\n }\n}\n\n/**\n * validates matches of size and icon\n */\nfunction validateIconSize(size: Size, icon: keyof KnownIconType) {\n let requiredIconSize: string\n switch (size) {\n case 'XS':\n requiredIconSize = '16'\n break\n case 'S':\n case 'M':\n requiredIconSize = '24'\n break\n }\n // アイコン名は サイズ/名前\n const result = /^\\d*/u.exec(icon)\n if (result == null) {\n throw new Error('Invalid icon name')\n }\n const [iconSize] = result\n if (iconSize !== requiredIconSize) {\n // eslint-disable-next-line no-console\n console.warn(\n `IconButton with size \"${size}\" expect icon size \"${requiredIconSize}, but got \"${iconSize}\"`\n )\n }\n}\n","import React, { useCallback, useContext } from 'react'\nimport styled from 'styled-components'\nimport warning from 'warning'\nimport { theme } from '../../styled'\nimport { px } from '@charcoal-ui/utils'\n\nexport type RadioProps = React.PropsWithChildren<{\n value: string\n forceChecked?: boolean\n disabled?: boolean\n}>\n\nexport default function Radio({\n value,\n forceChecked = false,\n disabled = false,\n children,\n}: RadioProps) {\n const {\n name,\n selected,\n disabled: isParentDisabled,\n readonly,\n hasError,\n onChange,\n } = useContext(RadioGroupContext)\n\n warning(\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n name !== undefined,\n `\"name\" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?`\n )\n\n const isSelected = value === selected\n const isDisabled = disabled || isParentDisabled\n const isReadonly = readonly && !isSelected\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange(e.currentTarget.value)\n },\n [onChange]\n )\n\n return (\n <RadioRoot aria-disabled={isDisabled || isReadonly}>\n <RadioInput\n name={name}\n value={value}\n checked={forceChecked || isSelected}\n hasError={hasError}\n onChange={handleChange}\n disabled={isDisabled || isReadonly}\n />\n {children != null && <RadioLabel>{children}</RadioLabel>}\n </RadioRoot>\n )\n}\n\nconst RadioRoot = styled.label`\n display: grid;\n grid-template-columns: auto 1fr;\n grid-gap: ${({ theme }) => px(theme.spacing[4])};\n align-items: center;\n cursor: pointer;\n\n ${theme((o) => [o.disabled])}\n`\n\nexport const RadioInput = styled.input.attrs({ type: 'radio' })<{\n hasError?: boolean\n}>`\n /** Make prior to browser default style */\n &[type='radio'] {\n appearance: none;\n display: block;\n box-sizing: border-box;\n\n margin: 0;\n padding: 6px;\n\n width: 20px;\n height: 20px;\n\n ${({ hasError = false }) =>\n theme((o) => [\n o.borderRadius('oval'),\n o.bg.surface1.hover.press,\n hasError && o.outline.assertive,\n ])};\n\n &:not(:checked) {\n border-width: 2px;\n border-style: solid;\n border-color: ${({ theme }) => theme.color.text3};\n }\n\n &:checked {\n ${theme((o) => o.bg.brand.hover.press)}\n\n &::after {\n content: '';\n display: block;\n width: 8px;\n height: 8px;\n pointer-events: none;\n\n ${theme((o) => [o.bg.text5.hover.press, o.borderRadius('oval')])}\n }\n }\n\n ${theme((o) => o.outline.default.focus)}\n }\n`\n\nconst RadioLabel = styled.div`\n ${theme((o) => [o.typography(14), o.font.text2])}\n`\n\nexport type RadioGroupProps = React.PropsWithChildren<{\n className?: string\n value?: string\n label: string\n name: string\n onChange(next: string): void\n disabled?: boolean\n readonly?: boolean\n hasError?: boolean\n}>\n\n// TODO: use (or polyfill) flex gap\nconst StyledRadioGroup = styled.div`\n display: grid;\n grid-template-columns: 1fr;\n grid-gap: ${({ theme }) => px(theme.spacing[8])};\n`\n\ninterface RadioGroupContext {\n name: string\n selected?: string\n disabled: boolean\n readonly: boolean\n hasError: boolean\n onChange: (next: string) => void\n}\n\nconst RadioGroupContext = React.createContext<RadioGroupContext>({\n name: undefined as never,\n selected: undefined,\n disabled: false,\n readonly: false,\n hasError: false,\n onChange() {\n throw new Error(\n 'Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?'\n )\n },\n})\n\nexport function RadioGroup({\n className,\n value,\n label,\n name,\n onChange,\n disabled,\n readonly,\n hasError,\n children,\n}: RadioGroupProps) {\n const handleChange = useCallback(\n (next: string) => {\n onChange(next)\n },\n [onChange]\n )\n\n return (\n <RadioGroupContext.Provider\n value={{\n name,\n selected: value,\n disabled: disabled ?? false,\n readonly: readonly ?? false,\n hasError: hasError ?? false,\n onChange: handleChange,\n }}\n >\n <StyledRadioGroup\n role=\"radiogroup\"\n aria-orientation=\"vertical\"\n aria-label={label}\n aria-invalid={hasError}\n className={className}\n >\n {children}\n </StyledRadioGroup>\n </RadioGroupContext.Provider>\n )\n}\n","import React, { ChangeEvent, useCallback, useContext } from 'react'\nimport styled, { css } from 'styled-components'\nimport warning from 'warning'\nimport { theme } from '../../styled'\nimport { disabledSelector, px } from '@charcoal-ui/utils'\n\nimport { MultiSelectGroupContext } from './context'\n\nexport type MultiSelectProps = React.PropsWithChildren<{\n value: string\n forceChecked?: boolean\n disabled?: boolean\n variant?: 'default' | 'overlay'\n onChange?: (payload: { value: string; selected: boolean }) => void\n}>\n\nexport default function MultiSelect({\n value,\n forceChecked = false,\n disabled = false,\n onChange,\n variant = 'default',\n children,\n}: MultiSelectProps) {\n const {\n name,\n selected,\n disabled: parentDisabled,\n readonly,\n hasError,\n onChange: parentOnChange,\n } = useContext(MultiSelectGroupContext)\n\n warning(\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n name !== undefined,\n `\"name\" is not Provided for <MultiSelect>. Perhaps you forgot to wrap with <MultiSelectGroup> ?`\n )\n\n const isSelected = selected.includes(value) || forceChecked\n const isDisabled = disabled || parentDisabled || readonly\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n if (!(event.currentTarget instanceof HTMLInputElement)) {\n return\n }\n if (onChange) onChange({ value, selected: event.currentTarget.checked })\n parentOnChange({ value, selected: event.currentTarget.checked })\n },\n [onChange, parentOnChange, value]\n )\n\n return (\n <MultiSelectRoot aria-disabled={isDisabled}>\n <MultiSelectInput\n {...{\n name,\n value,\n hasError,\n }}\n checked={isSelected}\n disabled={isDisabled}\n onChange={handleChange}\n overlay={variant === 'overlay'}\n aria-invalid={hasError}\n />\n <MultiSelectInputOverlay\n overlay={variant === 'overlay'}\n hasError={hasError}\n aria-hidden={true}\n >\n <pixiv-icon name=\"24/Check\" unsafe-non-guideline-scale={16 / 24} />\n </MultiSelectInputOverlay>\n {Boolean(children) && <MultiSelectLabel>{children}</MultiSelectLabel>}\n </MultiSelectRoot>\n )\n}\n\nconst MultiSelectRoot = styled.label`\n display: grid;\n grid-template-columns: auto 1fr;\n align-items: center;\n position: relative;\n cursor: pointer;\n ${disabledSelector} {\n cursor: default;\n }\n gap: ${({ theme }) => px(theme.spacing[4])};\n ${theme((o) => o.disabled)}\n`\n\nconst MultiSelectLabel = styled.div`\n display: flex;\n align-items: center;\n ${theme((o) => [o.typography(14), o.font.text2])}\n`\n\nconst MultiSelectInput = styled.input.attrs({ type: 'checkbox' })<{\n hasError: boolean\n overlay: boolean\n}>`\n &[type='checkbox'] {\n appearance: none;\n display: block;\n width: 20px;\n height: 20px;\n margin: 0;\n\n &:checked {\n ${theme((o) => o.bg.brand.hover.press)}\n }\n\n ${({ hasError, overlay }) =>\n theme((o) => [\n o.bg.text3.hover.press,\n o.borderRadius('oval'),\n hasError && !overlay && o.outline.assertive,\n overlay && o.bg.surface4,\n ])};\n }\n`\n\nconst MultiSelectInputOverlay = styled.div<{\n overlay: boolean\n hasError: boolean\n}>`\n position: absolute;\n top: -2px;\n left: -2px;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n\n ${({ hasError, overlay }) =>\n theme((o) => [\n o.width.px(24),\n o.height.px(24),\n o.borderRadius('oval'),\n o.font.text5,\n hasError && overlay && o.outline.assertive,\n ])}\n\n ${({ overlay }) =>\n overlay &&\n css`\n border-color: ${({ theme }) => theme.color.text5};\n border-width: 2px;\n border-style: solid;\n `}\n`\n\nexport type MultiSelectGroupProps = React.PropsWithChildren<{\n className?: string\n name: string\n ariaLabel: string\n selected: string[]\n onChange: (selected: string[]) => void\n disabled?: boolean\n readonly?: boolean\n hasError?: boolean\n}>\n\nexport function MultiSelectGroup({\n className,\n name,\n ariaLabel,\n selected,\n onChange,\n disabled = false,\n readonly = false,\n hasError = false,\n children,\n}: MultiSelectGroupProps) {\n const handleChange = useCallback(\n (payload: { value: string; selected: boolean }) => {\n const index = selected.indexOf(payload.value)\n\n if (payload.selected) {\n if (index < 0) {\n onChange([...selected, payload.value])\n }\n } else {\n if (index >= 0) {\n onChange([...selected.slice(0, index), ...selected.slice(index + 1)])\n }\n }\n },\n [onChange, selected]\n )\n\n return (\n <MultiSelectGroupContext.Provider\n value={{\n name,\n selected: Array.from(new Set(selected)),\n disabled,\n readonly,\n hasError,\n onChange: handleChange,\n }}\n >\n <div\n className={className}\n aria-label={ariaLabel}\n data-testid=\"SelectGroup\"\n >\n {children}\n </div>\n </MultiSelectGroupContext.Provider>\n )\n}\n","import { createContext } from 'react'\n\ntype MultiSelectGroupContext = {\n name: string\n selected: string[]\n disabled: boolean\n readonly: boolean\n hasError: boolean\n onChange: ({ value, selected }: { value: string; selected: boolean }) => void\n}\n\nexport const MultiSelectGroupContext = createContext<MultiSelectGroupContext>({\n name: undefined as never,\n selected: [],\n disabled: false,\n readonly: false,\n hasError: false,\n onChange() {\n throw new Error(\n 'Cannot find `onChange()` handler. Perhaps you forgot to wrap it with `<MultiSelectGroup />` ?'\n )\n },\n})\n","import { useSwitch } from '@react-aria/switch'\nimport type { AriaSwitchProps } from '@react-types/switch'\nimport React, { useRef, useMemo } from 'react'\nimport { useToggleState } from 'react-stately'\nimport styled from 'styled-components'\nimport { theme } from '../../styled'\nimport { disabledSelector, px } from '@charcoal-ui/utils'\n\nexport type SwitchProps = {\n name: string\n className?: string\n value?: string\n checked?: boolean\n disabled?: boolean\n onChange(checked: boolean): void\n} & (\n | // children か label は片方が必須\n {\n children: React.ReactNode\n }\n | {\n label: string\n }\n)\n\nexport default function SwitchCheckbox(props: SwitchProps) {\n const { disabled, className } = props\n\n const ariaSwitchProps: AriaSwitchProps = useMemo(\n () => ({\n ...props,\n\n // children がいない場合は aria-label をつけないといけない\n 'aria-label': 'children' in props ? undefined : props.label,\n isDisabled: props.disabled,\n isSelected: props.checked,\n }),\n [props]\n )\n\n const state = useToggleState(ariaSwitchProps)\n const ref = useRef<HTMLInputElement>(null)\n const {\n inputProps: { className: _className, type: _type, ...rest },\n } = useSwitch(ariaSwitchProps, state, ref)\n\n return (\n <Label className={className} aria-disabled={disabled}>\n <SwitchInput {...rest} ref={ref} />\n {'children' in props ? (\n // eslint-disable-next-line react/destructuring-assignment\n <LabelInner>{props.children}</LabelInner>\n ) : undefined}\n </Label>\n )\n}\n\nconst Label = styled.label`\n display: inline-grid;\n grid-template-columns: auto 1fr;\n align-items: center;\n gap: ${({ theme }) => px(theme.spacing[4])};\n cursor: pointer;\n outline: 0;\n\n ${theme((o) => o.disabled)}\n\n ${disabledSelector} {\n cursor: default;\n }\n`\n\nconst LabelInner = styled.div`\n ${theme((o) => [o.typography(14), o.font.text2])}\n`\n\nconst SwitchInput = styled.input.attrs({\n type: 'checkbox',\n})`\n &[type='checkbox'] {\n appearance: none;\n display: inline-flex;\n position: relative;\n box-sizing: border-box;\n width: 28px;\n border: 2px solid transparent;\n transition: box-shadow 0.2s, background-color 0.2s;\n cursor: inherit;\n ${theme((o) => [\n o.borderRadius(16),\n o.height.px(16),\n o.bg.text4.hover.press,\n o.outline.default.focus,\n ])}\n\n &::after {\n content: '';\n position: absolute;\n display: block;\n top: 0;\n left: 0;\n width: 12px;\n height: 12px;\n transform: translateX(0);\n transition: transform 0.2s;\n ${theme((o) => [o.bg.text5.hover.press, o.borderRadius('oval')])}\n }\n\n &:checked {\n ${theme((o) => o.bg.brand.hover.press)}\n\n &::after {\n transform: translateX(12px);\n }\n }\n }\n`\n","import { useTextField } from '@react-aria/textfield'\nimport { useVisuallyHidden } from '@react-aria/visually-hidden'\nimport React, {\n ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react'\nimport styled, { css } from 'styled-components'\nimport FieldLabel, { FieldLabelProps } from '../FieldLabel'\nimport { createTheme } from '@charcoal-ui/styled'\n\nconst theme = createTheme(styled)\n\ninterface TextFieldBaseProps\n extends Pick<FieldLabelProps, 'label' | 'requiredText' | 'subLabel'> {\n readonly className?: string\n readonly defaultValue?: string\n readonly value?: string\n readonly onChange?: (value: string) => void\n readonly onKeyDown?: (event: React.KeyboardEvent<Element>) => void\n readonly onFocus?: (event: React.FocusEvent<Element>) => void\n readonly onBlur?: (event: React.FocusEvent<Element>) => void\n readonly showCount?: boolean\n readonly showLabel?: boolean\n readonly placeholder?: string\n readonly assistiveText?: string\n readonly disabled?: boolean\n readonly required?: boolean\n readonly invalid?: boolean\n readonly maxLength?: number\n /**\n * tab-indexがー1かどうか\n */\n readonly excludeFromTabOrder?: boolean\n}\n\nexport interface SingleLineTextFieldProps extends TextFieldBaseProps {\n readonly autoHeight?: never\n readonly multiline?: false\n readonly rows?: never\n readonly type?: string\n readonly prefix?: ReactNode\n readonly suffix?: ReactNode\n}\n\nexport interface MultiLineTextFieldProps extends TextFieldBaseProps {\n readonly autoHeight?: boolean\n readonly multiline: true\n readonly rows?: number\n readonly type?: never\n readonly prefix?: never\n readonly suffix?: never\n}\n\nexport type TextFieldProps = SingleLineTextFieldProps | MultiLineTextFieldProps\ntype TextFieldElement = HTMLInputElement & HTMLTextAreaElement\n\nfunction mergeRefs<T>(...refs: React.Ref<T>[]): React.RefCallback<T> {\n return (value) => {\n for (const ref of refs) {\n if (typeof ref === 'function') {\n ref(value)\n } else if (ref !== null) {\n ;(ref as React.MutableRefObject<T | null>).current = value\n }\n }\n }\n}\n\nfunction countCodePointsInString(string: string) {\n // [...string] とするとproduction buildで動かなくなる\n // cf. https://twitter.com/f_subal/status/1497214727511891972\n return Array.from(string).length\n}\n\nconst TextField = React.forwardRef<TextFieldElement, TextFieldProps>(\n function TextField(props, ref) {\n return props.multiline !== undefined && props.multiline ? (\n <MultiLineTextField ref={ref} {...props} />\n ) : (\n <SingleLineTextField ref={ref} {...props} />\n )\n }\n)\n\nexport default TextField\n\nconst SingleLineTextField = React.forwardRef<\n HTMLInputElement,\n SingleLineTextFieldProps\n>(function SingleLineTextFieldInner({ onChange, ...props }, forwardRef) {\n const {\n className,\n showLabel = false,\n showCount = false,\n label,\n requiredText,\n subLabel,\n disabled = false,\n required,\n invalid = false,\n assistiveText,\n maxLength,\n prefix = null,\n suffix = null,\n } = props\n\n const { visuallyHiddenProps } = useVisuallyHidden()\n const ariaRef = useRef<HTMLInputElement>(null)\n const prefixRef = useRef<HTMLSpanElement>(null)\n const suffixRef = useRef<HTMLSpanElement>(null)\n const [count, setCount] = useState(countCodePointsInString(props.value ?? ''))\n const [prefixWidth, setPrefixWidth] = useState(0)\n const [suffixWidth, setSuffixWidth] = useState(0)\n\n const nonControlled = props.value === undefined\n const handleChange = useCallback(\n (value: string) => {\n const count = countCodePointsInString(value)\n if (maxLength !== undefined && count > maxLength) {\n return\n }\n if (nonControlled) {\n setCount(count)\n }\n onChange?.(value)\n },\n [maxLength, nonControlled, onChange]\n )\n\n useEffect(() => {\n setCount(countCodePointsInString(props.value ?? ''))\n }, [props.value])\n\n const { inputProps, labelProps, descriptionProps, errorMessageProps } =\n useTextField(\n {\n inputElementType: 'input',\n isDisabled: disabled,\n isRequired: required,\n validationState: invalid ? 'invalid' : 'valid',\n description: !invalid && assistiveText,\n errorMessage: invalid && assistiveText,\n onChange: handleChange,\n ...props,\n },\n ariaRef\n )\n\n useEffect(() => {\n const prefixObserver = new ResizeObserver((entries) => {\n setPrefixWidth(entries[0].contentRect.width)\n })\n const suffixObserver = new ResizeObserver((entries) => {\n setSuffixWidth(entries[0].contentRect.width)\n })\n\n if (prefixRef.current !== null) {\n prefixObserver.observe(prefixRef.current)\n }\n if (suffixRef.current !== null) {\n suffixObserver.observe(suffixRef.current)\n }\n\n return () => {\n suffixObserver.disconnect()\n prefixObserver.disconnect()\n }\n }, [])\n\n return (\n <TextFieldRoot className={className} isDisabled={disabled}>\n <TextFieldLabel\n label={label}\n requiredText={requiredText}\n required={required}\n subLabel={subLabel}\n {...labelProps}\n {...(!showLabel ? visuallyHiddenProps : {})}\n />\n <StyledInputContainer>\n <PrefixContainer ref={prefixRef}>\n <Affix>{prefix}</Affix>\n </PrefixContainer>\n <StyledInput\n ref={mergeRefs(forwardRef, ariaRef)}\n invalid={invalid}\n extraLeftPadding={prefixWidth}\n extraRightPadding={suffixWidth}\n {...inputProps}\n />\n <SuffixContainer ref={suffixRef}>\n <Affix>{suffix}</Affix>\n {showCount && (\n <SingleLineCounter>\n {maxLength !== undefined ? `${count}/${maxLength}` : count}\n </SingleLineCounter>\n )}\n </SuffixContainer>\n </StyledInputContainer>\n {assistiveText != null && assistiveText.length !== 0 && (\n <AssistiveText\n invalid={invalid}\n {...(invalid ? errorMessageProps : descriptionProps)}\n >\n {assistiveText}\n </AssistiveText>\n )}\n </TextFieldRoot>\n )\n})\n\nconst MultiLineTextField = React.forwardRef<\n HTMLTextAreaElement,\n MultiLineTextFieldProps\n>(function MultiLineTextFieldInner({ onChange, ...props }, forwardRef) {\n const {\n className,\n showCount = false,\n showLabel = false,\n label,\n requiredText,\n subLabel,\n disabled = false,\n required,\n invalid = false,\n assistiveText,\n maxLength,\n autoHeight = false,\n rows: initialRows = 4,\n } = props\n\n const { visuallyHiddenProps } = useVisuallyHidden()\n const textareaRef = useRef<HTMLTextAreaElement>(null)\n const ariaRef = useRef<HTMLTextAreaElement>(null)\n const [count, setCount] = useState(countCodePointsInString(props.value ?? ''))\n const [rows, setRows] = useState(initialRows)\n\n const syncHeight = useCallback(\n (textarea: HTMLTextAreaElement) => {\n const rows = (`${textarea.value}\\n`.match(/\\n/gu)?.length ?? 0) || 1\n setRows(initialRows <= rows ? rows : initialRows)\n },\n [initialRows]\n )\n\n const nonControlled = props.value === undefined\n const handleChange = useCallback(\n (value: string) => {\n const count = countCodePointsInString(value)\n if (maxLength !== undefined && count > maxLength) {\n return\n }\n if (nonControlled) {\n setCount(count)\n }\n if (autoHeight && textareaRef.current !== null) {\n syncHeight(textareaRef.current)\n }\n onChange?.(value)\n },\n [autoHeight, maxLength, nonControlled, onChange, syncHeight]\n )\n\n useEffect(() => {\n setCount(countCodePointsInString(props.value ?? ''))\n }, [props.value])\n\n const { inputProps, labelProps, descriptionProps, errorMessageProps } =\n useTextField(\n {\n inputElementType: 'textarea',\n isDisabled: disabled,\n isRequired: required,\n validationState: invalid ? 'invalid' : 'valid',\n description: !invalid && assistiveText,\n errorMessage: invalid && assistiveText,\n onChange: handleChange,\n ...props,\n },\n ariaRef\n )\n\n useEffect(() => {\n if (autoHeight && textareaRef.current !== null) {\n syncHeight(textareaRef.current)\n }\n }, [autoHeight, syncHeight])\n\n return (\n <TextFieldRoot className={className} isDisabled={disabled}>\n <TextFieldLabel\n label={label}\n requiredText={requiredText}\n required={required}\n subLabel={subLabel}\n {...labelProps}\n {...(!showLabel ? visuallyHiddenProps : {})}\n />\n <StyledTextareaContainer\n invalid={invalid}\n rows={showCount ? rows + 1 : rows}\n >\n <StyledTextarea\n ref={mergeRefs(textareaRef, forwardRef, ariaRef)}\n rows={rows}\n noBottomPadding={showCount}\n {...inputProps}\n />\n {showCount && (\n <MultiLineCounter>\n {maxLength !== undefined ? `${count}/${maxLength}` : count}\n </MultiLineCounter>\n )}\n </StyledTextareaContainer>\n {assistiveText != null && assistiveText.length !== 0 && (\n <AssistiveText\n invalid={invalid}\n {...(invalid ? errorMessageProps : descriptionProps)}\n >\n {assistiveText}\n </AssistiveText>\n )}\n </TextFieldRoot>\n )\n})\n\nconst TextFieldRoot = styled.div<{ isDisabled: boolean }>`\n display: flex;\n flex-direction: column;\n\n ${(p) => p.isDisabled && { opacity: p.theme.elementEffect.disabled.opacity }}\n`\n\nconst TextFieldLabel = styled(FieldLabel)`\n ${theme((o) => o.margin.bottom(8))}\n`\n\nconst StyledInputContainer = styled.div`\n height: 40px;\n display: grid;\n position: relative;\n`\n\nconst PrefixContainer = styled.span`\n position: absolute;\n top: 50%;\n left: 8px;\n transform: translateY(-50%);\n`\n\nconst SuffixContainer = styled.span`\n position: absolute;\n top: 50%;\n right: 8px;\n transform: translateY(-50%);\n\n display: flex;\n gap: 8px;\n`\n\nconst Affix = styled.span`\n user-select: none;\n\n ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text2])}\n`\n\nconst StyledInput = styled.input<{\n invalid: boolean\n extraLeftPadding: number\n extraRightPadding: number\n}>`\n border: none;\n box-sizing: border-box;\n outline: none;\n font-family: inherit;\n\n /* Prevent zooming for iOS Safari */\n transform-origin: top left;\n transform: scale(0.875);\n width: calc(100% / 0.875);\n height: calc(100% / 0.875);\n font-size: calc(14px / 0.875);\n line-height: calc(22px / 0.875);\n padding-left: calc((8px + ${(p) => p.extraLeftPadding}px) / 0.875);\n padding-right: calc((8px + ${(p) => p.extraRightPadding}px) / 0.875);\n border-radius: calc(4px / 0.875);\n\n /* Display box-shadow for iOS Safari */\n appearance: none;\n\n ${(p) =>\n theme((o) => [\n o.bg.surface3.hover,\n o.outline.default.focus,\n p.invalid && o.outline.assertive,\n o.font.text2,\n ])}\n\n &::placeholder {\n ${theme((o) => o.font.text3)}\n }\n`\n\nconst StyledTextareaContainer = styled.div<{ rows: number; invalid: boolean }>`\n position: relative;\n overflow: hidden;\n padding: 0 8px;\n\n ${(p) =>\n theme((o) => [\n o.bg.surface3.hover,\n p.invalid && o.outline.assertive,\n o.font.text2,\n o.borderRadius(4),\n ])}\n\n &:focus-within {\n ${(p) =>\n theme((o) => (p.invalid ? o.outline.assertive : o.outline.default))}\n }\n\n ${({ rows }) => css`\n height: calc(22px * ${rows} + 18px);\n `};\n`\n\nconst StyledTextarea = styled.textarea<{ noBottomPadding: boolean }>`\n border: none;\n outline: none;\n resize: none;\n font-family: inherit;\n color: inherit;\n\n /* Prevent zooming for iOS Safari */\n transform-origin: top left;\n transform: scale(0.875);\n width: calc(100% / 0.875);\n font-size: calc(14px / 0.875);\n line-height: calc(22px / 0.875);\n padding: calc(9px / 0.875) 0 ${(p) => (p.noBottomPadding ? 0 : '')};\n\n ${({ rows = 1 }) => css`\n height: calc(22px / 0.875 * ${rows});\n `};\n\n /* Display box-shadow for iOS Safari */\n appearance: none;\n\n background: none;\n\n &::placeholder {\n ${theme((o) => o.font.text3)}\n }\n\n /* Hide scrollbar for Chrome, Safari and Opera */\n &::-webkit-scrollbar {\n display: none;\n }\n /* Hide scrollbar for IE, Edge and Firefox */\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n`\n\nconst SingleLineCounter = styled.span`\n ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text3])}\n`\n\nconst MultiLineCounter = styled.span`\n position: absolute;\n bottom: 9px;\n right: 8px;\n\n ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text3])}\n`\n\nconst AssistiveText = styled.p<{ invalid: boolean }>`\n ${(p) =>\n theme((o) => [\n o.typography(14),\n o.margin.top(8),\n o.margin.bottom(0),\n o.font[p.invalid ? 'assertive' : 'text1'],\n ])}\n`\n","import React from 'react'\nimport styled from 'styled-components'\nimport { createTheme } from '@charcoal-ui/styled'\n\nexport interface FieldLabelProps\n extends React.LabelHTMLAttributes<HTMLLabelElement> {\n readonly className?: string\n readonly label: string\n readonly subLabel?: React.ReactNode\n readonly required?: boolean\n // TODO: 翻訳用のContextで注入する\n readonly requiredText?: string\n}\n\nconst FieldLabel = React.forwardRef<HTMLLabelElement, FieldLabelProps>(\n function FieldLabel(\n {\n style,\n className,\n label,\n required = false,\n requiredText,\n subLabel,\n ...labelProps\n },\n ref\n ) {\n return (\n <FieldLabelWrapper style={style} className={className}>\n <Label ref={ref} {...labelProps}>\n {label}\n </Label>\n {required && <RequiredText>{requiredText}</RequiredText>}\n <SubLabelClickable>\n <span>{subLabel}</span>\n </SubLabelClickable>\n </FieldLabelWrapper>\n )\n }\n)\n\nexport default FieldLabel\n\nconst theme = createTheme(styled)\n\nconst Label = styled.label`\n ${theme((o) => [o.typography(14).bold, o.font.text1])}\n`\n\nconst RequiredText = styled.span`\n ${theme((o) => [o.typography(14), o.font.text3])}\n`\n\nconst SubLabelClickable = styled.div`\n ${theme((o) => [\n o.typography(14),\n o.font.text3.hover.press,\n o.outline.default.focus,\n ])}\n`\n\nconst FieldLabelWrapper = styled.div`\n display: inline-flex;\n align-items: center;\n\n > ${RequiredText} {\n ${theme((o) => o.margin.left(4))}\n }\n\n > ${SubLabelClickable} {\n ${theme((o) => o.margin.left('auto'))}\n }\n`\n","import React from 'react'\n\nimport '@charcoal-ui/icons'\nimport type { PixivIcon, Props } from '@charcoal-ui/icons'\n\nexport interface OwnProps {\n unsafeNonGuidelineScale?: number\n className?: string\n}\n\nexport interface IconProps\n extends OwnProps,\n React.PropsWithoutRef<\n Omit<Props, 'class' | 'unsafe-non-guideline-scale' | 'css'>\n > {}\n\nconst Icon = React.forwardRef<PixivIcon, IconProps>(function IconInner(\n { name, scale, unsafeNonGuidelineScale, className, ...rest },\n ref\n) {\n return (\n <pixiv-icon\n ref={ref}\n name={name}\n scale={scale}\n unsafe-non-guideline-scale={unsafeNonGuidelineScale}\n class={className}\n {...rest}\n />\n )\n})\n\nexport default Icon\n","import React, { useContext, useRef } from 'react'\nimport {\n AriaModalOverlayProps,\n Overlay,\n useModalOverlay,\n useOverlay,\n usePreventScroll,\n} from '@react-aria/overlays'\nimport styled, { css, useTheme } from 'styled-components'\nimport { theme } from '../../styled'\nimport { FocusScope } from '@react-aria/focus'\nimport { useDialog } from '@react-aria/dialog'\nimport { AriaDialogProps } from '@react-types/dialog'\nimport { columnSystem, COLUMN_UNIT, GUTTER_UNIT } from '@charcoal-ui/foundation'\nimport { unreachable } from '../../_lib'\nimport { maxWidth } from '@charcoal-ui/utils'\nimport { useMedia } from '@charcoal-ui/styled'\nimport { animated, useTransition, easings } from 'react-spring'\nimport Button, { ButtonProps } from '../Button'\nimport IconButton from '../IconButton'\n\nexport type ModalProps = AriaModalOverlayProps &\n AriaDialogProps & {\n children: React.ReactNode\n zIndex?: number\n title: string\n size?: 'S' | 'M' | 'L'\n bottomSheet?: boolean | 'full'\n isOpen: boolean\n onClose: () => void\n\n // NOTICE: デフォルト値を与えてはならない\n // (たとえば document.body をデフォルト値にすると SSR できなくなる)\n portalContainer?: HTMLElement\n }\n\nconst DEFAULT_Z_INDEX = 10\n\n/**\n * モーダルコンポーネント。\n *\n * @example アプリケーションルートで `<OverlayProvider>` で囲った上で利用する\n * ```tsx\n * import {\n * OverlayProvider,\n * Modal,\n * ModalHeader,\n * ModalBody,\n * ModalButtons\n * } from '@charcoal-ui/react'\n *\n * <OverlayProvider>\n * <App>\n * <Modal isOpen={state.isOpen} onClose={() => state.close()} isDismissable>\n * <ModalHeader />\n * <ModalBody>...</ModalBody>\n * <ModalButtons>...</ModalButtons>\n * </Modal>\n * </App>\n * </OverlayProvider>\n * ```\n */\nexport default function Modal({\n children,\n zIndex = DEFAULT_Z_INDEX,\n portalContainer,\n ...props\n}: ModalProps) {\n const {\n title,\n size = 'M',\n bottomSheet = false,\n isDismissable,\n onClose,\n isOpen = false,\n } = props\n\n const ref = useRef<HTMLDivElement>(null)\n const { overlayProps, underlayProps } = useOverlay(props, ref)\n\n usePreventScroll()\n const { modalProps } = useModalOverlay(\n props,\n {\n close: onClose,\n isOpen: isOpen,\n // these props are not used actually.\n // https://github.com/adobe/react-spectrum/blob/df14e3fb129b94b310f0397a701b83f006b51dfe/packages/%40react-aria/overlays/src/useModalOverlay.ts\n open: () => {\n // nope\n },\n setOpen: () => {\n // nope\n },\n toggle: () => {\n // nope\n },\n },\n ref\n )\n\n const { dialogProps, titleProps } = useDialog(props, ref)\n\n const theme = useTheme()\n const isMobile = useMedia(maxWidth(theme.breakpoint.screen1)) ?? false\n const transitionEnabled = isMobile && bottomSheet !== false\n const transition = useTransition(isOpen, {\n from: {\n transform: 'translateY(100%)',\n backgroundColor: 'rgba(0, 0, 0, 0)',\n },\n enter: {\n transform: 'translateY(0%)',\n backgroundColor: 'rgba(0, 0, 0, 0.4)',\n },\n leave: {\n transform: 'translateY(100%)',\n backgroundColor: 'rgba(0, 0, 0, 0)',\n },\n config: transitionEnabled\n ? { duration: 400, easing: easings.easeOutQuart }\n : { duration: 0 },\n })\n const showDismiss = !isMobile || bottomSheet !== true\n\n return transition(\n ({ backgroundColor, transform }, item) =>\n item && (\n <Overlay>\n <ModalBackground\n zIndex={zIndex}\n {...underlayProps}\n style={transitionEnabled ? { backgroundColor } : {}}\n >\n <FocusScope contain restoreFocus autoFocus>\n <ModalDialog\n ref={ref}\n {...overlayProps}\n {...modalProps}\n {...dialogProps}\n style={transitionEnabled ? { transform } : {}}\n size={size}\n bottomSheet={bottomSheet}\n >\n <ModalContext.Provider\n value={{ titleProps, title, close: onClose, showDismiss }}\n >\n {children}\n {isDismissable === true && (\n <ModalCrossButton\n size=\"S\"\n icon=\"24/Close\"\n onClick={onClose}\n />\n )}\n </ModalContext.Provider>\n </ModalDialog>\n </FocusScope>\n </ModalBackground>\n </Overlay>\n )\n )\n}\n\nconst ModalContext = React.createContext<{\n titleProps: React.HTMLAttributes<HTMLElement>\n title: string\n close?: () => void\n showDismiss: boolean\n}>({\n titleProps: {},\n title: '',\n close: undefined,\n showDismiss: true,\n})\n\nconst ModalBackground = animated(styled.div<{ zIndex: number }>`\n z-index: ${({ zIndex }) => zIndex};\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n\n ${theme((o) => [o.bg.surface4])}\n`)\n\nconst ModalDialog = animated(styled.div<{\n size: 'S' | 'M' | 'L'\n bottomSheet: boolean | 'full'\n}>`\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: ${(p) =>\n p.size === 'S'\n ? columnSystem(3, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2\n : p.size === 'M'\n ? columnSystem(4, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2\n : // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n p.size === 'L'\n ? columnSystem(6, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2\n : unreachable(p.size)}px;\n\n ${theme((o) => [o.bg.background1, o.borderRadius(24)])}\n\n @media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {\n ${(p) =>\n p.bottomSheet === 'full'\n ? css`\n top: auto;\n bottom: 0;\n left: 0;\n transform: none;\n border-radius: 0;\n width: 100%;\n height: 100%;\n `\n : p.bottomSheet\n ? css`\n top: auto;\n bottom: 0;\n left: 0;\n transform: none;\n border-radius: 0;\n width: 100%;\n `\n : css`\n width: calc(100% - 48px);\n `}\n }\n`)\n\nconst ModalCrossButton = styled(IconButton)`\n position: absolute;\n top: 8px;\n right: 8px;\n\n ${theme((o) => [o.font.text3.hover.press])}\n`\n\nexport function ModalTitle(props: React.HTMLAttributes<HTMLHeadingElement>) {\n const { titleProps, title } = useContext(ModalContext)\n return (\n <ModalHeading {...titleProps} {...props}>\n {title}\n </ModalHeading>\n )\n}\n\nconst ModalHeading = styled.h3`\n margin: 0;\n font-weight: inherit;\n font-size: inherit;\n`\n\nexport function ModalDismissButton({ children, ...props }: ButtonProps) {\n const { close, showDismiss } = useContext(ModalContext)\n\n if (!showDismiss) {\n return null\n }\n\n return (\n <Button {...props} onClick={close} fixed>\n {children}\n </Button>\n )\n}\n","/**\n * Unit for grid column (px)\n */\nexport const COLUMN_UNIT = 80\n\n/**\n * Unit for grid gutter width (px)\n */\nexport const GUTTER_UNIT = 24\n\n// TODO: Grid definition with breakpoint\n\n/**\n * Calculate px occupied by the span of the columns with gutter gap\n *\n * @param span column span count\n */\nexport function columnSystem(span: number, column: number, gutter: number) {\n return span * column + (span - 1) * gutter\n}\n","import React from 'react'\nimport { ModalTitle } from '.'\nimport styled from 'styled-components'\nimport { theme } from '../../styled'\nimport { maxWidth } from '@charcoal-ui/utils'\n\nexport function ModalHeader() {\n return (\n <ModalHeaderRoot>\n <StyledModalTitle />\n </ModalHeaderRoot>\n )\n}\n\nconst ModalHeaderRoot = styled.div`\n height: 64px;\n display: grid;\n align-content: center;\n justify-content: center;\n`\n\nconst StyledModalTitle = styled(ModalTitle)`\n ${theme((o) => [o.font.text1, o.typography(16).bold])}\n`\n\nexport const ModalAlign = styled.div`\n ${theme((o) => [o.padding.horizontal(24)])}\n\n @media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {\n ${theme((o) => [o.padding.horizontal(16)])}\n }\n`\n\nexport const ModalBody = styled.div`\n ${theme((o) => [o.padding.bottom(40)])}\n`\n\nexport const ModalButtons = styled.div`\n display: grid;\n grid-auto-flow: row;\n grid-row-gap: 8px;\n ${theme((o) => [o.padding.horizontal(24).top(16)])}\n\n @media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {\n ${theme((o) => [o.padding.horizontal(16)])}\n }\n`\n","import React, { useImperativeHandle, useRef } from 'react'\nimport styled, { keyframes } from 'styled-components'\nimport { theme } from '../../styled'\n\nexport default function LoadingSpinner({\n size = 48,\n padding = 16,\n transparent = false,\n}) {\n return (\n <LoadingSpinnerRoot size={size} padding={padding} transparent={transparent}>\n <LoadingSpinnerIcon />\n </LoadingSpinnerRoot>\n )\n}\n\nconst LoadingSpinnerRoot = styled.div.attrs({ role: 'progressbar' })<{\n size: number\n padding: number\n transparent: boolean\n}>`\n margin: auto;\n padding: ${(props) => props.padding}px;\n border-radius: 8px;\n font-size: ${(props) => props.size}px;\n width: ${(props) => props.size}px;\n height: ${(props) => props.size}px;\n opacity: 0.84;\n ${({ transparent }) =>\n theme((o) => [\n o.font.text4,\n transparent ? o.bg.transparent : o.bg.background1,\n ])}\n`\n\nconst scaleout = keyframes`\n from {\n transform: scale(0);\n opacity: 1;\n }\n\n to {\n transform: scale(1);\n opacity: 0;\n }\n`\n\nconst Icon = styled.div.attrs({ role: 'presentation' })<{ once: boolean }>`\n width: 1em;\n height: 1em;\n border-radius: 1em;\n background-color: currentColor;\n animation: ${scaleout} 1s both ease-out;\n animation-iteration-count: ${(p) => (p.once ? 1 : 'infinite')};\n\n &[data-reset-animation] {\n animation: none;\n }\n`\n\ninterface Props {\n once?: boolean\n}\n\nexport interface LoadingSpinnerIconHandler {\n restart(): void\n}\n\nexport const LoadingSpinnerIcon = React.forwardRef<\n LoadingSpinnerIconHandler,\n Props\n>(function LoadingSpinnerIcon({ once = false }, ref) {\n const iconRef = useRef<HTMLDivElement>(null)\n\n useImperativeHandle(ref, () => ({\n restart: () => {\n if (!iconRef.current) {\n return\n }\n iconRef.current.dataset.resetAnimation = 'true'\n // Force reflow hack!\n void iconRef.current.offsetWidth\n delete iconRef.current.dataset.resetAnimation\n },\n }))\n\n return <Icon ref={iconRef} once={once} />\n})\n","import React, { Key, useMemo, useRef } from 'react'\nimport styled from 'styled-components'\nimport { Item, useSelectState } from 'react-stately'\nimport { disabledSelector } from '@charcoal-ui/utils'\nimport { useVisuallyHidden } from '@react-aria/visually-hidden'\nimport { useSelect, HiddenSelect } from '@react-aria/select'\nimport { useButton } from '@react-aria/button'\nimport { SelectProps } from '@react-types/select'\nimport Listbox, { ListboxProps } from './Listbox'\nimport Popover from './Popover'\nimport Icon from '../Icon'\nimport FieldLabel from '../FieldLabel'\nimport { theme } from '../../styled'\n\nimport type { CollectionBase } from '@react-types/shared'\nimport type { ReactNode } from 'react'\n\ntype LabelProps = {\n readonly showLabel?: boolean\n readonly label: string\n readonly subLabel?: ReactNode\n readonly requiredText?: string\n}\n\ntype Empty = Record<string, unknown>\nexport type DropdownSelectorProps<T extends Empty = Empty> = LabelProps &\n Readonly<CollectionBase<T>> & {\n readonly id?: string\n readonly name?: string\n readonly autoComplete?: string\n readonly placeholder?: string\n readonly className?: string\n readonly disabled?: boolean\n readonly required?: boolean\n readonly invalid?: boolean\n readonly assertiveText?: string\n readonly value?: Key\n readonly defaultValue?: Key\n readonly open?: boolean\n readonly onOpenChange?: (isOpen?: boolean) => void\n readonly onChange?: (key: Key) => void\n readonly mode?: ListboxProps<T>['mode']\n }\n\nconst DropdownSelector = <T extends Record<string, unknown>>({\n open,\n className,\n label = '',\n requiredText = '',\n subLabel,\n assertiveText,\n autoComplete,\n invalid = false,\n disabled = false,\n required = false,\n showLabel = false,\n mode = 'default',\n ...props\n}: DropdownSelectorProps<T>) => {\n const { visuallyHiddenProps } = useVisuallyHidden()\n const triggerRef = useRef<HTMLButtonElement>(null)\n const selectProps = useMemo<SelectProps<T>>(\n () => ({\n ...props,\n label,\n isOpen: open,\n isDisabled: disabled,\n isRequired: required,\n errorMessage: invalid && assertiveText,\n validationState: invalid ? 'invalid' : 'valid',\n onSelectionChange: props.onChange,\n selectedKey: props.value,\n defaultSelectedKey: props.defaultValue,\n }),\n [assertiveText, disabled, invalid, label, open, props, required]\n )\n const state = useSelectState<T>(selectProps)\n\n const {\n labelProps,\n triggerProps,\n valueProps,\n menuProps,\n errorMessageProps,\n descriptionProps,\n } = useSelect<T>(selectProps, state, triggerRef)\n\n const { buttonProps } = useButton(triggerProps, triggerRef)\n\n const hasAssertiveText =\n assertiveText !== undefined && assertiveText.length > 0\n\n return (\n <DropdownSelectorRoot aria-disabled={disabled} className={className}>\n <DropdownFieldLabel\n label={label}\n required={required}\n requiredText={requiredText}\n subLabel={subLabel}\n {...labelProps}\n {...(!showLabel ? visuallyHiddenProps : {})}\n />\n <HiddenSelect\n state={state}\n triggerRef={triggerRef}\n label={label}\n name={props.name}\n isDisabled={disabled}\n autoComplete={autoComplete}\n />\n <DropdownButtonWrapper>\n <DropdownButton {...buttonProps} ref={triggerRef} invalid={invalid}>\n <DropdownButtonText {...valueProps}>\n {/*\n * react-stately の useSelectState から取得される selectedItem の型が常に\n * Node<T> であるが runtime では null が帰ってくることがある\n */}\n {/* eslint-disable-next-line @typescript-eslint/strict-boolean-expressions,@typescript-eslint/no-unnecessary-condition*/}\n {state.selectedItem\n ? state.selectedItem.rendered\n : props.placeholder}\n </DropdownButtonText>\n\n <DropdownButtonIcon name=\"16/Menu\" />\n </DropdownButton>\n {state.isOpen && (\n <DropdownPopover open={state.isOpen} onClose={() => state.close()}>\n <Listbox {...menuProps} state={state} mode={mode} />\n </DropdownPopover>\n )}\n </DropdownButtonWrapper>\n\n {hasAssertiveText && (\n <AssertiveText\n invalid={invalid}\n {...(invalid ? errorMessageProps : descriptionProps)}\n >\n {assertiveText}\n </AssertiveText>\n )}\n </DropdownSelectorRoot>\n )\n}\n\nexport default DropdownSelector\nexport const DropdownSelectorItem = Item\n\nconst DropdownSelectorRoot = styled.div`\n position: relative;\n display: inline-block;\n\n ${disabledSelector} {\n cursor: default;\n ${theme((o) => o.disabled)}\n }\n`\n\nconst DropdownFieldLabel = styled(FieldLabel)`\n width: 100%;\n\n ${theme((o) => o.margin.bottom(8))}\n`\n\nconst DropdownButtonWrapper = styled.div`\n position: relative;\n`\n\nconst DropdownButton = styled.button<{ invalid: boolean }>`\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n height: 40px;\n width: 288px;\n box-sizing: border-box;\n cursor: pointer;\n\n ${disabledSelector} {\n cursor: default;\n }\n\n ${({ invalid }) =>\n theme((o) => [\n o.border.default,\n o.padding.horizontal(8),\n o.outline.default.focus,\n o.bg.surface3,\n o.borderRadius(4),\n invalid && o.outline.assertive,\n ])}\n`\n\nconst DropdownButtonText = styled.span`\n text-align: left;\n\n ${theme((o) => [o.typography(14), o.font.text2])}\n`\n\nconst DropdownButtonIcon = styled(Icon)`\n ${theme((o) => [o.font.text2])}\n`\n\nconst AssertiveText = styled.div<{ invalid: boolean }>`\n ${({ invalid }) =>\n theme((o) => [\n o.typography(14),\n o.margin.top(8),\n invalid ? o.font.assertive : o.font.text2,\n ])}\n`\n\nconst DropdownPopover = styled(Popover)`\n position: absolute;\n width: 100%;\n\n top: 100%;\n margin-top: 2px;\n`\n","import React, { memo, useRef, Fragment, useMemo } from 'react'\nimport styled, { css } from 'styled-components'\nimport { ListProps, ListState } from 'react-stately'\nimport { useListBox, useOption } from '@react-aria/listbox'\nimport { mergeProps } from '@react-aria/utils'\nimport { useFocusRing } from '@react-aria/focus'\nimport { px } from '@charcoal-ui/utils'\nimport Icon from '../Icon'\nimport { theme } from '../../styled'\n\nimport type { Node } from '@react-types/shared'\n\ntype ListMode = 'default' | 'separator'\nexport type ListboxProps<T> = Omit<ListProps<T>, 'children'> & {\n state: ListState<T>\n mode?: ListMode\n}\n\nconst Listbox = <T,>({\n state,\n mode = 'default',\n ...props\n}: ListboxProps<T>) => {\n const ref = useRef<HTMLUListElement>(null)\n\n const { listBoxProps } = useListBox(props, state, ref)\n const collection = useMemo(\n () =>\n [...state.collection].map((node, index, self) => ({\n node,\n first: index === 0,\n last: index === self.length - 1,\n })),\n [state.collection]\n )\n\n return (\n <ListboxRoot ref={ref} {...listBoxProps}>\n {collection.map(({ node, last }) => (\n <Fragment key={node.key}>\n <Option item={node} state={state} mode={mode} />\n {!last && mode === 'separator' && <Divider />}\n </Fragment>\n ))}\n </ListboxRoot>\n )\n}\nexport default memo(Listbox)\n\nconst ListboxRoot = styled.ul`\n padding-left: 0;\n margin: 0;\n box-sizing: border-box;\n list-style: none;\n\n ${theme((o) => [\n o.bg.background1,\n o.border.default,\n o.borderRadius(8),\n o.outline.default.focus,\n ])}\n`\n\nconst Divider = styled.div.attrs({ role: 'separator' })`\n display: flex;\n ${theme((o) => [o.padding.horizontal(8)])}\n\n &:before {\n content: '';\n display: block;\n width: 100%;\n height: 1px;\n background: #00000014;\n }\n`\n\ntype OptionProps<T> = {\n item: Node<T>\n state: ListState<T>\n mode?: ListMode\n}\n\nconst Option = <T,>({ item, state, mode }: OptionProps<T>) => {\n const ref = useRef<HTMLLIElement>(null)\n\n const { optionProps, isSelected } = useOption(item, state, ref)\n const { focusProps } = useFocusRing()\n\n return (\n <OptionRoot {...mergeProps(optionProps, focusProps)} ref={ref} mode={mode}>\n <OptionCheckIcon name=\"16/Check\" isSelected={isSelected} />\n <OptionText>{item.rendered}</OptionText>\n </OptionRoot>\n )\n}\n\nconst OptionRoot = styled.li<{ mode?: ListMode }>`\n display: flex;\n align-items: center;\n gap: ${({ theme }) => px(theme.spacing[4])};\n height: 40px;\n cursor: pointer;\n outline: none;\n\n ${({ mode }) =>\n theme((o) => [\n o.padding.horizontal(8),\n mode === 'separator' && o.padding.vertical(4),\n ])}\n\n &:focus {\n ${theme((o) => [o.bg.surface3])}\n }\n`\nconst OptionCheckIcon = styled(Icon)<{ isSelected: boolean }>`\n visibility: hidden;\n ${theme((o) => [o.font.text2])}\n\n ${({ isSelected }) =>\n isSelected &&\n css`\n visibility: visible;\n `}\n`\nconst OptionText = styled.span`\n display: block;\n ${theme((o) => [o.typography(14), o.font.text2])}\n`\n","function toVal(mix) {\n\tvar k, y, str='';\n\n\tif (typeof mix === 'string' || typeof mix === 'number') {\n\t\tstr += mix;\n\t} else if (typeof mix === 'object') {\n\t\tif (Array.isArray(mix)) {\n\t\t\tfor (k=0; k < mix.length; k++) {\n\t\t\t\tif (mix[k]) {\n\t\t\t\t\tif (y = toVal(mix[k])) {\n\t\t\t\t\t\tstr && (str += ' ');\n\t\t\t\t\t\tstr += y;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor (k in mix) {\n\t\t\t\tif (mix[k]) {\n\t\t\t\t\tstr && (str += ' ');\n\t\t\t\t\tstr += k;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn str;\n}\n\nexport default function () {\n\tvar i=0, tmp, x, str='';\n\twhile (i < arguments.length) {\n\t\tif (tmp = arguments[i++]) {\n\t\t\tif (x = toVal(tmp)) {\n\t\t\t\tstr && (str += ' ');\n\t\t\t\tstr += x\n\t\t\t}\n\t\t}\n\t}\n\treturn str;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useId, mergeIds, useSlotId} from './useId';\nexport {chain} from './chain';\nexport {mergeProps} from './mergeProps';\nexport {mergeRefs} from './mergeRefs';\nexport {filterDOMProps} from './filterDOMProps';\nexport {focusWithoutScrolling} from './focusWithoutScrolling';\nexport {getOffset} from './getOffset';\nexport {runAfterTransition} from './runAfterTransition';\nexport {useDrag1D} from './useDrag1D';\nexport {useGlobalListeners} from './useGlobalListeners';\nexport {useLabels} from './useLabels';\nexport {useObjectRef} from './useObjectRef';\nexport {useUpdateEffect} from './useUpdateEffect';\nexport {useLayoutEffect} from './useLayoutEffect';\nexport {useResizeObserver} from './useResizeObserver';\nexport {useSyncRef} from './useSyncRef';\nexport {getScrollParent} from './getScrollParent';\nexport {useViewportSize} from './useViewportSize';\nexport {useDescription} from './useDescription';\nexport {isMac, isIPhone, isIPad, isIOS, isAppleDevice, isWebKit, isChrome, isAndroid} from './platform';\nexport {useEvent} from './useEvent';\nexport {useValueEffect} from './useValueEffect';\nexport {scrollIntoView} from './scrollIntoView';\nexport {clamp, snapValueToStep} from '@react-stately/utils';\nexport {isVirtualClick, isVirtualPointerEvent} from './isVirtualEvent';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {useCallback, useEffect, useRef, useState} from 'react';\nimport {useLayoutEffect} from './useLayoutEffect';\nimport {useSSRSafeId} from '@react-aria/ssr';\nimport {useValueEffect} from './';\n\nlet idsUpdaterMap: Map<string, (v: string) => void> = new Map();\n\n/**\n * If a default is not provided, generate an id.\n * @param defaultId - Default component id.\n */\nexport function useId(defaultId?: string): string {\n let [value, setValue] = useState(defaultId);\n let nextId = useRef(null);\n\n let res = useSSRSafeId(value);\n\n let updateValue = useCallback((val) => {\n nextId.current = val;\n }, []);\n\n idsUpdaterMap.set(res, updateValue);\n\n useLayoutEffect(() => {\n let r = res;\n return () => {\n idsUpdaterMap.delete(r);\n };\n }, [res]);\n\n // This cannot cause an infinite loop because the ref is updated first.\n // eslint-disable-next-line\n useEffect(() => {\n let newId = nextId.current;\n if (newId) {\n nextId.current = null;\n setValue(newId);\n }\n });\n\n return res;\n}\n\n/**\n * Merges two ids.\n * Different ids will trigger a side-effect and re-render components hooked up with `useId`.\n */\nexport function mergeIds(idA: string, idB: string): string {\n if (idA === idB) {\n return idA;\n }\n\n let setIdA = idsUpdaterMap.get(idA);\n if (setIdA) {\n setIdA(idB);\n return idB;\n }\n\n let setIdB = idsUpdaterMap.get(idB);\n if (setIdB) {\n setIdB(idA);\n return idA;\n }\n\n return idB;\n}\n\n/**\n * Used to generate an id, and after render, check if that id is rendered so we know\n * if we can use it in places such as labelledby.\n * @param depArray - When to recalculate if the id is in the DOM.\n */\nexport function useSlotId(depArray: ReadonlyArray<any> = []): string {\n let id = useId();\n let [resolvedId, setResolvedId] = useValueEffect(id);\n let updateId = useCallback(() => {\n setResolvedId(function *() {\n yield id;\n\n yield document.getElementById(id) ? id : undefined;\n });\n }, [id, setResolvedId]);\n\n useLayoutEffect(updateId, [id, updateId, ...depArray]);\n\n return resolvedId;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport React from 'react';\n\n// During SSR, React emits a warning when calling useLayoutEffect.\n// Since neither useLayoutEffect nor useEffect run on the server,\n// we can suppress this by replace it with a noop on the server.\nexport const useLayoutEffect = typeof window !== 'undefined'\n ? React.useLayoutEffect\n : () => {};\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/**\n * Calls all functions in the order they were chained with the same arguments.\n */\nexport function chain(...callbacks: any[]): (...args: any[]) => void {\n return (...args: any[]) => {\n for (let callback of callbacks) {\n if (typeof callback === 'function') {\n callback(...args);\n }\n }\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {chain} from './chain';\nimport clsx from 'clsx';\nimport {mergeIds} from './useId';\n\ninterface Props {\n [key: string]: any\n}\n\n// taken from: https://stackoverflow.com/questions/51603250/typescript-3-parameter-list-intersection-type/51604379#51604379\ntype TupleTypes<T> = { [P in keyof T]: T[P] } extends { [key: number]: infer V } ? V : never;\n// eslint-disable-next-line no-undef, @typescript-eslint/no-unused-vars\ntype UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\n\n/**\n * Merges multiple props objects together. Event handlers are chained,\n * classNames are combined, and ids are deduplicated - different ids\n * will trigger a side-effect and re-render components hooked up with `useId`.\n * For all other props, the last prop object overrides all previous ones.\n * @param args - Multiple sets of props to merge together.\n */\nexport function mergeProps<T extends Props[]>(...args: T): UnionToIntersection<TupleTypes<T>> {\n // Start with a base clone of the first argument. This is a lot faster than starting\n // with an empty object and adding properties as we go.\n let result: Props = {...args[0]};\n for (let i = 1; i < args.length; i++) {\n let props = args[i];\n for (let key in props) {\n let a = result[key];\n let b = props[key];\n\n // Chain events\n if (\n typeof a === 'function' &&\n typeof b === 'function' &&\n // This is a lot faster than a regex.\n key[0] === 'o' &&\n key[1] === 'n' &&\n key.charCodeAt(2) >= /* 'A' */ 65 &&\n key.charCodeAt(2) <= /* 'Z' */ 90\n ) {\n result[key] = chain(a, b);\n\n // Merge classnames, sometimes classNames are empty string which eval to false, so we just need to do a type check\n } else if (\n (key === 'className' || key === 'UNSAFE_className') &&\n typeof a === 'string' &&\n typeof b === 'string'\n ) {\n result[key] = clsx(a, b);\n } else if (key === 'id' && a && b) {\n result.id = mergeIds(a, b);\n // Override others\n } else {\n result[key] = b !== undefined ? b : a;\n }\n }\n }\n\n return result as UnionToIntersection<TupleTypes<T>>;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ForwardedRef} from 'react';\n\n/**\n * Merges multiple refs into one. Works with either callback or object refs.\n */\nexport function mergeRefs<T>(...refs: ForwardedRef<T>[]): ForwardedRef<T> {\n return (value: T) => {\n for (let ref of refs) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref != null) {\n ref.current = value;\n }\n }\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMProps} from '@react-types/shared';\n\nconst DOMPropNames = new Set([\n 'id'\n]);\n\nconst labelablePropNames = new Set([\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-details'\n]);\n\ninterface Options {\n /**\n * If labelling associated aria properties should be included in the filter.\n */\n labelable?: boolean,\n /**\n * A Set of other property names that should be included in the filter.\n */\n propNames?: Set<string>\n}\n\nconst propRe = /^(data-.*)$/;\n\n/**\n * Filters out all props that aren't valid DOM props or defined via override prop obj.\n * @param props - The component props to be filtered.\n * @param opts - Props to override.\n */\nexport function filterDOMProps(props: DOMProps & AriaLabelingProps, opts: Options = {}): DOMProps & AriaLabelingProps {\n let {labelable, propNames} = opts;\n let filteredProps = {};\n\n for (const prop in props) {\n if (\n Object.prototype.hasOwnProperty.call(props, prop) && (\n DOMPropNames.has(prop) ||\n (labelable && labelablePropNames.has(prop)) ||\n propNames?.has(prop) ||\n propRe.test(prop)\n )\n ) {\n filteredProps[prop] = props[prop];\n }\n }\n\n return filteredProps;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {FocusableElement} from '@react-types/shared';\n\n// This is a polyfill for element.focus({preventScroll: true});\n// Currently necessary for Safari and old Edge:\n// https://caniuse.com/#feat=mdn-api_htmlelement_focus_preventscroll_option\n// See https://bugs.webkit.org/show_bug.cgi?id=178583\n//\n\n// Original licensing for the following methods can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/calvellido/focus-options-polyfill\n\ninterface ScrollableElement {\n element: HTMLElement,\n scrollTop: number,\n scrollLeft: number\n}\n\nexport function focusWithoutScrolling(element: FocusableElement) {\n if (supportsPreventScroll()) {\n element.focus({preventScroll: true});\n } else {\n let scrollableElements = getScrollableElements(element);\n element.focus();\n restoreScrollPosition(scrollableElements);\n }\n}\n\nlet supportsPreventScrollCached: boolean = null;\nfunction supportsPreventScroll() {\n if (supportsPreventScrollCached == null) {\n supportsPreventScrollCached = false;\n try {\n var focusElem = document.createElement('div');\n focusElem.focus({\n get preventScroll() {\n supportsPreventScrollCached = true;\n return true;\n }\n });\n } catch (e) {\n // Ignore\n }\n }\n\n return supportsPreventScrollCached;\n}\n\nfunction getScrollableElements(element: FocusableElement): ScrollableElement[] {\n var parent = element.parentNode;\n var scrollableElements: ScrollableElement[] = [];\n var rootScrollingElement = document.scrollingElement || document.documentElement;\n\n while (parent instanceof HTMLElement && parent !== rootScrollingElement) {\n if (\n parent.offsetHeight < parent.scrollHeight ||\n parent.offsetWidth < parent.scrollWidth\n ) {\n scrollableElements.push({\n element: parent,\n scrollTop: parent.scrollTop,\n scrollLeft: parent.scrollLeft\n });\n }\n parent = parent.parentNode;\n }\n\n if (rootScrollingElement instanceof HTMLElement) {\n scrollableElements.push({\n element: rootScrollingElement,\n scrollTop: rootScrollingElement.scrollTop,\n scrollLeft: rootScrollingElement.scrollLeft\n });\n }\n\n return scrollableElements;\n}\n\nfunction restoreScrollPosition(scrollableElements: ScrollableElement[]) {\n for (let {element, scrollTop, scrollLeft} of scrollableElements) {\n element.scrollTop = scrollTop;\n element.scrollLeft = scrollLeft;\n }\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport function getOffset(element, reverse, orientation = 'horizontal') {\n let rect = element.getBoundingClientRect();\n if (reverse) {\n return orientation === 'horizontal' ? rect.right : rect.bottom;\n }\n return orientation === 'horizontal' ? rect.left : rect.top;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// We store a global list of elements that are currently transitioning,\n// mapped to a set of CSS properties that are transitioning for that element.\n// This is necessary rather than a simple count of transitions because of browser\n// bugs, e.g. Chrome sometimes fires both transitionend and transitioncancel rather\n// than one or the other. So we need to track what's actually transitioning so that\n// we can ignore these duplicate events.\nlet transitionsByElement = new Map<EventTarget, Set<string>>();\n\n// A list of callbacks to call once there are no transitioning elements.\nlet transitionCallbacks = new Set<() => void>();\n\nfunction setupGlobalEvents() {\n if (typeof window === 'undefined') {\n return;\n }\n\n let onTransitionStart = (e: TransitionEvent) => {\n // Add the transitioning property to the list for this element.\n let transitions = transitionsByElement.get(e.target);\n if (!transitions) {\n transitions = new Set();\n transitionsByElement.set(e.target, transitions);\n\n // The transitioncancel event must be registered on the element itself, rather than as a global\n // event. This enables us to handle when the node is deleted from the document while it is transitioning.\n // In that case, the cancel event would have nowhere to bubble to so we need to handle it directly.\n e.target.addEventListener('transitioncancel', onTransitionEnd);\n }\n\n transitions.add(e.propertyName);\n };\n\n let onTransitionEnd = (e: TransitionEvent) => {\n // Remove property from list of transitioning properties.\n let properties = transitionsByElement.get(e.target);\n if (!properties) {\n return;\n }\n\n properties.delete(e.propertyName);\n\n // If empty, remove transitioncancel event, and remove the element from the list of transitioning elements.\n if (properties.size === 0) {\n e.target.removeEventListener('transitioncancel', onTransitionEnd);\n transitionsByElement.delete(e.target);\n }\n\n // If no transitioning elements, call all of the queued callbacks.\n if (transitionsByElement.size === 0) {\n for (let cb of transitionCallbacks) {\n cb();\n }\n\n transitionCallbacks.clear();\n }\n };\n\n document.body.addEventListener('transitionrun', onTransitionStart);\n document.body.addEventListener('transitionend', onTransitionEnd);\n}\n\nif (typeof document !== 'undefined') {\n if (document.readyState !== 'loading') {\n setupGlobalEvents();\n } else {\n document.addEventListener('DOMContentLoaded', setupGlobalEvents);\n }\n}\n\nexport function runAfterTransition(fn: () => void) {\n // Wait one frame to see if an animation starts, e.g. a transition on mount.\n requestAnimationFrame(() => {\n // If no transitions are running, call the function immediately.\n // Otherwise, add it to a list of callbacks to run at the end of the animation.\n if (transitionsByElement.size === 0) {\n fn();\n } else {\n transitionCallbacks.add(fn);\n }\n });\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {getOffset} from './getOffset';\nimport {Orientation} from '@react-types/shared';\nimport React, {HTMLAttributes, MutableRefObject, useRef} from 'react';\n\ninterface UseDrag1DProps {\n containerRef: MutableRefObject<HTMLElement>,\n reverse?: boolean,\n orientation?: Orientation,\n onHover?: (hovered: boolean) => void,\n onDrag?: (dragging: boolean) => void,\n onPositionChange?: (position: number) => void,\n onIncrement?: () => void,\n onDecrement?: () => void,\n onIncrementToMax?: () => void,\n onDecrementToMin?: () => void,\n onCollapseToggle?: () => void\n}\n\n// Keep track of elements that we are currently handling dragging for via useDrag1D.\n// If there's an ancestor and a descendant both using useDrag1D(), and the user starts\n// dragging the descendant, we don't want useDrag1D events to fire for the ancestor.\nconst draggingElements: HTMLElement[] = [];\n\n// created for splitview, this should be reusable for things like sliders/dials\n// It also handles keyboard events on the target allowing for increment/decrement by a given stepsize as well as minifying/maximizing and toggling between minified and previous size\n// It can also take a 'reverse' param to say if we should measure from the right/bottom instead of the top/left\n// It can also handle either a vertical or horizontal movement, but not both at the same time\n\nexport function useDrag1D(props: UseDrag1DProps): HTMLAttributes<HTMLElement> {\n console.warn('useDrag1D is deprecated, please use `useMove` instead https://react-spectrum.adobe.com/react-aria/useMove.html');\n let {containerRef, reverse, orientation, onHover, onDrag, onPositionChange, onIncrement, onDecrement, onIncrementToMax, onDecrementToMin, onCollapseToggle} = props;\n let getPosition = (e) => orientation === 'horizontal' ? e.clientX : e.clientY;\n let getNextOffset = (e: MouseEvent) => {\n let containerOffset = getOffset(containerRef.current, reverse, orientation);\n let mouseOffset = getPosition(e);\n let nextOffset = reverse ? containerOffset - mouseOffset : mouseOffset - containerOffset;\n return nextOffset;\n };\n let dragging = useRef(false);\n let prevPosition = useRef(0);\n\n // Keep track of the current handlers in a ref so that the events can access them.\n let handlers = useRef({onPositionChange, onDrag});\n handlers.current.onDrag = onDrag;\n handlers.current.onPositionChange = onPositionChange;\n\n let onMouseDragged = (e: MouseEvent) => {\n e.preventDefault();\n let nextOffset = getNextOffset(e);\n if (!dragging.current) {\n dragging.current = true;\n if (handlers.current.onDrag) {\n handlers.current.onDrag(true);\n }\n if (handlers.current.onPositionChange) {\n handlers.current.onPositionChange(nextOffset);\n }\n }\n if (prevPosition.current === nextOffset) {\n return;\n }\n prevPosition.current = nextOffset;\n if (onPositionChange) {\n onPositionChange(nextOffset);\n }\n };\n\n let onMouseUp = (e: MouseEvent) => {\n const target = e.target as HTMLElement;\n dragging.current = false;\n let nextOffset = getNextOffset(e);\n if (handlers.current.onDrag) {\n handlers.current.onDrag(false);\n }\n if (handlers.current.onPositionChange) {\n handlers.current.onPositionChange(nextOffset);\n }\n\n draggingElements.splice(draggingElements.indexOf(target), 1);\n window.removeEventListener('mouseup', onMouseUp, false);\n window.removeEventListener('mousemove', onMouseDragged, false);\n };\n\n let onMouseDown = (e: React.MouseEvent<HTMLElement>) => {\n const target = e.currentTarget;\n // If we're already handling dragging on a descendant with useDrag1D, then\n // we don't want to handle the drag motion on this target as well.\n if (draggingElements.some(elt => target.contains(elt))) {\n return;\n }\n draggingElements.push(target);\n window.addEventListener('mousemove', onMouseDragged, false);\n window.addEventListener('mouseup', onMouseUp, false);\n };\n\n let onMouseEnter = () => {\n if (onHover) {\n onHover(true);\n }\n };\n\n let onMouseOut = () => {\n if (onHover) {\n onHover(false);\n }\n };\n\n let onKeyDown = (e) => {\n switch (e.key) {\n case 'Left':\n case 'ArrowLeft':\n if (orientation === 'horizontal') {\n e.preventDefault();\n if (onDecrement && !reverse) {\n onDecrement();\n } else if (onIncrement && reverse) {\n onIncrement();\n }\n }\n break;\n case 'Up':\n case 'ArrowUp':\n if (orientation === 'vertical') {\n e.preventDefault();\n if (onDecrement && !reverse) {\n onDecrement();\n } else if (onIncrement && reverse) {\n onIncrement();\n }\n }\n break;\n case 'Right':\n case 'ArrowRight':\n if (orientation === 'horizontal') {\n e.preventDefault();\n if (onIncrement && !reverse) {\n onIncrement();\n } else if (onDecrement && reverse) {\n onDecrement();\n }\n }\n break;\n case 'Down':\n case 'ArrowDown':\n if (orientation === 'vertical') {\n e.preventDefault();\n if (onIncrement && !reverse) {\n onIncrement();\n } else if (onDecrement && reverse) {\n onDecrement();\n }\n }\n break;\n case 'Home':\n e.preventDefault();\n if (onDecrementToMin) {\n onDecrementToMin();\n }\n break;\n case 'End':\n e.preventDefault();\n if (onIncrementToMax) {\n onIncrementToMax();\n }\n break;\n case 'Enter':\n e.preventDefault();\n if (onCollapseToggle) {\n onCollapseToggle();\n }\n break;\n }\n };\n\n return {onMouseDown, onMouseEnter, onMouseOut, onKeyDown};\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {useCallback, useEffect, useRef} from 'react';\n\ninterface GlobalListeners {\n addGlobalListener<K extends keyof DocumentEventMap>(el: EventTarget, type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void,\n addGlobalListener(el: EventTarget, type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void,\n removeGlobalListener<K extends keyof DocumentEventMap>(el: EventTarget, type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void,\n removeGlobalListener(el: EventTarget, type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void,\n removeAllGlobalListeners(): void\n}\n\nexport function useGlobalListeners(): GlobalListeners {\n let globalListeners = useRef(new Map());\n let addGlobalListener = useCallback((eventTarget, type, listener, options) => {\n // Make sure we remove the listener after it is called with the `once` option.\n let fn = options?.once ? (...args) => {\n globalListeners.current.delete(listener);\n listener(...args);\n } : listener;\n globalListeners.current.set(listener, {type, eventTarget, fn, options});\n eventTarget.addEventListener(type, listener, options);\n }, []);\n let removeGlobalListener = useCallback((eventTarget, type, listener, options) => {\n let fn = globalListeners.current.get(listener)?.fn || listener;\n eventTarget.removeEventListener(type, fn, options);\n globalListeners.current.delete(listener);\n }, []);\n let removeAllGlobalListeners = useCallback(() => {\n globalListeners.current.forEach((value, key) => {\n removeGlobalListener(value.eventTarget, value.type, key, value.options);\n });\n }, [removeGlobalListener]);\n\n // eslint-disable-next-line arrow-body-style\n useEffect(() => {\n return removeAllGlobalListeners;\n }, [removeAllGlobalListeners]);\n\n return {addGlobalListener, removeGlobalListener, removeAllGlobalListeners};\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMProps} from '@react-types/shared';\nimport {useId} from './useId';\n\n/**\n * Merges aria-label and aria-labelledby into aria-labelledby when both exist.\n * @param props - Aria label props.\n * @param defaultLabel - Default value for aria-label when not present.\n */\nexport function useLabels(props: DOMProps & AriaLabelingProps, defaultLabel?: string): DOMProps & AriaLabelingProps {\n let {\n id,\n 'aria-label': label,\n 'aria-labelledby': labelledBy\n } = props;\n\n // If there is both an aria-label and aria-labelledby,\n // combine them by pointing to the element itself.\n id = useId(id);\n if (labelledBy && label) {\n let ids = new Set([...labelledBy.trim().split(/\\s+/), id]);\n labelledBy = [...ids].join(' ');\n } else if (labelledBy) {\n labelledBy = labelledBy.trim().split(/\\s+/).join(' ');\n }\n\n // If no labels are provided, use the default\n if (!label && !labelledBy && defaultLabel) {\n label = defaultLabel;\n }\n\n return {\n id,\n 'aria-label': label,\n 'aria-labelledby': labelledBy\n };\n}\n","/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {MutableRefObject, useRef} from 'react';\nimport {useLayoutEffect} from './';\n\n/**\n * Offers an object ref for a given callback ref or an object ref. Especially\n * helfpul when passing forwarded refs (created using `React.forwardRef`) to\n * React Aria Hooks.\n *\n * @param forwardedRef The original ref intended to be used.\n * @returns An object ref that updates the given ref.\n * @see https://reactjs.org/docs/forwarding-refs.html\n */\nexport function useObjectRef<T>(forwardedRef?: ((instance: T | null) => void) | MutableRefObject<T | null> | null): MutableRefObject<T> {\n const objRef = useRef<T>();\n\n /**\n * We're using `useLayoutEffect` here instead of `useEffect` because we want\n * to make sure that the `ref` value is up to date before other places in the\n * the execution cycle try to read it.\n */\n useLayoutEffect(() => {\n if (!forwardedRef) {\n return;\n }\n\n if (typeof forwardedRef === 'function') {\n forwardedRef(objRef.current);\n } else {\n forwardedRef.current = objRef.current;\n }\n }, [forwardedRef]);\n\n return objRef;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {EffectCallback, useEffect, useRef} from 'react';\n\n// Like useEffect, but only called for updates after the initial render.\nexport function useUpdateEffect(effect: EffectCallback, dependencies: any[]) {\n const isInitialMount = useRef(true);\n\n useEffect(() => {\n if (isInitialMount.current) {\n isInitialMount.current = false;\n } else {\n effect();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies);\n}\n","import {RefObject, useEffect} from 'react';\n\nfunction hasResizeObserver() {\n return typeof window.ResizeObserver !== 'undefined';\n}\n\ntype useResizeObserverOptionsType<T> = {\n ref: RefObject<T | undefined> | undefined,\n onResize: () => void\n}\n\nexport function useResizeObserver<T extends Element>(options: useResizeObserverOptionsType<T>) {\n const {ref, onResize} = options;\n\n useEffect(() => {\n let element = ref?.current;\n if (!element) {\n return;\n }\n\n if (!hasResizeObserver()) {\n window.addEventListener('resize', onResize, false);\n return () => {\n window.removeEventListener('resize', onResize, false);\n };\n } else {\n\n const resizeObserverInstance = new window.ResizeObserver((entries) => {\n if (!entries.length) {\n return;\n }\n\n onResize();\n });\n resizeObserverInstance.observe(element);\n\n return () => {\n if (element) {\n resizeObserverInstance.unobserve(element);\n }\n };\n }\n\n }, [onResize, ref]);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {MutableRefObject, RefObject} from 'react';\nimport {useLayoutEffect} from './';\n\ninterface ContextValue<T> {\n ref?: MutableRefObject<T>\n}\n\n// Syncs ref from context with ref passed to hook\nexport function useSyncRef<T>(context: ContextValue<T>, ref: RefObject<T>) {\n useLayoutEffect(() => {\n if (context && context.ref && ref) {\n context.ref.current = ref.current;\n return () => {\n context.ref.current = null;\n };\n }\n }, [context, ref]);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport function getScrollParent(node: Element): Element {\n while (node && !isScrollable(node)) {\n node = node.parentElement;\n }\n\n return node || document.scrollingElement || document.documentElement;\n}\n\nfunction isScrollable(node: Element): boolean {\n let style = window.getComputedStyle(node);\n return /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {useEffect, useState} from 'react';\n\ninterface ViewportSize {\n width: number,\n height: number\n}\n\n// @ts-ignore\nlet visualViewport = typeof window !== 'undefined' && window.visualViewport;\n\nexport function useViewportSize(): ViewportSize {\n let [size, setSize] = useState(() => getViewportSize());\n\n useEffect(() => {\n // Use visualViewport api to track available height even on iOS virtual keyboard opening\n let onResize = () => {\n setSize(size => {\n let newSize = getViewportSize();\n if (newSize.width === size.width && newSize.height === size.height) {\n return size;\n }\n return newSize;\n });\n };\n\n if (!visualViewport) {\n window.addEventListener('resize', onResize);\n } else {\n visualViewport.addEventListener('resize', onResize);\n }\n\n return () => {\n if (!visualViewport) {\n window.removeEventListener('resize', onResize);\n } else {\n visualViewport.removeEventListener('resize', onResize);\n }\n };\n }, []);\n\n return size;\n}\n\nfunction getViewportSize(): ViewportSize {\n return {\n width: visualViewport?.width || window.innerWidth,\n height: visualViewport?.height || window.innerHeight\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps} from '@react-types/shared';\nimport {useLayoutEffect} from './useLayoutEffect';\nimport {useState} from 'react';\n\nlet descriptionId = 0;\nconst descriptionNodes = new Map<string, {refCount: number, element: Element}>();\n\nexport function useDescription(description: string): AriaLabelingProps {\n let [id, setId] = useState(undefined);\n\n useLayoutEffect(() => {\n if (!description) {\n return;\n }\n\n let desc = descriptionNodes.get(description);\n if (!desc) {\n let id = `react-aria-description-${descriptionId++}`;\n setId(id);\n\n let node = document.createElement('div');\n node.id = id;\n node.style.display = 'none';\n node.textContent = description;\n document.body.appendChild(node);\n desc = {refCount: 0, element: node};\n descriptionNodes.set(description, desc);\n } else {\n setId(desc.element.id);\n }\n\n desc.refCount++;\n return () => {\n if (--desc.refCount === 0) {\n desc.element.remove();\n descriptionNodes.delete(description);\n }\n };\n }, [description]);\n\n return {\n 'aria-describedby': description ? id : undefined\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nfunction testUserAgent(re: RegExp) {\n if (typeof window === 'undefined' || window.navigator == null) {\n return false;\n }\n return (\n window.navigator['userAgentData']?.brands.some((brand: {brand: string, version: string}) => re.test(brand.brand))\n ) ||\n re.test(window.navigator.userAgent);\n}\n\nfunction testPlatform(re: RegExp) {\n return typeof window !== 'undefined' && window.navigator != null\n ? re.test(window.navigator['userAgentData']?.platform || window.navigator.platform)\n : false;\n}\n\nexport function isMac() {\n return testPlatform(/^Mac/i);\n}\n\nexport function isIPhone() {\n return testPlatform(/^iPhone/i);\n}\n\nexport function isIPad() {\n return testPlatform(/^iPad/i) ||\n // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.\n (isMac() && navigator.maxTouchPoints > 1);\n}\n\nexport function isIOS() {\n return isIPhone() || isIPad();\n}\n\nexport function isAppleDevice() {\n return isMac() || isIOS();\n}\n\nexport function isWebKit() {\n return testUserAgent(/AppleWebKit/i) && !isChrome();\n}\n\nexport function isChrome() {\n return testUserAgent(/Chrome/i);\n}\n\nexport function isAndroid() {\n return testUserAgent(/Android/i);\n}\n","/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {RefObject, useEffect, useRef} from 'react';\n\nexport function useEvent<K extends keyof GlobalEventHandlersEventMap>(\n ref: RefObject<EventTarget>,\n event: K,\n handler: (this: Document, ev: GlobalEventHandlersEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions\n) {\n let handlerRef = useRef(handler);\n handlerRef.current = handler;\n\n let isDisabled = handler == null;\n\n useEffect(() => {\n if (isDisabled) {\n return;\n }\n\n let element = ref.current;\n let handler = (e: GlobalEventHandlersEventMap[K]) => handlerRef.current.call(this, e);\n\n element.addEventListener(event, handler, options);\n return () => {\n element.removeEventListener(event, handler, options);\n };\n }, [ref, event, options, isDisabled]);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Dispatch, useCallback, useRef, useState} from 'react';\nimport {useLayoutEffect} from './';\n\ntype SetValueAction<S> = (prev: S) => Generator<any, void, unknown>;\n\n// This hook works like `useState`, but when setting the value, you pass a generator function\n// that can yield multiple values. Each yielded value updates the state and waits for the next\n// layout effect, then continues the generator. This allows sequential updates to state to be\n// written linearly.\nexport function useValueEffect<S>(defaultValue: S | (() => S)): [S, Dispatch<SetValueAction<S>>] {\n let [value, setValue] = useState(defaultValue);\n let valueRef = useRef(value);\n let effect = useRef(null);\n\n valueRef.current = value;\n\n // Store the function in a ref so we can always access the current version\n // which has the proper `value` in scope.\n let nextRef = useRef(null);\n nextRef.current = () => {\n // Run the generator to the next yield.\n let newValue = effect.current.next();\n\n // If the generator is done, reset the effect.\n if (newValue.done) {\n effect.current = null;\n return;\n }\n\n // If the value is the same as the current value,\n // then continue to the next yield. Otherwise,\n // set the value in state and wait for the next layout effect.\n if (value === newValue.value) {\n nextRef.current();\n } else {\n setValue(newValue.value);\n }\n };\n\n useLayoutEffect(() => {\n // If there is an effect currently running, continue to the next yield.\n if (effect.current) {\n nextRef.current();\n }\n });\n\n let queue = useCallback(fn => {\n effect.current = fn(valueRef.current);\n nextRef.current();\n }, [effect, nextRef]);\n\n return [value, queue];\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/**\n * Scrolls `scrollView` so that `element` is visible.\n * Similar to `element.scrollIntoView({block: 'nearest'})` (not supported in Edge),\n * but doesn't affect parents above `scrollView`.\n */\nexport function scrollIntoView(scrollView: HTMLElement, element: HTMLElement) {\n let offsetX = relativeOffset(scrollView, element, 'left');\n let offsetY = relativeOffset(scrollView, element, 'top');\n let width = element.offsetWidth;\n let height = element.offsetHeight;\n let x = scrollView.scrollLeft;\n let y = scrollView.scrollTop;\n let maxX = x + scrollView.offsetWidth;\n let maxY = y + scrollView.offsetHeight;\n\n if (offsetX <= x) {\n x = offsetX;\n } else if (offsetX + width > maxX) {\n x += offsetX + width - maxX;\n }\n if (offsetY <= y) {\n y = offsetY;\n } else if (offsetY + height > maxY) {\n y += offsetY + height - maxY;\n }\n\n scrollView.scrollLeft = x;\n scrollView.scrollTop = y;\n}\n\n/**\n * Computes the offset left or top from child to ancestor by accumulating\n * offsetLeft or offsetTop through intervening offsetParents.\n */\nfunction relativeOffset(ancestor: HTMLElement, child: HTMLElement, axis: 'left'|'top') {\n const prop = axis === 'left' ? 'offsetLeft' : 'offsetTop';\n let sum = 0;\n while (child.offsetParent) {\n sum += child[prop];\n if (child.offsetParent === ancestor) {\n // Stop once we have found the ancestor we are interested in.\n break;\n } else if (child.offsetParent.contains(ancestor)) {\n // If the ancestor is not `position:relative`, then we stop at\n // _its_ offset parent, and we subtract off _its_ offset, so that\n // we end up with the proper offset from child to ancestor.\n sum -= ancestor[prop];\n break;\n }\n child = child.offsetParent as HTMLElement;\n }\n return sum;\n}\n","/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {isAndroid} from './platform';\n\n// Original licensing for the following method can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/facebook/react/blob/3c713d513195a53788b3f8bb4b70279d68b15bcc/packages/react-interactions/events/src/dom/shared/index.js#L74-L87\n\n// Keyboards, Assistive Technologies, and element.click() all produce a \"virtual\"\n// click event. This is a method of inferring such clicks. Every browser except\n// IE 11 only sets a zero value of \"detail\" for click events that are \"virtual\".\n// However, IE 11 uses a zero value for all click events. For IE 11 we rely on\n// the quirk that it produces click events that are of type PointerEvent, and\n// where only the \"virtual\" click lacks a pointerType field.\n\nexport function isVirtualClick(event: MouseEvent | PointerEvent): boolean {\n // JAWS/NVDA with Firefox.\n if ((event as any).mozInputSource === 0 && event.isTrusted) {\n return true;\n }\n\n // Android TalkBack's detail value varies depending on the event listener providing the event so we have specific logic here instead\n // If pointerType is defined, event is from a click listener. For events from mousedown listener, detail === 0 is a sufficient check\n // to detect TalkBack virtual clicks.\n if (isAndroid() && (event as PointerEvent).pointerType) {\n return event.type === 'click' && event.buttons === 1;\n }\n\n return event.detail === 0 && !(event as PointerEvent).pointerType;\n}\n\nexport function isVirtualPointerEvent(event: PointerEvent) {\n // If the pointer size is zero, then we assume it's from a screen reader.\n // Android TalkBack double tap will sometimes return a event with width and height of 1\n // and pointerType === 'mouse' so we need to check for a specific combination of event attributes.\n // Cannot use \"event.pressure === 0\" as the sole check due to Safari pointer events always returning pressure === 0\n // instead of .5, see https://bugs.webkit.org/show_bug.cgi?id=206216. event.pointerType === 'mouse' is to distingush\n // Talkback double tap from Windows Firefox touch screen press\n return (\n (event.width === 0 && event.height === 0) ||\n (event.width === 1 &&\n event.height === 1 &&\n event.pressure === 0 &&\n event.detail === 0 &&\n event.pointerType === 'mouse'\n )\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {Pressable} from './Pressable';\nexport {PressResponder} from './PressResponder';\nexport {useFocus} from './useFocus';\nexport {\n isFocusVisible,\n getInteractionModality,\n setInteractionModality,\n useInteractionModality,\n useFocusVisible,\n useFocusVisibleListener\n} from './useFocusVisible';\nexport {useFocusWithin} from './useFocusWithin';\nexport {useHover} from './useHover';\nexport {useInteractOutside} from './useInteractOutside';\nexport {useKeyboard} from './useKeyboard';\nexport {useMove} from './useMove';\nexport {usePress} from './usePress';\nexport {useScrollWheel} from './useScrollWheel';\nexport {useLongPress} from './useLongPress';\n\nexport type {FocusProps, FocusResult} from './useFocus';\nexport type {FocusVisibleHandler, FocusVisibleProps, FocusVisibleResult, Modality} from './useFocusVisible';\nexport type {FocusWithinProps, FocusWithinResult} from './useFocusWithin';\nexport type {HoverProps, HoverResult} from './useHover';\nexport type {InteractOutsideProps} from './useInteractOutside';\nexport type {KeyboardProps, KeyboardResult} from './useKeyboard';\nexport type {PressProps, PressHookProps, PressResult} from './usePress';\nexport type {MoveEvents} from '@react-types/shared';\nexport type {MoveResult} from './useMove';\nexport type {LongPressProps, LongPressResult} from './useLongPress';\nexport type {ScrollWheelProps} from './useScrollWheel';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMAttributes} from '@react-types/shared';\nimport {mergeProps} from '@react-aria/utils';\nimport {PressProps, usePress} from './usePress';\nimport React, {ReactElement, RefObject, useRef} from 'react';\n\ninterface PressableProps extends PressProps {\n children: ReactElement<DOMAttributes, string>\n}\n\nexport const Pressable = React.forwardRef(({children, ...props}: PressableProps, ref: RefObject<Element>) => {\n let newRef = useRef();\n ref = ref ?? newRef;\n let {pressProps} = usePress({...props, ref});\n let child = React.Children.only(children);\n return React.cloneElement(\n child,\n // @ts-ignore\n {ref, ...mergeProps(child.props, pressProps)}\n );\n});\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from react.\n// Original licensing for the following can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions\n\nimport {disableTextSelection, restoreTextSelection} from './textSelection';\nimport {DOMAttributes, FocusableElement, PointerType, PressEvents} from '@react-types/shared';\nimport {focusWithoutScrolling, isVirtualClick, isVirtualPointerEvent, mergeProps, useGlobalListeners, useSyncRef} from '@react-aria/utils';\nimport {PressResponderContext} from './context';\nimport {RefObject, useContext, useEffect, useMemo, useRef, useState} from 'react';\n\nexport interface PressProps extends PressEvents {\n /** Whether the target is in a controlled press state (e.g. an overlay it triggers is open). */\n isPressed?: boolean,\n /** Whether the press events should be disabled. */\n isDisabled?: boolean,\n /** Whether the target should not receive focus on press. */\n preventFocusOnPress?: boolean,\n /**\n * Whether press events should be canceled when the pointer leaves the target while pressed.\n * By default, this is `false`, which means if the pointer returns back over the target while\n * still pressed, onPressStart will be fired again. If set to `true`, the press is canceled\n * when the pointer leaves the target and onPressStart will not be fired if the pointer returns.\n */\n shouldCancelOnPointerExit?: boolean,\n /** Whether text selection should be enabled on the pressable element. */\n allowTextSelectionOnPress?: boolean\n}\n\nexport interface PressHookProps extends PressProps {\n /** A ref to the target element. */\n ref?: RefObject<Element>\n}\n\ninterface PressState {\n isPressed: boolean,\n ignoreEmulatedMouseEvents: boolean,\n ignoreClickAfterPress: boolean,\n didFirePressStart: boolean,\n activePointerId: any,\n target: FocusableElement | null,\n isOverTarget: boolean,\n pointerType: PointerType,\n userSelect?: string\n}\n\ninterface EventBase {\n currentTarget: EventTarget,\n shiftKey: boolean,\n ctrlKey: boolean,\n metaKey: boolean,\n altKey: boolean\n}\n\nexport interface PressResult {\n /** Whether the target is currently pressed. */\n isPressed: boolean,\n /** Props to spread on the target element. */\n pressProps: DOMAttributes\n}\n\nfunction usePressResponderContext(props: PressHookProps): PressHookProps {\n // Consume context from <PressResponder> and merge with props.\n let context = useContext(PressResponderContext);\n if (context) {\n let {register, ...contextProps} = context;\n props = mergeProps(contextProps, props) as PressHookProps;\n register();\n }\n useSyncRef(context, props.ref);\n\n return props;\n}\n\n/**\n * Handles press interactions across mouse, touch, keyboard, and screen readers.\n * It normalizes behavior across browsers and platforms, and handles many nuances\n * of dealing with pointer and keyboard events.\n */\nexport function usePress(props: PressHookProps): PressResult {\n let {\n onPress,\n onPressChange,\n onPressStart,\n onPressEnd,\n onPressUp,\n isDisabled,\n isPressed: isPressedProp,\n preventFocusOnPress,\n shouldCancelOnPointerExit,\n allowTextSelectionOnPress,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ref: _, // Removing `ref` from `domProps` because TypeScript is dumb\n ...domProps\n } = usePressResponderContext(props);\n let propsRef = useRef<PressHookProps>(null);\n propsRef.current = {onPress, onPressChange, onPressStart, onPressEnd, onPressUp, isDisabled, shouldCancelOnPointerExit};\n\n let [isPressed, setPressed] = useState(false);\n let ref = useRef<PressState>({\n isPressed: false,\n ignoreEmulatedMouseEvents: false,\n ignoreClickAfterPress: false,\n didFirePressStart: false,\n activePointerId: null,\n target: null,\n isOverTarget: false,\n pointerType: null\n });\n\n let {addGlobalListener, removeAllGlobalListeners} = useGlobalListeners();\n\n let pressProps = useMemo(() => {\n let state = ref.current;\n let triggerPressStart = (originalEvent: EventBase, pointerType: PointerType) => {\n let {onPressStart, onPressChange, isDisabled} = propsRef.current;\n if (isDisabled || state.didFirePressStart) {\n return;\n }\n\n if (onPressStart) {\n onPressStart({\n type: 'pressstart',\n pointerType,\n target: originalEvent.currentTarget as Element,\n shiftKey: originalEvent.shiftKey,\n metaKey: originalEvent.metaKey,\n ctrlKey: originalEvent.ctrlKey,\n altKey: originalEvent.altKey\n });\n }\n\n if (onPressChange) {\n onPressChange(true);\n }\n\n state.didFirePressStart = true;\n setPressed(true);\n };\n\n let triggerPressEnd = (originalEvent: EventBase, pointerType: PointerType, wasPressed = true) => {\n let {onPressEnd, onPressChange, onPress, isDisabled} = propsRef.current;\n if (!state.didFirePressStart) {\n return;\n }\n\n state.ignoreClickAfterPress = true;\n state.didFirePressStart = false;\n\n if (onPressEnd) {\n onPressEnd({\n type: 'pressend',\n pointerType,\n target: originalEvent.currentTarget as Element,\n shiftKey: originalEvent.shiftKey,\n metaKey: originalEvent.metaKey,\n ctrlKey: originalEvent.ctrlKey,\n altKey: originalEvent.altKey\n });\n }\n\n if (onPressChange) {\n onPressChange(false);\n }\n\n setPressed(false);\n\n if (onPress && wasPressed && !isDisabled) {\n onPress({\n type: 'press',\n pointerType,\n target: originalEvent.currentTarget as Element,\n shiftKey: originalEvent.shiftKey,\n metaKey: originalEvent.metaKey,\n ctrlKey: originalEvent.ctrlKey,\n altKey: originalEvent.altKey\n });\n }\n };\n\n let triggerPressUp = (originalEvent: EventBase, pointerType: PointerType) => {\n let {onPressUp, isDisabled} = propsRef.current;\n if (isDisabled) {\n return;\n }\n\n if (onPressUp) {\n onPressUp({\n type: 'pressup',\n pointerType,\n target: originalEvent.currentTarget as Element,\n shiftKey: originalEvent.shiftKey,\n metaKey: originalEvent.metaKey,\n ctrlKey: originalEvent.ctrlKey,\n altKey: originalEvent.altKey\n });\n }\n };\n\n let cancel = (e: EventBase) => {\n if (state.isPressed) {\n if (state.isOverTarget) {\n triggerPressEnd(createEvent(state.target, e), state.pointerType, false);\n }\n state.isPressed = false;\n state.isOverTarget = false;\n state.activePointerId = null;\n state.pointerType = null;\n removeAllGlobalListeners();\n if (!allowTextSelectionOnPress) {\n restoreTextSelection(state.target);\n }\n }\n };\n\n let pressProps: DOMAttributes = {\n onKeyDown(e) {\n if (isValidKeyboardEvent(e.nativeEvent, e.currentTarget) && e.currentTarget.contains(e.target as Element)) {\n if (shouldPreventDefaultKeyboard(e.target as Element, e.key)) {\n e.preventDefault();\n }\n e.stopPropagation();\n\n // If the event is repeating, it may have started on a different element\n // after which focus moved to the current element. Ignore these events and\n // only handle the first key down event.\n if (!state.isPressed && !e.repeat) {\n state.target = e.currentTarget;\n state.isPressed = true;\n triggerPressStart(e, 'keyboard');\n\n // Focus may move before the key up event, so register the event on the document\n // instead of the same element where the key down event occurred.\n addGlobalListener(document, 'keyup', onKeyUp, false);\n }\n } else if (e.key === 'Enter' && isHTMLAnchorLink(e.currentTarget)) {\n // If the target is a link, we won't have handled this above because we want the default\n // browser behavior to open the link when pressing Enter. But we still need to prevent\n // default so that elements above do not also handle it (e.g. table row).\n e.stopPropagation();\n }\n },\n onKeyUp(e) {\n if (isValidKeyboardEvent(e.nativeEvent, e.currentTarget) && !e.repeat && e.currentTarget.contains(e.target as Element)) {\n triggerPressUp(createEvent(state.target, e), 'keyboard');\n }\n },\n onClick(e) {\n if (e && !e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n if (e && e.button === 0) {\n e.stopPropagation();\n if (isDisabled) {\n e.preventDefault();\n }\n\n // If triggered from a screen reader or by using element.click(),\n // trigger as if it were a keyboard click.\n if (!state.ignoreClickAfterPress && !state.ignoreEmulatedMouseEvents && (state.pointerType === 'virtual' || isVirtualClick(e.nativeEvent))) {\n // Ensure the element receives focus (VoiceOver on iOS does not do this)\n if (!isDisabled && !preventFocusOnPress) {\n focusWithoutScrolling(e.currentTarget);\n }\n\n triggerPressStart(e, 'virtual');\n triggerPressUp(e, 'virtual');\n triggerPressEnd(e, 'virtual');\n }\n\n state.ignoreEmulatedMouseEvents = false;\n state.ignoreClickAfterPress = false;\n }\n }\n };\n\n let onKeyUp = (e: KeyboardEvent) => {\n if (state.isPressed && isValidKeyboardEvent(e, state.target)) {\n if (shouldPreventDefaultKeyboard(e.target as Element, e.key)) {\n e.preventDefault();\n }\n e.stopPropagation();\n\n state.isPressed = false;\n let target = e.target as Element;\n triggerPressEnd(createEvent(state.target, e), 'keyboard', state.target.contains(target));\n removeAllGlobalListeners();\n\n // If the target is a link, trigger the click method to open the URL,\n // but defer triggering pressEnd until onClick event handler.\n if (state.target instanceof HTMLElement && state.target.contains(target) && (isHTMLAnchorLink(state.target) || state.target.getAttribute('role') === 'link')) {\n state.target.click();\n }\n }\n };\n\n if (typeof PointerEvent !== 'undefined') {\n pressProps.onPointerDown = (e) => {\n // Only handle left clicks, and ignore events that bubbled through portals.\n if (e.button !== 0 || !e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n // iOS safari fires pointer events from VoiceOver with incorrect coordinates/target.\n // Ignore and let the onClick handler take care of it instead.\n // https://bugs.webkit.org/show_bug.cgi?id=222627\n // https://bugs.webkit.org/show_bug.cgi?id=223202\n if (isVirtualPointerEvent(e.nativeEvent)) {\n state.pointerType = 'virtual';\n return;\n }\n\n // Due to browser inconsistencies, especially on mobile browsers, we prevent\n // default on pointer down and handle focusing the pressable element ourselves.\n if (shouldPreventDefault(e.currentTarget as Element)) {\n e.preventDefault();\n }\n\n state.pointerType = e.pointerType;\n\n e.stopPropagation();\n if (!state.isPressed) {\n state.isPressed = true;\n state.isOverTarget = true;\n state.activePointerId = e.pointerId;\n state.target = e.currentTarget;\n\n if (!isDisabled && !preventFocusOnPress) {\n focusWithoutScrolling(e.currentTarget);\n }\n\n if (!allowTextSelectionOnPress) {\n disableTextSelection(state.target);\n }\n\n triggerPressStart(e, state.pointerType);\n\n addGlobalListener(document, 'pointermove', onPointerMove, false);\n addGlobalListener(document, 'pointerup', onPointerUp, false);\n addGlobalListener(document, 'pointercancel', onPointerCancel, false);\n }\n };\n\n pressProps.onMouseDown = (e) => {\n if (!e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n if (e.button === 0) {\n // Chrome and Firefox on touch Windows devices require mouse down events\n // to be canceled in addition to pointer events, or an extra asynchronous\n // focus event will be fired.\n if (shouldPreventDefault(e.currentTarget as Element)) {\n e.preventDefault();\n }\n\n e.stopPropagation();\n }\n };\n\n pressProps.onPointerUp = (e) => {\n // iOS fires pointerup with zero width and height, so check the pointerType recorded during pointerdown.\n if (!e.currentTarget.contains(e.target as Element) || state.pointerType === 'virtual') {\n return;\n }\n\n // Only handle left clicks\n // Safari on iOS sometimes fires pointerup events, even\n // when the touch isn't over the target, so double check.\n if (e.button === 0 && isOverTarget(e, e.currentTarget)) {\n triggerPressUp(e, state.pointerType || e.pointerType);\n }\n };\n\n // Safari on iOS < 13.2 does not implement pointerenter/pointerleave events correctly.\n // Use pointer move events instead to implement our own hit testing.\n // See https://bugs.webkit.org/show_bug.cgi?id=199803\n let onPointerMove = (e: PointerEvent) => {\n if (e.pointerId !== state.activePointerId) {\n return;\n }\n\n if (isOverTarget(e, state.target)) {\n if (!state.isOverTarget) {\n state.isOverTarget = true;\n triggerPressStart(createEvent(state.target, e), state.pointerType);\n }\n } else if (state.isOverTarget) {\n state.isOverTarget = false;\n triggerPressEnd(createEvent(state.target, e), state.pointerType, false);\n if (propsRef.current.shouldCancelOnPointerExit) {\n cancel(e);\n }\n }\n };\n\n let onPointerUp = (e: PointerEvent) => {\n if (e.pointerId === state.activePointerId && state.isPressed && e.button === 0) {\n if (isOverTarget(e, state.target)) {\n triggerPressEnd(createEvent(state.target, e), state.pointerType);\n } else if (state.isOverTarget) {\n triggerPressEnd(createEvent(state.target, e), state.pointerType, false);\n }\n\n state.isPressed = false;\n state.isOverTarget = false;\n state.activePointerId = null;\n state.pointerType = null;\n removeAllGlobalListeners();\n if (!allowTextSelectionOnPress) {\n restoreTextSelection(state.target);\n }\n }\n };\n\n let onPointerCancel = (e: PointerEvent) => {\n cancel(e);\n };\n\n pressProps.onDragStart = (e) => {\n if (!e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n // Safari does not call onPointerCancel when a drag starts, whereas Chrome and Firefox do.\n cancel(e);\n };\n } else {\n pressProps.onMouseDown = (e) => {\n // Only handle left clicks\n if (e.button !== 0 || !e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n // Due to browser inconsistencies, especially on mobile browsers, we prevent\n // default on mouse down and handle focusing the pressable element ourselves.\n if (shouldPreventDefault(e.currentTarget)) {\n e.preventDefault();\n }\n\n e.stopPropagation();\n if (state.ignoreEmulatedMouseEvents) {\n return;\n }\n\n state.isPressed = true;\n state.isOverTarget = true;\n state.target = e.currentTarget;\n state.pointerType = isVirtualClick(e.nativeEvent) ? 'virtual' : 'mouse';\n\n if (!isDisabled && !preventFocusOnPress) {\n focusWithoutScrolling(e.currentTarget);\n }\n\n triggerPressStart(e, state.pointerType);\n\n addGlobalListener(document, 'mouseup', onMouseUp, false);\n };\n\n pressProps.onMouseEnter = (e) => {\n if (!e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n e.stopPropagation();\n if (state.isPressed && !state.ignoreEmulatedMouseEvents) {\n state.isOverTarget = true;\n triggerPressStart(e, state.pointerType);\n }\n };\n\n pressProps.onMouseLeave = (e) => {\n if (!e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n e.stopPropagation();\n if (state.isPressed && !state.ignoreEmulatedMouseEvents) {\n state.isOverTarget = false;\n triggerPressEnd(e, state.pointerType, false);\n if (propsRef.current.shouldCancelOnPointerExit) {\n cancel(e);\n }\n }\n };\n\n pressProps.onMouseUp = (e) => {\n if (!e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n if (!state.ignoreEmulatedMouseEvents && e.button === 0) {\n triggerPressUp(e, state.pointerType);\n }\n };\n\n let onMouseUp = (e: MouseEvent) => {\n // Only handle left clicks\n if (e.button !== 0) {\n return;\n }\n\n state.isPressed = false;\n removeAllGlobalListeners();\n\n if (state.ignoreEmulatedMouseEvents) {\n state.ignoreEmulatedMouseEvents = false;\n return;\n }\n\n if (isOverTarget(e, state.target)) {\n triggerPressEnd(createEvent(state.target, e), state.pointerType);\n } else if (state.isOverTarget) {\n triggerPressEnd(createEvent(state.target, e), state.pointerType, false);\n }\n\n state.isOverTarget = false;\n };\n\n pressProps.onTouchStart = (e) => {\n if (!e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n e.stopPropagation();\n let touch = getTouchFromEvent(e.nativeEvent);\n if (!touch) {\n return;\n }\n state.activePointerId = touch.identifier;\n state.ignoreEmulatedMouseEvents = true;\n state.isOverTarget = true;\n state.isPressed = true;\n state.target = e.currentTarget;\n state.pointerType = 'touch';\n\n // Due to browser inconsistencies, especially on mobile browsers, we prevent default\n // on the emulated mouse event and handle focusing the pressable element ourselves.\n if (!isDisabled && !preventFocusOnPress) {\n focusWithoutScrolling(e.currentTarget);\n }\n\n if (!allowTextSelectionOnPress) {\n disableTextSelection(state.target);\n }\n\n triggerPressStart(e, state.pointerType);\n\n addGlobalListener(window, 'scroll', onScroll, true);\n };\n\n pressProps.onTouchMove = (e) => {\n if (!e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n e.stopPropagation();\n if (!state.isPressed) {\n return;\n }\n\n let touch = getTouchById(e.nativeEvent, state.activePointerId);\n if (touch && isOverTarget(touch, e.currentTarget)) {\n if (!state.isOverTarget) {\n state.isOverTarget = true;\n triggerPressStart(e, state.pointerType);\n }\n } else if (state.isOverTarget) {\n state.isOverTarget = false;\n triggerPressEnd(e, state.pointerType, false);\n if (propsRef.current.shouldCancelOnPointerExit) {\n cancel(e);\n }\n }\n };\n\n pressProps.onTouchEnd = (e) => {\n if (!e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n e.stopPropagation();\n if (!state.isPressed) {\n return;\n }\n\n let touch = getTouchById(e.nativeEvent, state.activePointerId);\n if (touch && isOverTarget(touch, e.currentTarget)) {\n triggerPressUp(e, state.pointerType);\n triggerPressEnd(e, state.pointerType);\n } else if (state.isOverTarget) {\n triggerPressEnd(e, state.pointerType, false);\n }\n\n state.isPressed = false;\n state.activePointerId = null;\n state.isOverTarget = false;\n state.ignoreEmulatedMouseEvents = true;\n if (!allowTextSelectionOnPress) {\n restoreTextSelection(state.target);\n }\n removeAllGlobalListeners();\n };\n\n pressProps.onTouchCancel = (e) => {\n if (!e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n e.stopPropagation();\n if (state.isPressed) {\n cancel(e);\n }\n };\n\n let onScroll = (e: Event) => {\n if (state.isPressed && (e.target as Element).contains(state.target)) {\n cancel({\n currentTarget: state.target,\n shiftKey: false,\n ctrlKey: false,\n metaKey: false,\n altKey: false\n });\n }\n };\n\n pressProps.onDragStart = (e) => {\n if (!e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n cancel(e);\n };\n }\n\n return pressProps;\n }, [addGlobalListener, isDisabled, preventFocusOnPress, removeAllGlobalListeners, allowTextSelectionOnPress]);\n\n // Remove user-select: none in case component unmounts immediately after pressStart\n // eslint-disable-next-line arrow-body-style\n useEffect(() => {\n return () => {\n if (!allowTextSelectionOnPress) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n restoreTextSelection(ref.current.target);\n }\n };\n }, [allowTextSelectionOnPress]);\n\n return {\n isPressed: isPressedProp || isPressed,\n pressProps: mergeProps(domProps, pressProps)\n };\n}\n\nfunction isHTMLAnchorLink(target: Element): boolean {\n return target.tagName === 'A' && target.hasAttribute('href');\n}\n\nfunction isValidKeyboardEvent(event: KeyboardEvent, currentTarget: Element): boolean {\n const {key, code} = event;\n const element = currentTarget as HTMLElement;\n const role = element.getAttribute('role');\n // Accessibility for keyboards. Space and Enter only.\n // \"Spacebar\" is for IE 11\n return (\n (key === 'Enter' || key === ' ' || key === 'Spacebar' || code === 'Space') &&\n !((element instanceof HTMLInputElement && !isValidInputKey(element, key)) ||\n element instanceof HTMLTextAreaElement ||\n element.isContentEditable) &&\n // A link with a valid href should be handled natively,\n // unless it also has role='button' and was triggered using Space.\n (!isHTMLAnchorLink(element) || (role === 'button' && key !== 'Enter')) &&\n // An element with role='link' should only trigger with Enter key\n !(role === 'link' && key !== 'Enter')\n );\n}\n\nfunction getTouchFromEvent(event: TouchEvent): Touch | null {\n const {targetTouches} = event;\n if (targetTouches.length > 0) {\n return targetTouches[0];\n }\n return null;\n}\n\nfunction getTouchById(\n event: TouchEvent,\n pointerId: null | number\n): null | Touch {\n const changedTouches = event.changedTouches;\n for (let i = 0; i < changedTouches.length; i++) {\n const touch = changedTouches[i];\n if (touch.identifier === pointerId) {\n return touch;\n }\n }\n return null;\n}\n\nfunction createEvent(target: FocusableElement, e: EventBase): EventBase {\n return {\n currentTarget: target,\n shiftKey: e.shiftKey,\n ctrlKey: e.ctrlKey,\n metaKey: e.metaKey,\n altKey: e.altKey\n };\n}\n\ninterface Rect {\n top: number,\n right: number,\n bottom: number,\n left: number\n}\n\ninterface EventPoint {\n clientX: number,\n clientY: number,\n width?: number,\n height?: number,\n radiusX?: number,\n radiusY?: number\n}\n\nfunction getPointClientRect(point: EventPoint): Rect {\n let offsetX = (point.width / 2) || point.radiusX || 0;\n let offsetY = (point.height / 2) || point.radiusY || 0;\n\n return {\n top: point.clientY - offsetY,\n right: point.clientX + offsetX,\n bottom: point.clientY + offsetY,\n left: point.clientX - offsetX\n };\n}\n\nfunction areRectanglesOverlapping(a: Rect, b: Rect) {\n // check if they cannot overlap on x axis\n if (a.left > b.right || b.left > a.right) {\n return false;\n }\n // check if they cannot overlap on y axis\n if (a.top > b.bottom || b.top > a.bottom) {\n return false;\n }\n return true;\n}\n\nfunction isOverTarget(point: EventPoint, target: Element) {\n let rect = target.getBoundingClientRect();\n let pointRect = getPointClientRect(point);\n return areRectanglesOverlapping(rect, pointRect);\n}\n\nfunction shouldPreventDefault(target: Element) {\n // We cannot prevent default if the target is a draggable element.\n return !(target instanceof HTMLElement) || !target.draggable;\n}\n\nfunction shouldPreventDefaultKeyboard(target: Element, key: string) {\n if (target instanceof HTMLInputElement) {\n return !isValidInputKey(target, key);\n }\n\n if (target instanceof HTMLButtonElement) {\n return target.type !== 'submit';\n }\n\n return true;\n}\n\nconst nonTextInputTypes = new Set([\n 'checkbox',\n 'radio',\n 'range',\n 'color',\n 'file',\n 'image',\n 'button',\n 'submit',\n 'reset'\n]);\n\nfunction isValidInputKey(target: HTMLInputElement, key: string) {\n // Only space should toggle checkboxes and radios, not enter.\n return target.type === 'checkbox' || target.type === 'radio'\n ? key === ' '\n : nonTextInputTypes.has(target.type);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {isIOS, runAfterTransition} from '@react-aria/utils';\n\n// Safari on iOS starts selecting text on long press. The only way to avoid this, it seems,\n// is to add user-select: none to the entire page. Adding it to the pressable element prevents\n// that element from being selected, but nearby elements may still receive selection. We add\n// user-select: none on touch start, and remove it again on touch end to prevent this.\n// This must be implemented using global state to avoid race conditions between multiple elements.\n\n// There are three possible states due to the delay before removing user-select: none after\n// pointer up. The 'default' state always transitions to the 'disabled' state, which transitions\n// to 'restoring'. The 'restoring' state can either transition back to 'disabled' or 'default'.\n\n// For non-iOS devices, we apply user-select: none to the pressed element instead to avoid possible\n// performance issues that arise from applying and removing user-select: none to the entire page\n// (see https://github.com/adobe/react-spectrum/issues/1609).\ntype State = 'default' | 'disabled' | 'restoring';\n\n// Note that state only matters here for iOS. Non-iOS gets user-select: none applied to the target element\n// rather than at the document level so we just need to apply/remove user-select: none for each pressed element individually\nlet state: State = 'default';\nlet savedUserSelect = '';\nlet modifiedElementMap = new WeakMap<Element, string>();\n\nexport function disableTextSelection(target?: Element) {\n if (isIOS()) {\n if (state === 'default') {\n savedUserSelect = document.documentElement.style.webkitUserSelect;\n document.documentElement.style.webkitUserSelect = 'none';\n }\n\n state = 'disabled';\n } else if (target instanceof HTMLElement || target instanceof SVGElement) {\n // If not iOS, store the target's original user-select and change to user-select: none\n // Ignore state since it doesn't apply for non iOS\n modifiedElementMap.set(target, target.style.userSelect);\n target.style.userSelect = 'none';\n }\n}\n\nexport function restoreTextSelection(target?: Element) {\n if (isIOS()) {\n // If the state is already default, there's nothing to do.\n // If it is restoring, then there's no need to queue a second restore.\n if (state !== 'disabled') {\n return;\n }\n\n state = 'restoring';\n\n // There appears to be a delay on iOS where selection still might occur\n // after pointer up, so wait a bit before removing user-select.\n setTimeout(() => {\n // Wait for any CSS transitions to complete so we don't recompute style\n // for the whole page in the middle of the animation and cause jank.\n runAfterTransition(() => {\n // Avoid race conditions\n if (state === 'restoring') {\n if (document.documentElement.style.webkitUserSelect === 'none') {\n document.documentElement.style.webkitUserSelect = savedUserSelect || '';\n }\n\n savedUserSelect = '';\n state = 'default';\n }\n });\n }, 300);\n } else if (target instanceof HTMLElement || target instanceof SVGElement) {\n // If not iOS, restore the target's original user-select if any\n // Ignore state since it doesn't apply for non iOS\n if (target && modifiedElementMap.has(target)) {\n let targetOldUserSelect = modifiedElementMap.get(target);\n\n if (target.style.userSelect === 'none') {\n target.style.userSelect = targetOldUserSelect;\n }\n\n if (target.getAttribute('style') === '') {\n target.removeAttribute('style');\n }\n modifiedElementMap.delete(target);\n }\n }\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {FocusableElement} from '@react-types/shared';\nimport {PressProps} from './usePress';\nimport React, {MutableRefObject} from 'react';\n\ninterface IPressResponderContext extends PressProps {\n register(): void,\n ref?: MutableRefObject<FocusableElement>\n}\n\nexport const PressResponderContext = React.createContext<IPressResponderContext>(null);\nPressResponderContext.displayName = 'PressResponderContext';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {FocusableElement} from '@react-types/shared';\nimport {mergeProps, useSyncRef} from '@react-aria/utils';\nimport {PressProps} from './usePress';\nimport {PressResponderContext} from './context';\nimport React, {ReactNode, RefObject, useContext, useEffect, useRef} from 'react';\n\ninterface PressResponderProps extends PressProps {\n children: ReactNode\n}\n\nexport const PressResponder = React.forwardRef(({children, ...props}: PressResponderProps, ref: RefObject<FocusableElement>) => {\n let isRegistered = useRef(false);\n let prevContext = useContext(PressResponderContext);\n let context = mergeProps(prevContext || {}, {\n ...props,\n ref: ref || prevContext?.ref,\n register() {\n isRegistered.current = true;\n if (prevContext) {\n prevContext.register();\n }\n }\n });\n\n useSyncRef(prevContext, ref);\n\n useEffect(() => {\n if (!isRegistered.current) {\n console.warn(\n 'A PressResponder was rendered without a pressable child. ' +\n 'Either call the usePress hook, or wrap your DOM node with <Pressable> component.'\n );\n }\n }, []);\n\n return (\n <PressResponderContext.Provider value={context}>\n {children}\n </PressResponderContext.Provider>\n );\n});\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from react.\n// Original licensing for the following can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions\n\nimport {DOMAttributes, FocusEvents} from '@react-types/shared';\nimport {FocusEvent, useCallback} from 'react';\nimport {useSyntheticBlurEvent} from './utils';\n\nexport interface FocusProps extends FocusEvents {\n /** Whether the focus events should be disabled. */\n isDisabled?: boolean\n}\n\nexport interface FocusResult {\n /** Props to spread onto the target element. */\n focusProps: DOMAttributes\n}\n\n/**\n * Handles focus events for the immediate target.\n * Focus events on child elements will be ignored.\n */\nexport function useFocus(props: FocusProps): FocusResult {\n let {\n isDisabled,\n onFocus: onFocusProp,\n onBlur: onBlurProp,\n onFocusChange\n } = props;\n\n const onBlur: FocusProps['onBlur'] = useCallback((e: FocusEvent) => {\n if (e.target === e.currentTarget) {\n if (onBlurProp) {\n onBlurProp(e);\n }\n\n if (onFocusChange) {\n onFocusChange(false);\n }\n\n return true;\n }\n }, [onBlurProp, onFocusChange]);\n\n\n const onSyntheticFocus = useSyntheticBlurEvent(onBlur);\n\n const onFocus: FocusProps['onFocus'] = useCallback((e: FocusEvent) => {\n if (e.target === e.currentTarget) {\n if (onFocusProp) {\n onFocusProp(e);\n }\n\n if (onFocusChange) {\n onFocusChange(true);\n }\n\n onSyntheticFocus(e);\n }\n }, [onFocusChange, onFocusProp, onSyntheticFocus]);\n\n return {\n focusProps: {\n onFocus: (!isDisabled && (onFocusProp || onFocusChange || onBlurProp)) ? onFocus : undefined,\n onBlur: (!isDisabled && (onBlurProp || onFocusChange)) ? onBlur : null\n }\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {FocusEvent as ReactFocusEvent, useCallback, useRef} from 'react';\nimport {useLayoutEffect} from '@react-aria/utils';\n\nexport class SyntheticFocusEvent implements ReactFocusEvent {\n nativeEvent: FocusEvent;\n target: Element;\n currentTarget: Element;\n relatedTarget: Element;\n bubbles: boolean;\n cancelable: boolean;\n defaultPrevented: boolean;\n eventPhase: number;\n isTrusted: boolean;\n timeStamp: number;\n type: string;\n\n constructor(type: string, nativeEvent: FocusEvent) {\n this.nativeEvent = nativeEvent;\n this.target = nativeEvent.target as Element;\n this.currentTarget = nativeEvent.currentTarget as Element;\n this.relatedTarget = nativeEvent.relatedTarget as Element;\n this.bubbles = nativeEvent.bubbles;\n this.cancelable = nativeEvent.cancelable;\n this.defaultPrevented = nativeEvent.defaultPrevented;\n this.eventPhase = nativeEvent.eventPhase;\n this.isTrusted = nativeEvent.isTrusted;\n this.timeStamp = nativeEvent.timeStamp;\n this.type = type;\n }\n\n isDefaultPrevented(): boolean {\n return this.nativeEvent.defaultPrevented;\n }\n\n preventDefault(): void {\n this.defaultPrevented = true;\n this.nativeEvent.preventDefault();\n }\n\n stopPropagation(): void {\n this.nativeEvent.stopPropagation();\n this.isPropagationStopped = () => true;\n }\n\n isPropagationStopped(): boolean {\n return false;\n }\n\n persist() {}\n}\n\nexport function useSyntheticBlurEvent(onBlur: (e: ReactFocusEvent) => void) {\n let stateRef = useRef({\n isFocused: false,\n onBlur,\n observer: null as MutationObserver\n });\n stateRef.current.onBlur = onBlur;\n\n // Clean up MutationObserver on unmount. See below.\n // eslint-disable-next-line arrow-body-style\n useLayoutEffect(() => {\n const state = stateRef.current;\n return () => {\n if (state.observer) {\n state.observer.disconnect();\n state.observer = null;\n }\n };\n }, []);\n\n // This function is called during a React onFocus event.\n return useCallback((e: ReactFocusEvent) => {\n // React does not fire onBlur when an element is disabled. https://github.com/facebook/react/issues/9142\n // Most browsers fire a native focusout event in this case, except for Firefox. In that case, we use a\n // MutationObserver to watch for the disabled attribute, and dispatch these events ourselves.\n // For browsers that do, focusout fires before the MutationObserver, so onBlur should not fire twice.\n if (\n e.target instanceof HTMLButtonElement ||\n e.target instanceof HTMLInputElement ||\n e.target instanceof HTMLTextAreaElement ||\n e.target instanceof HTMLSelectElement\n ) {\n stateRef.current.isFocused = true;\n\n let target = e.target;\n let onBlurHandler = (e: FocusEvent) => {\n stateRef.current.isFocused = false;\n\n if (target.disabled) {\n // For backward compatibility, dispatch a (fake) React synthetic event.\n stateRef.current.onBlur?.(new SyntheticFocusEvent('blur', e));\n }\n\n // We no longer need the MutationObserver once the target is blurred.\n if (stateRef.current.observer) {\n stateRef.current.observer.disconnect();\n stateRef.current.observer = null;\n }\n };\n\n target.addEventListener('focusout', onBlurHandler, {once: true});\n\n stateRef.current.observer = new MutationObserver(() => {\n if (stateRef.current.isFocused && target.disabled) {\n stateRef.current.observer.disconnect();\n target.dispatchEvent(new FocusEvent('blur'));\n target.dispatchEvent(new FocusEvent('focusout', {bubbles: true}));\n }\n });\n\n stateRef.current.observer.observe(target, {attributes: true, attributeFilter: ['disabled']});\n }\n }, []);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from react.\n// Original licensing for the following can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions\n\nimport {isMac, isVirtualClick} from '@react-aria/utils';\nimport {useEffect, useState} from 'react';\n\nexport type Modality = 'keyboard' | 'pointer' | 'virtual';\ntype HandlerEvent = PointerEvent | MouseEvent | KeyboardEvent | FocusEvent;\ntype Handler = (modality: Modality, e: HandlerEvent) => void;\nexport type FocusVisibleHandler = (isFocusVisible: boolean) => void;\nexport interface FocusVisibleProps {\n /** Whether the element is a text input. */\n isTextInput?: boolean,\n /** Whether the element will be auto focused. */\n autoFocus?: boolean\n}\n\nexport interface FocusVisibleResult {\n /** Whether keyboard focus is visible globally. */\n isFocusVisible: boolean\n}\n\nlet currentModality = null;\nlet changeHandlers = new Set<Handler>();\nlet hasSetupGlobalListeners = false;\nlet hasEventBeforeFocus = false;\nlet hasBlurredWindowRecently = false;\n\n// Only Tab or Esc keys will make focus visible on text input elements\nconst FOCUS_VISIBLE_INPUT_KEYS = {\n Tab: true,\n Escape: true\n};\n\nfunction triggerChangeHandlers(modality: Modality, e: HandlerEvent) {\n for (let handler of changeHandlers) {\n handler(modality, e);\n }\n}\n\n/**\n * Helper function to determine if a KeyboardEvent is unmodified and could make keyboard focus styles visible.\n */\nfunction isValidKey(e: KeyboardEvent) {\n // Control and Shift keys trigger when navigating back to the tab with keyboard.\n return !(e.metaKey || (!isMac() && e.altKey) || e.ctrlKey || e.key === 'Control' || e.key === 'Shift' || e.key === 'Meta');\n}\n\n\nfunction handleKeyboardEvent(e: KeyboardEvent) {\n hasEventBeforeFocus = true;\n if (isValidKey(e)) {\n currentModality = 'keyboard';\n triggerChangeHandlers('keyboard', e);\n }\n}\n\nfunction handlePointerEvent(e: PointerEvent | MouseEvent) {\n currentModality = 'pointer';\n if (e.type === 'mousedown' || e.type === 'pointerdown') {\n hasEventBeforeFocus = true;\n triggerChangeHandlers('pointer', e);\n }\n}\n\nfunction handleClickEvent(e: MouseEvent) {\n if (isVirtualClick(e)) {\n hasEventBeforeFocus = true;\n currentModality = 'virtual';\n }\n}\n\nfunction handleFocusEvent(e: FocusEvent) {\n // Firefox fires two extra focus events when the user first clicks into an iframe:\n // first on the window, then on the document. We ignore these events so they don't\n // cause keyboard focus rings to appear.\n if (e.target === window || e.target === document) {\n return;\n }\n\n // If a focus event occurs without a preceding keyboard or pointer event, switch to virtual modality.\n // This occurs, for example, when navigating a form with the next/previous buttons on iOS.\n if (!hasEventBeforeFocus && !hasBlurredWindowRecently) {\n currentModality = 'virtual';\n triggerChangeHandlers('virtual', e);\n }\n\n hasEventBeforeFocus = false;\n hasBlurredWindowRecently = false;\n}\n\nfunction handleWindowBlur() {\n // When the window is blurred, reset state. This is necessary when tabbing out of the window,\n // for example, since a subsequent focus event won't be fired.\n hasEventBeforeFocus = false;\n hasBlurredWindowRecently = true;\n}\n\n/**\n * Setup global event listeners to control when keyboard focus style should be visible.\n */\nfunction setupGlobalFocusEvents() {\n if (typeof window === 'undefined' || hasSetupGlobalListeners) {\n return;\n }\n\n // Programmatic focus() calls shouldn't affect the current input modality.\n // However, we need to detect other cases when a focus event occurs without\n // a preceding user event (e.g. screen reader focus). Overriding the focus\n // method on HTMLElement.prototype is a bit hacky, but works.\n let focus = HTMLElement.prototype.focus;\n HTMLElement.prototype.focus = function () {\n hasEventBeforeFocus = true;\n focus.apply(this, arguments);\n };\n\n document.addEventListener('keydown', handleKeyboardEvent, true);\n document.addEventListener('keyup', handleKeyboardEvent, true);\n document.addEventListener('click', handleClickEvent, true);\n\n // Register focus events on the window so they are sure to happen\n // before React's event listeners (registered on the document).\n window.addEventListener('focus', handleFocusEvent, true);\n window.addEventListener('blur', handleWindowBlur, false);\n\n if (typeof PointerEvent !== 'undefined') {\n document.addEventListener('pointerdown', handlePointerEvent, true);\n document.addEventListener('pointermove', handlePointerEvent, true);\n document.addEventListener('pointerup', handlePointerEvent, true);\n } else {\n document.addEventListener('mousedown', handlePointerEvent, true);\n document.addEventListener('mousemove', handlePointerEvent, true);\n document.addEventListener('mouseup', handlePointerEvent, true);\n }\n\n hasSetupGlobalListeners = true;\n}\n\nif (typeof document !== 'undefined') {\n if (document.readyState !== 'loading') {\n setupGlobalFocusEvents();\n } else {\n document.addEventListener('DOMContentLoaded', setupGlobalFocusEvents);\n }\n}\n\n/**\n * If true, keyboard focus is visible.\n */\nexport function isFocusVisible(): boolean {\n return currentModality !== 'pointer';\n}\n\nexport function getInteractionModality(): Modality {\n return currentModality;\n}\n\nexport function setInteractionModality(modality: Modality) {\n currentModality = modality;\n triggerChangeHandlers(modality, null);\n}\n\n/**\n * Keeps state of the current modality.\n */\nexport function useInteractionModality(): Modality {\n setupGlobalFocusEvents();\n\n let [modality, setModality] = useState(currentModality);\n useEffect(() => {\n let handler = () => {\n setModality(currentModality);\n };\n\n changeHandlers.add(handler);\n return () => {\n changeHandlers.delete(handler);\n };\n }, []);\n\n return modality;\n}\n\n/**\n * If this is attached to text input component, return if the event is a focus event (Tab/Escape keys pressed) so that\n * focus visible style can be properly set.\n */\nfunction isKeyboardFocusEvent(isTextInput: boolean, modality: Modality, e: HandlerEvent) {\n return !(isTextInput && modality === 'keyboard' && e instanceof KeyboardEvent && !FOCUS_VISIBLE_INPUT_KEYS[e.key]);\n}\n\n/**\n * Manages focus visible state for the page, and subscribes individual components for updates.\n */\nexport function useFocusVisible(props: FocusVisibleProps = {}): FocusVisibleResult {\n let {isTextInput, autoFocus} = props;\n let [isFocusVisibleState, setFocusVisible] = useState(autoFocus || isFocusVisible());\n useFocusVisibleListener((isFocusVisible) => {\n setFocusVisible(isFocusVisible);\n }, [isTextInput], {isTextInput});\n\n return {isFocusVisible: isFocusVisibleState};\n}\n\n/**\n * Listens for trigger change and reports if focus is visible (i.e., modality is not pointer).\n */\nexport function useFocusVisibleListener(fn: FocusVisibleHandler, deps: ReadonlyArray<any>, opts?: {isTextInput?: boolean}): void {\n setupGlobalFocusEvents();\n\n useEffect(() => {\n let handler = (modality: Modality, e: HandlerEvent) => {\n if (!isKeyboardFocusEvent(opts?.isTextInput, modality, e)) {\n return;\n }\n fn(isFocusVisible());\n };\n changeHandlers.add(handler);\n return () => {\n changeHandlers.delete(handler);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from react.\n// Original licensing for the following can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions\n\nimport {DOMAttributes} from '@react-types/shared';\nimport {FocusEvent, useCallback, useRef} from 'react';\nimport {useSyntheticBlurEvent} from './utils';\n\nexport interface FocusWithinProps {\n /** Whether the focus within events should be disabled. */\n isDisabled?: boolean,\n /** Handler that is called when the target element or a descendant receives focus. */\n onFocusWithin?: (e: FocusEvent) => void,\n /** Handler that is called when the target element and all descendants lose focus. */\n onBlurWithin?: (e: FocusEvent) => void,\n /** Handler that is called when the the focus within state changes. */\n onFocusWithinChange?: (isFocusWithin: boolean) => void\n}\n\nexport interface FocusWithinResult {\n /** Props to spread onto the target element. */\n focusWithinProps: DOMAttributes\n}\n\n/**\n * Handles focus events for the target and its descendants.\n */\nexport function useFocusWithin(props: FocusWithinProps): FocusWithinResult {\n let {\n isDisabled,\n onBlurWithin,\n onFocusWithin,\n onFocusWithinChange\n } = props;\n let state = useRef({\n isFocusWithin: false\n });\n\n let onBlur = useCallback((e: FocusEvent) => {\n // We don't want to trigger onBlurWithin and then immediately onFocusWithin again\n // when moving focus inside the element. Only trigger if the currentTarget doesn't\n // include the relatedTarget (where focus is moving).\n if (state.current.isFocusWithin && !(e.currentTarget as Element).contains(e.relatedTarget as Element)) {\n state.current.isFocusWithin = false;\n\n if (onBlurWithin) {\n onBlurWithin(e);\n }\n\n if (onFocusWithinChange) {\n onFocusWithinChange(false);\n }\n }\n }, [onBlurWithin, onFocusWithinChange, state]);\n\n let onSyntheticFocus = useSyntheticBlurEvent(onBlur);\n let onFocus = useCallback((e: FocusEvent) => {\n if (!state.current.isFocusWithin) {\n if (onFocusWithin) {\n onFocusWithin(e);\n }\n\n if (onFocusWithinChange) {\n onFocusWithinChange(true);\n }\n\n state.current.isFocusWithin = true;\n onSyntheticFocus(e);\n }\n }, [onFocusWithin, onFocusWithinChange, onSyntheticFocus]);\n\n if (isDisabled) {\n return {\n focusWithinProps: {\n onFocus: null,\n onBlur: null\n }\n };\n }\n\n return {\n focusWithinProps: {\n onFocus,\n onBlur\n }\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from react.\n// Original licensing for the following can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions\n\nimport {DOMAttributes} from '@react-types/shared';\nimport {HoverEvents} from '@react-types/shared';\nimport {useEffect, useMemo, useRef, useState} from 'react';\n\nexport interface HoverProps extends HoverEvents {\n /** Whether the hover events should be disabled. */\n isDisabled?: boolean\n}\n\nexport interface HoverResult {\n /** Props to spread on the target element. */\n hoverProps: DOMAttributes,\n isHovered: boolean\n}\n\n// iOS fires onPointerEnter twice: once with pointerType=\"touch\" and again with pointerType=\"mouse\".\n// We want to ignore these emulated events so they do not trigger hover behavior.\n// See https://bugs.webkit.org/show_bug.cgi?id=214609.\nlet globalIgnoreEmulatedMouseEvents = false;\nlet hoverCount = 0;\n\nfunction setGlobalIgnoreEmulatedMouseEvents() {\n globalIgnoreEmulatedMouseEvents = true;\n\n // Clear globalIgnoreEmulatedMouseEvents after a short timeout. iOS fires onPointerEnter\n // with pointerType=\"mouse\" immediately after onPointerUp and before onFocus. On other\n // devices that don't have this quirk, we don't want to ignore a mouse hover sometime in\n // the distant future because a user previously touched the element.\n setTimeout(() => {\n globalIgnoreEmulatedMouseEvents = false;\n }, 50);\n}\n\nfunction handleGlobalPointerEvent(e) {\n if (e.pointerType === 'touch') {\n setGlobalIgnoreEmulatedMouseEvents();\n }\n}\n\nfunction setupGlobalTouchEvents() {\n if (typeof document === 'undefined') {\n return;\n }\n\n if (typeof PointerEvent !== 'undefined') {\n document.addEventListener('pointerup', handleGlobalPointerEvent);\n } else {\n document.addEventListener('touchend', setGlobalIgnoreEmulatedMouseEvents);\n }\n\n hoverCount++;\n return () => {\n hoverCount--;\n if (hoverCount > 0) {\n return;\n }\n\n if (typeof PointerEvent !== 'undefined') {\n document.removeEventListener('pointerup', handleGlobalPointerEvent);\n } else {\n document.removeEventListener('touchend', setGlobalIgnoreEmulatedMouseEvents);\n }\n };\n}\n\n/**\n * Handles pointer hover interactions for an element. Normalizes behavior\n * across browsers and platforms, and ignores emulated mouse events on touch devices.\n */\nexport function useHover(props: HoverProps): HoverResult {\n let {\n onHoverStart,\n onHoverChange,\n onHoverEnd,\n isDisabled\n } = props;\n\n let [isHovered, setHovered] = useState(false);\n let state = useRef({\n isHovered: false,\n ignoreEmulatedMouseEvents: false,\n pointerType: '',\n target: null\n }).current;\n\n useEffect(setupGlobalTouchEvents, []);\n\n let {hoverProps, triggerHoverEnd} = useMemo(() => {\n let triggerHoverStart = (event, pointerType) => {\n state.pointerType = pointerType;\n if (isDisabled || pointerType === 'touch' || state.isHovered || !event.currentTarget.contains(event.target)) {\n return;\n }\n\n state.isHovered = true;\n let target = event.currentTarget;\n state.target = target;\n\n if (onHoverStart) {\n onHoverStart({\n type: 'hoverstart',\n target,\n pointerType\n });\n }\n\n if (onHoverChange) {\n onHoverChange(true);\n }\n\n setHovered(true);\n };\n\n let triggerHoverEnd = (event, pointerType) => {\n state.pointerType = '';\n state.target = null;\n\n if (pointerType === 'touch' || !state.isHovered) {\n return;\n }\n\n state.isHovered = false;\n let target = event.currentTarget;\n if (onHoverEnd) {\n onHoverEnd({\n type: 'hoverend',\n target,\n pointerType\n });\n }\n\n if (onHoverChange) {\n onHoverChange(false);\n }\n\n setHovered(false);\n };\n\n let hoverProps: DOMAttributes = {};\n\n if (typeof PointerEvent !== 'undefined') {\n hoverProps.onPointerEnter = (e) => {\n if (globalIgnoreEmulatedMouseEvents && e.pointerType === 'mouse') {\n return;\n }\n\n triggerHoverStart(e, e.pointerType);\n };\n\n hoverProps.onPointerLeave = (e) => {\n if (!isDisabled && e.currentTarget.contains(e.target as Element)) {\n triggerHoverEnd(e, e.pointerType);\n }\n };\n } else {\n hoverProps.onTouchStart = () => {\n state.ignoreEmulatedMouseEvents = true;\n };\n\n hoverProps.onMouseEnter = (e) => {\n if (!state.ignoreEmulatedMouseEvents && !globalIgnoreEmulatedMouseEvents) {\n triggerHoverStart(e, 'mouse');\n }\n\n state.ignoreEmulatedMouseEvents = false;\n };\n\n hoverProps.onMouseLeave = (e) => {\n if (!isDisabled && e.currentTarget.contains(e.target as Element)) {\n triggerHoverEnd(e, 'mouse');\n }\n };\n }\n return {hoverProps, triggerHoverEnd};\n }, [onHoverStart, onHoverChange, onHoverEnd, isDisabled, state]);\n\n useEffect(() => {\n // Call the triggerHoverEnd as soon as isDisabled changes to true\n // Safe to call triggerHoverEnd, it will early return if we aren't currently hovering\n if (isDisabled) {\n triggerHoverEnd({currentTarget: state.target}, state.pointerType);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isDisabled]);\n\n return {\n hoverProps,\n isHovered\n };\n}\n\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from react.\n// Original licensing for the following can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions\n\nimport {RefObject, SyntheticEvent, useEffect, useRef} from 'react';\n\nexport interface InteractOutsideProps {\n ref: RefObject<Element>,\n onInteractOutside?: (e: SyntheticEvent) => void,\n onInteractOutsideStart?: (e: SyntheticEvent) => void,\n /** Whether the interact outside events should be disabled. */\n isDisabled?: boolean\n}\n\n/**\n * Example, used in components like Dialogs and Popovers so they can close\n * when a user clicks outside them.\n */\nexport function useInteractOutside(props: InteractOutsideProps) {\n let {ref, onInteractOutside, isDisabled, onInteractOutsideStart} = props;\n let stateRef = useRef({\n isPointerDown: false,\n ignoreEmulatedMouseEvents: false,\n onInteractOutside,\n onInteractOutsideStart\n });\n let state = stateRef.current;\n state.onInteractOutside = onInteractOutside;\n state.onInteractOutsideStart = onInteractOutsideStart;\n\n useEffect(() => {\n if (isDisabled) {\n return;\n }\n\n let onPointerDown = (e) => {\n if (isValidEvent(e, ref) && state.onInteractOutside) {\n if (state.onInteractOutsideStart) {\n state.onInteractOutsideStart(e);\n }\n state.isPointerDown = true;\n }\n };\n\n // Use pointer events if available. Otherwise, fall back to mouse and touch events.\n if (typeof PointerEvent !== 'undefined') {\n let onPointerUp = (e) => {\n if (state.isPointerDown && state.onInteractOutside && isValidEvent(e, ref)) {\n state.isPointerDown = false;\n state.onInteractOutside(e);\n }\n };\n\n // changing these to capture phase fixed combobox\n document.addEventListener('pointerdown', onPointerDown, true);\n document.addEventListener('pointerup', onPointerUp, true);\n\n return () => {\n document.removeEventListener('pointerdown', onPointerDown, true);\n document.removeEventListener('pointerup', onPointerUp, true);\n };\n } else {\n let onMouseUp = (e) => {\n if (state.ignoreEmulatedMouseEvents) {\n state.ignoreEmulatedMouseEvents = false;\n } else if (state.isPointerDown && state.onInteractOutside && isValidEvent(e, ref)) {\n state.isPointerDown = false;\n state.onInteractOutside(e);\n }\n };\n\n let onTouchEnd = (e) => {\n state.ignoreEmulatedMouseEvents = true;\n if (state.onInteractOutside && state.isPointerDown && isValidEvent(e, ref)) {\n state.isPointerDown = false;\n state.onInteractOutside(e);\n }\n };\n\n document.addEventListener('mousedown', onPointerDown, true);\n document.addEventListener('mouseup', onMouseUp, true);\n document.addEventListener('touchstart', onPointerDown, true);\n document.addEventListener('touchend', onTouchEnd, true);\n\n return () => {\n document.removeEventListener('mousedown', onPointerDown, true);\n document.removeEventListener('mouseup', onMouseUp, true);\n document.removeEventListener('touchstart', onPointerDown, true);\n document.removeEventListener('touchend', onTouchEnd, true);\n };\n }\n }, [ref, state, isDisabled]);\n}\n\nfunction isValidEvent(event, ref) {\n if (event.button > 0) {\n return false;\n }\n\n // if the event target is no longer in the document\n if (event.target) {\n const ownerDocument = event.target.ownerDocument;\n if (!ownerDocument || !ownerDocument.documentElement.contains(event.target)) {\n return false;\n }\n }\n\n return ref.current && !ref.current.contains(event.target);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {createEventHandler} from './createEventHandler';\nimport {DOMAttributes, KeyboardEvents} from '@react-types/shared';\n\nexport interface KeyboardProps extends KeyboardEvents {\n /** Whether the keyboard events should be disabled. */\n isDisabled?: boolean\n}\n\nexport interface KeyboardResult {\n /** Props to spread onto the target element. */\n keyboardProps: DOMAttributes\n}\n\n/**\n * Handles keyboard interactions for a focusable element.\n */\nexport function useKeyboard(props: KeyboardProps): KeyboardResult {\n return {\n keyboardProps: props.isDisabled ? {} : {\n onKeyDown: createEventHandler(props.onKeyDown),\n onKeyUp: createEventHandler(props.onKeyUp)\n }\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {BaseEvent} from '@react-types/shared';\nimport {SyntheticEvent} from 'react';\n\n/**\n * This function wraps a React event handler to make stopPropagation the default, and support continuePropagation instead.\n */\nexport function createEventHandler<T extends SyntheticEvent>(handler: (e: BaseEvent<T>) => void): (e: T) => void {\n if (!handler) {\n return;\n }\n\n let shouldStopPropagation = true;\n return (e: T) => {\n let event: BaseEvent<T> = {\n ...e,\n preventDefault() {\n e.preventDefault();\n },\n isDefaultPrevented() {\n return e.isDefaultPrevented();\n },\n stopPropagation() {\n console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');\n },\n continuePropagation() {\n shouldStopPropagation = false;\n }\n };\n\n handler(event);\n\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {disableTextSelection, restoreTextSelection} from './textSelection';\nimport {DOMAttributes, MoveEvents, PointerType} from '@react-types/shared';\nimport React, {useMemo, useRef} from 'react';\nimport {useGlobalListeners} from '@react-aria/utils';\n\nexport interface MoveResult {\n /** Props to spread on the target element. */\n moveProps: DOMAttributes\n}\n\ninterface EventBase {\n shiftKey: boolean,\n ctrlKey: boolean,\n metaKey: boolean,\n altKey: boolean\n}\n\n/**\n * Handles move interactions across mouse, touch, and keyboard, including dragging with\n * the mouse or touch, and using the arrow keys. Normalizes behavior across browsers and\n * platforms, and ignores emulated mouse events on touch devices.\n */\nexport function useMove(props: MoveEvents): MoveResult {\n let {onMoveStart, onMove, onMoveEnd} = props;\n\n let state = useRef<{\n didMove: boolean,\n lastPosition: {pageX: number, pageY: number} | null,\n id: number | null\n }>({didMove: false, lastPosition: null, id: null});\n\n let {addGlobalListener, removeGlobalListener} = useGlobalListeners();\n\n let moveProps = useMemo(() => {\n let moveProps: DOMAttributes = {};\n\n let start = () => {\n disableTextSelection();\n state.current.didMove = false;\n };\n let move = (originalEvent: EventBase, pointerType: PointerType, deltaX: number, deltaY: number) => {\n if (deltaX === 0 && deltaY === 0) {\n return;\n }\n\n if (!state.current.didMove) {\n state.current.didMove = true;\n onMoveStart?.({\n type: 'movestart',\n pointerType,\n shiftKey: originalEvent.shiftKey,\n metaKey: originalEvent.metaKey,\n ctrlKey: originalEvent.ctrlKey,\n altKey: originalEvent.altKey\n });\n }\n onMove({\n type: 'move',\n pointerType,\n deltaX: deltaX,\n deltaY: deltaY,\n shiftKey: originalEvent.shiftKey,\n metaKey: originalEvent.metaKey,\n ctrlKey: originalEvent.ctrlKey,\n altKey: originalEvent.altKey\n });\n };\n let end = (originalEvent: EventBase, pointerType: PointerType) => {\n restoreTextSelection();\n if (state.current.didMove) {\n onMoveEnd?.({\n type: 'moveend',\n pointerType,\n shiftKey: originalEvent.shiftKey,\n metaKey: originalEvent.metaKey,\n ctrlKey: originalEvent.ctrlKey,\n altKey: originalEvent.altKey\n });\n }\n };\n\n if (typeof PointerEvent === 'undefined') {\n let onMouseMove = (e: MouseEvent) => {\n if (e.button === 0) {\n move(e, 'mouse', e.pageX - state.current.lastPosition.pageX, e.pageY - state.current.lastPosition.pageY);\n state.current.lastPosition = {pageX: e.pageX, pageY: e.pageY};\n }\n };\n let onMouseUp = (e: MouseEvent) => {\n if (e.button === 0) {\n end(e, 'mouse');\n removeGlobalListener(window, 'mousemove', onMouseMove, false);\n removeGlobalListener(window, 'mouseup', onMouseUp, false);\n }\n };\n moveProps.onMouseDown = (e: React.MouseEvent) => {\n if (e.button === 0) {\n start();\n e.stopPropagation();\n e.preventDefault();\n state.current.lastPosition = {pageX: e.pageX, pageY: e.pageY};\n addGlobalListener(window, 'mousemove', onMouseMove, false);\n addGlobalListener(window, 'mouseup', onMouseUp, false);\n }\n };\n\n let onTouchMove = (e: TouchEvent) => {\n let touch = [...e.changedTouches].findIndex(({identifier}) => identifier === state.current.id);\n if (touch >= 0) {\n let {pageX, pageY} = e.changedTouches[touch];\n move(e, 'touch', pageX - state.current.lastPosition.pageX, pageY - state.current.lastPosition.pageY);\n state.current.lastPosition = {pageX, pageY};\n }\n };\n let onTouchEnd = (e: TouchEvent) => {\n let touch = [...e.changedTouches].findIndex(({identifier}) => identifier === state.current.id);\n if (touch >= 0) {\n end(e, 'touch');\n state.current.id = null;\n removeGlobalListener(window, 'touchmove', onTouchMove);\n removeGlobalListener(window, 'touchend', onTouchEnd);\n removeGlobalListener(window, 'touchcancel', onTouchEnd);\n }\n };\n moveProps.onTouchStart = (e: React.TouchEvent) => {\n if (e.changedTouches.length === 0 || state.current.id != null) {\n return;\n }\n\n let {pageX, pageY, identifier} = e.changedTouches[0];\n start();\n e.stopPropagation();\n e.preventDefault();\n state.current.lastPosition = {pageX, pageY};\n state.current.id = identifier;\n addGlobalListener(window, 'touchmove', onTouchMove, false);\n addGlobalListener(window, 'touchend', onTouchEnd, false);\n addGlobalListener(window, 'touchcancel', onTouchEnd, false);\n };\n } else {\n let onPointerMove = (e: PointerEvent) => {\n if (e.pointerId === state.current.id) {\n let pointerType = (e.pointerType || 'mouse') as PointerType;\n\n // Problems with PointerEvent#movementX/movementY:\n // 1. it is always 0 on macOS Safari.\n // 2. On Chrome Android, it's scaled by devicePixelRatio, but not on Chrome macOS\n move(e, pointerType, e.pageX - state.current.lastPosition.pageX, e.pageY - state.current.lastPosition.pageY);\n state.current.lastPosition = {pageX: e.pageX, pageY: e.pageY};\n }\n };\n\n let onPointerUp = (e: PointerEvent) => {\n if (e.pointerId === state.current.id) {\n let pointerType = (e.pointerType || 'mouse') as PointerType;\n end(e, pointerType);\n state.current.id = null;\n removeGlobalListener(window, 'pointermove', onPointerMove, false);\n removeGlobalListener(window, 'pointerup', onPointerUp, false);\n removeGlobalListener(window, 'pointercancel', onPointerUp, false);\n }\n };\n\n moveProps.onPointerDown = (e: React.PointerEvent) => {\n if (e.button === 0 && state.current.id == null) {\n start();\n e.stopPropagation();\n e.preventDefault();\n state.current.lastPosition = {pageX: e.pageX, pageY: e.pageY};\n state.current.id = e.pointerId;\n addGlobalListener(window, 'pointermove', onPointerMove, false);\n addGlobalListener(window, 'pointerup', onPointerUp, false);\n addGlobalListener(window, 'pointercancel', onPointerUp, false);\n }\n };\n }\n\n let triggerKeyboardMove = (e: EventBase, deltaX: number, deltaY: number) => {\n start();\n move(e, 'keyboard', deltaX, deltaY);\n end(e, 'keyboard');\n };\n\n moveProps.onKeyDown = (e) => {\n switch (e.key) {\n case 'Left':\n case 'ArrowLeft':\n e.preventDefault();\n e.stopPropagation();\n triggerKeyboardMove(e, -1, 0);\n break;\n case 'Right':\n case 'ArrowRight':\n e.preventDefault();\n e.stopPropagation();\n triggerKeyboardMove(e, 1, 0);\n break;\n case 'Up':\n case 'ArrowUp':\n e.preventDefault();\n e.stopPropagation();\n triggerKeyboardMove(e, 0, -1);\n break;\n case 'Down':\n case 'ArrowDown':\n e.preventDefault();\n e.stopPropagation();\n triggerKeyboardMove(e, 0, 1);\n break;\n }\n };\n\n return moveProps;\n }, [state, onMoveStart, onMove, onMoveEnd, addGlobalListener, removeGlobalListener]);\n\n return {moveProps};\n}\n","/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {RefObject, useCallback} from 'react';\nimport {ScrollEvents} from '@react-types/shared';\nimport {useEvent} from '@react-aria/utils';\n\nexport interface ScrollWheelProps extends ScrollEvents {\n /** Whether the scroll listener should be disabled. */\n isDisabled?: boolean\n}\n\n// scroll wheel needs to be added not passively so it's cancelable, small helper hook to remember that\nexport function useScrollWheel(props: ScrollWheelProps, ref: RefObject<HTMLElement>): void {\n let {onScroll, isDisabled} = props;\n let onScrollHandler = useCallback((e) => {\n // If the ctrlKey is pressed, this is a zoom event, do nothing.\n if (e.ctrlKey) {\n return;\n }\n\n // stop scrolling the page\n e.preventDefault();\n e.stopPropagation();\n\n if (onScroll) {\n onScroll({deltaX: e.deltaX, deltaY: e.deltaY});\n }\n }, [onScroll]);\n\n useEvent(ref, 'wheel', isDisabled ? null : onScrollHandler);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMAttributes, LongPressEvent} from '@react-types/shared';\nimport {mergeProps, useDescription, useGlobalListeners} from '@react-aria/utils';\nimport {usePress} from './usePress';\nimport {useRef} from 'react';\n\nexport interface LongPressProps {\n /** Whether long press events should be disabled. */\n isDisabled?: boolean,\n /** Handler that is called when a long press interaction starts. */\n onLongPressStart?: (e: LongPressEvent) => void,\n /**\n * Handler that is called when a long press interaction ends, either\n * over the target or when the pointer leaves the target.\n */\n onLongPressEnd?: (e: LongPressEvent) => void,\n /**\n * Handler that is called when the threshold time is met while\n * the press is over the target.\n */\n onLongPress?: (e: LongPressEvent) => void,\n /**\n * The amount of time in milliseconds to wait before triggering a long press.\n * @default 500ms\n */\n threshold?: number,\n /**\n * A description for assistive techology users indicating that a long press\n * action is available, e.g. \"Long press to open menu\".\n */\n accessibilityDescription?: string\n}\n\nexport interface LongPressResult {\n /** Props to spread on the target element. */\n longPressProps: DOMAttributes\n}\n\nconst DEFAULT_THRESHOLD = 500;\n\n/**\n * Handles long press interactions across mouse and touch devices. Supports a customizable time threshold,\n * accessibility description, and normalizes behavior across browsers and devices.\n */\nexport function useLongPress(props: LongPressProps): LongPressResult {\n let {\n isDisabled,\n onLongPressStart,\n onLongPressEnd,\n onLongPress,\n threshold = DEFAULT_THRESHOLD,\n accessibilityDescription\n } = props;\n\n const timeRef = useRef(null);\n let {addGlobalListener, removeGlobalListener} = useGlobalListeners();\n\n let {pressProps} = usePress({\n isDisabled,\n onPressStart(e) {\n if (e.pointerType === 'mouse' || e.pointerType === 'touch') {\n if (onLongPressStart) {\n onLongPressStart({\n ...e,\n type: 'longpressstart'\n });\n }\n\n timeRef.current = setTimeout(() => {\n // Prevent other usePress handlers from also handling this event.\n e.target.dispatchEvent(new PointerEvent('pointercancel', {bubbles: true}));\n if (onLongPress) {\n onLongPress({\n ...e,\n type: 'longpress'\n });\n }\n timeRef.current = null;\n }, threshold);\n\n // Prevent context menu, which may be opened on long press on touch devices\n if (e.pointerType === 'touch') {\n let onContextMenu = e => {\n e.preventDefault();\n };\n\n addGlobalListener(e.target, 'contextmenu', onContextMenu, {once: true});\n addGlobalListener(window, 'pointerup', () => {\n // If no contextmenu event is fired quickly after pointerup, remove the handler\n // so future context menu events outside a long press are not prevented.\n setTimeout(() => {\n removeGlobalListener(e.target, 'contextmenu', onContextMenu);\n }, 30);\n }, {once: true});\n }\n }\n },\n onPressEnd(e) {\n if (timeRef.current) {\n clearTimeout(timeRef.current);\n }\n\n if (onLongPressEnd && (e.pointerType === 'mouse' || e.pointerType === 'touch')) {\n onLongPressEnd({\n ...e,\n type: 'longpressend'\n });\n }\n }\n });\n\n let descriptionProps = useDescription(onLongPress && !isDisabled ? accessibilityDescription : null);\n\n return {\n longPressProps: mergeProps(pressProps, descriptionProps)\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport type {AriaFieldProps, FieldAria} from './useField';\nexport type {LabelAriaProps, LabelAria} from './useLabel';\n\nexport {useField} from './useField';\nexport {useLabel} from './useLabel';\n","/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMAttributes, HelpTextProps, Validation} from '@react-types/shared';\nimport {LabelAria, LabelAriaProps, useLabel} from './useLabel';\nimport {mergeProps, useSlotId} from '@react-aria/utils';\n\nexport interface AriaFieldProps extends LabelAriaProps, HelpTextProps, Omit<Validation, 'isRequired'> {}\n\nexport interface FieldAria extends LabelAria {\n /** Props for the description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\n/**\n * Provides the accessibility implementation for input fields.\n * Fields accept user input, gain context from their label, and may display a description or error message.\n * @param props - Props for the Field.\n */\nexport function useField(props: AriaFieldProps): FieldAria {\n let {description, errorMessage, validationState} = props;\n let {labelProps, fieldProps} = useLabel(props);\n\n let descriptionId = useSlotId([Boolean(description), Boolean(errorMessage), validationState]);\n let errorMessageId = useSlotId([Boolean(description), Boolean(errorMessage), validationState]);\n\n fieldProps = mergeProps(fieldProps, {\n 'aria-describedby': [\n descriptionId,\n // Use aria-describedby for error message because aria-errormessage is unsupported using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268\n errorMessageId,\n props['aria-describedby']\n ].filter(Boolean).join(' ') || undefined\n });\n\n return {\n labelProps,\n fieldProps,\n descriptionProps: {\n id: descriptionId\n },\n errorMessageProps: {\n id: errorMessageId\n }\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMAttributes, DOMProps, LabelableProps} from '@react-types/shared';\nimport {ElementType, LabelHTMLAttributes} from 'react';\nimport {useId, useLabels} from '@react-aria/utils';\n\nexport interface LabelAriaProps extends LabelableProps, DOMProps, AriaLabelingProps {\n /**\n * The HTML element used to render the label, e.g. 'label', or 'span'.\n * @default 'label'\n */\n labelElementType?: ElementType\n}\n\nexport interface LabelAria {\n /** Props to apply to the label container element. */\n labelProps: DOMAttributes | LabelHTMLAttributes<HTMLLabelElement>,\n /** Props to apply to the field container element being labeled. */\n fieldProps: AriaLabelingProps & DOMProps\n}\n\n/**\n * Provides the accessibility implementation for labels and their associated elements.\n * Labels provide context for user inputs.\n * @param props - The props for labels and fields.\n */\nexport function useLabel(props: LabelAriaProps): LabelAria {\n let {\n id,\n label,\n 'aria-labelledby': ariaLabelledby,\n 'aria-label': ariaLabel,\n labelElementType = 'label'\n } = props;\n\n id = useId(id);\n let labelId = useId();\n let labelProps = {};\n if (label) {\n ariaLabelledby = ariaLabelledby ? `${ariaLabelledby} ${labelId}` : labelId;\n labelProps = {\n id: labelId,\n htmlFor: labelElementType === 'label' ? id : undefined\n };\n } else if (!ariaLabelledby && !ariaLabel) {\n console.warn('If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility');\n }\n\n let fieldProps = useLabels({\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby\n });\n\n return {\n labelProps,\n fieldProps\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {I18nProvider, useLocale} from './context';\nexport {useMessageFormatter} from './useMessageFormatter';\nexport {useLocalizedStringFormatter} from './useLocalizedStringFormatter';\nexport {useListFormatter} from './useListFormatter';\nexport {useDateFormatter} from './useDateFormatter';\nexport {useNumberFormatter} from './useNumberFormatter';\nexport {useCollator} from './useCollator';\nexport {useFilter} from './useFilter';\n\nexport type {FormatMessage} from './useMessageFormatter';\nexport type {I18nProviderProps} from './context';\nexport type {Locale} from './useDefaultLocale';\nexport type {LocalizedStrings} from '@internationalized/message';\nexport type {DateFormatterOptions} from './useDateFormatter';\nexport type {DateFormatter} from '@internationalized/date';\nexport type {Filter} from './useFilter';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {isRTL} from './utils';\nimport {Locale, useDefaultLocale} from './useDefaultLocale';\nimport React, {ReactNode, useContext} from 'react';\n\nexport interface I18nProviderProps {\n /** Contents that should have the locale applied. */\n children: ReactNode,\n /** The locale to apply to the children. */\n locale?: string\n}\n\nconst I18nContext = React.createContext<Locale>(null);\n\n/**\n * Provides the locale for the application to all child components.\n */\nexport function I18nProvider(props: I18nProviderProps) {\n let {locale, children} = props;\n let defaultLocale = useDefaultLocale();\n\n let value: Locale = locale ? {\n locale,\n direction: isRTL(locale) ? 'rtl' : 'ltr'\n } : defaultLocale;\n\n return (\n <I18nContext.Provider value={value}>\n {children}\n </I18nContext.Provider>\n );\n}\n\n/**\n * Returns the current locale and layout direction.\n */\nexport function useLocale(): Locale {\n let defaultLocale = useDefaultLocale();\n let context = useContext(I18nContext);\n return context || defaultLocale;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// https://en.wikipedia.org/wiki/Right-to-left\nconst RTL_SCRIPTS = new Set(['Arab', 'Syrc', 'Samr', 'Mand', 'Thaa', 'Mend', 'Nkoo', 'Adlm', 'Rohg', 'Hebr']);\nconst RTL_LANGS = new Set(['ae', 'ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi']);\n\n/**\n * Determines if a locale is read right to left using [Intl.Locale]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale}.\n */\nexport function isRTL(locale: string) {\n // If the Intl.Locale API is available, use it to get the script for the locale.\n // This is more accurate than guessing by language, since languages can be written in multiple scripts.\n // @ts-ignore\n if (Intl.Locale) {\n // @ts-ignore\n let script = new Intl.Locale(locale).maximize().script;\n return RTL_SCRIPTS.has(script);\n }\n\n // If not, just guess by the language (first part of the locale)\n let lang = locale.split('-')[0];\n return RTL_LANGS.has(lang);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Direction} from '@react-types/shared';\nimport {isRTL} from './utils';\nimport {useEffect, useState} from 'react';\nimport {useIsSSR} from '@react-aria/ssr';\n\nexport interface Locale {\n /** The [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt) language code for the locale. */\n locale: string,\n /** The writing direction for the locale. */\n direction: Direction\n}\n\n/**\n * Gets the locale setting of the browser.\n */\nexport function getDefaultLocale(): Locale {\n // @ts-ignore\n let locale = (typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage)) || 'en-US';\n try {\n // @ts-ignore\n Intl.DateTimeFormat.supportedLocalesOf([locale]);\n } catch (_err) {\n locale = 'en-US';\n }\n return {\n locale,\n direction: isRTL(locale) ? 'rtl' : 'ltr'\n };\n}\n\nlet currentLocale = getDefaultLocale();\nlet listeners = new Set<(locale: Locale) => void>();\n\nfunction updateLocale() {\n currentLocale = getDefaultLocale();\n for (let listener of listeners) {\n listener(currentLocale);\n }\n}\n\n/**\n * Returns the current browser/system language, and updates when it changes.\n */\nexport function useDefaultLocale(): Locale {\n let isSSR = useIsSSR();\n let [defaultLocale, setDefaultLocale] = useState(currentLocale);\n\n useEffect(() => {\n if (listeners.size === 0) {\n window.addEventListener('languagechange', updateLocale);\n }\n\n listeners.add(setDefaultLocale);\n\n return () => {\n listeners.delete(setDefaultLocale);\n if (listeners.size === 0) {\n window.removeEventListener('languagechange', updateLocale);\n }\n };\n }, []);\n\n // We cannot determine the browser's language on the server, so default to\n // en-US. This will be updated after hydration on the client to the correct value.\n if (isSSR) {\n return {\n locale: 'en-US',\n direction: 'ltr'\n };\n }\n\n return defaultLocale;\n}\n","\"use strict\";","/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {LocalizedString, LocalizedStringDictionary, LocalizedStringFormatter, LocalizedStrings} from '@internationalized/string';\nimport {useLocale} from './context';\nimport {useMemo} from 'react';\n\nconst cache = new WeakMap();\nfunction getCachedDictionary<K extends string, T extends LocalizedString>(strings: LocalizedStrings<K, T>): LocalizedStringDictionary<K, T> {\n let dictionary = cache.get(strings);\n if (!dictionary) {\n dictionary = new LocalizedStringDictionary(strings);\n cache.set(strings, dictionary);\n }\n\n return dictionary;\n}\n\n/**\n * Provides localized string formatting for the current locale. Supports interpolating variables,\n * selecting the correct pluralization, and formatting numbers. Automatically updates when the locale changes.\n * @param strings - A mapping of languages to localized strings by key.\n */\nexport function useLocalizedStringFormatter<K extends string = string, T extends LocalizedString = string>(strings: LocalizedStrings<K, T>): LocalizedStringFormatter<K, T> {\n let {locale} = useLocale();\n let dictionary = useMemo(() => getCachedDictionary(strings), [strings]);\n return useMemo(() => new LocalizedStringFormatter(locale, dictionary), [locale, dictionary]);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {useLocale} from './context';\nimport {useMemo} from 'react';\n\n/**\n * Provides localized list formatting for the current locale. Automatically updates when the locale changes,\n * and handles caching of the list formatter for performance.\n * @param options - Formatting options.\n */\n\n// Typescript version 4.7 supports Intl.ListFormat - TODO upgrade\n// @ts-ignore\nexport function useListFormatter(options: Intl.ListFormatOptions = {}): Intl.ListFormat {\n let {locale} = useLocale();\n // @ts-ignore\n return useMemo(() => new Intl.ListFormat(locale, options), [locale, options]);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DateFormatter} from '@internationalized/date';\nimport {useLocale} from './context';\nimport {useMemo, useRef} from 'react';\n\nexport interface DateFormatterOptions extends Intl.DateTimeFormatOptions {\n calendar?: string\n}\n\n/**\n * Provides localized date formatting for the current locale. Automatically updates when the locale changes,\n * and handles caching of the date formatter for performance.\n * @param options - Formatting options.\n */\nexport function useDateFormatter(options?: DateFormatterOptions): DateFormatter {\n // Reuse last options object if it is shallowly equal, which allows the useMemo result to also be reused.\n let lastOptions = useRef(null);\n if (options && lastOptions.current && isEqual(options, lastOptions.current)) {\n options = lastOptions.current;\n }\n\n lastOptions.current = options;\n\n let {locale} = useLocale();\n return useMemo(() => new DateFormatter(locale, options), [locale, options]);\n}\n\nfunction isEqual(a: DateFormatterOptions, b: DateFormatterOptions) {\n if (a === b) {\n return true;\n }\n\n let aKeys = Object.keys(a);\n let bKeys = Object.keys(b);\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n\n for (let key of aKeys) {\n if (b[key] !== a[key]) {\n return false;\n }\n }\n\n return true;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {NumberFormatOptions, NumberFormatter} from '@internationalized/number';\nimport {useLocale} from './context';\nimport {useMemo} from 'react';\n\n/**\n * Provides localized number formatting for the current locale. Automatically updates when the locale changes,\n * and handles caching of the number formatter for performance.\n * @param options - Formatting options.\n */\nexport function useNumberFormatter(options: NumberFormatOptions = {}): Intl.NumberFormat {\n let {locale} = useLocale();\n return useMemo(() => new NumberFormatter(locale, options), [locale, options]);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {useLocale} from './context';\n\nlet cache = new Map<string, Intl.Collator>();\n\n/**\n * Provides localized string collation for the current locale. Automatically updates when the locale changes,\n * and handles caching of the collator for performance.\n * @param options - Collator options.\n */\nexport function useCollator(options?: Intl.CollatorOptions): Intl.Collator {\n let {locale} = useLocale();\n\n let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : '');\n if (cache.has(cacheKey)) {\n return cache.get(cacheKey);\n }\n\n let formatter = new Intl.Collator(locale, options);\n cache.set(cacheKey, formatter);\n return formatter;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {useCollator} from './useCollator';\n\nexport interface Filter {\n /** Returns whether a string starts with a given substring. */\n startsWith(string: string, substring: string): boolean,\n /** Returns whether a string ends with a given substring. */\n endsWith(string: string, substring: string): boolean,\n /** Returns whether a string contains a given substring. */\n contains(string: string, substring: string): boolean\n}\n\n/**\n * Provides localized string search functionality that is useful for filtering or matching items\n * in a list. Options can be provided to adjust the sensitivity to case, diacritics, and other parameters.\n */\nexport function useFilter(options?: Intl.CollatorOptions): Filter {\n let collator = useCollator({\n usage: 'search',\n ...options\n });\n\n // TODO(later): these methods don't currently support the ignorePunctuation option.\n\n return {\n startsWith(string, substring) {\n if (substring.length === 0) {\n return true;\n }\n\n // Normalize both strings so we can slice safely\n // TODO: take into account the ignorePunctuation option as well...\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n return collator.compare(string.slice(0, substring.length), substring) === 0;\n },\n endsWith(string, substring) {\n if (substring.length === 0) {\n return true;\n }\n\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n return collator.compare(string.slice(-substring.length), substring) === 0;\n },\n contains(string, substring) {\n if (substring.length === 0) {\n return true;\n }\n\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n\n let scan = 0;\n let sliceLen = substring.length;\n for (; scan + sliceLen <= string.length; scan++) {\n let slice = string.slice(scan, scan + sliceLen);\n if (collator.compare(substring, slice) === 0) {\n return true;\n }\n }\n\n return false;\n }\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {useSelectableCollection} from './useSelectableCollection';\nexport {useSelectableItem} from './useSelectableItem';\nexport {useSelectableList} from './useSelectableList';\nexport {ListKeyboardDelegate} from './ListKeyboardDelegate';\nexport {useTypeSelect} from './useTypeSelect';\n\nexport type {AriaSelectableCollectionOptions, SelectableCollectionAria} from './useSelectableCollection';\nexport type {AriaSelectableListOptions, SelectableListAria} from './useSelectableList';\nexport type {SelectableItemOptions, SelectableItemStates, SelectableItemAria} from './useSelectableItem';\nexport type {AriaTypeSelectOptions, TypeSelectAria} from './useTypeSelect';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMAttributes, FocusableElement, FocusStrategy, KeyboardDelegate} from '@react-types/shared';\nimport {FocusEvent, Key, KeyboardEvent, RefObject, useEffect, useRef} from 'react';\nimport {focusSafely, getFocusableTreeWalker} from '@react-aria/focus';\nimport {focusWithoutScrolling, mergeProps, scrollIntoView, useEvent} from '@react-aria/utils';\nimport {isCtrlKeyPressed, isNonContiguousSelectionModifier} from './utils';\nimport {MultipleSelectionManager} from '@react-stately/selection';\nimport {useLocale} from '@react-aria/i18n';\nimport {useTypeSelect} from './useTypeSelect';\n\nexport interface AriaSelectableCollectionOptions {\n /**\n * An interface for reading and updating multiple selection state.\n */\n selectionManager: MultipleSelectionManager,\n /**\n * A delegate object that implements behavior for keyboard focus movement.\n */\n keyboardDelegate: KeyboardDelegate,\n /**\n * The ref attached to the element representing the collection.\n */\n ref: RefObject<HTMLElement>,\n /**\n * Whether the collection or one of its items should be automatically focused upon render.\n * @default false\n */\n autoFocus?: boolean | FocusStrategy,\n /**\n * Whether focus should wrap around when the end/start is reached.\n * @default false\n */\n shouldFocusWrap?: boolean,\n /**\n * Whether the collection allows empty selection.\n * @default false\n */\n disallowEmptySelection?: boolean,\n /**\n * Whether the collection allows the user to select all items via keyboard shortcut.\n * @default false\n */\n disallowSelectAll?: boolean,\n /**\n * Whether selection should occur automatically on focus.\n * @default false\n */\n selectOnFocus?: boolean,\n /**\n * Whether typeahead is disabled.\n * @default false\n */\n disallowTypeAhead?: boolean,\n /**\n * Whether the collection items should use virtual focus instead of being focused directly.\n */\n shouldUseVirtualFocus?: boolean,\n /**\n * Whether navigation through tab key is enabled.\n */\n allowsTabNavigation?: boolean,\n /**\n * Whether the collection items are contained in a virtual scroller.\n */\n isVirtualized?: boolean,\n /**\n * The ref attached to the scrollable body. Used to provide automatic scrolling on item focus for non-virtualized collections.\n * If not provided, defaults to the collection ref.\n */\n scrollRef?: RefObject<HTMLElement>\n}\n\nexport interface SelectableCollectionAria {\n /** Props for the collection element. */\n collectionProps: DOMAttributes\n}\n\n/**\n * Handles interactions with selectable collections.\n */\nexport function useSelectableCollection(options: AriaSelectableCollectionOptions): SelectableCollectionAria {\n let {\n selectionManager: manager,\n keyboardDelegate: delegate,\n ref,\n autoFocus = false,\n shouldFocusWrap = false,\n disallowEmptySelection = false,\n disallowSelectAll = false,\n selectOnFocus = manager.selectionBehavior === 'replace',\n disallowTypeAhead = false,\n shouldUseVirtualFocus,\n allowsTabNavigation = false,\n isVirtualized,\n // If no scrollRef is provided, assume the collection ref is the scrollable region\n scrollRef = ref\n } = options;\n let {direction} = useLocale();\n\n\n let onKeyDown = (e: KeyboardEvent) => {\n // Prevent option + tab from doing anything since it doesn't move focus to the cells, only buttons/checkboxes\n if (e.altKey && e.key === 'Tab') {\n e.preventDefault();\n }\n\n // Keyboard events bubble through portals. Don't handle keyboard events\n // for elements outside the collection (e.g. menus).\n if (!ref.current.contains(e.target as Element)) {\n return;\n }\n\n const navigateToKey = (key: Key | undefined, childFocus?: FocusStrategy) => {\n if (key != null) {\n manager.setFocusedKey(key, childFocus);\n\n if (e.shiftKey && manager.selectionMode === 'multiple') {\n manager.extendSelection(key);\n } else if (selectOnFocus && !isNonContiguousSelectionModifier(e)) {\n manager.replaceSelection(key);\n }\n }\n };\n\n switch (e.key) {\n case 'ArrowDown': {\n if (delegate.getKeyBelow) {\n e.preventDefault();\n let nextKey = manager.focusedKey != null\n ? delegate.getKeyBelow(manager.focusedKey)\n : delegate.getFirstKey?.();\n if (nextKey == null && shouldFocusWrap) {\n nextKey = delegate.getFirstKey?.(manager.focusedKey);\n }\n navigateToKey(nextKey);\n }\n break;\n }\n case 'ArrowUp': {\n if (delegate.getKeyAbove) {\n e.preventDefault();\n let nextKey = manager.focusedKey != null\n ? delegate.getKeyAbove(manager.focusedKey)\n : delegate.getLastKey?.();\n if (nextKey == null && shouldFocusWrap) {\n nextKey = delegate.getLastKey?.(manager.focusedKey);\n }\n navigateToKey(nextKey);\n }\n break;\n }\n case 'ArrowLeft': {\n if (delegate.getKeyLeftOf) {\n e.preventDefault();\n let nextKey = delegate.getKeyLeftOf(manager.focusedKey);\n navigateToKey(nextKey, direction === 'rtl' ? 'first' : 'last');\n }\n break;\n }\n case 'ArrowRight': {\n if (delegate.getKeyRightOf) {\n e.preventDefault();\n let nextKey = delegate.getKeyRightOf(manager.focusedKey);\n navigateToKey(nextKey, direction === 'rtl' ? 'last' : 'first');\n }\n break;\n }\n case 'Home':\n if (delegate.getFirstKey) {\n e.preventDefault();\n let firstKey = delegate.getFirstKey(manager.focusedKey, isCtrlKeyPressed(e));\n manager.setFocusedKey(firstKey);\n if (isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode === 'multiple') {\n manager.extendSelection(firstKey);\n } else if (selectOnFocus) {\n manager.replaceSelection(firstKey);\n }\n }\n break;\n case 'End':\n if (delegate.getLastKey) {\n e.preventDefault();\n let lastKey = delegate.getLastKey(manager.focusedKey, isCtrlKeyPressed(e));\n manager.setFocusedKey(lastKey);\n if (isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode === 'multiple') {\n manager.extendSelection(lastKey);\n } else if (selectOnFocus) {\n manager.replaceSelection(lastKey);\n }\n }\n break;\n case 'PageDown':\n if (delegate.getKeyPageBelow) {\n e.preventDefault();\n let nextKey = delegate.getKeyPageBelow(manager.focusedKey);\n navigateToKey(nextKey);\n }\n break;\n case 'PageUp':\n if (delegate.getKeyPageAbove) {\n e.preventDefault();\n let nextKey = delegate.getKeyPageAbove(manager.focusedKey);\n navigateToKey(nextKey);\n }\n break;\n case 'a':\n if (isCtrlKeyPressed(e) && manager.selectionMode === 'multiple' && disallowSelectAll !== true) {\n e.preventDefault();\n manager.selectAll();\n }\n break;\n case 'Escape':\n e.preventDefault();\n if (!disallowEmptySelection) {\n manager.clearSelection();\n }\n break;\n case 'Tab': {\n if (!allowsTabNavigation) {\n // There may be elements that are \"tabbable\" inside a collection (e.g. in a grid cell).\n // However, collections should be treated as a single tab stop, with arrow key navigation internally.\n // We don't control the rendering of these, so we can't override the tabIndex to prevent tabbing.\n // Instead, we handle the Tab key, and move focus manually to the first/last tabbable element\n // in the collection, so that the browser default behavior will apply starting from that element\n // rather than the currently focused one.\n if (e.shiftKey) {\n ref.current.focus();\n } else {\n let walker = getFocusableTreeWalker(ref.current, {tabbable: true});\n let next: FocusableElement;\n let last: FocusableElement;\n do {\n last = walker.lastChild() as FocusableElement;\n if (last) {\n next = last;\n }\n } while (last);\n\n if (next && !next.contains(document.activeElement)) {\n focusWithoutScrolling(next);\n }\n }\n break;\n }\n }\n }\n };\n\n // Store the scroll position so we can restore it later.\n let scrollPos = useRef({top: 0, left: 0});\n useEvent(scrollRef, 'scroll', isVirtualized ? null : () => {\n scrollPos.current = {\n top: scrollRef.current.scrollTop,\n left: scrollRef.current.scrollLeft\n };\n });\n\n let onFocus = (e: FocusEvent) => {\n if (manager.isFocused) {\n // If a focus event bubbled through a portal, reset focus state.\n if (!e.currentTarget.contains(e.target)) {\n manager.setFocused(false);\n }\n\n return;\n }\n\n // Focus events can bubble through portals. Ignore these events.\n if (!e.currentTarget.contains(e.target)) {\n return;\n }\n\n manager.setFocused(true);\n\n if (manager.focusedKey == null) {\n let navigateToFirstKey = (key: Key | undefined) => {\n if (key != null) {\n manager.setFocusedKey(key);\n if (selectOnFocus) {\n manager.replaceSelection(key);\n }\n }\n };\n // If the user hasn't yet interacted with the collection, there will be no focusedKey set.\n // Attempt to detect whether the user is tabbing forward or backward into the collection\n // and either focus the first or last item accordingly.\n let relatedTarget = e.relatedTarget as Element;\n if (relatedTarget && (e.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING)) {\n navigateToFirstKey(manager.lastSelectedKey ?? delegate.getLastKey());\n } else {\n navigateToFirstKey(manager.firstSelectedKey ?? delegate.getFirstKey());\n }\n } else if (!isVirtualized) {\n // Restore the scroll position to what it was before.\n scrollRef.current.scrollTop = scrollPos.current.top;\n scrollRef.current.scrollLeft = scrollPos.current.left;\n\n // Refocus and scroll the focused item into view if it exists within the scrollable region.\n let element = scrollRef.current.querySelector(`[data-key=\"${manager.focusedKey}\"]`) as HTMLElement;\n if (element) {\n // This prevents a flash of focus on the first/last element in the collection\n focusWithoutScrolling(element);\n scrollIntoView(scrollRef.current, element);\n }\n }\n };\n\n let onBlur = (e) => {\n // Don't set blurred and then focused again if moving focus within the collection.\n if (!e.currentTarget.contains(e.relatedTarget as HTMLElement)) {\n manager.setFocused(false);\n }\n };\n\n const autoFocusRef = useRef(autoFocus);\n useEffect(() => {\n if (autoFocusRef.current) {\n let focusedKey = null;\n\n // Check focus strategy to determine which item to focus\n if (autoFocus === 'first') {\n focusedKey = delegate.getFirstKey();\n } if (autoFocus === 'last') {\n focusedKey = delegate.getLastKey();\n }\n\n // If there are any selected keys, make the first one the new focus target\n let selectedKeys = manager.selectedKeys;\n if (selectedKeys.size) {\n focusedKey = selectedKeys.values().next().value;\n }\n\n manager.setFocused(true);\n manager.setFocusedKey(focusedKey);\n\n // If no default focus key is selected, focus the collection itself.\n if (focusedKey == null && !shouldUseVirtualFocus) {\n focusSafely(ref.current);\n }\n }\n autoFocusRef.current = false;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // If not virtualized, scroll the focused element into view when the focusedKey changes.\n // When virtualized, Virtualizer handles this internally.\n useEffect(() => {\n if (!isVirtualized && manager.focusedKey && scrollRef?.current) {\n let element = scrollRef.current.querySelector(`[data-key=\"${manager.focusedKey}\"]`) as HTMLElement;\n if (element) {\n scrollIntoView(scrollRef.current, element);\n }\n }\n }, [isVirtualized, scrollRef, manager.focusedKey]);\n\n let handlers = {\n onKeyDown,\n onFocus,\n onBlur,\n onMouseDown(e) {\n // Ignore events that bubbled through portals.\n if (scrollRef.current === e.target) {\n // Prevent focus going to the collection when clicking on the scrollbar.\n e.preventDefault();\n }\n }\n };\n\n let {typeSelectProps} = useTypeSelect({\n keyboardDelegate: delegate,\n selectionManager: manager\n });\n\n if (!disallowTypeAhead) {\n handlers = mergeProps(typeSelectProps, handlers);\n }\n\n // If nothing is focused within the collection, make the collection itself tabbable.\n // This will be marshalled to either the first or last item depending on where focus came from.\n // If using virtual focus, don't set a tabIndex at all so that VoiceOver on iOS 14 doesn't try\n // to move real DOM focus to the element anyway.\n let tabIndex: number;\n if (!shouldUseVirtualFocus) {\n tabIndex = manager.focusedKey == null ? 0 : -1;\n }\n\n return {\n collectionProps: {\n ...handlers,\n tabIndex\n }\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {isAppleDevice} from '@react-aria/utils';\nimport {isMac} from '@react-aria/utils';\n\ninterface Event {\n altKey: boolean,\n ctrlKey: boolean,\n metaKey: boolean\n}\n\nexport function isNonContiguousSelectionModifier(e: Event) {\n // Ctrl + Arrow Up/Arrow Down has a system wide meaning on macOS, so use Alt instead.\n // On Windows and Ubuntu, Alt + Space has a system wide meaning.\n return isAppleDevice() ? e.altKey : e.ctrlKey;\n}\n\nexport function isCtrlKeyPressed(e: Event) {\n if (isMac()) {\n return e.metaKey;\n }\n\n return e.ctrlKey;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMAttributes, KeyboardDelegate} from '@react-types/shared';\nimport {Key, KeyboardEvent, useRef} from 'react';\nimport {MultipleSelectionManager} from '@react-stately/selection';\n\n/**\n * Controls how long to wait before clearing the typeahead buffer.\n */\nconst TYPEAHEAD_DEBOUNCE_WAIT_MS = 1000; // 1 second\n\nexport interface AriaTypeSelectOptions {\n /**\n * A delegate that returns collection item keys with respect to visual layout.\n */\n keyboardDelegate: KeyboardDelegate,\n /**\n * An interface for reading and updating multiple selection state.\n */\n selectionManager: MultipleSelectionManager,\n /**\n * Called when an item is focused by typing.\n */\n onTypeSelect?: (key: Key) => void\n}\n\nexport interface TypeSelectAria {\n /**\n * Props to be spread on the owner of the options.\n */\n typeSelectProps: DOMAttributes\n}\n\n/**\n * Handles typeahead interactions with collections.\n */\nexport function useTypeSelect(options: AriaTypeSelectOptions): TypeSelectAria {\n let {keyboardDelegate, selectionManager, onTypeSelect} = options;\n let state = useRef({\n search: '',\n timeout: null\n }).current;\n\n let onKeyDown = (e: KeyboardEvent) => {\n let character = getStringForKey(e.key);\n if (!character || e.ctrlKey || e.metaKey) {\n return;\n }\n\n // Do not propagate the Spacebar event if it's meant to be part of the search.\n // When we time out, the search term becomes empty, hence the check on length.\n // Trimming is to account for the case of pressing the Spacebar more than once,\n // which should cycle through the selection/deselection of the focused item.\n if (character === ' ' && state.search.trim().length > 0) {\n e.preventDefault();\n if (!('continuePropagation' in e)) {\n e.stopPropagation();\n }\n }\n\n state.search += character;\n\n // Use the delegate to find a key to focus.\n // Prioritize items after the currently focused item, falling back to searching the whole list.\n let key = keyboardDelegate.getKeyForSearch(state.search, selectionManager.focusedKey);\n\n // If no key found, search from the top.\n if (key == null) {\n key = keyboardDelegate.getKeyForSearch(state.search);\n }\n\n if (key != null) {\n selectionManager.setFocusedKey(key);\n if (onTypeSelect) {\n onTypeSelect(key);\n }\n }\n\n clearTimeout(state.timeout);\n state.timeout = setTimeout(() => {\n state.search = '';\n }, TYPEAHEAD_DEBOUNCE_WAIT_MS);\n };\n\n return {\n typeSelectProps: {\n // Using a capturing listener to catch the keydown event before\n // other hooks in order to handle the Spacebar event.\n onKeyDownCapture: keyboardDelegate.getKeyForSearch ? onKeyDown : null\n }\n };\n}\n\nfunction getStringForKey(key: string) {\n // If the key is of length 1, it is an ASCII value.\n // Otherwise, if there are no ASCII characters in the key name,\n // it is a Unicode character.\n // See https://www.w3.org/TR/uievents-key/\n if (key.length === 1 || !/^[A-Z]/i.test(key)) {\n return key;\n }\n\n return '';\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMAttributes, FocusableElement, LongPressEvent, PressEvent} from '@react-types/shared';\nimport {focusSafely} from '@react-aria/focus';\nimport {isCtrlKeyPressed, isNonContiguousSelectionModifier} from './utils';\nimport {Key, RefObject, useEffect, useRef} from 'react';\nimport {mergeProps} from '@react-aria/utils';\nimport {MultipleSelectionManager} from '@react-stately/selection';\nimport {PressProps, useLongPress, usePress} from '@react-aria/interactions';\n\nexport interface SelectableItemOptions {\n /**\n * An interface for reading and updating multiple selection state.\n */\n selectionManager: MultipleSelectionManager,\n /**\n * A unique key for the item.\n */\n key: Key,\n /**\n * Ref to the item.\n */\n ref: RefObject<FocusableElement>,\n /**\n * By default, selection occurs on pointer down. This can be strange if selecting an\n * item causes the UI to disappear immediately (e.g. menus).\n */\n shouldSelectOnPressUp?: boolean,\n /**\n * Whether selection requires the pointer/mouse down and up events to occur on the same target or triggers selection on\n * the target of the pointer/mouse up event.\n */\n allowsDifferentPressOrigin?: boolean,\n /**\n * Whether the option is contained in a virtual scroller.\n */\n isVirtualized?: boolean,\n /**\n * Function to focus the item.\n */\n focus?: () => void,\n /**\n * Whether the option should use virtual focus instead of being focused directly.\n */\n shouldUseVirtualFocus?: boolean,\n /** Whether the item is disabled. */\n isDisabled?: boolean,\n /**\n * Handler that is called when a user performs an action on the item. The exact user event depends on\n * the collection's `selectionBehavior` prop and the interaction modality.\n */\n onAction?: () => void\n}\n\nexport interface SelectableItemStates {\n /** Whether the item is currently in a pressed state. */\n isPressed: boolean,\n /** Whether the item is currently selected. */\n isSelected: boolean,\n /**\n * Whether the item is non-interactive, i.e. both selection and actions are disabled and the item may\n * not be focused. Dependent on `disabledKeys` and `disabledBehavior`.\n */\n isDisabled: boolean,\n /**\n * Whether the item may be selected, dependent on `selectionMode`, `disabledKeys`, and `disabledBehavior`.\n */\n allowsSelection: boolean,\n /**\n * Whether the item has an action, dependent on `onAction`, `disabledKeys`,\n * and `disabledBehavior`. It may also change depending on the current selection state\n * of the list (e.g. when selection is primary). This can be used to enable or disable hover\n * styles or other visual indications of interactivity.\n */\n hasAction: boolean\n}\n\nexport interface SelectableItemAria extends SelectableItemStates {\n /**\n * Props to be spread on the item root node.\n */\n itemProps: DOMAttributes\n}\n\n/**\n * Handles interactions with an item in a selectable collection.\n */\nexport function useSelectableItem(options: SelectableItemOptions): SelectableItemAria {\n let {\n selectionManager: manager,\n key,\n ref,\n shouldSelectOnPressUp,\n isVirtualized,\n shouldUseVirtualFocus,\n focus,\n isDisabled,\n onAction,\n allowsDifferentPressOrigin\n } = options;\n\n let onSelect = (e: PressEvent | LongPressEvent | PointerEvent) => {\n if (e.pointerType === 'keyboard' && isNonContiguousSelectionModifier(e)) {\n manager.toggleSelection(key);\n } else {\n if (manager.selectionMode === 'none') {\n return;\n }\n\n if (manager.selectionMode === 'single') {\n if (manager.isSelected(key) && !manager.disallowEmptySelection) {\n manager.toggleSelection(key);\n } else {\n manager.replaceSelection(key);\n }\n } else if (e && e.shiftKey) {\n manager.extendSelection(key);\n } else if (manager.selectionBehavior === 'toggle' || (e && (isCtrlKeyPressed(e) || e.pointerType === 'touch' || e.pointerType === 'virtual'))) {\n // if touch or virtual (VO) then we just want to toggle, otherwise it's impossible to multi select because they don't have modifier keys\n manager.toggleSelection(key);\n } else {\n manager.replaceSelection(key);\n }\n }\n };\n\n // Focus the associated DOM node when this item becomes the focusedKey\n useEffect(() => {\n let isFocused = key === manager.focusedKey;\n if (isFocused && manager.isFocused && !shouldUseVirtualFocus && document.activeElement !== ref.current) {\n if (focus) {\n focus();\n } else {\n focusSafely(ref.current);\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [ref, key, manager.focusedKey, manager.childFocusStrategy, manager.isFocused, shouldUseVirtualFocus]);\n\n isDisabled = isDisabled || manager.isDisabled(key);\n // Set tabIndex to 0 if the element is focused, or -1 otherwise so that only the last focused\n // item is tabbable. If using virtual focus, don't set a tabIndex at all so that VoiceOver\n // on iOS 14 doesn't try to move real DOM focus to the item anyway.\n let itemProps: SelectableItemAria['itemProps'] = {};\n if (!shouldUseVirtualFocus && !isDisabled) {\n itemProps = {\n tabIndex: key === manager.focusedKey ? 0 : -1,\n onFocus(e) {\n if (e.target === ref.current) {\n manager.setFocusedKey(key);\n }\n }\n };\n } else if (isDisabled) {\n itemProps.onMouseDown = (e) => {\n // Prevent focus going to the body when clicking on a disabled item.\n e.preventDefault();\n };\n }\n\n // With checkbox selection, onAction (i.e. navigation) becomes primary, and occurs on a single click of the row.\n // Clicking the checkbox enters selection mode, after which clicking anywhere on any row toggles selection for that row.\n // With highlight selection, onAction is secondary, and occurs on double click. Single click selects the row.\n // With touch, onAction occurs on single tap, and long press enters selection mode.\n let allowsSelection = !isDisabled && manager.canSelectItem(key);\n let allowsActions = onAction && !isDisabled;\n let hasPrimaryAction = allowsActions && (\n manager.selectionBehavior === 'replace'\n ? !allowsSelection\n : manager.isEmpty\n );\n let hasSecondaryAction = allowsActions && allowsSelection && manager.selectionBehavior === 'replace';\n let hasAction = hasPrimaryAction || hasSecondaryAction;\n let modality = useRef(null);\n\n let longPressEnabled = hasAction && allowsSelection;\n let longPressEnabledOnPressStart = useRef(false);\n let hadPrimaryActionOnPressStart = useRef(false);\n\n // By default, selection occurs on pointer down. This can be strange if selecting an\n // item causes the UI to disappear immediately (e.g. menus).\n // If shouldSelectOnPressUp is true, we use onPressUp instead of onPressStart.\n // onPress requires a pointer down event on the same element as pointer up. For menus,\n // we want to be able to have the pointer down on the trigger that opens the menu and\n // the pointer up on the menu item rather than requiring a separate press.\n // For keyboard events, selection still occurs on key down.\n let itemPressProps: PressProps = {};\n if (shouldSelectOnPressUp) {\n itemPressProps.onPressStart = (e) => {\n modality.current = e.pointerType;\n longPressEnabledOnPressStart.current = longPressEnabled;\n if (e.pointerType === 'keyboard' && (!hasAction || isSelectionKey())) {\n onSelect(e);\n }\n };\n\n // If allowsDifferentPressOrigin, make selection happen on pressUp (e.g. open menu on press down, selection on menu item happens on press up.)\n // Otherwise, have selection happen onPress (prevents listview row selection when clicking on interactable elements in the row)\n if (!allowsDifferentPressOrigin) {\n itemPressProps.onPress = (e) => {\n if (hasPrimaryAction || (hasSecondaryAction && e.pointerType !== 'mouse')) {\n if (e.pointerType === 'keyboard' && !isActionKey()) {\n return;\n }\n\n onAction();\n } else if (e.pointerType !== 'keyboard') {\n onSelect(e);\n }\n };\n } else {\n itemPressProps.onPressUp = (e) => {\n if (e.pointerType !== 'keyboard') {\n onSelect(e);\n }\n };\n\n itemPressProps.onPress = hasPrimaryAction ? () => onAction() : null;\n }\n } else {\n itemPressProps.onPressStart = (e) => {\n modality.current = e.pointerType;\n longPressEnabledOnPressStart.current = longPressEnabled;\n hadPrimaryActionOnPressStart.current = hasPrimaryAction;\n\n // Select on mouse down unless there is a primary action which will occur on mouse up.\n // For keyboard, select on key down. If there is an action, the Space key selects on key down,\n // and the Enter key performs onAction on key up.\n if (\n (e.pointerType === 'mouse' && !hasPrimaryAction) ||\n (e.pointerType === 'keyboard' && (!onAction || isSelectionKey()))\n ) {\n onSelect(e);\n }\n };\n\n itemPressProps.onPress = (e) => {\n // Selection occurs on touch up. Primary actions always occur on pointer up.\n // Both primary and secondary actions occur on Enter key up. The only exception\n // is secondary actions, which occur on double click with a mouse.\n if (\n e.pointerType === 'touch' ||\n e.pointerType === 'pen' ||\n e.pointerType === 'virtual' ||\n (e.pointerType === 'keyboard' && hasAction && isActionKey()) ||\n (e.pointerType === 'mouse' && hadPrimaryActionOnPressStart.current)\n ) {\n if (hasAction) {\n onAction();\n } else {\n onSelect(e);\n }\n }\n };\n }\n\n if (!isVirtualized) {\n itemProps['data-key'] = key;\n }\n\n itemPressProps.preventFocusOnPress = shouldUseVirtualFocus;\n let {pressProps, isPressed} = usePress(itemPressProps);\n\n // Double clicking with a mouse with selectionBehavior = 'replace' performs an action.\n let onDoubleClick = hasSecondaryAction ? (e) => {\n if (modality.current === 'mouse') {\n e.stopPropagation();\n e.preventDefault();\n onAction();\n }\n } : undefined;\n\n // Long pressing an item with touch when selectionBehavior = 'replace' switches the selection behavior\n // to 'toggle'. This changes the single tap behavior from performing an action (i.e. navigating) to\n // selecting, and may toggle the appearance of a UI affordance like checkboxes on each item.\n let {longPressProps} = useLongPress({\n isDisabled: !longPressEnabled,\n onLongPress(e) {\n if (e.pointerType === 'touch') {\n onSelect(e);\n manager.setSelectionBehavior('toggle');\n }\n }\n });\n\n // Prevent native drag and drop on long press if we also select on long press.\n // Once the user is in selection mode, they can long press again to drag.\n // Use a capturing listener to ensure this runs before useDrag, regardless of\n // the order the props get merged.\n let onDragStartCapture = e => {\n if (modality.current === 'touch' && longPressEnabledOnPressStart.current) {\n e.preventDefault();\n }\n };\n\n return {\n itemProps: mergeProps(\n itemProps,\n allowsSelection || hasPrimaryAction ? pressProps : {},\n longPressEnabled ? longPressProps : {},\n {onDoubleClick, onDragStartCapture}\n ),\n isPressed,\n isSelected: manager.isSelected(key),\n isDisabled,\n allowsSelection,\n hasAction\n };\n}\n\nfunction isActionKey() {\n let event = window.event as KeyboardEvent;\n return event?.key === 'Enter';\n}\n\nfunction isSelectionKey() {\n let event = window.event as KeyboardEvent;\n return event?.key === ' ' || event?.code === 'Space';\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection, DOMAttributes, FocusStrategy, KeyboardDelegate, Node} from '@react-types/shared';\nimport {Key, RefObject, useMemo} from 'react';\nimport {ListKeyboardDelegate} from './ListKeyboardDelegate';\nimport {MultipleSelectionManager} from '@react-stately/selection';\nimport {useCollator} from '@react-aria/i18n';\nimport {useSelectableCollection} from './useSelectableCollection';\n\nexport interface AriaSelectableListOptions {\n /**\n * An interface for reading and updating multiple selection state.\n */\n selectionManager: MultipleSelectionManager,\n /**\n * State of the collection.\n */\n collection: Collection<Node<unknown>>,\n /**\n * The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with.\n */\n disabledKeys: Set<Key>,\n /**\n * A ref to the item.\n */\n ref?: RefObject<HTMLElement>,\n /**\n * A delegate that returns collection item keys with respect to visual layout.\n */\n keyboardDelegate?: KeyboardDelegate,\n /**\n * Whether the collection or one of its items should be automatically focused upon render.\n * @default false\n */\n autoFocus?: boolean | FocusStrategy,\n /**\n * Whether focus should wrap around when the end/start is reached.\n * @default false\n */\n shouldFocusWrap?: boolean,\n /**\n * Whether the option is contained in a virtual scroller.\n */\n isVirtualized?: boolean,\n /**\n * Whether the collection allows empty selection.\n * @default false\n */\n disallowEmptySelection?: boolean,\n /**\n * Whether selection should occur automatically on focus.\n * @default false\n */\n selectOnFocus?: boolean,\n /**\n * Whether typeahead is disabled.\n * @default false\n */\n disallowTypeAhead?: boolean,\n /**\n * Whether the collection items should use virtual focus instead of being focused directly.\n */\n shouldUseVirtualFocus?: boolean,\n /**\n * Whether navigation through tab key is enabled.\n */\n allowsTabNavigation?: boolean\n}\n\nexport interface SelectableListAria {\n /**\n * Props for the option element.\n */\n listProps: DOMAttributes\n}\n\n/**\n * Handles interactions with a selectable list.\n */\nexport function useSelectableList(props: AriaSelectableListOptions): SelectableListAria {\n let {\n selectionManager,\n collection,\n disabledKeys,\n ref,\n keyboardDelegate,\n autoFocus,\n shouldFocusWrap,\n isVirtualized,\n disallowEmptySelection,\n selectOnFocus = selectionManager.selectionBehavior === 'replace',\n disallowTypeAhead,\n shouldUseVirtualFocus,\n allowsTabNavigation\n } = props;\n\n // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).\n // When virtualized, the layout object will be passed in as a prop and override this.\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let disabledBehavior = selectionManager.disabledBehavior;\n let delegate = useMemo(() => (\n keyboardDelegate || new ListKeyboardDelegate(collection, disabledBehavior === 'selection' ? new Set() : disabledKeys, ref, collator)\n ), [keyboardDelegate, collection, disabledKeys, ref, collator, disabledBehavior]);\n\n let {collectionProps} = useSelectableCollection({\n ref,\n selectionManager,\n keyboardDelegate: delegate,\n autoFocus,\n shouldFocusWrap,\n disallowEmptySelection,\n selectOnFocus,\n disallowTypeAhead,\n shouldUseVirtualFocus,\n allowsTabNavigation,\n isVirtualized,\n scrollRef: ref\n });\n\n return {\n listProps: collectionProps\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection, KeyboardDelegate, Node} from '@react-types/shared';\nimport {Key, RefObject} from 'react';\n\nexport class ListKeyboardDelegate<T> implements KeyboardDelegate {\n private collection: Collection<Node<T>>;\n private disabledKeys: Set<Key>;\n private ref: RefObject<HTMLElement>;\n private collator: Intl.Collator;\n\n constructor(collection: Collection<Node<T>>, disabledKeys: Set<Key>, ref: RefObject<HTMLElement>, collator?: Intl.Collator) {\n this.collection = collection;\n this.disabledKeys = disabledKeys;\n this.ref = ref;\n this.collator = collator;\n }\n\n getKeyBelow(key: Key) {\n key = this.collection.getKeyAfter(key);\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.disabledKeys.has(key)) {\n return key;\n }\n\n key = this.collection.getKeyAfter(key);\n }\n }\n\n getKeyAbove(key: Key) {\n key = this.collection.getKeyBefore(key);\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.disabledKeys.has(key)) {\n return key;\n }\n\n key = this.collection.getKeyBefore(key);\n }\n }\n\n getFirstKey() {\n let key = this.collection.getFirstKey();\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.disabledKeys.has(key)) {\n return key;\n }\n\n key = this.collection.getKeyAfter(key);\n }\n }\n\n getLastKey() {\n let key = this.collection.getLastKey();\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.disabledKeys.has(key)) {\n return key;\n }\n\n key = this.collection.getKeyBefore(key);\n }\n }\n\n private getItem(key: Key): HTMLElement {\n return this.ref.current.querySelector(`[data-key=\"${key}\"]`);\n }\n\n getKeyPageAbove(key: Key) {\n let menu = this.ref.current;\n let item = this.getItem(key);\n if (!item) {\n return null;\n }\n\n let pageY = Math.max(0, item.offsetTop + item.offsetHeight - menu.offsetHeight);\n\n while (item && item.offsetTop > pageY) {\n key = this.getKeyAbove(key);\n item = this.getItem(key);\n }\n\n return key;\n }\n\n getKeyPageBelow(key: Key) {\n let menu = this.ref.current;\n let item = this.getItem(key);\n if (!item) {\n return null;\n }\n\n let pageY = Math.min(menu.scrollHeight, item.offsetTop - item.offsetHeight + menu.offsetHeight);\n\n while (item && item.offsetTop < pageY) {\n key = this.getKeyBelow(key);\n item = this.getItem(key);\n }\n\n return key;\n }\n\n getKeyForSearch(search: string, fromKey?: Key) {\n if (!this.collator) {\n return null;\n }\n\n let collection = this.collection;\n let key = fromKey || this.getFirstKey();\n while (key != null) {\n let item = collection.getItem(key);\n let substring = item.textValue.slice(0, search.length);\n if (item.textValue && this.collator.compare(substring, search) === 0) {\n return key;\n }\n\n key = this.getKeyBelow(key);\n }\n\n return null;\n }\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport type {PartialNode} from './types';\nexport {Item} from './Item';\nexport {Section} from './Section';\nexport {useCollection} from './useCollection';\nexport {getItemCount} from './getItemCount';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ItemElement, ItemProps} from '@react-types/shared';\nimport {PartialNode} from './types';\nimport React, {ReactElement} from 'react';\n\nfunction Item<T>(props: ItemProps<T>): ReactElement { // eslint-disable-line @typescript-eslint/no-unused-vars\n return null;\n}\n\nItem.getCollectionNode = function* getCollectionNode<T>(props: ItemProps<T>, context: any): Generator<PartialNode<T>> {\n let {childItems, title, children} = props;\n\n let rendered = props.title || props.children;\n let textValue = props.textValue || (typeof rendered === 'string' ? rendered : '') || props['aria-label'] || '';\n\n // suppressTextValueWarning is used in components like Tabs, which don't have type to select support.\n if (!textValue && !context?.suppressTextValueWarning) {\n console.warn('<Item> with non-plain text contents is unsupported by type to select for accessibility. Please add a `textValue` prop.');\n }\n\n yield {\n type: 'item',\n props: props,\n rendered,\n textValue,\n 'aria-label': props['aria-label'],\n hasChildNodes: hasChildItems(props),\n *childNodes() {\n if (childItems) {\n for (let child of childItems) {\n yield {\n type: 'item',\n value: child\n };\n }\n } else if (title) {\n let items: PartialNode<T>[] = [];\n React.Children.forEach(children, child => {\n items.push({\n type: 'item',\n element: child as ItemElement<T>\n });\n });\n\n yield* items;\n }\n }\n };\n};\n\nfunction hasChildItems<T>(props: ItemProps<T>) {\n if (props.hasChildItems != null) {\n return props.hasChildItems;\n }\n\n if (props.childItems) {\n return true;\n }\n\n if (props.title && React.Children.count(props.children) > 0) {\n return true;\n }\n\n return false;\n}\n\n// We don't want getCollectionNode to show up in the type definition\nlet _Item = Item as <T>(props: ItemProps<T>) => JSX.Element;\nexport {_Item as Item};\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {PartialNode} from './types';\nimport React, {ReactElement} from 'react';\nimport {SectionProps} from '@react-types/shared';\n\nfunction Section<T>(props: SectionProps<T>): ReactElement { // eslint-disable-line @typescript-eslint/no-unused-vars\n return null;\n}\n\nSection.getCollectionNode = function* getCollectionNode<T>(props: SectionProps<T>): Generator<PartialNode<T>> {\n let {children, title, items} = props;\n yield {\n type: 'section',\n props: props,\n hasChildNodes: true,\n rendered: title,\n 'aria-label': props['aria-label'],\n *childNodes() {\n if (typeof children === 'function') {\n if (!items) {\n throw new Error('props.children was a function but props.items is missing');\n }\n \n for (let item of items) {\n yield {\n type: 'item',\n value: item,\n renderer: children\n };\n }\n } else {\n let items: PartialNode<T>[] = [];\n React.Children.forEach(children, child => {\n items.push({\n type: 'item',\n element: child\n });\n });\n\n yield* items;\n }\n }\n };\n};\n\n// We don't want getCollectionNode to show up in the type definition\nlet _Section = Section as <T>(props: SectionProps<T>) => JSX.Element;\nexport {_Section as Section};\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection, CollectionBase, Node} from '@react-types/shared';\nimport {CollectionBuilder} from './CollectionBuilder';\nimport {useMemo, useRef} from 'react';\n\ntype CollectionFactory<T, C extends Collection<Node<T>>> = (node: Iterable<Node<T>>, prev: C | null) => C;\n\nexport function useCollection<T extends object, C extends Collection<Node<T>> = Collection<Node<T>>>(props: CollectionBase<T>, factory: CollectionFactory<T, C>, context?: unknown, invalidators: Array<any> = []): C {\n let builder = useMemo(() => new CollectionBuilder<T>(), []);\n\n let prev = useRef<C>(null);\n return useMemo(() => {\n let nodes = builder.build(props, context);\n prev.current = factory(nodes, prev.current);\n return prev.current;\n // Don't invalidate when any prop changes, just the two we care about.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [builder, props.children, props.items, context, ...invalidators]);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CollectionBase, CollectionElement, Node} from '@react-types/shared';\nimport {PartialNode} from './types';\nimport React, {Key, ReactElement} from 'react';\n\ninterface CollectionBuilderState {\n renderer?: (value: any) => ReactElement\n}\n\nexport class CollectionBuilder<T extends object> {\n private context?: unknown;\n private cache: WeakMap<T, Node<T>> = new WeakMap();\n\n build(props: CollectionBase<T>, context?: unknown) {\n this.context = context;\n return iterable(() => this.iterateCollection(props));\n }\n\n private *iterateCollection(props: CollectionBase<T>) {\n let {children, items} = props;\n\n if (typeof children === 'function') {\n if (!items) {\n throw new Error('props.children was a function but props.items is missing');\n }\n\n for (let item of props.items) {\n yield* this.getFullNode({\n value: item\n }, {renderer: children});\n }\n } else {\n let items: CollectionElement<T>[] = [];\n React.Children.forEach(children, child => {\n items.push(child);\n });\n\n let index = 0;\n for (let item of items) {\n let nodes = this.getFullNode({\n element: item,\n index: index\n }, {});\n\n for (let node of nodes) {\n index++;\n yield node;\n }\n }\n }\n }\n\n private getKey(item: CollectionElement<T>, partialNode: PartialNode<T>, state: CollectionBuilderState, parentKey?: Key): Key {\n if (item.key != null) {\n return item.key;\n }\n\n if (partialNode.type === 'cell' && partialNode.key != null) {\n return `${parentKey}${partialNode.key}`;\n }\n\n let v = partialNode.value as any;\n if (v != null) {\n let key = v.key ?? v.id;\n if (key == null) {\n throw new Error('No key found for item');\n }\n\n return key;\n }\n\n return parentKey ? `${parentKey}.${partialNode.index}` : `$.${partialNode.index}`;\n }\n\n private getChildState(state: CollectionBuilderState, partialNode: PartialNode<T>) {\n return {\n renderer: partialNode.renderer || state.renderer\n };\n }\n\n private *getFullNode(partialNode: PartialNode<T>, state: CollectionBuilderState, parentKey?: Key, parentNode?: Node<T>): Generator<Node<T>> {\n // If there's a value instead of an element on the node, and a parent renderer function is available,\n // use it to render an element for the value.\n let element = partialNode.element;\n if (!element && partialNode.value && state && state.renderer) {\n let cached = this.cache.get(partialNode.value);\n if (cached && (!cached.shouldInvalidate || !cached.shouldInvalidate(this.context))) {\n cached.index = partialNode.index;\n cached.parentKey = parentNode ? parentNode.key : null;\n yield cached;\n return;\n }\n\n element = state.renderer(partialNode.value);\n }\n\n // If there's an element with a getCollectionNode function on its type, then it's a supported component.\n // Call this function to get a partial node, and recursively build a full node from there.\n if (React.isValidElement(element)) {\n let type = element.type as any;\n if (typeof type !== 'function' && typeof type.getCollectionNode !== 'function') {\n let name = typeof element.type === 'function' ? element.type.name : element.type;\n throw new Error(`Unknown element <${name}> in collection.`);\n }\n\n let childNodes = type.getCollectionNode(element.props, this.context) as Generator<PartialNode<T>, void, Node<T>[]>;\n let index = partialNode.index;\n let result = childNodes.next();\n while (!result.done && result.value) {\n let childNode = result.value;\n\n partialNode.index = index;\n\n let nodeKey = childNode.key;\n if (!nodeKey) {\n nodeKey = childNode.element ? null : this.getKey(element as CollectionElement<T>, partialNode, state, parentKey);\n }\n\n let nodes = this.getFullNode({\n ...childNode,\n key: nodeKey,\n index,\n wrapper: compose(partialNode.wrapper, childNode.wrapper)\n }, this.getChildState(state, childNode), parentKey ? `${parentKey}${element.key}` : element.key, parentNode);\n\n let children = [...nodes];\n for (let node of children) {\n // Cache the node based on its value\n node.value = childNode.value || partialNode.value;\n if (node.value) {\n this.cache.set(node.value, node);\n }\n\n // The partial node may have specified a type for the child in order to specify a constraint.\n // Verify that the full node that was built recursively matches this type.\n if (partialNode.type && node.type !== partialNode.type) {\n throw new Error(`Unsupported type <${capitalize(node.type)}> in <${capitalize(parentNode.type)}>. Only <${capitalize(partialNode.type)}> is supported.`);\n }\n\n index++;\n yield node;\n }\n\n result = childNodes.next(children);\n }\n\n return;\n }\n\n // Ignore invalid elements\n if (partialNode.key == null) {\n return;\n }\n\n // Create full node\n let builder = this;\n let node: Node<T> = {\n type: partialNode.type,\n props: partialNode.props,\n key: partialNode.key,\n parentKey: parentNode ? parentNode.key : null,\n value: partialNode.value,\n level: parentNode ? parentNode.level + 1 : 0,\n index: partialNode.index,\n rendered: partialNode.rendered,\n textValue: partialNode.textValue,\n 'aria-label': partialNode['aria-label'],\n wrapper: partialNode.wrapper,\n shouldInvalidate: partialNode.shouldInvalidate,\n hasChildNodes: partialNode.hasChildNodes,\n childNodes: iterable(function *() {\n if (!partialNode.hasChildNodes) {\n return;\n }\n\n let index = 0;\n for (let child of partialNode.childNodes()) {\n // Ensure child keys are globally unique by prepending the parent node's key\n if (child.key != null) {\n // TODO: Remove this line entirely and enforce that users always provide unique keys.\n // Currently this line will have issues when a parent has a key `a` and a child with key `bc`\n // but another parent has key `ab` and its child has a key `c`. The combined keys would result in both\n // children having a key of `abc`.\n child.key = `${node.key}${child.key}`;\n }\n\n child.index = index;\n let nodes = builder.getFullNode(child, builder.getChildState(state, child), node.key, node);\n for (let node of nodes) {\n index++;\n yield node;\n }\n }\n })\n };\n\n yield node;\n }\n}\n\n// Wraps an iterator function as an iterable object, and caches the results.\nfunction iterable<T>(iterator: () => IterableIterator<Node<T>>): Iterable<Node<T>> {\n let cache = [];\n let iterable = null;\n return {\n *[Symbol.iterator]() {\n for (let item of cache) {\n yield item;\n }\n\n if (!iterable) {\n iterable = iterator();\n }\n\n for (let item of iterable) {\n cache.push(item);\n yield item;\n }\n }\n };\n}\n\ntype Wrapper = (element: ReactElement) => ReactElement;\nfunction compose(outer: Wrapper | void, inner: Wrapper | void): Wrapper {\n if (outer && inner) {\n return (element) => outer(inner(element));\n }\n\n if (outer) {\n return outer;\n }\n\n if (inner) {\n return inner;\n }\n}\n\nfunction capitalize(str: string) {\n return str[0].toUpperCase() + str.slice(1);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Node} from '@react-types/shared';\n\nconst cache = new WeakMap<Iterable<unknown>, number>();\n\nexport function getItemCount<T>(collection: Iterable<Node<T>>): number {\n let count = cache.get(collection);\n if (count != null) {\n return count;\n }\n\n count = 0;\n for (let item of collection) {\n if (item.type === 'section') {\n count += getItemCount(item.childNodes);\n } else {\n count++;\n }\n }\n\n cache.set(collection, count);\n return count;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n * \n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {useListBox} from './useListBox';\nexport {useOption} from './useOption';\nexport {useListBoxSection} from './useListBoxSection';\nexport {listData, getItemId} from './utils';\n\nexport type {AriaListBoxOptions, ListBoxAria} from './useListBox';\nexport type {AriaOptionProps, OptionAria} from './useOption';\nexport type {AriaListBoxSectionProps, ListBoxSectionAria} from './useListBoxSection';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaListBoxProps} from '@react-types/listbox';\nimport {DOMAttributes, KeyboardDelegate} from '@react-types/shared';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {Key, ReactNode, RefObject} from 'react';\nimport {listData} from './utils';\nimport {ListState} from '@react-stately/list';\nimport {useFocusWithin} from '@react-aria/interactions';\nimport {useId} from '@react-aria/utils';\nimport {useLabel} from '@react-aria/label';\nimport {useSelectableList} from '@react-aria/selection';\n\nexport interface ListBoxAria {\n /** Props for the listbox element. */\n listBoxProps: DOMAttributes,\n /** Props for the listbox's visual label element (if any). */\n labelProps: DOMAttributes\n}\n\nexport interface AriaListBoxOptions<T> extends Omit<AriaListBoxProps<T>, 'children'> {\n /** Whether the listbox uses virtual scrolling. */\n isVirtualized?: boolean,\n\n /**\n * An optional keyboard delegate implementation for type to select,\n * to override the default.\n */\n keyboardDelegate?: KeyboardDelegate,\n\n /**\n * Whether the listbox items should use virtual focus instead of being focused directly.\n */\n shouldUseVirtualFocus?: boolean,\n\n /** Whether selection should occur on press up instead of press down. */\n shouldSelectOnPressUp?: boolean,\n\n /** Whether options should be focused when the user hovers over them. */\n shouldFocusOnHover?: boolean,\n\n /**\n * An optional visual label for the listbox.\n */\n label?: ReactNode,\n /**\n * Handler that is called when a user performs an action on an item. The exact user event depends on\n * the collection's `selectionBehavior` prop and the interaction modality.\n */\n onAction?: (key: Key) => void\n}\n\n/**\n * Provides the behavior and accessibility implementation for a listbox component.\n * A listbox displays a list of options and allows a user to select one or more of them.\n * @param props - Props for the listbox.\n * @param state - State for the listbox, as returned by `useListState`.\n */\nexport function useListBox<T>(props: AriaListBoxOptions<T>, state: ListState<T>, ref: RefObject<HTMLElement>): ListBoxAria {\n let domProps = filterDOMProps(props, {labelable: true});\n let {listProps} = useSelectableList({\n ...props,\n ref,\n selectionManager: state.selectionManager,\n collection: state.collection,\n disabledKeys: state.disabledKeys\n });\n\n let {focusWithinProps} = useFocusWithin({\n onFocusWithin: props.onFocus,\n onBlurWithin: props.onBlur,\n onFocusWithinChange: props.onFocusChange\n });\n\n // Share list id and some props with child options.\n let id = useId(props.id);\n listData.set(state, {\n id,\n shouldUseVirtualFocus: props.shouldUseVirtualFocus,\n shouldSelectOnPressUp: props.shouldSelectOnPressUp,\n shouldFocusOnHover: props.shouldFocusOnHover,\n isVirtualized: props.isVirtualized,\n onAction: props.onAction\n });\n\n let {labelProps, fieldProps} = useLabel({\n ...props,\n id,\n // listbox is not an HTML input element so it\n // shouldn't be labeled by a <label> element.\n labelElementType: 'span'\n });\n\n return {\n labelProps,\n listBoxProps: mergeProps(domProps, focusWithinProps, state.selectionManager.selectionMode === 'multiple' ? {\n 'aria-multiselectable': 'true'\n } : {}, {\n role: 'listbox',\n ...mergeProps(fieldProps, listProps)\n })\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Key} from 'react';\nimport {ListState} from '@react-stately/list';\n\ninterface ListData {\n id: string,\n shouldSelectOnPressUp?: boolean,\n shouldFocusOnHover?: boolean,\n shouldUseVirtualFocus?: boolean,\n isVirtualized?: boolean,\n onAction?: (key: Key) => void\n}\n\nexport const listData = new WeakMap<ListState<unknown>, ListData>();\n\nfunction normalizeKey(key: Key): string {\n if (typeof key === 'string') {\n return key.replace(/\\s*/g, '');\n }\n\n return '' + key;\n}\n\nexport function getItemId<T>(state: ListState<T>, itemKey: Key): string {\n let data = listData.get(state);\n\n if (!data) {\n throw new Error('Unknown list');\n }\n\n return `${data.id}-option-${normalizeKey(itemKey)}`;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMAttributes, FocusableElement} from '@react-types/shared';\nimport {getItemCount} from '@react-stately/collections';\nimport {getItemId, listData} from './utils';\nimport {isFocusVisible, useHover} from '@react-aria/interactions';\nimport {isMac, isWebKit, mergeProps, useSlotId} from '@react-aria/utils';\nimport {Key, RefObject} from 'react';\nimport {ListState} from '@react-stately/list';\nimport {SelectableItemStates, useSelectableItem} from '@react-aria/selection';\n\nexport interface OptionAria extends SelectableItemStates {\n /** Props for the option element. */\n optionProps: DOMAttributes,\n\n /** Props for the main text element inside the option. */\n labelProps: DOMAttributes,\n\n /** Props for the description text element inside the option, if any. */\n descriptionProps: DOMAttributes,\n\n /** Whether the option is currently focused. */\n isFocused: boolean\n}\n\nexport interface AriaOptionProps {\n /**\n * Whether the option is disabled.\n * @deprecated\n */\n isDisabled?: boolean,\n\n /**\n * Whether the option is selected.\n * @deprecated\n */\n isSelected?: boolean,\n\n /** A screen reader only label for the option. */\n 'aria-label'?: string,\n\n /** The unique key for the option. */\n key: Key,\n\n /**\n * Whether selection should occur on press up instead of press down.\n * @deprecated\n */\n shouldSelectOnPressUp?: boolean,\n\n /**\n * Whether the option should be focused when the user hovers over it.\n * @deprecated\n */\n shouldFocusOnHover?: boolean,\n\n /**\n * Whether the option is contained in a virtual scrolling listbox.\n * @deprecated\n */\n isVirtualized?: boolean,\n\n /**\n * Whether the option should use virtual focus instead of being focused directly.\n * @deprecated\n */\n shouldUseVirtualFocus?: boolean\n}\n\n/**\n * Provides the behavior and accessibility implementation for an option in a listbox.\n * See `useListBox` for more details about listboxes.\n * @param props - Props for the option.\n * @param state - State for the listbox, as returned by `useListState`.\n */\nexport function useOption<T>(props: AriaOptionProps, state: ListState<T>, ref: RefObject<FocusableElement>): OptionAria {\n let {\n key\n } = props;\n\n let data = listData.get(state);\n\n let isDisabled = props.isDisabled ?? state.disabledKeys.has(key);\n let isSelected = props.isSelected ?? state.selectionManager.isSelected(key);\n let isFocused = state.selectionManager.focusedKey === key;\n let shouldSelectOnPressUp = props.shouldSelectOnPressUp ?? data.shouldSelectOnPressUp;\n let shouldFocusOnHover = props.shouldFocusOnHover ?? data.shouldFocusOnHover;\n let shouldUseVirtualFocus = props.shouldUseVirtualFocus ?? data.shouldUseVirtualFocus;\n let isVirtualized = props.isVirtualized ?? data.isVirtualized;\n\n let labelId = useSlotId();\n let descriptionId = useSlotId();\n\n let optionProps = {\n role: 'option',\n 'aria-disabled': isDisabled,\n 'aria-selected': state.selectionManager.selectionMode !== 'none' ? isSelected : undefined\n };\n\n // Safari with VoiceOver on macOS misreads options with aria-labelledby or aria-label as simply \"text\".\n // We should not map slots to the label and description on Safari and instead just have VoiceOver read the textContent.\n // https://bugs.webkit.org/show_bug.cgi?id=209279\n if (!(isMac() && isWebKit())) {\n optionProps['aria-label'] = props['aria-label'];\n optionProps['aria-labelledby'] = labelId;\n optionProps['aria-describedby'] = descriptionId;\n }\n\n if (isVirtualized) {\n optionProps['aria-posinset'] = state.collection.getItem(key).index + 1;\n optionProps['aria-setsize'] = getItemCount(state.collection);\n }\n\n let {itemProps, isPressed, hasAction, allowsSelection} = useSelectableItem({\n selectionManager: state.selectionManager,\n key,\n ref,\n shouldSelectOnPressUp,\n allowsDifferentPressOrigin: shouldSelectOnPressUp && shouldFocusOnHover,\n isVirtualized,\n shouldUseVirtualFocus,\n isDisabled,\n onAction: data.onAction ? () => data.onAction(key) : undefined\n });\n\n let {hoverProps} = useHover({\n isDisabled: isDisabled || !shouldFocusOnHover,\n onHoverStart() {\n if (!isFocusVisible()) {\n state.selectionManager.setFocused(true);\n state.selectionManager.setFocusedKey(key);\n }\n }\n });\n\n return {\n optionProps: {\n ...optionProps,\n ...mergeProps(itemProps, hoverProps),\n id: getItemId(state, key)\n },\n labelProps: {\n id: labelId\n },\n descriptionProps: {\n id: descriptionId\n },\n isFocused,\n isSelected,\n isDisabled,\n isPressed,\n allowsSelection,\n hasAction\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMAttributes} from '@react-types/shared';\nimport {ReactNode} from 'react';\nimport {useId} from '@react-aria/utils';\n\nexport interface AriaListBoxSectionProps {\n /** The heading for the section. */\n heading?: ReactNode,\n /** An accessibility label for the section. Required if `heading` is not present. */\n 'aria-label'?: string\n}\n\nexport interface ListBoxSectionAria {\n /** Props for the wrapper list item. */\n itemProps: DOMAttributes,\n\n /** Props for the heading element, if any. */\n headingProps: DOMAttributes,\n\n /** Props for the group element. */\n groupProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a section in a listbox.\n * See `useListBox` for more details about listboxes.\n * @param props - Props for the section.\n */\nexport function useListBoxSection(props: AriaListBoxSectionProps): ListBoxSectionAria {\n let {heading, 'aria-label': ariaLabel} = props;\n let headingId = useId();\n\n return {\n itemProps: {\n role: 'presentation'\n },\n headingProps: heading ? {\n // Techincally, listbox cannot contain headings according to ARIA.\n // We hide the heading from assistive technology, and only use it\n // as a label for the nested group.\n id: headingId,\n 'aria-hidden': true\n } : {},\n groupProps: {\n role: 'group',\n 'aria-label': ariaLabel,\n 'aria-labelledby': heading ? headingId : undefined\n }\n };\n}\n","import { FocusScope } from '@react-aria/focus'\nimport { DismissButton, useOverlay } from '@react-aria/overlays'\nimport React, {\n FC,\n useRef,\n useMemo,\n PropsWithChildren,\n memo,\n CSSProperties,\n} from 'react'\nimport { mergeProps } from '@react-aria/utils'\n\ntype Props = PropsWithChildren<{\n open?: boolean\n onClose?: () => void\n style?: CSSProperties\n className?: string\n}>\n\nconst Popover: FC<Props> = ({ open, onClose, children, ...props }) => {\n const ref = useRef<HTMLDivElement>(null)\n\n const { overlayProps } = useOverlay(\n useMemo(\n () => ({\n isOpen: open,\n onClose,\n shouldCloseOnBlur: true,\n isDismissable: true,\n }),\n [onClose, open]\n ),\n ref\n )\n\n return (\n <FocusScope restoreFocus>\n <div {...mergeProps(overlayProps, props)} ref={ref}>\n {children}\n <DismissButton onDismiss={onClose} />\n </div>\n </FocusScope>\n )\n}\n\nexport default memo(Popover)\n","import React, { forwardRef, memo, useMemo, useRef } from 'react'\nimport { useRadioGroupState } from 'react-stately'\nimport {\n AriaRadioGroupProps,\n AriaRadioProps,\n useRadio,\n useRadioGroup,\n} from '@react-aria/radio'\nimport styled from 'styled-components'\nimport { disabledSelector } from '@charcoal-ui/utils'\n\nimport { RadioProvider, useRadioContext } from './RadioGroupContext'\nimport { theme } from '../../styled'\n\ntype SegmentedControlItem = {\n label: React.ReactNode\n value: string\n disabled?: boolean\n}\n\nexport type SegmentedControlProps = {\n readonly id?: string\n readonly name?: string\n readonly disabled?: boolean\n readonly readonly?: boolean\n readonly required?: boolean\n\n readonly value?: string\n readonly defaultValue?: string\n\n readonly data: string[] | SegmentedControlItem[]\n\n readonly onChange?: (value: string) => void\n}\n\nconst SegmentedControl = forwardRef<HTMLDivElement, SegmentedControlProps>(\n function SegmentedControlInner(props, ref) {\n const ariaRadioGroupProps = useMemo<AriaRadioGroupProps>(\n () => ({\n ...props,\n isDisabled: props.disabled,\n isReadOnly: props.readonly,\n isRequired: props.required,\n }),\n [props]\n )\n const state = useRadioGroupState(ariaRadioGroupProps)\n const { radioGroupProps } = useRadioGroup(ariaRadioGroupProps, state)\n const segmentedControlItems = useMemo<SegmentedControlItem[]>(() => {\n return props.data.map((d) =>\n typeof d === 'string' ? { value: d, label: d } : d\n )\n }, [props.data])\n\n return (\n <SegmentedControlRoot ref={ref} {...radioGroupProps}>\n <RadioProvider value={state}>\n {segmentedControlItems.map((item) => (\n <Segmented\n key={item.value}\n value={item.value}\n disabled={item.disabled}\n >\n {item.label}\n </Segmented>\n ))}\n </RadioProvider>\n </SegmentedControlRoot>\n )\n }\n)\n\nexport default memo(SegmentedControl)\n\ntype RadioProps = {\n value: string\n disabled?: boolean\n}\n\nconst Segmented: React.FC<RadioProps> = ({ children, ...props }) => {\n const state = useRadioContext()\n const ref = useRef<HTMLInputElement>(null)\n const ariaRadioProps = useMemo<AriaRadioProps>(\n () => ({ ...props, isDisabled: props.disabled }),\n [props]\n )\n\n const { inputProps, isDisabled, isSelected } = useRadio(\n ariaRadioProps,\n state,\n ref\n )\n\n return (\n <SegmentedRoot\n aria-disabled={isDisabled || state.isReadOnly}\n checked={isSelected}\n >\n <SegmentedInput {...inputProps} ref={ref} />\n <RadioLabel>\n <SegmentedLabelInner>{children}</SegmentedLabelInner>\n </RadioLabel>\n </SegmentedRoot>\n )\n}\n\nconst SegmentedControlRoot = styled.div`\n display: inline-flex;\n align-items: center;\n\n ${theme((o) => [o.bg.surface3, o.borderRadius(16)])}\n`\n\nconst SegmentedRoot = styled.label<{ checked?: boolean }>`\n position: relative;\n display: flex;\n align-items: center;\n cursor: pointer;\n height: 32px;\n\n ${disabledSelector} {\n cursor: default;\n }\n\n ${({ checked }) =>\n theme((o) => [\n o.padding.horizontal(16),\n o.borderRadius(16),\n o.disabled,\n checked === true && o.bg.brand,\n checked === true ? o.font.text5 : o.font.text2,\n ])}\n`\nconst SegmentedInput = styled.input`\n position: absolute;\n\n height: 0px;\n width: 0px;\n padding: 0;\n margin: 0;\n\n appearance: none;\n box-sizing: border-box;\n overflow: hidden;\n white-space: nowrap;\n opacity: 0;\n`\n\nconst RadioLabel = styled.div`\n background: transparent;\n display: flex;\n align-items: center;\n height: 22px;\n`\nconst SegmentedLabelInner = styled.div`\n ${theme((o) => [o.typography(14)])}\n`\n","import React, { createContext, useContext } from 'react'\nimport { RadioGroupState } from 'react-stately'\n\nconst RadioContext = createContext<RadioGroupState | null>(null)\n\ntype RadioProviderProps = React.PropsWithChildren<{\n value: RadioGroupState\n}>\nexport const RadioProvider: React.FC<RadioProviderProps> = ({\n value,\n children,\n}) => {\n return <RadioContext.Provider value={value}>{children}</RadioContext.Provider>\n}\nexport const useRadioContext = () => {\n const state = useContext(RadioContext)\n\n if (state === null)\n throw new Error('`<RadioProvider>` is not likely mounted.')\n\n return state\n}\n","import React, { forwardRef, memo, useMemo } from 'react'\nimport styled, { css } from 'styled-components'\nimport { useCheckbox } from '@react-aria/checkbox'\nimport { useObjectRef } from '@react-aria/utils'\nimport { useToggleState } from 'react-stately'\nimport { disabledSelector, px } from '@charcoal-ui/utils'\nimport { theme } from '../../styled'\n\nimport type { AriaCheckboxProps } from '@react-types/checkbox'\nimport Icon from '../Icon'\n\ntype CheckboxLabelProps =\n | {\n children: React.ReactNode\n }\n | {\n label: string\n }\n\nexport type CheckboxProps = CheckboxLabelProps & {\n readonly id?: string\n readonly name?: string\n\n readonly checked?: boolean\n readonly defaultChecked?: boolean\n readonly disabled?: boolean\n readonly readonly?: boolean\n\n readonly onClick?: () => void\n readonly onChange?: (isSelected: boolean) => void\n readonly onBlur?: () => void\n readonly onFocus?: () => void\n}\n\nconst Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(\n function CheckboxInner(props, ref) {\n const ariaCheckboxProps = useMemo<AriaCheckboxProps>(\n () => ({\n ...props,\n isSelected: props.checked,\n defaultSelected: props.defaultChecked,\n // children がいない場合は aria-label をつけないといけない\n 'aria-label': 'children' in props ? undefined : props.label,\n isDisabled: props.disabled,\n }),\n [props]\n )\n const state = useToggleState(ariaCheckboxProps)\n const objectRef = useObjectRef(ref)\n\n const { inputProps } = useCheckbox(ariaCheckboxProps, state, objectRef)\n const isDisabled = (props.disabled ?? false) || (props.readonly ?? false)\n\n return (\n <InputRoot aria-disabled={isDisabled}>\n <CheckboxInput type=\"checkbox\" {...inputProps} />\n <CheckboxInputOverlay aria-hidden={true} checked={inputProps.checked}>\n <Icon name=\"24/Check\" unsafeNonGuidelineScale={2 / 3} />\n </CheckboxInputOverlay>\n\n {'children' in props && <InputLabel>{props.children}</InputLabel>}\n </InputRoot>\n )\n }\n)\n\nexport default memo(Checkbox)\n\nconst hiddenCss = css`\n visibility: hidden;\n`\n\nconst InputRoot = styled.label`\n position: relative;\n display: flex;\n align-items: center;\n cursor: pointer;\n ${disabledSelector} {\n cursor: default;\n }\n\n gap: ${({ theme }) => px(theme.spacing[4])};\n ${theme((o) => [o.disabled])}\n`\n\nconst CheckboxInput = styled.input`\n &[type='checkbox'] {\n appearance: none;\n display: block;\n cursor: pointer;\n margin: 0;\n width: 20px;\n height: 20px;\n\n &:checked {\n ${theme((o) => o.bg.brand.hover.press)}\n }\n &:not(:checked) {\n border-width: 2px;\n border-style: solid;\n border-color: ${({ theme }) => theme.color.text4};\n }\n ${theme((o) => [o.outline.default.focus, o.borderRadius(4)])}\n }\n`\nconst CheckboxInputOverlay = styled.div<{ checked?: boolean }>`\n position: absolute;\n top: -2px;\n left: -2px;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n\n ${theme((o) => [o.width.px(24), o.height.px(24), o.font.text5])}\n\n ${({ checked }) => checked !== true && hiddenCss};\n`\n\nconst InputLabel = styled.div`\n ${theme((o) => [o.typography(14), o.font.text2])}\n`\n","import React, {\n forwardRef,\n memo,\n useMemo,\n ComponentPropsWithoutRef,\n} from 'react'\nimport { useObjectRef } from '@react-aria/utils'\nimport styled, { css } from 'styled-components'\nimport { theme } from '../../styled'\nimport { disabledSelector, px } from '@charcoal-ui/utils'\nimport { AriaButtonProps, useButton } from '@react-aria/button'\nimport Icon from '../Icon'\n\nconst sizeMap = {\n S: 32,\n M: 40,\n}\n\nexport type TagItemProps = {\n label: string\n translatedLabel?: string\n bgColor?: string\n bgImage?: string\n status?: 'default' | 'active' | 'inactive'\n size?: keyof typeof sizeMap\n disabled?: boolean\n} & Pick<ComponentPropsWithoutRef<'a'>, 'href' | 'target' | 'rel' | 'onClick'>\n\nconst TagItem = forwardRef<HTMLAnchorElement, TagItemProps>(\n function TagItemInner(\n {\n label,\n translatedLabel,\n bgColor = '#7ACCB1',\n bgImage,\n size = 'M',\n disabled,\n status = 'default',\n ...props\n },\n _ref\n ) {\n const ref = useObjectRef(_ref)\n const ariaButtonProps = useMemo<AriaButtonProps<'a'>>(\n () => ({\n elementType: 'a',\n isDisabled: disabled,\n ...props,\n }),\n [disabled, props]\n )\n\n const { buttonProps } = useButton(ariaButtonProps, ref)\n const hasTranslatedLabel =\n translatedLabel !== undefined && translatedLabel.length > 0\n\n return (\n <TagItemRoot\n ref={ref}\n size={hasTranslatedLabel ? 'M' : size}\n status={status}\n {...buttonProps}\n >\n <Background bgColor={bgColor} bgImage={bgImage} />\n\n <Inner>\n <LabelWrapper isTranslate={hasTranslatedLabel}>\n {hasTranslatedLabel && (\n <TranslatedLabel>\n <Label>{translatedLabel}</Label>\n </TranslatedLabel>\n )}\n <Label>{label}</Label>\n </LabelWrapper>\n {status === 'active' && <Icon name=\"16/Remove\" />}\n </Inner>\n </TagItemRoot>\n )\n }\n)\n\nexport default memo(TagItem)\n\ntype TagItemRootProps = Pick<TagItemProps, 'status'> &\n Required<Pick<TagItemProps, 'size'>>\n\nconst TagItemRoot = styled.a<TagItemRootProps>`\n isolation: isolate;\n position: relative;\n height: ${({ size }) => sizeMap[size]}px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n text-decoration: none;\n cursor: pointer;\n overflow: hidden;\n\n ${({ size, status }) =>\n theme((o) => [\n o.outline.default.focus,\n o.borderRadius(4),\n status !== 'active' && size === 'M' && o.padding.horizontal(24),\n status !== 'active' && size === 'S' && o.padding.horizontal(16),\n status === 'inactive' && o.bg.surface3,\n status === 'inactive' ? o.font.text2 : o.font.text5,\n ...(status === 'active' ? [o.padding.left(16), o.padding.right(8)] : []),\n ])}\n\n ${disabledSelector} {\n ${theme((o) => [o.disabled])}\n cursor: default;\n }\n`\n\nconst Background = styled.div<Pick<TagItemProps, 'bgColor' | 'bgImage'>>`\n position: absolute;\n z-index: 1;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n\n background-color: ${({ bgColor }) => bgColor};\n\n ${({ bgImage }) =>\n bgImage !== undefined &&\n css`\n ${theme((o) => [o.bg.surface4])}\n &::before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-position: center;\n background-size: cover;\n background-image: url(${bgImage});\n mix-blend-mode: overlay;\n }\n `}\n`\n\nconst Inner = styled.div`\n display: inline-flex;\n gap: ${({ theme }) => px(theme.spacing[8])};\n align-items: center;\n z-index: 2;\n`\n\nconst labelCSS = css`\n ${theme((o) => [o.typography(14).bold])}\n`\nconst translateLabelCSS = css`\n display: flex;\n align-items: center;\n flex-direction: column;\n font-size: 10px;\n`\nconst LabelWrapper = styled.div<{ isTranslate?: boolean }>`\n ${({ isTranslate }) => (isTranslate ?? false ? translateLabelCSS : labelCSS)}\n`\n\nconst Label = styled.span`\n max-width: 152px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: inherit;\n color: inherit;\n line-height: inherit;\n`\n\nconst TranslatedLabel = styled.div`\n ${theme((o) => [o.typography(12).bold])}\n`\n"],"mappings":";AAAA,OAAO,SAAS,kBAAkB;AAS3B,IAAM,cAAc,MAAM;AAAA,EAC/B,SAASA,aAAY,EAAE,IAAI,aAAa,KAAK,GAAG,KAAK;AACnD,WACE,oCAAC,OAAE,MAAM,IAAI,KAAW,GAAG,QACxB,QACH;AAAA,EAEJ;AACF;AAMA,IAAM,eAA2B;AAAA,EAC/B,MAAM;AACR;AAEA,IAAM,8BAA8B,MAAM,cAAc,YAAY;AAOrD,SAAR,qBAAsC,EAAE,UAAU,WAAW,GAAU;AAC5E,SACE;AAAA,IAAC,4BAA4B;AAAA,IAA5B;AAAA,MACC,OAAO,EAAE,GAAG,cAAc,GAAG,WAAW;AAAA;AAAA,IAEvC;AAAA,EACH;AAEJ;AAEO,SAAS,0BAA0B;AACxC,SAAO,WAAW,2BAA2B;AAC/C;;;AC9CA,SAAS,mBAAmB;;;ACA5B,SAAS,uBAAuB;;;ACAhC,OAAOC,YAAW;AAClB,OAAOC,aAAY;;;AC2BZ,SAAS,YAAY,OAAsB;AAChD,QAAM,IAA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","styled","React","Clickable","styled","Button","React","styled","React","styled","React","styled","styledProps","variantToProps","sizeToProps","React","useContext","styled","useContext","React","styled","theme","React","useCallback","useContext","styled","css","warning","disabledSelector","px","useContext","warning","useCallback","React","styled","disabledSelector","theme","px","css","React","styled","disabledSelector","px","React","styled","theme","React","useCallback","useRef","styled","css","React","styled","createTheme","FieldLabel","Label","theme","createTheme","theme","styled","React","TextField","forwardRef","useRef","useCallback","count","rows","css","React","React","useContext","useRef","styled","css","useRef","theme","React","styled","css","useContext","React","styled","maxWidth","React","styled","theme","React","useRef","styled","React","styled","Icon","LoadingSpinnerIcon","useRef","React","useMemo","useRef","styled","disabledSelector","useVisuallyHidden","React","useRef","useMemo","styled","css","getCollectionNode","px","useRef","useMemo","React","styled","theme","px","css","FocusScope","useOverlay","React","useRef","useMemo","memo","useRef","useOverlay","useMemo","React","FocusScope","memo","useVisuallyHidden","useRef","useMemo","React","styled","disabledSelector","React","memo","useMemo","useRef","styled","disabledSelector","React","createContext","useContext","useMemo","React","memo","useRef","RadioLabel","styled","disabledSelector","React","forwardRef","memo","useMemo","styled","css","useToggleState","disabledSelector","px","forwardRef","useMemo","useToggleState","React","memo","css","styled","disabledSelector","theme","px","React","forwardRef","memo","useMemo","styled","css","disabledSelector","px","useButton","forwardRef","useMemo","useButton","React","Label","memo","styled","disabledSelector","css","theme","px"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/ComponentAbstraction.tsx","../src/core/SSRProvider.tsx","../src/core/OverlayProvider.tsx","../src/core/CharcoalProvider.tsx","../src/components/Button/index.tsx","../src/_lib/index.ts","../src/styled.ts","../src/components/Clickable/index.tsx","../src/components/IconButton/index.tsx","../src/components/Radio/index.tsx","../src/components/MultiSelect/index.tsx","../src/components/MultiSelect/context.ts","../src/components/Switch/index.tsx","../src/components/TextField/index.tsx","../src/components/FieldLabel/index.tsx","../src/components/Icon/index.tsx","../src/components/Modal/index.tsx","../../foundation/src/grid.ts","../src/components/Modal/ModalPlumbing.tsx","../src/components/LoadingSpinner/index.tsx","../src/components/DropdownSelector/index.tsx","../src/components/DropdownSelector/Listbox.tsx","../src/components/DropdownSelector/Popover.tsx","../src/components/SegmentedControl/index.tsx","../src/components/SegmentedControl/RadioGroupContext.tsx","../src/components/Checkbox/index.tsx","../src/components/TagItem/index.tsx"],"sourcesContent":["import React, { useContext } from 'react'\n\nexport type LinkProps = {\n /**\n * リンクのURL\n */\n to: string\n} & Omit<React.ComponentPropsWithoutRef<'a'>, 'href'>\n\nexport const DefaultLink = React.forwardRef<HTMLAnchorElement, LinkProps>(\n function DefaultLink({ to, children, ...rest }, ref) {\n return (\n <a href={to} ref={ref} {...rest}>\n {children}\n </a>\n )\n }\n)\n\nexport interface Components {\n Link: React.ComponentType<React.ComponentPropsWithRef<typeof DefaultLink>>\n}\n\nconst DefaultValue: Components = {\n Link: DefaultLink,\n}\n\nconst ComponentAbstractionContext = React.createContext(DefaultValue)\n\ninterface Props {\n children: React.ReactNode\n components: Partial<Components>\n}\n\nexport default function ComponentAbstraction({ children, components }: Props) {\n return (\n <ComponentAbstractionContext.Provider\n value={{ ...DefaultValue, ...components }}\n >\n {children}\n </ComponentAbstractionContext.Provider>\n )\n}\n\nexport function useComponentAbstraction() {\n return useContext(ComponentAbstractionContext)\n}\n","export { SSRProvider } from '@react-aria/ssr'\n","export { OverlayProvider } from '@react-aria/overlays'\n","import React from 'react'\nimport { ThemeProvider } from 'styled-components'\nimport ComponentAbstraction, { Components } from './ComponentAbstraction'\nimport { TokenInjector } from '@charcoal-ui/styled'\nimport { ThemeMap } from '@charcoal-ui/styled/src/TokenInjector'\nimport { CharcoalTheme } from '@charcoal-ui/theme'\n\nimport { OverlayProvider } from './OverlayProvider'\nimport { SSRProvider } from './SSRProvider'\n\nexport type CharcoalProviderProps = React.PropsWithChildren<{\n themeMap: ThemeMap<CharcoalTheme>\n defaultTheme?: CharcoalTheme\n injectTokens?: boolean\n components?: Partial<Components>\n}>\n\nexport function CharcoalProvider({\n themeMap,\n defaultTheme = themeMap[':root'],\n components = {},\n injectTokens = true,\n children,\n}: CharcoalProviderProps) {\n return (\n <SSRProvider>\n <ThemeProvider theme={defaultTheme}>\n {injectTokens && <TokenInjector theme={themeMap} />}\n <ComponentAbstraction components={components}>\n <OverlayProvider>{children}</OverlayProvider>\n </ComponentAbstraction>\n </ThemeProvider>\n </SSRProvider>\n )\n}\n","import React from 'react'\nimport styled from 'styled-components'\nimport { unreachable } from '../../_lib'\nimport { theme } from '../../styled'\nimport Clickable, { ClickableElement, ClickableProps } from '../Clickable'\n\ntype Variant = 'Primary' | 'Default' | 'Overlay' | 'Danger' | 'Navigation'\ntype Size = 'S' | 'M'\n\ninterface StyledProps {\n /**\n * ボタンのスタイル\n */\n variant: Variant\n /**\n * ボタンのサイズ\n */\n size: Size\n /**\n * 幅を最大まで広げて描画\n */\n fixed: boolean\n}\n\nexport type ButtonProps = Partial<StyledProps> & ClickableProps\n\nconst Button = React.forwardRef<ClickableElement, ButtonProps>(function Button(\n {\n children,\n variant = 'Default',\n size = 'M',\n fixed = false,\n disabled = false,\n ...rest\n },\n ref\n) {\n return (\n <StyledButton\n {...rest}\n disabled={disabled}\n variant={variant}\n size={size}\n fixed={fixed}\n ref={ref}\n >\n {children}\n </StyledButton>\n )\n})\nexport default Button\n\nconst StyledButton = styled(Clickable)\n .withConfig<StyledProps>({\n shouldForwardProp(prop) {\n // fixed は <button> 要素に渡ってはいけない\n return prop !== 'fixed'\n },\n })\n .attrs<StyledProps, ReturnType<typeof styledProps>>(styledProps)`\n width: ${(p) => (p.fixed ? 'stretch' : 'min-content')};\n display: inline-grid;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n user-select: none;\n white-space: nowrap;\n\n ${(p) =>\n theme((o) => [\n o.font[p.font].hover.press,\n o.bg[p.background].hover.press,\n o.typography(14).bold.preserveHalfLeading,\n o.padding.horizontal(p.padding),\n o.disabled,\n o.borderRadius('oval'),\n o.outline.default.focus,\n ])}\n\n /* よく考えたらheight=32って定義が存在しないな... */\n height: ${(p) => p.height}px;\n`\n\nfunction styledProps(props: StyledProps) {\n return {\n ...props,\n ...variantToProps(props.variant),\n ...sizeToProps(props.size),\n }\n}\n\nfunction variantToProps(variant: Variant) {\n switch (variant) {\n case 'Overlay':\n return { font: 'text5', background: 'surface4' } as const\n case 'Default':\n return { font: 'text2', background: 'surface3' } as const\n case 'Primary':\n return { font: 'text5', background: 'brand' } as const\n case 'Navigation':\n return { font: 'text5', background: 'surface6' } as const\n case 'Danger':\n return { font: 'text5', background: 'assertive' } as const\n default:\n return unreachable(variant)\n }\n}\n\nfunction sizeToProps(size: Size) {\n switch (size) {\n case 'S':\n return {\n height: 32,\n padding: 16,\n } as const\n case 'M':\n return {\n height: 40,\n padding: 24,\n } as const\n }\n}\n","/**\n * 今後ポートされる予定の汎用的な関数群\n */\n\n/**\n * Function used to assert a given code path is unreachable\n */\nexport function unreachable(): never\n/**\n * Function used to assert a given code path is unreachable.\n * Very useful for ensuring switches are exhaustive:\n *\n * ```ts\n * switch (a.type) {\n * case Types.A:\n * case Types.B:\n * break\n * default:\n * unreachable(a) // will cause a build error if there was\n * // a Types.C that was not checked\n * }\n * ```\n *\n * @param value Value to be asserted as unreachable\n */\n// NOTE: Uses separate overloads, _not_ `value?: never`, to not allow `undefined` to be passed\n// eslint-disable-next-line @typescript-eslint/unified-signatures\nexport function unreachable(value: never): never\nexport function unreachable(value?: never): never {\n throw new Error(\n arguments.length === 0\n ? 'unreachable'\n : `unreachable (${JSON.stringify(value)})`\n )\n}\n","import styled from 'styled-components'\nimport { createTheme } from '@charcoal-ui/styled'\nexport const theme = createTheme(styled)\n","import React from 'react'\nimport styled, { css } from 'styled-components'\nimport {\n LinkProps,\n useComponentAbstraction,\n} from '../../core/ComponentAbstraction'\nimport { disabledSelector } from '@charcoal-ui/utils'\n\ninterface BaseProps {\n /**\n * クリックの無効化\n */\n disabled?: boolean\n}\n\ninterface LinkBaseProps {\n /**\n * リンクのURL。指定するとbuttonタグではなくaタグとして描画される\n */\n to: string\n}\n\nexport type ClickableProps =\n | (BaseProps & Omit<React.ComponentPropsWithoutRef<'button'>, 'disabled'>)\n | (BaseProps & LinkBaseProps & Omit<LinkProps, 'to'>)\nexport type ClickableElement = HTMLButtonElement & HTMLAnchorElement\n\nconst Clickable = React.forwardRef<ClickableElement, ClickableProps>(\n function Clickable(props, ref) {\n const { Link } = useComponentAbstraction()\n if ('to' in props) {\n const { onClick, disabled = false, ...rest } = props\n return (\n <A<typeof Link>\n {...rest}\n as={disabled ? undefined : Link}\n onClick={disabled ? undefined : onClick}\n aria-disabled={disabled}\n ref={ref}\n />\n )\n } else {\n return <Button {...props} ref={ref} />\n }\n }\n)\nexport default Clickable\n\nconst clickableCss = css`\n /* Clickable style */\n cursor: pointer;\n\n ${disabledSelector} {\n cursor: default;\n }\n`\n\nconst Button = styled.button`\n /* Reset button appearance */\n appearance: none;\n background: transparent;\n padding: 0;\n border-style: none;\n outline: none;\n color: inherit;\n text-rendering: inherit;\n letter-spacing: inherit;\n word-spacing: inherit;\n\n &:focus {\n outline: none;\n }\n\n /* Change the font styles in all browsers. */\n font: inherit;\n\n /* Remove the margin in Firefox and Safari. */\n margin: 0;\n\n /* Show the overflow in Edge. */\n overflow: visible;\n\n /* Remove the inheritance of text transform in Firefox. */\n text-transform: none;\n\n /* Remove the inner border and padding in Firefox. */\n &::-moz-focus-inner {\n border-style: none;\n padding: 0;\n }\n\n ${clickableCss}\n`\n\nconst A = styled.span`\n /* Reset a-tag appearance */\n color: inherit;\n\n &:focus {\n outline: none;\n }\n\n .text {\n top: calc(1em + 2em);\n }\n\n ${clickableCss}\n`\n","import React from 'react'\nimport styled from 'styled-components'\nimport { theme } from '../../styled'\nimport Clickable, { ClickableElement, ClickableProps } from '../Clickable'\nimport type { KnownIconType } from '@charcoal-ui/icons'\n\ntype Variant = 'Default' | 'Overlay'\ntype Size = 'XS' | 'S' | 'M'\n\ninterface StyledProps {\n readonly variant?: Variant\n readonly size?: Size\n readonly icon: keyof KnownIconType\n}\n\nexport type IconButtonProps = StyledProps & ClickableProps\n\nconst IconButton = React.forwardRef<ClickableElement, IconButtonProps>(\n function IconButtonInner(\n { variant = 'Default', size = 'M', icon, ...rest }: IconButtonProps,\n ref\n ) {\n validateIconSize(size, icon)\n return (\n <StyledIconButton {...rest} ref={ref} variant={variant} size={size}>\n <pixiv-icon name={icon} />\n </StyledIconButton>\n )\n }\n)\n\nexport default IconButton\n\nconst StyledIconButton = styled(Clickable).attrs<\n Required<StyledProps>,\n ReturnType<typeof styledProps>\n>(styledProps)`\n user-select: none;\n\n width: ${(p) => p.width}px;\n height: ${(p) => p.height}px;\n display: flex;\n align-items: center;\n justify-content: center;\n\n ${({ font, background }) =>\n theme((o) => [\n o.font[font],\n o.bg[background].hover.press,\n o.disabled,\n o.borderRadius('oval'),\n o.outline.default.focus,\n ])}\n`\n\nfunction styledProps(props: Required<StyledProps>) {\n return {\n ...props,\n ...variantToProps(props.variant),\n ...sizeToProps(props.size),\n }\n}\n\nfunction variantToProps(variant: Variant) {\n switch (variant) {\n case 'Default':\n return { font: 'text3', background: 'transparent' } as const\n case 'Overlay':\n return { font: 'text5', background: 'surface4' } as const\n }\n}\n\nfunction sizeToProps(size: Size) {\n switch (size) {\n case 'XS':\n return {\n width: 20,\n height: 20,\n }\n case 'S':\n return {\n width: 32,\n height: 32,\n }\n case 'M':\n return {\n width: 40,\n height: 40,\n }\n }\n}\n\n/**\n * validates matches of size and icon\n */\nfunction validateIconSize(size: Size, icon: keyof KnownIconType) {\n let requiredIconSize: string\n switch (size) {\n case 'XS':\n requiredIconSize = '16'\n break\n case 'S':\n case 'M':\n requiredIconSize = '24'\n break\n }\n // アイコン名は サイズ/名前\n const result = /^\\d*/u.exec(icon)\n if (result == null) {\n throw new Error('Invalid icon name')\n }\n const [iconSize] = result\n if (iconSize !== requiredIconSize) {\n // eslint-disable-next-line no-console\n console.warn(\n `IconButton with size \"${size}\" expect icon size \"${requiredIconSize}, but got \"${iconSize}\"`\n )\n }\n}\n","import React, { useCallback, useContext } from 'react'\nimport styled from 'styled-components'\nimport warning from 'warning'\nimport { theme } from '../../styled'\nimport { px } from '@charcoal-ui/utils'\n\nexport type RadioProps = React.PropsWithChildren<{\n value: string\n forceChecked?: boolean\n disabled?: boolean\n}>\n\nexport default function Radio({\n value,\n forceChecked = false,\n disabled = false,\n children,\n}: RadioProps) {\n const {\n name,\n selected,\n disabled: isParentDisabled,\n readonly,\n hasError,\n onChange,\n } = useContext(RadioGroupContext)\n\n warning(\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n name !== undefined,\n `\"name\" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?`\n )\n\n const isSelected = value === selected\n const isDisabled = disabled || isParentDisabled\n const isReadonly = readonly && !isSelected\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange(e.currentTarget.value)\n },\n [onChange]\n )\n\n return (\n <RadioRoot aria-disabled={isDisabled || isReadonly}>\n <RadioInput\n name={name}\n value={value}\n checked={forceChecked || isSelected}\n hasError={hasError}\n onChange={handleChange}\n disabled={isDisabled || isReadonly}\n />\n {children != null && <RadioLabel>{children}</RadioLabel>}\n </RadioRoot>\n )\n}\n\nconst RadioRoot = styled.label`\n display: grid;\n grid-template-columns: auto 1fr;\n grid-gap: ${({ theme }) => px(theme.spacing[4])};\n align-items: center;\n cursor: pointer;\n\n ${theme((o) => [o.disabled])}\n`\n\nexport const RadioInput = styled.input.attrs({ type: 'radio' })<{\n hasError?: boolean\n}>`\n /** Make prior to browser default style */\n &[type='radio'] {\n appearance: none;\n display: block;\n box-sizing: border-box;\n\n margin: 0;\n padding: 6px;\n\n width: 20px;\n height: 20px;\n\n ${({ hasError = false }) =>\n theme((o) => [\n o.borderRadius('oval'),\n o.bg.surface1.hover.press,\n hasError && o.outline.assertive,\n ])};\n\n &:not(:checked) {\n border-width: 2px;\n border-style: solid;\n border-color: ${({ theme }) => theme.color.text3};\n }\n\n &:checked {\n ${theme((o) => o.bg.brand.hover.press)}\n\n &::after {\n content: '';\n display: block;\n width: 8px;\n height: 8px;\n pointer-events: none;\n\n ${theme((o) => [o.bg.text5.hover.press, o.borderRadius('oval')])}\n }\n }\n\n ${theme((o) => o.outline.default.focus)}\n }\n`\n\nconst RadioLabel = styled.div`\n ${theme((o) => [o.typography(14), o.font.text2])}\n`\n\nexport type RadioGroupProps = React.PropsWithChildren<{\n className?: string\n value?: string\n label: string\n name: string\n onChange(next: string): void\n disabled?: boolean\n readonly?: boolean\n hasError?: boolean\n}>\n\n// TODO: use (or polyfill) flex gap\nconst StyledRadioGroup = styled.div`\n display: grid;\n grid-template-columns: 1fr;\n grid-gap: ${({ theme }) => px(theme.spacing[8])};\n`\n\ninterface RadioGroupContext {\n name: string\n selected?: string\n disabled: boolean\n readonly: boolean\n hasError: boolean\n onChange: (next: string) => void\n}\n\nconst RadioGroupContext = React.createContext<RadioGroupContext>({\n name: undefined as never,\n selected: undefined,\n disabled: false,\n readonly: false,\n hasError: false,\n onChange() {\n throw new Error(\n 'Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?'\n )\n },\n})\n\nexport function RadioGroup({\n className,\n value,\n label,\n name,\n onChange,\n disabled,\n readonly,\n hasError,\n children,\n}: RadioGroupProps) {\n const handleChange = useCallback(\n (next: string) => {\n onChange(next)\n },\n [onChange]\n )\n\n return (\n <RadioGroupContext.Provider\n value={{\n name,\n selected: value,\n disabled: disabled ?? false,\n readonly: readonly ?? false,\n hasError: hasError ?? false,\n onChange: handleChange,\n }}\n >\n <StyledRadioGroup\n role=\"radiogroup\"\n aria-orientation=\"vertical\"\n aria-label={label}\n aria-invalid={hasError}\n className={className}\n >\n {children}\n </StyledRadioGroup>\n </RadioGroupContext.Provider>\n )\n}\n","import React, { ChangeEvent, useCallback, useContext } from 'react'\nimport styled, { css } from 'styled-components'\nimport warning from 'warning'\nimport { theme } from '../../styled'\nimport { disabledSelector, px } from '@charcoal-ui/utils'\n\nimport { MultiSelectGroupContext } from './context'\n\nexport type MultiSelectProps = React.PropsWithChildren<{\n value: string\n forceChecked?: boolean\n disabled?: boolean\n variant?: 'default' | 'overlay'\n onChange?: (payload: { value: string; selected: boolean }) => void\n}>\n\nexport default function MultiSelect({\n value,\n forceChecked = false,\n disabled = false,\n onChange,\n variant = 'default',\n children,\n}: MultiSelectProps) {\n const {\n name,\n selected,\n disabled: parentDisabled,\n readonly,\n hasError,\n onChange: parentOnChange,\n } = useContext(MultiSelectGroupContext)\n\n warning(\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n name !== undefined,\n `\"name\" is not Provided for <MultiSelect>. Perhaps you forgot to wrap with <MultiSelectGroup> ?`\n )\n\n const isSelected = selected.includes(value) || forceChecked\n const isDisabled = disabled || parentDisabled || readonly\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n if (!(event.currentTarget instanceof HTMLInputElement)) {\n return\n }\n if (onChange) onChange({ value, selected: event.currentTarget.checked })\n parentOnChange({ value, selected: event.currentTarget.checked })\n },\n [onChange, parentOnChange, value]\n )\n\n return (\n <MultiSelectRoot aria-disabled={isDisabled}>\n <MultiSelectInput\n {...{\n name,\n value,\n hasError,\n }}\n checked={isSelected}\n disabled={isDisabled}\n onChange={handleChange}\n overlay={variant === 'overlay'}\n aria-invalid={hasError}\n />\n <MultiSelectInputOverlay\n overlay={variant === 'overlay'}\n hasError={hasError}\n aria-hidden={true}\n >\n <pixiv-icon name=\"24/Check\" unsafe-non-guideline-scale={16 / 24} />\n </MultiSelectInputOverlay>\n {Boolean(children) && <MultiSelectLabel>{children}</MultiSelectLabel>}\n </MultiSelectRoot>\n )\n}\n\nconst MultiSelectRoot = styled.label`\n display: grid;\n grid-template-columns: auto 1fr;\n align-items: center;\n position: relative;\n cursor: pointer;\n ${disabledSelector} {\n cursor: default;\n }\n gap: ${({ theme }) => px(theme.spacing[4])};\n ${theme((o) => o.disabled)}\n`\n\nconst MultiSelectLabel = styled.div`\n display: flex;\n align-items: center;\n ${theme((o) => [o.typography(14), o.font.text2])}\n`\n\nconst MultiSelectInput = styled.input.attrs({ type: 'checkbox' })<{\n hasError: boolean\n overlay: boolean\n}>`\n &[type='checkbox'] {\n appearance: none;\n display: block;\n width: 20px;\n height: 20px;\n margin: 0;\n\n &:checked {\n ${theme((o) => o.bg.brand.hover.press)}\n }\n\n ${({ hasError, overlay }) =>\n theme((o) => [\n o.bg.text3.hover.press,\n o.borderRadius('oval'),\n hasError && !overlay && o.outline.assertive,\n overlay && o.bg.surface4,\n ])};\n }\n`\n\nconst MultiSelectInputOverlay = styled.div<{\n overlay: boolean\n hasError: boolean\n}>`\n position: absolute;\n top: -2px;\n left: -2px;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n\n ${({ hasError, overlay }) =>\n theme((o) => [\n o.width.px(24),\n o.height.px(24),\n o.borderRadius('oval'),\n o.font.text5,\n hasError && overlay && o.outline.assertive,\n ])}\n\n ${({ overlay }) =>\n overlay &&\n css`\n border-color: ${({ theme }) => theme.color.text5};\n border-width: 2px;\n border-style: solid;\n `}\n`\n\nexport type MultiSelectGroupProps = React.PropsWithChildren<{\n className?: string\n name: string\n ariaLabel: string\n selected: string[]\n onChange: (selected: string[]) => void\n disabled?: boolean\n readonly?: boolean\n hasError?: boolean\n}>\n\nexport function MultiSelectGroup({\n className,\n name,\n ariaLabel,\n selected,\n onChange,\n disabled = false,\n readonly = false,\n hasError = false,\n children,\n}: MultiSelectGroupProps) {\n const handleChange = useCallback(\n (payload: { value: string; selected: boolean }) => {\n const index = selected.indexOf(payload.value)\n\n if (payload.selected) {\n if (index < 0) {\n onChange([...selected, payload.value])\n }\n } else {\n if (index >= 0) {\n onChange([...selected.slice(0, index), ...selected.slice(index + 1)])\n }\n }\n },\n [onChange, selected]\n )\n\n return (\n <MultiSelectGroupContext.Provider\n value={{\n name,\n selected: Array.from(new Set(selected)),\n disabled,\n readonly,\n hasError,\n onChange: handleChange,\n }}\n >\n <div\n className={className}\n aria-label={ariaLabel}\n data-testid=\"SelectGroup\"\n >\n {children}\n </div>\n </MultiSelectGroupContext.Provider>\n )\n}\n","import { createContext } from 'react'\n\ntype MultiSelectGroupContext = {\n name: string\n selected: string[]\n disabled: boolean\n readonly: boolean\n hasError: boolean\n onChange: ({ value, selected }: { value: string; selected: boolean }) => void\n}\n\nexport const MultiSelectGroupContext = createContext<MultiSelectGroupContext>({\n name: undefined as never,\n selected: [],\n disabled: false,\n readonly: false,\n hasError: false,\n onChange() {\n throw new Error(\n 'Cannot find `onChange()` handler. Perhaps you forgot to wrap it with `<MultiSelectGroup />` ?'\n )\n },\n})\n","import { useSwitch } from '@react-aria/switch'\nimport type { AriaSwitchProps } from '@react-types/switch'\nimport React, { useRef, useMemo } from 'react'\nimport { useToggleState } from 'react-stately'\nimport styled from 'styled-components'\nimport { theme } from '../../styled'\nimport { disabledSelector } from '@charcoal-ui/utils'\n\nexport type SwitchProps = {\n name: string\n className?: string\n value?: string\n checked?: boolean\n disabled?: boolean\n onChange(checked: boolean): void\n} & (\n | // children か label は片方が必須\n {\n children: React.ReactNode\n }\n | {\n label: string\n }\n)\n\nexport default function SwitchCheckbox(props: SwitchProps) {\n const { disabled, className } = props\n\n const ariaSwitchProps: AriaSwitchProps = useMemo(\n () => ({\n ...props,\n\n // children がいない場合は aria-label をつけないといけない\n 'aria-label': 'children' in props ? undefined : props.label,\n isDisabled: props.disabled,\n isSelected: props.checked,\n }),\n [props]\n )\n\n const state = useToggleState(ariaSwitchProps)\n const ref = useRef<HTMLInputElement>(null)\n const {\n inputProps: { className: _className, type: _type, ...rest },\n } = useSwitch(ariaSwitchProps, state, ref)\n\n return (\n <Label className={className} aria-disabled={disabled}>\n <SwitchInput {...rest} ref={ref} />\n {'children' in props ? (\n // eslint-disable-next-line react/destructuring-assignment\n <LabelInner>{props.children}</LabelInner>\n ) : undefined}\n </Label>\n )\n}\n\nconst Label = styled.label`\n display: inline-grid;\n grid-template-columns: auto 1fr;\n align-items: center;\n cursor: pointer;\n outline: 0;\n\n ${theme((o) => o.disabled)}\n\n ${disabledSelector} {\n cursor: default;\n }\n`\n\nconst LabelInner = styled.div`\n ${theme((o) => [\n o.typography(14).preserveHalfLeading,\n o.font.text2,\n o.margin.left(4),\n ])}\n`\n\nconst SwitchInput = styled.input.attrs({\n type: 'checkbox',\n})`\n &[type='checkbox'] {\n appearance: none;\n display: inline-flex;\n position: relative;\n box-sizing: border-box;\n width: 28px;\n border: 2px solid transparent;\n transition: box-shadow 0.2s, background-color 0.2s;\n cursor: inherit;\n ${theme((o) => [\n o.borderRadius(16),\n o.height.px(16),\n o.bg.text4.hover.press,\n o.outline.default.focus,\n o.margin.all(0),\n ])}\n\n &::after {\n content: '';\n position: absolute;\n display: block;\n top: 0;\n left: 0;\n width: 12px;\n height: 12px;\n transform: translateX(0);\n transition: transform 0.2s;\n ${theme((o) => [o.bg.text5.hover.press, o.borderRadius('oval')])}\n }\n\n &:checked {\n ${theme((o) => o.bg.brand.hover.press)}\n\n &::after {\n transform: translateX(12px);\n }\n }\n }\n`\n","import { useTextField } from '@react-aria/textfield'\nimport { useVisuallyHidden } from '@react-aria/visually-hidden'\nimport React, {\n ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react'\nimport styled, { css } from 'styled-components'\nimport FieldLabel, { FieldLabelProps } from '../FieldLabel'\nimport { createTheme } from '@charcoal-ui/styled'\n\nconst theme = createTheme(styled)\n\ninterface TextFieldBaseProps\n extends Pick<FieldLabelProps, 'label' | 'requiredText' | 'subLabel'> {\n readonly className?: string\n readonly defaultValue?: string\n readonly value?: string\n readonly onChange?: (value: string) => void\n readonly onKeyDown?: (event: React.KeyboardEvent<Element>) => void\n readonly onFocus?: (event: React.FocusEvent<Element>) => void\n readonly onBlur?: (event: React.FocusEvent<Element>) => void\n readonly showCount?: boolean\n readonly showLabel?: boolean\n readonly placeholder?: string\n readonly assistiveText?: string\n readonly disabled?: boolean\n readonly required?: boolean\n readonly invalid?: boolean\n readonly maxLength?: number\n /**\n * tab-indexがー1かどうか\n */\n readonly excludeFromTabOrder?: boolean\n}\n\nexport interface SingleLineTextFieldProps extends TextFieldBaseProps {\n readonly autoHeight?: never\n readonly multiline?: false\n readonly rows?: never\n readonly type?: string\n readonly prefix?: ReactNode\n readonly suffix?: ReactNode\n}\n\nexport interface MultiLineTextFieldProps extends TextFieldBaseProps {\n readonly autoHeight?: boolean\n readonly multiline: true\n readonly rows?: number\n readonly type?: never\n readonly prefix?: never\n readonly suffix?: never\n}\n\nexport type TextFieldProps = SingleLineTextFieldProps | MultiLineTextFieldProps\ntype TextFieldElement = HTMLInputElement & HTMLTextAreaElement\n\nfunction mergeRefs<T>(...refs: React.Ref<T>[]): React.RefCallback<T> {\n return (value) => {\n for (const ref of refs) {\n if (typeof ref === 'function') {\n ref(value)\n } else if (ref !== null) {\n ;(ref as React.MutableRefObject<T | null>).current = value\n }\n }\n }\n}\n\nfunction countCodePointsInString(string: string) {\n // [...string] とするとproduction buildで動かなくなる\n // cf. https://twitter.com/f_subal/status/1497214727511891972\n return Array.from(string).length\n}\n\nconst TextField = React.forwardRef<TextFieldElement, TextFieldProps>(\n function TextField(props, ref) {\n return props.multiline !== undefined && props.multiline ? (\n <MultiLineTextField ref={ref} {...props} />\n ) : (\n <SingleLineTextField ref={ref} {...props} />\n )\n }\n)\n\nexport default TextField\n\nconst SingleLineTextField = React.forwardRef<\n HTMLInputElement,\n SingleLineTextFieldProps\n>(function SingleLineTextFieldInner({ onChange, ...props }, forwardRef) {\n const {\n className,\n showLabel = false,\n showCount = false,\n label,\n requiredText,\n subLabel,\n disabled = false,\n required,\n invalid = false,\n assistiveText,\n maxLength,\n prefix = null,\n suffix = null,\n } = props\n\n const { visuallyHiddenProps } = useVisuallyHidden()\n const ariaRef = useRef<HTMLInputElement>(null)\n const prefixRef = useRef<HTMLSpanElement>(null)\n const suffixRef = useRef<HTMLSpanElement>(null)\n const [count, setCount] = useState(countCodePointsInString(props.value ?? ''))\n const [prefixWidth, setPrefixWidth] = useState(0)\n const [suffixWidth, setSuffixWidth] = useState(0)\n\n const nonControlled = props.value === undefined\n const handleChange = useCallback(\n (value: string) => {\n const count = countCodePointsInString(value)\n if (maxLength !== undefined && count > maxLength) {\n return\n }\n if (nonControlled) {\n setCount(count)\n }\n onChange?.(value)\n },\n [maxLength, nonControlled, onChange]\n )\n\n useEffect(() => {\n setCount(countCodePointsInString(props.value ?? ''))\n }, [props.value])\n\n const { inputProps, labelProps, descriptionProps, errorMessageProps } =\n useTextField(\n {\n inputElementType: 'input',\n isDisabled: disabled,\n isRequired: required,\n validationState: invalid ? 'invalid' : 'valid',\n description: !invalid && assistiveText,\n errorMessage: invalid && assistiveText,\n onChange: handleChange,\n ...props,\n },\n ariaRef\n )\n\n useEffect(() => {\n const prefixObserver = new ResizeObserver((entries) => {\n setPrefixWidth(entries[0].contentRect.width)\n })\n const suffixObserver = new ResizeObserver((entries) => {\n setSuffixWidth(entries[0].contentRect.width)\n })\n\n if (prefixRef.current !== null) {\n prefixObserver.observe(prefixRef.current)\n }\n if (suffixRef.current !== null) {\n suffixObserver.observe(suffixRef.current)\n }\n\n return () => {\n suffixObserver.disconnect()\n prefixObserver.disconnect()\n }\n }, [])\n\n return (\n <TextFieldRoot className={className} isDisabled={disabled}>\n <TextFieldLabel\n label={label}\n requiredText={requiredText}\n required={required}\n subLabel={subLabel}\n {...labelProps}\n {...(!showLabel ? visuallyHiddenProps : {})}\n />\n <StyledInputContainer>\n <PrefixContainer ref={prefixRef}>\n <Affix>{prefix}</Affix>\n </PrefixContainer>\n <StyledInput\n ref={mergeRefs(forwardRef, ariaRef)}\n invalid={invalid}\n extraLeftPadding={prefixWidth}\n extraRightPadding={suffixWidth}\n {...inputProps}\n />\n <SuffixContainer ref={suffixRef}>\n <Affix>{suffix}</Affix>\n {showCount && (\n <SingleLineCounter>\n {maxLength !== undefined ? `${count}/${maxLength}` : count}\n </SingleLineCounter>\n )}\n </SuffixContainer>\n </StyledInputContainer>\n {assistiveText != null && assistiveText.length !== 0 && (\n <AssistiveText\n invalid={invalid}\n {...(invalid ? errorMessageProps : descriptionProps)}\n >\n {assistiveText}\n </AssistiveText>\n )}\n </TextFieldRoot>\n )\n})\n\nconst MultiLineTextField = React.forwardRef<\n HTMLTextAreaElement,\n MultiLineTextFieldProps\n>(function MultiLineTextFieldInner({ onChange, ...props }, forwardRef) {\n const {\n className,\n showCount = false,\n showLabel = false,\n label,\n requiredText,\n subLabel,\n disabled = false,\n required,\n invalid = false,\n assistiveText,\n maxLength,\n autoHeight = false,\n rows: initialRows = 4,\n } = props\n\n const { visuallyHiddenProps } = useVisuallyHidden()\n const textareaRef = useRef<HTMLTextAreaElement>(null)\n const ariaRef = useRef<HTMLTextAreaElement>(null)\n const [count, setCount] = useState(countCodePointsInString(props.value ?? ''))\n const [rows, setRows] = useState(initialRows)\n\n const syncHeight = useCallback(\n (textarea: HTMLTextAreaElement) => {\n const rows = (`${textarea.value}\\n`.match(/\\n/gu)?.length ?? 0) || 1\n setRows(initialRows <= rows ? rows : initialRows)\n },\n [initialRows]\n )\n\n const nonControlled = props.value === undefined\n const handleChange = useCallback(\n (value: string) => {\n const count = countCodePointsInString(value)\n if (maxLength !== undefined && count > maxLength) {\n return\n }\n if (nonControlled) {\n setCount(count)\n }\n if (autoHeight && textareaRef.current !== null) {\n syncHeight(textareaRef.current)\n }\n onChange?.(value)\n },\n [autoHeight, maxLength, nonControlled, onChange, syncHeight]\n )\n\n useEffect(() => {\n setCount(countCodePointsInString(props.value ?? ''))\n }, [props.value])\n\n const { inputProps, labelProps, descriptionProps, errorMessageProps } =\n useTextField(\n {\n inputElementType: 'textarea',\n isDisabled: disabled,\n isRequired: required,\n validationState: invalid ? 'invalid' : 'valid',\n description: !invalid && assistiveText,\n errorMessage: invalid && assistiveText,\n onChange: handleChange,\n ...props,\n },\n ariaRef\n )\n\n useEffect(() => {\n if (autoHeight && textareaRef.current !== null) {\n syncHeight(textareaRef.current)\n }\n }, [autoHeight, syncHeight])\n\n return (\n <TextFieldRoot className={className} isDisabled={disabled}>\n <TextFieldLabel\n label={label}\n requiredText={requiredText}\n required={required}\n subLabel={subLabel}\n {...labelProps}\n {...(!showLabel ? visuallyHiddenProps : {})}\n />\n <StyledTextareaContainer\n invalid={invalid}\n rows={showCount ? rows + 1 : rows}\n >\n <StyledTextarea\n ref={mergeRefs(textareaRef, forwardRef, ariaRef)}\n rows={rows}\n noBottomPadding={showCount}\n {...inputProps}\n />\n {showCount && (\n <MultiLineCounter>\n {maxLength !== undefined ? `${count}/${maxLength}` : count}\n </MultiLineCounter>\n )}\n </StyledTextareaContainer>\n {assistiveText != null && assistiveText.length !== 0 && (\n <AssistiveText\n invalid={invalid}\n {...(invalid ? errorMessageProps : descriptionProps)}\n >\n {assistiveText}\n </AssistiveText>\n )}\n </TextFieldRoot>\n )\n})\n\nconst TextFieldRoot = styled.div<{ isDisabled: boolean }>`\n display: flex;\n flex-direction: column;\n\n ${(p) => p.isDisabled && { opacity: p.theme.elementEffect.disabled.opacity }}\n`\n\nconst TextFieldLabel = styled(FieldLabel)`\n ${theme((o) => o.margin.bottom(8))}\n`\n\nconst StyledInputContainer = styled.div`\n height: 40px;\n display: grid;\n position: relative;\n`\n\nconst PrefixContainer = styled.span`\n position: absolute;\n top: 50%;\n left: 8px;\n transform: translateY(-50%);\n`\n\nconst SuffixContainer = styled.span`\n position: absolute;\n top: 50%;\n right: 8px;\n transform: translateY(-50%);\n\n display: flex;\n gap: 8px;\n`\n\nconst Affix = styled.span`\n user-select: none;\n\n ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text2])}\n`\n\nconst StyledInput = styled.input<{\n invalid: boolean\n extraLeftPadding: number\n extraRightPadding: number\n}>`\n border: none;\n box-sizing: border-box;\n outline: none;\n font-family: inherit;\n\n /* Prevent zooming for iOS Safari */\n transform-origin: top left;\n transform: scale(0.875);\n width: calc(100% / 0.875);\n height: calc(100% / 0.875);\n font-size: calc(14px / 0.875);\n line-height: calc(22px / 0.875);\n padding-left: calc((8px + ${(p) => p.extraLeftPadding}px) / 0.875);\n padding-right: calc((8px + ${(p) => p.extraRightPadding}px) / 0.875);\n border-radius: calc(4px / 0.875);\n\n /* Display box-shadow for iOS Safari */\n appearance: none;\n\n ${(p) =>\n theme((o) => [\n o.bg.surface3.hover,\n o.outline.default.focus,\n p.invalid && o.outline.assertive,\n o.font.text2,\n ])}\n\n &::placeholder {\n ${theme((o) => o.font.text3)}\n }\n`\n\nconst StyledTextareaContainer = styled.div<{ rows: number; invalid: boolean }>`\n position: relative;\n overflow: hidden;\n padding: 0 8px;\n\n ${(p) =>\n theme((o) => [\n o.bg.surface3.hover,\n p.invalid && o.outline.assertive,\n o.font.text2,\n o.borderRadius(4),\n ])}\n\n &:focus-within {\n ${(p) =>\n theme((o) => (p.invalid ? o.outline.assertive : o.outline.default))}\n }\n\n ${({ rows }) => css`\n height: calc(22px * ${rows} + 18px);\n `};\n`\n\nconst StyledTextarea = styled.textarea<{ noBottomPadding: boolean }>`\n border: none;\n outline: none;\n resize: none;\n font-family: inherit;\n color: inherit;\n\n /* Prevent zooming for iOS Safari */\n transform-origin: top left;\n transform: scale(0.875);\n width: calc(100% / 0.875);\n font-size: calc(14px / 0.875);\n line-height: calc(22px / 0.875);\n padding: calc(9px / 0.875) 0 ${(p) => (p.noBottomPadding ? 0 : '')};\n\n ${({ rows = 1 }) => css`\n height: calc(22px / 0.875 * ${rows});\n `};\n\n /* Display box-shadow for iOS Safari */\n appearance: none;\n\n background: none;\n\n &::placeholder {\n ${theme((o) => o.font.text3)}\n }\n\n /* Hide scrollbar for Chrome, Safari and Opera */\n &::-webkit-scrollbar {\n display: none;\n }\n /* Hide scrollbar for IE, Edge and Firefox */\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n`\n\nconst SingleLineCounter = styled.span`\n ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text3])}\n`\n\nconst MultiLineCounter = styled.span`\n position: absolute;\n bottom: 9px;\n right: 8px;\n\n ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text3])}\n`\n\nconst AssistiveText = styled.p<{ invalid: boolean }>`\n ${(p) =>\n theme((o) => [\n o.typography(14),\n o.margin.top(8),\n o.margin.bottom(0),\n o.font[p.invalid ? 'assertive' : 'text1'],\n ])}\n`\n","import React from 'react'\nimport styled from 'styled-components'\nimport { createTheme } from '@charcoal-ui/styled'\n\nexport interface FieldLabelProps\n extends React.LabelHTMLAttributes<HTMLLabelElement> {\n readonly className?: string\n readonly label: string\n readonly subLabel?: React.ReactNode\n readonly required?: boolean\n // TODO: 翻訳用のContextで注入する\n readonly requiredText?: string\n}\n\nconst FieldLabel = React.forwardRef<HTMLLabelElement, FieldLabelProps>(\n function FieldLabel(\n {\n style,\n className,\n label,\n required = false,\n requiredText,\n subLabel,\n ...labelProps\n },\n ref\n ) {\n return (\n <FieldLabelWrapper style={style} className={className}>\n <Label ref={ref} {...labelProps}>\n {label}\n </Label>\n {required && <RequiredText>{requiredText}</RequiredText>}\n <SubLabelClickable>\n <span>{subLabel}</span>\n </SubLabelClickable>\n </FieldLabelWrapper>\n )\n }\n)\n\nexport default FieldLabel\n\nconst theme = createTheme(styled)\n\nconst Label = styled.label`\n ${theme((o) => [o.typography(14).bold, o.font.text1])}\n`\n\nconst RequiredText = styled.span`\n ${theme((o) => [o.typography(14), o.font.text3])}\n`\n\nconst SubLabelClickable = styled.div`\n ${theme((o) => [\n o.typography(14),\n o.font.text3.hover.press,\n o.outline.default.focus,\n ])}\n`\n\nconst FieldLabelWrapper = styled.div`\n display: inline-flex;\n align-items: center;\n\n > ${RequiredText} {\n ${theme((o) => o.margin.left(4))}\n }\n\n > ${SubLabelClickable} {\n ${theme((o) => o.margin.left('auto'))}\n }\n`\n","import React from 'react'\n\nimport '@charcoal-ui/icons'\nimport type { PixivIcon, Props } from '@charcoal-ui/icons'\n\nexport interface OwnProps {\n unsafeNonGuidelineScale?: number\n className?: string\n}\n\nexport interface IconProps\n extends OwnProps,\n React.PropsWithoutRef<\n Omit<Props, 'class' | 'unsafe-non-guideline-scale' | 'css'>\n > {}\n\nconst Icon = React.forwardRef<PixivIcon, IconProps>(function IconInner(\n { name, scale, unsafeNonGuidelineScale, className, ...rest },\n ref\n) {\n return (\n <pixiv-icon\n ref={ref}\n name={name}\n scale={scale}\n unsafe-non-guideline-scale={unsafeNonGuidelineScale}\n class={className}\n {...rest}\n />\n )\n})\n\nexport default Icon\n","import React, { useContext, useRef } from 'react'\nimport {\n AriaModalOverlayProps,\n Overlay,\n useModalOverlay,\n useOverlay,\n} from '@react-aria/overlays'\nimport styled, { css, useTheme } from 'styled-components'\nimport { theme } from '../../styled'\nimport { FocusScope } from '@react-aria/focus'\nimport { useDialog } from '@react-aria/dialog'\nimport { AriaDialogProps } from '@react-types/dialog'\nimport { columnSystem, COLUMN_UNIT, GUTTER_UNIT } from '@charcoal-ui/foundation'\nimport { unreachable } from '../../_lib'\nimport { maxWidth } from '@charcoal-ui/utils'\nimport { useMedia } from '@charcoal-ui/styled'\nimport { animated, useTransition, easings } from 'react-spring'\nimport Button, { ButtonProps } from '../Button'\nimport IconButton from '../IconButton'\n\nexport type ModalProps = AriaModalOverlayProps &\n AriaDialogProps & {\n children: React.ReactNode\n zIndex?: number\n title: string\n size?: 'S' | 'M' | 'L'\n bottomSheet?: boolean | 'full'\n isOpen: boolean\n onClose: () => void\n\n /**\n * https://github.com/adobe/react-spectrum/issues/3787\n * Next.jsで使用する際に発生するエラーの一時的な回避策でdocument.bodyを指定する必要がある\n */\n portalContainer?: HTMLElement\n }\n\nconst DEFAULT_Z_INDEX = 10\n\n/**\n * モーダルコンポーネント。\n *\n * @example アプリケーションルートで `<OverlayProvider>` ないし `<CharcoalProvider>` で囲った上で利用する\n * ```tsx\n * import {\n * OverlayProvider,\n * Modal,\n * ModalHeader,\n * ModalBody,\n * ModalButtons\n * } from '@charcoal-ui/react'\n *\n * <OverlayProvider>\n * <App>\n * <Modal isOpen={state.isOpen} onClose={() => state.close()} isDismissable>\n * <ModalHeader />\n * <ModalBody>...</ModalBody>\n * <ModalButtons>...</ModalButtons>\n * </Modal>\n * </App>\n * </OverlayProvider>\n * ```\n */\nexport default function Modal({\n children,\n zIndex = DEFAULT_Z_INDEX,\n portalContainer,\n ...props\n}: ModalProps) {\n const {\n title,\n size = 'M',\n bottomSheet = false,\n isDismissable,\n onClose,\n isOpen = false,\n } = props\n\n const ref = useRef<HTMLDivElement>(null)\n const { overlayProps, underlayProps } = useOverlay(props, ref)\n\n const { modalProps } = useModalOverlay(\n props,\n {\n close: onClose,\n isOpen: isOpen,\n // these props are not used actually.\n // https://github.com/adobe/react-spectrum/blob/df14e3fb129b94b310f0397a701b83f006b51dfe/packages/%40react-aria/overlays/src/useModalOverlay.ts\n open: () => {\n // nope\n },\n setOpen: () => {\n // nope\n },\n toggle: () => {\n // nope\n },\n },\n ref\n )\n\n const { dialogProps, titleProps } = useDialog(props, ref)\n\n const theme = useTheme()\n const isMobile = useMedia(maxWidth(theme.breakpoint.screen1)) ?? false\n const transitionEnabled = isMobile && bottomSheet !== false\n const transition = useTransition(isOpen, {\n from: {\n transform: 'translateY(100%)',\n backgroundColor: 'rgba(0, 0, 0, 0)',\n },\n enter: {\n transform: 'translateY(0%)',\n backgroundColor: 'rgba(0, 0, 0, 0.4)',\n },\n leave: {\n transform: 'translateY(100%)',\n backgroundColor: 'rgba(0, 0, 0, 0)',\n },\n config: transitionEnabled\n ? { duration: 400, easing: easings.easeOutQuart }\n : { duration: 0 },\n })\n const showDismiss = !isMobile || bottomSheet !== true\n\n return transition(\n ({ backgroundColor, transform }, item) =>\n item && (\n <Overlay portalContainer={portalContainer}>\n <ModalBackground\n zIndex={zIndex}\n {...underlayProps}\n style={transitionEnabled ? { backgroundColor } : {}}\n >\n <FocusScope contain restoreFocus autoFocus>\n <ModalDialog\n ref={ref}\n {...overlayProps}\n {...modalProps}\n {...dialogProps}\n style={transitionEnabled ? { transform } : {}}\n size={size}\n bottomSheet={bottomSheet}\n >\n <ModalContext.Provider\n value={{ titleProps, title, close: onClose, showDismiss }}\n >\n {children}\n {isDismissable === true && (\n <ModalCrossButton\n size=\"S\"\n icon=\"24/Close\"\n onClick={onClose}\n />\n )}\n </ModalContext.Provider>\n </ModalDialog>\n </FocusScope>\n </ModalBackground>\n </Overlay>\n )\n )\n}\n\nconst ModalContext = React.createContext<{\n titleProps: React.HTMLAttributes<HTMLElement>\n title: string\n close?: () => void\n showDismiss: boolean\n}>({\n titleProps: {},\n title: '',\n close: undefined,\n showDismiss: true,\n})\n\nconst ModalBackground = animated(styled.div<{ zIndex: number }>`\n z-index: ${({ zIndex }) => zIndex};\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n\n ${theme((o) => [o.bg.surface4])}\n`)\n\nconst ModalDialog = animated(styled.div<{\n size: 'S' | 'M' | 'L'\n bottomSheet: boolean | 'full'\n}>`\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: ${(p) =>\n p.size === 'S'\n ? columnSystem(3, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2\n : p.size === 'M'\n ? columnSystem(4, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2\n : // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n p.size === 'L'\n ? columnSystem(6, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2\n : unreachable(p.size)}px;\n\n ${theme((o) => [o.bg.background1, o.borderRadius(24)])}\n\n @media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {\n ${(p) =>\n p.bottomSheet === 'full'\n ? css`\n top: auto;\n bottom: 0;\n left: 0;\n transform: none;\n border-radius: 0;\n width: 100%;\n height: 100%;\n `\n : p.bottomSheet\n ? css`\n top: auto;\n bottom: 0;\n left: 0;\n transform: none;\n border-radius: 0;\n width: 100%;\n `\n : css`\n width: calc(100% - 48px);\n `}\n }\n`)\n\nconst ModalCrossButton = styled(IconButton)`\n position: absolute;\n top: 8px;\n right: 8px;\n\n ${theme((o) => [o.font.text3.hover.press])}\n`\n\nexport function ModalTitle(props: React.HTMLAttributes<HTMLHeadingElement>) {\n const { titleProps, title } = useContext(ModalContext)\n return (\n <ModalHeading {...titleProps} {...props}>\n {title}\n </ModalHeading>\n )\n}\n\nconst ModalHeading = styled.h3`\n margin: 0;\n font-weight: inherit;\n font-size: inherit;\n`\n\nexport function ModalDismissButton({ children, ...props }: ButtonProps) {\n const { close, showDismiss } = useContext(ModalContext)\n\n if (!showDismiss) {\n return null\n }\n\n return (\n <Button {...props} onClick={close} fixed>\n {children}\n </Button>\n )\n}\n","/**\n * Unit for grid column (px)\n */\nexport const COLUMN_UNIT = 80\n\n/**\n * Unit for grid gutter width (px)\n */\nexport const GUTTER_UNIT = 24\n\n// TODO: Grid definition with breakpoint\n\n/**\n * Calculate px occupied by the span of the columns with gutter gap\n *\n * @param span column span count\n */\nexport function columnSystem(span: number, column: number, gutter: number) {\n return span * column + (span - 1) * gutter\n}\n","import React from 'react'\nimport { ModalTitle } from '.'\nimport styled from 'styled-components'\nimport { theme } from '../../styled'\nimport { maxWidth } from '@charcoal-ui/utils'\n\nexport function ModalHeader() {\n return (\n <ModalHeaderRoot>\n <StyledModalTitle />\n </ModalHeaderRoot>\n )\n}\n\nconst ModalHeaderRoot = styled.div`\n height: 64px;\n display: grid;\n align-content: center;\n justify-content: center;\n`\n\nconst StyledModalTitle = styled(ModalTitle)`\n ${theme((o) => [o.font.text1, o.typography(16).bold])}\n`\n\nexport const ModalAlign = styled.div`\n ${theme((o) => [o.padding.horizontal(24)])}\n\n @media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {\n ${theme((o) => [o.padding.horizontal(16)])}\n }\n`\n\nexport const ModalBody = styled.div`\n ${theme((o) => [o.padding.bottom(40)])}\n`\n\nexport const ModalButtons = styled.div`\n display: grid;\n grid-auto-flow: row;\n grid-row-gap: 8px;\n ${theme((o) => [o.padding.horizontal(24).top(16)])}\n\n @media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {\n ${theme((o) => [o.padding.horizontal(16)])}\n }\n`\n","import React, { useImperativeHandle, useRef } from 'react'\nimport styled, { keyframes } from 'styled-components'\nimport { theme } from '../../styled'\n\nexport default function LoadingSpinner({\n size = 48,\n padding = 16,\n transparent = false,\n}) {\n return (\n <LoadingSpinnerRoot size={size} padding={padding} transparent={transparent}>\n <LoadingSpinnerIcon />\n </LoadingSpinnerRoot>\n )\n}\n\nconst LoadingSpinnerRoot = styled.div.attrs({ role: 'progressbar' })<{\n size: number\n padding: number\n transparent: boolean\n}>`\n margin: auto;\n padding: ${(props) => props.padding}px;\n border-radius: 8px;\n font-size: ${(props) => props.size}px;\n width: ${(props) => props.size}px;\n height: ${(props) => props.size}px;\n opacity: 0.84;\n ${({ transparent }) =>\n theme((o) => [\n o.font.text4,\n transparent ? o.bg.transparent : o.bg.background1,\n ])}\n`\n\nconst scaleout = keyframes`\n from {\n transform: scale(0);\n opacity: 1;\n }\n\n to {\n transform: scale(1);\n opacity: 0;\n }\n`\n\nconst Icon = styled.div.attrs({ role: 'presentation' })<{ once: boolean }>`\n width: 1em;\n height: 1em;\n border-radius: 1em;\n background-color: currentColor;\n animation: ${scaleout} 1s both ease-out;\n animation-iteration-count: ${(p) => (p.once ? 1 : 'infinite')};\n\n &[data-reset-animation] {\n animation: none;\n }\n`\n\ninterface Props {\n once?: boolean\n}\n\nexport interface LoadingSpinnerIconHandler {\n restart(): void\n}\n\nexport const LoadingSpinnerIcon = React.forwardRef<\n LoadingSpinnerIconHandler,\n Props\n>(function LoadingSpinnerIcon({ once = false }, ref) {\n const iconRef = useRef<HTMLDivElement>(null)\n\n useImperativeHandle(ref, () => ({\n restart: () => {\n if (!iconRef.current) {\n return\n }\n iconRef.current.dataset.resetAnimation = 'true'\n // Force reflow hack!\n void iconRef.current.offsetWidth\n delete iconRef.current.dataset.resetAnimation\n },\n }))\n\n return <Icon ref={iconRef} once={once} />\n})\n","import React, { Key, useMemo, useRef } from 'react'\nimport styled from 'styled-components'\nimport { Item, useSelectState } from 'react-stately'\nimport { disabledSelector } from '@charcoal-ui/utils'\nimport { useVisuallyHidden } from '@react-aria/visually-hidden'\nimport { useSelect, HiddenSelect } from '@react-aria/select'\nimport { useButton } from '@react-aria/button'\nimport { SelectProps } from '@react-types/select'\nimport Listbox, { ListboxProps } from './Listbox'\nimport Popover from './Popover'\nimport Icon from '../Icon'\nimport FieldLabel from '../FieldLabel'\nimport { theme } from '../../styled'\n\nimport type { CollectionBase } from '@react-types/shared'\nimport type { ReactNode } from 'react'\n\ntype LabelProps = {\n readonly showLabel?: boolean\n readonly label: string\n readonly subLabel?: ReactNode\n readonly requiredText?: string\n}\n\ntype Empty = Record<string, unknown>\nexport type DropdownSelectorProps<T extends Empty = Empty> = LabelProps &\n Readonly<CollectionBase<T>> & {\n readonly id?: string\n readonly name?: string\n readonly autoComplete?: string\n readonly placeholder?: string\n readonly className?: string\n readonly disabled?: boolean\n readonly required?: boolean\n readonly invalid?: boolean\n readonly assertiveText?: string\n readonly value?: Key\n readonly defaultValue?: Key\n readonly open?: boolean\n readonly onOpenChange?: (isOpen?: boolean) => void\n readonly onChange?: (key: Key) => void\n readonly mode?: ListboxProps<T>['mode']\n }\n\nconst DropdownSelector = <T extends Record<string, unknown>>({\n open,\n className,\n label = '',\n requiredText = '',\n subLabel,\n assertiveText,\n autoComplete,\n invalid = false,\n disabled = false,\n required = false,\n showLabel = false,\n mode = 'default',\n ...props\n}: DropdownSelectorProps<T>) => {\n const { visuallyHiddenProps } = useVisuallyHidden()\n const triggerRef = useRef<HTMLButtonElement>(null)\n const selectProps = useMemo<SelectProps<T>>(\n () => ({\n ...props,\n label,\n isOpen: open,\n isDisabled: disabled,\n isRequired: required,\n errorMessage: invalid && assertiveText,\n validationState: invalid ? 'invalid' : 'valid',\n onSelectionChange: props.onChange,\n selectedKey: props.value,\n defaultSelectedKey: props.defaultValue,\n }),\n [assertiveText, disabled, invalid, label, open, props, required]\n )\n const state = useSelectState<T>(selectProps)\n\n const {\n labelProps,\n triggerProps,\n valueProps,\n menuProps,\n errorMessageProps,\n descriptionProps,\n } = useSelect<T>(selectProps, state, triggerRef)\n\n const { buttonProps } = useButton(triggerProps, triggerRef)\n\n const hasAssertiveText =\n assertiveText !== undefined && assertiveText.length > 0\n\n return (\n <DropdownSelectorRoot aria-disabled={disabled} className={className}>\n <DropdownFieldLabel\n label={label}\n required={required}\n requiredText={requiredText}\n subLabel={subLabel}\n {...labelProps}\n {...(!showLabel ? visuallyHiddenProps : {})}\n />\n <HiddenSelect\n state={state}\n triggerRef={triggerRef}\n label={label}\n name={props.name}\n isDisabled={disabled}\n autoComplete={autoComplete}\n />\n <DropdownButtonWrapper>\n <DropdownButton {...buttonProps} ref={triggerRef} invalid={invalid}>\n <DropdownButtonText {...valueProps}>\n {/*\n * react-stately の useSelectState から取得される selectedItem の型が常に\n * Node<T> であるが runtime では null が帰ってくることがある\n */}\n {/* eslint-disable-next-line @typescript-eslint/strict-boolean-expressions,@typescript-eslint/no-unnecessary-condition*/}\n {state.selectedItem\n ? state.selectedItem.rendered\n : props.placeholder}\n </DropdownButtonText>\n\n <DropdownButtonIcon name=\"16/Menu\" />\n </DropdownButton>\n {state.isOpen && (\n <DropdownPopover open={state.isOpen} onClose={() => state.close()}>\n <Listbox {...menuProps} state={state} mode={mode} />\n </DropdownPopover>\n )}\n </DropdownButtonWrapper>\n\n {hasAssertiveText && (\n <AssertiveText\n invalid={invalid}\n {...(invalid ? errorMessageProps : descriptionProps)}\n >\n {assertiveText}\n </AssertiveText>\n )}\n </DropdownSelectorRoot>\n )\n}\n\nexport default DropdownSelector\nexport const DropdownSelectorItem = Item\n\nconst DropdownSelectorRoot = styled.div`\n position: relative;\n display: inline-block;\n\n ${disabledSelector} {\n cursor: default;\n ${theme((o) => o.disabled)}\n }\n`\n\nconst DropdownFieldLabel = styled(FieldLabel)`\n width: 100%;\n\n ${theme((o) => o.margin.bottom(8))}\n`\n\nconst DropdownButtonWrapper = styled.div`\n position: relative;\n`\n\nconst DropdownButton = styled.button<{ invalid: boolean }>`\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n height: 40px;\n width: 288px;\n box-sizing: border-box;\n cursor: pointer;\n\n ${disabledSelector} {\n cursor: default;\n }\n\n ${({ invalid }) =>\n theme((o) => [\n o.border.default,\n o.padding.horizontal(8),\n o.outline.default.focus,\n o.bg.surface3,\n o.borderRadius(4),\n invalid && o.outline.assertive,\n ])}\n`\n\nconst DropdownButtonText = styled.span`\n text-align: left;\n\n ${theme((o) => [o.typography(14), o.font.text2])}\n`\n\nconst DropdownButtonIcon = styled(Icon)`\n ${theme((o) => [o.font.text2])}\n`\n\nconst AssertiveText = styled.div<{ invalid: boolean }>`\n ${({ invalid }) =>\n theme((o) => [\n o.typography(14),\n o.margin.top(8),\n invalid ? o.font.assertive : o.font.text2,\n ])}\n`\n\nconst DropdownPopover = styled(Popover)`\n position: absolute;\n width: 100%;\n\n top: 100%;\n margin-top: 2px;\n`\n","import React, { memo, useRef, Fragment, useMemo } from 'react'\nimport styled, { css } from 'styled-components'\nimport { ListProps, ListState } from 'react-stately'\nimport { useListBox, useOption } from '@react-aria/listbox'\nimport { mergeProps } from '@react-aria/utils'\nimport { useFocusRing } from '@react-aria/focus'\nimport { px } from '@charcoal-ui/utils'\nimport Icon from '../Icon'\nimport { theme } from '../../styled'\n\nimport type { Node } from '@react-types/shared'\n\ntype ListMode = 'default' | 'separator'\nexport type ListboxProps<T> = Omit<ListProps<T>, 'children'> & {\n state: ListState<T>\n mode?: ListMode\n}\n\nconst Listbox = <T,>({\n state,\n mode = 'default',\n ...props\n}: ListboxProps<T>) => {\n const ref = useRef<HTMLUListElement>(null)\n\n const { listBoxProps } = useListBox(props, state, ref)\n const collection = useMemo(\n () =>\n [...state.collection].map((node, index, self) => ({\n node,\n first: index === 0,\n last: index === self.length - 1,\n })),\n [state.collection]\n )\n\n return (\n <ListboxRoot ref={ref} {...listBoxProps}>\n {collection.map(({ node, last }) => (\n <Fragment key={node.key}>\n <Option item={node} state={state} mode={mode} />\n {!last && mode === 'separator' && <Divider />}\n </Fragment>\n ))}\n </ListboxRoot>\n )\n}\nexport default memo(Listbox)\n\nconst ListboxRoot = styled.ul`\n padding-left: 0;\n margin: 0;\n box-sizing: border-box;\n list-style: none;\n\n ${theme((o) => [\n o.bg.background1,\n o.border.default,\n o.borderRadius(8),\n o.outline.default.focus,\n ])}\n`\n\nconst Divider = styled.div.attrs({ role: 'separator' })`\n display: flex;\n ${theme((o) => [o.padding.horizontal(8)])}\n\n &:before {\n content: '';\n display: block;\n width: 100%;\n height: 1px;\n background: #00000014;\n }\n`\n\ntype OptionProps<T> = {\n item: Node<T>\n state: ListState<T>\n mode?: ListMode\n}\n\nconst Option = <T,>({ item, state, mode }: OptionProps<T>) => {\n const ref = useRef<HTMLLIElement>(null)\n\n const { optionProps, isSelected } = useOption(item, state, ref)\n const { focusProps } = useFocusRing()\n\n return (\n <OptionRoot {...mergeProps(optionProps, focusProps)} ref={ref} mode={mode}>\n <OptionCheckIcon name=\"16/Check\" isSelected={isSelected} />\n <OptionText>{item.rendered}</OptionText>\n </OptionRoot>\n )\n}\n\nconst OptionRoot = styled.li<{ mode?: ListMode }>`\n display: flex;\n align-items: center;\n gap: ${({ theme }) => px(theme.spacing[4])};\n height: 40px;\n cursor: pointer;\n outline: none;\n\n ${({ mode }) =>\n theme((o) => [\n o.padding.horizontal(8),\n mode === 'separator' && o.padding.vertical(4),\n ])}\n\n &:focus {\n ${theme((o) => [o.bg.surface3])}\n }\n`\nconst OptionCheckIcon = styled(Icon)<{ isSelected: boolean }>`\n visibility: hidden;\n ${theme((o) => [o.font.text2])}\n\n ${({ isSelected }) =>\n isSelected &&\n css`\n visibility: visible;\n `}\n`\nconst OptionText = styled.span`\n display: block;\n ${theme((o) => [o.typography(14), o.font.text2])}\n`\n","import { FocusScope } from '@react-aria/focus'\nimport { DismissButton, useOverlay } from '@react-aria/overlays'\nimport React, {\n FC,\n useRef,\n useMemo,\n PropsWithChildren,\n memo,\n CSSProperties,\n} from 'react'\nimport { mergeProps } from '@react-aria/utils'\n\ntype Props = PropsWithChildren<{\n open?: boolean\n onClose?: () => void\n style?: CSSProperties\n className?: string\n}>\n\nconst Popover: FC<Props> = ({ open, onClose, children, ...props }) => {\n const ref = useRef<HTMLDivElement>(null)\n\n const { overlayProps } = useOverlay(\n useMemo(\n () => ({\n isOpen: open,\n onClose,\n shouldCloseOnBlur: true,\n isDismissable: true,\n }),\n [onClose, open]\n ),\n ref\n )\n\n return (\n <FocusScope restoreFocus>\n <div {...mergeProps(overlayProps, props)} ref={ref}>\n {children}\n <DismissButton onDismiss={onClose} />\n </div>\n </FocusScope>\n )\n}\n\nexport default memo(Popover)\n","import React, { forwardRef, memo, useMemo, useRef } from 'react'\nimport { useRadioGroupState } from 'react-stately'\nimport {\n AriaRadioGroupProps,\n AriaRadioProps,\n useRadio,\n useRadioGroup,\n} from '@react-aria/radio'\nimport styled from 'styled-components'\nimport { disabledSelector } from '@charcoal-ui/utils'\n\nimport { RadioProvider, useRadioContext } from './RadioGroupContext'\nimport { theme } from '../../styled'\n\ntype SegmentedControlItem = {\n label: React.ReactNode\n value: string\n disabled?: boolean\n}\n\nexport type SegmentedControlProps = {\n readonly id?: string\n readonly name?: string\n readonly disabled?: boolean\n readonly readonly?: boolean\n readonly required?: boolean\n\n readonly value?: string\n readonly defaultValue?: string\n\n readonly data: string[] | SegmentedControlItem[]\n\n readonly onChange?: (value: string) => void\n}\n\nconst SegmentedControl = forwardRef<HTMLDivElement, SegmentedControlProps>(\n function SegmentedControlInner(props, ref) {\n const ariaRadioGroupProps = useMemo<AriaRadioGroupProps>(\n () => ({\n ...props,\n isDisabled: props.disabled,\n isReadOnly: props.readonly,\n isRequired: props.required,\n }),\n [props]\n )\n const state = useRadioGroupState(ariaRadioGroupProps)\n const { radioGroupProps } = useRadioGroup(ariaRadioGroupProps, state)\n const segmentedControlItems = useMemo<SegmentedControlItem[]>(() => {\n return props.data.map((d) =>\n typeof d === 'string' ? { value: d, label: d } : d\n )\n }, [props.data])\n\n return (\n <SegmentedControlRoot ref={ref} {...radioGroupProps}>\n <RadioProvider value={state}>\n {segmentedControlItems.map((item) => (\n <Segmented\n key={item.value}\n value={item.value}\n disabled={item.disabled}\n >\n {item.label}\n </Segmented>\n ))}\n </RadioProvider>\n </SegmentedControlRoot>\n )\n }\n)\n\nexport default memo(SegmentedControl)\n\ntype RadioProps = {\n value: string\n disabled?: boolean\n}\n\nconst Segmented: React.FC<RadioProps> = ({ children, ...props }) => {\n const state = useRadioContext()\n const ref = useRef<HTMLInputElement>(null)\n const ariaRadioProps = useMemo<AriaRadioProps>(\n () => ({ ...props, isDisabled: props.disabled }),\n [props]\n )\n\n const { inputProps, isDisabled, isSelected } = useRadio(\n ariaRadioProps,\n state,\n ref\n )\n\n return (\n <SegmentedRoot\n aria-disabled={isDisabled || state.isReadOnly}\n checked={isSelected}\n >\n <SegmentedInput {...inputProps} ref={ref} />\n <RadioLabel>\n <SegmentedLabelInner>{children}</SegmentedLabelInner>\n </RadioLabel>\n </SegmentedRoot>\n )\n}\n\nconst SegmentedControlRoot = styled.div`\n display: inline-flex;\n align-items: center;\n\n ${theme((o) => [o.bg.surface3, o.borderRadius(16)])}\n`\n\nconst SegmentedRoot = styled.label<{ checked?: boolean }>`\n position: relative;\n display: flex;\n align-items: center;\n cursor: pointer;\n height: 32px;\n\n ${disabledSelector} {\n cursor: default;\n }\n\n ${({ checked }) =>\n theme((o) => [\n o.padding.horizontal(16),\n o.borderRadius(16),\n o.disabled,\n checked === true && o.bg.brand,\n checked === true ? o.font.text5 : o.font.text2,\n ])}\n`\nconst SegmentedInput = styled.input`\n position: absolute;\n\n height: 0px;\n width: 0px;\n padding: 0;\n margin: 0;\n\n appearance: none;\n box-sizing: border-box;\n overflow: hidden;\n white-space: nowrap;\n opacity: 0;\n`\n\nconst RadioLabel = styled.div`\n background: transparent;\n display: flex;\n align-items: center;\n height: 22px;\n`\nconst SegmentedLabelInner = styled.div`\n ${theme((o) => [o.typography(14)])}\n`\n","import React, { createContext, useContext } from 'react'\nimport { RadioGroupState } from 'react-stately'\n\nconst RadioContext = createContext<RadioGroupState | null>(null)\n\ntype RadioProviderProps = React.PropsWithChildren<{\n value: RadioGroupState\n}>\nexport const RadioProvider: React.FC<RadioProviderProps> = ({\n value,\n children,\n}) => {\n return <RadioContext.Provider value={value}>{children}</RadioContext.Provider>\n}\nexport const useRadioContext = () => {\n const state = useContext(RadioContext)\n\n if (state === null)\n throw new Error('`<RadioProvider>` is not likely mounted.')\n\n return state\n}\n","import React, { forwardRef, memo, useMemo } from 'react'\nimport styled, { css } from 'styled-components'\nimport { useCheckbox } from '@react-aria/checkbox'\nimport { useObjectRef } from '@react-aria/utils'\nimport { useToggleState } from 'react-stately'\nimport { disabledSelector, px } from '@charcoal-ui/utils'\nimport { theme } from '../../styled'\n\nimport type { AriaCheckboxProps } from '@react-types/checkbox'\nimport Icon from '../Icon'\n\ntype CheckboxLabelProps =\n | {\n children: React.ReactNode\n }\n | {\n label: string\n }\n\nexport type CheckboxProps = CheckboxLabelProps & {\n readonly id?: string\n readonly name?: string\n\n readonly checked?: boolean\n readonly defaultChecked?: boolean\n readonly disabled?: boolean\n readonly readonly?: boolean\n\n readonly onClick?: () => void\n readonly onChange?: (isSelected: boolean) => void\n readonly onBlur?: () => void\n readonly onFocus?: () => void\n}\n\nconst Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(\n function CheckboxInner(props, ref) {\n const ariaCheckboxProps = useMemo<AriaCheckboxProps>(\n () => ({\n ...props,\n isSelected: props.checked,\n defaultSelected: props.defaultChecked,\n // children がいない場合は aria-label をつけないといけない\n 'aria-label': 'children' in props ? undefined : props.label,\n isDisabled: props.disabled,\n }),\n [props]\n )\n const state = useToggleState(ariaCheckboxProps)\n const objectRef = useObjectRef(ref)\n\n const { inputProps } = useCheckbox(ariaCheckboxProps, state, objectRef)\n const isDisabled = (props.disabled ?? false) || (props.readonly ?? false)\n\n return (\n <InputRoot aria-disabled={isDisabled}>\n <CheckboxRoot>\n <CheckboxInput type=\"checkbox\" {...inputProps} />\n <CheckboxInputOverlay aria-hidden={true} checked={inputProps.checked}>\n <Icon name=\"24/Check\" unsafeNonGuidelineScale={2 / 3} />\n </CheckboxInputOverlay>\n </CheckboxRoot>\n\n {'children' in props && <InputLabel>{props.children}</InputLabel>}\n </InputRoot>\n )\n }\n)\n\nexport default memo(Checkbox)\n\nconst hiddenCss = css`\n visibility: hidden;\n`\n\nconst InputRoot = styled.label`\n position: relative;\n display: flex;\n\n cursor: pointer;\n ${disabledSelector} {\n cursor: default;\n }\n\n gap: ${({ theme }) => px(theme.spacing[4])};\n ${theme((o) => [o.disabled])}\n`\n\nconst CheckboxRoot = styled.div`\n position: relative;\n`\n\nconst CheckboxInput = styled.input`\n &[type='checkbox'] {\n appearance: none;\n display: block;\n cursor: pointer;\n margin: 0;\n width: 20px;\n height: 20px;\n\n &:checked {\n ${theme((o) => o.bg.brand.hover.press)}\n }\n &:not(:checked) {\n border-width: 2px;\n border-style: solid;\n border-color: ${({ theme }) => theme.color.text4};\n }\n ${theme((o) => [o.outline.default.focus, o.borderRadius(4)])}\n }\n`\nconst CheckboxInputOverlay = styled.div<{ checked?: boolean }>`\n position: absolute;\n top: -2px;\n left: -2px;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n\n ${theme((o) => [o.width.px(24), o.height.px(24), o.font.text5])}\n\n ${({ checked }) => checked !== true && hiddenCss};\n`\n\nconst InputLabel = styled.div`\n ${theme((o) => [o.font.text2])}\n\n font-size: 14px;\n /** checkbox の height が 20px なのでcheckbox と text が揃っているように見せるために行ボックスの高さを 20px にしている */\n line-height: 20px;\n`\n","import React, {\n forwardRef,\n memo,\n useMemo,\n ComponentPropsWithoutRef,\n} from 'react'\nimport { useObjectRef } from '@react-aria/utils'\nimport styled, { css } from 'styled-components'\nimport { theme } from '../../styled'\nimport { disabledSelector, px } from '@charcoal-ui/utils'\nimport { AriaButtonProps, useButton } from '@react-aria/button'\nimport Icon from '../Icon'\n\nconst sizeMap = {\n S: 32,\n M: 40,\n}\n\nexport type TagItemProps = {\n label: string\n translatedLabel?: string\n bgColor?: string\n bgImage?: string\n status?: 'default' | 'active' | 'inactive'\n size?: keyof typeof sizeMap\n disabled?: boolean\n} & Pick<ComponentPropsWithoutRef<'a'>, 'href' | 'target' | 'rel' | 'onClick'>\n\nconst TagItem = forwardRef<HTMLAnchorElement, TagItemProps>(\n function TagItemInner(\n {\n label,\n translatedLabel,\n bgColor = '#7ACCB1',\n bgImage,\n size = 'M',\n disabled,\n status = 'default',\n ...props\n },\n _ref\n ) {\n const ref = useObjectRef(_ref)\n const ariaButtonProps = useMemo<AriaButtonProps<'a'>>(\n () => ({\n elementType: 'a',\n isDisabled: disabled,\n ...props,\n }),\n [disabled, props]\n )\n\n const { buttonProps } = useButton(ariaButtonProps, ref)\n const hasTranslatedLabel =\n translatedLabel !== undefined && translatedLabel.length > 0\n\n return (\n <TagItemRoot\n ref={ref}\n size={hasTranslatedLabel ? 'M' : size}\n status={status}\n {...buttonProps}\n >\n <Background bgColor={bgColor} bgImage={bgImage} />\n\n <Inner>\n <LabelWrapper isTranslate={hasTranslatedLabel}>\n {hasTranslatedLabel && (\n <TranslatedLabel>\n <Label>{translatedLabel}</Label>\n </TranslatedLabel>\n )}\n <Label>{label}</Label>\n </LabelWrapper>\n {status === 'active' && <Icon name=\"16/Remove\" />}\n </Inner>\n </TagItemRoot>\n )\n }\n)\n\nexport default memo(TagItem)\n\ntype TagItemRootProps = Pick<TagItemProps, 'status'> &\n Required<Pick<TagItemProps, 'size'>>\n\nconst TagItemRoot = styled.a<TagItemRootProps>`\n isolation: isolate;\n position: relative;\n height: ${({ size }) => sizeMap[size]}px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n text-decoration: none;\n cursor: pointer;\n overflow: hidden;\n\n ${({ size, status }) =>\n theme((o) => [\n o.outline.default.focus,\n o.borderRadius(4),\n status !== 'active' && size === 'M' && o.padding.horizontal(24),\n status !== 'active' && size === 'S' && o.padding.horizontal(16),\n status === 'inactive' && o.bg.surface3,\n status === 'inactive' ? o.font.text2 : o.font.text5,\n ...(status === 'active' ? [o.padding.left(16), o.padding.right(8)] : []),\n ])}\n\n ${disabledSelector} {\n ${theme((o) => [o.disabled])}\n cursor: default;\n }\n`\n\nconst Background = styled.div<Pick<TagItemProps, 'bgColor' | 'bgImage'>>`\n position: absolute;\n z-index: 1;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n\n background-color: ${({ bgColor }) => bgColor};\n\n ${({ bgImage }) =>\n bgImage !== undefined &&\n css`\n ${theme((o) => [o.bg.surface4])}\n &::before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-position: center;\n background-size: cover;\n background-image: url(${bgImage});\n mix-blend-mode: overlay;\n }\n `}\n`\n\nconst Inner = styled.div`\n display: inline-flex;\n gap: ${({ theme }) => px(theme.spacing[8])};\n align-items: center;\n z-index: 2;\n`\n\nconst labelCSS = css`\n ${theme((o) => [o.typography(14).bold])}\n`\nconst translateLabelCSS = css`\n display: flex;\n align-items: center;\n flex-direction: column;\n font-size: 10px;\n`\nconst LabelWrapper = styled.div<{ isTranslate?: boolean }>`\n ${({ isTranslate }) => (isTranslate ?? false ? translateLabelCSS : labelCSS)}\n`\n\nconst Label = styled.span`\n max-width: 152px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: inherit;\n color: inherit;\n line-height: inherit;\n`\n\nconst TranslatedLabel = styled.div`\n ${theme((o) => [o.typography(12).bold])}\n`\n"],"mappings":";AAAA,OAAO,SAAS,kBAAkB;AAS3B,IAAM,cAAc,MAAM;AAAA,EAC/B,SAASA,aAAY,EAAE,IAAI,aAAa,KAAK,GAAG,KAAK;AACnD,WACE,oCAAC,OAAE,MAAM,IAAI,KAAW,GAAG,QACxB,QACH;AAAA,EAEJ;AACF;AAMA,IAAM,eAA2B;AAAA,EAC/B,MAAM;AACR;AAEA,IAAM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3C,IAAM,WAAWD;AAAA,IACb,MAAM,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,EAAE,IAAI,CAAC;AAAA;AAExC,IAAM,oBAAoBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAM1B,IAAM,eAAeF,SAAO;AAAA,IACxB,CAAC,EAAE,YAAY,MAAO,eAAe,QAAQ,oBAAoB;AAAA;AAGrE,IAAMF,SAAQE,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUrB,IAAM,kBAAkBA,SAAO;AAAA,IAC3B,MAAM,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,EAAE,IAAI,CAAC;AAAA;","names":["DefaultLink","React","React","React","styled","React","styled","React","Clickable","styled","Button","React","styled","React","styled","React","styled","styledProps","variantToProps","sizeToProps","React","useContext","styled","useContext","React","styled","theme","React","useCallback","useContext","styled","css","warning","disabledSelector","px","useContext","warning","useCallback","React","styled","disabledSelector","theme","px","css","React","styled","disabledSelector","React","styled","React","useCallback","useRef","styled","css","React","styled","createTheme","FieldLabel","Label","theme","createTheme","theme","styled","React","TextField","forwardRef","useRef","useCallback","count","rows","css","React","React","useContext","useRef","styled","css","useRef","theme","React","styled","css","useContext","React","styled","maxWidth","React","styled","theme","React","useRef","styled","React","styled","Icon","LoadingSpinnerIcon","useRef","React","useMemo","useRef","styled","disabledSelector","useVisuallyHidden","React","useRef","useMemo","styled","css","px","useRef","useMemo","React","styled","theme","px","css","FocusScope","useOverlay","React","useRef","useMemo","memo","mergeProps","useVisuallyHidden","useRef","useMemo","React","styled","disabledSelector","React","memo","useMemo","useRef","styled","disabledSelector","React","createContext","useContext","useMemo","React","memo","useRef","RadioLabel","styled","disabledSelector","React","forwardRef","memo","useMemo","styled","css","useToggleState","disabledSelector","px","forwardRef","useMemo","useToggleState","React","memo","css","styled","disabledSelector","theme","px","React","forwardRef","memo","useMemo","useObjectRef","styled","css","disabledSelector","px","useButton","forwardRef","useObjectRef","useMemo","useButton","React","Label","memo","styled","disabledSelector","css","theme","px"]}
|