@donkit-ai/design-system 0.2.18 → 0.3.0

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.
@@ -58,31 +58,31 @@
58
58
  }
59
59
 
60
60
  /* Small */
61
- .ds-checkbox--small .ds-checkbox__box {
61
+ .ds-checkbox--s .ds-checkbox__box {
62
62
  width: var(--icon-s);
63
63
  height: var(--icon-s);
64
64
  }
65
65
 
66
- .ds-checkbox--small .ds-checkbox__label {
66
+ .ds-checkbox--s .ds-checkbox__label {
67
67
  font-size: var(--font-size-p2);
68
68
  }
69
69
 
70
70
  /* Medium */
71
- .ds-checkbox--medium .ds-checkbox__box {
71
+ .ds-checkbox--m .ds-checkbox__box {
72
72
  width: var(--icon-m);
73
73
  height: var(--icon-m);
74
74
  }
75
75
 
76
- .ds-checkbox--medium .ds-checkbox__label {
76
+ .ds-checkbox--m .ds-checkbox__label {
77
77
  font-size: var(--font-size-p1);
78
78
  }
79
79
 
80
80
  /* Large */
81
- .ds-checkbox--large .ds-checkbox__box {
81
+ .ds-checkbox--l .ds-checkbox__box {
82
82
  width: var(--icon-l);
83
83
  height: var(--icon-l);
84
84
  }
85
85
 
86
- .ds-checkbox--large .ds-checkbox__label {
86
+ .ds-checkbox--l .ds-checkbox__label {
87
87
  font-size: var(--font-size-p1);
88
88
  }
@@ -5,7 +5,7 @@ import './Checkbox.css';
5
5
  export function Checkbox({
6
6
  checked = false,
7
7
  onChange,
8
- size = 'medium',
8
+ size = 'm',
9
9
  disabled = false,
10
10
  label,
11
11
  id,
@@ -58,33 +58,48 @@
58
58
  }
59
59
 
60
60
  /* Sizes */
61
- .ds-input--small {
61
+ .ds-input--xs {
62
+ height: var(--height-xs);
63
+ padding: 0 calc(var(--height-xs) / 4);
64
+ font-size: var(--font-size-p3);
65
+ border-radius: var(--radius-xs);
66
+ }
67
+
68
+ .ds-input--s {
62
69
  height: var(--height-s);
63
70
  padding: 0 calc(var(--height-s) / 4);
64
71
  font-size: var(--font-size-p2);
65
72
  border-radius: var(--radius-xs);
66
73
  }
67
74
 
68
- .ds-input--medium {
75
+ .ds-input--m {
69
76
  height: var(--height-m);
70
77
  padding: 0 calc(var(--height-m) / 4);
71
78
  font-size: var(--font-size-p1);
72
79
  border-radius: var(--radius-s);
73
80
  }
74
81
 
75
- .ds-input--with-icon.ds-input--small {
82
+ .ds-input--with-icon.ds-input--xs {
83
+ padding-left: calc(var(--height-xs) / 4 + 16px + var(--height-xs) / 4);
84
+ }
85
+
86
+ .ds-input--with-icon.ds-input--s {
76
87
  padding-left: calc(var(--height-s) / 4 + 20px + var(--height-s) / 4);
77
88
  }
78
89
 
79
- .ds-input--with-icon.ds-input--medium {
90
+ .ds-input--with-icon.ds-input--m {
80
91
  padding-left: calc(var(--height-m) / 4 + 24px + var(--height-m) / 4);
81
92
  }
82
93
 
83
- .ds-input--with-icon-right.ds-input--small {
94
+ .ds-input--with-icon-right.ds-input--xs {
95
+ padding-right: calc(var(--height-xs) / 4 + 16px + var(--height-xs) / 4);
96
+ }
97
+
98
+ .ds-input--with-icon-right.ds-input--s {
84
99
  padding-right: calc(var(--height-s) / 4 + 20px + var(--height-s) / 4);
85
100
  }
86
101
 
87
- .ds-input--with-icon-right.ds-input--medium {
102
+ .ds-input--with-icon-right.ds-input--m {
88
103
  padding-right: calc(var(--height-m) / 4 + 24px + var(--height-m) / 4);
89
104
  }
90
105
 
@@ -96,11 +111,15 @@
96
111
  pointer-events: none;
97
112
  }
98
113
 
99
- .ds-input-icon--small {
114
+ .ds-input-icon--xs {
115
+ left: 6px;
116
+ }
117
+
118
+ .ds-input-icon--s {
100
119
  left: 8px;
101
120
  }
102
121
 
103
- .ds-input-icon--medium {
122
+ .ds-input-icon--m {
104
123
  left: 11px;
105
124
  }
106
125
 
@@ -121,11 +140,15 @@
121
140
  color: var(--color-txt-icon-1);
122
141
  }
123
142
 
124
- .ds-input-icon-right--small {
143
+ .ds-input-icon-right--xs {
144
+ right: 6px;
145
+ }
146
+
147
+ .ds-input-icon-right--s {
125
148
  right: 8px;
126
149
  }
127
150
 
128
- .ds-input-icon-right--medium {
151
+ .ds-input-icon-right--m {
129
152
  right: 11px;
130
153
  }
131
154
 
@@ -9,7 +9,7 @@ export function Input({
9
9
  icon,
10
10
  iconRight,
11
11
  onIconRightClick,
12
- size = 'medium',
12
+ size = 'm',
13
13
  disabled,
14
14
  id,
15
15
  ...props
@@ -22,17 +22,17 @@
22
22
  margin: auto 0;
23
23
  }
24
24
 
25
- .ds-modal--small {
25
+ .ds-modal--s {
26
26
  width: 100%;
27
27
  max-width: 400px;
28
28
  }
29
29
 
30
- .ds-modal--medium {
30
+ .ds-modal--m {
31
31
  width: 100%;
32
32
  max-width: 600px;
33
33
  }
34
34
 
35
- .ds-modal--large {
35
+ .ds-modal--l {
36
36
  width: 100%;
37
37
  max-width: 900px;
38
38
  }
@@ -8,7 +8,7 @@ export function Modal({
8
8
  children,
9
9
  title,
10
10
  onClose,
11
- size = 'medium',
11
+ size = 'm',
12
12
  ...props
13
13
  }) {
14
14
  const modalRef = useRef(null);
@@ -0,0 +1,115 @@
1
+ .ds-radio {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ gap: var(--space-s);
5
+ cursor: pointer;
6
+ }
7
+
8
+ .ds-radio--disabled {
9
+ opacity: 0.5;
10
+ cursor: not-allowed;
11
+ }
12
+
13
+ .ds-radio__input {
14
+ position: absolute;
15
+ opacity: 0;
16
+ pointer-events: none;
17
+ }
18
+
19
+ .ds-radio__circle {
20
+ position: relative;
21
+ display: flex;
22
+ align-items: center;
23
+ justify-content: center;
24
+ background-color: var(--color-item-bg);
25
+ border: 1px solid var(--color-border);
26
+ transition: background-color var(--transition-normal), border-color var(--transition-normal);
27
+ flex-shrink: 0;
28
+ border-radius: 50%;
29
+ }
30
+
31
+ .ds-radio__input:checked + .ds-radio__circle {
32
+ background-color: var(--color-status-success);
33
+ border-color: var(--color-status-success);
34
+ }
35
+
36
+ .ds-radio__input:not(:checked) + .ds-radio__circle:hover {
37
+ border-color: var(--color-border-hover);
38
+ }
39
+
40
+ .ds-radio__dot {
41
+ background-color: var(--color-white);
42
+ border-radius: 50%;
43
+ opacity: 0;
44
+ transition: opacity var(--transition-normal);
45
+ }
46
+
47
+ .ds-radio__input:checked + .ds-radio__circle .ds-radio__dot {
48
+ opacity: 1;
49
+ }
50
+
51
+ .ds-radio__label {
52
+ font-size: var(--font-size-p1);
53
+ color: var(--color-txt-icon-1);
54
+ user-select: none;
55
+ }
56
+
57
+ /* Extra Small */
58
+ .ds-radio--xs .ds-radio__circle {
59
+ width: var(--icon-xs);
60
+ height: var(--icon-xs);
61
+ }
62
+
63
+ .ds-radio--xs .ds-radio__dot {
64
+ width: 6px;
65
+ height: 6px;
66
+ }
67
+
68
+ .ds-radio--xs .ds-radio__label {
69
+ font-size: var(--font-size-p3);
70
+ }
71
+
72
+ /* Small */
73
+ .ds-radio--s .ds-radio__circle {
74
+ width: var(--icon-s);
75
+ height: var(--icon-s);
76
+ }
77
+
78
+ .ds-radio--s .ds-radio__dot {
79
+ width: 8px;
80
+ height: 8px;
81
+ }
82
+
83
+ .ds-radio--s .ds-radio__label {
84
+ font-size: var(--font-size-p2);
85
+ }
86
+
87
+ /* Medium */
88
+ .ds-radio--m .ds-radio__circle {
89
+ width: var(--icon-m);
90
+ height: var(--icon-m);
91
+ }
92
+
93
+ .ds-radio--m .ds-radio__dot {
94
+ width: 10px;
95
+ height: 10px;
96
+ }
97
+
98
+ .ds-radio--m .ds-radio__label {
99
+ font-size: var(--font-size-p1);
100
+ }
101
+
102
+ /* Large */
103
+ .ds-radio--l .ds-radio__circle {
104
+ width: var(--icon-l);
105
+ height: var(--icon-l);
106
+ }
107
+
108
+ .ds-radio--l .ds-radio__dot {
109
+ width: 12px;
110
+ height: 12px;
111
+ }
112
+
113
+ .ds-radio--l .ds-radio__label {
114
+ font-size: var(--font-size-p1);
115
+ }
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import './Radio.css';
3
+
4
+ export function Radio({
5
+ checked = false,
6
+ onChange,
7
+ size = 'm',
8
+ disabled = false,
9
+ label,
10
+ name,
11
+ value,
12
+ id,
13
+ ...props
14
+ }) {
15
+ const radioId = id || `radio-${React.useId()}`;
16
+
17
+ const className = [
18
+ 'ds-radio',
19
+ `ds-radio--${size}`,
20
+ disabled && 'ds-radio--disabled',
21
+ ].filter(Boolean).join(' ');
22
+
23
+ return (
24
+ <label className={className} htmlFor={radioId}>
25
+ <input
26
+ type="radio"
27
+ id={radioId}
28
+ className="ds-radio__input"
29
+ checked={checked}
30
+ onChange={(e) => onChange?.(e.target.checked)}
31
+ disabled={disabled}
32
+ name={name}
33
+ value={value}
34
+ {...props}
35
+ />
36
+ <span className="ds-radio__circle">
37
+ <span className="ds-radio__dot" />
38
+ </span>
39
+ {label && <span className="ds-radio__label">{label}</span>}
40
+ </label>
41
+ );
42
+ }
@@ -60,14 +60,21 @@
60
60
  }
61
61
 
62
62
  /* Sizes */
63
- .ds-select-trigger--small {
63
+ .ds-select-trigger--xs {
64
+ height: var(--height-xs);
65
+ padding: 0 calc(var(--height-xs) / 4);
66
+ font-size: var(--font-size-p3);
67
+ border-radius: var(--radius-xs);
68
+ }
69
+
70
+ .ds-select-trigger--s {
64
71
  height: var(--height-s);
65
72
  padding: 0 calc(var(--height-s) / 4);
66
73
  font-size: var(--font-size-p2);
67
74
  border-radius: var(--radius-xs);
68
75
  }
69
76
 
70
- .ds-select-trigger--medium {
77
+ .ds-select-trigger--m {
71
78
  height: var(--height-m);
72
79
  padding: 0 calc(var(--height-m) / 4);
73
80
  font-size: var(--font-size-p1);
@@ -112,11 +119,11 @@
112
119
  bottom: calc(100% + 4px);
113
120
  }
114
121
 
115
- .ds-select-dropdown--small {
122
+ .ds-select-dropdown--s {
116
123
  border-radius: var(--radius-xs);
117
124
  }
118
125
 
119
- .ds-select-dropdown--medium {
126
+ .ds-select-dropdown--m {
120
127
  border-radius: var(--radius-s);
121
128
  }
122
129
 
@@ -134,13 +141,13 @@
134
141
  word-wrap: break-word;
135
142
  }
136
143
 
137
- .ds-select-option--small {
144
+ .ds-select-option--s {
138
145
  min-height: var(--height-s);
139
146
  padding: var(--space-xs) calc(var(--height-s) / 4);
140
147
  font-size: var(--font-size-p2);
141
148
  }
142
149
 
143
- .ds-select-option--medium {
150
+ .ds-select-option--m {
144
151
  min-height: var(--height-m);
145
152
  padding: var(--space-xs) calc(var(--height-m) / 4);
146
153
  font-size: var(--font-size-p1);
@@ -11,7 +11,7 @@ export function Select({
11
11
  placeholder = 'Select option',
12
12
  error,
13
13
  fullWidth = true,
14
- size = 'medium',
14
+ size = 'm',
15
15
  disabled = false,
16
16
  id,
17
17
  ...props
@@ -53,7 +53,7 @@ export function Select({
53
53
  }, [isOpen]);
54
54
 
55
55
  const selectedOption = options.find(opt => opt.value === value);
56
- const iconSize = size === 'small' ? iconSizes.s : iconSizes.m;
56
+ const iconSize = size === 'xs' ? iconSizes.xs : size === 'small' ? iconSizes.s : iconSizes.m;
57
57
 
58
58
  return (
59
59
  <div className={`ds-select-wrapper ${fullWidth ? 'ds-select-wrapper--full' : ''} ${disabled ? 'ds-select-wrapper--disabled' : ''}`}>
@@ -98,33 +98,49 @@
98
98
 
99
99
  /* Sizes */
100
100
 
101
+ /* Extra Small */
102
+ .ds-stepper--xs {
103
+ height: var(--height-xs);
104
+ }
105
+
106
+ .ds-stepper--xs .ds-stepper-button {
107
+ width: var(--height-xs);
108
+ padding: 0;
109
+ }
110
+
111
+ .ds-stepper--xs .ds-stepper-input {
112
+ font-size: var(--font-size-p3);
113
+ letter-spacing: var(--letter-spacing-p3);
114
+ padding: 0 var(--space-xs);
115
+ }
116
+
101
117
  /* Small */
102
- .ds-stepper--small {
118
+ .ds-stepper--s {
103
119
  height: var(--height-s);
104
120
  }
105
121
 
106
- .ds-stepper--small .ds-stepper-button {
122
+ .ds-stepper--s .ds-stepper-button {
107
123
  width: var(--height-s);
108
124
  padding: 0;
109
125
  }
110
126
 
111
- .ds-stepper--small .ds-stepper-input {
127
+ .ds-stepper--s .ds-stepper-input {
112
128
  font-size: var(--font-size-p2);
113
129
  letter-spacing: var(--letter-spacing-p2);
114
130
  padding: 0 var(--space-xs);
115
131
  }
116
132
 
117
133
  /* Medium */
118
- .ds-stepper--medium {
134
+ .ds-stepper--m {
119
135
  height: var(--height-m);
120
136
  }
121
137
 
122
- .ds-stepper--medium .ds-stepper-button {
138
+ .ds-stepper--m .ds-stepper-button {
123
139
  width: var(--height-m);
124
140
  padding: 0;
125
141
  }
126
142
 
127
- .ds-stepper--medium .ds-stepper-input {
143
+ .ds-stepper--m .ds-stepper-input {
128
144
  font-size: var(--font-size-p1);
129
145
  letter-spacing: var(--letter-spacing-p1);
130
146
  padding: 0 var(--space-s);
@@ -10,7 +10,7 @@ export function Stepper({
10
10
  min = 0,
11
11
  max = 100,
12
12
  step = 1,
13
- size = 'medium',
13
+ size = 'm',
14
14
  disabled = false,
15
15
  hint,
16
16
  error,
@@ -57,7 +57,7 @@ export function Stepper({
57
57
  disabled && 'ds-stepper--disabled',
58
58
  ].filter(Boolean).join(' ');
59
59
 
60
- const iconSize = size === 'small' ? iconSizes.s : iconSizes.m;
60
+ const iconSize = size === 'xs' ? iconSizes.xs : size === 'small' ? iconSizes.s : iconSizes.m;
61
61
 
62
62
  return (
63
63
  <div className={className}>
@@ -37,21 +37,28 @@
37
37
  }
38
38
 
39
39
  /* Sizes */
40
- .ds-tab--small {
40
+ .ds-tab--xs {
41
+ height: var(--height-xs);
42
+ padding: 0 calc(var(--height-xs) / 2);
43
+ font-size: var(--font-size-p3);
44
+ border-radius: var(--radius-xs);
45
+ }
46
+
47
+ .ds-tab--s {
41
48
  height: var(--height-s);
42
49
  padding: 0 calc(var(--height-s) / 2);
43
50
  font-size: var(--font-size-p2);
44
51
  border-radius: var(--radius-xs);
45
52
  }
46
53
 
47
- .ds-tab--medium {
54
+ .ds-tab--m {
48
55
  height: var(--height-m);
49
56
  padding: 0 calc(var(--height-m) / 2);
50
57
  font-size: var(--font-size-p1);
51
58
  border-radius: var(--radius-s);
52
59
  }
53
60
 
54
- .ds-tab--large {
61
+ .ds-tab--l {
55
62
  height: var(--height-l);
56
63
  padding: 0 calc(var(--height-l) / 2);
57
64
  font-size: var(--font-size-p1);
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import './Tabs.css';
3
3
 
4
- export function Tabs({ children, size = 'medium', variant = 'ghost', ...props }) {
4
+ export function Tabs({ children, size = 'm', variant = 'ghost', ...props }) {
5
5
  return (
6
6
  <div className="ds-tabs" role="tablist" {...props}>
7
7
  {React.Children.map(children, (child) => {
@@ -14,7 +14,7 @@ export function Tabs({ children, size = 'medium', variant = 'ghost', ...props })
14
14
  );
15
15
  }
16
16
 
17
- export function Tab({ children, selected = false, onClick, size = 'medium', variant = 'ghost', disabled = false, icon, href, ...props }) {
17
+ export function Tab({ children, selected = false, onClick, size = 'm', variant = 'ghost', disabled = false, icon, href, ...props }) {
18
18
  const isIconOnly = icon && !children;
19
19
 
20
20
  const className = [
@@ -87,13 +87,19 @@
87
87
  }
88
88
 
89
89
  /* Sizes */
90
- .ds-textarea--small {
90
+ .ds-textarea--xs {
91
+ padding: var(--space-xs);
92
+ font-size: var(--font-size-p3);
93
+ border-radius: var(--radius-xs);
94
+ }
95
+
96
+ .ds-textarea--s {
91
97
  padding: var(--space-xs) var(--space-s);
92
98
  font-size: var(--font-size-p2);
93
99
  border-radius: var(--radius-xs);
94
100
  }
95
101
 
96
- .ds-textarea--medium {
102
+ .ds-textarea--m {
97
103
  padding: var(--space-s);
98
104
  font-size: var(--font-size-p1);
99
105
  border-radius: var(--radius-s);
@@ -6,7 +6,7 @@ export function Textarea({
6
6
  error,
7
7
  hint,
8
8
  fullWidth = true,
9
- size = 'medium',
9
+ size = 'm',
10
10
  disabled,
11
11
  id,
12
12
  resize = true,
@@ -70,64 +70,64 @@
70
70
  }
71
71
 
72
72
  /* Small */
73
- .ds-toggle--small .ds-toggle__track {
73
+ .ds-toggle--s .ds-toggle__track {
74
74
  width: calc(var(--icon-s) * 1.75);
75
75
  height: var(--icon-s);
76
76
  border-radius: calc(var(--icon-s) / 2);
77
77
  padding: 2px;
78
78
  }
79
79
 
80
- .ds-toggle--small .ds-toggle__thumb {
80
+ .ds-toggle--s .ds-toggle__thumb {
81
81
  width: calc(var(--icon-s) - 4px);
82
82
  height: calc(var(--icon-s) - 4px);
83
83
  }
84
84
 
85
- .ds-toggle--small .ds-toggle__input:checked + .ds-toggle__track .ds-toggle__thumb {
85
+ .ds-toggle--s .ds-toggle__input:checked + .ds-toggle__track .ds-toggle__thumb {
86
86
  transform: translateX(calc(var(--icon-s) * 0.75));
87
87
  }
88
88
 
89
- .ds-toggle--small .ds-toggle__label {
89
+ .ds-toggle--s .ds-toggle__label {
90
90
  font-size: var(--font-size-p2);
91
91
  }
92
92
 
93
93
  /* Medium */
94
- .ds-toggle--medium .ds-toggle__track {
94
+ .ds-toggle--m .ds-toggle__track {
95
95
  width: calc(var(--icon-m) * 1.75);
96
96
  height: var(--icon-m);
97
97
  border-radius: calc(var(--icon-m) / 2);
98
98
  padding: 2px;
99
99
  }
100
100
 
101
- .ds-toggle--medium .ds-toggle__thumb {
101
+ .ds-toggle--m .ds-toggle__thumb {
102
102
  width: calc(var(--icon-m) - 4px);
103
103
  height: calc(var(--icon-m) - 4px);
104
104
  }
105
105
 
106
- .ds-toggle--medium .ds-toggle__input:checked + .ds-toggle__track .ds-toggle__thumb {
106
+ .ds-toggle--m .ds-toggle__input:checked + .ds-toggle__track .ds-toggle__thumb {
107
107
  transform: translateX(calc(var(--icon-m) * 0.75));
108
108
  }
109
109
 
110
- .ds-toggle--medium .ds-toggle__label {
110
+ .ds-toggle--m .ds-toggle__label {
111
111
  font-size: var(--font-size-p1);
112
112
  }
113
113
 
114
114
  /* Large */
115
- .ds-toggle--large .ds-toggle__track {
115
+ .ds-toggle--l .ds-toggle__track {
116
116
  width: calc(var(--icon-l) * 1.75);
117
117
  height: var(--icon-l);
118
118
  border-radius: calc(var(--icon-l) / 2);
119
119
  padding: 3px;
120
120
  }
121
121
 
122
- .ds-toggle--large .ds-toggle__thumb {
122
+ .ds-toggle--l .ds-toggle__thumb {
123
123
  width: calc(var(--icon-l) - 6px);
124
124
  height: calc(var(--icon-l) - 6px);
125
125
  }
126
126
 
127
- .ds-toggle--large .ds-toggle__input:checked + .ds-toggle__track .ds-toggle__thumb {
127
+ .ds-toggle--l .ds-toggle__input:checked + .ds-toggle__track .ds-toggle__thumb {
128
128
  transform: translateX(calc(var(--icon-l) * 0.75));
129
129
  }
130
130
 
131
- .ds-toggle--large .ds-toggle__label {
131
+ .ds-toggle--l .ds-toggle__label {
132
132
  font-size: var(--font-size-p1);
133
133
  }
@@ -4,7 +4,7 @@ import './Toggle.css';
4
4
  export function Toggle({
5
5
  checked = false,
6
6
  onChange,
7
- size = 'medium',
7
+ size = 'm',
8
8
  disabled = false,
9
9
  label,
10
10
  id,
package/src/index.js CHANGED
@@ -21,3 +21,4 @@ export { CodeAccordion } from './components/CodeAccordion';
21
21
  export { Tooltip } from './components/Tooltip';
22
22
  export { Toggle } from './components/Toggle';
23
23
  export { Checkbox } from './components/Checkbox';
24
+ export { Radio } from './components/Radio';
@@ -171,6 +171,7 @@
171
171
  /* =====================================
172
172
  * 5) Component heights
173
173
  * ===================================*/
174
+ --height-xs: 24px;
174
175
  --height-s: 32px;
175
176
  --height-m: 44px;
176
177
  --height-l: 56px;