@reykjavik/hanna-react 0.10.87 → 0.10.88

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/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@
4
4
 
5
5
  - ... <!-- Add new lines here. -->
6
6
 
7
+ ## 0.10.88
8
+
9
+ _2023-05-24_
10
+
11
+ - feat(ts): Export utility type `HtmlProps` from `utils` module — for adding
12
+ HTML attributes (including `data-*`) to React components.
13
+ - fix: Update dependencies to fix import resolution errors in node@>=18
14
+
7
15
  ## 0.10.87
8
16
 
9
17
  _2023-05-19_
@@ -1,5 +1,5 @@
1
- import type { formatBytes } from './_FileInput.utils';
2
- import { CustomFile } from './_FileInput.utils';
1
+ import type { formatBytes } from './_FileInput.utils.js';
2
+ import { CustomFile } from './_FileInput.utils.js';
3
3
  export type FileListProps = {
4
4
  files: Array<CustomFile>;
5
5
  showFileSize?: boolean;
package/Selectbox.d.ts CHANGED
@@ -1,11 +1,10 @@
1
- import type { SelectboxProps as _SelectboxProps } from '@hugsmidjan/react/Selectbox';
1
+ import type { OptionOrValue, SelectboxProps as _SelectboxProps } from '@hugsmidjan/react/Selectbox';
2
2
  import { FormFieldWrappingProps } from './FormField.js';
3
3
  export { type SelectboxOption, type SelectboxOptions as SelectboxOptionList,
4
4
  /** @deprecated Use `SelectboxOptionList` instead (Will be removed in v0.11) */
5
5
  type SelectboxOptions, } from '@hugsmidjan/react/Selectbox';
6
- type OptionOrValue = _SelectboxProps['options'][0];
7
6
  export type SelectboxProps<O extends OptionOrValue = OptionOrValue> = FormFieldWrappingProps & Omit<_SelectboxProps<O>, 'bem'> & {
8
7
  small?: boolean;
9
8
  };
10
- export declare const Selectbox: <O extends import("@hugsmidjan/react/__types/Selectbox.privates.js").OptionOrValue>(props: SelectboxProps<O>) => JSX.Element;
9
+ export declare const Selectbox: <O extends OptionOrValue>(props: SelectboxProps<O>) => JSX.Element;
11
10
  export default Selectbox;
@@ -1,4 +1,5 @@
1
1
  import { FormFieldInputProps } from '../FormField.js';
2
+ import { HTMLProps } from '../utils.js';
2
3
  import { TogglerInputProps } from './_TogglerInput.js';
3
4
  export type TogglerGroupOption = {
4
5
  value: string;
@@ -7,7 +8,7 @@ export type TogglerGroupOption = {
7
8
  id?: string;
8
9
  };
9
10
  export type TogglerGroupOptions = Array<TogglerGroupOption>;
10
- type RestrictedInputProps = Omit<JSX.IntrinsicElements['input'], 'type' | 'value' | 'defaultValue' | 'checked' | 'defaultChecked' | 'className' | 'id' | 'name' | 'children'>;
11
+ type RestrictedInputProps = Omit<HTMLProps<'input'>, 'type' | 'value' | 'defaultValue' | 'checked' | 'defaultChecked' | 'className' | 'id' | 'name' | 'children'>;
11
12
  export type TogglerGroupProps = {
12
13
  options: TogglerGroupOptions;
13
14
  className?: string;
@@ -1,5 +1,5 @@
1
- import type { formatBytes } from './_FileInput.utils';
2
- import { CustomFile } from './_FileInput.utils';
1
+ import type { formatBytes } from './_FileInput.utils.js';
2
+ import { CustomFile } from './_FileInput.utils.js';
3
3
  export type FileListProps = {
4
4
  files: Array<CustomFile>;
5
5
  showFileSize?: boolean;
@@ -1,11 +1,10 @@
1
- import type { SelectboxProps as _SelectboxProps } from '@hugsmidjan/react/Selectbox';
1
+ import type { OptionOrValue, SelectboxProps as _SelectboxProps } from '@hugsmidjan/react/Selectbox';
2
2
  import { FormFieldWrappingProps } from './FormField.js';
3
3
  export { type SelectboxOption, type SelectboxOptions as SelectboxOptionList,
4
4
  /** @deprecated Use `SelectboxOptionList` instead (Will be removed in v0.11) */
5
5
  type SelectboxOptions, } from '@hugsmidjan/react/Selectbox';
6
- type OptionOrValue = _SelectboxProps['options'][0];
7
6
  export type SelectboxProps<O extends OptionOrValue = OptionOrValue> = FormFieldWrappingProps & Omit<_SelectboxProps<O>, 'bem'> & {
8
7
  small?: boolean;
9
8
  };
10
- export declare const Selectbox: <O extends import("@hugsmidjan/react/__types/Selectbox.privates.js").OptionOrValue>(props: SelectboxProps<O>) => JSX.Element;
9
+ export declare const Selectbox: <O extends OptionOrValue>(props: SelectboxProps<O>) => JSX.Element;
11
10
  export default Selectbox;
@@ -1,4 +1,5 @@
1
1
  import { FormFieldInputProps } from '../FormField.js';
2
+ import { HTMLProps } from '../utils.js';
2
3
  import { TogglerInputProps } from './_TogglerInput.js';
3
4
  export type TogglerGroupOption = {
4
5
  value: string;
@@ -7,7 +8,7 @@ export type TogglerGroupOption = {
7
8
  id?: string;
8
9
  };
9
10
  export type TogglerGroupOptions = Array<TogglerGroupOption>;
10
- type RestrictedInputProps = Omit<JSX.IntrinsicElements['input'], 'type' | 'value' | 'defaultValue' | 'checked' | 'defaultChecked' | 'className' | 'id' | 'name' | 'children'>;
11
+ type RestrictedInputProps = Omit<HTMLProps<'input'>, 'type' | 'value' | 'defaultValue' | 'checked' | 'defaultChecked' | 'className' | 'id' | 'name' | 'children'>;
11
12
  export type TogglerGroupProps = {
12
13
  options: TogglerGroupOptions;
13
14
  className?: string;
package/esm/utils.d.ts CHANGED
@@ -6,3 +6,10 @@ export * from './utils/useFormatMonitor.js';
6
6
  export * from './utils/useGetSVGtext.js';
7
7
  export * from './utils/useMixedControlState.js';
8
8
  export * from './utils/useScrollbarWidthCSSVar.js';
9
+ /**
10
+ * Helper type to add HTML element props to a component, **including**
11
+ * `data-*` attributes
12
+ */
13
+ export type HTMLProps<T extends keyof JSX.IntrinsicElements> = JSX.IntrinsicElements[T] & {
14
+ [dataAttr: `data-${string}`]: unknown;
15
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reykjavik/hanna-react",
3
- "version": "0.10.87",
3
+ "version": "0.10.88",
4
4
  "author": "Reykjavík (http://www.reykjavik.is)",
5
5
  "contributors": [
6
6
  "Hugsmiðjan ehf (http://www.hugsmidjan.is)",
@@ -14,10 +14,10 @@
14
14
  "license": "MIT",
15
15
  "dependencies": {
16
16
  "@floating-ui/react": "^0.19.2",
17
- "@hugsmidjan/qj": "^4.10.2",
18
- "@hugsmidjan/react": "^0.4.25",
19
- "@reykjavik/hanna-css": "^0.4.1",
20
- "@reykjavik/hanna-utils": "^0.2.3",
17
+ "@hugsmidjan/qj": "^4.18.0",
18
+ "@hugsmidjan/react": "^0.4.30",
19
+ "@reykjavik/hanna-css": "^0.4.2",
20
+ "@reykjavik/hanna-utils": "^0.2.5",
21
21
  "@types/react": "^17.0.24",
22
22
  "@types/react-autosuggest": "^10.1.0",
23
23
  "@types/react-datepicker": "^4.8.0",
package/utils.d.ts CHANGED
@@ -6,3 +6,10 @@ export * from './utils/useFormatMonitor.js';
6
6
  export * from './utils/useGetSVGtext.js';
7
7
  export * from './utils/useMixedControlState.js';
8
8
  export * from './utils/useScrollbarWidthCSSVar.js';
9
+ /**
10
+ * Helper type to add HTML element props to a component, **including**
11
+ * `data-*` attributes
12
+ */
13
+ export type HTMLProps<T extends keyof JSX.IntrinsicElements> = JSX.IntrinsicElements[T] & {
14
+ [dataAttr: `data-${string}`]: unknown;
15
+ };