@lets-events/react 12.8.2 → 12.8.4

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.4 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
+ ESM dist/index.mjs 397.40 KB
14
+ ESM ⚡️ Build success in 76497ms
15
+ CJS dist/index.js 412.83 KB
16
+ CJS ⚡️ Build success in 76497ms
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 9188ms
19
+ DTS dist/index.d.mts 404.15 KB
20
+ DTS dist/index.d.ts 404.15 KB
21
21
  ⠙
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @lets-events/react
2
2
 
3
+ ## 12.8.4
4
+
5
+ ### Patch Changes
6
+
7
+ - MultiSelect ShowMoreButton
8
+
9
+ ## 12.8.3
10
+
11
+ ### Patch Changes
12
+
13
+ - Select Show More Button
14
+
3
15
  ## 12.8.2
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -13548,6 +13548,9 @@ type MultiSelectProps = ComponentProps<typeof StyledTrigger> & {
13548
13548
  selectedAllOptions?: boolean;
13549
13549
  selectedAllText?: string;
13550
13550
  selectedScroll?: boolean;
13551
+ showMoreButton?: boolean;
13552
+ showMoreButtonLabel?: string;
13553
+ showMoreButtonOnClick?: () => void;
13551
13554
  };
13552
13555
  declare const MultiSelect: React__default.ForwardRefExoticComponent<Omit<MultiSelectProps, "ref"> & React__default.RefAttributes<HTMLDivElement>>;
13553
13556
 
@@ -15249,13 +15252,16 @@ type SelectFormFieldProps = {
15249
15252
  required?: boolean;
15250
15253
  placeholder?: string;
15251
15254
  options: Option[];
15255
+ showMoreButton?: boolean;
15256
+ showMoreButtonLabel?: string;
15257
+ showMoreButtonOnClick?: () => void;
15252
15258
  validation?: {
15253
15259
  validate?: (value: string) => boolean | string;
15254
15260
  };
15255
15261
  validationErrorMessage?: string;
15256
15262
  defaultValue?: string;
15257
15263
  };
15258
- declare const SelectFormField: ({ name, label, required, placeholder, options, validation, validationErrorMessage, defaultValue, }: SelectFormFieldProps) => react_jsx_runtime.JSX.Element;
15264
+ declare const SelectFormField: ({ name, label, required, placeholder, options, showMoreButton, showMoreButtonLabel, showMoreButtonOnClick, validation, validationErrorMessage, defaultValue, }: SelectFormFieldProps) => react_jsx_runtime.JSX.Element;
15259
15265
 
15260
15266
  type SwitchFormFieldProps = {
15261
15267
  name: string;
package/dist/index.d.ts CHANGED
@@ -13548,6 +13548,9 @@ type MultiSelectProps = ComponentProps<typeof StyledTrigger> & {
13548
13548
  selectedAllOptions?: boolean;
13549
13549
  selectedAllText?: string;
13550
13550
  selectedScroll?: boolean;
13551
+ showMoreButton?: boolean;
13552
+ showMoreButtonLabel?: string;
13553
+ showMoreButtonOnClick?: () => void;
13551
13554
  };
13552
13555
  declare const MultiSelect: React__default.ForwardRefExoticComponent<Omit<MultiSelectProps, "ref"> & React__default.RefAttributes<HTMLDivElement>>;
13553
13556
 
@@ -15249,13 +15252,16 @@ type SelectFormFieldProps = {
15249
15252
  required?: boolean;
15250
15253
  placeholder?: string;
15251
15254
  options: Option[];
15255
+ showMoreButton?: boolean;
15256
+ showMoreButtonLabel?: string;
15257
+ showMoreButtonOnClick?: () => void;
15252
15258
  validation?: {
15253
15259
  validate?: (value: string) => boolean | string;
15254
15260
  };
15255
15261
  validationErrorMessage?: string;
15256
15262
  defaultValue?: string;
15257
15263
  };
15258
- declare const SelectFormField: ({ name, label, required, placeholder, options, validation, validationErrorMessage, defaultValue, }: SelectFormFieldProps) => react_jsx_runtime.JSX.Element;
15264
+ declare const SelectFormField: ({ name, label, required, placeholder, options, showMoreButton, showMoreButtonLabel, showMoreButtonOnClick, validation, validationErrorMessage, defaultValue, }: SelectFormFieldProps) => react_jsx_runtime.JSX.Element;
15259
15265
 
15260
15266
  type SwitchFormFieldProps = {
15261
15267
  name: string;
package/dist/index.js CHANGED
@@ -9928,7 +9928,10 @@ var MultiSelect = import_react18.default.forwardRef(
9928
9928
  maxHeight,
9929
9929
  selectedAllOptions = false,
9930
9930
  selectedAllText,
9931
- selectedScroll = false
9931
+ selectedScroll = false,
9932
+ showMoreButton = false,
9933
+ showMoreButtonLabel = "Carregar mais",
9934
+ showMoreButtonOnClick
9932
9935
  }, fowardedRef) => {
9933
9936
  const [isOpen, setIsOpen] = (0, import_react18.useState)(false);
9934
9937
  const triggerRef = (0, import_react18.useRef)(null);
@@ -10056,19 +10059,51 @@ var MultiSelect = import_react18.default.forwardRef(
10056
10059
  ]
10057
10060
  }
10058
10061
  ),
