nxt-color-picker 14.0.3 → 16.0.0-alpha.0
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 +22 -113
- package/esm2020/lib/color-picker/color-picker.component.mjs +370 -307
- package/esm2020/lib/color-picker.directive.mjs +164 -126
- package/esm2020/lib/color-picker.module.mjs +5 -5
- package/esm2020/lib/color-picker.service.mjs +10 -9
- package/esm2020/lib/slider.directive.mjs +11 -7
- package/esm2020/lib/text.directive.mjs +11 -7
- package/esm2020/nxt-color-picker.mjs +1 -1
- package/esm2020/public-api.mjs +1 -1
- package/esm2020/util/color.mjs +103 -57
- package/esm2020/util/contrast.mjs +17 -5
- package/esm2020/util/formats.mjs +17 -5
- package/esm2020/util/helpers.mjs +19 -1
- package/esm2020/util/types.mjs +36 -36
- package/fesm2015/nxt-color-picker.mjs +760 -546
- package/fesm2015/nxt-color-picker.mjs.map +1 -1
- package/fesm2020/nxt-color-picker.mjs +748 -548
- package/fesm2020/nxt-color-picker.mjs.map +1 -1
- package/lib/color-picker/color-picker.component.d.ts +56 -105
- package/lib/color-picker.directive.d.ts +91 -42
- package/lib/color-picker.service.d.ts +4 -1
- package/lib/slider.directive.d.ts +7 -4
- package/lib/text.directive.d.ts +5 -2
- package/package.json +9 -10
- package/util/color.d.ts +10 -5
- package/util/contrast.d.ts +6 -0
- package/util/formats.d.ts +20 -4
- package/util/helpers.d.ts +53 -23
- package/util/types.d.ts +12 -7
package/README.md
CHANGED
|
@@ -1,131 +1,40 @@
|
|
|
1
|
-
# Angular
|
|
1
|
+
# Angular color picker
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/Liquid-JS/nxt-components/blob/master/LICENSE)
|
|
4
|
+
[](https://www.npmjs.com/package/nxt-color-picker)
|
|
5
|
+
[](https://www.npmjs.com/package/nxt-color-picker)
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
A color picker widget for Angular with no dependencies.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
## Quick links
|
|
8
10
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
- preset colours show alpha
|
|
13
|
-
- proper support for mobile browsers
|
|
14
|
-
- **Type safe**: by replacing string options with enumerators, compiler can ensure you always pass correct options to nxt-color-picker
|
|
15
|
-
- **Built with Angular CLI** to make nxt-color-picker development and testing a single-step process
|
|
11
|
+
- [Demo](https://liquid-js.github.io/nxt-components/demo/color-picker)
|
|
12
|
+
- [Getting started](https://liquid-js.github.io/nxt-components/demo/color-picker/getting-started)
|
|
13
|
+
- [API docs](https://liquid-js.github.io/nxt-components/docs/nxt-color-picker)
|
|
16
14
|
|
|
17
|
-
###
|
|
15
|
+
### Installing
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
### Building the library
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
yarn
|
|
25
|
-
yarn build
|
|
17
|
+
```sh
|
|
18
|
+
npm install --save nxt-color-picker
|
|
26
19
|
```
|
|
27
20
|
|
|
28
|
-
###
|
|
21
|
+
### Import color picker module
|
|
29
22
|
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
yarn start
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Installing and usage
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
yarn add nxt-color-picker
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
##### Load the module for your app:
|
|
42
|
-
|
|
43
|
-
```javascript
|
|
44
|
-
import { ColorPickerModule } from 'nxt-color-picker';
|
|
23
|
+
```ts
|
|
24
|
+
import { ColorPickerModule } from 'nxt-color-picker'
|
|
45
25
|
|
|
46
26
|
@NgModule({
|
|
47
|
-
...
|
|
48
|
-
imports: [
|
|
49
27
|
...
|
|
50
|
-
|
|
51
|
-
|
|
28
|
+
imports: [
|
|
29
|
+
...
|
|
30
|
+
ColorPickerModule
|
|
31
|
+
]
|
|
52
32
|
})
|
|
53
33
|
```
|
|
54
34
|
|
|
55
|
-
|
|
35
|
+
### Include it in HTML template
|
|
56
36
|
|
|
57
37
|
```html
|
|
58
|
-
<input [(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
```javascript
|
|
62
|
-
[cpColor] // The color to show in the color picker dialog.
|
|
63
|
-
|
|
64
|
-
[cpWidth] // Use this option to set color picker dialog width ('230px').
|
|
65
|
-
[cpHeight] // Use this option to force color picker dialog height ('auto').
|
|
66
|
-
|
|
67
|
-
[cpToggle] // Sets the default open / close state of the color picker (false).
|
|
68
|
-
[cpDisabled] // Disables opening of the color picker dialog via toggle / events.
|
|
69
|
-
|
|
70
|
-
[cpMode] // Dialog color mode: 'color', 'grayscale', 'presets' ('color').
|
|
71
|
-
|
|
72
|
-
[cpCmykEnabled] // Enables CMYK input format and color change event (false).
|
|
73
|
-
|
|
74
|
-
[cpOutputFormat] // Output color format: OutputFormat (OutputFormat.auto).
|
|
75
|
-
[cpAlphaChannel] // Alpha mode: AlphaChannel (AlphaChannel.enabled).
|
|
76
|
-
[cpFallbackColor] // Used when the color is not well-formed or is undefined ('#000').
|
|
77
|
-
|
|
78
|
-
[cpPosition] // Dialog position: DialogPosition (DialogPosition.right).
|
|
79
|
-
[cpPositionOffset] // Dialog offset percentage relative to the directive element (0).
|
|
80
|
-
|
|
81
|
-
[cpPresetLabel] // Show label for preset colors (true). If string is given, it overrides the default label.
|
|
82
|
-
[cpPresetColors] // Array of preset colors to show in the color picker dialog ([]).
|
|
83
|
-
|
|
84
|
-
[cpDisableInput] // Disables / hides the color input field from the dialog (false).
|
|
85
|
-
|
|
86
|
-
[cpDialogDisplay] // Dialog positioning mode: DialogDisplay (DialogDisplay.popup).
|
|
87
|
-
// DialogDisplay.popup: dialog is shown as popup (fixed positioning).
|
|
88
|
-
// DialogDisplay.inline: dialog is shown permanently (static positioning).
|
|
89
|
-
|
|
90
|
-
[cpIgnoredElements] // Array of HTML elements that will be ignored when clicked ([]).
|
|
91
|
-
|
|
92
|
-
[cpSaveClickOutside] // Save currently selected color when user clicks outside (true).
|
|
93
|
-
[cpCloseClickOutside] // Close the color picker dialog when user clicks outside (true).
|
|
94
|
-
|
|
95
|
-
[cpOKButton] // Show an OK / Apply button which saves the color (false).
|
|
96
|
-
|
|
97
|
-
[cpCancelButton] // Show a Cancel / Reset button which resets the color (false).
|
|
98
|
-
|
|
99
|
-
[cpAddColorButton] // Show an Add Color button which add the color into preset (false).
|
|
100
|
-
|
|
101
|
-
[cpMaxPresetColors] // Use this option to set the max colors allowed in presets (6).
|
|
102
|
-
|
|
103
|
-
[cpUseRootViewContainer] // Create dialog component in the root view container (false).
|
|
104
|
-
// Note: The root component needs to have public viewContainerRef.
|
|
105
|
-
|
|
106
|
-
(cpOpen) // Current color value, send when dialog is opened (value: string).
|
|
107
|
-
(cpClose) // Current color value, send when dialog is closed (value: string).
|
|
108
|
-
|
|
109
|
-
(cpInputChange) // Input name and its value, send when user changes color through inputs (value: InputChangeEvent).
|
|
110
|
-
|
|
111
|
-
(cpToggleChange) // Status of the dialog, send when dialog is opened / closed (open: boolean).
|
|
112
|
-
|
|
113
|
-
(cpSliderDragStart) // Slider name and current color, send when slider dragging starts (value: SliderChangeEvent).
|
|
114
|
-
(cpSliderChange) // Slider name and its value, send when user changes color through slider (value: SliderChangeEvent).
|
|
115
|
-
(cpSliderDragEnd) // Slider name and current color, send when slider dragging ends (value: SliderChangeEvent).
|
|
116
|
-
|
|
117
|
-
(cpColorSelectCancel) // Color select canceled, send when Cancel button is pressed (void).
|
|
118
|
-
(cpColorSelect) // Selected color value, send when OK button pressed or user clicks outside (if cpSaveClickOutside is true). (value: string).
|
|
119
|
-
(cpColorChange) // Changed color value, send when color is changed (value: string).
|
|
120
|
-
|
|
121
|
-
(cpCmykColorChange) // Outputs the color as CMYK string if CMYK is enabled (value: string).
|
|
122
|
-
|
|
123
|
-
(cpPresetColorsChange) // Preset colors, send when 'Add Color' button is pressed (value: array).
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
##### Available control / helper functions (provided by the directive):
|
|
127
|
-
|
|
128
|
-
```javascript
|
|
129
|
-
openDialog() // Opens the color picker dialog if not already open.
|
|
130
|
-
closeDialog() // Closes the color picker dialog if not already closed.
|
|
38
|
+
<input [(nxtColor)]="color"
|
|
39
|
+
[style.background]="color"/>
|
|
131
40
|
```
|