@via-profit/ui-kit 0.1.0-rc.5 → 0.1.0-rc.7

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.
@@ -18,18 +18,18 @@ const react_1 = __importDefault(require("react"));
18
18
  const styled_1 = __importDefault(require("@emotion/styled"));
19
19
  const ButtonBase_1 = __importDefault(require("./ButtonBase"));
20
20
  const Button = (0, styled_1.default)(ButtonBase_1.default) `
21
- color: ${({ theme }) => theme.colors.accentPrimaryContrast().toString()};
22
- background-color: ${({ theme }) => theme.colors.accentPrimary().toString()};
21
+ color: ${({ theme }) => theme.colors.accentPrimaryContrast.toString()};
22
+ background-color: ${({ theme }) => theme.colors.accentPrimary.toString()};
23
23
  box-shadow: 0 2px 12px
24
- ${({ theme }) => theme.colors.accentPrimary().darken(0.6).alpha(0.3).toString()};
24
+ ${({ theme }) => theme.colors.accentPrimary.darken(0.6).alpha(0.3).toString()};
25
25
  &:hover {
26
- background-color: ${({ theme }) => theme.colors.accentPrimary().darken(0.1).toString()};
26
+ background-color: ${({ theme }) => theme.colors.accentPrimary.darken(0.1).toString()};
27
27
  }
28
28
  &:active {
29
- background-color: ${({ theme }) => theme.colors.accentPrimary().darken(0.2).toString()};
29
+ background-color: ${({ theme }) => theme.colors.accentPrimary.darken(0.2).toString()};
30
30
  }
31
31
  &:focus-visible {
32
- outline: 2px solid ${({ theme }) => theme.colors.accentPrimary().darken(0.3).toString()};
32
+ outline: 2px solid ${({ theme }) => theme.colors.accentPrimary.darken(0.3).toString()};
33
33
  }
34
34
  `;
35
35
  const StartIconWrapper = styled_1.default.span `
@@ -19,6 +19,7 @@ const styled_1 = __importDefault(require("@emotion/styled"));
19
19
  const Button = styled_1.default.button `
20
20
  border-radius: ${({ theme }) => theme.shape.radiusFactor * 2}em;
21
21
  padding: 0.8em 1em;
22
+ font-size: 0.8rem;
22
23
  cursor: pointer;
23
24
  font-size: 1em;
24
25
  border: 0;
@@ -18,20 +18,20 @@ const react_1 = __importDefault(require("react"));
18
18
  const styled_1 = __importDefault(require("@emotion/styled"));
19
19
  const ButtonBase_1 = __importDefault(require("./ButtonBase"));
20
20
  const Button = (0, styled_1.default)(ButtonBase_1.default) `
21
- color: ${({ theme }) => theme.colors.textPrimary().toString()};
21
+ color: ${({ theme }) => theme.colors.textPrimary.toString()};
22
22
  background-color: ${({ theme }) => theme.isDark
23
- ? theme.colors.backgroundPrimary().lighten(20).toString()
24
- : theme.colors.backgroundPrimary().toString()};
23
+ ? theme.colors.backgroundPrimary.lighten(20).toString()
24
+ : theme.colors.backgroundPrimary.toString()};
25
25
  box-shadow: 0 2px 12px
26
- ${({ theme }) => theme.colors.backgroundPrimary().darken(40).alpha(0.6).toString()};
26
+ ${({ theme }) => theme.colors.backgroundPrimary.darken(40).alpha(0.6).toString()};
27
27
  &:hover {
28
- background-color: ${({ theme }) => theme.colors.backgroundPrimary().darken(20).toString()};
28
+ background-color: ${({ theme }) => theme.colors.backgroundPrimary.darken(20).toString()};
29
29
  }
30
30
  &:active {
31
- background-color: ${({ theme }) => theme.colors.backgroundPrimary().darken(40).toString()};
31
+ background-color: ${({ theme }) => theme.colors.backgroundPrimary.darken(40).toString()};
32
32
  }
33
33
  &:focus-visible {
34
- outline: 2px solid ${({ theme }) => theme.colors.accentPrimary().toString()};
34
+ outline: 2px solid ${({ theme }) => theme.colors.accentPrimary.toString()};
35
35
  }
36
36
  `;
37
37
  const StartIconWrapper = styled_1.default.span `
@@ -29,28 +29,28 @@ const Btn = styled_1.default.button `
29
29
  cursor: ${({ $isDisabled }) => ($isDisabled ? 'default' : 'pointer')};
30
30
  border: 1px solid transparent;
31
31
  background-color: ${({ theme, $isSelected }) => $isSelected
32
- ? theme.colors.accentPrimary().toString()
33
- : theme.colors.backgroundPrimary().toString()};
32
+ ? theme.colors.accentPrimary.toString()
33
+ : theme.colors.backgroundPrimary.toString()};
34
34
  border-radius: ${({ theme }) => theme.shape.radiusFactor * 3}em;
35
35
  color: ${({ $isToday, theme, $isSelected, $isDisabled }) => {
36
36
  if ($isDisabled) {
37
- return theme.colors.textSecondary().toString();
37
+ return theme.colors.textSecondary.toString();
38
38
  }
39
39
  if ($isSelected) {
40
- return theme.colors.accentPrimaryContrast().toString();
40
+ return theme.colors.accentPrimaryContrast.toString();
41
41
  }
42
42
  if ($isToday) {
43
- return theme.colors.accentPrimary().toString();
43
+ return theme.colors.accentPrimary.toString();
44
44
  }
45
- return theme.colors.textPrimary().toString();
45
+ return theme.colors.textPrimary.toString();
46
46
  }};
