@pinuts/bsr-uikit-relaunch 0.2.18 → 0.2.20

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.
@@ -17,6 +17,7 @@ declare namespace BSRAutocompleteField {
17
17
  labelText: PropTypes.Requireable<string>;
18
18
  viewMode: PropTypes.Requireable<boolean>;
19
19
  disabled: PropTypes.Requireable<boolean>;
20
+ suggestionsAmount: PropTypes.Requireable<number>;
20
21
  }>>>;
21
22
  }
22
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BSRAutocompleteField.d.ts","sourceRoot":"","sources":["../../../src/items/BSRAddressSelector/BSRAutocompleteField.jsx"],"names":[],"mappings":";AA8CA;;QA2QC;;;;;;;;;;;;;;;;;;;sBAzTqB,YAAY"}
1
+ {"version":3,"file":"BSRAutocompleteField.d.ts","sourceRoot":"","sources":["../../../src/items/BSRAddressSelector/BSRAutocompleteField.jsx"],"names":[],"mappings":";AA8CA;;QAkRC;;;;;;;;;;;;;;;;;;;;sBAhUqB,YAAY"}
@@ -54,7 +54,8 @@ const BSRAutocompleteField = _ref => {
54
54
  viewMode,
55
55
  labelText,
56
56
  disabled,
57
- readOnly
57
+ readOnly,
58
+ suggestionsAmount = undefined
58
59
  } = config;
59
60
  const {
60
61
  prevSelection,
@@ -100,15 +101,20 @@ const BSRAutocompleteField = _ref => {
100
101
  if (mountedRef) {
101
102
  const loadData = async () => {
102
103
  const searchQuery = selectedOptionId || searchInput;
103
- const url = `${controllerPath}streetNames/?searchQuery=${encodeURIComponent(searchQuery)}`;
104
- try {
105
- const dataArr = await fetchOptions(url);
106
- // Nur State verändern, wenn Komponente gemounted ist
107
- if (mountedRef && dataArr) {
108
- setFetchedOptions(dataArr);
104
+ if (searchQuery.length > 2) {
105
+ const url = `${controllerPath}streetNames/?searchQuery=${encodeURIComponent(searchQuery)}`;
106
+ try {
107
+ const dataArr = await fetchOptions(url);
108
+ // Nur State verändern, wenn Komponente gemounted ist
109
+ if (mountedRef && dataArr) {
110
+ if (suggestionsAmount && dataArr.length > suggestionsAmount) {
111
+ dataArr.length = suggestionsAmount;
112
+ }
113
+ setFetchedOptions(dataArr);
114
+ }
115
+ } catch (error) {
116
+ console.error(error);
109
117
  }
110
- } catch (error) {
111
- console.error(error);
112
118
  }
113
119
  };
114
120
  if (debounceTimeout) {
@@ -180,10 +186,8 @@ const BSRAutocompleteField = _ref => {
180
186
  }
181
187
  }, 50);
182
188
  }, [key, setFieldValue, labelFieldKey, groupKey, setSelectedOptionId, setPrevSelection]);
183
- const className = (0, _react.useMemo)(() => [_BSRAddressSelectorModule.default.comboboxWrapper, 'ariakit-combobox', 'form-control px-2 py-1', isFocused && 'focused', isInvalid && 'is-invalid'].filter(Boolean).join(' '), [isFocused, isInvalid]);
184
- const formControlClassNames = (0, _index.getFormControlClassNames)(disabled, readOnly, disabled, 'w-75',
185
- // 'combobox w-75',
186
- ['input', field.className].filter(Boolean));
189
+ const className = (0, _react.useMemo)(() => [_BSRAddressSelectorModule.default.comboboxWrapper, _BSRAddressSelectorModule.default.formControl, _BSRAddressSelectorModule.default.ariakitCombobox, 'ariakit-combobox', 'form-control py-1 px-0', isFocused && 'focused', isInvalid && 'is-invalid'].filter(Boolean).join(' '), [isFocused, isInvalid]);
190
+ const formControlClassNames = (0, _index.getFormControlClassNames)(disabled, readOnly, disabled, ['input', field.className].filter(Boolean));
187
191
  const getPreviousSelectedItem = (0, _react.useCallback)(() => {
188
192
  return prevSelection?.value ? prevSelection.value : field.value;
189
193
  }, [prevSelection, field.value]);
@@ -259,7 +263,8 @@ BSRAutocompleteField.propTypes = {
259
263
  readOnly: _propTypes.default.bool,
260
264
  labelText: _propTypes.default.string,
261
265
  viewMode: _propTypes.default.bool,
262
- disabled: _propTypes.default.bool
266
+ disabled: _propTypes.default.bool,
267
+ suggestionsAmount: _propTypes.default.number
263
268
  }).isRequired
264
269
  };
