@aws-amplify/ui 5.0.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/dist/esm/helpers/authenticator/textUtil.js +1 -1
  2. package/dist/esm/i18n/dictionaries/authenticator/defaultTexts.js +1 -1
  3. package/dist/esm/i18n/dictionaries/authenticator/en.js +1 -1
  4. package/dist/esm/index.js +1 -1
  5. package/dist/esm/theme/createTheme.js +1 -1
  6. package/dist/esm/theme/defaultDarkModeOverride.js +1 -1
  7. package/dist/esm/theme/tokens/components/fieldControl.js +1 -1
  8. package/dist/esm/theme/tokens/index.js +1 -1
  9. package/dist/esm/theme/utils.js +1 -1
  10. package/dist/esm/types/authenticator/user.js +1 -1
  11. package/dist/esm/types/authenticator/utils.js +1 -0
  12. package/dist/index.js +1 -1
  13. package/dist/styles.css +982 -986
  14. package/dist/theme.css +983 -989
  15. package/dist/types/helpers/authenticator/textUtil.d.ts +5 -2
  16. package/dist/types/i18n/dictionaries/authenticator/defaultTexts.d.ts +2 -0
  17. package/dist/types/i18n/dictionaries/index.d.ts +2 -0
  18. package/dist/types/i18n/translations.d.ts +2 -0
  19. package/dist/types/theme/createTheme.d.ts +2 -2
  20. package/dist/types/theme/defaultDarkModeOverride.d.ts +2 -0
  21. package/dist/types/theme/defaultTheme.d.ts +2 -2
  22. package/dist/types/theme/index.d.ts +3 -2
  23. package/dist/types/theme/tokens/borderWidths.d.ts +5 -19
  24. package/dist/types/theme/tokens/colors.d.ts +36 -75
  25. package/dist/types/theme/tokens/components/alert.d.ts +14 -27
  26. package/dist/types/theme/tokens/components/authenticator.d.ts +26 -46
  27. package/dist/types/theme/tokens/components/autocomplete.d.ts +12 -41
  28. package/dist/types/theme/tokens/components/badge.d.ts +15 -28
  29. package/dist/types/theme/tokens/components/button.d.ts +39 -82
  30. package/dist/types/theme/tokens/components/card.d.ts +7 -14
  31. package/dist/types/theme/tokens/components/checkbox.d.ts +27 -80
  32. package/dist/types/theme/tokens/components/checkboxField.d.ts +3 -8
  33. package/dist/types/theme/tokens/components/collection.d.ts +20 -28
  34. package/dist/types/theme/tokens/components/copy.d.ts +8 -20
  35. package/dist/types/theme/tokens/components/dialCodeSelect.d.ts +3 -5
  36. package/dist/types/theme/tokens/components/divider.d.ts +8 -20
  37. package/dist/types/theme/tokens/components/expander.d.ts +21 -68
  38. package/dist/types/theme/tokens/components/field.d.ts +8 -16
  39. package/dist/types/theme/tokens/components/fieldControl.d.ts +22 -71
  40. package/dist/types/theme/tokens/components/fieldGroup.d.ts +6 -14
  41. package/dist/types/theme/tokens/components/fieldMessages.d.ts +6 -16
  42. package/dist/types/theme/tokens/components/flex.d.ts +3 -9
  43. package/dist/types/theme/tokens/components/heading.d.ts +5 -16
  44. package/dist/types/theme/tokens/components/highlightMatch.d.ts +5 -9
  45. package/dist/types/theme/tokens/components/icon.d.ts +3 -6
  46. package/dist/types/theme/tokens/components/image.d.ts +3 -8
  47. package/dist/types/theme/tokens/components/inAppMessaging.d.ts +12 -27
  48. package/dist/types/theme/tokens/components/index.d.ts +58 -49
  49. package/dist/types/theme/tokens/components/link.d.ts +4 -12
  50. package/dist/types/theme/tokens/components/loader.d.ts +14 -39
  51. package/dist/types/theme/tokens/components/menu.d.ts +8 -26
  52. package/dist/types/theme/tokens/components/pagination.d.ts +12 -48
  53. package/dist/types/theme/tokens/components/passwordField.d.ts +12 -14
  54. package/dist/types/theme/tokens/components/phoneNumberField.d.ts +4 -9
  55. package/dist/types/theme/tokens/components/placeholder.d.ts +8 -14
  56. package/dist/types/theme/tokens/components/radio.d.ts +21 -72
  57. package/dist/types/theme/tokens/components/radioGroup.d.ts +8 -17
  58. package/dist/types/theme/tokens/components/rating.d.ts +9 -19
  59. package/dist/types/theme/tokens/components/searchField.d.ts +12 -15
  60. package/dist/types/theme/tokens/components/select.d.ts +11 -35
  61. package/dist/types/theme/tokens/components/selectField.d.ts +6 -14
  62. package/dist/types/theme/tokens/components/sliderField.d.ts +20 -61
  63. package/dist/types/theme/tokens/components/stepperField.d.ts +11 -23
  64. package/dist/types/theme/tokens/components/switchField.d.ts +20 -54
  65. package/dist/types/theme/tokens/components/table.d.ts +24 -60
  66. package/dist/types/theme/tokens/components/tabs.d.ts +12 -43
  67. package/dist/types/theme/tokens/components/text.d.ts +6 -15
  68. package/dist/types/theme/tokens/components/textAreaField.d.ts +6 -10
  69. package/dist/types/theme/tokens/components/textField.d.ts +5 -12
  70. package/dist/types/theme/tokens/components/toggleButton.d.ts +30 -115
  71. package/dist/types/theme/tokens/components/toggleButtonGroup.d.ts +5 -7
  72. package/dist/types/theme/tokens/fontSizes.d.ts +5 -17
  73. package/dist/types/theme/tokens/fontWeights.d.ts +5 -16
  74. package/dist/types/theme/tokens/fonts.d.ts +7 -12
  75. package/dist/types/theme/tokens/index.d.ts +58 -48
  76. package/dist/types/theme/tokens/lineHeights.d.ts +5 -10
  77. package/dist/types/theme/tokens/opacities.d.ts +5 -18
  78. package/dist/types/theme/tokens/outlineOffsets.d.ts +5 -10
  79. package/dist/types/theme/tokens/outlineWidths.d.ts +5 -10
  80. package/dist/types/theme/tokens/radii.d.ts +5 -14
  81. package/dist/types/theme/tokens/shadows.d.ts +5 -10
  82. package/dist/types/theme/tokens/space.d.ts +8 -25
  83. package/dist/types/theme/tokens/time.d.ts +5 -10
  84. package/dist/types/theme/tokens/transforms.d.ts +7 -13
  85. package/dist/types/theme/tokens/types/designToken.d.ts +161 -20
  86. package/dist/types/theme/types.d.ts +7 -8
  87. package/dist/types/theme/utils.d.ts +30 -2
  88. package/dist/types/types/authenticator/index.d.ts +1 -0
  89. package/dist/types/types/authenticator/user.d.ts +7 -0
  90. package/dist/types/types/authenticator/utils.d.ts +1 -0
  91. package/package.json +8 -6
  92. package/dist/esm/theme/tokens/types/designToken.js +0 -1
  93. package/dist/types/theme/tokens/types/scales.d.ts +0 -13
