@bolttech/molecules-dropdown 0.26.0 → 0.27.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/README.md CHANGED
@@ -70,6 +70,7 @@ The **Dropdown** component accepts the following props:
70
70
  | `onKeyUp` | `function` | The onkeyup event occurs when the user releases a key on the keyboard |
71
71
  | `onKeyDown` | `boolean` | Onkeydown is an event handler in Javascript that gets called when a key is pressed on the keyboard |
72
72
  | `asyncOptionList` | `boolean` | A boolean prop that controls a different behavior when OptionList are set by an API request |
73
+ | helperMessage | `string` | An optional string to display as a helper message for the dropdown |
73
74
 
74
75
  ## Functionality
75
76
 
package/index.cjs CHANGED
@@ -2300,7 +2300,7 @@ const ContainerDropdown = /*#__PURE__*/styled__default["default"].section.withCo
2300
2300
  }) => theme.components.dropdown[$variant].container.color.default, ({
2301
2301
  theme,
2302
2302
  $variant
2303
- }) => `1px solid ${theme.components.dropdown[$variant].container.border.default}`, ({
2303
+ }) => `${theme.components.dropdown.borderWidth.default} solid ${theme.components.dropdown[$variant].container.border.default}`, ({
2304
2304
  theme
2305
2305
  }) => theme.components.dropdown.borderRadius, ({
2306
2306
  theme: {
@@ -2344,7 +2344,7 @@ const ContainerDropdown = /*#__PURE__*/styled__default["default"].section.withCo
2344
2344
  theme,
2345
2345
  $variant,
2346
2346
  $hasError
2347
- }) => `1px solid ${theme.components.dropdown[$variant].container.border[$hasError ? 'error' : 'focus']}`, ({
2347
+ }) => `${theme.components.dropdown.borderWidth.default} solid ${theme.components.dropdown[$variant].container.border[$hasError ? 'error' : 'focus']}`, ({
2348
2348
  $hasError
2349
2349
  }) => !$hasError && styled.css([".fieldLabel{color:", ";}.requiredLabel{color:", ";}label.material-symbols-sharp{color:", ";}"], ({
2350
2350
  theme,
@@ -2361,7 +2361,7 @@ const ContainerDropdown = /*#__PURE__*/styled__default["default"].section.withCo
2361
2361
  }) => $hasError && styled.css(["outline:", ";background-color:", ";.fieldLabel{color:", ";}.requiredLabel{color:", ";}label.material-symbols-sharp{color:", ";}"], ({
2362
2362
  theme,
2363
2363
  $variant
2364
- }) => `1px solid ${theme.components.dropdown[$variant].container.border[$hasValue ? 'errorFilled' : 'error']}`, ({
2364
+ }) => `${theme.components.dropdown.borderWidth.default} solid ${theme.components.dropdown[$variant].container.border[$hasValue ? 'errorFilled' : 'error']}`, ({
2365
2365
  theme,
2366
2366
  $variant
2367
2367
  }) => theme.components.dropdown[$variant].container.color[$hasValue ? 'errorFilled' : 'error'], ({
@@ -2380,7 +2380,7 @@ const ContainerDropdown = /*#__PURE__*/styled__default["default"].section.withCo
2380
2380
  }) => disabled && styled.css(["cursor:not-allowed;outline:", ";background-color:", ";*{cursor:not-allowed;}.fieldLabel{color:", ";}.requiredLabel{color:", ";}label.material-symbols-sharp{color:", ";}input{color:", ";&::placeholder{color:", ";}}"], ({
2381
2381
  theme,
2382
2382
  $variant
2383
- }) => `1px solid ${theme.components.dropdown[$variant].container.border.disable}`, ({
2383
+ }) => `${theme.components.dropdown.borderWidth.default} solid ${theme.components.dropdown[$variant].container.border.disable}`, ({
2384
2384
  theme,
2385
2385
  $variant
2386
2386
  }) => theme.components.dropdown[$variant].container.color.disable, ({
@@ -2402,7 +2402,7 @@ const ContainerDropdown = /*#__PURE__*/styled__default["default"].section.withCo
2402
2402
  const SectionContainer = /*#__PURE__*/styled__default["default"].section.withConfig({
2403
2403
  displayName: "molecules-dropdownstyles__SectionContainer",
2404
2404
  componentId: "sc-3wugi4-2"
2405
- })(["position:relative;.errorMessage{padding-right:", ";padding-left:", ";label{color:", ";font-weight:", ";line-height:", ";font-size:", ";letter-spacing:", ";}}"], ({
2405
+ })(["position:relative;.errorMessage{padding-right:", ";padding-left:", ";label{color:", ";font-weight:", ";line-height:", ";font-size:", ";letter-spacing:", ";}}.helperMessage{padding-right:", ";padding-left:", ";label{color:", ";font-weight:", ";line-height:", ";font-size:", ";letter-spacing:", ";}}"], ({
2406
2406
  theme
2407
2407
  }) => theme.components.dropdown.paddingHorizontal, ({
2408
2408
  theme
@@ -2417,7 +2417,23 @@ const SectionContainer = /*#__PURE__*/styled__default["default"].section.withCon
2417
2417
  theme
2418
2418
  }) => theme.components.dropdown.error.fontSize, ({
2419
2419
  theme
2420
- }) => theme.components.dropdown.error.letterSpacing);
2420
+ }) => theme.components.dropdown.error.letterSpacing, ({
2421
+ theme
2422
+ }) => theme.components.dropdown.paddingHorizontal, ({
2423
+ theme
2424
+ }) => theme.components.dropdown.paddingHorizontal, ({
2425
+ theme,
2426
+ $variant,
2427
+ disabled
2428
+ }) => theme.components.dropdown[$variant].text.color.helper[disabled ? 'disabled' : 'default'], ({
2429
+ theme
2430
+ }) => theme.components.dropdown.helper.fontWeight, ({
2431
+ theme
2432
+ }) => theme.components.dropdown.helper.lineHeight, ({
2433
+ theme
2434
+ }) => theme.components.dropdown.helper.fontSize, ({
2435
+ theme
2436
+ }) => theme.components.dropdown.helper.letterSpacing);
2421
2437
  const InputAndIconDropdown = /*#__PURE__*/styled__default["default"].div.withConfig({
2422
2438
  displayName: "molecules-dropdownstyles__InputAndIconDropdown",
2423
2439
  componentId: "sc-3wugi4-3"
@@ -2450,6 +2466,7 @@ const ReusableDropdownComponent = _a => {
2450
2466
  inputLabel,
2451
2467
  disabled,
2452
2468
  errorMessage,
2469
+ helperMessage,
2453
2470
  onChangeInputValue,
2454
2471
  onChangeInputLabel,
2455
2472
  setShowSelectComponent,
@@ -2463,7 +2480,7 @@ const ReusableDropdownComponent = _a => {
2463
2480
  onKeyUp,
2464
2481
  onKeyDown
2465
2482
  } = _a,
2466
- props = __rest(_a, ["id", "dataTestId", "label", "variant", "required", "inputValue", "inputLabel", "disabled", "errorMessage", "onChangeInputValue", "onChangeInputLabel", "setShowSelectComponent", "showSelectComponent", "setSelectedOptionOnInputValue", "disableSearch", "inputRef", "placeholder", "onBlur", "onFocus", "onKeyUp", "onKeyDown"]);
2483
+ props = __rest(_a, ["id", "dataTestId", "label", "variant", "required", "inputValue", "inputLabel", "disabled", "errorMessage", "helperMessage", "onChangeInputValue", "onChangeInputLabel", "setShowSelectComponent", "showSelectComponent", "setSelectedOptionOnInputValue", "disableSearch", "inputRef", "placeholder", "onBlur", "onFocus", "onKeyUp", "onKeyDown"]);
2467
2484
  const hasError = !!errorMessage;
2468
2485
  // we have to type cast because of jest. when testing it sets the type of useTheme to DefaultTheme
2469
2486
  const theme = /*#__PURE__*/styled.useTheme();
@@ -2542,6 +2559,12 @@ const ReusableDropdownComponent = _a => {
2542
2559
  "data-testid": `${dataTestId}-label-error-message`,
2543
2560
  children: errorMessage
2544
2561
  })
2562
+ }), !showSelectComponent && !errorMessage && helperMessage && jsxRuntime.jsx("div", {
2563
+ className: "helperMessage",
2564
+ children: jsxRuntime.jsx("label", {
2565
+ "data-testid": `${dataTestId}-label-helper-message`,
2566
+ children: helperMessage
2567
+ })
2545
2568
  })]
2546
2569
  });
2547
2570
  };
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@bolttech/molecules-dropdown",
3
- "version": "0.26.0",
3
+ "version": "0.27.0",
4
4
  "main": "./index.cjs",
