draft-components 1.6.0 → 1.7.1

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 (174) hide show
  1. package/cjs/components/dialog/dialog.cjs +1 -1
  2. package/cjs/components/filtered-search/filter-item.cjs +23 -0
  3. package/cjs/components/filtered-search/filter-operator-select.cjs +17 -0
  4. package/cjs/components/filtered-search/filter-token.cjs +17 -0
  5. package/cjs/components/filtered-search/filter-value-list.cjs +20 -0
  6. package/cjs/components/filtered-search/filtered-search.cjs +202 -0
  7. package/cjs/components/filtered-search/icons.cjs +21 -0
  8. package/cjs/components/filtered-search/model/abstract-filter.cjs +6 -0
  9. package/cjs/components/filtered-search/model/string-filter.cjs +46 -0
  10. package/cjs/components/filtered-search/model/string-set-filter.cjs +44 -0
  11. package/cjs/components/filtered-search/string-filter-input.cjs +17 -0
  12. package/cjs/components/filtered-search/string-filter-item.cjs +68 -0
  13. package/cjs/components/filtered-search/string-set-filter-item.cjs +77 -0
  14. package/cjs/components/filtered-search/use-combobox-ids.cjs +17 -0
  15. package/cjs/components/filtered-search/use-translations.cjs +24 -0
  16. package/cjs/components/index.cjs +12 -0
  17. package/cjs/components/popover/popover.cjs +3 -4
  18. package/cjs/components/slide-over/slide-over-body.cjs +10 -0
  19. package/cjs/components/slide-over/slide-over-context.cjs +24 -0
  20. package/cjs/components/slide-over/slide-over-header.cjs +21 -0
  21. package/cjs/components/slide-over/slide-over.cjs +106 -0
  22. package/cjs/hooks/index.cjs +2 -2
  23. package/cjs/hooks/use-disable-body-scroll.cjs +3 -1
  24. package/cjs/hooks/use-esc-key-down.cjs +3 -1
  25. package/cjs/hooks/use-focus-trap.cjs +3 -1
  26. package/cjs/index.cjs +16 -2
  27. package/cjs/lib/helpers.cjs +5 -1
  28. package/cjs/lib/index.cjs +2 -0
  29. package/cjs/lib/keyboard-keys.cjs +1 -0
  30. package/cjs/lib/react-helpers.cjs +8 -0
  31. package/css/draft-components.css +345 -2
  32. package/css/draft-components.dark.css +65 -40
  33. package/esm/components/dialog/dialog.js +1 -1
  34. package/esm/components/filtered-search/filter-item.js +21 -0
  35. package/esm/components/filtered-search/filter-operator-select.js +15 -0
  36. package/esm/components/filtered-search/filter-token.js +15 -0
  37. package/esm/components/filtered-search/filter-value-list.js +18 -0
  38. package/esm/components/filtered-search/filtered-search.js +200 -0
  39. package/esm/components/filtered-search/icons.js +16 -0
  40. package/esm/components/filtered-search/model/abstract-filter.js +4 -0
  41. package/esm/components/filtered-search/model/string-filter.js +44 -0
  42. package/esm/components/filtered-search/model/string-set-filter.js +42 -0
  43. package/esm/components/filtered-search/string-filter-input.js +15 -0
  44. package/esm/components/filtered-search/string-filter-item.js +66 -0
  45. package/esm/components/filtered-search/string-set-filter-item.js +75 -0
  46. package/esm/components/filtered-search/use-combobox-ids.js +15 -0
  47. package/esm/components/filtered-search/use-translations.js +21 -0
  48. package/esm/components/index.js +6 -0
  49. package/esm/components/popover/popover.js +3 -4
  50. package/esm/components/slide-over/slide-over-body.js +8 -0
  51. package/esm/components/slide-over/slide-over-context.js +21 -0
  52. package/esm/components/slide-over/slide-over-header.js +19 -0
  53. package/esm/components/slide-over/slide-over.js +104 -0
  54. package/esm/hooks/index.js +1 -1
  55. package/esm/hooks/use-disable-body-scroll.js +3 -1
  56. package/esm/hooks/use-esc-key-down.js +3 -1
  57. package/esm/hooks/use-focus-trap.js +3 -1
  58. package/esm/index.js +9 -3
  59. package/esm/lib/helpers.js +5 -2
  60. package/esm/lib/index.js +2 -2
  61. package/esm/lib/keyboard-keys.js +1 -0
  62. package/esm/lib/react-helpers.js +8 -1
  63. package/package.json +30 -30
  64. package/types/components/alert/alert.d.ts +1 -1
  65. package/types/components/avatar/avatar.d.ts +1 -1
  66. package/types/components/avatar-group/avatar-group.d.ts +1 -1
  67. package/types/components/badge/badge.d.ts +1 -1
  68. package/types/components/breadcrumbs/breadcrumbs-context.d.ts +1 -1
  69. package/types/components/breadcrumbs/breadcrumbs-item.d.ts +1 -1
  70. package/types/components/breadcrumbs/breadcrumbs.d.ts +1 -1
  71. package/types/components/button/button.d.ts +1 -1
  72. package/types/components/button/icon-button.d.ts +2 -2
  73. package/types/components/button-group/button-group.d.ts +1 -1
  74. package/types/components/caption/caption.d.ts +1 -1
  75. package/types/components/caption/icons.d.ts +1 -1
  76. package/types/components/checkbox/checkbox.d.ts +1 -1
  77. package/types/components/color-picker/color-picker-button.d.ts +1 -1
  78. package/types/components/color-picker/color-picker.d.ts +1 -1
  79. package/types/components/date-picker/calendar-day.d.ts +1 -1
  80. package/types/components/date-picker/calendar-grid-head.d.ts +1 -1
  81. package/types/components/date-picker/calendar-grid.d.ts +1 -1
  82. package/types/components/date-picker/calendar.d.ts +3 -3
  83. package/types/components/date-picker/date-picker.d.ts +3 -3
  84. package/types/components/date-picker/date-range-picker.d.ts +4 -4
  85. package/types/components/date-picker/date-range.d.ts +1 -1
  86. package/types/components/date-picker/icons.d.ts +1 -1
  87. package/types/components/date-picker-popover/date-picker-popover.d.ts +3 -3
  88. package/types/components/date-range-picker-popover/date-range-picker-popover-footer.d.ts +1 -1
  89. package/types/components/date-range-picker-popover/date-range-picker-popover-presets.d.ts +1 -1
  90. package/types/components/date-range-picker-popover/date-range-picker-popover.d.ts +4 -4
  91. package/types/components/date-range-picker-popover/types.d.ts +1 -1
  92. package/types/components/dialog/dialog-body.d.ts +1 -1
  93. package/types/components/dialog/dialog-context.d.ts +1 -1
  94. package/types/components/dialog/dialog-footer.d.ts +1 -1
  95. package/types/components/dialog/dialog-header.d.ts +1 -1
  96. package/types/components/dialog/dialog.d.ts +1 -1
  97. package/types/components/dialog/x-mark-icon.d.ts +1 -1
  98. package/types/components/empty-state/empty-state.d.ts +1 -1
  99. package/types/components/filter-buttons/filter-button.d.ts +1 -1
  100. package/types/components/filter-buttons/filter-buttons.d.ts +1 -1
  101. package/types/components/filtered-search/filter-item.d.ts +10 -0
  102. package/types/components/filtered-search/filter-operator-select.d.ts +10 -0
  103. package/types/components/filtered-search/filter-token.d.ts +9 -0
  104. package/types/components/filtered-search/filter-value-list.d.ts +8 -0
  105. package/types/components/filtered-search/filtered-search.d.ts +15 -0
  106. package/types/components/filtered-search/icons.d.ts +5 -0
  107. package/types/components/filtered-search/index.d.ts +4 -0
  108. package/types/components/filtered-search/model/abstract-filter.d.ts +6 -0
  109. package/types/components/filtered-search/model/string-filter.d.ts +47 -0
  110. package/types/components/filtered-search/model/string-set-filter.d.ts +41 -0
  111. package/types/components/filtered-search/model/validation-result.d.ts +6 -0
  112. package/types/components/filtered-search/string-filter-input.d.ts +9 -0
  113. package/types/components/filtered-search/string-filter-item.d.ts +13 -0
  114. package/types/components/filtered-search/string-set-filter-item.d.ts +15 -0
  115. package/types/components/filtered-search/types.d.ts +4 -0
  116. package/types/components/filtered-search/use-combobox-ids.d.ts +5 -0
  117. package/types/components/filtered-search/use-translations.d.ts +13 -0
  118. package/types/components/form-field/form-field.d.ts +1 -1
  119. package/types/components/index.d.ts +2 -0
  120. package/types/components/label/label.d.ts +1 -1
  121. package/types/components/menu/menu-item.d.ts +1 -1
  122. package/types/components/menu/menu-separator.d.ts +1 -1
  123. package/types/components/menu/menu.d.ts +3 -3
  124. package/types/components/nav-list/nav-list-item.d.ts +1 -1
  125. package/types/components/nav-list/nav-list-title.d.ts +1 -1
  126. package/types/components/nav-list/nav-list.d.ts +1 -1
  127. package/types/components/password-input/icons.d.ts +1 -1
  128. package/types/components/password-input/password-input.d.ts +1 -1
  129. package/types/components/popover/popover.d.ts +3 -1
  130. package/types/components/portal/portal-context.d.ts +1 -1
  131. package/types/components/portal/portal.d.ts +1 -1
  132. package/types/components/positioner/calc-position.d.ts +1 -1
  133. package/types/components/positioner/positioner.d.ts +2 -2
  134. package/types/components/radio/radio.d.ts +1 -1
  135. package/types/components/segmented-control/segmented-control-button.d.ts +1 -1
  136. package/types/components/segmented-control/segmented-control.d.ts +1 -1
  137. package/types/components/select/select.d.ts +1 -1
  138. package/types/components/selection-control/selection-control.d.ts +1 -1
  139. package/types/components/slide-over/index.d.ts +4 -0
  140. package/types/components/slide-over/slide-over-body.d.ts +3 -0
  141. package/types/components/slide-over/slide-over-context.d.ts +14 -0
  142. package/types/components/slide-over/slide-over-header.d.ts +11 -0
  143. package/types/components/slide-over/slide-over.d.ts +15 -0
  144. package/types/components/slide-over/types.d.ts +1 -0
  145. package/types/components/slider/slider-tick-marks.d.ts +1 -1
  146. package/types/components/slider/slider.d.ts +2 -2
  147. package/types/components/spinner/spinner.d.ts +1 -1
  148. package/types/components/switch/switch.d.ts +1 -1
  149. package/types/components/table/table-body.d.ts +1 -1
  150. package/types/components/table/table-cell.d.ts +1 -1
  151. package/types/components/table/table-container.d.ts +1 -1
  152. package/types/components/table/table-head-cell.d.ts +1 -1
  153. package/types/components/table/table-head.d.ts +1 -1
  154. package/types/components/table/table-row.d.ts +1 -1
  155. package/types/components/table/table.d.ts +1 -1
  156. package/types/components/tabs/tab-list.d.ts +1 -1
  157. package/types/components/tabs/tab-panel.d.ts +2 -2
  158. package/types/components/tabs/tab.d.ts +1 -1
  159. package/types/components/tabs/tabs-context.d.ts +2 -2
  160. package/types/components/tabs/tabs.d.ts +2 -2
  161. package/types/components/tag/tag.d.ts +1 -1
  162. package/types/components/text-input/text-input.d.ts +1 -1
  163. package/types/components/textarea/textarea.d.ts +1 -1
  164. package/types/components/toast/toast-button.d.ts +1 -1
  165. package/types/components/toast/toast.d.ts +1 -1
  166. package/types/components/toaster/toaster.d.ts +1 -1
  167. package/types/components/tooltip/tooltip.d.ts +2 -2
  168. package/types/hooks/index.d.ts +1 -1
  169. package/types/hooks/use-disable-body-scroll.d.ts +1 -1
  170. package/types/hooks/use-esc-key-down.d.ts +1 -1
  171. package/types/hooks/use-focus-trap.d.ts +2 -2
  172. package/types/lib/helpers.d.ts +1 -0
  173. package/types/lib/keyboard-keys.d.ts +1 -0
  174. package/types/lib/react-helpers.d.ts +2 -1
