@loadsmart/loadsmart-ui 5.13.2 → 5.14.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 (39) hide show
  1. package/dist/components/Text/Text.d.ts +1 -1
  2. package/dist/components/TopNavigation/TopNavigation.d.ts +2 -2
  3. package/dist/index.js +57 -45
  4. package/dist/index.js.map +1 -1
  5. package/dist/miranda-compatibility.theme-bb0cbfb2.js +2 -0
  6. package/dist/miranda-compatibility.theme-bb0cbfb2.js.map +1 -0
  7. package/dist/prop-73352de5.js +2 -0
  8. package/dist/{prop-0f94ff83.js.map → prop-73352de5.js.map} +1 -1
  9. package/dist/testing/index.js +1 -1
  10. package/dist/testing/index.js.map +1 -1
  11. package/dist/theming/index.js +1 -1
  12. package/dist/theming/index.js.map +1 -1
  13. package/dist/theming/themes/alice.theme.d.ts +171 -9
  14. package/dist/theming/themes/index.d.ts +1 -0
  15. package/dist/theming/themes/loadsmart.theme.d.ts +83 -9
  16. package/dist/theming/themes/miranda-compatibility.theme.d.ts +745 -0
  17. package/dist/theming/theming.helpers.d.ts +1 -0
  18. package/dist/tools/index.js +1 -1
  19. package/package.json +5 -3
  20. package/src/addons/Theme/register.js +2 -1
  21. package/src/components/Dropdown/DropdownMenu.tsx +1 -1
  22. package/src/components/Dropdown/DropdownTrigger.tsx +6 -4
  23. package/src/components/Select/SelectOption.tsx +4 -7
  24. package/src/components/SideNavigation/Menu/Menu.tsx +4 -3
  25. package/src/components/SideNavigation/Menu/MenuBaseItem.tsx +1 -1
  26. package/src/components/SideNavigation/Menu/MenuLink.tsx +4 -5
  27. package/src/components/SideNavigation/SideNavigation.stories.tsx +1 -1
  28. package/src/components/Steps/ProgressSteps/ProgressStep.tsx +9 -7
  29. package/src/components/ToggleGroup/Toggle.tsx +58 -33
  30. package/src/components/ToggleGroup/ToggleGroup.tsx +32 -19
  31. package/src/components/TopNavigation/TopNavigation.tsx +2 -2
  32. package/src/theming/themes/alice.theme.ts +111 -20
  33. package/src/theming/themes/index.ts +1 -0
  34. package/src/theming/themes/loadsmart.theme.ts +100 -9
  35. package/src/theming/themes/miranda-compatibility.theme.ts +900 -0
  36. package/src/theming/theming.helpers.ts +6 -0
  37. package/dist/loadsmart.theme-63c13988.js +0 -2
  38. package/dist/loadsmart.theme-63c13988.js.map +0 -1
  39. package/dist/prop-0f94ff83.js +0 -2
@@ -18,4 +18,5 @@ export declare function generateBorderGetters({ radiuses, widths, }: {
18
18
  radiuses: VariableMap;
19
19
  widths: VariableMap;
20
20
  }): Record<string, (name: string) => VariableValue>;
21
+ export declare function generateHeightGetter(heights: VariableMap): (name: string) => VariableValue;
21
22
  export {};
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../prop-0f94ff83.js");require("../toArray-b56541b4.js"),require("../loadsmart.theme-63c13988.js"),require("../theming/index.js"),exports.conditional=e.conditional,exports.prop=e.prop,exports.whenProps=e.whenProps;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../prop-73352de5.js");require("../toArray-b56541b4.js"),require("../miranda-compatibility.theme-bb0cbfb2.js"),require("@loadsmart/miranda-tokens"),require("../theming/index.js"),exports.conditional=e.conditional,exports.prop=e.prop,exports.whenProps=e.whenProps;
2
2
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loadsmart/loadsmart-ui",
3
- "version": "5.13.2",
3
+ "version": "5.14.1",
4
4
  "description": "Miranda UI, a React UI library",
5
5
  "main": "dist",
