@iress-oss/ids-components 6.0.0-alpha.4 → 6.0.0-alpha.6

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.
@@ -1,7 +1,7 @@
1
1
  import { jsx as d } from "react/jsx-runtime";
2
2
  import { forwardRef as b, useRef as _, useState as y, useEffect as g, useImperativeHandle as h } from "react";
3
3
  import { createPortal as f } from "react-dom";
4
- import { i as w, I as k } from "../../Provider-8wS70V56.js";
4
+ import { i as w, I as k } from "../../Provider-BPeo5YfI.js";
5
5
  const z = `@layer reset, base, tokens, recipes, utilities;
6
6
 
7
7
  @layer reset{
@@ -337,7 +337,7 @@ const z = `@layer reset, base, tokens, recipes, utilities;
337
337
  --spacing-xl: var(--iress-spacing-10, calc(10 * var(--iress-spacing-100, .25rem)));
338
338
  --spacing-button\\.inline: calc((var(--iress-radius-system--button-top-left, var(--iress-radius-075, calc(0.75 * 1rem))) * 0.25) + var(--iress-spacing-2, calc(2 * var(--iress-spacing-100, .25rem))));
339
339
  --spacing-button\\.block: calc(var(--iress-radius-system--button-top-left, var(--iress-radius-075, calc(0.75 * 1rem))) * 0.25);
340
- --spacing-field\\.footer: calc(var(--iress-typography-base-size, .875rem) * 2.35);
340
+ --spacing-field\\.footer: calc(var(--iress-typography-base-size, .875rem) * 2);
341
341
  --spacing-slider\\.tick: calc((calc(var(--iress-typography-base-size, .875rem) * (10 / 14)) - calc(var(--iress-typography-base-size, .875rem) * (5 / 14))) / 2);
342
342
  --z-index-100: 100;
343
343
  --z-index-200: 200;
@@ -3070,6 +3070,10 @@ const z = `@layer reset, base, tokens, recipes, utilities;
3070
3070
  border-width: 0;
3071
3071
  }
3072
3072
 
3073
+ .px_spacing\\.2 {
3074
+ padding-inline: var(--spacing-spacing\\.2);
3075
+ }
3076
+
3073
3077
  .flex_auto {
3074
3078
  flex: 1 1 auto;
3075
3079
  }
@@ -3082,10 +3086,6 @@ const z = `@layer reset, base, tokens, recipes, utilities;
3082
3086
  margin-block: var(--spacing-spacing\\.2);
3083
3087
  }
3084
3088
 
3085
- .px_spacing\\.2 {
3086
- padding-inline: var(--spacing-spacing\\.2);
3087
- }
3088
-
3089
3089
  .px_md {
3090
3090
  padding-inline: var(--spacing-md);
3091
3091
  }
