@mantine/core 7.0.0-alpha.15 → 7.0.0-alpha.16

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 (141) hide show
  1. package/cjs/components/Combobox/Combobox.js +9 -1
  2. package/cjs/components/Combobox/Combobox.js.map +1 -1
  3. package/cjs/components/Combobox/Combobox.module.css.js +1 -1
  4. package/cjs/components/Combobox/ComboboxDropdown/ComboboxDropdown.js +3 -5
  5. package/cjs/components/Combobox/ComboboxDropdown/ComboboxDropdown.js.map +1 -1
  6. package/cjs/components/Combobox/ComboboxDropdownTarget/ComboboxDropdownTarget.js +32 -0
  7. package/cjs/components/Combobox/ComboboxDropdownTarget/ComboboxDropdownTarget.js.map +1 -0
  8. package/cjs/components/Combobox/ComboboxEmpty/ComboboxEmpty.js.map +1 -1
  9. package/cjs/components/Combobox/ComboboxEventsTarget/ComboboxEventsTarget.js +71 -0
  10. package/cjs/components/Combobox/ComboboxEventsTarget/ComboboxEventsTarget.js.map +1 -0
  11. package/cjs/components/Combobox/ComboboxFooter/ComboboxFooter.js.map +1 -1
  12. package/cjs/components/Combobox/ComboboxHeader/ComboboxHeader.js.map +1 -1
  13. package/cjs/components/Combobox/ComboboxOption/ComboboxOption.js +2 -3
  14. package/cjs/components/Combobox/ComboboxOption/ComboboxOption.js.map +1 -1
  15. package/cjs/components/Combobox/ComboboxSearch/ComboboxSearch.js +7 -2
  16. package/cjs/components/Combobox/ComboboxSearch/ComboboxSearch.js.map +1 -1
  17. package/cjs/components/Combobox/use-combobox/use-combobox.js.map +1 -1
  18. package/cjs/components/Input/Input.js +19 -10
  19. package/cjs/components/Input/Input.js.map +1 -1
  20. package/cjs/components/Input/InputDescription/InputDescription.js +1 -1
  21. package/cjs/components/Input/InputDescription/InputDescription.js.map +1 -1
  22. package/cjs/components/Input/InputError/InputError.js +1 -1
  23. package/cjs/components/Input/InputError/InputError.js.map +1 -1
  24. package/cjs/components/Input/InputLabel/InputLabel.js +1 -1
  25. package/cjs/components/Input/InputLabel/InputLabel.js.map +1 -1
  26. package/cjs/components/Input/InputWrapper/InputWrapper.js +9 -5
  27. package/cjs/components/Input/InputWrapper/InputWrapper.js.map +1 -1
  28. package/cjs/components/Input/InputWrapper.context.js +4 -5
  29. package/cjs/components/Input/InputWrapper.context.js.map +1 -1
  30. package/cjs/components/Input/use-input-props.js +0 -4
  31. package/cjs/components/Input/use-input-props.js.map +1 -1
  32. package/cjs/components/InputBase/InputBase.js +2 -1
  33. package/cjs/components/InputBase/InputBase.js.map +1 -1
  34. package/cjs/components/Pill/Pill.js +158 -0
  35. package/cjs/components/Pill/Pill.js.map +1 -0
  36. package/cjs/components/Pill/Pill.module.css.js +8 -0
  37. package/cjs/components/Pill/Pill.module.css.js.map +1 -0
  38. package/cjs/components/Pill/PillGroup/PillGroup.js +78 -0
  39. package/cjs/components/Pill/PillGroup/PillGroup.js.map +1 -0
  40. package/cjs/components/Pill/PillGroup/PillGroup.module.css.js +8 -0
  41. package/cjs/components/Pill/PillGroup/PillGroup.module.css.js.map +1 -0
  42. package/cjs/components/Pill/PillGroup.context.js +11 -0
  43. package/cjs/components/Pill/PillGroup.context.js.map +1 -0
  44. package/cjs/components/PillsInput/PillsInput.context.js +11 -0
  45. package/cjs/components/PillsInput/PillsInput.context.js.map +1 -0
  46. package/cjs/components/PillsInput/PillsInput.js +105 -0
  47. package/cjs/components/PillsInput/PillsInput.js.map +1 -0
  48. package/cjs/components/PillsInput/PillsInputField/PillsInputField.js +88 -0
  49. package/cjs/components/PillsInput/PillsInputField/PillsInputField.js.map +1 -0
  50. package/cjs/components/PillsInput/PillsInputField/PillsInputField.module.css.js +8 -0
  51. package/cjs/components/PillsInput/PillsInputField/PillsInputField.module.css.js.map +1 -0
  52. package/cjs/components/Popover/PopoverDropdown/PopoverDropdown.js +2 -2
  53. package/cjs/components/Popover/PopoverDropdown/PopoverDropdown.js.map +1 -1
  54. package/cjs/core/utils/create-optional-context/create-optional-context.js +19 -0
  55. package/cjs/core/utils/create-optional-context/create-optional-context.js.map +1 -0
  56. package/cjs/index.css +182 -16
  57. package/cjs/index.js +20 -0
  58. package/cjs/index.js.map +1 -1
  59. package/esm/components/Combobox/Combobox.js +9 -1
  60. package/esm/components/Combobox/Combobox.js.map +1 -1
  61. package/esm/components/Combobox/Combobox.module.css.js +1 -1
  62. package/esm/components/Combobox/ComboboxDropdown/ComboboxDropdown.js +3 -5
  63. package/esm/components/Combobox/ComboboxDropdown/ComboboxDropdown.js.map +1 -1
  64. package/esm/components/Combobox/ComboboxDropdownTarget/ComboboxDropdownTarget.js +24 -0
  65. package/esm/components/Combobox/ComboboxDropdownTarget/ComboboxDropdownTarget.js.map +1 -0
  66. package/esm/components/Combobox/ComboboxEmpty/ComboboxEmpty.js.map +1 -1
  67. package/esm/components/Combobox/ComboboxEventsTarget/ComboboxEventsTarget.js +67 -0
  68. package/esm/components/Combobox/ComboboxEventsTarget/ComboboxEventsTarget.js.map +1 -0
  69. package/esm/components/Combobox/ComboboxFooter/ComboboxFooter.js.map +1 -1
  70. package/esm/components/Combobox/ComboboxHeader/ComboboxHeader.js.map +1 -1
  71. package/esm/components/Combobox/ComboboxOption/ComboboxOption.js +2 -3
  72. package/esm/components/Combobox/ComboboxOption/ComboboxOption.js.map +1 -1
  73. package/esm/components/Combobox/ComboboxSearch/ComboboxSearch.js +7 -2
  74. package/esm/components/Combobox/ComboboxSearch/ComboboxSearch.js.map +1 -1
  75. package/esm/components/Combobox/use-combobox/use-combobox.js.map +1 -1
  76. package/esm/components/Input/Input.js +19 -10
  77. package/esm/components/Input/Input.js.map +1 -1
  78. package/esm/components/Input/InputDescription/InputDescription.js +1 -1
  79. package/esm/components/Input/InputDescription/InputDescription.js.map +1 -1
  80. package/esm/components/Input/InputError/InputError.js +1 -1
  81. package/esm/components/Input/InputError/InputError.js.map +1 -1
  82. package/esm/components/Input/InputLabel/InputLabel.js +1 -1
  83. package/esm/components/Input/InputLabel/InputLabel.js.map +1 -1
  84. package/esm/components/Input/InputWrapper/InputWrapper.js +9 -5
  85. package/esm/components/Input/InputWrapper/InputWrapper.js.map +1 -1
  86. package/esm/components/Input/InputWrapper.context.js +4 -5
  87. package/esm/components/Input/InputWrapper.context.js.map +1 -1
  88. package/esm/components/Input/use-input-props.js +0 -4
  89. package/esm/components/Input/use-input-props.js.map +1 -1
  90. package/esm/components/InputBase/InputBase.js +2 -1
  91. package/esm/components/InputBase/InputBase.js.map +1 -1
  92. package/esm/components/Pill/Pill.js +150 -0
  93. package/esm/components/Pill/Pill.js.map +1 -0
  94. package/esm/components/Pill/Pill.module.css.js +4 -0
  95. package/esm/components/Pill/Pill.module.css.js.map +1 -0
  96. package/esm/components/Pill/PillGroup/PillGroup.js +70 -0
  97. package/esm/components/Pill/PillGroup/PillGroup.js.map +1 -0
  98. package/esm/components/Pill/PillGroup/PillGroup.module.css.js +4 -0
  99. package/esm/components/Pill/PillGroup/PillGroup.module.css.js.map +1 -0
  100. package/esm/components/Pill/PillGroup.context.js +6 -0
  101. package/esm/components/Pill/PillGroup.context.js.map +1 -0
  102. package/esm/components/PillsInput/PillsInput.context.js +6 -0
  103. package/esm/components/PillsInput/PillsInput.context.js.map +1 -0
  104. package/esm/components/PillsInput/PillsInput.js +97 -0
  105. package/esm/components/PillsInput/PillsInput.js.map +1 -0
  106. package/esm/components/PillsInput/PillsInputField/PillsInputField.js +80 -0
  107. package/esm/components/PillsInput/PillsInputField/PillsInputField.js.map +1 -0
  108. package/esm/components/PillsInput/PillsInputField/PillsInputField.module.css.js +4 -0
  109. package/esm/components/PillsInput/PillsInputField/PillsInputField.module.css.js.map +1 -0
  110. package/esm/components/Popover/PopoverDropdown/PopoverDropdown.js +2 -2
  111. package/esm/components/Popover/PopoverDropdown/PopoverDropdown.js.map +1 -1
  112. package/esm/core/utils/create-optional-context/create-optional-context.js +11 -0
  113. package/esm/core/utils/create-optional-context/create-optional-context.js.map +1 -0
  114. package/esm/index.css +182 -16
  115. package/esm/index.js +10 -0
  116. package/esm/index.js.map +1 -1
  117. package/lib/components/Combobox/Combobox.d.ts +16 -1
  118. package/lib/components/Combobox/ComboboxDropdownTarget/ComboboxDropdownTarget.d.ts +18 -0
  119. package/lib/components/Combobox/ComboboxEventsTarget/ComboboxEventsTarget.d.ts +27 -0
  120. package/lib/components/Combobox/index.d.ts +9 -1
  121. package/lib/components/Combobox/use-combobox/use-combobox.d.ts +33 -2
  122. package/lib/components/Input/Input.d.ts +6 -2
  123. package/lib/components/Input/InputWrapper.context.d.ts +5 -2
  124. package/lib/components/Input/index.d.ts +1 -0
  125. package/lib/components/Input/use-input-props.d.ts +48 -49
  126. package/lib/components/InputBase/InputBase.d.ts +2 -0
  127. package/lib/components/Pill/Pill.d.ts +48 -0
  128. package/lib/components/Pill/PillGroup/PillGroup.d.ts +31 -0
  129. package/lib/components/Pill/PillGroup.context.d.ts +10 -0
  130. package/lib/components/Pill/index.d.ts +4 -0
  131. package/lib/components/PillsInput/PillsInput.context.d.ts +14 -0
  132. package/lib/components/PillsInput/PillsInput.d.ts +22 -0
  133. package/lib/components/PillsInput/PillsInputField/PillsInputField.d.ts +22 -0
  134. package/lib/components/PillsInput/index.d.ts +4 -0
  135. package/lib/components/UnstyledButton/UnstyledButton.d.ts +1 -1
  136. package/lib/components/index.d.ts +2 -0
  137. package/lib/core/Box/Box.d.ts +1 -1
  138. package/lib/core/MantineProvider/use-mantine-color-scheme/use-computed-color-scheme.d.ts +1 -1
  139. package/lib/core/utils/create-optional-context/create-optional-context.d.ts +5 -0
  140. package/lib/core/utils/index.d.ts +1 -0
  141. package/package.json +2 -2
