@danske/sapphire-react-lab 0.87.1 → 0.87.3
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.
- package/build/cjs/index.js +49 -35
- package/build/cjs/index.js.map +1 -1
- package/build/esm/SearchField/src/SearchField.js +19 -4
- package/build/esm/SearchField/src/SearchField.js.map +1 -1
- package/build/esm/Typography/src/Heading.js +1 -3
- package/build/esm/Typography/src/Heading.js.map +1 -1
- package/build/index.d.ts +9 -3
- package/package.json +3 -3
|
@@ -29,9 +29,22 @@ var __spreadValues = (a, b) => {
|
|
|
29
29
|
return a;
|
|
30
30
|
};
|
|
31
31
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
32
|
-
|
|
33
|
-
var
|
|
32
|
+
var __objRest = (source, exclude) => {
|
|
33
|
+
var target = {};
|
|
34
|
+
for (var prop in source)
|
|
35
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
36
|
+
target[prop] = source[prop];
|
|
37
|
+
if (source != null && __getOwnPropSymbols)
|
|
38
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
39
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
40
|
+
target[prop] = source[prop];
|
|
41
|
+
}
|
|
42
|
+
return target;
|
|
43
|
+
};
|
|
44
|
+
function SearchField(propsAndRef) {
|
|
45
|
+
var _b;
|
|
34
46
|
useThemeCheck();
|
|
47
|
+
const _a = propsAndRef, { loadingState, loadingSkeletonRowsCount, forwardedRef } = _a, props = __objRest(_a, ["loadingState", "loadingSkeletonRowsCount", "forwardedRef"]);
|
|
35
48
|
const inputRef = useObjectRef(forwardedRef);
|
|
36
49
|
const buttonRef = useRef(null);
|
|
37
50
|
const listBoxRef = useFocusableRef(null);
|
|
@@ -104,12 +117,14 @@ const SearchField = React.forwardRef(function SearchField2(props, forwardedRef)
|
|
|
104
117
|
popoverRef,
|
|
105
118
|
listBoxRef,
|
|
106
119
|
listBoxProps,
|
|
107
|
-
|
|
120
|
+
loadingState,
|
|
121
|
+
loadingSkeletonRowsCount,
|
|
122
|
+
selectWidth: ((_b = triggerRef.current) == null ? void 0 : _b.offsetWidth) || 0,
|
|
108
123
|
size: props.size,
|
|
109
124
|
disableSelectedStyles: true,
|
|
110
125
|
isNonModal: true
|
|
111
126
|
}, props.children || []));
|
|
112
|
-
}
|
|
127
|
+
}
|
|
113
128
|
|
|
114
129
|
export { SearchField };
|
|
115
130
|
//# sourceMappingURL=SearchField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchField.js","sources":["../../../../src/SearchField/src/SearchField.tsx"],"sourcesContent":["import React, { ForwardedRef, useRef } from 'react';\nimport clsx from 'clsx';\nimport { HelpTextProps, LabelableProps, Validation } from '@react-types/shared';\nimport type { ComboBoxProps } from '@react-types/combobox';\nimport { AriaSearchFieldProps, useSearchField } from '@react-aria/searchfield';\n\nimport {\n SapphireStyleProps,\n useButton,\n useSapphireStyleProps,\n useThemeCheck,\n ListBoxPopover,\n Icon,\n} from '@danske/sapphire-react';\nimport styles from '@danske/sapphire-css/components/searchField/searchField.module.css';\nimport { useSearchFieldState } from '@react-stately/searchfield';\nimport { mergeProps, useObjectRef } from '@react-aria/utils';\nimport { CloseCircle, Search } from '@danske/sapphire-icons/react';\nimport { useFocusableRef } from '@react-spectrum/utils';\nimport { useComboBoxState } from './useComboBoxState';\nimport { useComboBox } from '@react-aria/combobox';\n\nexport type SapphireSearchFieldProps<T extends object> = SapphireStyleProps &\n Omit<\n AriaSearchFieldProps,\n keyof HelpTextProps | keyof Validation<unknown> | keyof LabelableProps\n > &\n AutocompleteProps<T> & {\n /**\n * @default 'large'\n */\n size?: 'large' | 'medium';\n /**\n * Adjusts the style for the type of surface it is rendered on.\n * @default 'primary'\n */\n surface?: 'primary' | 'secondary';\n } & (\n | { 'aria-labelledby': string }\n | {\n 'aria-label': string;\n }\n );\n\n// we don't want props related to \"selection\" because from the POV of the\n// autocomplete feature, there is no concept of \"selection\"\ninterface AutocompleteProps<T extends object> {\n items?: ComboBoxProps<T>['items'];\n defaultItems?: ComboBoxProps<T>['defaultItems'];\n children?: ComboBoxProps<T>['children'];\n onOpenChange?: ComboBoxProps<T>['onOpenChange'];\n defaultFilter?: (textValue: string, inputValue: string) => boolean;\n}\n\n/**\n * Sapphire search input field.\n */\nexport const SearchField = React.forwardRef(function SearchField<\n T extends object\n>(\n props: SapphireSearchFieldProps<T>,\n forwardedRef: ForwardedRef<HTMLInputElement>\n): JSX.Element {\n useThemeCheck();\n\n const inputRef = useObjectRef(forwardedRef);\n const buttonRef = useRef<HTMLDivElement>(null);\n const listBoxRef = useFocusableRef<HTMLUListElement>(null);\n const popoverRef = useRef<HTMLDivElement>(null);\n const triggerRef = useFocusableRef<HTMLDivElement>(null);\n const {\n styleProps: { style, className },\n } = useSapphireStyleProps(props);\n\n const state = useComboBoxState({\n ...props,\n inputValue: props.value,\n defaultInputValue: props.defaultValue,\n onInputChange: props.onChange,\n allowsEmptyCollection: false,\n allowsCustomValue: true,\n shouldCloseOnBlur: true,\n });\n\n const { inputProps: comboBoxInputProps, listBoxProps } = useComboBox(\n {\n ...props,\n inputRef,\n listBoxRef,\n popoverRef,\n },\n state\n );\n\n /**\n * In order to compose the `useSearchField` and `useComboBox` we want to:\n * - let the combobox control the input but\n * - allow the search field's \"clear\" and \"submit\" behavior\n *\n * For this, we take control of `useSearchField` and not pass the props\n * indiscriminately.\n *\n * For example think about using `onBlur` on `SearchField`. The combobox\n * hook gets that prop and the input props we get back will add that\n * listener to the input. We don't want the input props from\n * `useSearchField` to add the same listener.\n */\n const searchProps: AriaSearchFieldProps = {\n 'aria-label': props['aria-label'],\n 'aria-labelledby': props['aria-labelledby'],\n isDisabled: props.isDisabled,\n isReadOnly: props.isReadOnly,\n // needed for the submit functionality\n value: state.inputValue,\n onSubmit: (value) => {\n if (!state.selectionManager.isFocused) {\n props?.onSubmit?.(value);\n }\n },\n onClear: () => {\n state.setInputValue('');\n props.onClear?.();\n },\n };\n\n const searchFieldState = useSearchFieldState(searchProps);\n\n const { clearButtonProps, inputProps: searchFieldInputProps } =\n useSearchField(searchProps, searchFieldState, inputRef);\n\n const { buttonProps } = useButton(\n {\n ...clearButtonProps,\n elementType: 'div',\n },\n buttonRef\n );\n\n return (\n <div\n className={clsx(styles['sapphire-search-field'], className, {\n [styles['sapphire-search-field--medium']]: props.size === 'medium',\n [styles['sapphire-search-field--surface-secondary']]:\n props.surface === 'secondary',\n [styles['is-disabled']]: props.isDisabled,\n })}\n style={style}\n ref={triggerRef}\n >\n <span className={styles['sapphire-search-field__icon']}>\n <Icon size={props.size === 'medium' ? 'm' : 'l'}>\n <Search />\n </Icon>\n </span>\n <input\n {...mergeProps(comboBoxInputProps, searchFieldInputProps)}\n ref={inputRef}\n className={clsx(styles['sapphire-search-field__input'], {\n [styles['sapphire-search-field__input--empty']]:\n state.inputValue.length === 0,\n })}\n />\n <div\n ref={buttonRef}\n className={styles['sapphire-search-field__button']}\n {...buttonProps}\n >\n <Icon size={props.size === 'medium' ? 'm' : 'l'}>\n <CloseCircle />\n </Icon>\n </div>\n {state.isOpen && (\n <ListBoxPopover<T>\n state={state}\n triggerRef={triggerRef}\n popoverRef={popoverRef}\n listBoxRef={listBoxRef}\n listBoxProps={listBoxProps}\n selectWidth={triggerRef.current?.offsetWidth || 0}\n size={props.size}\n disableSelectedStyles\n isNonModal\n >\n {props.children || []}\n </ListBoxPopover>\n )}\n </div>\n );\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDO,MAAM,WAAc,GAAA,KAAA,CAAM,UAAW,CAAA,SAAA,YAAA,CAG1C,OACA,YACa,EAAA;AA9Df,EAAA,IAAA,EAAA,CAAA;AA+DE,EAAA,aAAA,EAAA,CAAA;AAEA,EAAA,MAAM,WAAW,YAAa,CAAA,YAAA,CAAA,CAAA;AAC9B,EAAA,MAAM,YAAY,MAAuB,CAAA,I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,GAAA,EAET,MAAM,QAAY,IAAA,EAAA,CAAA,CAAA,CAAA;AAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"SearchField.js","sources":["../../../../src/SearchField/src/SearchField.tsx"],"sourcesContent":["import React, { ForwardedRef, useRef } from 'react';\nimport clsx from 'clsx';\nimport { HelpTextProps, LabelableProps, Validation } from '@react-types/shared';\nimport type { ComboBoxProps } from '@react-types/combobox';\nimport { AriaSearchFieldProps, useSearchField } from '@react-aria/searchfield';\n\nimport {\n SapphireStyleProps,\n useButton,\n useSapphireStyleProps,\n useThemeCheck,\n ListBoxPopover,\n Icon,\n} from '@danske/sapphire-react';\nimport styles from '@danske/sapphire-css/components/searchField/searchField.module.css';\nimport { useSearchFieldState } from '@react-stately/searchfield';\nimport { mergeProps, useObjectRef } from '@react-aria/utils';\nimport { CloseCircle, Search } from '@danske/sapphire-icons/react';\nimport { useFocusableRef } from '@react-spectrum/utils';\nimport { useComboBoxState } from './useComboBoxState';\nimport { useComboBox } from '@react-aria/combobox';\n\nexport type SapphireSearchFieldProps<T extends object> = SapphireStyleProps &\n Omit<\n AriaSearchFieldProps,\n keyof HelpTextProps | keyof Validation<unknown> | keyof LabelableProps\n > &\n AutocompleteProps<T> & {\n /**\n * @default 'large'\n */\n size?: 'large' | 'medium';\n /**\n * Adjusts the style for the type of surface it is rendered on.\n * @default 'primary'\n */\n surface?: 'primary' | 'secondary';\n } & (\n | { 'aria-labelledby': string }\n | {\n 'aria-label': string;\n }\n ) & {\n loadingState?: 'loading';\n loadingSkeletonRowsCount?: number;\n };\n\n// we don't want props related to \"selection\" because from the POV of the\n// autocomplete feature, there is no concept of \"selection\"\ninterface AutocompleteProps<T extends object> {\n items?: ComboBoxProps<T>['items'];\n defaultItems?: ComboBoxProps<T>['defaultItems'];\n children?: ComboBoxProps<T>['children'];\n onOpenChange?: ComboBoxProps<T>['onOpenChange'];\n defaultFilter?: (textValue: string, inputValue: string) => boolean;\n}\n\ntype SapphireSearchFieldPropsWithRef<T extends object> =\n SapphireSearchFieldProps<T> & {\n forwardedRef?: ForwardedRef<HTMLInputElement>;\n };\n\n/**\n * Sapphire search input field.\n */\n// Ref (forwardedRef) exposed as normal prop to keep TS generics working and inference of the right type for items/children passed\n// Ie. type for items={items} is inferred for the item in the child render function {item => (intellisense for item available here)}\n// Using forwardRef that information is lost: https://stackoverflow.com/a/58473012 and https://stackoverflow.com/a/60237948\nexport function SearchField<T extends object>(\n propsAndRef: SapphireSearchFieldPropsWithRef<T>\n) {\n useThemeCheck();\n\n const { loadingState, loadingSkeletonRowsCount, forwardedRef, ...props } =\n propsAndRef;\n\n const inputRef = useObjectRef(forwardedRef);\n const buttonRef = useRef<HTMLDivElement>(null);\n const listBoxRef = useFocusableRef<HTMLUListElement>(null);\n const popoverRef = useRef<HTMLDivElement>(null);\n const triggerRef = useFocusableRef<HTMLDivElement>(null);\n const {\n styleProps: { style, className },\n } = useSapphireStyleProps(props);\n\n const state = useComboBoxState({\n ...props,\n inputValue: props.value,\n defaultInputValue: props.defaultValue,\n onInputChange: props.onChange,\n allowsEmptyCollection: false,\n allowsCustomValue: true,\n shouldCloseOnBlur: true,\n });\n\n const { inputProps: comboBoxInputProps, listBoxProps } = useComboBox(\n {\n ...props,\n inputRef,\n listBoxRef,\n popoverRef,\n },\n state\n );\n\n /**\n * In order to compose the `useSearchField` and `useComboBox` we want to:\n * - let the combobox control the input but\n * - allow the search field's \"clear\" and \"submit\" behavior\n *\n * For this, we take control of `useSearchField` and not pass the props\n * indiscriminately.\n *\n * For example think about using `onBlur` on `SearchField`. The combobox\n * hook gets that prop and the input props we get back will add that\n * listener to the input. We don't want the input props from\n * `useSearchField` to add the same listener.\n */\n const searchProps: AriaSearchFieldProps = {\n 'aria-label': props['aria-label'],\n 'aria-labelledby': props['aria-labelledby'],\n isDisabled: props.isDisabled,\n isReadOnly: props.isReadOnly,\n // needed for the submit functionality\n value: state.inputValue,\n onSubmit: (value) => {\n if (!state.selectionManager.isFocused) {\n props?.onSubmit?.(value);\n }\n },\n onClear: () => {\n state.setInputValue('');\n props.onClear?.();\n },\n };\n\n const searchFieldState = useSearchFieldState(searchProps);\n\n const { clearButtonProps, inputProps: searchFieldInputProps } =\n useSearchField(searchProps, searchFieldState, inputRef);\n\n const { buttonProps } = useButton(\n {\n ...clearButtonProps,\n elementType: 'div',\n },\n buttonRef\n );\n\n return (\n <div\n className={clsx(styles['sapphire-search-field'], className, {\n [styles['sapphire-search-field--medium']]: props.size === 'medium',\n [styles['sapphire-search-field--surface-secondary']]:\n props.surface === 'secondary',\n [styles['is-disabled']]: props.isDisabled,\n })}\n style={style}\n ref={triggerRef}\n >\n <span className={styles['sapphire-search-field__icon']}>\n <Icon size={props.size === 'medium' ? 'm' : 'l'}>\n <Search />\n </Icon>\n </span>\n <input\n {...mergeProps(comboBoxInputProps, searchFieldInputProps)}\n ref={inputRef}\n className={clsx(styles['sapphire-search-field__input'], {\n [styles['sapphire-search-field__input--empty']]:\n state.inputValue.length === 0,\n })}\n />\n <div\n ref={buttonRef}\n className={styles['sapphire-search-field__button']}\n {...buttonProps}\n >\n <Icon size={props.size === 'medium' ? 'm' : 'l'}>\n <CloseCircle />\n </Icon>\n </div>\n {state.isOpen && (\n <ListBoxPopover<T>\n state={state}\n triggerRef={triggerRef}\n popoverRef={popoverRef}\n listBoxRef={listBoxRef}\n listBoxProps={listBoxProps}\n loadingState={loadingState}\n loadingSkeletonRowsCount={loadingSkeletonRowsCount}\n selectWidth={triggerRef.current?.offsetWidth || 0}\n size={props.size}\n disableSelectedStyles\n isNonModal\n >\n {props.children || []}\n </ListBoxPopover>\n )}\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEO,SAAA,WAAA,CACL,WACA,EAAA;AAtEF,EAAA,IAAA,EAAA,CAAA;AAuEE,EAAA,aAAA,EAAA,CAAA;AAEA,EACE,MAAA,EAAA,GAAA,WAAA,EADM,gBAAc,wBAA0B,E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A;AAAA,IACA,wBAAA;AAAA,IACA,WAAa,EAAA,CAAA,CAAA,EAAA,GAAA,UAAA,CAAW,OAAX,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAoB,WAAe,KAAA,CAAA;AAAA,IAChD,MAAM,KAAM,CAAA,IAAA;AAAA,IACZ,qBAAqB,EAAA,IAAA;AAAA,IACrB,UAAU,EAAA,IAAA;AAAA,GAAA,EAET,MAAM,QAAY,IAAA,EAAA,CAAA,CAAA,CAAA;AAAA;;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { filterDOMProps } from '@react-aria/utils';
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
|
-
import { useDOMRef } from '@react-spectrum/utils';
|
|
4
3
|
import clsx from 'clsx';
|
|
5
4
|
import styles from '@danske/sapphire-css/components/text/text.module.css';
|
|
6
5
|
import { useThemeCheck, useTextStyleProps } from '@danske/sapphire-react';
|
|
@@ -41,13 +40,12 @@ const Heading = forwardRef(function Heading2(props, ref) {
|
|
|
41
40
|
const domProps = filterDOMProps(props);
|
|
42
41
|
const _a = props, { children, level, elementType } = _a, otherProps = __objRest(_a, ["children", "level", "elementType"]);
|
|
43
42
|
const { styleProps } = useTextStyleProps(otherProps);
|
|
44
|
-
const domRef = useDOMRef(ref);
|
|
45
43
|
const HeadingTag = elementType ? elementType : `h${level}`;
|
|
46
44
|
return /* @__PURE__ */ React.createElement(HeadingTag, __spreadProps(__spreadValues(__spreadValues({}, domProps), styleProps), {
|
|
47
45
|
className: clsx(styles["sapphire-text"], styles[`sapphire-text--heading-${level}`], styleProps.className, {
|
|
48
46
|
[styles["sapphire-text--heading-alternative"]]: props.fontVariant === "alternative"
|
|
49
47
|
}),
|
|
50
|
-
ref
|
|
48
|
+
ref
|
|
51
49
|
}), children);
|
|
52
50
|
});
|
|
53
51
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Heading.js","sources":["../../../../src/Typography/src/Heading.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"Heading.js","sources":["../../../../src/Typography/src/Heading.tsx"],"sourcesContent":["import { DOMProps } from '@react-types/shared';\nimport { filterDOMProps } from '@react-aria/utils';\nimport React, { ElementType, ForwardedRef, forwardRef } from 'react';\nimport clsx from 'clsx';\nimport styles from '@danske/sapphire-css/components/text/text.module.css';\n\nimport {\n useThemeCheck,\n useTextStyleProps,\n TextStyleProps,\n SapphireStyleProps,\n} from '@danske/sapphire-react';\n\ntype HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\nexport interface TypographyHeadingProps\n extends DOMProps,\n TextStyleProps,\n SapphireStyleProps {\n children: React.ReactNode;\n /**\n * The level of the heading.\n */\n level: HeadingLevel;\n elementType?: `h${HeadingLevel}`;\n fontVariant?: 'default' | 'alternative';\n}\n\nexport const Heading = forwardRef(function Heading(\n props: TypographyHeadingProps,\n ref: ForwardedRef<HTMLHeadingElement>\n) {\n useThemeCheck();\n\n const domProps = filterDOMProps(props);\n const { children, level, elementType, ...otherProps } = props;\n const { styleProps } = useTextStyleProps(otherProps);\n const HeadingTag = elementType ? elementType : (`h${level}` as ElementType);\n\n return (\n <HeadingTag\n {...domProps}\n {...styleProps}\n className={clsx(\n styles['sapphire-text'],\n styles[`sapphire-text--heading-${level}` as const],\n styleProps.className,\n {\n [styles['sapphire-text--heading-alternative']]:\n props.fontVariant === 'alternative',\n }\n )}\n ref={ref}\n >\n {children}\n </HeadingTag>\n );\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BO,MAAM,OAAU,GAAA,UAAA,CAAW,SAChC,QAAA,CAAA,KAAA,EACA,GACA,EAAA;AACA,EAAA,aAAA,EAAA,CAAA;AAEA,EAAA,MAAM,WAAW,cAAe,CAAA,KAAA,CAAA,CAAA;AAChC,EAAwD,MAAA,EAAA,GAAA,KAAA,EAAhD,YAAU,KAAO,EAAA,WAAA,EAAA,GAA+B,IAAf,UAAe,GAAA,SAAA,CAAA,EAAA,EAAf,CAAjC,UAAA,EAAU,OAAO,EAAA,aAAA,CAAA,CAAA,CAAA;AACzB,EAAM,MAAA,EAAE,eAAe,iBAAkB,CAAA,UAAA,CAAA,CAAA;AACzC,EAAM,MAAA,UAAA,GAAa,WAAc,GAAA,WAAA,GAAe,CAAI,CAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAEpD,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,UAAA,EAAD,aACM,CAAA,cAAA,CAAA,cAAA,CAAA,EAAA,EAAA,QAAA,CAAA,EACA,UAFN,CAAA,EAAA;AAAA,IAGE,SAAA,EAAW,KACT,MAAO,CAAA,eAAA,CAAA,EACP,OAAO,CAA0B,uBAAA,EAAA,KAAA,CAAA,CAAA,CAAA,EACjC,WAAW,SACX,EAAA;AAAA,MACG,CAAA,MAAA,CAAO,oCACN,CAAA,GAAA,KAAA,CAAM,WAAgB,KAAA,aAAA;AAAA,KAAA,CAAA;AAAA,IAG5B,GAAA;AAAA,GAEC,CAAA,EAAA,QAAA,CAAA,CAAA;AAAA,CAAA;;;;"}
|
package/build/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _react_types_shared from '@react-types/shared';
|
|
2
2
|
import { PressEvents, Validation, RangeValue, HelpTextProps, LabelableProps, CollectionBase, DOMProps, Expandable, ItemProps, AriaLabelingProps, FocusableRefValue } from '@react-types/shared';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import React__default, { ReactNode, ComponentType, RefObject, Key } from 'react';
|
|
4
|
+
import React__default, { ReactNode, ForwardedRef, ComponentType, RefObject, Key } from 'react';
|
|
5
5
|
import { AriaToggleButtonProps } from '@react-aria/button';
|
|
6
6
|
import { SapphireStyleProps, PopoverTriggerProps, HeadingProps, TextStyleProps, DialogProps } from '@danske/sapphire-react';
|
|
7
7
|
import { DateValue } from '@internationalized/date';
|
|
@@ -513,7 +513,10 @@ declare type SapphireSearchFieldProps<T extends object> = SapphireStyleProps & O
|
|
|
513
513
|
'aria-labelledby': string;
|
|
514
514
|
} | {
|
|
515
515
|
'aria-label': string;
|
|
516
|
-
})
|
|
516
|
+
}) & {
|
|
517
|
+
loadingState?: 'loading';
|
|
518
|
+
loadingSkeletonRowsCount?: number;
|
|
519
|
+
};
|
|
517
520
|
interface AutocompleteProps<T extends object> {
|
|
518
521
|
items?: ComboBoxProps<T>['items'];
|
|
519
522
|
defaultItems?: ComboBoxProps<T>['defaultItems'];
|
|
@@ -521,10 +524,13 @@ interface AutocompleteProps<T extends object> {
|
|
|
521
524
|
onOpenChange?: ComboBoxProps<T>['onOpenChange'];
|
|
522
525
|
defaultFilter?: (textValue: string, inputValue: string) => boolean;
|
|
523
526
|
}
|
|
527
|
+
declare type SapphireSearchFieldPropsWithRef<T extends object> = SapphireSearchFieldProps<T> & {
|
|
528
|
+
forwardedRef?: ForwardedRef<HTMLInputElement>;
|
|
529
|
+
};
|
|
524
530
|
/**
|
|
525
531
|
* Sapphire search input field.
|
|
526
532
|
*/
|
|
527
|
-
declare
|
|
533
|
+
declare function SearchField<T extends object>(propsAndRef: SapphireSearchFieldPropsWithRef<T>): React__default.JSX.Element;
|
|
528
534
|
|
|
529
535
|
declare type VerticalPlacement = 'top' | 'bottom';
|
|
530
536
|
declare type HorizontalPlacement = 'left' | 'right';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danske/sapphire-react-lab",
|
|
3
|
-
"version": "0.87.
|
|
3
|
+
"version": "0.87.3",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"description": "Experimental React components of the Sapphire Design System from Danske Bank A/S",
|
|
6
6
|
"exports": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
21
|
"build": "cross-env ../../node_modules/.bin/rollup --config ../../rollup.config.js",
|
|
22
|
-
"postpublish": "echo bypassing npx -y send-release-notes@latest --to=6d5d8a75.groupsmail.danskebank.com@emea.teams.ms",
|
|
22
|
+
"postpublish": "echo bypassing npx -y send-release-notes@latest --to=6d5d8a75.groupsmail.danskebank.com@emea.teams.ms --baseUrl=https://sapphire.danskenet.net/react",
|
|
23
23
|
"prepare": "yarn run build",
|
|
24
24
|
"prepublishOnly": "yarn run build"
|
|
25
25
|
},
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"clsx": "^1.1.1",
|
|
75
75
|
"react-transition-group": "^4.4.5"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "b6d8ab3c3119f61b7a7d8f522abecca275c9ff65"
|
|
78
78
|
}
|