@basic-ui/material 1.0.0-alpha.31 → 1.0.0-alpha.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.js +16 -10
- package/build/cjs/index.js.map +1 -1
- package/build/esm/Chip/ButtonChip.d.ts +1 -1
- package/build/esm/Combobox/Combobox.d.ts +7 -7
- package/build/esm/Select/CustomContainerExample.d.ts +3 -0
- package/build/esm/Select/CustomContainerExample.js +59 -0
- package/build/esm/Select/CustomContainerExample.js.map +1 -0
- package/build/esm/Select/Select.d.ts +4 -2
- package/build/esm/Select/Select.js +4 -3
- package/build/esm/Select/Select.js.map +1 -1
- package/build/esm/Switch/Switch.d.ts +1 -1
- package/build/esm/Switch/Switch.js +5 -5
- package/build/esm/Switch/Switch.js.map +1 -1
- package/build/esm/Table/TableHead.d.ts +1 -1
- package/build/esm/TextField/FilledContainer.d.ts +4 -1
- package/build/esm/TextField/FilledContainer.js +5 -5
- package/build/esm/TextField/FilledContainer.js.map +1 -1
- package/build/esm/TextField/TextField.d.ts +1 -1
- package/build/esm/ThemeExplorer/ThemeBuilder.js +13 -2
- package/build/esm/ThemeExplorer/ThemeBuilder.js.map +1 -1
- package/build/esm/ThemeExplorer/ThemeColors.js +33 -15
- package/build/esm/ThemeExplorer/ThemeColors.js.map +1 -1
- package/build/esm/ThemeExplorer/components.d.ts +1 -1
- package/build/esm/ThemeExplorer/components.js +11 -13
- package/build/esm/ThemeExplorer/components.js.map +1 -1
- package/build/esm/ThemeExplorer/makeColorScheme.d.ts +32 -4
- package/build/esm/ThemeExplorer/makeColorScheme.js +41 -8
- package/build/esm/ThemeExplorer/makeColorScheme.js.map +1 -1
- package/build/tsconfig-build.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/Select/CustomContainerExample.tsx +59 -0
- package/src/Select/Select.story.tsx +22 -1
- package/src/Select/Select.tsx +6 -2
- package/src/Switch/Switch.story.tsx +1 -1
- package/src/Switch/Switch.tsx +8 -2
- package/src/TextField/FilledContainer.tsx +6 -5
- package/src/ThemeExplorer/ThemeBuilder.tsx +16 -5
- package/src/ThemeExplorer/ThemeColors.tsx +39 -15
- package/src/ThemeExplorer/components.tsx +12 -20
- package/src/ThemeExplorer/makeColorScheme.tsx +39 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","names":["forwardRef","useState","useRef","useEffect","useId","wrapEvent","assignMultipleRefs","useControlledState","useTheme","Select","SelectComp","SelectButton","FilledContainer","HelperText","OutlinedContainer","SelectProvider","Menu","MenuPopover","MenuList","SelectIcon","makeDefaultRender","Box","IconContainer","listItemStyle","componentMap","outlined","filled","props","forwardedRef","idProp","id","name","variant","color","valueProp","value","defaultValue","disabled","error","label","placeholder","helperTextProp","helperText","onChangeProp","onChange","onFocus","onBlur","native","children","renderValueProp","renderValue","leadingIcon","otherProps","setState","e","v","hasFocus","setHasFocus","buttonRef","open","setOpen","fallbackId","theme","Container","handleFocus","handleBlur","handleToggle","isOpen","handleOnChange","target","currentTarget","dataset","hasError","Boolean","inputId","helperTextId","undefined","labelIsFloating","Comp","current","onSelect","minWidth","offsetWidth"],"sources":["../../../src/Select/Select.tsx"],"sourcesContent":["import type {\n SelectHTMLAttributes,\n ReactNode,\n ChangeEvent,\n ComponentType,\n} from 'react';\nimport { forwardRef, useState, useRef, useEffect, useId } from 'react';\nimport {\n wrapEvent,\n assignMultipleRefs,\n useControlledState,\n} from '@basic-ui/core';\n\nimport type { Theme } from '../theme';\nimport { useTheme } from '../theme';\nimport { Select as SelectComp, SelectButton } from './styledComponents';\nimport { FilledContainer } from '../TextField/FilledContainer';\nimport { HelperText } from '../TextField/HelperText';\nimport { OutlinedContainer } from '../TextField/OutlinedContainer';\nimport { SelectProvider } from './context';\nimport { Menu, MenuPopover, MenuList } from '../Menu';\nimport { SelectIcon } from './SelectIcon';\nimport { makeDefaultRender } from './defaultRender';\nimport type { BoxProps } from '../Box';\nimport { Box } from '../Box';\nimport { IconContainer } from '../TextField/IconContainer';\nimport { listItemStyle } from '../ListItem';\n\nconst componentMap = {\n outlined: OutlinedContainer,\n filled: FilledContainer,\n};\n\nexport interface SelectProps\n extends Omit<\n BoxProps<HTMLSelectElement, SelectHTMLAttributes<HTMLSelectElement>>,\n 'value' | 'defaultValue' | 'onChange'\n > {\n variant?: 'outlined' | 'filled';\n color?: 'primary' | 'secondary';\n label?: ReactNode;\n helperText?: string;\n defaultValue?: string;\n value?: string;\n native?: boolean;\n theme?: Theme;\n error?: boolean | string;\n onChange?: (e: ChangeEvent<HTMLSelectElement>, value: string) => void;\n renderValue?: (value?: string) => string | undefined;\n leadingIcon?: ReactNode;\n}\n\nexport const Select = forwardRef<\n HTMLSelectElement | HTMLButtonElement,\n SelectProps\n>(function Select(props, forwardedRef) {\n const {\n id: idProp,\n name,\n variant = 'outlined',\n color = 'primary',\n value: valueProp,\n defaultValue = '',\n disabled,\n error = false,\n label = null,\n placeholder,\n helperText: helperTextProp,\n onChange: onChangeProp,\n onFocus,\n onBlur,\n native = false,\n children,\n renderValue: renderValueProp,\n leadingIcon = null,\n ...otherProps\n } = props;\n const [value, onChange] = useControlledState(\n valueProp,\n onChangeProp,\n defaultValue,\n (setState) => (e, v) => {\n setState(v);\n }\n );\n const [hasFocus, setHasFocus] = useState(false);\n const buttonRef = useRef<HTMLButtonElement | HTMLSelectElement>();\n const [open, setOpen] = useState(false);\n const fallbackId = useId();\n const theme = useTheme();\n\n const Container = componentMap[variant] || OutlinedContainer;\n\n const handleFocus = () => {\n setHasFocus(true);\n };\n\n const handleBlur = () => {\n setHasFocus(false);\n };\n\n const handleToggle = (e: unknown, isOpen: boolean) => {\n setOpen(isOpen);\n };\n\n const handleOnChange = (e: any) => {\n onChange &&\n onChange(\n e as any,\n native ? e.target.value : e.currentTarget.dataset.value\n );\n };\n\n const hasError = Boolean(error);\n const helperText = typeof error === 'string' ? error : helperTextProp;\n\n const id = idProp || fallbackId;\n const inputId = `${id}-text-field`;\n const helperTextId = helperText ? `${id}-helper-text` : undefined;\n\n const renderValue = renderValueProp || makeDefaultRender(children);\n\n const labelIsFloating = hasFocus || open || renderValue(value) !== undefined;\n\n const Comp: ComponentType<any> = native\n ? (SelectComp as any)\n : (SelectButton as any);\n\n useEffect(() => {\n // right after mounting, if the default value in the select element\n // is different than the value we have stored in state we need to\n // update our state to reflect that.\n if (native && buttonRef.current && buttonRef.current.value !== value) {\n onChange && onChange({} as any, buttonRef.current.value);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <SelectProvider value={{ native, onSelect: handleOnChange, value }}>\n <Box display=\"inline-flex\" flexDirection=\"column\" width=\"100%\">\n {!native && <input type=\"hidden\" name={name} value={value} />}\n <Container\n theme={theme}\n label={label}\n color={color}\n labelIsFloating={labelIsFloating}\n inputId={inputId}\n hasFocus={hasFocus}\n disabled={disabled}\n forceActive={open}\n error={hasError}\n leadingIcon={Boolean(leadingIcon)}\n >\n <Menu onChange={handleToggle} open={open}>\n {leadingIcon && (\n <IconContainer position=\"start\">{leadingIcon}</IconContainer>\n )}\n <Comp\n ref={assignMultipleRefs(forwardedRef, buttonRef)}\n variant={variant}\n id={inputId}\n onFocus={wrapEvent(onFocus, handleFocus)}\n onBlur={wrapEvent(onBlur, handleBlur)}\n onChange={native ? handleOnChange : undefined}\n value={native ? value : undefined}\n theme={theme}\n placeholder={placeholder}\n disabled={disabled}\n aria-disabled={disabled ? 'true' : undefined}\n aria-describedby={helperTextId}\n hasLabel={!!label}\n leadingIcon={Boolean(leadingIcon)}\n name={native ? name : undefined}\n trailingIcon={true}\n {...otherProps}\n >\n {native ? children : renderValue(value)}\n </Comp>\n {!native && (\n <MenuPopover usePortal>\n <MenuList\n defaultActiveItemValue={value}\n style={{\n minWidth: buttonRef?.current?.offsetWidth,\n }}\n role=\"listbox\"\n __css={{\n '& [data-menu-item=\"\"]': {\n ...listItemStyle('primary'),\n },\n }}\n >\n {children}\n </MenuList>\n </MenuPopover>\n )}\n </Menu>\n <SelectIcon open={open} />\n </Container>\n\n <HelperText\n disabled={disabled}\n id={helperTextId}\n leftSide={helperText}\n error={hasError}\n />\n </Box>\n </SelectProvider>\n );\n});\n"],"mappings":";;;;AAMA,SAASA,UAAT,EAAqBC,QAArB,EAA+BC,MAA/B,EAAuCC,SAAvC,EAAkDC,KAAlD,QAA+D,OAA/D;AACA,SACEC,SADF,EAEEC,kBAFF,EAGEC,kBAHF,QAIO,gBAJP;AAOA,SAASC,QAAT,QAAyB,UAAzB;AACA,SAASC,MAAM,IAAIC,UAAnB,EAA+BC,YAA/B,QAAmD,oBAAnD;AACA,SAASC,eAAT,QAAgC,8BAAhC;AACA,SAASC,UAAT,QAA2B,yBAA3B;AACA,SAASC,iBAAT,QAAkC,gCAAlC;AACA,SAASC,cAAT,QAA+B,WAA/B;AACA,SAASC,IAAT,EAAeC,WAAf,EAA4BC,QAA5B,QAA4C,SAA5C;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,iBAAT,QAAkC,iBAAlC;AAEA,SAASC,GAAT,QAAoB,QAApB;AACA,SAASC,aAAT,QAA8B,4BAA9B;AACA,SAASC,aAAT,QAA8B,aAA9B;;;AAEA,IAAMC,YAAY,GAAG;EACnBC,QAAQ,EAAEX,iBADS;EAEnBY,MAAM,EAAEd;AAFW,CAArB;AAwBA,OAAO,IAAMH,MAAM,gBAAGT,UAAU,CAG9B,SAASS,MAAT,CAAgBkB,KAAhB,EAAuBC,YAAvB,EAAqC;EAAA;;EACrC,IACMC,MADN,GAoBIF,KApBJ,CACEG,EADF;EAAA,IAEEC,IAFF,GAoBIJ,KApBJ,CAEEI,IAFF;EAAA,qBAoBIJ,KApBJ,CAGEK,OAHF;EAAA,IAGEA,OAHF,+BAGY,UAHZ;EAAA,mBAoBIL,KApBJ,CAIEM,KAJF;EAAA,IAIEA,KAJF,6BAIU,SAJV;EAAA,IAKSC,SALT,GAoBIP,KApBJ,CAKEQ,KALF;EAAA,0BAoBIR,KApBJ,CAMES,YANF;E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select.js","names":["forwardRef","useState","useRef","useEffect","useId","wrapEvent","assignMultipleRefs","useControlledState","useTheme","Select","SelectComp","SelectButton","FilledContainer","HelperText","OutlinedContainer","SelectProvider","Menu","MenuPopover","MenuList","SelectIcon","makeDefaultRender","Box","IconContainer","listItemStyle","componentMap","outlined","filled","props","forwardedRef","idProp","id","name","variant","color","valueProp","value","defaultValue","disabled","error","label","placeholder","helperTextProp","helperText","onChangeProp","onChange","onFocus","onBlur","native","children","renderValueProp","renderValue","leadingIcon","overwrittenContainer","CustomContainer","otherProps","setState","e","v","hasFocus","setHasFocus","buttonRef","open","setOpen","fallbackId","theme","Container","handleFocus","handleBlur","handleToggle","isOpen","handleOnChange","target","currentTarget","dataset","hasError","Boolean","inputId","helperTextId","undefined","labelIsFloating","Comp","current","onSelect","minWidth","offsetWidth"],"sources":["../../../src/Select/Select.tsx"],"sourcesContent":["import type {\n SelectHTMLAttributes,\n ReactNode,\n ChangeEvent,\n ComponentType,\n} from 'react';\nimport { forwardRef, useState, useRef, useEffect, useId } from 'react';\nimport {\n wrapEvent,\n assignMultipleRefs,\n useControlledState,\n} from '@basic-ui/core';\n\nimport type { Theme } from '../theme';\nimport { useTheme } from '../theme';\nimport { Select as SelectComp, SelectButton } from './styledComponents';\nimport type { FilledContainerProps } from '../TextField/FilledContainer';\nimport { FilledContainer } from '../TextField/FilledContainer';\nimport { HelperText } from '../TextField/HelperText';\nimport { OutlinedContainer } from '../TextField/OutlinedContainer';\nimport { SelectProvider } from './context';\nimport { Menu, MenuPopover, MenuList } from '../Menu';\nimport { SelectIcon } from './SelectIcon';\nimport { makeDefaultRender } from './defaultRender';\nimport type { BoxProps } from '../Box';\nimport { Box } from '../Box';\nimport { IconContainer } from '../TextField/IconContainer';\nimport { listItemStyle } from '../ListItem';\n\nconst componentMap = {\n outlined: OutlinedContainer,\n filled: FilledContainer,\n};\n\nexport interface SelectProps\n extends Omit<\n BoxProps<HTMLSelectElement, SelectHTMLAttributes<HTMLSelectElement>>,\n 'value' | 'defaultValue' | 'onChange'\n > {\n variant?: 'outlined' | 'filled';\n color?: 'primary' | 'secondary';\n label?: ReactNode;\n helperText?: string;\n defaultValue?: string;\n value?: string;\n native?: boolean;\n theme?: Theme;\n error?: boolean | string;\n onChange?: (e: ChangeEvent<HTMLSelectElement>, value: string) => void;\n renderValue?: (value?: string) => string | undefined;\n leadingIcon?: ReactNode;\n CustomContainer?: ComponentType<FilledContainerProps>;\n}\n\nexport const Select = forwardRef<\n HTMLSelectElement | HTMLButtonElement,\n SelectProps\n>(function Select(props, forwardedRef) {\n const {\n id: idProp,\n name,\n variant = 'outlined',\n color = 'primary',\n value: valueProp,\n defaultValue = '',\n disabled,\n error = false,\n label = null,\n placeholder,\n helperText: helperTextProp,\n onChange: onChangeProp,\n onFocus,\n onBlur,\n native = false,\n children,\n renderValue: renderValueProp,\n leadingIcon = null,\n CustomContainer: overwrittenContainer,\n ...otherProps\n } = props;\n const [value, onChange] = useControlledState(\n valueProp,\n onChangeProp,\n defaultValue,\n (setState) => (e, v) => {\n setState(v);\n }\n );\n const [hasFocus, setHasFocus] = useState(false);\n const buttonRef = useRef<HTMLButtonElement | HTMLSelectElement>();\n const [open, setOpen] = useState(false);\n const fallbackId = useId();\n const theme = useTheme();\n\n const Container =\n overwrittenContainer || componentMap[variant] || OutlinedContainer;\n\n const handleFocus = () => {\n setHasFocus(true);\n };\n\n const handleBlur = () => {\n setHasFocus(false);\n };\n\n const handleToggle = (e: unknown, isOpen: boolean) => {\n setOpen(isOpen);\n };\n\n const handleOnChange = (e: any) => {\n onChange &&\n onChange(\n e as any,\n native ? e.target.value : e.currentTarget.dataset.value\n );\n };\n\n const hasError = Boolean(error);\n const helperText = typeof error === 'string' ? error : helperTextProp;\n\n const id = idProp || fallbackId;\n const inputId = `${id}-text-field`;\n const helperTextId = helperText ? `${id}-helper-text` : undefined;\n\n const renderValue = renderValueProp || makeDefaultRender(children);\n\n const labelIsFloating = hasFocus || open || renderValue(value) !== undefined;\n\n const Comp: ComponentType<any> = native\n ? (SelectComp as any)\n : (SelectButton as any);\n\n useEffect(() => {\n // right after mounting, if the default value in the select element\n // is different than the value we have stored in state we need to\n // update our state to reflect that.\n if (native && buttonRef.current && buttonRef.current.value !== value) {\n onChange && onChange({} as any, buttonRef.current.value);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <SelectProvider value={{ native, onSelect: handleOnChange, value }}>\n <Box display=\"inline-flex\" flexDirection=\"column\" width=\"100%\">\n {!native && <input type=\"hidden\" name={name} value={value} />}\n <Container\n theme={theme}\n label={label}\n color={color}\n labelIsFloating={labelIsFloating}\n inputId={inputId}\n hasFocus={hasFocus}\n disabled={disabled ?? false}\n forceActive={open}\n error={hasError}\n leadingIcon={Boolean(leadingIcon)}\n >\n <Menu onChange={handleToggle} open={open}>\n {leadingIcon && (\n <IconContainer position=\"start\">{leadingIcon}</IconContainer>\n )}\n <Comp\n ref={assignMultipleRefs(forwardedRef, buttonRef)}\n variant={variant}\n id={inputId}\n onFocus={wrapEvent(onFocus, handleFocus)}\n onBlur={wrapEvent(onBlur, handleBlur)}\n onChange={native ? handleOnChange : undefined}\n value={native ? value : undefined}\n theme={theme}\n placeholder={placeholder}\n disabled={disabled}\n aria-disabled={disabled ? 'true' : undefined}\n aria-describedby={helperTextId}\n hasLabel={!!label}\n leadingIcon={Boolean(leadingIcon)}\n name={native ? name : undefined}\n trailingIcon={true}\n {...otherProps}\n >\n {native ? children : renderValue(value)}\n </Comp>\n {!native && (\n <MenuPopover usePortal>\n <MenuList\n defaultActiveItemValue={value}\n style={{\n minWidth: buttonRef?.current?.offsetWidth,\n }}\n role=\"listbox\"\n __css={{\n '& [data-menu-item=\"\"]': {\n ...listItemStyle('primary'),\n },\n }}\n >\n {children}\n </MenuList>\n </MenuPopover>\n )}\n </Menu>\n <SelectIcon open={open} />\n </Container>\n\n <HelperText\n disabled={disabled}\n id={helperTextId}\n leftSide={helperText}\n error={hasError}\n />\n </Box>\n </SelectProv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 +10,4 @@ export interface SwitchProps extends BoxProps<HTMLInputElement, InputHTMLAttribu
|
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
}>;
|
|
12
12
|
}
|
|
13
|
-
export declare const Switch: import("react").ForwardRefExoticComponent<Pick<SwitchProps, "
|
|
13
|
+
export declare const Switch: import("react").ForwardRefExoticComponent<Pick<SwitchProps, "form" | "p" | "slot" | "style" | "title" | "pattern" | "bottom" | "top" | "hidden" | "left" | "right" | "as" | "sx" | "__css" | "variant" | "tx" | "theme" | "m" | "margin" | "mt" | "marginTop" | "mr" | "marginRight" | "mb" | "marginBottom" | "ml" | "marginLeft" | "mx" | "marginX" | "my" | "marginY" | "padding" | "pt" | "paddingTop" | "pr" | "paddingRight" | "pb" | "paddingBottom" | "pl" | "paddingLeft" | "px" | "paddingX" | "py" | "paddingY" | "width" | "height" | "minWidth" | "minHeight" | "maxWidth" | "maxHeight" | "display" | "verticalAlign" | "size" | "overflow" | "overflowX" | "overflowY" | "fontFamily" | "fontSize" | "fontWeight" | "lineHeight" | "letterSpacing" | "fontStyle" | "textAlign" | "color" | "bg" | "backgroundColor" | "opacity" | "alignItems" | "alignContent" | "justifyItems" | "justifyContent" | "flexWrap" | "flexDirection" | "flex" | "flexGrow" | "flexShrink" | "flexBasis" | "justifySelf" | "alignSelf" | "order" | "border" | "borderX" | "borderY" | "borderWidth" | "borderTopWidth" | "borderBottomWidth" | "borderLeftWidth" | "borderRightWidth" | "borderStyle" | "borderTopStyle" | "borderBottomStyle" | "borderLeftStyle" | "borderRightStyle" | "borderColor" | "borderTopColor" | "borderBottomColor" | "borderLeftColor" | "borderRightColor" | "borderRadius" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "gridGap" | "gridColumnGap" | "gridRowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "background" | "backgroundImage" | "backgroundSize" | "backgroundPosition" | "backgroundRepeat" | "position" | "zIndex" | "boxShadow" | "textShadow" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "disabled" | "enterKeyHint" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "placeholder" | "readOnly" | "required" | "src" | "step" | "type" | "value" | "onChange" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "icon" | "key"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
4
4
|
var _excluded = ["as", "disabled", "checked", "onChange", "size", "__css", "icon"],
|
|
5
5
|
_excluded2 = ["as", "icon", "disabled", "children"];
|
|
6
6
|
import { cloneElement, forwardRef } from 'react';
|
|
@@ -15,14 +15,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
15
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
var CheckBoxCore = _CheckBoxCore;
|
|
17
17
|
|
|
18
|
-
function getSizeCssVariables(size) {
|
|
19
|
-
var _ref;
|
|
18
|
+
function getSizeCssVariables(size, hasIcon) {
|
|
19
|
+
var _extends2, _ref;
|
|
20
20
|
|
|
21
21
|
var multiplier = size === 'small' ? 0.75 : 1;
|
|
22
22
|
var BORDER_WIDTH = 2;
|
|
23
23
|
var TRAIL_WIDTH = 52 * multiplier;
|
|
24
24
|
var TRAIL_HEIGHT = 32 * multiplier;
|
|
25
|
-
return
|
|
25
|
+
return _extends((_extends2 = {}, _defineProperty(_extends2, '--switch-border-width', rem(BORDER_WIDTH)), _defineProperty(_extends2, '--switch-trail-width', rem(TRAIL_WIDTH)), _defineProperty(_extends2, '--switch-trail-height', rem(TRAIL_HEIGHT)), _defineProperty(_extends2, '--switch-icon-size', rem(TRAIL_HEIGHT / 2)), _defineProperty(_extends2, '--switch-state-layer-size', rem(40 * multiplier)), _defineProperty(_extends2, '--switch-thumb-size-checked-inactive', rem(TRAIL_HEIGHT - BORDER_WIDTH * 4)), _defineProperty(_extends2, '--switch-thumb-size-checked-active', rem(TRAIL_HEIGHT - BORDER_WIDTH * 2)), _defineProperty(_extends2, '--switch-thumb-size-unchecked-inactive', rem(TRAIL_HEIGHT / 2)), _defineProperty(_extends2, '--switch-thumb-size-unchecked-active', rem(TRAIL_HEIGHT - BORDER_WIDTH * 2)), _extends2), hasIcon && (_ref = {}, _defineProperty(_ref, '--switch-thumb-size-unchecked-inactive', 'var(--switch-thumb-size-checked-inactive)'), _defineProperty(_ref, '--switch-thumb-size-unchecked-active', 'var(--switch-thumb-size-checked-active)'), _ref));
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
var SwitchInner = /*#__PURE__*/forwardRef(function SwitchInner(props, forwardedRef) {
|
|
@@ -45,7 +45,7 @@ var SwitchInner = /*#__PURE__*/forwardRef(function SwitchInner(props, forwardedR
|
|
|
45
45
|
display: "inline-block",
|
|
46
46
|
position: "relative",
|
|
47
47
|
minWidth: "auto",
|
|
48
|
-
sx: getSizeCssVariables(size),
|
|
48
|
+
sx: getSizeCssVariables(size, Boolean(icon)),
|
|
49
49
|
children: [/*#__PURE__*/_jsx(SwitchTrail, {
|
|
50
50
|
checked: checked,
|
|
51
51
|
disabled: disabled
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.js","names":["cloneElement","forwardRef","CheckBox","_CheckBoxCore","rem","RippleBox","Box","useTheme","SelectionControlLabel","SelectionControlText","SwitchTrail","SwitchThumb","SwitchCircle","CheckBoxCore","getSizeCssVariables","size","multiplier","BORDER_WIDTH","TRAIL_WIDTH","TRAIL_HEIGHT","SwitchInner","props","forwardedRef","as","Comp","disabled","checked","onChange","__css","icon","otherProps","color","theme","top","left","backgroundColor","transform","width","height","appearance","outline","border","borderRadius","zIndex","position","Switch","children","inner"],"sources":["../../../src/Switch/Switch.tsx"],"sourcesContent":["import type { ElementType, FC, InputHTMLAttributes, ReactElement } from 'react';\nimport { cloneElement, forwardRef } from 'react';\nimport { CheckBox as _CheckBoxCore } from '@basic-ui/core';\nimport { rem } from 'polished';\n\nimport type { RippleBoxProps } from '../Ripple';\nimport { RippleBox } from '../Ripple';\nimport type { BoxProps } from '../Box';\nimport { Box } from '../Box';\nimport { useTheme } from '../theme';\nimport {\n SelectionControlLabel,\n SelectionControlText,\n} from '../SelectionControl';\nimport { SwitchTrail, SwitchThumb, SwitchCircle } from './styledComponents';\n\nconst CheckBoxCore: FC<\n SwitchProps & {\n innerAs?: ElementType<any>;\n }\n> = _CheckBoxCore as any;\n\nexport interface SwitchProps\n extends BoxProps<HTMLInputElement, InputHTMLAttributes<HTMLInputElement>> {\n as?: ElementType<any>;\n checked?: boolean;\n disabled?: boolean;\n size?: 'small' | 'default';\n icon?: ReactElement<{ checked?: boolean; disabled?: boolean }>;\n}\n\nfunction getSizeCssVariables(size: 'small' | 'default') {\n const multiplier = size === 'small' ? 0.75 : 1;\n const BORDER_WIDTH = 2;\n const TRAIL_WIDTH = 52 * multiplier;\n const TRAIL_HEIGHT = 32 * multiplier;\n return {\n ['--switch-border-width']: rem(BORDER_WIDTH),\n ['--switch-trail-width']: rem(TRAIL_WIDTH),\n ['--switch-trail-height']: rem(TRAIL_HEIGHT),\n ['--switch-icon-size']: rem(TRAIL_HEIGHT / 2),\n ['--switch-state-layer-size']: rem(40 * multiplier),\n ['--switch-thumb-size-checked-inactive']: rem(\n TRAIL_HEIGHT - BORDER_WIDTH * 4\n ),\n ['--switch-thumb-size-checked-active']: rem(\n TRAIL_HEIGHT - BORDER_WIDTH * 2\n ),\n ['--switch-thumb-size-unchecked-inactive']: rem(TRAIL_HEIGHT / 2),\n ['--switch-thumb-size-unchecked-active']: rem(\n TRAIL_HEIGHT - BORDER_WIDTH * 2\n ),\n };\n}\n\nconst SwitchInner = forwardRef<HTMLInputElement, SwitchProps>(\n function SwitchInner(props, forwardedRef) {\n const {\n as: Comp = 'input',\n disabled,\n checked,\n onChange,\n size = 'default',\n __css,\n icon,\n ...otherProps\n } = props;\n const color = checked ? 'primary' : 'on.surface';\n const theme = useTheme();\n\n return (\n <Box\n display=\"inline-block\"\n position=\"relative\"\n minWidth=\"auto\"\n sx={getSizeCssVariables(size)}\n >\n <SwitchTrail checked={checked} disabled={disabled} />\n <SwitchThumb checked={checked}>\n <RippleBox<\n RippleBoxProps<\n HTMLInputElement,\n InputHTMLAttributes<HTMLInputElement>\n >\n >\n as={Comp}\n role=\"switch\"\n type=\"checkbox\"\n checked={checked}\n onChange={onChange}\n theme={theme}\n ref={forwardedRef}\n aria-checked={checked ? 'true' : 'false'}\n rippleColor={color}\n baseOpacity={0}\n hoverOpacity={0.04}\n focusOpacity={0.12}\n center={true}\n disabled={disabled}\n data-switch-thumb=\"\"\n {...otherProps}\n __css={{\n top: '50%',\n left: '50%',\n backgroundColor: 'transparent',\n transform: 'translate(-50%, -50%)',\n width: '100%',\n height: '100%',\n appearance: 'none',\n ':focus': {\n outline: 'none',\n },\n border: 'none',\n borderRadius: 'full',\n zIndex: 1,\n position: 'absolute',\n ...__css,\n }}\n />\n <SwitchCircle checked={checked}>\n {icon\n ? cloneElement(icon, {\n checked,\n ['data-checkbox-icon' as any]: '',\n disabled,\n })\n : null}\n </SwitchCircle>\n </SwitchThumb>\n </Box>\n );\n }\n);\n\nexport const Switch = forwardRef<HTMLInputElement, SwitchProps>(function Switch(\n props,\n forwardedRef\n) {\n const { as = 'input', icon, disabled, children, ...otherProps } = props;\n\n const inner = (\n <CheckBoxCore\n as={SwitchInner}\n innerAs={as}\n ref={forwardedRef}\n icon={icon}\n disabled={disabled}\n {...otherProps}\n />\n );\n\n if (!children) {\n return inner;\n }\n\n return (\n <SelectionControlLabel>\n {inner}\n <SelectionControlText disabled={disabled}>\n {children}\n </SelectionControlText>\n </SelectionControlLabel>\n );\n});\n"],"mappings":";;;;;AACA,SAASA,YAAT,EAAuBC,UAAvB,QAAyC,OAAzC;AACA,SAASC,QAAQ,IAAIC,aAArB,QAA0C,gBAA1C;AACA,SAASC,GAAT,QAAoB,UAApB;AAGA,SAASC,SAAT,QAA0B,WAA1B;AAEA,SAASC,GAAT,QAAoB,QAApB;AACA,SAASC,QAAT,QAAyB,UAAzB;AACA,SACEC,qBADF,EAEEC,oBAFF,QAGO,qBAHP;AAIA,SAASC,WAAT,EAAsBC,WAAtB,EAAmCC,YAAnC,QAAuD,oBAAvD;;;AAEA,IAAMC,YAIL,GAAGV,aAJJ;;AAeA,SAASW,mBAAT,CAA6BC,IAA7B,
|
|
1
|
+
{"version":3,"file":"Switch.js","names":["cloneElement","forwardRef","CheckBox","_CheckBoxCore","rem","RippleBox","Box","useTheme","SelectionControlLabel","SelectionControlText","SwitchTrail","SwitchThumb","SwitchCircle","CheckBoxCore","getSizeCssVariables","size","hasIcon","multiplier","BORDER_WIDTH","TRAIL_WIDTH","TRAIL_HEIGHT","SwitchInner","props","forwardedRef","as","Comp","disabled","checked","onChange","__css","icon","otherProps","color","theme","Boolean","top","left","backgroundColor","transform","width","height","appearance","outline","border","borderRadius","zIndex","position","Switch","children","inner"],"sources":["../../../src/Switch/Switch.tsx"],"sourcesContent":["import type { ElementType, FC, InputHTMLAttributes, ReactElement } from 'react';\nimport { cloneElement, forwardRef } from 'react';\nimport { CheckBox as _CheckBoxCore } from '@basic-ui/core';\nimport { rem } from 'polished';\n\nimport type { RippleBoxProps } from '../Ripple';\nimport { RippleBox } from '../Ripple';\nimport type { BoxProps } from '../Box';\nimport { Box } from '../Box';\nimport { useTheme } from '../theme';\nimport {\n SelectionControlLabel,\n SelectionControlText,\n} from '../SelectionControl';\nimport { SwitchTrail, SwitchThumb, SwitchCircle } from './styledComponents';\n\nconst CheckBoxCore: FC<\n SwitchProps & {\n innerAs?: ElementType<any>;\n }\n> = _CheckBoxCore as any;\n\nexport interface SwitchProps\n extends BoxProps<HTMLInputElement, InputHTMLAttributes<HTMLInputElement>> {\n as?: ElementType<any>;\n checked?: boolean;\n disabled?: boolean;\n size?: 'small' | 'default';\n icon?: ReactElement<{ checked?: boolean; disabled?: boolean }>;\n}\n\nfunction getSizeCssVariables(size: 'small' | 'default', hasIcon: boolean) {\n const multiplier = size === 'small' ? 0.75 : 1;\n const BORDER_WIDTH = 2;\n const TRAIL_WIDTH = 52 * multiplier;\n const TRAIL_HEIGHT = 32 * multiplier;\n return {\n ['--switch-border-width']: rem(BORDER_WIDTH),\n ['--switch-trail-width']: rem(TRAIL_WIDTH),\n ['--switch-trail-height']: rem(TRAIL_HEIGHT),\n ['--switch-icon-size']: rem(TRAIL_HEIGHT / 2),\n ['--switch-state-layer-size']: rem(40 * multiplier),\n ['--switch-thumb-size-checked-inactive']: rem(\n TRAIL_HEIGHT - BORDER_WIDTH * 4\n ),\n ['--switch-thumb-size-checked-active']: rem(\n TRAIL_HEIGHT - BORDER_WIDTH * 2\n ),\n ['--switch-thumb-size-unchecked-inactive']: rem(TRAIL_HEIGHT / 2),\n ['--switch-thumb-size-unchecked-active']: rem(\n TRAIL_HEIGHT - BORDER_WIDTH * 2\n ),\n ...(hasIcon && {\n ['--switch-thumb-size-unchecked-inactive']:\n 'var(--switch-thumb-size-checked-inactive)',\n ['--switch-thumb-size-unchecked-active']:\n 'var(--switch-thumb-size-checked-active)',\n }),\n };\n}\n\nconst SwitchInner = forwardRef<HTMLInputElement, SwitchProps>(\n function SwitchInner(props, forwardedRef) {\n const {\n as: Comp = 'input',\n disabled,\n checked,\n onChange,\n size = 'default',\n __css,\n icon,\n ...otherProps\n } = props;\n const color = checked ? 'primary' : 'on.surface';\n const theme = useTheme();\n\n return (\n <Box\n display=\"inline-block\"\n position=\"relative\"\n minWidth=\"auto\"\n sx={getSizeCssVariables(size, Boolean(icon))}\n >\n <SwitchTrail checked={checked} disabled={disabled} />\n <SwitchThumb checked={checked}>\n <RippleBox<\n RippleBoxProps<\n HTMLInputElement,\n InputHTMLAttributes<HTMLInputElement>\n >\n >\n as={Comp}\n role=\"switch\"\n type=\"checkbox\"\n checked={checked}\n onChange={onChange}\n theme={theme}\n ref={forwardedRef}\n aria-checked={checked ? 'true' : 'false'}\n rippleColor={color}\n baseOpacity={0}\n hoverOpacity={0.04}\n focusOpacity={0.12}\n center={true}\n disabled={disabled}\n data-switch-thumb=\"\"\n {...otherProps}\n __css={{\n top: '50%',\n left: '50%',\n backgroundColor: 'transparent',\n transform: 'translate(-50%, -50%)',\n width: '100%',\n height: '100%',\n appearance: 'none',\n ':focus': {\n outline: 'none',\n },\n border: 'none',\n borderRadius: 'full',\n zIndex: 1,\n position: 'absolute',\n ...__css,\n }}\n />\n <SwitchCircle checked={checked}>\n {icon\n ? cloneElement(icon, {\n checked,\n ['data-checkbox-icon' as any]: '',\n disabled,\n })\n : null}\n </SwitchCircle>\n </SwitchThumb>\n </Box>\n );\n }\n);\n\nexport const Switch = forwardRef<HTMLInputElement, SwitchProps>(function Switch(\n props,\n forwardedRef\n) {\n const { as = 'input', icon, disabled, children, ...otherProps } = props;\n\n const inner = (\n <CheckBoxCore\n as={SwitchInner}\n innerAs={as}\n ref={forwardedRef}\n icon={icon}\n disabled={disabled}\n {...otherProps}\n />\n );\n\n if (!children) {\n return inner;\n }\n\n return (\n <SelectionControlLabel>\n {inner}\n <SelectionControlText disabled={disabled}>\n {children}\n </SelectionControlText>\n </SelectionControlLabel>\n );\n});\n"],"mappings":";;;;;AACA,SAASA,YAAT,EAAuBC,UAAvB,QAAyC,OAAzC;AACA,SAASC,QAAQ,IAAIC,aAArB,QAA0C,gBAA1C;AACA,SAASC,GAAT,QAAoB,UAApB;AAGA,SAASC,SAAT,QAA0B,WAA1B;AAEA,SAASC,GAAT,QAAoB,QAApB;AACA,SAASC,QAAT,QAAyB,UAAzB;AACA,SACEC,qBADF,EAEEC,oBAFF,QAGO,qBAHP;AAIA,SAASC,WAAT,EAAsBC,WAAtB,EAAmCC,YAAnC,QAAuD,oBAAvD;;;AAEA,IAAMC,YAIL,GAAGV,aAJJ;;AAeA,SAASW,mBAAT,CAA6BC,IAA7B,EAAwDC,OAAxD,EAA0E;EAAA;;EACxE,IAAMC,UAAU,GAAGF,IAAI,KAAK,OAAT,GAAmB,IAAnB,GAA0B,CAA7C;EACA,IAAMG,YAAY,GAAG,CAArB;EACA,IAAMC,WAAW,GAAG,KAAKF,UAAzB;EACA,IAAMG,YAAY,GAAG,KAAKH,UAA1B;EACA,4DACG,uBADH,EAC6Bb,GAAG,CAACc,YAAD,CADhC,8BAEG,sBAFH,EAE4Bd,GAAG,CAACe,WAAD,CAF/B,8BAGG,uBAHH,EAG6Bf,GAAG,CAACgB,YAAD,CAHhC,8BAIG,oBAJH,EAI0BhB,GAAG,CAACgB,YAAY,GAAG,CAAhB,CAJ7B,8BAKG,2BALH,EAKiChB,GAAG,CAAC,KAAKa,UAAN,CALpC,8BAMG,sCANH,EAM4Cb,GAAG,CAC3CgB,YAAY,GAAGF,YAAY,GAAG,CADa,CAN/C,8BASG,oCATH,EAS0Cd,GAAG,CACzCgB,YAAY,GAAGF,YAAY,GAAG,CADW,CAT7C,8BAYG,wCAZH,EAY8Cd,GAAG,CAACgB,YAAY,GAAG,CAAhB,CAZjD,8BAaG,sCAbH,EAa4ChB,GAAG,CAC3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AEE,OAAO,EAAEG,EAFX;IAGE,GAAG,EAAED,YAHP;IAIE,IAAI,EAAEO,IAJR;IAKE,QAAQ,EAAEJ;EALZ,GAMMK,UANN,EADF;;EAWA,IAAI,CAACiB,QAAL,EAAe;IACb,OAAOC,KAAP;EACD;;EAED,oBACE,MAAC,qBAAD;IAAA,WACGA,KADH,eAEE,KAAC,oBAAD;MAAsB,QAAQ,EAAEvB,QAAhC;MAAA,UACGsB;IADH,EAFF;EAAA,EADF;AAQD,CA7B+B,CAAzB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { TableBodyProps } from './TableBody';
|
|
3
3
|
export declare type TableHeadProps = TableBodyProps;
|
|
4
|
-
export declare const TableHead: import("react").ForwardRefExoticComponent<Pick<TableBodyProps, "
|
|
4
|
+
export declare const TableHead: import("react").ForwardRefExoticComponent<Pick<TableBodyProps, "hidden" | keyof import("..").BaseProps | keyof import("styled-system").SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> | keyof import("styled-system").LayoutProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | keyof import("styled-system").TypographyProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | keyof import("styled-system").ColorProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> | keyof import("styled-system").FlexboxProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | keyof import("styled-system").BorderProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Border<import("styled-system").TLengthStyledSystem>> | keyof import("styled-system").GridProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | keyof import("styled-system").BackgroundProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Background<import("styled-system").TLengthStyledSystem>> | keyof import("styled-system").PositionProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | keyof import("styled-system").ShadowProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { BoxProps } from '../Box';
|
|
3
|
+
export declare const FilledContainerOverlay: (props: {
|
|
4
|
+
forceActive?: boolean;
|
|
5
|
+
}) => JSX.Element;
|
|
3
6
|
export interface FilledContainerProps extends Omit<BoxProps, 'color'> {
|
|
4
7
|
children?: ReactNode;
|
|
5
8
|
color?: string;
|
|
@@ -12,4 +15,4 @@ export interface FilledContainerProps extends Omit<BoxProps, 'color'> {
|
|
|
12
15
|
forceActive?: boolean;
|
|
13
16
|
leadingIcon?: boolean;
|
|
14
17
|
}
|
|
15
|
-
export declare const FilledContainer: import("react").ForwardRefExoticComponent<Pick<FilledContainerProps, "
|
|
18
|
+
export declare const FilledContainer: import("react").ForwardRefExoticComponent<Pick<FilledContainerProps, "disabled" | "bottom" | "top" | "hidden" | "left" | "right" | "as" | "sx" | "__css" | "variant" | "tx" | "theme" | "m" | "margin" | "mt" | "marginTop" | "mr" | "marginRight" | "mb" | "marginBottom" | "ml" | "marginLeft" | "mx" | "marginX" | "my" | "marginY" | "p" | "padding" | "pt" | "paddingTop" | "pr" | "paddingRight" | "pb" | "paddingBottom" | "pl" | "paddingLeft" | "px" | "paddingX" | "py" | "paddingY" | "width" | "height" | "minWidth" | "minHeight" | "maxWidth" | "maxHeight" | "display" | "verticalAlign" | "size" | "overflow" | "overflowX" | "overflowY" | "fontFamily" | "fontSize" | "fontWeight" | "lineHeight" | "letterSpacing" | "fontStyle" | "textAlign" | "color" | "bg" | "backgroundColor" | "opacity" | "alignItems" | "alignContent" | "justifyItems" | "justifyContent" | "flexWrap" | "flexDirection" | "flex" | "flexGrow" | "flexShrink" | "flexBasis" | "justifySelf" | "alignSelf" | "order" | "border" | "borderX" | "borderY" | "borderWidth" | "borderTopWidth" | "borderBottomWidth" | "borderLeftWidth" | "borderRightWidth" | "borderStyle" | "borderTopStyle" | "borderBottomStyle" | "borderLeftStyle" | "borderRightStyle" | "borderColor" | "borderTopColor" | "borderBottomColor" | "borderLeftColor" | "borderRightColor" | "borderRadius" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "gridGap" | "gridColumnGap" | "gridRowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "background" | "backgroundImage" | "backgroundSize" | "backgroundPosition" | "backgroundRepeat" | "position" | "zIndex" | "boxShadow" | "textShadow" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "hasFocus" | "label" | "labelIsFloating" | "inputId" | "error" | "forceActive" | "leadingIcon"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -14,10 +14,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
15
|
|
|
16
16
|
var makeSelector = function makeSelector(state) {
|
|
17
|
-
return "input:".concat(state, " ~ &,") + "select:".concat(state, " ~ &,") + "button:".concat(state, " ~ &,") + "textarea:".concat(state, " ~ &");
|
|
17
|
+
return "input:".concat(state, " ~ &,") + "select:".concat(state, " ~ &,") + "button:".concat(state, " ~ &,") + "textarea:".concat(state, " ~ &,") + "[role=\"button\"]:".concat(state, " ~ &");
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
export var FilledContainerOverlay = function FilledContainerOverlay(props) {
|
|
21
21
|
var _extends2;
|
|
22
22
|
|
|
23
23
|
var forceActive = props.forceActive;
|
|
@@ -46,7 +46,7 @@ var Overlay = function Overlay(props) {
|
|
|
46
46
|
});
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
var
|
|
49
|
+
var FilledContainerBorderBottom = function FilledContainerBorderBottom() {
|
|
50
50
|
return /*#__PURE__*/_jsx(Box, {
|
|
51
51
|
__css: _defineProperty({
|
|
52
52
|
position: 'absolute',
|
|
@@ -117,9 +117,9 @@ export var FilledContainer = /*#__PURE__*/forwardRef(function FilledContainer(pr
|
|
|
117
117
|
htmlFor: inputId,
|
|
118
118
|
color: active || error ? color : undefined,
|
|
119
119
|
children: label
|
|
120
|
-
}), children, /*#__PURE__*/_jsx(
|
|
120
|
+
}), children, /*#__PURE__*/_jsx(FilledContainerOverlay, {
|
|
121
121
|
forceActive: active
|
|
122
|
-
}), /*#__PURE__*/_jsx(
|
|
122
|
+
}), /*#__PURE__*/_jsx(FilledContainerBorderBottom, {}), /*#__PURE__*/_jsx(LineRipple, {
|
|
123
123
|
active: active || error,
|
|
124
124
|
color: color
|
|
125
125
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilledContainer.js","names":["forwardRef","get","useTheme","FloatingLabel","LineRipple","alpha","Box","ICON_WIDTH","PADDING_LEFT_WITHOUT_ICON","PADDING_LEFT_WITH_ICON","makeSelector","state","
|
|
1
|
+
{"version":3,"file":"FilledContainer.js","names":["forwardRef","get","useTheme","FloatingLabel","LineRipple","alpha","Box","ICON_WIDTH","PADDING_LEFT_WITHOUT_ICON","PADDING_LEFT_WITH_ICON","makeSelector","state","FilledContainerOverlay","props","forceActive","theme","position","top","bottom","left","right","backgroundColor","pointerEvents","opacity","cursor","color","FilledContainerBorderBottom","width","height","FilledContainer","forwardedRef","label","labelIsFloating","inputId","hasFocus","colorProp","children","error","disabled","leadingIcon","otherProps","finalLabelHeight","labelHeight","inputHeight","active","lineHeight","overflow","boxSizing","borderTopRightRadius","borderTopLeftRadius","undefined"],"sources":["../../../src/TextField/FilledContainer.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { forwardRef } from 'react';\nimport { get } from '@styled-system/css';\nimport { rem } from 'polished';\n\nimport { useTheme } from '../theme';\nimport { FloatingLabel } from '../FloatingLabel';\nimport { LineRipple } from '../LineRipple';\nimport { alpha } from '../color';\nimport type { BoxProps } from '../Box';\nimport { Box } from '../Box';\nimport {\n ICON_WIDTH,\n PADDING_LEFT_WITHOUT_ICON,\n PADDING_LEFT_WITH_ICON,\n} from './consts';\n\nconst makeSelector = (\n state:\n | 'hover:not([disabled]):not(:focus)'\n | 'focus:not([disabled])'\n | 'disabled'\n) =>\n `input:${state} ~ &,` +\n `select:${state} ~ &,` +\n `button:${state} ~ &,` +\n `textarea:${state} ~ &,` +\n `[role=\"button\"]:${state} ~ &`;\n\nexport const FilledContainerOverlay = (props: { forceActive?: boolean }) => {\n const { forceActive } = props;\n const theme = useTheme();\n\n return (\n <Box\n __css={{\n position: 'absolute',\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n backgroundColor: 'on.surface',\n pointerEvents: 'none',\n opacity: 0,\n [makeSelector('hover:not([disabled]):not(:focus)')]: !forceActive && {\n opacity: get(theme, `buttons.overlays.filled.hover.opacity`),\n },\n [makeSelector('focus:not([disabled])')]: {\n opacity: get(theme, `buttons.overlays.transparent.focus.opacity`),\n },\n [makeSelector('disabled')]: {\n cursor: 'default',\n color: alpha('on.surface', 0.6),\n opacity: 0.02,\n },\n ...(forceActive && {\n opacity: get(theme, `buttons.overlays.transparent.focus.opacity`),\n }),\n }}\n />\n );\n};\n\nconst FilledContainerBorderBottom = () => (\n <Box\n __css={{\n position: 'absolute',\n bottom: 0,\n left: 0,\n width: '100%',\n height: rem(1),\n backgroundColor: alpha('on.surface', 0.6),\n pointerEvents: 'none',\n [makeSelector('disabled')]: {\n backgroundColor: 'transparent',\n },\n }}\n />\n);\n\nexport interface FilledContainerProps extends Omit<BoxProps, 'color'> {\n children?: ReactNode;\n color?: string;\n hasFocus?: boolean;\n label?: ReactNode;\n labelIsFloating: boolean;\n inputId: string;\n error?: boolean;\n disabled?: boolean;\n forceActive?: boolean;\n leadingIcon?: boolean;\n}\n\nexport const FilledContainer = forwardRef<HTMLDivElement, FilledContainerProps>(\n function FilledContainer(props, forwardedRef) {\n const {\n label,\n labelIsFloating,\n inputId,\n hasFocus,\n color: colorProp,\n children,\n error = false,\n disabled = false,\n forceActive = false,\n leadingIcon,\n ...otherProps\n } = props;\n\n const finalLabelHeight = 16;\n const labelHeight = finalLabelHeight / 0.75;\n const inputHeight = 56;\n\n const color = error ? 'error' : colorProp;\n const active = hasFocus || forceActive;\n\n return (\n <Box\n ref={forwardedRef}\n disabled={disabled}\n active={active || error}\n __css={{\n position: 'relative',\n lineHeight: 0,\n width: '100%',\n backgroundColor: 'surface-variant',\n overflow: 'hidden',\n boxSizing: 'border-box',\n borderTopRightRadius: rem(4),\n borderTopLeftRadius: rem(4),\n color: alpha('on.surface-variant', 0.87),\n ...(disabled && {\n backgroundColor: alpha('on.surface-variant', 0.08),\n color: alpha('on.surface-variant', 0.38),\n }),\n ...(active && { color: 'primary' }),\n }}\n {...otherProps}\n >\n {label && (\n <FloatingLabel\n height={inputHeight}\n offsetX={\n leadingIcon\n ? PADDING_LEFT_WITH_ICON +\n ICON_WIDTH +\n PADDING_LEFT_WITHOUT_ICON\n : PADDING_LEFT_WITHOUT_ICON\n }\n translateX={0}\n translateY={\n // To debug, delete these lines one by one to see it doing its work\n -(inputHeight * 0.5) + // Put it at the top, crossing middle label\n labelHeight * 0.75 * 0.5 + // Put it at position 0\n 8 // Add a 8px padding to the top\n }\n active={labelIsFloating}\n htmlFor={inputId}\n color={active || error ? color : undefined}\n >\n {label}\n </FloatingLabel>\n )}\n\n {children}\n\n <FilledContainerOverlay forceActive={active} />\n <FilledContainerBorderBottom />\n <LineRipple active={active || error} color={color} />\n </Box>\n );\n }\n);\n"],"mappings":";;;;AACA,SAASA,UAAT,QAA2B,OAA3B;AACA,SAASC,GAAT,QAAoB,oBAApB;AAGA,SAASC,QAAT,QAAyB,UAAzB;AACA,SAASC,aAAT,QAA8B,kBAA9B;AACA,SAASC,UAAT,QAA2B,eAA3B;AACA,SAASC,KAAT,QAAsB,UAAtB;AAEA,SAASC,GAAT,QAAoB,QAApB;AACA,SACEC,UADF,EAEEC,yBAFF,EAGEC,sBAHF,QAIO,UAJP;;;;AAMA,IAAMC,YAAY,GAAG,SAAfA,YAAe,CACnBC,KADmB;EAAA,OAMnB,gBAASA,KAAT,8BACUA,KADV,8BAEUA,KAFV,gCAGYA,KAHZ,yCAImBA,KAJnB,SANmB;AAAA,CAArB;;AAYA,OAAO,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAyB,CAACC,KAAD,EAAsC;EAAA;;EAC1E,IAAQC,WAAR,GAAwBD,KAAxB,CAAQC,WAAR;EACA,IAAMC,KAAK,GAAGb,QAAQ,EAAtB;EAEA,oBACE,KAAC,GAAD;IACE,KAAK;MACHc,QAAQ,EAAE,UADP;MAEHC,GAAG,E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AEnB,KAAK,EAAE;IAAT,CAdX;EAJP,GAoBMe,UApBN;IAAA,WAsBGT,KAAK,iBACJ,KAAC,aAAD;MACE,MAAM,EAAEY,WADV;MAEE,OAAO,EACLJ,WAAW,GACP9B,sBAAsB,GACtBF,UADA,GAEAC,yBAHO,GAIPA,yBAPR;MASE,UAAU,EAAE,CATd;MAUE,UAAU,EACR;MACA,EAAEmC,WAAW,GAAG,GAAhB,IAAuB;MACvBD,WAAW,GAAG,IAAd,GAAqB,GADrB,GAC2B;MAC3B,CAJQ,CAIN;MAdN;MAgBE,MAAM,EAAEV,eAhBV;MAiBE,OAAO,EAAEC,OAjBX;MAkBE,KAAK,EAAEW,MAAM,IAAIP,KAAV,GAAkBZ,KAAlB,GAA0ByB,SAlBnC;MAAA,UAoBGnB;IApBH,EAvBJ,EA+CGK,QA/CH,eAiDE,KAAC,sBAAD;MAAwB,WAAW,EAAEQ;IAArC,EAjDF,eAkDE,KAAC,2BAAD,KAlDF,eAmDE,KAAC,UAAD;MAAY,MAAM,EAAEA,MAAM,IAAIP,KAA9B;MAAqC,KAAK,EAAEZ;IAA5C,EAnDF;EAAA,GADF;AAuDD,CA9EsC,CAAlC"}
|
|
@@ -16,4 +16,4 @@ export declare type TextFieldProps = Omit<InputProps, 'value' | 'defaultValue'>
|
|
|
16
16
|
leadingIcon?: ReactNode;
|
|
17
17
|
trailingIcon?: ReactNode;
|
|
18
18
|
};
|
|
19
|
-
export declare const TextField: import("react").ForwardRefExoticComponent<Pick<TextFieldProps, "
|
|
19
|
+
export declare const TextField: import("react").ForwardRefExoticComponent<Pick<TextFieldProps, "disabled" | "bottom" | "top" | "hidden" | "left" | "right" | "as" | "sx" | "__css" | "variant" | "tx" | "theme" | "m" | "margin" | "mt" | "marginTop" | "mr" | "marginRight" | "mb" | "marginBottom" | "ml" | "marginLeft" | "mx" | "marginX" | "my" | "marginY" | "p" | "padding" | "pt" | "paddingTop" | "pr" | "paddingRight" | "pb" | "paddingBottom" | "pl" | "paddingLeft" | "px" | "paddingX" | "py" | "paddingY" | "width" | "height" | "minWidth" | "minHeight" | "maxWidth" | "maxHeight" | "display" | "verticalAlign" | "size" | "overflow" | "overflowX" | "overflowY" | "fontFamily" | "fontSize" | "fontWeight" | "lineHeight" | "letterSpacing" | "fontStyle" | "textAlign" | "color" | "bg" | "backgroundColor" | "opacity" | "alignItems" | "alignContent" | "justifyItems" | "justifyContent" | "flexWrap" | "flexDirection" | "flex" | "flexGrow" | "flexShrink" | "flexBasis" | "justifySelf" | "alignSelf" | "order" | "border" | "borderX" | "borderY" | "borderWidth" | "borderTopWidth" | "borderBottomWidth" | "borderLeftWidth" | "borderRightWidth" | "borderStyle" | "borderTopStyle" | "borderBottomStyle" | "borderLeftStyle" | "borderRightStyle" | "borderColor" | "borderTopColor" | "borderBottomColor" | "borderLeftColor" | "borderRightColor" | "borderRadius" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "gridGap" | "gridColumnGap" | "gridRowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "background" | "backgroundImage" | "backgroundSize" | "backgroundPosition" | "backgroundRepeat" | "position" | "zIndex" | "boxShadow" | "textShadow" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "label" | "error" | "leadingIcon" | "form" | "pattern" | "list" | "step" | "autoComplete" | "autoFocus" | "multiple" | "name" | "required" | "value" | "helperText" | "hasLabel" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "type" | "max" | "min" | "crossOrigin" | "accept" | "alt" | "capture" | "checked" | "enterKeyHint" | "maxLength" | "minLength" | "readOnly" | "src" | "multiline" | "trailingIcon" | "containerProps" | "hideCharacterCounter"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import { useState, useMemo, useEffect } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { argbFromHex, hexFromArgb, TonalPalette, HCT } from '@material/material-color-utilities';
|
|
5
5
|
import { toColor } from '@basic-ui/color-picker';
|
|
6
6
|
import { THEME_OVERRIDE_STORAGE_KEY, injectThemeOverride, transformTheme, loadGoogleFont } from '@basic-ui/dynamic-theme';
|
|
7
7
|
import { rem } from 'polished';
|
|
@@ -88,7 +88,18 @@ var ThemeBuilderImpl = function ThemeBuilderImpl(props) {
|
|
|
88
88
|
setPrimaryColor = _useLocalStorageCache16[1];
|
|
89
89
|
|
|
90
90
|
var _useMemo = useMemo(function () {
|
|
91
|
-
|
|
91
|
+
/* This is from CorePalette.of(...) */
|
|
92
|
+
var argb = argbFromHex(primaryColor.hex);
|
|
93
|
+
var hct = HCT.fromInt(argb);
|
|
94
|
+
var hue = hct.hue;
|
|
95
|
+
return {
|
|
96
|
+
a1: TonalPalette.fromHueAndChroma(hue, Math.max(48, hct.chroma)),
|
|
97
|
+
a2: TonalPalette.fromHueAndChroma(hue, 16),
|
|
98
|
+
a3: TonalPalette.fromHueAndChroma(hue + 60, 24),
|
|
99
|
+
n1: TonalPalette.fromHueAndChroma(hue, 6),
|
|
100
|
+
n2: TonalPalette.fromHueAndChroma(hue, 8),
|
|
101
|
+
error: TonalPalette.fromHueAndChroma(25, 84)
|
|
102
|
+
};
|
|
92
103
|
}, [primaryColor.hex]),
|
|
93
104
|
a1 = _useMemo.a1,
|
|
94
105
|
a2 = _useMemo.a2,
|