draft-components 3.4.0 → 3.6.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.
- package/css/draft-components.css +65 -38
- package/dist/components/button/button.css +19 -9
- package/dist/components/empty-state/empty-state.css +4 -0
- package/dist/components/empty-state/empty-state.d.ts +2 -1
- package/dist/components/empty-state/empty-state.js +5 -2
- package/dist/components/filtered-search/filter-value-list.css +1 -1
- package/dist/components/filtered-search/filtered-search.css +1 -1
- package/dist/components/search-select/search-select.css +1 -0
- package/dist/components/search-select/search-select.d.ts +2 -1
- package/dist/components/search-select/search-select.js +2 -2
- package/dist/components/segmented-control/segmented-control.css +11 -11
- package/dist/components/table/table.css +2 -2
- package/dist/components/text-input/text-input.css +27 -15
- package/dist/components/text-input/text-input.d.ts +2 -0
- package/dist/components/text-input/text-input.js +2 -1
- package/package.json +38 -37
package/css/draft-components.css
CHANGED
|
@@ -953,6 +953,8 @@
|
|
|
953
953
|
.dc-button {
|
|
954
954
|
--dc-button-height: 36px;
|
|
955
955
|
--dc-button-radius: 9px;
|
|
956
|
+
--dc-button-padding-left: 16px;
|
|
957
|
+
--dc-button-padding-right: 16px;
|
|
956
958
|
--dc-button-text-color: var(--dc-button-gray-text-color);
|
|
957
959
|
--dc-button-border-color: var(--dc-button-gray-border-color);
|
|
958
960
|
--dc-button-bg: var(--dc-button-gray-bg);
|
|
@@ -967,7 +969,7 @@
|
|
|
967
969
|
place-items: center;
|
|
968
970
|
justify-content: center;
|
|
969
971
|
height: var(--dc-button-height);
|
|
970
|
-
padding: 0
|
|
972
|
+
padding: 0 var(--dc-button-padding-right) 0 var(--dc-button-padding-left);
|
|
971
973
|
font: 500 var(--dc-text-sm);
|
|
972
974
|
color: var(--dc-button-text-color);
|
|
973
975
|
text-align: center;
|
|
@@ -1043,6 +1045,14 @@
|
|
|
1043
1045
|
grid-template-columns: repeat(3, auto);
|
|
1044
1046
|
}
|
|
1045
1047
|
|
|
1048
|
+
.dc-button_has_icon-left {
|
|
1049
|
+
padding-left: calc(var(--dc-button-padding-left) / 1.6);
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
.dc-button_has_icon-right {
|
|
1053
|
+
padding-right: calc(var(--dc-button-padding-right) / 1.6);
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1046
1056
|
.dc-button_style_tinted {
|
|
1047
1057
|
--dc-button-text-color: var(--dc-button-gray-tinted-text-color);
|
|
1048
1058
|
--dc-button-bg: var(--dc-button-gray-tinted-bg);
|
|
@@ -1064,36 +1074,36 @@
|
|
|
1064
1074
|
.dc-button_xs {
|
|
1065
1075
|
--dc-button-height: 28px;
|
|
1066
1076
|
--dc-button-radius: 7px;
|
|
1077
|
+
--dc-button-padding-left: 8px;
|
|
1078
|
+
--dc-button-padding-right: 8px;
|
|
1067
1079
|
|
|
1068
|
-
padding-right: 8px;
|
|
1069
|
-
padding-left: 8px;
|
|
1070
1080
|
font: 500 var(--dc-text-xs);
|
|
1071
1081
|
}
|
|
1072
1082
|
|
|
1073
1083
|
.dc-button_sm {
|
|
1074
1084
|
--dc-button-height: 32px;
|
|
1075
1085
|
--dc-button-radius: 8px;
|
|
1086
|
+
--dc-button-padding-left: 12px;
|
|
1087
|
+
--dc-button-padding-right: 12px;
|
|
1076
1088
|
|
|
1077
|
-
padding-right: 12px;
|
|
1078
|
-
padding-left: 12px;
|
|
1079
1089
|
font: 500 var(--dc-text-sm);
|
|
1080
1090
|
}
|
|
1081
1091
|
|
|
1082
1092
|
.dc-button_lg {
|
|
1083
1093
|
--dc-button-height: 40px;
|
|
1084
1094
|
--dc-button-radius: 10px;
|
|
1095
|
+
--dc-button-padding-left: 18px;
|
|
1096
|
+
--dc-button-padding-right: 18px;
|
|
1085
1097
|
|
|
1086
|
-
padding-right: 18px;
|
|
1087
|
-
padding-left: 18px;
|
|
1088
1098
|
font: 500 var(--dc-text-md);
|
|
1089
1099
|
}
|
|
1090
1100
|
|
|
1091
1101
|
.dc-button_xl {
|
|
1092
1102
|
--dc-button-height: 44px;
|
|
1093
1103
|
--dc-button-radius: 11px;
|
|
1104
|
+
--dc-button-padding-left: 20px;
|
|
1105
|
+
--dc-button-padding-right: 20px;
|
|
1094
1106
|
|
|
1095
|
-
padding-right: 20px;
|
|
1096
|
-
padding-left: 20px;
|
|
1097
1107
|
font: 500 var(--dc-text-md);
|
|
1098
1108
|
}
|
|
1099
1109
|
|
|
@@ -1687,14 +1697,17 @@
|
|
|
1687
1697
|
border-radius: var(--dc-input-border-radius);
|
|
1688
1698
|
}
|
|
1689
1699
|
|
|
1690
|
-
.dc-text-
|
|
1691
|
-
|
|
1692
|
-
|
|
1700
|
+
.dc-text-input_full-width {
|
|
1701
|
+
display: flex;
|
|
1702
|
+
width: 100%;
|
|
1693
1703
|
}
|
|
1694
1704
|
|
|
1695
|
-
.dc-text-
|
|
1696
|
-
border-
|
|
1697
|
-
|
|
1705
|
+
.dc-text-input_invalid {
|
|
1706
|
+
border-color: var(--dc-input-border-color-error);
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
.dc-text-input_disabled {
|
|
1710
|
+
opacity: var(--dc-disabled-state-opacity);
|
|
1698
1711
|
}
|
|
1699
1712
|
|
|
1700
1713
|
.dc-text-input_focused {
|
|
@@ -1702,17 +1715,14 @@
|
|
|
1702
1715
|
box-shadow: 0 0 0 1px var(--dc-input-focus-ring-color);
|
|
1703
1716
|
}
|
|
1704
1717
|
|
|
1705
|
-
.dc-text-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
.dc-text-input_invalid {
|
|
1710
|
-
border-color: var(--dc-input-border-color-error);
|
|
1718
|
+
.dc-text-input > :first-child {
|
|
1719
|
+
border-top-left-radius: calc(var(--dc-input-border-radius) - 1px);
|
|
1720
|
+
border-bottom-left-radius: calc(var(--dc-input-border-radius) - 1px);
|
|
1711
1721
|
}
|
|
1712
1722
|
|
|
1713
|
-
.dc-text-
|
|
1714
|
-
|
|
1715
|
-
|
|
1723
|
+
.dc-text-input > :last-child {
|
|
1724
|
+
border-top-right-radius: calc(var(--dc-input-border-radius) - 1px);
|
|
1725
|
+
border-bottom-right-radius: calc(var(--dc-input-border-radius) - 1px);
|
|
1716
1726
|
}
|
|
1717
1727
|
|
|
1718
1728
|
.dc-text-input_sm {
|
|
@@ -1758,6 +1768,18 @@
|
|
|
1758
1768
|
outline: none;
|
|
1759
1769
|
}
|
|
1760
1770
|
|
|
1771
|
+
.dc-text-input_align_left .dc-text-input__native {
|
|
1772
|
+
text-align: left;
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
.dc-text-input_align_right .dc-text-input__native {
|
|
1776
|
+
text-align: right;
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
.dc-text-input_align_center .dc-text-input__native {
|
|
1780
|
+
text-align: center;
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1761
1783
|
.dc-text-input__slot-left,
|
|
1762
1784
|
.dc-text-input__slot-right {
|
|
1763
1785
|
box-sizing: border-box;
|
|
@@ -2158,6 +2180,7 @@
|
|
|
2158
2180
|
|
|
2159
2181
|
.dc-search-select:focus {
|
|
2160
2182
|
border-color: var(--dc-search-select-focus-ring-color);
|
|
2183
|
+
outline: none;
|
|
2161
2184
|
box-shadow: 0 0 0 1px var(--dc-search-select-focus-ring-color);
|
|
2162
2185
|
}
|
|
2163
2186
|
|
|
@@ -3132,19 +3155,19 @@
|
|
|
3132
3155
|
font-size: 15px;
|
|
3133
3156
|
}
|
|
3134
3157
|
|
|
3135
|
-
.dc-segmented__item + .dc-segmented__item
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
background:
|
|
3142
|
-
|
|
3158
|
+
.dc-segmented__item + .dc-segmented__item {
|
|
3159
|
+
background-image: linear-gradient(to bottom,
|
|
3160
|
+
transparent 25%,
|
|
3161
|
+
var(--dc-segmented-delimiter-color) 25% 75%,
|
|
3162
|
+
transparent 75%
|
|
3163
|
+
);
|
|
3164
|
+
background-repeat: no-repeat;
|
|
3165
|
+
background-size: 1px 100%;
|
|
3143
3166
|
}
|
|
3144
3167
|
|
|
3145
|
-
.dc-segmented__item_selected
|
|
3146
|
-
.dc-segmented__item_selected + .dc-segmented__item
|
|
3147
|
-
|
|
3168
|
+
.dc-segmented__item_selected,
|
|
3169
|
+
.dc-segmented__item_selected + .dc-segmented__item {
|
|
3170
|
+
background-image: none;
|
|
3148
3171
|
}
|
|
3149
3172
|
|
|
3150
3173
|
.dc-segmented-button {
|
|
@@ -3508,9 +3531,9 @@
|
|
|
3508
3531
|
box-sizing: border-box;
|
|
3509
3532
|
width: 100%;
|
|
3510
3533
|
overflow-x: auto;
|
|
3534
|
+
scroll-snap-type: x mandatory;
|
|
3511
3535
|
border: 0 solid var(--dc-table-border-color);
|
|
3512
3536
|
scroll-behavior: smooth;
|
|
3513
|
-
scroll-snap-type: x mandatory;
|
|
3514
3537
|
}
|
|
3515
3538
|
|
|
3516
3539
|
.dc-table-container_border_all {
|
|
@@ -3547,9 +3570,9 @@
|
|
|
3547
3570
|
padding:
|
|
3548
3571
|
var(--dc-table-cell-padding-y)
|
|
3549
3572
|
var(--dc-table-cell-padding-x);
|
|
3573
|
+
scroll-snap-align: start;
|
|
3550
3574
|
background: var(--dc-table-bg);
|
|
3551
3575
|
border-bottom: 1px solid var(--dc-table-border-color);
|
|
3552
|
-
scroll-snap-align: start;
|
|
3553
3576
|
}
|
|
3554
3577
|
|
|
3555
3578
|
.dc-table-cell_head {
|
|
@@ -4093,6 +4116,10 @@
|
|
|
4093
4116
|
color-scheme: light;
|
|
4094
4117
|
}
|
|
4095
4118
|
|
|
4119
|
+
.dc-empty-state_full_height {
|
|
4120
|
+
height: 100%;
|
|
4121
|
+
}
|
|
4122
|
+
|
|
4096
4123
|
.dc-empty-state__image {
|
|
4097
4124
|
color: var(--dc-empty-state-secondary-color);
|
|
4098
4125
|
}
|
|
@@ -4631,9 +4658,9 @@
|
|
|
4631
4658
|
|
|
4632
4659
|
.dc-filter-value-list > li {
|
|
4633
4660
|
display: flex;
|
|
4634
|
-
scroll-snap-align: start;
|
|
4635
4661
|
align-items: center;
|
|
4636
4662
|
min-height: 32px;
|
|
4663
|
+
scroll-snap-align: start;
|
|
4637
4664
|
}
|
|
4638
4665
|
|
|
4639
4666
|
.dc-filter-popover {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
.dc-button {
|
|
2
2
|
--dc-button-height: 36px;
|
|
3
3
|
--dc-button-radius: 9px;
|
|
4
|
+
--dc-button-padding-left: 16px;
|
|
5
|
+
--dc-button-padding-right: 16px;
|
|
4
6
|
--dc-button-text-color: var(--dc-button-gray-text-color);
|
|
5
7
|
--dc-button-border-color: var(--dc-button-gray-border-color);
|
|
6
8
|
--dc-button-bg: var(--dc-button-gray-bg);
|
|
@@ -15,7 +17,7 @@
|
|
|
15
17
|
place-items: center;
|
|
16
18
|
justify-content: center;
|
|
17
19
|
height: var(--dc-button-height);
|
|
18
|
-
padding: 0
|
|
20
|
+
padding: 0 var(--dc-button-padding-right) 0 var(--dc-button-padding-left);
|
|
19
21
|
font: 500 var(--dc-text-sm);
|
|
20
22
|
color: var(--dc-button-text-color);
|
|
21
23
|
text-align: center;
|
|
@@ -91,6 +93,14 @@
|
|
|
91
93
|
grid-template-columns: repeat(3, auto);
|
|
92
94
|
}
|
|
93
95
|
|
|
96
|
+
.dc-button_has_icon-left {
|
|
97
|
+
padding-left: calc(var(--dc-button-padding-left) / 1.6);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.dc-button_has_icon-right {
|
|
101
|
+
padding-right: calc(var(--dc-button-padding-right) / 1.6);
|
|
102
|
+
}
|
|
103
|
+
|
|
94
104
|
.dc-button_style_tinted {
|
|
95
105
|
--dc-button-text-color: var(--dc-button-gray-tinted-text-color);
|
|
96
106
|
--dc-button-bg: var(--dc-button-gray-tinted-bg);
|
|
@@ -112,36 +122,36 @@
|
|
|
112
122
|
.dc-button_xs {
|
|
113
123
|
--dc-button-height: 28px;
|
|
114
124
|
--dc-button-radius: 7px;
|
|
125
|
+
--dc-button-padding-left: 8px;
|
|
126
|
+
--dc-button-padding-right: 8px;
|
|
115
127
|
|
|
116
|
-
padding-right: 8px;
|
|
117
|
-
padding-left: 8px;
|
|
118
128
|
font: 500 var(--dc-text-xs);
|
|
119
129
|
}
|
|
120
130
|
|
|
121
131
|
.dc-button_sm {
|
|
122
132
|
--dc-button-height: 32px;
|
|
123
133
|
--dc-button-radius: 8px;
|
|
134
|
+
--dc-button-padding-left: 12px;
|
|
135
|
+
--dc-button-padding-right: 12px;
|
|
124
136
|
|
|
125
|
-
padding-right: 12px;
|
|
126
|
-
padding-left: 12px;
|
|
127
137
|
font: 500 var(--dc-text-sm);
|
|
128
138
|
}
|
|
129
139
|
|
|
130
140
|
.dc-button_lg {
|
|
131
141
|
--dc-button-height: 40px;
|
|
132
142
|
--dc-button-radius: 10px;
|
|
143
|
+
--dc-button-padding-left: 18px;
|
|
144
|
+
--dc-button-padding-right: 18px;
|
|
133
145
|
|
|
134
|
-
padding-right: 18px;
|
|
135
|
-
padding-left: 18px;
|
|
136
146
|
font: 500 var(--dc-text-md);
|
|
137
147
|
}
|
|
138
148
|
|
|
139
149
|
.dc-button_xl {
|
|
140
150
|
--dc-button-height: 44px;
|
|
141
151
|
--dc-button-radius: 11px;
|
|
152
|
+
--dc-button-padding-left: 20px;
|
|
153
|
+
--dc-button-padding-right: 20px;
|
|
142
154
|
|
|
143
|
-
padding-right: 20px;
|
|
144
|
-
padding-left: 20px;
|
|
145
155
|
font: 500 var(--dc-text-md);
|
|
146
156
|
}
|
|
147
157
|
|
|
@@ -7,6 +7,7 @@ export type EmptyStateProps = {
|
|
|
7
7
|
message?: ReactNode;
|
|
8
8
|
primaryAction?: ReactNode;
|
|
9
9
|
secondaryAction?: ReactNode;
|
|
10
|
+
fullHeight?: boolean;
|
|
10
11
|
} & EmptyStateBaseProps;
|
|
11
|
-
export declare function EmptyState({ className, image, title, message, primaryAction, secondaryAction, children, ...props }: EmptyStateProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function EmptyState({ className, image, title, message, primaryAction, secondaryAction, fullHeight, children, ...props }: EmptyStateProps): import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { classNames } from '../../lib/react-helpers.js';
|
|
3
|
-
export function EmptyState({ className, image, title, message, primaryAction, secondaryAction, children, ...props }) {
|
|
4
|
-
return (_jsxs("div", { ...props, className: classNames(
|
|
3
|
+
export function EmptyState({ className, image, title, message, primaryAction, secondaryAction, fullHeight, children, ...props }) {
|
|
4
|
+
return (_jsxs("div", { ...props, className: classNames(className, {
|
|
5
|
+
'dc-empty-state': true,
|
|
6
|
+
'dc-empty-state_full_height': fullHeight,
|
|
7
|
+
}), children: [image
|
|
5
8
|
? _jsx("div", { className: "dc-empty-state__image", children: image })
|
|
6
9
|
: null, title
|
|
7
10
|
? _jsx("h2", { className: "dc-empty-state__title", children: title })
|
|
@@ -12,6 +12,7 @@ export type SearchSelectProps<Value> = {
|
|
|
12
12
|
invalid?: boolean;
|
|
13
13
|
loading?: boolean;
|
|
14
14
|
disabled?: boolean;
|
|
15
|
+
readOnly?: boolean;
|
|
15
16
|
textboxIcon?: ReactNode;
|
|
16
17
|
textboxAriaLabel?: string;
|
|
17
18
|
textboxPlaceholder?: string;
|
|
@@ -21,7 +22,7 @@ export type SearchSelectProps<Value> = {
|
|
|
21
22
|
value: Value;
|
|
22
23
|
onChange: (value: Value) => void;
|
|
23
24
|
};
|
|
24
|
-
export declare function SearchSelect<Value>({ className, size, fullWidth, invalid, loading, disabled, textboxIcon, textboxAriaLabel, textboxPlaceholder, labelledBy, displayedValue, children, value: selectedValue, onChange: onSelectedValueChange, }: SearchSelectProps<Value>): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare function SearchSelect<Value>({ className, size, fullWidth, invalid, loading, disabled, readOnly, textboxIcon, textboxAriaLabel, textboxPlaceholder, labelledBy, displayedValue, children, value: selectedValue, onChange: onSelectedValueChange, }: SearchSelectProps<Value>): import("react/jsx-runtime").JSX.Element;
|
|
25
26
|
export declare namespace SearchSelect {
|
|
26
27
|
var Option: <T>({ className, value, children, caption, }: {
|
|
27
28
|
className?: string;
|
|
@@ -6,7 +6,7 @@ import { Popover } from '../popover/popover.js';
|
|
|
6
6
|
import { TextInput } from '../text-input/text-input.js';
|
|
7
7
|
import { Spinner } from '../spinner/spinner.js';
|
|
8
8
|
import { ChevronDown, MagnifyingGlass } from './icons.js';
|
|
9
|
-
export function SearchSelect({ className, size = 'md', fullWidth, invalid, loading, disabled, textboxIcon, textboxAriaLabel, textboxPlaceholder = '', labelledBy, displayedValue, children, value: selectedValue, onChange: onSelectedValueChange, }) {
|
|
9
|
+
export function SearchSelect({ className, size = 'md', fullWidth, invalid, loading, disabled, readOnly, textboxIcon, textboxAriaLabel, textboxPlaceholder = '', labelledBy, displayedValue, children, value: selectedValue, onChange: onSelectedValueChange, }) {
|
|
10
10
|
const id = useId();
|
|
11
11
|
const buttonId = `${id}button`;
|
|
12
12
|
const textboxId = `${id}textbox`;
|
|
@@ -16,7 +16,7 @@ export function SearchSelect({ className, size = 'md', fullWidth, invalid, loadi
|
|
|
16
16
|
const [searchQuery, setSearchQuery] = useState('');
|
|
17
17
|
const [highlightedValue, setHighlightedValue] = useState(selectedValue);
|
|
18
18
|
const openPopover = () => {
|
|
19
|
-
if (disabled || loading) {
|
|
19
|
+
if (readOnly || disabled || loading) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
options.clear();
|
|
@@ -46,19 +46,19 @@
|
|
|
46
46
|
font-size: 15px;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
.dc-segmented__item + .dc-segmented__item
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
background:
|
|
56
|
-
|
|
49
|
+
.dc-segmented__item + .dc-segmented__item {
|
|
50
|
+
background-image: linear-gradient(to bottom,
|
|
51
|
+
transparent 25%,
|
|
52
|
+
var(--dc-segmented-delimiter-color) 25% 75%,
|
|
53
|
+
transparent 75%
|
|
54
|
+
);
|
|
55
|
+
background-repeat: no-repeat;
|
|
56
|
+
background-size: 1px 100%;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
.dc-segmented__item_selected
|
|
60
|
-
.dc-segmented__item_selected + .dc-segmented__item
|
|
61
|
-
|
|
59
|
+
.dc-segmented__item_selected,
|
|
60
|
+
.dc-segmented__item_selected + .dc-segmented__item {
|
|
61
|
+
background-image: none;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
.dc-segmented-button {
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
box-sizing: border-box;
|
|
20
20
|
width: 100%;
|
|
21
21
|
overflow-x: auto;
|
|
22
|
+
scroll-snap-type: x mandatory;
|
|
22
23
|
border: 0 solid var(--dc-table-border-color);
|
|
23
24
|
scroll-behavior: smooth;
|
|
24
|
-
scroll-snap-type: x mandatory;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
.dc-table-container_border_all {
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
padding:
|
|
59
59
|
var(--dc-table-cell-padding-y)
|
|
60
60
|
var(--dc-table-cell-padding-x);
|
|
61
|
+
scroll-snap-align: start;
|
|
61
62
|
background: var(--dc-table-bg);
|
|
62
63
|
border-bottom: 1px solid var(--dc-table-border-color);
|
|
63
|
-
scroll-snap-align: start;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
.dc-table-cell_head {
|
|
@@ -29,14 +29,17 @@
|
|
|
29
29
|
border-radius: var(--dc-input-border-radius);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
.dc-text-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
.dc-text-input_full-width {
|
|
33
|
+
display: flex;
|
|
34
|
+
width: 100%;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
.dc-text-
|
|
38
|
-
border-
|
|
39
|
-
|
|
37
|
+
.dc-text-input_invalid {
|
|
38
|
+
border-color: var(--dc-input-border-color-error);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.dc-text-input_disabled {
|
|
42
|
+
opacity: var(--dc-disabled-state-opacity);
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
.dc-text-input_focused {
|
|
@@ -44,17 +47,14 @@
|
|
|
44
47
|
box-shadow: 0 0 0 1px var(--dc-input-focus-ring-color);
|
|
45
48
|
}
|
|
46
49
|
|
|
47
|
-
.dc-text-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
.dc-text-input_invalid {
|
|
52
|
-
border-color: var(--dc-input-border-color-error);
|
|
50
|
+
.dc-text-input > :first-child {
|
|
51
|
+
border-top-left-radius: calc(var(--dc-input-border-radius) - 1px);
|
|
52
|
+
border-bottom-left-radius: calc(var(--dc-input-border-radius) - 1px);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
.dc-text-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
.dc-text-input > :last-child {
|
|
56
|
+
border-top-right-radius: calc(var(--dc-input-border-radius) - 1px);
|
|
57
|
+
border-bottom-right-radius: calc(var(--dc-input-border-radius) - 1px);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
.dc-text-input_sm {
|
|
@@ -100,6 +100,18 @@
|
|
|
100
100
|
outline: none;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
.dc-text-input_align_left .dc-text-input__native {
|
|
104
|
+
text-align: left;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.dc-text-input_align_right .dc-text-input__native {
|
|
108
|
+
text-align: right;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.dc-text-input_align_center .dc-text-input__native {
|
|
112
|
+
text-align: center;
|
|
113
|
+
}
|
|
114
|
+
|
|
103
115
|
.dc-text-input__slot-left,
|
|
104
116
|
.dc-text-input__slot-right {
|
|
105
117
|
box-sizing: border-box;
|
|
@@ -4,6 +4,7 @@ type TextInputBaseProps = Omit<TextInputHTMLProps, 'type' | 'size'>;
|
|
|
4
4
|
export type TextInputType = 'date' | 'datetime-local' | 'email' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url' | 'week';
|
|
5
5
|
export type TextInputSize = 'sm' | 'md' | 'lg';
|
|
6
6
|
export type TextInputSlotStyle = 'plain' | 'tinted';
|
|
7
|
+
export type TextInputTextAlign = 'left' | 'right' | 'center';
|
|
7
8
|
export type TextInputSlotRenderer = (props: {
|
|
8
9
|
className: string;
|
|
9
10
|
}) => ReactNode;
|
|
@@ -17,6 +18,7 @@ export type TextInputProps = TextInputBaseProps & {
|
|
|
17
18
|
slotLeft?: ReactNode | TextInputSlotRenderer;
|
|
18
19
|
slotRight?: ReactNode | TextInputSlotRenderer;
|
|
19
20
|
slotStyle?: TextInputSlotStyle;
|
|
21
|
+
textAlign?: TextInputTextAlign;
|
|
20
22
|
onChangeValue?: TextInputValueChangeHandler;
|
|
21
23
|
};
|
|
22
24
|
export declare const TextInput: import("react").ForwardRefExoticComponent<Omit<TextInputProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useState } from 'react';
|
|
3
3
|
import { classNames } from '../../lib/react-helpers.js';
|
|
4
|
-
export const TextInput = forwardRef(function TextInput({ style, className, fullWidth, size = 'md', sizeInChars, slotStyle = 'plain', slotLeft, slotRight, type = 'text', invalid, disabled, onChange, onFocus, onBlur, onChangeValue, ...props }, ref) {
|
|
4
|
+
export const TextInput = forwardRef(function TextInput({ style, className, fullWidth, size = 'md', sizeInChars, slotStyle = 'plain', textAlign = 'left', slotLeft, slotRight, type = 'text', invalid, disabled, onChange, onFocus, onBlur, onChangeValue, ...props }, ref) {
|
|
5
5
|
const [focused, setFocused] = useState(false);
|
|
6
6
|
let elementBeforeInput;
|
|
7
7
|
if (slotLeft) {
|
|
@@ -46,6 +46,7 @@ export const TextInput = forwardRef(function TextInput({ style, className, fullW
|
|
|
46
46
|
return (_jsxs("div", { style: style, className: classNames(className, 'dc-text-input', {
|
|
47
47
|
[`dc-text-input_${size}`]: size,
|
|
48
48
|
[`dc-text-input_slot_${slotStyle}`]: slotStyle,
|
|
49
|
+
[`dc-text-input_align_${textAlign}`]: textAlign,
|
|
49
50
|
'dc-text-input_full-width': fullWidth,
|
|
50
51
|
'dc-text-input_invalid': invalid,
|
|
51
52
|
'dc-text-input_focused': focused,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "draft-components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "The React based UI components library.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"test": "vitest run",
|
|
27
27
|
"coverage": "vitest run --coverage",
|
|
28
28
|
"lint": "npm run lint-js && npm run lint-css",
|
|
29
|
-
"lint-js": "eslint
|
|
29
|
+
"lint-js": "eslint",
|
|
30
30
|
"lint-css": "stylelint 'src/**/*.css'",
|
|
31
31
|
"typecheck": "tsc --project 'tsconfig.json' --noEmit",
|
|
32
32
|
"prebuild": "npm run typecheck && npm run lint && npm run test",
|
|
@@ -55,49 +55,50 @@
|
|
|
55
55
|
"react-dom": ">= 18"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"@storybook/addon-
|
|
61
|
-
"@storybook/addon-
|
|
62
|
-
"@storybook/addon-
|
|
63
|
-
"@storybook/
|
|
64
|
-
"@storybook/
|
|
65
|
-
"@storybook/react
|
|
66
|
-
"@
|
|
58
|
+
"@eslint/js": "9.16.0",
|
|
59
|
+
"@heroicons/react": "2.2.0",
|
|
60
|
+
"@storybook/addon-actions": "8.4.7",
|
|
61
|
+
"@storybook/addon-essentials": "8.4.7",
|
|
62
|
+
"@storybook/addon-links": "8.4.7",
|
|
63
|
+
"@storybook/addon-themes": "8.4.7",
|
|
64
|
+
"@storybook/core-common": "8.4.7",
|
|
65
|
+
"@storybook/react": "8.4.7",
|
|
66
|
+
"@storybook/react-vite": "8.4.7",
|
|
67
|
+
"@stylistic/eslint-plugin": "2.12.1",
|
|
67
68
|
"@testing-library/dom": "10.4.0",
|
|
68
|
-
"@testing-library/jest-dom": "6.
|
|
69
|
-
"@testing-library/react": "16.
|
|
69
|
+
"@testing-library/jest-dom": "6.6.3",
|
|
70
|
+
"@testing-library/react": "16.1.0",
|
|
70
71
|
"@testing-library/user-event": "14.5.2",
|
|
71
|
-
"@types/node": "20.
|
|
72
|
-
"@types/react": "18.3.
|
|
73
|
-
"@types/react-dom": "18.3.
|
|
74
|
-
"@
|
|
75
|
-
"@
|
|
76
|
-
"
|
|
77
|
-
"@vitest/coverage-istanbul": "2.0.5",
|
|
78
|
-
"autoprefixer": "10.4.19",
|
|
72
|
+
"@types/node": "20.17.10",
|
|
73
|
+
"@types/react": "18.3.16",
|
|
74
|
+
"@types/react-dom": "18.3.5",
|
|
75
|
+
"@vitejs/plugin-react": "4.3.4",
|
|
76
|
+
"@vitest/coverage-istanbul": "2.1.8",
|
|
77
|
+
"autoprefixer": "10.4.20",
|
|
79
78
|
"color": "4.2.3",
|
|
80
|
-
"eslint": "
|
|
81
|
-
"eslint-plugin-jsx-a11y": "6.
|
|
82
|
-
"eslint-plugin-react": "7.
|
|
83
|
-
"eslint-plugin-react-hooks": "
|
|
84
|
-
"eslint-plugin-storybook": "0.
|
|
85
|
-
"eslint-plugin-testing-library": "
|
|
79
|
+
"eslint": "9.16.0",
|
|
80
|
+
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
81
|
+
"eslint-plugin-react": "7.37.2",
|
|
82
|
+
"eslint-plugin-react-hooks": "5.1.0",
|
|
83
|
+
"eslint-plugin-storybook": "0.11.1",
|
|
84
|
+
"eslint-plugin-testing-library": "7.1.1",
|
|
86
85
|
"glob": "11.0.0",
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
86
|
+
"globals": "15.13.0",
|
|
87
|
+
"husky": "9.1.7",
|
|
88
|
+
"jsdom": "25.0.1",
|
|
89
|
+
"lint-staged": "15.2.11",
|
|
90
|
+
"postcss": "8.4.49",
|
|
91
91
|
"postcss-import": "16.1.0",
|
|
92
92
|
"react": "18.3.1",
|
|
93
93
|
"react-dom": "18.3.1",
|
|
94
|
-
"storybook": "^8.
|
|
95
|
-
"stylelint": "16.
|
|
96
|
-
"stylelint-config-recess-order": "5.
|
|
94
|
+
"storybook": "^8.4.7",
|
|
95
|
+
"stylelint": "16.11.0",
|
|
96
|
+
"stylelint-config-recess-order": "5.1.1",
|
|
97
97
|
"stylelint-config-standard": "36.0.1",
|
|
98
|
-
"typescript": "5.
|
|
99
|
-
"
|
|
100
|
-
"
|
|
98
|
+
"typescript": "5.7.2",
|
|
99
|
+
"typescript-eslint": "8.18.0",
|
|
100
|
+
"vite": "6.0.3",
|
|
101
|
+
"vitest": "2.1.8"
|
|
101
102
|
},
|
|
102
103
|
"lint-staged": {
|
|
103
104
|
"*.ts?(x)": "npm run lint-js",
|