47
47
  &:hover {
48
48
  background-color: ${({ theme, $isSelected }) => $isSelected
49
- ? theme.colors.accentPrimary().darken(0.1).toString()
50
- : theme.colors.backgroundPrimary().darken(0.1).toString()};
49
+ ? theme.colors.accentPrimary.darken(0.1).toString()
50
+ : theme.colors.backgroundPrimary.darken(0.1).toString()};
51
51
  }
52
52
  &:focus-visible {
53
- border-color: ${({ theme, $isDisabled }) => $isDisabled ? 'transparent' : theme.colors.accentPrimary().toString()};
53
+ border-color: ${({ theme, $isDisabled }) => $isDisabled ? 'transparent' : theme.colors.accentPrimary.toString()};
54
54
  }
55
55
  opacity: ${({ $isDisabled }) => ($isDisabled ? 0.4 : 1)};
56
56
  `;
@@ -31,14 +31,14 @@ const Btn = styled_1.default.button `
31
31
  outline: none;
32
32
  cursor: pointer;
33
33
  border: 1px solid transparent;
34
- background-color: ${({ theme }) => theme.colors.backgroundPrimary().toString()};
34
+ background-color: ${({ theme }) => theme.colors.backgroundPrimary.toString()};
35
35
  border-radius: ${({ theme }) => theme.shape.radiusFactor * 3}em;
36
- color: ${({ theme }) => theme.colors.textPrimary().toString()};
36
+ color: ${({ theme }) => theme.colors.textPrimary.toString()};
37
37
  &:hover {
38
- background-color: ${({ theme }) => theme.colors.backgroundPrimary().darken(0.1).toString()};
38
+ background-color: ${({ theme }) => theme.colors.backgroundPrimary.darken(0.1).toString()};
39
39
  }
40
40
  &:focus-visible {
41
- border-color: ${({ theme }) => theme.colors.accentPrimary().toString()};
41
+ border-color: ${({ theme }) => theme.colors.accentPrimary.toString()};
42
42
  }
43
43
  opacity: ${({ disabled }) => (disabled ? 0.4 : 1)};
44
44
  `;
@@ -9,12 +9,12 @@ const CalendarPaper = styled_1.default.div `
9
9
  display: flex;
10
10
  flex-direction: column;
11
11
  justify-content: stretch;
12
- background-color: ${({ theme }) => theme.colors.backgroundPrimary().toString()};
12
+ background-color: ${({ theme }) => theme.colors.backgroundPrimary.toString()};
13
13
  border-radius: ${({ theme }) => theme.shape.radiusFactor * 1}em;
14
14
  padding: 0.4em;
15
15
  max-width: 17.6em;
16
16
  max-height: 20.4em;
17
17
  box-shadow: 0 4px 24px
18
- ${({ theme }) => theme.colors.backgroundPrimary().darken(0.5).alpha(0.6).toString()};
18
+ ${({ theme }) => theme.colors.backgroundPrimary.darken(0.5).alpha(0.6).toString()};
19
19
  `;
20
20
  exports.default = CalendarPaper;
@@ -12,6 +12,6 @@ const CalendarWeekDayLabel = styled_1.default.div `
12
12
  user-select: none;
13
13
  width: 3em;
14
14
  height: 3em;
15
- color: ${({ theme }) => theme.colors.textSecondary().toString()};
15
+ color: ${({ theme }) => theme.colors.textSecondary.toString()};
16
16
  `;
17
17
  exports.default = react_1.default.memo(CalendarWeekDayLabel);
@@ -24,19 +24,19 @@ const InnerContainer = styled_1.default.div `
24
24
  border-radius: ${({ theme }) => theme.shape.radiusFactor * 1}em;
25
25
  background-color: ${({ theme, selected, hovered }) => {
26
26
  if (selected && hovered) {
27
- return theme.colors.accentPrimary().darken(0.1).toString();
27
+ return theme.colors.accentPrimary.darken(0.1).toString();
28
28
  }
29
29
  if (selected) {
30
- return theme.colors.accentPrimary().toString();
30
+ return theme.colors.accentPrimary.toString();
31
31
  }
32
32
  if (hovered) {
33
- return theme.colors.backgroundGrey().darken(0.04).toString();
33
+ return theme.colors.backgroundGrey.darken(0.04).toString();
34
34
  }
35
35
  return 'inherit';
36
36
  }};
37
37
  color: ${({ theme, selected }) => {
38
38
  if (selected) {
39
- return theme.colors.accentPrimaryContrast().toString();
39
+ return theme.colors.accentPrimaryContrast.toString();
40
40
  }
41
41
  return 'inherit';
42
42
  }};
