draft-components 3.2.1 → 3.4.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.
Files changed (36) hide show
  1. package/css/draft-components.css +187 -2
  2. package/dist/components/button/icon-button.d.ts +0 -1
  3. package/dist/components/color-picker/color-picker.css +1 -2
  4. package/dist/components/filtered-search/string-set-filter-item.d.ts +1 -1
  5. package/dist/components/hero-icons/24/outline/arrow-small-down-icon.d.ts +1 -2
  6. package/dist/components/hero-icons/24/outline/arrow-small-up-icon.d.ts +1 -2
  7. package/dist/components/hero-icons/24/outline/arrows-up-down-icon.d.ts +1 -2
  8. package/dist/components/hero-icons/24/outline/chevron-left-icon.d.ts +1 -2
  9. package/dist/components/hero-icons/24/outline/chevron-right-icon.d.ts +1 -2
  10. package/dist/components/hero-icons/24/outline/eye-icon.d.ts +1 -2
  11. package/dist/components/hero-icons/24/outline/eye-slash-icon.d.ts +1 -2
  12. package/dist/components/hero-icons/24/outline/magnifying-glass-icon.d.ts +1 -2
  13. package/dist/components/hero-icons/24/outline/trash-icon.d.ts +1 -2
  14. package/dist/components/hero-icons/24/outline/x-mark-icon.d.ts +1 -2
  15. package/dist/components/hero-icons/24/solid/exclamation-triangle-icon.d.ts +1 -2
  16. package/dist/components/index.d.ts +1 -0
  17. package/dist/components/index.js +1 -0
  18. package/dist/components/popover/popover.d.ts +9 -9
  19. package/dist/components/search-select/context.d.ts +24 -0
  20. package/dist/components/search-select/context.js +47 -0
  21. package/dist/components/search-select/icons.d.ts +3 -0
  22. package/dist/components/search-select/icons.js +7 -0
  23. package/dist/components/search-select/index.d.ts +1 -0
  24. package/dist/components/search-select/index.js +1 -0
  25. package/dist/components/search-select/search-select.css +185 -0
  26. package/dist/components/search-select/search-select.d.ts +43 -0
  27. package/dist/components/search-select/search-select.js +180 -0
  28. package/dist/components/select/select.d.ts +19 -19
  29. package/dist/components/selection-control/selection-control.d.ts +1 -1
  30. package/dist/components/slide-over/slide-over.d.ts +4 -4
  31. package/dist/components/spinner/spinner.d.ts +1 -1
  32. package/dist/components/table/table-body.d.ts +1 -1
  33. package/dist/components/table/table-cell.d.ts +1 -1
  34. package/dist/components/toast/toast-button.d.ts +1 -1
  35. package/dist/components/toaster/toaster.js +1 -1
  36. package/package.json +41 -39
@@ -2056,6 +2056,192 @@
2056
2056
  color-scheme: dark;
2057
2057
  }
2058
2058
 
