@pinuts/bsr-uikit-relaunch 0.0.8 → 0.0.10

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.
@@ -0,0 +1,105 @@
1
+ // import React, { useEffect, useState } from 'react';
2
+ // import PropTypes from 'prop-types';
3
+ // import { useTranslation } from 'react-i18next';
4
+ //
5
+ // // form-builder
6
+ // import { registerComponent, formik } from '@pinuts/form-builder';
7
+ //
8
+ // import useGetOptionList from '../../hooks/useGetOptionList.js';
9
+ // import { getFormControlClassNames } from '../../utils/getUikitClassNames.js';
10
+ // import FormFieldChildPropTypes from '../FormFieldWrapper/FormFieldChildPropTypes.jsx';
11
+ // import FormFieldWrapper from '../FormFieldWrapper/FormFieldWrapper.jsx';
12
+ // import withFieldGroup from '../../hooks/withFieldGroup.jsx';
13
+ // import styles from '../../styles/form.module.scss';
14
+ //
15
+ // import SelectField from '../SelectField/SelectField.jsx';
16
+ //
17
+ // const { useFormikContext } = formik;
18
+ //
19
+ // const fetchHouseNumbers = async (streetId) => {
20
+ // const response = await fetch(`http://localhost:8086/cmsbs/rest/de.bsr.adressen.app/streetNo?streetid=${streetId}`);
21
+ // const data = await response.json();
22
+ //
23
+ // return data;
24
+ // };
25
+ //
26
+ // const HouseNumberSelectField = (config) => {
27
+ //
28
+ // const [selectedStreetId, setSelectedStreetId] = useState(null);
29
+ // const [houseNumberOptions, setHouseNumberOptions] = useState([]);
30
+ // const {
31
+ // streedFieldKey,
32
+ // key,
33
+ // } = config.config;
34
+ // const { values, setFieldValue } = useFormikContext();
35
+ //
36
+ // useEffect(() => {
37
+ // console.log('values: ' + streedFieldKey, config);
38
+ // const streetId = values[streedFieldKey] || '';
39
+ //
40
+ // console.log('values[streedFieldKey]: ', values[streedFieldKey]);
41
+ // setSelectedStreetId(streetId);
42
+ //
43
+ // // set number label
44
+ // if (houseNumberOptions && streetId) {
45
+ // const numberLabelFieldKey = `${key}Label`;
46
+ // const numberSelectKey = values[key];
47
+ // const numberlabel = houseNumberOptions.find(option => option.value === numberSelectKey)?.label;
48
+ // if (values[numberLabelFieldKey] !== numberlabel) {
49
+ // setFieldValue(numberLabelFieldKey, numberlabel);
50
+ // }
51
+ // }
52
+ // }, [values]);
53
+ //
54
+ // useEffect(() => {
55
+ // if (selectedStreetId) {
56
+ // fetchHouseNumbers(selectedStreetId).catch(console.error).then(setHouseNumberOptions);
57
+ // } else {
58
+ // setHouseNumberOptions([]);
59
+ // if (values[key]) {
60
+ // setFieldValue(key, '');
61
+ // }
62
+ // }
63
+ // }, [selectedStreetId]);
64
+ //
65
+ // const newConfig = {
66
+ // ...config,
67
+ // options: houseNumberOptions,
68
+ // };
69
+ //
70
+ // return (
71
+ // <SelectField {...newConfig} />
72
+ // );
73
+ // };
74
+ //
75
+ // HouseNumberSelectField.propTypes = {
76
+ // ...FormFieldChildPropTypes,
77
+ //
78
+ // validation: PropTypes.arrayOf(PropTypes.string),
79
+ // options: PropTypes.arrayOf(
80
+ // PropTypes.oneOfType([
81
+ // PropTypes.shape({
82
+ // value: PropTypes.oneOfType([
83
+ // PropTypes.string,
84
+ // PropTypes.number,
85
+ // ]),
86
+ // label: PropTypes.oneOfType([
87
+ // PropTypes.string,
88
+ // PropTypes.object,
89
+ // ]),
90
+ // }),
91
+ // PropTypes.string]),
92
+ // ).isRequired,
93
+ // emptyOptionLabel: PropTypes.string,
94
+ // skipOptions: PropTypes.oneOfType([
95
+ // PropTypes.arrayOf(PropTypes.string),
96
+ // PropTypes.string,
97
+ // ]),
98
+ // };
99
+ //
100
+ //
101
+ // registerComponent('HouseNumberSelectField', HouseNumberSelectField);
102
+ //
103
+ //
104
+ // export default HouseNumberSelectField;
105
+ "use strict";
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/items/Button/Button.jsx"],"names":[],"mappings":";AAKA;;;;;;;;;;;;gBA+CC"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/items/Button/Button.jsx"],"names":[],"mappings":";AAKA;;;;;;;;;;;;gBAkDC"}
@@ -29,18 +29,21 @@ const Button = _ref => {
29
29
  return null;
30
30
  }