@@ -25,10 +25,10 @@ const StyledMenuWrapper = styled_1.default.div `
25
25
  transition: visibility 120ms ease-out, opacity 120ms ease-out;
26
26
  opacity: ${props => (props.$isOpen ? 1 : 0)};
27
27
  visibility: ${props => (props.$isOpen ? 'visible' : 'hidden')};
28
- background-color: ${({ theme }) => theme.colors.backgroundPrimary().toString()};
28
+ background-color: ${({ theme }) => theme.colors.backgroundPrimary.toString()};
29
29
  border-radius: ${({ theme }) => theme.shape.radiusFactor * 2}em;
30
30
  box-shadow: 0 4px 24px
31
- ${({ theme }) => theme.colors.backgroundPrimary().darken(0.5).alpha(0.6).toString()};
31
+ ${({ theme }) => theme.colors.backgroundPrimary.darken(0.5).alpha(0.6).toString()};
32
32
  &:focus {
33
33
  outline: none;
34
34
  }
@@ -43,20 +43,20 @@ const StyledMenuWrapper = styled_1.default.div `
43
43
 
44
44
  & ::-webkit-scrollbar-track {
45
45
  background: ${({ theme }) => theme.isDark
46
- ? theme.colors.backgroundPrimary().darken(0.1).toString()
47
- : theme.colors.backgroundPrimary().darken(0.05).toString()};
46
+ ? theme.colors.backgroundPrimary.darken(0.1).toString()
47
+ : theme.colors.backgroundPrimary.darken(0.05).toString()};
48
48
  }
49
49
 
50
50
  & ::-webkit-scrollbar-thumb {
51
51
  background: ${({ theme }) => theme.isDark
52
- ? theme.colors.backgroundSecondary().lighten(0.3).toString()
53
- : theme.colors.backgroundSecondary().darken(0.3).toString()};
52
+ ? theme.colors.backgroundSecondary.lighten(0.3).toString()
53
+ : theme.colors.backgroundSecondary.darken(0.3).toString()};
54
54
  border-radius: 0.3rem;
55
55
  }
56
56
 
57
57
  & ::-webkit-scrollbar-thumb:horizontal:hover,
58
58
  & ::-webkit-scrollbar-thumb:vertical:hover {
59
- background: ${({ theme }) => theme.colors.accentPrimary().toString()};
59
+ background: ${({ theme }) => theme.colors.accentPrimary.toString()};
60
60
  }
61
61
  `;
62
62
  const MenuWrapperInner = styled_1.default.div `
