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.
Files changed (131) hide show
  1. package/dist/assets/icon/apps.svg +10 -0
  2. package/dist/assets/icon/bel.svg +3 -0
  3. package/dist/assets/icon/bind.svg +10 -0
  4. package/dist/assets/icon/calendar.svg +3 -0
  5. package/dist/assets/icon/check.svg +10 -0
  6. package/dist/assets/icon/dashboard.svg +10 -0
  7. package/dist/assets/icon/doc-download.svg +10 -0
  8. package/dist/assets/icon/doc-upload.svg +11 -0
  9. package/dist/assets/icon/doc.svg +10 -0
  10. package/dist/assets/icon/edital.svg +10 -0
  11. package/dist/assets/icon/eyes.svg +10 -0
  12. package/dist/assets/icon/finance.svg +10 -0
  13. package/dist/assets/icon/index.d.ts +26 -7
  14. package/dist/assets/icon/index.d.ts.map +1 -1
  15. package/dist/assets/icon/index.js +26 -7
  16. package/dist/assets/icon/index.js.map +1 -1
  17. package/dist/assets/icon/index.ts +51 -12
  18. package/dist/assets/icon/money.svg +10 -0
  19. package/dist/assets/icon/monitoring.svg +10 -0
  20. package/dist/assets/icon/order.svg +10 -0
  21. package/dist/assets/icon/portal.svg +3 -0
  22. package/dist/assets/icon/seting.svg +10 -0
  23. package/dist/assets/icon/spreadsheet.svg +3 -0
  24. package/dist/components/Button/index.d.ts.map +1 -1
  25. package/dist/components/Button/index.js +34 -3
  26. package/dist/components/Button/index.js.map +1 -1
  27. package/dist/components/Button/styles.d.ts +4 -0
  28. package/dist/components/Button/styles.d.ts.map +1 -1
  29. package/dist/components/Button/styles.js +26 -3
  30. package/dist/components/Button/styles.js.map +1 -1
  31. package/dist/components/ButtonRadiusIcon/index.d.ts.map +1 -1
  32. package/dist/components/ButtonRadiusIcon/index.js +3 -3
  33. package/dist/components/ButtonRadiusIcon/index.js.map +1 -1
  34. package/dist/components/ButtonRadiusIcon/styles.d.ts.map +1 -1
  35. package/dist/components/ButtonRadiusIcon/styles.js +17 -4
  36. package/dist/components/ButtonRadiusIcon/styles.js.map +1 -1
  37. package/dist/components/DateInput/index.d.ts +17 -0
  38. package/dist/components/DateInput/index.d.ts.map +1 -0
  39. package/dist/components/DateInput/index.js +22 -0
  40. package/dist/components/DateInput/index.js.map +1 -0
  41. package/dist/components/DateInput/stories.d.ts +8 -0
  42. package/dist/components/DateInput/stories.d.ts.map +1 -0
  43. package/dist/components/DateInput/stories.js +51 -0
  44. package/dist/components/DateInput/stories.js.map +1 -0
  45. package/dist/components/DateInput/styles.d.ts +21 -0
  46. package/dist/components/DateInput/styles.d.ts.map +1 -0
  47. package/dist/components/DateInput/styles.js +120 -0
  48. package/dist/components/DateInput/styles.js.map +1 -0
  49. package/dist/components/IconWrapper/index.d.ts +1 -0
  50. package/dist/components/IconWrapper/index.d.ts.map +1 -1
  51. package/dist/components/IconWrapper/index.js +18 -7
  52. package/dist/components/IconWrapper/index.js.map +1 -1
  53. package/dist/components/Input/index.d.ts +22 -0
  54. package/dist/components/Input/index.d.ts.map +1 -0
  55. package/dist/components/Input/index.js +70 -0
  56. package/dist/components/Input/index.js.map +1 -0
  57. package/dist/components/Input/stories.d.ts +10 -0
  58. package/dist/components/Input/stories.d.ts.map +1 -0
  59. package/dist/components/Input/stories.js +55 -0
  60. package/dist/components/Input/stories.js.map +1 -0
  61. package/dist/components/Input/styles.d.ts +19 -0
  62. package/dist/components/Input/styles.d.ts.map +1 -0
  63. package/dist/components/Input/styles.js +68 -0
  64. package/dist/components/Input/styles.js.map +1 -0
  65. package/dist/components/RangeDateInput/index.d.ts +25 -0
  66. package/dist/components/RangeDateInput/index.d.ts.map +1 -0
  67. package/dist/components/RangeDateInput/index.js +175 -0
  68. package/dist/components/RangeDateInput/index.js.map +1 -0
  69. package/dist/components/RangeDateInput/stories.d.ts +8 -0
  70. package/dist/components/RangeDateInput/stories.d.ts.map +1 -0
  71. package/dist/components/RangeDateInput/stories.js +60 -0
  72. package/dist/components/RangeDateInput/stories.js.map +1 -0
  73. package/dist/components/RangeDateInput/styles.d.ts +21 -0
  74. package/dist/components/RangeDateInput/styles.d.ts.map +1 -0
  75. package/dist/components/RangeDateInput/styles.js +126 -0
  76. package/dist/components/RangeDateInput/styles.js.map +1 -0
  77. package/dist/components/Table/index.js +1 -1
  78. package/dist/components/Table/index.js.map +1 -1
  79. package/dist/components/Themes/index.d.ts +1 -0
  80. package/dist/components/Themes/index.d.ts.map +1 -1
  81. package/dist/components/Themes/index.js +1 -0
  82. package/dist/components/Themes/index.js.map +1 -1
  83. package/dist/components/Types/index.d.ts +3 -0
  84. package/dist/components/Types/index.d.ts.map +1 -1
  85. package/dist/components/index.d.ts +1 -0
  86. package/dist/components/index.d.ts.map +1 -1
  87. package/dist/components/index.js +1 -0
  88. package/dist/components/index.js.map +1 -1
  89. package/dist/index.d.ts +6 -3
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/index.js +6 -3
  92. package/dist/index.js.map +1 -1
  93. package/package.json +1 -1
  94. package/src/assets/icon/apps.svg +10 -0
  95. package/src/assets/icon/bel.svg +3 -0
  96. package/src/assets/icon/bind.svg +10 -0
  97. package/src/assets/icon/calendar.svg +3 -0
  98. package/src/assets/icon/check.svg +10 -0
  99. package/src/assets/icon/dashboard.svg +10 -0
  100. package/src/assets/icon/doc-download.svg +10 -0
  101. package/src/assets/icon/doc-upload.svg +11 -0
  102. package/src/assets/icon/doc.svg +10 -0
  103. package/src/assets/icon/edital.svg +10 -0
  104. package/src/assets/icon/eyes.svg +10 -0
  105. package/src/assets/icon/finance.svg +10 -0
  106. package/src/assets/icon/index.ts +51 -12
  107. package/src/assets/icon/money.svg +10 -0
  108. package/src/assets/icon/monitoring.svg +10 -0
  109. package/src/assets/icon/order.svg +10 -0
  110. package/src/assets/icon/portal.svg +3 -0
  111. package/src/assets/icon/seting.svg +10 -0
  112. package/src/assets/icon/spreadsheet.svg +3 -0
  113. package/src/components/Button/index.tsx +44 -1
  114. package/src/components/Button/styles.ts +33 -3
  115. package/src/components/ButtonRadiusIcon/index.tsx +9 -2
  116. package/src/components/ButtonRadiusIcon/styles.ts +18 -4
  117. package/src/components/DateInput/index.tsx +29 -0
  118. package/src/components/DateInput/stories.tsx +56 -0
  119. package/src/components/DateInput/styles.ts +139 -0
  120. package/src/components/IconWrapper/index.tsx +34 -11
  121. package/src/components/Input/index.tsx +115 -0
  122. package/src/components/Input/stories.tsx +59 -0
  123. package/src/components/Input/styles.ts +84 -0
  124. package/src/components/RangeDateInput/index.tsx +272 -0
  125. package/src/components/RangeDateInput/stories.tsx +68 -0
  126. package/src/components/RangeDateInput/styles.ts +145 -0
  127. package/src/components/Table/index.tsx +1 -1
  128. package/src/components/Themes/index.ts +1 -0
  129. package/src/components/Types/index.ts +3 -0
  130. package/src/components/index.tsx +1 -0
  131. package/src/index.tsx +36 -4
