@edvisor/product-language 0.2.0 → 0.3.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 (94) hide show
  1. package/.eslintrc.json +14 -6
  2. package/package.json +2 -3
  3. package/project.json +18 -7
  4. package/src/README.md +61 -0
  5. package/src/helpers/index.ts +2 -1
  6. package/src/helpers/playground.ts +16 -0
  7. package/src/lib/components/badge/badge.tsx +8 -17
  8. package/src/lib/components/badge/stories/badge.stories.mdx +44 -0
  9. package/src/lib/components/badge/stories/components.tsx +49 -0
  10. package/src/lib/components/card/card.test.tsx +4 -5
  11. package/src/lib/components/card/card.tsx +2 -2
  12. package/src/lib/components/card/components/card-section-slot.tsx +2 -2
  13. package/src/lib/components/card/storybook/card.stories.mdx +1 -1
  14. package/src/lib/components/card/storybook/components.tsx +6 -23
  15. package/src/lib/components/checkbox/checkbox.tsx +34 -95
  16. package/src/lib/components/checkbox/helpers.tsx +100 -0
  17. package/src/lib/components/checkbox/stories/checkbox.stories.mdx +27 -24
  18. package/src/lib/components/checkbox/stories/components.tsx +63 -15
  19. package/src/lib/components/divider/stories/divider.stories.mdx +7 -13
  20. package/src/lib/components/flag/flag-size-flags.tsx +55 -0
  21. package/src/lib/components/flag/flag.list.tsx +788 -0
  22. package/src/lib/components/flag/flag.test.tsx +65 -0
  23. package/src/lib/components/flag/flag.tsx +97 -0
  24. package/src/lib/components/flag/index.tsx +1 -0
  25. package/src/lib/components/flag/stories/components.tsx +403 -0
  26. package/src/lib/components/flag/stories/flag.stories.mdx +48 -0
  27. package/src/lib/components/flag/stories/playGround-select.tsx +145 -0
  28. package/src/lib/components/icon/icon-list.tsx +135 -0
  29. package/src/lib/components/icon/icon.test.tsx +48 -0
  30. package/src/lib/components/icon/icon.tsx +181 -0
  31. package/src/lib/components/icon/index.tsx +1 -0
  32. package/src/lib/components/icon/stories/components.tsx +282 -0
  33. package/src/lib/components/icon/stories/icon.stories.mdx +65 -0
  34. package/src/lib/components/index.ts +5 -0
  35. package/src/lib/components/input-field/components/labeled-input.tsx +7 -14
  36. package/src/lib/components/input-field/components/stepper.tsx +4 -3
  37. package/src/lib/components/input-field/input-field.test.tsx +5 -6
  38. package/src/lib/components/input-field/input-field.tsx +8 -8
  39. package/src/lib/components/input-field/storybook/components.tsx +9 -16
  40. package/src/lib/components/link/storybook/link.stories.mdx +1 -0
  41. package/src/lib/components/molecules/avatar/avatar-size-flags.tsx +3 -3
  42. package/src/lib/components/molecules/avatar/avatar.tsx +2 -2
  43. package/src/lib/components/molecules/avatar/stories/avatar.stories.mdx +18 -21
  44. package/src/lib/components/molecules/button/button-flags.tsx +120 -15
  45. package/src/lib/components/molecules/button/button.test.tsx +9 -9
  46. package/src/lib/components/molecules/button/button.tsx +61 -78
  47. package/src/lib/components/molecules/button/stories/button.stories.mdx +43 -42
  48. package/src/lib/components/molecules/button/stories/components.tsx +6 -8
  49. package/src/lib/components/molecules/input-checkbox/input-checkbox.tsx +23 -24
  50. package/src/lib/components/molecules/input-checkbox/stories/components.tsx +32 -15
  51. package/src/lib/components/molecules/input-checkbox/stories/input-checkbox.stories.mdx +6 -8
  52. package/src/lib/components/organisms/multi-choice-list/multi-choice-list.tsx +7 -8
  53. package/src/lib/components/organisms/multi-choice-list/stories/components.tsx +3 -5
  54. package/src/lib/components/organisms/multi-choice-list/stories/multi-choice-list.stories.mdx +4 -4
  55. package/src/lib/components/spinner/spinner.test.tsx +2 -2
  56. package/src/lib/components/spinner/spinner.tsx +15 -28
  57. package/src/lib/components/spinner/stories/components.tsx +33 -2
  58. package/src/lib/components/spinner/stories/spinner.stories.mdx +3 -10
  59. package/src/lib/components/tabs/components/index.ts +1 -0
  60. package/src/lib/components/tabs/components/tab.tsx +62 -0
  61. package/src/lib/components/tabs/index.tsx +1 -0
  62. package/src/lib/components/tabs/storybook/components.tsx +282 -0
  63. package/src/lib/components/tabs/storybook/tabs.stories.mdx +97 -0
  64. package/src/lib/components/tabs/tabs.test.tsx +86 -0
  65. package/src/lib/components/tabs/tabs.tsx +101 -0
  66. package/src/lib/components/tag/components/close-button.tsx +85 -0
  67. package/src/lib/components/tag/components/index.ts +2 -0
  68. package/src/lib/components/tag/components/tag-label.tsx +44 -0
  69. package/src/lib/components/tag/index.tsx +1 -0
  70. package/src/lib/components/tag/stories/components.tsx +86 -0
  71. package/src/lib/components/tag/stories/tag.stories.mdx +42 -0
  72. package/src/lib/components/tag/tag.test.tsx +36 -0
  73. package/src/lib/components/tag/tag.tsx +33 -0
  74. package/src/lib/components/thumbnail/thumbnail.tsx +7 -2
  75. package/src/lib/components/typography/storybook/components.tsx +47 -15
  76. package/src/lib/components/typography/storybook/typography.stories.mdx +6 -4
  77. package/src/lib/components/typography/typography.test.tsx +34 -30
  78. package/src/lib/components/typography/typography.tsx +61 -19
  79. package/src/lib/foundations/color-system/base-palette/base-palette.ts +0 -1
  80. package/src/lib/foundations/color-system/color-guidelines/color-guidelines.ts +5 -4
  81. package/src/lib/foundations/color-system/components/color-sample.tsx +3 -3
  82. package/src/lib/foundations/typography/fonts.ts +205 -0
  83. package/src/lib/foundations/typography/text-aspect-flags.ts +11 -4
  84. package/src/lib/foundations/typography/typography.tsx +38 -33
  85. package/src/lib/helpers/numbers.ts +14 -0
  86. package/src/lib/helpers/safe-navigation.ts +10 -0
  87. package/src/lib/helpers/slots.test.tsx +98 -0
  88. package/src/lib/helpers/slots.tsx +93 -12
  89. package/.storybook/preview-head.html +0 -1
  90. package/src/lib/components/badge/badge.stories.tsx +0 -16
  91. package/src/lib/components/checkbox/components/components.tsx +0 -59
  92. package/src/lib/components/checkbox/stories/index.tsx +0 -1
  93. package/src/lib/components/molecules/input-checkbox/stories/index.tsx +0 -1
  94. package/src/lib/components/organisms/multi-choice-list/stories/index.tsx +0 -1