@@ -1,27 +1,59 @@
1
1
  /// <reference types="react" />
2
2
  export type ComboboxDropdownEventSource = 'keyboard' | 'mouse' | 'unknown';
3
3
  export interface ComboboxStore {
4
+ /** Current dropdown opened state */
4
5
  dropdownOpened: boolean;
6
+ /** Opens dropdown */
5
7
  openDropdown(eventSource?: ComboboxDropdownEventSource): void;
8
+ /** Closes dropdown */
6
9
  closeDropdown(eventSource?: ComboboxDropdownEventSource): void;
10
+ /** Toggles dropdown opened state */
7
11
  toggleDropdown(eventSource?: ComboboxDropdownEventSource): void;
12
+ /** Selected option index */
8
13
  selectedOptionIndex: number;
14
+ /** Selects `Combobox.Option` by index */
9
15
  selectOption(index: number): void;
16
+ /** Selects first `Combobox.Option` with `active` prop.
17
+ * If there are no such options, the function does nothing.
18
+ */
10
19
  selectActiveOption(): string | null;
20
+ /** Selects first `Combobox.Option` that is not disabled.
21
+ * If there are no such options, the function does nothing.
22
+ * */
11
23
  selectFirstOption(): string | null;
24
+ /** Selects next `Combobox.Option` that is not disabled.
25
+ * If the current option is the last one, the function selects first option, if `loop` is true.
26
+ */
12
27
  selectNextOption(): string | null;
28
+ /** Selects previous `Combobox.Option` that is not disabled.
29
+ * If the current option is the first one, the function selects last option, if `loop` is true.
30
+ * */
13
31
  selectPreviousOption(): string | null;
32
+ /** Resets selected option index to -1, removes `data-combobox-selected` from selected option */
14
33
  resetSelectedOption(): void;
34
+ /** Triggers `onClick` event of selected option.
35
+ * If there is no selected option, the function does nothing.
36
+ */
15
37
  clickSelectedOption(): void;
38
+ /** Updates selected option index to currently selected or active option.
39
+ * The function is required to be used with searchable components to update selected option index
40
+ * when options list changes based on search query.
41
+ */
16
42
  updateSelectedOptionIndex(target?: 'active' | 'selected'): void;
43
+ /** List id, used for `aria-*` attributes */
17
44
  listId: string | null;
45
+ /** Sets list id */
18
46
  setListId(id: string): void;
47
+ /** Ref of `Combobox.Search` input */
19
48
  searchRef: React.MutableRefObject<HTMLInputElement | null>;
49
+ /** Moves focus to `Combobox.Search` input */
20
50
  focusSearchInput(): void;
51
+ /** Ref of the target element */
21
52
  targetRef: React.MutableRefObject<HTMLElement | null>;
53
+ /** Moves focus to the target element */
22
54
  focusTarget(): void;
23
55
  }
