@lets-events/react 12.8.2 → 12.8.3

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.8.2 build
3
+ > @lets-events/react@12.8.3 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
- CJS dist/index.js 410.67 KB
14
- CJS ⚡️ Build success in 289ms
15
- ESM dist/index.mjs 395.31 KB
16
- ESM ⚡️ Build success in 291ms
13
+ CJS dist/index.js 411.36 KB
14
+ CJS ⚡️ Build success in 459ms
15
+ ESM dist/index.mjs 395.98 KB
16
+ ESM ⚡️ Build success in 460ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 6018ms
19
- DTS dist/index.d.mts 403.89 KB
20
- DTS dist/index.d.ts 403.89 KB
18
+ DTS ⚡️ Build success in 8332ms
19
+ DTS dist/index.d.mts 404.05 KB
20
+ DTS dist/index.d.ts 404.05 KB
21
21
  ⠙
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @lets-events/react
2
2
 
3
+ ## 12.8.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Select Show More Button
8
+
3
9
  ## 12.8.2
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -15249,13 +15249,16 @@ type SelectFormFieldProps = {
15249
15249
  required?: boolean;
15250
15250
  placeholder?: string;
15251
15251
  options: Option[];
15252
+ showMoreButton?: boolean;
15253
+ showMoreButtonLabel?: string;
15254
+ showMoreButtonOnClick?: () => void;
15252
15255
  validation?: {
15253
15256
  validate?: (value: string) => boolean | string;
15254
15257
  };
15255
15258
  validationErrorMessage?: string;
15256
15259
  defaultValue?: string;
15257
15260
  };
15258
- declare const SelectFormField: ({ name, label, required, placeholder, options, validation, validationErrorMessage, defaultValue, }: SelectFormFieldProps) => react_jsx_runtime.JSX.Element;
15261
+ declare const SelectFormField: ({ name, label, required, placeholder, options, showMoreButton, showMoreButtonLabel, showMoreButtonOnClick, validation, validationErrorMessage, defaultValue, }: SelectFormFieldProps) => react_jsx_runtime.JSX.Element;
15259
15262
 
15260
15263
  type SwitchFormFieldProps = {
15261
15264
  name: string;
package/dist/index.d.ts CHANGED
@@ -15249,13 +15249,16 @@ type SelectFormFieldProps = {
15249
15249
  required?: boolean;
15250
15250
  placeholder?: string;
15251
15251
  options: Option[];
15252
+ showMoreButton?: boolean;
15253
+ showMoreButtonLabel?: string;
15254
+ showMoreButtonOnClick?: () => void;
15252
15255
  validation?: {
15253
15256
  validate?: (value: string) => boolean | string;
15254
15257
  };
15255
15258
  validationErrorMessage?: string;
15256
15259
  defaultValue?: string;
15257
15260
  };
15258
- declare const SelectFormField: ({ name, label, required, placeholder, options, validation, validationErrorMessage, defaultValue, }: SelectFormFieldProps) => react_jsx_runtime.JSX.Element;
15261
+ declare const SelectFormField: ({ name, label, required, placeholder, options, showMoreButton, showMoreButtonLabel, showMoreButtonOnClick, validation, validationErrorMessage, defaultValue, }: SelectFormFieldProps) => react_jsx_runtime.JSX.Element;
15259
15262
 
15260
15263
  type SwitchFormFieldProps = {
15261
15264
  name: string;
package/dist/index.js CHANGED
@@ -10898,6 +10898,9 @@ var SelectFormField = ({
10898
10898
  required,
10899
10899
  placeholder = "Selecione",
10900
10900
  options,
10901
+ showMoreButton = false,
10902
+ showMoreButtonLabel = "Carregar mais",
10903
+ showMoreButtonOnClick,
10901
10904
  validation,
10902
10905
  validationErrorMessage = "Este campo \xE9 obrigat\xF3rio.",
10903
10906
  defaultValue
@@ -10931,24 +10934,38 @@ var SelectFormField = ({
10931
10934
  defaultValue: defaultValue || "",
10932
10935
  render: ({ field: { value, onChange } }) => {
10933
10936
  const selectedOption = options.find((opt) => opt.value === value);
10934
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10937
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
10935
10938
  DropdownMenu2,
10936
10939
  {
10937
10940
  placeholder: (selectedOption == null ? void 0 : selectedOption.label) || placeholder,
10938
10941
  fontWeight: "regular",
10939
10942
  typography: "labelLarge",
10940
10943
  color: haveError ? "error" : "default",
10941
- children: options.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10942
- DropdownMenuItem,
10943
- {
10944
- value: option.value,
10945
- onSelect: () => onChange(option.value),
10946
- fontWeight: "regular",
10947
- typography: "labelLarge",
10948
- children: option.label
10949
- },
10950
- `${option.value}${index}`
10951
- ))
10944
+ children: [
10945
+ options.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10946
+ DropdownMenuItem,
10947
+ {
10948
+ value: option.value,
10949
+ onSelect: () => onChange(option.value),
10950
+ fontWeight: "regular",
10951
+ typography: "labelLarge",
10952
+ children: option.label
10953
+ },
10954
+ `${option.value}${index}`
10955
+ )),
10956
+ showMoreButton && showMoreButtonOnClick && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10957
+ Button,
10958
+ {
10959
+ variant: "menuDropdownItem",
10960
+ color: "brand",
10961
+ onClick: showMoreButtonOnClick,
10962
+ fontWeight: "semibold",
10963
+ type: "button",
10964
+ css: { justifyContent: "flex-start", color: "var(--colors-brand500)!important" },
10965
+ children: showMoreButtonLabel
10966
+ }
10967
+ )
10968
+ ]
10952
10969
  }
10953
10970
  );
10954
10971
  }