@@ -1,53 +1,63 @@
1
- import { BorderWidths, WebBorderWidths } from './borderWidths';
2
- import { Colors, WebColors } from './colors';
3
- import { ComponentTokens } from './components';
4
- import { Fonts, WebFonts } from './fonts';
5
- import { FontSizes, WebFontSizes } from './fontSizes';
6
- import { FontWeights, WebFontWeights } from './fontWeights';
7
- import { LineHeights, WebLineHeights } from './lineHeights';
8
- import { Opacities, WebOpacities } from './opacities';
9
- import { OutlineOffsets, WebOutlineOffsets } from './outlineOffsets';
10
- import { OutlineWidths, WebOutlineWidths } from './outlineWidths';
11
- import { Radii, WebRadii } from './radii';
12
- import { Shadows, WebShadows } from './shadows';
13
- import { Space, WebSpace } from './space';
14
- import { Time, WebTime } from './time';
15
- import { Transforms, WebTransforms } from './transforms';
16
- export interface Tokens {
17
- components: ComponentTokens;
18
- borderWidths: BorderWidths;
19
- colors: Colors;
20
- fonts: Fonts;
21
- fontSizes: FontSizes;
22
- fontWeights: FontWeights;
23
- lineHeights: LineHeights;
24
- opacities: Opacities;
25
- outlineOffsets: OutlineOffsets;
26
- outlineWidths: OutlineWidths;
27
- radii: Radii;
28
- shadows: Shadows;
29
- space: Space;
30
- time: Time;
31
- transforms: Transforms;
1
+ import { BorderWidths } from './borderWidths';
2
+ import { Colors } from './colors';
3
+ import { ComponentTokens, DefaultComponentTokens, WebComponentTokens } from './components';
4
+ import { Fonts } from './fonts';
5
+ import { FontSizes } from './fontSizes';
6
+ import { FontWeights } from './fontWeights';
7
+ import { LineHeights } from './lineHeights';
8
+ import { Opacities } from './opacities';
9
+ import { OutlineOffsets } from './outlineOffsets';
10
+ import { OutlineWidths } from './outlineWidths';
11
+ import { Radii } from './radii';
12
+ import { Shadows } from './shadows';
13
+ import { Space } from './space';
14
+ import { Time } from './time';
15
+ import { Transforms } from './transforms';
16
+ import { OutputVariantKey } from './types/designToken';
17
+ /**
18
+ * Used for custom themes
19
+ */
20
+ interface BaseTokens<Output extends OutputVariantKey = unknown> {
21
+ borderWidths?: BorderWidths<Output>;
22
+ colors?: Colors<Output>;
23
+ fonts?: Fonts<Output>;
24
+ fontSizes?: FontSizes<Output>;
25
+ fontWeights?: FontWeights<Output>;
26
+ lineHeights?: LineHeights<Output>;
27
+ opacities?: Opacities<Output>;
28
+ outlineOffsets?: OutlineOffsets<Output>;
29
+ outlineWidths?: OutlineWidths<Output>;
30
+ radii?: Radii<Output>;
31
+ shadows?: Shadows<Output>;
32
+ space?: Space<Output>;
33
+ time?: Time<Output>;
34
+ transforms?: Transforms<Output>;
32
35
  }
36
+ export declare type Tokens = BaseTokens<'optional'> & {
37
+ components?: ComponentTokens;
38
+ };
39
+ export declare type DefaultTokens = Required<BaseTokens<'default'>> & {
40
+ components: DefaultComponentTokens;
41
+ };
33
42
  /**
34
43
  * The fully setup theme tokens. It has the same shape as Tokens
35
44
  * but each token has added fields.
36
45
  */
37
- export interface WebTokens extends Tokens {
38
- borderWidths: WebBorderWidths;
39
- colors: WebColors;
40
- fonts: WebFonts;
41
- fontSizes: WebFontSizes;
42
- fontWeights: WebFontWeights;
43
- lineHeights: WebLineHeights;
44
- opacities: WebOpacities;
45
- outlineOffsets: WebOutlineOffsets;
46
- outlineWidths: WebOutlineWidths;
47
- radii: WebRadii;
48
- shadows: WebShadows;
49
- space: WebSpace;
50
- time: WebTime;
51
- transform: WebTransforms;
52
- }
53
- export declare const tokens: Tokens;
46
+ export declare type WebTokens = Required<BaseTokens<'required'>> & {
47
+ components: WebComponentTokens;
48
+ };
49
+ declare type ReactNative = 'react-native';
50
+ declare type BaseReactNativeTokens<Output extends OutputVariantKey = unknown> = {
51
+ colors?: Colors<Output, ReactNative>;
52
+ borderWidths?: BorderWidths<Output, ReactNative>;
53
+ fontSizes?: Omit<FontSizes<Output, ReactNative>, 'xxxs' | 'xxxxl'>;
54
+ fontWeights?: FontWeights<Output, ReactNative>;
55
+ opacities?: Opacities<Output, ReactNative>;
56
+ radii?: Radii<Output, ReactNative>;
57
+ space?: Omit<Space<Output, ReactNative>, 'xxxs' | 'relative' | 'zero'>;
58
+ time?: Time<Output, ReactNative>;
59
+ };
60
+ export declare type ReactNativeTokens<Output extends OutputVariantKey> = Output extends 'required' | 'default' ? Required<BaseReactNativeTokens<Output>> : BaseReactNativeTokens<Output>;
61
+ export declare const tokens: DefaultTokens;
62
+ export declare const reactNativeTokens: ReactNativeTokens<'default'>;
63
+ export {};
@@ -1,10 +1,5 @@
1
- import { DesignToken, WebDesignToken, LineHeightValue } from './types/designToken';
2
- export declare type LineHeights = {
3
- small: DesignToken<LineHeightValue>;
4
- medium: DesignToken<LineHeightValue>;
5
- large: DesignToken<LineHeightValue>;
6
- };
7
- export declare type WebLineHeights = {
8
- [Property in keyof LineHeights]: WebDesignToken<LineHeightValue>;
9
- };
10
- export declare const lineHeights: LineHeights;
1
+ import { DesignTokenValues, LineHeightValue, OutputVariantKey } from './types/designToken';
2
+ declare type LineHeightSize = 'small' | 'medium' | 'large';
3
+ export declare type LineHeights<Output extends OutputVariantKey = unknown, Platform = unknown> = DesignTokenValues<LineHeightSize, LineHeightValue, Output, Platform>;
4
+ export declare const lineHeights: LineHeights<'default'>;
5
+ export {};
@@ -1,18 +1,5 @@
1
- import { DesignToken, WebDesignToken, OpacityValue } from './types/designToken';
2
- export declare type Opacities = {
3
- 0: DesignToken<OpacityValue>;
4
- 10: DesignToken<OpacityValue>;
5
- 20: DesignToken<OpacityValue>;
6
- 30: DesignToken<OpacityValue>;
7
- 40: DesignToken<OpacityValue>;
8
- 50: DesignToken<OpacityValue>;
9
- 60: DesignToken<OpacityValue>;
10
- 70: DesignToken<OpacityValue>;
11
- 80: DesignToken<OpacityValue>;
12
- 90: DesignToken<OpacityValue>;
13
- 100: DesignToken<OpacityValue>;
14
- };
15
- export declare type WebOpacities = {
16
- [Property in keyof Opacities]: WebDesignToken<OpacityValue>;
17
- };
18
- export declare const opacities: Opacities;
1
+ import { DesignTokenValues, OpacityValue, OutputVariantKey } from './types/designToken';
2
+ declare type OpacityScale = 0 | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 100;
3
+ export declare type Opacities<Output extends OutputVariantKey = unknown, Platform = unknown> = DesignTokenValues<OpacityScale, OpacityValue<Platform, Output>, Output, Platform>;
4
+ export declare const opacities: Opacities<'default'>;
5
+ export {};
@@ -1,10 +1,5 @@
1
- import { DesignToken, WebDesignToken, OutlineOffsetValue } from './types/designToken';
2
- export declare type OutlineOffsets = {
3
- small: DesignToken<OutlineOffsetValue>;
4
- medium: DesignToken<OutlineOffsetValue>;
5
- large: DesignToken<OutlineOffsetValue>;
6
- };
7
- export declare type WebOutlineOffsets = {
8
- [Property in keyof OutlineOffsets]: WebDesignToken<OutlineOffsetValue>;
9
- };
10
- export declare const outlineOffsets: OutlineOffsets;
1
+ import { DesignTokenValues, OutlineOffsetValue, OutputVariantKey } from './types/designToken';
2
+ declare type OutlineOffsetSize = 'small' | 'medium' | 'large';
3
+ export declare type OutlineOffsets<Output extends OutputVariantKey = unknown, Platform = unknown> = DesignTokenValues<OutlineOffsetSize, OutlineOffsetValue, Output, Platform>;
4
+ export declare const outlineOffsets: OutlineOffsets<'default'>;
5
+ export {};
@@ -1,10 +1,5 @@
1
- import { DesignToken, WebDesignToken, OutlineWidthValue } from './types/designToken';
2
- export declare type OutlineWidths = {
3
- small: DesignToken<OutlineWidthValue>;
4
- medium: DesignToken<OutlineWidthValue>;
5
- large: DesignToken<OutlineWidthValue>;
6
- };
7
- export declare type WebOutlineWidths = {
8
- [Property in keyof OutlineWidths]: WebDesignToken<OutlineWidthValue>;
9
- };
10
- export declare const outlineWidths: OutlineWidths;
1
+ import { DesignTokenValues, OutlineWidthValue, OutputVariantKey } from './types/designToken';
2
+ declare type OutlineWidthSize = 'small' | 'medium' | 'large';
3
+ export declare type OutlineWidths<Output extends OutputVariantKey = unknown, Platform = unknown> = DesignTokenValues<OutlineWidthSize, OutlineWidthValue, Output, Platform>;
4
+ export declare const outlineWidths: OutlineWidths<'default'>;
5
+ export {};
@@ -1,14 +1,5 @@
1
- import { DesignToken, WebDesignToken, RadiusValue } from './types/designToken';
2
- export declare type Radii = {
3
- xs: DesignToken<RadiusValue>;
4
- small: DesignToken<RadiusValue>;
5
- medium: DesignToken<RadiusValue>;
6
- large: DesignToken<RadiusValue>;
7
- xl: DesignToken<RadiusValue>;
8
- xxl: DesignToken<RadiusValue>;
9
- xxxl: DesignToken<RadiusValue>;
10
- };
11
- export declare type WebRadii = {
12
- [Property in keyof Radii]: WebDesignToken<RadiusValue>;
13
- };
14
- export declare const radii: Radii;
1
+ import { DesignTokenValues, OutputVariantKey, RadiusValue } from './types/designToken';
2
+ declare type RadiusSize = 'xs' | 'small' | 'medium' | 'large' | 'xl' | 'xxl' | 'xxxl';
3
+ export declare type Radii<Output extends OutputVariantKey = unknown, Platform = unknown> = DesignTokenValues<RadiusSize, RadiusValue<Platform, Output>, Output, Platform>;
4
+ export declare const radii: Radii<'default'>;
5
+ export {};
@@ -1,10 +1,5 @@
1
- import { DesignToken, WebDesignToken, ShadowValue } from './types/designToken';
2
- export declare type Shadows = {
3
- small: DesignToken<ShadowValue>;
4
- medium: DesignToken<ShadowValue>;
5
- large: DesignToken<ShadowValue>;
6
- };
7
- export declare type WebShadows = {
8
- [Property in keyof Shadows]: WebDesignToken<ShadowValue>;
9
- };
10
- export declare const shadows: Shadows;
1
+ import { DesignTokenValues, OutputVariantKey, ShadowValue } from './types/designToken';
2
+ declare type ShadowSize = 'small' | 'medium' | 'large';
3
+ export declare type Shadows<Output extends OutputVariantKey = unknown, Platform = unknown> = DesignTokenValues<ShadowSize, ShadowValue, Output, Platform>;
4
+ export declare const shadows: Shadows<'default'>;
5
+ export {};
@@ -1,26 +1,9 @@
1
- import { DesignToken, WebDesignToken, SpaceValue } from './types/designToken';
2
- export declare type SpaceSizes = {
3
- xxxs: DesignToken<SpaceValue>;
4
- xxs: DesignToken<SpaceValue>;
5
- xs: DesignToken<SpaceValue>;
6
- small: DesignToken<SpaceValue>;
7
- medium: DesignToken<SpaceValue>;
8
- large: DesignToken<SpaceValue>;
9
- xl: DesignToken<SpaceValue>;
10
- xxl: DesignToken<SpaceValue>;
11
- xxxl: DesignToken<SpaceValue>;
1
+ import { DesignTokenValues, OutputVariantKey, SpaceValue } from './types/designToken';
2
+ declare type SpaceSize = 'xxxs' | 'xxs' | 'xs' | 'small' | 'medium' | 'large' | 'xl' | 'xxl' | 'xxxl';
3
+ export declare type SpaceSizes<Output extends OutputVariantKey = unknown, Platform = unknown> = DesignTokenValues<SpaceSize | 'zero', SpaceValue<Platform>, Output, Platform>;
4
+ declare type BaseSpace<Output extends OutputVariantKey = unknown, Platform = unknown> = SpaceSizes<Output, Platform> & {
5
+ relative?: DesignTokenValues<SpaceSize | 'full', SpaceValue, Output, Platform>;
12
6
  };
13
- export declare type Space = SpaceSizes & {
14
- zero: DesignToken<SpaceValue>;
15
- relative: SpaceSizes & {
16
- full: DesignToken<SpaceValue>;
17
- };
18
- };
19
- export declare type WebSpace = {
20
- [Property in keyof Omit<Space, 'relative'>]: WebDesignToken<SpaceValue>;
21
- } & {
22
- relative: {
23
- [Property in keyof Space['relative']]: WebDesignToken<SpaceValue>;
24
- };
25
- };
26
- export declare const space: Space;
7
+ export declare type Space<Output extends OutputVariantKey = unknown, Platform = unknown> = Output extends 'required' | 'default' ? Required<BaseSpace<Output, Platform>> : BaseSpace<Output, Platform>;
8
+ export declare const space: Space<'default'>;
9
+ export {};
@@ -1,10 +1,5 @@
1
- import { DesignToken, WebDesignToken, TimeValue } from './types/designToken';
2
- export declare type Time = {
3
- short: DesignToken<TimeValue>;
4
- medium: DesignToken<TimeValue>;
5
- long: DesignToken<TimeValue>;
6
- };
7
- export declare type WebTime = {
8
- [Property in keyof Time]: WebDesignToken<TimeValue>;
9
- };
10
- export declare const time: Time;
1
+ import { DesignTokenValues, OutputVariantKey, TimeValue } from './types/designToken';
2
+ declare type Duration = 'short' | 'medium' | 'long';
3
+ export declare type Time<Output extends OutputVariantKey = unknown, Platform = unknown> = DesignTokenValues<Duration, TimeValue<Platform, Output>, Output, Platform>;
4
+ export declare const time: Time<'default'>;
5
+ export {};
@@ -1,14 +1,8 @@
1
- import { DesignToken, WebDesignToken, TransformValue } from './types/designToken';
2
- export declare type Transforms = {
3
- slideX: {
4
- small: DesignToken<TransformValue>;
5
- medium: DesignToken<TransformValue>;
6
- large: DesignToken<TransformValue>;
7
- };
1
+ import { DesignTokenValues, OutputVariantKey, TransformValue } from './types/designToken';
2
+ declare type TransformSize = 'small' | 'medium' | 'large';
3
+ export declare type BaseTransforms<Output extends OutputVariantKey = unknown, Platform = unknown> = {
4
+ slideX?: DesignTokenValues<TransformSize, TransformValue, Output, Platform>;
8
5
  };
9
- export declare type WebTransforms = {
10
- slideX: {
11
- [Property in keyof Transforms['slideX']]: WebDesignToken<TransformValue>;
12
- };
13
- };
14
- export declare const transforms: Transforms;
6
+ export declare type Transforms<Output extends OutputVariantKey = unknown, Platform = unknown> = Output extends 'required' | 'default' ? Required<BaseTransforms<Output, Platform>> : BaseTransforms<Output, Platform>;
7
+ export declare const transforms: Transforms<'default'>;
8
+ export {};
@@ -1,21 +1,14 @@
1
+ import { Properties } from 'csstype';
1
2
  /**
2
- * Helper function to test if something is a design token or not.
3
- * Used in the React component style props.
4
- *
5
- * @param arg - thing to test if it is a design token or not
6
- * @returns boolean
3
+ * a DesignToken can be either an object with a `value` key of `ValueType` or the `ValueType` itself
7
4
  */
8
- export declare function isDesignToken(arg: unknown): arg is WebDesignToken;
9
- /**
10
- *
11
- */
12
- export declare type DesignToken<ValueType = any> = {
5
+ export declare type DesignToken<ValueType = unknown> = {
13
6
  value: ValueType;
14
- };
7
+ } | ValueType;
15
8
  /**
16
9
  * A fully setup design token ready to be used in web platform.
17
10
  */
18
- export declare type WebDesignToken<ValueType = any> = {
11
+ export declare type WebDesignToken<ValueType = unknown> = {
19
12
  /**
20
13
  * Name of the design token
21
14
  */
@@ -33,7 +26,11 @@ export declare type WebDesignToken<ValueType = any> = {
33
26
  * `var(--amplify-colors-font-primary)`
34
27
  */
35
28
  toString(): string;
36
- } & DesignToken<ValueType>;
29
+ /**
30
+ * Token `ValueType`
31
+ */
32
+ value: ValueType;
33
+ };
37
34
  export declare type AnimationDurationValue = string;
38
35
  export declare type AnimationTimingFunctionValue = string;
39
36
  export declare type AlignItemsValue = string;
@@ -43,7 +40,7 @@ export declare type BorderColorValue = ColorValue;
43
40
  export declare type BorderCollapseValue = string;
44
41
  export declare type BorderRadiusValue = RadiusValue;
45
42
  export declare type BorderStyleValue = string;
46
- export declare type BorderWidthValue = SpaceValue;
43
+ export declare type BorderWidthValue<Platform extends PlatformKey = unknown, Output extends OutputVariantKey = unknown> = Output extends 'required' ? Platform extends 'react-native' ? number : SpaceValue : SpaceValue;
47
44
  export declare type BorderValue = string;
48
45
  export declare type BoxSizingValue = string;
49
46
  export declare type BoxShadowValue = ShadowValue;
@@ -54,22 +51,22 @@ export declare type DisplayValue = string;
54
51
  export declare type FlexDirectionValue = string;
55
52
  export declare type FlexValue = string;
56
53
  export declare type FlexWrapValue = string;
57
- export declare type FontSizeValue = string;
54
+ export declare type FontSizeValue<Platform extends PlatformKey = unknown, Output extends OutputVariantKey = unknown> = Output extends 'required' ? Platform extends 'react-native' ? number : string : string;
58
55
  export declare type FontStyleValue = string;
59
56
  export declare type FontValue = string;
60
- export declare type FontWeightValue = string | number;
57
+ export declare type FontWeightValue<Platform extends PlatformKey = unknown, Output extends OutputVariantKey = unknown> = Output extends 'required' ? Platform extends 'react-native' ? 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' : string | number : string | number;
61
58
  export declare type GapValue = string;
62
59
  export declare type JustifyContentValue = string;
63
60
  export declare type LineHeightValue = string | number;
64
61
  export declare type ObjectFitValue = string;
65
- export declare type OpacityValue = string;
62
+ export declare type OpacityValue<Platform extends PlatformKey = unknown, Output extends OutputVariantKey = unknown> = Output extends 'required' ? Platform extends 'react-native' ? number : string : string;
66
63
  export declare type OutlineOffsetValue = string;
67
64
  export declare type OutlineWidthValue = string;
68
65
  export declare type OutlineColorValue = string;
69
66
  export declare type OutlineStyleValue = string;
70
67
  export declare type PositionValue = string;
71
68
  export declare type PointerEventsValue = string;
72
- export declare type RadiusValue = string;
69
+ export declare type RadiusValue<Platform extends PlatformKey = unknown, Output extends OutputVariantKey = unknown> = Output extends 'required' ? Platform extends 'react-native' ? number : string : string;
73
70
  export declare type ShadowValue = {
74
71
  offsetX: string;
75
72
  offsetY: string;
@@ -80,9 +77,10 @@ export declare type ShadowValue = {
80
77
  export declare type StrokeFilledValue = string;
81
78
  export declare type StrokeEmptyValue = string;
82
79
  export declare type StrokeLinecapValue = string;
83
- export declare type SpaceValue = string;
80
+ export declare type StrokeWidthValue = string;
81
+ export declare type SpaceValue<Platform extends PlatformKey = unknown> = Platform extends 'react-native' ? string | number : string;
84
82
  export declare type TextAlignValue = string;
85
- export declare type TimeValue = string;
83
+ export declare type TimeValue<Platform extends PlatformKey = unknown, Output extends OutputVariantKey = unknown> = Output extends 'required' ? Platform extends 'react-native' ? number : string : string;
86
84
  export declare type TransformValue = string;
87
85
  export declare type TransitionDurationValue = string;
88
86
  export declare type TransitionPropertyValue = string;
@@ -90,3 +88,146 @@ export declare type TransitionTimingFunctionValue = string;
90
88
  export declare type VerticalAlignValue = string;
91
89
  export declare type WhiteSpaceValue = string;
92
90
  export declare type WordBreakValue = string;
91
+ /**
92
+ * Mapping of design token value types to style property keys
93
+ */
94
+ interface TokenStandardProperties {
95
+ animationDuration: AnimationDurationValue;
96
+ animationTimingFunction: AnimationTimingFunctionValue;
97
+ alignItems: AlignItemsValue;
98
+ alignContent: AlignContentValue;
99
+ backgroundColor: BackgroundColorValue;
100
+ borderBlockEnd: BorderValue;
101
+ borderBlockEndColor: ColorValue;
102
+ borderBlockStart: BorderValue;
103
+ borderCollapse: BorderCollapseValue;
104
+ borderColor: BorderColorValue;
105
+ borderInlineEnd: BorderValue;
106
+ borderInlineStart: BorderValue;
107
+ borderRadius: BorderRadiusValue;
108
+ borderStyle: BorderStyleValue;
109
+ borderWidth: BorderWidthValue;
110
+ border: BorderValue;
111
+ bottom: SpaceValue;
112
+ boxSizing: BoxSizingValue;
113
+ boxShadow: BoxShadowValue;
114
+ captionSide: CaptionSideValue;
115
+ color: ColorValue;
116
+ cursor: CursorValue;
117
+ display: DisplayValue;
118
+ fill: DesignToken<ColorValue>;
119
+ flexDirection: FlexDirectionValue;
120
+ flex: FlexValue;
121
+ flexWrap: FlexWrapValue;
122
+ fontStyle: FontStyleValue;
123
+ font: FontValue;
124
+ fontSize: FontSizeValue;
125
+ fontWeight: FontWeightValue;
126
+ gap: GapValue;
127
+ height: SpaceValue;
128
+ justifyContent: JustifyContentValue;
129
+ left: SpaceValue;
130
+ lineHeight: LineHeightValue;
131
+ margin: SpaceValue;
132
+ marginLeft: SpaceValue;
133
+ marginRight: SpaceValue;
134
+ marginBlockStart: SpaceValue;
135
+ maxHeight: SpaceValue;
136
+ maxWidth: SpaceValue;
137
+ minHeight: SpaceValue;
138
+ minWidth: SpaceValue;
139
+ objectFit: ObjectFitValue;
140
+ objectPosition: PositionValue;
141
+ opacity: OpacityValue;
142
+ outlineOffset: OutlineOffsetValue;
143
+ outlineWidth: OutlineWidthValue;
144
+ outlineColor: OutlineColorValue;
145
+ outlineStyle: OutlineStyleValue;
146
+ padding: SpaceValue;
147
+ paddingBlock: SpaceValue;
148
+ paddingBlockEnd: SpaceValue;
149
+ paddingBlockStart: SpaceValue;
150
+ paddingBottom: SpaceValue;
151
+ paddingInline: SpaceValue;
152
+ paddingInlineEnd: SpaceValue;
153
+ paddingInlineStart: SpaceValue;
154
+ paddingLeft: SpaceValue;
155
+ paddingRight: SpaceValue;
156
+ paddingTop: SpaceValue;
157
+ pointerEvents: PointerEventsValue;
158
+ position: PositionValue;
159
+ right: SpaceValue;
160
+ strokeLinecap: StrokeLinecapValue;
161
+ strokeWidth: StrokeWidthValue;
162
+ textAlign: TextAlignValue;
163
+ top: SpaceValue;
164
+ transform: TransformValue;
165
+ transitionDuration: TransitionDurationValue;
166
+ transitionProperty: TransitionPropertyValue;
167
+ transitionTimingFunction: TransitionTimingFunctionValue;
168
+ verticalAlign: VerticalAlignValue;
169
+ whiteSpace: WhiteSpaceValue;
170
+ width: SpaceValue;
171
+ wordBreak: WordBreakValue;
172
+ }
173
+ /**
174
+ * Custom style tokens with non-css property names
175
+ */
176
+ interface TokenCustomProperties {
177
+ borderBottomLeftRadius: RadiusValue;
178
+ borderBottomRightRadius: RadiusValue;
179
+ borderEndEndRadius: RadiusValue;
180
+ borderEndStartRadius: RadiusValue;
181
+ borderStartEndRadius: RadiusValue;
182
+ borderStartStartRadius: RadiusValue;
183
+ borderTopLeftRadius: RadiusValue;
184
+ borderTopRightRadius: RadiusValue;
185
+ duration: TimeValue;
186
+ endColor: ColorValue;
187
+ marginTop: SpaceValue;
188
+ paddingHorizontal: SpaceValue;
189
+ paddingVertical: SpaceValue;
190
+ shadow: ShadowValue;
191
+ size: SpaceValue;
192
+ startColor: ColorValue;
193
+ strokeEmpty: StrokeEmptyValue;
194
+ strokeFilled: StrokeFilledValue;
195
+ time: TimeValue;
196
+ }
197
+ interface TokenProperties extends TokenStandardProperties, TokenCustomProperties {
198
+ }
199
+ declare type TokenProperty = keyof TokenProperties;
200
+ declare type Property = Extract<keyof Properties, TokenProperty> | keyof TokenCustomProperties;
201
+ export declare type OutputVariantKey = 'default' | 'optional' | 'required' | unknown;
202
+ /**
203
+ * Return interface with all types optional for custom theme input
204
+ */
205
+ declare type OptionalDesignTokenProperties<Keys extends Property> = Partial<{
206
+ [Key in Keys]?: DesignToken<TokenProperties[Key]>;
207
+ }>;
208
+ /**
209
+ * Return interface with all types required for strict theme output
210
+ */
211
+ declare type RequiredDesignTokenProperties<Keys extends TokenProperty> = {
212
+ [Key in Keys]: WebDesignToken<TokenProperties[Key]>;
213
+ };
214
+ /**
215
+ * Return interface with all types required for strict theme output
216
+ */
217
+ declare type DefaultDesignTokenProperties<Keys extends TokenProperty> = Required<{
218
+ [Key in Keys]: DesignToken<TokenProperties[Key]>;
219
+ }>;
220
+ /**
221
+ * Utility for creating interfaces for components from supported CSS property keys
222
+ */
223
+ export declare type DesignTokenProperties<Keys extends TokenProperty, Output extends OutputVariantKey = unknown> = Output extends 'required' ? RequiredDesignTokenProperties<Keys> : Output extends 'optional' ? OptionalDesignTokenProperties<Keys> : DefaultDesignTokenProperties<Keys>;
224
+ export declare type PlatformKey = 'web' | 'react-native' | 'android' | 'ios' | unknown;
225
+ declare type PropKey = string | number;
226
+ declare type RequiredTokenValues<PropertyValueKey extends PropKey, PropertyValue, Platform extends PlatformKey = unknown> = Record<PropertyValueKey, Platform extends 'react-native' ? PropertyValue : WebDesignToken<PropertyValue>>;
227
+ declare type OptionalTokenValues<PropertyValueKey extends PropKey, PropertyValue, Platform extends PlatformKey = unknown> = Partial<Record<PropertyValueKey, DesignToken<PropertyValue>>>;
228
+ declare type DefaultTokenValues<PropertyValueKey extends PropKey, PropertyValue, Platform extends PlatformKey = unknown> = Required<Record<PropertyValueKey, DesignToken<PropertyValue>>>;
229
+ /**
230
+ * Utility for creating token interfaces in `Theme`
231
+ */
232
+ export declare type DesignTokenValues<PropertyValueKey extends PropKey, PropertyValue, Output extends OutputVariantKey = unknown, Platform extends PlatformKey = unknown> = Output extends 'required' ? RequiredTokenValues<PropertyValueKey, PropertyValue, Platform> : Output extends 'optional' ? OptionalTokenValues<PropertyValueKey, PropertyValue, Platform> : DefaultTokenValues<PropertyValueKey, PropertyValue, Platform>;
233
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { PartialDeep } from 'type-fest';
2
- import { Tokens, WebTokens } from './tokens';
2
+ import { DefaultTokens, Tokens, WebTokens } from './tokens';
3
3
  import { Breakpoints } from './breakpoints';
4
4
  export * from './tokens/types/designToken';
5
5
  export type { FontSizes } from './tokens/fontSizes';
@@ -87,7 +87,7 @@ export interface Theme {
87
87
  * multiple themes on a page.
88
88
  */
89
89
  name: string;
90
- tokens?: PartialDeep<Tokens>;
90
+ tokens?: Tokens;
91
91
  breakpoints?: PartialDeep<Breakpoints>;
92
92
  /**
93
93
  * Overrides allow you to change design tokens in different contexts, like
@@ -98,19 +98,18 @@ export interface Theme {
98
98
  overrides?: Array<Override>;
99
99
  }
100
100
  /**
101
- * A BaseTheme has all tokens and breakpoints required
101
+ * A DefaultTheme has all tokens and breakpoints required
102
102
  */
103
- export interface BaseTheme extends Theme {
104
- tokens: Tokens;
103
+ export interface DefaultTheme extends Pick<Theme, 'name' | 'overrides'> {
104
+ tokens: DefaultTokens;
105
105
  breakpoints: Breakpoints;
106
- overrides?: Array<Override>;
107
106
  }
108
107
  /**
109
108
  * WebTheme is a fully built theme that has cssText based
110
109
  * on the design tokens and all design tokens have added fields
111
110
  * to be used in Javascript/Typescript.
112
111
  */
113
- export interface WebTheme extends BaseTheme {
114
- tokens: WebTokens;
112
+ export interface WebTheme extends Pick<Theme, 'breakpoints' | 'name' | 'overrides'> {
115
113
  cssText: string;
114
+ tokens: WebTokens;
116
115
  }
@@ -1,8 +1,36 @@
1
- import { DesignToken } from './tokens/types/designToken';
1
+ import { DesignToken, WebDesignToken } from './tokens/types/designToken';
2
2
  export declare const CSS_VARIABLE_PREFIX = "amplify";
3
- export declare function cssValue(token: DesignToken): any;
3
+ export declare function cssValue(token: DesignToken<{
4
+ value: unknown;
5
+ }>): unknown;
4
6
  interface NameTransformProps {
5
7
  path?: Array<string>;
6
8
  }
7
9
  export declare function cssNameTransform({ path }: NameTransformProps): string;
10
+ /**
11
+ * Helper function to test if something is a design token or not.
12
+ * Used in the React component style props.
13
+ *
14
+ * @param value - thing to test if it is a design token or not
15
+ * @returns boolean
16
+ */
17
+ export declare function isDesignToken(value: unknown): value is WebDesignToken;
18
+ declare type SetupTokensProps = {
19
+ tokens: Record<string | number, any>;
20
+ path?: Array<string>;
21
+ setupToken: SetupToken;
22
+ };
23
+ export declare type SetupToken<ReturnType = any> = (args: {
24
+ token: BaseDesignToken;
25
+ path: Array<string>;
26
+ }) => ReturnType;
27
+ declare type BaseDesignToken = {
28
+ value: string | number;
29
+ };
30
+ /**
31
+ * Recursive function that will walk down the token object
32
+ * and perform the setupToken function on each token.
33
+ * Similar to what Style Dictionary does.
34
+ */
35
+ export declare function setupTokens({ tokens, path, setupToken, }: SetupTokensProps): any;
8
36
  export {};
@@ -1,5 +1,6 @@
1
1
  export * from './validator';
2
2
  export * from './user';
3
+ export * from './utils';
3
4
  export * from './form';
4
5
  export * from './attributes';
5
6
  export * from './stateMachine';
@@ -30,6 +30,13 @@ export interface AmplifyUser extends CognitoUser {
30
30
  */
31
31
  export interface CognitoUserAmplify extends AmplifyUser {
32
32
  }
33
+ /**
34
+ * Cognito user contact method types that have not been verified as valid
35
+ */
36
+ export declare enum UnverifiedContactMethodType {
37
+ Email = "email",
38
+ PhoneNumber = "phone_number"
39
+ }
33
40
  /**
34
41
  * Cognito user contact methods that have not been verified as valid
35
42
  */
@@ -0,0 +1 @@
1
+ export declare const isUnverifiedContactMethodType: (value: string) => boolean;