@descope/web-components-ui 1.0.287 → 1.0.289
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/cjs/index.cjs.js +76 -11
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.esm.js +76 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/button-selection-group-fields-descope-button-selection-group-item-index-js.js +1 -1
- package/package.json +1 -1
- package/src/components/button-selection-group-fields/descope-button-selection-group-item/ButtonSelectionGroupItemClass.js +4 -0
- package/src/helpers/themeHelpers/colorsHelpers.js +71 -11
- package/src/index.d.ts +3 -0
- package/src/theme/components/buttonSelectionGroup/buttonSelectionGroupItem.js +1 -0
package/dist/index.d.ts
CHANGED
@@ -51,6 +51,8 @@ export type Theme = {
|
|
51
51
|
typography: Record<string, any>;
|
52
52
|
shadow: Record<string, string>;
|
53
53
|
spacing: Record<string, string>;
|
54
|
+
radius: Record<string, string>;
|
55
|
+
border: Record<string, string>;
|
54
56
|
};
|
55
57
|
components: {
|
56
58
|
button: Record<string, any>;
|
@@ -60,5 +62,6 @@ export type Theme = {
|
|
60
62
|
link: Record<string, any>;
|
61
63
|
text: Record<string, any>;
|
62
64
|
inputWrapper: Record<string, any>;
|
65
|
+
buttonSelectionGroupItem: Record<string, any>;
|
63
66
|
};
|
64
67
|
};
|
package/dist/index.esm.js
CHANGED
@@ -7015,6 +7015,10 @@ const ButtonSelectionGroupItemClass = compose(
|
|
7015
7015
|
selector: () => ButtonClass.componentName,
|
7016
7016
|
property: ButtonClass.cssVarList.borderColor,
|
7017
7017
|
},
|
7018
|
+
borderWidth: {
|
7019
|
+
selector: () => ButtonClass.componentName,
|
7020
|
+
property: ButtonClass.cssVarList.borderWidth,
|
7021
|
+
},
|
7018
7022
|
borderStyle: {
|
7019
7023
|
selector: () => ButtonClass.componentName,
|
7020
7024
|
property: ButtonClass.cssVarList.borderStyle,
|
@@ -9384,27 +9388,87 @@ const createHelperVars = (theme, prefix) => {
|
|
9384
9388
|
return [res.theme, res.useVars, res.vars];
|
9385
9389
|
};
|
9386
9390
|
|
9387
|
-
|
9388
|
-
|
9389
|
-
|
9390
|
-
|
9391
|
+
const colorGaps = {
|
9392
|
+
darkLight: 0.4,
|
9393
|
+
highlight: 0.8,
|
9394
|
+
contrast: 1,
|
9395
|
+
edgeColor: {
|
9396
|
+
darkLight: 0.25,
|
9397
|
+
highlight: 0.1,
|
9398
|
+
},
|
9399
|
+
};
|
9400
|
+
|
9401
|
+
const darken = (c, percentage) => c.darken(percentage).hex();
|
9402
|
+
|
9403
|
+
const contrast = (c) => {
|
9391
9404
|
const isDark = c.isDark();
|
9392
9405
|
return c
|
9393
|
-
.mix(Color(isDark ? 'white' : 'black'),
|
9406
|
+
.mix(Color(isDark ? 'white' : 'black'), colorGaps.contrast)
|
9394
9407
|
.saturate(1)
|
9395
9408
|
.hex();
|
9396
9409
|
};
|
9397
9410
|
|
9398
|
-
const
|
9411
|
+
const lighten = (c, percentage) => {
|
9412
|
+
const isDark = c.lightness() < 0.5;
|
9413
|
+
|
9414
|
+
if (isDark) {
|
9415
|
+
return c.lightness(percentage * 100).hex();
|
9416
|
+
}
|
9417
|
+
|
9418
|
+
return c.lighten(percentage).hex();
|
9419
|
+
};
|
9420
|
+
|
9421
|
+
const isNearBlack = (color) => color.luminosity() < 0.01;
|
9422
|
+
const isNearWhite = (color) => color.luminosity() > 0.99;
|
9423
|
+
|
9424
|
+
const generateDarkColor = (color, theme) => {
|
9425
|
+
if (theme === 'dark') {
|
9426
|
+
return isNearWhite(color)
|
9427
|
+
? darken(color, colorGaps.edgeColor.darkLight)
|
9428
|
+
: lighten(color, colorGaps.darkLight);
|
9429
|
+
}
|
9430
|
+
|
9431
|
+
return isNearBlack(color)
|
9432
|
+
? lighten(color, colorGaps.edgeColor.darkLight)
|
9433
|
+
: darken(color, colorGaps.darkLight);
|
9434
|
+
};
|
9435
|
+
|
9436
|
+
const generateLightColor = (color, theme) => {
|
9437
|
+
if (theme === 'dark') {
|
9438
|
+
return isNearBlack(color)
|
9439
|
+
? lighten(color, colorGaps.edgeColor.darkLight)
|
9440
|
+
: darken(color, colorGaps.darkLight);
|
9441
|
+
}
|
9442
|
+
|
9443
|
+
return isNearWhite(color)
|
9444
|
+
? darken(color, colorGaps.edgeColor.darkLight)
|
9445
|
+
: lighten(color, colorGaps.darkLight);
|
9446
|
+
};
|
9447
|
+
|
9448
|
+
const generateHighlightColor = (color, theme) => {
|
9449
|
+
if (theme === 'dark') {
|
9450
|
+
return isNearBlack(color)
|
9451
|
+
? lighten(color, colorGaps.edgeColor.highlight)
|
9452
|
+
: darken(color, colorGaps.highlight);
|
9453
|
+
}
|
9454
|
+
|
9455
|
+
return isNearWhite(color)
|
9456
|
+
? darken(color, colorGaps.edgeColor.highlight)
|
9457
|
+
: lighten(color, colorGaps.highlight);
|
9458
|
+
};
|
9459
|
+
|
9460
|
+
const genColor = (color, theme) => {
|
9399
9461
|
const mainColor = new Color(color.main || color);
|
9400
9462
|
|
9401
|
-
|
9463
|
+
const res = {
|
9402
9464
|
main: mainColor.hex(),
|
9403
|
-
dark: color.dark ||
|
9404
|
-
light: color.light ||
|
9405
|
-
highlight: color.highlight ||
|
9406
|
-
contrast: color.contrast ||
|
9465
|
+
dark: color.dark || generateDarkColor(mainColor, theme),
|
9466
|
+
light: color.light || generateLightColor(mainColor, theme),
|
9467
|
+
highlight: color.highlight || generateHighlightColor(mainColor, theme),
|
9468
|
+
contrast: color.contrast || contrast(mainColor),
|
9407
9469
|
};
|
9470
|
+
|
9471
|
+
return res;
|
9408
9472
|
};
|
9409
9473
|
|
9410
9474
|
const genColors = (colors) => {
|
@@ -10805,6 +10869,7 @@ const buttonSelectionGroupItem = {
|
|
10805
10869
|
[vars$a.borderStyle]: 'solid',
|
10806
10870
|
[vars$a.borderRadius]: globalRefs$8.radius.sm,
|
10807
10871
|
[vars$a.outlineColor]: 'transparent',
|
10872
|
+
[vars$a.borderWidth]: globalRefs$8.border.xs,
|
10808
10873
|
|
10809
10874
|
_hover: {
|
10810
10875
|
[vars$a.backgroundColor]: globalRefs$8.colors.surface.highlight,
|