@yamada-ui/color-picker 1.4.10-dev-20241119122307 → 1.4.10-dev-20241119150031
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{chunk-OPWYRBSP.mjs → chunk-3DDU22W6.mjs} +3 -2
- package/dist/chunk-3DDU22W6.mjs.map +1 -0
- package/dist/{chunk-QWG3QE6A.mjs → chunk-DDNDRQKD.mjs} +3 -3
- package/dist/{chunk-ASZZSRFB.mjs → chunk-KXJGUNXF.mjs} +5 -6
- package/dist/chunk-KXJGUNXF.mjs.map +1 -0
- package/dist/{chunk-NNVWH4IX.mjs → chunk-OL3O7L3O.mjs} +2 -2
- package/dist/{chunk-Z2KAER2U.mjs → chunk-T4JTAQXV.mjs} +7 -12
- package/dist/chunk-T4JTAQXV.mjs.map +1 -0
- package/dist/{chunk-XSZZBWND.mjs → chunk-ZW72SK4V.mjs} +2 -2
- package/dist/color-picker.js +7 -12
- package/dist/color-picker.js.map +1 -1
- package/dist/color-picker.mjs +6 -6
- package/dist/color-selector-body.js +1 -0
- package/dist/color-selector-body.js.map +1 -1
- package/dist/color-selector-body.mjs +2 -2
- package/dist/color-selector-swatches.js +1 -0
- package/dist/color-selector-swatches.js.map +1 -1
- package/dist/color-selector-swatches.mjs +2 -2
- package/dist/color-selector.js +1 -0
- package/dist/color-selector.js.map +1 -1
- package/dist/color-selector.mjs +4 -4
- package/dist/color-swatch.js +1 -0
- package/dist/color-swatch.js.map +1 -1
- package/dist/color-swatch.mjs +1 -1
- package/dist/index.js +7 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/use-color-picker.d.mts +0 -1
- package/dist/use-color-picker.d.ts +0 -1
- package/dist/use-color-picker.js +5 -10
- package/dist/use-color-picker.js.map +1 -1
- package/dist/use-color-picker.mjs +1 -1
- package/package.json +4 -4
- package/dist/chunk-ASZZSRFB.mjs.map +0 -1
- package/dist/chunk-OPWYRBSP.mjs.map +0 -1
- package/dist/chunk-Z2KAER2U.mjs.map +0 -1
- /package/dist/{chunk-QWG3QE6A.mjs.map → chunk-DDNDRQKD.mjs.map} +0 -0
- /package/dist/{chunk-NNVWH4IX.mjs.map → chunk-OL3O7L3O.mjs.map} +0 -0
- /package/dist/{chunk-XSZZBWND.mjs.map → chunk-ZW72SK4V.mjs.map} +0 -0
package/dist/color-swatch.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/color-swatch.tsx"],"sourcesContent":["import type {\n CSSUIObject,\n CSSUIProps,\n HTMLUIProps,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\n\nconst defaultOverlays = (\n background: CSSUIProps[\"color\"],\n withShadow: boolean,\n): HTMLUIProps[] => {\n let overlays: HTMLUIProps[] = [\n {\n bgImage:\n \"linear-gradient(45deg, $checkers 25%, transparent 25%), linear-gradient(-45deg, $checkers 25%, transparent 25%), linear-gradient(45deg, transparent 75%, $checkers 75%), linear-gradient(-45deg, $body 75%, $checkers 75%)\",\n bgPosition: `0 0, 0 4px, 4px -4px, -4px 0`,\n bgSize: `8px 8px`,\n vars: [\n {\n name: \"checkers\",\n token: \"colors\",\n value: [\"blackAlpha.300\", \"whiteAlpha.300\"],\n },\n {\n name: \"body\",\n token: \"colors\",\n value: [\"whiteAlpha.500\", \"blackAlpha.500\"],\n },\n ],\n },\n { background },\n ]\n\n if (withShadow)\n overlays = [\n ...overlays,\n {\n boxShadow: `rgba(0, 0, 0, .1) 0 0 0 1px inset, rgb(0, 0, 0, .15) 0 0 4px inset`,\n },\n ]\n\n return overlays\n}\n\ninterface ColorSwatchOptions {\n /**\n * The color used for the swatch element.\n *\n * @default \"#ffffff00\"\n */\n color?: CSSUIProps[\"color\"]\n /**\n * If `true`, the color swatch will be perfectly round. Else, it'll be slightly round.\n *\n * @default false\n */\n isRounded?: boolean\n /**\n * The overlay used for the swatch element.\n */\n overlays?: HTMLUIProps[]\n /**\n * If `true`, the swatch element has an inner `box-shadow`.\n *\n * @default true\n */\n withShadow?: boolean\n}\n\nexport interface ColorSwatchProps\n extends Omit<HTMLUIProps, \"color\">,\n ThemeProps<\"ColorSwatch\">,\n ColorSwatchOptions {}\n\n/**\n * `ColorSwatch` is a component that displays color samples.\n *\n * @see Docs https://yamada-ui.com/components/data-display/color-swatch\n */\nexport const ColorSwatch = forwardRef<ColorSwatchProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"ColorSwatch\", props)\n const {\n className,\n color = \"#ffffff00\",\n isRounded,\n withShadow = true,\n overlays = defaultOverlays(color, withShadow),\n __css,\n ...rest\n } = omitThemeProps(mergedProps)\n\n const css: CSSUIObject = {\n \"& > *\": {\n alignItems: \"center\",\n bottom: \"0\",\n display: \"flex\",\n h: \"100%\",\n justifyContent: \"center\",\n left: \"0\",\n overflow: \"hidden\",\n position: \"absolute\",\n right: \"0\",\n top: \"0\",\n w: \"100%\",\n },\n position: \"relative\",\n _before: {\n content: `\"\"`,\n display: \"block\",\n h: 0,\n pb: \"100%\",\n },\n ...styles.container,\n ...__css,\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-color-swatch\", className)}\n aria-roledescription=\"color swatch\"\n role=\"img\"\n {...(isRounded ? { rounded: \"fallback(full, 9999px)\" } : {})}\n __css={css}\n {...rest}\n >\n <ui.div {...(isRounded ? { rounded: \"fallback(full, 9999px)\" } : {})}>\n {overlays.map((props, index) => (\n <ui.div\n key={index}\n __css={{\n bottom: 0,\n left: 0,\n position: \"absolute\",\n right: 0,\n top: 0,\n ...styles.overlay,\n }}\n {...(isRounded ? { rounded: \"fallback(full, 9999px)\" } : {})}\n {...props}\n />\n ))}\n </ui.div>\n </ui.div>\n )\n})\n\nColorSwatch.displayName = \"ColorSwatch\"\nColorSwatch.__ui__ = \"ColorSwatch\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,kBAKO;AACP,
|
1
|
+
{"version":3,"sources":["../src/color-swatch.tsx"],"sourcesContent":["import type {\n CSSUIObject,\n CSSUIProps,\n HTMLUIProps,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { cx, isString } from \"@yamada-ui/utils\"\n\nconst defaultOverlays = (\n background: CSSUIProps[\"color\"],\n withShadow: boolean,\n): HTMLUIProps[] => {\n let overlays: HTMLUIProps[] = [\n {\n bgImage:\n \"linear-gradient(45deg, $checkers 25%, transparent 25%), linear-gradient(-45deg, $checkers 25%, transparent 25%), linear-gradient(45deg, transparent 75%, $checkers 75%), linear-gradient(-45deg, $body 75%, $checkers 75%)\",\n bgPosition: `0 0, 0 4px, 4px -4px, -4px 0`,\n bgSize: `8px 8px`,\n vars: [\n {\n name: \"checkers\",\n token: \"colors\",\n value: [\"blackAlpha.300\", \"whiteAlpha.300\"],\n },\n {\n name: \"body\",\n token: \"colors\",\n value: [\"whiteAlpha.500\", \"blackAlpha.500\"],\n },\n ],\n },\n { background },\n ]\n\n if (withShadow)\n overlays = [\n ...overlays,\n {\n boxShadow: `rgba(0, 0, 0, .1) 0 0 0 1px inset, rgb(0, 0, 0, .15) 0 0 4px inset`,\n },\n ]\n\n return overlays\n}\n\ninterface ColorSwatchOptions {\n /**\n * The color used for the swatch element.\n *\n * @default \"#ffffff00\"\n */\n color?: CSSUIProps[\"color\"]\n /**\n * If `true`, the color swatch will be perfectly round. Else, it'll be slightly round.\n *\n * @default false\n */\n isRounded?: boolean\n /**\n * The overlay used for the swatch element.\n */\n overlays?: HTMLUIProps[]\n /**\n * If `true`, the swatch element has an inner `box-shadow`.\n *\n * @default true\n */\n withShadow?: boolean\n}\n\nexport interface ColorSwatchProps\n extends Omit<HTMLUIProps, \"color\">,\n ThemeProps<\"ColorSwatch\">,\n ColorSwatchOptions {}\n\n/**\n * `ColorSwatch` is a component that displays color samples.\n *\n * @see Docs https://yamada-ui.com/components/data-display/color-swatch\n */\nexport const ColorSwatch = forwardRef<ColorSwatchProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"ColorSwatch\", props)\n const {\n className,\n color = \"#ffffff00\",\n isRounded,\n withShadow = true,\n overlays = defaultOverlays(color, withShadow),\n __css,\n ...rest\n } = omitThemeProps(mergedProps)\n\n const css: CSSUIObject = {\n \"& > *\": {\n alignItems: \"center\",\n bottom: \"0\",\n display: \"flex\",\n h: \"100%\",\n justifyContent: \"center\",\n left: \"0\",\n overflow: \"hidden\",\n position: \"absolute\",\n right: \"0\",\n top: \"0\",\n w: \"100%\",\n },\n position: \"relative\",\n _before: {\n content: `\"\"`,\n display: \"block\",\n h: 0,\n pb: \"100%\",\n },\n ...styles.container,\n ...__css,\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-color-swatch\", className)}\n aria-label={isString(color) ? color : undefined}\n aria-roledescription=\"color swatch\"\n role=\"img\"\n {...(isRounded ? { rounded: \"fallback(full, 9999px)\" } : {})}\n __css={css}\n {...rest}\n >\n <ui.div {...(isRounded ? { rounded: \"fallback(full, 9999px)\" } : {})}>\n {overlays.map((props, index) => (\n <ui.div\n key={index}\n __css={{\n bottom: 0,\n left: 0,\n position: \"absolute\",\n right: 0,\n top: 0,\n ...styles.overlay,\n }}\n {...(isRounded ? { rounded: \"fallback(full, 9999px)\" } : {})}\n {...props}\n />\n ))}\n </ui.div>\n </ui.div>\n )\n})\n\nColorSwatch.displayName = \"ColorSwatch\"\nColorSwatch.__ui__ = \"ColorSwatch\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,kBAKO;AACP,mBAA6B;AA4HnB;AA1HV,IAAM,kBAAkB,CACtB,YACA,eACkB;AAClB,MAAI,WAA0B;AAAA,IAC5B;AAAA,MACE,SACE;AAAA,MACF,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,MAAM;AAA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AAE,SAAS,yBAAyB,IAAI,CAAC;AAAA,MAC1D,OAAO;AAAA,MACN,GAAG;AAAA,MAEJ,sDAAC,eAAG,KAAH,EAAQ,GAAI,YAAY,EAAE,SAAS,yBAAyB,IAAI,CAAC,GAC/D,mBAAS,IAAI,CAACA,QAAO,UACpB;AAAA,QAAC,eAAG;AAAA,QAAH;AAAA,UAEC,OAAO;AAAA,YACL,QAAQ;AAAA,YACR,MAAM;AAAA,YACN,UAAU;AAAA,YACV,OAAO;AAAA,YACP,KAAK;AAAA,YACL,GAAG,OAAO;AAAA,UACZ;AAAA,UACC,GAAI,YAAY,EAAE,SAAS,yBAAyB,IAAI,CAAC;AAAA,UACzD,GAAGA;AAAA;AAAA,QAVC;AAAA,MAWP,CACD,GACH;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,YAAY,cAAc;AAC1B,YAAY,SAAS;","names":["props"]}
|
package/dist/color-swatch.mjs
CHANGED
package/dist/index.js
CHANGED
@@ -1201,6 +1201,7 @@ var ColorSwatch = (0, import_core5.forwardRef)((props, ref) => {
|
|
1201
1201
|
{
|
1202
1202
|
ref,
|
1203
1203
|
className: (0, import_utils7.cx)("ui-color-swatch", className),
|
1204
|
+
"aria-label": (0, import_utils7.isString)(color) ? color : void 0,
|
1204
1205
|
"aria-roledescription": "color swatch",
|
1205
1206
|
role: "img",
|
1206
1207
|
...isRounded ? { rounded: "fallback(full, 9999px)" } : {},
|
@@ -1906,8 +1907,7 @@ var [ColorPickerProvider, useColorPickerContext] = (0, import_utils14.createCont
|
|
1906
1907
|
errorMessage: `useColorPickerContext returned is 'undefined'. Seems you forgot to wrap the components in "<ColorPicker />"`
|
1907
1908
|
});
|
1908
1909
|
var useColorPicker = (props) => {
|
1909
|
-
|
1910
|
-
id,
|
1910
|
+
const {
|
1911
1911
|
allowInput = true,
|
1912
1912
|
animation,
|
1913
1913
|
boundary,
|
@@ -1987,8 +1987,6 @@ var useColorPicker = (props) => {
|
|
1987
1987
|
onClose: onCloseProp,
|
1988
1988
|
onOpen: onOpenProp
|
1989
1989
|
});
|
1990
|
-
const uuid = (0, import_react5.useId)();
|
1991
|
-
id != null ? id : id = uuid;
|
1992
1990
|
const onOpen = (0, import_react5.useCallback)(() => {
|
1993
1991
|
if (disabled || readOnly) return;
|
1994
1992
|
onInternalOpen();
|
@@ -2165,10 +2163,11 @@ var useColorPicker = (props) => {
|
|
2165
2163
|
);
|
2166
2164
|
const getFieldProps = (0, import_react5.useCallback)(
|
2167
2165
|
(props2 = {}, ref = null) => ({
|
2168
|
-
"aria-
|
2166
|
+
"aria-haspopup": "dialog",
|
2169
2167
|
"data-active": (0, import_utils14.dataAttr)(isOpen),
|
2170
2168
|
"data-not-allowed": (0, import_utils14.dataAttr)(!readOnly && !disabled && !allowInput),
|
2171
|
-
|
2169
|
+
role: "combobox",
|
2170
|
+
tabIndex: -1,
|
2172
2171
|
...formControlProps,
|
2173
2172
|
...props2,
|
2174
2173
|
ref: (0, import_utils14.mergeRefs)(fieldRef, ref),
|
@@ -2197,8 +2196,7 @@ var useColorPicker = (props) => {
|
|
2197
2196
|
...disabled || !allowInput ? { pointerEvents: "none" } : {}
|
2198
2197
|
};
|
2199
2198
|
return {
|
2200
|
-
"
|
2201
|
-
role: "combobox",
|
2199
|
+
autoComplete: "off",
|
2202
2200
|
tabIndex: !allowInput ? -1 : 0,
|
2203
2201
|
...formControlProps,
|
2204
2202
|
...inputProps,
|
@@ -2210,7 +2208,6 @@ var useColorPicker = (props) => {
|
|
2210
2208
|
};
|
2211
2209
|
},
|
2212
2210
|
[
|
2213
|
-
id,
|
2214
2211
|
inputProps,
|
2215
2212
|
allowInput,
|
2216
2213
|
disabled,
|
@@ -2281,7 +2278,6 @@ var useColorPicker = (props) => {
|
|
2281
2278
|
]
|
2282
2279
|
);
|
2283
2280
|
return {
|
2284
|
-
id,
|
2285
2281
|
allowInput,
|
2286
2282
|
eyeDropperSupported,
|
2287
2283
|
value,
|
@@ -2330,7 +2326,6 @@ var ColorPicker = (0, import_core12.forwardRef)(
|
|
2330
2326
|
...computedProps
|
2331
2327
|
} = (0, import_core12.omitThemeProps)(mergedProps, ["withSwatch"]);
|
2332
2328
|
const {
|
2333
|
-
id,
|
2334
2329
|
eyeDropperSupported,
|
2335
2330
|
value,
|
2336
2331
|
getContainerProps,
|
@@ -2388,7 +2383,7 @@ var ColorPicker = (0, import_core12.forwardRef)(
|
|
2388
2383
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_portal.Portal, { ...portalProps, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
2389
2384
|
import_popover.PopoverContent,
|
2390
2385
|
{
|
2391
|
-
|
2386
|
+
as: "div",
|
2392
2387
|
className: "ui-color-picker__content",
|
2393
2388
|
__css: { ...styles.content },
|
2394
2389
|
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|