w-design-system 0.0.24 → 0.0.26
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/dist/assets/icon/apps.svg +10 -0
- package/dist/assets/icon/bel.svg +3 -0
- package/dist/assets/icon/bind.svg +10 -0
- package/dist/assets/icon/calendar.svg +3 -0
- package/dist/assets/icon/check.svg +10 -0
- package/dist/assets/icon/dashboard.svg +10 -0
- package/dist/assets/icon/doc-download.svg +10 -0
- package/dist/assets/icon/doc-upload.svg +11 -0
- package/dist/assets/icon/doc.svg +10 -0
- package/dist/assets/icon/edital.svg +10 -0
- package/dist/assets/icon/eyes.svg +10 -0
- package/dist/assets/icon/finance.svg +10 -0
- package/dist/assets/icon/index.d.ts +26 -7
- package/dist/assets/icon/index.d.ts.map +1 -1
- package/dist/assets/icon/index.js +26 -7
- package/dist/assets/icon/index.js.map +1 -1
- package/dist/assets/icon/index.ts +51 -12
- package/dist/assets/icon/money.svg +10 -0
- package/dist/assets/icon/monitoring.svg +10 -0
- package/dist/assets/icon/order.svg +10 -0
- package/dist/assets/icon/portal.svg +3 -0
- package/dist/assets/icon/seting.svg +10 -0
- package/dist/assets/icon/spreadsheet.svg +3 -0
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +34 -3
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Button/styles.d.ts +4 -0
- package/dist/components/Button/styles.d.ts.map +1 -1
- package/dist/components/Button/styles.js +26 -3
- package/dist/components/Button/styles.js.map +1 -1
- package/dist/components/ButtonRadiusIcon/index.d.ts.map +1 -1
- package/dist/components/ButtonRadiusIcon/index.js +3 -3
- package/dist/components/ButtonRadiusIcon/index.js.map +1 -1
- package/dist/components/ButtonRadiusIcon/styles.d.ts.map +1 -1
- package/dist/components/ButtonRadiusIcon/styles.js +17 -4
- package/dist/components/ButtonRadiusIcon/styles.js.map +1 -1
- package/dist/components/DateInput/index.d.ts +17 -0
- package/dist/components/DateInput/index.d.ts.map +1 -0
- package/dist/components/DateInput/index.js +22 -0
- package/dist/components/DateInput/index.js.map +1 -0
- package/dist/components/DateInput/stories.d.ts +8 -0
- package/dist/components/DateInput/stories.d.ts.map +1 -0
- package/dist/components/DateInput/stories.js +51 -0
- package/dist/components/DateInput/stories.js.map +1 -0
- package/dist/components/DateInput/styles.d.ts +21 -0
- package/dist/components/DateInput/styles.d.ts.map +1 -0
- package/dist/components/DateInput/styles.js +120 -0
- package/dist/components/DateInput/styles.js.map +1 -0
- package/dist/components/IconWrapper/index.d.ts +1 -0
- package/dist/components/IconWrapper/index.d.ts.map +1 -1
- package/dist/components/IconWrapper/index.js +18 -7
- package/dist/components/IconWrapper/index.js.map +1 -1
- package/dist/components/Input/index.d.ts +22 -0
- package/dist/components/Input/index.d.ts.map +1 -0
- package/dist/components/Input/index.js +70 -0
- package/dist/components/Input/index.js.map +1 -0
- package/dist/components/Input/stories.d.ts +10 -0
- package/dist/components/Input/stories.d.ts.map +1 -0
- package/dist/components/Input/stories.js +55 -0
- package/dist/components/Input/stories.js.map +1 -0
- package/dist/components/Input/styles.d.ts +19 -0
- package/dist/components/Input/styles.d.ts.map +1 -0
- package/dist/components/Input/styles.js +68 -0
- package/dist/components/Input/styles.js.map +1 -0
- package/dist/components/RangeDateInput/index.d.ts +25 -0
- package/dist/components/RangeDateInput/index.d.ts.map +1 -0
- package/dist/components/RangeDateInput/index.js +175 -0
- package/dist/components/RangeDateInput/index.js.map +1 -0
- package/dist/components/RangeDateInput/stories.d.ts +8 -0
- package/dist/components/RangeDateInput/stories.d.ts.map +1 -0
- package/dist/components/RangeDateInput/stories.js +60 -0
- package/dist/components/RangeDateInput/stories.js.map +1 -0
- package/dist/components/RangeDateInput/styles.d.ts +21 -0
- package/dist/components/RangeDateInput/styles.d.ts.map +1 -0
- package/dist/components/RangeDateInput/styles.js +126 -0
- package/dist/components/RangeDateInput/styles.js.map +1 -0
- package/dist/components/Table/index.js +1 -1
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Themes/index.d.ts +1 -0
- package/dist/components/Themes/index.d.ts.map +1 -1
- package/dist/components/Themes/index.js +1 -0
- package/dist/components/Themes/index.js.map +1 -1
- package/dist/components/Types/index.d.ts +3 -0
- package/dist/components/Types/index.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/assets/icon/apps.svg +10 -0
- package/src/assets/icon/bel.svg +3 -0
- package/src/assets/icon/bind.svg +10 -0
- package/src/assets/icon/calendar.svg +3 -0
- package/src/assets/icon/check.svg +10 -0
- package/src/assets/icon/dashboard.svg +10 -0
- package/src/assets/icon/doc-download.svg +10 -0
- package/src/assets/icon/doc-upload.svg +11 -0
- package/src/assets/icon/doc.svg +10 -0
- package/src/assets/icon/edital.svg +10 -0
- package/src/assets/icon/eyes.svg +10 -0
- package/src/assets/icon/finance.svg +10 -0
- package/src/assets/icon/index.ts +51 -12
- package/src/assets/icon/money.svg +10 -0
- package/src/assets/icon/monitoring.svg +10 -0
- package/src/assets/icon/order.svg +10 -0
- package/src/assets/icon/portal.svg +3 -0
- package/src/assets/icon/seting.svg +10 -0
- package/src/assets/icon/spreadsheet.svg +3 -0
- package/src/components/Button/index.tsx +44 -1
- package/src/components/Button/styles.ts +33 -3
- package/src/components/ButtonRadiusIcon/index.tsx +9 -2
- package/src/components/ButtonRadiusIcon/styles.ts +18 -4
- package/src/components/DateInput/index.tsx +29 -0
- package/src/components/DateInput/stories.tsx +56 -0
- package/src/components/DateInput/styles.ts +139 -0
- package/src/components/IconWrapper/index.tsx +34 -11
- package/src/components/Input/index.tsx +115 -0
- package/src/components/Input/stories.tsx +59 -0
- package/src/components/Input/styles.ts +84 -0
- package/src/components/RangeDateInput/index.tsx +272 -0
- package/src/components/RangeDateInput/stories.tsx +68 -0
- package/src/components/RangeDateInput/styles.ts +145 -0
- package/src/components/Table/index.tsx +1 -1
- package/src/components/Themes/index.ts +1 -0
- package/src/components/Types/index.ts +3 -0
- package/src/components/index.tsx +1 -0
- package/src/index.tsx +36 -4
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import React, { HTMLAttributes, ReactNode, useEffect, useId, useMemo, useRef, useState } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
CalendarDay,
|
|
4
|
+
CalendarGrid,
|
|
5
|
+
CalendarHeader,
|
|
6
|
+
CalendarWeekDayLabel,
|
|
7
|
+
Dropdown,
|
|
8
|
+
DropdownWrapper,
|
|
9
|
+
DefaultOptionButton,
|
|
10
|
+
InputDateWrapper,
|
|
11
|
+
CalendarDaySelectedBackground,
|
|
12
|
+
CalendarDayValue,
|
|
13
|
+
} from './styles'
|
|
14
|
+
import { calendarSVG, chevronDownSVG, chevronLeftSVG, chevronRightSVG } from '../../assets/icon'
|
|
15
|
+
import { IconWrapper } from '../IconWrapper'
|
|
16
|
+
import { Input } from '../Input'
|
|
17
|
+
import { theme } from '../Themes'
|
|
18
|
+
|
|
19
|
+
export interface RangeDateInputProps extends HTMLAttributes<HTMLDivElement> {
|
|
20
|
+
isRange?: boolean
|
|
21
|
+
placeholder?: string
|
|
22
|
+
label: string
|
|
23
|
+
defaultOptions?: { text: string; id: number }[]
|
|
24
|
+
selectedOption?: number | null
|
|
25
|
+
readonly?: boolean
|
|
26
|
+
disabled?: boolean
|
|
27
|
+
onSelectedOptionChange?: (option: number | null) => void
|
|
28
|
+
startCustomDate: Date | null
|
|
29
|
+
endCustomDate: Date | null
|
|
30
|
+
onSelectedCustomRange: (start: Date | null, end: Date | null) => void
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface Position {
|
|
34
|
+
x: number
|
|
35
|
+
y: number
|
|
36
|
+
width: number
|
|
37
|
+
height: number
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface EmptyDay {
|
|
41
|
+
type: 'empty'
|
|
42
|
+
key: string
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface Day {
|
|
46
|
+
type: 'day'
|
|
47
|
+
value: number
|
|
48
|
+
today: boolean
|
|
49
|
+
selected: boolean
|
|
50
|
+
date: Date
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const monthNames = [
|
|
54
|
+
'Janeiro',
|
|
55
|
+
'Fevereiro',
|
|
56
|
+
'Março',
|
|
57
|
+
'Abril',
|
|
58
|
+
'Maio',
|
|
59
|
+
'Junho',
|
|
60
|
+
'Julho',
|
|
61
|
+
'Agosto',
|
|
62
|
+
'Setembro',
|
|
63
|
+
'Outubro',
|
|
64
|
+
'Novembro',
|
|
65
|
+
'Dezembro',
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
const weekDays = ['DOM', 'SEG', 'TER', 'QUA', 'QUI', 'SEX', 'SAB']
|
|
69
|
+
|
|
70
|
+
type DayType = EmptyDay | Day
|
|
71
|
+
export const RangeDateInput: React.FC<RangeDateInputProps> = ({
|
|
72
|
+
label,
|
|
73
|
+
defaultOptions,
|
|
74
|
+
selectedOption,
|
|
75
|
+
onSelectedOptionChange,
|
|
76
|
+
placeholder,
|
|
77
|
+
onSelectedCustomRange,
|
|
78
|
+
startCustomDate,
|
|
79
|
+
endCustomDate,
|
|
80
|
+
isRange,
|
|
81
|
+
...props
|
|
82
|
+
}) => {
|
|
83
|
+
const [currentYear, setCurrentYear] = useState(0)
|
|
84
|
+
const [currentMonth, setCurrentMonth] = useState(0)
|
|
85
|
+
const [currentMouseHoverDate, setCurrentMouseHoverDate] = useState<Date | null>(null)
|
|
86
|
+
const [open, setOpen] = useState(false)
|
|
87
|
+
const wrapperRef = useRef<HTMLDivElement>(null)
|
|
88
|
+
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
const date = new Date()
|
|
91
|
+
setCurrentYear(date.getFullYear())
|
|
92
|
+
setCurrentMonth(date.getMonth())
|
|
93
|
+
}, [])
|
|
94
|
+
|
|
95
|
+
const days: DayType[] = []
|
|
96
|
+
|
|
97
|
+
const changeMonth = (delta: number) => {
|
|
98
|
+
const newDate = new Date(currentYear, currentMonth + delta)
|
|
99
|
+
setCurrentYear(newDate.getFullYear())
|
|
100
|
+
setCurrentMonth(newDate.getMonth())
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const onSelectedOptionChangeHandler = (option: number | null) => {
|
|
104
|
+
if (onSelectedOptionChange) {
|
|
105
|
+
onSelectedOptionChange(option)
|
|
106
|
+
if (onSelectedCustomRange) onSelectedCustomRange(null, null)
|
|
107
|
+
setOpen(false)
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const onDayClick = (date: Date) => {
|
|
112
|
+
if (onSelectedOptionChange) onSelectedOptionChange(null)
|
|
113
|
+
if (!startCustomDate) {
|
|
114
|
+
onSelectedCustomRange && onSelectedCustomRange(date, null)
|
|
115
|
+
currentMouseHoverDate && setCurrentMouseHoverDate(date)
|
|
116
|
+
if (isRange === false) setOpen(false)
|
|
117
|
+
} else if (!endCustomDate) {
|
|
118
|
+
let firstDate = startCustomDate
|
|
119
|
+
let secondDate = date
|
|
120
|
+
if (firstDate && secondDate && firstDate > secondDate) {
|
|
121
|
+
const temp = firstDate
|
|
122
|
+
firstDate = secondDate
|
|
123
|
+
secondDate = temp
|
|
124
|
+
}
|
|
125
|
+
onSelectedCustomRange && onSelectedCustomRange(firstDate, secondDate)
|
|
126
|
+
setOpen(false)
|
|
127
|
+
} else {
|
|
128
|
+
if (isRange === false) setOpen(false)
|
|
129
|
+
onSelectedCustomRange && onSelectedCustomRange(date, null)
|
|
130
|
+
setCurrentMouseHoverDate(date)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const onMouseEnter = (date: Date) => {
|
|
135
|
+
if (startCustomDate && !endCustomDate) {
|
|
136
|
+
setCurrentMouseHoverDate(date)
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const onMouseLeave = (date: Date) => {}
|
|
140
|
+
|
|
141
|
+
const day = new Date(currentYear, currentMonth, 1)
|
|
142
|
+
|
|
143
|
+
for (let i = 0; i < day.getDay(); i++) {
|
|
144
|
+
days.push({ type: 'empty', key: `before-${i}` })
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const todayString = new Date().toDateString()
|
|
148
|
+
let firstDate = startCustomDate
|
|
149
|
+
let secondDate = endCustomDate ?? currentMouseHoverDate
|
|
150
|
+
if (firstDate && secondDate && firstDate > secondDate) {
|
|
151
|
+
const temp = firstDate
|
|
152
|
+
firstDate = secondDate
|
|
153
|
+
secondDate = temp
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
while (day.getMonth() === currentMonth) {
|
|
157
|
+
const isSelected = (firstDate && secondDate && day >= firstDate && day <= secondDate) ?? false
|
|
158
|
+
days.push({
|
|
159
|
+
type: 'day',
|
|
160
|
+
value: day.getDate(),
|
|
161
|
+
today: day.toDateString() === todayString,
|
|
162
|
+
selected: isSelected,
|
|
163
|
+
date: new Date(day),
|
|
164
|
+
})
|
|
165
|
+
day.setDate(day.getDate() + 1)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const value = useMemo(() => {
|
|
169
|
+
if (selectedOption !== null) return defaultOptions?.find(option => option.id === selectedOption)?.text ?? ''
|
|
170
|
+
if (!firstDate && !secondDate) return ''
|
|
171
|
+
if (firstDate && !secondDate) return firstDate.toLocaleDateString()
|
|
172
|
+
|
|
173
|
+
if (secondDate && firstDate?.toLocaleDateString() === secondDate.toLocaleDateString())
|
|
174
|
+
return firstDate.toLocaleDateString()
|
|
175
|
+
|
|
176
|
+
if (firstDate && secondDate) return `${firstDate.toLocaleDateString()} - ${secondDate.toLocaleDateString()}`
|
|
177
|
+
|
|
178
|
+
return ''
|
|
179
|
+
}, [selectedOption, firstDate, secondDate])
|
|
180
|
+
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
if (!open) return
|
|
183
|
+
const handler = (event: MouseEvent) => {
|
|
184
|
+
let element: HTMLElement | null = event.target as HTMLElement
|
|
185
|
+
console.log(element)
|
|
186
|
+
while (element && element !== document.body.parentElement) {
|
|
187
|
+
if (element === wrapperRef.current) break
|
|
188
|
+
element = element.parentElement
|
|
189
|
+
}
|
|
190
|
+
if (element === document.body.parentElement) {
|
|
191
|
+
setOpen(false)
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
document.addEventListener('click', handler)
|
|
195
|
+
|
|
196
|
+
return () => {
|
|
197
|
+
document.removeEventListener('click', handler)
|
|
198
|
+
}
|
|
199
|
+
}, [open])
|
|
200
|
+
|
|
201
|
+
placeholder = placeholder ?? 'Selecione um período'
|
|
202
|
+
return (
|
|
203
|
+
<InputDateWrapper {...props} ref={wrapperRef}>
|
|
204
|
+
<Input
|
|
205
|
+
iconLeft={
|
|
206
|
+
<IconWrapper className="icon" src={calendarSVG} width="20px" height="20px" color={theme.colors.shade30} />
|
|
207
|
+
}
|
|
208
|
+
iconRight={
|
|
209
|
+
<IconWrapper
|
|
210
|
+
className={`icon ${open ? 'icon-rotate' : ''}`}
|
|
211
|
+
src={chevronDownSVG}
|
|
212
|
+
width="16px"
|
|
213
|
+
color={theme.colors.shade30}
|
|
214
|
+
/>
|
|
215
|
+
}
|
|
216
|
+
placeholder={placeholder}
|
|
217
|
+
label={label}
|
|
218
|
+
value={value}
|
|
219
|
+
readonly
|
|
220
|
+
onClick={() => setOpen(!open)}
|
|
221
|
+
/>
|
|
222
|
+
{open && (
|
|
223
|
+
<DropdownWrapper>
|
|
224
|
+
<Dropdown>
|
|
225
|
+
{(defaultOptions?.length ?? 0) > 0 && (
|
|
226
|
+
<div>
|
|
227
|
+
{defaultOptions?.map(option => (
|
|
228
|
+
<DefaultOptionButton
|
|
229
|
+
selected={option.id === selectedOption}
|
|
230
|
+
key={option.id}
|
|
231
|
+
onClick={() => onSelectedOptionChangeHandler(option.id)}
|
|
232
|
+
>
|
|
233
|
+
{option.text}
|
|
234
|
+
</DefaultOptionButton>
|
|
235
|
+
))}
|
|
236
|
+
<DefaultOptionButton selected={!!firstDate}>Período Personalizado</DefaultOptionButton>
|
|
237
|
+
</div>
|
|
238
|
+
)}
|
|
239
|
+
<CalendarHeader>
|
|
240
|
+
<IconWrapper className="icon" src={chevronLeftSVG} width="14px" onClick={() => changeMonth(-1)} />
|
|
241
|
+
{monthNames[currentMonth]} {currentYear}
|
|
242
|
+
<IconWrapper className="icon" src={chevronRightSVG} width="14px" onClick={() => changeMonth(1)} />
|
|
243
|
+
</CalendarHeader>
|
|
244
|
+
|
|
245
|
+
<CalendarGrid>
|
|
246
|
+
{weekDays.map(weekDay => (
|
|
247
|
+
<CalendarWeekDayLabel key={weekDay}>{weekDay}</CalendarWeekDayLabel>
|
|
248
|
+
))}
|
|
249
|
+
{days.map(day => {
|
|
250
|
+
if (day.type === 'empty') {
|
|
251
|
+
return <div key={day.key}></div>
|
|
252
|
+
}
|
|
253
|
+
return (
|
|
254
|
+
<CalendarDay
|
|
255
|
+
key={day.value}
|
|
256
|
+
today={day.today}
|
|
257
|
+
onClick={() => onDayClick(day.date)}
|
|
258
|
+
onMouseEnter={() => onMouseEnter(day.date)}
|
|
259
|
+
onMouseLeave={() => onMouseLeave(day.date)}
|
|
260
|
+
>
|
|
261
|
+
<CalendarDaySelectedBackground selected={day.selected} today={day.today} />
|
|
262
|
+
<CalendarDayValue>{day.value}</CalendarDayValue>
|
|
263
|
+
</CalendarDay>
|
|
264
|
+
)
|
|
265
|
+
})}
|
|
266
|
+
</CalendarGrid>
|
|
267
|
+
</Dropdown>
|
|
268
|
+
</DropdownWrapper>
|
|
269
|
+
)}
|
|
270
|
+
</InputDateWrapper>
|
|
271
|
+
)
|
|
272
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { RangeDateInput } from './index'
|
|
3
|
+
import { VARIANTS_TYPES } from '../../utils/constanst'
|
|
4
|
+
import React from 'react'
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof RangeDateInput> = {
|
|
7
|
+
title: 'Components/RangeDateInput',
|
|
8
|
+
component: RangeDateInput,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
placeholder: { control: 'text' },
|
|
12
|
+
label: { control: 'text' },
|
|
13
|
+
readonly: { control: 'boolean' },
|
|
14
|
+
disabled: { control: 'boolean' },
|
|
15
|
+
selectedOption: { control: 'number' },
|
|
16
|
+
startCustomDate: { control: 'date' },
|
|
17
|
+
endCustomDate: { control: 'date' },
|
|
18
|
+
onSelectedOptionChange: { action: 'selectedOptionChange' },
|
|
19
|
+
onSelectedCustomRange: { action: 'selectedCustomRange' },
|
|
20
|
+
},
|
|
21
|
+
} satisfies Meta<typeof RangeDateInput>
|
|
22
|
+
|
|
23
|
+
export default meta
|
|
24
|
+
type Story = StoryObj<typeof RangeDateInput>
|
|
25
|
+
|
|
26
|
+
const ComponentWrapper = ({ defaultOptions, ...args }: any) => {
|
|
27
|
+
const [selectedOption, setSelectOption] = React.useState<number | null>(null)
|
|
28
|
+
const [startDate, setStartDate] = React.useState<Date | null>(null)
|
|
29
|
+
const [endDate, setEndDate] = React.useState<Date | null>(null)
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<RangeDateInput
|
|
33
|
+
selectedOption={selectedOption}
|
|
34
|
+
startCustomDate={startDate}
|
|
35
|
+
endCustomDate={endDate}
|
|
36
|
+
onSelectedCustomRange={(start, end) => {
|
|
37
|
+
setStartDate(start)
|
|
38
|
+
setEndDate(end)
|
|
39
|
+
}}
|
|
40
|
+
onSelectedOptionChange={option => setSelectOption(option)}
|
|
41
|
+
defaultOptions={
|
|
42
|
+
defaultOptions ?? [
|
|
43
|
+
{
|
|
44
|
+
text: 'Últimos 30 dias',
|
|
45
|
+
id: 30,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
text: 'Últimos 60 dias',
|
|
49
|
+
id: 60,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
text: 'Últimos 90 dias',
|
|
53
|
+
id: 90,
|
|
54
|
+
},
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
{...args}
|
|
58
|
+
/>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const SelecionarIntervaloDeDatas: Story = {
|
|
63
|
+
render: args => <ComponentWrapper label="Período da Disputa" placeholder="Placeholder" />,
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const SelecionarIntervaloDeDatasSimples: Story = {
|
|
67
|
+
render: args => <ComponentWrapper defaultOptions={[]} />,
|
|
68
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import styled from 'styled-components'
|
|
2
|
+
import { theme } from '../Themes'
|
|
3
|
+
|
|
4
|
+
export const InputDateWrapper = styled.div`
|
|
5
|
+
position: relative;
|
|
6
|
+
.icon {
|
|
7
|
+
transition: transform 0.3s;
|
|
8
|
+
}
|
|
9
|
+
.icon-rotate {
|
|
10
|
+
transform: rotate(180deg) translateY(5px);
|
|
11
|
+
}
|
|
12
|
+
`
|
|
13
|
+
|
|
14
|
+
export const Dropdown = styled.div`
|
|
15
|
+
position: absolute;
|
|
16
|
+
width: 252px;
|
|
17
|
+
padding: 16px;
|
|
18
|
+
z-index: 1;
|
|
19
|
+
border-radius: 4px;
|
|
20
|
+
border: 1px solid ${theme.colors.shade20};
|
|
21
|
+
margin-top: 7px;
|
|
22
|
+
box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.1);
|
|
23
|
+
`
|
|
24
|
+
|
|
25
|
+
export const DropdownWrapper = styled.div`
|
|
26
|
+
position: relative;
|
|
27
|
+
`
|
|
28
|
+
|
|
29
|
+
export const CalendarGrid = styled.div`
|
|
30
|
+
display: grid;
|
|
31
|
+
font-family: 'Nunito Sans', sans-serif;
|
|
32
|
+
grid-template-columns: repeat(7, 36px);
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-items: center;
|
|
35
|
+
grid-column-gap: 0px;
|
|
36
|
+
grid-row-gap: 0px;
|
|
37
|
+
height: 100%;
|
|
38
|
+
width: 100%;
|
|
39
|
+
font-size: ${theme.paragraph.small};
|
|
40
|
+
color: ${theme.colors.shade50};
|
|
41
|
+
`
|
|
42
|
+
|
|
43
|
+
export const CalendarWeekDayLabel = styled.div`
|
|
44
|
+
font-size: ${theme.paragraph['xx-small']};
|
|
45
|
+
color: ${theme.colors.shade30};
|
|
46
|
+
font-weight: 600;
|
|
47
|
+
margin-bottom: 4px;
|
|
48
|
+
`
|
|
49
|
+
|
|
50
|
+
export interface DefaultOptionButtonProps {
|
|
51
|
+
selected: boolean
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const DefaultOptionButton = styled.button<DefaultOptionButtonProps>`
|
|
55
|
+
background-color: transparent;
|
|
56
|
+
border: none;
|
|
57
|
+
font-size: ${theme.paragraph.medium};
|
|
58
|
+
font-family: 'Nunito Sans', sans-serif;
|
|
59
|
+
color: ${({ selected }) => (selected ? theme.colors.cyan30 : theme.colors.shade40)};
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
padding: 0;
|
|
62
|
+
width: 100%;
|
|
63
|
+
text-align: left;
|
|
64
|
+
height: 46px;
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
|
|
68
|
+
&:not(:last-child) {
|
|
69
|
+
border-bottom: 1px solid ${theme.colors.shade10};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&:hover {
|
|
73
|
+
color: ${theme.colors.cyan30};
|
|
74
|
+
}
|
|
75
|
+
`
|
|
76
|
+
|
|
77
|
+
export const CalendarHeader = styled.div`
|
|
78
|
+
display: flex;
|
|
79
|
+
justify-content: space-between;
|
|
80
|
+
align-items: center;
|
|
81
|
+
font-size: ${theme.paragraph.small};
|
|
82
|
+
font-family: 'Nunito Sans', sans-serif;
|
|
83
|
+
font-weight: 600;
|
|
84
|
+
|
|
85
|
+
.icon,
|
|
86
|
+
.icon svg,
|
|
87
|
+
.icon svg path {
|
|
88
|
+
fill: ${theme.colors.shade50} !important;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.icon:hover,
|
|
92
|
+
.icon:hover svg,
|
|
93
|
+
.icon:hover svg path {
|
|
94
|
+
fill: ${theme.colors.cyan30} !important;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.icon-disabled,
|
|
98
|
+
.icon-disabled svg,
|
|
99
|
+
.icon-disabled svg path {
|
|
100
|
+
fill: ${theme.colors.shade20} !important;
|
|
101
|
+
}
|
|
102
|
+
`
|
|
103
|
+
export interface CalendarDayProps {
|
|
104
|
+
today: boolean
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export const CalendarDay = styled.div<CalendarDayProps>`
|
|
108
|
+
position: relative;
|
|
109
|
+
cursor: pointer;
|
|
110
|
+
color: ${({ today }) => (today ? theme.colors.white : theme.colors.shade50)};
|
|
111
|
+
width: 36px;
|
|
112
|
+
height: 36px;
|
|
113
|
+
`
|
|
114
|
+
|
|
115
|
+
export interface CalendarDaySelectedBackgroundProps {
|
|
116
|
+
today: boolean
|
|
117
|
+
selected: boolean
|
|
118
|
+
}
|
|
119
|
+
export const CalendarDaySelectedBackground = styled.div<CalendarDaySelectedBackgroundProps>`
|
|
120
|
+
position: absolute;
|
|
121
|
+
background-color: ${({ selected }) => selected && 'rgba(33, 126, 253, 0.16)'};
|
|
122
|
+
width: 100%;
|
|
123
|
+
height: 100%;
|
|
124
|
+
inset: 0;
|
|
125
|
+
|
|
126
|
+
&:hover {
|
|
127
|
+
background-color: rgba(33, 126, 253, 0.16);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
&::before {
|
|
131
|
+
content: '';
|
|
132
|
+
border-radius: 50%;
|
|
133
|
+
position: absolute;
|
|
134
|
+
background-color: ${({ today }) => (today ? theme.colors.cyan40 : 'transparent')};
|
|
135
|
+
inset: 0;
|
|
136
|
+
}
|
|
137
|
+
`
|
|
138
|
+
export const CalendarDayValue = styled.div`
|
|
139
|
+
position: absolute;
|
|
140
|
+
inset: 0;
|
|
141
|
+
display: flex;
|
|
142
|
+
align-items: center;
|
|
143
|
+
justify-content: center;
|
|
144
|
+
pointer-events: none;
|
|
145
|
+
`
|
|
@@ -138,7 +138,7 @@ export const Table: React.FC<TableProps> = ({
|
|
|
138
138
|
index: React.Key | null | undefined,
|
|
139
139
|
) => (
|
|
140
140
|
<Th key={index} width={col.width} align={col.align}>
|
|
141
|
-
<Paragraph color={theme.colors.shade30} textTransform={'uppercase'}>
|
|
141
|
+
<Paragraph color={theme.colors.shade30} textTransform={'uppercase'} strongBod>
|
|
142
142
|
{col.header}
|
|
143
143
|
</Paragraph>
|
|
144
144
|
</Th>
|
|
@@ -10,12 +10,15 @@ export interface ButtonTypes extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
10
10
|
halfLeft?: boolean
|
|
11
11
|
halfRight?: boolean
|
|
12
12
|
fullWidth?: boolean
|
|
13
|
+
size?: 'small' | 'medium' | 'large'
|
|
14
|
+
loading?: boolean
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
export interface ButtonRadiusIconTypes extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
16
18
|
variant?: ColorsVariant
|
|
17
19
|
icon?: string
|
|
18
20
|
subTitle?: string
|
|
21
|
+
size?: 'small' | 'medium' | 'large'
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
export interface ButtonRoundTypes extends ButtonHTMLAttributes<HTMLButtonElement> {
|
package/src/components/index.tsx
CHANGED
package/src/index.tsx
CHANGED
|
@@ -2,13 +2,45 @@ export { Banner } from './components/Banner/index'
|
|
|
2
2
|
export { Button } from './components/Button/index'
|
|
3
3
|
export { ButtonRadiusIcon } from './components/ButtonRadiusIcon/index'
|
|
4
4
|
export { ButtonRound } from './components/ButtonRound/index'
|
|
5
|
+
export { DateInput } from './components/DateInput/index'
|
|
5
6
|
export { IconWrapper } from './components/IconWrapper/index'
|
|
7
|
+
export { Input } from './components/Input/index'
|
|
6
8
|
export { Modal } from './components/Modal/index'
|
|
9
|
+
export { Paginate } from './components/Paginate/index'
|
|
7
10
|
export { Paragraph } from './components/Paragraph/index'
|
|
11
|
+
export { RangeDateInput } from './components/RangeDateInput/index'
|
|
12
|
+
export { Table } from './components/Table/index'
|
|
8
13
|
export { Tabs } from './components/Tabs/index'
|
|
9
14
|
export { theme } from './components/Themes/index'
|
|
10
15
|
export { Title } from './components/Title/index'
|
|
11
|
-
export {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
export {
|
|
17
|
+
appsSVG,
|
|
18
|
+
alertSVG,
|
|
19
|
+
bindSVG,
|
|
20
|
+
bellSVG,
|
|
21
|
+
checkSVG,
|
|
22
|
+
calendarSVG,
|
|
23
|
+
chevronDownSVG,
|
|
24
|
+
chevronLeftSVG,
|
|
25
|
+
chevronRightSVG,
|
|
26
|
+
closeSVG,
|
|
27
|
+
commentSVG,
|
|
28
|
+
docCheckSVG,
|
|
29
|
+
docSVG,
|
|
30
|
+
dumpSVG,
|
|
31
|
+
dashboardSVG,
|
|
32
|
+
docDownloadSVG,
|
|
33
|
+
docUploadSVG,
|
|
34
|
+
editSVG,
|
|
35
|
+
editalSVG,
|
|
36
|
+
imageSVG,
|
|
37
|
+
monitoringSVG,
|
|
38
|
+
settingSVG,
|
|
39
|
+
financeSVG,
|
|
40
|
+
spreadsheetSVG,
|
|
41
|
+
orderSVG,
|
|
42
|
+
moneySVG,
|
|
43
|
+
eyesSVG,
|
|
44
|
+
portalSVG,
|
|
45
|
+
spinSVG,
|
|
46
|
+
} from './assets/icon/index'
|