2059
+ .dc-search-select-button-label {
2060
+ display: inline-flex;
2061
+ gap: 0.5em;
2062
+ align-items: center;
2063
+ }
2064
+
2065
+ .dc-search-select-button-label > b {
2066
+ font-weight: 700;
2067
+ }
2068
+
2069
+ .dc-search-select-option {
2070
+ box-sizing: border-box;
2071
+ display: flex;
2072
+ flex-direction: column;
2073
+ justify-content: center;
2074
+ min-height: 28px;
2075
+ padding: 4px 8px;
2076
+ font-size: 14px;
2077
+ line-height: 1.25;
2078
+ color: inherit;
2079
+ cursor: default;
2080
+ border-radius: 5px;
2081
+ }
2082
+
2083
+ .dc-search-select-option_highlighted {
2084
+ color: var(--dc-control-primary-text-color);
2085
+ background: var(--dc-control-bg-inset);
2086
+ }
2087
+
2088
+ .dc-search-select-option_selected {
2089
+ color: var(--dc-control-on-primary-color);
2090
+ background: var(--dc-control-primary-color);
2091
+ }
2092
+
2093
+ .dc-search-select-option__caption {
2094
+ font-size: 80%;
2095
+ opacity: 0.75;
2096
+ }
2097
+
2098
+ .dc-search-select-separator {
2099
+ display: flex;
2100
+ align-items: center;
2101
+ width: 100%;
2102
+ padding: 8px 0;
2103
+ }
2104
+
2105
+ .dc-search-select-separator::before,
2106
+ .dc-search-select-separator::after {
2107
+ display: block;
2108
+ height: 1px;
2109
+ content: '';
2110
+ background: var(--dc-control-bg-inset);
2111
+ }
2112
+
2113
+ .dc-search-select-separator::before {
2114
+ flex-shrink: 0;
2115
+ width: 12px;
2116
+ }
2117
+
2118
+ .dc-search-select-separator::after {
2119
+ flex-grow: 1;
2120
+ }
2121
+
2122
+ .dc-search-select-separator__label {
2123
+ padding: 0 8px;
2124
+ font-size: 12px;
2125
+ color: var(--dc-control-secondary-text-color);
2126
+ }
2127
+
2128
+ .dc-search-select {
2129
+ --dc-search-select-font-size: 14px;
2130
+ --dc-search-select-text-color: var(--dc-control-primary-text-color);
2131
+ --dc-search-select-height: 36px;
2132
+ --dc-search-select-padding-x: 12px;
2133
+ --dc-search-select-radius: 7px;
2134
+ --dc-search-select-border-color: var(--dc-control-border-color);
2135
+ --dc-search-select-border-color-error: var(--dc-control-error-color);
2136
+ --dc-search-select-bg: var(--dc-control-bg);
2137
+ --dc-search-select-focus-ring-color: var(--dc-control-primary-color);
2138
+
2139
+ position: relative;
2140
+ box-sizing: border-box;
2141
+ display: inline-flex;
2142
+ align-items: center;
2143
+ max-width: 100%;
2144
+ height: var(--dc-search-select-height);
2145
+ padding: 0 var(--dc-search-select-padding-x);
2146
+ padding-right: calc(var(--dc-search-select-height) + 0.15em);
2147
+ font-family: var(--dc-primary-font);
2148
+ font-size: var(--dc-search-select-font-size);
2149
+ font-weight: 400;
2150
+ line-height: 1.25;
2151
+ color: var(--dc-search-select-text-color);
2152
+ vertical-align: middle;
2153
+ color-scheme: light;
2154
+ background: var(--dc-search-select-bg);
2155
+ border: 1px solid var(--dc-search-select-border-color);
2156
+ border-radius: var(--dc-search-select-radius);
2157
+ }
2158
+
2159
+ .dc-search-select:focus {
2160
+ border-color: var(--dc-search-select-focus-ring-color);
2161
+ box-shadow: 0 0 0 1px var(--dc-search-select-focus-ring-color);
2162
+ }
2163
+
2164
+ .dc-search-select_loading,
2165
+ .dc-search-select_disabled {
2166
+ pointer-events: none;
2167
+ }
2168
+
2169
+ .dc-search-select_disabled {
2170
+ opacity: var(--dc-disabled-state-opacity);
2171
+ }
2172
+
2173
+ .dc-search-select_invalid {
2174
+ border-color: var(--dc-search-select-border-color-error);
2175
+ }
2176
+
2177
+ .dc-search-select_full-width {
2178
+ display: flex;
2179
+ width: 100%;
2180
+ }
2181
+
2182
+ .dc-search-select_size_sm {
2183
+ --dc-search-select-font-size: 13px;
2184
+ --dc-search-select-height: 32px;
2185
+ --dc-search-select-padding-x: 8px;
2186
+ --dc-search-select-radius: 6px;
2187
+ }
2188
+
2189
+ .dc-search-select_size_lg {
2190
+ --dc-search-select-font-size: 15px;
2191
+ --dc-search-select-height: 40px;
2192
+ --dc-search-select-padding-x: 16px;
2193
+ --dc-search-select-radius: 8px;
2194
+ }
2195
+
2196
+ .dc-search-select__slot-right {
2197
+ position: absolute;
2198
+ top: 0;
2199
+ right: 0;
2200
+ display: inline-flex;
2201
+ flex-shrink: 0;
2202
+ align-items: center;
2203
+ justify-content: center;
2204
+ width: var(--dc-search-select-height);
2205
+ height: var(--dc-search-select-height);
2206
+ pointer-events: none;
2207
+ }
2208
+
2209
+ .dc-search-select__arrow {
2210
+ transform: translateY(5%);
2211
+ }
2212
+
2213
+ .dc-search-select__popover {
2214
+ --dc-search-select-popover-padding: 8px;
2215
+ --dc-search-select-popover-radius: 8px;
2216
+
2217
+ padding: 0;
2218
+ padding-bottom: var(--dc-search-select-popover-padding);
2219
+ border-radius: var(--dc-search-select-popover-radius);
2220
+ }
2221
+
2222
+ .dc-search-select__textbox {
2223
+ padding: var(--dc-search-select-popover-padding);
2224
+ }
2225
+
2226
+ .dc-search-select__listbox {
2227
+ max-height: 352px;
2228
+ padding: 0 var(--dc-search-select-popover-padding);
2229
+ margin: 0;
2230
+ overflow-y: auto;
2231
+ list-style: none;
2232
+ border-bottom-right-radius: inherit;
2233
+ border-bottom-left-radius: inherit;
2234
+ }
2235
+
2236
+ .dc-search-select__listbox > [role="option"] + [role="option"] {
2237
+ margin-top: 2px;
2238
+ }
2239
+
2240
+ .dark .dc-search-select,
2241
+ .dark.dc-search-select {
2242
+ color-scheme: dark;
2243
+ }
2244
+
2059
2245
  .dc-switch {
2060
2246
  --dc-switch-width: 38px;
2061
2247
  --dc-switch-height: 24px;
@@ -3178,8 +3364,7 @@
3178
3364
  height: 1px;
3179
3365
  overflow: hidden;
3180
3366
  clip: rect(0 0 0 0);
3181
- -webkit-clip-path: inset(50%);
3182
- clip-path: inset(50%);
3367
+ clip-path: inset(50%);
3183
3368
  white-space: nowrap;
3184
3369
  }
3185
3370
 
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { ButtonProps } from './button.js';
3
2
  export type IconButtonProps = Omit<ButtonProps, 'caption' | 'iconLeft' | 'iconRight'>;
4
3
  export declare const IconButton: import("react").ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
@@ -45,8 +45,7 @@
45
45
  height: 1px;
46
46
  overflow: hidden;
47
47
  clip: rect(0 0 0 0);
48
- -webkit-clip-path: inset(50%);
49
- clip-path: inset(50%);
48
+ clip-path: inset(50%);
50
49
  white-space: nowrap;
51
50
  }
52
51
 
