draft-components 3.1.0 → 3.2.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.
@@ -252,12 +252,36 @@
252
252
  flex-wrap: wrap-reverse !important;
253
253
  }
254
254
 
255
+ .justify-items-start {
256
+ justify-items: start !important;
257
+ }
258
+
259
+ .justify-items-end {
260
+ justify-items: end !important;
261
+ }
262
+
263
+ .justify-items-center {
264
+ justify-items: center !important;
265
+ }
266
+
267
+ .justify-items-between {
268
+ justify-items: space-between !important;
269
+ }
270
+
271
+ .justify-items-around {
272
+ justify-items: space-around !important;
273
+ }
274
+
275
+ .justify-items-evenly {
276
+ justify-items: space-evenly !important;
277
+ }
278
+
255
279
  .justify-content-start {
256
- justify-content: flex-start !important;
280
+ justify-content: start !important;
257
281
  }
258
282
 
259
283
  .justify-content-end {
260
- justify-content: flex-end !important;
284
+ justify-content: end !important;
261
285
  }
262
286
 
263
287
  .justify-content-center {
@@ -277,11 +301,11 @@
277
301
  }
278
302
 
279
303
  .align-items-start {
280
- align-items: flex-start !important;
304
+ align-items: start !important;
281
305
  }
282
306
 
283
307
  .align-items-end {
284
- align-items: flex-end !important;
308
+ align-items: end !important;
285
309
  }
286
310
 
287
311
  .align-items-center {
@@ -297,11 +321,11 @@
297
321
  }
298
322
 
299
323
  .align-content-start {
300
- align-content: flex-start !important;
324
+ align-content: start !important;
301
325
  }
302
326
 
303
327
  .align-content-end {
304
- align-content: flex-end !important;
328
+ align-content: end !important;
305
329
  }
306
330
 
307
331
  .align-content-center {
@@ -325,11 +349,11 @@
325
349
  }
326
350
 
327
351
  .align-self-start {
328
- align-self: flex-start !important;
352
+ align-self: start !important;
329
353
  }
330
354
 
331
355
  .align-self-end {
332
- align-self: flex-end !important;
356
+ align-self: end !important;
333
357
  }
334
358
 
335
359
  .align-self-center {
@@ -1025,7 +1025,6 @@
1025
1025
  }
1026
1026
 
1027
1027
  .dc-button:hover:not(:disabled) {
1028
- cursor: pointer;
1029
1028
  background: var(--dc-button-bg-hover);
1030
1029
  }
1031
1030
 
@@ -1035,10 +1034,6 @@
1035
1034
  grid-template-columns: repeat(2, auto);
1036
1035
  }
1037
1036
 
1038
- .dc-button_loading {
1039
- cursor: default;
1040
- }
1041
-
1042
1037
  .dc-button_loading:disabled {
1043
1038
  opacity: initial;
1044
1039
  }
@@ -1702,7 +1697,7 @@
1702
1697
  border-bottom-right-radius: calc(var(--dc-input-border-radius) - 1px);
1703
1698
  }
1704
1699
 
1705
- .dc-text-input:focus-within {
1700
+ .dc-text-input_focused {
1706
1701
  border-color: var(--dc-input-focus-ring-color);
1707
1702
  box-shadow: 0 0 0 1px var(--dc-input-focus-ring-color);
1708
1703
  }
@@ -1843,7 +1838,6 @@
1843
1838
  .dc-password-input__toggle-button:not(:disabled):focus,
1844
1839
  .dc-password-input__toggle-button:not(:disabled):hover {
1845
1840
  color: var(--dc-password-input-toggle-color-hover);
1846
- cursor: pointer;
1847
1841
  background: var(--dc-password-input-toggle-bg-hover);
1848
1842
  outline: none;
1849
1843
  }
@@ -2008,6 +2002,7 @@
2008
2002
  }
2009
2003
 