@@ -127,7 +127,7 @@ const ModalConfirmBox = (props, ref) => {
127
127
  overflow: auto;
128
128
  -webkit-overflow-scrolling: touch;
129
129
  outline: none;
130
- background: ${theme.colors.backgroundPrimary().toString()};
130
+ background: ${theme.colors.backgroundPrimary.toString()};
131
131
  border-radius: 1em;
132
132
  transform: translate(-50%, -40%);
133
133
  transition: transform 100ms ease-in-out, opacity 100ms ease-in-out;
@@ -78,7 +78,7 @@ const ModalDialog = (props, ref) => {
78
78
  overflow: auto;
79
79
  -webkit-overflow-scrolling: touch;
80
80
  outline: none;
81
- background: ${theme.colors.backgroundPrimary().toString()};
81
+ background: ${theme.colors.backgroundPrimary.toString()};
82
82
  border-radius: 1em;
83
83
  transform: translate(-50%, -40%);
84
84
  transition: transform 100ms ease-in-out, opacity 100ms ease-in-out;
@@ -76,7 +76,7 @@ const Inner = styled_1.default.div `
76
76
  `;
77
77
  const CloseButton = (0, styled_1.default)(Button_1.default) `
78
78
  margin-left: ${props => (props.$withToolbar ? '1em' : 0)};
79
- color: ${props => props.theme.colors.textPrimary().toString()};
79
+ color: ${props => props.theme.colors.textPrimary.toString()};
80
80
  background: none;
81
81
  width: auto;
82
82
  height: auto;
@@ -131,7 +131,7 @@ const ModalDrawer = (props, ref) => {
131
131
  overflow: auto;
132
132
  -webkit-overflow-scrolling: touch;
133
133
  outline: none;
134
- background: ${theme.colors.backgroundPrimary().toString()};
134
+ background: ${theme.colors.backgroundPrimary.toString()};
135
135
  border-radius: 1em 1em 0 0;
136
136
  transform: translate(0, 100%);
137
137
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
@@ -126,7 +126,7 @@ const ModalMessageBox = (props, ref) => {
126
126
  overflow: auto;
127
127
  -webkit-overflow-scrolling: touch;
128
128
  outline: none;
129
- background: ${theme.colors.backgroundPrimary().toString()};
129
+ background: ${theme.colors.backgroundPrimary.toString()};
130
130
  border-radius: 1em;
131
131
  transform: translate(-50%, -40%);
132
132
  transition: transform 100ms ease-in-out, opacity 100ms ease-in-out;
@@ -32,7 +32,7 @@ const CountryFlagContainer = styled_1.default.span `
32
32
  overflow: hidden;
33
33
  margin-left: 0.5em;
34
34
  margin-right: 0.5em;
35
- border: 1px solid ${({ theme }) => theme.colors.textPrimary().alpha(0.8).toString()};
35
+ border: 1px solid ${({ theme }) => theme.colors.textPrimary.alpha(0.8).toString()};
36
36
  `;
37
37
  const CountryFlag = props => {
38
38
  const { countryCode } = props, otherProps = __rest(props, ["countryCode"]);
@@ -28,7 +28,7 @@ const react_1 = require("@emotion/react");
28
28
  const UnknownFlag = (props, ref) => {
29
29
  const { colors } = (0, react_1.useTheme)();
30
30
  return (React.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 512 512", ref: ref }, props),
31
- React.createElement("path", { transform: "translate(78.682 31.951)", d: "m-78.682-31.951h512v512h-512z", fill: colors.backgroundPrimary().toString(), strokeLinejoin: "round", strokeWidth: "2.176" }),
32
- React.createElement("path", { transform: "translate(78.682 31.951)", d: "m177.32 288.09q-4.915 0-8.0953-3.1803-3.1803-3.4694-3.1803-8.3844 0-11.854 5.7824-25.153 5.7823-13.299 15.612-22.551l7.2279-6.6497q9.83-9.2518 15.323-15.323 5.4932-6.3606 8.9626-15.034 3.7585-8.9626 3.7585-20.527 0-11.276-5.4932-20.527-5.4932-9.5409-15.612-15.034-10.119-5.4932-23.129-5.4932-21.395 0-34.116 13.01-12.432 12.721-12.432 33.248 0 4.915-3.1803 8.0953-2.8912 2.8912-7.8062 2.8912t-8.0953-2.8912q-3.1803-3.1803-3.1803-8.0953 0-19.66 8.6735-34.983 8.6735-15.323 24.286-23.997 15.612-8.6735 35.851-8.6735 19.082 0 34.116 8.3844 15.323 8.0953 23.708 22.551 8.6735 14.456 8.6735 32.67 0 14.167-4.6259 24.864-4.6259 10.408-11.854 18.503-6.9388 8.0953-19.949 19.949l-5.2041 4.6259q-8.0953 7.2279-11.565 17.058-3.1803 9.5409-3.1803 19.082 0 4.915-3.1803 8.3844-3.1803 3.1803-8.0953 3.1803zm0 51.174q-7.2279 0-12.143-4.915-4.6259-4.915-4.6259-11.854 0-7.2279 4.915-12.143 4.915-4.915 11.854-4.915t11.854 4.915q5.2041 4.915 5.2041 12.143 0 6.9388-5.2041 11.854-4.915 4.915-11.854 4.915z", fill: colors.textPrimary().toString(), strokeWidth: ".72279" })));
31
+ React.createElement("path", { transform: "translate(78.682 31.951)", d: "m-78.682-31.951h512v512h-512z", fill: colors.backgroundPrimary.toString(), strokeLinejoin: "round", strokeWidth: "2.176" }),
32
+ React.createElement("path", { transform: "translate(78.682 31.951)", d: "m177.32 288.09q-4.915 0-8.0953-3.1803-3.1803-3.4694-3.1803-8.3844 0-11.854 5.7824-25.153 5.7823-13.299 15.612-22.551l7.2279-6.6497q9.83-9.2518 15.323-15.323 5.4932-6.3606 8.9626-15.034 3.7585-8.9626 3.7585-20.527 0-11.276-5.4932-20.527-5.4932-9.5409-15.612-15.034-10.119-5.4932-23.129-5.4932-21.395 0-34.116 13.01-12.432 12.721-12.432 33.248 0 4.915-3.1803 8.0953-2.8912 2.8912-7.8062 2.8912t-8.0953-2.8912q-3.1803-3.1803-3.1803-8.0953 0-19.66 8.6735-34.983 8.6735-15.323 24.286-23.997 15.612-8.6735 35.851-8.6735 19.082 0 34.116 8.3844 15.323 8.0953 23.708 22.551 8.6735 14.456 8.6735 32.67 0 14.167-4.6259 24.864-4.6259 10.408-11.854 18.503-6.9388 8.0953-19.949 19.949l-5.2041 4.6259q-8.0953 7.2279-11.565 17.058-3.1803 9.5409-3.1803 19.082 0 4.915-3.1803 8.3844-3.1803 3.1803-8.0953 3.1803zm0 51.174q-7.2279 0-12.143-4.915-4.6259-4.915-4.6259-11.854 0-7.2279 4.915-12.143 4.915-4.915 11.854-4.915t11.854 4.915q5.2041 4.915 5.2041 12.143 0 6.9388-5.2041 11.854-4.915 4.915-11.854 4.915z", fill: colors.textPrimary.toString(), strokeWidth: ".72279" })));
33
33
  };
34
34
  exports.default = React.forwardRef(UnknownFlag);
@@ -36,16 +36,16 @@ const StyledButton = styled_1.default.button `
36
36
  border: 1px solid;
37
37
  border-radius: ${({ theme }) => theme.shape.radiusFactor * 2}em;
38
38
  border-color: ${({ theme }) => theme.isDark
39
- ? theme.colors.backgroundPrimary().lighten(1.4).toString()
40
- : theme.colors.backgroundPrimary().darken(0.4).toString()};
39
+ ? theme.colors.backgroundPrimary.lighten(1.4).toString()
40
+ : theme.colors.backgroundPrimary.darken(0.4).toString()};
41
41
  &:hover {
42
- background-color: ${({ theme }) => theme.colors.backgroundPrimary().darken(0.05).toString()};
42
+ background-color: ${({ theme }) => theme.colors.backgroundPrimary.darken(0.05).toString()};
43
43
  }
44
44
  &:active {
45
- background-color: ${({ theme }) => theme.colors.backgroundPrimary().darken(0.1).toString()};
45
+ background-color: ${({ theme }) => theme.colors.backgroundPrimary.darken(0.1).toString()};
46
46
  }
47
47
  &:focus-visible {
48
- outline: 2px solid ${({ theme }) => theme.colors.accentPrimary().toString()};
48
+ outline: 2px solid ${({ theme }) => theme.colors.accentPrimary.toString()};
49
49
  }
50
50
  `;
51
51
  const ValueWrapper = styled_1.default.span `
@@ -47,7 +47,7 @@ const ErrorTextContainer = styled_1.default.div `
47
47
  overflow: hidden;
48
48
  `;
49
49
  const ErrorTextInner = styled_1.default.div `
50
- color: ${({ theme }) => theme.colors.error().toString()};
50
+ color: ${({ theme }) => theme.colors.error.toString()};
51
51
  font-size: 0.8em;
52
52
  transform: translateY(${({ $error }) => ($error ? 0 : '0.2em')});
53
53
  opacity: ${({ $error }) => ($error ? 1 : 0)};
@@ -42,7 +42,7 @@ const styled_1 = __importDefault(require("@emotion/styled"));
42
42
  const Asterisk = styled_1.default.span `
43
43
  font-size: 0.8em;
44
44
  margin-left: 0.2em;
45
- color: ${({ theme }) => theme.colors.error().toString()};
45
+ color: ${({ theme }) => theme.colors.error.toString()};
46
46
  `;
47
47
  const TextFieldLabelAsterisk = (props, ref) => {
48
48
  const { children, error, focused } = props, otherProps = __rest(props, ["children", "error", "focused"]);
@@ -47,25 +47,25 @@ const Wrapper = styled_1.default.div `
47
47
  border: 1px solid;
48
48
  outline: 1px solid transparent;
49
49
  border-color: ${({ theme }) => theme.isDark
50
- ? theme.colors.textPrimary().darken(100).toString()
51
- : theme.colors.textPrimary().lighten(150).toString()};
50
+ ? theme.colors.textPrimary.darken(100).toString()
51
+ : theme.colors.textPrimary.lighten(150).toString()};
52
52
  width: ${({ $fullWidth }) => ($fullWidth ? '100%' : 'auto')};