5
5
  "type": "commonjs",
6
6
  "types": "./src/index.d.ts",
7
7
  "dependencies": {
8
8
  "@bolttech/atoms-icon": "0.22.1",
9
- "@bolttech/atoms-input": "0.21.2",
9
+ "@bolttech/atoms-input": "0.22.0",
10
10
  "@bolttech/atoms-select": "0.21.0",
11
- "@bolttech/default-theme": "0.3.1",
11
+ "@bolttech/default-theme": "0.5.0",
12
12
  "@bolttech/form-engine": "0.10.3",
13
- "@bolttech/frontend-foundations": "0.4.0",
13
+ "@bolttech/frontend-foundations": "0.7.0",
14
14
  "@bolttech/ui-utils": "0.2.4",
15
15
  "react": "18.2.0",
16
16
  "react-dom": "18.2.0",
@@ -7,6 +7,7 @@ export declare const DropdownWithHeaders: import("react").ForwardRefExoticCompon
7
7
  id?: string | undefined;
8
8
  dataTestId?: string | undefined;
9
9
  errorMessage?: string | undefined;
10
+ helperMessage?: string | undefined;
10
11
  required?: boolean | undefined;
11
12
  variant?: import("./molecules-dropdown.type").StyleVariants | undefined;
12
13
  disableSearch?: boolean | undefined;
@@ -7,6 +7,7 @@ export declare const Dropdown: import("react").ForwardRefExoticComponent<Pick<im
7
7
  id?: string | undefined;
8
8
  dataTestId?: string | undefined;
9
9
  errorMessage?: string | undefined;
10
+ helperMessage?: string | undefined;
10
11
  required?: boolean | undefined;
11
12
  variant?: import("./molecules-dropdown.type").StyleVariants | undefined;
12
13
  disableSearch?: boolean | undefined;
@@ -14,6 +14,7 @@ Default props for Dropdown component
14
14
  @property disabled - An optional boolean to disable the dropdown
15
15
  @property dataTestId - An optional string to use as the data-testid attribute for the dropdown
16
16
  @property errorMessage - An optional string to display as an error message for the dropdown
17
+ @property helperMessage - An optional string to display as an helper message for the dropdown
17
18
  @property required - An optional boolean to indicate if the dropdown is required
18
19
  @property variant - An optional string to set the variant of the dropdown
19
20
  @property disableSearch - An optional boolean representing if the user can type and mobile phones should show the keyboard
@@ -25,6 +26,7 @@ type DefaultDropdownProps = {
25
26
  id?: string;
26
27
  dataTestId?: string;
27
28
  errorMessage?: string;
29
+ helperMessage?: string;
28
30
  required?: boolean;
29
31
  variant?: StyleVariants;
30
32
  disableSearch?: boolean;
@@ -1,2 +1,2 @@
1
1
  import { ReusableDropdownComponentProps } from './molecules-dropdown.type';
2
- export declare const ReusableDropdownComponent: ({ id, dataTestId, label, variant, required, inputValue, inputLabel, disabled, errorMessage, onChangeInputValue, onChangeInputLabel, setShowSelectComponent, showSelectComponent, setSelectedOptionOnInputValue, disableSearch, inputRef, placeholder, onBlur, onFocus, onKeyUp, onKeyDown, ...props }: ReusableDropdownComponentProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const ReusableDropdownComponent: ({ id, dataTestId, label, variant, required, inputValue, inputLabel, disabled, errorMessage, helperMessage, onChangeInputValue, onChangeInputLabel, setShowSelectComponent, showSelectComponent, setSelectedOptionOnInputValue, disableSearch, inputRef, placeholder, onBlur, onFocus, onKeyUp, onKeyDown, ...props }: ReusableDropdownComponentProps) => import("react/jsx-runtime").JSX.Element;