@donkit-ai/design-system 0.3.5 → 0.4.3

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 (45) hide show
  1. package/dist/index.cjs.js +22 -0
  2. package/dist/index.es.js +1105 -0
  3. package/dist/tokens.css +1 -0
  4. package/package.json +15 -9
  5. package/src/components/Accordion.css +0 -70
  6. package/src/components/Accordion.jsx +0 -42
  7. package/src/components/Alert.css +0 -93
  8. package/src/components/Alert.jsx +0 -47
  9. package/src/components/Badge.css +0 -52
  10. package/src/components/Badge.jsx +0 -25
  11. package/src/components/Button.css +0 -103
  12. package/src/components/Button.jsx +0 -80
  13. package/src/components/Card.css +0 -46
  14. package/src/components/Card.jsx +0 -70
  15. package/src/components/Checkbox.css +0 -88
  16. package/src/components/Checkbox.jsx +0 -47
  17. package/src/components/Code.css +0 -30
  18. package/src/components/Code.jsx +0 -27
  19. package/src/components/CodeAccordion.css +0 -80
  20. package/src/components/CodeAccordion.jsx +0 -42
  21. package/src/components/Input.css +0 -163
  22. package/src/components/Input.jsx +0 -55
  23. package/src/components/Link.css +0 -18
  24. package/src/components/Link.jsx +0 -21
  25. package/src/components/Modal.css +0 -70
  26. package/src/components/Modal.jsx +0 -72
  27. package/src/components/Radio.css +0 -115
  28. package/src/components/Radio.jsx +0 -42
  29. package/src/components/Select.css +0 -167
  30. package/src/components/Select.jsx +0 -118
  31. package/src/components/Stepper.css +0 -183
  32. package/src/components/Stepper.jsx +0 -104
  33. package/src/components/Tabs.css +0 -87
  34. package/src/components/Tabs.jsx +0 -81
  35. package/src/components/Textarea.css +0 -116
  36. package/src/components/Textarea.jsx +0 -41
  37. package/src/components/Toggle.css +0 -133
  38. package/src/components/Toggle.jsx +0 -38
  39. package/src/components/Tooltip.css +0 -134
  40. package/src/components/Tooltip.jsx +0 -158
  41. package/src/components/Typography.css +0 -74
  42. package/src/components/Typography.jsx +0 -42
  43. package/src/index.js +0 -24
  44. package/src/styles/iconSizes.js +0 -15
  45. package/src/styles/tokens.css +0 -298