2010
2004
  .dc-select__native {
2005
+ flex-grow: 1;
2011
2006
  max-width: 100%;
2012
2007
  padding-right: calc(var(--dc-select-height) + 0.5em);
2013
2008
  padding-left: var(--dc-select-padding-x);
@@ -2017,7 +2012,6 @@
2017
2012
  -webkit-appearance: none;
2018
2013
  -moz-appearance: none;
2019
2014
  appearance: none;
2020
- cursor: pointer;
2021
2015
  background: none;
2022
2016
  border: none;
2023
2017
  }
@@ -2027,7 +2021,6 @@
2027
2021
  }
2028
2022
 
2029
2023
  .dc-select__native:disabled {
2030
- cursor: default;
2031
2024
  opacity: 1;
2032
2025
  }
2033
2026
 
@@ -2110,7 +2103,6 @@
2110
2103
  width: 100%;
2111
2104
  height: 100%;
2112
2105
  vertical-align: middle;
2113
- cursor: pointer;
2114
2106
  background: var(--dc-switch-track-bg);
2115
2107
  border-radius: var(--dc-switch-radius);
2116
2108
  transition-duration: 0.2s;
@@ -2228,7 +2220,6 @@
2228
2220
  width: 100%;
2229
2221
  height: 100%;
2230
2222
  vertical-align: middle;
2231
- cursor: pointer;
2232
2223
  background: var(--dc-checkbox-bg);
2233
2224
  border: 1px solid var(--dc-checkbox-border-color);
2234
2225
  border-radius: var(--dc-checkbox-radius);
@@ -2317,7 +2308,6 @@
2317
2308
  width: var(--dc-radio-size);
2318
2309
  height: var(--dc-radio-size);
2319
2310
  vertical-align: middle;
2320
- cursor: pointer;
2321
2311
  background: var(--dc-radio-color-bg);
2322
2312
  border: 1px solid var(--dc-radio-color-border);
2323
2313
  border-radius: 50%;
@@ -2806,10 +2796,6 @@
2806
2796
  background: var(--dc-day-bg-selected);
2807
2797
  }
2808
2798
 
2809
- .dc-calendar-day:hover {
2810
- cursor: pointer;
2811
- }
2812
-
2813
2799
  .dc-calendar-day:hover > .dc-calendar-day__body {
2814
2800
  box-shadow: inset 0 0 0 2px var(--dc-day-border-color-hover);
2815
2801
  }
@@ -2957,7 +2943,7 @@
2957
2943
  }
2958
2944
 
2959
2945
  .dc-segmented__item + .dc-segmented__item::before {
2960
- display: inline-block;
2946
+ display: block;
2961
2947
  float: left;
2962
2948
  width: 1px;
2963
2949
  height: calc(var(--dc-segmented-button-height) - var(--dc-segmented-button-radius) * 2);
@@ -2986,7 +2972,6 @@
2986
2972
  -webkit-appearance: none;
2987
2973
  -moz-appearance: none;
2988
2974
  appearance: none;
2989
- cursor: pointer;
2990
2975
  -webkit-user-select: none;
2991
2976
  -moz-user-select: none;
2992
2977
  user-select: none;
@@ -3174,7 +3159,6 @@
3174
3159
  height: var(--dc-color-picker-btn-size);
3175
3160
  font-size: 0;
3176
3161
  color: transparent;
3177
- cursor: pointer;
3178
3162
  background: var(--dc-color-picker-btn-color);
3179
3163
  border-radius: 50%;
3180
3164
  box-shadow: inset 0 0 0 1px var(--dc-color-picker-btn-inner-border-color);
@@ -3420,7 +3404,6 @@
3420
3404
  -webkit-appearance: none;
3421
3405
  -moz-appearance: none;
3422
3406
  appearance: none;
3423
- cursor: pointer;
3424
3407
  background: transparent;
3425
3408
  border: none;
3426
3409
  }
@@ -3551,7 +3534,6 @@
3551
3534
  -webkit-appearance: none;
3552
3535
  -moz-appearance: none;
3553
3536
  appearance: none;
3554
- cursor: pointer;
3555
3537
  background: none;
