@stack-spot/citric-react 0.3.2 → 0.4.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.
Files changed (139) hide show
  1. package/dist/citric.css +4 -0
  2. package/dist/components/Accordion.d.ts +1 -2
  3. package/dist/components/Accordion.d.ts.map +1 -1
  4. package/dist/components/Accordion.js.map +1 -1
  5. package/dist/components/Alert.d.ts +1 -2
  6. package/dist/components/Alert.d.ts.map +1 -1
  7. package/dist/components/Alert.js.map +1 -1
  8. package/dist/components/Avatar.d.ts +2 -2
  9. package/dist/components/Avatar.d.ts.map +1 -1
  10. package/dist/components/AvatarGroup.d.ts +2 -2
  11. package/dist/components/AvatarGroup.d.ts.map +1 -1
  12. package/dist/components/Badge.d.ts +2 -2
  13. package/dist/components/Badge.d.ts.map +1 -1
  14. package/dist/components/Blockquote.d.ts +2 -2
  15. package/dist/components/Blockquote.d.ts.map +1 -1
  16. package/dist/components/Breadcrumb.d.ts +1 -2
  17. package/dist/components/Breadcrumb.d.ts.map +1 -1
  18. package/dist/components/Breadcrumb.js.map +1 -1
  19. package/dist/components/Button.d.ts +2 -2
  20. package/dist/components/Button.d.ts.map +1 -1
  21. package/dist/components/Card.d.ts +2 -2
  22. package/dist/components/Card.d.ts.map +1 -1
  23. package/dist/components/Checkbox.d.ts +2 -2
  24. package/dist/components/Checkbox.d.ts.map +1 -1
  25. package/dist/components/CheckboxGroup.d.ts +2 -2
  26. package/dist/components/CheckboxGroup.d.ts.map +1 -1
  27. package/dist/components/Circle.d.ts +2 -2
  28. package/dist/components/Circle.d.ts.map +1 -1
  29. package/dist/components/CitricComponent.d.ts +1 -1
  30. package/dist/components/CitricComponent.d.ts.map +1 -1
  31. package/dist/components/CitricComponent.js.map +1 -1
  32. package/dist/components/Divider.d.ts +2 -2
  33. package/dist/components/Divider.d.ts.map +1 -1
  34. package/dist/components/Favorite.d.ts +2 -2
  35. package/dist/components/Favorite.d.ts.map +1 -1
  36. package/dist/components/FieldGroup.d.ts +1 -2
  37. package/dist/components/FieldGroup.d.ts.map +1 -1
  38. package/dist/components/FieldGroup.js.map +1 -1
  39. package/dist/components/FormGroup.d.ts +1 -2
  40. package/dist/components/FormGroup.d.ts.map +1 -1
  41. package/dist/components/FormGroup.js.map +1 -1
  42. package/dist/components/IconBox.d.ts +2 -2
  43. package/dist/components/IconBox.d.ts.map +1 -1
  44. package/dist/components/Input.d.ts +3 -3
  45. package/dist/components/Input.d.ts.map +1 -1
  46. package/dist/components/Link.d.ts +2 -2
  47. package/dist/components/Link.d.ts.map +1 -1
  48. package/dist/components/MenuOverlay/types.d.ts +2 -3
  49. package/dist/components/MenuOverlay/types.d.ts.map +1 -1
  50. package/dist/components/Overlay/types.d.ts +2 -2
  51. package/dist/components/Overlay/types.d.ts.map +1 -1
  52. package/dist/components/Pagination.d.ts +1 -2
  53. package/dist/components/Pagination.d.ts.map +1 -1
  54. package/dist/components/Pagination.js.map +1 -1
  55. package/dist/components/ProgressBar.d.ts +2 -2
  56. package/dist/components/ProgressBar.d.ts.map +1 -1
  57. package/dist/components/ProgressCircular.d.ts +2 -2
  58. package/dist/components/ProgressCircular.d.ts.map +1 -1
  59. package/dist/components/RadioGroup.d.ts +2 -2
  60. package/dist/components/RadioGroup.d.ts.map +1 -1
  61. package/dist/components/Rating.d.ts +1 -2
  62. package/dist/components/Rating.d.ts.map +1 -1
  63. package/dist/components/Rating.js.map +1 -1
  64. package/dist/components/Select/SimpleSelect.d.ts.map +1 -1
  65. package/dist/components/Select/SimpleSelect.js +4 -6
  66. package/dist/components/Select/SimpleSelect.js.map +1 -1
  67. package/dist/components/Select/types.d.ts +2 -2
  68. package/dist/components/Select/types.d.ts.map +1 -1
  69. package/dist/components/SelectBox.d.ts +2 -2
  70. package/dist/components/SelectBox.d.ts.map +1 -1
  71. package/dist/components/Skeleton.d.ts +1 -2
  72. package/dist/components/Skeleton.d.ts.map +1 -1
  73. package/dist/components/Skeleton.js.map +1 -1
  74. package/dist/components/Slider.d.ts +2 -2
  75. package/dist/components/Slider.d.ts.map +1 -1
  76. package/dist/components/Stepper.d.ts +1 -2
  77. package/dist/components/Stepper.d.ts.map +1 -1
  78. package/dist/components/Stepper.js.map +1 -1
  79. package/dist/components/Switch.d.ts +2 -2
  80. package/dist/components/Switch.d.ts.map +1 -1
  81. package/dist/components/Table.d.ts +3 -4
  82. package/dist/components/Table.d.ts.map +1 -1
  83. package/dist/components/Table.js.map +1 -1
  84. package/dist/components/Tabs/types.d.ts +2 -2
  85. package/dist/components/Tabs/types.d.ts.map +1 -1
  86. package/dist/components/Text.d.ts +16 -4
  87. package/dist/components/Text.d.ts.map +1 -1
  88. package/dist/components/Text.js +8 -2
  89. package/dist/components/Text.js.map +1 -1
  90. package/dist/components/Textarea.d.ts +2 -2
  91. package/dist/components/Textarea.d.ts.map +1 -1
  92. package/dist/components/Tooltip.d.ts +2 -2
  93. package/dist/components/Tooltip.d.ts.map +1 -1
  94. package/dist/components/layout.d.ts +4 -4
  95. package/dist/components/layout.d.ts.map +1 -1
  96. package/dist/types.d.ts +2 -1
  97. package/dist/types.d.ts.map +1 -1
  98. package/package.json +1 -1
  99. package/src/components/Accordion.tsx +1 -2
  100. package/src/components/Alert.tsx +1 -2
  101. package/src/components/Avatar.tsx +2 -2
  102. package/src/components/AvatarGroup.tsx +2 -2
  103. package/src/components/Badge.tsx +2 -2
  104. package/src/components/Blockquote.tsx +2 -2
  105. package/src/components/Breadcrumb.tsx +1 -2
  106. package/src/components/Button.tsx +2 -2
  107. package/src/components/Card.tsx +2 -2
  108. package/src/components/Checkbox.tsx +2 -2
  109. package/src/components/CheckboxGroup.tsx +2 -2
  110. package/src/components/Circle.tsx +2 -2
  111. package/src/components/CitricComponent.ts +1 -1
  112. package/src/components/Divider.tsx +2 -2
  113. package/src/components/Favorite.tsx +2 -2
  114. package/src/components/FieldGroup.tsx +1 -2
  115. package/src/components/FormGroup.tsx +1 -2
  116. package/src/components/IconBox.tsx +2 -2
  117. package/src/components/Input.tsx +2 -2
  118. package/src/components/Link.tsx +2 -2
  119. package/src/components/MenuOverlay/types.ts +2 -3
  120. package/src/components/Overlay/types.ts +2 -3
  121. package/src/components/Pagination.tsx +1 -2
  122. package/src/components/ProgressBar.tsx +2 -2
  123. package/src/components/ProgressCircular.tsx +2 -2
  124. package/src/components/RadioGroup.tsx +2 -2
  125. package/src/components/Rating.tsx +1 -2
  126. package/src/components/Select/SimpleSelect.tsx +12 -6
  127. package/src/components/Select/types.ts +2 -2
  128. package/src/components/SelectBox.tsx +2 -2
  129. package/src/components/Skeleton.tsx +1 -2
  130. package/src/components/Slider.tsx +2 -2
  131. package/src/components/Stepper.tsx +1 -2
  132. package/src/components/Switch.tsx +2 -2
  133. package/src/components/Table.tsx +3 -4
  134. package/src/components/Tabs/types.ts +2 -2
  135. package/src/components/Text.ts +21 -4
  136. package/src/components/Textarea.tsx +2 -2
  137. package/src/components/Tooltip.tsx +2 -2
  138. package/src/components/layout.tsx +4 -4
  139. package/src/types.ts +2 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stack-spot/citric-react",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "author": "StackSpot",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,6 +1,5 @@