53
53
  font-size: 0.9em;
54
- background-color: ${({ theme }) => theme.colors.backgroundPrimary().darken(0.02).toString()};
55
- color: ${({ theme }) => theme.colors.textPrimary().toString()};
54
+ background-color: ${({ theme }) => theme.colors.backgroundPrimary.darken(0.02).toString()};
55
+ color: ${({ theme }) => theme.colors.textPrimary.toString()};
56
56
  transition: all 180ms ease-out 0s;
57
57
 
58
58
  ${props => props.$focused &&
59
59
  (0, react_1.css) `
60
- border-color: ${props.theme.colors.accentPrimary().lighten(0.5).toString()};
61
- outline-color: ${props.theme.colors.accentPrimary().lighten(0.5).toString()};
60
+ border-color: ${props.theme.colors.accentPrimary.lighten(0.5).toString()};
61
+ outline-color: ${props.theme.colors.accentPrimary.lighten(0.5).toString()};
62
62
  `};
63
63
  ${props => props.$error &&
64
64
  (0, react_1.css) `
65
- border-color: ${props.theme.colors.error().toString()};
66
- color: ${props.theme.colors.error().toString()};
65
+ border-color: ${props.theme.colors.error.toString()};
66
+ color: ${props.theme.colors.error.toString()};
67
67
  &:focus {
68
- border-color: ${props.theme.colors.error().lighten(0.6).toString()};
68
+ border-color: ${props.theme.colors.error.lighten(0.6).toString()};
69
69
  }
70
70
  `}