3556
3538
  border: none;
3557
3539
  border-radius: 4px;
@@ -3698,7 +3680,6 @@
3698
3680
  -moz-appearance: none;
3699
3681
  appearance: none;
3700
3682
  pointer-events: none;
3701
- cursor: pointer;
3702
3683
  background: var(--dc-toast-close-btn-bg);
3703
3684
  border: none;
3704
3685
  border-radius: 50%;
@@ -3722,7 +3703,6 @@
3722
3703
  -webkit-appearance: none;
3723
3704
  -moz-appearance: none;
3724
3705
  appearance: none;
3725
- cursor: pointer;
3726
3706
  background: var(--dc-toast-btn-bg);
3727
3707
  border: none;
3728
3708
  border-radius: 6px;
@@ -3983,7 +3963,6 @@
3983
3963
  -webkit-appearance: none;
3984
3964
  -moz-appearance: none;
3985
3965
  appearance: none;
3986
- cursor: pointer;
3987
3966
  background: none;
3988
3967
  border: none;
3989
3968
  }
@@ -4107,10 +4086,6 @@
4107
4086
  border-radius: 6px;
4108
4087
  }
4109
4088
 
4110
- .dc-menu-btn:hover {
4111
- cursor: pointer;
4112
- }
4113
-
4114
4089
  .dc-menu-btn:focus {
4115
4090
  background: var(--dc-menu-item-bg);
4116
4091
  outline: none;
@@ -4339,7 +4314,6 @@
4339
4314
  font: var(--dc-text-sm);
4340
4315
  color: var(--dc-filter-button-text-color);
4341
4316
  white-space: nowrap;
4342
- cursor: pointer;
4343
4317
  -webkit-user-select: none;
4344
4318
  -moz-user-select: none;
4345
4319
  user-select: none;
@@ -4393,7 +4367,6 @@
4393
4367
  padding: 0;
4394
4368
  font-size: 14px;
4395
4369
  color: inherit;
4396
- cursor: pointer;
4397
4370
  background: none;
4398
4371
  border: none;
4399
4372
  }
@@ -4636,7 +4609,6 @@
4636
4609
  box-sizing: border-box;
4637
4610
  padding: 6px 8px;
4638
4611
  color: var(--dc-filtered-search-option-color);
4639
- cursor: pointer;
4640
4612
  border-radius: 5px;
4641
4613
  }
4642
4614
 
@@ -56,7 +56,6 @@
56
56
  -webkit-appearance: none;
57
57
  -moz-appearance: none;
58
58
  appearance: none;
59
- cursor: pointer;
60
59
  background: none;
61
60
  border: none;
62
61
  border-radius: 4px;
@@ -73,7 +73,6 @@
73
73
  }
74
74
 
75
75
  .dc-button:hover:not(:disabled) {
76
- cursor: pointer;
77
76
  background: var(--dc-button-bg-hover);
78
77
  }
79
78
 
@@ -83,10 +82,6 @@
83
82
  grid-template-columns: repeat(2, auto);
84
83
  }
85
84
 
86
- .dc-button_loading {
87
- cursor: default;
88
- }
89
-
90
85
  .dc-button_loading:disabled {
91
86
  opacity: initial;
92
87
  }
@@ -39,7 +39,6 @@
39
39
  width: 100%;
40
40
  height: 100%;
41
41
  vertical-align: middle;
42
- cursor: pointer;
43
42
  background: var(--dc-checkbox-bg);
44
43
  border: 1px solid var(--dc-checkbox-border-color);
45
44
  border-radius: var(--dc-checkbox-radius);
@@ -30,7 +30,6 @@
30
30
  height: var(--dc-color-picker-btn-size);
31
31
  font-size: 0;
32
32
  color: transparent;
33
- cursor: pointer;
34
33
  background: var(--dc-color-picker-btn-color);
35
34
  border-radius: 50%;
36
35
  box-shadow: inset 0 0 0 1px var(--dc-color-picker-btn-inner-border-color);