1
1
  import { listToClass } from '@stack-spot/portal-theme'
2
2
  import { useEffect, useMemo, useState } from 'react'
3
- import { HTMLExtension } from '../types'
4
3
  import { applyCSSVariable } from '../utils/css'
5
4
  import { CitricComponent } from './CitricComponent'
6
5
 
@@ -34,7 +33,7 @@ export interface BaseAccordionProps {
34
33
  maxHeight?: number,
35
34
  }
36
35
 
37
- export type AccordionProps = HTMLExtension<'div', BaseAccordionProps>
36
+ export type AccordionProps = React.JSX.IntrinsicElements['div'] & BaseAccordionProps
38
37
 
39
38
  export const Accordion = (
40
39
  { id, appearance, expanded, onChange, header, maxHeight = 300, className, style, children, ...props }: AccordionProps,
@@ -1,5 +1,4 @@
1
1
  import { listToClass } from '@stack-spot/portal-theme'
2
- import { HTMLExtension } from '../types'
3
2
  import { CitricComponent } from './CitricComponent'
4
3
 
5
4
  export interface BaseAlertProps {
@@ -10,7 +9,7 @@ export interface BaseAlertProps {
10
9
  type?: 'error' | 'info' | 'warning',
11
10
  }
12
11
 
13
- export type AlertProps = HTMLExtension<'div', BaseAlertProps>
12
+ export type AlertProps = React.JSX.IntrinsicElements['div'] & BaseAlertProps
14
13
 
15
14
  export const Alert = ({ type, className, children, ...props }: AlertProps) =>
16
15
  <CitricComponent tag="div" component="alert" className={listToClass([type, className])} {...props}>{children}</CitricComponent>
@@ -1,5 +1,5 @@
1
1
  import { listToClass } from '@stack-spot/portal-theme'
2
- import { HTMLExtension, WithColorPalette } from '../types'
2
+ import { WithColorPalette } from '../types'
3
3
  import { CitricComponent } from './CitricComponent'
4
4
 
5
5
  export interface BaseAvatarProps extends WithColorPalette {
@@ -21,7 +21,7 @@ export interface BaseAvatarProps extends WithColorPalette {
21
21
  image?: string,
22
22
  }
23
23
 
24
- export type AvatarProps = HTMLExtension<'div', BaseAvatarProps>
24
+ export type AvatarProps = React.JSX.IntrinsicElements['div'] & BaseAvatarProps
25
25
 
26
26
  export const Avatar = ({ size, name, appearance, className, image, ...props }: AvatarProps) => {
27
27
  const parts = name?.split(' ') ?? ['']
@@ -1,5 +1,5 @@
1
1
  import { listToClass } from '@stack-spot/portal-theme'
2
- import { HTMLExtension, WithColorPalette } from '../types'
2
+ import { WithColorPalette } from '../types'
3
3
  import { Avatar } from './Avatar'
4
4
  import { CitricComponent } from './CitricComponent'
5
5
 
@@ -22,7 +22,7 @@ export interface BaseAvatarGroupProps extends WithColorPalette {
22
22
  maxItems?: number,
23
23
  }
24
24
 
25
- export type AvatarGroupProps = HTMLExtension<'div', BaseAvatarGroupProps>
25
+ export type AvatarGroupProps = React.JSX.IntrinsicElements['div'] & BaseAvatarGroupProps
26
26
 
27
27
  export const AvatarGroup = ({ size, items, appearance, maxItems, className, ...props }: AvatarGroupProps) => {
28
28
  const avatars = items.map(({ name, image }) => <Avatar key={name} name={name} image={image} />, [items])
@@ -1,5 +1,5 @@
1
1
  import { listToClass } from '@stack-spot/portal-theme'
2
- import { HTMLExtension, WithColorPalette } from '../types'
2
+ import { HTMLTag, WithColorPalette } from '../types'
3
3
  import { CitricComponent } from './CitricComponent'
4
4
 
5
5
  type ValidTags = 'a' | 'button' | 'li' | 'div' | 'span'
@@ -17,7 +17,7 @@ export interface BaseBadgeProps<T extends ValidTags = ValidTags> extends WithCol
17
17
  appearance?: 'square' | 'circle',
18
18
  }
19
19
 
20
- export type BadgeProps<T extends ValidTags> = HTMLExtension<T, BaseBadgeProps<T>>
20
+ export type BadgeProps<T extends ValidTags> = HTMLTag[T] & BaseBadgeProps<T>
21
21
 
22
22
  export function Badge<T extends ValidTags>({ tag, appearance, className, children, ...props }: BadgeProps<T>) {
23
23
  return (
@@ -1,9 +1,9 @@
1
- import { HTMLExtension, WithColorPalette, WithColorScheme } from '../types'
1
+ import { WithColorPalette, WithColorScheme } from '../types'
2
2
  import { CitricComponent } from './CitricComponent'
3
3
 
4
4
  export type BaseBlockquoteProps = WithColorScheme & WithColorPalette
5
5
 
6
- export type BlockquoteProps = HTMLExtension<'blockquote', BaseBlockquoteProps>
6
+ export type BlockquoteProps = React.JSX.IntrinsicElements['blockquote'] & BaseBlockquoteProps
7
7
 
8
8
  export const Blockquote = ({ children, ...props }: BlockquoteProps) =>
9
9
  <CitricComponent tag="blockquote" component="blockquote" {...props}>{children}</CitricComponent>
@@ -1,5 +1,4 @@
1
1
  import { useMemo } from 'react'
2
- import { HTMLExtension } from '../types'
3
2
  import { CitricComponent } from './CitricComponent'
4
3
 
5
4
  interface BreadCrumbItem {
@@ -11,7 +10,7 @@ export interface BaseBreadcrumbProps {
11
10
  items: BreadCrumbItem[],
12
11
  }
13
12
 
14
- export type BreadcrumbProps = HTMLExtension<'nav', BaseBreadcrumbProps>
13
+ export type BreadcrumbProps = React.JSX.IntrinsicElements['nav'] & BaseBreadcrumbProps
15
14
 
16
15
  export const Breadcrumb = ({ items, ...props }: BreadcrumbProps) => {
17
16
  const children = useMemo(
@@ -1,7 +1,7 @@
1
1
  import { listToClass } from '@stack-spot/portal-theme'
2
2
  import { useState } from 'react'
3
3
  import { useCitricController } from '../context/hooks'
4
- import { HTMLExtension, WithColorScheme } from '../types'
4
+ import { WithColorScheme } from '../types'
5
5
  import { CitricComponent } from './CitricComponent'
6
6
  import { ProgressCircular } from './ProgressCircular'
7
7
 
@@ -44,7 +44,7 @@ export interface BaseButtonProps extends WithColorScheme {
44
44
  analytics?: boolean,
45
45
  }
46
46
 
47
- export type ButtonProps = HTMLExtension<'button', BaseButtonProps>
47
+ export type ButtonProps = Omit<React.JSX.IntrinsicElements['button'], 'onClick'> & BaseButtonProps
48
48
 
49
49
  export const Button = (
50
50
  { appearance, size, feedback, loading, disabled, onClick, className, children, type = 'button', analytics, ...props }: ButtonProps,
@@ -1,5 +1,5 @@
1
1
  import { listToClass } from '@stack-spot/portal-theme'
2
- import { HTMLExtension, WithColorScheme } from '../types'
2
+ import { WithColorScheme } from '../types'
3
3
  import { CitricComponent } from './CitricComponent'
4
4
 
5
5
  export interface BaseCardProps extends WithColorScheme {
@@ -18,7 +18,7 @@ export interface BaseCardProps extends WithColorScheme {
18
18
  bgLevel?: 300 | 400 | 500 | 600,
19
19
  }
20
20
 
21
- export type CardProps = HTMLExtension<'div', BaseCardProps>
21
+ export type CardProps = React.JSX.IntrinsicElements['div'] & BaseCardProps
22
22
 
23
23
  export const Card = ({ onClick, size, bgLevel, className, children, ...props }: CardProps) => (
24
24
  <CitricComponent
@@ -1,4 +1,4 @@
1
- import { HTMLExtension, WithColorScheme } from '../types'
1
+ import { ControlledInput, WithColorScheme } from '../types'
2
2
  import { CitricComponent } from './CitricComponent'
3
3
 
4
4
  export interface BaseCheckboxProps extends WithColorScheme {
@@ -12,7 +12,7 @@ export interface BaseCheckboxProps extends WithColorScheme {
12
12
  children?: React.ReactNode,
13
13
  }
14
14
 
15
- export type CheckboxProps = HTMLExtension<'input', BaseCheckboxProps>
15
+ export type CheckboxProps = ControlledInput & BaseCheckboxProps
16
16
 
17
17
  export const Checkbox = (
18
18
  { appearance = 'checkbox', value, onChange, colorScheme, children, className, style, ...props }: CheckboxProps,
@@ -1,6 +1,6 @@
1
1
  import { isNil } from 'lodash'
2
2
  import { useMemo } from 'react'
3
- import { HTMLExtension, WithColorScheme } from '../types'
3
+ import { WithColorScheme } from '../types'
4
4
  import { defaultRenderKey, defaultRenderLabel } from '../utils/options'
5
5
  import { CitricComponent } from './CitricComponent'
6
6
  import { Column } from './layout'
@@ -55,7 +55,7 @@ export interface BaseCheckboxGroupProps<T = any> extends WithColorScheme {
55
55
  isDisabled?: (option: T) => boolean,
56
56
  }
57
57
 
58
- export type CheckboxGroupProps<T> = HTMLExtension<'div', BaseCheckboxGroupProps<T>>
58
+ export type CheckboxGroupProps<T> = React.JSX.IntrinsicElements['div'] & BaseCheckboxGroupProps<T>
59
59
 
60
60
  export function CheckboxGroup<T>({
61
61
  appearance = 'checkbox',
@@ -1,5 +1,5 @@
1
1
  import { listToClass } from '@stack-spot/portal-theme'
2
- import { HTMLExtension, WithColorPalette, WithColorScheme } from '../types'
2
+ import { WithColorPalette, WithColorScheme } from '../types'
3
3
  import { CitricComponent } from './CitricComponent'
4
4
 
5
5
  export interface BaseCircleProps extends WithColorPalette, WithColorScheme {
@@ -17,7 +17,7 @@ export interface BaseCircleProps extends WithColorPalette, WithColorScheme {
17
17
  size?: 'xxs' | 'xs' | 'sm' | 'lg' | 'xl' | 'xxl',
18
18
  }
19
19
 
20
- export type CircleProps = HTMLExtension<'div', BaseCircleProps>
20
+ export type CircleProps = React.JSX.IntrinsicElements['div'] & BaseCircleProps
21
21
 
22
22
  export const Circle = ({ showBorders, className, size, children, ...props }: CircleProps) => (
23
23
  <CitricComponent tag="div" component="circle" className={listToClass([className, showBorders && 'bordered', size])} {...props}>
@@ -18,7 +18,7 @@ interface CitricComponentType {
18
18
  <T extends keyof JSX.IntrinsicElements>(props: Props<T>): React.ReactNode,
19
19
  }
20
20
 
21
- export function asCitricProps({ colorScheme, colorPalette, component, ...props }: Omit<Props<any>, 'tag'>) {
21
+ export function asCitricProps({ colorScheme, colorPalette, component, ...props }: Omit<CustomProps<any>, 'tag'> & Record<string, any>) {
22
22
  const citricProps: Record<string, any> = { ...props, 'data-citric': component }
23
23
  if (colorScheme) citricProps['data-color-scheme'] = colorScheme
24
24
  if (colorPalette) citricProps['data-color-palette'] = colorPalette
@@ -1,5 +1,5 @@
1
1
  import { listToClass } from '@stack-spot/portal-theme'
2
- import { HTMLExtension, WithColorScheme } from '../types'
2
+ import { WithColorScheme } from '../types'
3
3
  import { CitricComponent } from './CitricComponent'
4
4
 
5
5
  export interface BaseDividerProps extends WithColorScheme {
@@ -13,7 +13,7 @@ export interface BaseDividerProps extends WithColorScheme {
13
13
  size?: 'sm' | 'md' | 'lg',
14
14
  }
15
15
 
16
- export type DividerProps = HTMLExtension<'hr', BaseDividerProps>
16
+ export type DividerProps = React.JSX.IntrinsicElements['hr'] & BaseDividerProps
17
17
 
18
18
  export const Divider = ({ size, direction, className, children, ...props }: DividerProps) => (
19
19
  <CitricComponent tag="hr" component="divider" className={listToClass([className, size, direction])} {...props}>
@@ -1,5 +1,5 @@
1
1
  import { listToClass } from '@stack-spot/portal-theme'
2
- import { HTMLExtension } from '../types'
2
+ import { ControlledInput } from '../types'
3
3
  import { CitricComponent } from './CitricComponent'
4
4
 
5
5
  type FavoriteAppearance = 'square' | 'circle' | 'text'
@@ -22,7 +22,7 @@ export interface BaseFavoriteProps {
22
22
  isLoading?: boolean,
23
23
  }
24
24
 
25
- export type FavoriteProps = HTMLExtension<'input', BaseFavoriteProps>
25
+ export type FavoriteProps = ControlledInput & BaseFavoriteProps
26
26
 
27
27
  export const Favorite = ({ value, size, appearance, onChange, isLoading, className, ...props }: FavoriteProps) =>
28
28
  <CitricComponent
@@ -1,5 +1,4 @@
1
1
  import { listToClass } from '@stack-spot/portal-theme'
2
- import { HTMLExtension } from '../types'
3
2
  import { CitricComponent } from './CitricComponent'
4
3
 
5
4
  export interface BaseFieldGroupProps {
@@ -13,7 +12,7 @@ export interface BaseFieldGroupProps {
13
12
  auto?: boolean,
14
13
  }
15
14
 
16
- export type FieldGroupProps = HTMLExtension<'div', BaseFieldGroupProps>
15
+ export type FieldGroupProps = React.JSX.IntrinsicElements['div'] & BaseFieldGroupProps
17
16
 
18
17
  export const FieldGroup = ({ auto = true, className, children, ...props }: FieldGroupProps) => (
19
18
  <CitricComponent tag="div" component="field-group" className={listToClass([className, auto && 'auto'])} {...props}>
@@ -1,5 +1,4 @@
1
1
  import { listToClass } from '@stack-spot/portal-theme'
2
- import { HTMLExtension } from '../types'
3
2
  import { CitricComponent } from './CitricComponent'
4
3
  import { IconButton } from './IconBox'
5
4
  import { Text } from './Text'
@@ -24,7 +23,7 @@ export interface BaseFormGroupProps {
24
23
  warning?: string,
25
24
  }
26
25
 
27
- export type FormGroupProps = HTMLExtension<'div', BaseFormGroupProps>
26
+ export type FormGroupProps = React.JSX.IntrinsicElements['div'] & BaseFormGroupProps
28
27
 
29
28
  export const FormGroup = ({ error, help, label, warning, className, children, ...props }: FormGroupProps) => (
30
29
  <CitricComponent tag="div" component="form-group" className={listToClass([className, error && 'error'])} {...props}>
@@ -2,7 +2,7 @@ import { IconGroup, IconOwnProps } from '@stack-spot/citric-icons'
2
2
  import { listToClass } from '@stack-spot/portal-theme'
3
3
  import { useCallback } from 'react'
4
4
  import { useCitricController } from '../context/hooks'
5
- import { HTMLExtension, WithColorPalette, WithColorScheme } from '../types'
5
+ import { HTMLTag, WithColorPalette, WithColorScheme } from '../types'
6
6
  import { CitricComponent } from './CitricComponent'
7
7
 
8
8
  type IconBoxTag = 'a' | 'button' | 'i' | 'span' | 'div'
@@ -43,7 +43,7 @@ export interface BaseIconBoxProps<T extends IconBoxTag, G extends IconGroup> ext
43
43
  analytics?: boolean,
44
44
  }
45
45
 
46
- export type IconBoxProps<T extends IconBoxTag, G extends IconGroup> = HTMLExtension<T, BaseIconBoxProps<T, G>>
46
+ export type IconBoxProps<T extends IconBoxTag, G extends IconGroup> = HTMLTag[T] & BaseIconBoxProps<T, G>
47
47
 
48
48
  export function IconBox<T extends IconBoxTag = 'i', G extends IconGroup = 'outline'>(
49
49
  { group, icon, tag, colorScheme, colorPalette, appearance, size, className, analytics, onClick, feedback, ...props }: IconBoxProps<T, G>,
@@ -1,4 +1,4 @@
1
- import { HTMLExtension, WithColorScheme } from '../types'
1
+ import { ControlledInput, WithColorScheme } from '../types'
2
2
  import { CitricComponent } from './CitricComponent'
3
3
 
4
4
  export type SupportedInputType = 'color' | 'date' | 'datetime-local' | 'email' | 'month' | 'number' | 'password' | 'search' | 'tel' |
@@ -14,7 +14,7 @@ export interface BaseInputProps<T extends SupportedInputType> extends WithColorS
14
14
  }
15
15
 
16
16
  export type InputProps<T extends SupportedInputType = 'text'> =
17
- HTMLExtension<'input', BaseInputProps<T> & { type?: T }>
17
+ ControlledInput & BaseInputProps<T> & { type?: T }
18
18
 
19
19
  export function Input<T extends SupportedInputType = 'text'>({ type, value, onChange, ...props }: InputProps<T>) {
20
20
  function handleChange(e: React.ChangeEvent<HTMLInputElement>) {
@@ -1,5 +1,5 @@
1
1
  import { useCitricController } from '../context/hooks'
2
- import { HTMLExtension, TextAppearance, WithColor } from '../types'
2
+ import { TextAppearance, WithColor } from '../types'
3
3
  import { applyColor, applyTextAppearance } from '../utils/css'
4
4
  import { asCitricProps, CitricComponent } from './CitricComponent'
5
5
 
@@ -20,7 +20,7 @@ export interface BaseLinkProps extends WithColor {
20
20
  analytics?: boolean,
21
21
  }
22
22
 
23
- export type LinkProps = HTMLExtension<'a', BaseLinkProps>
23
+ export type LinkProps = React.JSX.IntrinsicElements['a'] & BaseLinkProps
24
24
 
25
25
  export const Link = ({ appearance, color, style, className, children, onClick, analytics, ...props }: LinkProps) => {
26
26
  const citric = useCitricController()
@@ -1,4 +1,3 @@
1
- import { HTMLExtension } from '../../types'
2
1
  import { BaseOverlayProps } from '../Overlay/types'
3
2
 
4
3
  interface CustomLabel {
@@ -165,7 +164,7 @@ export interface BaseMenuProps {
165
164
  menuStyle?: React.CSSProperties,
166
165
  }
167
166
 
168
- export type MenuProps = HTMLExtension<'div', BaseMenuProps>
167
+ export type MenuProps = React.JSX.IntrinsicElements['div'] & BaseMenuProps
169
168
 
170
169
  export interface BaseMenuOverlayProps extends
171
170
  BaseMenuProps, Omit<BaseOverlayProps<'div'>, 'tag' | 'onRenderChild' | 'content' | 'triggerOn' | 'reference'> {
@@ -175,4 +174,4 @@ export interface BaseMenuOverlayProps extends
175
174
  id?: string,
176
175
  }
177
176
 
178
- export type MenuOverlayProps = HTMLExtension<'div', BaseMenuOverlayProps>
177
+ export type MenuOverlayProps = Omit<React.JSX.IntrinsicElements['div'], 'content'> & BaseMenuOverlayProps
@@ -1,5 +1,5 @@
1
1
  import { OverlayOptions } from '../../overlay'
2
- import { HTMLExtension, HTMLTag } from '../../types'
2
+ import { HTMLTag } from '../../types'
3
3
 
4
4
  export type TriggerOn = 'hover' | 'click'
5
5
 
@@ -63,8 +63,7 @@ export interface BaseOverlayProps<T extends keyof HTMLTag> extends Omit<OverlayO
63
63
  onRenderChild?: (element: HTMLElement) => void,
64
64
  }
65
65
 
66
- export type OverlayProps<T extends keyof HTMLTag> =
67
- HTMLExtension<'div', BaseOverlayProps<T>>
66
+ export type OverlayProps<T extends keyof HTMLTag> = Omit<React.JSX.IntrinsicElements['div'], 'content'> & BaseOverlayProps<T>
68
67
 
69
68
  export interface OverlayController {
70
69
  close: () => Promise<void>,
@@ -1,6 +1,5 @@
1
1
  import { Dictionary, interpolate, useTranslate } from '@stack-spot/portal-translate'
2
2
  import { useMemo } from 'react'
3
- import { HTMLExtension } from '../types'
4
3
  import { CitricComponent } from './CitricComponent'
5
4
  import { IconButton } from './IconBox'
6
5
 
@@ -29,7 +28,7 @@ export interface BasePaginationProps {
29
28
  onChange: (page: number, size: number) => void,
30
29
  }
31
30
 
32
- export type PaginationProps = HTMLExtension<'div', BasePaginationProps>
31
+ export type PaginationProps = React.JSX.IntrinsicElements['div'] & BasePaginationProps
33
32
 
34
33
  export const Pagination = (
35
34
  { pageSizeOptions = [10, 20, 30], pageSize, totalPages, page, onChange, ...props }: PaginationProps,
@@ -1,6 +1,6 @@
1
1
  import { listToClass } from '@stack-spot/portal-theme'
2
2
  import { isNil } from 'lodash'
3
- import { HTMLExtension, WithColorPalette, WithColorScheme } from '../types'
3
+ import { WithColorPalette, WithColorScheme } from '../types'
4
4
  import { applyCSSVariable } from '../utils/css'
5
5
  import { CitricComponent } from './CitricComponent'
6
6
 
@@ -13,7 +13,7 @@ export interface BaseProgressBarProps extends WithColorScheme, WithColorPalette
13
13
  progress?: number,
14
14
  }
15
15
 
16
- export type ProgressBarProps = HTMLExtension<'div', BaseProgressBarProps>
16
+ export type ProgressBarProps = React.JSX.IntrinsicElements['div'] & BaseProgressBarProps
17
17
 
18
18
  export const ProgressBar = ({ progress, style, className, ...props }: ProgressBarProps) =>
19
19
  <CitricComponent
@@ -1,6 +1,6 @@
1
1
  import { listToClass } from '@stack-spot/portal-theme'
2
2
  import { isNil } from 'lodash'
3
- import { HTMLExtension, WithColorPalette, WithColorScheme } from '../types'
3
+ import { WithColorPalette, WithColorScheme } from '../types'
4
4
  import { applyCSSVariable } from '../utils/css'
5
5
  import { CitricComponent } from './CitricComponent'
6
6
 
@@ -17,7 +17,7 @@ export interface BaseProgressCircularProps extends WithColorScheme, WithColorPal
17
17
  size?: 'xs' | 'sm' | 'md' | 'lg',
18
18
  }
19
19
 
20
- export type ProgressCircularProps = HTMLExtension<'div', BaseProgressCircularProps>
20
+ export type ProgressCircularProps = React.JSX.IntrinsicElements['div'] & BaseProgressCircularProps
21
21
 
22
22
  export const ProgressCircular = ({ progress, size, style, className, ...props }: ProgressCircularProps) =>
23
23
  <CitricComponent
@@ -1,6 +1,6 @@
1
1
  import { isNil } from 'lodash'
2
2
  import { useMemo } from 'react'
3
- import { HTMLExtension, WithColorScheme } from '../types'
3
+ import { WithColorScheme } from '../types'
4
4
  import { defaultRenderKey, defaultRenderLabel } from '../utils/options'
5
5
  import { CitricComponent } from './CitricComponent'
6
6
  import { Column } from './layout'
@@ -50,7 +50,7 @@ export interface BaseRadioGroupProps<T> extends WithColorScheme {
50
50
  isDisabled?: (option: T) => boolean,
51
51
  }
52
52
 
53
- export type RadioGroupProps<T> = HTMLExtension<'div', BaseRadioGroupProps<T>>
53
+ export type RadioGroupProps<T> = React.JSX.IntrinsicElements['div'] & BaseRadioGroupProps<T>
54
54
 
55
55
  export function RadioGroup<T>({
56
56
  name,
@@ -1,4 +1,3 @@
1
- import { HTMLExtension } from '../types'
2
1
  import { CitricComponent } from './CitricComponent'
3
2
 
4
3
  export type RatingValue = 1 | 2 | 3 | 4 | 5
@@ -12,7 +11,7 @@ export interface BaseRatingProps {
12
11
  name?: string,
13
12
  }
14
13
 
15
- export type RatingProps = HTMLExtension<'div', BaseRatingProps>
14
+ export type RatingProps = React.JSX.IntrinsicElements['div'] & BaseRatingProps
16
15
 
17
16
  export const Rating = ({ value, onChange, name, ...props }: RatingProps) => (
18
17
  <CitricComponent tag="div" component="rating" {...props}>
@@ -1,4 +1,3 @@
1
- import { isNil } from 'lodash'
2
1
  import { useCallback, useMemo } from 'react'
3
2
  import { defaultRenderKey, defaultRenderLabel } from '../../utils/options'
4
3
  import { CitricComponent } from '../CitricComponent'
@@ -20,17 +19,16 @@ export function SimpleSelect<T>({
20
19
  ...props
21
20
  }: SelectProps<T> & { wrap?: boolean }) {
22
21
  const handleChange = useCallback((e: React.ChangeEvent<HTMLSelectElement>) => {
23
- const selectedIndex = e.target.options.selectedIndex + (required ? 0 : 1)
24
- onChange?.(options[selectedIndex])
22
+ const selectedIndex = e.target.options.selectedIndex - (e.target.options.length > options.length ? 1 : 0)
23
+ onChange?.(selectedIndex >= 0 ? options[selectedIndex] : undefined)
25
24
  }, [options])
26
25
 
27
26
  const renderedOptions = useMemo(() => {
28
- const valueKey = value ? renderKey(value) : undefined
29
27
  const items = (!value || !required) ? [<option key="">{renderLabel(undefined)}</option>] : []
30
28
  options.forEach((o) => {
31
29
  const key = renderKey(o)
32
30
  items.push(
33
- <option key={key} value={key} selected={o === value || (!isNil(key) && key === valueKey)}>
31
+ <option key={key} value={key}>
34
32
  {renderLabel(o)}
35
33
  </option>,
36
34
  )
@@ -47,12 +45,20 @@ export function SimpleSelect<T>({
47
45
  component="select"
48
46
  onFocus={onFocus}
49
47
  onBlur={onBlur}
48
+ value={value ? renderKey(value) : ''}
50
49
  >
51
50
  {renderedOptions}
52
51
  </CitricComponent>
53
52
  ) : (
54
53
  <CitricComponent tag="div" component="select" aria-busy={loading} {...props}>
55
- <select required={required} onChange={handleChange} disabled={disabled || loading} onFocus={onFocus} onBlur={onBlur}>
54
+ <select
55
+ value={value ? renderKey(value) : undefined}
56
+ required={required}
57
+ onChange={handleChange}
58
+ disabled={disabled || loading}
59
+ onFocus={onFocus}
60
+ onBlur={onBlur}
61
+ >
56
62
  {renderedOptions}
57
63
  </select>
58
64
  {loading && <ProgressCircular className="loader" size="xs" />}
@@ -1,4 +1,4 @@
1
- import { HTMLExtension, WithColorScheme } from '../../types'
1
+ import { WithColorScheme } from '../../types'
2
2
 
3
3
  interface CommonSelectProps<T> extends WithColorScheme {
4
4
  /**
@@ -118,4 +118,4 @@ export interface RichSelectProps<T> extends CommonSelectProps<T> {
118
118
 
119
119
  export type BaseSelectProps<T> = SimpleSelectProps<T> | RichSelectProps<T>
120
120
 
121
- export type SelectProps<T> = HTMLExtension<'div', BaseSelectProps<T>>
121
+ export type SelectProps<T> = React.JSX.IntrinsicElements['div'] & BaseSelectProps<T>
@@ -1,6 +1,6 @@
1
1
  import { listToClass } from '@stack-spot/portal-theme'
2
2
  import { useMemo } from 'react'
3
- import { HTMLExtension, WithColorPalette, WithColorScheme } from '../types'
3
+ import { WithColorPalette, WithColorScheme } from '../types'
4
4
  import { defaultRenderKey, defaultRenderLabel } from '../utils/options'
5
5
  import { CitricComponent } from './CitricComponent'
6
6
  import { layout } from './layout'
@@ -70,7 +70,7 @@ interface RadioProps<T> extends CommonSelectBoxProps<T> {
70
70
 
71
71
  export type BaseSelectBoxProps<T> = RadioProps<T> | CheckboxProps<T>
72
72
 
73
- export type SelectBoxProps<T> = HTMLExtension<'div', BaseSelectBoxProps<T>>
73
+ export type SelectBoxProps<T> = React.JSX.IntrinsicElements['div'] & BaseSelectBoxProps<T>
74
74
 
75
75
  export function SelectBox<T>({
76
76
  multiple,
@@ -1,5 +1,4 @@
1
1
  import { listToClass } from '@stack-spot/portal-theme'
2
- import { HTMLExtension } from '../types'
3
2
  import { CitricComponent } from './CitricComponent'
4
3
 
5
4
  export interface BaseSkeletonProps {
@@ -29,7 +28,7 @@ export interface BaseSkeletonProps {
29
28
  bgLevel?: 400 | 500 | 600,
30
29
  }
31
30
 
32
- export type SkeletonProps = HTMLExtension<'div', BaseSkeletonProps>
31
+ export type SkeletonProps = React.JSX.IntrinsicElements['div'] & BaseSkeletonProps
33
32
 
34
33
  export const Skeleton = ({ appearance, className, style, width, height, bgLevel, ...props }: SkeletonProps) =>
35
34
  <CitricComponent
@@ -1,5 +1,5 @@
1
1
  import { listToClass } from '@stack-spot/portal-theme'
2
- import { HTMLExtension, WithColorPalette, WithColorScheme } from '../types'
2
+ import { ControlledInput, WithColorPalette, WithColorScheme } from '../types'
3
3
  import { applyCSSVariable } from '../utils/css'
4
4
  import { CitricComponent } from './CitricComponent'
5
5
 
@@ -32,7 +32,7 @@ export interface BaseSliderProps extends WithColorScheme, WithColorPalette {
32
32
  renderValue?: (value: number) => string,
33
33
  }
34
34
 
35
- export type SliderProps = HTMLExtension<'input', BaseSliderProps>
35
+ export type SliderProps = ControlledInput & BaseSliderProps
36
36
 
37
37
  export const Slider = (
38
38
  { value, onChange, min, max, style, showValue, renderValue, colorPalette, colorScheme, className, ...props }: SliderProps,
@@ -1,7 +1,6 @@
1
1
  import { listToClass } from '@stack-spot/portal-theme'
2
2
  import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
3
3
  import { useCallback, useEffect, useMemo, useState } from 'react'
4
- import { HTMLExtension } from '../types'
5
4
  import { Button } from './Button'
6
5
  import { Column, Row } from './layout'
7
6
  import { Tabs } from './Tabs'
@@ -57,7 +56,7 @@ export interface BaseStepperProps<Key extends string> extends BaseTabsProps<Key>
57
56
  },
58
57
  }
59
58
 
60
- export type StepperProps<Key extends string> = HTMLExtension<'div', BaseStepperProps<Key>>
59
+ export type StepperProps<Key extends string> = React.JSX.IntrinsicElements['div'] & BaseStepperProps<Key>
61
60
 
62
61
  function getTabsWithDisabled<Key extends string>(tabs: Tab<Key>[], value: Key | undefined) {
63
62
  let index = findSelectedIndex(tabs, value ?? '')
@@ -1,4 +1,4 @@
1
- import { HTMLExtension, WithColorScheme } from '../types'
1
+ import { ControlledInput, WithColorScheme } from '../types'
2
2
  import { CitricComponent } from './CitricComponent'
3
3
 
4
4
  interface Props extends WithColorScheme {
@@ -7,7 +7,7 @@ interface Props extends WithColorScheme {
7
7
  children?: React.ReactNode,
8
8
  }
9
9
 
10
- export type SwitchProps = HTMLExtension<'input', Props>
10
+ export type SwitchProps = ControlledInput & Props
11
11
 
12
12
  export const Switch = ({ value, onChange, children, className, style, ...props }: SwitchProps) => {
13
13
  const handleChange = onChange ? () => onChange(!value) : undefined
@@ -1,7 +1,6 @@
1
1
  import { listToClass } from '@stack-spot/portal-theme'
2
2
  import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
3
3
  import { useEffect, useRef } from 'react'
4
- import { HTMLExtension } from '../types'
5
4
  import { applyCSSVariable } from '../utils/css'
6
5
  import { CitricComponent } from './CitricComponent'
7
6
 
@@ -106,9 +105,9 @@ interface BaseTrProps {
106
105
  accordionMaxHeight?: string,
107
106
  }
108
107
 
109
- export type TableProps = HTMLExtension<'table', BaseTableProps>
110
- export type ThProps = HTMLExtension<'th', BaseThProps>
111
- export type TrProps = HTMLExtension<'tr', BaseTrProps>
108
+ export type TableProps = React.JSX.IntrinsicElements['table'] & BaseTableProps
109
+ export type ThProps = React.JSX.IntrinsicElements['th'] & BaseThProps
110
+ export type TrProps = React.JSX.IntrinsicElements['tr'] & BaseTrProps
112
111
 
113
112
  export const Table = ({
114
113
  appearance, stripped, compressed, showBorders, showHeaderBorders, showRowBorders, rounded, roundedRows, uppercaseHeader, className,