@hortiview/shared-components 0.0.4730 → 0.0.4779
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 +199 -1
- package/dist/ListAreaService-BPp_O2BH.js +67 -0
- package/dist/assets/DeleteModal.css +1 -22
- package/dist/assets/FormDatePicker.css +1 -0
- package/dist/assets/FormSelect.css +1 -0
- package/dist/assets/FormText.css +1 -0
- package/dist/assets/main.css +22 -0
- package/dist/components/BaseView/BaseView.d.ts +1 -0
- package/dist/components/BaseView/BaseView.js +23 -21
- package/dist/components/BaseView/BaseView.test.js +1 -1
- package/dist/components/BasicHeading/BasicHeading.js +52 -41
- package/dist/components/BlockView/BlockView.js +51 -41
- package/dist/components/DeleteModal/DeleteModal.js +31 -43
- package/dist/components/DeleteModal/DeleteModal.test.js +3 -3
- package/dist/components/Disclaimer/Disclaimer.js +11 -8
- package/dist/components/FormComponents/FormCheckBox/FormCheckBox.d.ts +30 -0
- package/dist/components/FormComponents/FormCheckBox/FormCheckBox.js +42 -0
- package/dist/components/FormComponents/FormCheckBox/FormCheckBox.test.d.ts +1 -0
- package/dist/components/FormComponents/FormCheckBox/FormCheckBox.test.js +50 -0
- package/dist/components/FormComponents/FormDatePicker/FormDatePicker.d.ts +36 -0
- package/dist/components/FormComponents/FormDatePicker/FormDatePicker.js +64 -0
- package/dist/components/FormComponents/FormDatePicker/FormDatePicker.test.d.ts +1 -0
- package/dist/components/FormComponents/FormDatePicker/FormDatePicker.test.js +69 -0
- package/dist/components/FormComponents/FormRadio/FormRadio.d.ts +21 -0
- package/dist/components/FormComponents/FormRadio/FormRadio.js +30 -0
- package/dist/components/FormComponents/FormRadio/FormRadio.test.d.ts +1 -0
- package/dist/components/FormComponents/FormRadio/FormRadio.test.js +73 -0
- package/dist/components/FormComponents/FormSelect/FormSelect.d.ts +61 -0
- package/dist/components/FormComponents/FormSelect/FormSelect.js +80 -0
- package/dist/components/FormComponents/FormSelect/FormSelect.test.d.ts +1 -0
- package/dist/components/FormComponents/FormSelect/FormSelect.test.js +65 -0
- package/dist/components/FormComponents/FormSlider/FormSlider.d.ts +27 -0
- package/dist/components/FormComponents/FormSlider/FormSlider.js +37 -0
- package/dist/components/FormComponents/FormSlider/FormSlider.test.d.ts +1 -0
- package/dist/components/FormComponents/FormSlider/FormSlider.test.js +49 -0
- package/dist/components/FormComponents/FormText/FormText.d.ts +69 -0
- package/dist/components/FormComponents/FormText/FormText.js +108 -0
- package/dist/components/FormComponents/FormText/FormText.test.d.ts +1 -0
- package/dist/components/FormComponents/FormText/FormText.test.js +84 -0
- package/dist/components/HashTabView/HashTabView.js +48 -40
- package/dist/components/HeaderFilter/HeaderFilter.js +16 -14
- package/dist/components/Iconify/Iconify.d.ts +1 -0
- package/dist/components/ListArea/ListArea.d.ts +1 -0
- package/dist/components/ListArea/ListArea.js +494 -316
- package/dist/components/ListArea/ListArea.test.js +1 -1
- package/dist/components/ListArea/ListAreaService.js +8 -55
- package/dist/components/SearchBar/SearchBar.js +23 -21
- package/dist/components/VerticalDivider/VerticalDivider.js +6 -4
- package/dist/get-Dyz8NMrE.js +321 -0
- package/dist/hooks/useBreakpoint.js +2 -2
- package/dist/main.d.ts +6 -0
- package/dist/main.js +42 -29
- package/dist/types/HashTab.d.ts +1 -0
- package/dist/types/ListElement.d.ts +1 -0
- package/dist/types/internal/ReactRouterTypes.d.ts +1 -0
- package/dist/{useBreakpoint-DyAmuka7.js → useBreakpoint-DROHPVxO.js} +2 -2
- package/package.json +7 -2
- package/dist/BlockView.module-8kbPxxc4.js +0 -15
- package/dist/HashTabView.module-BY0tbl3B.js +0 -13
- package/dist/HeaderFilter.module-DiBmulr5.js +0 -7
- package/dist/_getTag-DyrzUAbj.js +0 -494
- package/dist/baseView.module-DXWalo9p.js +0 -7
- package/dist/basicHeading.module-ClcvD7x2.js +0 -16
- package/dist/disclaimer.module-BZydt-Q_.js +0 -8
- package/dist/listArea.module-B04TR5bj.js +0 -14
- package/dist/searchBar.module-9gKyrZRT.js +0 -7
- package/dist/verticalDivider.module-C3_GL-fH.js +0 -7
- /package/dist/assets/{baseView.css → BaseView.css} +0 -0
- /package/dist/assets/{basicHeading.css → BasicHeading.css} +0 -0
- /package/dist/assets/{disclaimer.css → Disclaimer.css} +0 -0
- /package/dist/assets/{listArea.css → ListAreaService.css} +0 -0
- /package/dist/assets/{searchBar.css → SearchBar.css} +0 -0
- /package/dist/assets/{verticalDivider.css → VerticalDivider.css} +0 -0
package/README.md
CHANGED
|
@@ -12,10 +12,19 @@ This is a shared component library. It should used in the HortiView platform and
|
|
|
12
12
|
|
|
13
13
|
`yarn add @hortiview/shared-components`
|
|
14
14
|
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
This library is based in Bayers element component library. To use it properly you need to install this package first.
|
|
18
|
+
To get access to this restricted package please contact your Bayer contact person.
|
|
19
|
+
|
|
20
|
+
After you gain access use `yarn add @element/react-components @element/themes` or `npm i @element/react-components @element/themes` to add the package to your solution.
|
|
21
|
+
|
|
15
22
|
## Remarks
|
|
16
23
|
|
|
17
24
|
For the best experience use [react-router](https://reactrouter.com/en/main) in your solution, because some of the component rely on properties like pathname, hash or components like `Link` out of `react-router`.
|
|
18
25
|
|
|
26
|
+
Additionally the library provides form components using [react-hook-form](https://react-hook-form.com/get-started). When you want to use these components please install `react-hook-form` before using them.
|
|
27
|
+
|
|
19
28
|
## Available packages:
|
|
20
29
|
|
|
21
30
|
1. [BaseView](#baseview)
|
|
@@ -24,8 +33,15 @@ For the best experience use [react-router](https://reactrouter.com/en/main) in y
|
|
|
24
33
|
1. [DeleteModal](#deletemodal)
|
|
25
34
|
1. [Disclaimer](#disclaimer)
|
|
26
35
|
1. [EmptyView](#emptyview)
|
|
36
|
+
1. [FormComponents](#formcomponents)
|
|
37
|
+
1. [FormCheckBox](#formcheckbox)
|
|
38
|
+
1. [FormDatePicker](#formdatepicker)
|
|
39
|
+
1. [FormRadio](#formradio)
|
|
40
|
+
1. [FormSelect](#formselect)
|
|
41
|
+
1. [FormSlider](#formslider)
|
|
42
|
+
1. [FormText](#formtext)
|
|
27
43
|
1. [HashTabView](#hashtabview)
|
|
28
|
-
1. [
|
|
44
|
+
1. [HeaderFilter](#headerfilter)
|
|
29
45
|
1. [Iconify](#iconify)
|
|
30
46
|
1. [ListArea](#listarea)
|
|
31
47
|
1. [ScrollBar](#scrollbar)
|
|
@@ -153,6 +169,188 @@ import { EmptyView } from '@hortiview/shared-components';
|
|
|
153
169
|
<EmptyView title='No Content' subtitle='nothing' icon='grass' />;
|
|
154
170
|
```
|
|
155
171
|
|
|
172
|
+
### FormComponents
|
|
173
|
+
|
|
174
|
+
The library provides some form components based on [react-hook-form](https://react-hook-form.com/). The components can only be use within a form provided by react-hook-form.
|
|
175
|
+
So please add the package before you use the components.
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
yarn add react-hook-form
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
or
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
npm install react-hook-form
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
#### FormCheckBox
|
|
188
|
+
|
|
189
|
+
Provides a checkbox form component
|
|
190
|
+
|
|
191
|
+
```typescript
|
|
192
|
+
import { FormCheckBox } from '@hortiview/shared-components';
|
|
193
|
+
import { FormProvider, SubmitHandler, useForm } from 'react-hook-form';
|
|
194
|
+
|
|
195
|
+
const formMethods = useForm<{ check: boolean }>({
|
|
196
|
+
mode: 'onSubmit',
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
const { handleSubmit } = formMethods;
|
|
200
|
+
|
|
201
|
+
<FormProvider {...formMethods}>
|
|
202
|
+
<form onSubmit={handleSubmit(onSubmit)}>
|
|
203
|
+
<FormCheckBox<{ check: boolean }>
|
|
204
|
+
propertyName={`check`}
|
|
205
|
+
label={'My Checkbox'}
|
|
206
|
+
onChange={() => additionalOnChange()}
|
|
207
|
+
validate={validateFn}
|
|
208
|
+
/>
|
|
209
|
+
</form>
|
|
210
|
+
</FormProvider>;
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
#### FormDatePicker
|
|
214
|
+
|
|
215
|
+
Provides a datepicker form component
|
|
216
|
+
|
|
217
|
+
```typescript
|
|
218
|
+
import { FormDatePicker } from '@hortiview/shared-components';
|
|
219
|
+
import { FormProvider, SubmitHandler, useForm } from 'react-hook-form';
|
|
220
|
+
|
|
221
|
+
const formMethods = useForm<{ birthday: string }>({
|
|
222
|
+
mode: 'onSubmit',
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
const { handleSubmit } = formMethods;
|
|
226
|
+
|
|
227
|
+
<FormProvider {...formMethods}>
|
|
228
|
+
<form onSubmit={handleSubmit(onSubmit)}>
|
|
229
|
+
<FormDatePicker<{ birthday: string }>
|
|
230
|
+
propertyName={'birthday'}
|
|
231
|
+
label={'user.date-of-birth'}
|
|
232
|
+
maxRangeYear={0}
|
|
233
|
+
/>
|
|
234
|
+
</form>
|
|
235
|
+
</FormProvider>;
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
#### FormRadio
|
|
239
|
+
|
|
240
|
+
Provides a radio button form component
|
|
241
|
+
|
|
242
|
+
```typescript
|
|
243
|
+
import { FormRadio } from '@hortiview/shared-components';
|
|
244
|
+
import { FormProvider, SubmitHandler, useForm } from 'react-hook-form';
|
|
245
|
+
|
|
246
|
+
const formMethods = useForm<{ radioValue: string }>({
|
|
247
|
+
mode: 'onSubmit',
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
const { handleSubmit } = formMethods;
|
|
251
|
+
|
|
252
|
+
<FormProvider {...formMethods}>
|
|
253
|
+
<form onSubmit={handleSubmit(onSubmit)}>
|
|
254
|
+
<FormRadio<{ radioValue: string }>
|
|
255
|
+
propertyName='radioValue'
|
|
256
|
+
options={[
|
|
257
|
+
{ value: 'priced', label: 'Priced' },
|
|
258
|
+
{ value: 'free', label: 'Free },
|
|
259
|
+
]}
|
|
260
|
+
/>
|
|
261
|
+
</form>
|
|
262
|
+
</FormProvider>;
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
#### FormSelect
|
|
266
|
+
|
|
267
|
+
Provides a select form component
|
|
268
|
+
|
|
269
|
+
```typescript
|
|
270
|
+
import { FormSelect } from '@hortiview/shared-components';
|
|
271
|
+
import { FormProvider, SubmitHandler, useForm } from 'react-hook-form';
|
|
272
|
+
|
|
273
|
+
const formMethods = useForm<{ type: string }>({
|
|
274
|
+
mode: 'onSubmit',
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
const { handleSubmit } = formMethods;
|
|
278
|
+
|
|
279
|
+
const typeOptions = [
|
|
280
|
+
{
|
|
281
|
+
id: 1,
|
|
282
|
+
value: 'Car',
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
id: 2,
|
|
286
|
+
value: 'Bike',
|
|
287
|
+
},
|
|
288
|
+
];
|
|
289
|
+
|
|
290
|
+
<FormProvider {...formMethods}>
|
|
291
|
+
<form onSubmit={handleSubmit(onSubmit)}>
|
|
292
|
+
<FormSelect<{ type: string }>
|
|
293
|
+
propertyName='type'
|
|
294
|
+
label='Type'
|
|
295
|
+
options={typeOptions}
|
|
296
|
+
valueKey='id'
|
|
297
|
+
textKey='value'
|
|
298
|
+
requiredText='required'
|
|
299
|
+
required
|
|
300
|
+
/>
|
|
301
|
+
</form>
|
|
302
|
+
</FormProvider>;
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
#### FormSlider
|
|
306
|
+
|
|
307
|
+
Provides a slider form component
|
|
308
|
+
|
|
309
|
+
```typescript
|
|
310
|
+
import { FormSlider } from '@hortiview/shared-components';
|
|
311
|
+
import { FormProvider, SubmitHandler, useForm } from 'react-hook-form';
|
|
312
|
+
|
|
313
|
+
const formMethods = useForm<{ range: string }>({
|
|
314
|
+
mode: 'onSubmit',
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
const { handleSubmit } = formMethods;
|
|
318
|
+
|
|
319
|
+
<FormProvider {...formMethods}>
|
|
320
|
+
<form onSubmit={handleSubmit(onSubmit)}>
|
|
321
|
+
<FormSlider<{ range: string }> propertyName='range' minValue={30} maxValue={90} step={30} />
|
|
322
|
+
</form>
|
|
323
|
+
</FormProvider>;
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
#### FormText
|
|
327
|
+
|
|
328
|
+
Provides a text form component
|
|
329
|
+
|
|
330
|
+
```typescript
|
|
331
|
+
import { FormText } from '@hortiview/shared-components';
|
|
332
|
+
import { FormProvider, SubmitHandler, useForm } from 'react-hook-form';
|
|
333
|
+
|
|
334
|
+
const formMethods = useForm<{ address: string }>({
|
|
335
|
+
mode: 'onSubmit',
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
const { handleSubmit } = formMethods;
|
|
339
|
+
|
|
340
|
+
<FormProvider {...formMethods}>
|
|
341
|
+
<form onSubmit={handleSubmit(onSubmit)}>
|
|
342
|
+
<FormText<{ address: string }>
|
|
343
|
+
maxLength={200}
|
|
344
|
+
label='address'
|
|
345
|
+
propertyName='address'
|
|
346
|
+
required
|
|
347
|
+
requiredText='required'
|
|
348
|
+
textarea
|
|
349
|
+
/>
|
|
350
|
+
</form>
|
|
351
|
+
</FormProvider>;
|
|
352
|
+
```
|
|
353
|
+
|
|
156
354
|
### HashTabView
|
|
157
355
|
|
|
158
356
|
A tab view component, which can use the hash value in the url to render the tab regarding to the hash. For the best experience use `react-router`.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import "./assets/ListAreaService.css";
|
|
2
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import { TypoButton as b, TypoSubtitle as q, TypoBody as k, Icon as L } from "@element/react-components";
|
|
4
|
+
import { Iconify as C } from "./components/Iconify/Iconify.js";
|
|
5
|
+
import { AvailableCustomIcons as x } from "./enums/AvailableCustomIcons.js";
|
|
6
|
+
const E = "_fullWidth_1l0qh_1", N = "_mainElevation_1l0qh_5", W = "_searchbar_1l0qh_11", $ = "_roundedBottom_1l0qh_19", j = "_list_1l0qh_24", S = "_listItem_1l0qh_48", w = "_trailingIcon_1l0qh_52", A = "_groupedListItem_1l0qh_64", _ = {
|
|
7
|
+
fullWidth: E,
|
|
8
|
+
mainElevation: N,
|
|
9
|
+
searchbar: W,
|
|
10
|
+
roundedBottom: $,
|
|
11
|
+
list: j,
|
|
12
|
+
listItem: S,
|
|
13
|
+
trailingIcon: w,
|
|
14
|
+
groupedListItem: A
|
|
15
|
+
}, J = (o, i, n, r) => {
|
|
16
|
+
const l = o.reduce((e, a) => {
|
|
17
|
+
const { groupName: t, ...m } = a;
|
|
18
|
+
return !t || typeof t != "string" || (e[t] || (e[t] = {
|
|
19
|
+
groupName: /* @__PURE__ */ s(b, { children: t }),
|
|
20
|
+
id: t,
|
|
21
|
+
items: []
|
|
22
|
+
}), e[t].items = [
|
|
23
|
+
...e[t].items,
|
|
24
|
+
g(m, i, n, !0, r)
|
|
25
|
+
]), e;
|
|
26
|
+
}, {});
|
|
27
|
+
return Object.values(l);
|
|
28
|
+
}, K = (o, i, n, r) => o.map((l) => g(l, i, n, !1, r)), g = (o, i, n, r, l) => {
|
|
29
|
+
const {
|
|
30
|
+
title: e,
|
|
31
|
+
subTitle: a,
|
|
32
|
+
route: t,
|
|
33
|
+
value: m,
|
|
34
|
+
noNavigation: d,
|
|
35
|
+
disabled: I,
|
|
36
|
+
icon: h,
|
|
37
|
+
iconType: p,
|
|
38
|
+
trailingIcon: v,
|
|
39
|
+
trailingIconType: y,
|
|
40
|
+
actionButton: f,
|
|
41
|
+
onClick: T,
|
|
42
|
+
customTitle: u
|
|
43
|
+
} = o, c = i === t;
|
|
44
|
+
return {
|
|
45
|
+
select: c,
|
|
46
|
+
primaryText: u ?? /* @__PURE__ */ s(q, { level: 1, bold: c, themeColor: c ? "primary" : void 0, children: e }),
|
|
47
|
+
secondaryText: a && !u ? /* @__PURE__ */ s(k, { level: 2, themeColor: c ? "primary" : void 0, children: a }) : void 0,
|
|
48
|
+
trailingBlock: f ?? v ?? /* @__PURE__ */ s(L, { icon: "arrow_right" }),
|
|
49
|
+
leadingBlock: G(h),
|
|
50
|
+
nonInteractive: I,
|
|
51
|
+
value: m,
|
|
52
|
+
componentProps: {
|
|
53
|
+
leadingBlockType: p ?? "icon",
|
|
54
|
+
trailingBlockType: y ?? "icon",
|
|
55
|
+
className: `${p === "avatar" ? "" : _.listItem} ${n} ${r ? _.groupedListItem : ""}`,
|
|
56
|
+
onClick: (O, B) => T?.(B),
|
|
57
|
+
tag: d ? void 0 : l ?? "a",
|
|
58
|
+
to: d ? void 0 : t
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}, G = (o) => typeof o == "string" && o in x ? /* @__PURE__ */ s(C, { icon: o }) : o;
|
|
62
|
+
export {
|
|
63
|
+
K as a,
|
|
64
|
+
J as g,
|
|
65
|
+
g as m,
|
|
66
|
+
_ as s
|
|
67
|
+
};
|