265
270
  const HigherOrderAutocompleteField = (0, _withFieldGroup.default)(BSRAutocompleteField);
@@ -85,6 +85,8 @@
85
85
 
86
86
  .comboboxPopoverWrapper {
87
87
  // popover darf kein outline haben
88
+ background: $bsr-white-100;
89
+
88
90
  :focus-visible {
89
91
  outline: 0;
90
92
  border: 0;
@@ -103,18 +105,16 @@
103
105
 
104
106
  div[role="listbox"] {
105
107
  overflow-x: hidden;
106
- // border-radius: $border-radius;
108
+ background: $bsr-white-100;
107
109
  border-top-left-radius: 0;
108
110
  border-top-right-radius: 0;
109
111
  border-top: none;
110
- // border-color: currentColor;
111
- //max-height: min(var(--popover-available-height, $popover-max-height), $popover-max-height);
112
- //max-height: $popover-max-height;
113
- padding: 0.3rem;
114
- transform: translatey(0.6rem) translatex(-1rem);
112
+ padding-inline: 0;
113
+ padding-block: 4px;
114
+ transform: translateY(0.6rem);
115
115
 
116
116
  div[role="option"] {
117
- font-weight: $sub-headline-font-size;
117
+ font-weight: $fontweight-normal;
118
118
  white-space: normal;
119
119
 
120
120
  &:active,
@@ -135,17 +135,13 @@
135
135
  }
136
136
 
137
137
  &[aria-selected="true"].selected {
138
- background-color: $primary !important;
139
- color: $white;
138
+ background-color: $bsr-black-30 !important;
139
+ color: $bsr-black-90;
140
140
  }
141
141
  &.selected {
142
142
  box-shadow: none;
143
- background-color: $primary !important;
144
- color: $white;
145
-
146
- &:hover {
147
- color: $white !important;
148
- }
143
+ background-color: $bsr-black-30 !important;
144
+ color: $bsr-black-90;
149
145
  }
150
146
  }
151
147
  }
@@ -255,7 +251,7 @@
255
251
 
256
252
  &:focus,
257
253
  &:hover {
258
- background-color: $bsr-brown-100;
254
+ background-color: $bsr-black-10;
259
255
  color: $bsr-black-90;
260
256
  cursor: pointer;
261
257
  }
@@ -270,13 +266,6 @@
270
266
  &:not(:last-child) {
271
267
  margin-bottom: 0.25rem;
272
268
  }
273
-
274
- &[aria-selected="true"].selected {
275
- &::after {
276
- content: "✔";
277
- margin-inline-start: 0.5rem;
278
- }
279
- }
280
269
  }
281
270
  }
282
271
 
@@ -252,6 +252,15 @@ fieldset.formInput {
252
252
  }
253
253
  }
254
254
 
255
+ #addressSelector .row .col div.form-control.ariakit-combobox {
256
+ padding: $base-gap * 2 0 $base-gap * 3 0 !important;
257
+
258
+ input[role="combobox"] {
259
+ padding-inline: $base-gap * 4 !important;
260
+ width: 100% !important;
261
+ }
262
+ }
263
+
255
264
  /* RADIO INPUT */
256
265
  input[type="radio"] {
257
266
  display: flex;
@@ -489,7 +498,6 @@ form input[type="checkbox"] + label:before {
489
498
  &:focus {
490
499
  &:is(button):not(.disabled) {
491
500
  background-color: $secondary;
492
- color: $text-light;
493
501
 
494
502
  .closeBtn {
495
503
  color: $text-light;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinuts/bsr-uikit-relaunch",
3
- "version": "0.2.18",
3
+ "version": "0.2.20",
4
4
  "private": false,
5
5
  "description": "BSR UI-KIT Relaunch",
6
6
  "main": "dist/index.js",