31
31
  const usedText = text ? t(text) : '';
32
- const usedAriaLabel = ariaLabel ? t(ariaLabel) : '';
32
+ const usedAriaLabel = ariaLabel ? t(ariaLabel) : usedText;
33
33
 
34
34
  // !!! ??? linter: The button type attribute must be specified by a static string or a trivial ternary expression
35
35
  const btnType = type || 'button';
36
36
  /* eslint-disable react/button-has-type */
37
37
 
38
+ const key = inputProps?.key || 'button';
38
39
  return /*#__PURE__*/_react.default.createElement("button", _extends({
39
40
  type: btnType,
40
41
  onClick: onClick,
41
42
  className: _formBuilder.utils.getClassNames(['btn', color && `btn-${color}`, rounded && 'btn-rounded', circular && 'btn-circular', className, ariaAttributes?.['aria-disabled'] && 'disabled']),
42
43
  "aria-label": usedAriaLabel
43
- }, ariaAttributes, inputProps), usedText, children);
44
+ }, ariaAttributes, inputProps, {
45
+ key: key
46
+ }), usedText, children);
44
47
  /* eslint-enable react/button-has-type */
45
48
  };
46
49
  Button.propTypes = {
@@ -51,7 +54,7 @@ Button.propTypes = {
51
54
  circular: _propTypes.default.bool,
52
55
  inputProps: _propTypes.default.object,
53
56
  onClick: _propTypes.default.func,
54
- ariaLabel: _propTypes.default.string.isRequired,
57
+ ariaLabel: _propTypes.default.string,
55
58
  ariaAttributes: _propTypes.default.object,
56
59
  children: _propTypes.default.node,
57
60
  type: _propTypes.default.string
@@ -1 +1 @@
1
- {"version":3,"file":"SubmitButton.d.ts","sourceRoot":"","sources":["../../../src/items/Button/SubmitButton.jsx"],"names":[],"mappings":";AAKA;;;gBAQC"}
1
+ {"version":3,"file":"SubmitButton.d.ts","sourceRoot":"","sources":["../../../src/items/Button/SubmitButton.jsx"],"names":[],"mappings":";AAKA;;;gBASC"}
@@ -19,7 +19,8 @@ const SubmitButton = _ref => {
19
19
  inputProps: {
20
20
  ...inputProps,
21
21
  type: 'submit'
22
- }
22
+ },
23
+ key: inputProps.key
23
24
  }));
24
25
  };
25
26
  SubmitButton.propTypes = {
@@ -30,7 +31,9 @@ const FormBuilderSubmitButton = _ref2 => {
30
31
  config = {},
31
32
  ...otherProps
32
33
  } = _ref2;
33
- return /*#__PURE__*/_react.default.createElement(SubmitButton, _extends({}, otherProps, config));
34
+ return /*#__PURE__*/_react.default.createElement(SubmitButton, _extends({}, otherProps, config, {
35
+ key: config.key
36
+ }));
34
37
  };
35
38
  FormBuilderSubmitButton.propTypes = {
36
39
  config: _propTypes.default.shape(SubmitButton.propTypes)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinuts/bsr-uikit-relaunch",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "private": false,
5
5
  "description": "BSR UI-KIT Relaunch",
6
6
  "main": "dist/index.js",