@granto-umbrella/umbrella-components 2.3.8 → 2.3.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@granto-umbrella/umbrella-components",
3
- "version": "2.3.8",
3
+ "version": "2.3.10",
4
4
  "description": "Umbrella Components for React",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -1,4 +1,3 @@
1
- // DatePicker.styles.ts
2
1
  import { createGlobalStyle, styled } from "styled-components";
3
2
  import ReactDatePicker, {
4
3
  DatePickerProps,
@@ -16,54 +15,36 @@ import {
16
15
  // register Portuguese‐Brazil locale
17
16
  registerLocale("pt-BR", ptBR);
18
17
 
19
- // 1) Global overrides for the popup calendar:
18
+ // global overrides for the popup calendar
20
19
  export const DatePickerGlobalStyles = createGlobalStyle`
21
- .react-datepicker {
22
- background: ${semanticColors.base.background};
23
- border: 1px solid ${semanticColors.neutral[300]};
24
- border-radius: ${semanticRadius.global.radius.md};
25
- font-family: inherit;
26
- box-shadow: 0 4px 8px rgba(0,0,0,0.1);
27
- }
28
-
29
- .react-datepicker__header {
30
- background: ${semanticColors.neutral[100]};
31
- border-bottom: none;
32
- border-top-left-radius: ${semanticRadius.global.radius.md};
33
- border-top-right-radius: ${semanticRadius.global.radius.md};
34
- padding: ${semanticSizes.global.padding.sm};
35
- }
36
-
37
- .react-datepicker__current-month {
38
- font-size: ${typographyTokens.fontSizes.bodyM};
39
- color: ${semanticColors.base.text};
40
- }
41
-
42
- .react-datepicker__day-name,
43
- .react-datepicker__day {
44
- width: 2rem;
45
- line-height: 2rem;
46
- margin: 0.1rem;
47
- }
20
+ /* … your existing .react-datepicker* overrides … */
21
+ `;
48
22
 
49
- .react-datepicker__day--selected {
50
- background-color: ${semanticColors.branding.surface.enabled};
51
- color: ${semanticColors.base.background};
52
- border-radius: 50%;
53
- }
23
+ // wrapper around input + icon
24
+ export const InputWrapper = styled.div`
25
+ position: relative;
26
+ width: 100%;
27
+ `;
54
28
 
55
- .react-datepicker__triangle {
56
- display: none;
57
- }
29
+ // ícone absolutizado à esquerda
30
+ export const IconWrapper = styled.div`
31
+ position: absolute;
32
+ top: 50%;
33
+ left: ${semanticSizes.global.padding.lg};
34
+ transform: translateY(-50%);
35
+ pointer-events: none;
36
+ color: ${semanticColors.neutral[500]};
58
37
  `;
59
38
 
60
- // 2) Styled input only:
39
+ // styled input itself; we add extra left‐padding for the icon
61
40
  export const StyledDatePicker = styled(
62
41
  ReactDatePicker as unknown as React.ComponentType<DatePickerProps>
63
42
  )`
64
43
  width: 100%;
65
44
  padding: ${semanticSizes.global.padding.md} ${semanticSizes.global.padding.lg};
66
- gap: ${semanticSizes.global.gap.md};
45
+ padding-left: calc(
46
+ ${semanticSizes.global.padding.lg} ${primitiveSizes.size.x4}
47
+ );
67
48
  border: 1px solid ${semanticColors.neutral[300]};
68
49
  border-radius: ${semanticRadius.global.radius.md};
69
50
  font-size: ${typographyTokens.fontSizes.labelM};
@@ -1,11 +1,13 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
1
  import React from "react";
2
+ import { Calendar as CalendarIcon } from "lucide-react";
3
3
  import {
4
4
  Container,
5
5
  DatePickerGlobalStyles,
6
6
  Label,
7
7
  StyledDatePicker,
8
8
  SupportText,
9
+ InputWrapper,
10
+ IconWrapper,
9
11
  } from "./DatePicker.styles";
10
12
 
11
13
  import "react-datepicker/dist/react-datepicker.css";
@@ -17,7 +19,6 @@ interface DatePickerInputProps {
17
19
  minDate?: Date;
18
20
  maxDate?: Date;
19
21
  placeholder?: string;
20
- [key: string]: any;
21
22
  label?: string;
22
23
  supportText?: string;
23
24
  error?: boolean;
@@ -39,32 +40,40 @@ export const DatePickerInput: React.FC<DatePickerInputProps> = ({
39
40
  {label && <Label>{label}</Label>}
40
41
  <DatePickerGlobalStyles />
41
42
 
42
- {mode === "range" ? (
43
- <StyledDatePicker
44
- locale="pt-BR"
45
- selectsRange
46
- startDate={(selected as [Date, Date])[0] || undefined}
47
- endDate={(selected as [Date, Date])[1] || undefined}
48
- selected={(selected as [Date, Date])[0] || undefined}
49
- onChange={(d) => onChange(d as [Date, Date])}
50
- minDate={minDate}
51
- maxDate={maxDate}
52
- placeholderText={placeholder}
53
- dateFormat="dd/MM/yyyy"
54
- {...rest}
55
- />
56
- ) : (
57
- <StyledDatePicker
58
- locale="pt-BR"
59
- selected={selected as Date}
60
- onChange={(d) => onChange(d as Date)}
61
- minDate={minDate}
62
- maxDate={maxDate}
63
- placeholderText={placeholder}
64
- dateFormat="dd/MM/yyyy"
65
- {...rest}
66
- />
67
- )}
43
+ <InputWrapper>
44
+ {/* the calendar icon */}
45
+ <IconWrapper>
46
+ <CalendarIcon size={16} />
47
+ </IconWrapper>
48
+
49
+ {mode === "range" ? (
50
+ <StyledDatePicker
51
+ locale="pt-BR"
52
+ selectsRange
53
+ startDate={(selected as [Date, Date])[0] || undefined}
54
+ endDate={(selected as [Date, Date])[1] || undefined}
55
+ selected={(selected as [Date, Date])[0] || undefined}
56
+ onChange={(d) => onChange(d as [Date, Date])}
57
+ minDate={minDate}
58
+ maxDate={maxDate}
59
+ placeholderText={placeholder}
60
+ dateFormat="dd/MM/yyyy"
61
+ {...rest}
62
+ />
63
+ ) : (
64
+ <StyledDatePicker
65
+ locale="pt-BR"
66
+ selected={selected as Date}
67
+ onChange={(d) => onChange(d as Date)}
68
+ minDate={minDate}
69
+ maxDate={maxDate}
70
+ placeholderText={placeholder}
71
+ dateFormat="dd/MM/yyyy"
72
+ {...rest}
73
+ />
74
+ )}
75
+ </InputWrapper>
76
+
68
77
  {supportText && <SupportText $error={error}>{supportText}</SupportText>}
69
78
  </Container>
70
79
  );
@@ -0,0 +1,3 @@
1
+ // src/global.d.ts
2
+ // Allow import of any ".css" file
3
+ declare module "*.css";