@@ -100,10 +100,6 @@
100
100
  background: var(--dc-day-bg-selected);
101
101
  }
102
102
 
103
- .dc-calendar-day:hover {
104
- cursor: pointer;
105
- }
106
-
107
103
  .dc-calendar-day:hover > .dc-calendar-day__body {
108
104
  box-shadow: inset 0 0 0 2px var(--dc-day-border-color-hover);
109
105
  }
@@ -28,7 +28,6 @@
28
28
  font: var(--dc-text-sm);
29
29
  color: var(--dc-filter-button-text-color);
30
30
  white-space: nowrap;
31
- cursor: pointer;
32
31
  -webkit-user-select: none;
33
32
  -moz-user-select: none;
34
33
  user-select: none;
@@ -19,7 +19,6 @@
19
19
  padding: 0;
20
20
  font-size: 14px;
21
21
  color: inherit;
22
- cursor: pointer;
23
22
  background: none;
24
23
  border: none;
25
24
  }
@@ -19,7 +19,6 @@
19
19
  padding: 0;
20
20
  font-size: 14px;
21
21
  color: inherit;
22
- cursor: pointer;
23
22
  background: none;
24
23
  border: none;
25
24
  }
@@ -262,7 +261,6 @@
262
261
  box-sizing: border-box;
263
262
  padding: 6px 8px;
264
263
  color: var(--dc-filtered-search-option-color);
265
- cursor: pointer;
266
264
  border-radius: 5px;
267
265
  }
268
266
 
@@ -47,10 +47,6 @@
47
47
  border-radius: 6px;
48
48
  }
49
49
 
50
- .dc-menu-btn:hover {
51
- cursor: pointer;
52
- }
53
-
54
50
  .dc-menu-btn:focus {
55
51
  background: var(--dc-menu-item-bg);
56
52
  outline: none;
@@ -33,7 +33,6 @@
33
33
  .dc-password-input__toggle-button:not(:disabled):focus,
34
34
  .dc-password-input__toggle-button:not(:disabled):hover {
35
35
  color: var(--dc-password-input-toggle-color-hover);
36
- cursor: pointer;
37
36
  background: var(--dc-password-input-toggle-bg-hover);
38
37
  outline: none;
39
38
  }
@@ -37,7 +37,6 @@
37
37
  width: var(--dc-radio-size);
38
38
  height: var(--dc-radio-size);
39
39
  vertical-align: middle;
40
- cursor: pointer;
41
40
  background: var(--dc-radio-color-bg);
42
41
  border: 1px solid var(--dc-radio-color-border);
43
42
  border-radius: 50%;
@@ -47,7 +47,7 @@
47
47
  }
48
48
 
49
49
  .dc-segmented__item + .dc-segmented__item::before {
50
- display: inline-block;
50
+ display: block;
51
51
  float: left;
52
52
  width: 1px;
53
53
  height: calc(var(--dc-segmented-button-height) - var(--dc-segmented-button-radius) * 2);
@@ -76,7 +76,6 @@
76
76
  -webkit-appearance: none;
77
77
  -moz-appearance: none;
78
78
  appearance: none;
79
- cursor: pointer;
80
79
  -webkit-user-select: none;
81
80
  -moz-user-select: none;
82
81
  user-select: none;
@@ -65,6 +65,7 @@
65
65
  }
66
66
 
67
67
  .dc-select__native {
68
+ flex-grow: 1;
68
69
  max-width: 100%;
69
70
  padding-right: calc(var(--dc-select-height) + 0.5em);
70
71
  padding-left: var(--dc-select-padding-x);
@@ -74,7 +75,6 @@
74
75
  -webkit-appearance: none;
75
76
  -moz-appearance: none;
76
77
  appearance: none;
77
- cursor: pointer;
78
78
  background: none;
79
79
  border: none;
80
80
  }
@@ -84,7 +84,6 @@
84
84
  }
85
85
 
86
86
  .dc-select__native:disabled {
87
- cursor: default;
88
87
  opacity: 1;
89
88
  }
90
89
 