@@ -1,70 +0,0 @@
1
- import React from 'react';
2
- import './Card.css';
3
-
4
- export function Card({
5
- children,
6
- padding = 'm',
7
- variant = 'info',
8
- hover = false, // deprecated, use variant="interactive"
9
- onClick,
10
- href,
11
- disabled = false,
12
- ...props
13
- }) {
14
- const cardVariant = hover ? 'interactive' : variant;
15
- const isInteractive = cardVariant === 'interactive' || onClick || href;
16
-
17
- const className = [
18
- 'ds-card',
19
- `ds-card--${padding}`,
20
- isInteractive && 'ds-card--interactive',
21
- ].filter(Boolean).join(' ');
22
-
23
- // Render as link if href is provided
24
- if (href) {
25
- const handleClick = (e) => {
26
- if (disabled) {
27
- e.preventDefault();
28
- return;
29
- }
30
- // При Cmd/Ctrl+Click или Middle Click — пусть браузер откроет новую вкладку
31
- if (e.metaKey || e.ctrlKey || e.button === 1) {
32
- return;
33
- }
34
- // Обычный клик — preventDefault и вызов onClick
35
- e.preventDefault();
36
- onClick?.(e);
37
- };
38
-
39
- return (
40
- <a
41
- className={className}
42
- href={disabled ? undefined : href}
43
- onClick={handleClick}
44
- aria-disabled={disabled ? 'true' : undefined}
45
- {...props}
46
- >
47
- {children}
48
- </a>
49
- );
50
- }
51
-
52
- // Render as button if interactive with onClick
53
- const Element = isInteractive && onClick ? 'button' : 'div';
54
- const interactiveProps = isInteractive && onClick ? {
55
- type: 'button',
56
- onClick,
57
- disabled,
58
- } : {};
59
-
60
- return (
61
- <Element
62
- className={className}
63
- role={isInteractive && !onClick ? 'article' : undefined}
64
- {...interactiveProps}
65
- {...props}
66
- >
67
- {children}
68
- </Element>
69
- );
70
- }
@@ -1,88 +0,0 @@
1
- .ds-checkbox {
2
- display: inline-flex;
3
- align-items: center;
4
- gap: var(--space-s);
5
- cursor: pointer;
6
- }
7
-
8
- .ds-checkbox--disabled {
9
- opacity: 0.5;
10
- cursor: not-allowed;
11
- }
12
-
13
- .ds-checkbox__input {
14
- position: absolute;
15
- opacity: 0;
16
- pointer-events: none;
17
- }
18
-
19
- .ds-checkbox__box {
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: 4px;
29
- }
30
-
31
- .ds-checkbox__input:checked + .ds-checkbox__box {
32
- background-color: var(--color-status-success);
33
- border-color: var(--color-status-success);
34
- }
35
-
36
- .ds-checkbox__input:not(:checked) + .ds-checkbox__box:hover {
37
- border-color: var(--color-border-hover);
38
- }
39
-
40
- .ds-checkbox__icon {
41
- color: var(--color-white);
42
- }
43
-
44
- .ds-checkbox__label {
45
- font-size: var(--font-size-p1);
46
- color: var(--color-txt-icon-1);
47
- user-select: none;
48
- }
49
-
50
- /* Extra Small */
51
- .ds-checkbox--xs .ds-checkbox__box {
52
- width: var(--icon-xs);
53
- height: var(--icon-xs);
54
- }
55
-
56
- .ds-checkbox--xs .ds-checkbox__label {
57
- font-size: var(--font-size-p3);
58
- }
59
-
60
- /* Small */
61
- .ds-checkbox--s .ds-checkbox__box {
62
- width: var(--icon-s);
63
- height: var(--icon-s);
64
- }
65
-
66
- .ds-checkbox--s .ds-checkbox__label {
67
- font-size: var(--font-size-p2);
68
- }
69
-
70
- /* Medium */
71
- .ds-checkbox--m .ds-checkbox__box {
72
- width: var(--icon-m);
73
- height: var(--icon-m);
74
- }
75
-
76
- .ds-checkbox--m .ds-checkbox__label {
77
- font-size: var(--font-size-p1);
78
- }
79
-
80
- /* Large */
81
- .ds-checkbox--l .ds-checkbox__box {
82
- width: var(--icon-l);
83
- height: var(--icon-l);
84
- }
85
-
86
- .ds-checkbox--l .ds-checkbox__label {
87
- font-size: var(--font-size-p1);
88
- }
@@ -1,47 +0,0 @@
1
- import React from 'react';
2
- import { Check } from 'lucide-react';
3
- import './Checkbox.css';
4
-
5
- export function Checkbox({
6
- checked = false,
7
- onChange,
8
- size = 'm',
9
- disabled = false,
10
- label,
11
- id,
12
- ...props
13
- }) {
14
- const checkboxId = id || `checkbox-${React.useId()}`;
15
-
16
- const className = [
17
- 'ds-checkbox',
18
- `ds-checkbox--${size}`,
19
- disabled && 'ds-checkbox--disabled',
20
- ].filter(Boolean).join(' ');
21
-
22
- const iconSize = size === 'xs' ? 10 : size === 'small' ? 14 : size === 'large' ? 20 : 16;
23
-
24
- return (
25
- <label className={className} htmlFor={checkboxId}>
26
- <input
27
- type="checkbox"
28
- id={checkboxId}
29
- className="ds-checkbox__input"
30
- checked={checked}
31
- onChange={(e) => onChange?.(e.target.checked)}
32
- disabled={disabled}
33
- {...props}
34
- />
35
- <span className="ds-checkbox__box">
36
- {checked && (
37
- <Check
38
- size={iconSize}
39
- strokeWidth={2.5}
40
- className="ds-checkbox__icon"
41
- />
42
- )}
43
- </span>
44
- {label && <span className="ds-checkbox__label">{label}</span>}
45
- </label>
46
- );
47
- }
@@ -1,30 +0,0 @@
1
- .ds-code-inline {
2
- font-family: 'Fira Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
3
- font-size: 0.9em;
4
- background-color: var(--color-code-bg);
5
- color: var(--color-txt-icon-1);
6
- padding: 2px 6px;
7
- border-radius: var(--radius-s);
8
- white-space: nowrap;
9
- }
10
-
11
- .ds-code-block {
12
- font-family: 'Fira Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
13
- font-size: var(--font-size-p2);
14
- background-color: var(--color-code-bg);
15
- color: var(--color-txt-icon-1);
16
- padding: var(--space-s);
17
- border-radius: var(--radius-s);
18
- overflow-x: auto;
19
- line-height: 1.6;
20
- margin: 0;
21
- }
22
-
23
- .ds-code-block code {
24
- background: none;
25
- border: none;
26
- padding: 0;
27
- font-family: inherit;
28
- font-size: inherit;
29
- color: inherit;
30
- }
@@ -1,27 +0,0 @@
1
- import React from 'react';
2
- import { CodeAccordion } from './CodeAccordion';
3
- import './Code.css';
4
-
5
- export function Code({ children, block = false, collapsible = false, title = 'Code', defaultExpanded = false, ...props }) {
6
- if (block) {
7
- if (collapsible) {
8
- return (
9
- <CodeAccordion title={title} defaultExpanded={defaultExpanded} {...props}>
10
- {children}
11
- </CodeAccordion>
12
- );
13
- }
14
-
15
- return (
16
- <pre className="ds-code-block" {...props}>
17
- <code>{children}</code>
18
- </pre>
19
- );
20
- }
21
-
22
- return (
23
- <code className="ds-code-inline" {...props}>
24
- {children}
25
- </code>
26
- );
27
- }
@@ -1,80 +0,0 @@
1
- .ds-code-accordion {
2
- border-radius: var(--radius-s);
3
- overflow: hidden;
4
- }
5
-
6
- .ds-code-accordion__header {
7
- display: flex;
8
- align-items: center;
9
- justify-content: space-between;
10
- width: 100%;
11
- background-color: var(--color-item-bg);
12
- border: none;
13
- color: var(--color-txt-icon-1);
14
- font-size: var(--font-size-p1);
15
- font-family: inherit;
16
- cursor: pointer;
17
- transition: background-color var(--transition-normal);
18
- }
19
-
20
- .ds-code-accordion__header:hover {
21
- background-color: var(--color-item-bg-hover);
22
- }
23
-
24
- .ds-code-accordion__title {
25
- font-weight: 400;
26
- }
27
-
28
- .ds-code-accordion__icon {
29
- flex-shrink: 0;
30
- color: var(--color-txt-icon-2);
31
- transition: transform var(--transition-normal);
32
- }
33
-
34
- .ds-code-accordion__icon--expanded {
35
- transform: rotate(180deg);
36
- }
37
-
38
- .ds-code-accordion__content {
39
- font-family: 'Fira Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
40
- font-size: var(--font-size-p2);
41
- background-color: var(--color-code-bg);
42
- color: var(--color-txt-icon-1);
43
- overflow-x: auto;
44
- line-height: 1.6;
45
- margin: 0;
46
- }
47
-
48
- /* Sizes */
49
- .ds-code-accordion--s .ds-code-accordion__header {
50
- padding: var(--space-xs);
51
- }
52
-
53
- .ds-code-accordion--s .ds-code-accordion__content {
54
- padding: var(--space-xs);
55
- }
56
-
57
- .ds-code-accordion--m .ds-code-accordion__header {
58
- padding: var(--space-s);
59
- }
60
-
61
- .ds-code-accordion--m .ds-code-accordion__content {
62
- padding: var(--space-s);
63
- }
64
-
65
- .ds-code-accordion--l .ds-code-accordion__header {
66
- padding: var(--space-m);
67
- }
68
-
69
- .ds-code-accordion--l .ds-code-accordion__content {
70
- padding: var(--space-m);
71
- }
72
-
73
- .ds-code-accordion__content code {
74
- background: none;
75
- border: none;
76
- padding: 0;
77
- font-family: inherit;
78
- font-size: inherit;
79
- color: inherit;
80
- }
@@ -1,42 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { ChevronDown } from 'lucide-react';
3
- import { iconSizes } from '../styles/iconSizes';
4
- import './CodeAccordion.css';
5
-
6
- export function CodeAccordion({
7
- children,
8
- title = 'Code',
9
- defaultExpanded = false,
10
- padding = 's',
11
- ...props
12
- }) {
13
- const [isExpanded, setIsExpanded] = useState(defaultExpanded);
14
-
15
- const className = [
16
- 'ds-code-accordion',
17
- `ds-code-accordion--${padding}`,
18
- ].filter(Boolean).join(' ');
19
-
20
- return (
21
- <div className={className}>
22
- <button
23
- type="button"
24
- className="ds-code-accordion__header"
25
- onClick={() => setIsExpanded(!isExpanded)}
26
- aria-expanded={isExpanded}
27
- >
28
- <span className="ds-code-accordion__title">{title}</span>
29
- <ChevronDown
30
- size={iconSizes.s}
31
- strokeWidth={1.5}
32
- className={`ds-code-accordion__icon ${isExpanded ? 'ds-code-accordion__icon--expanded' : ''}`}
33
- />
34
- </button>
35
- {isExpanded && (
36
- <pre className="ds-code-accordion__content" {...props}>
37
- <code>{children}</code>
38
- </pre>
39
- )}
40
- </div>
41
- );
42
- }
@@ -1,163 +0,0 @@
1
- .ds-input-wrapper {
2
- display: flex;
3
- flex-direction: column;
4
- gap: var(--space-xs);
5
- }
6
-
7
- .ds-input-wrapper--full {
8
- width: 100%;
9
- }
10
-
11
- .ds-input-wrapper--disabled {
12
- opacity: 0.5;
13
- cursor: not-allowed;
14
- }
15
-
16
- .ds-input-label {
17
- font-size: var(--font-size-p2);
18
- font-weight: 400;
19
- color: var(--color-txt-icon-1);
20
- }
21
-
22
- .ds-input-container {
23
- position: relative;
24
- display: flex;
25
- align-items: center;
26
- }
27
-
28
- .ds-input {
29
- width: 100%;
30
- font-family: inherit;
31
- color: var(--color-txt-icon-1);
32
- background-color: transparent;
33
- border: 1px solid var(--color-border);
34
- transition: border-color var(--transition-normal);
35
- line-height: 1.5;
36
- }
37
-
38
- .ds-input::placeholder {
39
- color: var(--color-txt-icon-2);
40
- }
41
-
42
- .ds-input:hover:not(:disabled) {
43
- border-color: var(--color-border-hover);
44
- }
45
-
46
- .ds-input:focus,
47
- .ds-input:active {
48
- outline: none;
49
- border-color: var(--color-border-hover);
50
- }
51
-
52
- .ds-input:disabled {
53
- cursor: not-allowed;
54
- }
55
-
56
- .ds-input--error {
57
- border-color: var(--color-error);
58
- }
59
-
60
- /* Sizes */
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 {
69
- height: var(--height-s);
70
- padding: 0 calc(var(--height-s) / 4);
71
- font-size: var(--font-size-p2);
72
- border-radius: var(--radius-xs);
73
- }
74
-
75
- .ds-input--m {
76
- height: var(--height-m);
77
- padding: 0 calc(var(--height-m) / 4);
78
- font-size: var(--font-size-p1);
79
- border-radius: var(--radius-s);
80
- }
81
-
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 {
87
- padding-left: calc(var(--height-s) / 4 + 20px + var(--height-s) / 4);
88
- }
89
-
90
- .ds-input--with-icon.ds-input--m {
91
- padding-left: calc(var(--height-m) / 4 + 24px + var(--height-m) / 4);
92
- }
93
-
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 {
99
- padding-right: calc(var(--height-s) / 4 + 20px + var(--height-s) / 4);
100
- }
101
-
102
- .ds-input--with-icon-right.ds-input--m {
103
- padding-right: calc(var(--height-m) / 4 + 24px + var(--height-m) / 4);
104
- }
105
-
106
- .ds-input-icon {
107
- position: absolute;
108
- display: flex;
109
- align-items: center;
110
- color: var(--color-txt-icon-2);
111
- pointer-events: none;
112
- }
113
-
114
- .ds-input-icon--xs {
115
- left: 6px;
116
- }
117
-
118
- .ds-input-icon--s {
119
- left: 8px;
120
- }
121
-
122
- .ds-input-icon--m {
123
- left: 11px;
124
- }
125
-
126
- .ds-input-icon-right {
127
- position: absolute;
128
- display: flex;
129
- align-items: center;
130
- justify-content: center;
131
- background: none;
132
- border: none;
133
- color: var(--color-txt-icon-2);
134
- cursor: pointer;
135
- transition: color var(--transition-normal);
136
- padding: 0;
137
- }
138
-
139
- .ds-input-icon-right:hover {
140
- color: var(--color-txt-icon-1);
141
- }
142
-
143
- .ds-input-icon-right--xs {
144
- right: 6px;
145
- }
146
-
147
- .ds-input-icon-right--s {
148
- right: 8px;
149
- }
150
-
151
- .ds-input-icon-right--m {
152
- right: 11px;
153
- }
154
-
155
- .ds-input-hint {
156
- font-size: var(--font-size-p2);
157
- color: var(--color-txt-icon-2);
158
- }
159
-
160
- .ds-input-error {
161
- font-size: var(--font-size-p2);
162
- color: var(--color-error);
163
- }
@@ -1,55 +0,0 @@
1
- import React from 'react';
2
- import './Input.css';
3
-
4
- export function Input({
5
- label,
6
- error,
7
- hint,
8
- fullWidth = true,
9
- icon,
10
- iconRight,
11
- onIconRightClick,
12
- size = 'm',
13
- disabled,
14
- id,
15
- ...props
16
- }) {
17
- const inputId = id || `input-${React.useId()}`;
18
- const hintId = hint ? `${inputId}-hint` : undefined;
19
- const errorId = error ? `${inputId}-error` : undefined;
20
- const describedBy = errorId || hintId;
21
-
22
- return (
23
- <div className={`ds-input-wrapper ${fullWidth ? 'ds-input-wrapper--full' : ''} ${disabled ? 'ds-input-wrapper--disabled' : ''}`}>
24
- {label && (
25
- <label className="ds-input-label" htmlFor={inputId}>
26
- {label}
27
- </label>
28
- )}
29
- <div className="ds-input-container">
30
- {icon && <span className={`ds-input-icon ds-input-icon--${size}`} aria-hidden="true">{icon}</span>}
31
- <input
32
- id={inputId}
33
- className={`ds-input ds-input--${size} ${icon ? 'ds-input--with-icon' : ''} ${iconRight ? 'ds-input--with-icon-right' : ''} ${error ? 'ds-input--error' : ''}`}
34
- disabled={disabled}
35
- aria-invalid={error ? 'true' : 'false'}
36
- aria-describedby={describedBy}
37
- {...props}
38
- />
39
- {iconRight && (
40
- <button
41
- type="button"
42
- className={`ds-input-icon-right ds-input-icon-right--${size}`}
43
- onClick={onIconRightClick}
44
- tabIndex={-1}
45
- aria-label="Toggle visibility"
46
- >
47
- {iconRight}
48
- </button>
49
- )}
50
- </div>
51
- {hint && !error && <span id={hintId} className="ds-input-hint">{hint}</span>}
52
- {error && <span id={errorId} className="ds-input-error" role="alert">{error}</span>}
53
- </div>
54
- );
55
- }
@@ -1,18 +0,0 @@
1
- .ds-link {
2
- color: var(--color-accent);
3
- text-decoration: none;
4
- cursor: pointer;
5
- transition: color var(--transition-fast), text-decoration var(--transition-fast);
6
- font-size: inherit;
7
- font-weight: inherit;
8
- line-height: inherit;
9
- }
10
-
11
- .ds-link:hover {
12
- color: var(--color-accent-hover);
13
- text-decoration: underline;
14
- }
15
-
16
- .ds-link:active {
17
- color: var(--color-accent-hover);
18
- }
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import './Link.css';
3
-
4
- export function Link({ href, children, onClick, target, rel, ...props }) {
5
- // Add security attributes for external links
6
- const isExternal = target === '_blank';
7
- const secureRel = isExternal ? (rel ? `${rel} noopener noreferrer` : 'noopener noreferrer') : rel;
8
-
9
- return (
10
- <a
11
- href={href}
12
- className="ds-link"
13
- onClick={onClick}
14
- target={target}
15
- rel={secureRel}
16
- {...props}
17
- >
18
- {children}
19
- </a>
20
- );
21
- }