@@ -10,6 +10,6 @@ export type StringSetFilterItemProps = {
10
10
  export declare function StringSetFilterItem({ filter, isEditing, onEditStart, onEditCancel, onRemove, onChange, }: StringSetFilterItemProps): import("react/jsx-runtime").JSX.Element;
11
11
  export declare namespace StringSetFilterItem {
12
12
  var defaultValueFormatter: (value: string) => string;
13
- var defaultValuesFormatter: (values: string[]) => string;
13
+ var defaultValuesFormatter: (values: StringSetFilter["value"]) => string;
14
14
  var defaultOperatorFormatter: (operator: StringSetFilterOperator) => string;
15
15
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const ArrowSmallDownIcon: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").SVGProps<SVGSVGElement>, "ref"> & {
3
- ref?: ((instance: SVGSVGElement | null) => void) | import("react").RefObject<SVGSVGElement> | null | undefined;
2
+ ref?: ((instance: SVGSVGElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<SVGSVGElement> | null | undefined;
4
3
  }, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const ArrowSmallUpIcon: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").SVGProps<SVGSVGElement>, "ref"> & {
3
- ref?: ((instance: SVGSVGElement | null) => void) | import("react").RefObject<SVGSVGElement> | null | undefined;
2
+ ref?: ((instance: SVGSVGElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<SVGSVGElement> | null | undefined;
4
3
  }, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const ArrowsUpDownIcon: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").SVGProps<SVGSVGElement>, "ref"> & {
3
- ref?: ((instance: SVGSVGElement | null) => void) | import("react").RefObject<SVGSVGElement> | null | undefined;
2
+ ref?: ((instance: SVGSVGElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<SVGSVGElement> | null | undefined;
4
3
  }, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const ChevronLeftIcon: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").SVGProps<SVGSVGElement>, "ref"> & {
3
- ref?: ((instance: SVGSVGElement | null) => void) | import("react").RefObject<SVGSVGElement> | null | undefined;
2
+ ref?: ((instance: SVGSVGElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<SVGSVGElement> | null | undefined;
4
3
  }, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const ChevronRightIcon: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").SVGProps<SVGSVGElement>, "ref"> & {
3
- ref?: ((instance: SVGSVGElement | null) => void) | import("react").RefObject<SVGSVGElement> | null | undefined;
2
+ ref?: ((instance: SVGSVGElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<SVGSVGElement> | null | undefined;
4
3
  }, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const EyeIcon: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").SVGProps<SVGSVGElement>, "ref"> & {
3
- ref?: ((instance: SVGSVGElement | null) => void) | import("react").RefObject<SVGSVGElement> | null | undefined;
2
+ ref?: ((instance: SVGSVGElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<SVGSVGElement> | null | undefined;
4
3
  }, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const EyeSlashIcon: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").SVGProps<SVGSVGElement>, "ref"> & {
3
- ref?: ((instance: SVGSVGElement | null) => void) | import("react").RefObject<SVGSVGElement> | null | undefined;
2
+ ref?: ((instance: SVGSVGElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<SVGSVGElement> | null | undefined;
4
3
  }, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const MagnifyingGlassIcon: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").SVGProps<SVGSVGElement>, "ref"> & {
3
- ref?: ((instance: SVGSVGElement | null) => void) | import("react").RefObject<SVGSVGElement> | null | undefined;
2
+ ref?: ((instance: SVGSVGElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<SVGSVGElement> | null | undefined;
4
3
  }, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const TrashIcon: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").SVGProps<SVGSVGElement>, "ref"> & {
3
- ref?: ((instance: SVGSVGElement | null) => void) | import("react").RefObject<SVGSVGElement> | null | undefined;
2
+ ref?: ((instance: SVGSVGElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<SVGSVGElement> | null | undefined;
4
3
  }, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const XMarkIcon: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").SVGProps<SVGSVGElement>, "ref"> & {
3
- ref?: ((instance: SVGSVGElement | null) => void) | import("react").RefObject<SVGSVGElement> | null | undefined;
2
+ ref?: ((instance: SVGSVGElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<SVGSVGElement> | null | undefined;
4
3
  }, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const ExclamationTriangleIcon: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").SVGProps<SVGSVGElement>, "ref"> & {
3
- ref?: ((instance: SVGSVGElement | null) => void) | import("react").RefObject<SVGSVGElement> | null | undefined;
2
+ ref?: ((instance: SVGSVGElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<SVGSVGElement> | null | undefined;
4
3
  }, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
@@ -24,6 +24,7 @@ export * from './popover/index.js';
24
24
  export * from './portal/index.js';
25
25
  export * from './positioner/index.js';
26
26
  export * from './radio/index.js';
27
+ export * from './search-select/index.js';
27
28
  export * from './segmented-control/index.js';
28
29
  export * from './select/index.js';
29
30
  export * from './selection-control/index.js';
@@ -24,6 +24,7 @@ export * from './popover/index.js';
24
24
  export * from './portal/index.js';
25
25
  export * from './positioner/index.js';
26
26
  export * from './radio/index.js';
27
+ export * from './search-select/index.js';
27
28
  export * from './segmented-control/index.js';
28
29
  export * from './select/index.js';
29
30
  export * from './selection-control/index.js';
@@ -34,18 +34,18 @@ export type PopoverProps = {
34
34
  onClose?: PopoverCloseCallback;
35
35
  } & PopoverHTMLProps;
36
36
  export declare const Popover: import("react").ForwardRefExoticComponent<{
37
- defaultIsOpen?: boolean | undefined;
38
- isOpen?: boolean | undefined;
39
- shouldTrapFocus?: boolean | undefined;
40
- shouldFocusAnchorAfterEscPress?: boolean | undefined;
41
- transitionDurationMs?: number | undefined;
42
- anchorGap?: number | undefined;
43
- viewportGap?: number | undefined;
37
+ defaultIsOpen?: boolean;
38
+ isOpen?: boolean;
39
+ shouldTrapFocus?: boolean;
40
+ shouldFocusAnchorAfterEscPress?: boolean;
41
+ transitionDurationMs?: number;
42
+ anchorGap?: number;
43
+ viewportGap?: number;
44
44
  placement?: PopoverPlacement;
45
45
  alignment?: PopoverAlignment;
46
46
  anchor: ReactNode | PopoverAnchorRenderFn;
47
47
  children: ReactNode;
48
- onOpen?: PopoverOpenCallback | undefined;
49
- onClose?: PopoverCloseCallback | undefined;
48
+ onOpen?: PopoverOpenCallback;
49
+ onClose?: PopoverCloseCallback;
50
50
  } & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<PopoverRef>>;
51
51
  export {};
@@ -0,0 +1,24 @@
1
+ import { ReactNode } from 'react';
2
+ export declare class OptionStore<T> {
3
+ private _map;
4
+ readonly idPrefix: string;
5
+ constructor(idPrefix?: string);
6
+ private _generateId;
7
+ get ids(): string[];
8
+ get values(): T[];
9
+ idOf(value: T): string | undefined;
10
+ append(value: T): string;
11
+ clear(): void;
12
+ }
13
+ export type SearchSelectContext<T> = {
14
+ options: OptionStore<T>;
15
+ selectedValue: T;
16
+ highlightedValue: T;
17
+ setSelectedValue: (value: T) => void;
18
+ setHighlightedValue: (value: T) => void;
19
+ };
20
+ export declare function useSearchSelectContext(): SearchSelectContext<any>;
21
+ export declare function SearchSelectContextProvider<T>({ value, children, }: {
22
+ value: SearchSelectContext<T>;
23
+ children: ReactNode;
24
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,47 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext } from 'react';
3
+ export class OptionStore {
4
+ _map;
5
+ idPrefix;
6
+ constructor(idPrefix = '') {
7
+ this._map = new Map();
8
+ this.idPrefix = idPrefix;
9
+ }
10
+ _generateId() {
11
+ const count = this._map.size;
12
+ return `${this.idPrefix}${count + 1}`;
13
+ }
14
+ get ids() {
15
+ return Array.from(this._map.values());
16
+ }
17
+ get values() {
18
+ return Array.from(this._map.keys());
19
+ }
20
+ idOf(value) {
21
+ return this._map.get(value);
22
+ }
23
+ append(value) {
24
+ let id = this._map.get(value);
25
+ if (id) {
26
+ return id;
27
+ }
28
+ id = this._generateId();
29
+ this._map.set(value, id);
30
+ return id;
31
+ }
32
+ clear() {
33
+ this._map.clear();
34
+ }
35
+ }
36
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
+ const searchSelectContext = createContext(null);
38
+ export function useSearchSelectContext() {
39
+ const ctx = useContext(searchSelectContext);
40
+ if (ctx === null) {
41
+ throw new Error('useSearchSelectContext must be used within SearchSelectContextProvider');
42
+ }
43
+ return ctx;
44
+ }
45
+ export function SearchSelectContextProvider({ value, children, }) {
46
+ return (_jsx(searchSelectContext.Provider, { value: value, children: children }));
47
+ }
@@ -0,0 +1,3 @@
1
+ import { ComponentPropsWithoutRef } from 'react';
2
+ export declare function MagnifyingGlass({ width, height, ...props }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
3
+ export declare function ChevronDown({ width, height, ...props }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export function MagnifyingGlass({ width = 24, height = 24, ...props }) {
3
+ return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", width: width, height: height, strokeWidth: 1.5, stroke: "currentColor", ...props, children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z" }) }));
4
+ }
5
+ export function ChevronDown({ width = 24, height = 24, ...props }) {
6
+ return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", width: width, height: height, strokeWidth: 1.5, stroke: "currentColor", ...props, children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m19.5 8.25-7.5 7.5-7.5-7.5" }) }));
7
+ }
@@ -0,0 +1 @@
1
+ export * from './search-select.js';
@@ -0,0 +1 @@
1
+ export * from './search-select.js';
@@ -0,0 +1,185 @@
1
+ .dc-search-select-button-label {
2
+ display: inline-flex;
3
+ gap: 0.5em;
4
+ align-items: center;
5
+ }
6
+
7
+ .dc-search-select-button-label > b {
8
+ font-weight: 700;
9
+ }
10
+
11
+ .dc-search-select-option {
12
+ box-sizing: border-box;
13
+ display: flex;
14
+ flex-direction: column;
15
+ justify-content: center;
16
+ min-height: 28px;
17
+ padding: 4px 8px;
18
+ font-size: 14px;
19
+ line-height: 1.25;
20
+ color: inherit;
21
+ cursor: default;
22
+ border-radius: 5px;
23
+ }
24
+
25
+ .dc-search-select-option_highlighted {
26
+ color: var(--dc-control-primary-text-color);
27
+ background: var(--dc-control-bg-inset);
28
+ }
29
+
30
+ .dc-search-select-option_selected {
31
+ color: var(--dc-control-on-primary-color);
32
+ background: var(--dc-control-primary-color);
33
+ }
34
+
35
+ .dc-search-select-option__caption {
36
+ font-size: 80%;
37
+ opacity: 0.75;
38
+ }
39
+
40
+ .dc-search-select-separator {
41
+ display: flex;
42
+ align-items: center;
43
+ width: 100%;
44
+ padding: 8px 0;
45
+ }
46
+
47
+ .dc-search-select-separator::before,
48
+ .dc-search-select-separator::after {
49
+ display: block;
50
+ height: 1px;
51
+ content: '';
52
+ background: var(--dc-control-bg-inset);
53
+ }
54
+
55
+ .dc-search-select-separator::before {
56
+ flex-shrink: 0;
57
+ width: 12px;
58
+ }
59
+
60
+ .dc-search-select-separator::after {
61
+ flex-grow: 1;
62
+ }
63
+
64
+ .dc-search-select-separator__label {
65
+ padding: 0 8px;
66
+ font-size: 12px;
67
+ color: var(--dc-control-secondary-text-color);
68
+ }
69
+
70
+ .dc-search-select {
71
+ --dc-search-select-font-size: 14px;
72
+ --dc-search-select-text-color: var(--dc-control-primary-text-color);
73
+ --dc-search-select-height: 36px;
74
+ --dc-search-select-padding-x: 12px;
75
+ --dc-search-select-radius: 7px;
76
+ --dc-search-select-border-color: var(--dc-control-border-color);
77
+ --dc-search-select-border-color-error: var(--dc-control-error-color);
78
+ --dc-search-select-bg: var(--dc-control-bg);
79
+ --dc-search-select-focus-ring-color: var(--dc-control-primary-color);
80
+
81
+ position: relative;
82
+ box-sizing: border-box;
83
+ display: inline-flex;
84
+ align-items: center;
85
+ max-width: 100%;
86
+ height: var(--dc-search-select-height);
87
+ padding: 0 var(--dc-search-select-padding-x);
88
+ padding-right: calc(var(--dc-search-select-height) + 0.15em);
89
+ font-family: var(--dc-primary-font);
90
+ font-size: var(--dc-search-select-font-size);
91
+ font-weight: 400;
92
+ line-height: 1.25;
93
+ color: var(--dc-search-select-text-color);
94
+ vertical-align: middle;
95
+ color-scheme: light;
96
+ background: var(--dc-search-select-bg);
97
+ border: 1px solid var(--dc-search-select-border-color);
98
+ border-radius: var(--dc-search-select-radius);
99
+ }
100
+
101
+ .dc-search-select:focus {
102
+ border-color: var(--dc-search-select-focus-ring-color);
103
+ box-shadow: 0 0 0 1px var(--dc-search-select-focus-ring-color);
104
+ }
105
+
106
+ .dc-search-select_loading,
107
+ .dc-search-select_disabled {
108
+ pointer-events: none;
109
+ }
110
+
111
+ .dc-search-select_disabled {
112
+ opacity: var(--dc-disabled-state-opacity);
113
+ }
114
+
115
+ .dc-search-select_invalid {
116
+ border-color: var(--dc-search-select-border-color-error);
117
+ }
118
+
119
+ .dc-search-select_full-width {
120
+ display: flex;
121
+ width: 100%;
122
+ }
123
+
124
+ .dc-search-select_size_sm {
125
+ --dc-search-select-font-size: 13px;
126
+ --dc-search-select-height: 32px;
127
+ --dc-search-select-padding-x: 8px;
128
+ --dc-search-select-radius: 6px;
129
+ }
130
+
131
+ .dc-search-select_size_lg {
132
+ --dc-search-select-font-size: 15px;
133
+ --dc-search-select-height: 40px;
134
+ --dc-search-select-padding-x: 16px;
135
+ --dc-search-select-radius: 8px;
136
+ }
137
+
138
+ .dc-search-select__slot-right {
139
+ position: absolute;
140
+ top: 0;
141
+ right: 0;
142
+ display: inline-flex;
143
+ flex-shrink: 0;
144
+ align-items: center;
145
+ justify-content: center;
146
+ width: var(--dc-search-select-height);
147
+ height: var(--dc-search-select-height);
148
+ pointer-events: none;
149
+ }
150
+
151
+ .dc-search-select__arrow {
152
+ transform: translateY(5%);
153
+ }
154
+
155
+ .dc-search-select__popover {
156
+ --dc-search-select-popover-padding: 8px;
157
+ --dc-search-select-popover-radius: 8px;
158
+
159
+ padding: 0;
160
+ padding-bottom: var(--dc-search-select-popover-padding);
161
+ border-radius: var(--dc-search-select-popover-radius);
162
+ }
163
+
164
+ .dc-search-select__textbox {
165
+ padding: var(--dc-search-select-popover-padding);
166
+ }
167
+
168
+ .dc-search-select__listbox {
169
+ max-height: 352px;
170
+ padding: 0 var(--dc-search-select-popover-padding);
171
+ margin: 0;
172
+ overflow-y: auto;
173
+ list-style: none;
174
+ border-bottom-right-radius: inherit;
175
+ border-bottom-left-radius: inherit;
176
+ }
177
+
178
+ .dc-search-select__listbox > [role="option"] + [role="option"] {
179
+ margin-top: 2px;
180
+ }
181
+
182
+ .dark .dc-search-select,
183
+ .dark.dc-search-select {
184
+ color-scheme: dark;
185
+ }
@@ -0,0 +1,43 @@
1
+ import { ReactNode } from 'react';
2
+ type RenderLabelFn<Value> = (value: Value) => ReactNode;
3
+ type RenderOptionsFn = (props: {
4
+ searchQuery: string;
5
+ searchQueryLowerCased: string;
6
+ }) => ReactNode;
7
+ export type SearchSelectSize = 'sm' | 'md' | 'lg';
8
+ export type SearchSelectProps<Value> = {
9
+ className?: string;
10
+ size?: SearchSelectSize;
11
+ fullWidth?: boolean;
12
+ invalid?: boolean;
13
+ loading?: boolean;
14
+ disabled?: boolean;
15
+ textboxIcon?: ReactNode;
16
+ textboxAriaLabel?: string;
17
+ textboxPlaceholder?: string;
18
+ labelledBy?: string;
19
+ displayedValue?: ReactNode | RenderLabelFn<Value>;
20
+ children?: ReactNode | RenderOptionsFn;
21
+ value: Value;
22
+ onChange: (value: Value) => void;
23
+ };
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 namespace SearchSelect {
26
+ var Option: <T>({ className, value, children, caption, }: {
27
+ className?: string;
28
+ value: T;
29
+ children: ReactNode;
30
+ caption?: ReactNode;
31
+ }) => import("react/jsx-runtime").JSX.Element;
32
+ var Separator: ({ className, children, }: {
33
+ className?: string;
34
+ children?: ReactNode;
35
+ }) => import("react/jsx-runtime").JSX.Element;
36
+ var ButtonLabel: ({ className, icon, value, children, }: {
37
+ className?: string;
38
+ icon?: ReactNode;
39
+ value: ReactNode;
40
+ children: ReactNode;
41
+ }) => import("react/jsx-runtime").JSX.Element;
42
+ }
43
+ export {};
@@ -0,0 +1,180 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId, useState, useEffect, } from 'react';
3
+ import { useSearchSelectContext, SearchSelectContextProvider, OptionStore, } from './context.js';
4
+ import { classNames } from '../../lib/react-helpers.js';
5
+ import { Popover } from '../popover/popover.js';
6
+ import { TextInput } from '../text-input/text-input.js';
7
+ import { Spinner } from '../spinner/spinner.js';
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, }) {
10
+ const id = useId();
11
+ const buttonId = `${id}button`;
12
+ const textboxId = `${id}textbox`;
13
+ const listboxId = `${id}listbox`;
14
+ const [options] = useState(() => new OptionStore(`${id}option-`));
15
+ const [isOpen, setIsOpen] = useState(false);
16
+ const [searchQuery, setSearchQuery] = useState('');
17
+ const [highlightedValue, setHighlightedValue] = useState(selectedValue);
18
+ const openPopover = () => {
19
+ if (disabled || loading) {
20
+ return;
21
+ }
22
+ options.clear();
23
+ setSearchQuery('');
24
+ setHighlightedValue(selectedValue);
25
+ setIsOpen(true);
26
+ window.setTimeout(() => {
27
+ const textbox = window.document.getElementById(textboxId);
28
+ if (textbox) {
29
+ textbox.focus();
30
+ }
31
+ });
32
+ };
33
+ const closePopover = () => {
34
+ setIsOpen(false);
35
+ window.setTimeout(() => {
36
+ const button = window.document.getElementById(buttonId);
37
+ if (button) {
38
+ button.focus();
39
+ }
40
+ });
41
+ };
42
+ const setSelectedValue = (value) => {
43
+ onSelectedValueChange(value);
44
+ closePopover();
45
+ };
46
+ const handleButtonClick = () => {
47
+ if (isOpen) {
48
+ closePopover();
49
+ }
50
+ else {
51
+ openPopover();
52
+ }
53
+ };
54
+ const handleButtonKeyDown = (event) => {
55
+ let handled = false;
56
+ if (event.key === 'ArrowUp') {
57
+ handled = true;
58
+ openPopover();
59
+ }
60
+ else if (event.key === 'ArrowDown') {
61
+ handled = true;
62
+ openPopover();
63
+ }
64
+ if (handled) {
65
+ event.preventDefault();
66
+ event.stopPropagation();
67
+ }
68
+ };
69
+ const handleTextboxChange = (event) => {
70
+ options.clear();
71
+ setSearchQuery(event.target.value);
72
+ };
73
+ const handleTextboxKeyDown = (event) => {
74
+ let handled = false;
75
+ if (event.key === 'ArrowUp') {
76
+ handled = true;
77
+ const values = options.values;
78
+ const index = values.indexOf(highlightedValue) - 1;
79
+ setHighlightedValue(index >= 0
80
+ ? values[index]
81
+ : values[values.length - 1]);
82
+ }
83
+ if (event.key === 'ArrowDown') {
84
+ handled = true;
85
+ const values = options.values;
86
+ const index = values.indexOf(highlightedValue) + 1;
87
+ setHighlightedValue(index < values.length
88
+ ? values[index]
89
+ : values[0]);
90
+ }
91
+ if (event.key === 'Home') {
92
+ handled = true;
93
+ const values = options.values;
94
+ setHighlightedValue(values[0]);
95
+ }
96
+ if (event.key === 'End') {
97
+ handled = true;
98
+ const values = options.values;
99
+ setHighlightedValue(values[values.length - 1]);
100
+ }
101
+ if (event.key === 'Enter') {
102
+ handled = true;
103
+ setSelectedValue(highlightedValue);
104
+ }
105
+ if (handled) {
106
+ event.preventDefault();
107
+ event.stopPropagation();
108
+ }
109
+ };
110
+ useEffect(() => {
111
+ const optionId = options.idOf(highlightedValue);
112
+ if (!optionId) {
113
+ return;
114
+ }
115
+ const listbox = window.document.getElementById(listboxId);
116
+ const option = window.document.getElementById(optionId);
117
+ if (!listbox || !option) {
118
+ return;
119
+ }
120
+ const listboxRect = listbox.getBoundingClientRect();
121
+ const optionRect = option.getBoundingClientRect();
122
+ if (optionRect.top < listboxRect.top) {
123
+ listbox.scrollTo({
124
+ top: optionRect.top - listboxRect.top + listbox.scrollTop,
125
+ });
126
+ }
127
+ else if (optionRect.bottom > listboxRect.bottom) {
128
+ listbox.scrollTo({
129
+ top: optionRect.bottom - listboxRect.bottom + listbox.scrollTop,
130
+ });
131
+ }
132
+ }, [listboxId, options, highlightedValue]);
133
+ const ctx = {
134
+ options: options,
135
+ selectedValue,
136
+ highlightedValue,
137
+ setSelectedValue: setSelectedValue,
138
+ setHighlightedValue: setHighlightedValue,
139
+ };
140
+ return (_jsx(Popover, { className: "dc-search-select__popover", isOpen: isOpen, onClose: closePopover, anchor: (_jsxs("button", { className: classNames(className, {
141
+ 'dc-search-select': true,
142
+ 'dc-search-select_full-width': fullWidth,
143
+ 'dc-search-select_invalid': invalid,
144
+ 'dc-search-select_loading': loading,
145
+ 'dc-search-select_disabled': disabled,
146
+ [`dc-search-select_size_${size}`]: size,
147
+ }), id: buttonId, "aria-expanded": isOpen, "aria-controls": listboxId, "aria-labelledby": labelledBy, tabIndex: disabled || loading ? -1 : undefined, type: "button", onClick: handleButtonClick, onKeyDown: handleButtonKeyDown, children: [typeof displayedValue === 'function'
148
+ ? displayedValue(selectedValue)
149
+ : displayedValue, _jsx("span", { className: "dc-search-select__slot-right", children: loading
150
+ ? (_jsx(Spinner, { className: "dc-search-select__spinner", width: "1.05em", height: "1.05em" }))
151
+ : (_jsx(ChevronDown, { className: "dc-search-select__arrow", width: "1.05em", height: "1.05em", strokeWidth: 2 })) })] })), alignment: "start", placement: "bottom", children: _jsxs(_Fragment, { children: [_jsx("div", { className: "dc-search-select__textbox", children: _jsx(TextInput, { id: textboxId, fullWidth: true, slotLeft: textboxIcon || _jsx(MagnifyingGlass, { width: 16, height: 16 }), placeholder: textboxPlaceholder, size: "sm", type: "text", role: "combobox", "aria-controls": listboxId, "aria-expanded": "true", "aria-autocomplete": "list", "aria-activedescendant": options.idOf(highlightedValue), "aria-label": textboxAriaLabel, value: searchQuery, onChange: handleTextboxChange, onKeyDown: handleTextboxKeyDown }) }), _jsx(SearchSelectContextProvider, { value: ctx, children: _jsx("ul", { className: "dc-search-select__listbox", id: listboxId, role: "listbox", children: typeof children === 'function'
152
+ ? children({
153
+ searchQuery,
154
+ searchQueryLowerCased: searchQuery.toLowerCase(),
155
+ })
156
+ : children }) })] }) }));
157
+ }
158
+ SearchSelect.Option = function SearchSelectOption({ className, value, children, caption, }) {
159
+ const { options, selectedValue, highlightedValue, setSelectedValue, setHighlightedValue, } = useSearchSelectContext();
160
+ const id = options.append(value);
161
+ const selected = value === selectedValue;
162
+ const highlighted = value === highlightedValue;
163
+ return (
164
+ /* eslint-disable jsx-a11y/click-events-have-key-events */
165
+ _jsxs("li", { className: classNames(className, {
166
+ 'dc-search-select-option': true,
167
+ 'dc-search-select-option_selected': selected,
168
+ 'dc-search-select-option_highlighted': highlighted,
169
+ }), id: id, role: "option", "aria-selected": highlighted, onClick: () => setSelectedValue(value), onMouseEnter: () => setHighlightedValue(value), children: [_jsx("div", { className: "dc-search-select-option__label", children: children }), caption
170
+ ? _jsx("div", { className: "dc-search-select-option__caption", children: caption })
171
+ : null] }));
172
+ };
173
+ SearchSelect.Separator = function SearchSelectSeparator({ className, children, }) {
174
+ return (_jsx("li", { className: classNames('dc-search-select-separator', className), role: "separator", children: children
175
+ ? _jsx("div", { className: "dc-search-select-separator__label", children: children })
176
+ : null }));
177
+ };
178
+ SearchSelect.ButtonLabel = function SearchSelectButtonLabel({ className, icon, value, children, }) {
179
+ return (_jsxs("div", { className: classNames('dc-search-select-button-label', className), children: [icon, _jsxs("span", { children: [children, " ", _jsx("b", { children: value })] })] }));
180
+ };
@@ -20,30 +20,30 @@ export type SelectProps = SelectBaseProps & ({
20
20
  onChangeValue?: (value: string[]) => void;
21
21
  });
22
22
  export declare const Select: import("react").ForwardRefExoticComponent<(Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>, "ref"> & {
23
- ref?: ((instance: HTMLSelectElement | null) => void) | import("react").RefObject<HTMLSelectElement> | null | undefined;
23
+ ref?: ((instance: HTMLSelectElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLSelectElement> | null | undefined;
24
24
  }, "defaultValue" | "size" | "value" | "multiple"> & {
25
- fullWidth?: boolean | undefined;
26
- invalid?: boolean | undefined;
27
- loading?: boolean | undefined;
28
- size?: SelectSize | undefined;
29
- displayedOptionsCount?: number | undefined;
25
+ fullWidth?: boolean;
26
+ invalid?: boolean;
27
+ loading?: boolean;
28
+ size?: SelectSize;
29
+ displayedOptionsCount?: number;
30
30
  } & {
31
- multiple?: false | undefined;
32
- value?: string | number | undefined;
33
- defaultValue?: string | number | undefined;
34
- onChangeValue?: ((value: string) => void) | undefined;
31
+ multiple?: false;
32
+ value?: string | number;
33
+ defaultValue?: string | number;
34
+ onChangeValue?: (value: string) => void;
35
35
  }, "ref"> | Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>, "ref"> & {
36
- ref?: ((instance: HTMLSelectElement | null) => void) | import("react").RefObject<HTMLSelectElement> | null | undefined;
36
+ ref?: ((instance: HTMLSelectElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLSelectElement> | null | undefined;
37
37
  }, "defaultValue" | "size" | "value" | "multiple"> & {
38
- fullWidth?: boolean | undefined;
39
- invalid?: boolean | undefined;
40
- loading?: boolean | undefined;
41
- size?: SelectSize | undefined;
42
- displayedOptionsCount?: number | undefined;
38
+ fullWidth?: boolean;
39
+ invalid?: boolean;
40
+ loading?: boolean;
41
+ size?: SelectSize;
42
+ displayedOptionsCount?: number;
43
43
  } & {
44
44
  multiple: true;
45
- value?: string[] | undefined;
46
- defaultValue?: string[] | undefined;
47
- onChangeValue?: ((value: string[]) => void) | undefined;
45
+ value?: string[];
46
+ defaultValue?: string[];
47
+ onChangeValue?: (value: string[]) => void;
48
48
  }, "ref">) & import("react").RefAttributes<HTMLSelectElement>>;
49
49
  export {};
@@ -11,7 +11,7 @@ export type SelectionControlProps = {
11
11
  children: JSX.Element | SelectionControlRenderFn;
12
12
  } & SelectionControlBaseProps;
13
13
  export declare const SelectionControl: import("react").ForwardRefExoticComponent<{
14
- labelFor?: string | undefined;
14
+ labelFor?: string;
15
15
  caption?: ReactNode;
16
16
  label: ReactNode;
17
17
  children: JSX.Element | SelectionControlRenderFn;
@@ -14,10 +14,10 @@ export type SlideOverRef = {
14
14
  close: () => void;
15
15
  };
16
16
  export declare const SlideOver: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
17
- animationDurationMs?: number | undefined;
18
- animationDisabled?: boolean | undefined;
19
- shouldCloseOnEscKeyPress?: boolean | undefined;
20
- shouldCloseOnBackdropClick?: boolean | undefined;
17
+ animationDurationMs?: number;
18
+ animationDisabled?: boolean;
19
+ shouldCloseOnEscKeyPress?: boolean;
20
+ shouldCloseOnBackdropClick?: boolean;
21
21
  onClose: SlideOverCloseCallback;
22
22
  } & import("react").RefAttributes<SlideOverRef>> & {
23
23
  Header: typeof SlideOverHeader;
@@ -3,5 +3,5 @@ export type SpinnerProps = ComponentPropsWithoutRef<'svg'> & {
3
3
  size?: number | string;
4
4
  };
5
5
  export declare const Spinner: import("react").ForwardRefExoticComponent<Omit<import("react").SVGProps<SVGSVGElement>, "ref"> & {
6
- size?: string | number | undefined;
6
+ size?: number | string;
7
7
  } & import("react").RefAttributes<SVGSVGElement>>;
@@ -1,5 +1,5 @@
1
1
  import { ComponentPropsWithRef } from 'react';
2
2
  export type TableBodyProps = ComponentPropsWithRef<'tbody'>;
3
3
  export declare const TableBody: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & {
4
- ref?: ((instance: HTMLTableSectionElement | null) => void) | import("react").RefObject<HTMLTableSectionElement> | null | undefined;
4
+ ref?: ((instance: HTMLTableSectionElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLTableSectionElement> | null | undefined;
5
5
  }, "ref"> & import("react").RefAttributes<HTMLTableSectionElement>>;
@@ -1,5 +1,5 @@
1
1
  import { ComponentPropsWithRef } from 'react';
2
2
  export type TableCellProps = ComponentPropsWithRef<'td'>;
3
3
  export declare const TableCell: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, "ref"> & {
4
- ref?: ((instance: HTMLTableDataCellElement | null) => void) | import("react").RefObject<HTMLTableDataCellElement> | null | undefined;
4
+ ref?: ((instance: HTMLTableDataCellElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLTableDataCellElement> | null | undefined;
5
5
  }, "ref"> & import("react").RefAttributes<HTMLTableCellElement>>;
@@ -1,5 +1,5 @@
1
1
  import { ComponentPropsWithRef } from 'react';
2
2
  export type ToastButtonProps = ComponentPropsWithRef<'button'>;
3
3
  export declare const ToastButton: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
4
- ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
4
+ ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
5
5
  }, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
@@ -15,7 +15,7 @@ export class Toaster {
15
15
  onHide;
16
16
  constructor(params) {
17
17
  this._id = 0;
18
- this.timeoutMs = params?.timeoutMs || 10000;
18
+ this.timeoutMs = params?.timeoutMs || 10_000;
19
19
  this.onShow = params?.onShowToast;
20
20
  this.onHide = params?.onHideToast;
21
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "draft-components",
3
- "version": "3.2.1",
3
+ "version": "3.4.0",
4
4
  "description": "The React based UI components library.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -22,7 +22,7 @@
22
22
  "css"
23
23
  ],
24
24
  "scripts": {
25
- "prepare": "husky install",
25
+ "prepare": "husky",
26
26
  "test": "vitest run",
27
27
  "coverage": "vitest run --coverage",
28
28
  "lint": "npm run lint-js && npm run lint-css",
@@ -55,47 +55,49 @@
55
55
  "react-dom": ">= 18"
56
56
  },
57
57
  "devDependencies": {
58
- "@heroicons/react": "2.1.1",
59
- "@storybook/addon-actions": "7.6.7",
60
- "@storybook/addon-essentials": "7.6.7",
61
- "@storybook/addon-links": "7.6.7",
62
- "@storybook/addon-themes": "7.6.7",
63
- "@storybook/react": "7.6.7",
64
- "@storybook/react-vite": "7.6.7",
65
- "@stylistic/eslint-plugin": "1.6.3",
66
- "@testing-library/dom": "9.3.3",
67
- "@testing-library/jest-dom": "6.2.0",
68
- "@testing-library/react": "14.1.2",
58
+ "@heroicons/react": "2.1.5",
59
+ "@storybook/addon-actions": "^8.2.7",
60
+ "@storybook/addon-essentials": "^8.2.7",
61
+ "@storybook/addon-links": "^8.2.7",
62
+ "@storybook/addon-themes": "^8.2.7",
63
+ "@storybook/core-common": "^8.2.7",
64
+ "@storybook/react": "^8.2.7",
65
+ "@storybook/react-vite": "^8.2.7",
66
+ "@stylistic/eslint-plugin": "2.6.1",
67
+ "@testing-library/dom": "10.4.0",
68
+ "@testing-library/jest-dom": "6.4.8",
69
+ "@testing-library/react": "16.0.0",
69
70
  "@testing-library/user-event": "14.5.2",
70
- "@types/node": "20.10.7",
71
- "@types/react": "18.2.47",
72
- "@types/react-dom": "18.2.18",
73
- "@typescript-eslint/eslint-plugin": "7.1.1",
74
- "@typescript-eslint/parser": "7.1.1",
75
- "@vitest/coverage-istanbul": "1.1.3",
76
- "autoprefixer": "10.4.16",
71
+ "@types/node": "20.14.13",
72
+ "@types/react": "18.3.3",
73
+ "@types/react-dom": "18.3.0",
74
+ "@typescript-eslint/eslint-plugin": "8.0.0",
75
+ "@typescript-eslint/parser": "8.0.0",
76
+ "@vitejs/plugin-react": "4.3.1",
77
+ "@vitest/coverage-istanbul": "2.0.5",
78
+ "autoprefixer": "10.4.19",
77
79
  "color": "4.2.3",
78
80
  "eslint": "8.57.0",
79
- "eslint-plugin-jsx-a11y": "6.8.0",
80
- "eslint-plugin-react": "7.34.0",
81
- "eslint-plugin-react-hooks": "4.6.0",
81
+ "eslint-plugin-jsx-a11y": "6.9.0",
82
+ "eslint-plugin-react": "7.35.0",
83
+ "eslint-plugin-react-hooks": "4.6.2",
82
84
  "eslint-plugin-storybook": "0.8.0",
83
- "eslint-plugin-testing-library": "6.2.0",
84
- "glob": "10.3.10",
85
- "husky": "8.0.3",
86
- "jsdom": "23.2.0",
87
- "lint-staged": "15.2.0",
88
- "postcss": "8.4.33",
89
- "postcss-import": "16.0.0",
90
- "react": "18.2.0",
91
- "react-dom": "18.2.0",
92
- "storybook": "7.6.7",
93
- "stylelint": "16.2.1",
94
- "stylelint-config-recess-order": "5.0.0",
95
- "stylelint-config-standard": "36.0.0",
96
- "typescript": "5.3.3",
97
- "vite": "5.0.11",
98
- "vitest": "1.1.3"
85
+ "eslint-plugin-testing-library": "6.2.2",
86
+ "glob": "11.0.0",
87
+ "husky": "9.1.4",
88
+ "jsdom": "24.1.1",
89
+ "lint-staged": "15.2.7",
90
+ "postcss": "8.4.40",
91
+ "postcss-import": "16.1.0",
92
+ "react": "18.3.1",
93
+ "react-dom": "18.3.1",
94
+ "storybook": "^8.2.7",
95
+ "stylelint": "16.8.1",
96
+ "stylelint-config-recess-order": "5.0.1",
97
+ "stylelint-config-standard": "36.0.1",
98
+ "typescript": "5.5.4",
99
+ "vite": "5.3.5",
100
+ "vitest": "2.0.5"
99
101
  },
100
102
  "lint-staged": {
101
103
  "*.ts?(x)": "npm run lint-js",