@@ -45,7 +45,6 @@
45
45
  width: 100%;
46
46
  height: 100%;
47
47
  vertical-align: middle;
48
- cursor: pointer;
49
48
  background: var(--dc-switch-track-bg);
50
49
  border-radius: var(--dc-switch-radius);
51
50
  transition-duration: 0.2s;
@@ -104,7 +104,6 @@
104
104
  -webkit-appearance: none;
105
105
  -moz-appearance: none;
106
106
  appearance: none;
107
- cursor: pointer;
108
107
  background: transparent;
109
108
  border: none;
110
109
  }
@@ -18,7 +18,6 @@
18
18
  -webkit-appearance: none;
19
19
  -moz-appearance: none;
20
20
  appearance: none;
21
- cursor: pointer;
22
21
  background: none;
23
22
  border: none;
24
23
  }
@@ -39,7 +39,7 @@
39
39
  border-bottom-right-radius: calc(var(--dc-input-border-radius) - 1px);
40
40
  }
41
41
 
42
- .dc-text-input:focus-within {
42
+ .dc-text-input_focused {
43
43
  border-color: var(--dc-input-focus-ring-color);
44
44
  box-shadow: 0 0 0 1px var(--dc-input-focus-ring-color);
45
45
  }
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef } from 'react';
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, onChangeValue, ...props }, ref) {
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) {
5
+ const [focused, setFocused] = useState(false);
5
6
  let elementBeforeInput;
6
7
  if (slotLeft) {
7
8
  const className = 'dc-text-input__slot-left';
@@ -30,13 +31,26 @@ export const TextInput = forwardRef(function TextInput({ style, className, fullW
30
31
  onChangeValue(event.target.value);
31
32
  }
32
33
  };
34
+ const handleFocus = (event) => {
35
+ setFocused(true);
36
+ if (typeof onFocus === 'function') {
37
+ onFocus(event);
38
+ }
39
+ };
40
+ const handleBlur = (event) => {
41
+ setFocused(false);
42
+ if (typeof onBlur === 'function') {
43
+ onBlur(event);
44
+ }
45
+ };
33
46
  return (_jsxs("div", { style: style, className: classNames(className, 'dc-text-input', {
34
47
  [`dc-text-input_${size}`]: size,
35
48
  [`dc-text-input_slot_${slotStyle}`]: slotStyle,
36
49
  'dc-text-input_full-width': fullWidth,
37
50
  'dc-text-input_invalid': invalid,
51
+ 'dc-text-input_focused': focused,
38
52
  'dc-text-input_disabled': disabled,
39
53
  'dc-text-input_has_slot-left': elementBeforeInput,
40
54
  'dc-text-input_has_slot-right': elementAfterInput,
41
- }), children: [elementBeforeInput, _jsx("input", { ...props, className: "dc-text-input__native", ref: ref, type: type, size: sizeInChars, disabled: disabled, "aria-invalid": props['aria-invalid'] ?? invalid, onChange: handleChange }), elementAfterInput] }));
55
+ }), children: [elementBeforeInput, _jsx("input", { ...props, className: "dc-text-input__native", ref: ref, type: type, size: sizeInChars, disabled: disabled, "aria-invalid": props['aria-invalid'] ?? invalid, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur }), elementAfterInput] }));
42
56
  });
@@ -39,7 +39,6 @@
39
39
  -moz-appearance: none;
40
40
  appearance: none;
41
41
  pointer-events: none;
42
- cursor: pointer;
43
42
  background: var(--dc-toast-close-btn-bg);
44
43
  border: none;
45
44
  border-radius: 50%;
@@ -63,7 +62,6 @@
63
62
  -webkit-appearance: none;
64
63
  -moz-appearance: none;
65
64
  appearance: none;
66
- cursor: pointer;
67
65
  background: var(--dc-toast-btn-bg);
68
66
  border: none;
69
67
  border-radius: 6px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "draft-components",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "The React based UI components library.",
5
5
  "type": "module",
6
6
  "exports": {