@zendeskgarden/react-colorpickers 9.0.0-next.1 → 9.0.0-next.3
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/index.cjs.js +283 -255
- package/dist/index.esm.js +284 -256
- 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/{ColorpickerDialog → ColorPickerDialog}/StyledButtonPreview.d.ts +2 -2
- package/dist/typings/styled/ColorSwatch/StyledColorSwatch.d.ts +1 -2
- package/dist/typings/styled/ColorSwatch/StyledColorSwatchInput.d.ts +13 -0
- package/dist/typings/styled/ColorSwatch/StyledColorSwatchLabel.d.ts +16 -0
- package/dist/typings/styled/ColorSwatch/StyledIcon.d.ts +1 -3
- package/dist/typings/styled/index.d.ts +19 -18
- package/dist/typings/types/index.d.ts +12 -32
- package/package.json +10 -9
- package/dist/typings/styled/ColorSwatch/StyledSwatchButton.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}/StyledAlphaRange.d.ts +0 -0
- /package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledColorPicker.d.ts +0 -0
- /package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledColorWell.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}/StyledPreview.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/{Colorpicker → ColorPicker}/StyledSliders.d.ts +0 -0
- /package/dist/typings/styled/{ColorpickerDialog → ColorPickerDialog}/StyledButton.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
|
@@ -18,8 +18,9 @@ var reactButtons = require('@zendeskgarden/react-buttons');
|
|
|
18
18
|
var reactModals = require('@zendeskgarden/react-modals');
|
|
19
19
|
var isEqual = require('lodash.isequal');
|
|
20
20
|
var containerUtilities = require('@zendeskgarden/container-utilities');
|
|
21
|
-
var
|
|
21
|
+
var reactMergeRefs = require('react-merge-refs');
|
|
22
22
|
var containerGrid = require('@zendeskgarden/container-grid');
|
|
23
|
+
var reactTooltips = require('@zendeskgarden/react-tooltips');
|
|
23
24
|
|
|
24
25
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
25
26
|
|
|
@@ -146,22 +147,22 @@ const getThumbPosition = (x, y, rtl, container) => {
|
|
|
146
147
|
};
|
|
147
148
|
};
|
|
148
149
|
|
|
149
|
-
const COMPONENT_ID$
|
|
150
|
+
const COMPONENT_ID$m = 'colorpickers.colorpicker';
|
|
150
151
|
const getColorPickerWidth = props => {
|
|
151
152
|
return props.isOpaque ? 268 : 312;
|
|
152
153
|
};
|
|
153
154
|
const StyledColorPicker = styled__default.default.div.attrs({
|
|
154
|
-
'data-garden-id': COMPONENT_ID$
|
|
155
|
-
'data-garden-version': '9.0.0-next.
|
|
155
|
+
'data-garden-id': COMPONENT_ID$m,
|
|
156
|
+
'data-garden-version': '9.0.0-next.3'
|
|
156
157
|
}).withConfig({
|
|
157
158
|
displayName: "StyledColorPicker",
|
|
158
|
-
componentId: "sc-
|
|
159
|
-
})(["width:", "px;min-width:", "px;", ";"], getColorPickerWidth, getColorPickerWidth, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
159
|
+
componentId: "sc-gspq4q-0"
|
|
160
|
+
})(["width:", "px;min-width:", "px;", ";"], getColorPickerWidth, getColorPickerWidth, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$m, props));
|
|
160
161
|
StyledColorPicker.defaultProps = {
|
|
161
162
|
theme: reactTheming.DEFAULT_THEME
|
|
162
163
|
};
|
|
163
164
|
|
|
164
|
-
const COMPONENT_ID$
|
|
165
|
+
const COMPONENT_ID$l = 'colorpickers.colorpicker_range';
|
|
165
166
|
const thumbStyles = function (styles) {
|
|
166
167
|
let modifier = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
167
168
|
return `
|
|
@@ -287,26 +288,26 @@ const sizeStyles$2 = props => {
|
|
|
287
288
|
`;
|
|
288
289
|
};
|
|
289
290
|
const StyledRange = styled__default.default(reactForms.Range).attrs({
|
|
290
|
-
'data-garden-id': COMPONENT_ID$
|
|
291
|
-
'data-garden-version': '9.0.0-next.
|
|
291
|
+
'data-garden-id': COMPONENT_ID$l,
|
|
292
|
+
'data-garden-version': '9.0.0-next.3',
|
|
292
293
|
hasLowerTrack: false
|
|
293
294
|
}).withConfig({
|
|
294
295
|
displayName: "StyledRange",
|
|
295
296
|
componentId: "sc-ug3wi9-0"
|
|
296
297
|
})(["", ";", " ", ";", ";"], sizeStyles$2, trackStyles(`
|
|
297
298
|
border-radius: 0;
|
|
298
|
-
`), colorStyles$1, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
299
|
+
`), colorStyles$1, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$l, props));
|
|
299
300
|
StyledRange.defaultProps = {
|
|
300
301
|
theme: reactTheming.DEFAULT_THEME
|
|
301
302
|
};
|
|
302
303
|
|
|
303
|
-
const COMPONENT_ID$
|
|
304
|
+
const COMPONENT_ID$k = 'colorpickers.colorpicker_hue';
|
|
304
305
|
const StyledHueRange = styled__default.default(StyledRange).attrs({
|
|
305
|
-
'data-garden-id': COMPONENT_ID$
|
|
306
|
-
'data-garden-version': '9.0.0-next.
|
|
306
|
+
'data-garden-id': COMPONENT_ID$k,
|
|
307
|
+
'data-garden-version': '9.0.0-next.3'
|
|
307
308
|
}).withConfig({
|
|
308
309
|
displayName: "StyledHueRange",
|
|
309
|
-
componentId: "sc-
|
|
310
|
+
componentId: "sc-1gdhww1-0"
|
|
310
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.isOpaque && `0 ${getTrackMargin(props)}px`, props => getTrackHeight(props));
|
|
311
312
|
StyledHueRange.defaultProps = {
|
|
312
313
|
theme: reactTheming.DEFAULT_THEME
|
|
@@ -331,7 +332,7 @@ const checkeredBackground = function (theme, size) {
|
|
|
331
332
|
`;
|
|
332
333
|
};
|
|
333
334
|
|
|
334
|
-
const COMPONENT_ID$
|
|
335
|
+
const COMPONENT_ID$j = 'colorpickers.colorpicker_alpha';
|
|
335
336
|
const background$3 = props => {
|
|
336
337
|
const direction = `to ${props.theme.rtl ? 'left' : 'right'}`;
|
|
337
338
|
const fromColor = `rgba(${props.red}, ${props.green}, ${props.blue}, 0)`;
|
|
@@ -346,17 +347,17 @@ const StyledAlphaRange = styled__default.default(StyledRange).attrs(props => ({
|
|
|
346
347
|
backgroundSize: 'auto',
|
|
347
348
|
background: background$3(props)
|
|
348
349
|
},
|
|
349
|
-
'data-garden-id': COMPONENT_ID$
|
|
350
|
-
'data-garden-version': '9.0.0-next.
|
|
350
|
+
'data-garden-id': COMPONENT_ID$j,
|
|
351
|
+
'data-garden-version': '9.0.0-next.3'
|
|
351
352
|
})).withConfig({
|
|
352
353
|
displayName: "StyledAlphaRange",
|
|
353
|
-
componentId: "sc-
|
|
354
|
+
componentId: "sc-1f6hp2j-0"
|
|
354
355
|
})([""]);
|
|
355
356
|
StyledAlphaRange.defaultProps = {
|
|
356
357
|
theme: reactTheming.DEFAULT_THEME
|
|
357
358
|
};
|
|
358
359
|
|
|
359
|
-
const COMPONENT_ID$
|
|
360
|
+
const COMPONENT_ID$i = 'colorpickers.colorpicker_preview_box';
|
|
360
361
|
const background$2 = props => {
|
|
361
362
|
const alpha = props.alpha ? props.alpha / 100 : 0;
|
|
362
363
|
const color = `rgba(${props.red}, ${props.green}, ${props.blue}, ${alpha})`;
|
|
@@ -370,18 +371,18 @@ const StyledPreview = styled__default.default.div.attrs(props => ({
|
|
|
370
371
|
style: {
|
|
371
372
|
background: background$2(props)
|
|
372
373
|
},
|
|
373
|
-
'data-garden-id': COMPONENT_ID$
|
|
374
|
-
'data-garden-version': '9.0.0-next.
|
|
374
|
+
'data-garden-id': COMPONENT_ID$i,
|
|
375
|
+
'data-garden-version': '9.0.0-next.3',
|
|
375
376
|
'data-test-id': 'preview-box'
|
|
376
377
|
})).withConfig({
|
|
377
378
|
displayName: "StyledPreview",
|
|
378
|
-
componentId: "sc-
|
|
379
|
-
})(["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$
|
|
379
|
+
componentId: "sc-1z5nh7-0"
|
|
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.isOpaque ? 6 : 8), props => props.theme.space.base * (props.isOpaque ? 6 : 8), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$i, props));
|
|
380
381
|
StyledPreview.defaultProps = {
|
|
381
382
|
theme: reactTheming.DEFAULT_THEME
|
|
382
383
|
};
|
|
383
384
|
|
|
384
|
-
const COMPONENT_ID$
|
|
385
|
+
const COMPONENT_ID$h = 'colorpickers.colorpicker_colorwell';
|
|
385
386
|
const background$1 = props => {
|
|
386
387
|
const blackAlpha = polished.rgba(props.theme.palette.black, 0.9);
|
|
387
388
|
const black = `linear-gradient(0deg, ${props.theme.palette.black}, ${blackAlpha} 1%, transparent 99%)`;
|
|
@@ -392,21 +393,21 @@ const background$1 = props => {
|
|
|
392
393
|
return `${black}, ${white}, ${color}`;
|
|
393
394
|
};
|
|
394
395
|
const StyledColorWell = styled__default.default.div.attrs(props => ({
|
|
395
|
-
'data-garden-id': COMPONENT_ID$
|
|
396
|
-
'data-garden-version': '9.0.0-next.
|
|
396
|
+
'data-garden-id': COMPONENT_ID$h,
|
|
397
|
+
'data-garden-version': '9.0.0-next.3',
|
|
397
398
|
'data-test-id': 'colorwell',
|
|
398
399
|
style: {
|
|
399
400
|
background: background$1(props)
|
|
400
401
|
}
|
|
401
402
|
})).withConfig({
|
|
402
403
|
displayName: "StyledColorWell",
|
|
403
|
-
componentId: "sc-
|
|
404
|
-
})(["position:relative;margin-bottom:", "px;cursor:pointer;height:208px;overflow:hidden;", ";"], props => props.theme.space.base * 2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
404
|
+
componentId: "sc-1gg9z8m-0"
|
|
405
|
+
})(["position:relative;margin-bottom:", "px;cursor:pointer;height:208px;overflow:hidden;", ";"], props => props.theme.space.base * 2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$h, props));
|
|
405
406
|
StyledColorWell.defaultProps = {
|
|
406
407
|
theme: reactTheming.DEFAULT_THEME
|
|
407
408
|
};
|
|
408
409
|
|
|
409
|
-
const COMPONENT_ID$
|
|
410
|
+
const COMPONENT_ID$g = 'colorpickers.colorpicker_colorwell_thumb';
|
|
410
411
|
const sizeStyles$1 = theme => {
|
|
411
412
|
const borderWidth = polished.stripUnit(theme.borderWidths.sm) * 2;
|
|
412
413
|
const size = theme.space.base * 5;
|
|
@@ -420,8 +421,8 @@ const sizeStyles$1 = theme => {
|
|
|
420
421
|
`;
|
|
421
422
|
};
|
|
422
423
|
const StyledColorWellThumb = styled__default.default.div.attrs(props => ({
|
|
423
|
-
'data-garden-id': COMPONENT_ID$
|
|
424
|
-
'data-garden-version': '9.0.0-next.
|
|
424
|
+
'data-garden-id': COMPONENT_ID$g,
|
|
425
|
+
'data-garden-version': '9.0.0-next.3',
|
|
425
426
|
'data-test-id': 'colorwell-thumb',
|
|
426
427
|
style: {
|
|
427
428
|
top: `${props.top}%`,
|
|
@@ -429,75 +430,75 @@ const StyledColorWellThumb = styled__default.default.div.attrs(props => ({
|
|
|
429
430
|
}
|
|
430
431
|
})).withConfig({
|
|
431
432
|
displayName: "StyledColorWellThumb",
|
|
432
|
-
componentId: "sc-
|
|
433
|
-
})(["position:absolute;border:solid ", ";border-radius:50%;box-shadow:", ";", ";", ";"], props => props.theme.palette.white, props => props.theme.shadows.lg(`${props.theme.space.base}px`, `${props.theme.space.base * 2}px`, reactTheming.getColor('neutralHue', 800, props.theme, 0.24)), props => sizeStyles$1(props.theme), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
433
|
+
componentId: "sc-1npyab0-0"
|
|
434
|
+
})(["position:absolute;border:solid ", ";border-radius:50%;box-shadow:", ";", ";", ";"], props => props.theme.palette.white, props => props.theme.shadows.lg(`${props.theme.space.base}px`, `${props.theme.space.base * 2}px`, reactTheming.getColor('neutralHue', 800, props.theme, 0.24)), props => sizeStyles$1(props.theme), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$g, props));
|
|
434
435
|
StyledColorWellThumb.defaultProps = {
|
|
435
436
|
theme: reactTheming.DEFAULT_THEME
|
|
436
437
|
};
|
|
437
438
|
|
|
438
|
-
const COMPONENT_ID$
|
|
439
|
+
const COMPONENT_ID$f = 'colorpickers.colorpicker_slider_group';
|
|
439
440
|
const StyledSliderGroup = styled__default.default.div.attrs({
|
|
440
|
-
'data-garden-id': COMPONENT_ID$
|
|
441
|
-
'data-garden-version': '9.0.0-next.
|
|
441
|
+
'data-garden-id': COMPONENT_ID$f,
|
|
442
|
+
'data-garden-version': '9.0.0-next.3'
|
|
442
443
|
}).withConfig({
|
|
443
444
|
displayName: "StyledSliderGroup",
|
|
444
|
-
componentId: "sc-
|
|
445
|
-
})(["display:flex;justify-content:space-between;margin-bottom:", "px;", ";"], props => props.theme.space.base * 2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
445
|
+
componentId: "sc-tigkzg-0"
|
|
446
|
+
})(["display:flex;justify-content:space-between;margin-bottom:", "px;", ";"], props => props.theme.space.base * 2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$f, props));
|
|
446
447
|
StyledSliderGroup.defaultProps = {
|
|
447
448
|
theme: reactTheming.DEFAULT_THEME
|
|
448
449
|
};
|
|
449
450
|
|
|
450
|
-
const COMPONENT_ID$
|
|
451
|
+
const COMPONENT_ID$e = 'colorpickers.colorpicker_hex_field';
|
|
451
452
|
const StyledHexField = styled__default.default(reactForms.Field).attrs({
|
|
452
|
-
'data-garden-id': COMPONENT_ID$
|
|
453
|
-
'data-garden-version': '9.0.0-next.
|
|
453
|
+
'data-garden-id': COMPONENT_ID$e,
|
|
454
|
+
'data-garden-version': '9.0.0-next.3',
|
|
454
455
|
spellcheck: false
|
|
455
456
|
}).withConfig({
|
|
456
457
|
displayName: "StyledHexField",
|
|
457
|
-
componentId: "sc-
|
|
458
|
-
})(["display:flex;flex-basis:0;flex-direction:column;flex-grow:1;width:auto;text-align:center;input{direction:ltr;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
458
|
+
componentId: "sc-ijq1c-0"
|
|
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$e, props));
|
|
459
460
|
StyledHexField.defaultProps = {
|
|
460
461
|
theme: reactTheming.DEFAULT_THEME
|
|
461
462
|
};
|
|
462
463
|
|
|
463
|
-
const COMPONENT_ID$
|
|
464
|
+
const COMPONENT_ID$d = 'colorpickers.colorpicker_label';
|
|
464
465
|
const StyledLabel = styled__default.default(reactForms.Label).attrs({
|
|
465
|
-
'data-garden-id': COMPONENT_ID$
|
|
466
|
-
'data-garden-version': '9.0.0-next.
|
|
466
|
+
'data-garden-id': COMPONENT_ID$d,
|
|
467
|
+
'data-garden-version': '9.0.0-next.3'
|
|
467
468
|
}).withConfig({
|
|
468
469
|
displayName: "StyledLabel",
|
|
469
|
-
componentId: "sc-
|
|
470
|
-
})(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
470
|
+
componentId: "sc-1vxt3m9-0"
|
|
471
|
+
})(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$d, props));
|
|
471
472
|
StyledLabel.defaultProps = {
|
|
472
473
|
theme: reactTheming.DEFAULT_THEME
|
|
473
474
|
};
|
|
474
475
|
|
|
475
|
-
const COMPONENT_ID$
|
|
476
|
+
const COMPONENT_ID$c = 'colorpickers.colorpicker_input';
|
|
476
477
|
const StyledInput = styled__default.default(reactForms.Input).attrs({
|
|
477
|
-
'data-garden-id': COMPONENT_ID$
|
|
478
|
-
'data-garden-version': '9.0.0-next.
|
|
478
|
+
'data-garden-id': COMPONENT_ID$c,
|
|
479
|
+
'data-garden-version': '9.0.0-next.3',
|
|
479
480
|
focusInset: false
|
|
480
481
|
}).withConfig({
|
|
481
482
|
displayName: "StyledInput",
|
|
482
|
-
componentId: "sc-
|
|
483
|
-
})(["text-align:center;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
483
|
+
componentId: "sc-1uzlutt-0"
|
|
484
|
+
})(["text-align:center;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$c, props));
|
|
484
485
|
StyledInput.defaultProps = {
|
|
485
486
|
theme: reactTheming.DEFAULT_THEME
|
|
486
487
|
};
|
|
487
488
|
|
|
488
|
-
const COMPONENT_ID$
|
|
489
|
+
const COMPONENT_ID$b = 'colorpickers.colorpicker_input_group';
|
|
489
490
|
const StyledInputGroup = styled__default.default.div.attrs({
|
|
490
|
-
'data-garden-id': COMPONENT_ID$
|
|
491
|
-
'data-garden-version': '9.0.0-next.
|
|
491
|
+
'data-garden-id': COMPONENT_ID$b,
|
|
492
|
+
'data-garden-version': '9.0.0-next.3'
|
|
492
493
|
}).withConfig({
|
|
493
494
|
displayName: "StyledInputGroup",
|
|
494
|
-
componentId: "sc-
|
|
495
|
-
})(["display:flex;justify-content:space-between;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
495
|
+
componentId: "sc-1m9g2wg-0"
|
|
496
|
+
})(["display:flex;justify-content:space-between;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$b, props));
|
|
496
497
|
StyledInputGroup.defaultProps = {
|
|
497
498
|
theme: reactTheming.DEFAULT_THEME
|
|
498
499
|
};
|
|
499
500
|
|
|
500
|
-
const COMPONENT_ID$
|
|
501
|
+
const COMPONENT_ID$a = 'colorpickers.colorpicker_rgb_field';
|
|
501
502
|
const sizeStyles = theme => {
|
|
502
503
|
const margin = `${theme.space.base * 1.5}px`;
|
|
503
504
|
const width = `${theme.space.base * 12.75}px`;
|
|
@@ -508,42 +509,42 @@ const sizeStyles = theme => {
|
|
|
508
509
|
`;
|
|
509
510
|
};
|
|
510
511
|
const StyledRGBAField = styled__default.default(reactForms.Field).attrs({
|
|
511
|
-
'data-garden-id': COMPONENT_ID$
|
|
512
|
-
'data-garden-version': '9.0.0-next.
|
|
512
|
+
'data-garden-id': COMPONENT_ID$a,
|
|
513
|
+
'data-garden-version': '9.0.0-next.3'
|
|
513
514
|
}).withConfig({
|
|
514
515
|
displayName: "StyledRGBAField",
|
|
515
|
-
componentId: "sc-
|
|
516
|
-
})(["display:flex;flex-direction:column;text-align:center;", ";", ";"], props => sizeStyles(props.theme), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
516
|
+
componentId: "sc-13266k8-0"
|
|
517
|
+
})(["display:flex;flex-direction:column;text-align:center;", ";", ";"], props => sizeStyles(props.theme), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$a, props));
|
|
517
518
|
StyledRGBAField.defaultProps = {
|
|
518
519
|
theme: reactTheming.DEFAULT_THEME
|
|
519
520
|
};
|
|
520
521
|
|
|
521
|
-
const COMPONENT_ID$
|
|
522
|
+
const COMPONENT_ID$9 = 'colorpickers.colorpicker_sliders';
|
|
522
523
|
const StyledSliders = styled__default.default.div.attrs({
|
|
523
|
-
'data-garden-id': COMPONENT_ID$
|
|
524
|
-
'data-garden-version': '9.0.0-next.
|
|
524
|
+
'data-garden-id': COMPONENT_ID$9,
|
|
525
|
+
'data-garden-version': '9.0.0-next.3'
|
|
525
526
|
}).withConfig({
|
|
526
527
|
displayName: "StyledSliders",
|
|
527
|
-
componentId: "sc-
|
|
528
|
-
})(["position:relative;margin-", ":", "px;width:100%;& > *{position:absolute;width:100%;height:", "px;}& > :first-child{top:-", "px;}& > :last-child{bottom:-", "px;}", ";"], props => props.theme.rtl ? 'right' : 'left', props => props.theme.space.base * 2, props => getTrackMargin(props) * 2 + getTrackHeight(props), getTrackMargin, getTrackMargin, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
528
|
+
componentId: "sc-1lgr50m-0"
|
|
529
|
+
})(["position:relative;margin-", ":", "px;width:100%;& > *{position:absolute;width:100%;height:", "px;}& > :first-child{top:-", "px;}& > :last-child{bottom:-", "px;}", ";"], props => props.theme.rtl ? 'right' : 'left', props => props.theme.space.base * 2, props => getTrackMargin(props) * 2 + getTrackHeight(props), getTrackMargin, getTrackMargin, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$9, props));
|
|
529
530
|
StyledSliders.defaultProps = {
|
|
530
531
|
theme: reactTheming.DEFAULT_THEME
|
|
531
532
|
};
|
|
532
533
|
|
|
533
|
-
const COMPONENT_ID$
|
|
534
|
+
const COMPONENT_ID$8 = 'colorpickers.colordialog_button';
|
|
534
535
|
const StyledButton = styled__default.default(reactButtons.Button).attrs({
|
|
535
536
|
isNeutral: true,
|
|
536
|
-
'data-garden-id': COMPONENT_ID$
|
|
537
|
-
'data-garden-version': '9.0.0-next.
|
|
537
|
+
'data-garden-id': COMPONENT_ID$8,
|
|
538
|
+
'data-garden-version': '9.0.0-next.3'
|
|
538
539
|
}).withConfig({
|
|
539
540
|
displayName: "StyledButton",
|
|
540
|
-
componentId: "sc-
|
|
541
|
-
})(["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, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
541
|
+
componentId: "sc-1dlijfv-0"
|
|
542
|
+
})(["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, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$8, props));
|
|
542
543
|
StyledButton.defaultProps = {
|
|
543
544
|
theme: reactTheming.DEFAULT_THEME
|
|
544
545
|
};
|
|
545
546
|
|
|
546
|
-
const COMPONENT_ID$
|
|
547
|
+
const COMPONENT_ID$7 = 'colorpickers.colordialog_preview';
|
|
547
548
|
const background = props => {
|
|
548
549
|
const {
|
|
549
550
|
backgroundColor
|
|
@@ -568,102 +569,123 @@ const StyledButtonPreview = styled__default.default.span.attrs(props => ({
|
|
|
568
569
|
style: {
|
|
569
570
|
background: `${background(props)}, ${checkeredBackground(props.theme, 8)}`
|
|
570
571
|
},
|
|
571
|
-
'data-garden-id': COMPONENT_ID$
|
|
572
|
-
'data-garden-version': '9.0.0-next.
|
|
572
|
+
'data-garden-id': COMPONENT_ID$7,
|
|
573
|
+
'data-garden-version': '9.0.0-next.3',
|
|
573
574
|
'data-test-id': 'dialog-preview'
|
|
574
575
|
})).withConfig({
|
|
575
576
|
displayName: "StyledButtonPreview",
|
|
576
|
-
componentId: "sc-
|
|
577
|
-
})(["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$
|
|
577
|
+
componentId: "sc-yxis8h-0"
|
|
578
|
+
})(["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));
|
|
578
579
|
StyledButtonPreview.defaultProps = {
|
|
579
580
|
theme: reactTheming.DEFAULT_THEME
|
|
580
581
|
};
|
|
581
582
|
|
|
582
|
-
const COMPONENT_ID$
|
|
583
|
+
const COMPONENT_ID$6 = 'colorpickers.colordialog_tooltipmodal';
|
|
583
584
|
const StyledTooltipModal = styled__default.default(reactModals.TooltipModal).attrs({
|
|
584
|
-
'data-garden-id': COMPONENT_ID$
|
|
585
|
-
'data-garden-version': '9.0.0-next.
|
|
585
|
+
'data-garden-id': COMPONENT_ID$6,
|
|
586
|
+
'data-garden-version': '9.0.0-next.3'
|
|
586
587
|
}).withConfig({
|
|
587
588
|
displayName: "StyledTooltipModal",
|
|
588
|
-
componentId: "sc-
|
|
589
|
-
})(["width:auto !important;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
589
|
+
componentId: "sc-gykkrw-0"
|
|
590
|
+
})(["width:auto !important;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$6, props));
|
|
590
591
|
StyledTooltipModal.defaultProps = {
|
|
591
592
|
theme: reactTheming.DEFAULT_THEME
|
|
592
593
|
};
|
|
593
594
|
|
|
594
|
-
const COMPONENT_ID$
|
|
595
|
+
const COMPONENT_ID$5 = 'colorpickers.colordialog_tooltipmodal_body';
|
|
595
596
|
const StyledTooltipBody = styled__default.default(reactModals.TooltipModal.Body).attrs({
|
|
596
|
-
'data-garden-id': COMPONENT_ID$
|
|
597
|
-
'data-garden-version': '9.0.0-next.
|
|
597
|
+
'data-garden-id': COMPONENT_ID$5,
|
|
598
|
+
'data-garden-version': '9.0.0-next.3'
|
|
598
599
|
}).withConfig({
|
|
599
600
|
displayName: "StyledTooltipBody",
|
|
600
|
-
componentId: "sc-
|
|
601
|
-
})(["padding:0;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
601
|
+
componentId: "sc-1ueddpo-0"
|
|
602
|
+
})(["padding:0;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props));
|
|
602
603
|
StyledTooltipBody.defaultProps = {
|
|
603
604
|
theme: reactTheming.DEFAULT_THEME
|
|
604
605
|
};
|
|
605
606
|
|
|
606
|
-
const COMPONENT_ID$
|
|
607
|
-
const StyledSwatchButton = styled__default.default(StyledButtonPreview).attrs(props => ({
|
|
608
|
-
as: 'button',
|
|
609
|
-
'data-garden-id': COMPONENT_ID$3,
|
|
610
|
-
'data-test-id': props.backgroundColor,
|
|
611
|
-
'data-garden-version': '9.0.0-next.1'
|
|
612
|
-
})).withConfig({
|
|
613
|
-
displayName: "StyledSwatchButton",
|
|
614
|
-
componentId: "sc-edpwpp-0"
|
|
615
|
-
})(["transition:box-shadow 0.1s ease-in-out;outline:none;border:none;border-radius:", ";cursor:pointer;padding:0;", " ", ";"], props => props.theme.borderRadii.md, props => reactTheming.focusStyles({
|
|
616
|
-
theme: props.theme
|
|
617
|
-
}), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
618
|
-
StyledSwatchButton.defaultProps = {
|
|
619
|
-
theme: reactTheming.DEFAULT_THEME
|
|
620
|
-
};
|
|
621
|
-
|
|
622
|
-
const COMPONENT_ID$2 = 'colorpickers.color_swatch';
|
|
607
|
+
const COMPONENT_ID$4 = 'colorpickers.color_swatch';
|
|
623
608
|
const StyledColorSwatch = styled__default.default.table.attrs({
|
|
624
|
-
'data-garden-id': COMPONENT_ID$
|
|
625
|
-
'data-garden-version': '9.0.0-next.
|
|
626
|
-
role: 'grid'
|
|
609
|
+
'data-garden-id': COMPONENT_ID$4,
|
|
610
|
+
'data-garden-version': '9.0.0-next.3'
|
|
627
611
|
}).withConfig({
|
|
628
612
|
displayName: "StyledColorSwatch",
|
|
629
613
|
componentId: "sc-ajx440-0"
|
|
630
|
-
})(["border-collapse:collapse;line-height:normal;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
614
|
+
})(["border-collapse:collapse;line-height:normal;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props));
|
|
631
615
|
StyledColorSwatch.defaultProps = {
|
|
632
616
|
theme: reactTheming.DEFAULT_THEME
|
|
633
617
|
};
|
|
634
618
|
|
|
635
|
-
const COMPONENT_ID$
|
|
619
|
+
const COMPONENT_ID$3 = 'colorpickers.color_swatch_input';
|
|
620
|
+
const StyledColorSwatchInput = styled__default.default.input.attrs({
|
|
621
|
+
'data-garden-id': COMPONENT_ID$3,
|
|
622
|
+
'data-garden-version': '9.0.0-next.3'
|
|
623
|
+
}).withConfig({
|
|
624
|
+
displayName: "StyledColorSwatchInput",
|
|
625
|
+
componentId: "sc-em45h0-0"
|
|
626
|
+
})(["position:absolute;opacity:0;z-index:1;margin:0;cursor:pointer;width:100%;height:100%;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
627
|
+
StyledColorSwatchInput.defaultProps = {
|
|
628
|
+
theme: reactTheming.DEFAULT_THEME
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
const COMPONENT_ID$2 = 'colorpickers.color_swatch_label';
|
|
636
632
|
const colorStyles = props => {
|
|
637
|
-
const {
|
|
638
|
-
theme,
|
|
639
|
-
color
|
|
640
|
-
} = props;
|
|
641
633
|
const {
|
|
642
634
|
alpha
|
|
643
|
-
} = polished.parseToRgb(
|
|
644
|
-
let
|
|
645
|
-
if (alpha
|
|
646
|
-
|
|
635
|
+
} = polished.parseToRgb(props.backgroundColor);
|
|
636
|
+
let foregroundColor;
|
|
637
|
+
if (alpha && alpha < 0.4) {
|
|
638
|
+
foregroundColor = props.theme.colors.foreground;
|
|
639
|
+
} else {
|
|
640
|
+
foregroundColor = polished.readableColor(props.backgroundColor, props.theme.colors.foreground, props.theme.colors.background);
|
|
647
641
|
}
|
|
648
642
|
return `
|
|
649
|
-
color: ${
|
|
643
|
+
color: ${foregroundColor};
|
|
650
644
|
`;
|
|
651
645
|
};
|
|
652
|
-
const
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
646
|
+
const StyledColorSwatchLabel = styled__default.default(StyledButtonPreview).attrs({
|
|
647
|
+
as: 'label',
|
|
648
|
+
'data-garden-id': COMPONENT_ID$2,
|
|
649
|
+
'data-garden-version': '9.0.0-next.3'
|
|
650
|
+
}).withConfig({
|
|
651
|
+
displayName: "StyledColorSwatchLabel",
|
|
652
|
+
componentId: "sc-1aghocg-0"
|
|
653
|
+
})(["position:relative;top:0;border-radius:", ";", ";", " ", ";"], props => props.theme.borderRadii.md, colorStyles, props => reactTheming.focusStyles({
|
|
654
|
+
theme: props.theme,
|
|
655
|
+
selector: '&:has(:focus-visible)'
|
|
656
|
+
}), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
657
|
+
StyledColorSwatchLabel.defaultProps = {
|
|
658
|
+
theme: reactTheming.DEFAULT_THEME
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
var _path$1;
|
|
662
|
+
function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
|
|
663
|
+
var SvgCheckSmFill = function SvgCheckSmFill(props) {
|
|
664
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
|
|
665
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
666
|
+
width: 12,
|
|
667
|
+
height: 12,
|
|
668
|
+
focusable: "false",
|
|
669
|
+
viewBox: "0 0 12 12",
|
|
670
|
+
"aria-hidden": "true"
|
|
671
|
+
}, props), _path$1 || (_path$1 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
672
|
+
fill: "none",
|
|
673
|
+
stroke: "currentColor",
|
|
674
|
+
strokeLinecap: "round",
|
|
675
|
+
strokeLinejoin: "round",
|
|
676
|
+
strokeWidth: 2,
|
|
677
|
+
d: "M3 6l2 2 4-4"
|
|
678
|
+
})));
|
|
679
|
+
};
|
|
680
|
+
|
|
681
|
+
const COMPONENT_ID$1 = 'colorpickers.colorswatch_check';
|
|
682
|
+
const StyledIcon = styled__default.default(SvgCheckSmFill).attrs({
|
|
661
683
|
'data-garden-id': COMPONENT_ID$1,
|
|
662
|
-
'data-garden-version': '9.0.0-next.
|
|
684
|
+
'data-garden-version': '9.0.0-next.3'
|
|
663
685
|
}).withConfig({
|
|
664
686
|
displayName: "StyledIcon",
|
|
665
687
|
componentId: "sc-8oigif-0"
|
|
666
|
-
})(["transition:opacity 0.2s ease-in-out;opacity:
|
|
688
|
+
})(["position:absolute;top:0;left:0;transition:opacity 0.2s ease-in-out;opacity:0;width:100%;height:100%;", ":checked ~ &{opacity:1;}", ";"], StyledColorSwatchInput, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
667
689
|
StyledIcon.defaultProps = {
|
|
668
690
|
theme: reactTheming.DEFAULT_THEME
|
|
669
691
|
};
|
|
@@ -671,7 +693,7 @@ StyledIcon.defaultProps = {
|
|
|
671
693
|
const COMPONENT_ID = 'colorpickers.swatch_cell';
|
|
672
694
|
const StyledCell = styled__default.default.td.attrs({
|
|
673
695
|
'data-garden-id': COMPONENT_ID,
|
|
674
|
-
'data-garden-version': '9.0.0-next.
|
|
696
|
+
'data-garden-version': '9.0.0-next.3'
|
|
675
697
|
}).withConfig({
|
|
676
698
|
displayName: "StyledCell",
|
|
677
699
|
componentId: "sc-qr3oit-0"
|
|
@@ -1023,7 +1045,7 @@ const reducer = (state, action) => {
|
|
|
1023
1045
|
}
|
|
1024
1046
|
};
|
|
1025
1047
|
|
|
1026
|
-
const
|
|
1048
|
+
const ColorPicker = React.forwardRef((_ref, ref) => {
|
|
1027
1049
|
let {
|
|
1028
1050
|
color,
|
|
1029
1051
|
defaultColor,
|
|
@@ -1213,11 +1235,11 @@ const Colorpicker = React.forwardRef((_ref, ref) => {
|
|
|
1213
1235
|
onChange: handleAlphaChange
|
|
1214
1236
|
}))));
|
|
1215
1237
|
});
|
|
1216
|
-
|
|
1238
|
+
ColorPicker.defaultProps = {
|
|
1217
1239
|
defaultColor: '#fff'
|
|
1218
1240
|
};
|
|
1219
|
-
|
|
1220
|
-
|
|
1241
|
+
ColorPicker.displayName = 'ColorPicker';
|
|
1242
|
+
ColorPicker.propTypes = {
|
|
1221
1243
|
color: PropTypes__default.default.oneOfType([PropTypes__default.default.object, PropTypes__default.default.string]),
|
|
1222
1244
|
isOpaque: PropTypes__default.default.bool,
|
|
1223
1245
|
onChange: PropTypes__default.default.func,
|
|
@@ -1225,23 +1247,23 @@ Colorpicker.propTypes = {
|
|
|
1225
1247
|
defaultColor: PropTypes__default.default.oneOfType([PropTypes__default.default.object, PropTypes__default.default.string])
|
|
1226
1248
|
};
|
|
1227
1249
|
|
|
1228
|
-
var _path
|
|
1229
|
-
function _extends
|
|
1250
|
+
var _path;
|
|
1251
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1230
1252
|
var SvgChevronDownStroke = function SvgChevronDownStroke(props) {
|
|
1231
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends
|
|
1253
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
1232
1254
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1233
1255
|
width: 16,
|
|
1234
1256
|
height: 16,
|
|
1235
1257
|
focusable: "false",
|
|
1236
1258
|
viewBox: "0 0 16 16",
|
|
1237
1259
|
"aria-hidden": "true"
|
|
1238
|
-
}, props), _path
|
|
1260
|
+
}, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1239
1261
|
fill: "currentColor",
|
|
1240
1262
|
d: "M12.688 5.61a.5.5 0 01.69.718l-.066.062-5 4a.5.5 0 01-.542.054l-.082-.054-5-4a.5.5 0 01.55-.83l.074.05L8 9.359l4.688-3.75z"
|
|
1241
1263
|
})));
|
|
1242
1264
|
};
|
|
1243
1265
|
|
|
1244
|
-
const
|
|
1266
|
+
const ColorPickerDialog = React.forwardRef((_ref, ref) => {
|
|
1245
1267
|
let {
|
|
1246
1268
|
color,
|
|
1247
1269
|
defaultColor,
|
|
@@ -1253,7 +1275,6 @@ const ColorpickerDialog = React.forwardRef((_ref, ref) => {
|
|
|
1253
1275
|
isAnimated,
|
|
1254
1276
|
isOpaque,
|
|
1255
1277
|
isOpen,
|
|
1256
|
-
popperModifiers,
|
|
1257
1278
|
zIndex,
|
|
1258
1279
|
focusInset,
|
|
1259
1280
|
disabled,
|
|
@@ -1269,7 +1290,7 @@ const ColorpickerDialog = React.forwardRef((_ref, ref) => {
|
|
|
1269
1290
|
const colorPickerRef = React.useRef(null);
|
|
1270
1291
|
const [referenceElement, setReferenceElement] = React.useState();
|
|
1271
1292
|
const [uncontrolledColor, setUncontrolledColor] = React.useState(defaultColor);
|
|
1272
|
-
const ariaLabelText = reactTheming.useText(
|
|
1293
|
+
const ariaLabelText = reactTheming.useText(ColorPickerDialog, {
|
|
1273
1294
|
'aria-label': ariaLabel
|
|
1274
1295
|
}, 'aria-label', 'Color picker');
|
|
1275
1296
|
const openDialog = () => {
|
|
@@ -1315,7 +1336,6 @@ const ColorpickerDialog = React.forwardRef((_ref, ref) => {
|
|
|
1315
1336
|
}, React__namespace.default.createElement(SvgChevronDownStroke, null))), React__namespace.default.createElement(StyledTooltipModal, _extends$2({
|
|
1316
1337
|
ref: ref,
|
|
1317
1338
|
hasArrow: hasArrow,
|
|
1318
|
-
popperModifiers: popperModifiers,
|
|
1319
1339
|
zIndex: zIndex,
|
|
1320
1340
|
isAnimated: isAnimated,
|
|
1321
1341
|
isOpaque: isOpaque,
|
|
@@ -1327,7 +1347,7 @@ const ColorpickerDialog = React.forwardRef((_ref, ref) => {
|
|
|
1327
1347
|
onClose && onClose(isControlled ? color : uncontrolledColor);
|
|
1328
1348
|
},
|
|
1329
1349
|
"aria-label": ariaLabelText
|
|
1330
|
-
}, props), React__namespace.default.createElement(StyledTooltipBody, null, React__namespace.default.createElement(
|
|
1350
|
+
}, props), React__namespace.default.createElement(StyledTooltipBody, null, React__namespace.default.createElement(ColorPicker, {
|
|
1331
1351
|
autofocus: true,
|
|
1332
1352
|
color: color,
|
|
1333
1353
|
isOpaque: isOpaque,
|
|
@@ -1337,132 +1357,156 @@ const ColorpickerDialog = React.forwardRef((_ref, ref) => {
|
|
|
1337
1357
|
onChange: isControlled ? onChange : setUncontrolledColor
|
|
1338
1358
|
}))));
|
|
1339
1359
|
});
|
|
1340
|
-
|
|
1341
|
-
...
|
|
1360
|
+
ColorPickerDialog.propTypes = {
|
|
1361
|
+
...ColorPicker.propTypes,
|
|
1342
1362
|
placement: PropTypes__default.default.oneOf(reactModals.PLACEMENT),
|
|
1343
1363
|
onClose: PropTypes__default.default.func,
|
|
1344
1364
|
onDialogChange: PropTypes__default.default.func,
|
|
1345
1365
|
disabled: PropTypes__default.default.bool,
|
|
1346
1366
|
labels: PropTypes__default.default.object,
|
|
1347
1367
|
buttonProps: PropTypes__default.default.object,
|
|
1348
|
-
popperModifiers: PropTypes__default.default.any,
|
|
1349
1368
|
zIndex: PropTypes__default.default.number,
|
|
1350
1369
|
hasArrow: PropTypes__default.default.bool,
|
|
1351
1370
|
isAnimated: PropTypes__default.default.bool,
|
|
1352
1371
|
isOpen: PropTypes__default.default.bool,
|
|
1353
1372
|
focusInset: PropTypes__default.default.bool
|
|
1354
1373
|
};
|
|
1355
|
-
|
|
1374
|
+
ColorPickerDialog.defaultProps = {
|
|
1356
1375
|
placement: 'bottom-start',
|
|
1357
1376
|
isAnimated: true,
|
|
1358
1377
|
zIndex: 1000,
|
|
1359
1378
|
hasArrow: false
|
|
1360
1379
|
};
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
var _path;
|
|
1364
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1365
|
-
var SvgCheckSmFill = function SvgCheckSmFill(props) {
|
|
1366
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
1367
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1368
|
-
width: 12,
|
|
1369
|
-
height: 12,
|
|
1370
|
-
focusable: "false",
|
|
1371
|
-
viewBox: "0 0 12 12",
|
|
1372
|
-
"aria-hidden": "true"
|
|
1373
|
-
}, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1374
|
-
fill: "none",
|
|
1375
|
-
stroke: "currentColor",
|
|
1376
|
-
strokeLinecap: "round",
|
|
1377
|
-
strokeLinejoin: "round",
|
|
1378
|
-
strokeWidth: 2,
|
|
1379
|
-
d: "M3 6l2 2 4-4"
|
|
1380
|
-
})));
|
|
1381
|
-
};
|
|
1380
|
+
ColorPickerDialog.displayName = 'ColorPickerDialog';
|
|
1382
1381
|
|
|
1383
1382
|
const ColorSwatch = React.forwardRef((_ref, ref) => {
|
|
1384
1383
|
let {
|
|
1384
|
+
name,
|
|
1385
1385
|
colors,
|
|
1386
|
+
isCheckboxGroup,
|
|
1387
|
+
defaultSelectedColIndex,
|
|
1388
|
+
defaultSelectedRowIndex,
|
|
1389
|
+
selectedColIndex,
|
|
1390
|
+
selectedRowIndex,
|
|
1391
|
+
onSelect,
|
|
1386
1392
|
...props
|
|
1387
1393
|
} = _ref;
|
|
1388
|
-
const
|
|
1389
|
-
|
|
1390
|
-
|
|
1394
|
+
const theme = React.useContext(styled.ThemeContext) || reactTheming.DEFAULT_THEME;
|
|
1395
|
+
const environment = reactTheming.useDocument(theme);
|
|
1396
|
+
const gridRef = React.useRef();
|
|
1397
|
+
const [rowIndex, setRowIndex] = React.useState(selectedRowIndex === null ? undefined : selectedRowIndex);
|
|
1398
|
+
const [colIndex, setColIndex] = React.useState(selectedColIndex === null ? undefined : selectedColIndex);
|
|
1399
|
+
const isControlled = selectedColIndex !== undefined && selectedRowIndex !== undefined;
|
|
1391
1400
|
const {
|
|
1392
1401
|
getGridCellProps
|
|
1393
1402
|
} = containerGrid.useGrid({
|
|
1394
|
-
|
|
1403
|
+
environment,
|
|
1404
|
+
rtl: theme.rtl,
|
|
1395
1405
|
matrix: colors,
|
|
1396
|
-
selection: true,
|
|
1397
1406
|
wrap: true,
|
|
1398
1407
|
idPrefix: containerUtilities.useId(undefined),
|
|
1399
|
-
|
|
1408
|
+
defaultRowIndex: defaultSelectedRowIndex,
|
|
1409
|
+
defaultColIndex: defaultSelectedColIndex,
|
|
1410
|
+
rowIndex,
|
|
1411
|
+
colIndex,
|
|
1412
|
+
onChange: (row, col) => {
|
|
1413
|
+
setRowIndex(row);
|
|
1414
|
+
setColIndex(col);
|
|
1415
|
+
}
|
|
1400
1416
|
});
|
|
1401
|
-
return React__namespace.default.createElement(StyledColorSwatch, {
|
|
1402
|
-
|
|
1403
|
-
|
|
1417
|
+
return React__namespace.default.createElement(StyledColorSwatch, _extends$2({
|
|
1418
|
+
role: "grid",
|
|
1419
|
+
ref: reactMergeRefs.mergeRefs([gridRef, ref])
|
|
1420
|
+
}, props), React__namespace.default.createElement("tbody", null, colors.map((row, _rowIndex) => React__namespace.default.createElement("tr", {
|
|
1404
1421
|
key: row[0].value
|
|
1405
|
-
}, row.map((color,
|
|
1422
|
+
}, row.map((color, _colIndex) => {
|
|
1406
1423
|
const {
|
|
1407
1424
|
label,
|
|
1408
1425
|
value
|
|
1409
1426
|
} = color;
|
|
1410
1427
|
const {
|
|
1411
|
-
|
|
1412
|
-
|
|
1428
|
+
role,
|
|
1429
|
+
onFocus,
|
|
1430
|
+
...gridCellProps
|
|
1413
1431
|
} = getGridCellProps({
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
type: 'button',
|
|
1417
|
-
role: undefined
|
|
1432
|
+
colIndex: _colIndex,
|
|
1433
|
+
rowIndex: _rowIndex
|
|
1418
1434
|
});
|
|
1435
|
+
const checked = isControlled ? selectedRowIndex === _rowIndex && selectedColIndex === _colIndex : undefined;
|
|
1436
|
+
const defaultChecked = isControlled ? undefined : defaultSelectedRowIndex === _rowIndex && defaultSelectedColIndex === _colIndex;
|
|
1437
|
+
const handleChange = event => {
|
|
1438
|
+
if (onSelect) {
|
|
1439
|
+
if (event.target.checked) {
|
|
1440
|
+
onSelect(_rowIndex, _colIndex);
|
|
1441
|
+
} else {
|
|
1442
|
+
onSelect(null, null);
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
if (isCheckboxGroup && event.target.checked) {
|
|
1446
|
+
const inputs = gridRef.current?.querySelectorAll('input');
|
|
1447
|
+
inputs?.forEach(input => {
|
|
1448
|
+
if (input !== event.target) {
|
|
1449
|
+
input.checked = false;
|
|
1450
|
+
}
|
|
1451
|
+
});
|
|
1452
|
+
}
|
|
1453
|
+
};
|
|
1454
|
+
const handleBlur = event => {
|
|
1455
|
+
event.target.parentElement?.removeAttribute('data-garden-focus-visible');
|
|
1456
|
+
if (!(isCheckboxGroup || gridRef.current?.contains(event.relatedTarget))) {
|
|
1457
|
+
const selectedInput = gridRef.current?.querySelector(`input[name='${event.target.name}']:checked`);
|
|
1458
|
+
if (selectedInput !== null) {
|
|
1459
|
+
const inputs = gridRef.current?.querySelectorAll('input');
|
|
1460
|
+
inputs?.forEach(input => input.setAttribute('tabIndex', input.checked ? '0' : '-1'));
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
};
|
|
1464
|
+
const handleFocus = containerUtilities.composeEventHandlers(onFocus, event => event.target.parentElement?.setAttribute('data-garden-focus-visible', 'true'));
|
|
1419
1465
|
return React__namespace.default.createElement(StyledCell, {
|
|
1420
1466
|
key: value,
|
|
1421
|
-
|
|
1467
|
+
role: role
|
|
1468
|
+
}, React__namespace.default.createElement(StyledColorSwatchLabel, {
|
|
1469
|
+
backgroundColor: value
|
|
1422
1470
|
}, React__namespace.default.createElement(reactTooltips.Tooltip, {
|
|
1423
1471
|
content: label
|
|
1424
|
-
}, React__namespace.default.createElement(
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1472
|
+
}, React__namespace.default.createElement(StyledColorSwatchInput, _extends$2({
|
|
1473
|
+
"aria-label": label,
|
|
1474
|
+
name: name,
|
|
1475
|
+
type: isCheckboxGroup ? 'checkbox' : 'radio',
|
|
1476
|
+
value: value,
|
|
1477
|
+
defaultChecked: defaultChecked,
|
|
1478
|
+
checked: checked,
|
|
1479
|
+
onFocus: handleFocus,
|
|
1480
|
+
onBlur: handleBlur,
|
|
1481
|
+
onChange: handleChange
|
|
1482
|
+
}, gridCellProps))), React__namespace.default.createElement(StyledIcon, null)));
|
|
1432
1483
|
})))));
|
|
1433
1484
|
});
|
|
1434
1485
|
ColorSwatch.displayName = 'ColorSwatch';
|
|
1435
1486
|
ColorSwatch.propTypes = {
|
|
1487
|
+
name: PropTypes__default.default.string.isRequired,
|
|
1436
1488
|
colors: PropTypes__default.default.arrayOf(PropTypes__default.default.any).isRequired,
|
|
1437
|
-
|
|
1438
|
-
colIndex: PropTypes__default.default.number,
|
|
1489
|
+
isCheckboxGroup: PropTypes__default.default.bool,
|
|
1439
1490
|
selectedRowIndex: PropTypes__default.default.number,
|
|
1440
1491
|
selectedColIndex: PropTypes__default.default.number,
|
|
1441
|
-
defaultRowIndex: PropTypes__default.default.number,
|
|
1442
|
-
defaultColIndex: PropTypes__default.default.number,
|
|
1443
1492
|
defaultSelectedRowIndex: PropTypes__default.default.number,
|
|
1444
1493
|
defaultSelectedColIndex: PropTypes__default.default.number,
|
|
1445
|
-
onChange: PropTypes__default.default.func,
|
|
1446
1494
|
onSelect: PropTypes__default.default.func
|
|
1447
1495
|
};
|
|
1448
1496
|
|
|
1449
1497
|
const ColorSwatchDialog = React.forwardRef((_ref, ref) => {
|
|
1450
1498
|
let {
|
|
1499
|
+
name,
|
|
1451
1500
|
colors,
|
|
1452
|
-
|
|
1453
|
-
colIndex,
|
|
1501
|
+
isCheckboxGroup,
|
|
1454
1502
|
selectedRowIndex,
|
|
1455
1503
|
selectedColIndex,
|
|
1456
|
-
defaultRowIndex,
|
|
1457
|
-
defaultColIndex,
|
|
1458
1504
|
defaultSelectedRowIndex,
|
|
1459
1505
|
defaultSelectedColIndex,
|
|
1460
1506
|
placement,
|
|
1461
|
-
onChange,
|
|
1462
1507
|
onSelect,
|
|
1463
1508
|
hasArrow,
|
|
1464
1509
|
isAnimated,
|
|
1465
|
-
popperModifiers,
|
|
1466
1510
|
zIndex,
|
|
1467
1511
|
isOpen,
|
|
1468
1512
|
focusInset,
|
|
@@ -1473,17 +1517,21 @@ const ColorSwatchDialog = React.forwardRef((_ref, ref) => {
|
|
|
1473
1517
|
'aria-label': ariaLabel,
|
|
1474
1518
|
...props
|
|
1475
1519
|
} = _ref;
|
|
1476
|
-
const
|
|
1477
|
-
const controlledSelect = selectedRowIndex !== null && selectedColIndex !== null && selectedRowIndex !== undefined && selectedColIndex !== undefined;
|
|
1478
|
-
const isControlled = controlledFocus || controlledSelect;
|
|
1520
|
+
const isControlled = selectedRowIndex !== undefined && selectedColIndex !== undefined;
|
|
1479
1521
|
const isDialogControlled = isOpen !== undefined && isOpen !== null;
|
|
1480
1522
|
const buttonRef = React.useRef(null);
|
|
1481
1523
|
const colorSwatchRef = React.useRef(null);
|
|
1482
|
-
const [referenceElement, setReferenceElement] = React.useState();
|
|
1483
|
-
const [
|
|
1484
|
-
const [
|
|
1485
|
-
|
|
1486
|
-
|
|
1524
|
+
const [referenceElement, setReferenceElement] = React.useState(null);
|
|
1525
|
+
const [rowIndex, setRowIndex] = React.useState(defaultSelectedRowIndex);
|
|
1526
|
+
const [colIndex, setColIndex] = React.useState(defaultSelectedColIndex);
|
|
1527
|
+
let backgroundColor;
|
|
1528
|
+
if (isControlled) {
|
|
1529
|
+
if (selectedRowIndex !== null && selectedColIndex !== null) {
|
|
1530
|
+
backgroundColor = colors[selectedRowIndex][selectedColIndex].value;
|
|
1531
|
+
}
|
|
1532
|
+
} else if (rowIndex !== undefined && colIndex !== undefined) {
|
|
1533
|
+
backgroundColor = colors[rowIndex][colIndex].value;
|
|
1534
|
+
}
|
|
1487
1535
|
const ariaLabelText = reactTheming.useText(ColorSwatchDialog, {
|
|
1488
1536
|
'aria-label': ariaLabel
|
|
1489
1537
|
}, 'aria-label', 'Color swatch');
|
|
@@ -1496,14 +1544,6 @@ const ColorSwatchDialog = React.forwardRef((_ref, ref) => {
|
|
|
1496
1544
|
}
|
|
1497
1545
|
}
|
|
1498
1546
|
}, [isOpen, isDialogControlled]);
|
|
1499
|
-
let uncontrolledSelectedColor;
|
|
1500
|
-
let controlledSelectedColor;
|
|
1501
|
-
if (uncontrolledSelectedRowIndex > -1 && uncontrolledSelectedColIndex > -1) {
|
|
1502
|
-
uncontrolledSelectedColor = colors[uncontrolledSelectedRowIndex][uncontrolledSelectedColIndex];
|
|
1503
|
-
}
|
|
1504
|
-
if (selectedRowIndex !== undefined && selectedColIndex !== undefined && selectedRowIndex > -1 && selectedColIndex > -1) {
|
|
1505
|
-
controlledSelectedColor = colors[selectedRowIndex][selectedColIndex];
|
|
1506
|
-
}
|
|
1507
1547
|
const openDialog = () => {
|
|
1508
1548
|
setReferenceElement(buttonRef.current);
|
|
1509
1549
|
onDialogChange && onDialogChange({
|
|
@@ -1511,8 +1551,6 @@ const ColorSwatchDialog = React.forwardRef((_ref, ref) => {
|
|
|
1511
1551
|
});
|
|
1512
1552
|
};
|
|
1513
1553
|
const closeDialog = () => {
|
|
1514
|
-
setUncontrolledRowIndex(uncontrolledSelectedRowIndex);
|
|
1515
|
-
setUncontrolledColIndex(uncontrolledSelectedColIndex);
|
|
1516
1554
|
setReferenceElement(null);
|
|
1517
1555
|
onDialogChange && onDialogChange({
|
|
1518
1556
|
isOpen: false
|
|
@@ -1527,15 +1565,22 @@ const ColorSwatchDialog = React.forwardRef((_ref, ref) => {
|
|
|
1527
1565
|
});
|
|
1528
1566
|
React.useEffect(() => {
|
|
1529
1567
|
if (referenceElement && colorSwatchRef.current) {
|
|
1530
|
-
const
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1568
|
+
const input = colorSwatchRef.current.querySelector('[tabindex="0"]');
|
|
1569
|
+
input?.focus();
|
|
1570
|
+
}
|
|
1571
|
+
}, [referenceElement]);
|
|
1572
|
+
const handleSelect = (row, col) => {
|
|
1573
|
+
if (isControlled === false) {
|
|
1574
|
+
if (row === null || col === null) {
|
|
1575
|
+
setRowIndex(undefined);
|
|
1576
|
+
setColIndex(undefined);
|
|
1534
1577
|
} else {
|
|
1535
|
-
|
|
1578
|
+
setRowIndex(row);
|
|
1579
|
+
setColIndex(col);
|
|
1536
1580
|
}
|
|
1537
1581
|
}
|
|
1538
|
-
|
|
1582
|
+
onSelect && onSelect(row, col);
|
|
1583
|
+
};
|
|
1539
1584
|
return React__namespace.default.createElement(React__namespace.default.Fragment, null, children ? ( React.cloneElement(React.Children.only(children), {
|
|
1540
1585
|
onClick,
|
|
1541
1586
|
ref: buttonRef
|
|
@@ -1545,9 +1590,9 @@ const ColorSwatchDialog = React.forwardRef((_ref, ref) => {
|
|
|
1545
1590
|
ref: buttonRef,
|
|
1546
1591
|
onClick: onClick
|
|
1547
1592
|
}, buttonProps), React__namespace.default.createElement(StyledButtonPreview, {
|
|
1548
|
-
backgroundColor:
|
|
1593
|
+
backgroundColor: backgroundColor
|
|
1549
1594
|
}), React__namespace.default.createElement(reactButtons.Button.EndIcon, {
|
|
1550
|
-
isRotated: referenceElement
|
|
1595
|
+
isRotated: referenceElement !== null
|
|
1551
1596
|
}, React__namespace.default.createElement(SvgChevronDownStroke, null))), React__namespace.default.createElement(StyledTooltipModal, _extends$2({
|
|
1552
1597
|
ref: ref,
|
|
1553
1598
|
zIndex: zIndex,
|
|
@@ -1555,35 +1600,19 @@ const ColorSwatchDialog = React.forwardRef((_ref, ref) => {
|
|
|
1555
1600
|
focusOnMount: false,
|
|
1556
1601
|
placement: placement,
|
|
1557
1602
|
isAnimated: isAnimated,
|
|
1558
|
-
popperModifiers: popperModifiers,
|
|
1559
1603
|
referenceElement: referenceElement,
|
|
1560
1604
|
onClose: closeDialog,
|
|
1561
1605
|
"aria-label": ariaLabelText
|
|
1562
1606
|
}, props), React__namespace.default.createElement(StyledTooltipBody, null, React__namespace.default.createElement(ColorSwatch, {
|
|
1607
|
+
name: name,
|
|
1563
1608
|
colors: colors,
|
|
1564
1609
|
ref: colorSwatchRef,
|
|
1565
|
-
|
|
1566
|
-
colIndex: colIndex,
|
|
1610
|
+
isCheckboxGroup: isCheckboxGroup,
|
|
1567
1611
|
selectedRowIndex: selectedRowIndex,
|
|
1568
1612
|
selectedColIndex: selectedColIndex,
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
defaultSelectedColIndex: uncontrolledSelectedColIndex,
|
|
1573
|
-
onChange: (rowIdx, colIdx) => {
|
|
1574
|
-
if (isControlled === false) {
|
|
1575
|
-
setUncontrolledRowIndex(rowIdx);
|
|
1576
|
-
setUncontrolledColIndex(colIdx);
|
|
1577
|
-
}
|
|
1578
|
-
onChange && onChange(rowIdx, colIdx);
|
|
1579
|
-
},
|
|
1580
|
-
onSelect: (rowIdx, colIdx) => {
|
|
1581
|
-
if (isControlled === false) {
|
|
1582
|
-
setUncontrolledSelectedRowIndex(rowIdx);
|
|
1583
|
-
setUncontrolledSelectedColIndex(colIdx);
|
|
1584
|
-
}
|
|
1585
|
-
onSelect && onSelect(rowIdx, colIdx);
|
|
1586
|
-
}
|
|
1613
|
+
defaultSelectedRowIndex: rowIndex,
|
|
1614
|
+
defaultSelectedColIndex: colIndex,
|
|
1615
|
+
onSelect: handleSelect
|
|
1587
1616
|
}))));
|
|
1588
1617
|
});
|
|
1589
1618
|
ColorSwatchDialog.propTypes = {
|
|
@@ -1592,7 +1621,6 @@ ColorSwatchDialog.propTypes = {
|
|
|
1592
1621
|
onDialogChange: PropTypes__default.default.func,
|
|
1593
1622
|
disabled: PropTypes__default.default.bool,
|
|
1594
1623
|
buttonProps: PropTypes__default.default.object,
|
|
1595
|
-
popperModifiers: PropTypes__default.default.any,
|
|
1596
1624
|
zIndex: PropTypes__default.default.number,
|
|
1597
1625
|
hasArrow: PropTypes__default.default.bool,
|
|
1598
1626
|
isAnimated: PropTypes__default.default.bool,
|
|
@@ -1607,7 +1635,7 @@ ColorSwatchDialog.defaultProps = {
|
|
|
1607
1635
|
};
|
|
1608
1636
|
ColorSwatchDialog.displayName = 'ColorSwatchDialog';
|
|
1609
1637
|
|
|
1638
|
+
exports.ColorPicker = ColorPicker;
|
|
1639
|
+
exports.ColorPickerDialog = ColorPickerDialog;
|
|
1610
1640
|
exports.ColorSwatch = ColorSwatch;
|
|
1611
1641
|
exports.ColorSwatchDialog = ColorSwatchDialog;
|
|
1612
|
-
exports.Colorpicker = Colorpicker;
|
|
1613
|
-
exports.ColorpickerDialog = ColorpickerDialog;
|