@@ -1,6 +1,6 @@
1
1
  import { Canvas, Meta } from '@storybook/addon-docs';
2
2
  import { TypographyTable, Button } from './components'
3
- import { Heading3, Label1, Body } from '../typography'
3
+ import { Heading3, Label, Body } from '../typography'
4
4
 
5
5
  <Meta title="Components/Typography" />
6
6
 
@@ -14,7 +14,7 @@ When you are building from a mockup you will be clicking on elements and checkin
14
14
 
15
15
  ### Typography: Ag
16
16
 
17
- When you see text in a mockup you can click that text to see what kind of typographic component it represents. In the typography section of the figma inspector you will see a label Ag with a value like "Label1" or "Label1/emphasis". This is the name of the component you should use, and whether you should set the emphasis flag.
17
+ When you see text in a mockup you can click that text to see what kind of typographic component it represents. In the typography section of the figma inspector you will see a label Ag with a value like "Label Default" or "Label Strong" or "Label Subtle". This is the name of the component you should use, and whether you should set the strong or subtle flag.
18
18
 
19
19
  For example if you see "Ag Heading3".
20
20
 
@@ -22,10 +22,12 @@ For example if you see "Ag Heading3".
22
22
  <Heading3>Heading 3, no modifiers</Heading3>
23
23
  </Canvas>