@@ -7427,6 +7427,10 @@ const z = `@layer reset, base, tokens, recipes, utilities;
7427
7427
  z-index: -1;
7428
7428
  }
7429
7429
 
7430
+ .\\[\\&_\\.ids-popover__content\\]\\:z_100 .ids-popover__content {
7431
+ z-index: var(--z-index-100);
7432
+ }
7433
+
7430
7434
  :where([dir=rtl], :dir(rtl)) .rtl\\:selectChevronRtl_true:after {
7431
7435
  content: '';
7432
7436
  width: calc(var(--iress-typography-base-size, .875rem) * 0.5);
@@ -1,4 +1,5 @@
1
1
  import { ForwardedRef, ReactElement, ChangeEvent, ReactNode } from 'react';
2
+ import { IressSelectMenuProps } from '../RichSelect';
2
3
  import { AutocompleteSearchHookProps } from '../Autocomplete';
3
4
  import { IressSelectActivatorProps } from './components/SelectActivator';
4
5
  import { SelectHiddenInputRenderProps } from './components/SelectHiddenInput';
@@ -7,6 +8,7 @@ import { ControlledValue } from '../../hooks';
7
8
  import { FormattedLabelValueMeta, LabelValueMeta, ReactHookFormCompatibleRef } from '../../interfaces';
8
9
  import { FloatingUIAligns } from '../../types';
9
10
  import { IressPopoverProps, PopoverRef } from '../Popover';
11
+ import { IressButtonProps } from '../Button';
10
12
  export interface IressRichSelectProps<TMultiple extends boolean = false> extends Omit<AutocompleteSearchHookProps, 'query'>, Omit<IressPopoverProps, 'activator' | 'children' | 'contentClassName' | 'defaultShow' | 'defaultValue' | 'disabledAutoToggle' | 'onChange' | 'matchActivatorWidth' | 'show' | 'width'>, Pick<IressSelectActivatorProps, 'append' | 'prepend' | 'selectedOptionsText'> {
11
13
  /**
12
14
  * Sets the alignment of the dropdown relative to the activator element.
@@ -133,6 +135,14 @@ export interface SelectOptionsRenderProps<TMultiple extends boolean = false> ext
133
135
  * The query value that was used to filter the items (may be different from query).
134
136
  */
135
137
  debouncedQuery: string;
138
+ /**
139
+ * Clears the current selection in the menu.
140
+ */
141
+ handleClear: IressButtonProps['onClick'] & IressButtonProps['onKeyDown'];
142
+ /**
143
+ * When the menu selection changes, this will set the value and close the menu.
144
+ */
145
+ handleMenuChange: IressSelectMenuProps<TMultiple>['onChange'];
136
146
  /**
137
147
  * The query value to filter items by and create search results.
138
148
  */
@@ -1,5 +1,5 @@
1
1
  import { IressRichSelectProps, SelectOptionsRenderProps } from '../RichSelect';
2
- interface SelectOptionsProps<TMultiple extends boolean = false> extends Pick<IressRichSelectProps<TMultiple>, 'autoHighlight' | 'minSearchLength' | 'multiSelect' | 'onChange' | 'options' | 'renderOptions' | 'value' | 'initialOptions'>, Omit<SelectOptionsRenderProps<TMultiple>, 'close'> {
2
+ interface SelectOptionsProps<TMultiple extends boolean = false> extends Pick<IressRichSelectProps<TMultiple>, 'autoHighlight' | 'minSearchLength' | 'multiSelect' | 'onChange' | 'options' | 'renderOptions' | 'value' | 'initialOptions'>, Omit<SelectOptionsRenderProps<TMultiple>, 'close' | 'handleClear' | 'handleMenuChange'> {
3
3
  setShow: (show: boolean) => void;
4
4
  shouldShowInstructions?: boolean;
5
5
  shouldShowNoResults?: boolean;
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { Control, ControllerRenderProps, FieldPath, FieldPathValue, FieldValues, UseControllerProps } from 'react-hook-form';
2
+ import { Control, ControllerFieldState, ControllerRenderProps, FieldPath, FieldPathValue, FieldValues, UseControllerProps, UseFormStateReturn } from 'react-hook-form';
3
3
  import { CustomRules } from './helpers/transformCustomRulesToValidateRule';
4
4
  import { IressFieldProps } from '../../../components/Field';
5
5
  export interface IressFormFieldProps<T extends FieldValues = FieldValues, TName extends FieldPath<T> = FieldPath<T>> extends Omit<IressFieldProps, 'children' | 'htmlFor' | 'required'>, Omit<UseControllerProps<T, FieldPath<T>>, 'disabled'> {
@@ -22,7 +22,7 @@ export interface IressFormFieldProps<T extends FieldValues = FieldValues, TName
22
22
  * To ensure the field is correctly registered with the form, the control must be passed as props to the rendered component.
23
23
  * (eg. `render={field => <IressInput {...field} />}`)
24
24
  */
25
- render: (field: FormFieldRenderProps<T>) => ReactNode;
25
+ render: (field: FormFieldRenderProps<T>, state: FormFieldRenderState<T>) => ReactNode;
26
26
  /**
27
27
  * Validation rules, including: required, min, max, minLength, maxLength, pattern, validate
28
28
  * @see https://react-hook-form.com/api/useform/register)
@@ -47,6 +47,19 @@ export interface FormFieldRenderProps<T extends FieldValues> extends ControllerR
47
47
  */
48
48
  id: string;
49
49
  }
50
+ /**
51
+ * Props for the `IressFormField` `render` prop, second argument.
52
+ */
53
+ export interface FormFieldRenderState<T extends FieldValues> {
54
+ /**
55
+ * State of the field.
56
+ */
57
+ fieldState?: ControllerFieldState;
58
+ /**
59
+ * State of the form.
60
+ */
61
+ formState?: UseFormStateReturn<T>;
62
+ }
50
63
  /**
51
64
  * A `IressField` wrapper that can show error message and label automatically inside an `IressForm`.
52
65
  * It uses the `useController` hook from `react-hook-form` for form management.