24
- interface UseComboboxOptions {
56
+ export interface UseComboboxOptions {
25
57
  /** Default value for `dropdownOpened`, `false` by default */
26
58
  defaultOpened?: boolean;
27
59
  /** Controlled `dropdownOpened` state */
@@ -38,4 +70,3 @@ interface UseComboboxOptions {
38
70
  scrollBehavior?: ScrollBehavior;
39
71
  }
40
72
  export declare function useCombobox({ defaultOpened, opened, onOpenedChange, onDropdownClose, onDropdownOpen, loop, scrollBehavior, }?: UseComboboxOptions): ComboboxStore;
41
- export {};
@@ -14,8 +14,8 @@ export type InputCssVariables = {
14
14
  wrapper: '--input-height' | '--input-fz' | '--input-radius' | '--input-left-section-width' | '--input-right-section-width' | '--input-left-section-pointer-events' | '--input-right-section-pointer-events' | '--input-padding-y' | '--input-margin-top' | '--input-margin-bottom';
15
15
  };
16
16
  export interface InputStylesCtx {
17
- offsetTop: boolean;
18
- offsetBottom: boolean;
17
+ offsetTop: boolean | undefined;
18
+ offsetBottom: boolean | undefined;
19
19
  }
20
20
  export interface __InputProps {
21
21
  /** Content section rendered on the left side of the input */
@@ -55,6 +55,10 @@ export interface InputProps extends BoxProps, __InputProps, StylesApiProps<Input
55
55
  error?: React.ReactNode;
56
56
  /** Determines whether the input can have multiple lines, for example when `component="textarea"`, `false` by default */
57
57
  multiline?: boolean;
58
+ /** Input element id */
59
+ id?: string;
60
+ /** Determines whether `aria-` and other accessibility attributes should be added to the input, `true` by default */
61
+ withAria?: boolean;
58
62
  }
59
63
  export type InputFactory = PolymorphicFactory<{
60
64
  props: InputProps;
@@ -5,8 +5,11 @@ interface InputWrapperContextValue {
5
5
  offsetTop: boolean;
6
6
  offsetBottom: boolean;
7
7
  describedBy: string | undefined;
8
+ inputId: string | undefined;
8
9
  getStyles: GetStylesApi<InputWrapperFactory> | null;
9
10
  }
10
- export declare const InputWrapperProvider: import("react").Provider<InputWrapperContextValue>;
11
- export declare const useInputWrapperContext: () => InputWrapperContextValue;
11
+ export declare const InputWrapperProvider: ({ children, value }: {
12
+ value: InputWrapperContextValue;
13
+ children: import("react").ReactNode;
14
+ }) => JSX.Element, useInputWrapperContext: () => InputWrapperContextValue | null;
12
15
  export {};
@@ -5,6 +5,7 @@ export { InputError } from './InputError/InputError';
5
5
  export { InputLabel } from './InputLabel/InputLabel';
6
6
  export { InputPlaceholder } from './InputPlaceholder/InputPlaceholder';
7
7
  export { useInputProps } from './use-input-props';
8
+ export { useInputWrapperContext } from './InputWrapper.context';
8
9
  export type { __InputProps, __BaseInputProps, __InputStylesNames, InputCssVariables, InputFactory, InputProps, InputStylesNames, InputVariant, } from './Input';
9
10
  export type { __InputWrapperProps, InputWrapperFactory, InputWrapperProps, InputWrapperStylesNames, } from './InputWrapper/InputWrapper';
10
11
  export type { InputDescriptionCssVariables, InputDescriptionFactory, InputDescriptionProps, InputDescriptionStylesNames, InputDescriptionVariant, } from './InputDescription/InputDescription';
@@ -9,33 +9,68 @@ interface BaseProps extends __BaseInputProps, BoxProps, StylesApiProps<{
9
9
  __stylesApiProps?: Record<string, any>;
10
10
  id?: string;
11
11
  }
12
- export declare function useInputProps<T extends BaseProps, U extends Partial<T>>(component: string, defaultProps: U, _props: T): Omit<T & { [Key in Extract<keyof T, never>]-?: {}[Key] | NonNullable<T[Key]>; }, "vars" | "variant" | "className" | "style" | "unstyled" | "classNames" | "styles" | "size" | "__staticSelector" | "label" | "id" | "required" | "error" | "description" | "__stylesApiProps" | "withAsterisk" | "labelProps" | "descriptionProps" | "errorProps" | "inputContainer" | "inputWrapperOrder" | "wrapperProps"> & {
12
+ export declare function useInputProps<T extends BaseProps, U extends Partial<T>>(component: string, defaultProps: U, _props: T): Omit<T & { [Key in Extract<keyof T, never>]-?: {}[Key] | NonNullable<T[Key]>; }, "label" | "style" | "className" | "variant" | "size" | "styles" | "description" | "required" | "id" | "__staticSelector" | "unstyled" | "classNames" | "vars" | "error" | "__stylesApiProps" | "withAsterisk" | "labelProps" | "descriptionProps" | "errorProps" | "inputContainer" | "inputWrapperOrder" | "wrapperProps"> & {
13
13
  classNames: Partial<Record<string, string>> | ((theme: import("../../core").MantineTheme, props: any, ctx: unknown) => Partial<Record<string, string>>) | undefined;
14
14
  styles: Partial<Record<string, import("react").CSSProperties>> | ((theme: import("../../core").MantineTheme, props: any, ctx: unknown) => Partial<Record<string, import("react").CSSProperties>>) | undefined;
15
15
  unstyled: boolean | undefined;
16
16
  wrapperProps: {
17
- className: string | undefined;
18
- style: import("../../core").MantineStyleProp;
19
17
  children?: import("react").ReactNode;
20
- hidden?: boolean | undefined;
21
- color?: string | undefined;
22
18
  slot?: string | undefined;
19
+ style: import("../../core").MantineStyleProp;
23
20
  title?: string | undefined;
21
+ className: string | undefined;
22
+ color?: string | undefined;
23
+ translate?: "yes" | "no" | undefined;
24
+ hidden?: boolean | undefined;
24
25
  key?: import("react").Key | null | undefined;
25
- id: string;
26
+ defaultChecked?: boolean | undefined;
27
+ defaultValue?: string | number | readonly string[] | undefined;
28
+ suppressContentEditableWarning?: boolean | undefined;
29
+ suppressHydrationWarning?: boolean | undefined;
30
+ accessKey?: string | undefined;
31
+ contentEditable?: "inherit" | (boolean | "false" | "true") | undefined;
32
+ contextMenu?: string | undefined;
33
+ dir?: string | undefined;
34
+ draggable?: (boolean | "false" | "true") | undefined;
35
+ id?: string | undefined;
26
36
  lang?: string | undefined;
27
- role?: import("react").AriaRole | undefined;
37
+ nonce?: string | undefined;
38
+ placeholder?: string | undefined;
39
+ spellCheck?: (boolean | "false" | "true") | undefined;
28
40
  tabIndex?: number | undefined;
41
+ radioGroup?: string | undefined;
42
+ role?: import("react").AriaRole | undefined;
43
+ about?: string | undefined;
44
+ datatype?: string | undefined;
45
+ inlist?: any;
46
+ prefix?: string | undefined;
47
+ property?: string | undefined;
48
+ resource?: string | undefined;
49
+ typeof?: string | undefined;
50
+ vocab?: string | undefined;
51
+ autoCapitalize?: string | undefined;
52
+ autoCorrect?: string | undefined;
53
+ autoSave?: string | undefined;
54
+ itemProp?: string | undefined;
55
+ itemScope?: boolean | undefined;
56
+ itemType?: string | undefined;
57
+ itemID?: string | undefined;
58
+ itemRef?: string | undefined;
59
+ results?: number | undefined;
60
+ security?: string | undefined;
61
+ unselectable?: "on" | "off" | undefined;
62
+ inputMode?: "search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
63
+ is?: string | undefined;
29
64
  'aria-activedescendant'?: string | undefined;
30
65
  'aria-atomic'?: (boolean | "false" | "true") | undefined;
31
- 'aria-autocomplete'?: "both" | "none" | "inline" | "list" | undefined;
66
+ 'aria-autocomplete'?: "none" | "inline" | "both" | "list" | undefined;
32
67
  'aria-busy'?: (boolean | "false" | "true") | undefined;
33
68
  'aria-checked'?: boolean | "mixed" | "false" | "true" | undefined;
34
69
  'aria-colcount'?: number | undefined;
35
70
  'aria-colindex'?: number | undefined;
36
71
  'aria-colspan'?: number | undefined;
37
72
  'aria-controls'?: string | undefined;
38
- 'aria-current'?: boolean | "page" | "false" | "true" | "time" | "step" | "location" | "date" | undefined;
73
+ 'aria-current'?: boolean | "time" | "page" | "false" | "true" | "step" | "location" | "date" | undefined;
39
74
  'aria-describedby'?: string | undefined;
40
75
  'aria-details'?: string | undefined;
41
76
  'aria-disabled'?: (boolean | "false" | "true") | undefined;
@@ -44,7 +79,7 @@ export declare function useInputProps<T extends BaseProps, U extends Partial<T>>
44
79
  'aria-expanded'?: (boolean | "false" | "true") | undefined;
45
80
  'aria-flowto'?: string | undefined;
46
81
  'aria-grabbed'?: (boolean | "false" | "true") | undefined;
47
- 'aria-haspopup'?: boolean | "listbox" | "grid" | "menu" | "false" | "true" | "dialog" | "tree" | undefined;
82
+ 'aria-haspopup'?: boolean | "dialog" | "menu" | "grid" | "listbox" | "false" | "true" | "tree" | undefined;
48
83
  'aria-hidden'?: (boolean | "false" | "true") | undefined;
49
84
  'aria-invalid'?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
50
85
  'aria-keyshortcuts'?: string | undefined;
@@ -61,7 +96,7 @@ export declare function useInputProps<T extends BaseProps, U extends Partial<T>>
61
96
  'aria-posinset'?: number | undefined;
62
97
  'aria-pressed'?: boolean | "mixed" | "false" | "true" | undefined;
63
98
  'aria-readonly'?: (boolean | "false" | "true") | undefined;
64
- 'aria-relevant'?: "all" | "text" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
99
+ 'aria-relevant'?: "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
65
100
  'aria-required'?: (boolean | "false" | "true") | undefined;
66
101
  'aria-roledescription'?: string | undefined;
67
102
  'aria-rowcount'?: number | undefined;
@@ -69,7 +104,7 @@ export declare function useInputProps<T extends BaseProps, U extends Partial<T>>
69
104
  'aria-rowspan'?: number | undefined;
70
105
  'aria-selected'?: (boolean | "false" | "true") | undefined;
71
106
  'aria-setsize'?: number | undefined;
72
- 'aria-sort'?: "none" | "ascending" | "descending" | "other" | undefined;
107
+ 'aria-sort'?: "none" | "other" | "ascending" | "descending" | undefined;
73
108
  'aria-valuemax'?: number | undefined;
74
109
  'aria-valuemin'?: number | undefined;
75
110
  'aria-valuenow'?: number | undefined;
@@ -239,41 +274,6 @@ export declare function useInputProps<T extends BaseProps, U extends Partial<T>>
239
274
  onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
240
275
  onTransitionEnd?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
241
276
  onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
242
- defaultChecked?: boolean | undefined;
243
- defaultValue?: string | number | readonly string[] | undefined;
244
- suppressContentEditableWarning?: boolean | undefined;
245
- suppressHydrationWarning?: boolean | undefined;
246
- accessKey?: string | undefined;
247
- contentEditable?: "inherit" | (boolean | "false" | "true") | undefined;
248
- contextMenu?: string | undefined;
249
- dir?: string | undefined;
250
- draggable?: (boolean | "false" | "true") | undefined;
251
- nonce?: string | undefined;
252
- placeholder?: string | undefined;
253
- spellCheck?: (boolean | "false" | "true") | undefined;
254
- translate?: "no" | "yes" | undefined;
255
- radioGroup?: string | undefined;
256
- about?: string | undefined;
257
- datatype?: string | undefined;
258
- inlist?: any;
259
- prefix?: string | undefined;
260
- property?: string | undefined;
261
- resource?: string | undefined;
262
- typeof?: string | undefined;
263
- vocab?: string | undefined;
264
- autoCapitalize?: string | undefined;
265
- autoCorrect?: string | undefined;
266
- autoSave?: string | undefined;
267
- itemProp?: string | undefined;
268
- itemScope?: boolean | undefined;
269
- itemType?: string | undefined;
270
- itemID?: string | undefined;
271
- itemRef?: string | undefined;
272
- results?: number | undefined;
273
- security?: string | undefined;
274
- unselectable?: "off" | "on" | undefined;
275
- inputMode?: "search" | "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
276
- is?: string | undefined;
277
277
  label: import("react").ReactNode;
278
278
  description: import("react").ReactNode;
279
279
  error: import("react").ReactNode;
@@ -288,7 +288,7 @@ export declare function useInputProps<T extends BaseProps, U extends Partial<T>>
288
288
  styles: Partial<Record<string, import("react").CSSProperties>> | ((theme: import("../../core").MantineTheme, props: any, ctx: unknown) => Partial<Record<string, import("react").CSSProperties>>) | undefined;
289
289
  size: (string & {}) | import("../../core").MantineSize | undefined;
290
290
  inputContainer: ((children: import("react").ReactNode) => import("react").ReactNode) | undefined;
291
- inputWrapperOrder: ("input" | "label" | "error" | "description")[] | undefined;
291
+ inputWrapperOrder: ("input" | "label" | "description" | "error")[] | undefined;
292
292
  withAsterisk: boolean | undefined;
293
293
  variant: string | undefined;
294
294
  } & BoxProps;
@@ -297,7 +297,6 @@ export declare function useInputProps<T extends BaseProps, U extends Partial<T>>
297
297
  classNames: Partial<Record<string, string>> | ((theme: import("../../core").MantineTheme, props: any, ctx: unknown) => Partial<Record<string, string>>) | undefined;
298
298
  styles: Partial<Record<string, import("react").CSSProperties>> | ((theme: import("../../core").MantineTheme, props: any, ctx: unknown) => Partial<Record<string, import("react").CSSProperties>>) | undefined;
299
299
  unstyled: boolean | undefined;
300
- id: string;
301
300
  size: (string & {}) | import("../../core").MantineSize | undefined;
302
301
  __staticSelector: string | undefined;
303
302
  __stylesApiProps: Record<string, any>;
@@ -7,6 +7,8 @@ export interface InputBaseProps extends BoxProps, __BaseInputProps, StylesApiPro
7
7
  wrapperProps?: Record<string, any>;
8
8
  /** Determines whether the input can have multiple lines, for example when `component="textarea"`, `false` by default */
9
9
  multiline?: boolean;
10
+ /** Determines whether `aria-` and other accessibility attributes should be added to the input, `true` by default */
11
+ withAria?: boolean;
10
12
  }
11
13
  export type InputBaseFactory = PolymorphicFactory<{
12
14
  props: InputBaseProps;
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import { BoxProps, StylesApiProps, ElementProps, Factory, MantineSize, MantineRadius } from '../../core';
3
+ import { PillGroup } from './PillGroup/PillGroup';
4
+ export type PillStylesNames = 'root' | 'label' | 'remove';
5
+ export type PillVariant = 'default' | 'contrast';
6
+ export type PillCssVariables = {
7
+ root: '--pill-fz' | '--pill-radius' | '--pill-height';
8
+ };
9
+ export interface PillProps extends BoxProps, StylesApiProps<PillFactory>, ElementProps<'div'> {
10
+ /** Controls pill `font-size` and `padding`, `'sm'` by default */
11
+ size?: MantineSize;
12
+ /** Determines whether the remove button should be displayed, `false` by default */
13
+ withRemoveButton?: boolean;
14
+ /** Called when the remove button is clicked */
15
+ onRemove?(): void;
16
+ /** Props passed down to the remove button */
17
+ removeButtonProps?: React.ComponentPropsWithoutRef<'button'>;
18
+ /** Key of `theme.radius` or any valid CSS value to set border-radius. Numbers are converted to rem. `'xl'` by default. */
19
+ radius?: MantineRadius | (string & {}) | number;
20
+ /** If pill is disabled it has higher contrast to be visible on the disabled input background and the remove button is hidden */
21
+ disabled?: boolean;
22
+ }
23
+ export type PillFactory = Factory<{
24
+ props: PillProps;
25
+ ref: HTMLDivElement;
26
+ stylesNames: PillStylesNames;
27
+ vars: PillCssVariables;
28
+ variant: PillVariant;
29
+ ctx: {
30
+ size: MantineSize | (string & {});
31
+ };
32
+ staticComponents: {
33
+ Group: typeof PillGroup;
34
+ };
35
+ }>;
36
+ export declare const Pill: import("../../core").MantineComponent<{
37
+ props: PillProps;
38
+ ref: HTMLDivElement;
39
+ stylesNames: PillStylesNames;
40
+ vars: PillCssVariables;
41
+ variant: PillVariant;
42
+ ctx: {
43
+ size: MantineSize | (string & {});
44
+ };
45
+ staticComponents: {
46
+ Group: typeof PillGroup;
47
+ };
48
+ }>;
@@ -0,0 +1,31 @@
1
+ import { BoxProps, StylesApiProps, ElementProps, Factory, MantineSize } from '../../../core';
2
+ export type PillGroupStylesNames = 'root';
3
+ export type PillGroupCssVariables = {
4
+ root: '--pg-gap';
5
+ };
6
+ export interface PillGroupProps extends BoxProps, StylesApiProps<PillGroupFactory>, ElementProps<'div'> {
7
+ /** Controls spacing between pills, by default controlled by `size` */
8
+ gap?: MantineSize | (string & {}) | number;
9
+ /** Controls size of the child `Pill` components and gap between them, `'sm'` by default */
10
+ size?: MantineSize | (string & {});
11
+ /** Determines whether child `Pill` components should be disabled */
12
+ disabled?: boolean;
13
+ }
14
+ export type PillGroupFactory = Factory<{
15
+ props: PillGroupProps;
16
+ ref: HTMLDivElement;
17
+ stylesNames: PillGroupStylesNames;
18
+ vars: PillGroupCssVariables;
19
+ ctx: {
20
+ size: MantineSize | (string & {});
21
+ };
22
+ }>;
23
+ export declare const PillGroup: import("../../../core").MantineComponent<{
24
+ props: PillGroupProps;
25
+ ref: HTMLDivElement;
26
+ stylesNames: PillGroupStylesNames;
27
+ vars: PillGroupCssVariables;
28
+ ctx: {
29
+ size: MantineSize | (string & {});
30
+ };
31
+ }>;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { MantineSize } from '../../core';
3
+ export interface PillGroupContextValue {
4
+ size: MantineSize | (string & {}) | undefined;
5
+ disabled: boolean | undefined;
6
+ }
7
+ export declare const PillGroupProvider: ({ children, value }: {
8
+ value: PillGroupContextValue;
9
+ children: import("react").ReactNode;
10
+ }) => JSX.Element, usePillGroupContext: () => PillGroupContextValue | null;
@@ -0,0 +1,4 @@
1
+ export { Pill } from './Pill';
2
+ export { PillGroup } from './PillGroup/PillGroup';
3
+ export type { PillCssVariables, PillFactory, PillProps, PillStylesNames, PillVariant, } from './Pill';
4
+ export type { PillGroupCssVariables, PillGroupFactory, PillGroupProps, PillGroupStylesNames, } from './PillGroup/PillGroup';
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { MantineSize } from '../../core';
3
+ import { InputVariant } from '../Input';
4
+ export interface PillsInputContextValue {
5
+ fieldRef: React.MutableRefObject<HTMLInputElement | undefined>;
6
+ size: MantineSize | (string & {});
7
+ disabled: boolean | undefined;
8
+ hasError: boolean | undefined;
9
+ variant: InputVariant | (string & {}) | undefined;
10
+ }
11
+ export declare const PillsInputProvider: ({ children, value }: {
12
+ value: PillsInputContextValue;
13
+ children: React.ReactNode;
14
+ }) => JSX.Element, usePillsInputContext: () => PillsInputContextValue | null;
@@ -0,0 +1,22 @@
1
+ import { ElementProps, Factory } from '../../core';
2
+ import { __InputStylesNames } from '../Input';
3
+ import { InputBaseProps } from '../InputBase';
4
+ import { PillsInputField } from './PillsInputField/PillsInputField';
5
+ export interface PillsInputProps extends InputBaseProps, ElementProps<'div', 'size'> {
6
+ }
7
+ export type PillsInputFactory = Factory<{
8
+ props: PillsInputProps;
9
+ ref: HTMLInputElement;
10
+ stylesNames: __InputStylesNames;
11
+ staticComponents: {
12
+ Field: typeof PillsInputField;
13
+ };
14
+ }>;
15
+ export declare const PillsInput: import("../../core").MantineComponent<{
16
+ props: PillsInputProps;
17
+ ref: HTMLInputElement;
18
+ stylesNames: __InputStylesNames;
19
+ staticComponents: {
20
+ Field: typeof PillsInputField;
21
+ };
22
+ }>;
@@ -0,0 +1,22 @@
1
+ import { BoxProps, StylesApiProps, ElementProps, Factory, MantineSize } from '../../../core';
2
+ export type PillsInputFieldStylesNames = 'root';
3
+ export interface PillsInputFieldProps extends BoxProps, StylesApiProps<PillsInputFieldFactory>, ElementProps<'input', 'type'> {
4
+ /** Controls input styles when focused. If `auto` the input is hidden when not focused. If `visible` the input will always remain visible. `'visible'` by default */
5
+ type?: 'auto' | 'visible' | 'hidden';
6
+ }
7
+ export type PillsInputFieldFactory = Factory<{
8
+ props: PillsInputFieldProps;
9
+ ref: HTMLInputElement;
10
+ stylesNames: PillsInputFieldStylesNames;
11
+ ctx: {
12
+ size: MantineSize | (string & {});
13
+ };
14
+ }>;
15
+ export declare const PillsInputField: import("../../../core").MantineComponent<{
16
+ props: PillsInputFieldProps;
17
+ ref: HTMLInputElement;
18
+ stylesNames: PillsInputFieldStylesNames;
19
+ ctx: {
20
+ size: MantineSize | (string & {});
21
+ };
22
+ }>;
@@ -0,0 +1,4 @@
1
+ export { PillsInput } from './PillsInput';
2
+ export { PillsInputField } from './PillsInputField/PillsInputField';
3
+ export type { PillsInputFactory, PillsInputProps } from './PillsInput';
4
+ export type { PillsInputFieldFactory, PillsInputFieldProps, PillsInputFieldStylesNames, } from './PillsInputField/PillsInputField';
@@ -12,7 +12,7 @@ export type UnstyledButtonFactory = PolymorphicFactory<{
12
12
  }>;
13
13
  export declare const UnstyledButton: (<C = "button">(props: import("../../core/factory/create-polymorphic-component").PolymorphicComponentProps<C, UnstyledButtonProps>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & Omit<React.FunctionComponent<(UnstyledButtonProps & {
14
14
  component?: any;
15
- } & Omit<Omit<any, "ref">, keyof UnstyledButtonProps | "component"> & {
15
+ } & Omit<Omit<any, "ref">, "component" | keyof UnstyledButtonProps> & {
16
16
  ref?: any;
17
17
  }) | (UnstyledButtonProps & {
18
18
  component: React.ElementType<any>;
@@ -42,6 +42,8 @@ export * from './NativeSelect';
42
42
  export * from './Notification';
43
43
  export * from './Overlay';
44
44
  export * from './Paper';
45
+ export * from './Pill';
46
+ export * from './PillsInput';
45
47
  export * from './Popover';
46
48
  export * from './Portal';
47
49
  export * from './ScrollArea';
@@ -22,7 +22,7 @@ export interface BoxComponentProps extends BoxProps {
22
22
  }
23
23
  export declare const Box: (<C = "div">(props: import("../factory/create-polymorphic-component").PolymorphicComponentProps<C, BoxComponentProps>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & Omit<React.FunctionComponent<(BoxComponentProps & {
24
24
  component?: any;
25
- } & Omit<Omit<any, "ref">, keyof BoxComponentProps | "component"> & {
25
+ } & Omit<Omit<any, "ref">, "component" | keyof BoxComponentProps> & {
26
26
  ref?: any;
27
27
  }) | (BoxComponentProps & {
28
28
  component: React.ElementType<any>;
@@ -1,2 +1,2 @@
1
1
  import { UseMediaQueryOptions } from '@mantine/hooks';
2
- export declare function useComputedColorScheme(defaultValue: 'light' | 'dark', options?: UseMediaQueryOptions): "light" | "dark";
2
+ export declare function useComputedColorScheme(defaultValue: 'light' | 'dark', options?: UseMediaQueryOptions): "dark" | "light";
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export declare function createOptionalContext<ContextValue>(initialValue?: ContextValue | null): readonly [({ children, value }: {
3
+ value: ContextValue;
4
+ children: React.ReactNode;
5
+ }) => JSX.Element, () => ContextValue | null];
@@ -6,6 +6,7 @@ export { filterProps } from './filter-props/filter-props';
6
6
  export { isNumberLike } from './is-number-like/is-number-like';
7
7
  export { isElement } from './is-element/is-element';
8
8
  export { createSafeContext } from './create-safe-context/create-safe-context';
9
+ export { createOptionalContext } from './create-optional-context/create-optional-context';
9
10
  export { getSafeId } from './get-safe-id/get-safe-id';
10
11
  export { createScopedKeydownHandler } from './create-scoped-keydown-handler/create-scoped-keydown-handler';
11
12
  export { findElementAncestor } from './find-element-ancestor/find-element-ancestor';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mantine/core",
3
3
  "description": "React components library focused on usability, accessibility and developer experience",
4
- "version": "7.0.0-alpha.15",
4
+ "version": "7.0.0-alpha.16",
5
5
  "types": "./lib/index.d.ts",
6
6
  "exports": {
7
7
  ".": {
@@ -34,7 +34,7 @@
34
34
  "design"
35
35
  ],
36
36
  "peerDependencies": {
37
- "@mantine/hooks": "7.0.0-alpha.15",
37
+ "@mantine/hooks": "7.0.0-alpha.16",
38
38
  "react": ">=18.0.0",
39
39
  "react-dom": ">=18.0.0"
40
40
  },