draft-components 3.4.0 → 3.5.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.
@@ -1758,6 +1758,18 @@
1758
1758
  outline: none;
1759
1759
  }
1760
1760
 
1761
+ .dc-text-input_align_left .dc-text-input__native {
1762
+ text-align: left;
1763
+ }
1764
+
1765
+ .dc-text-input_align_right .dc-text-input__native {
1766
+ text-align: right;
1767
+ }
1768
+
1769
+ .dc-text-input_align_center .dc-text-input__native {
1770
+ text-align: center;
1771
+ }
1772
+
1761
1773
  .dc-text-input__slot-left,
1762
1774
  .dc-text-input__slot-right {
1763
1775
  box-sizing: border-box;
@@ -2158,6 +2170,7 @@
2158
2170
 
2159
2171
  .dc-search-select:focus {
2160
2172
  border-color: var(--dc-search-select-focus-ring-color);
2173
+ outline: none;
2161
2174
  box-shadow: 0 0 0 1px var(--dc-search-select-focus-ring-color);
2162
2175
  }
2163
2176
 
@@ -3132,19 +3145,19 @@
3132
3145
  font-size: 15px;
3133
3146
  }
3134
3147
 
3135
- .dc-segmented__item + .dc-segmented__item::before {
3136
- display: block;
3137
- float: left;
3138
- width: 1px;
3139
- height: calc(var(--dc-segmented-button-height) - var(--dc-segmented-button-radius) * 2);
3140
- content: "";
3141
- background: var(--dc-segmented-delimiter-color);
3142
- transform: translateY(var(--dc-segmented-button-radius));
3148
+ .dc-segmented__item + .dc-segmented__item {
3149
+ background-image: linear-gradient(to bottom,
3150
+ transparent 25%,
3151
+ var(--dc-segmented-delimiter-color) 25% 75%,
3152
+ transparent 75%
3153
+ );
3154
+ background-repeat: no-repeat;
3155
+ background-size: 1px 100%;
3143
3156
  }
3144
3157
 
3145
- .dc-segmented__item_selected::before,
3146
- .dc-segmented__item_selected + .dc-segmented__item::before {
3147
- visibility: hidden;
3158
+ .dc-segmented__item_selected,
3159
+ .dc-segmented__item_selected + .dc-segmented__item {
3160
+ background-image: none;
3148
3161
  }
3149
3162
 
3150
3163
  .dc-segmented-button {
@@ -100,6 +100,7 @@
100
100
 
101
101
  .dc-search-select:focus {
102
102
  border-color: var(--dc-search-select-focus-ring-color);
103
+ outline: none;
103
104
  box-shadow: 0 0 0 1px var(--dc-search-select-focus-ring-color);
104
105
  }
105
106
 
@@ -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::before {
50
- display: block;
51
- float: left;
52
- width: 1px;
53
- height: calc(var(--dc-segmented-button-height) - var(--dc-segmented-button-radius) * 2);
54
- content: "";
55
- background: var(--dc-segmented-delimiter-color);
56
- transform: translateY(var(--dc-segmented-button-radius));
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::before,
60
- .dc-segmented__item_selected + .dc-segmented__item::before {
61
- visibility: hidden;
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 {
@@ -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.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "The React based UI components library.",
5
5
  "type": "module",
6
6
  "exports": {