@sanity/color-input 3.1.0 → 3.1.2

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Sanity.io
3
+ Copyright (c) 2024 Sanity.io
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/lib/index.d.ts CHANGED
@@ -1,8 +1,7 @@
1
- /// <reference types="react" />
2
-
3
1
  import {Color} from 'react-color'
4
2
  import {HSLColor} from 'react-color'
5
3
  import {HSVColor} from 'react-color'
4
+ import {JSX as JSX_2} from 'react/jsx-runtime'
6
5
  import {ObjectDefinition} from 'sanity'
7
6
  import {ObjectInputProps} from 'sanity'
8
7
  import {ObjectOptions} from 'sanity'
@@ -37,7 +36,7 @@ export declare interface ColorDefinition
37
36
  options?: ColorOptions
38
37
  }
39
38
 
40
- export declare function ColorInput(props: ObjectInputProps): JSX.Element
39
+ export declare function ColorInput(props: ObjectInputProps): JSX_2.Element
41
40
 
42
41
  export declare const colorInput: Plugin_2<void>
43
42
 
package/lib/index.esm.js CHANGED
@@ -1,5 +1,3 @@
1
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
2
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
1
  import { defineType, set, setIfMissing, unset, definePlugin } from 'sanity';
4
2
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
5
3
  import { useMemo, useCallback, useRef, useState, useEffect } from 'react';
@@ -1353,9 +1351,15 @@ function validateWCAG2Parms(parms) {
1353
1351
  size: size
1354
1352
  };
1355
1353
  }
1356
- const ColorListWrap = styled(Flex)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n gap: 0.25em;\n"])));
1357
- const ColorBoxContainer = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 2.1em;\n height: 2.1em;\n cursor: pointer;\n position: relative;\n overflow: hidden;\n border-radius: 3px;\n background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAADFJREFUOE9jZGBgEGHAD97gk2YcNYBhmIQBgWSAP52AwoAQwJvQRg1gACckQoC2gQgAIF8IscwEtKYAAAAASUVORK5CYII=') left center #fff;\n"])));
1358
- const ColorBox$1 = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n content: '';\n position: absolute;\n inset: 0;\n z-index: 1;\n"])));
1354
+ var __freeze$1 = Object.freeze;
1355
+ var __defProp$1 = Object.defineProperty;
1356
+ var __template$1 = (cooked, raw) => __freeze$1(__defProp$1(cooked, "raw", {
1357
+ value: __freeze$1(raw || cooked.slice())
1358
+ }));
1359
+ var _a$1, _b$1, _c;
1360
+ const ColorListWrap = styled(Flex)(_a$1 || (_a$1 = __template$1(["\n gap: 0.25em;\n"])));
1361
+ const ColorBoxContainer = styled.div(_b$1 || (_b$1 = __template$1(["\n width: 2.1em;\n height: 2.1em;\n cursor: pointer;\n position: relative;\n overflow: hidden;\n border-radius: 3px;\n background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAADFJREFUOE9jZGBgEGHAD97gk2YcNYBhmIQBgWSAP52AwoAQwJvQRg1gACckQoC2gQgAIF8IscwEtKYAAAAASUVORK5CYII=') left center #fff;\n"])));
1362
+ const ColorBox$1 = styled.div(_c || (_c = __template$1(["\n border-radius: inherit;\n box-shadow: inset 0 0 0 1px var(--card-shadow-outline-color);\n content: '';\n position: absolute;\n inset: 0;\n z-index: 1;\n"])));
1359
1363
  const validateColors = colors => colors.reduce((cls, c) => {
1360
1364
  const color = c.hex ? tinycolor(c.hex) : tinycolor(c);
1361
1365
  if (color.isValid()) {
@@ -1392,10 +1396,16 @@ const ColorList = _ref2 => {
1392
1396
  })
1393
1397
  });
1394
1398
  };
1395
- const ColorBox = styled(Box)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"])));
1396
- const ReadOnlyContainer = styled(Flex)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin-top: 6rem;\n background-color: var(--card-bg-color);\n position: relative;\n width: 100%;\n"])));
1399
+ var __freeze = Object.freeze;
1400
+ var __defProp = Object.defineProperty;
1401
+ var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", {
1402
+ value: __freeze(raw || cooked.slice())
1403
+ }));
1404
+ var _a, _b;
1405
+ const ColorBox = styled(Box)(_a || (_a = __template(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"])));
1406
+ const ReadOnlyContainer = styled(Flex)(_b || (_b = __template(["\n margin-top: 6rem;\n background-color: var(--card-bg-color);\n position: relative;\n width: 100%;\n"])));
1397
1407
  const ColorPickerInner = props => {
1398
- var _a, _b, _c;
1408
+ var _a2, _b2, _c;
1399
1409
  const {
1400
1410
  width,
1401
1411
  color: {
@@ -1499,7 +1509,7 @@ const ColorPickerInner = props => {
1499
1509
  size: 1,
1500
1510
  children: [/* @__PURE__ */jsx("strong", {
1501
1511
  children: "HSL: "
1502
- }), " ", Math.round((_a = hsl == null ? void 0 : hsl.h) != null ? _a : 0), " ", Math.round((_b = hsl == null ? void 0 : hsl.s) != null ? _b : 0), "%", " ", Math.round((_c = hsl == null ? void 0 : hsl.l) != null ? _c : 0)]
1512
+ }), " ", Math.round((_a2 = hsl == null ? void 0 : hsl.h) != null ? _a2 : 0), " ", Math.round(((_b2 = hsl == null ? void 0 : hsl.s) != null ? _b2 : 0) * 100), "% ", Math.round(((_c = hsl == null ? void 0 : hsl.l) != null ? _c : 0) * 100), "%"]
1503
1513
  })]
1504
1514
  })]
1505
1515
  })