@okta/okta-signin-widget 7.16.0 → 7.16.1

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.
Files changed (246) hide show
  1. package/README.md +5 -5
  2. package/dist/css/fonts.css +172 -0
  3. package/dist/css/okta-sign-in.next.css +1 -240
  4. package/dist/css/okta-sign-in.next.css.map +1 -1
  5. package/dist/esm/src/config/config.json.js +1 -1
  6. package/dist/js/okta-sign-in.classic.js +1 -1
  7. package/dist/js/okta-sign-in.classic.min.js +1 -1
  8. package/dist/js/okta-sign-in.js +1 -1
  9. package/dist/js/okta-sign-in.min.js +1 -1
  10. package/dist/js/okta-sign-in.next.js +61 -19
  11. package/dist/js/okta-sign-in.next.js.map +1 -1
  12. package/dist/js/okta-sign-in.next.no-polyfill.js +60 -18
  13. package/dist/js/okta-sign-in.next.no-polyfill.js.map +1 -1
  14. package/dist/js/okta-sign-in.no-polyfill.min.js +1 -1
  15. package/dist/js/okta-sign-in.oie.js +1 -1
  16. package/dist/js/okta-sign-in.oie.min.js +1 -1
  17. package/package.json +10 -5
  18. package/src/config/config.json +1 -1
  19. package/src/v3/components/AuthCoin/AuthCoin.tsx +15 -17
  20. package/src/v3/components/AuthContainer/AuthContainer.tsx +11 -17
  21. package/src/v3/components/AuthContent/AuthContent.tsx +21 -16
  22. package/src/v3/components/AuthHeader/AuthHeader.tsx +18 -19
  23. package/src/v3/components/AuthenticatorButton/AuthenticatorButton.tsx +116 -77
  24. package/src/v3/components/AuthenticatorButton/AuthenticatorButtonList.tsx +9 -3
  25. package/src/v3/components/Button/Button.tsx +16 -20
  26. package/src/v3/components/CaptchaContainer/CaptchaContainer.tsx +1 -1
  27. package/src/v3/components/Checkbox/Checkbox.tsx +33 -82
  28. package/src/v3/components/ConsentHeader/ConsentHeader.tsx +23 -23
  29. package/src/v3/components/Divider/Divider.tsx +2 -2
  30. package/src/v3/components/Form/Accordion.tsx +15 -36
  31. package/src/v3/components/Form/ElementContainer.tsx +6 -3
  32. package/src/v3/components/Form/Form.tsx +2 -4
  33. package/src/v3/components/Form/Layout.tsx +1 -1
  34. package/src/v3/components/Form/LayoutContainer.tsx +4 -2
  35. package/src/v3/components/Heading/Heading.tsx +7 -5
  36. package/src/v3/components/Icon/CustomAppIcon.tsx +13 -15
  37. package/src/v3/components/Icon/CustomOTPIcon.tsx +5 -10
  38. package/src/v3/components/Icon/DuoIcon.tsx +5 -10
  39. package/src/v3/components/Icon/EmailIcon.tsx +5 -10
  40. package/src/v3/components/Icon/GoogleOTPIcon.tsx +5 -10
  41. package/src/v3/components/Icon/IDPIcon.tsx +5 -10
  42. package/src/v3/components/Icon/OktaVerifyIcon.tsx +0 -7
  43. package/src/v3/components/Icon/OnPremMFAIcon.tsx +5 -10
  44. package/src/v3/components/Icon/PasswordIcon.tsx +5 -10
  45. package/src/v3/components/Icon/PhoneIcon.tsx +5 -10
  46. package/src/v3/components/Icon/RSAIcon.tsx +6 -11
  47. package/src/v3/components/Icon/SecurityKeyOrBiometricsIcon.tsx +5 -10
  48. package/src/v3/components/Icon/SecurityQuestionIcon.tsx +5 -10
  49. package/src/v3/components/Icon/SmartCardIcon.tsx +5 -10
  50. package/src/v3/components/Icon/SymantecIcon.tsx +5 -10
  51. package/src/v3/components/Icon/YubiKeyIcon.tsx +5 -10
  52. package/src/v3/components/Icon/index.tsx +0 -2
  53. package/src/v3/components/IdentifierContainer/IdentifierContainer.tsx +31 -47
  54. package/src/v3/components/Image/Image.tsx +42 -0
  55. package/src/v3/{src/components/CustomPluginsOdysseyCacheProvider → components/Image}/index.tsx +2 -2
  56. package/src/v3/components/ImageWithText/ImageWithText.tsx +7 -4
  57. package/src/v3/components/Images/AppIcon.tsx +16 -46
  58. package/src/v3/components/Images/DeviceIcon.tsx +16 -32
  59. package/src/v3/components/Images/LocationIcon.tsx +16 -26
  60. package/src/v3/components/Images/PhoneIcon.tsx +34 -29
  61. package/src/v3/components/Images/YubikeyDemoImage.tsx +32 -27
  62. package/src/v3/components/Images/index.tsx +0 -1
  63. package/src/v3/components/InfoBox/InfoBox.tsx +12 -12
  64. package/src/v3/components/InfoSection/InfoSection.tsx +20 -14
  65. package/src/v3/components/InformationalText/InformationalText.tsx +16 -6
  66. package/src/v3/components/InputPassword/InputPassword.tsx +31 -164
  67. package/src/v3/components/InputText/InputText.tsx +27 -103
  68. package/src/v3/components/LaunchAuthenticatorButton/LaunchAuthenticatorButton.tsx +14 -26
  69. package/src/v3/components/Link/Link.tsx +8 -20
  70. package/src/v3/components/List/List.tsx +16 -12
  71. package/src/v3/components/PIVButton/PIVButton.tsx +10 -8
  72. package/src/v3/components/PasswordRequirements/Icon.tsx +17 -23
  73. package/src/v3/components/PasswordRequirements/PasswordMatches.tsx +9 -2
  74. package/src/v3/components/PasswordRequirements/PasswordRequirementListItem.tsx +6 -5
  75. package/src/v3/components/PasswordRequirements/PasswordRequirements.tsx +5 -3
  76. package/src/v3/components/PhoneAuthenticator/PhoneAuthenticator.tsx +53 -137
  77. package/src/v3/components/QRCode/QRCode.tsx +27 -20
  78. package/src/v3/components/Radio/Radio.tsx +31 -93
  79. package/src/v3/components/ReminderPrompt/ReminderPrompt.tsx +9 -12
  80. package/src/v3/components/Select/Select.tsx +45 -92
  81. package/src/v3/components/Spinner/Spinner.tsx +6 -8
  82. package/src/v3/components/StepperButton/StepperButton.tsx +6 -10
  83. package/src/v3/components/StepperLink/StepperLink.tsx +1 -1
  84. package/src/v3/components/StepperRadio/StepperRadio.tsx +22 -43
  85. package/src/v3/components/TextWithActionLink/TextWithActionLink.tsx +1 -1
  86. package/src/v3/components/Title/Title.tsx +5 -9
  87. package/src/v3/components/WebAuthNSubmitButton/WebAuthNSubmitButton.tsx +10 -9
  88. package/src/v3/components/Widget/GlobalStyles.tsx +16 -21
  89. package/src/v3/components/Widget/index.tsx +51 -36
  90. package/src/v3/components/Widget/style.scss +295 -0
  91. package/src/v3/components/WidgetMessageContainer/WidgetMessageContainer.tsx +11 -8
  92. package/src/v3/components/hocs/withFormValidationState.tsx +2 -5
  93. package/src/v3/jest.config.js +1 -0
  94. package/src/v3/jest.setup.js +1 -0
  95. package/src/v3/package.json +11 -7
  96. package/src/v3/screenshots/base/UI_demo/UI_demo_RTL_VRT.png +0 -0
  97. package/src/v3/screenshots/base/UI_demo/UI_demo_VRT.png +0 -0
  98. package/src/v3/src/components/AuthCoin/AuthCoin.tsx +15 -17
  99. package/src/v3/src/components/AuthCoin/__snapshots__/AuthCoin.test.tsx.snap +20 -47
  100. package/src/v3/src/components/AuthContainer/AuthContainer.tsx +11 -17
  101. package/src/v3/src/components/AuthContent/AuthContent.tsx +21 -16
  102. package/src/v3/src/components/AuthHeader/AuthHeader.tsx +18 -19
  103. package/src/v3/src/components/AuthenticatorButton/AuthenticatorButton.tsx +116 -77
  104. package/src/v3/src/components/AuthenticatorButton/AuthenticatorButtonList.tsx +9 -3
  105. package/src/v3/src/components/Button/Button.tsx +16 -20
  106. package/src/v3/src/components/CaptchaContainer/CaptchaContainer.tsx +1 -1
  107. package/src/v3/src/components/Checkbox/Checkbox.tsx +33 -82
  108. package/src/v3/src/components/ConsentHeader/ConsentHeader.tsx +23 -23
  109. package/src/v3/src/components/Divider/Divider.tsx +2 -2
  110. package/src/v3/src/components/Form/Accordion.tsx +15 -36
  111. package/src/v3/src/components/Form/ElementContainer.tsx +6 -3
  112. package/src/v3/src/components/Form/Form.tsx +2 -4
  113. package/src/v3/src/components/Form/Layout.tsx +1 -1
  114. package/src/v3/src/components/Form/LayoutContainer.tsx +4 -2
  115. package/src/v3/src/components/Heading/Heading.tsx +7 -5
  116. package/src/v3/src/components/Icon/CustomAppIcon.tsx +13 -15
  117. package/src/v3/src/components/Icon/CustomOTPIcon.tsx +5 -10
  118. package/src/v3/src/components/Icon/DuoIcon.tsx +5 -10
  119. package/src/v3/src/components/Icon/EmailIcon.tsx +5 -10
  120. package/src/v3/src/components/Icon/GoogleOTPIcon.tsx +5 -10
  121. package/src/v3/src/components/Icon/IDPIcon.tsx +5 -10
  122. package/src/v3/src/components/Icon/OktaVerifyIcon.tsx +0 -7
  123. package/src/v3/src/components/Icon/OnPremMFAIcon.tsx +5 -10
  124. package/src/v3/src/components/Icon/PasswordIcon.tsx +5 -10
  125. package/src/v3/src/components/Icon/PhoneIcon.tsx +5 -10
  126. package/src/v3/src/components/Icon/RSAIcon.tsx +6 -11
  127. package/src/v3/src/components/Icon/SecurityKeyOrBiometricsIcon.tsx +5 -10
  128. package/src/v3/src/components/Icon/SecurityQuestionIcon.tsx +5 -10
  129. package/src/v3/src/components/Icon/SmartCardIcon.tsx +5 -10
  130. package/src/v3/src/components/Icon/SymantecIcon.tsx +5 -10
  131. package/src/v3/src/components/Icon/YubiKeyIcon.tsx +5 -10
  132. package/src/v3/src/components/Icon/index.tsx +0 -2
  133. package/src/v3/src/components/IdentifierContainer/IdentifierContainer.tsx +31 -47
  134. package/src/v3/src/components/Image/Image.tsx +42 -0
  135. package/src/v3/{components/CustomPluginsOdysseyCacheProvider → src/components/Image}/index.tsx +2 -2
  136. package/src/v3/src/components/ImageWithText/ImageWithText.tsx +7 -4
  137. package/src/v3/src/components/Images/AppIcon.tsx +16 -46
  138. package/src/v3/src/components/Images/DeviceIcon.tsx +16 -32
  139. package/src/v3/src/components/Images/LocationIcon.tsx +16 -26
  140. package/src/v3/src/components/Images/PhoneIcon.tsx +34 -29
  141. package/src/v3/src/components/Images/YubikeyDemoImage.tsx +32 -27
  142. package/src/v3/src/components/Images/index.tsx +0 -1
  143. package/src/v3/src/components/InfoBox/InfoBox.tsx +12 -12
  144. package/src/v3/src/components/InfoSection/InfoSection.tsx +20 -14
  145. package/src/v3/src/components/InformationalText/InformationalText.tsx +16 -6
  146. package/src/v3/src/components/InputPassword/InputPassword.tsx +31 -164
  147. package/src/v3/src/components/InputText/InputText.tsx +27 -103
  148. package/src/v3/src/components/LaunchAuthenticatorButton/LaunchAuthenticatorButton.tsx +14 -26
  149. package/src/v3/src/components/Link/Link.tsx +8 -20
  150. package/src/v3/src/components/List/List.tsx +16 -12
  151. package/src/v3/src/components/PIVButton/PIVButton.tsx +10 -8
  152. package/src/v3/src/components/PasswordRequirements/Icon.tsx +17 -23
  153. package/src/v3/src/components/PasswordRequirements/PasswordMatches.tsx +9 -2
  154. package/src/v3/src/components/PasswordRequirements/PasswordRequirementListItem.tsx +6 -5
  155. package/src/v3/src/components/PasswordRequirements/PasswordRequirements.tsx +5 -3
  156. package/src/v3/src/components/PhoneAuthenticator/PhoneAuthenticator.tsx +53 -137
  157. package/src/v3/src/components/QRCode/QRCode.tsx +27 -20
  158. package/src/v3/src/components/Radio/Radio.tsx +31 -93
  159. package/src/v3/src/components/ReminderPrompt/ReminderPrompt.tsx +9 -12
  160. package/src/v3/src/components/ReminderPrompt/__snapshots__/ReminderPrompt.test.tsx.snap +37 -17
  161. package/src/v3/src/components/Select/Select.tsx +45 -92
  162. package/src/v3/src/components/Spinner/Spinner.tsx +6 -8
  163. package/src/v3/src/components/StepperButton/StepperButton.tsx +6 -10
  164. package/src/v3/src/components/StepperLink/StepperLink.tsx +1 -1
  165. package/src/v3/src/components/StepperRadio/StepperRadio.tsx +22 -43
  166. package/src/v3/src/components/TextWithActionLink/TextWithActionLink.tsx +1 -1
  167. package/src/v3/src/components/Title/Title.tsx +5 -9
  168. package/src/v3/src/components/WebAuthNSubmitButton/WebAuthNSubmitButton.tsx +10 -9
  169. package/src/v3/src/components/Widget/GlobalStyles.tsx +16 -21
  170. package/src/v3/src/components/Widget/index.tsx +51 -36
  171. package/src/v3/src/components/Widget/style.scss +295 -0
  172. package/src/v3/src/components/WidgetMessageContainer/WidgetMessageContainer.tsx +11 -8
  173. package/src/v3/src/components/hocs/withFormValidationState.tsx +2 -5
  174. package/src/v3/src/transformer/button/__snapshots__/transformIDPButtons.test.ts.snap +0 -2
  175. package/src/v3/src/transformer/i18n/__snapshots__/transformAuthenticatorButton.test.ts.snap +4 -4
  176. package/src/v3/src/transformer/i18n/transformAuthenticatorButton.test.ts +3 -3
  177. package/src/v3/src/transformer/i18n/transformAuthenticatorButton.ts +18 -2
  178. package/src/v3/src/transformer/layout/development/transformEnumerateComponents.ts +72 -5
  179. package/src/v3/src/transformer/layout/idp/__snapshots__/transformIdpRedirect.test.ts.snap +4 -4
  180. package/src/v3/src/transformer/selectAuthenticator/__snapshots__/transformSelectAuthenticatorVerify.test.ts.snap +0 -3
  181. package/src/v3/src/transformer/selectAuthenticator/__snapshots__/transformSelectOVCustomAppMethodVerify.test.ts.snap +0 -1
  182. package/src/v3/src/transformer/selectAuthenticator/__snapshots__/utils.test.ts.snap +163 -42
  183. package/src/v3/src/transformer/selectAuthenticator/transformSelectAuthenticatorEnroll.ts +7 -1
  184. package/src/v3/src/transformer/selectAuthenticator/transformSelectAuthenticatorVerify.ts +0 -1
  185. package/src/v3/src/transformer/selectAuthenticator/transformSelectOVCustomAppMethodVerify.ts +0 -1
  186. package/src/v3/src/transformer/selectAuthenticator/utils.test.ts +117 -39
  187. package/src/v3/src/transformer/selectAuthenticator/utils.ts +102 -58
  188. package/src/v3/src/transformer/terminal/transformEmailMagicLinkOTPOnlyElements.ts +1 -3
  189. package/src/v3/src/transformer/uischema/transform.test.ts +0 -6
  190. package/src/v3/src/transformer/uischema/transform.ts +0 -2
  191. package/src/v3/src/{components/FieldLevelMessageContainer/index.tsx → types/image.ts} +10 -3
  192. package/src/v3/src/types/index.ts +1 -0
  193. package/src/v3/src/types/schema.ts +2 -1
  194. package/src/v3/src/types/widget.ts +3 -3
  195. package/src/v3/src/util/buildFieldLevelErrorMessages.ts +48 -0
  196. package/src/v3/src/util/formUtils.ts +5 -17
  197. package/src/v3/src/util/htmlContentParserUtils.tsx +3 -1
  198. package/src/v3/src/util/index.ts +2 -0
  199. package/src/v3/src/util/isLtrField.ts +22 -0
  200. package/src/v3/src/util/languageUtils.ts +14 -0
  201. package/src/v3/src/util/leonardo.d.ts +571 -0
  202. package/src/v3/src/util/mergeThemes.test.tsx +20 -7
  203. package/src/v3/src/util/mergeThemes.ts +32 -1
  204. package/src/v3/src/util/stylisPlugins.ts +21 -0
  205. package/src/v3/src/util/theme.test.ts +63 -187
  206. package/src/v3/src/util/theme.ts +274 -247
  207. package/src/v3/svgo.config.js +0 -6
  208. package/src/v3/transformer/i18n/transformAuthenticatorButton.ts +18 -2
  209. package/src/v3/transformer/layout/development/transformEnumerateComponents.ts +72 -5
  210. package/src/v3/transformer/selectAuthenticator/transformSelectAuthenticatorEnroll.ts +7 -1
  211. package/src/v3/transformer/selectAuthenticator/transformSelectAuthenticatorVerify.ts +0 -1
  212. package/src/v3/transformer/selectAuthenticator/transformSelectOVCustomAppMethodVerify.ts +0 -1
  213. package/src/v3/transformer/selectAuthenticator/utils.ts +102 -58
  214. package/src/v3/transformer/terminal/transformEmailMagicLinkOTPOnlyElements.ts +1 -3
  215. package/src/v3/transformer/uischema/transform.ts +0 -2
  216. package/src/v3/tsconfig.base.json +3 -0
  217. package/src/v3/{components/FieldLevelMessageContainer/index.tsx → types/image.ts} +10 -3
  218. package/src/v3/types/index.ts +1 -0
  219. package/src/v3/types/schema.ts +2 -1
  220. package/src/v3/types/widget.ts +3 -3
  221. package/src/v3/util/buildFieldLevelErrorMessages.ts +48 -0
  222. package/src/v3/util/formUtils.ts +5 -17
  223. package/src/v3/util/htmlContentParserUtils.tsx +3 -1
  224. package/src/v3/util/index.ts +2 -0
  225. package/src/v3/util/isLtrField.ts +22 -0
  226. package/src/v3/util/languageUtils.ts +14 -0
  227. package/src/v3/util/leonardo.d.ts +571 -0
  228. package/src/v3/util/mergeThemes.ts +32 -1
  229. package/src/v3/util/stylisPlugins.ts +21 -0
  230. package/src/v3/util/theme.ts +274 -247
  231. package/src/v3/components/CustomPluginsOdysseyCacheProvider/CustomPluginsOdysseyCacheProvider.tsx +0 -66
  232. package/src/v3/components/FieldLevelMessageContainer/FieldLevelMessageContainer.tsx +0 -55
  233. package/src/v3/components/Icon/CheckCircle.tsx +0 -30
  234. package/src/v3/components/Icon/RightArrowIcon.tsx +0 -30
  235. package/src/v3/components/Images/MobileDeviceIcon.tsx +0 -38
  236. package/src/v3/components/Widget/style.css +0 -181
  237. package/src/v3/src/components/CustomPluginsOdysseyCacheProvider/CustomPluginsOdysseyCacheProvider.tsx +0 -66
  238. package/src/v3/src/components/FieldLevelMessageContainer/FieldLevelMessageContainer.tsx +0 -55
  239. package/src/v3/src/components/Icon/CheckCircle.tsx +0 -30
  240. package/src/v3/src/components/Icon/RightArrowIcon.tsx +0 -30
  241. package/src/v3/src/components/Images/MobileDeviceIcon.tsx +0 -38
  242. package/src/v3/src/components/Widget/style.css +0 -181
  243. package/src/v3/src/transformer/uischema/setLtrFields.ts +0 -41
  244. package/src/v3/src/util/designTokens.ts +0 -249
  245. package/src/v3/transformer/uischema/setLtrFields.ts +0 -41
  246. package/src/v3/util/designTokens.ts +0 -249
