@loadsmart/loadsmart-ui 5.11.0 → 5.11.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 (56) hide show
  1. package/dist/index.js +490 -340
  2. package/dist/index.js.map +1 -1
  3. package/dist/testing/SelectEvent/SelectEvent.d.ts +2 -0
  4. package/dist/testing/index.js +1 -1
  5. package/dist/testing/index.js.map +1 -1
  6. package/package.json +8 -7
  7. package/src/common/CloseButton/CloseButton.tsx +11 -7
  8. package/src/common/SelectionWrapper.tsx +7 -7
  9. package/src/components/Accordion/Accordion.tsx +28 -22
  10. package/src/components/Banner/Banner.tsx +2 -2
  11. package/src/components/Breadcrumbs/Breadcrumb.tsx +3 -2
  12. package/src/components/Breadcrumbs/Breadcrumbs.tsx +1 -1
  13. package/src/components/Button/Button.tsx +20 -17
  14. package/src/components/Calendar/Calendar.tsx +8 -4
  15. package/src/components/Calendar/PickerModeToggle.tsx +6 -3
  16. package/src/components/Calendar/Pickers/DayPicker.tsx +1 -1
  17. package/src/components/Calendar/Pickers/MonthPicker.tsx +1 -1
  18. package/src/components/Calendar/Pickers/PickerButton.tsx +39 -29
  19. package/src/components/Calendar/Pickers/YearPicker.tsx +1 -1
  20. package/src/components/Card/Card.tsx +9 -6
  21. package/src/components/Card/CardTitle.tsx +3 -4
  22. package/src/components/Checkbox/Checkbox.tsx +26 -14
  23. package/src/components/Dialog/Dialog.tsx +5 -5
  24. package/src/components/DragDropFile/styles.tsx +11 -6
  25. package/src/components/Drawer/Drawer.tsx +6 -6
  26. package/src/components/Dropdown/DropdownMenu.tsx +28 -15
  27. package/src/components/Dropdown/DropdownTrigger.tsx +34 -24
  28. package/src/components/HighlightMatch/HighlightMatch.tsx +1 -2
  29. package/src/components/Label/Label.tsx +3 -3
  30. package/src/components/Link/Link.tsx +13 -9
  31. package/src/components/Loaders/LoadingBar.tsx +2 -2
  32. package/src/components/Modal/Modal.tsx +12 -7
  33. package/src/components/ProgressBar/ProgressBar.tsx +6 -4
  34. package/src/components/Radio/Radio.tsx +19 -11
  35. package/src/components/Section/Section.tsx +8 -6
  36. package/src/components/Select/Select.test.tsx +161 -161
  37. package/src/components/Select/SelectEmpty.tsx +5 -4
  38. package/src/components/Select/SelectTrigger.tsx +11 -6
  39. package/src/components/SideNavigation/Menu/Menu.tsx +3 -3
  40. package/src/components/SideNavigation/Menu/MenuBaseItem.tsx +5 -4
  41. package/src/components/SideNavigation/Menu/MenuExpandable.tsx +3 -2
  42. package/src/components/Steps/ProgressSteps/ProgressStep.tsx +39 -31
  43. package/src/components/Switch/Switch.tsx +18 -6
  44. package/src/components/Table/Table.tsx +2 -2
  45. package/src/components/Tabs/Tabs.tsx +32 -26
  46. package/src/components/Tag/Tag.tsx +44 -35
  47. package/src/components/TextField/TextField.tsx +22 -15
  48. package/src/components/Textarea/Textarea.tsx +22 -17
  49. package/src/components/Toast/Toast.tsx +3 -3
  50. package/src/components/ToggleGroup/Toggle.tsx +7 -7
  51. package/src/components/ToggleGroup/ToggleGroup.stories.tsx +14 -12
  52. package/src/components/Tooltip/Tooltip.tsx +22 -20
  53. package/src/components/TopNavigation/Menu/MenuItemDropdown.tsx +1 -1
  54. package/src/components/TopNavigation/OpenSideNavButton/OpenSideNavButton.tsx +1 -1
  55. package/src/styles/font.tsx +3 -3
  56. package/src/testing/SelectEvent/SelectEvent.ts +87 -45
