@react-aria/color 3.0.0-nightly.4718 → 3.0.0-nightly.4723

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/types.d.ts CHANGED
@@ -85,7 +85,7 @@ export interface ColorFieldAria extends ValidationResult {
85
85
  export function useColorField(props: AriaColorFieldProps, state: ColorFieldState, ref: _RefObject1<HTMLInputElement | null>): ColorFieldAria;
86
86
  export interface AriaColorSwatchProps extends AriaLabelingProps, DOMProps {
87
87
  /** The color value to display in the swatch. */
88
- color?: string | Color | null;
88
+ color?: string | Color;
89
89
  /**
90
90
  * A localized accessible name for the color.
91
91
  * By default, a description is generated from the color value,
@@ -1 +1 @@
1
- {"mappings":";;;;;ACwBA;IACE,kDAAkD;IAClD,cAAc,EAAE,aAAa,CAAC;IAC9B,mCAAmC;IACnC,UAAU,EAAE,aAAa,CAAC;IAC1B,oEAAoE;IACpE,WAAW,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IACnD,kEAAkE;IAClE,WAAW,EAAE,oBAAoB,gBAAgB,CAAC,CAAA;CACnD;AAED,qCAAsC,SAAQ,kBAAkB;IAC9D,uEAAuE;IACvE,SAAS,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,CAAC;IAC9C,uEAAuE;IACvE,SAAS,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,CAAC;IAC9C,kDAAkD;IAClD,YAAY,EAAE,UAAU,OAAO,GAAG,IAAI,CAAC,CAAA;CACxC;AAED;;;GAGG;AACH,6BAA6B,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,cAAc,GAAG,aAAa,CAoa9F;AC/bD,uCAAwC,SAAQ,oBAAoB;IAClE,mCAAmC;IACnC,QAAQ,EAAE,UAAU,OAAO,GAAG,IAAI,CAAC,CAAC;IACpC,mCAAmC;IACnC,QAAQ,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,CAAA;CAC7C;AAED;IACE,mCAAmC;IACnC,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AE,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IAC9B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;IACE,0CAA0C;IAC1C,gBAAgB,EAAE,eAAe,WAAW,CAAC,CAAC;IAC9C,4CAA4C;IAC5C,KAAK,EAAE,KAAK,CAAA;CACb;AAED;;;GAGG;AACH,+BAA+B,KAAK,EAAE,oBAAoB,GAAG,eAAe,CA6B3E;ACxDD,2CAA4C,SAAQ,sBAAsB,EAAE,iBAAiB;CAAG;AAChG,sCAAuC,SAAQ,eAAe;CAAG;AAEjE;;;GAGG;AACH,qCAAqC,KAAK,EAAE,0BAA0B,EAAE,KAAK,EAAE,sBAAsB,EAAE,QAAQ,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,GAAG,qBAAqB,CAW1K;ACfD,YAAY,EAAC,mBAAmB,EAAC,MAAM,oBAAoB,CAAC","sources":["packages/@react-aria/color/src/packages/@react-aria/color/src/useColorAreaGradient.ts","packages/@react-aria/color/src/packages/@react-aria/color/src/useColorArea.ts","packages/@react-aria/color/src/packages/@react-aria/color/src/useColorSlider.ts","packages/@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/useColorSwatch.ts","packages/@react-aria/color/src/packages/@react-aria/color/src/useColorChannelField.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,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 */\nexport {useColorArea} from './useColorArea';\nexport {useColorSlider} from './useColorSlider';\nexport {useColorWheel} from './useColorWheel';\nexport {useColorField} from './useColorField';\nexport {useColorSwatch} from './useColorSwatch';\nexport {useColorChannelField} from './useColorChannelField';\nexport type {AriaColorAreaOptions, ColorAreaAria} from './useColorArea';\nexport type {AriaColorSliderOptions, ColorSliderAria} from './useColorSlider';\nexport type {AriaColorWheelOptions, ColorWheelAria} from './useColorWheel';\nexport type {AriaColorFieldProps} from '@react-types/color';\nexport type {ColorFieldAria} from './useColorField';\nexport type {AriaColorSwatchProps, ColorSwatchAria} from './useColorSwatch';\nexport type {AriaColorChannelFieldProps, ColorChannelFieldAria} from './useColorChannelField';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;;;ACwBA;IACE,kDAAkD;IAClD,cAAc,EAAE,aAAa,CAAC;IAC9B,mCAAmC;IACnC,UAAU,EAAE,aAAa,CAAC;IAC1B,oEAAoE;IACpE,WAAW,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IACnD,kEAAkE;IAClE,WAAW,EAAE,oBAAoB,gBAAgB,CAAC,CAAA;CACnD;AAED,qCAAsC,SAAQ,kBAAkB;IAC9D,uEAAuE;IACvE,SAAS,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,CAAC;IAC9C,uEAAuE;IACvE,SAAS,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,CAAC;IAC9C,kDAAkD;IAClD,YAAY,EAAE,UAAU,OAAO,GAAG,IAAI,CAAC,CAAA;CACxC;AAED;;;GAGG;AACH,6BAA6B,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,cAAc,GAAG,aAAa,CAoa9F;AC/bD,uCAAwC,SAAQ,oBAAoB;IAClE,mCAAmC;IACnC,QAAQ,EAAE,UAAU,OAAO,GAAG,IAAI,CAAC,CAAC;IACpC,mCAAmC;IACnC,QAAQ,EAAE,UAAU,gBAAgB,GAAG,IAA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AE,QAAQ;IACvE,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACvB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;IACE,0CAA0C;IAC1C,gBAAgB,EAAE,eAAe,WAAW,CAAC,CAAC;IAC9C,4CAA4C;IAC5C,KAAK,EAAE,KAAK,CAAA;CACb;AAED;;;GAGG;AACH,+BAA+B,KAAK,EAAE,oBAAoB,GAAG,eAAe,CA6B3E;ACxDD,2CAA4C,SAAQ,sBAAsB,EAAE,iBAAiB;CAAG;AAChG,sCAAuC,SAAQ,eAAe;CAAG;AAEjE;;;GAGG;AACH,qCAAqC,KAAK,EAAE,0BAA0B,EAAE,KAAK,EAAE,sBAAsB,EAAE,QAAQ,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,GAAG,qBAAqB,CAW1K;ACfD,YAAY,EAAC,mBAAmB,EAAC,MAAM,oBAAoB,CAAC","sources":["packages/@react-aria/color/src/packages/@react-aria/color/src/useColorAreaGradient.ts","packages/@react-aria/color/src/packages/@react-aria/color/src/useColorArea.ts","packages/@react-aria/color/src/packages/@react-aria/color/src/useColorSlider.ts","packages/@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/useColorSwatch.ts","packages/@react-aria/color/src/packages/@react-aria/color/src/useColorChannelField.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,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 */\nexport {useColorArea} from './useColorArea';\nexport {useColorSlider} from './useColorSlider';\nexport {useColorWheel} from './useColorWheel';\nexport {useColorField} from './useColorField';\nexport {useColorSwatch} from './useColorSwatch';\nexport {useColorChannelField} from './useColorChannelField';\nexport type {AriaColorAreaOptions, ColorAreaAria} from './useColorArea';\nexport type {AriaColorSliderOptions, ColorSliderAria} from './useColorSlider';\nexport type {AriaColorWheelOptions, ColorWheelAria} from './useColorWheel';\nexport type {AriaColorFieldProps} from '@react-types/color';\nexport type {ColorFieldAria} from './useColorField';\nexport type {AriaColorSwatchProps, ColorSwatchAria} from './useColorSwatch';\nexport type {AriaColorChannelFieldProps, ColorChannelFieldAria} from './useColorChannelField';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAkCM,SAAS,0CAAe,KAA2B;IACxD,IAAI,EAAC,OAAO,KAAK,aAAE,SAAS,EAAC,GAAG;IAChC,IAAI,eAAe,SAAS;IAC5B,IAAI,QAAQ,CAAA,GAAA,oBAAM,EAAE,IAAM,OAAO,iBAAiB,WAAW,CAAA,GAAA,mCAAS,EAAE,gBAAgB,cAAc;QAAC;KAAa;IACpH,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,8BAAQ;IACvB,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IACrD,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAChE,IAAI,KAAK,CAAA,GAAA,2BAAI,EAAE,MAAM,EAAE;IAEvB,IAAI,CAAC,WACH,YAAY,MAAM,eAAe,CAAC,aAAa,IAAI,gBAAgB,MAAM,CAAC,iBAAiB,MAAM,YAAY,CAAC;IAGhH,OAAO;QACL,kBAAkB;YAChB,GAAG,QAAQ;YACX,MAAM;YACN,wBAAwB,gBAAgB,MAAM,CAAC;YAC/C,cAAc;gBAAC;gBAAW,KAAK,CAAC,aAAa,IAAI;aAAG,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC;YAC1E,mBAAmB,KAAK,CAAC,kBAAkB,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC,GAAG;gBACpF;YACA,OAAO;gBACL,iBAAiB,MAAM,QAAQ,CAAC;gBAChC,aAAa;gBACb,mBAAmB;YACrB;QACF;QACA,OAAO,SAAS;IAClB;AACF","sources":["packages/@react-aria/color/src/useColorSwatch.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMProps} from '@react-types/shared';\nimport {Color} from '@react-types/color';\nimport {filterDOMProps, useId} from '@react-aria/utils';\nimport {HTMLAttributes, useMemo} from 'react';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {parseColor} from '@react-stately/color';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaColorSwatchProps extends AriaLabelingProps, DOMProps {\n /** The color value to display in the swatch. */\n color?: string | Color | null,\n /** \n * A localized accessible name for the color.\n * By default, a description is generated from the color value,\n * but this can be overridden if you have a more specific color\n * name (e.g. Pantone colors).\n */\n colorName?: string\n}\n\nexport interface ColorSwatchAria {\n /** Props for the color swatch element. */\n colorSwatchProps: HTMLAttributes<HTMLElement>,\n /** The parsed color value of the swatch. */\n color: Color\n}\n\n/**\n * Provides the accessibility implementation for a color swatch component.\n * A color swatch displays a preview of a selected color.\n */\nexport function useColorSwatch(props: AriaColorSwatchProps): ColorSwatchAria {\n let {color: value, colorName} = props;\n let nonNullValue = value || '#fff0';\n let color = useMemo(() => typeof nonNullValue === 'string' ? parseColor(nonNullValue) : nonNullValue, [nonNullValue]);\n let {locale} = useLocale();\n let DOMProps = filterDOMProps(props, {labelable: true});\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/color');\n let id = useId(props.id);\n\n if (!colorName) {\n colorName = color.getChannelValue('alpha') === 0 ? stringFormatter.format('transparent') : color.getColorName(locale);\n }\n\n return {\n colorSwatchProps: {\n ...DOMProps,\n role: 'img',\n 'aria-roledescription': stringFormatter.format('colorSwatch'),\n 'aria-label': [colorName, props['aria-label'] || ''].filter(Boolean).join(', '),\n 'aria-labelledby': props['aria-labelledby'] ? `${id} ${props['aria-labelledby']}` : undefined,\n id,\n style: {\n backgroundColor: color.toString('css'),\n // @ts-ignore\n forcedColorAdjust: 'none'\n }\n },\n color: color || null\n };\n}\n"],"names":[],"version":3,"file":"useColorSwatch.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAkCM,SAAS,0CAAe,KAA2B;IACxD,IAAI,EAAC,OAAO,KAAK,aAAE,SAAS,EAAC,GAAG;IAChC,IAAI,eAAe,SAAS;IAC5B,IAAI,QAAQ,CAAA,GAAA,oBAAM,EAAE,IAAM,OAAO,iBAAiB,WAAW,CAAA,GAAA,mCAAS,EAAE,gBAAgB,cAAc;QAAC;KAAa;IACpH,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,8BAAQ;IACvB,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IACrD,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAChE,IAAI,KAAK,CAAA,GAAA,2BAAI,EAAE,MAAM,EAAE;IAEvB,IAAI,CAAC,WACH,YAAY,MAAM,eAAe,CAAC,aAAa,IAAI,gBAAgB,MAAM,CAAC,iBAAiB,MAAM,YAAY,CAAC;IAGhH,OAAO;QACL,kBAAkB;YAChB,GAAG,QAAQ;YACX,MAAM;YACN,wBAAwB,gBAAgB,MAAM,CAAC;YAC/C,cAAc;gBAAC;gBAAW,KAAK,CAAC,aAAa,IAAI;aAAG,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC;YAC1E,mBAAmB,KAAK,CAAC,kBAAkB,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC,GAAG;gBACpF;YACA,OAAO;gBACL,iBAAiB,MAAM,QAAQ,CAAC;gBAChC,aAAa;gBACb,mBAAmB;YACrB;QACF;QACA,OAAO,SAAS;IAClB;AACF","sources":["packages/@react-aria/color/src/useColorSwatch.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMProps} from '@react-types/shared';\nimport {Color} from '@react-types/color';\nimport {filterDOMProps, useId} from '@react-aria/utils';\nimport {HTMLAttributes, useMemo} from 'react';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {parseColor} from '@react-stately/color';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaColorSwatchProps extends AriaLabelingProps, DOMProps {\n /** The color value to display in the swatch. */\n color?: string | Color,\n /** \n * A localized accessible name for the color.\n * By default, a description is generated from the color value,\n * but this can be overridden if you have a more specific color\n * name (e.g. Pantone colors).\n */\n colorName?: string\n}\n\nexport interface ColorSwatchAria {\n /** Props for the color swatch element. */\n colorSwatchProps: HTMLAttributes<HTMLElement>,\n /** The parsed color value of the swatch. */\n color: Color\n}\n\n/**\n * Provides the accessibility implementation for a color swatch component.\n * A color swatch displays a preview of a selected color.\n */\nexport function useColorSwatch(props: AriaColorSwatchProps): ColorSwatchAria {\n let {color: value, colorName} = props;\n let nonNullValue = value || '#fff0';\n let color = useMemo(() => typeof nonNullValue === 'string' ? parseColor(nonNullValue) : nonNullValue, [nonNullValue]);\n let {locale} = useLocale();\n let DOMProps = filterDOMProps(props, {labelable: true});\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/color');\n let id = useId(props.id);\n\n if (!colorName) {\n colorName = color.getChannelValue('alpha') === 0 ? stringFormatter.format('transparent') : color.getColorName(locale);\n }\n\n return {\n colorSwatchProps: {\n ...DOMProps,\n role: 'img',\n 'aria-roledescription': stringFormatter.format('colorSwatch'),\n 'aria-label': [colorName, props['aria-label'] || ''].filter(Boolean).join(', '),\n 'aria-labelledby': props['aria-labelledby'] ? `${id} ${props['aria-labelledby']}` : undefined,\n id,\n style: {\n backgroundColor: color.toString('css'),\n // @ts-ignore\n forcedColorAdjust: 'none'\n }\n },\n color: color || null\n };\n}\n"],"names":[],"version":3,"file":"useColorSwatch.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAkCM,SAAS,0CAAe,KAA2B;IACxD,IAAI,EAAC,OAAO,KAAK,aAAE,SAAS,EAAC,GAAG;IAChC,IAAI,eAAe,SAAS;IAC5B,IAAI,QAAQ,CAAA,GAAA,cAAM,EAAE,IAAM,OAAO,iBAAiB,WAAW,CAAA,GAAA,iBAAS,EAAE,gBAAgB,cAAc;QAAC;KAAa;IACpH,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,gBAAQ;IACvB,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IACrD,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAChE,IAAI,KAAK,CAAA,GAAA,YAAI,EAAE,MAAM,EAAE;IAEvB,IAAI,CAAC,WACH,YAAY,MAAM,eAAe,CAAC,aAAa,IAAI,gBAAgB,MAAM,CAAC,iBAAiB,MAAM,YAAY,CAAC;IAGhH,OAAO;QACL,kBAAkB;YAChB,GAAG,QAAQ;YACX,MAAM;YACN,wBAAwB,gBAAgB,MAAM,CAAC;YAC/C,cAAc;gBAAC;gBAAW,KAAK,CAAC,aAAa,IAAI;aAAG,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC;YAC1E,mBAAmB,KAAK,CAAC,kBAAkB,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC,GAAG;gBACpF;YACA,OAAO;gBACL,iBAAiB,MAAM,QAAQ,CAAC;gBAChC,aAAa;gBACb,mBAAmB;YACrB;QACF;QACA,OAAO,SAAS;IAClB;AACF","sources":["packages/@react-aria/color/src/useColorSwatch.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMProps} from '@react-types/shared';\nimport {Color} from '@react-types/color';\nimport {filterDOMProps, useId} from '@react-aria/utils';\nimport {HTMLAttributes, useMemo} from 'react';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {parseColor} from '@react-stately/color';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaColorSwatchProps extends AriaLabelingProps, DOMProps {\n /** The color value to display in the swatch. */\n color?: string | Color | null,\n /** \n * A localized accessible name for the color.\n * By default, a description is generated from the color value,\n * but this can be overridden if you have a more specific color\n * name (e.g. Pantone colors).\n */\n colorName?: string\n}\n\nexport interface ColorSwatchAria {\n /** Props for the color swatch element. */\n colorSwatchProps: HTMLAttributes<HTMLElement>,\n /** The parsed color value of the swatch. */\n color: Color\n}\n\n/**\n * Provides the accessibility implementation for a color swatch component.\n * A color swatch displays a preview of a selected color.\n */\nexport function useColorSwatch(props: AriaColorSwatchProps): ColorSwatchAria {\n let {color: value, colorName} = props;\n let nonNullValue = value || '#fff0';\n let color = useMemo(() => typeof nonNullValue === 'string' ? parseColor(nonNullValue) : nonNullValue, [nonNullValue]);\n let {locale} = useLocale();\n let DOMProps = filterDOMProps(props, {labelable: true});\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/color');\n let id = useId(props.id);\n\n if (!colorName) {\n colorName = color.getChannelValue('alpha') === 0 ? stringFormatter.format('transparent') : color.getColorName(locale);\n }\n\n return {\n colorSwatchProps: {\n ...DOMProps,\n role: 'img',\n 'aria-roledescription': stringFormatter.format('colorSwatch'),\n 'aria-label': [colorName, props['aria-label'] || ''].filter(Boolean).join(', '),\n 'aria-labelledby': props['aria-labelledby'] ? `${id} ${props['aria-labelledby']}` : undefined,\n id,\n style: {\n backgroundColor: color.toString('css'),\n // @ts-ignore\n forcedColorAdjust: 'none'\n }\n },\n color: color || null\n };\n}\n"],"names":[],"version":3,"file":"useColorSwatch.module.js.map"}
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAkCM,SAAS,0CAAe,KAA2B;IACxD,IAAI,EAAC,OAAO,KAAK,aAAE,SAAS,EAAC,GAAG;IAChC,IAAI,eAAe,SAAS;IAC5B,IAAI,QAAQ,CAAA,GAAA,cAAM,EAAE,IAAM,OAAO,iBAAiB,WAAW,CAAA,GAAA,iBAAS,EAAE,gBAAgB,cAAc;QAAC;KAAa;IACpH,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,gBAAQ;IACvB,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IACrD,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAChE,IAAI,KAAK,CAAA,GAAA,YAAI,EAAE,MAAM,EAAE;IAEvB,IAAI,CAAC,WACH,YAAY,MAAM,eAAe,CAAC,aAAa,IAAI,gBAAgB,MAAM,CAAC,iBAAiB,MAAM,YAAY,CAAC;IAGhH,OAAO;QACL,kBAAkB;YAChB,GAAG,QAAQ;YACX,MAAM;YACN,wBAAwB,gBAAgB,MAAM,CAAC;YAC/C,cAAc;gBAAC;gBAAW,KAAK,CAAC,aAAa,IAAI;aAAG,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC;YAC1E,mBAAmB,KAAK,CAAC,kBAAkB,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC,GAAG;gBACpF;YACA,OAAO;gBACL,iBAAiB,MAAM,QAAQ,CAAC;gBAChC,aAAa;gBACb,mBAAmB;YACrB;QACF;QACA,OAAO,SAAS;IAClB;AACF","sources":["packages/@react-aria/color/src/useColorSwatch.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMProps} from '@react-types/shared';\nimport {Color} from '@react-types/color';\nimport {filterDOMProps, useId} from '@react-aria/utils';\nimport {HTMLAttributes, useMemo} from 'react';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {parseColor} from '@react-stately/color';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaColorSwatchProps extends AriaLabelingProps, DOMProps {\n /** The color value to display in the swatch. */\n color?: string | Color,\n /** \n * A localized accessible name for the color.\n * By default, a description is generated from the color value,\n * but this can be overridden if you have a more specific color\n * name (e.g. Pantone colors).\n */\n colorName?: string\n}\n\nexport interface ColorSwatchAria {\n /** Props for the color swatch element. */\n colorSwatchProps: HTMLAttributes<HTMLElement>,\n /** The parsed color value of the swatch. */\n color: Color\n}\n\n/**\n * Provides the accessibility implementation for a color swatch component.\n * A color swatch displays a preview of a selected color.\n */\nexport function useColorSwatch(props: AriaColorSwatchProps): ColorSwatchAria {\n let {color: value, colorName} = props;\n let nonNullValue = value || '#fff0';\n let color = useMemo(() => typeof nonNullValue === 'string' ? parseColor(nonNullValue) : nonNullValue, [nonNullValue]);\n let {locale} = useLocale();\n let DOMProps = filterDOMProps(props, {labelable: true});\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/color');\n let id = useId(props.id);\n\n if (!colorName) {\n colorName = color.getChannelValue('alpha') === 0 ? stringFormatter.format('transparent') : color.getColorName(locale);\n }\n\n return {\n colorSwatchProps: {\n ...DOMProps,\n role: 'img',\n 'aria-roledescription': stringFormatter.format('colorSwatch'),\n 'aria-label': [colorName, props['aria-label'] || ''].filter(Boolean).join(', '),\n 'aria-labelledby': props['aria-labelledby'] ? `${id} ${props['aria-labelledby']}` : undefined,\n id,\n style: {\n backgroundColor: color.toString('css'),\n // @ts-ignore\n forcedColorAdjust: 'none'\n }\n },\n color: color || null\n };\n}\n"],"names":[],"version":3,"file":"useColorSwatch.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/color",
3
- "version": "3.0.0-nightly.4718+4b27a0c02",
3
+ "version": "3.0.0-nightly.4723+9b48ec5d5",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,18 +22,18 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-aria/i18n": "3.0.0-nightly.3006+4b27a0c02",
26
- "@react-aria/interactions": "3.0.0-nightly.3006+4b27a0c02",
27
- "@react-aria/numberfield": "3.0.0-nightly.3006+4b27a0c02",
28
- "@react-aria/slider": "3.7.9-nightly.4718+4b27a0c02",
29
- "@react-aria/spinbutton": "3.0.0-nightly.3006+4b27a0c02",
30
- "@react-aria/textfield": "3.0.0-nightly.3006+4b27a0c02",
31
- "@react-aria/utils": "3.0.0-nightly.3006+4b27a0c02",
32
- "@react-aria/visually-hidden": "3.0.0-nightly.3006+4b27a0c02",
33
- "@react-stately/color": "3.6.2-nightly.4718+4b27a0c02",
34
- "@react-stately/form": "3.0.4-nightly.4718+4b27a0c02",
35
- "@react-types/color": "3.0.0-nightly.4718+4b27a0c02",
36
- "@react-types/shared": "3.0.0-nightly.3006+4b27a0c02",
25
+ "@react-aria/i18n": "3.0.0-nightly.3011+9b48ec5d5",
26
+ "@react-aria/interactions": "3.0.0-nightly.3011+9b48ec5d5",
27
+ "@react-aria/numberfield": "3.0.0-nightly.3011+9b48ec5d5",
28
+ "@react-aria/slider": "3.7.9-nightly.4723+9b48ec5d5",
29
+ "@react-aria/spinbutton": "3.0.0-nightly.3011+9b48ec5d5",
30
+ "@react-aria/textfield": "3.0.0-nightly.3011+9b48ec5d5",
31
+ "@react-aria/utils": "3.0.0-nightly.3011+9b48ec5d5",
32
+ "@react-aria/visually-hidden": "3.0.0-nightly.3011+9b48ec5d5",
33
+ "@react-stately/color": "3.6.2-nightly.4723+9b48ec5d5",
34
+ "@react-stately/form": "3.0.4-nightly.4723+9b48ec5d5",
35
+ "@react-types/color": "3.0.0-nightly.4723+9b48ec5d5",
36
+ "@react-types/shared": "3.0.0-nightly.3011+9b48ec5d5",
37
37
  "@swc/helpers": "^0.5.0"
38
38
  },
39
39
  "peerDependencies": {
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "4b27a0c027f4fbab9ed1070c748966c902b13429"
46
+ "gitHead": "9b48ec5d528adeba1a96592945459726def7ba56"
47
47
  }
@@ -21,7 +21,7 @@ import {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';
21
21
 
22
22
  export interface AriaColorSwatchProps extends AriaLabelingProps, DOMProps {
23
23
  /** The color value to display in the swatch. */
24
- color?: string | Color | null,
24
+ color?: string | Color,
25
25
  /**
26
26
  * A localized accessible name for the color.
27
27
  * By default, a description is generated from the color value,