6
6
  "files": [
@@ -78,6 +78,7 @@
78
78
  "@babel/preset-typescript": "7.13.0",
79
79
  "@commitlint/cli": "16.0.2",
80
80
  "@commitlint/config-conventional": "16.0.0",
81
+ "@loadsmart/miranda-tokens": "1.3.0",
81
82
  "@loadsmart/stylelint-config": "0.0.3",
82
83
  "@rollup/plugin-babel": "5.3.0",
83
84
  "@rollup/plugin-commonjs": "19.0.0",
@@ -167,16 +168,17 @@
167
168
  "tailwindcss": "npm:@tailwindcss/postcss7-compat",
168
169
  "ts-jest": "26.5.6",
169
170
  "ts-toolbelt": "^9.6.0",
170
- "ttypescript": "1.5.12",
171
+ "ttypescript": "^1.5.13",
171
172
  "typescript": "4.2.4",
172
173
  "typescript-plugin-styled-components": "1.5.0"
173
174
  },
174
175
  "peerDependencies": {
176
+ "@loadsmart/miranda-tokens": "1.3.0",
175
177
  "@testing-library/dom": ">=5.12.0",
176
178
  "@testing-library/react": ">=11.2.6",
177
179
  "prop-types": ">=15.7.2",
178
- "react": ">=16.8.0",
179
180
  "react-dom": ">=16.8.0",
181
+ "react": ">=16.8.0",
180
182
  "styled-components": ">=5.3.0"
181
183
  },