@@ -23,11 +23,11 @@ export interface DialogProps extends WithScaleProps {
23
23
 
24
24
  const Header = styled.h1`
25
25
  padding-bottom: ${token('space-s')};
26
- font-size: ${token('font-size-2')};
27
- font-weight: ${token('font-weight-bold')};
28
- line-height: ${token('font-height-2')};
29
26
 
30
27
  color: ${token('dialog-header-color')};
28
+ font-weight: ${token('font-weight-bold')};
29
+ font-size: ${token('font-size-2')};
30
+ line-height: ${token('font-height-2')};
31
31
  text-align: center;
32
32
 
33
33
  border-bottom: 1px solid ${token('dialog-header-border-color')};
@@ -35,10 +35,10 @@ const Header = styled.h1`
35
35
  const Body = styled.div`
36
36
  margin-top: ${token('space-l')};
37
37
  margin-bottom: ${token('space-l')};
38
- font-size: ${token('font-size-4')};
39
- line-height: ${token('font-height-3')};
40
38
 
41
39
  color: ${token('dialog-body-font-color')};
40
+ font-size: ${token('font-size-4')};
41
+ line-height: ${token('font-height-3')};
42
42
  text-align: center;
43
43
  `
44
44
 
@@ -29,31 +29,36 @@ export const DragDropFileWrapper = styled(Stack)<{ withFileList: boolean }>`
29
29
  export const DropZoneWrapper = styled((props: StackProps) => <Stack as="label" {...props} />)<
30
30
  Pick<DropZoneProps, 'disabled' | 'error'>
31
31
  >`
32
- padding: ${getToken('space-l')} ${getToken('space-3xl')};
33
- text-align: center;
32
+ ${transition({ property: 'border-color, box-shadow, opacity' })}
33
+
34
34
  cursor: pointer;
35
+
35
36
  background-color: ${getToken('color-neutral-white')};
37
+ border-radius: ${getToken('border-radius-s')};
38
+ border: 2px dashed;
36
39
  border-color: ${conditional({
37
40
  'color-neutral-light': whenProps({ error: false }),
38
41
  'color-danger': whenProps({ disabled: false, error: true }),
39
42
  })};
40
- border-style: dashed;
41
- border-width: 2px;
42
- border-radius: ${getToken('border-radius-s')};
43
+
44
+ padding: ${getToken('space-l')} ${getToken('space-3xl')};
45
+
46
+ text-align: center;
43
47
 
44
48
  ${hoverable`
45
49
  border-color: ${conditional({
46
50
  'color-accent': whenProps({ disabled: false, error: false }),
47
51
  })};
48
52
  `}
53
+
49
54
  ${focusable`
50
55
  border-color: ${conditional({
51
56
  'color-accent': whenProps({ disabled: false, error: false }),
52
57
  })};
53
58
  box-shadow: ${getToken('shadow-glow-primary')};
54
59
  `}
60
+
55
61
  ${disableable()}
56
- ${transition({ property: 'border-color, box-shadow, opacity' })}
57
62
  `
58
63
 
59
64
  export const HiddenInput = styled.input`
@@ -29,12 +29,12 @@ const StyledAside = styled.aside<Pick<DrawerProps, 'open'>>`
29
29
  width: 100%;
30
30
  height: 100%;
31
31
 
32
+ background: ${token('modal-overlay-background')};
33
+
32
34
  visibility: ${conditional({
33
35
  visible: whenProps({ open: true }),
34
36
  hidden: whenProps({ open: false }),
35
37
  })};
36
-
37
- background: ${token('modal-overlay-background')};
38
38
  `
39
39
 
40
40
  const CloseButton = styled(DefaultCloseButton)`
@@ -81,15 +81,15 @@ const StyledHeader = styled.header`
81
81
  justify-content: center;
82
82
 
83
83
  padding: ${token('space-xl')};
84
- font-size: ${token('font-size-2')};
85
- font-weight: ${token('font-weight-bold')};
86
84
 
87
85
  color: ${token('color-neutral-darker')};
86
+ font-weight: ${token('font-weight-bold')};
87
+ font-size: ${token('font-size-2')};
88
88
  text-align: center;
89
89
 
90
90
  border-bottom-color: ${token('color-neutral-light')};
91
- border-bottom-style: solid;
92
91
  border-bottom-width: 1px;
92
+ border-bottom-style: solid;
93
93
  `
94
94
 
95
95
  const StyledBody = styled.div`
@@ -108,8 +108,8 @@ const StyledFooter = styled.footer`
108
108
  padding: ${token('space-xl')};
109
109
 
110
110
  border-top-color: ${token('color-neutral-light')};
111
- border-top-style: solid;
112
111
  border-top-width: 1px;
112
+ border-top-style: solid;
113
113
  `
114
114
 
115
115
  export interface DrawerHeaderProps {
@@ -66,32 +66,42 @@ const Children = styled.span`
66
66
  `
67
67
 
68
68
  const DropdownItemWrapper = styled.button`
69
+ ${transition()}
70
+
69
71
  display: inline-flex;
70
- flex: 1 0;
71
- align-items: center;
72
72
  justify-content: flex-start;
73
- min-height: 36px;
74
- padding: 0 ${token('space-s')};
75
- margin: 0 ${token('space-s')};
76
- font-size: ${token('font-size-4')};
77
- color: ${token('color-neutral-darker')};
78
- cursor: pointer;
79
- background: ${token('color-neutral-white')};
80
- border: none;
81
- border-radius: ${token('border-radius-s')};
73
+ align-items: center;
82
74
 
83
75
  ${font({
84
76
  height: 'font-height-3',
85
77
  weight: 'font-weight-medium',
86
78
  })}
79
+ font-size: ${token('font-size-4')};
80
+
81
+ min-height: 36px;
82
+ flex: 1 0;
83
+
84
+ border: none;
85
+ border-radius: ${token('border-radius-s')};
86
+ background: ${token('color-neutral-white')};
87
+
88
+ color: ${token('color-neutral-darker')};
89
+
90
+ padding: 0 ${token('space-s')};
91
+
92
+ margin: 0 ${token('space-s')};
93
+
94
+ cursor: pointer;
95
+
87
96
  ${hoverable`
88
97
  background: ${token('color-neutral-lighter')};
89
98
  `}
99
+
90
100
  ${focusable`
91
101
  background: ${token('color-neutral-lighter')};
92
102
  `}
103
+
93
104
  ${disableable()}
94
- ${transition()}
95
105
 
96
106
  ${Children} {
97
107
  flex: 1 0 auto;
@@ -114,14 +124,17 @@ const DropdownItemWrapper = styled.button`
114
124
 
115
125
  const DropdownSectionHeader = styled.strong`
116
126
  display: flex;
117
- align-items: center;
118
127
  justify-content: flex-start;
119
- margin: 0 ${token('space-s')};
120
- font-size: ${token('font-size-4')};
128
+ align-items: center;
129
+
121
130
  ${font({
122
131
  height: 'font-height-3',
123
132
  weight: 'font-weight-bold',
124
133
  })}
134
+
135
+ font-size: ${token('font-size-4')};
136
+
137
+ margin: 0 ${token('space-s')};
125
138
  `
126
139
 
127
140
  const DropdownSectionWrapper = styled.div`
@@ -57,15 +57,19 @@ const TriggerButton = styled(
57
57
  SelectorButton as React.ForwardRefExoticComponent<TriggerButtonProps>
58
58
  ).attrs(triggerButtonAttrs)`
59
59
  flex: 1;
60
+
60
61
  justify-content: flex-start;
61
- font-weight: ${conditional({
62
- 'font-weight-regular': whenProps({ outlined: false }),
63
- })};
62
+
63
+ border: none;
64
+
64
65
  text-transform: ${conditional({
65
66
  capitalize: whenProps({ outlined: false, variant: 'tertiary' }),
66
67
  uppercase: whenProps({ outlined: true }),
67
68
  })};
68
- border: none;
69
+
70
+ font-weight: ${conditional({
71
+ 'font-weight-regular': whenProps({ outlined: false }),
72
+ })};
69
73
 
70
74
  ${hoverable`
71
75
  border-color: ${conditional({
@@ -113,17 +117,17 @@ const TriggerButton = styled(
113
117
  overflow: hidden;
114
118
 
115
119
  font-weight: ${token('font-weight-bold')};
116
- pointer-events: none;
117
120
 
118
121
  visibility: hidden;
119
122
 
120
- /* @REVIEW: since this is a span descendant of a button
121
- I'm using the direct value of children the solution inside Link
123
+ /* @REVIEW: since this is a span descendant of a button
124
+ I'm using the direct value of children the solution inside Link
122
125
  relies on data-text attribute */
123
126
 
124
127
  content: '${children}';
125
128
  content: '${children}' / '';
126
129
  user-select: none;
130
+ pointer-events: none;
127
131
 
128
132
  @media speech {
129
133
  display: none;
@@ -135,29 +139,33 @@ const TriggerButton = styled(
135
139
  `
136
140
 
137
141
  const DropdownTriggerWrapper = styled.div<DropdownTriggerWrapperProps>`
142
+ ${transition()}
143
+
144
+ ${font({
145
+ height: 'font-height-3',
146
+ weight: 'font-weight-medium',
147
+ })}
148
+
138
149
  display: flex;
139
- flex: 1;
140
- align-items: center;
141
150
  justify-content: flex-start;
151
+ align-items: center;
142
152
 
143
- height: 36px;
144
- font-size: ${token('font-size-4')};
145
-
146
- color: ${token('color-neutral-darker')};
153
+ border-radius: ${token('button-border-radius')};
154
+ border-width: ${token('button-border-width')};
155
+ border-style: solid;
147
156
  border-color: ${conditional({
148
157
  'button-secondary-border-color': whenProps({ scheme: 'light', $outlined: true }),
149
158
  'button-secondary-dark-border-color': whenProps({ scheme: 'dark', $outlined: true }),
150
159
  'color-transparent': whenProps({ $outlined: false }),
151
160
  })};
152
- border-style: solid;
153
- border-width: ${token('button-border-width')};
154
- border-radius: ${token('button-border-radius')};
155
161
 
156
- ${transition()}
157
- ${font({
158
- height: 'font-height-3',
159
- weight: 'font-weight-medium',
160
- })}
162
+ font-size: ${token('font-size-4')};
163
+
164
+ color: ${token('color-neutral-darker')};
165
+
166
+ height: 36px;
167
+ flex: 1;
168
+
161
169
  ${hoverable`
162
170
  border-color: ${conditional({
163
171
  'button-secondary-border-color--hover': whenProps({ scheme: 'light', $outlined: true }),
@@ -205,11 +213,13 @@ const DropdownTriggerWrapper = styled.div<DropdownTriggerWrapperProps>`
205
213
  `
206
214
 
207
215
  const TriggerHandle = styled(BaseButton)`
208
- height: calc(100% - 2px);
216
+ ${focusable()}
217
+
209
218
  background: ${token('color-transparent')};
210
- border: none;
211
219
  border-radius: 0 ${token('border-radius-s')} ${token('border-radius-s')} 0;
212
- ${focusable()}
220
+ border: none;
221
+
222
+ height: calc(100% - 2px);
213
223
  `
214
224
 
215
225
  const RotatableIcon = styled(DefaultIcon)<{ $rotate: boolean }>`
@@ -15,9 +15,8 @@ const HighlightMatchWrapper = styled.span`
15
15
  white-space: pre;
16
16
 
17
17
  mark {
18
- font-weight: ${token('font-weight-bold')};
19
-
20
18
  color: inherit;
19
+ font-weight: ${token('font-weight-bold')};
21
20
 
22
21
  background-color: ${token('color-transparent')};
23
22
  }
@@ -56,9 +56,9 @@ const StyledChildren = styled.span<WithAdditionalProps>`
56
56
 
57
57
  const StyledRequired = styled.sup`
58
58
  top: 0;
59
- font-size: ${token('label-font-size')};
60
59
 
61
60
  color: ${token('label-required-color')};
61
+ font-size: ${token('label-font-size')};
62
62
  `
63
63
 
64
64
  const StyledTooltipAnchor = styled.span<WithAdditionalProps>`
@@ -68,13 +68,13 @@ const StyledTooltipAnchor = styled.span<WithAdditionalProps>`
68
68
  width: 16px;
69
69
  height: 16px;
70
70
  margin: 0 0 0 ${token('label-tooltip-margin-left')};
71
- font-size: ${token('label-tooltip-font-size')};
72
- font-weight: ${token('label-tooltip-font-weight')};
73
71
 
74
72
  color: ${conditional({
75
73
  'label-tooltip-font-color': whenProps({ scheme: 'light' }),
76
74
  'label-tooltip-dark-font-color': whenProps({ scheme: 'dark' }),
77
75
  })};
76
+ font-weight: ${token('label-tooltip-font-weight')};
77
+ font-size: ${token('label-tooltip-font-size')};
78
78
 
79
79
  background: ${conditional({
80
80
  'label-tooltip-background-color': whenProps({ scheme: 'light' }),
@@ -17,27 +17,31 @@ export interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
17
17
  }
18
18
 
19
19
  const StyledBaseAnchor = styled.a`
20
+ ${font({
21
+ height: 'link-font-height',
22
+ weight: 'link-font-weight',
23
+ })}
24
+ ${transition()}
25
+
26
+ ${ellipsizable()}
27
+
20
28
  display: inline-flex;
21
29
  flex-direction: column;
22
30
  align-items: center;
23
31
  justify-content: center;
24
32
 
25
- min-height: 24px;
33
+ text-align: center;
26
34
  font-size: ${token('link-font-size')};
27
35
  color: ${token('color-neutral-darker')};
28
- text-align: center;
29
36
  text-decoration: none;
30
37
 
31
- ${font({
32
- height: 'link-font-height',
33
- weight: 'link-font-weight',
34
- })}
35
- ${ellipsizable()}
36
- ${transition()}
38
+ min-height: 24px;
39
+
37
40
  ${hoverable`
38
41
  text-decoration: underline;
39
42
  font-weight: ${token('link-font-weight--hover')};
40
43
  `}
44
+
41
45
  ${disableable``}
42
46
 
43
47
  ${({ children }) =>
@@ -49,13 +53,13 @@ const StyledBaseAnchor = styled.a`
49
53
  overflow: hidden;
50
54
 
51
55
  font-weight: ${token('link-font-weight--hover')};
52
- pointer-events: none;
53
56
 
54
57
  visibility: hidden;
55
58
 
56
59
  content: attr(data-text);
57
60
  content: attr(data-text) / '';
58
61
  user-select: none;
62
+ pointer-events: none;
59
63
 
60
64
  @media speech {
61
65
  display: none;
@@ -29,12 +29,12 @@ export const Bar = styled.div<{ width?: number; velocity?: number }>`
29
29
  width: 100%;
30
30
  height: ${token('space-s')};
31
31
 
32
- content: '';
33
-
34
32
  background-color: ${token('color-primary')};
35
33
 
36
34
  animation: ${loading} ${({ velocity }) => (velocity && velocity > 0 ? velocity : 2.5)}s linear
37
35
  infinite;
36
+
37
+ content: '';
38
38
  }
39
39
  `
40
40
 
@@ -52,13 +52,13 @@ const ModalWrapper = styled.div<ModalWrapperProps>`
52
52
  `
53
53
 
54
54
  const HeaderWrapper = styled.div`
55
- box-sizing: content-box;
56
55
  display: flex;
57
56
  align-items: center;
58
57
  justify-content: center;
58
+ box-sizing: content-box;
59
59
  height: ${token('space-xl')};
60
- padding-bottom: ${token('space-s')};
61
60
  margin-bottom: ${token('space-l')};
61
+ padding-bottom: ${token('space-s')};
62
62
 
63
63
  border-bottom: 1px solid ${token('color-neutral-light')};
64
64
  `
@@ -71,15 +71,20 @@ const Close = styled(CloseButton).attrs({
71
71
  `
72
72
 
73
73
  const Content = styled.div<ContentProps>`
74
- position: relative;
75
- z-index: ${token('z-index-modal')};
76
- padding: ${token('space-xl')};
77
- margin: 0 auto;
78
74
  background: white;
79
75
  border-radius: ${token('border-radius-s')};
80
- outline: none;
81
76
  box-shadow: ${token('shadow-modal')};
82
77
 
78
+ padding: ${token('space-xl')};
79
+
80
+ margin: 0 auto;
81
+
82
+ position: relative;
83
+
84
+ outline: none;
85
+
86
+ z-index: ${token('z-index-modal')};
87
+
83
88
  ${({ fullscreen }) =>
84
89
  fullscreen &&
85
90
  css`
@@ -5,16 +5,18 @@ import conditional, { whenProps } from 'tools/conditional'
5
5
  import Status from 'utils/types/Status'
6
6
 
7
7
  const Bar = styled.div<{ rounded: boolean }>`
8
- position: relative;
8
+ align-items: center;
9
9
  display: flex;
10
10
  flex-grow: 0;
11
11
  flex-shrink: 1;
12
- align-items: center;
12
+
13
13
  justify-content: center;
14
+ overflow: hidden;
14
15
  width: 100%;
15
- height: ${token('progressbar-height')};
16
16
 
17
- overflow: hidden;
17
+ position: relative;
18
+
19
+ height: ${token('progressbar-height')};
18
20
 
19
21
  ${({ rounded }) =>
20
22
  rounded &&
@@ -21,37 +21,45 @@ export interface RadioProps extends InputHTMLAttributes<HTMLInputElement>, Selec
21
21
  const Check = styled(Icon)<SelectionStyleProps>`
22
22
  position: absolute;
23
23
  top: 50%;
24
+
24
25
  left: 50%;
25
26
 
26
27
  width: 10px;
27
28
  height: 10px;
28
29
 
30
+ transform: translate(-50%, -50%);
31
+
29
32
  pointer-events: none;
30
33
 
31
34
  fill: currentColor;
32
-
33
- transform: translate(-50%, -50%);
34
35
  `
35
36
 
36
37
  const Selector = styled.input<SelectionStyleProps>`
38
+ ${transition()}
39
+
37
40
  display: inline-flex;
38
41
  flex-flow: row nowrap;
39
42
  align-items: center;
40
43
 
41
- width: ${token('radio-small-selector-size')};
42
- height: ${token('radio-small-selector-size')};
43
- color: white;
44
44
  cursor: pointer;
45
+
46
+ appearance: none;
47
+
48
+ outline: none;
49
+
50
+ color: white;
51
+
52
+ height: ${token('radio-small-selector-size')};
53
+ width: ${token('radio-small-selector-size')};
54
+
55
+ border-radius: ${token('radio-selector-border-radius')};
56
+ border-width: ${token('button-border-width')};
57
+ border-style: solid;
58
+
45
59
  background: ${conditional({
46
60
  'radio-selector-background': whenProps({ scheme: 'light' }),
47
61
  'radio-dark-selector-background': whenProps({ scheme: 'dark' }),
48
62
  })};
49
- appearance: none;
50
- border-style: solid;
51
- border-width: ${token('button-border-width')};
52
- border-radius: ${token('radio-selector-border-radius')};
53
- outline: none;
54
- ${transition()}
55
63
 
56
64
  &:not(:checked) {
57
65
  border-color: ${conditional({
@@ -12,16 +12,18 @@ const StyledSection = styled.section`
12
12
  `
13
13
 
14
14
  const StyledSectionTitle = styled.section`
15
- padding: ${token('space-s')} ${token('space-xs')};
16
- margin-bottom: ${token('space-l')};
17
- font-size: ${token('font-size-3')};
18
- color: ${token('color-neutral-darker')};
19
- border-bottom: 2px solid ${token('color-neutral-light')};
20
-
21
15
  ${font({
22
16
  weight: 'font-weight-bold',
23
17
  height: 'font-height-2',
24
18
  })}
19
+
20
+ font-size: ${token('font-size-3')};
21
+ color: ${token('color-neutral-darker')};
22
+
23
+ border-bottom: 2px solid ${token('color-neutral-light')};
24
+
25
+ padding: ${token('space-s')} ${token('space-xs')};
26
+ margin-bottom: ${token('space-l')};
25
27
  `
26
28
 
27
29
  const StyledSpan = styled.span`