10059
- options.map(({ value, label }, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CheckboxItem, { value, css: itemStyle, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: label }) }, i))
10062
+ options.map(({ value, label }, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CheckboxItem, { value, css: itemStyle, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: label }) }, i)),
10063
+ showMoreButton && showMoreButtonOnClick && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10064
+ Button,
10065
+ {
10066
+ variant: "menuDropdownItem",
10067
+ color: "brand",
10068
+ onClick: showMoreButtonOnClick,
10069
+ fontWeight: "semibold",
10070
+ type: "button",
10071
+ css: {
10072
+ justifyContent: "flex-start",
10073
+ color: "var(--colors-brand500)!important"
10074
+ },
10075
+ children: showMoreButtonLabel
10076
+ }
10077
+ )
10060
10078
  ]
10061
10079
  }
10062
10080
  )
10063
10081
  }
10064
- ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10082
+ ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
10065
10083
  StyledFlexWithMaxHeight,
10066
10084
  {
10067
10085
  direction: "column",
10068
10086
  gap: 8,
10069
10087
  hasMaxHeight: !!maxHeight,
10070
10088
  style: maxHeight ? { maxHeight } : void 0,
10071
- children: options.map(({ value, label }, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledItem2, { onClick: () => handleItemClick(value), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: label }) }, i))
10089
+ children: [
10090
+ options.map(({ value, label }, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledItem2, { onClick: () => handleItemClick(value), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: label }) }, i)),
10091
+ showMoreButton && showMoreButtonOnClick && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10092
+ Button,
10093
+ {
10094
+ variant: "menuDropdownItem",
10095
+ color: "brand",
10096
+ onClick: showMoreButtonOnClick,
10097
+ fontWeight: "semibold",
10098
+ type: "button",
10099
+ css: {
10100
+ justifyContent: "flex-start",
10101
+ color: "var(--colors-brand500)!important"
10102
+ },
10103
+ children: showMoreButtonLabel
10104
+ }
10105
+ )
10106
+ ]
10072
10107
  }
10073
10108
  )
10074
10109
  }
@@ -10898,6 +10933,9 @@ var SelectFormField = ({
10898
10933
  required,
10899
10934
  placeholder = "Selecione",
10900
10935
  options,
10936
+ showMoreButton = false,
10937
+ showMoreButtonLabel = "Carregar mais",
10938
+ showMoreButtonOnClick,
10901
10939
  validation,
10902
10940
  validationErrorMessage = "Este campo \xE9 obrigat\xF3rio.",
10903
10941
  defaultValue
@@ -10931,24 +10969,38 @@ var SelectFormField = ({
10931
10969
  defaultValue: defaultValue || "",
10932
10970
  render: ({ field: { value, onChange } }) => {
10933
10971
  const selectedOption = options.find((opt) => opt.value === value);
10934
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10972
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
10935
10973
  DropdownMenu2,
10936
10974
  {
10937
10975
  placeholder: (selectedOption == null ? void 0 : selectedOption.label) || placeholder,
10938
10976
  fontWeight: "regular",
10939
10977
  typography: "labelLarge",
10940
10978
  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
- ))
10979
+ children: [
10980
+ options.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10981
+ DropdownMenuItem,
10982
+ {
10983
+ value: option.value,
10984
+ onSelect: () => onChange(option.value),
10985
+ fontWeight: "regular",
10986
+ typography: "labelLarge",
10987
+ children: option.label
10988
+ },
10989
+ `${option.value}${index}`
10990
+ )),
10991
+ showMoreButton && showMoreButtonOnClick && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10992
+ Button,
10993
+ {
10994
+ variant: "menuDropdownItem",
10995
+ color: "brand",
10996
+ onClick: showMoreButtonOnClick,
10997
+ fontWeight: "semibold",
10998
+ type: "button",
10999
+ css: { justifyContent: "flex-start", color: "var(--colors-brand500)!important" },
11000
+ children: showMoreButtonLabel
11001
+ }
11002
+ )
11003
+ ]
10952
11004
  }
