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 CHANGED
@@ -1,131 +1,40 @@
1
- # Angular Color Picker
1
+ # Angular color picker
2
2
 
3
- <a href="https://badge.fury.io/js/nxt-color-picker"><img src="https://badge.fury.io/js/nxt-color-picker.svg" align="right" alt="yarn version" height="18"></a>
3
+ [![GitHub license](https://img.shields.io/github/license/Liquid-JS/nxt-components.svg)](https://github.com/Liquid-JS/nxt-components/blob/master/LICENSE)
4
+ [![npm](https://img.shields.io/npm/dm/nxt-color-picker.svg)](https://www.npmjs.com/package/nxt-color-picker)
5
+ [![scope](https://img.shields.io/npm/v/nxt-color-picker.svg)](https://www.npmjs.com/package/nxt-color-picker)
4
6
 
5
- This is a responsive color picker based on [angular2-color-picker](https://github.com/Alberplz/angular2-color-picker) and updates from [ngx-color-picker](https://github.com/zefoy/ngx-color-picker).
7
+ A color picker widget for Angular with no dependencies.
6
8
 
7
- #### Why another rewrite?
9
+ ## Quick links
8
10
 
9
- - **Responsive**: nxt-color-picker uses CSS and flex layout to ensure pixel-perfect rendering on all screen sizes and resolutions
10
- - **UX improvements**:
11
- - slider indicator changes color based on background to maintain visibility
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
- ### Quick links
15
+ ### Installing
18
16
 
19
- [Example application](https://liquid-js.github.io/nxt-color-picker/en-US/)
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
- ### Running the app
21
+ ### Import color picker module
29
22
 
30
- ```bash
31
- yarn
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
- ColorPickerModule
51
- ]
28
+ imports: [
29
+ ...
30
+ ColorPickerModule
31
+ ]
52
32
  })
53
33
  ```
54
34
 
55
- ##### Use it in your HTML template:
35
+ ### Include it in HTML template
56
36
 
57
37
  ```html
58
- <input [(cpColor)]="color" [style.background]="color"/>
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
  ```