71
71
  `;
@@ -1,6 +1,5 @@
1
1
  import { ColorInterface } from '../color';
2
2
  export type CreateTheme = (overrides?: UIThemeOverrides) => UITheme;
3
- export type ColorManipulator = () => ColorInterface;
4
3
  export interface UITheme {
5
4
  readonly isDark: boolean;
6
5
  readonly fontSize: Record<'small' | 'normal' | 'medium' | 'large', number>;
@@ -10,16 +9,16 @@ export interface UITheme {
10
9
  readonly modal: number;
11
10
  };
12
11
  readonly colors: {
13
- readonly backgroundPrimary: ColorManipulator;
14
- readonly backgroundSecondary: ColorManipulator;
15
- readonly backgroundGrey: ColorManipulator;
16
- readonly textPrimary: ColorManipulator;
17
- readonly textSecondary: ColorManipulator;
18
- readonly accentPrimary: ColorManipulator;
19
- readonly accentPrimaryContrast: ColorManipulator;
20
- readonly accentSecondary: ColorManipulator;
21
- readonly accentSecondaryContrast: ColorManipulator;
22
- readonly error: ColorManipulator;
12
+ readonly backgroundPrimary: ColorInterface;
13
+ readonly backgroundSecondary: ColorInterface;
14
+ readonly backgroundGrey: ColorInterface;
15
+ readonly textPrimary: ColorInterface;
16
+ readonly textSecondary: ColorInterface;
17
+ readonly accentPrimary: ColorInterface;
18
+ readonly accentPrimaryContrast: ColorInterface;
19
+ readonly accentSecondary: ColorInterface;
20
+ readonly accentSecondaryContrast: ColorInterface;
21
+ readonly error: ColorInterface;
23
22
  };
24
23
  readonly shape: {
25
24
  readonly radiusFactor: 0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1;
@@ -17,18 +17,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  const color_1 = __importDefault(require("../color"));
18
18
  const createTheme = (overrides) => {
19
19
  const _a = overrides || {}, { isDark, fontSize, zIndex, colors, shape } = _a, rest = __rest(_a, ["isDark", "fontSize", "zIndex", "colors", "shape"]);
20
- const theme = Object.assign(Object.assign({}, rest), { isDark: typeof isDark === 'boolean' ? isDark : false, fontSize: Object.assign({ small: 14, normal: 16, medium: 18, large: 20 }, fontSize), zIndex: Object.assign({ header: 8, mainDrawer: 9, modal: 10 }, zIndex), colors: {
21
- backgroundPrimary: () => new color_1.default((colors === null || colors === void 0 ? void 0 : colors.backgroundPrimary) || '#fff'),
22
- backgroundSecondary: () => new color_1.default((colors === null || colors === void 0 ? void 0 : colors.backgroundSecondary) || '#F9F9F9'),
23
- backgroundGrey: () => new color_1.default((colors === null || colors === void 0 ? void 0 : colors.backgroundGrey) || '#F4F6FA'),
24
- textPrimary: () => new color_1.default((colors === null || colors === void 0 ? void 0 : colors.textPrimary) || '#212121'),
25
- textSecondary: () => new color_1.default((colors === null || colors === void 0 ? void 0 : colors.textSecondary) || '#343434'),
26
- accentPrimary: () => new color_1.default((colors === null || colors === void 0 ? void 0 : colors.accentPrimary) || '#FFA800'),
27
- accentPrimaryContrast: () => new color_1.default((colors === null || colors === void 0 ? void 0 : colors.accentPrimaryContrast) || '#FFFFFF'),
28
- accentSecondary: () => new color_1.default((colors === null || colors === void 0 ? void 0 : colors.accentSecondary) || '#bd00ff'),
29
- accentSecondaryContrast: () => new color_1.default((colors === null || colors === void 0 ? void 0 : colors.accentSecondaryContrast) || '#FFFFFF'),
30
- error: () => new color_1.default((colors === null || colors === void 0 ? void 0 : colors.error) || '#ff2b2b'),
31
- }, shape: Object.assign({ radiusFactor: 0.5 }, shape) });
20
+ const theme = Object.assign(Object.assign({}, rest), { isDark: typeof isDark === 'boolean' ? isDark : false, fontSize: Object.assign({ small: 14, normal: 16, medium: 18, large: 20 }, fontSize), zIndex: Object.assign({ header: 8, mainDrawer: 9, modal: 10 }, zIndex), colors: {}, shape: Object.assign({ radiusFactor: 0.5 }, shape) });
21
+ const defaultColors = {
22
+ backgroundPrimary: '#FFFFFF',
23
+ backgroundSecondary: '#F9F9F9',
24
+ backgroundGrey: '#F4F6FA',
25
+ textPrimary: '#212121',
26
+ textSecondary: '#343434',
27
+ accentPrimary: '#FFA800',
28
+ accentPrimaryContrast: '#FFFFFF',
29
+ accentSecondary: '#bd00ff',
30
+ accentSecondaryContrast: '#FFFFFF',
31
+ error: '#ff2b2b',
32
+ };
33
+ Object.entries(Object.assign(Object.assign({}, defaultColors), colors)).forEach(([colorName, colorValue]) => {
34
+ theme.colors[colorName] = new color_1.default(colorValue);
35
+ });
36
+ theme.colors.test = new color_1.default('red');
32
37
  return theme;
33
38
  };
34
39
  exports.default = createTheme;
@@ -7,5 +7,6 @@ const styled_1 = __importDefault(require("@emotion/styled"));
7
7
  const Base = styled_1.default.span `
8
8
  font-size: 1rem;
9
9
  font-weight: 300;
10
+ color: ${({ theme }) => theme.colors.textPrimary.toString()};
10
11
  `;
11
12
  exports.default = Base;
@@ -9,8 +9,8 @@ const Blockquote = styled_1.default.blockquote `
9
9
  font-weight: 400;
10
10
  font-style: italic;
11
11
  position: relative;
12
- border-left: 4px solid ${({ theme }) => theme.colors.textSecondary().toString()};
13
- color: ${({ theme }) => theme.colors.textSecondary().toString()};
12
+ border-left: 4px solid ${({ theme }) => theme.colors.textSecondary.toString()};
13
+ color: ${({ theme }) => theme.colors.textSecondary.toString()};
14
14
  margin: 0;
15
15
  padding: 1em 0 1em 2em;