@@ -0,0 +1,571 @@
1
+ /*
2
+ * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
+ *
5
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
+ * Unless required by applicable law or agreed to in writing, software
7
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
+ *
10
+ * See the License for the specific language governing permissions and limitations under the License.
11
+ */
12
+
13
+ /* eslint-disable max-classes-per-file */
14
+ declare module '@adobe/leonardo-contrast-colors' {
15
+ import type ChromaJs from 'chroma-js';
16
+
17
+ type ColorTuple = [number, number, number];
18
+
19
+ /**
20
+ * Supported colorspaces from the {@link https://www.w3.org/TR/css-color-4/ W3C CSS Color Module Level 4} spec.
21
+ * @example '#RRGGBB' // HEX
22
+ * @example 'rgb(255 255 255)' // RGB
23
+ * @example 'hsl(360deg 0% 100%)' // HSL
24
+ * @example 'hsv(360deg 0% 100%)' // HSV
25
+ * @example 'hsluv(360 0 100)' // HSLuv
26
+ * @example 'lab(100% 0 0)' // LAB
27
+ * @example 'lch(100% 0 360deg)' // LCH
28
+ * @example 'oklab(100% 0 0)' // OKLAB
29
+ * @example 'oklch(100% 0 360deg)' // OKLCH
30
+ * @example 'jab(100% 0 0)' // CAM02
31
+ * @example 'jch(100% 0 360deg)' // CAM02p
32
+ */
33
+ type Colorspace =
34
+ | 'HEX'
35
+ | 'RGB'
36
+ | 'HSL'
37
+ | 'HSV'
38
+ | 'HSLuv'
39
+ | 'LAB'
40
+ | 'LCH'
41
+ | 'OKLAB'
42
+ | 'OKLCH'
43
+ | 'CAM02'
44
+ | 'CAM02p';
45
+
46
+ /**
47
+ * Supported interpolation colorspaces from the {@link https://www.w3.org/TR/css-color-4/ W3C CSS Color Module Level 4} spec.
48
+ * @example 'rgb(255 255 255)' // RGB
49
+ * @example 'hsl(360deg 0% 100%)' // HSL
50
+ * @example 'hsv(360deg 0% 100%)' // HSV
51
+ * @example 'hsluv(360 0 100)' // HSLuv
52
+ * @example 'lab(100% 0 0)' // LAB
53
+ * @example 'lch(100% 0 360deg)' // LCH
54
+ * @example 'oklab(100% 0 0)' // OKLAB
55
+ * @example 'oklch(100% 0 360deg)' // OKLCH
56
+ * @example 'jab(100% 0 0)' // CAM02
57
+ * @example 'jch(100% 0 360deg)' // CAM02p
58
+ */
59
+ type InterpolationColorspace = Exclude<Colorspace, 'HEX'>;
60
+
61
+ type RGBArray = ColorTuple;
62
+
63
+ interface ColorBase {
64
+ /**
65
+ * User-defined name for a color, (eg "Blue"). Used to name output color values.
66
+ */
67
+ name: string
68
+ /**
69
+ * List of specific colors to interpolate between in order to generate a full lightness scale of the color.
70
+ * @remarks Strings are passed to {@link ChromaJs.valid}
71
+ */
72
+ colorKeys: CssColor[]
73
+ /**
74
+ * The colorspace in which the key colors will be interpolated.
75
+ */
76
+ colorspace?: InterpolationColorspace
77
+ /**
78
+ * List of target contrast ratios, or object with named keys for each value.
79
+ * @see {@link RatiosArray}, {@link RatiosObject}
80
+ */
81
+ ratios: RatiosArray | RatiosObject
82
+ /**
83
+ * Applies bezier smoothing to interpolation.
84
+ */
85
+ smooth?: boolean
86
+ /**
87
+ * Desired color output format.
88
+ */
89
+ output?: Colorspace
90
+ saturation?: number
91
+ }
92
+
93
+ export class Color implements Required<ColorBase> {
94
+ constructor({
95
+ name, colorKeys, colorspace, ratios, smooth, output, saturation,
96
+ }: ColorBase)
97
+ name: string;
98
+
99
+ colorKeys: CssColor[];
100
+
101
+ colorspace: InterpolationColorspace;
102
+
103
+ ratios: RatiosArray | RatiosObject;
104
+
105
+ smooth: boolean;
106
+
107
+ output: Colorspace;
108
+
109
+ saturation: number;
110
+
111
+ readonly colorScale: ChromaJs.Scale;
112
+ }
113
+
114
+ export class BackgroundColor extends Color {
115
+ readonly backgroundColorScale: ChromaJs.Scale;
116
+ }
117
+ /**
118
+ * @see {@link https://www.w3.org/TR/WCAG22/#contrast-minimum}
119
+ * @see {@link https://www.w3.org/TR/wcag-3.0/#visual-contrast-of-text}
120
+ */
121
+ type ContrastFormula = 'wcag2' | 'wcag3';
122
+ type LightnessDistribution = 'linear' | 'polynomial';
123
+
124
+ interface UpdateColorOptions extends Partial<ColorBase> {
125
+ /**
126
+ * The current name of the color to be updated.
127
+ */
128
+ color: string
129
+ /**
130
+ * A new name for the color.
131
+ */
132
+ name?: string
133
+ }
134
+
135
+ export class Theme implements Required<ThemeBase> {
136
+ constructor({
137
+ colors,
138
+ backgroundColor,
139
+ lightness,
140
+ /**
141
+ * @default 1
142
+ */
143
+ contrast,
144
+ /**
145
+ * @default 100
146
+ */
147
+ saturation,
148
+ /**
149
+ * @default 'HEX'
150
+ */
151
+ output,
152
+ /** @default 'wcag2' */
153
+ formula,
154
+ }: ThemeBase)
155
+
156
+ colors: Color[];
157
+
158
+ backgroundColor: BackgroundColor;
159
+
160
+ lightness: number;
161
+
162
+ contrast: number;
163
+
164
+ output: Colorspace;
165
+
166
+ saturation: number;
167
+
168
+ formula: ContrastFormula;
169
+
170
+ readonly backgroundColorValue: number;
171
+
172
+ /**
173
+ * Each color is an object named by user-defined value (eg `name: 'gray'`). `values` array consists of all generated color values for the color, with properties name, contrast, and value.
174
+ * @example
175
+ * [
176
+ { background: "#e0e0e0" },
177
+ {
178
+ name: 'gray',
179
+ values: [
180
+ {name: "gray100", contrast: 1, value: "#e0e0e0"},
181
+ {name: "gray200", contrast: 2, value: "#a0a0a0"},
182
+ {name: "gray300", contrast: 3, value: "#808080"},
183
+ {name: "gray400", contrast: 4.5, value: "#646464"}
184
+ ]
185
+ },
186
+ {
187
+ name: 'blue',
188
+ values: [
189
+ {name: "blue100", contrast: 2, value: "#b18cff"},
190
+ {name: "blue200", contrast: 3, value: "#8d63ff"},
191
+ {name: "blue300", contrast: 4.5, value: "#623aff"},
192
+ {name: "blue400", contrast: 8, value: "#1c0ad1"}
193
+ ]
194
+ }
195
+ ]
196
+ */
197
+ readonly contrastColors: [
198
+ ContrastColorBackground,
199
+ ...ContrastColor[],
200
+ ];
201
+
202
+ /**
203
+ * Simplified format as an object of key-value pairs. Property is equal to the {@link RatiosArray generated} or {@link RatiosObject user-defined name} for each generated value.
204
+ * @example {
205
+ * "gray100": "#e0e0e0",
206
+ * "gray200": "#a0a0a0",
207
+ * "gray300": "#808080",
208
+ * "gray400": "#646464",
209
+ * "blue100": "#b18cff",
210
+ * "blue200": "#8d63ff",
211
+ * "blue300": "#623aff",
212
+ * "blue400": "#1c0ad1"
213
+ * }
214
+ */
215
+ readonly contrastColorPairs: Record<string, CssColor>;
216
+
217
+ /**
218
+ * All color values in a flat array.
219
+ * @example [ "#e0e0e0", "#a0a0a0", "#808080", "#646464", "#b18cff", "#8d63ff", "#623aff", "#1c0ad1" ]
220
+ */
221
+ readonly contrastColorValues: CssColor[];
222
+
223
+ /**
224
+ * Add a {@link Color} to the theme
225
+ * @example ```
226
+ * const red = new Color({...})
227
+ * theme.addColor = red;
228
+ * ```
229
+ */
230
+ set addColor(arg: Color)
231
+ /**
232
+ * Remove a {@link Color} from an existing theme. Accepts an object with the Color's name and value, or by passing the Color class itself.
233
+ * @example ```
234
+ * // Remove via color name
235
+ theme.removeColor = {name: 'Red'};
236
+ * ```
237
+ * @example ```
238
+ * // Remove via Color class
239
+ * const red = new Color({...})
240
+ * theme.removeColor = red;
241
+ * ```
242
+ */
243
+ set removeColor(arg: Color | { name: string })
244
+ /**
245
+ * Update a {@link Color} via its setters from the theme. Accepts an object with the name of the color you wish to modify, followed by the property and the new value you wish to modify.
246
+ * @example ```
247
+ * // Change the colors ratios
248
+ * theme.updateColor = {name: 'red', ratios: [3, 4.5, 7]};
249
+ * ```
250
+ * @example ```
251
+ * // Change the colors colorKeys
252
+ * theme.updateColor = {name: 'red', colorKeys: ['#ff0000']};
253
+ * ```
254
+ * @example ```
255
+ * // Change the color's name
256
+ * theme.updateColor = {name: 'red', name: 'Crimson'};
257
+ * ```
258
+ */
259
+ set updateColor(arg: UpdateColorOptions | UpdateColorOptions[])
260
+ }
261
+
262
+ /**
263
+ * When passing a flat array of target ratios, the output colors in your Theme will be generated by concatenating the color name (eg "Blue") with numeric increments. Colors with a positive contrast ratio with the base (ie, 2:1) will be named in increments of 100. For example, `gray100`, `gray200`.
264
+ *
265
+ * Colors with a negative contrast ratio with the base (ie -2:1) will be named in increments less than 100 and based on the number of negative values declared. For example, if there are 3 negative values `[-1.4, -1.3, -1.2, 1, 2, 3]`, the name for those values will be incremented by 100/4 (length plus one to avoid a `0` value), such as `gray25`, `gray50`, and `gray75`.
266
+ * @example ```
267
+ * new Color({
268
+ name: 'blue',
269
+ colorKeys: ['#5CDBFF', '#0000FF'],
270
+ colorSpace: 'LCH',
271
+ ratios: [3, 4.5]
272
+ });
273
+ // Returns:
274
+ [
275
+ {
276
+ name: 'blue',
277
+ values: [
278
+ {name: "blue100", contrast: 3, value: "#8d63ff"},
279
+ {name: "blue200", contrast: 4.5, value: "#623aff"}
280
+ ]
281
+ }
282
+ ]
283
+ ```
284
+ */
285
+ type RatiosArray = number[];
286
+
287
+ /**
288
+ * When defining ratios as an object with key-value pairs, you define what name will be output in your Leonardo theme.
289
+ * @example ```
290
+ * new Color({
291
+ name: 'blue',
292
+ colorKeys: ['#5CDBFF', '#0000FF'],
293
+ colorSpace: 'LCH',
294
+ ratios: {
295
+ 'blue--largeText': 3,
296
+ 'blue--normalText': 4.5
297
+ }
298
+ });
299
+ // Returns:
300
+ [
301
+ {
302
+ name: 'blue',
303
+ values: [
304
+ {name: "blue--largeText", contrast: 3, value: "#8d63ff"},
305
+ {name: "blue--normalText", contrast: 4.5, value: "#623aff"}
306
+ ]
307
+ }
308
+ ]
309
+ * ```
310
+ */
311
+ type RatiosObject = Record<string, number>;
312
+
313
+ interface ContrastColorBackground {
314
+ background: CssColor
315
+ }
316
+
317
+ interface ContrastColor {
318
+ name: string
319
+ values: ContrastColorValue[]
320
+ }
321
+
322
+ interface ContrastColorValue {
323
+ name: string,
324
+ contrast: number
325
+ value: CssColor
326
+ }
327
+
328
+ interface ThemeBase {
329
+ /**
330
+ * List of {@link Color} classes to generate theme colors for.
331
+ */
332
+ colors: Color[]
333
+ /**
334
+ * A single {@link BackgroundColor} class is required.
335
+ */
336
+ backgroundColor: BackgroundColor
337
+ /**
338
+ * Value from 0-100 for desired lightness of generated theme background color (whole number).
339
+ */
340
+ lightness: number
341
+ /**
342
+ * Multiplier to increase or decrease contrast for all theme colors.
343
+ */
344
+ contrast?: number
345
+ /**
346
+ * Value from 0-100 for decreasing saturation of all theme colors.
347
+ */
348
+ saturation?: number
349
+ /**
350
+ * Desired color output format.
351
+ */
352
+ output?: Colorspace
353
+ formula?: ContrastFormula
354
+ }
355
+
356
+ /**
357
+ * A valid CSS color.
358
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/color_value}
359
+ */
360
+ type CssColor = RgbHexColor | RgbColor | HslColor | HsvColor | HsluvColor | LabColor | LchColor
361
+ | OkLabColor | OkLchColor | Cam02Color | Cam02pColor | CssColorName;
362
+
363
+ /**
364
+ * A string representing a CSS hexadecimal RGB color.
365
+ * @example '#ff0000'
366
+ * @example '#369'
367
+ * @remarks Significantly more permissive than hex colors are, but probably the safest solution given the current limitations of Typescript's string literals.
368
+ */
369
+ type RgbHexColor = `#${string}`;
370
+ /**
371
+ * A CSS RGB color function.
372
+ * @example 'rgb(255 255 255)'
373
+ */
374
+ type RgbColor = `rgb(${number} ${number} ${number})`;
375
+ /**
376
+ * A CSS HSL color function.
377
+ * @example 'hsl(360deg 0% 100%)'
378
+ */
379
+ type HslColor = `hsl(${Degrees} ${Percent} ${Percent})`;
380
+
381
+ /**
382
+ * @example 'hsv(360deg 0% 100%)'
383
+ */
384
+ type HsvColor = `hsv(${Degrees} ${Percent} ${Percent})`;
385
+
386
+ /**
387
+ * @example 'hsluv(360 0 100)'
388
+ */
389
+ type HsluvColor = `hsluv(${number} ${number} ${number})`;
390
+
391
+ /**
392
+ * @example 'lab(100% 0 0)'
393
+ */
394
+ type LabColor = `lab(${Percent} ${number} ${number})`;
395
+
396
+ /**
397
+ * @example 'lch(100% 0 360deg)'
398
+ */
399
+ type LchColor = `lch(${Percent} ${number} ${Degrees})`;
400
+
401
+ /**
402
+ * @example 'oklab(100% 0 0)'
403
+ */
404
+ type OkLabColor = `oklab(${Percent} ${number} ${number})`;
405
+
406
+ /**
407
+ * @example 'oklch(100% 0 360deg)'
408
+ */
409
+ type OkLchColor = `oklch(${Percent} ${number} ${Degrees})`;
410
+
411
+ /**
412
+ * @example 'jab(100% 0 0)'
413
+ */
414
+ type Cam02Color = `jab(${Percent} ${number} ${number})`;
415
+
416
+ /**
417
+ * @example 'jch(100% 0 360deg)'
418
+ */
419
+ type Cam02pColor = `jch(${Percent} ${number} ${Degrees})`;
420
+ type Percent = `${number}%`;
421
+ type Degrees = `${number}deg`;
422
+
423
+ type CssColorName = 'aliceblue' |
424
+ 'antiquewhite' |
425
+ 'aqua' |
426
+ 'aquamarine' |
427
+ 'azure' |
428
+ 'beige' |
429
+ 'bisque' |
430
+ 'black' |
431
+ 'blanchedalmond' |
432
+ 'blue' |
433
+ 'blueviolet' |
434
+ 'brown' |
435
+ 'burlywood' |
436
+ 'cadetblue' |
437
+ 'chartreuse' |
438
+ 'chocolate' |
439
+ 'coral' |
440
+ 'cornflowerblue' |
441
+ 'cornsilk' |
442
+ 'crimson' |
443
+ 'cyan' |
444
+ 'darkblue' |
445
+ 'darkcyan' |
446
+ 'darkgoldenrod' |
447
+ 'darkgray' |
448
+ 'darkgreen' |
449
+ 'darkgrey' |
450
+ 'darkkhaki' |
451
+ 'darkmagenta' |
452
+ 'darkolivegreen' |
453
+ 'darkorange' |
454
+ 'darkorchid' |
455
+ 'darkred' |
456
+ 'darksalmon' |
457
+ 'darkseagreen' |
458
+ 'darkslateblue' |
459
+ 'darkslategray' |
460
+ 'darkslategrey' |
461
+ 'darkturquoise' |
462
+ 'darkviolet' |
463
+ 'deeppink' |
464
+ 'deepskyblue' |
465
+ 'dimgray' |
466
+ 'dimgrey' |
467
+ 'dodgerblue' |
468
+ 'firebrick' |
469
+ 'floralwhite' |
470
+ 'forestgreen' |
471
+ 'fuchsia' |
472
+ 'gainsboro' |
473
+ 'ghostwhite' |
474
+ 'goldenrod' |
475
+ 'gold' |
476
+ 'gray' |
477
+ 'green' |
478
+ 'greenyellow' |
479
+ 'grey' |
480
+ 'honeydew' |
481
+ 'hotpink' |
482
+ 'indianred' |
483
+ 'indigo' |
484
+ 'ivory' |
485
+ 'khaki' |
486
+ 'lavenderblush' |
487
+ 'lavender' |
488
+ 'lawngreen' |
489
+ 'lemonchiffon' |
490
+ 'lightblue' |
491
+ 'lightcoral' |
492
+ 'lightcyan' |
493
+ 'lightgoldenrodyellow' |
494
+ 'lightgray' |
495
+ 'lightgreen' |
496
+ 'lightgrey' |
497
+ 'lightpink' |
498
+ 'lightsalmon' |
499
+ 'lightseagreen' |
500
+ 'lightskyblue' |
501
+ 'lightslategray' |
502
+ 'lightslategrey' |
503
+ 'lightsteelblue' |
504
+ 'lightyellow' |
505
+ 'lime' |
506
+ 'limegreen' |
507
+ 'linen' |
508
+ 'magenta' |
509
+ 'maroon' |
510
+ 'mediumaquamarine' |
511
+ 'mediumblue' |
512
+ 'mediumorchid' |
513
+ 'mediumpurple' |
514
+ 'mediumseagreen' |
515
+ 'mediumslateblue' |
516
+ 'mediumspringgreen' |
517
+ 'mediumturquoise' |
518
+ 'mediumvioletred' |
519
+ 'midnightblue' |
520
+ 'mintcream' |
521
+ 'mistyrose' |
522
+ 'moccasin' |
523
+ 'navajowhite' |
524
+ 'navy' |
525
+ 'oldlace' |
526
+ 'olive' |
527
+ 'olivedrab' |
528
+ 'orange' |
529
+ 'orangered' |
530
+ 'orchid' |
531
+ 'palegoldenrod' |
532
+ 'palegreen' |
533
+ 'paleturquoise' |
534
+ 'palevioletred' |
535
+ 'papayawhip' |
536
+ 'peachpuff' |
537
+ 'peru' |
538
+ 'pink' |
539
+ 'plum' |
540
+ 'powderblue' |
541
+ 'purple' |
542
+ 'rebeccapurple' |
543
+ 'red' |
544
+ 'rosybrown' |
545
+ 'royalblue' |
546
+ 'saddlebrown' |
547
+ 'salmon' |
548
+ 'sandybrown' |
549
+ 'seagreen' |
550
+ 'seashell' |
551
+ 'sienna' |
552
+ 'silver' |
553
+ 'skyblue' |
554
+ 'slateblue' |
555
+ 'slategray' |
556
+ 'slategrey' |
557
+ 'snow' |
558
+ 'springgreen' |
559
+ 'steelblue' |
560
+ 'tan' |
561
+ 'teal' |
562
+ 'thistle' |
563
+ 'tomato' |
564
+ 'turquoise' |
565
+ 'violet' |
566
+ 'wheat' |
567
+ 'white' |
568
+ 'whitesmoke' |
569
+ 'yellow' |
570
+ 'yellowgreen';
571
+ }
@@ -10,13 +10,16 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { CSSObject, TextField, ThemeProvider } from '@mui/material';
14
- import { odysseyTheme } from '@okta/odyssey-react-mui';
13
+ import { CSSObject, TextField } from '@mui/material';
14
+ import * as Tokens from '@okta/odyssey-design-tokens';
15
+ import { createOdysseyMuiTheme, OdysseyThemeProvider } from '@okta/odyssey-react-mui';
15
16
  import { render } from '@testing-library/preact';
