@hexure/ui 1.1.0 → 1.1.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/README.md +68 -20
- package/dist/cjs/index.js +27 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/Button/Button.d.ts +1 -1
- package/dist/cjs/types/components/Modal/Modal.d.ts +2 -2
- package/dist/cjs/types/components/Multiselect/MultiSelect.d.ts +1 -1
- package/dist/esm/index.js +27 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/Button/Button.d.ts +1 -1
- package/dist/esm/types/components/Modal/Modal.d.ts +2 -2
- package/dist/esm/types/components/Multiselect/MultiSelect.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,36 +1,84 @@
|
|
|
1
1
|
# Getting Started
|
|
2
2
|
|
|
3
|
-
InsTech UI is
|
|
3
|
+
InsTech UI is the source repository for the @hexure/ui npm package. This library of components is the React implementation of the Hexure Design System, and should be used across all Hexure React applications and projects.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# Usage
|
|
7
|
+
|
|
8
|
+
1. Run `npm i @hexure/ui --save`
|
|
9
|
+
2. If needed, install/update any required peer dependencies: react, react-dom, @mdi/font, @mdi/js, @mdi/react, moment, numeral
|
|
10
|
+
3. Refer to https://zeroheight.com/3b34634b9/p/57050e-itds for available components and how to use them.
|
|
11
|
+
4. Import components as needed into your React project: `import { Button } from @hexure/ui`
|
|
4
12
|
|
|
5
|
-
1. Installation process
|
|
6
|
-
a. Install nodeJS (preferably through NVS for windows and NVM for Linux/MacOS)
|
|
7
13
|
b. To use the UI Library in your project `npx install @hexure/ui`
|
|
8
14
|
Some common Commands:
|
|
9
15
|
`npm run rollup` to run rollup and generate a dist folder
|
|
10
16
|
`npm run storybook` to run storybook server and see components on storybook.
|
|
11
17
|
`npm run test` to run all test cases.
|
|
12
18
|
|
|
13
|
-
2. Usage: See `https://zeroheight.com/3b34634b9/p/57050e-itds`
|
|
14
19
|
|
|
15
20
|
# Contribute
|
|
16
21
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
## Setting up your local environment
|
|
23
|
+
|
|
24
|
+
1. Clone the repo to your machine
|
|
25
|
+
2. Make sure you have Node and NPM install on your machine
|
|
26
|
+
3. Navigate to the clone repo directory and install it's npm packages: `npm i`
|
|
27
|
+
4. Run the storybook command to preview the components and your changes: `npm run storybook`
|
|
28
|
+
|
|
29
|
+
## Creating a new component
|
|
30
|
+
|
|
31
|
+
1. Pull down the latest version of main and create a new branch off it that corresponds with a Jira ticket: `git branch -b [your_name]/[FEE-#]`
|
|
32
|
+
2. Create a new directory in `src/components` with the following files:
|
|
33
|
+
- index.ts
|
|
34
|
+
- ComponentName.tsx: This should match the name of the React component and the name of the component in the Design System
|
|
35
|
+
- ComponentName.stories.tsx: This should match the name of the tsx file above
|
|
36
|
+
3. Add the following content to index.ts
|
|
37
|
+
- ```export { default } from './ComponentName';```
|
|
38
|
+
4. Build out ComponentName.tsx and ComponentName.stories.tsx as needed.
|
|
39
|
+
- Be sure to follow our front-end guidelines and standards found at https://insurancetechnologies.atlassian.net/jira/software/projects/FEE/pages
|
|
40
|
+
5. Make sure ESLint passes by before committing/pushing your changes `npm run eslint`. You can use `npm run eslint-fix` to auto-fix some of the ESLint errors
|
|
41
|
+
6. Make sure you run Prettier before committing/pushing your changes: `npm run prettier`
|
|
42
|
+
7. Once you're work is complete, create a new Pull Request in Azure DevOps against the main branch.
|
|
43
|
+
8. Your Pull Request must be reviewed and approved by the lead over this repository.
|
|
44
|
+
9. Once approved, merge your pull request into main and follow the steps under "Releasing a new version"
|
|
45
|
+
|
|
46
|
+
## Modifying an existing component
|
|
20
47
|
|
|
21
|
-
|
|
22
|
-
|
|
48
|
+
1. Pull down the latest version of main and create a new branch off it that corresponds with a Jira ticket: `git branch -b [your_name]/[FEE-#]`
|
|
49
|
+
2. Modify ComponentName.tsx and ComponentName.stories.tsx as neeeded.
|
|
50
|
+
- Be sure to follow our front-end guidelines and standards found at https://insurancetechnologies.atlassian.net/jira/software/projects/FEE/pages
|
|
51
|
+
3. Make sure ESLint passes by before committing/pushing your changes `npm run eslint`. You can use `npm run eslint-fix` to auto-fix some of the ESLint errors
|
|
52
|
+
4. Make sure you run Prettier before committing/pushing your changes: `npm run prettier`
|
|
53
|
+
5. Once you're work is complete, create a new Pull Request in Azure DevOps against the main branch.
|
|
54
|
+
6. Your Pull Request must be reviewed and approved by the lead over this repository.
|
|
55
|
+
7. Once approved, merge your pull request into main and follow the steps under "Releasing a new version"
|
|
23
56
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
|
27
|
-
|---> Component.tsx
|
|
28
|
-
|---> Component.test.tsx
|
|
29
|
-
|---> Component.stories.tsx
|
|
30
|
-
|---> index.ts
|
|
57
|
+
## Releasing a new version
|
|
58
|
+
You should release a new version of this package immediately after a Pull Request in approved.
|
|
31
59
|
|
|
32
|
-
|
|
33
|
-
|
|
60
|
+
1. Determine the new version number based on the following:
|
|
61
|
+
- Major: The only time this would be bumped is if we're making wholistic breaking changes, like doing a major upgrade to React.
|
|
62
|
+
- Minor: This should be bumped if we are:
|
|
63
|
+
- Adding a new component or utility
|
|
64
|
+
- Making breaking changes to an individual component or utility
|
|
65
|
+
- Patch: This should be bumped if we are:
|
|
66
|
+
- Making non-breaking changes to an indivdiual component or utility
|
|
67
|
+
- Making minor bumps to npm packages
|
|
68
|
+
- Fixing bugs with existing components
|
|
69
|
+
2. Pull down the latest version of main and create a new branch off it that corresponds with the new version number: `git branch -b release/1.x.x`
|
|
70
|
+
3. Make sure ESLint passes: `npm run eslint`
|
|
71
|
+
- Since ESLint passing is a requirement for all PRs, this should always pass
|
|
72
|
+
4. Run Rollup to compile the src files into the dist directory for distribution: `npm run rollup`
|
|
73
|
+
- Sometimes rollup won't exit out the command after generating the files into dist. If this happens, just exit out of the process
|
|
74
|
+
5. Verify the updates are seen in the dist directory: `git status` and/or `git diff`
|
|
75
|
+
6. Add, commit, and push the changes: `git add .` then `git commit -m "v1.x.x"` then `git push origin release/1.x.x`
|
|
76
|
+
7. Create a Pull Request in Azure DevOps against the main branch.
|
|
77
|
+
8. Your Pull Request must be reviewed and approved by the lead over this repository.
|
|
78
|
+
9. Once approved, merge your pull request into main.
|
|
79
|
+
10. Pull down the updated main branch and run `npm publish`
|
|
80
|
+
11. Go to the Azure DevOps repo and add a new Tag
|
|
81
|
+
- Tag Name: v1.x.x
|
|
82
|
+
- Description: Add details around what was added/changed
|
|
83
|
+
|
|
34
84
|
|
|
35
|
-
Important Note:
|
|
36
|
-
It is very important for you to generate a new dist folder each time you create a new component or make changes to the existing. Since we install the library through git we should have the dist folder because the project (React application) will look inside this folder for the components and styles. Since we are not creating an npm package or registry, this step is very important and the dist folder should not be added to .gitignore file.
|
package/dist/cjs/index.js
CHANGED
|
@@ -2037,6 +2037,23 @@ var Accordion = function (_a) {
|
|
|
2037
2037
|
};
|
|
2038
2038
|
var templateObject_1$j, templateObject_2$h;
|
|
2039
2039
|
|
|
2040
|
+
var button_type_mapping = {
|
|
2041
|
+
primary: {
|
|
2042
|
+
background_color: Colors.PRIMARY.Hex,
|
|
2043
|
+
border_color: Colors.PRIMARY.Hex,
|
|
2044
|
+
content_color: '#fff',
|
|
2045
|
+
},
|
|
2046
|
+
secondary: {
|
|
2047
|
+
background_color: 'transparent',
|
|
2048
|
+
border_color: Colors.PRIMARY.Hex,
|
|
2049
|
+
content_color: Colors.PRIMARY.Hex,
|
|
2050
|
+
},
|
|
2051
|
+
red: {
|
|
2052
|
+
background_color: Colors.RED.Hex,
|
|
2053
|
+
border_color: Colors.RED.Hex,
|
|
2054
|
+
content_color: '#fff',
|
|
2055
|
+
},
|
|
2056
|
+
};
|
|
2040
2057
|
var StyledButton = styled.button(templateObject_1$i || (templateObject_1$i = __makeTemplateObject(["\n height: ", ";\n line-height: 1em;\n border-radius: ", ";\n margin: ", ";\n padding: ", ";\n outline: none;\n background: ", ";\n width: ", ";\n cursor: ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n opacity: ", ";\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n box-sizing: border-box;\n &:hover {\n opacity: ", ";\n }\n"], ["\n height: ", ";\n line-height: 1em;\n border-radius: ", ";\n margin: ", ";\n padding: ", ";\n outline: none;\n background: ", ";\n width: ", ";\n cursor: ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n opacity: ", ";\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n box-sizing: border-box;\n &:hover {\n opacity: ", ";\n }\n"])), function (props) { return (props.$small ? '30px' : '40px'); }, function (props) { return (props.$small ? '15px' : '20px'); }, function (props) { return props.$margin || '0px'; }, function (props) {
|
|
2041
2058
|
if (props.$hasChildren) {
|
|
2042
2059
|
if (props.$small) {
|
|
@@ -2047,7 +2064,9 @@ var StyledButton = styled.button(templateObject_1$i || (templateObject_1$i = __m
|
|
|
2047
2064
|
}
|
|
2048
2065
|
}
|
|
2049
2066
|
return '0px';
|
|
2050
|
-
}, function (props) {
|
|
2067
|
+
}, function (props) {
|
|
2068
|
+
return props.$type ? button_type_mapping[props.$type].background_color : Colors.PRIMARY.Hex;
|
|
2069
|
+
}, function (props) {
|
|
2051
2070
|
if (props.$hasChildren) {
|
|
2052
2071
|
return 'auto';
|
|
2053
2072
|
}
|
|
@@ -2055,16 +2074,18 @@ var StyledButton = styled.button(templateObject_1$i || (templateObject_1$i = __m
|
|
|
2055
2074
|
return '30px';
|
|
2056
2075
|
}
|
|
2057
2076
|
return '40px';
|
|
2058
|
-
}, function (props) { return (props.$disabled ? 'default' : 'pointer'); }, function (props) { return (props.$disabled ? 0.6 : 0.9); },
|
|
2059
|
-
|
|
2077
|
+
}, function (props) { return (props.$disabled ? 'default' : 'pointer'); }, function (props) { return (props.$disabled ? 0.6 : 0.9); }, function (props) {
|
|
2078
|
+
return props.$type ? button_type_mapping[props.$type].border_color : Colors.PRIMARY.Hex;
|
|
2079
|
+
}, function (props) { return (props.$disabled ? 0.6 : 1); });
|
|
2080
|
+
var Label$3 = styled.span(templateObject_2$g || (templateObject_2$g = __makeTemplateObject(["\n color: ", ";\n font-size: ", ";\n font-family: ", ";\n font-weight: 500;\n line-height: ", ";\n"], ["\n color: ", ";\n font-size: ", ";\n font-family: ", ";\n font-weight: 500;\n line-height: ", ";\n"])), function (props) { return (props.$type ? button_type_mapping[props.$type].content_color : '#fff'); }, function (props) { return (props.$small ? FontSizes.SMALL : FontSizes.DEFAULT); }, FontStyles.DEFAULT, function (props) { return (props.$small ? '2.2em' : '2.9em'); });
|
|
2060
2081
|
var StyledIcon = styled.span(templateObject_3$b || (templateObject_3$b = __makeTemplateObject(["\n margin-left: ", ";\n margin-right: ", ";\n display: flex;\n align-items: center;\n box-sizing: border-box;\n"], ["\n margin-left: ", ";\n margin-right: ", ";\n display: flex;\n align-items: center;\n box-sizing: border-box;\n"])), function (props) { return (props.$hasChildren ? '6px' : '0px'); }, function (props) { return (props.$hasChildren ? '-4px' : '0px'); });
|
|
2061
2082
|
var Button = function (_a) {
|
|
2062
2083
|
var children = _a.children, _b = _a.disabled, disabled = _b === void 0 ? false : _b, icon = _a.icon, _c = _a.margin, margin = _c === void 0 ? '' : _c, onClick = _a.onClick, _d = _a.small, small = _d === void 0 ? false : _d, _e = _a.type, type = _e === void 0 ? 'primary' : _e, accessibleProps = __rest(_a, ["children", "disabled", "icon", "margin", "onClick", "small", "type"]);
|
|
2063
2084
|
var has_children = children && children.length > 0;
|
|
2064
|
-
return (React.createElement(StyledButton, __assign({ "$disabled": disabled, "$hasChildren": !!has_children, "$margin": margin, "$
|
|
2085
|
+
return (React.createElement(StyledButton, __assign({ "$disabled": disabled, "$hasChildren": !!has_children, "$margin": margin, "$small": small, "$type": type, onClick: disabled ? undefined : onClick }, accessibleProps),
|
|
2065
2086
|
children ? (React.createElement(Label$3, { "$small": small, "$type": type }, children)) : null,
|
|
2066
2087
|
icon ? (React.createElement(StyledIcon, { "$hasChildren": !!has_children },
|
|
2067
|
-
React.createElement(Icon, { color: type
|
|
2088
|
+
React.createElement(Icon, { color: type ? button_type_mapping[type].content_color : '#fff', path: icon, size: small ? '20px' : '24px' }))) : null));
|
|
2068
2089
|
};
|
|
2069
2090
|
var templateObject_1$i, templateObject_2$g, templateObject_3$b;
|
|
2070
2091
|
|
|
@@ -2324,7 +2345,7 @@ var Container = styled.dialog(templateObject_2$7 || (templateObject_2$7 = __make
|
|
|
2324
2345
|
var Header$1 = styled.div(templateObject_3$5 || (templateObject_3$5 = __makeTemplateObject(["\n position: sticky;\n top: 0;\n padding: 20px;\n border-bottom: 1px solid #e5e5e5;\n display: flex;\n align-items: center;\n background: #ffffff;\n box-sizing: border-box;\n"], ["\n position: sticky;\n top: 0;\n padding: 20px;\n border-bottom: 1px solid #e5e5e5;\n display: flex;\n align-items: center;\n background: #ffffff;\n box-sizing: border-box;\n"])));
|
|
2325
2346
|
var Close = styled.div(templateObject_4$3 || (templateObject_4$3 = __makeTemplateObject(["\n margin-left: auto;\n display: flex;\n align-items: center;\n padding-left: 20px;\n cursor: pointer;\n"], ["\n margin-left: auto;\n display: flex;\n align-items: center;\n padding-left: 20px;\n cursor: pointer;\n"])));
|
|
2326
2347
|
var CloseMsg = styled.span(templateObject_5$1 || (templateObject_5$1 = __makeTemplateObject(["\n font-size: ", ";\n font-weight: 400;\n font-family: ", ";\n line-height: 1em;\n color: ", ";\n"], ["\n font-size: ", ";\n font-weight: 400;\n font-family: ", ";\n line-height: 1em;\n color: ", ";\n"])), FontSizes.SMALL, FontStyles.DEFAULT, Colors.MEDIUM_GRAY.Hex);
|
|
2327
|
-
var ContentWrapper = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n overflow: auto;\n background: #ffffff;\n max-height: calc(100vh - 260px);\n box-sizing: border-box;\n"], ["\n overflow: auto;\n background: #ffffff;\n max-height: calc(100vh - 260px);\n box-sizing: border-box;\n"])));
|
|
2348
|
+
var ContentWrapper = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n overflow-x: hidden;\n overflow-y: auto;\n background: #ffffff;\n max-height: calc(100vh - 260px);\n box-sizing: border-box;\n"], ["\n overflow-x: hidden;\n overflow-y: auto;\n background: #ffffff;\n max-height: calc(100vh - 260px);\n box-sizing: border-box;\n"])));
|
|
2328
2349
|
var ButtonBar = styled.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n position: sticky;\n bottom: 0;\n background: #ffffff;\n padding: 20px;\n border-top: 1px solid #e5e5e5;\n display: flex;\n align-items: center;\n justify-self: flex-end;\n box-sizing: border-box;\n"], ["\n position: sticky;\n bottom: 0;\n background: #ffffff;\n padding: 20px;\n border-top: 1px solid #e5e5e5;\n display: flex;\n align-items: center;\n justify-self: flex-end;\n box-sizing: border-box;\n"])));
|
|
2329
2350
|
var Modal = function (_a) {
|
|
2330
2351
|
var children = _a.children, title = _a.title, onClose = _a.onClose, maxWidth = _a.maxWidth, primaryButton = _a.primaryButton, secondaryButton = _a.secondaryButton, tertiaryButton = _a.tertiaryButton, accessibleProps = __rest(_a, ["children", "title", "onClose", "maxWidth", "primaryButton", "secondaryButton", "tertiaryButton"]);
|