@sanity/color-input 2.36.0-v2-studio.1 → 2.36.1

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) 2022 - 2022 Sanity.io
3
+ Copyright (c) 2023 - 2022 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/README.md CHANGED
@@ -14,7 +14,7 @@ yarn add @sanity/color-input@studio-v2
14
14
  Next, add `"@sanity/color-input"` to `sanity.json` plugins array:
15
15
  ```json
16
16
  "plugins": [
17
- @sanity/color-input
17
+ "@sanity/color-input"
18
18
  ]
19
19
  ```
20
20
 
package/lib/ColorInput.js CHANGED
@@ -79,11 +79,15 @@ class ColorInput extends _react.PureComponent {
79
79
  type = _this$props2.type,
80
80
  readOnly = _this$props2.readOnly,
81
81
  value = _this$props2.value,
82
- level = _this$props2.level;
82
+ level = _this$props2.level,
83
+ markers = _this$props2.markers,
84
+ presence = _this$props2.presence;
83
85
  return /*#__PURE__*/_react.default.createElement(_components.FormField, {
84
86
  title: type.title,
85
87
  description: type.description,
86
- level: level
88
+ level: level,
89
+ __unstable_markers: markers,
90
+ __unstable_presence: presence
87
91
  }, value ? /*#__PURE__*/_react.default.createElement(_ColorPicker.default, {
88
92
  ref: this.focusRef,
89
93
  color: value.hsl || value.hex,
@@ -116,6 +120,8 @@ _defineProperty(ColorInput, "propTypes", {
116
120
  value: _propTypes.default.shape({
117
121
  hex: _propTypes.default.string,
118
122
  alpha: _propTypes.default.number
119
- })
123
+ }),
124
+ markers: _propTypes.default.array,
125
+ presence: _propTypes.default.array
120
126
  });
121
127
  //# sourceMappingURL=ColorInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorInput.js","names":["set","patches","unset","setIfMissing","DEFAULT_COLOR","hex","hsl","h","s","l","a","hsv","v","rgb","r","g","b","source","ColorInput","PureComponent","React","createRef","nextColor","props","onChange","type","fieldPatches","fields","filter","field","name","map","nextFieldValue","isObject","jsonType","Object","assign","_type","PatchEvent","from","debounce","emitSetColor","focus","focusRef","current","render","readOnly","value","level","title","description","handleColorChange","options","disableAlpha","handleUnset","AddIcon","Boolean","handleCreateColor","PropTypes","shape","string","arrayOf","isRequired","func","bool","alpha","number"],"sources":["../src/ColorInput.js"],"sourcesContent":["///<reference types=\"@sanity/types/parts\" />\n\n/* eslint-disable id-length */\nimport React, {PureComponent} from 'react'\nimport PropTypes from 'prop-types'\nimport {PatchEvent, patches} from 'part:@sanity/form-builder'\nimport {debounce} from 'lodash'\nimport {Button} from '@sanity/ui'\nimport {AddIcon} from '@sanity/icons'\nimport {FormField} from '@sanity/base/components'\nimport ColorPicker from './ColorPicker'\n\nconst {set, unset, setIfMissing} = patches\n\nconst DEFAULT_COLOR = {\n hex: '#24a3e3',\n hsl: {h: 200, s: 0.7732, l: 0.5156, a: 1},\n hsv: {h: 200, s: 0.8414, v: 0.8901, a: 1},\n rgb: {r: 46, g: 163, b: 227, a: 1},\n source: 'hex',\n}\n\nexport default class ColorInput extends PureComponent {\n focusRef = React.createRef()\n static propTypes = {\n type: PropTypes.shape({\n name: PropTypes.string,\n title: PropTypes.string,\n description: PropTypes.string,\n fields: PropTypes.arrayOf(\n PropTypes.shape({\n name: PropTypes.string.isRequired,\n })\n ),\n }).isRequired,\n onChange: PropTypes.func.isRequired,\n readOnly: PropTypes.bool,\n value: PropTypes.shape({\n hex: PropTypes.string,\n alpha: PropTypes.number,\n }),\n }\n\n focus() {\n // todo: make the ColorPicker component support .focus()\n if (this.focusRef.current && this.focusRef.current.focus) {\n this.focusRef.current.focus()\n }\n }\n\n emitSetColor = (nextColor) => {\n const {onChange, type} = this.props\n\n const fieldPatches = type.fields\n .filter((field) => field.name in nextColor)\n .map((field) => {\n const nextFieldValue = nextColor[field.name]\n const isObject = field.type.jsonType === 'object'\n return set(\n isObject ? Object.assign({_type: field.type.name}, nextFieldValue) : nextFieldValue,\n [field.name]\n )\n })\n\n onChange(\n PatchEvent.from([\n setIfMissing({_type: type.name}),\n set(type.name, ['_type']),\n set(nextColor.rgb.a, ['alpha']),\n ...fieldPatches,\n ])\n )\n }\n\n // The color picker emits onChange events continuously while the user is sliding the\n // hue/saturation/alpha selectors. This debounces the event to avoid excessive patches\n handleColorChange = debounce(this.emitSetColor, 100)\n\n handleCreateColor = () => {\n this.emitSetColor(DEFAULT_COLOR)\n }\n\n handleUnset = () => {\n this.props.onChange(PatchEvent.from(unset()))\n }\n\n render() {\n const {type, readOnly, value, level} = this.props\n return (\n <FormField title={type.title} description={type.description} level={level}>\n {value ? (\n <ColorPicker\n ref={this.focusRef}\n color={value.hsl || value.hex}\n readOnly={readOnly || type.readOnly}\n onChange={this.handleColorChange}\n disableAlpha={type.options && type.options.disableAlpha}\n onUnset={this.handleUnset}\n />\n ) : (\n <Button\n icon={AddIcon}\n mode=\"ghost\"\n text=\"Create color\"\n ref={this.focusRef}\n disabled={Boolean(readOnly)}\n onClick={this.handleCreateColor}\n />\n )}\n </FormField>\n )\n }\n}\n"],"mappings":";;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAuC;AAAA;AAAA;AAAA;AAEvC,IAAOA,GAAG,GAAyBC,oBAAO,CAAnCD,GAAG;EAAEE,KAAK,GAAkBD,oBAAO,CAA9BC,KAAK;EAAEC,YAAY,GAAIF,oBAAO,CAAvBE,YAAY;AAE/B,IAAMC,aAAa,GAAG;EACpBC,GAAG,EAAE,SAAS;EACdC,GAAG,EAAE;IAACC,CAAC,EAAE,GAAG;IAAEC,CAAC,EAAE,MAAM;IAAEC,CAAC,EAAE,MAAM;IAAEC,CAAC,EAAE;EAAC,CAAC;EACzCC,GAAG,EAAE;IAACJ,CAAC,EAAE,GAAG;IAAEC,CAAC,EAAE,MAAM;IAAEI,CAAC,EAAE,MAAM;IAAEF,CAAC,EAAE;EAAC,CAAC;EACzCG,G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,CAAE;MAC5B,OAAO,EAAE,IAAI,CAACW;IAAkB,EAEnC,CACS;EAEhB;AACF;AAAC;AAAA,gBA1FoBvC,UAAU,eAEV;EACjBO,IAAI,EAAEiC,kBAAS,CAACC,KAAK,CAAC;IACpB7B,IAAI,EAAE4B,kBAAS,CAACE,MAAM;IACtBX,KAAK,EAAES,kBAAS,CAACE,MAAM;IACvBV,WAAW,EAAEQ,kBAAS,CAACE,MAAM;IAC7BjC,MAAM,EAAE+B,kBAAS,CAACG,OAAO,CACvBH,kBAAS,CAACC,KAAK,CAAC;MACd7B,IAAI,EAAE4B,kBAAS,CAACE,MAAM,CAACE;IACzB,CAAC,CAAC;EAEN,CAAC,CAAC,CAACA,UAAU;EACbtC,QAAQ,EAAEkC,kBAAS,CAACK,IAAI,CAACD,UAAU;EACnChB,QAAQ,EAAEY,kBAAS,CAACM,IAAI;EACxBjB,KAAK,EAAEW,kBAAS,CAACC,KAAK,CAAC;IACrBtD,GAAG,EAAEqD,kBAAS,CAACE,MAAM;IACrBK,KAAK,EAAEP,kBAAS,CAACQ;EACnB,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"ColorInput.js","names":["set","patches","unset","setIfMissing","DEFAULT_COLOR","hex","hsl","h","s","l","a","hsv","v","rgb","r","g","b","source","ColorInput","PureComponent","React","createRef","nextColor","props","onChange","type","fieldPatches","fields","filter","field","name","map","nextFieldValue","isObject","jsonType","Object","assign","_type","PatchEvent","from","debounce","emitSetColor","focus","focusRef","current","render","readOnly","value","level","markers","presence","title","description","handleColorChange","options","disableAlpha","handleUnset","AddIcon","Boolean","handleCreateColor","PropTypes","shape","string","arrayOf","isRequired","func","bool","alpha","number","array"],"sources":["../src/ColorInput.js"],"sourcesContent":["///<reference types=\"@sanity/types/parts\" />\n\n/* eslint-disable id-length */\nimport React, {PureComponent} from 'react'\nimport PropTypes from 'prop-types'\nimport {PatchEvent, patches} from 'part:@sanity/form-builder'\nimport {debounce} from 'lodash'\nimport {Button} from '@sanity/ui'\nimport {AddIcon} from '@sanity/icons'\nimport {FormField} from '@sanity/base/components'\nimport ColorPicker from './ColorPicker'\n\nconst {set, unset, setIfMissing} = patches\n\nconst DEFAULT_COLOR = {\n hex: '#24a3e3',\n hsl: {h: 200, s: 0.7732, l: 0.5156, a: 1},\n hsv: {h: 200, s: 0.8414, v: 0.8901, a: 1},\n rgb: {r: 46, g: 163, b: 227, a: 1},\n source: 'hex',\n}\n\nexport default class ColorInput extends PureComponent {\n focusRef = React.createRef()\n static propTypes = {\n type: PropTypes.shape({\n name: PropTypes.string,\n title: PropTypes.string,\n description: PropTypes.string,\n fields: PropTypes.arrayOf(\n PropTypes.shape({\n name: PropTypes.string.isRequired,\n })\n ),\n }).isRequired,\n onChange: PropTypes.func.isRequired,\n readOnly: PropTypes.bool,\n value: PropTypes.shape({\n hex: PropTypes.string,\n alpha: PropTypes.number,\n }),\n markers: PropTypes.array,\n presence: PropTypes.array,\n }\n\n focus() {\n // todo: make the ColorPicker component support .focus()\n if (this.focusRef.current && this.focusRef.current.focus) {\n this.focusRef.current.focus()\n }\n }\n\n emitSetColor = (nextColor) => {\n const {onChange, type} = this.props\n\n const fieldPatches = type.fields\n .filter((field) => field.name in nextColor)\n .map((field) => {\n const nextFieldValue = nextColor[field.name]\n const isObject = field.type.jsonType === 'object'\n return set(\n isObject ? Object.assign({_type: field.type.name}, nextFieldValue) : nextFieldValue,\n [field.name]\n )\n })\n\n onChange(\n PatchEvent.from([\n setIfMissing({_type: type.name}),\n set(type.name, ['_type']),\n set(nextColor.rgb.a, ['alpha']),\n ...fieldPatches,\n ])\n )\n }\n\n // The color picker emits onChange events continuously while the user is sliding the\n // hue/saturation/alpha selectors. This debounces the event to avoid excessive patches\n handleColorChange = debounce(this.emitSetColor, 100)\n\n handleCreateColor = () => {\n this.emitSetColor(DEFAULT_COLOR)\n }\n\n handleUnset = () => {\n this.props.onChange(PatchEvent.from(unset()))\n }\n\n render() {\n const {type, readOnly, value, level, markers, presence} = this.props\n return (\n <FormField\n title={type.title}\n description={type.description}\n level={level}\n __unstable_markers={markers}\n __unstable_presence={presence}\n >\n {value ? (\n <ColorPicker\n ref={this.focusRef}\n color={value.hsl || value.hex}\n readOnly={readOnly || type.readOnly}\n onChange={this.handleColorChange}\n disableAlpha={type.options && type.options.disableAlpha}\n onUnset={this.handleUnset}\n />\n ) : (\n <Button\n icon={AddIcon}\n mode=\"ghost\"\n text=\"Create color\"\n ref={this.focusRef}\n disabled={Boolean(readOnly)}\n onClick={this.handleCreateColor}\n />\n )}\n </FormField>\n )\n }\n}\n"],"mappings":";;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAuC;AAAA;AAAA;AAAA;AAEvC,IAAOA,GAAG,GAAyBC,oBAAO,CAAnCD,GAAG;EAAEE,KAAK,GAAkBD,oBAAO,CAA9BC,KAAK;EAAEC,YAAY,GAAIF,oBAAO,CAAvBE,YAAY;AAE/B,IAAMC,aAAa,GAAG;EACpBC,GAAG,EAAE,SAAS;EACdC,GAAG,EAAE;IAACC,CAAC,EAAE,GAAG;IAAEC,CAAC,EAAE,MAAM;IAAEC,CAAC,EAAE,MAAM;IAAEC,CAAC,EAAE;EAAC,CAAC;EACzCC,GAAG,EAAE;IAACJ,CAAC,EAAE,GAAG;IAAEC,CAAC,EAAE,MAAM;IAAEI,CAAC,EAAE,MAAM;IAAEF,CAAC,EAAE;EAAC,CAAC;EACzCG,GAAG,EAAE;IAACC,CAAC,EAAE,EAAE;IAAEC,CAAC,EAAE,GAAG;IAAEC,CAAC,EAAE,GAAG;IAAEN,CAAC,EAAE;EAAC,CAAC;EAClCO,MAAM,EAAE;AACV,CAAC;AAEc,MAAMC,UAAU,SAASC,oBAAa,CAAC;EAAA;IAAA;IAAA,+CACzCC,cAAK,CAACC,SAAS,EAAE;IAAA,sCA6BZC,SAAS,IAAK;MAC5B,kBAAyB,IAAI,CAACC,KAAK;QAA5BC,QAAQ,eAARA,QAAQ;QAAEC,IAAI,eAAJA,IAAI;MAErB,IA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WAAW,EAAEQ,kBAAS,CAACE,MAAM;IAC7BnC,MAAM,EAAEiC,kBAAS,CAACG,OAAO,CACvBH,kBAAS,CAACC,KAAK,CAAC;MACd/B,IAAI,EAAE8B,kBAAS,CAACE,MAAM,CAACE;IACzB,CAAC,CAAC;EAEN,CAAC,CAAC,CAACA,UAAU;EACbxC,QAAQ,EAAEoC,kBAAS,CAACK,IAAI,CAACD,UAAU;EACnClB,QAAQ,EAAEc,kBAAS,CAACM,IAAI;EACxBnB,KAAK,EAAEa,kBAAS,CAACC,KAAK,CAAC;IACrBxD,GAAG,EAAEuD,kBAAS,CAACE,MAAM;IACrBK,KAAK,EAAEP,kBAAS,CAACQ;EACnB,CAAC,CAAC;EACFnB,OAAO,EAAEW,kBAAS,CAACS,KAAK;EACxBnB,QAAQ,EAAEU,kBAAS,CAACS;AACtB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/color-input",
3
- "version": "2.36.0-v2-studio.1",
3
+ "version": "2.36.1",
4
4
  "description": "Color input for Sanity Studio",
5
5
  "keywords": [
6
6
  "sanity",
@@ -13,7 +13,7 @@
13
13
  ],
14
14
  "homepage": "https://www.sanity.io/",
15
15
  "bugs": {
16
- "url": "git@github.com:sanity-io//issues"
16
+ "url": "https://github.com/sanity-io/color-input/issues"
17
17
  },
18
18
  "repository": {
19
19
  "type": "git",
@@ -22,6 +22,11 @@
22
22
  "license": "MIT",
23
23
  "author": "Sanity.io <hello@sanity.io>",
24
24
  "main": "lib/schemas/color.js",
25
+ "files": [
26
+ "lib",
27
+ "src",
28
+ "sanity.json"
29
+ ],
25
30
  "scripts": {
26
31
  "prebuild": "npm run clean",
27
32
  "build": "sanipack build",
@@ -0,0 +1,121 @@
1
+ ///<reference types="@sanity/types/parts" />
2
+
3
+ /* eslint-disable id-length */
4
+ import React, {PureComponent} from 'react'
5
+ import PropTypes from 'prop-types'
6
+ import {PatchEvent, patches} from 'part:@sanity/form-builder'
7
+ import {debounce} from 'lodash'
8
+ import {Button} from '@sanity/ui'
9
+ import {AddIcon} from '@sanity/icons'
10
+ import {FormField} from '@sanity/base/components'
11
+ import ColorPicker from './ColorPicker'
12
+
13
+ const {set, unset, setIfMissing} = patches
14
+
15
+ const DEFAULT_COLOR = {
16
+ hex: '#24a3e3',
17
+ hsl: {h: 200, s: 0.7732, l: 0.5156, a: 1},
18
+ hsv: {h: 200, s: 0.8414, v: 0.8901, a: 1},
19
+ rgb: {r: 46, g: 163, b: 227, a: 1},
20
+ source: 'hex',
21
+ }
22
+
23
+ export default class ColorInput extends PureComponent {
24
+ focusRef = React.createRef()
25
+ static propTypes = {
26
+ type: PropTypes.shape({
27
+ name: PropTypes.string,
28
+ title: PropTypes.string,
29
+ description: PropTypes.string,
30
+ fields: PropTypes.arrayOf(
31
+ PropTypes.shape({
32
+ name: PropTypes.string.isRequired,
33
+ })
34
+ ),
35
+ }).isRequired,
36
+ onChange: PropTypes.func.isRequired,
37
+ readOnly: PropTypes.bool,
38
+ value: PropTypes.shape({
39
+ hex: PropTypes.string,
40
+ alpha: PropTypes.number,
41
+ }),
42
+ markers: PropTypes.array,
43
+ presence: PropTypes.array,
44
+ }
45
+
46
+ focus() {
47
+ // todo: make the ColorPicker component support .focus()
48
+ if (this.focusRef.current && this.focusRef.current.focus) {
49
+ this.focusRef.current.focus()
50
+ }
51
+ }
52
+
53
+ emitSetColor = (nextColor) => {
54
+ const {onChange, type} = this.props
55
+
56
+ const fieldPatches = type.fields
57
+ .filter((field) => field.name in nextColor)
58
+ .map((field) => {
59
+ const nextFieldValue = nextColor[field.name]
60
+ const isObject = field.type.jsonType === 'object'
61
+ return set(
62
+ isObject ? Object.assign({_type: field.type.name}, nextFieldValue) : nextFieldValue,
63
+ [field.name]
64
+ )
65
+ })
66
+
67
+ onChange(
68
+ PatchEvent.from([
69
+ setIfMissing({_type: type.name}),
70
+ set(type.name, ['_type']),
71
+ set(nextColor.rgb.a, ['alpha']),
72
+ ...fieldPatches,
73
+ ])
74
+ )
75
+ }
76
+
77
+ // The color picker emits onChange events continuously while the user is sliding the
78
+ // hue/saturation/alpha selectors. This debounces the event to avoid excessive patches
79
+ handleColorChange = debounce(this.emitSetColor, 100)
80
+
81
+ handleCreateColor = () => {
82
+ this.emitSetColor(DEFAULT_COLOR)
83
+ }
84
+
85
+ handleUnset = () => {
86
+ this.props.onChange(PatchEvent.from(unset()))
87
+ }
88
+
89
+ render() {
90
+ const {type, readOnly, value, level, markers, presence} = this.props
91
+ return (
92
+ <FormField
93
+ title={type.title}
94
+ description={type.description}
95
+ level={level}
96
+ __unstable_markers={markers}
97
+ __unstable_presence={presence}
98
+ >
99
+ {value ? (
100
+ <ColorPicker
101
+ ref={this.focusRef}
102
+ color={value.hsl || value.hex}
103
+ readOnly={readOnly || type.readOnly}
104
+ onChange={this.handleColorChange}
105
+ disableAlpha={type.options && type.options.disableAlpha}
106
+ onUnset={this.handleUnset}
107
+ />
108
+ ) : (
109
+ <Button
110
+ icon={AddIcon}
111
+ mode="ghost"
112
+ text="Create color"
113
+ ref={this.focusRef}
114
+ disabled={Boolean(readOnly)}
115
+ onClick={this.handleCreateColor}
116
+ />
117
+ )}
118
+ </FormField>
119
+ )
120
+ }
121
+ }
@@ -0,0 +1,144 @@
1
+ import React from 'react'
2
+ import PropTypes from 'prop-types'
3
+ import {ColorWrap, Checkboard, Saturation, Hue, Alpha} from 'react-color/lib/components/common'
4
+ import {Box, Card, Flex, Button, Inline, Stack, Text} from '@sanity/ui'
5
+ import {TrashIcon} from '@sanity/icons'
6
+ import styled from 'styled-components'
7
+ import {ColorPickerFields} from './ColorPickerFields'
8
+
9
+ const ColorBox = styled(Box)`
10
+ position: absolute;
11
+ top: 0;
12
+ left: 0;
13
+ width: 100%;
14
+ height: 100%;
15
+ `
16
+
17
+ const ReadOnlyContainer = styled(Flex)`
18
+ margin-top: 6rem;
19
+ background-color: var(--card-bg-color);
20
+ position: relative;
21
+ width: 100%;
22
+ `
23
+
24
+ const ColorPicker = ({
25
+ width,
26
+ rgb,
27
+ hex,
28
+ hsv,
29
+ hsl,
30
+ onChange,
31
+ onUnset,
32
+ disableAlpha,
33
+ renderers,
34
+ readOnly,
35
+ }) => {
36
+ return (
37
+ <div style={{width}}>
38
+ <Card padding={1} border radius={1}>
39
+ <Stack space={2}>
40
+ {!readOnly && (
41
+ <>
42
+ <Card overflow="hidden" style={{position: 'relative', height: '5em'}}>
43
+ <Saturation is="Saturation" onChange={onChange} hsl={hsl} hsv={hsv} />
44
+ </Card>
45
+
46
+ <Card
47
+ shadow={1}
48
+ radius={3}
49
+ overflow="hidden"
50
+ style={{position: 'relative', height: '10px'}}
51
+ >
52
+ <Hue is="Hue" hsl={hsl} onChange={!readOnly && onChange} />
53
+ </Card>
54
+
55
+ {!disableAlpha && (
56
+ <Card
57
+ shadow={1}
58
+ radius={3}
59
+ overflow="hidden"
60
+ style={{position: 'relative', height: '10px'}}
61
+ >
62
+ <Alpha is="Alpha" rgb={rgb} hsl={hsl} renderers={renderers} onChange={onChange} />
63
+ </Card>
64
+ )}
65
+ </>
66
+ )}
67
+ <Flex>
68
+ <Card
69
+ flex={1}
70
+ radius={2}
71
+ overflow="hidden"
72
+ style={{position: 'relative', minWidth: '4em'}}
73
+ >
74
+ <Checkboard />
75
+ <ColorBox style={{backgroundColor: `rgba(${rgb.r},${rgb.g},${rgb.b},${rgb.a})`}} />
76
+
77
+ {readOnly && (
78
+ <ReadOnlyContainer
79
+ padding={2}
80
+ paddingBottom={1}
81
+ sizing="border"
82
+ justify="space-between"
83
+ >
84
+ <Stack space={3} marginTop={1}>
85
+ <Text size={3} weight="bold">
86
+ {hex}
87
+ </Text>
88
+
89
+ <Inline space={3}>
90
+ <Text size={1}>
91
+ <strong>RGB: </strong>
92
+ {rgb.r} {rgb.g} {rgb.b}
93
+ </Text>
94
+ <Text size={1}>
95
+ <strong>HSL: </strong> {Math.round(hsl.h)} {Math.round(hsl.s)}%{' '}
96
+ {Math.round(hsl.l)}
97
+ </Text>
98
+ </Inline>
99
+ </Stack>
100
+ </ReadOnlyContainer>
101
+ )}
102
+ </Card>
103
+
104
+ {!readOnly && (
105
+ <Flex align="flex-start" marginLeft={2}>
106
+ <Box style={{width: 200}}>
107
+ <ColorPickerFields
108
+ rgb={rgb}
109
+ hsl={hsl}
110
+ hex={hex}
111
+ onChange={onChange}
112
+ disableAlpha={disableAlpha}
113
+ />
114
+ </Box>
115
+ <Box marginLeft={2}>
116
+ <Button onClick={onUnset} title="Delete color" icon={TrashIcon} tone="critical" />
117
+ </Box>
118
+ </Flex>
119
+ )}
120
+ </Flex>
121
+ </Stack>
122
+ </Card>
123
+ </div>
124
+ )
125
+ }
126
+
127
+ ColorPicker.propTypes = {
128
+ width: PropTypes.string,
129
+ hex: PropTypes.string,
130
+ hsl: PropTypes.object,
131
+ hsv: PropTypes.object,
132
+ rgb: PropTypes.object,
133
+ onChange: PropTypes.func,
134
+ disableAlpha: PropTypes.bool,
135
+ readOnly: PropTypes.bool,
136
+ renderers: PropTypes.func,
137
+ onUnset: PropTypes.func,
138
+ }
139
+
140
+ ColorPicker.defaultProps = {
141
+ disableAlpha: false,
142
+ }
143
+
144
+ export default ColorWrap(ColorPicker)
@@ -0,0 +1,128 @@
1
+ import React from 'react'
2
+ import * as color from 'react-color/lib/helpers/color'
3
+ import {EditableInput} from 'react-color/lib/components/common'
4
+ import {Box, Flex, useTheme} from '@sanity/ui'
5
+
6
+ export const ColorPickerFields = ({onChange, rgb, hsl, hex, disableAlpha}) => {
7
+ const {sanity} = useTheme()
8
+
9
+ const inputStyles = {
10
+ input: {
11
+ width: '80%',
12
+ padding: '4px 10% 3px',
13
+ border: 'none',
14
+ boxShadow: `inset 0 0 0 1px ${sanity.color.input.default.enabled.border}`,
15
+ color: sanity.color.input.default.enabled.fg,
16
+ backgroundColor: sanity.color.input.default.enabled.bg,
17
+ fontSize: sanity.fonts.text.sizes[0].fontSize,
18
+ textAlign: 'center',
19
+ },
20
+ label: {
21
+ display: 'block',
22
+ textAlign: 'center',
23
+ fontSize: sanity.fonts.label.sizes[0].fontSize,
24
+ color: sanity.color.base.fg,
25
+ paddingTop: '3px',
26
+ paddingBottom: '4px',
27
+ textTransform: 'capitalize',
28
+ },
29
+ }
30
+
31
+ const handleChange = (data, e) => {
32
+ if (data.hex && color.isValidHex(data.hex)) {
33
+ onChange(
34
+ {
35
+ hex: data.hex,
36
+ source: 'hex',
37
+ },
38
+ e
39
+ )
40
+ } else if (data.r || data.g || data.b) {
41
+ onChange(
42
+ {
43
+ r: data.r || rgb.r,
44
+ g: data.g || rgb.g,
45
+ b: data.b || rgb.b,
46
+ a: rgb.a,
47
+ source: 'rgb',
48
+ },
49
+ e
50
+ )
51
+ } else if (data.a) {
52
+ if (data.a < 0) {
53
+ data.a = 0
54
+ } else if (data.a > 100) {
55
+ data.a = 100
56
+ }
57
+
58
+ data.a /= 100
59
+ onChange(
60
+ {
61
+ h: hsl.h,
62
+ s: hsl.s,
63
+ l: hsl.l,
64
+ a: data.a,
65
+ source: 'rgb',
66
+ },
67
+ e
68
+ )
69
+ }
70
+ }
71
+
72
+ return (
73
+ <Flex>
74
+ <Box flex={2} marginRight={1}>
75
+ <EditableInput
76
+ style={inputStyles}
77
+ label="hex"
78
+ value={hex.replace('#', '')}
79
+ onChange={handleChange}
80
+ />
81
+ </Box>
82
+ <Box flex={1} marginRight={1}>
83
+ <EditableInput
84
+ style={inputStyles}
85
+ label="r"
86
+ value={rgb.r}
87
+ onChange={handleChange}
88
+ dragLabel="true"
89
+ dragMax="255"
90
+ />
91
+ </Box>
92
+ <Box flex={1} marginRight={1}>
93
+ <EditableInput
94
+ style={inputStyles}
95
+ label="g"
96
+ value={rgb.g}
97
+ onChange={handleChange}
98
+ dragLabel="true"
99
+ dragMax="255"
100
+ />
101
+ </Box>
102
+ <Box flex={1} marginRight={1}>
103
+ <EditableInput
104
+ style={inputStyles}
105
+ label="b"
106
+ value={rgb.b}
107
+ onChange={handleChange}
108
+ dragLabel="true"
109
+ dragMax="255"
110
+ />
111
+ </Box>
112
+ {!disableAlpha && (
113
+ <Box flex={1}>
114
+ <EditableInput
115
+ style={inputStyles}
116
+ label="a"
117
+ value={Math.round(rgb.a * 100)}
118
+ onChange={handleChange}
119
+ dragLabel="true"
120
+ dragMax="100"
121
+ />
122
+ </Box>
123
+ )}
124
+ </Flex>
125
+ )
126
+ }
127
+
128
+ export default ColorPickerFields
@@ -0,0 +1,70 @@
1
+ /* eslint-disable react/display-name */
2
+ import React from 'react'
3
+ import ColorInput from '../ColorInput'
4
+
5
+ const round = (val) => Math.round(val * 100)
6
+
7
+ export default {
8
+ name: 'color',
9
+ type: 'object',
10
+ title: 'Color',
11
+ inputComponent: ColorInput,
12
+ fields: [
13
+ {
14
+ title: 'Hex',
15
+ name: 'hex',
16
+ type: 'string',
17
+ },
18
+ {
19
+ title: 'Alpha',
20
+ name: 'alpha',
21
+ type: 'number',
22
+ },
23
+ {
24
+ title: 'Hue Saturation Lightness',
25
+ name: 'hsl',
26
+ type: 'hslaColor',
27
+ },
28
+ {
29
+ title: 'Hue Saturation Value',
30
+ name: 'hsv',
31
+ type: 'hsvaColor',
32
+ },
33
+ {
34
+ title: 'Red Green Blue (rgb)',
35
+ name: 'rgb',
36
+ type: 'rgbaColor',
37
+ },
38
+ ],
39
+ preview: {
40
+ select: {
41
+ title: 'hex',
42
+ alpha: 'alpha',
43
+ hex: 'hex',
44
+ hsl: 'hsl',
45
+ },
46
+ prepare({title, hex, hsl, alpha}) {
47
+ let subtitle = hex || 'No color set'
48
+ if (hsl) {
49
+ subtitle = `H:${round(hsl.l)} S:${round(hsl.l)} L:${round(hsl.l)} A:${round(alpha)}`
50
+ }
51
+ return {
52
+ title: title,
53
+ subtitle: subtitle,
54
+ media: () => (
55
+ <div
56
+ style={{
57
+ backgroundColor: hex || '#000',
58
+ opacity: alpha || 1,
59
+ position: 'absolute',
60
+ height: '100%',
61
+ width: '100%',
62
+ top: '0',
63
+ left: '0',
64
+ }}
65
+ />
66
+ ),
67
+ }
68
+ },
69
+ },
70
+ }
@@ -0,0 +1,11 @@
1
+ export default {
2
+ title: 'Hue Saturation Lightness',
3
+ name: 'hslaColor',
4
+ type: 'object',
5
+ fields: [
6
+ {name: 'h', type: 'number', title: 'Hue'},
7
+ {name: 's', type: 'number', title: 'Saturation'},
8
+ {name: 'l', type: 'number', title: 'Lightness'},
9
+ {name: 'a', type: 'number', title: 'Alpha'},
10
+ ],
11
+ }
@@ -0,0 +1,11 @@
1
+ export default {
2
+ title: 'Hue Saturation Value',
3
+ name: 'hsvaColor',
4
+ type: 'object',
5
+ fields: [
6
+ {name: 'h', type: 'number', title: 'Hue'},
7
+ {name: 's', type: 'number', title: 'Saturation'},
8
+ {name: 'v', type: 'number', title: 'Value'},
9
+ {name: 'a', type: 'number', title: 'Alpha'},
10
+ ],
11
+ }
@@ -0,0 +1,11 @@
1
+ export default {
2
+ title: 'Red Green Blue (rgb)',
3
+ name: 'rgbaColor',
4
+ type: 'object',
5
+ fields: [
6
+ {name: 'r', type: 'number', title: 'Red'},
7
+ {name: 'g', type: 'number', title: 'Green'},
8
+ {name: 'b', type: 'number', title: 'Blue'},
9
+ {name: 'a', type: 'number', title: 'Alpha'},
10
+ ],
11
+ }
package/.eslintrc.js DELETED
@@ -1,25 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- parser: '@babel/eslint-parser',
4
- globals: {
5
- __DEV__: true,
6
- JSX: true,
7
- },
8
- env: {
9
- node: true,
10
- browser: true,
11
- },
12
- settings: {
13
- react: {version: '16.9.0'},
14
- },
15
- extends: ['sanity', 'sanity/react', 'plugin:react-hooks/recommended', 'prettier'],
16
- rules: {
17
- camelcase: ['error', {allow: ['^unstable_', '^Unstable_']}],
18
- 'prettier/prettier': 'error',
19
- 'react/prop-types': 'off',
20
- 'react/forbid-prop-types': 'off',
21
- 'react/jsx-no-bind': 'off',
22
- 'react/require-default-props': 'off',
23
- },
24
- plugins: ['prettier', 'react'],
25
- }
@@ -1,133 +0,0 @@
1
- ---
2
- name: CI & Release
3
-
4
- # Workflow name based on selected inputs. Fallback to default Github naming when expression evaluates to empty string
5
- run-name: >-
6
- ${{
7
- inputs.release && inputs.test && format('Build {0} ➤ Test ➤ Publish to NPM', github.ref_name) ||
8
- inputs.release && !inputs.test && format('Build {0} ➤ Skip Tests ➤ Publish to NPM', github.ref_name) ||
9
- github.event_name == 'workflow_dispatch' && inputs.test && format('Build {0} ➤ Test', github.ref_name) ||
10
- github.event_name == 'workflow_dispatch' && !inputs.test && format('Build {0} ➤ Skip Tests', github.ref_name) ||
11
- ''
12
- }}
13
-
14
- on:
15
- # Build on pushes branches that have a PR (including drafts)
16
- pull_request:
17
- # Build on commits pushed to branches without a PR if it's in the allowlist
18
- push:
19
- branches: [main,studio-v2]
20
- # https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
21
- workflow_dispatch:
22
- inputs:
23
- test:
24
- description: Run tests
25
- required: true
26
- default: true
27
- type: boolean
28
- release:
29
- description: Release new version
30
- required: true
31
- default: false
32
- type: boolean
33
-
34
- concurrency:
35
- # On PRs builds will cancel if new pushes happen before the CI completes, as it defines `github.head_ref` and gives it the name of the branch the PR wants to merge into
36
- # Otherwise `github.run_id` ensures that you can quickly merge a queue of PRs without causing tests to auto cancel on any of the commits pushed to main.
37
- group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
38
- cancel-in-progress: true
39
-
40
- jobs:
41
- log-the-inputs:
42
- name: Log inputs
43
- runs-on: ubuntu-latest
44
- steps:
45
- - run: |
46
- echo "Inputs: $INPUTS"
47
- env:
48
- INPUTS: ${{ toJSON(inputs) }}
49
-
50
- build:
51
- runs-on: ubuntu-latest
52
- name: Lint & Build
53
- steps:
54
- - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3
55
- - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # tag=v3
56
- with:
57
- cache: npm
58
- node-version: lts/*
59
- - run: npm ci
60
- # Linting can be skipped
61
- - run: npm run lint --if-present
62
- if: github.event.inputs.test != 'false'
63
- # But not the build script, as semantic-release will crash if this command fails so it makes sense to test it early
64
- - run: npm run prepublishOnly --if-present
65
-
66
- # test:
67
- # needs: build
68
- # # The test matrix can be skipped, in case a new release needs to be fast-tracked and tests are already passing on main
69
- # if: github.event.inputs.test != 'false'
70
- # runs-on: ${{ matrix.os }}
71
- # name: Node.js ${{ matrix.node }} / ${{ matrix.os }}
72
- # strategy:
73
- # # A test failing on windows doesn't mean it'll fail on macos. It's useful to let all tests run to its completion to get the full picture
74
- # fail-fast: false
75
- # matrix:
76
- # # Run the testing suite on each major OS with the latest LTS release of Node.js
77
- # os: [macos-latest, ubuntu-latest, windows-latest]
78
- # node: [lts/*]
79
- # # It makes sense to also test the oldest, and latest, versions of Node.js, on ubuntu-only since it's the fastest CI runner
80
- # include:
81
- # - os: ubuntu-latest
82
- # # Test the oldest LTS release of Node that's still receiving bugfixes and security patches, versions older than that have reached End-of-Life
83
- # node: lts/-2
84
- # - os: ubuntu-latest
85
- # # Test the actively developed version that will become the latest LTS release next October
86
- # node: current
87
- # steps:
88
- # # It's only necessary to do this for windows, as mac and ubuntu are sane OS's that already use LF
89
- # - name: Set git to use LF
90
- # if: matrix.os == 'windows-latest'
91
- # run: |
92
- # git config --global core.autocrlf false
93
- # git config --global core.eol lf
94
- # - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3
95
- # - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # tag=v3
96
- # with:
97
- # cache: npm
98
- # node-version: ${{ matrix.node }}
99
- # - run: npm i
100
- # - run: npm test --if-present
101
-
102
- release:
103
- # needs: [build, test]
104
- needs: [build]
105
- # only run if opt-in during workflow_dispatch
106
- if: always() && github.event.inputs.release == 'true' && needs.build.result != 'failure' && needs.test.result != 'failure' && needs.test.result != 'cancelled'
107
- runs-on: ubuntu-latest
108
- name: Semantic release
109
- steps:
110
- - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3
111
- with:
112
- # Need to fetch entire commit history to
113
- # analyze every commit since last release
114
- fetch-depth: 0
115
- - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # tag=v3
116
- with:
117
- cache: npm
118
- node-version: lts/*
119
- - run: npm ci
120
- # Branches that will release new versions are defined in .releaserc.json
121
- - run: npx semantic-release
122
- # Don't allow interrupting the release step if the job is cancelled, as it can lead to an inconsistent state
123
- # e.g. git tags were pushed but it exited before `npm publish`
124
- if: always()
125
- env:
126
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127
- NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
128
- # Re-run semantic release with rich logs if it failed to publish for easier debugging
129
- - run: npx semantic-release --dry-run --debug
130
- if: failure()
131
- env:
132
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
133
- NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
package/.husky/commit-msg DELETED
@@ -1,4 +0,0 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- npx --no -- commitlint --edit ""
package/.husky/pre-commit DELETED
@@ -1,4 +0,0 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- npx lint-staged
package/.prettierrc DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "semi": false,
3
- "printWidth": 100,
4
- "bracketSpacing": false,
5
- "singleQuote": true,
6
- "useTabs": false,
7
- "endOfLine": "lf"
8
- }
package/.releaserc.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "extends": "@sanity/semantic-release-preset",
3
- "branches": ["main", {"name": "studio-v2", "channel": "studio-v2", "prerelease": "v2-studio"}]
4
- }
package/CHANGELOG.md DELETED
@@ -1,12 +0,0 @@
1
- <!-- markdownlint-disable --><!-- textlint-disable -->
2
-
3
- # 📓 Changelog
4
-
5
- All notable changes to this project will be documented in this file. See
6
- [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
7
-
8
- ## [2.36.0-v2-studio.1](https://github.com/sanity-io/color-input/compare/v2.35.2...v2.36.0-v2-studio.1) (2022-11-23)
9
-
10
- ### Features
11
-
12
- - @sanity/color-input (standalone) for Sanity Studio v2 ([d3a8655](https://github.com/sanity-io/color-input/commit/d3a8655747e6e52c4f09486ea7970b029f80b860))
Binary file
Binary file
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- extends: ['@commitlint/config-conventional'],
3
- }
@@ -1,4 +0,0 @@
1
- module.exports = {
2
- '**/*.{js,jsx}': ['eslint'],
3
- '**/*.{ts,tsx}': ['eslint', () => 'tsc --noEmit'],
4
- }