@zendeskgarden/react-colorpickers 9.0.0-next.8 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/elements/ColorPicker/ColorWell.js +10 -12
- package/dist/esm/elements/ColorPicker/index.js +12 -12
- package/dist/esm/elements/ColorPickerDialog/index.js +7 -5
- package/dist/esm/elements/ColorSwatch/index.js +64 -61
- package/dist/esm/elements/ColorSwatchDialog/index.js +7 -4
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/check-sm-fill.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-down-stroke.svg.js +1 -1
- package/dist/esm/styled/ColorPicker/StyledAlphaRange.js +12 -10
- package/dist/esm/styled/ColorPicker/StyledColorPicker.js +3 -6
- package/dist/esm/styled/ColorPicker/StyledColorWell.js +3 -6
- package/dist/esm/styled/ColorPicker/StyledColorWellThumb.js +23 -15
- package/dist/esm/styled/ColorPicker/StyledHexField.js +2 -5
- package/dist/esm/styled/ColorPicker/StyledHueRange.js +2 -6
- package/dist/esm/styled/ColorPicker/StyledInput.js +2 -5
- package/dist/esm/styled/ColorPicker/StyledInputGroup.js +2 -5
- package/dist/esm/styled/ColorPicker/StyledLabel.js +2 -5
- package/dist/esm/styled/ColorPicker/StyledPreview.js +11 -12
- package/dist/esm/styled/ColorPicker/StyledRGBAField.js +2 -5
- package/dist/esm/styled/ColorPicker/StyledSliderGroup.js +2 -5
- package/dist/esm/styled/ColorPicker/StyledSliders.js +26 -7
- package/dist/esm/styled/ColorPickerDialog/StyledButton.js +2 -8
- package/dist/esm/styled/ColorPickerDialog/StyledButtonPreview.js +20 -19
- package/dist/esm/styled/ColorPickerDialog/StyledTooltipBody.js +5 -8
- package/dist/esm/styled/ColorPickerDialog/StyledTooltipDialog.js +20 -0
- package/dist/esm/styled/ColorSwatch/StyledCell.js +2 -5
- package/dist/esm/styled/ColorSwatch/StyledColorSwatch.js +2 -5
- package/dist/esm/styled/ColorSwatch/StyledColorSwatchInput.js +2 -5
- package/dist/esm/styled/ColorSwatch/StyledColorSwatchLabel.js +19 -9
- package/dist/esm/styled/ColorSwatch/StyledIcon.js +2 -5
- package/dist/esm/styled/common/StyledRange.js +38 -32
- package/dist/index.cjs.js +298 -315
- package/dist/typings/styled/ColorPicker/StyledAlphaRange.d.ts +2 -2
- package/dist/typings/styled/ColorPicker/StyledColorPicker.d.ts +1 -1
- package/dist/typings/styled/ColorPicker/StyledColorWell.d.ts +1 -1
- package/dist/typings/styled/ColorPicker/StyledPreview.d.ts +3 -3
- package/dist/typings/styled/ColorPicker/StyledSliders.d.ts +3 -2
- package/dist/typings/styled/ColorPickerDialog/StyledButton.d.ts +0 -1
- package/dist/typings/styled/ColorPickerDialog/StyledButtonPreview.d.ts +1 -1
- package/dist/typings/styled/ColorPickerDialog/{StyledTooltipModal.d.ts → StyledTooltipDialog.d.ts} +2 -2
- package/dist/typings/styled/ColorSwatch/StyledColorSwatchLabel.d.ts +1 -1
- package/dist/typings/styled/common/StyledRange.d.ts +2 -2
- package/dist/typings/styled/index.d.ts +1 -1
- package/dist/typings/styled/types.d.ts +12 -0
- package/dist/typings/types/index.d.ts +9 -9
- package/package.json +11 -12
- package/LICENSE.md +0 -176
- package/dist/esm/styled/ColorPickerDialog/StyledTooltipModal.js +0 -23
- package/dist/esm/styled/common/checkeredBackground.js +0 -28
- package/dist/typings/styled/common/checkeredBackground.d.ts +0 -8
package/dist/index.cjs.js
CHANGED
|
@@ -131,22 +131,19 @@ const getThumbPosition = (x, y, rtl, container) => {
|
|
|
131
131
|
};
|
|
132
132
|
};
|
|
133
133
|
|
|
134
|
-
const COMPONENT_ID$
|
|
134
|
+
const COMPONENT_ID$l = 'colorpickers.colorpicker';
|
|
135
135
|
const getColorPickerWidth = props => {
|
|
136
|
-
return props
|
|
136
|
+
return props.$isOpaque ? 268 : 312;
|
|
137
137
|
};
|
|
138
138
|
const StyledColorPicker = styled__default.default.div.attrs({
|
|
139
|
-
'data-garden-id': COMPONENT_ID$
|
|
140
|
-
'data-garden-version': '9.0.0
|
|
139
|
+
'data-garden-id': COMPONENT_ID$l,
|
|
140
|
+
'data-garden-version': '9.0.0'
|
|
141
141
|
}).withConfig({
|
|
142
142
|
displayName: "StyledColorPicker",
|
|
143
143
|
componentId: "sc-gspq4q-0"
|
|
144
|
-
})(["width:", "px;min-width:", "px;", ";"], getColorPickerWidth, getColorPickerWidth, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
145
|
-
StyledColorPicker.defaultProps = {
|
|
146
|
-
theme: reactTheming.DEFAULT_THEME
|
|
147
|
-
};
|
|
144
|
+
})(["width:", "px;min-width:", "px;", ";"], getColorPickerWidth, getColorPickerWidth, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$l, props));
|
|
148
145
|
|
|
149
|
-
const COMPONENT_ID$
|
|
146
|
+
const COMPONENT_ID$k = 'colorpickers.colorpicker_range';
|
|
150
147
|
const thumbStyles = function (styles) {
|
|
151
148
|
let modifier = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
152
149
|
return `
|
|
@@ -191,17 +188,36 @@ const trackLowerStyles = function (styles) {
|
|
|
191
188
|
}
|
|
192
189
|
`;
|
|
193
190
|
};
|
|
194
|
-
const colorStyles$
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
191
|
+
const colorStyles$2 = _ref => {
|
|
192
|
+
let {
|
|
193
|
+
theme
|
|
194
|
+
} = _ref;
|
|
195
|
+
const thumbBackgroundColor = reactTheming.getColor({
|
|
196
|
+
theme,
|
|
197
|
+
variable: 'background.default'
|
|
198
|
+
});
|
|
199
|
+
const thumbBorderColor = reactTheming.getColor({
|
|
200
|
+
theme,
|
|
201
|
+
variable: 'border.default',
|
|
202
|
+
dark: {
|
|
203
|
+
offset: -100
|
|
204
|
+
},
|
|
205
|
+
light: {
|
|
206
|
+
offset: 100
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
const thumbActiveBackgroundColor = thumbBackgroundColor;
|
|
210
|
+
const thumbActiveBorderColor = reactTheming.getColor({
|
|
211
|
+
theme,
|
|
212
|
+
variable: 'border.primaryEmphasis'
|
|
213
|
+
});
|
|
214
|
+
const thumbFocusBorderColor = thumbActiveBorderColor;
|
|
215
|
+
const thumbHoverBackgroundColor = reactTheming.getColor({
|
|
216
|
+
theme,
|
|
217
|
+
variable: 'background.subtle'
|
|
218
|
+
});
|
|
219
|
+
const thumbHoverBorderColor = thumbActiveBorderColor;
|
|
202
220
|
return `
|
|
203
|
-
border-color: ${props.isOpaque && reactTheming.getColorV8('background', 600 , props.theme)};
|
|
204
|
-
|
|
205
221
|
${trackStyles(`
|
|
206
222
|
background-color: transparent;
|
|
207
223
|
`)}
|
|
@@ -231,32 +247,22 @@ const colorStyles$1 = props => {
|
|
|
231
247
|
`, ':active')}
|
|
232
248
|
`;
|
|
233
249
|
};
|
|
234
|
-
const getThumbSize = props => props.theme.space.base * (props
|
|
235
|
-
const getTrackHeight = props => props.theme.space.base * (props
|
|
250
|
+
const getThumbSize = props => props.theme.space.base * (props.$isOpaque ? 6 : 4);
|
|
251
|
+
const getTrackHeight = props => props.theme.space.base * (props.$isOpaque ? 6 : 3);
|
|
236
252
|
const getTrackMargin = props => (getThumbSize(props) - getTrackHeight(props)) / 2 + polished.stripUnit(props.theme.shadowWidths.md);
|
|
237
|
-
const sizeStyles$
|
|
253
|
+
const sizeStyles$3 = props => {
|
|
238
254
|
const thumbSize = getThumbSize(props);
|
|
239
255
|
const trackHeight = getTrackHeight(props);
|
|
240
256
|
const trackMargin = getTrackMargin(props);
|
|
241
257
|
const thumbMargin = (trackHeight - thumbSize) / 2;
|
|
242
|
-
const trackOffset = props.theme.space.base * (props
|
|
243
|
-
const height = props
|
|
244
|
-
let marginHorizontal;
|
|
245
|
-
let border;
|
|
246
|
-
let borderRadius;
|
|
247
|
-
if (props.isOpaque) {
|
|
248
|
-
marginHorizontal = `-${trackMargin}px`;
|
|
249
|
-
border = `${trackMargin}px ${props.theme.borderStyles.solid}`;
|
|
250
|
-
borderRadius = `${trackMargin + polished.stripUnit(props.theme.shadowWidths.md)}px`;
|
|
251
|
-
}
|
|
258
|
+
const trackOffset = props.theme.space.base * (props.$isOpaque ? -2 : -1);
|
|
259
|
+
const height = props.$isOpaque ? trackHeight : trackMargin * 2 + trackHeight;
|
|
252
260
|
return `
|
|
253
261
|
/* stylelint-disable-next-line declaration-no-important */
|
|
254
262
|
margin-top: 0 !important;
|
|
255
|
-
margin-${props.theme.rtl ? 'right' : 'left'}: ${marginHorizontal};
|
|
256
263
|
height: ${height}px; /* [1] */
|
|
257
264
|
box-sizing: content-box; /* [2] */
|
|
258
|
-
border: ${
|
|
259
|
-
border-radius: ${borderRadius};
|
|
265
|
+
border-radius: ${props.$isOpaque && props.theme.borderRadii.md};
|
|
260
266
|
|
|
261
267
|
${trackStyles(`
|
|
262
268
|
margin: ${trackMargin}px ${trackOffset}px;
|
|
@@ -265,89 +271,70 @@ const sizeStyles$2 = props => {
|
|
|
265
271
|
|
|
266
272
|
${thumbStyles(`
|
|
267
273
|
margin: ${thumbMargin}px 0;
|
|
268
|
-
border-width: ${
|
|
274
|
+
border-width: ${props.theme.borderWidths.sm};
|
|
269
275
|
height: ${thumbSize}px;
|
|
270
276
|
width: ${thumbSize}px;
|
|
271
277
|
`)};
|
|
272
278
|
`;
|
|
273
279
|
};
|
|
274
280
|
const StyledRange = styled__default.default(reactForms.Range).attrs({
|
|
275
|
-
'data-garden-id': COMPONENT_ID$
|
|
276
|
-
'data-garden-version': '9.0.0
|
|
281
|
+
'data-garden-id': COMPONENT_ID$k,
|
|
282
|
+
'data-garden-version': '9.0.0',
|
|
277
283
|
hasLowerTrack: false
|
|
278
284
|
}).withConfig({
|
|
279
285
|
displayName: "StyledRange",
|
|
280
286
|
componentId: "sc-ug3wi9-0"
|
|
281
|
-
})(["", ";", " ", ";", ";"], sizeStyles$
|
|
287
|
+
})(["", ";", " ", ";", ";"], sizeStyles$3, trackStyles(`
|
|
282
288
|
border-radius: 0;
|
|
283
|
-
`), colorStyles$
|
|
284
|
-
StyledRange.defaultProps = {
|
|
285
|
-
theme: reactTheming.DEFAULT_THEME
|
|
286
|
-
};
|
|
289
|
+
`), colorStyles$2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$k, props));
|
|
287
290
|
|
|
288
|
-
const COMPONENT_ID$
|
|
291
|
+
const COMPONENT_ID$j = 'colorpickers.colorpicker_hue';
|
|
289
292
|
const StyledHueRange = styled__default.default(StyledRange).attrs({
|
|
290
|
-
'data-garden-id': COMPONENT_ID$
|
|
291
|
-
'data-garden-version': '9.0.0
|
|
293
|
+
'data-garden-id': COMPONENT_ID$j,
|
|
294
|
+
'data-garden-version': '9.0.0'
|
|
292
295
|
}).withConfig({
|
|
293
296
|
displayName: "StyledHueRange",
|
|
294
297
|
componentId: "sc-1gdhww1-0"
|
|
295
|
-
})(["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
|
|
296
|
-
StyledHueRange.defaultProps = {
|
|
297
|
-
theme: reactTheming.DEFAULT_THEME
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
const checkeredBackground = function (theme, size) {
|
|
301
|
-
let positionY = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
302
|
-
let repeat = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'repeat';
|
|
303
|
-
const color = reactTheming.getColorV8('neutralHue', 400, theme);
|
|
304
|
-
const dimensions = `${size}px ${size}px`;
|
|
305
|
-
const positionX1 = theme.rtl ? '100%' : '0';
|
|
306
|
-
const positionX2 = theme.rtl ? `calc(100% - ${size / 2}px)` : `${size / 2}px`;
|
|
307
|
-
const position1 = `${positionX1} ${positionY}px`;
|
|
308
|
-
const position2 = `${positionX2} ${size / 2 + positionY}px`;
|
|
309
|
-
const position3 = `${positionX2} ${positionY}px`;
|
|
310
|
-
const position4 = `${positionX1} ${size / -2 + positionY}px`;
|
|
311
|
-
return `
|
|
312
|
-
linear-gradient(45deg, ${color} 25%, transparent 25%) ${position1} / ${dimensions} ${repeat},
|
|
313
|
-
linear-gradient(45deg, transparent 75%, ${color} 75%) ${position2} / ${dimensions} ${repeat},
|
|
314
|
-
linear-gradient(135deg, ${color} 25%, transparent 25%) ${position3} / ${dimensions} ${repeat},
|
|
315
|
-
linear-gradient(135deg, transparent 75%, ${color} 75%) ${position4} / ${dimensions} ${repeat}
|
|
316
|
-
`;
|
|
317
|
-
};
|
|
298
|
+
})(["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));
|
|
318
299
|
|
|
319
|
-
const COMPONENT_ID$
|
|
300
|
+
const COMPONENT_ID$i = 'colorpickers.colorpicker_alpha';
|
|
320
301
|
const background$3 = props => {
|
|
321
302
|
const direction = `to ${props.theme.rtl ? 'left' : 'right'}`;
|
|
322
|
-
const fromColor = `rgba(${props
|
|
323
|
-
const toColor = `rgb(${props
|
|
303
|
+
const fromColor = `rgba(${props.$red}, ${props.$green}, ${props.$blue}, 0)`;
|
|
304
|
+
const toColor = `rgb(${props.$red}, ${props.$green}, ${props.$blue})`;
|
|
324
305
|
const positionY = getTrackMargin(props);
|
|
325
306
|
const height = getTrackHeight(props);
|
|
326
|
-
const
|
|
327
|
-
return
|
|
307
|
+
const overlay = `linear-gradient(${direction}, ${fromColor}, ${toColor}) 0 ${positionY}px / 100% ${height}px no-repeat`;
|
|
308
|
+
return reactTheming.getCheckeredBackground({
|
|
309
|
+
theme: props.theme,
|
|
310
|
+
size: height,
|
|
311
|
+
positionY,
|
|
312
|
+
repeat: 'repeat-x',
|
|
313
|
+
overlay
|
|
314
|
+
});
|
|
328
315
|
};
|
|
329
316
|
const StyledAlphaRange = styled__default.default(StyledRange).attrs(props => ({
|
|
330
317
|
style: {
|
|
331
318
|
backgroundSize: 'auto',
|
|
332
319
|
background: background$3(props)
|
|
333
320
|
},
|
|
334
|
-
'data-garden-id': COMPONENT_ID$
|
|
335
|
-
'data-garden-version': '9.0.0
|
|
321
|
+
'data-garden-id': COMPONENT_ID$i,
|
|
322
|
+
'data-garden-version': '9.0.0'
|
|
336
323
|
})).withConfig({
|
|
337
324
|
displayName: "StyledAlphaRange",
|
|
338
325
|
componentId: "sc-1f6hp2j-0"
|
|
339
326
|
})([""]);
|
|
340
|
-
StyledAlphaRange.defaultProps = {
|
|
341
|
-
theme: reactTheming.DEFAULT_THEME
|
|
342
|
-
};
|
|
343
327
|
|
|
344
|
-
const COMPONENT_ID$
|
|
328
|
+
const COMPONENT_ID$h = 'colorpickers.colorpicker_preview_box';
|
|
345
329
|
const background$2 = props => {
|
|
346
|
-
const alpha = props
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
330
|
+
const alpha = props.$alpha ? props.$alpha / 100 : 0;
|
|
331
|
+
let retVal = `rgba(${props.$red}, ${props.$green}, ${props.$blue}, ${alpha})`;
|
|
332
|
+
if (!props.$isOpaque) {
|
|
333
|
+
retVal = reactTheming.getCheckeredBackground({
|
|
334
|
+
theme: props.theme,
|
|
335
|
+
size: 13,
|
|
336
|
+
overlay: retVal
|
|
337
|
+
});
|
|
351
338
|
}
|
|
352
339
|
return retVal;
|
|
353
340
|
};
|
|
@@ -355,30 +342,27 @@ const StyledPreview = styled__default.default.div.attrs(props => ({
|
|
|
355
342
|
style: {
|
|
356
343
|
background: background$2(props)
|
|
357
344
|
},
|
|
358
|
-
'data-garden-id': COMPONENT_ID$
|
|
359
|
-
'data-garden-version': '9.0.0
|
|
345
|
+
'data-garden-id': COMPONENT_ID$h,
|
|
346
|
+
'data-garden-version': '9.0.0',
|
|
360
347
|
'data-test-id': 'preview-box'
|
|
361
348
|
})).withConfig({
|
|
362
349
|
displayName: "StyledPreview",
|
|
363
350
|
componentId: "sc-1z5nh7-0"
|
|
364
|
-
})(["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
|
|
365
|
-
StyledPreview.defaultProps = {
|
|
366
|
-
theme: reactTheming.DEFAULT_THEME
|
|
367
|
-
};
|
|
351
|
+
})(["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));
|
|
368
352
|
|
|
369
|
-
const COMPONENT_ID$
|
|
353
|
+
const COMPONENT_ID$g = 'colorpickers.colorpicker_colorwell';
|
|
370
354
|
const background$1 = props => {
|
|
371
355
|
const blackAlpha = polished.rgba(props.theme.palette.black, 0.9);
|
|
372
356
|
const black = `linear-gradient(0deg, ${props.theme.palette.black}, ${blackAlpha} 1%, transparent 99%)`;
|
|
373
357
|
const whiteAngle = `${props.theme.rtl ? -90 : 90}deg`;
|
|
374
358
|
const white = `linear-gradient(${whiteAngle}, ${props.theme.palette.white} 1%, transparent)`;
|
|
375
|
-
const colorValue = polished.hsl(props
|
|
359
|
+
const colorValue = polished.hsl(props.$hue, 1, 0.5);
|
|
376
360
|
const color = `linear-gradient(${colorValue}, ${colorValue})`;
|
|
377
361
|
return `${black}, ${white}, ${color}`;
|
|
378
362
|
};
|
|
379
363
|
const StyledColorWell = styled__default.default.div.attrs(props => ({
|
|
380
|
-
'data-garden-id': COMPONENT_ID$
|
|
381
|
-
'data-garden-version': '9.0.0
|
|
364
|
+
'data-garden-id': COMPONENT_ID$g,
|
|
365
|
+
'data-garden-version': '9.0.0',
|
|
382
366
|
'data-test-id': 'colorwell',
|
|
383
367
|
style: {
|
|
384
368
|
background: background$1(props)
|
|
@@ -386,27 +370,35 @@ const StyledColorWell = styled__default.default.div.attrs(props => ({
|
|
|
386
370
|
})).withConfig({
|
|
387
371
|
displayName: "StyledColorWell",
|
|
388
372
|
componentId: "sc-1gg9z8m-0"
|
|
389
|
-
})(["position:relative;margin-bottom:", "px;cursor:pointer;height:208px;overflow:hidden;", ";"], props => props.theme.space.base * 2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
390
|
-
StyledColorWell.defaultProps = {
|
|
391
|
-
theme: reactTheming.DEFAULT_THEME
|
|
392
|
-
};
|
|
373
|
+
})(["position:relative;margin-bottom:", "px;cursor:pointer;height:208px;overflow:hidden;", ";"], props => props.theme.space.base * 2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$g, props));
|
|
393
374
|
|
|
394
|
-
const COMPONENT_ID$
|
|
395
|
-
const
|
|
375
|
+
const COMPONENT_ID$f = 'colorpickers.colorpicker_colorwell_thumb';
|
|
376
|
+
const colorStyles$1 = _ref => {
|
|
377
|
+
let {
|
|
378
|
+
theme
|
|
379
|
+
} = _ref;
|
|
380
|
+
const borderColor = reactTheming.getColor({
|
|
381
|
+
theme,
|
|
382
|
+
hue: 'white'
|
|
383
|
+
});
|
|
384
|
+
const boxShadow = `${theme.shadows.xs(reactTheming.getColor({
|
|
385
|
+
theme,
|
|
386
|
+
hue: 'black'
|
|
387
|
+
}))}`;
|
|
388
|
+
return styled.css(["border-color:", ";box-shadow:", ";"], borderColor, boxShadow);
|
|
389
|
+
};
|
|
390
|
+
const sizeStyles$2 = _ref2 => {
|
|
391
|
+
let {
|
|
392
|
+
theme
|
|
393
|
+
} = _ref2;
|
|
396
394
|
const borderWidth = polished.stripUnit(theme.borderWidths.sm) * 2;
|
|
397
395
|
const size = theme.space.base * 5;
|
|
398
396
|
const translateValue = size / -2;
|
|
399
|
-
return
|
|
400
|
-
transform: translate(${translateValue}px, ${translateValue}px);
|
|
401
|
-
box-sizing: border-box;
|
|
402
|
-
border-width: ${borderWidth}px;
|
|
403
|
-
width: ${size}px;
|
|
404
|
-
height: ${size}px;
|
|
405
|
-
`;
|
|
397
|
+
return styled.css(["transform:translate(", "px,", "px);box-sizing:border-box;border-width:", "px;width:", "px;height:", "px;"], translateValue, translateValue, borderWidth, size, size);
|
|
406
398
|
};
|
|
407
399
|
const StyledColorWellThumb = styled__default.default.div.attrs(props => ({
|
|
408
|
-
'data-garden-id': COMPONENT_ID$
|
|
409
|
-
'data-garden-version': '9.0.0
|
|
400
|
+
'data-garden-id': COMPONENT_ID$f,
|
|
401
|
+
'data-garden-version': '9.0.0',
|
|
410
402
|
'data-test-id': 'colorwell-thumb',
|
|
411
403
|
style: {
|
|
412
404
|
top: `${props.top}%`,
|
|
@@ -415,75 +407,57 @@ const StyledColorWellThumb = styled__default.default.div.attrs(props => ({
|
|
|
415
407
|
})).withConfig({
|
|
416
408
|
displayName: "StyledColorWellThumb",
|
|
417
409
|
componentId: "sc-1npyab0-0"
|
|
418
|
-
})(["position:absolute;border:
|
|
419
|
-
StyledColorWellThumb.defaultProps = {
|
|
420
|
-
theme: reactTheming.DEFAULT_THEME
|
|
421
|
-
};
|
|
410
|
+
})(["position:absolute;border:", ";border-radius:50%;", " ", " ", ";"], props => props.theme.borders.sm, sizeStyles$2, colorStyles$1, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$f, props));
|
|
422
411
|
|
|
423
|
-
const COMPONENT_ID$
|
|
412
|
+
const COMPONENT_ID$e = 'colorpickers.colorpicker_slider_group';
|
|
424
413
|
const StyledSliderGroup = styled__default.default.div.attrs({
|
|
425
|
-
'data-garden-id': COMPONENT_ID$
|
|
426
|
-
'data-garden-version': '9.0.0
|
|
414
|
+
'data-garden-id': COMPONENT_ID$e,
|
|
415
|
+
'data-garden-version': '9.0.0'
|
|
427
416
|
}).withConfig({
|
|
428
417
|
displayName: "StyledSliderGroup",
|
|
429
418
|
componentId: "sc-tigkzg-0"
|
|
430
|
-
})(["display:flex;justify-content:space-between;margin-bottom:", "px;", ";"], props => props.theme.space.base * 2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
431
|
-
StyledSliderGroup.defaultProps = {
|
|
432
|
-
theme: reactTheming.DEFAULT_THEME
|
|
433
|
-
};
|
|
419
|
+
})(["display:flex;justify-content:space-between;margin-bottom:", "px;", ";"], props => props.theme.space.base * 2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$e, props));
|
|
434
420
|
|
|
435
|
-
const COMPONENT_ID$
|
|
421
|
+
const COMPONENT_ID$d = 'colorpickers.colorpicker_hex_field';
|
|
436
422
|
const StyledHexField = styled__default.default(reactForms.Field).attrs({
|
|
437
|
-
'data-garden-id': COMPONENT_ID$
|
|
438
|
-
'data-garden-version': '9.0.0
|
|
423
|
+
'data-garden-id': COMPONENT_ID$d,
|
|
424
|
+
'data-garden-version': '9.0.0',
|
|
439
425
|
spellcheck: false
|
|
440
426
|
}).withConfig({
|
|
441
427
|
displayName: "StyledHexField",
|
|
442
428
|
componentId: "sc-ijq1c-0"
|
|
443
|
-
})(["display:flex;flex-basis:0;flex-direction:column;flex-grow:1;width:auto;text-align:center;input{direction:ltr;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
444
|
-
StyledHexField.defaultProps = {
|
|
445
|
-
theme: reactTheming.DEFAULT_THEME
|
|
446
|
-
};
|
|
429
|
+
})(["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));
|
|
447
430
|
|
|
448
|
-
const COMPONENT_ID$
|
|
431
|
+
const COMPONENT_ID$c = 'colorpickers.colorpicker_label';
|
|
449
432
|
const StyledLabel = styled__default.default(reactForms.Label).attrs({
|
|
450
|
-
'data-garden-id': COMPONENT_ID$
|
|
451
|
-
'data-garden-version': '9.0.0
|
|
433
|
+
'data-garden-id': COMPONENT_ID$c,
|
|
434
|
+
'data-garden-version': '9.0.0'
|
|
452
435
|
}).withConfig({
|
|
453
436
|
displayName: "StyledLabel",
|
|
454
437
|
componentId: "sc-1vxt3m9-0"
|
|
455
|
-
})(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
456
|
-
StyledLabel.defaultProps = {
|
|
457
|
-
theme: reactTheming.DEFAULT_THEME
|
|
458
|
-
};
|
|
438
|
+
})(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$c, props));
|
|
459
439
|
|
|
460
|
-
const COMPONENT_ID$
|
|
440
|
+
const COMPONENT_ID$b = 'colorpickers.colorpicker_input';
|
|
461
441
|
const StyledInput = styled__default.default(reactForms.Input).attrs({
|
|
462
|
-
'data-garden-id': COMPONENT_ID$
|
|
463
|
-
'data-garden-version': '9.0.0
|
|
442
|
+
'data-garden-id': COMPONENT_ID$b,
|
|
443
|
+
'data-garden-version': '9.0.0',
|
|
464
444
|
focusInset: false
|
|
465
445
|
}).withConfig({
|
|
466
446
|
displayName: "StyledInput",
|
|
467
447
|
componentId: "sc-1uzlutt-0"
|
|
468
|
-
})(["text-align:center;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
469
|
-
StyledInput.defaultProps = {
|
|
470
|
-
theme: reactTheming.DEFAULT_THEME
|
|
471
|
-
};
|
|
448
|
+
})(["text-align:center;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$b, props));
|
|
472
449
|
|
|
473
|
-
const COMPONENT_ID$
|
|
450
|
+
const COMPONENT_ID$a = 'colorpickers.colorpicker_input_group';
|
|
474
451
|
const StyledInputGroup = styled__default.default.div.attrs({
|
|
475
|
-
'data-garden-id': COMPONENT_ID$
|
|
476
|
-
'data-garden-version': '9.0.0
|
|
452
|
+
'data-garden-id': COMPONENT_ID$a,
|
|
453
|
+
'data-garden-version': '9.0.0'
|
|
477
454
|
}).withConfig({
|
|
478
455
|
displayName: "StyledInputGroup",
|
|
479
456
|
componentId: "sc-1m9g2wg-0"
|
|
480
|
-
})(["display:flex;justify-content:space-between;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
481
|
-
StyledInputGroup.defaultProps = {
|
|
482
|
-
theme: reactTheming.DEFAULT_THEME
|
|
483
|
-
};
|
|
457
|
+
})(["display:flex;justify-content:space-between;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$a, props));
|
|
484
458
|
|
|
485
|
-
const COMPONENT_ID$
|
|
486
|
-
const sizeStyles = theme => {
|
|
459
|
+
const COMPONENT_ID$9 = 'colorpickers.colorpicker_rgb_field';
|
|
460
|
+
const sizeStyles$1 = theme => {
|
|
487
461
|
const margin = `${theme.space.base * 1.5}px`;
|
|
488
462
|
const width = `${theme.space.base * 12.75}px`;
|
|
489
463
|
return `
|
|
@@ -493,133 +467,147 @@ const sizeStyles = theme => {
|
|
|
493
467
|
`;
|
|
494
468
|
};
|
|
495
469
|
const StyledRGBAField = styled__default.default(reactForms.Field).attrs({
|
|
496
|
-
'data-garden-id': COMPONENT_ID$
|
|
497
|
-
'data-garden-version': '9.0.0
|
|
470
|
+
'data-garden-id': COMPONENT_ID$9,
|
|
471
|
+
'data-garden-version': '9.0.0'
|
|
498
472
|
}).withConfig({
|
|
499
473
|
displayName: "StyledRGBAField",
|
|
500
474
|
componentId: "sc-13266k8-0"
|
|
501
|
-
})(["display:flex;flex-direction:column;text-align:center;", ";", ";"], props => sizeStyles(props.theme), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
502
|
-
StyledRGBAField.defaultProps = {
|
|
503
|
-
theme: reactTheming.DEFAULT_THEME
|
|
504
|
-
};
|
|
475
|
+
})(["display:flex;flex-direction:column;text-align:center;", ";", ";"], props => sizeStyles$1(props.theme), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$9, props));
|
|
505
476
|
|
|
506
|
-
const COMPONENT_ID$
|
|
477
|
+
const COMPONENT_ID$8 = 'colorpickers.colorpicker_sliders';
|
|
478
|
+
const sizeStyles = props => {
|
|
479
|
+
if (props.$isOpaque) {
|
|
480
|
+
return undefined;
|
|
481
|
+
}
|
|
482
|
+
const trackHeight = getTrackHeight(props);
|
|
483
|
+
const trackMargin = getTrackMargin(props);
|
|
484
|
+
return `
|
|
485
|
+
& > * {
|
|
486
|
+
position: absolute;
|
|
487
|
+
width: 100%;
|
|
488
|
+
height: ${trackMargin * 2 + trackHeight}px;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
& > :first-child {
|
|
492
|
+
top: -${trackMargin}px;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
& > :last-child {
|
|
496
|
+
bottom: -${trackMargin}px;
|
|
497
|
+
}
|
|
498
|
+
`;
|
|
499
|
+
};
|
|
507
500
|
const StyledSliders = styled__default.default.div.attrs({
|
|
508
|
-
'data-garden-id': COMPONENT_ID$
|
|
509
|
-
'data-garden-version': '9.0.0
|
|
501
|
+
'data-garden-id': COMPONENT_ID$8,
|
|
502
|
+
'data-garden-version': '9.0.0'
|
|
510
503
|
}).withConfig({
|
|
511
504
|
displayName: "StyledSliders",
|
|
512
505
|
componentId: "sc-1lgr50m-0"
|
|
513
|
-
})(["position:relative;margin-", ":", "px;width:100
|
|
514
|
-
StyledSliders.defaultProps = {
|
|
515
|
-
theme: reactTheming.DEFAULT_THEME
|
|
516
|
-
};
|
|
506
|
+
})(["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));
|
|
517
507
|
|
|
518
|
-
const COMPONENT_ID$8 = 'colorpickers.colordialog_button';
|
|
519
508
|
const StyledButton = styled__default.default(reactButtons.Button).attrs({
|
|
520
509
|
isNeutral: true,
|
|
521
|
-
'data-garden-
|
|
522
|
-
'data-garden-version': '9.0.0-next.8'
|
|
510
|
+
'data-garden-version': '9.0.0'
|
|
523
511
|
}).withConfig({
|
|
524
512
|
displayName: "StyledButton",
|
|
525
513
|
componentId: "sc-1dlijfv-0"
|
|
526
|
-
})(["padding:0;width:", "px;max-width:", "px;&:last-of-type:not(:first-child){border-top-", "-radius:", " !important;border-bottom-", "-radius:", " !important;}"
|
|
527
|
-
StyledButton.defaultProps = {
|
|
528
|
-
theme: reactTheming.DEFAULT_THEME
|
|
529
|
-
};
|
|
514
|
+
})(["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);
|
|
530
515
|
|
|
531
516
|
const COMPONENT_ID$7 = 'colorpickers.colordialog_preview';
|
|
532
|
-
const background =
|
|
533
|
-
|
|
534
|
-
backgroundColor
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
517
|
+
const background = _ref => {
|
|
518
|
+
let {
|
|
519
|
+
$backgroundColor,
|
|
520
|
+
theme
|
|
521
|
+
} = _ref;
|
|
522
|
+
let retVal;
|
|
523
|
+
if (typeof $backgroundColor === 'string') {
|
|
524
|
+
retVal = $backgroundColor;
|
|
525
|
+
} else if ($backgroundColor === undefined) {
|
|
526
|
+
retVal = theme.palette.white;
|
|
541
527
|
} else {
|
|
542
528
|
const {
|
|
543
529
|
red,
|
|
544
530
|
green,
|
|
545
531
|
blue,
|
|
546
532
|
alpha = 1
|
|
547
|
-
} = backgroundColor;
|
|
548
|
-
|
|
533
|
+
} = $backgroundColor;
|
|
534
|
+
retVal = `rgba(${red}, ${green}, ${blue}, ${alpha ? alpha / 100 : 0})`;
|
|
549
535
|
}
|
|
550
|
-
return
|
|
536
|
+
return retVal;
|
|
551
537
|
};
|
|
552
538
|
const StyledButtonPreview = styled__default.default.span.attrs(props => ({
|
|
553
539
|
style: {
|
|
554
|
-
background:
|
|
540
|
+
background: reactTheming.getCheckeredBackground({
|
|
541
|
+
theme: props.theme,
|
|
542
|
+
size: 8,
|
|
543
|
+
overlay: background(props)
|
|
544
|
+
})
|
|
555
545
|
},
|
|
556
546
|
'data-garden-id': COMPONENT_ID$7,
|
|
557
|
-
'data-garden-version': '9.0.0
|
|
547
|
+
'data-garden-version': '9.0.0',
|
|
558
548
|
'data-test-id': 'dialog-preview'
|
|
559
549
|
})).withConfig({
|
|
560
550
|
displayName: "StyledButtonPreview",
|
|
561
551
|
componentId: "sc-yxis8h-0"
|
|
562
552
|
})(["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));
|
|
563
|
-
StyledButtonPreview.defaultProps = {
|
|
564
|
-
theme: reactTheming.DEFAULT_THEME
|
|
565
|
-
};
|
|
566
553
|
|
|
567
|
-
const COMPONENT_ID$6 = 'colorpickers.
|
|
568
|
-
const
|
|
554
|
+
const COMPONENT_ID$6 = 'colorpickers.colordialog_tooltipdialog';
|
|
555
|
+
const StyledTooltipDialog = styled__default.default(reactModals.TooltipDialog).attrs({
|
|
569
556
|
'data-garden-id': COMPONENT_ID$6,
|
|
570
|
-
'data-garden-version': '9.0.0
|
|
557
|
+
'data-garden-version': '9.0.0'
|
|
571
558
|
}).withConfig({
|
|
572
|
-
displayName: "
|
|
573
|
-
componentId: "sc-
|
|
559
|
+
displayName: "StyledTooltipDialog",
|
|
560
|
+
componentId: "sc-1vbkccl-0"
|
|
574
561
|
})(["width:auto !important;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$6, props));
|
|
575
|
-
StyledTooltipModal.defaultProps = {
|
|
576
|
-
theme: reactTheming.DEFAULT_THEME
|
|
577
|
-
};
|
|
578
562
|
|
|
579
|
-
const COMPONENT_ID$5 = 'colorpickers.
|
|
580
|
-
const StyledTooltipBody = styled__default.default(reactModals.
|
|
563
|
+
const COMPONENT_ID$5 = 'colorpickers.colordialog_tooltipdialog_body';
|
|
564
|
+
const StyledTooltipBody = styled__default.default(reactModals.TooltipDialog.Body).attrs({
|
|
581
565
|
'data-garden-id': COMPONENT_ID$5,
|
|
582
|
-
'data-garden-version': '9.0.0
|
|
566
|
+
'data-garden-version': '9.0.0'
|
|
583
567
|
}).withConfig({
|
|
584
568
|
displayName: "StyledTooltipBody",
|
|
585
569
|
componentId: "sc-1ueddpo-0"
|
|
586
570
|
})(["padding:0;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props));
|
|
587
|
-
StyledTooltipBody.defaultProps = {
|
|
588
|
-
theme: reactTheming.DEFAULT_THEME
|
|
589
|
-
};
|
|
590
571
|
|
|
591
572
|
const COMPONENT_ID$4 = 'colorpickers.color_swatch';
|
|
592
573
|
const StyledColorSwatch = styled__default.default.table.attrs({
|
|
593
574
|
'data-garden-id': COMPONENT_ID$4,
|
|
594
|
-
'data-garden-version': '9.0.0
|
|
575
|
+
'data-garden-version': '9.0.0'
|
|
595
576
|
}).withConfig({
|
|
596
577
|
displayName: "StyledColorSwatch",
|
|
597
578
|
componentId: "sc-ajx440-0"
|
|
598
579
|
})(["border-collapse:collapse;line-height:normal;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props));
|
|
599
|
-
StyledColorSwatch.defaultProps = {
|
|
600
|
-
theme: reactTheming.DEFAULT_THEME
|
|
601
|
-
};
|
|
602
580
|
|
|
603
581
|
const COMPONENT_ID$3 = 'colorpickers.color_swatch_input';
|
|
604
582
|
const StyledColorSwatchInput = styled__default.default.input.attrs({
|
|
605
583
|
'data-garden-id': COMPONENT_ID$3,
|
|
606
|
-
'data-garden-version': '9.0.0
|
|
584
|
+
'data-garden-version': '9.0.0'
|
|
607
585
|
}).withConfig({
|
|
608
586
|
displayName: "StyledColorSwatchInput",
|
|
609
587
|
componentId: "sc-em45h0-0"
|
|
610
588
|
})(["position:absolute;opacity:0;z-index:1;margin:0;cursor:pointer;width:100%;height:100%;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
611
|
-
StyledColorSwatchInput.defaultProps = {
|
|
612
|
-
theme: reactTheming.DEFAULT_THEME
|
|
613
|
-
};
|
|
614
589
|
|
|
615
590
|
const COMPONENT_ID$2 = 'colorpickers.color_swatch_label';
|
|
616
|
-
const colorStyles =
|
|
591
|
+
const colorStyles = _ref => {
|
|
592
|
+
let {
|
|
593
|
+
$backgroundColor,
|
|
594
|
+
theme
|
|
595
|
+
} = _ref;
|
|
617
596
|
const {
|
|
618
597
|
alpha
|
|
619
|
-
} = polished.parseToRgb(
|
|
620
|
-
|
|
598
|
+
} = polished.parseToRgb($backgroundColor);
|
|
599
|
+
const returnIfLightColor = reactTheming.getColor({
|
|
600
|
+
theme,
|
|
601
|
+
hue: 'neutralHue',
|
|
602
|
+
shade: 900
|
|
603
|
+
});
|
|
604
|
+
let foregroundColor = returnIfLightColor;
|
|
621
605
|
if (alpha === undefined || alpha >= 0.4) {
|
|
622
|
-
|
|
606
|
+
const returnIfDarkColor = reactTheming.getColor({
|
|
607
|
+
theme,
|
|
608
|
+
hue: 'white'
|
|
609
|
+
});
|
|
610
|
+
foregroundColor = polished.readableColor($backgroundColor, returnIfLightColor, returnIfDarkColor, false );
|
|
623
611
|
}
|
|
624
612
|
return `
|
|
625
613
|
color: ${foregroundColor};
|
|
@@ -628,7 +616,7 @@ const colorStyles = props => {
|
|
|
628
616
|
const StyledColorSwatchLabel = styled__default.default(StyledButtonPreview).attrs({
|
|
629
617
|
as: 'label',
|
|
630
618
|
'data-garden-id': COMPONENT_ID$2,
|
|
631
|
-
'data-garden-version': '9.0.0
|
|
619
|
+
'data-garden-version': '9.0.0'
|
|
632
620
|
}).withConfig({
|
|
633
621
|
displayName: "StyledColorSwatchLabel",
|
|
634
622
|
componentId: "sc-1aghocg-0"
|
|
@@ -636,12 +624,9 @@ const StyledColorSwatchLabel = styled__default.default(StyledButtonPreview).attr
|
|
|
636
624
|
theme: props.theme,
|
|
637
625
|
selector: '&:has(:focus-visible)'
|
|
638
626
|
}), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
639
|
-
StyledColorSwatchLabel.defaultProps = {
|
|
640
|
-
theme: reactTheming.DEFAULT_THEME
|
|
641
|
-
};
|
|
642
627
|
|
|
643
628
|
var _path$1;
|
|
644
|
-
function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (
|
|
629
|
+
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); }
|
|
645
630
|
var SvgCheckSmFill = function SvgCheckSmFill(props) {
|
|
646
631
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
|
|
647
632
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -663,26 +648,20 @@ var SvgCheckSmFill = function SvgCheckSmFill(props) {
|
|
|
663
648
|
const COMPONENT_ID$1 = 'colorpickers.colorswatch_check';
|
|
664
649
|
const StyledIcon = styled__default.default(SvgCheckSmFill).attrs({
|
|
665
650
|
'data-garden-id': COMPONENT_ID$1,
|
|
666
|
-
'data-garden-version': '9.0.0
|
|
651
|
+
'data-garden-version': '9.0.0'
|
|
667
652
|
}).withConfig({
|
|
668
653
|
displayName: "StyledIcon",
|
|
669
654
|
componentId: "sc-8oigif-0"
|
|
670
655
|
})(["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));
|
|
671
|
-
StyledIcon.defaultProps = {
|
|
672
|
-
theme: reactTheming.DEFAULT_THEME
|
|
673
|
-
};
|
|
674
656
|
|
|
675
657
|
const COMPONENT_ID = 'colorpickers.swatch_cell';
|
|
676
658
|
const StyledCell = styled__default.default.td.attrs({
|
|
677
659
|
'data-garden-id': COMPONENT_ID,
|
|
678
|
-
'data-garden-version': '9.0.0
|
|
660
|
+
'data-garden-version': '9.0.0'
|
|
679
661
|
}).withConfig({
|
|
680
662
|
displayName: "StyledCell",
|
|
681
663
|
componentId: "sc-qr3oit-0"
|
|
682
664
|
})(["padding:", "px;font-size:0;", ";"], props => props.theme.space.base, props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
|
|
683
|
-
StyledCell.defaultProps = {
|
|
684
|
-
theme: reactTheming.DEFAULT_THEME
|
|
685
|
-
};
|
|
686
665
|
|
|
687
666
|
const ColorWell = React__namespace.default.memo(_ref => {
|
|
688
667
|
let {
|
|
@@ -745,17 +724,15 @@ const ColorWell = React__namespace.default.memo(_ref => {
|
|
|
745
724
|
throttledChange.cancel();
|
|
746
725
|
};
|
|
747
726
|
}, [throttledChange]);
|
|
748
|
-
return (
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
}))
|
|
758
|
-
);
|
|
727
|
+
return React__namespace.default.createElement(StyledColorWell, {
|
|
728
|
+
$hue: hue,
|
|
729
|
+
ref: containerRef,
|
|
730
|
+
role: "presentation",
|
|
731
|
+
onMouseDown: handleMouseDown
|
|
732
|
+
}, React__namespace.default.createElement(StyledColorWellThumb, {
|
|
733
|
+
top: mouseActiveRef.current ? topFromMouse : topPosition,
|
|
734
|
+
left: mouseActiveRef.current ? leftFromMouse : leftPosition
|
|
735
|
+
}));
|
|
759
736
|
});
|
|
760
737
|
ColorWell.displayName = 'ColorWell';
|
|
761
738
|
|
|
@@ -1129,27 +1106,27 @@ const ColorPicker = React.forwardRef((_ref, ref) => {
|
|
|
1129
1106
|
}, [computedColor]);
|
|
1130
1107
|
return React__namespace.default.createElement(StyledColorPicker, Object.assign({
|
|
1131
1108
|
ref: ref,
|
|
1132
|
-
isOpaque: isOpaque
|
|
1109
|
+
$isOpaque: isOpaque
|
|
1133
1110
|
}, props), React__namespace.default.createElement(ColorWell, {
|
|
1134
1111
|
hue: computedColor.hue,
|
|
1135
1112
|
saturation: computedColor.saturation,
|
|
1136
1113
|
lightness: computedColor.lightness,
|
|
1137
1114
|
onChange: handleColorWellChange
|
|
1138
1115
|
}), React__namespace.default.createElement(StyledSliderGroup, null, React__namespace.default.createElement(StyledPreview, {
|
|
1139
|
-
red: computedColor.red,
|
|
1140
|
-
green: computedColor.green,
|
|
1141
|
-
blue: computedColor.blue,
|
|
1142
|
-
alpha: computedColor.alpha,
|
|
1143
|
-
isOpaque: isOpaque
|
|
1116
|
+
$red: computedColor.red,
|
|
1117
|
+
$green: computedColor.green,
|
|
1118
|
+
$blue: computedColor.blue,
|
|
1119
|
+
$alpha: computedColor.alpha,
|
|
1120
|
+
$isOpaque: isOpaque
|
|
1144
1121
|
}), React__namespace.default.createElement(StyledSliders, {
|
|
1145
|
-
isOpaque: isOpaque
|
|
1122
|
+
$isOpaque: isOpaque
|
|
1146
1123
|
}, React__namespace.default.createElement(reactForms.Field, null, React__namespace.default.createElement(reactForms.Field.Label, {
|
|
1147
1124
|
hidden: true
|
|
1148
1125
|
}, labels.hueSlider || 'Hue slider'), React__namespace.default.createElement(StyledHueRange, {
|
|
1149
1126
|
step: 1,
|
|
1150
1127
|
max: 360,
|
|
1151
1128
|
value: computedColor.hue,
|
|
1152
|
-
isOpaque: isOpaque,
|
|
1129
|
+
$isOpaque: isOpaque,
|
|
1153
1130
|
onChange: handleHueChange
|
|
1154
1131
|
})), !isOpaque && React__namespace.default.createElement(reactForms.Field, null, React__namespace.default.createElement(reactForms.Field.Label, {
|
|
1155
1132
|
hidden: true
|
|
@@ -1158,9 +1135,9 @@ const ColorPicker = React.forwardRef((_ref, ref) => {
|
|
|
1158
1135
|
step: 0.01,
|
|
1159
1136
|
value: computedColor.alpha / 100,
|
|
1160
1137
|
onChange: handleAlphaSliderChange,
|
|
1161
|
-
red: computedColor.red,
|
|
1162
|
-
green: computedColor.green,
|
|
1163
|
-
blue: computedColor.blue
|
|
1138
|
+
$red: computedColor.red,
|
|
1139
|
+
$green: computedColor.green,
|
|
1140
|
+
$blue: computedColor.blue
|
|
1164
1141
|
})))), React__namespace.default.createElement(StyledInputGroup, null, React__namespace.default.createElement(StyledHexField, null, React__namespace.default.createElement(StyledLabel, {
|
|
1165
1142
|
isRegular: true
|
|
1166
1143
|
}, labels.hex || 'Hex'), React__namespace.default.createElement(StyledInput, {
|
|
@@ -1230,7 +1207,7 @@ ColorPicker.propTypes = {
|
|
|
1230
1207
|
};
|
|
1231
1208
|
|
|
1232
1209
|
var _path;
|
|
1233
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
1210
|
+
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); }
|
|
1234
1211
|
var SvgChevronDownStroke = function SvgChevronDownStroke(props) {
|
|
1235
1212
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
1236
1213
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1275,6 +1252,7 @@ const ColorPickerDialog = React.forwardRef((_ref, ref) => {
|
|
|
1275
1252
|
const ariaLabelText = reactTheming.useText(ColorPickerDialog, {
|
|
1276
1253
|
'aria-label': ariaLabel
|
|
1277
1254
|
}, 'aria-label', 'Color picker');
|
|
1255
|
+
const theme = styled.useTheme() || reactTheming.DEFAULT_THEME;
|
|
1278
1256
|
const openDialog = () => {
|
|
1279
1257
|
setReferenceElement(buttonRef.current);
|
|
1280
1258
|
onDialogChange && onDialogChange({
|
|
@@ -1312,17 +1290,17 @@ const ColorPickerDialog = React.forwardRef((_ref, ref) => {
|
|
|
1312
1290
|
ref: buttonRef,
|
|
1313
1291
|
onClick: onClick
|
|
1314
1292
|
}, buttonProps), React__namespace.default.createElement(StyledButtonPreview, {
|
|
1315
|
-
backgroundColor: isControlled ? color : uncontrolledColor
|
|
1293
|
+
$backgroundColor: isControlled ? color : uncontrolledColor
|
|
1316
1294
|
}), React__namespace.default.createElement(reactButtons.Button.EndIcon, {
|
|
1317
1295
|
isRotated: referenceElement != null
|
|
1318
|
-
}, React__namespace.default.createElement(SvgChevronDownStroke, null))), React__namespace.default.createElement(
|
|
1296
|
+
}, React__namespace.default.createElement(SvgChevronDownStroke, null))), React__namespace.default.createElement(StyledTooltipDialog, Object.assign({
|
|
1319
1297
|
ref: ref,
|
|
1320
1298
|
hasArrow: hasArrow,
|
|
1321
1299
|
zIndex: zIndex,
|
|
1322
1300
|
isAnimated: isAnimated,
|
|
1323
|
-
isOpaque: isOpaque,
|
|
1324
1301
|
focusOnMount: false,
|
|
1325
1302
|
placement: placement,
|
|
1303
|
+
offset: theme.space.base,
|
|
1326
1304
|
referenceElement: referenceElement,
|
|
1327
1305
|
onClose: () => {
|
|
1328
1306
|
closeDialog();
|
|
@@ -1396,69 +1374,72 @@ const ColorSwatch = React.forwardRef((_ref, ref) => {
|
|
|
1396
1374
|
setColIndex(col);
|
|
1397
1375
|
}
|
|
1398
1376
|
});
|
|
1399
|
-
return
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
if (
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
}
|
|
1426
|
-
if (isCheckboxGroup && event.target.checked) {
|
|
1427
|
-
const inputs = gridRef.current?.querySelectorAll('input');
|
|
1428
|
-
inputs?.forEach(input => {
|
|
1429
|
-
if (input !== event.target) {
|
|
1430
|
-
input.checked = false;
|
|
1377
|
+
return (
|
|
1378
|
+
React__namespace.default.createElement(StyledColorSwatch, Object.assign({
|
|
1379
|
+
role: "grid",
|
|
1380
|
+
ref: reactMergeRefs.mergeRefs([gridRef, ref])
|
|
1381
|
+
}, props), React__namespace.default.createElement("tbody", null, colors.map((row, _rowIndex) => React__namespace.default.createElement("tr", {
|
|
1382
|
+
key: row[0].value
|
|
1383
|
+
}, row.map((color, _colIndex) => {
|
|
1384
|
+
const {
|
|
1385
|
+
label,
|
|
1386
|
+
value
|
|
1387
|
+
} = color;
|
|
1388
|
+
const {
|
|
1389
|
+
role,
|
|
1390
|
+
...gridCellProps
|
|
1391
|
+
} = getGridCellProps({
|
|
1392
|
+
colIndex: _colIndex,
|
|
1393
|
+
rowIndex: _rowIndex
|
|
1394
|
+
});
|
|
1395
|
+
const checked = isControlled ? selectedRowIndex === _rowIndex && selectedColIndex === _colIndex : undefined;
|
|
1396
|
+
const defaultChecked = isControlled ? undefined : defaultSelectedRowIndex === _rowIndex && defaultSelectedColIndex === _colIndex;
|
|
1397
|
+
const handleChange = event => {
|
|
1398
|
+
if (onSelect) {
|
|
1399
|
+
if (event.target.checked) {
|
|
1400
|
+
onSelect(_rowIndex, _colIndex);
|
|
1401
|
+
} else {
|
|
1402
|
+
onSelect(null, null);
|
|
1431
1403
|
}
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
};
|
|
1435
|
-
const handleBlur = event => {
|
|
1436
|
-
if (!(isCheckboxGroup || gridRef.current?.contains(event.relatedTarget))) {
|
|
1437
|
-
const selectedInput = gridRef.current?.querySelector(`input[name='${event.target.name}']:checked`);
|
|
1438
|
-
if (selectedInput !== null) {
|
|
1404
|
+
}
|
|
1405
|
+
if (isCheckboxGroup && event.target.checked) {
|
|
1439
1406
|
const inputs = gridRef.current?.querySelectorAll('input');
|
|
1440
|
-
inputs?.forEach(input =>
|
|
1407
|
+
inputs?.forEach(input => {
|
|
1408
|
+
if (input !== event.target) {
|
|
1409
|
+
input.checked = false;
|
|
1410
|
+
}
|
|
1411
|
+
});
|
|
1441
1412
|
}
|
|
1442
|
-
}
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1413
|
+
};
|
|
1414
|
+
const handleBlur = event => {
|
|
1415
|
+
if (!(isCheckboxGroup || gridRef.current?.contains(event.relatedTarget))) {
|
|
1416
|
+
const selectedInput = gridRef.current?.querySelector(`input[name='${event.target.name}']:checked`);
|
|
1417
|
+
if (selectedInput !== null) {
|
|
1418
|
+
const inputs = gridRef.current?.querySelectorAll('input');
|
|
1419
|
+
inputs?.forEach(input => input.setAttribute('tabIndex', input.checked ? '0' : '-1'));
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
};
|
|
1423
|
+
return React__namespace.default.createElement(StyledCell, {
|
|
1424
|
+
key: value,
|
|
1425
|
+
role: role
|
|
1426
|
+
}, React__namespace.default.createElement(StyledColorSwatchLabel, {
|
|
1427
|
+
$backgroundColor: value
|
|
1428
|
+
}, React__namespace.default.createElement(reactTooltips.Tooltip, {
|
|
1429
|
+
content: label,
|
|
1430
|
+
zIndex: 1
|
|
1431
|
+
}, React__namespace.default.createElement(StyledColorSwatchInput, Object.assign({
|
|
1432
|
+
"aria-label": label,
|
|
1433
|
+
name: name,
|
|
1434
|
+
type: isCheckboxGroup ? 'checkbox' : 'radio',
|
|
1435
|
+
value: value,
|
|
1436
|
+
defaultChecked: defaultChecked,
|
|
1437
|
+
checked: checked,
|
|
1438
|
+
onBlur: handleBlur,
|
|
1439
|
+
onChange: handleChange
|
|
1440
|
+
}, gridCellProps))), React__namespace.default.createElement(StyledIcon, null)));
|
|
1441
|
+
})))))
|
|
1442
|
+
);
|
|
1462
1443
|
});
|
|
1463
1444
|
ColorSwatch.displayName = 'ColorSwatch';
|
|
1464
1445
|
ColorSwatch.propTypes = {
|
|
@@ -1502,6 +1483,7 @@ const ColorSwatchDialog = React.forwardRef((_ref, ref) => {
|
|
|
1502
1483
|
const [referenceElement, setReferenceElement] = React.useState(null);
|
|
1503
1484
|
const [rowIndex, setRowIndex] = React.useState(defaultSelectedRowIndex);
|
|
1504
1485
|
const [colIndex, setColIndex] = React.useState(defaultSelectedColIndex);
|
|
1486
|
+
const theme = styled.useTheme() || reactTheming.DEFAULT_THEME;
|
|
1505
1487
|
let backgroundColor;
|
|
1506
1488
|
if (isControlled) {
|
|
1507
1489
|
if (selectedRowIndex !== null && selectedColIndex !== null) {
|
|
@@ -1568,15 +1550,16 @@ const ColorSwatchDialog = React.forwardRef((_ref, ref) => {
|
|
|
1568
1550
|
ref: buttonRef,
|
|
1569
1551
|
onClick: onClick
|
|
1570
1552
|
}, buttonProps), React__namespace.default.createElement(StyledButtonPreview, {
|
|
1571
|
-
backgroundColor: backgroundColor
|
|
1553
|
+
$backgroundColor: backgroundColor
|
|
1572
1554
|
}), React__namespace.default.createElement(reactButtons.Button.EndIcon, {
|
|
1573
1555
|
isRotated: referenceElement !== null
|
|
1574
|
-
}, React__namespace.default.createElement(SvgChevronDownStroke, null))), React__namespace.default.createElement(
|
|
1556
|
+
}, React__namespace.default.createElement(SvgChevronDownStroke, null))), React__namespace.default.createElement(StyledTooltipDialog, Object.assign({
|
|
1575
1557
|
ref: ref,
|
|
1576
1558
|
zIndex: zIndex,
|
|
1577
1559
|
hasArrow: hasArrow,
|
|
1578
1560
|
focusOnMount: false,
|
|
1579
1561
|
placement: placement,
|
|
1562
|
+
offset: theme.space.base,
|
|
1580
1563
|
isAnimated: isAnimated,
|
|
1581
1564
|
referenceElement: referenceElement,
|
|
1582
1565
|
onClose: closeDialog,
|