@moises.ai/design-system 4.16.4 → 4.16.6

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": "@moises.ai/design-system",
3
- "version": "4.16.4",
3
+ "version": "4.16.6",
4
4
  "description": "Design System package based on @radix-ui/themes with custom defaults",
5
5
  "private": false,
6
6
  "type": "module",
@@ -19,6 +19,8 @@ export const DropdownButton = ({
19
19
  ...props
20
20
  }) => {
21
21
  const [hover, setHover] = useState(false)
22
+ const [isTriggerButtonFocused, setIsTriggerButtonFocused] = useState(false)
23
+ const [isChevronFocused, setIsChevronFocused] = useState(false)
22
24
 
23
25
  const handleTriggerClick = (e) => {
24
26
  if (onTriggerClick) {
@@ -28,20 +30,38 @@ export const DropdownButton = ({
28
30
  }
29
31
  }
30
32
 
33
+ const handleTriggerButtonFocus = () => {
34
+ setIsTriggerButtonFocused(true)
35
+ }
36
+ const handleTriggerButtonBlur = () => {
37
+ setIsTriggerButtonFocused(false)
38
+ }
39
+ const handleChevronFocus = () => {
40
+ setIsChevronFocused(true)
41
+ }
42
+ const handleChevronBlur = () => {
43
+ setIsChevronFocused(false)
44
+ }
45
+
46
+ const ChevronTrigger = onTriggerClick ? 'button' : 'div'
47
+
31
48
  return (
32
49
  <Flex className={classNames(styles.container, className)} {...props}>
33
- <Popover.Root open={open} onOpenChange={onOpenChange} modal={true}>
50
+ <Popover.Root open={open} onOpenChange={onOpenChange} modal={true} >
34
51
  {onTriggerClick && (
35
52
  <Flex
36
53
  as="button"
37
54
  className={classNames({
38
55
  [styles.triggerWithClick]: onTriggerClick,
56
+ [styles.triggerWithClickFocused]: isTriggerButtonFocused,
39
57
  [styles.hasLeftColor]: leftColor,
40
58
  [styles.freeWidthTrigger]: !withIconTrigger,
41
59
  })}
42
60
  onMouseEnter={() => setHover(true)}
43
61
  onMouseLeave={() => setHover(false)}
44
62
  onClick={handleTriggerClick}
63
+ onFocus={handleTriggerButtonFocus}
64
+ onBlur={handleTriggerButtonBlur}
45
65
  >
46
66
  <Button
47
67
  variant="ghost"
@@ -55,6 +75,7 @@ export const DropdownButton = ({
55
75
  width: withIconTrigger ? '32px' : undefined,
56
76
  backgroundColor: leftColor,
57
77
  borderRadius: leftColor ? '3px' : '0px',
78
+ outline: 'none',
58
79
  }}
59
80
  >
60
81
  {trigger}
@@ -62,12 +83,14 @@ export const DropdownButton = ({
62
83
  </Flex>
63
84
  )}
64
85
  <Popover.Trigger asChild>
65
- <div
86
+ <ChevronTrigger
87
+ type={onTriggerClick ? 'button' : undefined}
66
88
  className={classNames({
67
89
  [styles.hover]: hover,
68
90
  [styles.hasLeftColor]: leftColor,
69
91
  [styles.hasTriggerWithClick]: onTriggerClick,
70
92
  [styles.hasTriggerWithoutClick]: !onTriggerClick,
93
+ [styles.chevronFocused]: isChevronFocused,
71
94
  })}
72
95
  onMouseEnter={() => {
73
96
  setHover(true)
@@ -75,6 +98,8 @@ export const DropdownButton = ({
75
98
  onMouseLeave={() => {
76
99
  setHover(false)
77
100
  }}
101
+ onFocus={handleChevronFocus}
102
+ onBlur={handleChevronBlur}
78
103
  >
79
104
  {!onTriggerClick && (
80
105
  <Button
@@ -88,6 +113,7 @@ export const DropdownButton = ({
88
113
  : '0 6px',
89
114
  backgroundColor: leftColor,
90
115
  borderRadius: leftColor ? '3px' : '0px',
116
+ outline: 'none',
91
117
  }}
92
118
  >
93
119
  {trigger}
@@ -109,7 +135,7 @@ export const DropdownButton = ({
109
135
  [styles.hover]: hover,
110
136
  })}
111
137
  />
112
- </div>
138
+ </ChevronTrigger>
113
139
  </Popover.Trigger>
114
140
  <Popover.Content
115
141
  className={styles.content}
@@ -14,10 +14,16 @@
14
14
  &.triggerWithClick {
15
15
  cursor: pointer;
16
16
  }
17
+
18
+ &:focus-visible {
19
+ outline: 2px solid var(--neutral-alpha-8);
20
+ outline-offset: 2px;
21
+ }
17
22
  }
18
23
 
19
24
  .triggerWithClick {
20
- border-width: 1px 0 1px 1px; /* top right bottom left */
25
+ border-width: 1px 0 1px 1px;
26
+ /* top right bottom left */
21
27
  border-style: solid;
22
28
  border-color: var(--neutral-alpha-3);
23
29
  display: flex;
@@ -36,18 +42,36 @@
36
42
  &:hover button {
37
43
  color: var(--neutral-alpha-12) !important;
38
44
  }
45
+
46
+ &:focus-visible {
47
+ outline: 2px solid var(--neutral-alpha-8);
48
+ outline-offset: 2px;
49
+ }
50
+ }
51
+
52
+ .triggerWithClickFocused,
53
+ .chevronFocused {
54
+ outline: 2px solid var(--neutral-alpha-8);
55
+ outline-offset: 2px;
39
56
  }
40
57
 
41
58
  .triggerWithClick.freeWidthTrigger {
42
59
  width: auto;
43
60
  }
44
61
 
62
+ /* quando tiver active no triggerWithClick */
63
+ .triggerWithClick:focus-visible {
64
+ outline: 2px solid var(--neutral-alpha-8);
65
+ outline-offset: 2px;
66
+ }
67
+
45
68
  .hasTriggerWithClick {
46
- border-width: 1px 1px 1px 0; /* top right bottom left */
69
+ border-width: 1px 1px 1px 0;
70
+ /* top right bottom left */
47
71
  border-style: solid;
48
72
  border-color: var(--neutral-alpha-3);
49
73
  display: flex;
50
- height: 30px;
74
+ height: 32px;
51
75
 
52
76
  border-top-right-radius: 4px;
53
77
  border-bottom-right-radius: 4px;
@@ -55,11 +79,22 @@
55
79
  justify-content: center !important;
56
80
  align-items: center;
57
81
  padding: 0 4px 0 0;
82
+ margin: 0;
83
+ background: transparent;
84
+ font: inherit;
85
+ color: inherit;
86
+ cursor: pointer;
87
+
88
+ &:focus-visible {
89
+ outline: 2px solid var(--neutral-alpha-8);
90
+ outline-offset: 2px;
91
+ }
58
92
  }
59
93
 
60
94
  .hover {
61
95
  color: var(--neutral-alpha-12) !important;
62
96
  cursor: pointer;
97
+
63
98
  }
64
99
 
65
100
  .trigger.hover button {
@@ -94,7 +129,7 @@
94
129
 
95
130
  display: flex;
96
131
  width: fit-content;
97
- padding: 12px 16px;
132
+ padding: 12px 16px 16px 16px;
98
133
  flex-direction: column;
99
134
  justify-content: center;
100
135
  align-items: center;
@@ -103,6 +138,7 @@
103
138
  animation-duration: 400ms;
104
139
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
105
140
  will-change: transform, opacity;
141
+
106
142
  }
107
143
 
108
144
  .content[data-side='top'] {
@@ -121,11 +157,17 @@
121
157
  animation-name: slideRightAndFade;
122
158
  }
123
159
 
160
+ .content:focus-visible {
161
+ outline: 2px solid var(--neutral-alpha-8);
162
+ outline-offset: 2px;
163
+ }
164
+
124
165
  @keyframes slideUpAndFade {
125
166
  from {
126
167
  opacity: 0;
127
168
  transform: translateY(2px);
128
169
  }
170
+
129
171
  to {
130
172
  opacity: 1;
131
173
  transform: translateY(0);
@@ -137,6 +179,7 @@
137
179
  opacity: 0;
138
180
  transform: translateX(-2px);
139
181
  }
182
+
140
183
  to {
141
184
  opacity: 1;
142
185
  transform: translateX(0);
@@ -148,6 +191,7 @@
148
191
  opacity: 0;
149
192
  transform: translateY(-2px);
150
193
  }
194
+
151
195
  to {
152
196
  opacity: 1;
153
197
  transform: translateY(0);
@@ -159,6 +203,7 @@
159
203
  opacity: 0;
160
204
  transform: translateX(2px);
161
205
  }
206
+
162
207
  to {
163
208
  opacity: 1;
164
209
  transform: translateX(0);
@@ -167,4 +212,4 @@
167
212
 
168
213
  .chevron {
169
214
  color: var(--neutral-alpha-11);
170
- }
215
+ }
@@ -46,6 +46,7 @@
46
46
  user-select: none;
47
47
  bottom: -7px;
48
48
  z-index: 12;
49
+ background: transparent;
49
50
 
50
51
  &:hover {
51
52
  .sliderTrack {
@@ -57,12 +58,18 @@
57
58
 
58
59
  .sliderTrack {
59
60
  position: relative;
60
- /* z-index: 1; */
61
61
  flex: 1;
62
62
  height: 2px;
63
63
  overflow: visible;
64
64
  border-radius: 0px;
65
65
  background: var(--neutral-5);
66
+ transition: height 0.15s ease, border-radius 0.15s ease, background 0.15s ease;
67
+ }
68
+
69
+ .sliderRoot:hover .sliderTrack {
70
+ height: 4px;
71
+ border-radius: 9999px;
72
+ background: var(--neutral-6);
66
73
  }
67
74
 
68
75
  .bufferedRange {
@@ -105,7 +112,7 @@
105
112
  bottom: 8px;
106
113
  left: 0;
107
114
  height: 28px;
108
- overflow: hidden;
115
+ overflow: clip;
109
116
  pointer-events: none;
110
117
  opacity: 0;
111
118
  transform: translateY(4px);
package/src/index.jsx CHANGED
@@ -37,6 +37,7 @@ export {
37
37
  VisuallyHidden,
38
38
  } from '@radix-ui/themes'
39
39
 
40
+ export { Slider as SliderPrimitive } from 'radix-ui'
40
41
  // Export our custom components
41
42
 
42
43
  export { AdditionalItems } from './components/AdditionalItems/AdditionalItems'