diff --git a/5021.064bac95.iframe.bundle.js b/5021.03df505e.iframe.bundle.js similarity index 99% rename from 5021.064bac95.iframe.bundle.js rename to 5021.03df505e.iframe.bundle.js index 07125cda0..572761124 100644 --- a/5021.064bac95.iframe.bundle.js +++ b/5021.03df505e.iframe.bundle.js @@ -536,5 +536,5 @@ margin-top: 4px; margin-bottom: -4px; color: ${p=>`var(--charcoal-${p.invalid?"assertive":"text2"})`}; -`;try{TextField.displayName="TextField",TextField.__docgenInfo={description:"",displayName:"TextField",props:{prefix:{defaultValue:null,description:"",name:"prefix",required:!1,type:{name:"ReactNode"}},suffix:{defaultValue:null,description:"",name:"suffix",required:!1,type:{name:"ReactNode"}},defaultValue:{defaultValue:null,description:"",name:"defaultValue",required:!1,type:{name:"string"}},value:{defaultValue:null,description:"",name:"value",required:!1,type:{name:"string"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!1,type:{name:"((value: string) => void)"}},onKeyDown:{defaultValue:null,description:"",name:"onKeyDown",required:!1,type:{name:"((event: KeyboardEvent) => void)"}},onFocus:{defaultValue:null,description:"",name:"onFocus",required:!1,type:{name:"((event: FocusEvent) => void)"}},onBlur:{defaultValue:null,description:"",name:"onBlur",required:!1,type:{name:"((event: FocusEvent) => void)"}},showCount:{defaultValue:null,description:"",name:"showCount",required:!1,type:{name:"boolean"}},showLabel:{defaultValue:null,description:"",name:"showLabel",required:!1,type:{name:"boolean"}},assistiveText:{defaultValue:null,description:"",name:"assistiveText",required:!1,type:{name:"string"}},invalid:{defaultValue:null,description:"",name:"invalid",required:!1,type:{name:"boolean"}},label:{defaultValue:null,description:"",name:"label",required:!0,type:{name:"string"}},requiredText:{defaultValue:null,description:"",name:"requiredText",required:!1,type:{name:"string"}},subLabel:{defaultValue:null,description:"",name:"subLabel",required:!1,type:{name:"ReactNode"}},onCopy:{defaultValue:null,description:"",name:"onCopy",required:!1,type:{name:"ClipboardEventHandler"}},onPaste:{defaultValue:null,description:"",name:"onPaste",required:!1,type:{name:"ClipboardEventHandler"}},onCut:{defaultValue:null,description:"",name:"onCut",required:!1,type:{name:"ClipboardEventHandler"}},onCompositionStart:{defaultValue:null,description:"",name:"onCompositionStart",required:!1,type:{name:"CompositionEventHandler"}},onCompositionEnd:{defaultValue:null,description:"",name:"onCompositionEnd",required:!1,type:{name:"CompositionEventHandler"}},onCompositionUpdate:{defaultValue:null,description:"",name:"onCompositionUpdate",required:!1,type:{name:"CompositionEventHandler"}},onSelect:{defaultValue:null,description:"",name:"onSelect",required:!1,type:{name:"ReactEventHandler"}},onBeforeInput:{defaultValue:null,description:"",name:"onBeforeInput",required:!1,type:{name:"FormEventHandler"}},onInput:{defaultValue:null,description:"",name:"onInput",required:!1,type:{name:"FormEventHandler"}},autoCapitalize:{defaultValue:null,description:"",name:"autoCapitalize",required:!1,type:{name:"enum",value:[{value:'"none"'},{value:'"on"'},{value:'"off"'},{value:'"sentences"'},{value:'"words"'},{value:'"characters"'}]}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["packages/react/src/components/TextField/index.tsx#TextField"]={docgenInfo:TextField.__docgenInfo,name:"TextField",path:"packages/react/src/components/TextField/index.tsx#TextField"})}catch(__react_docgen_typescript_loader_error){}try{TextFieldLabel.displayName="TextFieldLabel",TextFieldLabel.__docgenInfo={description:"",displayName:"TextFieldLabel",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},label:{defaultValue:null,description:"",name:"label",required:!0,type:{name:"string"}},required:{defaultValue:null,description:"",name:"required",required:!1,type:{name:"boolean"}},requiredText:{defaultValue:null,description:"",name:"requiredText",required:!1,type:{name:"string"}},subLabel:{defaultValue:null,description:"",name:"subLabel",required:!1,type:{name:"ReactNode"}},theme:{defaultValue:null,description:"",name:"theme",required:!1,type:{name:"DefaultTheme"}},as:{defaultValue:null,description:"",name:"as",required:!1,type:{name:"undefined"}},forwardedAs:{defaultValue:null,description:"",name:"forwardedAs",required:!1,type:{name:"undefined"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["packages/react/src/components/TextField/index.tsx#TextFieldLabel"]={docgenInfo:TextFieldLabel.__docgenInfo,name:"TextFieldLabel",path:"packages/react/src/components/TextField/index.tsx#TextFieldLabel"})}catch(__react_docgen_typescript_loader_error){}try{AssistiveText.displayName="AssistiveText",AssistiveText.__docgenInfo={description:"",displayName:"AssistiveText",props:{ref:{defaultValue:null,description:"",name:"ref",required:!1,type:{name:"((instance: HTMLParagraphElement | null) => void) | RefObject | null"}},invalid:{defaultValue:null,description:"",name:"invalid",required:!0,type:{name:"boolean"}},theme:{defaultValue:null,description:"",name:"theme",required:!1,type:{name:"DefaultTheme"}},as:{defaultValue:null,description:"",name:"as",required:!1,type:{name:"undefined"}},forwardedAs:{defaultValue:null,description:"",name:"forwardedAs",required:!1,type:{name:"undefined"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["packages/react/src/components/TextField/index.tsx#AssistiveText"]={docgenInfo:AssistiveText.__docgenInfo,name:"AssistiveText",path:"packages/react/src/components/TextField/index.tsx#AssistiveText"})}catch(__react_docgen_typescript_loader_error){}},"./packages/react/src/components/TextField/useFocusWithClick.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Q:()=>useFocusWithClick});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js");function useFocusWithClick(containerRef,inputRef){(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{const el=containerRef.current;if(el){const handleDown=e=>{e.target!==inputRef.current&&inputRef.current?.focus()};return el.addEventListener("click",handleDown),()=>{el.removeEventListener("click",handleDown)}}}))}}}]); -//# sourceMappingURL=5021.064bac95.iframe.bundle.js.map \ No newline at end of file +`;try{TextField.displayName="TextField",TextField.__docgenInfo={description:"",displayName:"TextField",props:{prefix:{defaultValue:null,description:"",name:"prefix",required:!1,type:{name:"ReactNode"}},suffix:{defaultValue:null,description:"",name:"suffix",required:!1,type:{name:"ReactNode"}},defaultValue:{defaultValue:null,description:"",name:"defaultValue",required:!1,type:{name:"string"}},value:{defaultValue:null,description:"",name:"value",required:!1,type:{name:"string"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!1,type:{name:"((value: string) => void)"}},onKeyDown:{defaultValue:null,description:"",name:"onKeyDown",required:!1,type:{name:"((event: KeyboardEvent) => void)"}},onFocus:{defaultValue:null,description:"",name:"onFocus",required:!1,type:{name:"((event: FocusEvent) => void)"}},onBlur:{defaultValue:null,description:"",name:"onBlur",required:!1,type:{name:"((event: FocusEvent) => void)"}},showCount:{defaultValue:null,description:"",name:"showCount",required:!1,type:{name:"boolean"}},showLabel:{defaultValue:null,description:"",name:"showLabel",required:!1,type:{name:"boolean"}},assistiveText:{defaultValue:null,description:"",name:"assistiveText",required:!1,type:{name:"string"}},invalid:{defaultValue:null,description:"",name:"invalid",required:!1,type:{name:"boolean"}},label:{defaultValue:null,description:"",name:"label",required:!0,type:{name:"string"}},requiredText:{defaultValue:null,description:"",name:"requiredText",required:!1,type:{name:"string"}},subLabel:{defaultValue:null,description:"",name:"subLabel",required:!1,type:{name:"ReactNode"}},onCopy:{defaultValue:null,description:"",name:"onCopy",required:!1,type:{name:"ClipboardEventHandler"}},onPaste:{defaultValue:null,description:"",name:"onPaste",required:!1,type:{name:"ClipboardEventHandler"}},onCut:{defaultValue:null,description:"",name:"onCut",required:!1,type:{name:"ClipboardEventHandler"}},onCompositionStart:{defaultValue:null,description:"",name:"onCompositionStart",required:!1,type:{name:"CompositionEventHandler"}},onCompositionEnd:{defaultValue:null,description:"",name:"onCompositionEnd",required:!1,type:{name:"CompositionEventHandler"}},onCompositionUpdate:{defaultValue:null,description:"",name:"onCompositionUpdate",required:!1,type:{name:"CompositionEventHandler"}},onSelect:{defaultValue:null,description:"",name:"onSelect",required:!1,type:{name:"ReactEventHandler"}},onBeforeInput:{defaultValue:null,description:"",name:"onBeforeInput",required:!1,type:{name:"FormEventHandler"}},onInput:{defaultValue:null,description:"",name:"onInput",required:!1,type:{name:"FormEventHandler"}},autoCapitalize:{defaultValue:null,description:"",name:"autoCapitalize",required:!1,type:{name:"enum",value:[{value:'"none"'},{value:'"on"'},{value:'"off"'},{value:'"sentences"'},{value:'"words"'},{value:'"characters"'}]}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["packages/react/src/components/TextField/index.tsx#TextField"]={docgenInfo:TextField.__docgenInfo,name:"TextField",path:"packages/react/src/components/TextField/index.tsx#TextField"})}catch(__react_docgen_typescript_loader_error){}try{TextFieldLabel.displayName="TextFieldLabel",TextFieldLabel.__docgenInfo={description:"",displayName:"TextFieldLabel",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},label:{defaultValue:null,description:"",name:"label",required:!0,type:{name:"string"}},requiredText:{defaultValue:null,description:"",name:"requiredText",required:!1,type:{name:"string"}},subLabel:{defaultValue:null,description:"",name:"subLabel",required:!1,type:{name:"ReactNode"}},required:{defaultValue:null,description:"",name:"required",required:!1,type:{name:"boolean"}},theme:{defaultValue:null,description:"",name:"theme",required:!1,type:{name:"DefaultTheme"}},as:{defaultValue:null,description:"",name:"as",required:!1,type:{name:"undefined"}},forwardedAs:{defaultValue:null,description:"",name:"forwardedAs",required:!1,type:{name:"undefined"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["packages/react/src/components/TextField/index.tsx#TextFieldLabel"]={docgenInfo:TextFieldLabel.__docgenInfo,name:"TextFieldLabel",path:"packages/react/src/components/TextField/index.tsx#TextFieldLabel"})}catch(__react_docgen_typescript_loader_error){}try{AssistiveText.displayName="AssistiveText",AssistiveText.__docgenInfo={description:"",displayName:"AssistiveText",props:{ref:{defaultValue:null,description:"",name:"ref",required:!1,type:{name:"((instance: HTMLParagraphElement | null) => void) | RefObject | null"}},invalid:{defaultValue:null,description:"",name:"invalid",required:!0,type:{name:"boolean"}},theme:{defaultValue:null,description:"",name:"theme",required:!1,type:{name:"DefaultTheme"}},as:{defaultValue:null,description:"",name:"as",required:!1,type:{name:"undefined"}},forwardedAs:{defaultValue:null,description:"",name:"forwardedAs",required:!1,type:{name:"undefined"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["packages/react/src/components/TextField/index.tsx#AssistiveText"]={docgenInfo:AssistiveText.__docgenInfo,name:"AssistiveText",path:"packages/react/src/components/TextField/index.tsx#AssistiveText"})}catch(__react_docgen_typescript_loader_error){}},"./packages/react/src/components/TextField/useFocusWithClick.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Q:()=>useFocusWithClick});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js");function useFocusWithClick(containerRef,inputRef){(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{const el=containerRef.current;if(el){const handleDown=e=>{e.target!==inputRef.current&&inputRef.current?.focus()};return el.addEventListener("click",handleDown),()=>{el.removeEventListener("click",handleDown)}}}))}}}]); +//# sourceMappingURL=5021.03df505e.iframe.bundle.js.map \ No newline at end of file diff --git a/5021.064bac95.iframe.bundle.js.map b/5021.03df505e.iframe.bundle.js.map similarity index 99% rename from 5021.064bac95.iframe.bundle.js.map rename to 5021.03df505e.iframe.bundle.js.map index d6633e2cb..cb14f77b8 100644 --- a/5021.064bac95.iframe.bundle.js.map +++ b/5021.03df505e.iframe.bundle.js.map @@ -1 +1 @@ -{"version":3,"file":"5021.064bac95.iframe.bundle.js","mappings":";;;AAYA;;;AAaA;AACA;;;;;;;;;;;;AAYA;AACA;AACA;;;;;AAKA;;AAEA;AAGA;AACA;AACA;;AAGA;AACA;;;AAGA;AACA;;;;;;;;;AASA;;;;AChBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjBA;AAGA;;;;;ACDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACqDA;;;;AAMA;;;AAKA;;;;;;;;;;;;AAYA;;;;;;;;;;;;;AAaA;AACA;;AAIA;;;;;;;;;;AAWA;;;;;;AAUA;;;;;;;;;AAWA;;AAIA;;;;;;;;;;;;;;;;;;;;;AAqBA;;;;;;;;;;;;;;;;;;;;;;;;AC5HA;;;;;;;;;;;;;;;;;;;;AAsBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA;;;;AAIA;;;;AAIA;;;;;;AC3EA;AACA;;;;AAIA;AACA;;;;;;AAMA;AAGA;AACA;AACA;;AAGA;AACA;;;AAGA;AACA;;;AAGA;;;;;;;AAgBA;;;;;AClFA;AACA;;;;AAQA;;;;;;;;;;;;;;;;;;;;;AAuBA;;;AAKA;;AAIA;;;;;;;;;;;;ACpBA;;;;;AAoBA;;;AAGA;;;;;AAOA;;;;;;;;;ACkIA;;;;;;;;;;;;;;;AAeA;AACA;;;;AAQA;;;;;;;;;;;;;;;;;AAmBA;;;;AAeA;;;;AC3FA;AAGA;;AAIA;;AAMA;;;;;;;;;;;;;;;;;;;AAsBA;;;AAGA;;;AAOA;;;AAKA;;;;AAMA;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA;;;;AAMA;;;;;AAKA","sources":["webpack://charcoal-ui/./packages/react/src/components/Button/StyledButton.tsx","webpack://charcoal-ui/./packages/react/src/components/Clickable/index.tsx","webpack://charcoal-ui/./packages/react/src/components/DropdownSelector/DropdownMenuItem.tsx","webpack://charcoal-ui/./packages/react/src/components/DropdownSelector/ListItem/index.tsx","webpack://charcoal-ui/./packages/react/src/components/DropdownSelector/index.tsx","webpack://charcoal-ui/./packages/react/src/components/FieldLabel/index.tsx","webpack://charcoal-ui/./packages/react/src/components/IconButton/index.tsx","webpack://charcoal-ui/./packages/react/src/components/Modal/ModalPlumbing.tsx","webpack://charcoal-ui/./packages/react/src/components/Modal/Dialog/index.tsx","webpack://charcoal-ui/./packages/react/src/components/Modal/index.tsx","webpack://charcoal-ui/./packages/react/src/components/TextField/index.tsx"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport Clickable from '../Clickable'\nimport { variantToFont } from './lib/variantToFont'\nimport { variantToBackground } from './lib/variantToBackground'\nimport type { Size } from '.'\nimport { focusVisibleFocusRingCss } from '@charcoal-ui/styled'\n\nconst horizontalPaddingSmall = css`\n padding-right: 16px;\n padding-left: 16px;\n`\n\nconst horizontalPaddingMedium = css`\n padding-right: 24px;\n padding-left: 24px;\n`\n\ntype StyledButtonProps = {\n $fullWidth: boolean\n $size: Size\n $background: ReturnType\n $color: ReturnType\n $isActive: boolean\n}\n\nexport const StyledButton = styled(Clickable)`\n width: ${(p) => (p.$fullWidth ? '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 border-radius: 999999px;\n font-size: 14px;\n line-height: 22px;\n font-weight: bold;\n\n ${(p) => (p.$size === 'M' ? horizontalPaddingMedium : horizontalPaddingSmall)}\n color: var(--charcoal-${(p) => p.$color});\n background-color: var(--charcoal-${(p) => p.$background});\n transition: 0.2s color, 0.2s background-color, 0.2s box-shadow;\n\n &:not(:disabled):not([aria-disabled]),\n &[aria-disabled='false'] {\n ${focusVisibleFocusRingCss}\n\n ${({ $isActive: $active, $color, $background }) =>\n $active\n ? css`\n color: var(--charcoal-${$color}-press);\n background-color: var(--charcoal-${$background}-press);\n `\n : css`\n &:hover {\n color: var(--charcoal-${$color}-hover);\n background-color: var(--charcoal-${$background}-hover);\n }\n &:active {\n color: var(--charcoal-${$color}-press);\n background-color: var(--charcoal-${$background}-press);\n }\n `}\n }\n\n &:disabled,\n &[aria-disabled]:not([aria-disabled='false']) {\n opacity: 0.32;\n }\n height: ${(p) => (p.$size === 'M' ? 40 : 32)}px;\n`\n","import * as React from 'react'\nimport styled 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, 'disabled'>)\n | (BaseProps & LinkBaseProps & Omit)\nexport type ClickableElement = HTMLButtonElement & HTMLAnchorElement\n\nconst Clickable = React.forwardRef(\n function Clickable(props, ref) {\n const { Link } = useComponentAbstraction()\n const isLink = 'to' in props\n const as = isLink ? Link : 'button'\n const ariaDisabled = isLink && props.disabled === true ? true : undefined\n let rest = props\n if (isLink) {\n const { disabled, ..._rest } = props\n rest = _rest\n }\n return (\n \n )\n }\n)\nexport default Clickable\n\nconst StyledClickableDiv = styled.div`\n cursor: pointer;\n\n ${disabledSelector} {\n cursor: default;\n }\n\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 text-decoration: none;\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","import styled from 'styled-components'\nimport MenuItem, { MenuItemProps } from './MenuItem'\nimport { MenuListContext } from './MenuList/MenuListContext'\nimport { useContext } from 'react'\nimport Icon from '../Icon'\n\nexport type DropdownMenuItemProps = Omit, 'as'>\n\n/**\n * DropdownSelectorの選択肢として使うMenuItem\n */\nexport default function DropdownMenuItem(props: DropdownMenuItemProps) {\n const { value: ctxValue } = useContext(MenuListContext)\n const isSelected = props.value === ctxValue\n const { children, ...rest } = props\n\n return (\n \n {isSelected && }\n {props.children}\n \n )\n}\n\n/**\n * アイコンがない時を考慮して20px(16pxのwidthと4pxのgap)の余白をとる\n */\nconst StyledSpan = styled.span<{ isSelected?: boolean }>`\n font-size: 14px;\n line-height: 22px;\n color: var(--charcoal-text2);\n padding: 9px 0;\n\n display: flex;\n align-items: center;\n width: 100%;\n margin-left: ${({ isSelected }) => (isSelected === true ? 0 : 20)}px;\n`\n\nconst Text2ColorIcon = styled(Icon)`\n color: var(--charcoal-text2);\n padding-right: 4px;\n`\n","import { ReactNode } from 'react'\nimport styled from 'styled-components'\n\nexport type CustomJSXElement =\n | keyof JSX.IntrinsicElements\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | React.JSXElementConstructor\n\nexport type ListItemProps = {\n children?: ReactNode\n as?: T\n} & Omit, 'children'>\n\n/**\n * リストのある要素を示すコンポーネント\n *\n * asを用いて拡張することができる\n * @example\n * ```\n * Link\n * NextLink\n * ```\n */\nexport default function ListItem(\n props: ListItemProps\n) {\n const { children, ...rest } = props\n return (\n \n {props.children}\n \n )\n}\n\nconst StyledLi = styled.li`\n list-style: none;\n`\n\nconst ItemDiv = styled.div`\n display: flex;\n align-items: center;\n min-height: 40px;\n cursor: pointer;\n outline: none;\n\n padding-right: 16px;\n padding-left: 16px;\n\n &:disabled,\n &[aria-disabled]:not([aria-disabled='false']) {\n opacity: 0.32;\n cursor: default;\n }\n\n :hover,\n :focus,\n :focus-within {\n background-color: var(--charcoal-surface3);\n }\n`\n","import { ReactNode, useState, useRef } from 'react'\nimport styled, { css } from 'styled-components'\nimport { disabledSelector } from '@charcoal-ui/utils'\nimport Icon from '../Icon'\nimport FieldLabel from '../FieldLabel'\nimport { DropdownPopover } from './DropdownPopover'\nimport { findPreviewRecursive } from './utils/findPreviewRecursive'\nimport MenuList, { MenuListChildren } from './MenuList'\nimport { focusVisibleFocusRingCss } from '@charcoal-ui/styled'\n\nexport type DropdownSelectorProps = {\n label: string\n value: string\n disabled?: boolean\n placeholder?: string\n showLabel?: boolean\n invalid?: boolean\n assistiveText?: string\n required?: boolean\n requiredText?: string\n subLabel?: ReactNode\n children: MenuListChildren\n onChange: (value: string) => void\n}\n\nconst defaultRequiredText = '*必須'\n\nexport default function DropdownSelector(props: DropdownSelectorProps) {\n const triggerRef = useRef(null)\n const [isOpen, setIsOpen] = useState(false)\n const preview = findPreviewRecursive(props.children, props.value)\n\n return (\n \n {props.showLabel === true && (\n \n )}\n {\n if (props.disabled === true) return\n setIsOpen(true)\n }}\n ref={triggerRef}\n type=\"button\"\n $active={isOpen}\n >\n \n {props.placeholder !== undefined && preview === undefined\n ? props.placeholder\n : preview}\n \n \n \n {isOpen && (\n setIsOpen(false)}\n triggerRef={triggerRef}\n value={props.value}\n >\n {\n props.onChange(v)\n setIsOpen(false)\n }}\n >\n {props.children}\n \n \n )}\n {props.assistiveText !== undefined && (\n \n {props.assistiveText}\n \n )}\n \n )\n}\n\nconst DropdownSelectorRoot = styled.div`\n display: inline-block;\n width: 100%;\n\n ${disabledSelector} {\n cursor: default;\n opacity: 0.32;\n }\n`\n\nconst DropdownFieldLabel = styled(FieldLabel)`\n width: 100%;\n margin-bottom: 8px;\n`\n\nconst DropdownButton = styled.button<{ invalid?: boolean; $active?: boolean }>`\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n height: 40px;\n width: 100%;\n box-sizing: border-box;\n border: none;\n cursor: pointer;\n gap: 4px;\n\n ${disabledSelector} {\n cursor: default;\n }\n\n padding-right: 8px;\n padding-left: 8px;\n background-color: var(--charcoal-surface3);\n border-radius: 4px;\n\n transition: 0.2s box-shadow, 0.2s background-color;\n\n &:not(:disabled):not([aria-disabled]),\n &[aria-disabled='false'] {\n ${focusVisibleFocusRingCss}\n ${({ $active }) =>\n $active === true\n ? css`\n background-color: var(--charcoal-surface3-press);\n `\n : css`\n &:hover {\n background-color: var(--charcoal-surface3-hover);\n }\n &:active {\n background-color: var(--charcoal-surface3-press);\n }\n `}\n }\n\n ${({ invalid }) =>\n invalid === true &&\n css`\n &:not(:disabled):not([aria-disabled]),\n &[aria-disabled='false'] {\n box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);\n }\n `}\n`\n\nconst DropdownButtonText = styled.span`\n text-align: left;\n font-size: 14px;\n line-height: 22px;\n display: flow-root;\n color: var(--charcoal-text2);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`\n\nconst DropdownButtonIcon = styled(Icon)`\n color: var(--charcoal-text2);\n`\n\nconst AssertiveText = styled.div<{ invalid?: boolean }>`\n margin-top: 8px;\n font-size: 14px;\n color: var(--charcoal-text2);\n line-height: 22px;\n display: flow-root;\n &::before {\n display: block;\n width: 0;\n height: 0;\n content: '';\n margin-top: -4px;\n }\n &::after {\n display: block;\n width: 0;\n height: 0;\n content: '';\n margin-bottom: -4px;\n }\n\n ${({ invalid }) =>\n invalid === true &&\n css`\n color: var(--charcoal-assertive);\n `}\n`\n","import * as React from 'react'\nimport styled from 'styled-components'\n\nexport interface FieldLabelProps\n extends React.LabelHTMLAttributes {\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(\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 \n \n {required && {requiredText}}\n \n {subLabel}\n \n \n )\n }\n)\n\nexport default FieldLabel\n\nconst Label = styled.label`\n font-size: 14px;\n line-height: 22px;\n font-weight: bold;\n display: flow-root;\n color: var(--charcoal-text1);\n\n &::before {\n display: block;\n width: 0;\n height: 0;\n content: '';\n margin-top: -4px;\n }\n &::after {\n display: block;\n width: 0;\n height: 0;\n content: '';\n margin-bottom: -4px;\n }\n`\n\nconst RequiredText = styled.span`\n font-size: 14px;\n line-height: 22px;\n display: flow-root;\n color: var(--charcoal-text2);\n\n &::before {\n display: block;\n width: 0;\n height: 0;\n content: '';\n margin-top: -4px;\n }\n &::after {\n display: block;\n width: 0;\n height: 0;\n content: '';\n margin-bottom: -4px;\n }\n`\n\nconst SubLabelClickable = styled.div`\n font-size: 14px;\n line-height: 22px;\n display: flow-root;\n color: var(--charcoal-text3);\n transition: 0.2s color, 0.2s box-shadow;\n\n &::before {\n display: block;\n width: 0;\n height: 0;\n content: '';\n margin-top: -4px;\n }\n &::after {\n display: block;\n width: 0;\n height: 0;\n content: '';\n margin-bottom: -4px;\n }\n\n &:not(:disabled):not([aria-disabled]),\n &[aria-disabled='false'] {\n &:hover {\n color: var(--charcoal-text3-hover);\n }\n &:active {\n color: var(--charcoal-text3-press);\n }\n &:active,\n &:focus,\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);\n }\n }\n`\n\nconst FieldLabelWrapper = styled.div`\n display: inline-flex;\n align-items: center;\n\n > ${RequiredText} {\n margin-left: 4px;\n }\n\n > ${SubLabelClickable} {\n margin-left: auto;\n }\n`\n","import { forwardRef } from 'react'\nimport styled, { css } from 'styled-components'\nimport Clickable, { ClickableElement, ClickableProps } from '../Clickable'\nimport type { KnownIconType } from '@charcoal-ui/icons'\nimport { focusVisibleFocusRingCss } from '@charcoal-ui/styled'\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 readonly isActive?: boolean\n}\n\nexport type IconButtonProps = StyledProps & ClickableProps\n\nconst IconButton = forwardRef(\n function IconButtonInner(\n {\n variant = 'Default',\n size = 'M',\n icon,\n isActive = false,\n ...rest\n }: IconButtonProps,\n ref\n ) {\n validateIconSize(size, icon)\n return (\n \n \n \n )\n }\n)\n\nexport default IconButton\n\ntype StyledIconButtonProps = Required<{\n [key in keyof Pick<\n StyledProps,\n 'size' | 'variant' | 'isActive'\n > as `$${key}`]: StyledProps[key]\n}>\n\nconst StyledIconButton = styled(Clickable).attrs<\n StyledIconButtonProps,\n ReturnType\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 color: var(${({ $font }) => `--charcoal-${$font}`});\n background-color: var(${({ $background }) => `--charcoal-${$background}`});\n border-radius: 999999px;\n transition: 0.2s background-color, 0.2s box-shadow;\n\n &:not(:disabled):not([aria-disabled]),\n &[aria-disabled='false'] {\n ${({ $isActive, $background, $font }) =>\n $isActive\n ? css`\n color: var(--charcoal-${$font}-press);\n background-color: var(--charcoal-${$background}-press);\n `\n : css`\n &:hover {\n color: var(--charcoal-${$font}-hover);\n background-color: var(--charcoal-${$background}-hover);\n }\n &:active {\n color: var(--charcoal-${$font}-press);\n background-color: var(--charcoal-${$background}-press);\n }\n `}\n ${focusVisibleFocusRingCss}\n }\n\n &:disabled,\n &[aria-disabled]:not([aria-disabled='false']) {\n opacity: 0.32;\n }\n`\n\nfunction styledProps({ $size, $variant }: StyledIconButtonProps) {\n return {\n ...variantToProps($variant),\n ...sizeToProps($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 { BottomSheet, ModalContext, ModalTitle } from '.'\nimport styled, { css } from 'styled-components'\nimport { useContext } from 'react'\nimport { maxWidth } from '@charcoal-ui/utils'\n\nexport function ModalHeader() {\n const modalCtx = useContext(ModalContext)\n return (\n \n \n \n )\n}\n\nconst ModalHeaderRoot = styled.div<{\n $bottomSheet: BottomSheet\n}>`\n height: 64px;\n display: grid;\n align-content: center;\n justify-content: center;\n @media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {\n ${(p) =>\n p.$bottomSheet !== false &&\n css`\n height: 48px;\n `}\n }\n`\n\nconst StyledModalTitle = styled(ModalTitle)`\n color: var(--charcoal-text1);\n font-size: 16px;\n line-height: 24px;\n font-weight: bold;\n display: flow-root;\n\n &::before {\n display: block;\n width: 0;\n height: 0;\n content: '';\n margin-top: -4px;\n }\n &::after {\n display: block;\n width: 0;\n height: 0;\n content: '';\n margin-bottom: -4px;\n }\n`\n\nexport const ModalAlign = styled.div`\n padding-left: 16px;\n padding-right: 16px;\n`\n\nexport const ModalBody = styled.div`\n padding-bottom: 40px;\n`\n\nexport const ModalButtons = styled.div`\n display: grid;\n grid-auto-flow: row;\n grid-row-gap: 8px;\n\n padding-top: 16px;\n padding-left: 16px;\n padding-right: 16px;\n`\n","import { forwardRef } from 'react'\nimport * as React from 'react'\nimport styled, { css } from 'styled-components'\nimport { useDialog } from '@react-aria/dialog'\nimport { columnSystem, COLUMN_UNIT, GUTTER_UNIT } from '@charcoal-ui/foundation'\nimport { unreachable } from '../../../_lib'\nimport { maxWidth } from '@charcoal-ui/utils'\nimport { animated } from 'react-spring'\nimport { useForwardedRef } from '../../../_lib/useForwardedRef'\nimport { Size, BottomSheet } from '..'\n\nexport const Dialog = forwardRef<\n HTMLDivElement,\n React.ComponentProps\n>(function Dialog(props, forwardRef) {\n const ref = useForwardedRef(forwardRef)\n const { dialogProps } = useDialog(\n {\n role: 'dialog',\n },\n ref\n )\n\n return (\n \n )\n})\n\nconst AnimatedStyledDialogDiv = animated(styled.div<{\n size: Size\n bottomSheet: BottomSheet\n}>`\n margin: auto;\n position: relative;\n height: fit-content;\n width: ${(p) => {\n switch (p.size) {\n case 'S': {\n return columnSystem(3, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2\n }\n case 'M': {\n return columnSystem(4, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2\n }\n case 'L': {\n return columnSystem(6, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2\n }\n default: {\n return unreachable(p.size)\n }\n }\n }}px;\n\n background-color: var(--charcoal-surface1);\n border-radius: 24px;\n\n @media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {\n max-width: 440px;\n width: calc(100% - 48px);\n ${(p) =>\n p.bottomSheet !== false &&\n css`\n max-width: unset;\n width: 100%;\n border-radius: 0;\n margin: auto 0 0 0;\n ${p.bottomSheet === 'full' &&\n css`\n min-height: 100%;\n `}\n `}\n }\n :focus {\n outline: none;\n }\n`)\n","import { useContext, forwardRef, memo } from 'react'\nimport * as React from 'react'\nimport { AriaModalOverlayProps, Overlay } from '@react-aria/overlays'\nimport styled, { css, useTheme } from 'styled-components'\nimport { AriaDialogProps } from '@react-types/dialog'\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'\nimport { useObjectRef } from '@react-aria/utils'\nimport { Dialog } from './Dialog'\nimport { ModalBackgroundContext } from './ModalBackgroundContext'\nimport { useCharcoalModalOverlay } from './useCustomModalOverlay'\n\nexport type BottomSheet = boolean | 'full'\nexport type Size = 'S' | 'M' | 'L'\n\nexport type ModalProps = AriaModalOverlayProps &\n AriaDialogProps & {\n children: React.ReactNode\n zIndex?: number\n title: string\n size?: Size\n bottomSheet?: BottomSheet\n isOpen: boolean\n onClose: () => void\n className?: string\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 アプリケーションルートで `` ないし `` で囲った上で利用する\n * ```tsx\n * import {\n * OverlayProvider,\n * Modal,\n * ModalHeader,\n * ModalBody,\n * ModalButtons\n * } from '@charcoal-ui/react'\n *\n * \n * \n * state.close()} isDismissable>\n * \n * \n * ...\n * ...\n * \n * \n * \n * \n * ```\n */\nconst Modal = forwardRef(function ModalInner(\n { children, zIndex = DEFAULT_Z_INDEX, portalContainer, ...props },\n external\n) {\n const {\n title,\n size = 'M',\n bottomSheet = false,\n isDismissable,\n onClose,\n className,\n isOpen = false,\n } = props\n\n const ref = useObjectRef(external)\n\n const { modalProps, underlayProps } = useCharcoalModalOverlay(\n {\n ...props,\n isKeyboardDismissDisabled:\n isDismissable === undefined || isDismissable === false,\n },\n {\n onClose,\n isOpen,\n },\n ref\n )\n\n const theme = useTheme()\n const isMobile = useMedia(maxWidth(theme.breakpoint.screen1)) ?? false\n const transitionEnabled = isMobile && bottomSheet !== false\n const showDismiss = !isMobile || bottomSheet !== true\n\n const transition = useTransition(isOpen, {\n from: {\n transform: 'translateY(100%)',\n backgroundColor: 'rgba(0, 0, 0, 0)',\n overflow: 'hidden',\n },\n enter: {\n transform: 'translateY(0%)',\n backgroundColor: 'rgba(0, 0, 0, 0.4)',\n },\n update: {\n overflow: 'auto',\n },\n leave: {\n transform: 'translateY(100%)',\n backgroundColor: 'rgba(0, 0, 0, 0)',\n overflow: 'hidden',\n },\n config: transitionEnabled\n ? { duration: 400, easing: easings.easeOutQuart }\n : { duration: 0 },\n })\n\n const bgRef = React.useRef(null)\n\n const handleClick = React.useCallback(\n (e: MouseEvent) => {\n if (e.currentTarget === e.target) {\n onClose()\n }\n },\n [onClose]\n )\n\n return transition(\n ({ backgroundColor, overflow, transform }, item) =>\n item && (\n \n \n \n \n \n {children}\n {isDismissable === true && (\n \n )}\n \n \n \n \n \n )\n )\n})\n\nexport default memo(Modal)\n\nexport const ModalContext = React.createContext<{\n /**\n * @deprecated\n */\n titleProps: React.HTMLAttributes\n title: string\n close?: () => void\n showDismiss: boolean\n bottomSheet: BottomSheet\n}>({\n titleProps: {},\n title: '',\n close: undefined,\n showDismiss: true,\n bottomSheet: false,\n})\n\nconst ModalBackground = animated(styled.div<{\n zIndex: number\n $bottomSheet: BottomSheet\n}>`\n z-index: ${({ zIndex }) => zIndex};\n overflow: auto;\n display: flex;\n position: fixed;\n top: 0;\n left: 0;\n width: -webkit-fill-available;\n width: -moz-available;\n height: 100%;\n justify-content: center;\n padding: 40px 0;\n box-sizing: border-box;\n\n background-color: var(--charcoal-surface4);\n\n @media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {\n ${(p) =>\n p.$bottomSheet !== false &&\n css`\n padding: 0;\n `}\n }\n`)\n\nconst ModalCrossButton = styled(IconButton)`\n position: absolute;\n top: 8px;\n right: 8px;\n\n color: var(--charcoal-text3);\n transition: 0.2s color;\n\n &:not(:disabled):not([aria-disabled]),\n &[aria-disabled='false'] {\n &:hover {\n color: var(--charcoal-text3-hover);\n }\n &:active {\n color: var(--charcoal-text3-press);\n }\n }\n`\n\nexport function ModalTitle(props: React.HTMLAttributes) {\n const { titleProps, title } = useContext(ModalContext)\n return (\n \n {title}\n \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 \n )\n}\n","import { useTextField } from '@react-aria/textfield'\nimport { useVisuallyHidden } from '@react-aria/visually-hidden'\nimport { ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport * as React from 'react'\nimport styled, { css } from 'styled-components'\nimport FieldLabel, { FieldLabelProps } from '../FieldLabel'\nimport { countCodePointsInString, mergeRefs } from '../../_lib'\nimport { ReactAreaUseTextFieldCompat } from '../../_lib/compat'\nimport { useFocusWithClick } from './useFocusWithClick'\nimport { mergeProps } from '@react-aria/utils'\n\ntype DOMProps = Omit<\n React.InputHTMLAttributes,\n // react-ariaのhookは、onChangeが`(v: string) => void`想定\n | 'onChange'\n\n // RDFa Attributeとかぶる\n // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/58d57ca87ac7be0d306c0844dc254e90c150bd0d/types/react/index.d.ts#L1951\n | 'prefix'\n\n // ReactAreaUseTextFieldCompatに書いてあるような事情で、ここにあるイベントハンドラの型をゆるめる\n | keyof ReactAreaUseTextFieldCompat\n>\n\nexport interface TextFieldProps\n extends Pick,\n DOMProps,\n ReactAreaUseTextFieldCompat {\n readonly prefix?: ReactNode\n readonly suffix?: ReactNode\n\n // 要素は number とか string[] もありうるが、今はこれしか想定してない\n readonly defaultValue?: string\n readonly value?: string\n readonly onChange?: (value: string) => void\n\n // react-ariaの型定義のせいでHTMLInputElementにできない\n readonly onKeyDown?: (event: React.KeyboardEvent) => void\n readonly onFocus?: (event: React.FocusEvent) => void\n readonly onBlur?: (event: React.FocusEvent) => void\n\n readonly showCount?: boolean\n readonly showLabel?: boolean\n readonly assistiveText?: string\n readonly invalid?: boolean\n}\n\nconst TextField = React.forwardRef(\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 ...restProps\n } = props\n\n const { visuallyHiddenProps } = useVisuallyHidden()\n const ariaRef = useRef(null)\n const [count, setCount] = useState(\n countCodePointsInString(props.value ?? '')\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 onChange?.(value)\n },\n [maxLength, nonControlled, onChange]\n )\n\n useEffect(() => {\n setCount(countCodePointsInString(props.value ?? ''))\n }, [props.value])\n\n const {\n inputProps: ariaInputProps,\n labelProps,\n descriptionProps,\n 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 const containerRef = useRef(null)\n\n useFocusWithClick(containerRef, ariaRef)\n\n const inputProps = mergeProps(restProps, ariaInputProps)\n\n return (\n \n \n \n {prefix && {prefix}}\n \n {(suffix || showCount) && (\n \n {suffix}\n {showCount && (\n \n {maxLength !== undefined ? `${count}/${maxLength}` : count}\n \n )}\n \n )}\n \n {assistiveText != null && assistiveText.length !== 0 && (\n \n {assistiveText}\n \n )}\n \n )\n }\n)\n\nexport default TextField\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\nexport const TextFieldLabel = styled(FieldLabel)`\n margin-bottom: 8px;\n`\n\nconst StyledInputContainer = styled.div<{\n invalid: boolean\n hasPrefix: boolean\n hasSuffix: boolean\n}>`\n display: grid;\n grid-template-columns: ${(p) =>\n [p.hasPrefix && 'auto', '1fr', p.hasSuffix && 'auto']\n .filter(Boolean)\n .join(' ')};\n height: 40px;\n transition: 0.2s background-color, 0.2s box-shadow;\n color: var(--charcoal-text2);\n background-color: var(--charcoal-surface3);\n border-radius: 4px;\n gap: 4px;\n padding: 0 8px;\n line-height: 22px;\n font-size: 14px;\n\n :not(:disabled):not([aria-disabled]):hover,\n [aria-disabled='false']:hover {\n background-color: var(--charcoal-surface3-hover);\n }\n\n :focus-within {\n outline: none;\n box-shadow: 0 0 0 4px\n ${(p) => (p.invalid ? `rgba(255,43,0,0.32)` : `rgba(0, 150, 250, 0.32);`)};\n }\n\n ${(p) =>\n p.invalid &&\n css`\n box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);\n `}\n`\n\nconst PrefixContainer = styled.div`\n display: flex;\n align-items: center;\n`\n\nconst SuffixContainer = styled.span`\n display: flex;\n align-items: center;\n gap: 8px;\n`\n\nconst StyledInput = styled.input<{\n invalid: boolean\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: 0;\n padding-right: 0;\n border-radius: calc(4px / 0.875);\n\n /* Display box-shadow for iOS Safari */\n appearance: none;\n background: transparent;\n\n color: var(--charcoal-text2);\n &::placeholder {\n color: var(--charcoal-text3);\n }\n`\n\nconst SingleLineCounter = styled.span`\n line-height: 22px;\n font-size: 14px;\n color: var(--charcoal-text3);\n`\n\nexport const AssistiveText = styled.p<{ invalid: boolean }>`\n font-size: 14px;\n line-height: 22px;\n margin-top: 4px;\n margin-bottom: -4px;\n color: ${(p) => `var(--charcoal-${p.invalid ? `assertive` : `text2`})`};\n`\n"],"names":[],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"5021.03df505e.iframe.bundle.js","mappings":";;;AAYA;;;AAaA;AACA;;;;;;;;;;;;AAYA;AACA;AACA;;;;;AAKA;;AAEA;AAGA;AACA;AACA;;AAGA;AACA;;;AAGA;AACA;;;;;;;;;AASA;;;;AChBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjBA;AAGA;;;;;ACDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACqDA;;;;AAMA;;;AAKA;;;;;;;;;;;;AAYA;;;;;;;;;;;;;AAaA;AACA;;AAIA;;;;;;;;;;AAWA;;;;;;AAUA;;;;;;;;;AAWA;;AAIA;;;;;;;;;;;;;;;;;;;;;AAqBA;;;;;;;;;;;;;;;;;;;;;;;;AC5HA;;;;;;;;;;;;;;;;;;;;AAsBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA;;;;AAIA;;;;AAIA;;;;;;AC3EA;AACA;;;;AAIA;AACA;;;;;;AAMA;AAGA;AACA;AACA;;AAGA;AACA;;;AAGA;AACA;;;AAGA;;;;;;;AAgBA;;;;;AClFA;AACA;;;;AAQA;;;;;;;;;;;;;;;;;;;;;AAuBA;;;AAKA;;AAIA;;;;;;;;;;;;ACpBA;;;;;AAoBA;;;AAGA;;;;;AAOA;;;;;;;;;ACkIA;;;;;;;;;;;;;;;AAeA;AACA;;;;AAQA;;;;;;;;;;;;;;;;;AAmBA;;;;AAeA;;;;AC3FA;AAGA;;AAIA;;AAMA;;;;;;;;;;;;;;;;;;;AAsBA;;;AAGA;;;AAOA;;;AAKA;;;;AAMA;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA;;;;AAMA;;;;;AAKA","sources":["webpack://charcoal-ui/./packages/react/src/components/Button/StyledButton.tsx","webpack://charcoal-ui/./packages/react/src/components/Clickable/index.tsx","webpack://charcoal-ui/./packages/react/src/components/DropdownSelector/DropdownMenuItem.tsx","webpack://charcoal-ui/./packages/react/src/components/DropdownSelector/ListItem/index.tsx","webpack://charcoal-ui/./packages/react/src/components/DropdownSelector/index.tsx","webpack://charcoal-ui/./packages/react/src/components/FieldLabel/index.tsx","webpack://charcoal-ui/./packages/react/src/components/IconButton/index.tsx","webpack://charcoal-ui/./packages/react/src/components/Modal/ModalPlumbing.tsx","webpack://charcoal-ui/./packages/react/src/components/Modal/Dialog/index.tsx","webpack://charcoal-ui/./packages/react/src/components/Modal/index.tsx","webpack://charcoal-ui/./packages/react/src/components/TextField/index.tsx"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport Clickable from '../Clickable'\nimport { variantToFont } from './lib/variantToFont'\nimport { variantToBackground } from './lib/variantToBackground'\nimport type { Size } from '.'\nimport { focusVisibleFocusRingCss } from '@charcoal-ui/styled'\n\nconst horizontalPaddingSmall = css`\n padding-right: 16px;\n padding-left: 16px;\n`\n\nconst horizontalPaddingMedium = css`\n padding-right: 24px;\n padding-left: 24px;\n`\n\ntype StyledButtonProps = {\n $fullWidth: boolean\n $size: Size\n $background: ReturnType\n $color: ReturnType\n $isActive: boolean\n}\n\nexport const StyledButton = styled(Clickable)`\n width: ${(p) => (p.$fullWidth ? '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 border-radius: 999999px;\n font-size: 14px;\n line-height: 22px;\n font-weight: bold;\n\n ${(p) => (p.$size === 'M' ? horizontalPaddingMedium : horizontalPaddingSmall)}\n color: var(--charcoal-${(p) => p.$color});\n background-color: var(--charcoal-${(p) => p.$background});\n transition: 0.2s color, 0.2s background-color, 0.2s box-shadow;\n\n &:not(:disabled):not([aria-disabled]),\n &[aria-disabled='false'] {\n ${focusVisibleFocusRingCss}\n\n ${({ $isActive: $active, $color, $background }) =>\n $active\n ? css`\n color: var(--charcoal-${$color}-press);\n background-color: var(--charcoal-${$background}-press);\n `\n : css`\n &:hover {\n color: var(--charcoal-${$color}-hover);\n background-color: var(--charcoal-${$background}-hover);\n }\n &:active {\n color: var(--charcoal-${$color}-press);\n background-color: var(--charcoal-${$background}-press);\n }\n `}\n }\n\n &:disabled,\n &[aria-disabled]:not([aria-disabled='false']) {\n opacity: 0.32;\n }\n height: ${(p) => (p.$size === 'M' ? 40 : 32)}px;\n`\n","import * as React from 'react'\nimport styled 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, 'disabled'>)\n | (BaseProps & LinkBaseProps & Omit)\nexport type ClickableElement = HTMLButtonElement & HTMLAnchorElement\n\nconst Clickable = React.forwardRef(\n function Clickable(props, ref) {\n const { Link } = useComponentAbstraction()\n const isLink = 'to' in props\n const as = isLink ? Link : 'button'\n const ariaDisabled = isLink && props.disabled === true ? true : undefined\n let rest = props\n if (isLink) {\n const { disabled, ..._rest } = props\n rest = _rest\n }\n return (\n \n )\n }\n)\nexport default Clickable\n\nconst StyledClickableDiv = styled.div`\n cursor: pointer;\n\n ${disabledSelector} {\n cursor: default;\n }\n\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 text-decoration: none;\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","import styled from 'styled-components'\nimport MenuItem, { MenuItemProps } from './MenuItem'\nimport { MenuListContext } from './MenuList/MenuListContext'\nimport { useContext } from 'react'\nimport Icon from '../Icon'\n\nexport type DropdownMenuItemProps = Omit, 'as'>\n\n/**\n * DropdownSelectorの選択肢として使うMenuItem\n */\nexport default function DropdownMenuItem(props: DropdownMenuItemProps) {\n const { value: ctxValue } = useContext(MenuListContext)\n const isSelected = props.value === ctxValue\n const { children, ...rest } = props\n\n return (\n \n {isSelected && }\n {props.children}\n \n )\n}\n\n/**\n * アイコンがない時を考慮して20px(16pxのwidthと4pxのgap)の余白をとる\n */\nconst StyledSpan = styled.span<{ isSelected?: boolean }>`\n font-size: 14px;\n line-height: 22px;\n color: var(--charcoal-text2);\n padding: 9px 0;\n\n display: flex;\n align-items: center;\n width: 100%;\n margin-left: ${({ isSelected }) => (isSelected === true ? 0 : 20)}px;\n`\n\nconst Text2ColorIcon = styled(Icon)`\n color: var(--charcoal-text2);\n padding-right: 4px;\n`\n","import { ReactNode } from 'react'\nimport styled from 'styled-components'\n\nexport type CustomJSXElement =\n | keyof JSX.IntrinsicElements\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | React.JSXElementConstructor\n\nexport type ListItemProps = {\n children?: ReactNode\n as?: T\n} & Omit, 'children'>\n\n/**\n * リストのある要素を示すコンポーネント\n *\n * asを用いて拡張することができる\n * @example\n * ```\n * Link\n * NextLink\n * ```\n */\nexport default function ListItem(\n props: ListItemProps\n) {\n const { children, ...rest } = props\n return (\n \n {props.children}\n \n )\n}\n\nconst StyledLi = styled.li`\n list-style: none;\n`\n\nconst ItemDiv = styled.div`\n display: flex;\n align-items: center;\n min-height: 40px;\n cursor: pointer;\n outline: none;\n\n padding-right: 16px;\n padding-left: 16px;\n\n &:disabled,\n &[aria-disabled]:not([aria-disabled='false']) {\n opacity: 0.32;\n cursor: default;\n }\n\n :hover,\n :focus,\n :focus-within {\n background-color: var(--charcoal-surface3);\n }\n`\n","import { ReactNode, useState, useRef } from 'react'\nimport styled, { css } from 'styled-components'\nimport { disabledSelector } from '@charcoal-ui/utils'\nimport Icon from '../Icon'\nimport FieldLabel from '../FieldLabel'\nimport { DropdownPopover } from './DropdownPopover'\nimport { findPreviewRecursive } from './utils/findPreviewRecursive'\nimport MenuList, { MenuListChildren } from './MenuList'\nimport { focusVisibleFocusRingCss } from '@charcoal-ui/styled'\n\nexport type DropdownSelectorProps = {\n label: string\n value: string\n disabled?: boolean\n placeholder?: string\n showLabel?: boolean\n invalid?: boolean\n assistiveText?: string\n required?: boolean\n requiredText?: string\n subLabel?: ReactNode\n children: MenuListChildren\n onChange: (value: string) => void\n}\n\nconst defaultRequiredText = '*必須'\n\nexport default function DropdownSelector(props: DropdownSelectorProps) {\n const triggerRef = useRef(null)\n const [isOpen, setIsOpen] = useState(false)\n const preview = findPreviewRecursive(props.children, props.value)\n\n return (\n \n {props.showLabel === true && (\n \n )}\n {\n if (props.disabled === true) return\n setIsOpen(true)\n }}\n ref={triggerRef}\n type=\"button\"\n $active={isOpen}\n >\n \n {props.placeholder !== undefined && preview === undefined\n ? props.placeholder\n : preview}\n \n \n \n {isOpen && (\n setIsOpen(false)}\n triggerRef={triggerRef}\n value={props.value}\n >\n {\n props.onChange(v)\n setIsOpen(false)\n }}\n >\n {props.children}\n \n \n )}\n {props.assistiveText !== undefined && (\n \n {props.assistiveText}\n \n )}\n \n )\n}\n\nconst DropdownSelectorRoot = styled.div`\n display: inline-block;\n width: 100%;\n\n ${disabledSelector} {\n cursor: default;\n opacity: 0.32;\n }\n`\n\nconst DropdownFieldLabel = styled(FieldLabel)`\n width: 100%;\n margin-bottom: 8px;\n`\n\nconst DropdownButton = styled.button<{ invalid?: boolean; $active?: boolean }>`\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n height: 40px;\n width: 100%;\n box-sizing: border-box;\n border: none;\n cursor: pointer;\n gap: 4px;\n\n ${disabledSelector} {\n cursor: default;\n }\n\n padding-right: 8px;\n padding-left: 8px;\n background-color: var(--charcoal-surface3);\n border-radius: 4px;\n\n transition: 0.2s box-shadow, 0.2s background-color;\n\n &:not(:disabled):not([aria-disabled]),\n &[aria-disabled='false'] {\n ${focusVisibleFocusRingCss}\n ${({ $active }) =>\n $active === true\n ? css`\n background-color: var(--charcoal-surface3-press);\n `\n : css`\n &:hover {\n background-color: var(--charcoal-surface3-hover);\n }\n &:active {\n background-color: var(--charcoal-surface3-press);\n }\n `}\n }\n\n ${({ invalid }) =>\n invalid === true &&\n css`\n &:not(:disabled):not([aria-disabled]),\n &[aria-disabled='false'] {\n box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);\n }\n `}\n`\n\nconst DropdownButtonText = styled.span`\n text-align: left;\n font-size: 14px;\n line-height: 22px;\n display: flow-root;\n color: var(--charcoal-text2);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`\n\nconst DropdownButtonIcon = styled(Icon)`\n color: var(--charcoal-text2);\n`\n\nconst AssertiveText = styled.div<{ invalid?: boolean }>`\n margin-top: 8px;\n font-size: 14px;\n color: var(--charcoal-text2);\n line-height: 22px;\n display: flow-root;\n &::before {\n display: block;\n width: 0;\n height: 0;\n content: '';\n margin-top: -4px;\n }\n &::after {\n display: block;\n width: 0;\n height: 0;\n content: '';\n margin-bottom: -4px;\n }\n\n ${({ invalid }) =>\n invalid === true &&\n css`\n color: var(--charcoal-assertive);\n `}\n`\n","import * as React from 'react'\nimport styled from 'styled-components'\n\nexport interface FieldLabelProps\n extends React.LabelHTMLAttributes {\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(\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 \n \n {required && {requiredText}}\n \n {subLabel}\n \n \n )\n }\n)\n\nexport default FieldLabel\n\nconst Label = styled.label`\n font-size: 14px;\n line-height: 22px;\n font-weight: bold;\n display: flow-root;\n color: var(--charcoal-text1);\n\n &::before {\n display: block;\n width: 0;\n height: 0;\n content: '';\n margin-top: -4px;\n }\n &::after {\n display: block;\n width: 0;\n height: 0;\n content: '';\n margin-bottom: -4px;\n }\n`\n\nconst RequiredText = styled.span`\n font-size: 14px;\n line-height: 22px;\n display: flow-root;\n color: var(--charcoal-text2);\n\n &::before {\n display: block;\n width: 0;\n height: 0;\n content: '';\n margin-top: -4px;\n }\n &::after {\n display: block;\n width: 0;\n height: 0;\n content: '';\n margin-bottom: -4px;\n }\n`\n\nconst SubLabelClickable = styled.div`\n font-size: 14px;\n line-height: 22px;\n display: flow-root;\n color: var(--charcoal-text3);\n transition: 0.2s color, 0.2s box-shadow;\n\n &::before {\n display: block;\n width: 0;\n height: 0;\n content: '';\n margin-top: -4px;\n }\n &::after {\n display: block;\n width: 0;\n height: 0;\n content: '';\n margin-bottom: -4px;\n }\n\n &:not(:disabled):not([aria-disabled]),\n &[aria-disabled='false'] {\n &:hover {\n color: var(--charcoal-text3-hover);\n }\n &:active {\n color: var(--charcoal-text3-press);\n }\n &:active,\n &:focus,\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);\n }\n }\n`\n\nconst FieldLabelWrapper = styled.div`\n display: inline-flex;\n align-items: center;\n\n > ${RequiredText} {\n margin-left: 4px;\n }\n\n > ${SubLabelClickable} {\n margin-left: auto;\n }\n`\n","import { forwardRef } from 'react'\nimport styled, { css } from 'styled-components'\nimport Clickable, { ClickableElement, ClickableProps } from '../Clickable'\nimport type { KnownIconType } from '@charcoal-ui/icons'\nimport { focusVisibleFocusRingCss } from '@charcoal-ui/styled'\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 readonly isActive?: boolean\n}\n\nexport type IconButtonProps = StyledProps & ClickableProps\n\nconst IconButton = forwardRef(\n function IconButtonInner(\n {\n variant = 'Default',\n size = 'M',\n icon,\n isActive = false,\n ...rest\n }: IconButtonProps,\n ref\n ) {\n validateIconSize(size, icon)\n return (\n \n \n \n )\n }\n)\n\nexport default IconButton\n\ntype StyledIconButtonProps = Required<{\n [key in keyof Pick<\n StyledProps,\n 'size' | 'variant' | 'isActive'\n > as `$${key}`]: StyledProps[key]\n}>\n\nconst StyledIconButton = styled(Clickable).attrs<\n StyledIconButtonProps,\n ReturnType\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 color: var(${({ $font }) => `--charcoal-${$font}`});\n background-color: var(${({ $background }) => `--charcoal-${$background}`});\n border-radius: 999999px;\n transition: 0.2s background-color, 0.2s box-shadow;\n\n &:not(:disabled):not([aria-disabled]),\n &[aria-disabled='false'] {\n ${({ $isActive, $background, $font }) =>\n $isActive\n ? css`\n color: var(--charcoal-${$font}-press);\n background-color: var(--charcoal-${$background}-press);\n `\n : css`\n &:hover {\n color: var(--charcoal-${$font}-hover);\n background-color: var(--charcoal-${$background}-hover);\n }\n &:active {\n color: var(--charcoal-${$font}-press);\n background-color: var(--charcoal-${$background}-press);\n }\n `}\n ${focusVisibleFocusRingCss}\n }\n\n &:disabled,\n &[aria-disabled]:not([aria-disabled='false']) {\n opacity: 0.32;\n }\n`\n\nfunction styledProps({ $size, $variant }: StyledIconButtonProps) {\n return {\n ...variantToProps($variant),\n ...sizeToProps($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 { BottomSheet, ModalContext, ModalTitle } from '.'\nimport styled, { css } from 'styled-components'\nimport { useContext } from 'react'\nimport { maxWidth } from '@charcoal-ui/utils'\n\nexport function ModalHeader() {\n const modalCtx = useContext(ModalContext)\n return (\n \n \n \n )\n}\n\nconst ModalHeaderRoot = styled.div<{\n $bottomSheet: BottomSheet\n}>`\n height: 64px;\n display: grid;\n align-content: center;\n justify-content: center;\n @media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {\n ${(p) =>\n p.$bottomSheet !== false &&\n css`\n height: 48px;\n `}\n }\n`\n\nconst StyledModalTitle = styled(ModalTitle)`\n color: var(--charcoal-text1);\n font-size: 16px;\n line-height: 24px;\n font-weight: bold;\n display: flow-root;\n\n &::before {\n display: block;\n width: 0;\n height: 0;\n content: '';\n margin-top: -4px;\n }\n &::after {\n display: block;\n width: 0;\n height: 0;\n content: '';\n margin-bottom: -4px;\n }\n`\n\nexport const ModalAlign = styled.div`\n padding-left: 16px;\n padding-right: 16px;\n`\n\nexport const ModalBody = styled.div`\n padding-bottom: 40px;\n`\n\nexport const ModalButtons = styled.div`\n display: grid;\n grid-auto-flow: row;\n grid-row-gap: 8px;\n\n padding-top: 16px;\n padding-left: 16px;\n padding-right: 16px;\n`\n","import { forwardRef } from 'react'\nimport * as React from 'react'\nimport styled, { css } from 'styled-components'\nimport { useDialog } from '@react-aria/dialog'\nimport { columnSystem, COLUMN_UNIT, GUTTER_UNIT } from '@charcoal-ui/foundation'\nimport { unreachable } from '../../../_lib'\nimport { maxWidth } from '@charcoal-ui/utils'\nimport { animated } from 'react-spring'\nimport { useForwardedRef } from '../../../_lib/useForwardedRef'\nimport { Size, BottomSheet } from '..'\n\nexport const Dialog = forwardRef<\n HTMLDivElement,\n React.ComponentProps\n>(function Dialog(props, forwardRef) {\n const ref = useForwardedRef(forwardRef)\n const { dialogProps } = useDialog(\n {\n role: 'dialog',\n },\n ref\n )\n\n return (\n \n )\n})\n\nconst AnimatedStyledDialogDiv = animated(styled.div<{\n size: Size\n bottomSheet: BottomSheet\n}>`\n margin: auto;\n position: relative;\n height: fit-content;\n width: ${(p) => {\n switch (p.size) {\n case 'S': {\n return columnSystem(3, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2\n }\n case 'M': {\n return columnSystem(4, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2\n }\n case 'L': {\n return columnSystem(6, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2\n }\n default: {\n return unreachable(p.size)\n }\n }\n }}px;\n\n background-color: var(--charcoal-surface1);\n border-radius: 24px;\n\n @media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {\n max-width: 440px;\n width: calc(100% - 48px);\n ${(p) =>\n p.bottomSheet !== false &&\n css`\n max-width: unset;\n width: 100%;\n border-radius: 0;\n margin: auto 0 0 0;\n ${p.bottomSheet === 'full' &&\n css`\n min-height: 100%;\n `}\n `}\n }\n :focus {\n outline: none;\n }\n`)\n","import { useContext, forwardRef, memo } from 'react'\nimport * as React from 'react'\nimport { AriaModalOverlayProps, Overlay } from '@react-aria/overlays'\nimport styled, { css, useTheme } from 'styled-components'\nimport { AriaDialogProps } from '@react-types/dialog'\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'\nimport { useObjectRef } from '@react-aria/utils'\nimport { Dialog } from './Dialog'\nimport { ModalBackgroundContext } from './ModalBackgroundContext'\nimport { useCharcoalModalOverlay } from './useCustomModalOverlay'\n\nexport type BottomSheet = boolean | 'full'\nexport type Size = 'S' | 'M' | 'L'\n\nexport type ModalProps = AriaModalOverlayProps &\n AriaDialogProps & {\n children: React.ReactNode\n zIndex?: number\n title: string\n size?: Size\n bottomSheet?: BottomSheet\n isOpen: boolean\n onClose: () => void\n className?: string\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 アプリケーションルートで `` ないし `` で囲った上で利用する\n * ```tsx\n * import {\n * OverlayProvider,\n * Modal,\n * ModalHeader,\n * ModalBody,\n * ModalButtons\n * } from '@charcoal-ui/react'\n *\n * \n * \n * state.close()} isDismissable>\n * \n * \n * ...\n * ...\n * \n * \n * \n * \n * ```\n */\nconst Modal = forwardRef(function ModalInner(\n { children, zIndex = DEFAULT_Z_INDEX, portalContainer, ...props },\n external\n) {\n const {\n title,\n size = 'M',\n bottomSheet = false,\n isDismissable,\n onClose,\n className,\n isOpen = false,\n } = props\n\n const ref = useObjectRef(external)\n\n const { modalProps, underlayProps } = useCharcoalModalOverlay(\n {\n ...props,\n isKeyboardDismissDisabled:\n isDismissable === undefined || isDismissable === false,\n },\n {\n onClose,\n isOpen,\n },\n ref\n )\n\n const theme = useTheme()\n const isMobile = useMedia(maxWidth(theme.breakpoint.screen1)) ?? false\n const transitionEnabled = isMobile && bottomSheet !== false\n const showDismiss = !isMobile || bottomSheet !== true\n\n const transition = useTransition(isOpen, {\n from: {\n transform: 'translateY(100%)',\n backgroundColor: 'rgba(0, 0, 0, 0)',\n overflow: 'hidden',\n },\n enter: {\n transform: 'translateY(0%)',\n backgroundColor: 'rgba(0, 0, 0, 0.4)',\n },\n update: {\n overflow: 'auto',\n },\n leave: {\n transform: 'translateY(100%)',\n backgroundColor: 'rgba(0, 0, 0, 0)',\n overflow: 'hidden',\n },\n config: transitionEnabled\n ? { duration: 400, easing: easings.easeOutQuart }\n : { duration: 0 },\n })\n\n const bgRef = React.useRef(null)\n\n const handleClick = React.useCallback(\n (e: MouseEvent) => {\n if (e.currentTarget === e.target) {\n onClose()\n }\n },\n [onClose]\n )\n\n return transition(\n ({ backgroundColor, overflow, transform }, item) =>\n item && (\n \n \n \n \n \n {children}\n {isDismissable === true && (\n \n )}\n \n \n \n \n \n )\n )\n})\n\nexport default memo(Modal)\n\nexport const ModalContext = React.createContext<{\n /**\n * @deprecated\n */\n titleProps: React.HTMLAttributes\n title: string\n close?: () => void\n showDismiss: boolean\n bottomSheet: BottomSheet\n}>({\n titleProps: {},\n title: '',\n close: undefined,\n showDismiss: true,\n bottomSheet: false,\n})\n\nconst ModalBackground = animated(styled.div<{\n zIndex: number\n $bottomSheet: BottomSheet\n}>`\n z-index: ${({ zIndex }) => zIndex};\n overflow: auto;\n display: flex;\n position: fixed;\n top: 0;\n left: 0;\n width: -webkit-fill-available;\n width: -moz-available;\n height: 100%;\n justify-content: center;\n padding: 40px 0;\n box-sizing: border-box;\n\n background-color: var(--charcoal-surface4);\n\n @media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {\n ${(p) =>\n p.$bottomSheet !== false &&\n css`\n padding: 0;\n `}\n }\n`)\n\nconst ModalCrossButton = styled(IconButton)`\n position: absolute;\n top: 8px;\n right: 8px;\n\n color: var(--charcoal-text3);\n transition: 0.2s color;\n\n &:not(:disabled):not([aria-disabled]),\n &[aria-disabled='false'] {\n &:hover {\n color: var(--charcoal-text3-hover);\n }\n &:active {\n color: var(--charcoal-text3-press);\n }\n }\n`\n\nexport function ModalTitle(props: React.HTMLAttributes) {\n const { titleProps, title } = useContext(ModalContext)\n return (\n \n {title}\n \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 \n )\n}\n","import { useTextField } from '@react-aria/textfield'\nimport { useVisuallyHidden } from '@react-aria/visually-hidden'\nimport { ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport * as React from 'react'\nimport styled, { css } from 'styled-components'\nimport FieldLabel, { FieldLabelProps } from '../FieldLabel'\nimport { countCodePointsInString, mergeRefs } from '../../_lib'\nimport { ReactAreaUseTextFieldCompat } from '../../_lib/compat'\nimport { useFocusWithClick } from './useFocusWithClick'\nimport { mergeProps } from '@react-aria/utils'\n\ntype DOMProps = Omit<\n React.InputHTMLAttributes,\n // react-ariaのhookは、onChangeが`(v: string) => void`想定\n | 'onChange'\n\n // RDFa Attributeとかぶる\n // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/58d57ca87ac7be0d306c0844dc254e90c150bd0d/types/react/index.d.ts#L1951\n | 'prefix'\n\n // ReactAreaUseTextFieldCompatに書いてあるような事情で、ここにあるイベントハンドラの型をゆるめる\n | keyof ReactAreaUseTextFieldCompat\n>\n\nexport interface TextFieldProps\n extends Pick,\n DOMProps,\n ReactAreaUseTextFieldCompat {\n readonly prefix?: ReactNode\n readonly suffix?: ReactNode\n\n // 要素は number とか string[] もありうるが、今はこれしか想定してない\n readonly defaultValue?: string\n readonly value?: string\n readonly onChange?: (value: string) => void\n\n // react-ariaの型定義のせいでHTMLInputElementにできない\n readonly onKeyDown?: (event: React.KeyboardEvent) => void\n readonly onFocus?: (event: React.FocusEvent) => void\n readonly onBlur?: (event: React.FocusEvent) => void\n\n readonly showCount?: boolean\n readonly showLabel?: boolean\n readonly assistiveText?: string\n readonly invalid?: boolean\n}\n\nconst TextField = React.forwardRef(\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 ...restProps\n } = props\n\n const { visuallyHiddenProps } = useVisuallyHidden()\n const ariaRef = useRef(null)\n const [count, setCount] = useState(\n countCodePointsInString(props.value ?? '')\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 onChange?.(value)\n },\n [maxLength, nonControlled, onChange]\n )\n\n useEffect(() => {\n setCount(countCodePointsInString(props.value ?? ''))\n }, [props.value])\n\n const {\n inputProps: ariaInputProps,\n labelProps,\n descriptionProps,\n 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 const containerRef = useRef(null)\n\n useFocusWithClick(containerRef, ariaRef)\n\n const inputProps = mergeProps(restProps, ariaInputProps)\n\n return (\n \n \n \n {prefix && {prefix}}\n \n {(suffix || showCount) && (\n \n {suffix}\n {showCount && (\n \n {maxLength !== undefined ? `${count}/${maxLength}` : count}\n \n )}\n \n )}\n \n {assistiveText != null && assistiveText.length !== 0 && (\n \n {assistiveText}\n \n )}\n \n )\n }\n)\n\nexport default TextField\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\nexport const TextFieldLabel = styled(FieldLabel)`\n margin-bottom: 8px;\n`\n\nconst StyledInputContainer = styled.div<{\n invalid: boolean\n hasPrefix: boolean\n hasSuffix: boolean\n}>`\n display: grid;\n grid-template-columns: ${(p) =>\n [p.hasPrefix && 'auto', '1fr', p.hasSuffix && 'auto']\n .filter(Boolean)\n .join(' ')};\n height: 40px;\n transition: 0.2s background-color, 0.2s box-shadow;\n color: var(--charcoal-text2);\n background-color: var(--charcoal-surface3);\n border-radius: 4px;\n gap: 4px;\n padding: 0 8px;\n line-height: 22px;\n font-size: 14px;\n\n :not(:disabled):not([aria-disabled]):hover,\n [aria-disabled='false']:hover {\n background-color: var(--charcoal-surface3-hover);\n }\n\n :focus-within {\n outline: none;\n box-shadow: 0 0 0 4px\n ${(p) => (p.invalid ? `rgba(255,43,0,0.32)` : `rgba(0, 150, 250, 0.32);`)};\n }\n\n ${(p) =>\n p.invalid &&\n css`\n box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);\n `}\n`\n\nconst PrefixContainer = styled.div`\n display: flex;\n align-items: center;\n`\n\nconst SuffixContainer = styled.span`\n display: flex;\n align-items: center;\n gap: 8px;\n`\n\nconst StyledInput = styled.input<{\n invalid: boolean\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: 0;\n padding-right: 0;\n border-radius: calc(4px / 0.875);\n\n /* Display box-shadow for iOS Safari */\n appearance: none;\n background: transparent;\n\n color: var(--charcoal-text2);\n &::placeholder {\n color: var(--charcoal-text3);\n }\n`\n\nconst SingleLineCounter = styled.span`\n line-height: 22px;\n font-size: 14px;\n color: var(--charcoal-text3);\n`\n\nexport const AssistiveText = styled.p<{ invalid: boolean }>`\n font-size: 14px;\n line-height: 22px;\n margin-top: 4px;\n margin-bottom: -4px;\n color: ${(p) => `var(--charcoal-${p.invalid ? `assertive` : `text2`})`};\n`\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/iframe.html b/iframe.html index f051ea649..91020a51c 100644 --- a/iframe.html +++ b/iframe.html @@ -348,7 +348,7 @@ window['DOCS_OPTIONS'] = {"defaultName":"Docs","autodocs":"tag"};