nxt-color-picker 14.0.3 → 15.0.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 +48 -47
- package/esm2020/lib/color-picker/color-picker.component.mjs +349 -288
- package/esm2020/lib/color-picker.directive.mjs +123 -126
- package/esm2020/lib/color-picker.module.mjs +5 -5
- package/esm2020/lib/color-picker.service.mjs +7 -9
- package/esm2020/lib/slider.directive.mjs +8 -7
- package/esm2020/lib/text.directive.mjs +8 -7
- package/esm2020/nxt-color-picker.mjs +1 -1
- package/esm2020/public-api.mjs +1 -1
- package/esm2020/util/color.mjs +12 -12
- package/esm2020/util/contrast.mjs +1 -1
- package/esm2020/util/formats.mjs +1 -1
- package/esm2020/util/helpers.mjs +1 -1
- package/esm2020/util/types.mjs +36 -36
- package/fesm2015/nxt-color-picker.mjs +547 -474
- package/fesm2015/nxt-color-picker.mjs.map +1 -1
- package/fesm2020/nxt-color-picker.mjs +536 -476
- package/fesm2020/nxt-color-picker.mjs.map +1 -1
- package/lib/color-picker/color-picker.component.d.ts +52 -105
- package/lib/color-picker.directive.d.ts +41 -41
- package/lib/color-picker.service.d.ts +1 -1
- package/lib/slider.directive.d.ts +4 -4
- package/lib/text.directive.d.ts +2 -2
- package/package.json +9 -10
- package/util/color.d.ts +3 -3
- package/util/helpers.d.ts +23 -23
- package/util/types.d.ts +12 -7
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ This is a responsive color picker based on [angular2-color-picker](https://githu
|
|
|
16
16
|
|
|
17
17
|
### Quick links
|
|
18
18
|
|
|
19
|
-
[Example application](https://liquid-js.github.io/nxt-color-picker
|
|
19
|
+
[Example application](https://liquid-js.github.io/nxt-components/color-picker)
|
|
20
20
|
|
|
21
21
|
### Building the library
|
|
22
22
|
|
|
@@ -44,88 +44,89 @@ yarn add nxt-color-picker
|
|
|
44
44
|
import { ColorPickerModule } from 'nxt-color-picker';
|
|
45
45
|
|
|
46
46
|
@NgModule({
|
|
47
|
-
...
|
|
48
|
-
imports: [
|
|
49
47
|
...
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
imports: [
|
|
49
|
+
...
|
|
50
|
+
ColorPickerModule
|
|
51
|
+
]
|
|
52
52
|
})
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
##### Use it in your HTML template:
|
|
56
56
|
|
|
57
57
|
```html
|
|
58
|
-
<input [(
|
|
58
|
+
<input [(nxtColor)]="color"
|
|
59
|
+
[style.background]="color"/>
|
|
59
60
|
```
|
|
60
61
|
|
|
61
62
|
```javascript
|
|
62
|
-
[
|
|
63
|
+
[nxtColor] // The color to show in the color picker dialog.
|
|
63
64
|
|
|
64
|
-
[
|
|
65
|
-
[
|
|
65
|
+
[width] // Use this option to set color picker dialog width ('230px').
|
|
66
|
+
[height] // Use this option to force color picker dialog height ('auto').
|
|
66
67
|
|
|
67
|
-
[
|
|
68
|
-
[
|
|
68
|
+
[toggle] // Sets the default open / close state of the color picker (false).
|
|
69
|
+
[disabled] // Disables opening of the color picker dialog via toggle / events.
|
|
69
70
|
|
|
70
|
-
[
|
|
71
|
+
[mode] // Dialog color mode: 'color', 'grayscale', 'presets' ('color').
|
|
71
72
|
|
|
72
|
-
[
|
|
73
|
+
[cmykEnabled] // Enables CMYK input format and color change event (false).
|
|
73
74
|
|
|
74
|
-
[
|
|
75
|
-
[
|
|
76
|
-
[
|
|
75
|
+
[outputFormat] // Output color format: OutputFormat (OutputFormatEnum.auto).
|
|
76
|
+
[alphaChannel] // Alpha mode: AlphaChannel (AlphaChannelEnum.enabled).
|
|
77
|
+
[fallbackColor] // Used when the color is not well-formed or is undefined ('#000').
|
|
77
78
|
|
|
78
|
-
[
|
|
79
|
-
[
|
|
79
|
+
[position] // Dialog position: DialogPosition (DialogPositionEnum.right).
|
|
80
|
+
[positionOffset] // Dialog offset percentage relative to the directive element (0).
|
|
80
81
|
|
|
81
|
-
[
|
|
82
|
-
[
|
|
82
|
+
[presetLabel] // Show label for preset colors (true). If string is given, it overrides the default label.
|
|
83
|
+
[presetColors] // Array of preset colors to show in the color picker dialog ([]).
|
|
83
84
|
|
|
84
|
-
[
|
|
85
|
+
[disableInput] // Disables / hides the color input field from the dialog (false).
|
|
85
86
|
|
|
86
|
-
[
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
[dialogDisplay] // Dialog positioning mode: DialogDisplay (DialogDisplayEnum.popup).
|
|
88
|
+
// DialogDisplayEnum.popup: dialog is shown as popup (fixed positioning).
|
|
89
|
+
// DialogDisplayEnum.inline: dialog is shown permanently (static positioning).
|
|
89
90
|
|
|
90
|
-
[
|
|
91
|
+
[ignoredElements] // Array of HTML elements that will be ignored when clicked ([]).
|
|
91
92
|
|
|
92
|
-
[
|
|
93
|
-
[
|
|
93
|
+
[saveClickOutside] // Save currently selected color when user clicks outside (true).
|
|
94
|
+
[closeClickOutside] // Close the color picker dialog when user clicks outside (true).
|
|
94
95
|
|
|
95
|
-
[
|
|
96
|
+
[okButton] // Show an OK / Apply button which saves the color (false).
|
|
96
97
|
|
|
97
|
-
[
|
|
98
|
+
[cancelButton] // Show a Cancel / Reset button which resets the color (false).
|
|
98
99
|
|
|
99
|
-
[
|
|
100
|
+
[addColorButton] // Show an Add Color button which add the color into preset (false).
|
|
100
101
|
|
|
101
|
-
[
|
|
102
|
+
[maxPresetColors] // Use this option to set the max colors allowed in presets (6).
|
|
102
103
|
|
|
103
|
-
[
|
|
104
|
-
|
|
104
|
+
[useRootViewContainer] // Create dialog component in the root view container (false).
|
|
105
|
+
// Note: The root component needs to have public viewContainerRef.
|
|
105
106
|
|
|
106
|
-
(
|
|
107
|
-
(
|
|
107
|
+
(open) // Current color value, send when dialog is opened (value: string).
|
|
108
|
+
(close) // Current color value, send when dialog is closed (value: string).
|
|
108
109
|
|
|
109
|
-
(
|
|
110
|
+
(inputChange) // Input name and its value, send when user changes color through inputs (value: InputChangeEvent).
|
|
110
111
|
|
|
111
|
-
(
|
|
112
|
+
(toggleChange) // Status of the dialog, send when dialog is opened / closed (open: boolean).
|
|
112
113
|
|
|
113
|
-
(
|
|
114
|
-
(
|
|
115
|
-
(
|
|
114
|
+
(sliderDragStart) // Slider name and current color, send when slider dragging starts (value: SliderChangeEvent).
|
|
115
|
+
(sliderChange) // Slider name and its value, send when user changes color through slider (value: SliderChangeEvent).
|
|
116
|
+
(sliderDragEnd) // Slider name and current color, send when slider dragging ends (value: SliderChangeEvent).
|
|
116
117
|
|
|
117
|
-
(
|
|
118
|
-
(
|
|
119
|
-
(
|
|
118
|
+
(colorSelectCancel) // Color select canceled, send when Cancel button is pressed (void).
|
|
119
|
+
(colorSelect) // Selected color value, send when OK button pressed or user clicks outside (if saveClickOutside is true). (value: string).
|
|
120
|
+
(nxtColorChange) // Changed color value, send when color is changed (value: string).
|
|
120
121
|
|
|
121
|
-
(
|
|
122
|
+
(cmykColorChange) // Outputs the color as CMYK string if CMYK is enabled (value: string).
|
|
122
123
|
|
|
123
|
-
(
|
|
124
|
+
(presetColorsChange) // Preset colors, send when 'Add Color' button is pressed (value: array).
|
|
124
125
|
```
|
|
125
126
|
|
|
126
127
|
##### Available control / helper functions (provided by the directive):
|
|
127
128
|
|
|
128
129
|
```javascript
|
|
129
|
-
openDialog()
|
|
130
|
-
closeDialog()
|
|
130
|
+
openDialog() // Opens the color picker dialog if not already open.
|
|
131
|
+
closeDialog() // Closes the color picker dialog if not already closed.
|
|
131
132
|
```
|