@@ -0,0 +1,29 @@
1
+ import React, { HTMLAttributes } from 'react'
2
+ import { RangeDateInput } from '../RangeDateInput'
3
+
4
+ export interface DateInputProps extends HTMLAttributes<HTMLDivElement> {
5
+ placeholder?: string
6
+ label: string
7
+ defaultOptions?: { text: string; id: number }[]
8
+ selectedOption?: number | null
9
+ readonly?: boolean
10
+ disabled?: boolean
11
+ onSelectedOptionChange?: (option: number | null) => void
12
+ customDate: Date | null
13
+ onSelectedCustomDate?: (date: Date | null) => void
14
+ }
15
+
16
+ export const DateInput: React.FC<DateInputProps> = ({ onSelectedCustomDate, customDate, ...props }) => {
17
+ const onRangeSelected = (start: Date | null) => {
18
+ if (onSelectedCustomDate) onSelectedCustomDate(start)
19
+ }
20
+ return (
21
+ <RangeDateInput
22
+ {...props}
23
+ isRange={false}
24
+ onSelectedCustomRange={onRangeSelected}
25
+ startCustomDate={customDate}
26
+ endCustomDate={customDate}
27
+ />
28
+ )
29
+ }
@@ -0,0 +1,56 @@
1
+ import { Meta, StoryObj } from '@storybook/react'
2
+ import { DateInput } from './index'
3
+ import React from 'react'
4
+
5
+ const meta: Meta<typeof DateInput> = {
6
+ title: 'Components/DateInput',
7
+ component: DateInput,
8
+ tags: ['autodocs'],
9
+ argTypes: {
10
+ placeholder: { control: 'text' },
11
+ label: { control: 'text' },
12
+ readonly: { control: 'boolean' },
13
+ disabled: { control: 'boolean' },
14
+ },
15
+ } satisfies Meta<typeof DateInput>
16
+
17
+ export default meta
18
+ type Story = StoryObj<typeof DateInput>
19
+
20
+ const ComponentWrapper = ({ defaultOptions, ...args }: any) => {
21
+ const [selectedOption, setSelectOption] = React.useState<number | null>(null)
22
+ const [customDate, setCustomDate] = React.useState<Date | null>(null)
23
+ return (
24
+ <DateInput
25
+ selectedOption={selectedOption}
26
+ customDate={customDate}
27
+ onSelectedOptionChange={option => setSelectOption(option)}
28
+ onSelectedCustomDate={date => setCustomDate(date)}
29
+ defaultOptions={
30
+ defaultOptions ?? [
31
+ {
32
+ text: 'Ontem',
33
+ id: -1,
34
+ },
35
+ {
36
+ text: 'Hoje',
37
+ id: 0,
38
+ },
39
+ {
40
+ text: 'Amanhã',
41
+ id: 1,
42
+ },
43
+ ]
44
+ }
45
+ {...args}
46
+ />
47
+ )
48
+ }
49
+
50
+ export const SelecionarDataDeDatas: Story = {
51
+ render: args => <ComponentWrapper label="Data da Disputa" placeholder="Placeholder" />,
52
+ }
53
+
54
+ export const SelecionarDatasSimples: Story = {
55
+ render: args => <ComponentWrapper defaultOptions={[]} />,
56
+ }
@@ -0,0 +1,139 @@
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
+ &::before {
126
+ content: '';
127
+ border-radius: 50%;
128
+ position: absolute;
129
+ background-color: ${({ today }) => (today ? theme.colors.cyan40 : 'transparent')};
130
+ inset: 0;
131
+ }
132
+ `
133
+ export const CalendarDayValue = styled.div`
134
+ position: absolute;
135
+ inset: 0;
136
+ display: flex;
137
+ align-items: center;
138
+ justify-content: center;
139
+ `
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import styled from 'styled-components'
2
+ import styled, { keyframes, css } from 'styled-components'
3
3
  import { ReactSVG } from 'react-svg'
4
4
 
5
5
  interface IconWrapperProps {
@@ -9,35 +9,58 @@ interface IconWrapperProps {
9
9
  height?: string
10
10
  className?: string
11
11
  onClick?: () => void
12
+ loading?: boolean
12
13
  }
13
14
 
14
- interface IconWrappeProps {
15
+ interface StyledIconWrapperProps {
15
16
  color?: string
16
17
  width?: string
17
18
  height?: string
18
- onClick?: () => void
19
+ clickable?: boolean
20
+ loading?: boolean
19
21
  }
20
22
 
21
- const StyledIconWrapper = styled.div<IconWrappeProps>`
23
+ const spinAnimation = keyframes`
24
+ 0% { transform: rotate(0deg); }
25
+ 100% { transform: rotate(360deg); }
26
+ `
27
+
28
+ const StyledIconWrapper = styled.div<StyledIconWrapperProps>`
22
29
  height: 100%;
23
30
  display: flex;
24
31
  align-items: center;
25
32
  justify-content: center;
26
33
  flex-shrink: 0;
27
- cursor: ${props => (props.onClick ? 'pointer' : 'default')};
34
+ cursor: ${({ clickable }) => (clickable ? 'pointer' : 'default')};
35
+
28
36
  svg {
29
- width: ${props => props.width || '24px'};
30
- height: ${props => props.height || '24px'};
31
- fill: ${props => props.color || 'black'};
37
+ width: ${({ width }) => width || '24px'};
38
+ height: ${({ height }) => height || '24px'};
39
+ fill: ${({ color }) => color || 'black'};
40
+
41
+ ${({ loading }) =>
42
+ loading &&
43
+ css`
44
+ animation: ${css`
45
+ ${spinAnimation}`} 2s linear infinite;
46
+ `}
32
47
 
33
48
  path {
34
- fill: ${props => props.color || 'black'};
49
+ fill: ${({ color }) => color || 'black'};
35
50
  }
36
51
  }
37
52
  `