@@ -1,4 +1,4 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
1
+ import { ComponentPropsWithoutRef } from 'react';
2
2
  type TagBaseProps = ComponentPropsWithoutRef<'strong'>;
3
3
  export type TagFill = 'gray' | 'green' | 'cyan' | 'blue' | 'purple' | 'pink' | 'red' | 'orange' | 'yellow';
4
4
  export type TagSize = 'sm' | 'md' | 'lg';
@@ -1,4 +1,4 @@
1
- import { type ComponentPropsWithRef, type ReactNode } from 'react';
1
+ import { ComponentPropsWithRef, ReactNode } from 'react';
2
2
  type TextInputHTMLProps = ComponentPropsWithRef<'input'>;
3
3
  type TextInputBaseProps = Omit<TextInputHTMLProps, 'type' | 'width' | 'size'>;
4
4
  export type TextInputType = 'date' | 'datetime-local' | 'email' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url';
@@ -1,4 +1,4 @@
1
- import { type ComponentPropsWithRef, type ReactNode } from 'react';
1
+ import { ComponentPropsWithRef, ReactNode } from 'react';
2
2
  type TextareaHTMLProps = ComponentPropsWithRef<'textarea'>;
3
3
  export type TextareaSize = 'sm' | 'md' | 'lg';
4
4
  export type TextareaWidth = '30ch' | '40ch' | '60ch' | '80ch';