16
17
 
17
18
  import { mergeThemes } from './mergeThemes';
18
19
 
19
20
  test('mergeThemes()', () => {
21
+ const odysseyTheme = createOdysseyMuiTheme({ odysseyTokens: Tokens });
22
+
20
23
  const merged = mergeThemes(
21
24
  odysseyTheme,
22
25
  {
@@ -59,7 +62,15 @@ test('mergeThemes()', () => {
59
62
 
60
63
  expect(typeof root).toBe('function');
61
64
 
62
- const expected = {
65
+ // Odyssey 1.x default MuiInputLabel styles not present in style overrides
66
+ const odysseyThemeDefaultStyles = {
67
+ '& > .MuiTypography-root': {
68
+ lineHeight: 'unset',
69
+ },
70
+ overflow: 'unset',
71
+ };
72
+
73
+ const customStyles = {
63
74
  display: 'flex',
64
75
  justifyContent: 'revert',
65
76
  whiteSpace: 'pre-wrap',
@@ -67,6 +78,8 @@ test('mergeThemes()', () => {
67
78
  color: 'blue',
68
79
  };
69
80
 
81
+ const mergedStyles = { ...odysseyThemeDefaultStyles, ...customStyles };
82
+
70
83
  expect(typeof root).toBe('function');
71
84
 
72
85
  // @ts-expect-error root is function
@@ -74,13 +87,13 @@ test('mergeThemes()', () => {
74
87
  ownerState: {},
75
88
  theme: odysseyTheme,
76
89
  });
77
- expect(actual).toEqual(expected);
90
+ expect(actual).toEqual(mergedStyles);
78
91
 
79
92
  const { getByText } = render(
80
- <ThemeProvider theme={merged}>
93
+ <OdysseyThemeProvider themeOverride={merged}>
81
94
  <TextField label="Label" />
82
- </ThemeProvider>,
95
+ </OdysseyThemeProvider>,
83
96
  );
84
97
  const el = getByText('Label', { selector: 'label' });
85
- expect(el).toHaveStyle(expected);
98
+ expect(el).toHaveStyle(customStyles);
86
99
  });
@@ -10,7 +10,8 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { CSSInterpolation, ThemeOptions } from '@mui/material';
13
+ import { CSSInterpolation } from '@mui/material';
14
+ import { ThemeOptions } from '@okta/odyssey-react-mui';
14
15
  import { merge } from 'lodash';
15
16
 
16
17
  import { cssInterpolate } from './cssInterpolate';
@@ -77,6 +78,36 @@ export const mergeThemes = (
77
78
  // @ts-expect-error FIXME CSSInterpolation may not be CSSObject
78
79
  ...resolve(config.styleOverrides?.input, options),
79
80
  }),
81
+ adornedEnd: (options: Record<string, unknown>) => ({
82
+ // @ts-expect-error FIXME CSSInterpolation may not be CSSObject
83
+ ...resolve(prev.components?.[component]?.styleOverrides?.adornedEnd, options),
84
+ // @ts-expect-error FIXME CSSInterpolation may not be CSSObject
85
+ ...resolve(config.styleOverrides?.adornedEnd, options),
86
+ }),
87
+ adornedStart: (options: Record<string, unknown>) => ({
88
+ // @ts-expect-error FIXME CSSInterpolation may not be CSSObject
89
+ ...resolve(prev.components?.[component]?.styleOverrides?.adornedStart, options),
90
+ // @ts-expect-error FIXME CSSInterpolation may not be CSSObject
91
+ ...resolve(config.styleOverrides?.adornedStart, options),
92
+ }),
93
+ label: (options: Record<string, unknown>) => ({
94
+ // @ts-expect-error FIXME CSSInterpolation may not be CSSObject
95
+ ...resolve(prev.components?.[component]?.styleOverrides?.label, options),
96
+ // @ts-expect-error FIXME CSSInterpolation may not be CSSObject
97
+ ...resolve(config.styleOverrides?.label, options),
98
+ }),
99
+ button: (options: Record<string, unknown>) => ({
100
+ // @ts-expect-error FIXME CSSInterpolation may not be CSSObject
101
+ ...resolve(prev.components?.[component]?.styleOverrides?.button, options),
102
+ // @ts-expect-error FIXME CSSInterpolation may not be CSSObject
103
+ ...resolve(config.styleOverrides?.button, options),
104
+ }),
105
+ select: (options: Record<string, unknown>) => ({
106
+ // @ts-expect-error FIXME CSSInterpolation may not be CSSObject
107
+ ...resolve(prev.components?.[component]?.styleOverrides?.select, options),
108
+ // @ts-expect-error FIXME CSSInterpolation may not be CSSObject
109
+ ...resolve(config.styleOverrides?.select, options),
110
+ }),
80
111
  },
81
112
  },
82
113
  },
@@ -0,0 +1,21 @@
1
+ /*
2
+ * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
+ *
5
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
+ * Unless required by applicable law or agreed to in writing, software
7
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
+ *
10
+ * See the License for the specific language governing permissions and limitations under the License.
11
+ */
12
+
13
+ import { StylisPlugin } from '@emotion/cache';
14
+ import { prefixer } from 'stylis';
15
+
16
+ import logical from '../../stylis-logical-plugin/src';
17
+
18
+ export const stylisPlugins : StylisPlugin[] = [
19
+ logical({ rootDirElement: '#okta-sign-in' }) as unknown as StylisPlugin,
20
+ prefixer as unknown as StylisPlugin,
21
+ ];