@lets-events/react 12.11.5 → 12.11.7

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.
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- > @lets-events/react@12.11.5 build
3
+ > @lets-events/react@12.11.7 build
4
4
  > tsup src/index.tsx --format esm,cjs --dts --external react
5
5
 
6
6
  CLI Building entry: src/index.tsx
@@ -10,12 +10,12 @@
10
10
  CLI Target: es6
11
11
  ESM Build start
12
12
  CJS Build start
13
- ESM dist/index.mjs 423.54 KB
14
- ESM ⚡️ Build success in -258293ms
15
- CJS dist/index.js 439.68 KB
16
- CJS ⚡️ Build success in -258292ms
13
+ ESM dist/index.mjs 423.79 KB
14
+ ESM ⚡️ Build success in 288ms
15
+ CJS dist/index.js 439.94 KB
16
+ CJS ⚡️ Build success in 289ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 7027ms
19
- DTS dist/index.d.mts 411.19 KB
20
- DTS dist/index.d.ts 411.19 KB
18
+ DTS ⚡️ Build success in 6480ms
19
+ DTS dist/index.d.mts 411.35 KB
20
+ DTS dist/index.d.ts 411.35 KB
21
21
  ⠙
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @lets-events/react
2
2
 
3
+ ## 12.11.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Placeholder SelectFormField
8
+
9
+ ## 12.11.6
10
+
11
+ ### Patch Changes
12
+
13
+ - SelectFormField placeholder
14
+
3
15
  ## 12.11.5
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -15468,8 +15468,9 @@ type CountryFormFieldProps = {
15468
15468
  declare function CountryFormField({ name, label, required, language, }: CountryFormFieldProps): react_jsx_runtime.JSX.Element;
15469
15469
 
15470
15470
  type Option = {
15471
- label: string;
15471
+ label: string | React.ReactNode;
15472
15472
  value: string;
15473
+ selectedLabel?: string;
15473
15474
  };
15474
15475
  type SelectFormFieldProps = {
15475
15476
  name: string;
@@ -15485,8 +15486,9 @@ type SelectFormFieldProps = {
15485
15486
  };
15486
15487
  validationErrorMessage?: string;
15487
15488
  defaultValue?: string;
15489
+ placeholderTypography?: "labelExtraSmall" | "labelSmall" | "labelMedium" | "labelLarge";
15488
15490
  };
15489
- declare const SelectFormField: ({ name, label, required, placeholder, options, showMoreButton, showMoreButtonLabel, showMoreButtonOnClick, validation, validationErrorMessage, defaultValue, }: SelectFormFieldProps) => react_jsx_runtime.JSX.Element;
15491
+ declare const SelectFormField: ({ name, label, required, placeholder, options, showMoreButton, showMoreButtonLabel, showMoreButtonOnClick, validation, validationErrorMessage, defaultValue, placeholderTypography, }: SelectFormFieldProps) => react_jsx_runtime.JSX.Element;
15490
15492
 
15491
15493
  type SwitchFormFieldProps = {
15492
15494
  name: string;
package/dist/index.d.ts CHANGED
@@ -15468,8 +15468,9 @@ type CountryFormFieldProps = {
15468
15468
  declare function CountryFormField({ name, label, required, language, }: CountryFormFieldProps): react_jsx_runtime.JSX.Element;
15469
15469
 
15470
15470
  type Option = {
15471
- label: string;
15471
+ label: string | React.ReactNode;
15472
15472
  value: string;
15473
+ selectedLabel?: string;
15473
15474
  };
15474
15475
  type SelectFormFieldProps = {
15475
15476
  name: string;
@@ -15485,8 +15486,9 @@ type SelectFormFieldProps = {
15485
15486
  };
15486
15487
  validationErrorMessage?: string;
15487
15488
  defaultValue?: string;
15489
+ placeholderTypography?: "labelExtraSmall" | "labelSmall" | "labelMedium" | "labelLarge";
15488
15490
  };
15489
- declare const SelectFormField: ({ name, label, required, placeholder, options, showMoreButton, showMoreButtonLabel, showMoreButtonOnClick, validation, validationErrorMessage, defaultValue, }: SelectFormFieldProps) => react_jsx_runtime.JSX.Element;
15491
+ declare const SelectFormField: ({ name, label, required, placeholder, options, showMoreButton, showMoreButtonLabel, showMoreButtonOnClick, validation, validationErrorMessage, defaultValue, placeholderTypography, }: SelectFormFieldProps) => react_jsx_runtime.JSX.Element;
15490
15492
 
15491
15493
  type SwitchFormFieldProps = {
15492
15494
  name: string;
package/dist/index.js CHANGED
@@ -11508,7 +11508,8 @@ var SelectFormField = ({
11508
11508
  showMoreButtonOnClick,
11509
11509
  validation,
11510
11510
  validationErrorMessage = "Este campo \xE9 obrigat\xF3rio.",
11511
- defaultValue
11511
+ defaultValue,
11512
+ placeholderTypography = "labelLarge"
11512
11513
  }) => {
11513
11514
  const {
11514
11515
  control,
@@ -11539,12 +11540,13 @@ var SelectFormField = ({
11539
11540
  defaultValue: defaultValue || "",
11540
11541
  render: ({ field: { value, onChange } }) => {
11541
11542
  const selectedOption = options.find((opt) => opt.value === value);
11543
+ const hasSelectedLabel = !!(selectedOption == null ? void 0 : selectedOption.selectedLabel);
11542
11544
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
11543
11545
  DropdownMenu2,
11544
11546
  {
11545
- placeholder: (selectedOption == null ? void 0 : selectedOption.label) || placeholder,
11547
+ placeholder: selectedOption ? hasSelectedLabel ? selectedOption == null ? void 0 : selectedOption.selectedLabel : selectedOption == null ? void 0 : selectedOption.label : placeholder,
11548
+ typography: placeholderTypography,
11546
11549
  fontWeight: "regular",
11547
- typography: "labelLarge",
11548
11550
  color: haveError ? "error" : "default",
11549
11551
  children: [
11550
11552
  options.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
@@ -11553,7 +11555,7 @@ var SelectFormField = ({
11553
11555
  value: option.value,
11554
11556
  onSelect: () => onChange(option.value),
11555
11557
  fontWeight: "regular",
11556
- typography: "labelLarge",
11558
+ typography: placeholderTypography,
11557
11559
  children: option.label
11558
11560
  },
11559
11561
  `${option.value}${index}`
package/dist/index.mjs CHANGED
@@ -11400,7 +11400,8 @@ var SelectFormField = ({
11400
11400
  showMoreButtonOnClick,
11401
11401
  validation,
11402
11402
  validationErrorMessage = "Este campo \xE9 obrigat\xF3rio.",
11403
- defaultValue
11403
+ defaultValue,
11404
+ placeholderTypography = "labelLarge"
11404
11405
  }) => {
11405
11406
  const {
11406
11407
  control,
@@ -11431,12 +11432,13 @@ var SelectFormField = ({
11431
11432
  defaultValue: defaultValue || "",
11432
11433
  render: ({ field: { value, onChange } }) => {
11433
11434
  const selectedOption = options.find((opt) => opt.value === value);
11435
+ const hasSelectedLabel = !!(selectedOption == null ? void 0 : selectedOption.selectedLabel);
11434
11436
  return /* @__PURE__ */ jsxs24(
11435
11437
  DropdownMenu2,
11436
11438
  {
11437
- placeholder: (selectedOption == null ? void 0 : selectedOption.label) || placeholder,
11439
+ placeholder: selectedOption ? hasSelectedLabel ? selectedOption == null ? void 0 : selectedOption.selectedLabel : selectedOption == null ? void 0 : selectedOption.label : placeholder,
11440
+ typography: placeholderTypography,
11438
11441
  fontWeight: "regular",
11439
- typography: "labelLarge",
11440
11442
  color: haveError ? "error" : "default",
11441
11443
  children: [
11442
11444
  options.map((option, index) => /* @__PURE__ */ jsx43(
@@ -11445,7 +11447,7 @@ var SelectFormField = ({
11445
11447
  value: option.value,
11446
11448
  onSelect: () => onChange(option.value),
11447
11449
  fontWeight: "regular",
11448
- typography: "labelLarge",
11450
+ typography: placeholderTypography,
11449
11451
  children: option.label
11450
11452
  },
11451
11453
  `${option.value}${index}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lets-events/react",
3
- "version": "12.11.5",
3
+ "version": "12.11.7",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -7,8 +7,9 @@ import { getNestedValue } from "../../utils/getNestedValue";
7
7
  import { Button } from "../Button";
8
8
 
9
9
  type Option = {
10
- label: string;
10
+ label: string | React.ReactNode;
11
11
  value: string;
12
+ selectedLabel?: string;
12
13
  };
13
14
 
14
15
  export type SelectFormFieldProps = {
@@ -25,6 +26,7 @@ export type SelectFormFieldProps = {
25
26
  };
26
27
  validationErrorMessage?: string;
27
28
  defaultValue?: string;
29
+ placeholderTypography?: "labelExtraSmall" | "labelSmall" | "labelMedium" | "labelLarge";
28
30
  };
29
31
 
30
32
  export const SelectFormField = ({
@@ -39,6 +41,7 @@ export const SelectFormField = ({
39
41
  validation,
40
42
  validationErrorMessage = "Este campo é obrigatório.",
41
43
  defaultValue,
44
+ placeholderTypography = "labelLarge",
42
45
  }: SelectFormFieldProps) => {
43
46
  const {
44
47
  control,
@@ -70,12 +73,12 @@ export const SelectFormField = ({
70
73
  defaultValue={defaultValue || ""}
71
74
  render={({ field: { value, onChange } }) => {
72
75
  const selectedOption = options.find((opt) => opt.value === value);
73
-
76
+ const hasSelectedLabel = !!selectedOption?.selectedLabel;
74
77
  return (
75
78
  <DropdownMenu
76
- placeholder={selectedOption?.label || placeholder}
79
+ placeholder={selectedOption ? (hasSelectedLabel ? selectedOption?.selectedLabel : selectedOption?.label as string) : placeholder}
80
+ typography={placeholderTypography}
77
81
  fontWeight="regular"
78
- typography="labelLarge"
79
82
  color={haveError ? "error" : "default"}
80
83
  >
81
84
  {options.map((option, index) => (
@@ -84,7 +87,7 @@ export const SelectFormField = ({
84
87
  value={option.value}
85
88
  onSelect={() => onChange(option.value)}
86
89
  fontWeight="regular"
87
- typography="labelLarge"
90
+ typography={placeholderTypography}
88
91
  >
89
92
  {option.label}
90
93
  </DropdownMenuItem>