38
53
 
39
- export const IconWrapper: React.FC<IconWrapperProps> = ({ src, color, width, height, className, onClick }) => (
40
- <StyledIconWrapper color={color} width={width} height={height} className={className} onClick={onClick}>
54
+ export const IconWrapper: React.FC<IconWrapperProps> = ({ src, color, width, height, className, onClick, loading }) => (
55
+ <StyledIconWrapper
56
+ color={color}
57
+ width={width}
58
+ height={height}
59
+ className={className}
60
+ clickable={!!onClick}
61
+ loading={loading}
62
+ onClick={onClick}
63
+ >
41
64
  <ReactSVG src={src} />
42
65
  </StyledIconWrapper>
43
66
  )
@@ -0,0 +1,115 @@
1
+ import React, { HTMLAttributes, ReactNode, useEffect, useId, useRef } from 'react'
2
+ import { InputWrapper, StyledInput, StyledInputBorder, StyledInputContent, StyledLabel } from './styles'
3
+
4
+ export interface InputProps extends HTMLAttributes<HTMLDivElement> {
5
+ placeholder?: string
6
+ iconLeft?: ReactNode
7
+ label: string
8
+ value?: string
9
+ readonly?: boolean
10
+ disabled?: boolean
11
+ onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void
12
+ onInput?: (e: React.FormEvent<HTMLInputElement>) => void
13
+ onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void
14
+ onKeyUp?: (e: React.KeyboardEvent<HTMLInputElement>) => void
15
+ iconRight?: ReactNode
16
+ }
17
+
18
+ export interface Position {
19
+ x: number
20
+ y: number
21
+ width: number
22
+ height: number
23
+ }
24
+
25
+ export const Input: React.FC<InputProps> = ({
26
+ label,
27
+ readonly,
28
+ onChange,
29
+ onInput,
30
+ value,
31
+ onKeyDown,
32
+ disabled,
33
+ onKeyUp,
34
+ iconLeft,
35
+ iconRight,
36
+ ...props
37
+ }) => {
38
+ const id = useId()
39
+ const [labelPosition, setLabelPosition] = React.useState<Position>({
40
+ x: 0,
41
+ y: 0,
42
+ width: 0,
43
+ height: 0,
44
+ })
45
+ const [contentPosition, setContentPosition] = React.useState<Position>({
46
+ x: 0,
47
+ y: 0,
48
+ width: 0,
49
+ height: 0,
50
+ })
51
+
52
+ const contentRef = useRef<HTMLDivElement>(null)
53
+ const labelRef = useRef<HTMLLabelElement>(null)
54
+ const inputRef = useRef<HTMLInputElement>(null)
55
+
56
+ const updatePositions = () => {
57
+ if (contentRef.current) {
58
+ setContentPosition({
59
+ x: 0,
60
+ y: 0,
61
+ width: contentRef.current.offsetWidth,
62
+ height: contentRef.current.offsetHeight,
63
+ })
64
+ }
65
+ if (labelRef.current) {
66
+ setLabelPosition({
67
+ x: labelRef.current.offsetLeft,
68
+ y: labelRef.current.offsetTop,
69
+ width: labelRef.current.offsetWidth,
70
+ height: labelRef.current.offsetHeight,
71
+ })
72
+ }
73
+ }
74
+
75
+ const onClickHandler = () => {
76
+ inputRef.current?.focus()
77
+ }
78
+
79
+ useEffect(() => {
80
+ const handler = () => updatePositions()
81
+
82
+ window.addEventListener('resize', handler)
83
+
84
+ return () => window.removeEventListener('resize', handler)
85
+ }, [])
86
+
87
+ useEffect(() => {
88
+ updatePositions()
89
+ }, [label])
90
+
91
+ return (
92
+ <InputWrapper {...props}>
93
+ <StyledInputContent disabled={disabled} ref={contentRef} onClick={onClickHandler}>
94
+ <StyledInputBorder content={contentPosition} label={labelPosition} />
95
+ <StyledLabel htmlFor={id} ref={labelRef}>
96
+ {label}
97
+ </StyledLabel>
98
+ {iconLeft}
99
+ <StyledInput
100
+ id={id}
101
+ disabled={disabled}
102
+ value={value}
103
+ placeholder={props.placeholder}
104
+ ref={inputRef}
105
+ onChange={onChange}
106
+ onInput={onInput}
107
+ onKeyDown={onKeyDown}
108
+ onKeyUp={onKeyUp}
109
+ readOnly={readonly}
110
+ />
111
+ {iconRight}
112
+ </StyledInputContent>
113
+ </InputWrapper>
114
+ )
115
+ }
@@ -0,0 +1,59 @@
1
+ import { Meta, StoryObj } from '@storybook/react'
2
+ import { Input } from './index'
3
+ import { VARIANTS_TYPES } from '../../utils/constanst'
4
+ import { useState } from 'react'
5
+ import React from 'react'
6
+ import { IconWrapper } from '../IconWrapper'
7
+ import { editSVG } from '../../assets/icon'
8
+ import { theme } from '../Themes'
9
+
10
+ const meta: Meta<typeof Input> = {
11
+ title: 'Components/Input',
12
+ component: Input,
13
+ tags: ['autodocs'],
14
+ argTypes: {
15
+ placeholder: { control: 'text' },
16
+ label: { control: 'text' },
17
+ value: { control: 'text' },
18
+ readonly: { control: 'boolean' },
19
+ disabled: { control: 'boolean' },
20
+ onChange: { action: 'change' },
21
+ onInput: { action: 'input' },
22
+ onKeyDown: { action: 'keydown' },
23
+ onKeyUp: { action: 'keyup' },
24
+ },
25
+ }
26
+
27
+ export default meta
28
+ type Story = StoryObj<typeof Input>
29
+
30
+ export const Playground: Story = {
31
+ args: {
32
+ label: 'Label',
33
+ placeholder: 'placeholder',
34
+ },
35
+ }
36
+ const ComponentWrapper = ({ ...args }: any) => {
37
+ const [value, setValue] = useState<string>('')
38
+ return <Input {...args} value={value} onChange={e => setValue(e.target.value)} />
39
+ }
40
+
41
+ export const Default: StoryObj<typeof Input> = {
42
+ render: args => <ComponentWrapper {...args} />,
43
+ }
44
+
45
+ export const Disabled: StoryObj<typeof Input> = {
46
+ render: args => <ComponentWrapper {...args} placeholder="Disabled" label="Disabled" disabled />,
47
+ }
48
+
49
+ export const DisabledWithIcon: StoryObj<typeof Input> = {
50
+ render: args => (
51
+ <ComponentWrapper
52
+ {...args}
53
+ iconLeft={<IconWrapper src={editSVG} width="20px" color={theme.colors.shade30} />}
54
+ placeholder="Disabled"
55
+ label="Disabled"
56
+ disabled
57
+ />
58
+ ),
59
+ }
@@ -0,0 +1,84 @@
1
+ import styled from 'styled-components'
2
+ import { theme } from '../Themes'
3
+ import type { Position } from '.'
4
+
5
+ export const InputWrapper = styled.div`
6
+ border-radius: 4px;
7
+ `
8
+
9
+ export const StyledInput = styled.input`
10
+ width: 100%;
11
+ font-family: ${theme.fonts.join(', ')};
12
+ outline: none;
13
+ font-size: ${theme.paragraph.medium};
14
+ border: none;
15
+ color: ${theme.colors.shade50};
16
+ z-index: 1;
17
+ background-color: transparent;
18
+ &:active,
19
+ &:focus {
20
+ outline: none;
21
+ border: none;
22
+ }
23
+ &::placeholder {
24
+ color: ${theme.colors.shade30};
25
+ font-size: ${theme.paragraph.medium};
26
+ opacity: 1;
27
+ }
28
+ &:disabled {
29
+ background-color: transparent;;
30
+ cursor: not-allowed;
31
+ }
32
+ `
33
+
34
+ export const StyledLabel = styled.label`
35
+ position: absolute;
36
+ left: 15px;
37
+ top: -8px;
38
+ padding: 0 1px;
39
+ font-weight: 600;
40
+ font-size: ${theme.paragraph.small};
41
+ color: ${theme.colors.shade50};
42
+ font-family: 'Nunito Sans', sans-serif;
43
+ text-wrap: nowrap;
44
+ `
45
+
46
+ export interface StyledInputContentProps {
47
+ disabled?: boolean
48
+ }
49
+
50
+ export const StyledInputContent = styled.div<StyledInputContentProps>`
51
+ position: relative;
52
+ padding: 18px 16px 14px 16px;
53
+ display: flex;
54
+ gap: 8px;
55
+ height: 22px;
56
+ align-items: center;
57
+ justify-content: space-between;
58
+ border-radius: 4px;
59
+ cursor: ${({ disabled }: StyledInputContentProps) => (disabled ? 'not-allowed' : 'pointer')};
60
+ background-color: ${({ disabled }: StyledInputContentProps) =>
61
+ disabled ? theme.colors.shade10 : theme.colors.white};
62
+ `
63
+
64
+ export interface StyledInputBorderProps {
65
+ label: Position
66
+ content: Position
67
+ }
68
+
69
+ /**
70
+ * O clip-path faz com que o elemento fique transparente na região do label
71
+ * @see https://stackoverflow.com/questions/3742479/how-to-cut-a-hole-in-an-svg-rectangle
72
+ * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d
73
+ */
74
+ export const StyledInputBorder = styled.div<StyledInputBorderProps>`
75
+ position: absolute;
76
+ inset: 0px;
77
+ border-radius: 4px;
78
+ border: 1px solid ${theme.colors.shade20};
79
+ clip-rule: evenodd;
80
+ clip-path: path(
81
+ '${({ label, content }) =>
82
+ `M ${content.x} ${content.y} l ${content.width} 0 l 0 ${content.height} l -${content.width} 0z M ${label.x} ${label.y} l 0 ${label.height} l ${label.width} 0 l 0 -${label.height}z`}'
83
+ );
84
+ `