10953
11005
  );
10954
11006
  }
package/dist/index.mjs CHANGED
@@ -9816,7 +9816,10 @@ var MultiSelect = React10.forwardRef(
9816
9816
  maxHeight,
9817
9817
  selectedAllOptions = false,
9818
9818
  selectedAllText,
9819
- selectedScroll = false
9819
+ selectedScroll = false,
9820
+ showMoreButton = false,
9821
+ showMoreButtonLabel = "Carregar mais",
9822
+ showMoreButtonOnClick
9820
9823
  }, fowardedRef) => {
9821
9824
  const [isOpen, setIsOpen] = useState8(false);
9822
9825
  const triggerRef = useRef8(null);
@@ -9944,19 +9947,51 @@ var MultiSelect = React10.forwardRef(
9944
9947
  ]
9945
9948
  }
9946
9949
  ),
9947
- options.map(({ value, label }, i) => /* @__PURE__ */ jsx27(CheckboxItem, { value, css: itemStyle, children: /* @__PURE__ */ jsx27(Text, { typography: "labelSmall", children: label }) }, i))
9950
+ options.map(({ value, label }, i) => /* @__PURE__ */ jsx27(CheckboxItem, { value, css: itemStyle, children: /* @__PURE__ */ jsx27(Text, { typography: "labelSmall", children: label }) }, i)),
9951
+ showMoreButton && showMoreButtonOnClick && /* @__PURE__ */ jsx27(
9952
+ Button,
9953
+ {
9954
+ variant: "menuDropdownItem",
9955
+ color: "brand",
9956
+ onClick: showMoreButtonOnClick,
9957
+ fontWeight: "semibold",
9958
+ type: "button",
9959
+ css: {
9960
+ justifyContent: "flex-start",
9961
+ color: "var(--colors-brand500)!important"
9962
+ },
9963
+ children: showMoreButtonLabel
9964
+ }
9965
+ )
9948
9966
  ]
9949
9967
  }
9950
9968
  )
9951
9969
  }
9952
- ) : /* @__PURE__ */ jsx27(
9970
+ ) : /* @__PURE__ */ jsxs16(
9953
9971
  StyledFlexWithMaxHeight,
9954
9972
  {
9955
9973
  direction: "column",
9956
9974
  gap: 8,
9957
9975
  hasMaxHeight: !!maxHeight,
9958
9976
  style: maxHeight ? { maxHeight } : void 0,
9959
- children: options.map(({ value, label }, i) => /* @__PURE__ */ jsx27(StyledItem2, { onClick: () => handleItemClick(value), children: /* @__PURE__ */ jsx27(Text, { typography: "labelSmall", children: label }) }, i))
9977
+ children: [
9978
+ options.map(({ value, label }, i) => /* @__PURE__ */ jsx27(StyledItem2, { onClick: () => handleItemClick(value), children: /* @__PURE__ */ jsx27(Text, { typography: "labelSmall", children: label }) }, i)),
9979
+ showMoreButton && showMoreButtonOnClick && /* @__PURE__ */ jsx27(
9980
+ Button,
9981
+ {
9982
+ variant: "menuDropdownItem",
9983
+ color: "brand",
9984
+ onClick: showMoreButtonOnClick,
9985
+ fontWeight: "semibold",
9986
+ type: "button",
9987
+ css: {
9988
+ justifyContent: "flex-start",
9989
+ color: "var(--colors-brand500)!important"
9990
+ },
9991
+ children: showMoreButtonLabel
9992
+ }
9993
+ )
9994
+ ]
9960
9995
  }
9961
9996
  )
9962
9997
  }
