@zendeskgarden/react-colorpickers 9.0.0-next.2 → 9.0.0-next.21
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 +72 -2
- package/dist/esm/elements/ColorPicker/ColorWell.js +110 -0
- package/dist/esm/elements/ColorPicker/index.js +237 -0
- package/dist/esm/elements/ColorPicker/reducer.js +275 -0
- package/dist/esm/elements/ColorPickerDialog/index.js +153 -0
- package/dist/esm/elements/ColorSwatch/index.js +149 -0
- package/dist/esm/elements/ColorSwatchDialog/index.js +179 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/check-sm-fill.svg.js +29 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-down-stroke.svg.js +25 -0
- package/dist/esm/styled/ColorPicker/StyledAlphaRange.js +42 -0
- package/dist/esm/styled/ColorPicker/StyledColorPicker.js +25 -0
- package/dist/esm/styled/ColorPicker/StyledColorWell.js +36 -0
- package/dist/esm/styled/ColorPicker/StyledColorWellThumb.js +51 -0
- package/dist/esm/styled/ColorPicker/StyledHexField.js +24 -0
- package/dist/esm/styled/ColorPicker/StyledHueRange.js +23 -0
- package/dist/esm/styled/ColorPicker/StyledInput.js +24 -0
- package/dist/esm/styled/ColorPicker/StyledInputGroup.js +22 -0
- package/dist/esm/styled/ColorPicker/StyledLabel.js +23 -0
- package/dist/esm/styled/ColorPicker/StyledPreview.js +39 -0
- package/dist/esm/styled/ColorPicker/StyledRGBAField.js +32 -0
- package/dist/esm/styled/ColorPicker/StyledSliderGroup.js +22 -0
- package/dist/esm/styled/ColorPicker/StyledSliders.js +45 -0
- package/dist/esm/styled/ColorPickerDialog/StyledButton.js +22 -0
- package/dist/esm/styled/ColorPickerDialog/StyledButtonPreview.js +52 -0
- package/dist/esm/styled/ColorPickerDialog/StyledTooltipBody.js +23 -0
- package/dist/esm/styled/ColorPickerDialog/StyledTooltipModal.js +23 -0
- package/dist/esm/styled/ColorSwatch/StyledCell.js +22 -0
- package/dist/esm/styled/ColorSwatch/StyledColorSwatch.js +22 -0
- package/dist/esm/styled/ColorSwatch/StyledColorSwatchInput.js +22 -0
- package/dist/esm/styled/ColorSwatch/StyledColorSwatchLabel.js +53 -0
- package/dist/esm/styled/ColorSwatch/StyledIcon.js +24 -0
- package/dist/esm/styled/common/StyledRange.js +160 -0
- package/dist/esm/utils/conversion.js +34 -0
- package/dist/esm/utils/saturation.js +64 -0
- package/dist/esm/utils/validation.js +12 -0
- package/dist/index.cjs.js +267 -243
- package/dist/typings/elements/{Colorpicker → ColorPicker}/index.d.ts +2 -2
- package/dist/typings/elements/{ColorpickerDialog → ColorPickerDialog}/index.d.ts +2 -2
- package/dist/typings/index.d.ts +3 -3
- package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledAlphaRange.d.ts +2 -2
- package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledColorPicker.d.ts +1 -1
- package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledColorWell.d.ts +1 -1
- package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledPreview.d.ts +3 -3
- package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledSliders.d.ts +3 -2
- package/dist/typings/styled/{ColorpickerDialog → ColorPickerDialog}/StyledButton.d.ts +0 -1
- package/dist/typings/styled/{ColorpickerDialog → ColorPickerDialog}/StyledButtonPreview.d.ts +2 -2
- package/dist/typings/styled/ColorSwatch/StyledColorSwatchLabel.d.ts +3 -3
- package/dist/typings/styled/common/StyledRange.d.ts +2 -2
- package/dist/typings/styled/index.d.ts +17 -17
- package/dist/typings/styled/types.d.ts +12 -0
- package/dist/typings/types/index.d.ts +2 -2
- package/package.json +12 -12
- package/dist/index.esm.js +0 -1612
- package/dist/typings/styled/common/checkeredBackground.d.ts +0 -8
- /package/dist/typings/elements/{Colorpicker → ColorPicker}/ColorWell.d.ts +0 -0
- /package/dist/typings/elements/{Colorpicker → ColorPicker}/reducer.d.ts +0 -0
- /package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledColorWellThumb.d.ts +0 -0
- /package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledHexField.d.ts +0 -0
- /package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledHueRange.d.ts +0 -0
- /package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledInput.d.ts +0 -0
- /package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledInputGroup.d.ts +0 -0
- /package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledLabel.d.ts +0 -0
- /package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledRGBAField.d.ts +0 -0
- /package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledSliderGroup.d.ts +0 -0
- /package/dist/typings/styled/{ColorpickerDialog → ColorPickerDialog}/StyledTooltipBody.d.ts +0 -0
- /package/dist/typings/styled/{ColorpickerDialog → ColorPickerDialog}/StyledTooltipModal.d.ts +0 -0
package/dist/index.cjs.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
8
7
|
'use strict';
|
|
9
8
|
|
|
10
9
|
var React = require('react');
|
|
@@ -48,21 +47,6 @@ var throttle__default = /*#__PURE__*/_interopDefault(throttle);
|
|
|
48
47
|
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
49
48
|
var isEqual__default = /*#__PURE__*/_interopDefault(isEqual);
|
|
50
49
|
|
|
51
|
-
function _extends$2() {
|
|
52
|
-
_extends$2 = Object.assign ? Object.assign.bind() : function (target) {
|
|
53
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
54
|
-
var source = arguments[i];
|
|
55
|
-
for (var key in source) {
|
|
56
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
57
|
-
target[key] = source[key];
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return target;
|
|
62
|
-
};
|
|
63
|
-
return _extends$2.apply(this, arguments);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
50
|
function hslToHsv(h, s, l) {
|
|
67
51
|
let saturation = s;
|
|
68
52
|
saturation *= (l < 50 ? l : 100 - l) / 100;
|
|
@@ -147,22 +131,22 @@ const getThumbPosition = (x, y, rtl, container) => {
|
|
|
147
131
|
};
|
|
148
132
|
};
|
|
149
133
|
|
|
150
|
-
const COMPONENT_ID$
|
|
134
|
+
const COMPONENT_ID$l = 'colorpickers.colorpicker';
|
|
151
135
|
const getColorPickerWidth = props => {
|
|
152
|
-
return props
|
|
136
|
+
return props.$isOpaque ? 268 : 312;
|
|
153
137
|
};
|
|
154
138
|
const StyledColorPicker = styled__default.default.div.attrs({
|
|
155
|
-
'data-garden-id': COMPONENT_ID$
|
|
156
|
-
'data-garden-version': '9.0.0-next.
|
|
139
|
+
'data-garden-id': COMPONENT_ID$l,
|
|
140
|
+
'data-garden-version': '9.0.0-next.21'
|
|
157
141
|
}).withConfig({
|
|
158
142
|
displayName: "StyledColorPicker",
|
|
159
|
-
componentId: "sc-
|
|
160
|
-
})(["width:", "px;min-width:", "px;", ";"], getColorPickerWidth, getColorPickerWidth, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
143
|
+
componentId: "sc-gspq4q-0"
|
|
144
|
+
})(["width:", "px;min-width:", "px;", ";"], getColorPickerWidth, getColorPickerWidth, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$l, props));
|
|
161
145
|
StyledColorPicker.defaultProps = {
|
|
162
146
|
theme: reactTheming.DEFAULT_THEME
|
|
163
147
|
};
|
|
164
148
|
|
|
165
|
-
const COMPONENT_ID$
|
|
149
|
+
const COMPONENT_ID$k = 'colorpickers.colorpicker_range';
|
|
166
150
|
const thumbStyles = function (styles) {
|
|
167
151
|
let modifier = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
168
152
|
return `
|
|
@@ -207,17 +191,36 @@ const trackLowerStyles = function (styles) {
|
|
|
207
191
|
}
|
|
208
192
|
`;
|
|
209
193
|
};
|
|
210
|
-
const colorStyles$
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
194
|
+
const colorStyles$2 = _ref => {
|
|
195
|
+
let {
|
|
196
|
+
theme
|
|
197
|
+
} = _ref;
|
|
198
|
+
const thumbBackgroundColor = reactTheming.getColor({
|
|
199
|
+
theme,
|
|
200
|
+
variable: 'background.default'
|
|
201
|
+
});
|
|
202
|
+
const thumbBorderColor = reactTheming.getColor({
|
|
203
|
+
theme,
|
|
204
|
+
variable: 'border.default',
|
|
205
|
+
dark: {
|
|
206
|
+
offset: -100
|
|
207
|
+
},
|
|
208
|
+
light: {
|
|
209
|
+
offset: 100
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
const thumbActiveBackgroundColor = thumbBackgroundColor;
|
|
213
|
+
const thumbActiveBorderColor = reactTheming.getColor({
|
|
214
|
+
theme,
|
|
215
|
+
variable: 'border.primaryEmphasis'
|
|
216
|
+
});
|
|
217
|
+
const thumbFocusBorderColor = thumbActiveBorderColor;
|
|
218
|
+
const thumbHoverBackgroundColor = reactTheming.getColor({
|
|
219
|
+
theme,
|
|
220
|
+
variable: 'background.subtle'
|
|
221
|
+
});
|
|
222
|
+
const thumbHoverBorderColor = thumbActiveBorderColor;
|
|
218
223
|
return `
|
|
219
|
-
border-color: ${props.isOpaque && props.theme.colors.background};
|
|
220
|
-
|
|
221
224
|
${trackStyles(`
|
|
222
225
|
background-color: transparent;
|
|
223
226
|
`)}
|
|
@@ -239,7 +242,7 @@ const colorStyles$1 = props => {
|
|
|
239
242
|
${thumbStyles(`
|
|
240
243
|
background-color: ${thumbBackgroundColor};
|
|
241
244
|
border-color: ${thumbFocusBorderColor};
|
|
242
|
-
`, '
|
|
245
|
+
`, ':focus-visible')}
|
|
243
246
|
|
|
244
247
|
${thumbStyles(`
|
|
245
248
|
border-color: ${thumbActiveBorderColor};
|
|
@@ -247,32 +250,22 @@ const colorStyles$1 = props => {
|
|
|
247
250
|
`, ':active')}
|
|
248
251
|
`;
|
|
249
252
|
};
|
|
250
|
-
const getThumbSize = props => props.theme.space.base * (props
|
|
251
|
-
const getTrackHeight = props => props.theme.space.base * (props
|
|
253
|
+
const getThumbSize = props => props.theme.space.base * (props.$isOpaque ? 6 : 4);
|
|
254
|
+
const getTrackHeight = props => props.theme.space.base * (props.$isOpaque ? 6 : 3);
|
|
252
255
|
const getTrackMargin = props => (getThumbSize(props) - getTrackHeight(props)) / 2 + polished.stripUnit(props.theme.shadowWidths.md);
|
|
253
|
-
const sizeStyles$
|
|
256
|
+
const sizeStyles$3 = props => {
|
|
254
257
|
const thumbSize = getThumbSize(props);
|
|
255
258
|
const trackHeight = getTrackHeight(props);
|
|
256
259
|
const trackMargin = getTrackMargin(props);
|
|
257
260
|
const thumbMargin = (trackHeight - thumbSize) / 2;
|
|
258
|
-
const trackOffset = props.theme.space.base * (props
|
|
259
|
-
const height = props
|
|
260
|
-
let marginHorizontal;
|
|
261
|
-
let border;
|
|
262
|
-
let borderRadius;
|
|
263
|
-
if (props.isOpaque) {
|
|
264
|
-
marginHorizontal = `-${trackMargin}px`;
|
|
265
|
-
border = `${trackMargin}px ${props.theme.borderStyles.solid}`;
|
|
266
|
-
borderRadius = `${trackMargin + polished.stripUnit(props.theme.shadowWidths.md)}px`;
|
|
267
|
-
}
|
|
261
|
+
const trackOffset = props.theme.space.base * (props.$isOpaque ? -2 : -1);
|
|
262
|
+
const height = props.$isOpaque ? trackHeight : trackMargin * 2 + trackHeight;
|
|
268
263
|
return `
|
|
269
264
|
/* stylelint-disable-next-line declaration-no-important */
|
|
270
265
|
margin-top: 0 !important;
|
|
271
|
-
margin-${props.theme.rtl ? 'right' : 'left'}: ${marginHorizontal};
|
|
272
266
|
height: ${height}px; /* [1] */
|
|
273
267
|
box-sizing: content-box; /* [2] */
|
|
274
|
-
border: ${
|
|
275
|
-
border-radius: ${borderRadius};
|
|
268
|
+
border-radius: ${props.$isOpaque && props.theme.borderRadii.md};
|
|
276
269
|
|
|
277
270
|
${trackStyles(`
|
|
278
271
|
margin: ${trackMargin}px ${trackOffset}px;
|
|
@@ -281,89 +274,79 @@ const sizeStyles$2 = props => {
|
|
|
281
274
|
|
|
282
275
|
${thumbStyles(`
|
|
283
276
|
margin: ${thumbMargin}px 0;
|
|
284
|
-
border-width: ${
|
|
277
|
+
border-width: ${props.theme.borderWidths.sm};
|
|
285
278
|
height: ${thumbSize}px;
|
|
286
279
|
width: ${thumbSize}px;
|
|
287
280
|
`)};
|
|
288
281
|
`;
|
|
289
282
|
};
|
|
290
283
|
const StyledRange = styled__default.default(reactForms.Range).attrs({
|
|
291
|
-
'data-garden-id': COMPONENT_ID$
|
|
292
|
-
'data-garden-version': '9.0.0-next.
|
|
284
|
+
'data-garden-id': COMPONENT_ID$k,
|
|
285
|
+
'data-garden-version': '9.0.0-next.21',
|
|
293
286
|
hasLowerTrack: false
|
|
294
287
|
}).withConfig({
|
|
295
288
|
displayName: "StyledRange",
|
|
296
289
|
componentId: "sc-ug3wi9-0"
|
|
297
|
-
})(["", ";", " ", ";", ";"], sizeStyles$
|
|
290
|
+
})(["", ";", " ", ";", ";"], sizeStyles$3, trackStyles(`
|
|
298
291
|
border-radius: 0;
|
|
299
|
-
`), colorStyles$
|
|
292
|
+
`), colorStyles$2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$k, props));
|
|
300
293
|
StyledRange.defaultProps = {
|
|
301
294
|
theme: reactTheming.DEFAULT_THEME
|
|
302
295
|
};
|
|
303
296
|
|
|
304
|
-
const COMPONENT_ID$
|
|
297
|
+
const COMPONENT_ID$j = 'colorpickers.colorpicker_hue';
|
|
305
298
|
const StyledHueRange = styled__default.default(StyledRange).attrs({
|
|
306
|
-
'data-garden-id': COMPONENT_ID$
|
|
307
|
-
'data-garden-version': '9.0.0-next.
|
|
299
|
+
'data-garden-id': COMPONENT_ID$j,
|
|
300
|
+
'data-garden-version': '9.0.0-next.21'
|
|
308
301
|
}).withConfig({
|
|
309
302
|
displayName: "StyledHueRange",
|
|
310
|
-
componentId: "sc-
|
|
311
|
-
})(["background:linear-gradient( to ", ",#f00 0%,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,#f00 100% ) no-repeat;background-position:", ";background-size:100% ", "px;"], props => props.theme.rtl ? 'left' : 'right', props => !props
|
|
303
|
+
componentId: "sc-1gdhww1-0"
|
|
304
|
+
})(["background:linear-gradient( to ", ",#f00 0%,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,#f00 100% ) no-repeat;background-position:", ";background-size:100% ", "px;"], props => props.theme.rtl ? 'left' : 'right', props => !props.$isOpaque && `0 ${getTrackMargin(props)}px`, props => getTrackHeight(props));
|
|
312
305
|
StyledHueRange.defaultProps = {
|
|
313
306
|
theme: reactTheming.DEFAULT_THEME
|
|
314
307
|
};
|
|
315
308
|
|
|
316
|
-
const
|
|
317
|
-
let positionY = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
318
|
-
let repeat = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'repeat';
|
|
319
|
-
const color = reactTheming.getColor('neutralHue', 400, theme);
|
|
320
|
-
const dimensions = `${size}px ${size}px`;
|
|
321
|
-
const positionX1 = theme.rtl ? '100%' : '0';
|
|
322
|
-
const positionX2 = theme.rtl ? `calc(100% - ${size / 2}px)` : `${size / 2}px`;
|
|
323
|
-
const position1 = `${positionX1} ${positionY}px`;
|
|
324
|
-
const position2 = `${positionX2} ${size / 2 + positionY}px`;
|
|
325
|
-
const position3 = `${positionX2} ${positionY}px`;
|
|
326
|
-
const position4 = `${positionX1} ${size / -2 + positionY}px`;
|
|
327
|
-
return `
|
|
328
|
-
linear-gradient(45deg, ${color} 25%, transparent 25%) ${position1} / ${dimensions} ${repeat},
|
|
329
|
-
linear-gradient(45deg, transparent 75%, ${color} 75%) ${position2} / ${dimensions} ${repeat},
|
|
330
|
-
linear-gradient(135deg, ${color} 25%, transparent 25%) ${position3} / ${dimensions} ${repeat},
|
|
331
|
-
linear-gradient(135deg, transparent 75%, ${color} 75%) ${position4} / ${dimensions} ${repeat}
|
|
332
|
-
`;
|
|
333
|
-
};
|
|
334
|
-
|
|
335
|
-
const COMPONENT_ID$j = 'colorpickers.colorpicker_alpha';
|
|
309
|
+
const COMPONENT_ID$i = 'colorpickers.colorpicker_alpha';
|
|
336
310
|
const background$3 = props => {
|
|
337
311
|
const direction = `to ${props.theme.rtl ? 'left' : 'right'}`;
|
|
338
|
-
const fromColor = `rgba(${props
|
|
339
|
-
const toColor = `rgb(${props
|
|
312
|
+
const fromColor = `rgba(${props.$red}, ${props.$green}, ${props.$blue}, 0)`;
|
|
313
|
+
const toColor = `rgb(${props.$red}, ${props.$green}, ${props.$blue})`;
|
|
340
314
|
const positionY = getTrackMargin(props);
|
|
341
315
|
const height = getTrackHeight(props);
|
|
342
|
-
const
|
|
343
|
-
return
|
|
316
|
+
const overlay = `linear-gradient(${direction}, ${fromColor}, ${toColor}) 0 ${positionY}px / 100% ${height}px no-repeat`;
|
|
317
|
+
return reactTheming.getCheckeredBackground({
|
|
318
|
+
theme: props.theme,
|
|
319
|
+
size: height,
|
|
320
|
+
positionY,
|
|
321
|
+
repeat: 'repeat-x',
|
|
322
|
+
overlay
|
|
323
|
+
});
|
|
344
324
|
};
|
|
345
325
|
const StyledAlphaRange = styled__default.default(StyledRange).attrs(props => ({
|
|
346
326
|
style: {
|
|
347
327
|
backgroundSize: 'auto',
|
|
348
328
|
background: background$3(props)
|
|
349
329
|
},
|
|
350
|
-
'data-garden-id': COMPONENT_ID$
|
|
351
|
-
'data-garden-version': '9.0.0-next.
|
|
330
|
+
'data-garden-id': COMPONENT_ID$i,
|
|
331
|
+
'data-garden-version': '9.0.0-next.21'
|
|
352
332
|
})).withConfig({
|
|
353
333
|
displayName: "StyledAlphaRange",
|
|
354
|
-
componentId: "sc-
|
|
334
|
+
componentId: "sc-1f6hp2j-0"
|
|
355
335
|
})([""]);
|
|
356
336
|
StyledAlphaRange.defaultProps = {
|
|
357
337
|
theme: reactTheming.DEFAULT_THEME
|
|
358
338
|
};
|
|
359
339
|
|
|
360
|
-
const COMPONENT_ID$
|
|
340
|
+
const COMPONENT_ID$h = 'colorpickers.colorpicker_preview_box';
|
|
361
341
|
const background$2 = props => {
|
|
362
|
-
const alpha = props
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
342
|
+
const alpha = props.$alpha ? props.$alpha / 100 : 0;
|
|
343
|
+
let retVal = `rgba(${props.$red}, ${props.$green}, ${props.$blue}, ${alpha})`;
|
|
344
|
+
if (!props.$isOpaque) {
|
|
345
|
+
retVal = reactTheming.getCheckeredBackground({
|
|
346
|
+
theme: props.theme,
|
|
347
|
+
size: 13,
|
|
348
|
+
overlay: retVal
|
|
349
|
+
});
|
|
367
350
|
}
|
|
368
351
|
return retVal;
|
|
369
352
|
};
|
|
@@ -371,58 +354,69 @@ const StyledPreview = styled__default.default.div.attrs(props => ({
|
|
|
371
354
|
style: {
|
|
372
355
|
background: background$2(props)
|
|
373
356
|
},
|
|
374
|
-
'data-garden-id': COMPONENT_ID$
|
|
375
|
-
'data-garden-version': '9.0.0-next.
|
|
357
|
+
'data-garden-id': COMPONENT_ID$h,
|
|
358
|
+
'data-garden-version': '9.0.0-next.21',
|
|
376
359
|
'data-test-id': 'preview-box'
|
|
377
360
|
})).withConfig({
|
|
378
361
|
displayName: "StyledPreview",
|
|
379
|
-
componentId: "sc-
|
|
380
|
-
})(["flex-shrink:0;border-radius:", ";box-shadow:inset 0 0 0 ", " ", ";width:", "px;height:", "px;", ";"], props => props.theme.borderRadii.md, props => props.theme.borderWidths.sm, props => polished.rgba(props.theme.palette.black, 0.19), props => props.theme.space.base * (props
|
|
362
|
+
componentId: "sc-1z5nh7-0"
|
|
363
|
+
})(["flex-shrink:0;border-radius:", ";box-shadow:inset 0 0 0 ", " ", ";width:", "px;height:", "px;", ";"], props => props.theme.borderRadii.md, props => props.theme.borderWidths.sm, props => polished.rgba(props.theme.palette.black, 0.19), props => props.theme.space.base * (props.$isOpaque ? 6 : 8), props => props.theme.space.base * (props.$isOpaque ? 6 : 8), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$h, props));
|
|
381
364
|
StyledPreview.defaultProps = {
|
|
382
365
|
theme: reactTheming.DEFAULT_THEME
|
|
383
366
|
};
|
|
384
367
|
|
|
385
|
-
const COMPONENT_ID$
|
|
368
|
+
const COMPONENT_ID$g = 'colorpickers.colorpicker_colorwell';
|
|
386
369
|
const background$1 = props => {
|
|
387
370
|
const blackAlpha = polished.rgba(props.theme.palette.black, 0.9);
|
|
388
371
|
const black = `linear-gradient(0deg, ${props.theme.palette.black}, ${blackAlpha} 1%, transparent 99%)`;
|
|
389
372
|
const whiteAngle = `${props.theme.rtl ? -90 : 90}deg`;
|
|
390
373
|
const white = `linear-gradient(${whiteAngle}, ${props.theme.palette.white} 1%, transparent)`;
|
|
391
|
-
const colorValue = polished.hsl(props
|
|
374
|
+
const colorValue = polished.hsl(props.$hue, 1, 0.5);
|
|
392
375
|
const color = `linear-gradient(${colorValue}, ${colorValue})`;
|
|
393
376
|
return `${black}, ${white}, ${color}`;
|
|
394
377
|
};
|
|
395
378
|
const StyledColorWell = styled__default.default.div.attrs(props => ({
|
|
396
|
-
'data-garden-id': COMPONENT_ID$
|
|
397
|
-
'data-garden-version': '9.0.0-next.
|
|
379
|
+
'data-garden-id': COMPONENT_ID$g,
|
|
380
|
+
'data-garden-version': '9.0.0-next.21',
|
|
398
381
|
'data-test-id': 'colorwell',
|
|
399
382
|
style: {
|
|
400
383
|
background: background$1(props)
|
|
401
384
|
}
|
|
402
385
|
})).withConfig({
|
|
403
386
|
displayName: "StyledColorWell",
|
|
404
|
-
componentId: "sc-
|
|
405
|
-
})(["position:relative;margin-bottom:", "px;cursor:pointer;height:208px;overflow:hidden;", ";"], props => props.theme.space.base * 2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
387
|
+
componentId: "sc-1gg9z8m-0"
|
|
388
|
+
})(["position:relative;margin-bottom:", "px;cursor:pointer;height:208px;overflow:hidden;", ";"], props => props.theme.space.base * 2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$g, props));
|
|
406
389
|
StyledColorWell.defaultProps = {
|
|
407
390
|
theme: reactTheming.DEFAULT_THEME
|
|
408
391
|
};
|
|
409
392
|
|
|
410
|
-
const COMPONENT_ID$
|
|
411
|
-
const
|
|
393
|
+
const COMPONENT_ID$f = 'colorpickers.colorpicker_colorwell_thumb';
|
|
394
|
+
const colorStyles$1 = _ref => {
|
|
395
|
+
let {
|
|
396
|
+
theme
|
|
397
|
+
} = _ref;
|
|
398
|
+
const borderColor = reactTheming.getColor({
|
|
399
|
+
theme,
|
|
400
|
+
hue: 'white'
|
|
401
|
+
});
|
|
402
|
+
const boxShadow = `${theme.shadows.xs(reactTheming.getColor({
|
|
403
|
+
theme,
|
|
404
|
+
hue: 'black'
|
|
405
|
+
}))}`;
|
|
406
|
+
return styled.css(["border-color:", ";box-shadow:", ";"], borderColor, boxShadow);
|
|
407
|
+
};
|
|
408
|
+
const sizeStyles$2 = _ref2 => {
|
|
409
|
+
let {
|
|
410
|
+
theme
|
|
411
|
+
} = _ref2;
|
|
412
412
|
const borderWidth = polished.stripUnit(theme.borderWidths.sm) * 2;
|
|
413
413
|
const size = theme.space.base * 5;
|
|
414
414
|
const translateValue = size / -2;
|
|
415
|
-
return
|
|
416
|
-
transform: translate(${translateValue}px, ${translateValue}px);
|
|
417
|
-
box-sizing: border-box;
|
|
418
|
-
border-width: ${borderWidth}px;
|
|
419
|
-
width: ${size}px;
|
|
420
|
-
height: ${size}px;
|
|
421
|
-
`;
|
|
415
|
+
return styled.css(["transform:translate(", "px,", "px);box-sizing:border-box;border-width:", "px;width:", "px;height:", "px;"], translateValue, translateValue, borderWidth, size, size);
|
|
422
416
|
};
|
|
423
417
|
const StyledColorWellThumb = styled__default.default.div.attrs(props => ({
|
|
424
|
-
'data-garden-id': COMPONENT_ID$
|
|
425
|
-
'data-garden-version': '9.0.0-next.
|
|
418
|
+
'data-garden-id': COMPONENT_ID$f,
|
|
419
|
+
'data-garden-version': '9.0.0-next.21',
|
|
426
420
|
'data-test-id': 'colorwell-thumb',
|
|
427
421
|
style: {
|
|
428
422
|
top: `${props.top}%`,
|
|
@@ -430,76 +424,76 @@ const StyledColorWellThumb = styled__default.default.div.attrs(props => ({
|
|
|
430
424
|
}
|
|
431
425
|
})).withConfig({
|
|
432
426
|
displayName: "StyledColorWellThumb",
|
|
433
|
-
componentId: "sc-
|
|
434
|
-
})(["position:absolute;border:
|
|
427
|
+
componentId: "sc-1npyab0-0"
|
|
428
|
+
})(["position:absolute;border:", ";border-radius:50%;", " ", " ", ";"], props => props.theme.borders.sm, sizeStyles$2, colorStyles$1, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$f, props));
|
|
435
429
|
StyledColorWellThumb.defaultProps = {
|
|
436
430
|
theme: reactTheming.DEFAULT_THEME
|
|
437
431
|
};
|
|
438
432
|
|
|
439
|
-
const COMPONENT_ID$
|
|
433
|
+
const COMPONENT_ID$e = 'colorpickers.colorpicker_slider_group';
|
|
440
434
|
const StyledSliderGroup = styled__default.default.div.attrs({
|
|
441
|
-
'data-garden-id': COMPONENT_ID$
|
|
442
|
-
'data-garden-version': '9.0.0-next.
|
|
435
|
+
'data-garden-id': COMPONENT_ID$e,
|
|
436
|
+
'data-garden-version': '9.0.0-next.21'
|
|
443
437
|
}).withConfig({
|
|
444
438
|
displayName: "StyledSliderGroup",
|
|
445
|
-
componentId: "sc-
|
|
446
|
-
})(["display:flex;justify-content:space-between;margin-bottom:", "px;", ";"], props => props.theme.space.base * 2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
439
|
+
componentId: "sc-tigkzg-0"
|
|
440
|
+
})(["display:flex;justify-content:space-between;margin-bottom:", "px;", ";"], props => props.theme.space.base * 2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$e, props));
|
|
447
441
|
StyledSliderGroup.defaultProps = {
|
|
448
442
|
theme: reactTheming.DEFAULT_THEME
|
|
449
443
|
};
|
|
450
444
|
|
|
451
|
-
const COMPONENT_ID$
|
|
445
|
+
const COMPONENT_ID$d = 'colorpickers.colorpicker_hex_field';
|
|
452
446
|
const StyledHexField = styled__default.default(reactForms.Field).attrs({
|
|
453
|
-
'data-garden-id': COMPONENT_ID$
|
|
454
|
-
'data-garden-version': '9.0.0-next.
|
|
447
|
+
'data-garden-id': COMPONENT_ID$d,
|
|
448
|
+
'data-garden-version': '9.0.0-next.21',
|
|
455
449
|
spellcheck: false
|
|
456
450
|
}).withConfig({
|
|
457
451
|
displayName: "StyledHexField",
|
|
458
|
-
componentId: "sc-
|
|
459
|
-
})(["display:flex;flex-basis:0;flex-direction:column;flex-grow:1;width:auto;text-align:center;input{direction:ltr;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
452
|
+
componentId: "sc-ijq1c-0"
|
|
453
|
+
})(["display:flex;flex-basis:0;flex-direction:column;flex-grow:1;width:auto;text-align:center;input{direction:ltr;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$d, props));
|
|
460
454
|
StyledHexField.defaultProps = {
|
|
461
455
|
theme: reactTheming.DEFAULT_THEME
|
|
462
456
|
};
|
|
463
457
|
|
|
464
|
-
const COMPONENT_ID$
|
|
458
|
+
const COMPONENT_ID$c = 'colorpickers.colorpicker_label';
|
|
465
459
|
const StyledLabel = styled__default.default(reactForms.Label).attrs({
|
|
466
|
-
'data-garden-id': COMPONENT_ID$
|
|
467
|
-
'data-garden-version': '9.0.0-next.
|
|
460
|
+
'data-garden-id': COMPONENT_ID$c,
|
|
461
|
+
'data-garden-version': '9.0.0-next.21'
|
|
468
462
|
}).withConfig({
|
|
469
463
|
displayName: "StyledLabel",
|
|
470
|
-
componentId: "sc-
|
|
471
|
-
})(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
464
|
+
componentId: "sc-1vxt3m9-0"
|
|
465
|
+
})(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$c, props));
|
|
472
466
|
StyledLabel.defaultProps = {
|
|
473
467
|
theme: reactTheming.DEFAULT_THEME
|
|
474
468
|
};
|
|
475
469
|
|
|
476
|
-
const COMPONENT_ID$
|
|
470
|
+
const COMPONENT_ID$b = 'colorpickers.colorpicker_input';
|
|
477
471
|
const StyledInput = styled__default.default(reactForms.Input).attrs({
|
|
478
|
-
'data-garden-id': COMPONENT_ID$
|
|
479
|
-
'data-garden-version': '9.0.0-next.
|
|
472
|
+
'data-garden-id': COMPONENT_ID$b,
|
|
473
|
+
'data-garden-version': '9.0.0-next.21',
|
|
480
474
|
focusInset: false
|
|
481
475
|
}).withConfig({
|
|
482
476
|
displayName: "StyledInput",
|
|
483
|
-
componentId: "sc-
|
|
484
|
-
})(["text-align:center;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
477
|
+
componentId: "sc-1uzlutt-0"
|
|
478
|
+
})(["text-align:center;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$b, props));
|
|
485
479
|
StyledInput.defaultProps = {
|
|
486
480
|
theme: reactTheming.DEFAULT_THEME
|
|
487
481
|
};
|
|
488
482
|
|
|
489
|
-
const COMPONENT_ID$
|
|
483
|
+
const COMPONENT_ID$a = 'colorpickers.colorpicker_input_group';
|
|
490
484
|
const StyledInputGroup = styled__default.default.div.attrs({
|
|
491
|
-
'data-garden-id': COMPONENT_ID$
|
|
492
|
-
'data-garden-version': '9.0.0-next.
|
|
485
|
+
'data-garden-id': COMPONENT_ID$a,
|
|
486
|
+
'data-garden-version': '9.0.0-next.21'
|
|
493
487
|
}).withConfig({
|
|
494
488
|
displayName: "StyledInputGroup",
|
|
495
|
-
componentId: "sc-
|
|
496
|
-
})(["display:flex;justify-content:space-between;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
489
|
+
componentId: "sc-1m9g2wg-0"
|
|
490
|
+
})(["display:flex;justify-content:space-between;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$a, props));
|
|
497
491
|
StyledInputGroup.defaultProps = {
|
|
498
492
|
theme: reactTheming.DEFAULT_THEME
|
|
499
493
|
};
|
|
500
494
|
|
|
501
|
-
const COMPONENT_ID$
|
|
502
|
-
const sizeStyles = theme => {
|
|
495
|
+
const COMPONENT_ID$9 = 'colorpickers.colorpicker_rgb_field';
|
|
496
|
+
const sizeStyles$1 = theme => {
|
|
503
497
|
const margin = `${theme.space.base * 1.5}px`;
|
|
504
498
|
const width = `${theme.space.base * 12.75}px`;
|
|
505
499
|
return `
|
|
@@ -509,72 +503,97 @@ const sizeStyles = theme => {
|
|
|
509
503
|
`;
|
|
510
504
|
};
|
|
511
505
|
const StyledRGBAField = styled__default.default(reactForms.Field).attrs({
|
|
512
|
-
'data-garden-id': COMPONENT_ID$
|
|
513
|
-
'data-garden-version': '9.0.0-next.
|
|
506
|
+
'data-garden-id': COMPONENT_ID$9,
|
|
507
|
+
'data-garden-version': '9.0.0-next.21'
|
|
514
508
|
}).withConfig({
|
|
515
509
|
displayName: "StyledRGBAField",
|
|
516
|
-
componentId: "sc-
|
|
517
|
-
})(["display:flex;flex-direction:column;text-align:center;", ";", ";"], props => sizeStyles(props.theme), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
510
|
+
componentId: "sc-13266k8-0"
|
|
511
|
+
})(["display:flex;flex-direction:column;text-align:center;", ";", ";"], props => sizeStyles$1(props.theme), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$9, props));
|
|
518
512
|
StyledRGBAField.defaultProps = {
|
|
519
513
|
theme: reactTheming.DEFAULT_THEME
|
|
520
514
|
};
|
|
521
515
|
|
|
522
|
-
const COMPONENT_ID$
|
|
516
|
+
const COMPONENT_ID$8 = 'colorpickers.colorpicker_sliders';
|
|
517
|
+
const sizeStyles = props => {
|
|
518
|
+
if (props.$isOpaque) {
|
|
519
|
+
return undefined;
|
|
520
|
+
}
|
|
521
|
+
const trackHeight = getTrackHeight(props);
|
|
522
|
+
const trackMargin = getTrackMargin(props);
|
|
523
|
+
return `
|
|
524
|
+
& > * {
|
|
525
|
+
position: absolute;
|
|
526
|
+
width: 100%;
|
|
527
|
+
height: ${trackMargin * 2 + trackHeight}px;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
& > :first-child {
|
|
531
|
+
top: -${trackMargin}px;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
& > :last-child {
|
|
535
|
+
bottom: -${trackMargin}px;
|
|
536
|
+
}
|
|
537
|
+
`;
|
|
538
|
+
};
|
|
523
539
|
const StyledSliders = styled__default.default.div.attrs({
|
|
524
|
-
'data-garden-id': COMPONENT_ID$
|
|
525
|
-
'data-garden-version': '9.0.0-next.
|
|
540
|
+
'data-garden-id': COMPONENT_ID$8,
|
|
541
|
+
'data-garden-version': '9.0.0-next.21'
|
|
526
542
|
}).withConfig({
|
|
527
543
|
displayName: "StyledSliders",
|
|
528
|
-
componentId: "sc-
|
|
529
|
-
})(["position:relative;margin-", ":", "px;width:100
|
|
544
|
+
componentId: "sc-1lgr50m-0"
|
|
545
|
+
})(["position:relative;margin-", ":", "px;width:100%;", " ", ";"], props => props.theme.rtl ? 'right' : 'left', props => props.theme.space.base * 2, sizeStyles, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$8, props));
|
|
530
546
|
StyledSliders.defaultProps = {
|
|
531
547
|
theme: reactTheming.DEFAULT_THEME
|
|
532
548
|
};
|
|
533
549
|
|
|
534
|
-
const COMPONENT_ID$8 = 'colorpickers.colordialog_button';
|
|
535
550
|
const StyledButton = styled__default.default(reactButtons.Button).attrs({
|
|
536
551
|
isNeutral: true,
|
|
537
|
-
'data-garden-
|
|
538
|
-
'data-garden-version': '9.0.0-next.2'
|
|
552
|
+
'data-garden-version': '9.0.0-next.21'
|
|
539
553
|
}).withConfig({
|
|
540
554
|
displayName: "StyledButton",
|
|
541
|
-
componentId: "sc-
|
|
542
|
-
})(["padding:0;width:", "px;max-width:", "px;&:last-of-type:not(:first-child){border-top-", "-radius:", " !important;border-bottom-", "-radius:", " !important;}"
|
|
555
|
+
componentId: "sc-1dlijfv-0"
|
|
556
|
+
})(["padding:0;width:", "px;max-width:", "px;&:last-of-type:not(:first-child){border-top-", "-radius:", " !important;border-bottom-", "-radius:", " !important;}"], props => props.theme.space.base * 17, props => props.theme.space.base * 17, props => props.theme.rtl ? 'left' : 'right', props => props.theme.borderRadii.md, props => props.theme.rtl ? 'left' : 'right', props => props.theme.borderRadii.md);
|
|
543
557
|
StyledButton.defaultProps = {
|
|
544
558
|
theme: reactTheming.DEFAULT_THEME
|
|
545
559
|
};
|
|
546
560
|
|
|
547
561
|
const COMPONENT_ID$7 = 'colorpickers.colordialog_preview';
|
|
548
|
-
const background =
|
|
549
|
-
|
|
550
|
-
backgroundColor
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
562
|
+
const background = _ref => {
|
|
563
|
+
let {
|
|
564
|
+
$backgroundColor,
|
|
565
|
+
theme
|
|
566
|
+
} = _ref;
|
|
567
|
+
let retVal;
|
|
568
|
+
if (typeof $backgroundColor === 'string') {
|
|
569
|
+
retVal = $backgroundColor;
|
|
570
|
+
} else if ($backgroundColor === undefined) {
|
|
571
|
+
retVal = theme.palette.white;
|
|
557
572
|
} else {
|
|
558
573
|
const {
|
|
559
574
|
red,
|
|
560
575
|
green,
|
|
561
576
|
blue,
|
|
562
577
|
alpha = 1
|
|
563
|
-
} = backgroundColor;
|
|
564
|
-
|
|
578
|
+
} = $backgroundColor;
|
|
579
|
+
retVal = `rgba(${red}, ${green}, ${blue}, ${alpha ? alpha / 100 : 0})`;
|
|
565
580
|
}
|
|
566
|
-
return
|
|
581
|
+
return retVal;
|
|
567
582
|
};
|
|
568
583
|
const StyledButtonPreview = styled__default.default.span.attrs(props => ({
|
|
569
584
|
style: {
|
|
570
|
-
background:
|
|
585
|
+
background: reactTheming.getCheckeredBackground({
|
|
586
|
+
theme: props.theme,
|
|
587
|
+
size: 8,
|
|
588
|
+
overlay: background(props)
|
|
589
|
+
})
|
|
571
590
|
},
|
|
572
591
|
'data-garden-id': COMPONENT_ID$7,
|
|
573
|
-
'data-garden-version': '9.0.0-next.
|
|
592
|
+
'data-garden-version': '9.0.0-next.21',
|
|
574
593
|
'data-test-id': 'dialog-preview'
|
|
575
594
|
})).withConfig({
|
|
576
595
|
displayName: "StyledButtonPreview",
|
|
577
|
-
componentId: "sc-
|
|
596
|
+
componentId: "sc-yxis8h-0"
|
|
578
597
|
})(["display:inline-block;bottom:", "px;border-radius:", ";box-shadow:inset 0 0 0 ", " ", ";width:", "px;height:", "px;", ";"], props => props.theme.space.base, props => props.theme.borderRadii.sm, props => props.theme.borderWidths.sm, props => polished.rgba(props.theme.palette.black, 0.19), props => props.theme.space.base * 5, props => props.theme.space.base * 5, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$7, props));
|
|
579
598
|
StyledButtonPreview.defaultProps = {
|
|
580
599
|
theme: reactTheming.DEFAULT_THEME
|
|
@@ -583,10 +602,10 @@ StyledButtonPreview.defaultProps = {
|
|
|
583
602
|
const COMPONENT_ID$6 = 'colorpickers.colordialog_tooltipmodal';
|
|
584
603
|
const StyledTooltipModal = styled__default.default(reactModals.TooltipModal).attrs({
|
|
585
604
|
'data-garden-id': COMPONENT_ID$6,
|
|
586
|
-
'data-garden-version': '9.0.0-next.
|
|
605
|
+
'data-garden-version': '9.0.0-next.21'
|
|
587
606
|
}).withConfig({
|
|
588
607
|
displayName: "StyledTooltipModal",
|
|
589
|
-
componentId: "sc-
|
|
608
|
+
componentId: "sc-gykkrw-0"
|
|
590
609
|
})(["width:auto !important;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$6, props));
|
|
591
610
|
StyledTooltipModal.defaultProps = {
|
|
592
611
|
theme: reactTheming.DEFAULT_THEME
|
|
@@ -595,10 +614,10 @@ StyledTooltipModal.defaultProps = {
|
|
|
595
614
|
const COMPONENT_ID$5 = 'colorpickers.colordialog_tooltipmodal_body';
|
|
596
615
|
const StyledTooltipBody = styled__default.default(reactModals.TooltipModal.Body).attrs({
|
|
597
616
|
'data-garden-id': COMPONENT_ID$5,
|
|
598
|
-
'data-garden-version': '9.0.0-next.
|
|
617
|
+
'data-garden-version': '9.0.0-next.21'
|
|
599
618
|
}).withConfig({
|
|
600
619
|
displayName: "StyledTooltipBody",
|
|
601
|
-
componentId: "sc-
|
|
620
|
+
componentId: "sc-1ueddpo-0"
|
|
602
621
|
})(["padding:0;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props));
|
|
603
622
|
StyledTooltipBody.defaultProps = {
|
|
604
623
|
theme: reactTheming.DEFAULT_THEME
|
|
@@ -607,7 +626,7 @@ StyledTooltipBody.defaultProps = {
|
|
|
607
626
|
const COMPONENT_ID$4 = 'colorpickers.color_swatch';
|
|
608
627
|
const StyledColorSwatch = styled__default.default.table.attrs({
|
|
609
628
|
'data-garden-id': COMPONENT_ID$4,
|
|
610
|
-
'data-garden-version': '9.0.0-next.
|
|
629
|
+
'data-garden-version': '9.0.0-next.21'
|
|
611
630
|
}).withConfig({
|
|
612
631
|
displayName: "StyledColorSwatch",
|
|
613
632
|
componentId: "sc-ajx440-0"
|
|
@@ -619,48 +638,58 @@ StyledColorSwatch.defaultProps = {
|
|
|
619
638
|
const COMPONENT_ID$3 = 'colorpickers.color_swatch_input';
|
|
620
639
|
const StyledColorSwatchInput = styled__default.default.input.attrs({
|
|
621
640
|
'data-garden-id': COMPONENT_ID$3,
|
|
622
|
-
'data-garden-version': '9.0.0-next.
|
|
641
|
+
'data-garden-version': '9.0.0-next.21'
|
|
623
642
|
}).withConfig({
|
|
624
643
|
displayName: "StyledColorSwatchInput",
|
|
625
644
|
componentId: "sc-em45h0-0"
|
|
626
|
-
})(["position:absolute;opacity:0;z-index:1;margin:0;width:100%;height:100%;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
645
|
+
})(["position:absolute;opacity:0;z-index:1;margin:0;cursor:pointer;width:100%;height:100%;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
627
646
|
StyledColorSwatchInput.defaultProps = {
|
|
628
647
|
theme: reactTheming.DEFAULT_THEME
|
|
629
648
|
};
|
|
630
649
|
|
|
631
650
|
const COMPONENT_ID$2 = 'colorpickers.color_swatch_label';
|
|
632
|
-
const colorStyles =
|
|
633
|
-
|
|
651
|
+
const colorStyles = _ref => {
|
|
652
|
+
let {
|
|
653
|
+
$backgroundColor,
|
|
654
|
+
theme
|
|
655
|
+
} = _ref;
|
|
634
656
|
const {
|
|
635
657
|
alpha
|
|
636
|
-
} = polished.parseToRgb(
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
658
|
+
} = polished.parseToRgb($backgroundColor);
|
|
659
|
+
const returnIfLightColor = reactTheming.getColor({
|
|
660
|
+
theme,
|
|
661
|
+
hue: 'neutralHue',
|
|
662
|
+
shade: 900
|
|
663
|
+
});
|
|
664
|
+
let foregroundColor = returnIfLightColor;
|
|
665
|
+
if (alpha === undefined || alpha >= 0.4) {
|
|
666
|
+
const returnIfDarkColor = reactTheming.getColor({
|
|
667
|
+
theme,
|
|
668
|
+
hue: 'white'
|
|
669
|
+
});
|
|
670
|
+
foregroundColor = polished.readableColor($backgroundColor, returnIfLightColor, returnIfDarkColor, false );
|
|
642
671
|
}
|
|
643
672
|
return `
|
|
644
673
|
color: ${foregroundColor};
|
|
645
|
-
|
|
646
|
-
&[data-garden-focus-visible] {
|
|
647
|
-
box-shadow: ${boxShadow};
|
|
648
674
|
`;
|
|
649
675
|
};
|
|
650
676
|
const StyledColorSwatchLabel = styled__default.default(StyledButtonPreview).attrs({
|
|
651
677
|
as: 'label',
|
|
652
678
|
'data-garden-id': COMPONENT_ID$2,
|
|
653
|
-
'data-garden-version': '9.0.0-next.
|
|
679
|
+
'data-garden-version': '9.0.0-next.21'
|
|
654
680
|
}).withConfig({
|
|
655
681
|
displayName: "StyledColorSwatchLabel",
|
|
656
682
|
componentId: "sc-1aghocg-0"
|
|
657
|
-
})(["position:relative;border-radius:", ";
|
|
683
|
+
})(["position:relative;top:0;border-radius:", ";", ";", " ", ";"], props => props.theme.borderRadii.md, colorStyles, props => reactTheming.focusStyles({
|
|
684
|
+
theme: props.theme,
|
|
685
|
+
selector: '&:has(:focus-visible)'
|
|
686
|
+
}), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
658
687
|
StyledColorSwatchLabel.defaultProps = {
|
|
659
688
|
theme: reactTheming.DEFAULT_THEME
|
|
660
689
|
};
|
|
661
690
|
|
|
662
691
|
var _path$1;
|
|
663
|
-
function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (
|
|
692
|
+
function _extends$1() { return _extends$1 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$1.apply(null, arguments); }
|
|
664
693
|
var SvgCheckSmFill = function SvgCheckSmFill(props) {
|
|
665
694
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
|
|
666
695
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -682,7 +711,7 @@ var SvgCheckSmFill = function SvgCheckSmFill(props) {
|
|
|
682
711
|
const COMPONENT_ID$1 = 'colorpickers.colorswatch_check';
|
|
683
712
|
const StyledIcon = styled__default.default(SvgCheckSmFill).attrs({
|
|
684
713
|
'data-garden-id': COMPONENT_ID$1,
|
|
685
|
-
'data-garden-version': '9.0.0-next.
|
|
714
|
+
'data-garden-version': '9.0.0-next.21'
|
|
686
715
|
}).withConfig({
|
|
687
716
|
displayName: "StyledIcon",
|
|
688
717
|
componentId: "sc-8oigif-0"
|
|
@@ -694,7 +723,7 @@ StyledIcon.defaultProps = {
|
|
|
694
723
|
const COMPONENT_ID = 'colorpickers.swatch_cell';
|
|
695
724
|
const StyledCell = styled__default.default.td.attrs({
|
|
696
725
|
'data-garden-id': COMPONENT_ID,
|
|
697
|
-
'data-garden-version': '9.0.0-next.
|
|
726
|
+
'data-garden-version': '9.0.0-next.21'
|
|
698
727
|
}).withConfig({
|
|
699
728
|
displayName: "StyledCell",
|
|
700
729
|
componentId: "sc-qr3oit-0"
|
|
@@ -766,7 +795,7 @@ const ColorWell = React__namespace.default.memo(_ref => {
|
|
|
766
795
|
}, [throttledChange]);
|
|
767
796
|
return (
|
|
768
797
|
React__namespace.default.createElement(StyledColorWell, {
|
|
769
|
-
hue: hue,
|
|
798
|
+
$hue: hue,
|
|
770
799
|
ref: containerRef,
|
|
771
800
|
role: "presentation",
|
|
772
801
|
onMouseDown: handleMouseDown
|
|
@@ -1046,7 +1075,7 @@ const reducer = (state, action) => {
|
|
|
1046
1075
|
}
|
|
1047
1076
|
};
|
|
1048
1077
|
|
|
1049
|
-
const
|
|
1078
|
+
const ColorPicker = React.forwardRef((_ref, ref) => {
|
|
1050
1079
|
let {
|
|
1051
1080
|
color,
|
|
1052
1081
|
defaultColor,
|
|
@@ -1146,40 +1175,40 @@ const Colorpicker = React.forwardRef((_ref, ref) => {
|
|
|
1146
1175
|
payload: computedColor
|
|
1147
1176
|
});
|
|
1148
1177
|
}, [computedColor]);
|
|
1149
|
-
return React__namespace.default.createElement(StyledColorPicker,
|
|
1178
|
+
return React__namespace.default.createElement(StyledColorPicker, Object.assign({
|
|
1150
1179
|
ref: ref,
|
|
1151
|
-
isOpaque: isOpaque
|
|
1180
|
+
$isOpaque: isOpaque
|
|
1152
1181
|
}, props), React__namespace.default.createElement(ColorWell, {
|
|
1153
1182
|
hue: computedColor.hue,
|
|
1154
1183
|
saturation: computedColor.saturation,
|
|
1155
1184
|
lightness: computedColor.lightness,
|
|
1156
1185
|
onChange: handleColorWellChange
|
|
1157
1186
|
}), React__namespace.default.createElement(StyledSliderGroup, null, React__namespace.default.createElement(StyledPreview, {
|
|
1158
|
-
red: computedColor.red,
|
|
1159
|
-
green: computedColor.green,
|
|
1160
|
-
blue: computedColor.blue,
|
|
1161
|
-
alpha: computedColor.alpha,
|
|
1162
|
-
isOpaque: isOpaque
|
|
1187
|
+
$red: computedColor.red,
|
|
1188
|
+
$green: computedColor.green,
|
|
1189
|
+
$blue: computedColor.blue,
|
|
1190
|
+
$alpha: computedColor.alpha,
|
|
1191
|
+
$isOpaque: isOpaque
|
|
1163
1192
|
}), React__namespace.default.createElement(StyledSliders, {
|
|
1164
|
-
isOpaque: isOpaque
|
|
1165
|
-
}, React__namespace.default.createElement(reactForms.Field, null, React__namespace.default.createElement(reactForms.Label, {
|
|
1193
|
+
$isOpaque: isOpaque
|
|
1194
|
+
}, React__namespace.default.createElement(reactForms.Field, null, React__namespace.default.createElement(reactForms.Field.Label, {
|
|
1166
1195
|
hidden: true
|
|
1167
1196
|
}, labels.hueSlider || 'Hue slider'), React__namespace.default.createElement(StyledHueRange, {
|
|
1168
1197
|
step: 1,
|
|
1169
1198
|
max: 360,
|
|
1170
1199
|
value: computedColor.hue,
|
|
1171
|
-
isOpaque: isOpaque,
|
|
1200
|
+
$isOpaque: isOpaque,
|
|
1172
1201
|
onChange: handleHueChange
|
|
1173
|
-
})), !isOpaque && React__namespace.default.createElement(reactForms.Field, null, React__namespace.default.createElement(reactForms.Label, {
|
|
1202
|
+
})), !isOpaque && React__namespace.default.createElement(reactForms.Field, null, React__namespace.default.createElement(reactForms.Field.Label, {
|
|
1174
1203
|
hidden: true
|
|
1175
1204
|
}, labels.alphaSlider || 'Alpha slider'), React__namespace.default.createElement(StyledAlphaRange, {
|
|
1176
1205
|
max: 1,
|
|
1177
1206
|
step: 0.01,
|
|
1178
1207
|
value: computedColor.alpha / 100,
|
|
1179
1208
|
onChange: handleAlphaSliderChange,
|
|
1180
|
-
red: computedColor.red,
|
|
1181
|
-
green: computedColor.green,
|
|
1182
|
-
blue: computedColor.blue
|
|
1209
|
+
$red: computedColor.red,
|
|
1210
|
+
$green: computedColor.green,
|
|
1211
|
+
$blue: computedColor.blue
|
|
1183
1212
|
})))), React__namespace.default.createElement(StyledInputGroup, null, React__namespace.default.createElement(StyledHexField, null, React__namespace.default.createElement(StyledLabel, {
|
|
1184
1213
|
isRegular: true
|
|
1185
1214
|
}, labels.hex || 'Hex'), React__namespace.default.createElement(StyledInput, {
|
|
@@ -1236,11 +1265,11 @@ const Colorpicker = React.forwardRef((_ref, ref) => {
|
|
|
1236
1265
|
onChange: handleAlphaChange
|
|
1237
1266
|
}))));
|
|
1238
1267
|
});
|
|
1239
|
-
|
|
1268
|
+
ColorPicker.defaultProps = {
|
|
1240
1269
|
defaultColor: '#fff'
|
|
1241
1270
|
};
|
|
1242
|
-
|
|
1243
|
-
|
|
1271
|
+
ColorPicker.displayName = 'ColorPicker';
|
|
1272
|
+
ColorPicker.propTypes = {
|
|
1244
1273
|
color: PropTypes__default.default.oneOfType([PropTypes__default.default.object, PropTypes__default.default.string]),
|
|
1245
1274
|
isOpaque: PropTypes__default.default.bool,
|
|
1246
1275
|
onChange: PropTypes__default.default.func,
|
|
@@ -1249,7 +1278,7 @@ Colorpicker.propTypes = {
|
|
|
1249
1278
|
};
|
|
1250
1279
|
|
|
1251
1280
|
var _path;
|
|
1252
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
1281
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
1253
1282
|
var SvgChevronDownStroke = function SvgChevronDownStroke(props) {
|
|
1254
1283
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
1255
1284
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1264,7 +1293,7 @@ var SvgChevronDownStroke = function SvgChevronDownStroke(props) {
|
|
|
1264
1293
|
})));
|
|
1265
1294
|
};
|
|
1266
1295
|
|
|
1267
|
-
const
|
|
1296
|
+
const ColorPickerDialog = React.forwardRef((_ref, ref) => {
|
|
1268
1297
|
let {
|
|
1269
1298
|
color,
|
|
1270
1299
|
defaultColor,
|
|
@@ -1291,7 +1320,7 @@ const ColorpickerDialog = React.forwardRef((_ref, ref) => {
|
|
|
1291
1320
|
const colorPickerRef = React.useRef(null);
|
|
1292
1321
|
const [referenceElement, setReferenceElement] = React.useState();
|
|
1293
1322
|
const [uncontrolledColor, setUncontrolledColor] = React.useState(defaultColor);
|
|
1294
|
-
const ariaLabelText = reactTheming.useText(
|
|
1323
|
+
const ariaLabelText = reactTheming.useText(ColorPickerDialog, {
|
|
1295
1324
|
'aria-label': ariaLabel
|
|
1296
1325
|
}, 'aria-label', 'Color picker');
|
|
1297
1326
|
const openDialog = () => {
|
|
@@ -1325,21 +1354,20 @@ const ColorpickerDialog = React.forwardRef((_ref, ref) => {
|
|
|
1325
1354
|
return React__namespace.default.createElement(React__namespace.default.Fragment, null, children ? ( React.cloneElement(React.Children.only(children), {
|
|
1326
1355
|
onClick,
|
|
1327
1356
|
ref: buttonRef
|
|
1328
|
-
})) : React__namespace.default.createElement(StyledButton,
|
|
1357
|
+
})) : React__namespace.default.createElement(StyledButton, Object.assign({
|
|
1329
1358
|
disabled: disabled,
|
|
1330
1359
|
focusInset: focusInset,
|
|
1331
1360
|
ref: buttonRef,
|
|
1332
1361
|
onClick: onClick
|
|
1333
1362
|
}, buttonProps), React__namespace.default.createElement(StyledButtonPreview, {
|
|
1334
|
-
backgroundColor: isControlled ? color : uncontrolledColor
|
|
1363
|
+
$backgroundColor: isControlled ? color : uncontrolledColor
|
|
1335
1364
|
}), React__namespace.default.createElement(reactButtons.Button.EndIcon, {
|
|
1336
1365
|
isRotated: referenceElement != null
|
|
1337
|
-
}, React__namespace.default.createElement(SvgChevronDownStroke, null))), React__namespace.default.createElement(StyledTooltipModal,
|
|
1366
|
+
}, React__namespace.default.createElement(SvgChevronDownStroke, null))), React__namespace.default.createElement(StyledTooltipModal, Object.assign({
|
|
1338
1367
|
ref: ref,
|
|
1339
1368
|
hasArrow: hasArrow,
|
|
1340
1369
|
zIndex: zIndex,
|
|
1341
1370
|
isAnimated: isAnimated,
|
|
1342
|
-
isOpaque: isOpaque,
|
|
1343
1371
|
focusOnMount: false,
|
|
1344
1372
|
placement: placement,
|
|
1345
1373
|
referenceElement: referenceElement,
|
|
@@ -1348,7 +1376,7 @@ const ColorpickerDialog = React.forwardRef((_ref, ref) => {
|
|
|
1348
1376
|
onClose && onClose(isControlled ? color : uncontrolledColor);
|
|
1349
1377
|
},
|
|
1350
1378
|
"aria-label": ariaLabelText
|
|
1351
|
-
}, props), React__namespace.default.createElement(StyledTooltipBody, null, React__namespace.default.createElement(
|
|
1379
|
+
}, props), React__namespace.default.createElement(StyledTooltipBody, null, React__namespace.default.createElement(ColorPicker, {
|
|
1352
1380
|
autofocus: true,
|
|
1353
1381
|
color: color,
|
|
1354
1382
|
isOpaque: isOpaque,
|
|
@@ -1358,8 +1386,8 @@ const ColorpickerDialog = React.forwardRef((_ref, ref) => {
|
|
|
1358
1386
|
onChange: isControlled ? onChange : setUncontrolledColor
|
|
1359
1387
|
}))));
|
|
1360
1388
|
});
|
|
1361
|
-
|
|
1362
|
-
...
|
|
1389
|
+
ColorPickerDialog.propTypes = {
|
|
1390
|
+
...ColorPicker.propTypes,
|
|
1363
1391
|
placement: PropTypes__default.default.oneOf(reactModals.PLACEMENT),
|
|
1364
1392
|
onClose: PropTypes__default.default.func,
|
|
1365
1393
|
onDialogChange: PropTypes__default.default.func,
|
|
@@ -1372,13 +1400,13 @@ ColorpickerDialog.propTypes = {
|
|
|
1372
1400
|
isOpen: PropTypes__default.default.bool,
|
|
1373
1401
|
focusInset: PropTypes__default.default.bool
|
|
1374
1402
|
};
|
|
1375
|
-
|
|
1403
|
+
ColorPickerDialog.defaultProps = {
|
|
1376
1404
|
placement: 'bottom-start',
|
|
1377
1405
|
isAnimated: true,
|
|
1378
1406
|
zIndex: 1000,
|
|
1379
1407
|
hasArrow: false
|
|
1380
1408
|
};
|
|
1381
|
-
|
|
1409
|
+
ColorPickerDialog.displayName = 'ColorPickerDialog';
|
|
1382
1410
|
|
|
1383
1411
|
const ColorSwatch = React.forwardRef((_ref, ref) => {
|
|
1384
1412
|
let {
|
|
@@ -1415,7 +1443,7 @@ const ColorSwatch = React.forwardRef((_ref, ref) => {
|
|
|
1415
1443
|
setColIndex(col);
|
|
1416
1444
|
}
|
|
1417
1445
|
});
|
|
1418
|
-
return React__namespace.default.createElement(StyledColorSwatch,
|
|
1446
|
+
return React__namespace.default.createElement(StyledColorSwatch, Object.assign({
|
|
1419
1447
|
role: "grid",
|
|
1420
1448
|
ref: reactMergeRefs.mergeRefs([gridRef, ref])
|
|
1421
1449
|
}, props), React__namespace.default.createElement("tbody", null, colors.map((row, _rowIndex) => React__namespace.default.createElement("tr", {
|
|
@@ -1427,7 +1455,6 @@ const ColorSwatch = React.forwardRef((_ref, ref) => {
|
|
|
1427
1455
|
} = color;
|
|
1428
1456
|
const {
|
|
1429
1457
|
role,
|
|
1430
|
-
onFocus,
|
|
1431
1458
|
...gridCellProps
|
|
1432
1459
|
} = getGridCellProps({
|
|
1433
1460
|
colIndex: _colIndex,
|
|
@@ -1453,7 +1480,6 @@ const ColorSwatch = React.forwardRef((_ref, ref) => {
|
|
|
1453
1480
|
}
|
|
1454
1481
|
};
|
|
1455
1482
|
const handleBlur = event => {
|
|
1456
|
-
event.target.parentElement?.removeAttribute('data-garden-focus-visible');
|
|
1457
1483
|
if (!(isCheckboxGroup || gridRef.current?.contains(event.relatedTarget))) {
|
|
1458
1484
|
const selectedInput = gridRef.current?.querySelector(`input[name='${event.target.name}']:checked`);
|
|
1459
1485
|
if (selectedInput !== null) {
|
|
@@ -1462,22 +1488,20 @@ const ColorSwatch = React.forwardRef((_ref, ref) => {
|
|
|
1462
1488
|
}
|
|
1463
1489
|
}
|
|
1464
1490
|
};
|
|
1465
|
-
const handleFocus = containerUtilities.composeEventHandlers(onFocus, event => event.target.parentElement?.setAttribute('data-garden-focus-visible', 'true'));
|
|
1466
1491
|
return React__namespace.default.createElement(StyledCell, {
|
|
1467
1492
|
key: value,
|
|
1468
1493
|
role: role
|
|
1469
1494
|
}, React__namespace.default.createElement(StyledColorSwatchLabel, {
|
|
1470
|
-
backgroundColor: value
|
|
1495
|
+
$backgroundColor: value
|
|
1471
1496
|
}, React__namespace.default.createElement(reactTooltips.Tooltip, {
|
|
1472
1497
|
content: label
|
|
1473
|
-
}, React__namespace.default.createElement(StyledColorSwatchInput,
|
|
1498
|
+
}, React__namespace.default.createElement(StyledColorSwatchInput, Object.assign({
|
|
1474
1499
|
"aria-label": label,
|
|
1475
1500
|
name: name,
|
|
1476
1501
|
type: isCheckboxGroup ? 'checkbox' : 'radio',
|
|
1477
1502
|
value: value,
|
|
1478
1503
|
defaultChecked: defaultChecked,
|
|
1479
1504
|
checked: checked,
|
|
1480
|
-
onFocus: handleFocus,
|
|
1481
1505
|
onBlur: handleBlur,
|
|
1482
1506
|
onChange: handleChange
|
|
1483
1507
|
}, gridCellProps))), React__namespace.default.createElement(StyledIcon, null)));
|
|
@@ -1585,16 +1609,16 @@ const ColorSwatchDialog = React.forwardRef((_ref, ref) => {
|
|
|
1585
1609
|
return React__namespace.default.createElement(React__namespace.default.Fragment, null, children ? ( React.cloneElement(React.Children.only(children), {
|
|
1586
1610
|
onClick,
|
|
1587
1611
|
ref: buttonRef
|
|
1588
|
-
})) : React__namespace.default.createElement(StyledButton,
|
|
1612
|
+
})) : React__namespace.default.createElement(StyledButton, Object.assign({
|
|
1589
1613
|
disabled: disabled,
|
|
1590
1614
|
focusInset: focusInset,
|
|
1591
1615
|
ref: buttonRef,
|
|
1592
1616
|
onClick: onClick
|
|
1593
1617
|
}, buttonProps), React__namespace.default.createElement(StyledButtonPreview, {
|
|
1594
|
-
backgroundColor: backgroundColor
|
|
1618
|
+
$backgroundColor: backgroundColor
|
|
1595
1619
|
}), React__namespace.default.createElement(reactButtons.Button.EndIcon, {
|
|
1596
1620
|
isRotated: referenceElement !== null
|
|
1597
|
-
}, React__namespace.default.createElement(SvgChevronDownStroke, null))), React__namespace.default.createElement(StyledTooltipModal,
|
|
1621
|
+
}, React__namespace.default.createElement(SvgChevronDownStroke, null))), React__namespace.default.createElement(StyledTooltipModal, Object.assign({
|
|
1598
1622
|
ref: ref,
|
|
1599
1623
|
zIndex: zIndex,
|
|
1600
1624
|
hasArrow: hasArrow,
|
|
@@ -1636,7 +1660,7 @@ ColorSwatchDialog.defaultProps = {
|
|
|
1636
1660
|
};
|
|
1637
1661
|
ColorSwatchDialog.displayName = 'ColorSwatchDialog';
|
|
1638
1662
|
|
|
1663
|
+
exports.ColorPicker = ColorPicker;
|
|
1664
|
+
exports.ColorPickerDialog = ColorPickerDialog;
|
|
1639
1665
|
exports.ColorSwatch = ColorSwatch;
|
|
1640
1666
|
exports.ColorSwatchDialog = ColorSwatchDialog;
|
|
1641
|
-
exports.Colorpicker = Colorpicker;
|
|
1642
|
-
exports.ColorpickerDialog = ColorpickerDialog;
|