@react-aria/color 3.0.0-beta.4 → 3.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +403 -501
- package/dist/main.js.map +1 -1
- package/dist/module.js +388 -462
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/useColorField.ts +2 -0
- package/src/useColorWheel.ts +43 -27
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAuCA;;;;OAIO,SAASA,cAAT,CAAwBC,KAAxB,EAAuDC,KAAvD,EAAiG;AACtG,MAAI;AAACC,IAAAA,QAAD;AAAWC,IAAAA,QAAX;AAAqBC,IAAAA,WAArB;AAAkCC,IAAAA,OAAlC;AAA2C,kBAAcC;AAAzD,MAAsEN,KAA1E;AAEA,MAAI;AAACO,IAAAA,MAAD;AAASC,IAAAA;AAAT,MAAsBC,SAAS,EAAnC,CAHsG,CAKtG;;AACA,MAAI,CAACT,KAAK,CAACU,KAAP,IAAgB,CAACJ,SAAjB,IAA8B,CAACN,KAAK,CAAC,iBAAD,CAAxC,EAA6D;AAC3DM,IAAAA,SAAS,GAAGL,KAAK,CAACU,KAAN,CAAYC,cAAZ,CAA2BP,OAA3B,EAAoCE,MAApC,CAAZ;AACD,GARqG,CAUtG;;;AACA,MAAI;AAACM,IAAAA,UAAD;AAAaC,IAAAA,UAAb;AAAyBC,IAAAA,UAAzB;AAAqCC,IAAAA;AAArC,MAAoDC,SAAS,oCAAKjB,KAAL;AAAY,kBAAcM;AAA1B,MAAsCL,KAAtC,EAA6CC,QAA7C,CAAjE;AACA,MAAI;AAACgB,IAAAA,UAAD;AAAaC,IAAAA;AAAb,MAA2BC,cAAc,CAAC;AAC5CC,IAAAA,KAAK,EAAE,CADqC;AAE5CjB,IAAAA,WAF4C;AAG5CkB,IAAAA,UAAU,EAAEtB,KAAK,CAACsB,UAH0B;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@react-aria/color/src/useColorSlider.ts","./packages/@react-aria/color/src/useColorWheel.ts","./packages/@react-aria/color/src/useColorField.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaColorSliderProps} from '@react-types/color';\nimport {ColorSliderState} from '@react-stately/color';\nimport {HTMLAttributes, RefObject} from 'react';\nimport {mergeProps} from '@react-aria/utils';\nimport {useLocale} from '@react-aria/i18n';\nimport {useSlider, useSliderThumb} from '@react-aria/slider';\n\ninterface ColorSliderAriaOptions extends AriaColorSliderProps {\n /** A ref for the track element. */\n trackRef: RefObject<HTMLElement>,\n /** A ref for the input element. */\n inputRef: RefObject<HTMLInputElement>\n}\n\ninterface ColorSliderAria {\n /** Props for the label element. */\n labelProps: HTMLAttributes<HTMLElement>,\n /** Props for the track element. */\n trackProps: HTMLAttributes<HTMLElement>,\n /** Props for the thumb element. */\n thumbProps: HTMLAttributes<HTMLElement>,\n /** Props for the visually hidden range input element. */\n inputProps: HTMLAttributes<HTMLElement>,\n /** Props for the output element, displaying the value of the color slider. */\n outputProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a color slider component.\n * Color sliders allow users to adjust an individual channel of a color value.\n */\nexport function useColorSlider(props: ColorSliderAriaOptions, state: ColorSliderState): ColorSliderAria {\n let {trackRef, inputRef, orientation, channel, 'aria-label': ariaLabel} = props;\n\n let {locale, direction} = useLocale();\n\n // Provide a default aria-label if there is no other label provided.\n if (!props.label && !ariaLabel && !props['aria-labelledby']) {\n ariaLabel = state.value.getChannelName(channel, locale);\n }\n\n // @ts-ignore - ignore unused incompatible props\n let {groupProps, trackProps, labelProps, outputProps} = useSlider({...props, 'aria-label': ariaLabel}, state, trackRef);\n let {inputProps, thumbProps} = useSliderThumb({\n index: 0,\n orientation,\n isDisabled: props.isDisabled,\n trackRef,\n inputRef\n }, state);\n\n let generateBackground = () => {\n let value = state.getDisplayColor();\n let to: string;\n if (orientation === 'vertical') {\n to = 'top';\n } else if (direction === 'ltr') {\n to = 'right';\n } else {\n to = 'left';\n }\n switch (channel) {\n case 'hue':\n return `linear-gradient(to ${to}, rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)`;\n case 'lightness': {\n // We have to add an extra color stop in the middle so that the hue shows up at all.\n // Otherwise it will always just be black to white.\n let min = state.getThumbMinValue(0);\n let max = state.getThumbMaxValue(0);\n let start = value.withChannelValue(channel, min).toString('css');\n let middle = value.withChannelValue(channel, (max - min) / 2).toString('css');\n let end = value.withChannelValue(channel, max).toString('css');\n return `linear-gradient(to ${to}, ${start}, ${middle}, ${end})`;\n }\n case 'saturation':\n case 'brightness':\n case 'red':\n case 'green':\n case 'blue':\n case 'alpha': {\n let start = value.withChannelValue(channel, state.getThumbMinValue(0)).toString('css');\n let end = value.withChannelValue(channel, state.getThumbMaxValue(0)).toString('css');\n return `linear-gradient(to ${to}, ${start}, ${end})`;\n }\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n };\n\n let thumbPosition = state.getThumbPercent(0);\n if (orientation === 'vertical' || direction === 'rtl') {\n thumbPosition = 1 - thumbPosition;\n }\n\n return {\n trackProps: {\n ...mergeProps(groupProps, trackProps),\n style: {\n position: 'relative',\n touchAction: 'none',\n background: generateBackground()\n }\n },\n inputProps,\n thumbProps: {\n ...thumbProps,\n style: {\n touchAction: 'none',\n position: 'absolute',\n [orientation === 'vertical' ? 'top' : 'left']: `${thumbPosition * 100}%`,\n transform: 'translate(-50%, -50%)'\n }\n },\n labelProps,\n outputProps\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaColorWheelProps} from '@react-types/color';\nimport {ColorWheelState} from '@react-stately/color';\nimport {focusWithoutScrolling, mergeProps, useGlobalListeners, useLabels} from '@react-aria/utils';\nimport React, {ChangeEvent, HTMLAttributes, InputHTMLAttributes, RefObject, useCallback, useRef} from 'react';\nimport {useKeyboard, useMove} from '@react-aria/interactions';\nimport {useLocale} from '@react-aria/i18n';\n\ninterface ColorWheelAriaProps extends AriaColorWheelProps {\n /** The outer radius of the color wheel. */\n outerRadius: number,\n /** The inner radius of the color wheel. */\n innerRadius: number\n}\n\ninterface ColorWheelAria {\n /** Props for the track element. */\n trackProps: HTMLAttributes<HTMLElement>,\n /** Props for the thumb element. */\n thumbProps: HTMLAttributes<HTMLElement>,\n /** Props for the visually hidden range input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>\n}\n\nconst PAGE_MIN_STEP_SIZE = 6;\n\n/**\n * Provides the behavior and accessibility implementation for a color wheel component.\n * Color wheels allow users to adjust the hue of an HSL or HSB color value on a circular track.\n */\nexport function useColorWheel(props: ColorWheelAriaProps, state: ColorWheelState, inputRef: RefObject<HTMLElement>): ColorWheelAria {\n let {\n isDisabled,\n step = 1,\n innerRadius,\n outerRadius,\n 'aria-label': ariaLabel\n } = props;\n\n let {addGlobalListener, removeGlobalListener} = useGlobalListeners();\n\n let thumbRadius = (innerRadius + outerRadius) / 2;\n\n let focusInput = useCallback(() => {\n if (inputRef.current) {\n focusWithoutScrolling(inputRef.current);\n }\n }, [inputRef]);\n\n let stateRef = useRef<ColorWheelState>(null);\n stateRef.current = state;\n\n let currentPosition = useRef<{x: number, y: number}>(null);\n let moveHandler = {\n onMoveStart() {\n currentPosition.current = null;\n state.setDragging(true);\n },\n onMove({deltaX, deltaY, pointerType}) {\n if (currentPosition.current == null) {\n currentPosition.current = stateRef.current.getThumbPosition(thumbRadius);\n }\n currentPosition.current.x += deltaX;\n currentPosition.current.y += deltaY;\n if (pointerType === 'keyboard') {\n if (deltaX > 0 || deltaY < 0) {\n state.increment();\n } else if (deltaX < 0 || deltaY > 0) {\n state.decrement();\n }\n } else {\n stateRef.current.setHueFromPoint(currentPosition.current.x, currentPosition.current.y, thumbRadius);\n }\n },\n onMoveEnd() {\n isOnTrack.current = undefined;\n state.setDragging(false);\n focusInput();\n }\n };\n let {moveProps: movePropsThumb} = useMove(moveHandler);\n\n let currentPointer = useRef<number | null | undefined>(undefined);\n let isOnTrack = useRef<boolean>(false);\n let {moveProps: movePropsContainer} = useMove({\n onMoveStart() {\n if (isOnTrack.current) {\n moveHandler.onMoveStart();\n }\n },\n onMove(e) {\n if (isOnTrack.current) {\n moveHandler.onMove(e);\n }\n },\n onMoveEnd() {\n if (isOnTrack.current) {\n moveHandler.onMoveEnd();\n }\n }\n });\n\n let onThumbDown = (id: number | null) => {\n if (!state.isDragging) {\n currentPointer.current = id;\n focusInput();\n state.setDragging(true);\n addGlobalListener(window, 'mouseup', onThumbUp, false);\n addGlobalListener(window, 'touchend', onThumbUp, false);\n addGlobalListener(window, 'pointerup', onThumbUp, false);\n }\n };\n\n let onThumbUp = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (id === currentPointer.current) {\n focusInput();\n state.setDragging(false);\n currentPointer.current = undefined;\n isOnTrack.current = false;\n\n removeGlobalListener(window, 'mouseup', onThumbUp, false);\n removeGlobalListener(window, 'touchend', onThumbUp, false);\n removeGlobalListener(window, 'pointerup', onThumbUp, false);\n }\n };\n\n let onTrackDown = (track: Element, id: number | null, pageX: number, pageY: number) => {\n let rect = track.getBoundingClientRect();\n let x = pageX - rect.x - rect.width / 2;\n let y = pageY - rect.y - rect.height / 2;\n let radius = Math.sqrt(x * x + y * y);\n if (innerRadius < radius && radius < outerRadius && !state.isDragging && currentPointer.current === undefined) {\n isOnTrack.current = true;\n currentPointer.current = id;\n stateRef.current.setHueFromPoint(x, y, radius);\n\n focusInput();\n state.setDragging(true);\n\n addGlobalListener(window, 'mouseup', onTrackUp, false);\n addGlobalListener(window, 'touchend', onTrackUp, false);\n addGlobalListener(window, 'pointerup', onTrackUp, false);\n }\n };\n\n let onTrackUp = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (isOnTrack.current && id === currentPointer.current) {\n isOnTrack.current = false;\n currentPointer.current = undefined;\n state.setDragging(false);\n focusInput();\n\n removeGlobalListener(window, 'mouseup', onTrackUp, false);\n removeGlobalListener(window, 'touchend', onTrackUp, false);\n removeGlobalListener(window, 'pointerup', onTrackUp, false);\n }\n };\n\n let {keyboardProps} = useKeyboard({\n onKeyDown(e) {\n switch (e.key) {\n case 'PageUp':\n e.preventDefault();\n state.increment(PAGE_MIN_STEP_SIZE);\n break;\n case 'PageDown':\n e.preventDefault();\n state.decrement(PAGE_MIN_STEP_SIZE);\n break;\n }\n }\n });\n\n let trackInteractions = isDisabled ? {} : mergeProps({\n onMouseDown: (e: React.MouseEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onTrackDown(e.currentTarget, undefined, e.clientX, e.clientY);\n },\n onPointerDown: (e: React.PointerEvent) => {\n if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {\n return;\n }\n onTrackDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);\n },\n onTouchStart: (e: React.TouchEvent) => {\n onTrackDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);\n }\n }, movePropsContainer);\n\n let thumbInteractions = isDisabled ? {} : mergeProps({\n onMouseDown: (e: React.MouseEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onThumbDown(undefined);\n },\n onPointerDown: (e: React.PointerEvent) => {\n if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {\n return;\n }\n onThumbDown(e.pointerId);\n },\n onTouchStart: (e: React.TouchEvent) => {\n onThumbDown(e.changedTouches[0].identifier);\n }\n }, movePropsThumb, keyboardProps);\n let {x, y} = state.getThumbPosition(thumbRadius);\n\n // Provide a default aria-label if none is given\n let {locale} = useLocale();\n if (ariaLabel == null && props['aria-labelledby'] == null) {\n ariaLabel = state.value.getChannelName('hue', locale);\n }\n\n let inputLabellingProps = useLabels({\n ...props,\n 'aria-label': ariaLabel\n });\n\n return {\n trackProps: {\n ...trackInteractions,\n style: {\n position: 'relative',\n touchAction: 'none',\n width: outerRadius * 2,\n height: outerRadius * 2,\n background: `\n conic-gradient(\n from 90deg,\n hsl(0, 100%, 50%),\n hsl(30, 100%, 50%),\n hsl(60, 100%, 50%),\n hsl(90, 100%, 50%),\n hsl(120, 100%, 50%),\n hsl(150, 100%, 50%),\n hsl(180, 100%, 50%),\n hsl(210, 100%, 50%),\n hsl(240, 100%, 50%),\n hsl(270, 100%, 50%),\n hsl(300, 100%, 50%),\n hsl(330, 100%, 50%),\n hsl(360, 100%, 50%)\n )\n `,\n clipPath: `path(evenodd, \"${circlePath(outerRadius, outerRadius, outerRadius)} ${circlePath(outerRadius, outerRadius, innerRadius)}\")`\n }\n },\n thumbProps: {\n ...thumbInteractions,\n style: {\n position: 'absolute',\n left: '50%',\n top: '50%',\n transform: `translate(calc(${x}px - 50%), calc(${y}px - 50%))`,\n touchAction: 'none'\n }\n },\n inputProps: mergeProps(\n inputLabellingProps,\n {\n type: 'range',\n min: '0',\n max: '360',\n step: String(step),\n 'aria-valuetext': state.value.formatChannelValue('hue', locale),\n disabled: isDisabled,\n value: `${state.value.getChannelValue('hue')}`,\n onChange: (e: ChangeEvent<HTMLInputElement>) => {\n state.setHue(parseFloat(e.target.value));\n }\n }\n )\n };\n}\n\n// Creates an SVG path string for a circle.\nfunction circlePath(cx: number, cy: number, r: number) {\n return `M ${cx}, ${cy} m ${-r}, 0 a ${r}, ${r}, 0, 1, 0, ${r * 2}, 0 a ${r}, ${r}, 0, 1, 0 ${-r * 2}, 0`;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaColorFieldProps} from '@react-types/color';\nimport {ColorFieldState} from '@react-stately/color';\nimport {\n HTMLAttributes,\n LabelHTMLAttributes,\n RefObject,\n useCallback,\n useState\n} from 'react';\nimport {mergeProps, useId} from '@react-aria/utils';\nimport {useFocusWithin, useScrollWheel} from '@react-aria/interactions';\nimport {useFormattedTextField} from '@react-aria/textfield';\nimport {useSpinButton} from '@react-aria/spinbutton';\n\ninterface ColorFieldAria {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n /** Props for the input element. */\n inputProps: HTMLAttributes<HTMLInputElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a color field component.\n * Color fields allow users to enter and adjust a hex color value.\n */\nexport function useColorField(\n props: AriaColorFieldProps,\n state: ColorFieldState,\n ref: RefObject<HTMLInputElement>\n): ColorFieldAria {\n let {\n isDisabled,\n isReadOnly,\n isRequired\n } = props;\n\n let {\n colorValue,\n inputValue,\n commit,\n increment,\n decrement,\n incrementToMax,\n decrementToMin\n } = state;\n\n let inputId = useId();\n let {spinButtonProps} = useSpinButton(\n {\n isDisabled,\n isReadOnly,\n isRequired,\n maxValue: 0xFFFFFF,\n minValue: 0,\n onIncrement: increment,\n onIncrementToMax: incrementToMax,\n onDecrement: decrement,\n onDecrementToMin: decrementToMin,\n value: colorValue ? colorValue.toHexInt() : undefined,\n textValue: colorValue ? colorValue.toString('hex') : undefined\n }\n );\n\n let [focusWithin, setFocusWithin] = useState(false);\n let {focusWithinProps} = useFocusWithin({isDisabled, onFocusWithinChange: setFocusWithin});\n\n let onWheel = useCallback((e) => {\n if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {\n return;\n }\n if (e.deltaY > 0) {\n increment();\n } else if (e.deltaY < 0) {\n decrement();\n }\n }, [isReadOnly, isDisabled, decrement, increment]);\n // If the input isn't supposed to receive input, disable scrolling.\n let scrollingDisabled = isDisabled || isReadOnly || !focusWithin;\n useScrollWheel({onScroll: onWheel, isDisabled: scrollingDisabled}, ref);\n\n let onChange = value => {\n state.setInputValue(value);\n };\n\n let {labelProps, inputProps} = useFormattedTextField(\n mergeProps(props, {\n id: inputId,\n value: inputValue,\n type: 'text',\n autoComplete: 'off',\n onChange\n }), state, ref);\n\n return {\n labelProps,\n inputProps: mergeProps(inputProps, spinButtonProps, focusWithinProps, {\n role: 'textbox',\n 'aria-valuemax': null,\n 'aria-valuemin': null,\n 'aria-valuenow': null,\n 'aria-valuetext': null,\n autoCorrect: 'off',\n onBlur: commit\n })\n };\n}\n"],"names":["useColorSlider","props","state","trackRef","inputRef","orientation","channel","ariaLabel","locale","direction","useLocale","label","value","getChannelName","groupProps","trackProps","labelProps","outputProps","useSlider","inputProps","thumbProps","useSliderThumb","index","isDisabled","generateBackground","getDisplayColor","to","min","getThumbMinValue","max","getThumbMaxValue","start","withChannelValue","toString","middle","end","Error","thumbPosition","getThumbPercent","mergeProps","style","position","touchAction","background","transform","PAGE_MIN_STEP_SIZE","useColorWheel","step","innerRadius","outerRadius","addGlobalListener","removeGlobalListener","useGlobalListeners","thumbRadius","focusInput","useCallback","current","focusWithoutScrolling","stateRef","useRef","currentPosition","moveHandler","onMoveStart","setDragging","onMove","deltaX","deltaY","pointerType","getThumbPosition","x","y","increment","decrement","setHueFromPoint","onMoveEnd","isOnTrack","undefined","moveProps","movePropsThumb","useMove","currentPointer","movePropsContainer","e","onThumbDown","id","isDragging","window","onThumbUp","pointerId","changedTouches","identifier","onTrackDown","track","pageX","pageY","rect","getBoundingClientRect","width","height","radius","Math","sqrt","onTrackUp","keyboardProps","useKeyboard","onKeyDown","key","preventDefault","trackInteractions","onMouseDown","button","altKey","ctrlKey","metaKey","currentTarget","clientX","clientY","onPointerDown","onTouchStart","thumbInteractions","inputLabellingProps","useLabels","clipPath","circlePath","left","top","type","String","formatChannelValue","disabled","getChannelValue","onChange","setHue","parseFloat","target","cx","cy","r","useColorField","ref","isReadOnly","isRequired","colorValue","inputValue","commit","incrementToMax","decrementToMin","inputId","useId","spinButtonProps","useSpinButton","maxValue","minValue","onIncrement","onIncrementToMax","onDecrement","onDecrementToMin","toHexInt","textValue","focusWithin","setFocusWithin","useState","focusWithinProps","useFocusWithin","onFocusWithinChange","onWheel","abs","scrollingDisabled","useScrollWheel","onScroll","setInputValue","useFormattedTextField","autoComplete","role","autoCorrect","onBlur"],"version":3,"file":"module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;SC2CgB,yCAAc,CAAC,KAA6B,EAAE,KAAuB,EAAmB,CAAC;IACvG,GAAG,CAAC,CAAC,WAAA,QAAQ,aAAE,QAAQ,gBAAE,WAAW,YAAE,OAAO,GAAE,CAAY,aAAE,SAAS,EAAA,CAAC,GAAG,KAAK;IAE/E,GAAG,CAAC,CAAC,SAAA,MAAM,cAAE,SAAS,EAAA,CAAC,GAAG,gBAAS;IAEnC,EAAoE,AAApE,kEAAoE;IACpE,EAAE,GAAG,KAAK,CAAC,KAAK,KAAK,SAAS,KAAK,KAAK,CAAC,CAAiB,mBACxD,SAAS,GAAG,KAAK,CAAC,KAAK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QAAA,QAAQ,EAAE,OAAO;QAAE,UAAU,EAAE,iBAAiB;IAAA,CAAC,EAAE,GAAG;IAEtE,GAAG,CAAC,QAAQ,IAAG,KAAK,GAAI,CAAC;QACvB,KAAK,CAAC,aAAa,CAAC,KAAK;IAC3B,CAAC;IAED,GAAG,CAAC,CAAC,aAAA,UAAU,eAAE,UAAU,EAAA,CAAC,GAAG,4BAAqB,CAClD,iBAAU,CAAC,KAAK,EAAE,CAAC;QACjB,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,UAAU;QACjB,YAAY,EAAE,SAAS;QACvB,IAAI,EAAE,CAAM;QACZ,YAAY,EAAE,CAAK;kBACnB,QAAQ;IACV,CAAC,GAAG,KAAK,EAAE,GAAG;IAEhB,MAAM,CAAC,CAAC;oBACN,UAAU;QACV,UAAU,EAAE,iBAAU,CAAC,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAC;YACrE,IAAI,EAAE,CAAS;YACf,CAAe,gBAAE,IAAI;YACrB,CAAe,gBAAE,IAAI;YACrB,CAAe,gBAAE,IAAI;YACrB,CAAgB,iBAAE,IAAI;YACtB,WAAW,EAAE,CAAK;YAClB,UAAU,EAAE,CAAO;YACnB,MAAM,EAAE,MAAM;QAChB,CAAC;IACH,CAAC;AACH,CAAC;","sources":["packages/@react-aria/color/src/index.ts","packages/@react-aria/color/src/useColorSlider.ts","packages/@react-aria/color/src/useColorWheel.ts","packages/@react-aria/color/src/useColorField.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport * from './useColorSlider';\nexport * from './useColorWheel';\nexport * from './useColorField';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaColorSliderProps} from '@react-types/color';\nimport {ColorSliderState} from '@react-stately/color';\nimport {HTMLAttributes, RefObject} from 'react';\nimport {mergeProps} from '@react-aria/utils';\nimport {useLocale} from '@react-aria/i18n';\nimport {useSlider, useSliderThumb} from '@react-aria/slider';\n\ninterface ColorSliderAriaOptions extends AriaColorSliderProps {\n /** A ref for the track element. */\n trackRef: RefObject<HTMLElement>,\n /** A ref for the input element. */\n inputRef: RefObject<HTMLInputElement>\n}\n\ninterface ColorSliderAria {\n /** Props for the label element. */\n labelProps: HTMLAttributes<HTMLElement>,\n /** Props for the track element. */\n trackProps: HTMLAttributes<HTMLElement>,\n /** Props for the thumb element. */\n thumbProps: HTMLAttributes<HTMLElement>,\n /** Props for the visually hidden range input element. */\n inputProps: HTMLAttributes<HTMLElement>,\n /** Props for the output element, displaying the value of the color slider. */\n outputProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a color slider component.\n * Color sliders allow users to adjust an individual channel of a color value.\n */\nexport function useColorSlider(props: ColorSliderAriaOptions, state: ColorSliderState): ColorSliderAria {\n let {trackRef, inputRef, orientation, channel, 'aria-label': ariaLabel} = props;\n\n let {locale, direction} = useLocale();\n\n // Provide a default aria-label if there is no other label provided.\n if (!props.label && !ariaLabel && !props['aria-labelledby']) {\n ariaLabel = state.value.getChannelName(channel, locale);\n }\n\n // @ts-ignore - ignore unused incompatible props\n let {groupProps, trackProps, labelProps, outputProps} = useSlider({...props, 'aria-label': ariaLabel}, state, trackRef);\n let {inputProps, thumbProps} = useSliderThumb({\n index: 0,\n orientation,\n isDisabled: props.isDisabled,\n trackRef,\n inputRef\n }, state);\n\n let generateBackground = () => {\n let value = state.getDisplayColor();\n let to: string;\n if (orientation === 'vertical') {\n to = 'top';\n } else if (direction === 'ltr') {\n to = 'right';\n } else {\n to = 'left';\n }\n switch (channel) {\n case 'hue':\n return `linear-gradient(to ${to}, rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)`;\n case 'lightness': {\n // We have to add an extra color stop in the middle so that the hue shows up at all.\n // Otherwise it will always just be black to white.\n let min = state.getThumbMinValue(0);\n let max = state.getThumbMaxValue(0);\n let start = value.withChannelValue(channel, min).toString('css');\n let middle = value.withChannelValue(channel, (max - min) / 2).toString('css');\n let end = value.withChannelValue(channel, max).toString('css');\n return `linear-gradient(to ${to}, ${start}, ${middle}, ${end})`;\n }\n case 'saturation':\n case 'brightness':\n case 'red':\n case 'green':\n case 'blue':\n case 'alpha': {\n let start = value.withChannelValue(channel, state.getThumbMinValue(0)).toString('css');\n let end = value.withChannelValue(channel, state.getThumbMaxValue(0)).toString('css');\n return `linear-gradient(to ${to}, ${start}, ${end})`;\n }\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n };\n\n let thumbPosition = state.getThumbPercent(0);\n if (orientation === 'vertical' || direction === 'rtl') {\n thumbPosition = 1 - thumbPosition;\n }\n\n return {\n trackProps: {\n ...mergeProps(groupProps, trackProps),\n style: {\n position: 'relative',\n touchAction: 'none',\n background: generateBackground()\n }\n },\n inputProps,\n thumbProps: {\n ...thumbProps,\n style: {\n touchAction: 'none',\n position: 'absolute',\n [orientation === 'vertical' ? 'top' : 'left']: `${thumbPosition * 100}%`,\n transform: 'translate(-50%, -50%)'\n }\n },\n labelProps,\n outputProps\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaColorWheelProps} from '@react-types/color';\nimport {ColorWheelState} from '@react-stately/color';\nimport {focusWithoutScrolling, mergeProps, useGlobalListeners, useLabels} from '@react-aria/utils';\nimport React, {ChangeEvent, HTMLAttributes, InputHTMLAttributes, RefObject, useCallback, useRef} from 'react';\nimport {useKeyboard, useMove} from '@react-aria/interactions';\nimport {useLocale} from '@react-aria/i18n';\n\ninterface ColorWheelAriaProps extends AriaColorWheelProps {\n /** The outer radius of the color wheel. */\n outerRadius: number,\n /** The inner radius of the color wheel. */\n innerRadius: number\n}\n\ninterface ColorWheelAria {\n /** Props for the track element. */\n trackProps: HTMLAttributes<HTMLElement>,\n /** Props for the thumb element. */\n thumbProps: HTMLAttributes<HTMLElement>,\n /** Props for the visually hidden range input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>\n}\n\nconst PAGE_MIN_STEP_SIZE = 6;\n\n/**\n * Provides the behavior and accessibility implementation for a color wheel component.\n * Color wheels allow users to adjust the hue of an HSL or HSB color value on a circular track.\n */\nexport function useColorWheel(props: ColorWheelAriaProps, state: ColorWheelState, inputRef: RefObject<HTMLElement>): ColorWheelAria {\n let {\n isDisabled,\n step = 1,\n innerRadius,\n outerRadius,\n 'aria-label': ariaLabel\n } = props;\n\n let {addGlobalListener, removeGlobalListener} = useGlobalListeners();\n\n let thumbRadius = (innerRadius + outerRadius) / 2;\n\n let focusInput = useCallback(() => {\n if (inputRef.current) {\n focusWithoutScrolling(inputRef.current);\n }\n }, [inputRef]);\n\n let stateRef = useRef<ColorWheelState>(null);\n stateRef.current = state;\n\n let currentPosition = useRef<{x: number, y: number}>(null);\n let moveHandler = {\n onMoveStart() {\n currentPosition.current = null;\n state.setDragging(true);\n },\n onMove({deltaX, deltaY, pointerType}) {\n if (currentPosition.current == null) {\n currentPosition.current = stateRef.current.getThumbPosition(thumbRadius);\n }\n currentPosition.current.x += deltaX;\n currentPosition.current.y += deltaY;\n if (pointerType === 'keyboard') {\n if (deltaX > 0 || deltaY < 0) {\n state.increment();\n } else if (deltaX < 0 || deltaY > 0) {\n state.decrement();\n }\n } else {\n stateRef.current.setHueFromPoint(currentPosition.current.x, currentPosition.current.y, thumbRadius);\n }\n },\n onMoveEnd() {\n isOnTrack.current = undefined;\n state.setDragging(false);\n focusInput();\n }\n };\n let {moveProps: movePropsThumb} = useMove(moveHandler);\n\n let currentPointer = useRef<number | null | undefined>(undefined);\n let isOnTrack = useRef<boolean>(false);\n let {moveProps: movePropsContainer} = useMove({\n onMoveStart() {\n if (isOnTrack.current) {\n moveHandler.onMoveStart();\n }\n },\n onMove(e) {\n if (isOnTrack.current) {\n moveHandler.onMove(e);\n }\n },\n onMoveEnd() {\n if (isOnTrack.current) {\n moveHandler.onMoveEnd();\n }\n }\n });\n\n let onThumbDown = (id: number | null) => {\n if (!state.isDragging) {\n currentPointer.current = id;\n focusInput();\n state.setDragging(true);\n\n if (typeof PointerEvent !== 'undefined') {\n addGlobalListener(window, 'pointerup', onThumbUp, false);\n } else {\n addGlobalListener(window, 'mouseup', onThumbUp, false);\n addGlobalListener(window, 'touchend', onThumbUp, false);\n }\n }\n };\n\n let onThumbUp = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (id === currentPointer.current) {\n focusInput();\n state.setDragging(false);\n currentPointer.current = undefined;\n isOnTrack.current = false;\n\n if (typeof PointerEvent !== 'undefined') {\n removeGlobalListener(window, 'pointerup', onThumbUp, false);\n } else {\n removeGlobalListener(window, 'mouseup', onThumbUp, false);\n removeGlobalListener(window, 'touchend', onThumbUp, false);\n }\n }\n };\n\n let onTrackDown = (track: Element, id: number | null, pageX: number, pageY: number) => {\n let rect = track.getBoundingClientRect();\n let x = pageX - rect.x - rect.width / 2;\n let y = pageY - rect.y - rect.height / 2;\n let radius = Math.sqrt(x * x + y * y);\n if (innerRadius < radius && radius < outerRadius && !state.isDragging && currentPointer.current === undefined) {\n isOnTrack.current = true;\n currentPointer.current = id;\n stateRef.current.setHueFromPoint(x, y, radius);\n\n focusInput();\n state.setDragging(true);\n\n if (typeof PointerEvent !== 'undefined') {\n addGlobalListener(window, 'pointerup', onTrackUp, false);\n } else {\n addGlobalListener(window, 'mouseup', onTrackUp, false);\n addGlobalListener(window, 'touchend', onTrackUp, false);\n }\n }\n };\n\n let onTrackUp = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (isOnTrack.current && id === currentPointer.current) {\n isOnTrack.current = false;\n currentPointer.current = undefined;\n state.setDragging(false);\n focusInput();\n\n\n if (typeof PointerEvent !== 'undefined') {\n removeGlobalListener(window, 'pointerup', onTrackUp, false);\n } else {\n removeGlobalListener(window, 'mouseup', onTrackUp, false);\n removeGlobalListener(window, 'touchend', onTrackUp, false);\n }\n }\n };\n\n let {keyboardProps} = useKeyboard({\n onKeyDown(e) {\n switch (e.key) {\n case 'PageUp':\n e.preventDefault();\n state.increment(PAGE_MIN_STEP_SIZE);\n break;\n case 'PageDown':\n e.preventDefault();\n state.decrement(PAGE_MIN_STEP_SIZE);\n break;\n }\n }\n });\n\n let trackInteractions = isDisabled ? {} : mergeProps({\n ...(typeof PointerEvent !== 'undefined' ? {\n onPointerDown: (e: React.PointerEvent) => {\n if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {\n return;\n }\n onTrackDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);\n }} : {\n onMouseDown: (e: React.MouseEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onTrackDown(e.currentTarget, undefined, e.clientX, e.clientY);\n },\n onTouchStart: (e: React.TouchEvent) => {\n onTrackDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);\n }\n })\n }, movePropsContainer);\n\n let thumbInteractions = isDisabled ? {} : mergeProps({\n onMouseDown: (e: React.MouseEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onThumbDown(undefined);\n },\n onPointerDown: (e: React.PointerEvent) => {\n if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {\n return;\n }\n onThumbDown(e.pointerId);\n },\n onTouchStart: (e: React.TouchEvent) => {\n onThumbDown(e.changedTouches[0].identifier);\n }\n }, movePropsThumb, keyboardProps);\n let {x, y} = state.getThumbPosition(thumbRadius);\n\n // Provide a default aria-label if none is given\n let {locale} = useLocale();\n if (ariaLabel == null && props['aria-labelledby'] == null) {\n ariaLabel = state.value.getChannelName('hue', locale);\n }\n\n let inputLabellingProps = useLabels({\n ...props,\n 'aria-label': ariaLabel\n });\n\n return {\n trackProps: {\n ...trackInteractions,\n style: {\n position: 'relative',\n touchAction: 'none',\n width: outerRadius * 2,\n height: outerRadius * 2,\n background: `\n conic-gradient(\n from 90deg,\n hsl(0, 100%, 50%),\n hsl(30, 100%, 50%),\n hsl(60, 100%, 50%),\n hsl(90, 100%, 50%),\n hsl(120, 100%, 50%),\n hsl(150, 100%, 50%),\n hsl(180, 100%, 50%),\n hsl(210, 100%, 50%),\n hsl(240, 100%, 50%),\n hsl(270, 100%, 50%),\n hsl(300, 100%, 50%),\n hsl(330, 100%, 50%),\n hsl(360, 100%, 50%)\n )\n `,\n clipPath: `path(evenodd, \"${circlePath(outerRadius, outerRadius, outerRadius)} ${circlePath(outerRadius, outerRadius, innerRadius)}\")`\n }\n },\n thumbProps: {\n ...thumbInteractions,\n style: {\n position: 'absolute',\n left: '50%',\n top: '50%',\n transform: `translate(calc(${x}px - 50%), calc(${y}px - 50%))`,\n touchAction: 'none'\n }\n },\n inputProps: mergeProps(\n inputLabellingProps,\n {\n type: 'range',\n min: '0',\n max: '360',\n step: String(step),\n 'aria-valuetext': state.value.formatChannelValue('hue', locale),\n disabled: isDisabled,\n value: `${state.value.getChannelValue('hue')}`,\n onChange: (e: ChangeEvent<HTMLInputElement>) => {\n state.setHue(parseFloat(e.target.value));\n }\n }\n )\n };\n}\n\n// Creates an SVG path string for a circle.\nfunction circlePath(cx: number, cy: number, r: number) {\n return `M ${cx}, ${cy} m ${-r}, 0 a ${r}, ${r}, 0, 1, 0, ${r * 2}, 0 a ${r}, ${r}, 0, 1, 0 ${-r * 2}, 0`;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaColorFieldProps} from '@react-types/color';\nimport {ColorFieldState} from '@react-stately/color';\nimport {\n HTMLAttributes,\n LabelHTMLAttributes,\n RefObject,\n useCallback,\n useState\n} from 'react';\nimport {mergeProps, useId} from '@react-aria/utils';\nimport {useFocusWithin, useScrollWheel} from '@react-aria/interactions';\nimport {useFormattedTextField} from '@react-aria/textfield';\nimport {useSpinButton} from '@react-aria/spinbutton';\n\ninterface ColorFieldAria {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n /** Props for the input element. */\n inputProps: HTMLAttributes<HTMLInputElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a color field component.\n * Color fields allow users to enter and adjust a hex color value.\n */\nexport function useColorField(\n props: AriaColorFieldProps,\n state: ColorFieldState,\n ref: RefObject<HTMLInputElement>\n): ColorFieldAria {\n let {\n isDisabled,\n isReadOnly,\n isRequired\n } = props;\n\n let {\n colorValue,\n inputValue,\n commit,\n increment,\n decrement,\n incrementToMax,\n decrementToMin\n } = state;\n\n let inputId = useId();\n let {spinButtonProps} = useSpinButton(\n {\n isDisabled,\n isReadOnly,\n isRequired,\n maxValue: 0xFFFFFF,\n minValue: 0,\n onIncrement: increment,\n onIncrementToMax: incrementToMax,\n onDecrement: decrement,\n onDecrementToMin: decrementToMin,\n value: colorValue ? colorValue.toHexInt() : undefined,\n textValue: colorValue ? colorValue.toString('hex') : undefined\n }\n );\n\n let [focusWithin, setFocusWithin] = useState(false);\n let {focusWithinProps} = useFocusWithin({isDisabled, onFocusWithinChange: setFocusWithin});\n\n let onWheel = useCallback((e) => {\n if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {\n return;\n }\n if (e.deltaY > 0) {\n increment();\n } else if (e.deltaY < 0) {\n decrement();\n }\n }, [isReadOnly, isDisabled, decrement, increment]);\n // If the input isn't supposed to receive input, disable scrolling.\n let scrollingDisabled = isDisabled || isReadOnly || !focusWithin;\n useScrollWheel({onScroll: onWheel, isDisabled: scrollingDisabled}, ref);\n\n let onChange = value => {\n state.setInputValue(value);\n };\n\n let {labelProps, inputProps} = useFormattedTextField(\n mergeProps(props, {\n id: inputId,\n value: inputValue,\n defaultValue: undefined,\n type: 'text',\n autoComplete: 'off',\n onChange\n }), state, ref);\n\n return {\n labelProps,\n inputProps: mergeProps(inputProps, spinButtonProps, focusWithinProps, {\n role: 'textbox',\n 'aria-valuemax': null,\n 'aria-valuemin': null,\n 'aria-valuenow': null,\n 'aria-valuetext': null,\n autoCorrect: 'off',\n spellCheck: 'false',\n onBlur: commit\n })\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;AAmBA,gCAAiC,SAAQ,oBAAoB;IAC3D,mCAAmC;IACnC,QAAQ,EAAE,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ages/@react-aria/color/src/packages/@react-aria/color/src/useColorWheel.ts","packages/@react-aria/color/src/packages/@react-aria/color/src/useColorField.ts","packages/@react-aria/color/src/packages/@react-aria/color/src/index.ts","packages/@react-aria/color/src/index.ts"],"sourcesContent":[null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport * from './useColorSlider';\nexport * from './useColorWheel';\nexport * from './useColorField';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/color",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.8",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@babel/runtime": "^7.6.2",
|
|
21
|
-
"@react-aria/i18n": "^3.3.
|
|
22
|
-
"@react-aria/interactions": "^3.
|
|
23
|
-
"@react-aria/slider": "^3.0.
|
|
24
|
-
"@react-aria/spinbutton": "^3.0.
|
|
25
|
-
"@react-aria/textfield": "^3.
|
|
26
|
-
"@react-aria/utils": "^3.
|
|
27
|
-
"@react-stately/color": "3.0.0-beta.
|
|
28
|
-
"@react-types/color": "3.0.0-beta.
|
|
29
|
-
"@react-types/shared": "^3.
|
|
30
|
-
"@react-types/slider": "^3.0.
|
|
21
|
+
"@react-aria/i18n": "^3.3.6",
|
|
22
|
+
"@react-aria/interactions": "^3.8.1",
|
|
23
|
+
"@react-aria/slider": "^3.0.5",
|
|
24
|
+
"@react-aria/spinbutton": "^3.0.3",
|
|
25
|
+
"@react-aria/textfield": "^3.5.2",
|
|
26
|
+
"@react-aria/utils": "^3.11.2",
|
|
27
|
+
"@react-stately/color": "3.0.0-beta.7",
|
|
28
|
+
"@react-types/color": "3.0.0-beta.5",
|
|
29
|
+
"@react-types/shared": "^3.11.1",
|
|
30
|
+
"@react-types/slider": "^3.0.4"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"react": "^16.8.0 || ^17.0.0-rc.1",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "404d41859b7d6f56201d7fc01bd9f22ae3512937"
|
|
40
40
|
}
|
package/src/useColorField.ts
CHANGED
|
@@ -98,6 +98,7 @@ export function useColorField(
|
|
|
98
98
|
mergeProps(props, {
|
|
99
99
|
id: inputId,
|
|
100
100
|
value: inputValue,
|
|
101
|
+
defaultValue: undefined,
|
|
101
102
|
type: 'text',
|
|
102
103
|
autoComplete: 'off',
|
|
103
104
|
onChange
|
|
@@ -112,6 +113,7 @@ export function useColorField(
|
|
|
112
113
|
'aria-valuenow': null,
|
|
113
114
|
'aria-valuetext': null,
|
|
114
115
|
autoCorrect: 'off',
|
|
116
|
+
spellCheck: 'false',
|
|
115
117
|
onBlur: commit
|
|
116
118
|
})
|
|
117
119
|
};
|
package/src/useColorWheel.ts
CHANGED
|
@@ -116,9 +116,13 @@ export function useColorWheel(props: ColorWheelAriaProps, state: ColorWheelState
|
|
|
116
116
|
currentPointer.current = id;
|
|
117
117
|
focusInput();
|
|
118
118
|
state.setDragging(true);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
|
|
120
|
+
if (typeof PointerEvent !== 'undefined') {
|
|
121
|
+
addGlobalListener(window, 'pointerup', onThumbUp, false);
|
|
122
|
+
} else {
|
|
123
|
+
addGlobalListener(window, 'mouseup', onThumbUp, false);
|
|
124
|
+
addGlobalListener(window, 'touchend', onThumbUp, false);
|
|
125
|
+
}
|
|
122
126
|
}
|
|
123
127
|
};
|
|
124
128
|
|
|
@@ -130,9 +134,12 @@ export function useColorWheel(props: ColorWheelAriaProps, state: ColorWheelState
|
|
|
130
134
|
currentPointer.current = undefined;
|
|
131
135
|
isOnTrack.current = false;
|
|
132
136
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
137
|
+
if (typeof PointerEvent !== 'undefined') {
|
|
138
|
+
removeGlobalListener(window, 'pointerup', onThumbUp, false);
|
|
139
|
+
} else {
|
|
140
|
+
removeGlobalListener(window, 'mouseup', onThumbUp, false);
|
|
141
|
+
removeGlobalListener(window, 'touchend', onThumbUp, false);
|
|
142
|
+
}
|
|
136
143
|
}
|
|
137
144
|
};
|
|
138
145
|
|
|
@@ -149,9 +156,12 @@ export function useColorWheel(props: ColorWheelAriaProps, state: ColorWheelState
|
|
|
149
156
|
focusInput();
|
|
150
157
|
state.setDragging(true);
|
|
151
158
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
159
|
+
if (typeof PointerEvent !== 'undefined') {
|
|
160
|
+
addGlobalListener(window, 'pointerup', onTrackUp, false);
|
|
161
|
+
} else {
|
|
162
|
+
addGlobalListener(window, 'mouseup', onTrackUp, false);
|
|
163
|
+
addGlobalListener(window, 'touchend', onTrackUp, false);
|
|
164
|
+
}
|
|
155
165
|
}
|
|
156
166
|
};
|
|
157
167
|
|
|
@@ -163,9 +173,13 @@ export function useColorWheel(props: ColorWheelAriaProps, state: ColorWheelState
|
|
|
163
173
|
state.setDragging(false);
|
|
164
174
|
focusInput();
|
|
165
175
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
176
|
+
|
|
177
|
+
if (typeof PointerEvent !== 'undefined') {
|
|
178
|
+
removeGlobalListener(window, 'pointerup', onTrackUp, false);
|
|
179
|
+
} else {
|
|
180
|
+
removeGlobalListener(window, 'mouseup', onTrackUp, false);
|
|
181
|
+
removeGlobalListener(window, 'touchend', onTrackUp, false);
|
|
182
|
+
}
|
|
169
183
|
}
|
|
170
184
|
};
|
|
171
185
|
|
|
@@ -185,21 +199,23 @@ export function useColorWheel(props: ColorWheelAriaProps, state: ColorWheelState
|
|
|
185
199
|
});
|
|
186
200
|
|
|
187
201
|
let trackInteractions = isDisabled ? {} : mergeProps({
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
202
|
+
...(typeof PointerEvent !== 'undefined' ? {
|
|
203
|
+
onPointerDown: (e: React.PointerEvent) => {
|
|
204
|
+
if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
onTrackDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);
|
|
208
|
+
}} : {
|
|
209
|
+
onMouseDown: (e: React.MouseEvent) => {
|
|
210
|
+
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
onTrackDown(e.currentTarget, undefined, e.clientX, e.clientY);
|
|
214
|
+
},
|
|
215
|
+
onTouchStart: (e: React.TouchEvent) => {
|
|
216
|
+
onTrackDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);
|
|
217
|
+
}
|
|
218
|
+
})
|
|
203
219
|
}, movePropsContainer);
|
|
204
220
|
|
|
205
221
|
let thumbInteractions = isDisabled ? {} : mergeProps({
|