@@ -1,4 +1,4 @@
1
- import { type ComponentPropsWithRef } from 'react';
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
4
  ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
@@ -1,4 +1,4 @@
1
- import { type ComponentPropsWithoutRef, type MouseEventHandler, type ReactNode } from 'react';
1
+ import { ComponentPropsWithoutRef, MouseEventHandler, ReactNode } from 'react';
2
2
  type ToastBaseProps = ComponentPropsWithoutRef<'section'>;
3
3
  export type ToastProps = {
4
4
  icon?: ReactNode;
@@ -1,4 +1,4 @@
1
- import { type ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
  type YPosition = 'top' | 'bottom';
3
3
  type XPosition = 'left' | 'center' | 'right';
4
4
  export type ToastPosition = `${YPosition}-${XPosition}`;
@@ -1,5 +1,5 @@
1
- import { type ComponentPropsWithoutRef, type ReactNode, type RefCallback } from 'react';
2
- import { type PositionerProps } from '../positioner';
1
+ import { ComponentPropsWithoutRef, ReactNode, RefCallback } from 'react';
2
+ import { PositionerProps } from '../positioner';
3
3
  type TooltipChildrenRenderFn = (props: {
4
4
  ref: RefCallback<HTMLElement>;
5
5
  }, context: {
@@ -1,4 +1,4 @@
1
- export * from './use-mount-transition';
2
1
  export * from './use-disable-body-scroll';
3
2
  export * from './use-esc-key-down';
4
3
  export * from './use-focus-trap';
4
+ export * from './use-mount-transition';
@@ -1,5 +1,5 @@
1
1
  type Options = {
2
2
  isEnabled: boolean;
3
3
  };
4
- export declare function useDisableBodyScroll(options: Options): void;
4
+ export declare function useDisableBodyScroll(options?: Options): void;
5
5
  export {};
@@ -13,5 +13,5 @@ type Options = {
13
13
  * @param options.isEnabled A flag that determines whether to run
14
14
  * the passed handler or not.
15
15
  */
16
- export declare function useEscKeyDown(handler: Handler, options: Options): void;
16
+ export declare function useEscKeyDown(handler: Handler, options?: Options): void;
17
17
  export {};
@@ -1,4 +1,4 @@
1
- import { type RefObject } from 'react';
1
+ import { RefObject } from 'react';
2
2
  type ModalRef = RefObject<HTMLElement>;
3
3
  type Options = {
4
4
  isEnabled: boolean;
@@ -11,5 +11,5 @@ type Options = {
11
11
  * @param {boolean} options.isEnabled - A flag that determines whether
12
12
  * to trap focus or not.
13
13
  */
14
- export declare function useFocusTrap(modalRef: ModalRef, options: Options): void;
14
+ export declare function useFocusTrap(modalRef: ModalRef, options?: Options): void;
15
15
  export {};
@@ -1,4 +1,5 @@
1
1
  type AnyFunction = (...args: any[]) => any;
2
2
  export declare function once<T extends AnyFunction>(fn: T): (...args: Parameters<T>) => ReturnType<T>;
3
+ export declare function exhaustiveCheck(value: never, message?: string): never;
3
4
  export declare function assertIfNullable<T>(value: T, message?: string): asserts value is NonNullable<T>;
4
5
  export {};
@@ -10,5 +10,6 @@ export declare const KeyboardKeys: {
10
10
  PageDown: string;
11
11
  Enter: string;
12
12
  Escape: string;
13
+ Backspace: string;
13
14
  Space: string;
14
15
  };
@@ -1,4 +1,4 @@
1
- import { type MutableRefObject, type ReactElement, type Ref, type RefCallback } from 'react';
1
+ import { type MutableRefObject, type ReactElement, type Ref, type RefCallback, RefObject } from 'react';
2
2
  export type ClassNamesObject = {
3
3
  [className: string]: unknown;
4
4
  };
@@ -11,3 +11,4 @@ export type ReactElementWithRef = ReactElement & {
11
11
  };
12
12
  export declare function isReactElementWithRef(element: unknown): element is ReactElementWithRef;
13
13
  export declare function focusElement(element: EventTarget | null | undefined): void;
14
+ export declare function getRefElement<T extends HTMLElement>(ref: RefObject<T> | MutableRefObject<T>, message?: string): NonNullable<T>;