@sanity/color-input 2.30.2-shopify.0 → 3.0.0-studio-v3.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/README.md CHANGED
@@ -1,16 +1,46 @@
1
1
  # @sanity/color-input
2
2
 
3
- Color input for [Sanity](https://sanity.io/) that stores selected colors in hex, hsl, hsv and rgb format.
3
+ > **NOTE**
4
+ >
5
+ > This is the **Sanity Studio v3 version** of @sanity/color-input.
6
+ >
7
+ > For the v2 version, please refer to the [v2-branch](https://github.com/sanity-io/sanity/tree/next/packages/%40sanity/color-input).
8
+
9
+ ## What is it?
10
+
11
+ Color input plugin for [Sanity](https://sanity.io/) that stores selected colors in hex, hsl, hsv and rgb format.
12
+
13
+ ![Color input in the Studio](assets/color-input.png)
4
14
 
5
15
  ## Installation
16
+ ```
17
+ npm install --save @sanity/color-input@studio-v3
18
+ ```
19
+
20
+ or
6
21
 
7
22
  ```
8
- sanity install @sanity/color-input
23
+ yarn add @sanity/color-input@studio-v3
9
24
  ```
10
25
 
11
26
  ## Usage
12
27
 
13
- Use it in your schema types:
28
+ Add it as a plugin in sanity.config.ts (or .js):
29
+
30
+ ```js
31
+ import { colorSchema } from "@sanity/color-input";
32
+
33
+ export default createConfig({
34
+ // ...
35
+ plugins: [
36
+ colorSchema(),
37
+ ]
38
+ })
39
+ ```
40
+
41
+
42
+
43
+ Now you can use the `color` type in your schema types:
14
44
 
15
45
  ```js
16
46
  // [...]
@@ -26,8 +56,6 @@ Use it in your schema types:
26
56
  }
27
57
  ```
28
58
 
29
- Note that the above only works if you import and use the `all:part:@sanity/base/schema-type` part in your schema.
30
-
31
59
  ## Options
32
60
 
33
61
  To disable the alpha option, set `disableAlpha` to `true`:
@@ -36,7 +64,7 @@ To disable the alpha option, set `disableAlpha` to `true`:
36
64
  // ...fields...
37
65
  {
38
66
  name: 'favoriteColor',
39
- title: 'Favorite color',
67
+ title: 'Color no-alpha',
40
68
  type: 'color',
41
69
  options: {
42
70
  disableAlpha: true
@@ -44,6 +72,10 @@ To disable the alpha option, set `disableAlpha` to `true`:
44
72
  }
45
73
  ```
46
74
 
75
+ Which will render accordingly:
76
+
77
+ ![This is an image](assets/no-alpha.png)
78
+
47
79
  ## Data model
48
80
 
49
81
  ```js
@@ -78,3 +110,26 @@ To disable the alpha option, set `disableAlpha` to `true`:
78
110
  ## License
79
111
 
80
112
  MIT-licensed. See LICENSE.
113
+
114
+
115
+ ## Develop & test
116
+
117
+ Make sure to run `npm run build` once, then run
118
+
119
+ ```bash
120
+ npm run link-watch
121
+ ```
122
+
123
+ In another shell, `cd` to your test studio and run:
124
+
125
+ ```bash
126
+ npx yalc add @sanity/color-input --link && yarn install
127
+ ```
128
+
129
+ Now, changes in this repo will be automatically built and pushed to the studio,
130
+ triggering hotreload. Yalc avoids issues with react-hooks that are typical when using yarn/npm link.
131
+
132
+ ### About build & watch
133
+
134
+ This plugin uses [@sanity/plugin-sdk](https://github.com/sanity-io/plugin-sdk)
135
+ with default configuration for build & watch scripts.