182
184
  "dependencies": {
@@ -18,8 +18,9 @@ import loadsmart, {
18
18
  SHADOWS,
19
19
  SPACINGS,
20
20
  } from '../../theming/themes/loadsmart.theme'
21
+ import miranda from '../../theming/themes/miranda-compatibility.theme'
21
22
 
22
- const THEMES = { alice, loadsmart }
23
+ const THEMES = { alice, loadsmart, miranda }
23
24
 
24
25
  const TOKEN_PARAM_KEY = 'tokenPrefix'
25
26
 
@@ -26,7 +26,7 @@ import conditional, { whenProps } from 'tools/conditional'
26
26
 
27
27
  const Popover = styled(DefaultPopover)<{ $align: 'start' | 'end' }>`
28
28
  position: absolute;
29
- top: calc(36px + ${token('space-xs')});
29
+ top: calc(${token('dropdown-trigger-height')} + ${token('space-xs')});
30
30
 
31
31
  ${conditional({
32
32
  'left: 0;': whenProps({ $align: 'start' }),
@@ -37,7 +37,7 @@ type TriggerButtonProps = ButtonProps & {
37
37
 
38
38
  const dropdownExpandedStyle = css`
39
39
  &[aria-expanded='true'] {
40
- color: ${token('color-accent')};
40
+ color: ${token('dropdown-trigger-expanded-color')};
41
41
  }
42
42
  `
43
43
 
@@ -120,8 +120,8 @@ const TriggerButton = styled(
120
120
 
121
121
  visibility: hidden;
122
122
 
123
- /* @REVIEW: since this is a span descendant of a button
124
- 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
125
125
  relies on data-text attribute */
126
126
 
127
127
  content: '${children}';
@@ -163,7 +163,9 @@ const DropdownTriggerWrapper = styled.div<DropdownTriggerWrapperProps>`
163
163
 
164
164
  color: ${token('color-neutral-darker')};
165
165
 
166
- height: 36px;
166
+ height: ${token('dropdown-trigger-height')};
167
+ box-sizing: border-box;
168
+
167
169
  flex: 1;
168
170
 
169
171
  ${hoverable`
@@ -22,17 +22,14 @@ const Group = styled(DefaultGroup).attrs({
22
22
  `
23
23
 
24
24
  const Icon = styled(DefaultIcon)`
25
- color: ${token('color-accent')};
25
+ color: ${token('select-selected-option-check-color')};
26
26
  `
27
27
 
28
28
  const DefaultSelectOption = styled(Dropdown.Item)<DropdownMenuItemProps>`
29
29
  background: ${conditional({
30
- 'color-accent': whenProps({ 'aria-selected': true }),
31
- 'color-neutral-white': whenProps({ 'aria-selected': false }),
32
- })}${conditional({
33
- '33': whenProps({ 'aria-selected': true }),
34
- ff: whenProps({ 'aria-selected': false }),
35
- })};
30
+ 'select-selected-option-background-color': whenProps({ 'aria-selected': true }),
31
+ 'color-neutral-white': whenProps({ 'aria-selected': false }),
32
+ })};
36
33
  `
37
34
 
38
35
  function SelectOption({
@@ -15,9 +15,10 @@ const MenuTitle = styled.div`
15
15
  padding-left: ${token('space-l')};
16
16
 
17
17
  color: ${token('color-neutral')};
18
- font-weight: ${token('font-weight-bold')};
19
- font-size: ${token('font-size-5')};
20
- line-height: ${token('font-height-3')};
18
+
19
+ font-weight: ${token('side-navigation-menu-title-font-weight')};
20
+ font-size: ${token('side-navigation-menu-title-font-size')};
21
+ line-height: ${token('side-navigation-menu-title-line-height')};
21
22
  text-transform: uppercase;
22
23
  `
23
24
 
@@ -35,7 +35,7 @@ const StyledMenuItem = styled.button`
35
35
  cursor: pointer;
36
36
 
37
37
  ${focusable`
38
- color: ${token('color-primary')};
38
+ color: ${token('side-navigation-menu-item-color--focus')};
39
39
  `}
40
40
  `
41
41
 
@@ -8,16 +8,15 @@ import MenuBaseItem from './MenuBaseItem'
8
8
 
9
9
  const StyledMenuItem = styled((props) => <MenuBaseItem as="a" {...props} />)`
10
10
  ${hoverable`
11
- color: ${token('color-primary')};
11
+ color: ${token('side-navigation-menu-link-color--hover')};
12
12
  `}
13
13
 
14
14
  ${({ active }) =>
15
15
  active
16
16
  ? css`
17
- color: ${token('color-primary')};
18
-
19
- background-color: rgba(0, 0, 0, 0.2);
20
- box-shadow: inset ${token('space-xs')} 0px ${token('color-primary')};
17
+ background-color: ${token('side-navigation-menu-link-background-color--active')};
18
+ box-shadow: inset ${token('space-xs')} 0
19
+ ${token('side-navigation-menu-link-box-shadow-color--active')};
21
20
  `
22
21
  : ''}
23
22
  `
@@ -46,7 +46,7 @@ export function Playground(args: SideNavigationProps): JSX.Element {
46
46
  <SideNavigation.Menu.SubItem
47
47
  label="Trailing"
48
48
  trailing={
49
- <Tag size="small" variant="accent">
49
+ <Tag size="small" variant="success">
50
50
  NEW
51
51
  </Tag>
52
52
  }
@@ -31,8 +31,8 @@ const StepConnector = styled.span<{ complete: boolean }>`
31
31
  })};
32
32
 
33
33
  background: ${conditional({
34
- 'color-neutral': whenProps({ complete: false }),
35
- 'color-accent': whenProps({ complete: true }),
34
+ 'steps-progress-step-background-color': whenProps({ complete: false }),
35
+ 'steps-progress-step-background-color--complete': whenProps({ complete: true }),
36
36
  })};
37
37
  `
38
38
 
@@ -79,16 +79,18 @@ const StepIndicator = styled.span<{ current: boolean; complete: boolean }>`
79
79
  border-width: 2px;
80
80
  border-style: solid;
81
81
  border-color: ${conditional({
82
- 'color-accent': whenProps([
82
+ 'steps-progress-step-background-color--complete': whenProps([
83
83
  { current: true, complete: [true, false] },
84
84
  { current: false, complete: true },
85
85
  ]),
86
- 'color-neutral': whenProps({ current: false, complete: false }),
86
+ 'steps-progress-step-background-color': whenProps({ current: false, complete: false }),
87
87
  })};
88
88
  border-radius: ${token('border-radius-circle')};
89
89
 
90
90
  background: ${conditional({
91
- 'color-accent': whenProps([{ current: false, complete: true }]),
91
+ 'steps-progress-step-background-color--complete': whenProps([
92
+ { current: false, complete: true },
93
+ ]),
92
94
  'color-neutral-white': whenProps([
93
95
  { current: true, complete: [true, false] },
94
96
  { current: false, complete: false },
@@ -96,9 +98,9 @@ const StepIndicator = styled.span<{ current: boolean; complete: boolean }>`
96
98
  })};
97
99
 
98
100
  color: ${conditional({
99
- 'color-neutral': whenProps({ current: false, complete: false }),
101
+ 'steps-progress-step-background-color': whenProps({ current: false, complete: false }),
100
102
  'color-neutral-white': whenProps({ current: false, complete: true }),
101
- 'color-accent': whenProps({ current: true }),
103
+ 'steps-progress-step-background-color--complete': whenProps({ current: true }),
102
104
  })};
103
105
  `
104
106
 
@@ -14,82 +14,107 @@ import ToggleGroupContext, { SelectableContext } from './ToggleGroupContext'
14
14
  import type { ToggleGroupOptionProps, ToggleGroupType } from './ToggleGroup.types'
15
15
 
16
16
  const ToggleButton = styled(BaseButton)<{ $type: ToggleGroupType }>`
17
- background: ${conditional({
18
- 'color-transparent': whenProps({ 'aria-checked': false }),
19
- 'color-neutral-darkest': whenProps({ 'aria-checked': true }),
17
+ text-transform: ${token('toggle-text-transform')};
18
+
19
+ background-color: ${conditional({
20
+ 'toggle-background-color': whenProps({ 'aria-checked': false }),
21
+ 'toggle-checked-background-color': whenProps({ 'aria-checked': true }),
20
22
  })};
21
23
 
22
24
  border-color: ${conditional({
23
- 'color-neutral-darkest': whenProps([
24
- { $type: 'multiple' },
25
- { $type: 'single', 'aria-checked': true },
26
- ]),
27
- 'color-transparent': whenProps({ $type: 'single', 'aria-checked': false }),
25
+ 'toggle-single-border-color': whenProps({ $type: 'single', 'aria-checked': false }),
26
+ 'toggle-single-checked-border-color': whenProps({ $type: 'single', 'aria-checked': true }),
27
+ 'toggle-multiple-border-color': whenProps({ $type: 'multiple', 'aria-checked': false }),
28
+ 'toggle-multiple-checked-border-color': whenProps({ $type: 'multiple', 'aria-checked': true }),
28
29
  })};
29
30
 
30
31
  color: ${conditional({
31
- 'color-neutral-darker': whenProps({ 'aria-checked': false }),
32
- 'color-neutral-white': whenProps({ 'aria-checked': true }),
32
+ 'toggle-color': whenProps({ 'aria-checked': false }),
33
+ 'toggle-checked-color': whenProps({ 'aria-checked': true }),
33
34
  })};
34
35
 
35
36
  padding: ${token('space-xs')} ${token('space-s')};
36
37
 
37
38
  ${hoverable`
38
39
  border-color: ${conditional({
39
- 'color-neutral-dark': whenProps({ $type: 'multiple' }),
40
- 'color-transparent': whenProps({ $type: 'single' }),
40
+ 'toggle-multiple-border-color--hover': whenProps({ $type: 'multiple' }),
41
+ 'toggle-single-border-color--hover': whenProps({ $type: 'single' }),
41
42
  })};
42
43
 
43
44
  background-color: ${conditional({
44
- 'color-transparent': whenProps({ 'aria-checked': false }),
45
- 'color-neutral-dark': whenProps({ 'aria-checked': true }),
45
+ 'toggle-background-color--hover': whenProps({ 'aria-checked': false }),
46
+ 'toggle-checked-background-color--hover': whenProps({ 'aria-checked': true }),
46
47
  })};
48
+
47
49
  color: ${conditional({
48
- 'color-neutral-dark': whenProps({ 'aria-checked': false }),
49
- 'color-neutral-white': whenProps({ 'aria-checked': true }),
50
+ 'toggle-color--hover': whenProps({ 'aria-checked': false }),
51
+ 'toggle-checked-color--hover': whenProps({ 'aria-checked': true }),
50
52
  })};
51
53
  `}
52
54
 
53
55
  ${focusable`
54
- border-color: ${token('color-neutral-darker')};
56
+ border-color: ${conditional({
57
+ 'toggle-multiple-border-color--focus': whenProps({ $type: 'multiple' }),
58
+ 'toggle-single-border-color--focus': whenProps({ $type: 'single' }),
59
+ })};
60
+
55
61
  background-color: ${conditional({
56
- 'color-transparent': whenProps({ 'aria-checked': false }),
57
- 'color-neutral-darker': whenProps({ 'aria-checked': true }),
62
+ 'toggle-background-color--focus': whenProps({ 'aria-checked': false }),
63
+ 'toggle-checked-background-color--focus': whenProps({ 'aria-checked': true }),
58
64
  })};
65
+
59
66
  color: ${conditional({
60
- 'color-neutral-darker': whenProps({ 'aria-checked': false }),
61
- 'color-neutral-white': whenProps({ 'aria-checked': true }),
67
+ 'toggle-color--focus': whenProps({ 'aria-checked': false }),
68
+ 'toggle-checked-color--focus': whenProps({ 'aria-checked': true }),
62
69
  })};
63
70
 
64
71
  box-shadow: ${token('button-primary-outline')};
65
72
  `}
66
73
 
67
74
  ${activatable`
68
- border-color: ${token('color-neutral')};
75
+ border-color: ${conditional({
76
+ 'toggle-multiple-border-color--active': whenProps({ $type: 'multiple' }),
77
+ 'toggle-single-border-color--active': whenProps({ $type: 'single' }),
78
+ })};
79
+
69
80
  background-color: ${conditional({
70
- 'color-transparent': whenProps({ 'aria-checked': false }),
71
- 'color-neutral': whenProps({ 'aria-checked': true }),
81
+ 'toggle-background-color--active': whenProps({ 'aria-checked': false }),
82
+ 'toggle-checked-background-color--active': whenProps({ 'aria-checked': true }),
72
83
  })};
84
+
73
85
  color: ${conditional({
74
- 'color-neutral': whenProps({ 'aria-checked': false }),
75
- 'color-neutral-white': whenProps({ 'aria-checked': true }),
86
+ 'toggle-color--active': whenProps({ 'aria-checked': false }),
87
+ 'toggle-checked-color--active': whenProps({ 'aria-checked': true }),
76
88
  })};
77
89
  `}
78
90
 
79
91
  ${disableable`
80
92
  opacity: 1; // toggle group already applies opacity; we don't want to overlap it.
81
93
 
94
+ background-color: ${conditional({
95
+ 'toggle-background-color--disabled': whenProps({ 'aria-checked': false }),
96
+ 'toggle-checked-background-color--disabled': whenProps({ 'aria-checked': true }),
97
+ })};
98
+
82
99
  border-color: ${conditional({
83
- 'color-neutral-darkest': whenProps([
84
- { $type: 'multiple' },
85
- { $type: 'single', 'aria-checked': true },
86
- ]),
87
- 'color-transparent': whenProps({ $type: 'single', 'aria-checked': false }),
100
+ 'toggle-single-border-color--disabled': whenProps({ $type: 'single', 'aria-checked': false }),
101
+ 'toggle-single-checked-border-color--disabled': whenProps({
102
+ $type: 'single',
103
+ 'aria-checked': true,
104
+ }),
105
+ 'toggle-multiple-border-color--disabled': whenProps({
106
+ $type: 'multiple',
107
+ 'aria-checked': false,
108
+ }),
109
+ 'toggle-multiple-checked-border-color--disabled': whenProps({
110
+ $type: 'multiple',
111
+ 'aria-checked': true,
112
+ }),
88
113
  })};
89
114
 
90
115
  color: ${conditional({
91
- 'color-neutral-lightest': whenProps({ 'aria-checked': true }),
92
- 'color-neutral-darker': whenProps({ 'aria-checked': false }),
116
+ 'toggle-color--disabled': whenProps({ 'aria-checked': false }),
117
+ 'toggle-checked-color--disabled': whenProps({ 'aria-checked': true }),
93
118
  })};
94
119
  `}
95
120
  `
@@ -21,32 +21,45 @@ import type {
21
21
 
22
22
  const Container = styled(Group)<{ $multiple: boolean; $scale: ToggleGroupProps['scale'] }>`
23
23
  padding: ${conditional({
24
- '0': whenProps({ $multiple: true }),
25
- '3px': whenProps({ $multiple: false }),
24
+ 'toggle-group-multiple-padding': whenProps({ $multiple: true }),
25
+ 'toggle-group-single-padding': whenProps({ $multiple: false }),
26
26
  })};
27
27
 
28
- ${({ $multiple }) =>
29
- $multiple
30
- ? css`
31
- border: none;
32
- `
33
- : css`
34
- border: 1px solid ${token('color-neutral-darker')};
35
- border-radius: ${token('border-radius-s')};
36
- `}
28
+ border-color: ${conditional({
29
+ 'toggle-group-multiple-border-color': whenProps({ $multiple: true }),
30
+ 'toggle-group-single-border-color': whenProps({ $multiple: false }),
31
+ })};
32
+
33
+ border-style: ${conditional({
34
+ 'toggle-group-multiple-border-style': whenProps({ $multiple: true }),
35
+ 'toggle-group-single-border-style': whenProps({ $multiple: false }),
36
+ })};
37
+
38
+ border-width: ${conditional({
39
+ 'toggle-group-multiple-border-width': whenProps({ $multiple: true }),
40
+ 'toggle-group-single-border-width': whenProps({ $multiple: false }),
41
+ })};
42
+
43
+ border-radius: ${conditional({
44
+ 'toggle-group-multiple-border-radius': whenProps({ $multiple: true }),
45
+ 'toggle-group-single-border-radius': whenProps({ $multiple: false }),
46
+ })};
37
47
 
38
48
  ${disableable()}
39
49
 
40
50
  ${Toggle} {
41
- ${conditional({
42
- 'font-size: 10px;': whenProps({ $multiple: false, $scale: 'small' }),
51
+ height: ${conditional({
52
+ 'toggle-single-height': whenProps({ $multiple: false, $scale: 'default' }),
53
+ 'toggle-single-small-height': whenProps({ $multiple: false, $scale: 'small' }),
54
+ 'toggle-multiple-height': whenProps({ $multiple: true, $scale: 'default' }),
55
+ 'toggle-multiple-small-height': whenProps({ $multiple: true, $scale: 'small' }),
43
56
  })};
44
57
 
45
- height: ${conditional({
46
- '36px': whenProps({ $multiple: true, $scale: 'default' }),
47
- '24px': whenProps({ $multiple: true, $scale: 'small' }),
48
- '28px': whenProps({ $multiple: false, $scale: 'default' }),
49
- '16px': whenProps({ $multiple: false, $scale: 'small' }),
58
+ font-size: ${conditional({
59
+ 'toggle-single-font-size': whenProps({ $multiple: false, $scale: 'default' }),
60
+ 'toggle-single-small-font-size': whenProps({ $multiple: false, $scale: 'small' }),
61
+ 'toggle-multiple-font-size': whenProps({ $multiple: true, $scale: 'default' }),
62
+ 'toggle-multiple-small-font-size': whenProps({ $multiple: true, $scale: 'small' }),
50
63
  })};
51
64
  }
52
65
  `
@@ -118,7 +131,7 @@ function ToggleGroup(props: ToggleGroupProps): JSX.Element {
118
131
  id={id}
119
132
  role={multiple ? 'group' : 'radiogroup'}
120
133
  align="center"
121
- space={multiple ? 's' : 'xs'}
134
+ space="xs"
122
135
  $multiple={multiple}
123
136
  $scale={scale}
124
137
  >
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import type { PropsWithChildren } from 'react'
2
+ import type { ReactNode } from 'react'
3
3
  import styled, { css } from 'styled-components'
4
4
 
5
5
  import { getToken as token } from 'theming'
@@ -33,7 +33,7 @@ const Container = styled.div`
33
33
  `
34
34
 
35
35
  export interface TopNavigationProps {
36
- children: PropsWithChildren<unknown>
36
+ children?: ReactNode
37
37
  }
38
38
 
39
39
  function TopNavigation({ children }: TopNavigationProps): JSX.Element {