@moises.ai/design-system 4.19.4 → 4.19.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/dist/{AutomationPenIcon-508hiLNg.js → AutomationPenIcon-BPBwkoCg.js} +1 -22
- package/dist/icons.js +1 -1
- package/dist/index.js +1103 -1097
- package/package.json +1 -1
- package/src/components/Select/Select.jsx +21 -25
- package/src/components/Select/Select.module.css +13 -0
- package/src/components/TextField/TextField.jsx +24 -6
- package/src/components/TextField/TextField.module.css +37 -0
- package/src/components/TextField/TextField.stories.jsx +39 -0
- package/src/icons/ArrowRightIcon.jsx +3 -17
package/package.json
CHANGED
|
@@ -93,32 +93,28 @@ export const Select = ({
|
|
|
93
93
|
})}
|
|
94
94
|
disabled={disabled || readOnly}
|
|
95
95
|
>
|
|
96
|
-
<
|
|
97
|
-
{
|
|
98
|
-
|
|
99
|
-
{item.aiDetected && (
|
|
100
|
-
<Text
|
|
101
|
-
size="1"
|
|
102
|
-
style={{
|
|
103
|
-
color: 'var(--aqua-alpha-9)',
|
|
104
|
-
verticalAlign: 'top',
|
|
105
|
-
}}
|
|
106
|
-
>
|
|
107
|
-
✦
|
|
96
|
+
<span className={styles.itemLabel}>
|
|
97
|
+
<Text size={size} style={{ color: 'var(--neutral-12)' }}>
|
|
98
|
+
{item.label}
|
|
108
99
|
</Text>
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
100
|
+
{item.aiDetected && (
|
|
101
|
+
<span className={styles.aiDetected} aria-hidden>
|
|
102
|
+
✦
|
|
103
|
+
</span>
|
|
104
|
+
)}
|
|
105
|
+
{item.extra && (
|
|
106
|
+
<Text
|
|
107
|
+
size={size}
|
|
108
|
+
className={styles.extra}
|
|
109
|
+
style={{
|
|
110
|
+
color: 'var(--neutral-alpha-9)',
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
{' '}
|
|
114
|
+
{item.extra}
|
|
115
|
+
</Text>
|
|
116
|
+
)}
|
|
117
|
+
</span>
|
|
122
118
|
</SelectRadix.Item>
|
|
123
119
|
),
|
|
124
120
|
)}
|
|
@@ -147,3 +147,16 @@
|
|
|
147
147
|
padding: 12px 15px;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
.itemLabel {
|
|
151
|
+
line-height: 1;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.aiDetected {
|
|
155
|
+
color: var(--aqua-alpha-9);
|
|
156
|
+
font-size: var(--font-size-1);
|
|
157
|
+
line-height: 1;
|
|
158
|
+
display: inline-block;
|
|
159
|
+
vertical-align: super;
|
|
160
|
+
margin-left: 2px;
|
|
161
|
+
}
|
|
162
|
+
|
|
@@ -20,6 +20,9 @@ export const TextField = ({
|
|
|
20
20
|
error,
|
|
21
21
|
secondaryText,
|
|
22
22
|
autoFocus,
|
|
23
|
+
aiDetected = false,
|
|
24
|
+
textAlign = 'left',
|
|
25
|
+
style,
|
|
23
26
|
...props
|
|
24
27
|
}) => {
|
|
25
28
|
// legacy Icon prop is kept for backwards compatibility.
|
|
@@ -27,6 +30,8 @@ export const TextField = ({
|
|
|
27
30
|
startSlot ||
|
|
28
31
|
(Icon ? <Icon width={16} height={16} className={styles.icon} /> : null)
|
|
29
32
|
|
|
33
|
+
const chars = String(value ?? '').length
|
|
34
|
+
|
|
30
35
|
return (
|
|
31
36
|
<Flex direction="column" width="100%" height="100%" gap="1">
|
|
32
37
|
{title && (
|
|
@@ -48,7 +53,13 @@ export const TextField = ({
|
|
|
48
53
|
[styles.focusRing]: focusRing || error,
|
|
49
54
|
[styles.errorText]: error,
|
|
50
55
|
[styles[`size${size}`]]: size,
|
|
56
|
+
[styles.alignCenter]: textAlign === 'center',
|
|
57
|
+
[styles.alignLeft]: textAlign === 'left',
|
|
51
58
|
})}
|
|
59
|
+
style={{
|
|
60
|
+
...(aiDetected && { '--ai-chars': chars }),
|
|
61
|
+
...style,
|
|
62
|
+
}}
|
|
52
63
|
readOnly={readOnly}
|
|
53
64
|
disabled={disabled}
|
|
54
65
|
autoFocus={autoFocus}
|
|
@@ -57,18 +68,25 @@ export const TextField = ({
|
|
|
57
68
|
{resolvedStartSlot && (
|
|
58
69
|
<TextFieldRadix.Slot>{resolvedStartSlot}</TextFieldRadix.Slot>
|
|
59
70
|
)}
|
|
71
|
+
{aiDetected && (
|
|
72
|
+
<span className={styles.aiDetected} aria-hidden>
|
|
73
|
+
<span className={styles.aiDetectedMark}>✦</span>
|
|
74
|
+
</span>
|
|
75
|
+
)}
|
|
60
76
|
{endSlot && <div className={styles.endSlot}>{endSlot}</div>}
|
|
61
77
|
</TextFieldRadix.Root>
|
|
62
78
|
{secondaryText && (
|
|
63
|
-
<Text
|
|
79
|
+
<Text
|
|
80
|
+
size="1"
|
|
81
|
+
weight="regular"
|
|
64
82
|
className={classNames(styles.secondaryText, {
|
|
65
|
-
[styles.errorText]: error
|
|
66
|
-
})}
|
|
83
|
+
[styles.errorText]: error,
|
|
84
|
+
})}
|
|
85
|
+
>
|
|
67
86
|
{secondaryText}
|
|
68
87
|
</Text>
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
</Flex >
|
|
88
|
+
)}
|
|
89
|
+
</Flex>
|
|
72
90
|
)
|
|
73
91
|
}
|
|
74
92
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
.TextField {
|
|
2
|
+
position: relative;
|
|
2
3
|
background-color: var(--neutral-alpha-3);
|
|
3
4
|
color: var(--neutral-12);
|
|
4
5
|
box-shadow: none;
|
|
@@ -27,6 +28,42 @@
|
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
.alignLeft input {
|
|
32
|
+
text-align: left;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.alignCenter input {
|
|
36
|
+
text-align: center;
|
|
37
|
+
/* Radix uses text-indent as left inset; reset it so center is true center. */
|
|
38
|
+
text-indent: 0;
|
|
39
|
+
padding-left: var(--text-field-padding);
|
|
40
|
+
padding-right: var(--text-field-padding);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.aiDetected {
|
|
44
|
+
position: absolute;
|
|
45
|
+
top: 50%;
|
|
46
|
+
transform: translateY(-50%);
|
|
47
|
+
pointer-events: none;
|
|
48
|
+
line-height: 1;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.alignLeft .aiDetected {
|
|
52
|
+
left: calc(var(--text-field-padding) + (var(--ai-chars, 0) * 1ch) + 2px);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.alignCenter .aiDetected {
|
|
56
|
+
left: calc(50% + (var(--ai-chars, 0) * 0.5ch) + 2px);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.aiDetectedMark {
|
|
60
|
+
display: inline-block;
|
|
61
|
+
color: var(--aqua-alpha-9);
|
|
62
|
+
font-size: var(--font-size-1);
|
|
63
|
+
line-height: 1;
|
|
64
|
+
transform: translateY(-0.35em);
|
|
65
|
+
}
|
|
66
|
+
|
|
30
67
|
.icon {
|
|
31
68
|
color: var(--neutral-alpha-10);
|
|
32
69
|
}
|
|
@@ -155,6 +155,23 @@ const MyComponent = () => (
|
|
|
155
155
|
defaultValue: { summary: 'undefined' },
|
|
156
156
|
},
|
|
157
157
|
},
|
|
158
|
+
aiDetected: {
|
|
159
|
+
control: 'boolean',
|
|
160
|
+
description: 'Shows ✦ icon next to the input value when true',
|
|
161
|
+
table: {
|
|
162
|
+
type: { summary: 'boolean' },
|
|
163
|
+
defaultValue: { summary: 'false' },
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
textAlign: {
|
|
167
|
+
control: 'select',
|
|
168
|
+
options: ['left', 'center'],
|
|
169
|
+
description: 'Horizontal alignment of the input text',
|
|
170
|
+
table: {
|
|
171
|
+
type: { summary: "'left' | 'center'" },
|
|
172
|
+
defaultValue: { summary: 'left' },
|
|
173
|
+
},
|
|
174
|
+
},
|
|
158
175
|
},
|
|
159
176
|
decorators: [
|
|
160
177
|
(Story) => (
|
|
@@ -273,3 +290,25 @@ export const WithCustomSlots = {
|
|
|
273
290
|
},
|
|
274
291
|
name: 'With custom slots',
|
|
275
292
|
}
|
|
293
|
+
|
|
294
|
+
export const WithAiDetected = {
|
|
295
|
+
args: {
|
|
296
|
+
...Default.args,
|
|
297
|
+
title: 'Tempo',
|
|
298
|
+
value: '120',
|
|
299
|
+
textAlign: 'center',
|
|
300
|
+
aiDetected: true,
|
|
301
|
+
},
|
|
302
|
+
name: 'With AI detected',
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export const WithAiDetectedLeft = {
|
|
306
|
+
args: {
|
|
307
|
+
...Default.args,
|
|
308
|
+
title: 'Song tuning (Hz)',
|
|
309
|
+
value: '440',
|
|
310
|
+
textAlign: 'left',
|
|
311
|
+
aiDetected: true,
|
|
312
|
+
},
|
|
313
|
+
name: 'With AI detected (left)',
|
|
314
|
+
}
|
|
@@ -4,23 +4,9 @@ export const ArrowRightIcon = ({
|
|
|
4
4
|
className,
|
|
5
5
|
...props
|
|
6
6
|
}) => (
|
|
7
|
-
<svg
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
height={height}
|
|
11
|
-
viewBox="0 0 24 24"
|
|
12
|
-
fill="none"
|
|
13
|
-
className={className}
|
|
14
|
-
{...props}
|
|
15
|
-
>
|
|
16
|
-
<path
|
|
17
|
-
d="M13 18L19 12L13 6M18 12L5 12"
|
|
18
|
-
stroke="currentColor"
|
|
19
|
-
strokeWidth="1.5"
|
|
20
|
-
strokeLinecap="round"
|
|
21
|
-
strokeLinejoin="round"
|
|
22
|
-
/>
|
|
23
|
-
</svg>
|
|
7
|
+
<svg xmlns="http://www.w3.org/2000/svg" width={width} height={height} viewBox="0 0 24 24" fill="none" {...props} aria-label="Arrow Right Icon">
|
|
8
|
+
<path d="M13.1429 19L20 12L13.1429 5M18.8571 12L4 12" stroke="white" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"/>
|
|
9
|
+
</svg>
|
|
24
10
|
)
|
|
25
11
|
|
|
26
12
|
ArrowRightIcon.displayName = 'ArrowRightIcon'
|