@zohodesk/components 1.6.25 → 1.6.26
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/CHANGELOG.md +2042 -0
- package/README.md +16 -2031
- package/assets/Appearance/dark/mode/Component_v1_DarkMode.module.css +5 -20
- package/assets/Appearance/light/mode/Component_v1_LightMode.module.css +5 -20
- package/assets/Appearance/pureDark/mode/Component_v1_PureDarkMode.module.css +5 -20
- package/es/Accordion/Accordion.js +1 -6
- package/es/Accordion/AccordionItem.js +1 -6
- package/es/Animation/Animation.js +1 -8
- package/es/AppContainer/AppContainer.js +1 -6
- package/es/AppContainer/__tests__/__snapshots__/AppContainer.spec.js.snap +16 -16
- package/es/Avatar/Avatar.js +1 -6
- package/es/AvatarTeam/AvatarTeam.js +1 -7
- package/es/Button/Button.js +1 -6
- package/es/Buttongroup/Buttongroup.js +1 -14
- package/es/Card/Card.js +1 -9
- package/es/Card/__tests__/__snapshots__/Card.spec.js.snap +17 -17
- package/es/Card/__tests__/__snapshots__/CardContent.spec.js.snap +12 -12
- package/es/Card/__tests__/__snapshots__/CardHeader.spec.js.snap +4 -4
- package/es/CheckBox/CheckBox.js +1 -6
- package/es/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +88 -88
- package/es/ColorSelect/__tests__/__snapshots__/ColorMultiSelect.spec.js.snap +48 -48
- package/es/ColorSelect/__tests__/__snapshots__/ColorSingleSelect.spec.js.snap +30 -30
- package/es/DateTime/DateWidget.js +0 -10
- package/es/DateTime/__tests__/__snapshots__/CalendarView.spec.js.snap +49 -49
- package/es/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +93 -93
- package/es/DateTime/__tests__/__snapshots__/DateTimePopupFooter.spec.js.snap +1 -1
- package/es/DateTime/__tests__/__snapshots__/DateTimePopupHeader.spec.js.snap +8 -8
- package/es/DateTime/__tests__/__snapshots__/DateWidget.spec.js.snap +7 -7
- package/es/DateTime/__tests__/__snapshots__/DaysRow.spec.js.snap +1 -1
- package/es/DateTime/__tests__/__snapshots__/Time.spec.js.snap +28 -28
- package/es/DropDown/DropDownHeading.js +1 -6
- package/es/DropDown/__tests__/__snapshots__/DropDown.spec.js.snap +2 -2
- package/es/Heading/Heading.js +1 -6
- package/es/Label/Label.js +1 -6
- package/es/Label/__tests__/__snapshots__/Label.spec.js.snap +4 -4
- package/es/ListItem/ListContainer.js +1 -6
- package/es/ListItem/ListItem.js +1 -6
- package/es/ListItem/ListItemWithAvatar.js +1 -6
- package/es/ListItem/ListItemWithCheckBox.js +1 -6
- package/es/ListItem/ListItemWithIcon.js +1 -6
- package/es/ListItem/ListItemWithRadio.js +1 -6
- package/es/ListItem/__tests__/__snapshots__/ListContainer.spec.js.snap +2 -2
- package/es/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +16 -16
- package/es/ListItem/__tests__/__snapshots__/ListItemWithAvatar.spec.js.snap +41 -41
- package/es/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +62 -62
- package/es/ListItem/__tests__/__snapshots__/ListItemWithIcon.spec.js.snap +41 -41
- package/es/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +62 -62
- package/es/Modal/Modal.js +1 -8
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +1 -7
- package/es/MultiSelect/AdvancedMultiSelect.js +1 -9
- package/es/MultiSelect/MobileHeader/__tests__/__snapshots__/MobileHeader.spec.js.snap +3 -3
- package/es/MultiSelect/__tests__/__snapshots__/AdvancedGroupMultiSelect.spec.js.snap +6 -6
- package/es/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +50 -50
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +35 -35
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelectHeader.spec.js.snap +7 -7
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelectWithAvatar.spec.js.snap +8 -8
- package/es/MultiSelect/__tests__/__snapshots__/SelectedOptions.spec.js.snap +4 -4
- package/es/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +47 -47
- package/es/Radio/__tests__/__snapshots__/Radio.spec.js.snap +94 -94
- package/es/ResponsiveDropBox/__tests__/__snapshots__/ResponsiveDropBox.spec.js.snap +1 -1
- package/es/RippleEffect/RippleEffect.js +1 -6
- package/es/Select/GroupSelect.js +1 -8
- package/es/Select/Select.js +1 -10
- package/es/Select/SelectWithAvatar.js +1 -9
- package/es/Select/SelectWithIcon.js +1 -7
- package/es/Select/__tests__/__snapshots__/GroupSelect.spec.js.snap +7 -7
- package/es/Select/__tests__/__snapshots__/Select.spec.js.snap +831 -831
- package/es/Select/__tests__/__snapshots__/SelectWithAvatar.spec.js.snap +2 -2
- package/es/Select/__tests__/__snapshots__/SelectWithIcon.spec.js.snap +10 -10
- package/es/Switch/Switch.js +1 -6
- package/es/Switch/__tests__/__snapshots__/Switch.spec.js.snap +44 -44
- package/es/Tab/Tab.js +1 -6
- package/es/Tab/__tests__/__snapshots__/Tab.spec.js.snap +2 -2
- package/es/Tab/__tests__/__snapshots__/TabContent.spec.js.snap +1 -1
- package/es/Tab/__tests__/__snapshots__/TabContentWrapper.spec.js.snap +1 -1
- package/es/Tab/__tests__/__snapshots__/TabLayout.spec.js.snap +40 -40
- package/es/Tab/__tests__/__snapshots__/TabWrapper.spec.js.snap +1 -1
- package/es/Tab/__tests__/__snapshots__/Tabs.spec.js.snap +4 -4
- package/es/Tag/Tag.js +1 -6
- package/es/Tag/__tests__/__snapshots__/Tag.spec.js.snap +94 -94
- package/es/TextBox/TextBox.js +1 -8
- package/es/TextBoxIcon/TextBoxIcon.js +1 -8
- package/es/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +167 -167
- package/es/Textarea/Textarea.js +1 -8
- package/es/Tooltip/Tooltip.js +1 -8
- package/es/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +1 -5
- package/es/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +1 -5
- package/es/semantic/Button/Button.js +1 -6
- package/es/shared/ArrowIcon/__tests__/__snapshots__/ArrowIcon.spec.js.snap +20 -20
- package/es/shared/InputFieldLine/__tests__/__snapshots__/InputFieldLine.spec.js.snap +19 -19
- package/es/v1/Button/Button.js +197 -113
- package/es/v1/Button/README.md +110 -44
- package/es/v1/Button/__tests__/Button.spec.js +139 -48
- package/es/v1/Button/__tests__/__snapshots__/Button.spec.js.snap +1236 -340
- package/es/v1/Button/constants/index.js +29 -23
- package/es/v1/Button/constants/presets.js +160 -0
- package/es/v1/Button/css/Button_v1.module.css +33 -16
- package/es/v1/Button/css/cssJSLogic.js +56 -29
- package/es/v1/Button/props/defaultProps.js +5 -6
- package/es/v1/Button/props/propTypes.js +26 -8
- package/es/v1/Label/__tests__/__snapshots__/Label.spec.js.snap +24 -24
- package/es/v1/Switch/__tests__/__snapshots__/Switch.spec.js.snap +14 -14
- package/es/v1/helpers/colorHelpers/__tests__/colorHelper.spec.js +357 -0
- package/es/v1/helpers/colorHelpers/background/backgroundColor.module.css +38 -534
- package/es/v1/helpers/colorHelpers/border/borderColor.module.css +28 -412
- package/es/v1/helpers/colorHelpers/colorHelper.js +120 -139
- package/es/v1/helpers/colorHelpers/constants/index.js +45 -4
- package/es/v1/helpers/colorHelpers/index.js +0 -1
- package/es/v1/helpers/colorHelpers/paletteUtilities.README.md +141 -336
- package/es/v1/helpers/colorHelpers/text/textColor.module.css +79 -295
- package/lib/Accordion/Accordion.js +1 -6
- package/lib/Accordion/AccordionItem.js +1 -6
- package/lib/Animation/Animation.js +1 -8
- package/lib/AppContainer/AppContainer.js +1 -6
- package/lib/AppContainer/__tests__/__snapshots__/AppContainer.spec.js.snap +16 -16
- package/lib/Avatar/Avatar.js +1 -6
- package/lib/AvatarTeam/AvatarTeam.js +1 -7
- package/lib/Button/Button.js +1 -7
- package/lib/Buttongroup/Buttongroup.js +1 -14
- package/lib/Card/Card.js +1 -8
- package/lib/Card/__tests__/__snapshots__/Card.spec.js.snap +17 -17
- package/lib/Card/__tests__/__snapshots__/CardContent.spec.js.snap +12 -12
- package/lib/Card/__tests__/__snapshots__/CardHeader.spec.js.snap +4 -4
- package/lib/CheckBox/CheckBox.js +1 -6
- package/lib/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +88 -88
- package/lib/ColorSelect/__tests__/__snapshots__/ColorMultiSelect.spec.js.snap +48 -48
- package/lib/ColorSelect/__tests__/__snapshots__/ColorSingleSelect.spec.js.snap +30 -30
- package/lib/DateTime/DateWidget.js +0 -10
- package/lib/DateTime/__tests__/__snapshots__/CalendarView.spec.js.snap +49 -49
- package/lib/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +93 -93
- package/lib/DateTime/__tests__/__snapshots__/DateTimePopupFooter.spec.js.snap +1 -1
- package/lib/DateTime/__tests__/__snapshots__/DateTimePopupHeader.spec.js.snap +8 -8
- package/lib/DateTime/__tests__/__snapshots__/DateWidget.spec.js.snap +7 -7
- package/lib/DateTime/__tests__/__snapshots__/DaysRow.spec.js.snap +1 -1
- package/lib/DateTime/__tests__/__snapshots__/Time.spec.js.snap +28 -28
- package/lib/DropDown/DropDownHeading.js +1 -6
- package/lib/DropDown/__tests__/__snapshots__/DropDown.spec.js.snap +2 -2
- package/lib/Heading/Heading.js +1 -6
- package/lib/Label/Label.js +1 -6
- package/lib/Label/__tests__/__snapshots__/Label.spec.js.snap +4 -4
- package/lib/ListItem/ListContainer.js +1 -7
- package/lib/ListItem/ListItem.js +1 -6
- package/lib/ListItem/ListItemWithAvatar.js +1 -6
- package/lib/ListItem/ListItemWithCheckBox.js +1 -6
- package/lib/ListItem/ListItemWithIcon.js +1 -6
- package/lib/ListItem/ListItemWithRadio.js +1 -6
- package/lib/ListItem/__tests__/__snapshots__/ListContainer.spec.js.snap +2 -2
- package/lib/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +16 -16
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithAvatar.spec.js.snap +41 -41
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +62 -62
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithIcon.spec.js.snap +41 -41
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +62 -62
- package/lib/Modal/Modal.js +1 -8
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +1 -7
- package/lib/MultiSelect/AdvancedMultiSelect.js +1 -9
- package/lib/MultiSelect/MobileHeader/__tests__/__snapshots__/MobileHeader.spec.js.snap +3 -3
- package/lib/MultiSelect/__tests__/__snapshots__/AdvancedGroupMultiSelect.spec.js.snap +6 -6
- package/lib/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +50 -50
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +35 -35
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelectHeader.spec.js.snap +7 -7
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelectWithAvatar.spec.js.snap +8 -8
- package/lib/MultiSelect/__tests__/__snapshots__/SelectedOptions.spec.js.snap +4 -4
- package/lib/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +47 -47
- package/lib/Radio/__tests__/__snapshots__/Radio.spec.js.snap +94 -94
- package/lib/ResponsiveDropBox/__tests__/__snapshots__/ResponsiveDropBox.spec.js.snap +1 -1
- package/lib/RippleEffect/RippleEffect.js +1 -6
- package/lib/Select/GroupSelect.js +1 -9
- package/lib/Select/Select.js +1 -11
- package/lib/Select/SelectWithAvatar.js +1 -9
- package/lib/Select/SelectWithIcon.js +1 -7
- package/lib/Select/__tests__/__snapshots__/GroupSelect.spec.js.snap +7 -7
- package/lib/Select/__tests__/__snapshots__/Select.spec.js.snap +831 -831
- package/lib/Select/__tests__/__snapshots__/SelectWithAvatar.spec.js.snap +2 -2
- package/lib/Select/__tests__/__snapshots__/SelectWithIcon.spec.js.snap +10 -10
- package/lib/Switch/Switch.js +1 -6
- package/lib/Switch/__tests__/__snapshots__/Switch.spec.js.snap +44 -44
- package/lib/Tab/Tab.js +1 -6
- package/lib/Tab/__tests__/__snapshots__/Tab.spec.js.snap +2 -2
- package/lib/Tab/__tests__/__snapshots__/TabContent.spec.js.snap +1 -1
- package/lib/Tab/__tests__/__snapshots__/TabContentWrapper.spec.js.snap +1 -1
- package/lib/Tab/__tests__/__snapshots__/TabLayout.spec.js.snap +40 -40
- package/lib/Tab/__tests__/__snapshots__/TabWrapper.spec.js.snap +1 -1
- package/lib/Tab/__tests__/__snapshots__/Tabs.spec.js.snap +4 -4
- package/lib/Tag/Tag.js +1 -6
- package/lib/Tag/__tests__/__snapshots__/Tag.spec.js.snap +94 -94
- package/lib/TextBox/TextBox.js +1 -8
- package/lib/TextBoxIcon/TextBoxIcon.js +1 -8
- package/lib/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +167 -167
- package/lib/Textarea/Textarea.js +1 -8
- package/lib/Tooltip/Tooltip.js +1 -8
- package/lib/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +1 -5
- package/lib/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +1 -5
- package/lib/semantic/Button/Button.js +1 -6
- package/lib/shared/ArrowIcon/__tests__/__snapshots__/ArrowIcon.spec.js.snap +20 -20
- package/lib/shared/InputFieldLine/__tests__/__snapshots__/InputFieldLine.spec.js.snap +19 -19
- package/lib/v1/Button/Button.js +207 -123
- package/lib/v1/Button/README.md +110 -44
- package/lib/v1/Button/__tests__/Button.spec.js +195 -88
- package/lib/v1/Button/__tests__/__snapshots__/Button.spec.js.snap +1236 -340
- package/lib/v1/Button/constants/index.js +34 -31
- package/lib/v1/Button/constants/presets.js +179 -0
- package/lib/v1/Button/css/Button_v1.module.css +33 -16
- package/lib/v1/Button/css/cssJSLogic.js +45 -25
- package/lib/v1/Button/props/defaultProps.js +4 -5
- package/lib/v1/Button/props/propTypes.js +41 -7
- package/lib/v1/Label/__tests__/__snapshots__/Label.spec.js.snap +24 -24
- package/lib/v1/Switch/__tests__/__snapshots__/Switch.spec.js.snap +14 -14
- package/lib/v1/helpers/colorHelpers/__tests__/colorHelper.spec.js +363 -0
- package/lib/v1/helpers/colorHelpers/background/backgroundColor.module.css +38 -534
- package/lib/v1/helpers/colorHelpers/border/borderColor.module.css +28 -412
- package/lib/v1/helpers/colorHelpers/colorHelper.js +130 -153
- package/lib/v1/helpers/colorHelpers/constants/index.js +45 -4
- package/lib/v1/helpers/colorHelpers/index.js +2 -24
- package/lib/v1/helpers/colorHelpers/paletteUtilities.README.md +141 -336
- package/lib/v1/helpers/colorHelpers/text/textColor.module.css +79 -295
- package/package.json +16 -16
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`Label - Snapshot Render with a11y attributes 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
|
-
class="
|
|
6
|
+
class="d-inline-flex d-flex-row d-items-center container default"
|
|
7
7
|
data-id="flex"
|
|
8
8
|
data-test-id="flex"
|
|
9
9
|
role="group"
|
|
@@ -22,7 +22,7 @@ exports[`Label - Snapshot Render with a11y attributes 1`] = `
|
|
|
22
22
|
exports[`Label - Snapshot Render with customClass 1`] = `
|
|
23
23
|
<DocumentFragment>
|
|
24
24
|
<div
|
|
25
|
-
class="
|
|
25
|
+
class="d-inline-flex d-flex-row d-items-center container default custom-container"
|
|
26
26
|
data-id="flex"
|
|
27
27
|
data-test-id="flex"
|
|
28
28
|
>
|
|
@@ -39,7 +39,7 @@ exports[`Label - Snapshot Render with customClass 1`] = `
|
|
|
39
39
|
exports[`Label - Snapshot Render with customId and testId 1`] = `
|
|
40
40
|
<DocumentFragment>
|
|
41
41
|
<div
|
|
42
|
-
class="
|
|
42
|
+
class="d-inline-flex d-flex-row d-items-center container default"
|
|
43
43
|
data-id="label-customId"
|
|
44
44
|
data-selector-id="label-customId"
|
|
45
45
|
data-test-id="label-testId"
|
|
@@ -57,7 +57,7 @@ exports[`Label - Snapshot Render with customId and testId 1`] = `
|
|
|
57
57
|
exports[`Label - Snapshot Render with customProps 1`] = `
|
|
58
58
|
<DocumentFragment>
|
|
59
59
|
<div
|
|
60
|
-
class="
|
|
60
|
+
class="d-inline-flex d-flex-row d-items-center d-min-w-0 d-flex-shrink container default"
|
|
61
61
|
data-id="flex"
|
|
62
62
|
data-test-id="flex"
|
|
63
63
|
>
|
|
@@ -74,7 +74,7 @@ exports[`Label - Snapshot Render with customProps 1`] = `
|
|
|
74
74
|
exports[`Label - Snapshot Render with default props 1`] = `
|
|
75
75
|
<DocumentFragment>
|
|
76
76
|
<div
|
|
77
|
-
class="
|
|
77
|
+
class="d-inline-flex d-flex-row d-items-center container default"
|
|
78
78
|
data-id="flex"
|
|
79
79
|
data-test-id="flex"
|
|
80
80
|
>
|
|
@@ -91,7 +91,7 @@ exports[`Label - Snapshot Render with default props 1`] = `
|
|
|
91
91
|
exports[`Label - Snapshot Render with fontWeight=regular 1`] = `
|
|
92
92
|
<DocumentFragment>
|
|
93
93
|
<div
|
|
94
|
-
class="
|
|
94
|
+
class="d-inline-flex d-flex-row d-items-center container default"
|
|
95
95
|
data-id="flex"
|
|
96
96
|
data-test-id="flex"
|
|
97
97
|
>
|
|
@@ -108,7 +108,7 @@ exports[`Label - Snapshot Render with fontWeight=regular 1`] = `
|
|
|
108
108
|
exports[`Label - Snapshot Render with fontWeight=semibold 1`] = `
|
|
109
109
|
<DocumentFragment>
|
|
110
110
|
<div
|
|
111
|
-
class="
|
|
111
|
+
class="d-inline-flex d-flex-row d-items-center container default"
|
|
112
112
|
data-id="flex"
|
|
113
113
|
data-test-id="flex"
|
|
114
114
|
>
|
|
@@ -125,7 +125,7 @@ exports[`Label - Snapshot Render with fontWeight=semibold 1`] = `
|
|
|
125
125
|
exports[`Label - Snapshot Render with htmlFor 1`] = `
|
|
126
126
|
<DocumentFragment>
|
|
127
127
|
<div
|
|
128
|
-
class="
|
|
128
|
+
class="d-inline-flex d-flex-row d-items-center container default"
|
|
129
129
|
data-id="flex"
|
|
130
130
|
data-test-id="flex"
|
|
131
131
|
>
|
|
@@ -143,7 +143,7 @@ exports[`Label - Snapshot Render with htmlFor 1`] = `
|
|
|
143
143
|
exports[`Label - Snapshot Render with i18nKeys 1`] = `
|
|
144
144
|
<DocumentFragment>
|
|
145
145
|
<div
|
|
146
|
-
class="
|
|
146
|
+
class="d-inline-flex d-flex-row d-items-center container default"
|
|
147
147
|
data-id="flex"
|
|
148
148
|
data-test-id="flex"
|
|
149
149
|
>
|
|
@@ -167,7 +167,7 @@ exports[`Label - Snapshot Render with i18nKeys 1`] = `
|
|
|
167
167
|
exports[`Label - Snapshot Render with isClipped=true 1`] = `
|
|
168
168
|
<DocumentFragment>
|
|
169
169
|
<div
|
|
170
|
-
class="
|
|
170
|
+
class="d-inline-flex d-flex-row d-items-center container default"
|
|
171
171
|
data-id="flex"
|
|
172
172
|
data-test-id="flex"
|
|
173
173
|
>
|
|
@@ -184,7 +184,7 @@ exports[`Label - Snapshot Render with isClipped=true 1`] = `
|
|
|
184
184
|
exports[`Label - Snapshot Render with isDisabled=true 1`] = `
|
|
185
185
|
<DocumentFragment>
|
|
186
186
|
<div
|
|
187
|
-
class="
|
|
187
|
+
class="d-inline-flex d-flex-row d-items-center container disabled"
|
|
188
188
|
data-id="flex"
|
|
189
189
|
data-test-id="flex"
|
|
190
190
|
>
|
|
@@ -201,7 +201,7 @@ exports[`Label - Snapshot Render with isDisabled=true 1`] = `
|
|
|
201
201
|
exports[`Label - Snapshot Render with isReadOnly=true 1`] = `
|
|
202
202
|
<DocumentFragment>
|
|
203
203
|
<div
|
|
204
|
-
class="
|
|
204
|
+
class="d-inline-flex d-flex-row d-items-center container readonly default"
|
|
205
205
|
data-id="flex"
|
|
206
206
|
data-test-id="flex"
|
|
207
207
|
>
|
|
@@ -218,7 +218,7 @@ exports[`Label - Snapshot Render with isReadOnly=true 1`] = `
|
|
|
218
218
|
exports[`Label - Snapshot Render with isRequired=true 1`] = `
|
|
219
219
|
<DocumentFragment>
|
|
220
220
|
<div
|
|
221
|
-
class="
|
|
221
|
+
class="d-inline-flex d-flex-row d-items-center container default"
|
|
222
222
|
data-id="flex"
|
|
223
223
|
data-test-id="flex"
|
|
224
224
|
>
|
|
@@ -242,7 +242,7 @@ exports[`Label - Snapshot Render with isRequired=true 1`] = `
|
|
|
242
242
|
exports[`Label - Snapshot Render with isRequired=true isClipped=true 1`] = `
|
|
243
243
|
<DocumentFragment>
|
|
244
244
|
<div
|
|
245
|
-
class="
|
|
245
|
+
class="d-inline-flex d-flex-row d-items-center container default"
|
|
246
246
|
data-id="flex"
|
|
247
247
|
data-test-id="flex"
|
|
248
248
|
>
|
|
@@ -266,7 +266,7 @@ exports[`Label - Snapshot Render with isRequired=true isClipped=true 1`] = `
|
|
|
266
266
|
exports[`Label - Snapshot Render with layout=block 1`] = `
|
|
267
267
|
<DocumentFragment>
|
|
268
268
|
<div
|
|
269
|
-
class="flex row
|
|
269
|
+
class="d-flex d-flex-row d-items-center container default"
|
|
270
270
|
data-id="flex"
|
|
271
271
|
data-test-id="flex"
|
|
272
272
|
>
|
|
@@ -283,7 +283,7 @@ exports[`Label - Snapshot Render with layout=block 1`] = `
|
|
|
283
283
|
exports[`Label - Snapshot Render with layout=inline 1`] = `
|
|
284
284
|
<DocumentFragment>
|
|
285
285
|
<div
|
|
286
|
-
class="
|
|
286
|
+
class="d-inline-flex d-flex-row d-items-center container default"
|
|
287
287
|
data-id="flex"
|
|
288
288
|
data-test-id="flex"
|
|
289
289
|
>
|
|
@@ -300,7 +300,7 @@ exports[`Label - Snapshot Render with layout=inline 1`] = `
|
|
|
300
300
|
exports[`Label - Snapshot Render with palette=default 1`] = `
|
|
301
301
|
<DocumentFragment>
|
|
302
302
|
<div
|
|
303
|
-
class="
|
|
303
|
+
class="d-inline-flex d-flex-row d-items-center container default"
|
|
304
304
|
data-id="flex"
|
|
305
305
|
data-test-id="flex"
|
|
306
306
|
>
|
|
@@ -317,7 +317,7 @@ exports[`Label - Snapshot Render with palette=default 1`] = `
|
|
|
317
317
|
exports[`Label - Snapshot Render with palette=secondary 1`] = `
|
|
318
318
|
<DocumentFragment>
|
|
319
319
|
<div
|
|
320
|
-
class="
|
|
320
|
+
class="d-inline-flex d-flex-row d-items-center container secondary"
|
|
321
321
|
data-id="flex"
|
|
322
322
|
data-test-id="flex"
|
|
323
323
|
>
|
|
@@ -334,7 +334,7 @@ exports[`Label - Snapshot Render with palette=secondary 1`] = `
|
|
|
334
334
|
exports[`Label - Snapshot Render with requiredType=asterisk 1`] = `
|
|
335
335
|
<DocumentFragment>
|
|
336
336
|
<div
|
|
337
|
-
class="
|
|
337
|
+
class="d-inline-flex d-flex-row d-items-center container default"
|
|
338
338
|
data-id="flex"
|
|
339
339
|
data-test-id="flex"
|
|
340
340
|
>
|
|
@@ -358,7 +358,7 @@ exports[`Label - Snapshot Render with requiredType=asterisk 1`] = `
|
|
|
358
358
|
exports[`Label - Snapshot Render with requiredType=text 1`] = `
|
|
359
359
|
<DocumentFragment>
|
|
360
360
|
<div
|
|
361
|
-
class="
|
|
361
|
+
class="d-inline-flex d-flex-row d-items-center container default"
|
|
362
362
|
data-id="flex"
|
|
363
363
|
data-test-id="flex"
|
|
364
364
|
>
|
|
@@ -382,7 +382,7 @@ exports[`Label - Snapshot Render with requiredType=text 1`] = `
|
|
|
382
382
|
exports[`Label - Snapshot Render with shouldHighlightRequired=true 1`] = `
|
|
383
383
|
<DocumentFragment>
|
|
384
384
|
<div
|
|
385
|
-
class="
|
|
385
|
+
class="d-inline-flex d-flex-row d-items-center container required"
|
|
386
386
|
data-id="flex"
|
|
387
387
|
data-test-id="flex"
|
|
388
388
|
>
|
|
@@ -406,7 +406,7 @@ exports[`Label - Snapshot Render with shouldHighlightRequired=true 1`] = `
|
|
|
406
406
|
exports[`Label - Snapshot Render with size=medium 1`] = `
|
|
407
407
|
<DocumentFragment>
|
|
408
408
|
<div
|
|
409
|
-
class="
|
|
409
|
+
class="d-inline-flex d-flex-row d-items-center container default"
|
|
410
410
|
data-id="flex"
|
|
411
411
|
data-test-id="flex"
|
|
412
412
|
>
|
|
@@ -423,7 +423,7 @@ exports[`Label - Snapshot Render with size=medium 1`] = `
|
|
|
423
423
|
exports[`Label - Snapshot Render with size=small 1`] = `
|
|
424
424
|
<DocumentFragment>
|
|
425
425
|
<div
|
|
426
|
-
class="
|
|
426
|
+
class="d-inline-flex d-flex-row d-items-center container default"
|
|
427
427
|
data-id="flex"
|
|
428
428
|
data-test-id="flex"
|
|
429
429
|
>
|
|
@@ -440,7 +440,7 @@ exports[`Label - Snapshot Render with size=small 1`] = `
|
|
|
440
440
|
exports[`Label - Snapshot Render with tag attributes 1`] = `
|
|
441
441
|
<DocumentFragment>
|
|
442
442
|
<div
|
|
443
|
-
class="
|
|
443
|
+
class="d-inline-flex d-flex-row d-items-center container default"
|
|
444
444
|
data-custom-attr="true"
|
|
445
445
|
data-id="flex"
|
|
446
446
|
data-test-id="flex"
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
exports[`Switch - Snapshot Render with a11y attributes 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
|
-
class="
|
|
6
|
+
class="d-inline-flex d-flex-row d-items-center container medium unChecked enabled"
|
|
7
7
|
data-id="flex"
|
|
8
8
|
data-test-id="flex"
|
|
9
9
|
>
|
|
10
10
|
<div
|
|
11
|
-
class="
|
|
11
|
+
class="d-flex-shrink-0 trackWrapper"
|
|
12
12
|
data-id="flex"
|
|
13
13
|
data-test-id="flex"
|
|
14
14
|
>
|
|
@@ -46,12 +46,12 @@ exports[`Switch - Snapshot Render with a11y attributes 1`] = `
|
|
|
46
46
|
exports[`Switch - Snapshot Render with customClass 1`] = `
|
|
47
47
|
<DocumentFragment>
|
|
48
48
|
<div
|
|
49
|
-
class="
|
|
49
|
+
class="d-inline-flex d-flex-row d-items-center container medium unChecked enabled"
|
|
50
50
|
data-id="flex"
|
|
51
51
|
data-test-id="flex"
|
|
52
52
|
>
|
|
53
53
|
<div
|
|
54
|
-
class="
|
|
54
|
+
class="d-flex-shrink-0 trackWrapper"
|
|
55
55
|
data-id="flex"
|
|
56
56
|
data-test-id="flex"
|
|
57
57
|
>
|
|
@@ -89,13 +89,13 @@ exports[`Switch - Snapshot Render with customClass 1`] = `
|
|
|
89
89
|
exports[`Switch - Snapshot Render with customId and testId 1`] = `
|
|
90
90
|
<DocumentFragment>
|
|
91
91
|
<div
|
|
92
|
-
class="
|
|
92
|
+
class="d-inline-flex d-flex-row d-items-center container medium unChecked enabled"
|
|
93
93
|
data-id="switch-customId"
|
|
94
94
|
data-selector-id="switch-customId"
|
|
95
95
|
data-test-id="switch-testId"
|
|
96
96
|
>
|
|
97
97
|
<div
|
|
98
|
-
class="
|
|
98
|
+
class="d-flex-shrink-0 trackWrapper"
|
|
99
99
|
data-id="flex"
|
|
100
100
|
data-test-id="flex"
|
|
101
101
|
>
|
|
@@ -133,12 +133,12 @@ exports[`Switch - Snapshot Render with customId and testId 1`] = `
|
|
|
133
133
|
exports[`Switch - Snapshot Render with default props 1`] = `
|
|
134
134
|
<DocumentFragment>
|
|
135
135
|
<div
|
|
136
|
-
class="
|
|
136
|
+
class="d-inline-flex d-flex-row d-items-center container medium unChecked enabled"
|
|
137
137
|
data-id="flex"
|
|
138
138
|
data-test-id="flex"
|
|
139
139
|
>
|
|
140
140
|
<div
|
|
141
|
-
class="
|
|
141
|
+
class="d-flex-shrink-0 trackWrapper"
|
|
142
142
|
data-id="flex"
|
|
143
143
|
data-test-id="flex"
|
|
144
144
|
>
|
|
@@ -176,12 +176,12 @@ exports[`Switch - Snapshot Render with default props 1`] = `
|
|
|
176
176
|
exports[`Switch - Snapshot Render with isChecked=true 1`] = `
|
|
177
177
|
<DocumentFragment>
|
|
178
178
|
<div
|
|
179
|
-
class="
|
|
179
|
+
class="d-inline-flex d-flex-row d-items-center container medium checked enabled"
|
|
180
180
|
data-id="flex"
|
|
181
181
|
data-test-id="flex"
|
|
182
182
|
>
|
|
183
183
|
<div
|
|
184
|
-
class="
|
|
184
|
+
class="d-flex-shrink-0 trackWrapper"
|
|
185
185
|
data-id="flex"
|
|
186
186
|
data-test-id="flex"
|
|
187
187
|
>
|
|
@@ -220,12 +220,12 @@ exports[`Switch - Snapshot Render with isChecked=true 1`] = `
|
|
|
220
220
|
exports[`Switch - Snapshot Render with isDisabled=true 1`] = `
|
|
221
221
|
<DocumentFragment>
|
|
222
222
|
<div
|
|
223
|
-
class="
|
|
223
|
+
class="d-inline-flex d-flex-row d-items-center container medium checked disabled"
|
|
224
224
|
data-id="flex"
|
|
225
225
|
data-test-id="flex"
|
|
226
226
|
>
|
|
227
227
|
<div
|
|
228
|
-
class="
|
|
228
|
+
class="d-flex-shrink-0 trackWrapper"
|
|
229
229
|
data-id="flex"
|
|
230
230
|
data-test-id="flex"
|
|
231
231
|
>
|
|
@@ -265,12 +265,12 @@ exports[`Switch - Snapshot Render with isDisabled=true 1`] = `
|
|
|
265
265
|
exports[`Switch - Snapshot Render with tag attributes 1`] = `
|
|
266
266
|
<DocumentFragment>
|
|
267
267
|
<div
|
|
268
|
-
class="
|
|
268
|
+
class="d-inline-flex d-flex-row d-items-center container medium unChecked enabled"
|
|
269
269
|
data-id="flex"
|
|
270
270
|
data-test-id="flex"
|
|
271
271
|
>
|
|
272
272
|
<div
|
|
273
|
-
class="
|
|
273
|
+
class="d-flex-shrink-0 trackWrapper"
|
|
274
274
|
data-id="flex"
|
|
275
275
|
data-test-id="flex"
|
|
276
276
|
>
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _colorHelper = _interopRequireDefault(require("../colorHelper"));
|
|
4
|
+
|
|
5
|
+
var _constants = require("../constants");
|
|
6
|
+
|
|
7
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8
|
+
|
|
9
|
+
var ALL_KEYS = ['bg', 'selectedBg', 'hoverBg', 'focusBg', 'activeBg', 'text', 'selectedText', 'hoverText', 'focusText', 'activeText', 'border', 'selectedBorder', 'hoverBorder', 'focusBorder', 'activeBorder'];
|
|
10
|
+
describe('getPaletteClasses', function () {
|
|
11
|
+
// --- Return shape ---
|
|
12
|
+
it('returns an object with all 15 expected keys', function () {
|
|
13
|
+
var result = (0, _colorHelper["default"])({});
|
|
14
|
+
expect(Object.keys(result)).toEqual(expect.arrayContaining(ALL_KEYS));
|
|
15
|
+
expect(Object.keys(result)).toHaveLength(15);
|
|
16
|
+
}); // --- Default / empty inputs ---
|
|
17
|
+
|
|
18
|
+
it('returns empty strings for all keys when called with no palette or appearance', function () {
|
|
19
|
+
var result = (0, _colorHelper["default"])({});
|
|
20
|
+
ALL_KEYS.forEach(function (key) {
|
|
21
|
+
expect(result[key]).toBe('');
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
it('returns empty strings for all keys when called with undefined arguments', function () {
|
|
25
|
+
var result = (0, _colorHelper["default"])({
|
|
26
|
+
palette: undefined,
|
|
27
|
+
appearance: undefined,
|
|
28
|
+
hoverAppearance: undefined,
|
|
29
|
+
selectedAppearance: undefined
|
|
30
|
+
});
|
|
31
|
+
ALL_KEYS.forEach(function (key) {
|
|
32
|
+
expect(result[key]).toBe('');
|
|
33
|
+
});
|
|
34
|
+
}); // --- Base appearance (bg) ---
|
|
35
|
+
|
|
36
|
+
it('returns a non-empty bg class when palette and appearance.bg=true are provided', function () {
|
|
37
|
+
var result = (0, _colorHelper["default"])({
|
|
38
|
+
palette: 'brand',
|
|
39
|
+
appearance: {
|
|
40
|
+
bg: true
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
expect(result.bg).toBe('bg-brand-80');
|
|
44
|
+
});
|
|
45
|
+
it('returns lighter bg shade when palette is brandLighter and appearance.bg=true', function () {
|
|
46
|
+
var result = (0, _colorHelper["default"])({
|
|
47
|
+
palette: 'brandLighter',
|
|
48
|
+
appearance: {
|
|
49
|
+
bg: true
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
expect(result.bg).toBe('bg-brand-10');
|
|
53
|
+
});
|
|
54
|
+
it('returns correct bg class for info palette', function () {
|
|
55
|
+
var result = (0, _colorHelper["default"])({
|
|
56
|
+
palette: 'info',
|
|
57
|
+
appearance: {
|
|
58
|
+
bg: true
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
expect(result.bg).toBe('bg-blue-80');
|
|
62
|
+
});
|
|
63
|
+
it('returns correct bg class for secondary palette', function () {
|
|
64
|
+
var result = (0, _colorHelper["default"])({
|
|
65
|
+
palette: 'secondary',
|
|
66
|
+
appearance: {
|
|
67
|
+
bg: true
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
expect(result.bg).toBe('bg-grey-65');
|
|
71
|
+
});
|
|
72
|
+
it('returns correct bg class for danger palette', function () {
|
|
73
|
+
var result = (0, _colorHelper["default"])({
|
|
74
|
+
palette: 'danger',
|
|
75
|
+
appearance: {
|
|
76
|
+
bg: true
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
expect(result.bg).toBe('bg-red-70');
|
|
80
|
+
});
|
|
81
|
+
it('returns correct bg class for success palette', function () {
|
|
82
|
+
var result = (0, _colorHelper["default"])({
|
|
83
|
+
palette: 'success',
|
|
84
|
+
appearance: {
|
|
85
|
+
bg: true
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
expect(result.bg).toBe('bg-green-80');
|
|
89
|
+
});
|
|
90
|
+
it('returns correct bg class for warning palette', function () {
|
|
91
|
+
var result = (0, _colorHelper["default"])({
|
|
92
|
+
palette: 'warning',
|
|
93
|
+
appearance: {
|
|
94
|
+
bg: true
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
expect(result.bg).toBe('bg-orange-80');
|
|
98
|
+
}); // --- BG_BORDER_INVALID filtering ---
|
|
99
|
+
|
|
100
|
+
it('returns empty bg when appearance.bg is "black" (BG_BORDER_INVALID)', function () {
|
|
101
|
+
var result = (0, _colorHelper["default"])({
|
|
102
|
+
palette: 'brand',
|
|
103
|
+
appearance: {
|
|
104
|
+
bg: 'black'
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
expect(result.bg).toBe('');
|
|
108
|
+
});
|
|
109
|
+
it('returns empty bg when appearance.bg is "white" (BG_BORDER_INVALID)', function () {
|
|
110
|
+
var result = (0, _colorHelper["default"])({
|
|
111
|
+
palette: 'brand',
|
|
112
|
+
appearance: {
|
|
113
|
+
bg: 'white'
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
expect(result.bg).toBe('');
|
|
117
|
+
});
|
|
118
|
+
it('returns empty border when appearance.border is "black" (BG_BORDER_INVALID)', function () {
|
|
119
|
+
var result = (0, _colorHelper["default"])({
|
|
120
|
+
palette: 'brand',
|
|
121
|
+
appearance: {
|
|
122
|
+
border: 'black'
|
|
123
|
+
}
|
|
124
|
+
}); // border falls back to transparent when borderConfig is null and state is undefined
|
|
125
|
+
|
|
126
|
+
expect(result.border).toBe('border-transparent');
|
|
127
|
+
}); // --- TEXT_INVALID filtering ---
|
|
128
|
+
|
|
129
|
+
it('returns empty text when appearance.text is "transparent" (TEXT_INVALID)', function () {
|
|
130
|
+
var result = (0, _colorHelper["default"])({
|
|
131
|
+
palette: 'brand',
|
|
132
|
+
appearance: {
|
|
133
|
+
text: 'transparent'
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
expect(result.text).toBe('');
|
|
137
|
+
}); // --- Border fallback ---
|
|
138
|
+
|
|
139
|
+
it('returns border-transparent when no border appearance is set and state is base', function () {
|
|
140
|
+
var result = (0, _colorHelper["default"])({
|
|
141
|
+
palette: 'brand',
|
|
142
|
+
appearance: {
|
|
143
|
+
bg: true
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
expect(result.border).toBe('border-transparent');
|
|
147
|
+
});
|
|
148
|
+
it('returns empty hoverBorder when hoverAppearance has no border and bg only', function () {
|
|
149
|
+
var result = (0, _colorHelper["default"])({
|
|
150
|
+
palette: 'brand',
|
|
151
|
+
appearance: {
|
|
152
|
+
bg: true
|
|
153
|
+
},
|
|
154
|
+
hoverAppearance: {
|
|
155
|
+
bg: true
|
|
156
|
+
}
|
|
157
|
+
}); // state is 'hover', no borderConfig → empty string (state branch)
|
|
158
|
+
|
|
159
|
+
expect(result.hoverBorder).toBe('');
|
|
160
|
+
}); // --- Hover appearance ---
|
|
161
|
+
|
|
162
|
+
it('returns hover-state bg classes for hoverAppearance.bg=true with same palette tone', function () {
|
|
163
|
+
var result = (0, _colorHelper["default"])({
|
|
164
|
+
palette: 'brand',
|
|
165
|
+
appearance: {
|
|
166
|
+
bg: true
|
|
167
|
+
},
|
|
168
|
+
hoverAppearance: {
|
|
169
|
+
bg: true
|
|
170
|
+
}
|
|
171
|
+
}); // isContinuingTone is true (same tone, same isLighter), so darker=true → hover shade (100)
|
|
172
|
+
|
|
173
|
+
expect(result.hoverBg).toBe('hover:bg-brand-100');
|
|
174
|
+
expect(result.focusBg).toBe('focus:bg-brand-100');
|
|
175
|
+
expect(result.activeBg).toBe('active:bg-brand-100');
|
|
176
|
+
});
|
|
177
|
+
it('returns hover bg from a different palette tone (no isContinuingTone)', function () {
|
|
178
|
+
var result = (0, _colorHelper["default"])({
|
|
179
|
+
palette: 'brand',
|
|
180
|
+
appearance: {
|
|
181
|
+
bg: true
|
|
182
|
+
},
|
|
183
|
+
hoverAppearance: {
|
|
184
|
+
bg: 'info'
|
|
185
|
+
}
|
|
186
|
+
}); // hoverAppearance.bg='info' → resolveConfig('info', paletteConfig) → PALETTE_CONFIG['info']
|
|
187
|
+
// tone='blue', isLighter=false, isContinuingTone=false → base shade (80)
|
|
188
|
+
|
|
189
|
+
expect(result.hoverBg).toBe('hover:bg-blue-80');
|
|
190
|
+
});
|
|
191
|
+
it('returns empty hover classes when hoverAppearance is not provided', function () {
|
|
192
|
+
var result = (0, _colorHelper["default"])({
|
|
193
|
+
palette: 'brand',
|
|
194
|
+
appearance: {
|
|
195
|
+
bg: true
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
expect(result.hoverBg).toBe('');
|
|
199
|
+
expect(result.focusBg).toBe('');
|
|
200
|
+
expect(result.activeBg).toBe('');
|
|
201
|
+
}); // --- Selected appearance ---
|
|
202
|
+
|
|
203
|
+
it('returns selected-state bg when selectedAppearance.bg=true', function () {
|
|
204
|
+
var result = (0, _colorHelper["default"])({
|
|
205
|
+
palette: 'brand',
|
|
206
|
+
appearance: {
|
|
207
|
+
bg: true
|
|
208
|
+
},
|
|
209
|
+
selectedAppearance: {
|
|
210
|
+
bg: true
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
expect(result.selectedBg).toBe('selected:bg-brand-80');
|
|
214
|
+
});
|
|
215
|
+
it('returns empty selected classes when selectedAppearance is not provided', function () {
|
|
216
|
+
var result = (0, _colorHelper["default"])({
|
|
217
|
+
palette: 'brand',
|
|
218
|
+
appearance: {
|
|
219
|
+
bg: true
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
expect(result.selectedBg).toBe('');
|
|
223
|
+
expect(result.selectedText).toBe('');
|
|
224
|
+
expect(result.selectedBorder).toBe('');
|
|
225
|
+
}); // --- Text classes ---
|
|
226
|
+
|
|
227
|
+
it('returns text class when appearance.text=true and palette has a textTone', function () {
|
|
228
|
+
var result = (0, _colorHelper["default"])({
|
|
229
|
+
palette: 'brand',
|
|
230
|
+
appearance: {
|
|
231
|
+
text: true
|
|
232
|
+
}
|
|
233
|
+
}); // resolveConfig(true, paletteConfig) → { ...paletteConfig, isInherit: true }
|
|
234
|
+
// resolveTextTone: isInherit=true, bgConfig=null (no bg in appearance), uses textTone='brand'
|
|
235
|
+
|
|
236
|
+
expect(result.text).toBe('text-brand-80');
|
|
237
|
+
});
|
|
238
|
+
it('returns filled text tone when bg is present and palette is not lighter', function () {
|
|
239
|
+
var result = (0, _colorHelper["default"])({
|
|
240
|
+
palette: 'info',
|
|
241
|
+
appearance: {
|
|
242
|
+
bg: true,
|
|
243
|
+
text: true
|
|
244
|
+
}
|
|
245
|
+
}); // bgConfig is present (tone='blue', isLighter=false), textConfig.isInherit=true
|
|
246
|
+
// resolveTextTone: not isLighter → filledTextTone='white'
|
|
247
|
+
// getTextClass(undefined, 'white', ...) → TONE_INTENSITY['white'] is undefined
|
|
248
|
+
// → paletteTextStyle['text-white'] → 'text-white'
|
|
249
|
+
|
|
250
|
+
expect(result.text).toBe('text-white');
|
|
251
|
+
});
|
|
252
|
+
it('returns lighter text tone when palette is lighter and bg is present', function () {
|
|
253
|
+
var result = (0, _colorHelper["default"])({
|
|
254
|
+
palette: 'infoLighter',
|
|
255
|
+
appearance: {
|
|
256
|
+
bg: true,
|
|
257
|
+
text: true
|
|
258
|
+
}
|
|
259
|
+
}); // bgConfig.isLighter=true → filledTextTone='blue' → getTextClass for 'blue'
|
|
260
|
+
// TONE_INTENSITY['blue'] = { base: 80, ... } → shade=80
|
|
261
|
+
|
|
262
|
+
expect(result.text).toBe('text-blue-80');
|
|
263
|
+
}); // --- Border classes ---
|
|
264
|
+
|
|
265
|
+
it('returns base border shade when appearance.border=true (isLighter=false)', function () {
|
|
266
|
+
var result = (0, _colorHelper["default"])({
|
|
267
|
+
palette: 'brand',
|
|
268
|
+
appearance: {
|
|
269
|
+
border: true
|
|
270
|
+
}
|
|
271
|
+
}); // tone='brand', isLighter=false, darker=false → shade = intensity.base = 80
|
|
272
|
+
|
|
273
|
+
expect(result.border).toBe('border-brand-80');
|
|
274
|
+
});
|
|
275
|
+
it('returns borderLight shade when appearance.border=true on lighter palette', function () {
|
|
276
|
+
var result = (0, _colorHelper["default"])({
|
|
277
|
+
palette: 'brandLighter',
|
|
278
|
+
appearance: {
|
|
279
|
+
border: true
|
|
280
|
+
}
|
|
281
|
+
}); // tone='brand', isLighter=true, darker=false → shade = intensity.borderLight = 10
|
|
282
|
+
|
|
283
|
+
expect(result.border).toBe('border-brand-10');
|
|
284
|
+
}); // --- Custom tone (not in TONE_INTENSITY) ---
|
|
285
|
+
|
|
286
|
+
it('returns empty bg when appearance.bg uses a tone not in TONE_INTENSITY and not in CSS', function () {
|
|
287
|
+
var result = (0, _colorHelper["default"])({
|
|
288
|
+
appearance: {
|
|
289
|
+
bg: 'custom-tone'
|
|
290
|
+
}
|
|
291
|
+
}); // PALETTE_CONFIG['custom-tone'] is undefined, resolveConfig returns { tone: 'custom-tone', ... }
|
|
292
|
+
// TONE_INTENSITY['custom-tone'] is undefined → looks up paletteBgStyle['bg-custom-tone']
|
|
293
|
+
// That class is not in the CSS file → undefined → falls back to ''
|
|
294
|
+
|
|
295
|
+
expect(result.bg).toBe('');
|
|
296
|
+
}); // --- Each PALETTE_CONFIG key produces a valid (non-error) result ---
|
|
297
|
+
|
|
298
|
+
it.each(Object.keys(_constants.PALETTE_CONFIG))('does not throw for palette "%s" with all appearances set', function (palette) {
|
|
299
|
+
expect(function () {
|
|
300
|
+
(0, _colorHelper["default"])({
|
|
301
|
+
palette: palette,
|
|
302
|
+
appearance: {
|
|
303
|
+
bg: true,
|
|
304
|
+
border: true,
|
|
305
|
+
text: true
|
|
306
|
+
},
|
|
307
|
+
hoverAppearance: {
|
|
308
|
+
bg: true,
|
|
309
|
+
border: true,
|
|
310
|
+
text: true
|
|
311
|
+
},
|
|
312
|
+
selectedAppearance: {
|
|
313
|
+
bg: true,
|
|
314
|
+
border: true,
|
|
315
|
+
text: true
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
}).not.toThrow();
|
|
319
|
+
});
|
|
320
|
+
it.each(Object.keys(_constants.PALETTE_CONFIG))('returns an object with all 15 keys for palette "%s"', function (palette) {
|
|
321
|
+
var result = (0, _colorHelper["default"])({
|
|
322
|
+
palette: palette,
|
|
323
|
+
appearance: {
|
|
324
|
+
bg: true,
|
|
325
|
+
border: true,
|
|
326
|
+
text: true
|
|
327
|
+
},
|
|
328
|
+
hoverAppearance: {
|
|
329
|
+
bg: true
|
|
330
|
+
},
|
|
331
|
+
selectedAppearance: {
|
|
332
|
+
bg: true
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
expect(Object.keys(result)).toHaveLength(15);
|
|
336
|
+
}); // --- Full appearance object (bg + border + text together) ---
|
|
337
|
+
|
|
338
|
+
it('populates bg, text, and border simultaneously when all appearance fields are set', function () {
|
|
339
|
+
var result = (0, _colorHelper["default"])({
|
|
340
|
+
palette: 'brand',
|
|
341
|
+
appearance: {
|
|
342
|
+
bg: true,
|
|
343
|
+
border: true,
|
|
344
|
+
text: true
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
expect(result.bg).not.toBe('');
|
|
348
|
+
expect(result.border).not.toBe('');
|
|
349
|
+
expect(result.text).not.toBe('');
|
|
350
|
+
}); // --- Appearance with bg=false (falsy) ---
|
|
351
|
+
|
|
352
|
+
it('returns empty bg when appearance.bg is false', function () {
|
|
353
|
+
var result = (0, _colorHelper["default"])({
|
|
354
|
+
palette: 'brand',
|
|
355
|
+
appearance: {
|
|
356
|
+
bg: false,
|
|
357
|
+
border: true
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
expect(result.bg).toBe('');
|
|
361
|
+
expect(result.border).not.toBe('');
|
|
362
|
+
});
|
|
363
|
+
});
|