@mrshmllw/smores-react 2.12.1 → 2.12.2
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.
- package/dist/Dropdown/Dropdown.js +30 -37
- package/dist/Dropdown/Dropdown.js.map +1 -1
- package/package.json +11 -11
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
11
11
|
};
|
12
12
|
import React, { forwardRef, useMemo, } from 'react';
|
13
13
|
import { darken } from 'polished';
|
14
|
-
import styled from 'styled-components';
|
14
|
+
import styled, { css } from 'styled-components';
|
15
15
|
import { theme } from '../theme';
|
16
16
|
import { Icon } from '../Icon';
|
17
17
|
import { Field } from '../fields/Field';
|
@@ -53,55 +53,48 @@ export const Dropdown = forwardRef(function Dropdown(_a, ref) {
|
|
53
53
|
React.createElement(Caret, { outlined: outlined },
|
54
54
|
React.createElement(Icon, { render: "caret", color: "subtext", size: 24 })))));
|
55
55
|
});
|
56
|
-
const
|
57
|
-
|
58
|
-
return `border: 2px solid ${theme.colors.error}`;
|
59
|
-
}
|
60
|
-
else if (error && !outlined) {
|
61
|
-
return `border-bottom: 2px solid ${theme.colors.error}`;
|
62
|
-
}
|
63
|
-
else {
|
64
|
-
return;
|
65
|
-
}
|
66
|
-
};
|
67
|
-
const StyledSelect = styled.select `
|
68
|
-
width: 100%;
|
69
|
-
height: 32px;
|
70
|
-
padding-right: 24px;
|
71
|
-
background-color: ${theme.colors.white};
|
56
|
+
const borderColor = ({ error }) => error ? theme.colors.error : theme.colors.outline;
|
57
|
+
const resetSelect = css `
|
72
58
|
border: none;
|
73
|
-
border-bottom: ${({ outlined }) => !outlined && `1px solid ${theme.colors.outline}`};
|
74
59
|
border-radius: 0;
|
75
60
|
font-size: 16px;
|
76
|
-
cursor: pointer;
|
77
61
|
appearance: none; /* remove default arrow */
|
62
|
+
outline: none;
|
63
|
+
`;
|
64
|
+
const StyledSelect = styled.select `
|
65
|
+
${resetSelect}
|
66
|
+
width: 100%;
|
67
|
+
height: 32px;
|
68
|
+
|
69
|
+
cursor: pointer;
|
70
|
+
background-color: ${theme.colors.white};
|
71
|
+
|
72
|
+
${({ outlined }) => {
|
73
|
+
if (outlined) {
|
74
|
+
return css `
|
75
|
+
border-radius: 8px;
|
76
|
+
padding: 16px 12px;
|
77
|
+
border: 2px solid ${borderColor};
|
78
|
+
height: auto;
|
79
|
+
`;
|
80
|
+
}
|
81
|
+
return css `
|
82
|
+
padding-right: 24px;
|
83
|
+
border-bottom: 1px solid ${borderColor};
|
84
|
+
`;
|
85
|
+
}}
|
86
|
+
|
78
87
|
&:disabled {
|
79
88
|
cursor: not-allowed;
|
80
89
|
opacity: 0.5;
|
81
90
|
}
|
82
|
-
|
83
|
-
color: ${theme.colors.outline};
|
84
|
-
}
|
91
|
+
|
85
92
|
&:hover,
|
86
93
|
&:focus,
|
87
94
|
&:focus-visible,
|
88
95
|
&:checked {
|
89
|
-
|
90
|
-
border-color: ${darken(0.1, theme.colors.outline)};
|
96
|
+
border-color: ${(p) => darken(0.1, borderColor(p))};
|
91
97
|
}
|
92
|
-
${({ outlined }) => outlined &&
|
93
|
-
`
|
94
|
-
border: 2px solid ${theme.colors.outline};
|
95
|
-
border-radius: 8px;
|
96
|
-
padding: 16px 12px;
|
97
|
-
box-sizing: border-box;
|
98
|
-
height: auto;
|
99
|
-
&:hover,
|
100
|
-
&:focus-within {
|
101
|
-
border: 2px solid ${theme.colors.outline};
|
102
|
-
}
|
103
|
-
`}
|
104
|
-
${({ error, outlined }) => getErrorOutline(outlined, error)};
|
105
98
|
`;
|
106
99
|
const DropdownContainer = styled.div `
|
107
100
|
position: relative;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../src/Dropdown/Dropdown.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAGZ,UAAU,EAEV,OAAO,GACR,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,MAAM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AC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAA;AAEnD,MAAM,WAAW,GAAG,GAAG,CAAA;;;;;;CAMtB,CAAA;AAED,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAa;IAC3C,WAAW;;;;;sBAKO,KAAK,CAAC,MAAM,CAAC,KAAK;;IAEpC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACjB,IAAI,QAAQ,EAAE;QACZ,OAAO,GAAG,CAAA;;;4BAGY,WAAW;;OAEhC,CAAA;KACF;IAED,OAAO,GAAG,CAAA;;iCAEmB,WAAW;KACvC,CAAA;AACH,CAAC;;;;;;;;;;;oBAWiB,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;;CAErD,CAAA;AAED,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAEnC,CAAA;AAED,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAuB;;;;WAIpC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;;;CAGrD,CAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@mrshmllw/smores-react",
|
3
|
-
"version": "2.12.
|
3
|
+
"version": "2.12.2",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"description": "Collection of React components used by Marshmallow Technology",
|
6
6
|
"keywords": [
|
@@ -29,17 +29,17 @@
|
|
29
29
|
"fix-package-lock-conflicts": "echo \"Make sure conflicts in package.json are resolved before running this script\" && npm i --package-lock-only"
|
30
30
|
},
|
31
31
|
"devDependencies": {
|
32
|
-
"@babel/core": "^7.
|
33
|
-
"@babel/plugin-proposal-class-properties": "^7.
|
34
|
-
"@babel/preset-env": "^7.
|
35
|
-
"@babel/preset-react": "^7.
|
36
|
-
"@babel/preset-typescript": "^7.
|
32
|
+
"@babel/core": "^7.20.5",
|
33
|
+
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
34
|
+
"@babel/preset-env": "^7.20.2",
|
35
|
+
"@babel/preset-react": "^7.18.6",
|
36
|
+
"@babel/preset-typescript": "^7.18.6",
|
37
37
|
"@snyk/protect": "^1.881.0",
|
38
|
-
"@storybook/addon-essentials": "^6.
|
39
|
-
"@storybook/builder-webpack5": "^6.5.
|
40
|
-
"@storybook/manager-webpack5": "^6.5.
|
41
|
-
"@storybook/react": "^6.
|
42
|
-
"@storybook/storybook-deployer": "^2.8.
|
38
|
+
"@storybook/addon-essentials": "^6.5.14",
|
39
|
+
"@storybook/builder-webpack5": "^6.5.14",
|
40
|
+
"@storybook/manager-webpack5": "^6.5.14",
|
41
|
+
"@storybook/react": "^6.5.14",
|
42
|
+
"@storybook/storybook-deployer": "^2.8.16",
|
43
43
|
"@testing-library/jest-dom": "^5.11.4",
|
44
44
|
"@testing-library/react": "^13.4.0",
|
45
45
|
"@types/jest": "^29.0.0",
|