@infonomic/uikit 6.2.2 → 6.3.0

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.
@@ -2,13 +2,13 @@ import type React from 'react';
2
2
  import { Select as SelectPrimitive } from '@base-ui/react/select';
3
3
  import type { Intent } from '../@types/shared.js';
4
4
  import type { Size, Variant } from '../button/@types/button.js';
5
- export interface SelectValue {
5
+ export interface SelectValue<Value extends string | number = string> {
6
6
  label: string;
7
- value: string;
7
+ value: Value;
8
8
  prefix?: string;
9
9
  suffix?: string;
10
10
  }
11
- type SelectProps = Omit<React.ComponentProps<typeof SelectPrimitive.Root>, 'items'> & {
11
+ type SelectProps<Value extends string | number = string> = Omit<React.ComponentProps<typeof SelectPrimitive.Root<Value>>, 'items'> & {
12
12
  id?: string;
13
13
  intent?: Intent;
14
14
  variant?: Variant;
@@ -20,9 +20,9 @@ type SelectProps = Omit<React.ComponentProps<typeof SelectPrimitive.Root>, 'item
20
20
  disabledValue?: string;
21
21
  ariaLabel?: string;
22
22
  helpText?: string;
23
- items?: SelectValue[];
23
+ items?: SelectValue<Value>[];
24
24
  };
25
- export declare function Select({ id, children, placeholder, disabledValue, intent, variant, size, position, containerClassName, className, ariaLabel, helpText, items, ...rest }: SelectProps): React.JSX.Element;
25
+ export declare function Select<Value extends string | number = string>({ id, children, placeholder, disabledValue, intent, variant, size, position, containerClassName, className, ariaLabel, helpText, items, ...rest }: SelectProps<Value>): React.JSX.Element;
26
26
  export declare const SelectItem: {
27
27
  ({ ref: forwardedRef, children, className, ...props }: React.ComponentProps<typeof SelectPrimitive.Item> & {
28
28
  ref?: React.RefObject<HTMLDivElement>;
@@ -1 +1 @@
1
- {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;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A;CAC7B,CAAA;AAED,wBAAgB,MAAM,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,EAC7D,EAAE,EACF,QAAQ,EACR,WAAW,EACX,aAAa,EACb,MAAM,EACN,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,QAAQ,EACR,KAAK,EACL,GAAG,IAAI,EACR,EAAE,WAAW,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAiDxC;AAED,eAAO,MAAM,UAAU;2DAKpB,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,GAAG;QACrD,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAA;KACtC;;CAeA,CAAA"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@infonomic/uikit",
3
3
  "private": false,
4
4
  "license": "MIT",
5
- "version": "6.2.2",
5
+ "version": "6.3.0",
6
6
  "type": "module",
7
7
  "description": "Infonomic UI kit is a collection of reusable UI components and utilities for React and Astro.",
8
8
  "keywords": [
@@ -14,14 +14,17 @@ import styles from './select.module.css'
14
14
  import type { Intent } from '../@types/shared.js'
15
15
  import type { Size, Variant } from '../button/@types/button.js'
16
16
 
17
- export interface SelectValue {
17
+ export interface SelectValue<Value extends string | number = string> {
18
18
  label: string
19
- value: string
19
+ value: Value
20
20
  prefix?: string
21
21
  suffix?: string
22
22
  }
23
23
 
24
- type SelectProps = Omit<React.ComponentProps<typeof SelectPrimitive.Root>, 'items'> & {
24
+ type SelectProps<Value extends string | number = string> = Omit<
25
+ React.ComponentProps<typeof SelectPrimitive.Root<Value>>,
26
+ 'items'
27
+ > & {
25
28
  id?: string
26
29
  intent?: Intent
27
30
  variant?: Variant
@@ -33,10 +36,10 @@ type SelectProps = Omit<React.ComponentProps<typeof SelectPrimitive.Root>, 'item
33
36
  disabledValue?: string
34
37
  ariaLabel?: string
35
38
  helpText?: string
36
- items?: SelectValue[]
39
+ items?: SelectValue<Value>[]
37
40
  }
38
41
 
39
- export function Select({
42
+ export function Select<Value extends string | number = string>({
40
43
  id,
41
44
  children,
42
45
  placeholder,
@@ -51,10 +54,10 @@ export function Select({
51
54
  helpText,
52
55
  items,
53
56
  ...rest
54
- }: SelectProps): React.JSX.Element {
57
+ }: SelectProps<Value>): React.JSX.Element {
55
58
  return (
56
59
  <div className={cx('infonomic-select-container', containerClassName)}>
57
- <SelectPrimitive.Root items={items} {...rest}>
60
+ <SelectPrimitive.Root<Value> items={items} {...rest}>
58
61
  <SelectPrimitive.Trigger
59
62
  aria-label={ariaLabel ?? 'Select'}
60
63
  render={