@trimble-oss/moduswebcomponents-mcp 1.0.1 → 1.2.0
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/package.json +1 -1
- package/versions/1.2.0/component-docs/_all_components.json +56 -0
- package/versions/1.2.0/component-docs/modus-wc-autocomplete.json +415 -0
- package/versions/1.2.0/component-docs/modus-wc-date.json +227 -0
- package/versions/1.2.0/component-docs/modus-wc-dropdown-menu.json +164 -0
- package/versions/1.2.0/component-docs/modus-wc-logo.json +61 -0
- package/versions/1.2.0/component-docs/modus-wc-menu-item.json +165 -0
- package/versions/1.2.0/component-docs/modus-wc-menu.json +106 -0
- package/versions/1.2.0/component-docs/modus-wc-navbar.json +290 -0
- package/versions/1.2.0/component-docs/modus-wc-profile-menu.json +64 -0
- package/versions/1.2.0/component-docs/modus-wc-side-navigation.json +102 -0
- package/versions/1.2.0/component-docs/modus-wc-table.json +202 -0
- package/versions/1.2.0/component-docs/modus-wc-tooltip.json +94 -0
- package/versions/1.2.0/component-docs/modus-wc-typography.json +78 -0
- package/versions/1.2.0/docs/_all_docs.json +15 -0
- package/versions/1.2.0/docs/angular.mdx +374 -0
- package/versions/1.2.0/docs/getting-started.mdx +131 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { Meta } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
<Meta title="Documentation/Getting Started" />
|
|
4
|
+
|
|
5
|
+
# Getting Started
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
<b>
|
|
10
|
+
Lock the installed package version to avoid unintended breakages on future npm
|
|
11
|
+
installs.
|
|
12
|
+
</b>
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @trimble-oss/moduswebcomponents
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
### 1. Set up the styling:
|
|
21
|
+
|
|
22
|
+
You will need to import our styling in your main JavaScript or CSS file:
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
import '@trimble-oss/moduswebcomponents/modus-wc-styles.css';
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
#### Variables-Only CSS
|
|
29
|
+
|
|
30
|
+
If you want Modus styling to apply only to your components and **not affect the rest of your application**, you can import the lightweight variables-only file instead:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
import '@trimble-oss/moduswebcomponents/modus-wc-variables.css';
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Modus components inside Shadow DOM will automatically inject their own class rules via `handleShadowDOMStyles()`, so they render correctly without the full stylesheet being loaded globally.
|
|
37
|
+
|
|
38
|
+
> **Note:** Both imports work with Shadow DOM. We recommend `modus-wc-styles.css` for new applications. Consider `modus-wc-variables.css` for existing applications where you want to avoid global style changes.
|
|
39
|
+
|
|
40
|
+
### 2. Set the theme:
|
|
41
|
+
|
|
42
|
+
The theme can be set manually or by using the `ThemeSwitcher` component. See the "Use a Theme" section of [Styling](/docs/documentation-styling--docs) for guidance.
|
|
43
|
+
|
|
44
|
+
Available themes are:
|
|
45
|
+
|
|
46
|
+
- `modus-modern-light` (default)
|
|
47
|
+
- `modus-modern-dark`
|
|
48
|
+
- `modus-classic-light`
|
|
49
|
+
- `modus-classic-dark`
|
|
50
|
+
- `connect-light`
|
|
51
|
+
- `connect-dark`
|
|
52
|
+
|
|
53
|
+
### 3. Register custom elements:
|
|
54
|
+
|
|
55
|
+
```javascript
|
|
56
|
+
import { defineCustomElements } from '@trimble-oss/moduswebcomponents/loader';
|
|
57
|
+
|
|
58
|
+
// Call during the initial loading of your application
|
|
59
|
+
const Root = () => {
|
|
60
|
+
defineCustomElements();
|
|
61
|
+
|
|
62
|
+
return <App />;
|
|
63
|
+
};
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 4. Use the components:
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
// Use in HTML
|
|
70
|
+
<modus-wc-button variant="primary">Click me</modus-wc-button>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Types
|
|
74
|
+
|
|
75
|
+
Types are a crucial part of our component library, providing robust type safety and enhanced developer experience through comprehensive TypeScript definitions for all components.
|
|
76
|
+
|
|
77
|
+
```javascript
|
|
78
|
+
import { ISelectOption, ModusWcSelectCustomEvent } from '@trimble-oss/moduswebcomponents';
|
|
79
|
+
|
|
80
|
+
const options: ISelectOption[] = [
|
|
81
|
+
{
|
|
82
|
+
label: 'Option 1',
|
|
83
|
+
value: '1',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
label: 'Option 2',
|
|
87
|
+
value: '2',
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
|
|
91
|
+
const handleEvent = (e: ModusWcSelectCustomEvent<ISelectOption>) => {}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Testing with Jest
|
|
95
|
+
|
|
96
|
+
If you are using the React integration package (`@trimble-oss/moduswebcomponents-react`), this package is published as ES modules. To use it in a Jest environment you need to configure Babel to transpile it.
|
|
97
|
+
|
|
98
|
+
Add `transformIgnorePatterns` to your Jest config (`package.json` or `jest.config.js`):
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"jest": {
|
|
103
|
+
"transformIgnorePatterns": ["/node_modules/(?!(@trimble-oss|@stencil))"]
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Ensure your `babel.config.js` includes these presets:
|
|
109
|
+
|
|
110
|
+
```js
|
|
111
|
+
module.exports = {
|
|
112
|
+
presets: [
|
|
113
|
+
['@babel/preset-env', { targets: { node: 'current' } }],
|
|
114
|
+
['@babel/preset-react', { runtime: 'automatic' }],
|
|
115
|
+
'@babel/preset-typescript',
|
|
116
|
+
],
|
|
117
|
+
};
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Framework Integrations
|
|
121
|
+
|
|
122
|
+
- ### [Angular](?path=/docs/documentation-frameworks-angular--docs)
|
|
123
|
+
|
|
124
|
+
- ### [React](?path=/docs/documentation-frameworks-react--docs)
|
|
125
|
+
|
|
126
|
+
- ### [Vue](?path=/docs/documentation-frameworks-vue--docs)
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
Need help? Check out our [GitHub repository](https://github.com/trimble-oss/modus-wc-2.0)
|
|
131
|
+
or [raise an issue](https://github.com/trimble-oss/modus-wc-2.0/issues).
|