16
16
  & > p:first-of-type {
package/Typography/Del.js CHANGED
@@ -6,5 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const styled_1 = __importDefault(require("@emotion/styled"));
7
7
  const Del = styled_1.default.del `
8
8
  font-size: 1em;
9
+ color: ${({ theme }) => theme.colors.textPrimary.toString()};
9
10
  `;
10
11
  exports.default = Del;
package/Typography/Em.js CHANGED
@@ -6,5 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const styled_1 = __importDefault(require("@emotion/styled"));
7
7
  const Em = styled_1.default.em `
8
8
  font-size: 1em;
9
+ color: ${({ theme }) => theme.colors.textPrimary.toString()};
9
10
  `;
10
11
  exports.default = Em;
package/Typography/H1.js CHANGED
@@ -7,5 +7,6 @@ const styled_1 = __importDefault(require("@emotion/styled"));
7
7
  const H1 = styled_1.default.h1 `
8
8
  font-size: 2rem;
9
9
  font-weight: 700;
10
+ color: ${({ theme }) => theme.colors.textPrimary.toString()};
10
11
  `;
11
12
  exports.default = H1;
package/Typography/H2.js CHANGED
@@ -7,5 +7,6 @@ const styled_1 = __importDefault(require("@emotion/styled"));
7
7
  const H2 = styled_1.default.h2 `
8
8
  font-size: 1.5rem;
9
9
  font-weight: 500;
10
+ color: ${({ theme }) => theme.colors.textPrimary.toString()};
10
11
  `;
11
12
  exports.default = H2;
package/Typography/H3.js CHANGED
@@ -7,5 +7,6 @@ const styled_1 = __importDefault(require("@emotion/styled"));
7
7
  const H3 = styled_1.default.h3 `
8
8
  font-size: 1.25rem;
9
9
  font-weight: 500;
10
+ color: ${({ theme }) => theme.colors.textPrimary.toString()};
10
11
  `;
11
12
  exports.default = H3;
package/Typography/H4.js CHANGED
@@ -7,5 +7,6 @@ const styled_1 = __importDefault(require("@emotion/styled"));
7
7
  const H4 = styled_1.default.h4 `
8
8
  font-size: 1.2rem;
9
9
  font-weight: 500;
10
+ color: ${({ theme }) => theme.colors.textPrimary.toString()};
10
11
  `;
11
12
  exports.default = H4;
package/Typography/H5.js CHANGED
@@ -7,5 +7,6 @@ const styled_1 = __importDefault(require("@emotion/styled"));
7
7
  const H5 = styled_1.default.h5 `
8
8
  font-size: 1.2rem;
9
9
  font-weight: 300;
10
+ color: ${({ theme }) => theme.colors.textPrimary.toString()};
10
11
  `;
11
12
  exports.default = H5;
@@ -6,12 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Li = exports.Ol = exports.Ul = void 0;
7
7
  const styled_1 = __importDefault(require("@emotion/styled"));
8
8
  exports.Ul = styled_1.default.ul `
9
+ color: ${({ theme }) => theme.colors.textPrimary.toString()};
9
10
  font-size: 1em;
10
11
  `;
11
12
  exports.Ol = styled_1.default.ul `
13
+ color: ${({ theme }) => theme.colors.textPrimary.toString()};
12
14
  font-size: 1em;
13
15
  `;
14
16
  exports.Li = styled_1.default.li `
17
+ color: ${({ theme }) => theme.colors.textPrimary.toString()};
15
18
  font-size: 1em;
16
19
  `;
17
20
  exports.default = exports.Ul;
@@ -7,5 +7,6 @@ const styled_1 = __importDefault(require("@emotion/styled"));
7
7
  const Paragraph = styled_1.default.p `
8
8
  font-size: 1rem;
9
9
  font-weight: 300;
10
+ color: ${({ theme }) => theme.colors.textPrimary.toString()};
10
11
  `;
11
12
  exports.default = Paragraph;
@@ -6,5 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const styled_1 = __importDefault(require("@emotion/styled"));
7
7
  const Span = styled_1.default.span `
8
8
  font-size: 1em;
9
+ color: ${({ theme }) => theme.colors.textPrimary.toString()};
9
10
  `;
10
11
  exports.default = Span;
@@ -6,5 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const styled_1 = __importDefault(require("@emotion/styled"));
7
7
  const Strong = styled_1.default.strong `
8
8
  font-size: 1em;
9
+ color: ${({ theme }) => theme.colors.textPrimary.toString()};
9
10
  `;
10
11
  exports.default = Strong;
@@ -0,0 +1,3 @@
1
+ import Paragraph from './Paragraph';
2
+ export * from './Paragraph';
3
+ export default Paragraph;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ const Paragraph_1 = __importDefault(require("./Paragraph"));
21
+ __exportStar(require("./Paragraph"), exports);
22
+ exports.default = Paragraph_1.default;
package/color/Color.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  export interface ColorInterface {
2
- parseColor(value: string): ParsedColor;
2
+ parseColor(value: string | Color): ParsedColor;
3
3
  shade(decimal: number): this;
4
4
  alpha(decimal: number): this;
5
5
  lighten(decimal: number): this;
6
6
  darken(decimal: number): this;
7
7
  getHextByWebColor(value: string): string;
8
+ rgb(): ParsedColor;
8
9
  rgbString(): string;
9
10
  hexString(): string;
10
11
  toString(): string;
@@ -19,7 +20,7 @@ export type ParsedColor = {
19
20
  };
20
21
  declare class Color implements ColorInterface {
21
22
  #private;
22
- constructor(value: string);
23
+ constructor(value: string | Color);
23
24
  lighten(decimal: number): this;
24
25
  darken(decimal: number): this;
25
26
  alpha(decimal: number): this;
@@ -33,7 +34,12 @@ declare class Color implements ColorInterface {
33
34
  * lum - 0-25
34
35
  */
35
36
  shade(lum: number): this;
36
- rgb(): ParsedColor;
37
+ rgb(): {
38
+ r: number;
39
+ g: number;
40
+ b: number;
41
+ a: number;
42
+ };
37
43
  toString(): string;
38
44
  rgbString(): string;
39
45
  hexString(): string;
package/color/Color.js CHANGED
@@ -10,12 +10,19 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
11
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
12
  };
13
- var _Color_color;
13
+ var _Color_color, _Color_cache;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  class Color {
16
16
  constructor(value) {
17
17
  _Color_color.set(this, void 0);
18
- __classPrivateFieldSet(this, _Color_color, this.parseColor(value), "f");
18
+ _Color_cache.set(this, void 0);
19
+ if (value instanceof Color) {
20
+ __classPrivateFieldSet(this, _Color_color, Object.assign({}, value.rgb()), "f");
21
+ }
22
+ else {
23
+ __classPrivateFieldSet(this, _Color_color, this.parseColor(value), "f");
24
+ }
25
+ __classPrivateFieldSet(this, _Color_cache, Object.assign({}, __classPrivateFieldGet(this, _Color_color, "f")), "f");
19
26
  return this;
20
27
  }
21
28
  lighten(decimal) {
@@ -61,20 +68,28 @@ class Color {
61
68
  return this;
62
69
  }
63
70
  rgb() {
64
- return __classPrivateFieldGet(this, _Color_color, "f");
71
+ const result = Object.assign({}, __classPrivateFieldGet(this, _Color_color, "f"));
72
+ __classPrivateFieldSet(this, _Color_color, Object.assign({}, __classPrivateFieldGet(this, _Color_cache, "f")), "f");
73
+ return result;
65
74
  }
66
75
  toString() {
67
- return this.rgbString();
76
+ const result = this.rgbString();
77
+ __classPrivateFieldSet(this, _Color_color, Object.assign({}, __classPrivateFieldGet(this, _Color_cache, "f")), "f");
78
+ return result;
68
79
  }
69
80
  rgbString() {
70
- return `rgba(${__classPrivateFieldGet(this, _Color_color, "f").r}, ${__classPrivateFieldGet(this, _Color_color, "f").g}, ${__classPrivateFieldGet(this, _Color_color, "f").b}, ${__classPrivateFieldGet(this, _Color_color, "f").a})`;
81
+ const result = `rgba(${__classPrivateFieldGet(this, _Color_color, "f").r}, ${__classPrivateFieldGet(this, _Color_color, "f").g}, ${__classPrivateFieldGet(this, _Color_color, "f").b}, ${__classPrivateFieldGet(this, _Color_color, "f").a})`;
82
+ __classPrivateFieldSet(this, _Color_color, Object.assign({}, __classPrivateFieldGet(this, _Color_cache, "f")), "f");
83
+ return result;
71
84
  }
72
85
  hexString() {
73
86
  const colorToHex = (color) => {
74
87
  const hexadecimal = color.toString(16);
75
88
  return hexadecimal.length === 1 ? `0${hexadecimal}` : hexadecimal;
76
89
  };
77
- return '#' + colorToHex(__classPrivateFieldGet(this, _Color_color, "f").r) + colorToHex(__classPrivateFieldGet(this, _Color_color, "f").g) + colorToHex(__classPrivateFieldGet(this, _Color_color, "f").b);
90
+ const result = '#' + colorToHex(__classPrivateFieldGet(this, _Color_color, "f").r) + colorToHex(__classPrivateFieldGet(this, _Color_color, "f").g) + colorToHex(__classPrivateFieldGet(this, _Color_color, "f").b);
91
+ __classPrivateFieldSet(this, _Color_color, Object.assign({}, __classPrivateFieldGet(this, _Color_cache, "f")), "f");
92
+ return result;
78
93
  }
79
94
  parseColor(value) {
80
95
  const inputColor = value.trim().toLowerCase();
@@ -131,7 +146,7 @@ class Color {
131
146
  if (webHex) {
132
147
  return this.parseColor(webHex);
133
148
  }
134
- throw new Error('Failed to parse color');
149
+ throw new Error(`Failed to parse color value «${value}»`);
135
150
  }
136
151
  hslToRgb(value) {
137
152
  const hsl = value.match(/(\d+(\.\d+)?)/g);
@@ -342,5 +357,31 @@ class Color {
342
357
  return webColors[v];
343
358
  }
344
359
  }
345
- _Color_color = new WeakMap();
360
+ _Color_color = new WeakMap(), _Color_cache = new WeakMap();
361
+ // class Color {
362
+ // #c: _Color;
363
+ // #cache: _Color;
364
+ // constructor(value: string) {
365
+ // this.#c = new _Color(value);
366
+ // this.#cache = new _Color(value);
367
+ // return this;
368
+ // }
369
+ // lighten(decimal: number): this {
370
+ // this.#c.lighten(decimal);
371
+ // return this;
372
+ // }
373
+ // darken(decimal: number): this {
374
+ // this.#c.darken(decimal);
375
+ // return this;
376
+ // }
377
+ // alpha(decimal: number): this {
378
+ // this.#c.alpha(decimal);
379
+ // return this;
380
+ // }
381
+ // toString() {
382
+ // const s = this.#c.toString();
383
+ // this.#c = new _Color(this.#cache.toString());
384
+ // return s;
385
+ // }
386
+ // }
346
387
  exports.default = Color;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@via-profit/ui-kit",
3
- "version": "0.1.0-rc.5",
3
+ "version": "0.1.0-rc.7",
4
4
  "description": "UI Kit",
5
5
  "main": "index.js",
6
6
  "repository": {