@usertour/helpers 0.0.61 → 0.0.62
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/__tests__/convert-settings.test.cjs +27 -4
- package/dist/__tests__/convert-settings.test.js +27 -4
- package/dist/{chunk-XKSTKX45.js → chunk-H5PTH5RA.js} +1 -1
- package/dist/convert-settings.cjs +1 -1
- package/dist/convert-settings.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
|
@@ -364,7 +364,7 @@ var convertToCssVars = (settings, type = "tooltip") => {
|
|
|
364
364
|
"--usertour-checklist-trigger-hover-background-color": settings.checklistLauncher.color.hover,
|
|
365
365
|
"--usertour-question-color": hexToHSLString(settings.survey.color),
|
|
366
366
|
"--usertour-launcher-button-height": `${settings.launcherButtons.height}px`,
|
|
367
|
-
"--usertour-launcher-button-width": settings.launcherButtons.width
|
|
367
|
+
"--usertour-launcher-button-width": !settings.launcherButtons.width ? "auto" : `${settings.launcherButtons.width}px`,
|
|
368
368
|
"--usertour-launcher-button-horizontal-padding": `${settings.launcherButtons.px}px`,
|
|
369
369
|
"--usertour-launcher-button-border-radius": `${settings.launcherButtons.borderRadius}px`,
|
|
370
370
|
"--usertour-launcher-button-background-color": settings.launcherButtons.primary.backgroundColor.background,
|
|
@@ -548,7 +548,6 @@ describe("convert-settings", () => {
|
|
|
548
548
|
},
|
|
549
549
|
launcherButtons: {
|
|
550
550
|
height: 32,
|
|
551
|
-
width: 0,
|
|
552
551
|
px: 16,
|
|
553
552
|
borderRadius: 8,
|
|
554
553
|
primary: {
|
|
@@ -919,7 +918,7 @@ describe("convert-settings", () => {
|
|
|
919
918
|
const result = convertSettings(settings);
|
|
920
919
|
expect(result.launcherButtons).toBeDefined();
|
|
921
920
|
expect(result.launcherButtons.height).toBe(import_types2.defaultSettings.launcherButtons.height);
|
|
922
|
-
expect(result.launcherButtons.width).
|
|
921
|
+
expect(result.launcherButtons.width).toBeUndefined();
|
|
923
922
|
expect(result.launcherButtons.px).toBe(import_types2.defaultSettings.launcherButtons.px);
|
|
924
923
|
expect(result.launcherButtons.borderRadius).toBe(
|
|
925
924
|
import_types2.defaultSettings.launcherButtons.borderRadius
|
|
@@ -1050,11 +1049,35 @@ describe("convert-settings", () => {
|
|
|
1050
1049
|
expect(css).toContain("--usertour-launcher-button-hover-border-color:");
|
|
1051
1050
|
expect(css).toContain("--usertour-launcher-button-active-border-color:");
|
|
1052
1051
|
});
|
|
1053
|
-
it("should set launcher button width to auto when width is
|
|
1052
|
+
it("should set launcher button width to auto when width is undefined", () => {
|
|
1054
1053
|
const convertedSettings = convertSettings(completeSettings);
|
|
1055
1054
|
const css = convertToCssVars(convertedSettings);
|
|
1056
1055
|
expect(css).toContain("--usertour-launcher-button-width:auto");
|
|
1057
1056
|
});
|
|
1057
|
+
it("should set launcher button width to auto when width is 0", () => {
|
|
1058
|
+
const settingsWithZeroWidth = {
|
|
1059
|
+
...completeSettings,
|
|
1060
|
+
launcherButtons: {
|
|
1061
|
+
...completeSettings.launcherButtons,
|
|
1062
|
+
width: 0
|
|
1063
|
+
}
|
|
1064
|
+
};
|
|
1065
|
+
const convertedSettings = convertSettings(settingsWithZeroWidth);
|
|
1066
|
+
const css = convertToCssVars(convertedSettings);
|
|
1067
|
+
expect(css).toContain("--usertour-launcher-button-width:auto");
|
|
1068
|
+
});
|
|
1069
|
+
it("should set launcher button width to specific value when width is provided", () => {
|
|
1070
|
+
const settingsWithWidth = {
|
|
1071
|
+
...completeSettings,
|
|
1072
|
+
launcherButtons: {
|
|
1073
|
+
...completeSettings.launcherButtons,
|
|
1074
|
+
width: 120
|
|
1075
|
+
}
|
|
1076
|
+
};
|
|
1077
|
+
const convertedSettings = convertSettings(settingsWithWidth);
|
|
1078
|
+
const css = convertToCssVars(convertedSettings);
|
|
1079
|
+
expect(css).toContain("--usertour-launcher-button-width:120px");
|
|
1080
|
+
});
|
|
1058
1081
|
it("should set launcher button border width to 0px when border is disabled", () => {
|
|
1059
1082
|
const convertedSettings = convertSettings(completeSettings);
|
|
1060
1083
|
const css = convertToCssVars(convertedSettings);
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
convertSettings,
|
|
3
3
|
convertToCssVars,
|
|
4
4
|
mergeThemeDefaultSettings
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-H5PTH5RA.js";
|
|
6
6
|
import "../chunk-5C3J4DM2.js";
|
|
7
7
|
import "../chunk-FZFHBCB6.js";
|
|
8
8
|
import "../chunk-GFH3VWOC.js";
|
|
@@ -165,7 +165,6 @@ describe("convert-settings", () => {
|
|
|
165
165
|
},
|
|
166
166
|
launcherButtons: {
|
|
167
167
|
height: 32,
|
|
168
|
-
width: 0,
|
|
169
168
|
px: 16,
|
|
170
169
|
borderRadius: 8,
|
|
171
170
|
primary: {
|
|
@@ -536,7 +535,7 @@ describe("convert-settings", () => {
|
|
|
536
535
|
const result = convertSettings(settings);
|
|
537
536
|
expect(result.launcherButtons).toBeDefined();
|
|
538
537
|
expect(result.launcherButtons.height).toBe(defaultSettings.launcherButtons.height);
|
|
539
|
-
expect(result.launcherButtons.width).
|
|
538
|
+
expect(result.launcherButtons.width).toBeUndefined();
|
|
540
539
|
expect(result.launcherButtons.px).toBe(defaultSettings.launcherButtons.px);
|
|
541
540
|
expect(result.launcherButtons.borderRadius).toBe(
|
|
542
541
|
defaultSettings.launcherButtons.borderRadius
|
|
@@ -667,11 +666,35 @@ describe("convert-settings", () => {
|
|
|
667
666
|
expect(css).toContain("--usertour-launcher-button-hover-border-color:");
|
|
668
667
|
expect(css).toContain("--usertour-launcher-button-active-border-color:");
|
|
669
668
|
});
|
|
670
|
-
it("should set launcher button width to auto when width is
|
|
669
|
+
it("should set launcher button width to auto when width is undefined", () => {
|
|
671
670
|
const convertedSettings = convertSettings(completeSettings);
|
|
672
671
|
const css = convertToCssVars(convertedSettings);
|
|
673
672
|
expect(css).toContain("--usertour-launcher-button-width:auto");
|
|
674
673
|
});
|
|
674
|
+
it("should set launcher button width to auto when width is 0", () => {
|
|
675
|
+
const settingsWithZeroWidth = {
|
|
676
|
+
...completeSettings,
|
|
677
|
+
launcherButtons: {
|
|
678
|
+
...completeSettings.launcherButtons,
|
|
679
|
+
width: 0
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
const convertedSettings = convertSettings(settingsWithZeroWidth);
|
|
683
|
+
const css = convertToCssVars(convertedSettings);
|
|
684
|
+
expect(css).toContain("--usertour-launcher-button-width:auto");
|
|
685
|
+
});
|
|
686
|
+
it("should set launcher button width to specific value when width is provided", () => {
|
|
687
|
+
const settingsWithWidth = {
|
|
688
|
+
...completeSettings,
|
|
689
|
+
launcherButtons: {
|
|
690
|
+
...completeSettings.launcherButtons,
|
|
691
|
+
width: 120
|
|
692
|
+
}
|
|
693
|
+
};
|
|
694
|
+
const convertedSettings = convertSettings(settingsWithWidth);
|
|
695
|
+
const css = convertToCssVars(convertedSettings);
|
|
696
|
+
expect(css).toContain("--usertour-launcher-button-width:120px");
|
|
697
|
+
});
|
|
675
698
|
it("should set launcher button border width to 0px when border is disabled", () => {
|
|
676
699
|
const convertedSettings = convertSettings(completeSettings);
|
|
677
700
|
const css = convertToCssVars(convertedSettings);
|
|
@@ -301,7 +301,7 @@ var convertToCssVars = (settings, type = "tooltip") => {
|
|
|
301
301
|
"--usertour-checklist-trigger-hover-background-color": settings.checklistLauncher.color.hover,
|
|
302
302
|
"--usertour-question-color": hexToHSLString(settings.survey.color),
|
|
303
303
|
"--usertour-launcher-button-height": `${settings.launcherButtons.height}px`,
|
|
304
|
-
"--usertour-launcher-button-width": settings.launcherButtons.width
|
|
304
|
+
"--usertour-launcher-button-width": !settings.launcherButtons.width ? "auto" : `${settings.launcherButtons.width}px`,
|
|
305
305
|
"--usertour-launcher-button-horizontal-padding": `${settings.launcherButtons.px}px`,
|
|
306
306
|
"--usertour-launcher-button-border-radius": `${settings.launcherButtons.borderRadius}px`,
|
|
307
307
|
"--usertour-launcher-button-background-color": settings.launcherButtons.primary.backgroundColor.background,
|
|
@@ -373,7 +373,7 @@ var convertToCssVars = (settings, type = "tooltip") => {
|
|
|
373
373
|
"--usertour-checklist-trigger-hover-background-color": settings.checklistLauncher.color.hover,
|
|
374
374
|
"--usertour-question-color": hexToHSLString(settings.survey.color),
|
|
375
375
|
"--usertour-launcher-button-height": `${settings.launcherButtons.height}px`,
|
|
376
|
-
"--usertour-launcher-button-width": settings.launcherButtons.width
|
|
376
|
+
"--usertour-launcher-button-width": !settings.launcherButtons.width ? "auto" : `${settings.launcherButtons.width}px`,
|
|
377
377
|
"--usertour-launcher-button-horizontal-padding": `${settings.launcherButtons.px}px`,
|
|
378
378
|
"--usertour-launcher-button-border-radius": `${settings.launcherButtons.borderRadius}px`,
|
|
379
379
|
"--usertour-launcher-button-background-color": settings.launcherButtons.primary.backgroundColor.background,
|
package/dist/convert-settings.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -675,7 +675,7 @@ var convertToCssVars = (settings, type = "tooltip") => {
|
|
|
675
675
|
"--usertour-checklist-trigger-hover-background-color": settings.checklistLauncher.color.hover,
|
|
676
676
|
"--usertour-question-color": hexToHSLString(settings.survey.color),
|
|
677
677
|
"--usertour-launcher-button-height": `${settings.launcherButtons.height}px`,
|
|
678
|
-
"--usertour-launcher-button-width": settings.launcherButtons.width
|
|
678
|
+
"--usertour-launcher-button-width": !settings.launcherButtons.width ? "auto" : `${settings.launcherButtons.width}px`,
|
|
679
679
|
"--usertour-launcher-button-horizontal-padding": `${settings.launcherButtons.px}px`,
|
|
680
680
|
"--usertour-launcher-button-border-radius": `${settings.launcherButtons.borderRadius}px`,
|
|
681
681
|
"--usertour-launcher-button-background-color": settings.launcherButtons.primary.backgroundColor.background,
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usertour/helpers",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.62",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Utility functions and helpers shared across the UserTour project",
|
|
6
6
|
"homepage": "https://www.usertour.io",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@paralleldrive/cuid2": "^2.2.2",
|
|
32
|
-
"@usertour/types": "^0.0.
|
|
32
|
+
"@usertour/types": "^0.0.46",
|
|
33
33
|
"chroma-js": "^3.1.2",
|
|
34
34
|
"class-variance-authority": "^0.4.0",
|
|
35
35
|
"date-fns": "^2.30.0",
|