package/dist/index.mjs CHANGED
@@ -10791,6 +10791,9 @@ var SelectFormField = ({
10791
10791
  required,
10792
10792
  placeholder = "Selecione",
10793
10793
  options,
10794
+ showMoreButton = false,
10795
+ showMoreButtonLabel = "Carregar mais",
10796
+ showMoreButtonOnClick,
10794
10797
  validation,
10795
10798
  validationErrorMessage = "Este campo \xE9 obrigat\xF3rio.",
10796
10799
  defaultValue
@@ -10824,24 +10827,38 @@ var SelectFormField = ({
10824
10827
  defaultValue: defaultValue || "",
10825
10828
  render: ({ field: { value, onChange } }) => {
10826
10829
  const selectedOption = options.find((opt) => opt.value === value);
10827
- return /* @__PURE__ */ jsx42(
10830
+ return /* @__PURE__ */ jsxs23(
10828
10831
  DropdownMenu2,
10829
10832
  {
10830
10833
  placeholder: (selectedOption == null ? void 0 : selectedOption.label) || placeholder,
10831
10834
  fontWeight: "regular",
10832
10835
  typography: "labelLarge",
10833
10836
  color: haveError ? "error" : "default",
10834
- children: options.map((option, index) => /* @__PURE__ */ jsx42(
10835
- DropdownMenuItem,
10836
- {
10837
- value: option.value,
10838
- onSelect: () => onChange(option.value),
10839
- fontWeight: "regular",
10840
- typography: "labelLarge",
10841
- children: option.label
10842
- },
10843
- `${option.value}${index}`
10844
- ))
10837
+ children: [
10838
+ options.map((option, index) => /* @__PURE__ */ jsx42(
10839
+ DropdownMenuItem,
10840
+ {
10841
+ value: option.value,
10842
+ onSelect: () => onChange(option.value),
10843
+ fontWeight: "regular",
10844
+ typography: "labelLarge",
10845
+ children: option.label
10846
+ },
10847
+ `${option.value}${index}`
10848
+ )),
10849
+ showMoreButton && showMoreButtonOnClick && /* @__PURE__ */ jsx42(
10850
+ Button,
10851
+ {
10852
+ variant: "menuDropdownItem",
10853
+ color: "brand",
10854
+ onClick: showMoreButtonOnClick,
10855
+ fontWeight: "semibold",
10856
+ type: "button",
10857
+ css: { justifyContent: "flex-start", color: "var(--colors-brand500)!important" },
10858
+ children: showMoreButtonLabel
10859
+ }
10860
+ )
10861
+ ]
10845
10862
  }
10846
10863
  );
10847
10864
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lets-events/react",
3
- "version": "12.8.2",
3
+ "version": "12.8.3",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -4,6 +4,7 @@ import { Flex } from "../Flex";
4
4
  import { FormLabel } from "./subComponents/FormLabel";
5
5
  import { ErrorFormMessage } from "./subComponents/ErrorFormMessage";
6
6
  import { getNestedValue } from "../../utils/getNestedValue";
7
+ import { Button } from "../Button";
7
8
 
8
9
  type Option = {
9
10
  label: string;
@@ -16,6 +17,9 @@ export type SelectFormFieldProps = {
16
17
  required?: boolean;
17
18
  placeholder?: string;
18
19
  options: Option[];
20
+ showMoreButton?: boolean;
21
+ showMoreButtonLabel?: string;
22
+ showMoreButtonOnClick?: () => void;
19
23
  validation?: {
20
24
  validate?: (value: string) => boolean | string;
21
25
  };
@@ -29,6 +33,9 @@ export const SelectFormField = ({
29
33
  required,
30
34
  placeholder = "Selecione",
31
35
  options,
36
+ showMoreButton = false,
37
+ showMoreButtonLabel = "Carregar mais",
38
+ showMoreButtonOnClick,
32
39
  validation,
33
40
  validationErrorMessage = "Este campo é obrigatório.",
34
41
  defaultValue,
@@ -82,6 +89,19 @@ export const SelectFormField = ({
82
89
  {option.label}
83
90
  </DropdownMenuItem>
84
91
  ))}
92
+
93
+ {showMoreButton && showMoreButtonOnClick && (
94
+ <Button
95
+ variant="menuDropdownItem"
96
+ color="brand"
97
+ onClick={showMoreButtonOnClick}
98
+ fontWeight="semibold"
99
+ type="button"
100
+ css={{ justifyContent: "flex-start", color: "var(--colors-brand500)!important" }}
101
+ >
102
+ {showMoreButtonLabel}
103
+ </Button>
104
+ )}
85
105
  </DropdownMenu>
86
106
  );
87
107
  }}