@@ -10791,6 +10826,9 @@ var SelectFormField = ({
10791
10826
  required,
10792
10827
  placeholder = "Selecione",
10793
10828
  options,
10829
+ showMoreButton = false,
10830
+ showMoreButtonLabel = "Carregar mais",
10831
+ showMoreButtonOnClick,
10794
10832
  validation,
10795
10833
  validationErrorMessage = "Este campo \xE9 obrigat\xF3rio.",
10796
10834
  defaultValue
@@ -10824,24 +10862,38 @@ var SelectFormField = ({
10824
10862
  defaultValue: defaultValue || "",
10825
10863
  render: ({ field: { value, onChange } }) => {
10826
10864
  const selectedOption = options.find((opt) => opt.value === value);
10827
- return /* @__PURE__ */ jsx42(
10865
+ return /* @__PURE__ */ jsxs23(
10828
10866
  DropdownMenu2,
10829
10867
  {
10830
10868
  placeholder: (selectedOption == null ? void 0 : selectedOption.label) || placeholder,
10831
10869
  fontWeight: "regular",
10832
10870
  typography: "labelLarge",
10833
10871
  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
- ))
10872
+ children: [
10873
+ options.map((option, index) => /* @__PURE__ */ jsx42(
10874
+ DropdownMenuItem,
10875
+ {
10876
+ value: option.value,
10877
+ onSelect: () => onChange(option.value),
10878
+ fontWeight: "regular",
10879
+ typography: "labelLarge",
10880
+ children: option.label
10881
+ },
10882
+ `${option.value}${index}`
10883
+ )),
10884
+ showMoreButton && showMoreButtonOnClick && /* @__PURE__ */ jsx42(
10885
+ Button,
10886
+ {
10887
+ variant: "menuDropdownItem",
10888
+ color: "brand",
10889
+ onClick: showMoreButtonOnClick,
10890
+ fontWeight: "semibold",
10891
+ type: "button",
10892
+ css: { justifyContent: "flex-start", color: "var(--colors-brand500)!important" },
10893
+ children: showMoreButtonLabel
10894
+ }
10895
+ )
10896
+ ]
10845
10897
  }
10846
10898
  );
10847
10899
  }
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.4",
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
  }}
@@ -11,6 +11,7 @@ import {
11
11
  import { colors } from "@lets-events/tokens";
12
12
  import { ComponentProps, useMemo } from "react";
13
13
  import { Flex } from "../Flex";
14
+ import { Button } from "../Button";
14
15
  import { CloseBtnStyled, ButtonSelectAllStyled, itemStyle, StyledContent, StyledFlexSelectedItems, StyledFlexWithMaxHeight, StyledItem, StyledText, StyledTrigger } from "./styledComponents";
15
16
 
16
17
  export type MultiSelectProps = ComponentProps<typeof StyledTrigger> & {
@@ -31,6 +32,9 @@ export type MultiSelectProps = ComponentProps<typeof StyledTrigger> & {
31
32
  selectedAllOptions?: boolean;
32
33
  selectedAllText?: string;
33
34
  selectedScroll?: boolean;
35
+ showMoreButton?: boolean;
36
+ showMoreButtonLabel?: string;
37
+ showMoreButtonOnClick?: () => void;
34
38
  };
35
39
 
36
40
  export const MultiSelect = React.forwardRef<HTMLDivElement, MultiSelectProps>(
@@ -50,7 +54,10 @@ export const MultiSelect = React.forwardRef<HTMLDivElement, MultiSelectProps>(
50
54
  maxHeight,
51
55
  selectedAllOptions = false,
52
56
  selectedAllText,
53
- selectedScroll = false
57
+ selectedScroll = false,
58
+ showMoreButton = false,
59
+ showMoreButtonLabel = "Carregar mais",
60
+ showMoreButtonOnClick
54
61
  },
55
62
  fowardedRef
56
63
  ) => {
@@ -182,6 +189,21 @@ export const MultiSelect = React.forwardRef<HTMLDivElement, MultiSelectProps>(
182
189
  <Text typography={"labelSmall"}>{label}</Text>
183
190
  </CheckboxItem>
184
191
  ))}
192
+ {showMoreButton && showMoreButtonOnClick && (
193
+ <Button
194
+ variant="menuDropdownItem"
195
+ color="brand"
196
+ onClick={showMoreButtonOnClick}
197
+ fontWeight="semibold"
198
+ type="button"
199
+ css={{
200
+ justifyContent: "flex-start",
201
+ color: "var(--colors-brand500)!important",
202
+ }}
203
+ >
204
+ {showMoreButtonLabel}
205
+ </Button>
206
+ )}
185
207
  </StyledFlexWithMaxHeight>
186
208
  </CheckboxGroup>
187
209
  ) : (
@@ -196,6 +218,21 @@ export const MultiSelect = React.forwardRef<HTMLDivElement, MultiSelectProps>(
196
218
  <Text typography={"labelSmall"}>{label}</Text>
197
219
  </StyledItem>
198
220
  ))}
221
+ {showMoreButton && showMoreButtonOnClick && (
222
+ <Button
223
+ variant="menuDropdownItem"
224
+ color="brand"
225
+ onClick={showMoreButtonOnClick}
226
+ fontWeight="semibold"
227
+ type="button"
228
+ css={{
229
+ justifyContent: "flex-start",
230
+ color: "var(--colors-brand500)!important",
231
+ }}
232
+ >
233
+ {showMoreButtonLabel}
234
+ </Button>
235
+ )}
199
236
  </StyledFlexWithMaxHeight>
200
237
  )}
201
238
  </StyledContent>