24
24
 
25
- If you see "Ag Label 1/emphasis" you should use a Label1 with emphasis set.
25
+ If you see "Ag Label Strong" you should use a Label with strong set.
26
26
 
27
27
  <Canvas>
28
- <Label1 emphasis>Label 1, emphasis</Label1>
28
+ <Label>Label default</Label>
29
+ <Label subtle>Label Subtle</Label>
30
+ <Label strong>Label Strong</Label>
29
31
  </Canvas>
30
32
 
31
33
  ### Colors: Text
@@ -1,15 +1,15 @@
1
1
  import { render, screen } from '@testing-library/react'
2
+ import { FontWeight, LineHeight } from 'foundations/typography/constants'
2
3
  import {
3
4
  Display,
4
5
  Heading1,
5
6
  Heading2,
6
7
  Heading3,
7
8
  Heading4,
8
- BodyLarge,
9
9
  Body,
10
+ BodyLarge,
10
11
  Caption,
11
- Label1,
12
- Label2,
12
+ Label,
13
13
  } from './typography'
14
14
 
15
15
  describe('Typography', () => {
@@ -20,74 +20,78 @@ describe('Typography', () => {
20
20
  })
21
21
 
22
22
  it('should render Heading1 successfully', () => {
23
- const { baseElement } = render(<Heading1>My Text Here</Heading1>)
24
- expect(baseElement).toBeTruthy()
23
+ render(<Heading1>My Text Here</Heading1>)
24
+
25
25
  expect(screen.getByText('My Text Here')).toBeTruthy()
26
26
  })
27
27
 
28
28
  it('should render Heading2 successfully', () => {
29
- const { baseElement } = render(<Heading2>My Text Here</Heading2>)
30
- expect(baseElement).toBeTruthy()
29
+ render(<Heading2>My Text Here</Heading2>)
30
+
31
31
  expect(screen.getByText('My Text Here')).toBeTruthy()
32
32
  })
33
33
 
34
34
  it('should render Heading3 successfully', () => {
35
- const { baseElement } = render(<Heading3>My Text Here</Heading3>)
36
- expect(baseElement).toBeTruthy()
35
+ render(<Heading3>My Text Here</Heading3>)
36
+
37
37
  expect(screen.getByText('My Text Here')).toBeTruthy()
38
38
  })
39
39
 
40
40
  it('should render Heading4 successfully', () => {
41
- const { baseElement } = render(<Heading4>My Text Here</Heading4>)
42
- expect(baseElement).toBeTruthy()
41
+ render(<Heading4>My Text Here</Heading4>)
42
+
43
43
  expect(screen.getByText('My Text Here')).toBeTruthy()
44
44
  })
45
45
 
46
- it('should render BodyLarge successfully', () => {
47
- const { baseElement } = render(<BodyLarge>My Text Here</BodyLarge>)
48
- expect(baseElement).toBeTruthy()
46
+ it('should render large successfully', () => {
47
+ render(<BodyLarge>My Text Here</BodyLarge>)
48
+
49
49
  expect(screen.getByText('My Text Here')).toBeTruthy()
50
+ expect(screen.getByText('My Text Here')).toHaveStyle(`line-height: ${LineHeight.d}`)
51
+ expect(screen.getByText('My Text Here')).toHaveStyle(`font-weight: ${FontWeight.Regular}`)
50
52
  })
51
53
 
52
54
  it('should render Body successfully', () => {
53
- const { baseElement } = render(<Body>My Text Here</Body>)
54
- expect(baseElement).toBeTruthy()
55
+ render(<Body>My Text Here</Body>)
56
+
55
57
  expect(screen.getByText('My Text Here')).toBeTruthy()
56
58
  })
57
59
 
58
60
  it('should render Subdued successfully', () => {
59
- const { baseElement } = render(<Body subdued>My Text Here</Body>)
60
- expect(baseElement).toBeTruthy()
61
+ render(<Body subdued>My Text Here</Body>)
62
+
61
63
  expect(screen.getByText('My Text Here')).toBeTruthy()
62
64
  })
63
65
 
64
66
  it('should render Light successfully', () => {
65
- const { baseElement } = render(<Body light>My Text Here</Body>)
66
- expect(baseElement).toBeTruthy()
67
+ render(<Body light>My Text Here</Body>)
68
+
67
69
  expect(screen.getByText('My Text Here')).toBeTruthy()
68
70
  })
69
71
 
70
72
  it('should render White successfully', () => {
71
- const { baseElement } = render(<Body onPrimary>My Text Here</Body>)
72
- expect(baseElement).toBeTruthy()
73
+ render(<Body onPrimary>My Text Here</Body>)
74
+
73
75
  expect(screen.getByText('My Text Here')).toBeTruthy()
74
76
  })
75
77
 
76
78
  it('should render Caption successfully', () => {
77
- const { baseElement } = render(<Caption>My Text Here</Caption>)
78
- expect(baseElement).toBeTruthy()
79
+ render(<Caption>My Text Here</Caption>)
80
+
79
81
  expect(screen.getByText('My Text Here')).toBeTruthy()
80
82
  })
81
83
 
82
- it('should render Label1 successfully', () => {
83
- const { baseElement } = render(<Label1>My Text Here</Label1>)
84
- expect(baseElement).toBeTruthy()
84
+ it('should render Label successfully', () => {
85
+ render(<Label>My Text Here</Label>)
86
+
85
87
  expect(screen.getByText('My Text Here')).toBeTruthy()
86
88
  })
87
89
 
88
- it('should render Label2 successfully', () => {
89
- const { baseElement } = render(<Label2>My Text Here</Label2>)
90
- expect(baseElement).toBeTruthy()
90
+ it('should render Label Strong successfully', () => {
91
+ render(<Label strong>My Text Here</Label>)
92
+
91
93
  expect(screen.getByText('My Text Here')).toBeTruthy()
94
+ expect(screen.getByText('My Text Here')).toHaveStyle(`line-height: ${LineHeight.b}`)
95
+ expect(screen.getByText('My Text Here')).toHaveStyle(`font-weight: ${FontWeight.Medium}`)
92
96
  })
93
97
  })
@@ -1,57 +1,99 @@
1
- import { Typography, ITextProps, Margin } from '@foundations'
2
- import { PropsWithChildren } from '@helpers'
1
+ import { HTMLAttributes } from 'react'
3
2
  import styled from 'styled-components'
3
+ import { Typography, Margin, IBodyProps, ILabelProps } from '@foundations'
4
+ import { FC, PropsWithChildren } from '@helpers'
5
+ import { ITextAspectProps, ITransientTextAspectProps } from 'foundations/typography/text-aspect-flags'
4
6
 
5
- type Semibold = { semibold?: boolean }
6
- type Regular = { regular?: boolean }
7
- type Medium = { medium?: boolean }
7
+ export type ITextComponentProps = ITextAspectProps & { emphasis?: boolean } & HTMLAttributes<HTMLElement> & PropsWithChildren
8
+ type ITransientTextComponentProps = ITransientTextAspectProps & { $emphasis?: boolean } & HTMLAttributes<HTMLElement>
8
9
 
9
- type ITextComponentProps = ITextProps & PropsWithChildren
10
+ function toTransientProps (props: ITextComponentProps): ITransientTextComponentProps {
11
+ const { onCritical, onPrimary, emphasis, children, ...rest } = props
12
+
13
+ return {
14
+ ...rest,
15
+ $onCritical: onCritical,
16
+ $onPrimary: onPrimary,
17
+ $emphasis: emphasis,
18
+ } as unknown as ITransientTextComponentProps
19
+ }
10
20
 
11
- export const Display = styled.div<ITextComponentProps & Regular>`
21
+ const DISPLAY = styled.div<ITransientTextComponentProps>`
12
22
  ${Typography.Display};
13
23
  `
14
24
 
15
- export const Heading1 = styled.h1<ITextComponentProps & Semibold>`
25
+ export const Display: FC<ITextComponentProps> = (props) => {
26
+ return <DISPLAY {...toTransientProps(props)}>{props.children}</DISPLAY>
27
+ }
28
+
29
+ const HEADING1 = styled.h1<ITransientTextComponentProps>`
16
30
  ${Typography.Heading1};
17
31
  margin: ${Margin.none};
18
32
  margin-bottom: ${Margin.l};
19
33
  `
20
34
 
21
- export const Heading2 = styled.h2<ITextComponentProps & Semibold>`
35
+ export const Heading1: FC<ITextComponentProps> = (props) => {
36
+ return <HEADING1 {...toTransientProps(props)}>{props.children}</HEADING1>
37
+ }
38
+
39
+ const HEADING2 = styled.h2<ITransientTextComponentProps>`
22
40
  ${Typography.Heading2};
23
41
  margin: ${Margin.none};
24
42
  margin-bottom: ${Margin.m};
25
43
  `
26
44
 
27
- export const Heading3 = styled.h3<ITextComponentProps & Semibold>`
45
+ export const Heading2: FC<ITextComponentProps> = (props) => {
46
+ return <HEADING2 {...toTransientProps(props)}>{props.children}</HEADING2>
47
+ }
48
+
49
+ const HEADING3 = styled.h3<ITransientTextComponentProps>`
28
50
  ${Typography.Heading3};
29
51
  margin: ${Margin.none};
30
52
  margin-bottom: ${Margin.l};
31
53
  `
32
54
 
33
- export const Heading4 = styled.h4<ITextComponentProps & Semibold>`
55
+ export const Heading3: FC<ITextComponentProps> = (props) => {
56
+ return <HEADING3 {...toTransientProps(props)}>{props.children}</HEADING3>
57
+ }
58
+
59
+ const HEADING4 = styled.h4<ITransientTextComponentProps>`
34
60
  ${Typography.Heading4};
35
61
  margin: ${Margin.none};
36
62
  margin-bottom: ${Margin.m};
37
63
  `
38
64
 
39
- export const BodyLarge = styled.div<ITextComponentProps & Regular & Semibold>`
65
+ export const Heading4: FC<ITextComponentProps> = (props) => {
66
+ return <HEADING4 {...toTransientProps(props)}>{props.children}</HEADING4>
67
+ }
68
+
69
+ export const BODY_LARGE = styled.div<ITransientTextComponentProps & IBodyProps>`
40
70
  ${Typography.BodyLarge};
41
71
  `
42
72
 
43
- export const Body = styled.div<ITextComponentProps & Regular & Medium>`
73
+ export const BodyLarge: FC<ITextComponentProps & IBodyProps> = (props) => {
74
+ return <BODY_LARGE {...toTransientProps(props)}>{props.children}</BODY_LARGE>
75
+ }
76
+
77
+ export const BODY = styled.div<ITransientTextComponentProps & IBodyProps>`
44
78
  ${Typography.Body};
45
79
  `
46
80
 
47
- export const Caption = styled.div<ITextComponentProps & Regular>`
81
+ export const Body: FC<ITextComponentProps & IBodyProps> = (props) => {
82
+ return <BODY {...toTransientProps(props)}>{props.children}</BODY>
83
+ }
84
+
85
+ export const CAPTION = styled.div<ITransientTextComponentProps>`
48
86
  ${Typography.Caption};
49
87
  `
50
88
 
51
- export const Label1 = styled.div<ITextComponentProps & Regular & Medium>`
52
- ${Typography.Label1};
89
+ export const Caption: FC<ITextComponentProps> = (props) => {
90
+ return <CAPTION {...toTransientProps(props)}>{props.children}</CAPTION>
91
+ }
92
+
93
+ export const LABEL = styled.div<ITransientTextComponentProps & ILabelProps>`
94
+ ${Typography.Label};
53
95
  `
54
96
 
55
- export const Label2 = styled.div<ITextComponentProps & Regular>`
56
- ${Typography.Label2};
57
- `
97
+ export const Label: FC<ITextComponentProps & ILabelProps> = (props) => {
98
+ return <LABEL {...toTransientProps(props)}>{props.children}</LABEL>
99
+ }
@@ -65,7 +65,6 @@ export const RED = {
65
65
  100: '#FEE2E2',
66
66
  200: '#FECACA',
67
67
  300: '#FCA5A5', // @TODO we should update the current structure with the figma updates
68
- 3300: '#FEF6F6',
69
68
  400: '#F87171',
70
69
  500: '#EF4444',
71
70
  600: '#DC2626',
@@ -135,6 +135,7 @@ export const Actions = {
135
135
  Default: BLUE[600],
136
136
  Hover: BLUE[700],
137
137
  Pressed: BLUE[800],
138
+ Depressed: BLUE[900],
138
139
  Disabled: DisabledGray,
139
140
  },
140
141
  Secondary: {
@@ -146,14 +147,14 @@ export const Actions = {
146
147
  },
147
148
  Critical: {
148
149
  Default: RED[600],
149
- Hover: RED[500],
150
- Pressed: RED[700],
150
+ Hover: RED[700],
151
+ Pressed: RED[800],
151
152
  Disabled: DisabledGray,
152
153
  },
153
154
  SecondaryCritical: {
154
155
  Default: WHITE,
155
- Hover: RED[500],
156
- Pressed: RED[700],
156
+ Hover: RED[700],
157
+ Pressed: RED[800],
157
158
  Disabled: DisabledGray,
158
159
  },
159
160
  }
@@ -4,7 +4,7 @@ import { FC, Hex, isDefined } from '@helpers'
4
4
  import { Flex, SpaceBetween } from '@components'
5
5
 
6
6
  import { GRAY, WHITE } from '../base-palette'
7
- import { Caption, Label1 } from 'components/typography'
7
+ import { Caption, Label } from 'components/typography'
8
8
  import { Margin } from '../../spacing'
9
9
 
10
10
  function isPale (color: string) {
@@ -68,7 +68,7 @@ const Details = styled(Flex)`
68
68
  justify-content: center;
69
69
  `
70
70
 
71
- const ColorName = styled(Label1)`
71
+ const ColorName = styled(Label)`
72
72
  white-space: nowrap;
73
73
  margin-bottom: ${Margin.xxxs};
74
74
  `
@@ -91,7 +91,7 @@ export const ColorSquare: FC<IColorSquareProps> = (props) => {
91
91
  <ColorFrame>
92
92
  <SquareColorSample color={props.hex} border={props.border} />
93
93
  <Details column>
94
- <ColorName emphasis>{props.name}</ColorName>
94
+ <ColorName strong>{props.name}</ColorName>
95
95
  <ColorId subdued>{props.colorId}</ColorId>
96
96
  </Details>
97
97
  </ColorFrame>
@@ -0,0 +1,205 @@
1
+ export const InterFontFace = `
2
+ @font-face {
3
+ font-family: 'Inter';
4
+ font-style: normal;
5
+ font-weight: 300;
6
+ src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2JL7W0Q5n-wU.woff2)
7
+ format('woff2');
8
+ unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F,
9
+ U+FE2E-FE2F;
10
+ }
11
+ /* cyrillic */
12
+ @font-face {
13
+ font-family: 'Inter';
14
+ font-style: normal;
15
+ font-weight: 300;
16
+ src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa0ZL7W0Q5n-wU.woff2)
17
+ format('woff2');
18
+ unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
19
+ }
20
+ /* greek-ext */
21
+ @font-face {
22
+ font-family: 'Inter';
23
+ font-style: normal;
24
+ font-weight: 300;
25
+ src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2ZL7W0Q5n-wU.woff2)
26
+ format('woff2');
27
+ unicode-range: U+1F00-1FFF;
28
+ }
29
+ /* greek */
30
+ @font-face {
31
+ font-family: 'Inter';
32
+ font-style: normal;
33
+ font-weight: 300;
34
+ src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1pL7W0Q5n-wU.woff2)
35
+ format('woff2');
36
+ unicode-range: U+0370-03FF;
37
+ }
38
+ /* vietnamese */
39
+ @font-face {
40
+ font-family: 'Inter';
41
+ font-style: normal;
42
+ font-weight: 300;
43
+ src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2pL7W0Q5n-wU.woff2)
44
+ format('woff2');
45
+ unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169,
46
+ U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
47
+ }
48
+ /* latin-ext */
49
+ @font-face {
50
+ font-family: 'Inter';
51
+ font-style: normal;
52
+ font-weight: 300;
53
+ src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa25L7W0Q5n-wU.woff2)
54
+ format('woff2');
55
+ unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
56
+ U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
57
+ }
58
+ /* latin */
59
+ @font-face {
60
+ font-family: 'Inter';
61
+ font-style: normal;
62
+ font-weight: 300;
63
+ src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7W0Q5nw.woff2)
64
+ format('woff2');
65
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
66
+ U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212,
67
+ U+2215, U+FEFF, U+FFFD;
68
+ }
69
+ /* cyrillic-ext */
70
+ @font-face {
71
+ font-family: 'Inter';
72
+ font-style: normal;
73
+ font-weight: 400;
74
+ src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2JL7W0Q5n-wU.woff2)
75
+ format('woff2');
76
+ unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F,
77
+ U+FE2E-FE2F;
78
+ }
79
+ /* cyrillic */
80
+ @font-face {
81
+ font-family: 'Inter';
82
+ font-style: normal;
83
+ font-weight: 400;
84
+ src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa0ZL7W0Q5n-wU.woff2)
85
+ format('woff2');
86
+ unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
87
+ }
88
+ /* greek-ext */
89
+ @font-face {
90
+ font-family: 'Inter';
91
+ font-style: normal;
92
+ font-weight: 400;
93
+ src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2ZL7W0Q5n-wU.woff2)
94
+ format('woff2');
95
+ unicode-range: U+1F00-1FFF;
96
+ }
97
+ /* greek */
98
+ @font-face {
99
+ font-family: 'Inter';
100
+ font-style: normal;
101
+ font-weight: 400;
102
+ src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1pL7W0Q5n-wU.woff2)
103
+ format('woff2');
104
+ unicode-range: U+0370-03FF;
105
+ }
106
+ /* vietnamese */
107
+ @font-face {
108
+ font-family: 'Inter';
109
+ font-style: normal;
110
+ font-weight: 400;
111
+ src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2pL7W0Q5n-wU.woff2)
112
+ format('woff2');
113
+ unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169,
114
+ U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
115
+ }
116
+ /* latin-ext */
117
+ @font-face {
118
+ font-family: 'Inter';
119
+ font-style: normal;
120
+ font-weight: 400;
121
+ src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa25L7W0Q5n-wU.woff2)
122
+ format('woff2');
123
+ unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
124
+ U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
125
+ }
126
+ /* latin */
127
+ @font-face {
128
+ font-family: 'Inter';
129
+ font-style: normal;
130
+ font-weight: 400;
131
+ src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7W0Q5nw.woff2)
132
+ format('woff2');
133
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
134
+ U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212,
135
+ U+2215, U+FEFF, U+FFFD;
136
+ }
137
+ /* cyrillic-ext */
138
+ @font-face {
139
+ font-family: 'Inter';
140
+ font-style: normal;
141
+ font-weight: 500;
142
+ src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2JL7W0Q5n-wU.woff2)
143
+ format('woff2');
144
+ unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F,
145
+ U+FE2E-FE2F;
146
+ }
147
+ /* cyrillic */
148
+ @font-face {
149
+ font-family: 'Inter';
150
+ font-style: normal;
151
+ font-weight: 500;
152
+ src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa0ZL7W0Q5n-wU.woff2)
153
+ format('woff2');
154
+ unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
155
+ }
156
+ /* greek-ext */
157
+ @font-face {
158
+ font-family: 'Inter';
159
+ font-style: normal;
160
+ font-weight: 500;
161
+ src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2ZL7W0Q5n-wU.woff2)
162
+ format('woff2');
163
+ unicode-range: U+1F00-1FFF;
164
+ }
165
+ /* greek */
166
+ @font-face {
167
+ font-family: 'Inter';
168
+ font-style: normal;
169
+ font-weight: 500;
170
+ src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1pL7W0Q5n-wU.woff2)
171
+ format('woff2');
172
+ unicode-range: U+0370-03FF;
173
+ }
174
+ /* vietnamese */
175
+ @font-face {
176
+ font-family: 'Inter';
177
+ font-style: normal;
178
+ font-weight: 500;
179
+ src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2pL7W0Q5n-wU.woff2)
180
+ format('woff2');
181
+ unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169,
182
+ U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
183
+ }
184
+ /* latin-ext */
185
+ @font-face {
186
+ font-family: 'Inter';
187
+ font-style: normal;
188
+ font-weight: 500;
189
+ src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa25L7W0Q5n-wU.woff2)
190
+ format('woff2');
191
+ unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
192
+ U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
193
+ }
194
+ /* latin */
195
+ @font-face {
196
+ font-family: 'Inter';
197
+ font-style: normal;
198
+ font-weight: 500;
199
+ src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7W0Q5nw.woff2)
200
+ format('woff2');
201
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
202
+ U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212,
203
+ U+2215, U+FEFF, U+FFFD;
204
+ }
205
+ `
@@ -1,4 +1,4 @@
1
- import { bitwiseOr, MappedEnum, PropsWithChildren, RequireOnlyOne } from '@helpers'
1
+ import { bitwiseOr, isDefined, MappedEnum, PropsWithChildren, RequireOnlyOne } from '@helpers'
2
2
  import { Text } from '../color-system'
3
3
 
4
4
  export const enum TextAspects {
@@ -37,7 +37,14 @@ const TextAspectColors = {
37
37
 
38
38
  export type ITextAspectProps = Partial<RequireOnlyOne<TextOptions<boolean>>> & PropsWithChildren
39
39
 
40
- export function getTextAspect(props: ITextAspectProps) {
40
+ export type TransientTextOptions = Omit<TextOptions<boolean>, 'onCritical' | 'onPrimary'> & {
41
+ $onCritical?: boolean
42
+ $onPrimary?: boolean
43
+ }
44
+
45
+ export type ITransientTextAspectProps = Partial<RequireOnlyOne<TransientTextOptions>> & PropsWithChildren
46
+
47
+ export function getTextAspect(props: ITextAspectProps & ITransientTextAspectProps) {
41
48
  return TextAspectColors[
42
49
  toTextAspect(
43
50
  bitwiseOr([
@@ -46,8 +53,8 @@ export function getTextAspect(props: ITextAspectProps) {
46
53
  props.light,
47
54
  props.critical,
48
55
  props.success,
49
- props.onPrimary,
50
- props.onCritical,
56
+ isDefined(props.onPrimary) ? props.onPrimary : props.$onPrimary,
57
+ isDefined(props.onCritical) ? props.onCritical : props.$onCritical,
51
58
  ])
52
59
  )
53
60
  ]