@charcoal-ui/react 5.0.0-beta.5 → 5.0.0-beta.7

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 (59) hide show
  1. package/dist/index.cjs.map +1 -1
  2. package/dist/index.css +31 -10
  3. package/dist/index.css.map +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/layered.css +31 -10
  6. package/dist/layered.css.map +1 -1
  7. package/package.json +5 -5
  8. package/src/_lib/createDivComponent.tsx +1 -1
  9. package/src/_lib/index.ts +1 -1
  10. package/src/components/Button/index.css +4 -1
  11. package/src/components/Button/index.tsx +2 -2
  12. package/src/components/Button/styledButtonTypeTest.d.tsx +2 -2
  13. package/src/components/Checkbox/CheckboxInput/index.css +3 -1
  14. package/src/components/Checkbox/CheckboxInput/index.tsx +3 -3
  15. package/src/components/Checkbox/index.tsx +1 -1
  16. package/src/components/Clickable/index.tsx +2 -2
  17. package/src/components/DropdownSelector/DropdownPopover.tsx +1 -1
  18. package/src/components/DropdownSelector/ListItem/index.tsx +1 -1
  19. package/src/components/DropdownSelector/MenuItem/index.tsx +2 -2
  20. package/src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx +6 -6
  21. package/src/components/DropdownSelector/MenuList/index.tsx +1 -1
  22. package/src/components/DropdownSelector/Popover/index.tsx +1 -1
  23. package/src/components/DropdownSelector/Popover/usePreventScroll.tsx +1 -1
  24. package/src/components/DropdownSelector/index.css +3 -1
  25. package/src/components/DropdownSelector/index.story.tsx +1 -1
  26. package/src/components/DropdownSelector/index.tsx +3 -3
  27. package/src/components/DropdownSelector/utils/findPreviewRecursive.tsx +2 -2
  28. package/src/components/FieldLabel/index.css +3 -1
  29. package/src/components/FieldLabel/index.tsx +2 -2
  30. package/src/components/Icon/index.tsx +1 -1
  31. package/src/components/IconButton/index.css +3 -1
  32. package/src/components/IconButton/index.tsx +4 -4
  33. package/src/components/LoadingSpinner/index.tsx +4 -4
  34. package/src/components/Modal/Dialog/index.tsx +1 -1
  35. package/src/components/Modal/ModalBackgroundContext.tsx +1 -1
  36. package/src/components/Modal/index.tsx +4 -4
  37. package/src/components/Modal/useCustomModalOverlay.tsx +4 -4
  38. package/src/components/MultiSelect/context.ts +1 -1
  39. package/src/components/MultiSelect/index.css +3 -1
  40. package/src/components/MultiSelect/index.test.tsx +6 -6
  41. package/src/components/MultiSelect/index.tsx +5 -5
  42. package/src/components/Radio/RadioGroup/index.tsx +4 -4
  43. package/src/components/Radio/RadioGroupContext.ts +1 -1
  44. package/src/components/Radio/RadioInput/index.css +6 -2
  45. package/src/components/Radio/RadioInput/index.tsx +2 -2
  46. package/src/components/Radio/index.test.tsx +3 -1
  47. package/src/components/Radio/index.tsx +2 -2
  48. package/src/components/SegmentedControl/index.tsx +6 -6
  49. package/src/components/Switch/SwitchInput/index.tsx +1 -1
  50. package/src/components/Switch/index.tsx +1 -1
  51. package/src/components/TagItem/index.tsx +3 -3
  52. package/src/components/TextArea/index.css +3 -1
  53. package/src/components/TextArea/index.tsx +4 -4
  54. package/src/components/TextField/AssistiveText/index.tsx +1 -1
  55. package/src/components/TextField/index.css +3 -1
  56. package/src/components/TextField/index.tsx +3 -3
  57. package/src/components/TextField/text-field.test.tsx +5 -5
  58. package/src/components/TextField/useFocusWithClick.tsx +1 -1
  59. package/src/core/themeHelper.ts +2 -2
@@ -16,7 +16,7 @@ export type RadioProps = React.PropsWithChildren<{
16
16
 
17
17
  const Radio = forwardRef<HTMLInputElement, RadioProps>(function RadioInner(
18
18
  { value, disabled = false, children, ...props },
19
- ref
19
+ ref,
20
20
  ) {
21
21
  const {
22
22
  name,
@@ -32,7 +32,7 @@ const Radio = forwardRef<HTMLInputElement, RadioProps>(function RadioInner(
32
32
  warning(
33
33
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
34
34
  name !== undefined,
35
- `"name" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?`
35
+ `"name" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?`,
36
36
  )
37
37
 
38
38
  const isSelected = value === selected
@@ -38,7 +38,7 @@ const SegmentedControl = forwardRef<HTMLDivElement, SegmentedControlProps>(
38
38
  function SegmentedControlInner(props, ref) {
39
39
  const className = useClassNames(
40
40
  'charcoal-segmented-control',
41
- props.className
41
+ props.className,
42
42
  )
43
43
 
44
44
  const ariaRadioGroupProps = useMemo<AriaRadioGroupProps>(
@@ -49,13 +49,13 @@ const SegmentedControl = forwardRef<HTMLDivElement, SegmentedControlProps>(
49
49
  isRequired: props.required,
50
50
  'aria-label': props.name,
51
51
  }),
52
- [props]
52
+ [props],
53
53
  )
54
54
  const state = useRadioGroupState(ariaRadioGroupProps)
55
55
  const { radioGroupProps } = useRadioGroup(ariaRadioGroupProps, state)
56
56
  const segmentedControlItems = useMemo<SegmentedControlItem[]>(() => {
57
57
  return props.data.map((d) =>
58
- typeof d === 'string' ? { value: d, label: d } : d
58
+ typeof d === 'string' ? { value: d, label: d } : d,
59
59
  )
60
60
  }, [props.data])
61
61
 
@@ -74,7 +74,7 @@ const SegmentedControl = forwardRef<HTMLDivElement, SegmentedControlProps>(
74
74
  </RadioProvider>
75
75
  </div>
76
76
  )
77
- }
77
+ },
78
78
  )
79
79
 
80
80
  export default memo(SegmentedControl)
@@ -94,13 +94,13 @@ const Segmented = (props: RadioProps) => {
94
94
  isDisabled: props.disabled,
95
95
  children: props.children,
96
96
  }),
97
- [props]
97
+ [props],
98
98
  )
99
99
 
100
100
  const { inputProps, isDisabled, isSelected } = useRadio(
101
101
  ariaRadioProps,
102
102
  state,
103
- ref
103
+ ref,
104
104
  )
105
105
 
106
106
  return (
@@ -21,7 +21,7 @@ const SwitchInput = forwardRef<
21
21
  const el = e.currentTarget
22
22
  onChange?.(el.checked)
23
23
  },
24
- [onChange]
24
+ [onChange],
25
25
  )
26
26
 
27
27
  const classNames = useClassNames('charcoal-switch-input', className)
@@ -9,7 +9,7 @@ export type SwitchProps = SwitchInputProps
9
9
 
10
10
  const Switch = forwardRef<HTMLInputElement, SwitchProps>(function Switch(
11
11
  { children, onChange, disabled, className, id, ...props },
12
- ref
12
+ ref,
13
13
  ) {
14
14
  const htmlId = useId(id)
15
15
  const noChildren = children === undefined
@@ -36,7 +36,7 @@ const TagItem = forwardRef<HTMLButtonElement, TagItemProps>(
36
36
  status = 'default',
37
37
  ...props
38
38
  }: TagItemProps<T>,
39
- _ref: ForwardedRef<HTMLButtonElement>
39
+ _ref: ForwardedRef<HTMLButtonElement>,
40
40
  ) {
41
41
  const ref = useObjectRef(_ref)
42
42
 
@@ -45,7 +45,7 @@ const TagItem = forwardRef<HTMLButtonElement, TagItemProps>(
45
45
  const className = useClassNames(
46
46
  'charcoal-tag-item',
47
47
  'charcoal-tag-item__bg',
48
- props.className
48
+ props.className,
49
49
  )
50
50
 
51
51
  const bgVariant =
@@ -83,7 +83,7 @@ const TagItem = forwardRef<HTMLButtonElement, TagItemProps>(
83
83
  {status === 'active' && <Icon name="16/Remove" />}
84
84
  </Component>
85
85
  )
86
- }
86
+ },
87
87
  ) as <T extends React.ElementType = 'button'>(p: TagItemProps<T>) => JSX.Element
88
88
 
89
89
  export default memo(TagItem)
@@ -15,7 +15,9 @@
15
15
  color: var(--charcoal-text2);
16
16
  background-color: var(--charcoal-surface3);
17
17
  border-radius: 4px;
18
- transition: 0.2s background-color, 0.2s box-shadow;
18
+ transition:
19
+ 0.2s background-color,
20
+ 0.2s box-shadow;
19
21
  height: calc(22px * var(--charcoal-text-area-rows) + 18px);
20
22
  }
21
23
 
@@ -48,7 +48,7 @@ const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(
48
48
  getCount = countCodePointsInString,
49
49
  ...props
50
50
  },
51
- forwardRef
51
+ forwardRef,
52
52
  ) {
53
53
  const { visuallyHiddenProps } = useVisuallyHidden()
54
54
  const textareaRef = useRef<HTMLTextAreaElement>(null)
@@ -60,7 +60,7 @@ const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(
60
60
  const rows = (`${textarea.value}\n`.match(/\n/gu)?.length ?? 0) || 1
61
61
  setRows(initialRows <= rows ? rows : initialRows)
62
62
  },
63
- [initialRows]
63
+ [initialRows],
64
64
  )
65
65
 
66
66
  const nonControlled = value === undefined
@@ -79,7 +79,7 @@ const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(
79
79
  }
80
80
  onChange?.(value)
81
81
  },
82
- [autoHeight, getCount, maxLength, nonControlled, onChange, syncHeight]
82
+ [autoHeight, getCount, maxLength, nonControlled, onChange, syncHeight],
83
83
  )
84
84
 
85
85
  useEffect(() => {
@@ -153,7 +153,7 @@ const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(
153
153
  )}
154
154
  </div>
155
155
  )
156
- }
156
+ },
157
157
  )
158
158
 
159
159
  export default TextArea
@@ -2,5 +2,5 @@ import { createDivComponent } from '../../../_lib/createDivComponent'
2
2
  import './index.css'
3
3
 
4
4
  export const AssistiveText = createDivComponent(
5
- 'charcoal-text-field-assistive-text'
5
+ 'charcoal-text-field-assistive-text',
6
6
  )
@@ -11,7 +11,9 @@
11
11
  .charcoal-text-field-container {
12
12
  display: flex;
13
13
  height: 40px;
14
- transition: 0.2s background-color, 0.2s box-shadow;
14
+ transition:
15
+ 0.2s background-color,
16
+ 0.2s box-shadow;
15
17
  color: var(--charcoal-text2);
16
18
  background-color: var(--charcoal-surface3);
17
19
  border-radius: 4px;
@@ -53,7 +53,7 @@ const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(
53
53
  getCount = countCodePointsInString,
54
54
  ...props
55
55
  },
56
- forwardRef
56
+ forwardRef,
57
57
  ) {
58
58
  const inputRef = useRef<HTMLInputElement>(null)
59
59
 
@@ -71,7 +71,7 @@ const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(
71
71
  setCount(count)
72
72
  onChange?.(value)
73
73
  },
74
- [getCount, maxLength, onChange]
74
+ [getCount, maxLength, onChange],
75
75
  )
76
76
 
77
77
  useEffect(() => {
@@ -142,7 +142,7 @@ const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(
142
142
  )}
143
143
  </div>
144
144
  )
145
- }
145
+ },
146
146
  )
147
147
 
148
148
  export default TextField
@@ -27,7 +27,7 @@ describe('TextField component', () => {
27
27
  const { container } = render(<TextField prefix={prefixValue} />)
28
28
  const prefixElement = container.querySelector('.charcoal-text-prefix')
29
29
  expect(prefixElement).toBeNull()
30
- }
30
+ },
31
31
  )
32
32
 
33
33
  test.each([
@@ -40,13 +40,13 @@ describe('TextField component', () => {
40
40
  'should not render suffix when value is falsy (%s: %s) and showCount is false',
41
41
  (suffixValue, _desc) => {
42
42
  const { container } = render(
43
- <TextField suffix={suffixValue} showCount={false} />
43
+ <TextField suffix={suffixValue} showCount={false} />,
44
44
  )
45
45
  const suffixElement = container.querySelector(
46
- '.charcoal-text-field-suffix'
46
+ '.charcoal-text-field-suffix',
47
47
  )
48
48
  expect(suffixElement).toBeNull()
49
- }
49
+ },
50
50
  )
51
51
 
52
52
  it('should render prefix and suffix when provided as truthy values', () => {
@@ -56,7 +56,7 @@ describe('TextField component', () => {
56
56
  <TextField
57
57
  prefix={<span>{prefixContent}</span>}
58
58
  suffix={<span>{suffixContent}</span>}
59
- />
59
+ />,
60
60
  )
61
61
 
62
62
  const prefixElement = container.querySelector('.charcoal-text-field-prefix')
@@ -3,7 +3,7 @@ import * as React from 'react'
3
3
 
4
4
  export function useFocusWithClick(
5
5
  containerRef: React.RefObject<HTMLDivElement | null>,
6
- inputRef: React.RefObject<HTMLInputElement | HTMLTextAreaElement | null>
6
+ inputRef: React.RefObject<HTMLInputElement | HTMLTextAreaElement | null>,
7
7
  ) {
8
8
  useEffect(() => {
9
9
  const el = containerRef.current
@@ -34,7 +34,7 @@ export const themeSetter =
34
34
  */
35
35
  export function themeSelector<
36
36
  T extends string,
37
- S extends string = typeof DEFAULT_ROOT_ATTRIBUTE
37
+ S extends string = typeof DEFAULT_ROOT_ATTRIBUTE,
38
38
  >(theme: T, attr?: S) {
39
39
  return `:root[data-${attr ?? DEFAULT_ROOT_ATTRIBUTE}='${theme}']` as const
40
40
  }
@@ -83,7 +83,7 @@ export const useTheme = (localStorageKey: string = LOCAL_STORAGE_KEY) => {
83
83
  const media = isDark !== undefined ? (isDark ? 'dark' : 'light') : undefined
84
84
  const [local, setTheme, ready] =
85
85
  useLocalStorage<typeof media>(localStorageKey)
86
- const theme = !ready || media === undefined ? undefined : local ?? media
86
+ const theme = !ready || media === undefined ? undefined : (local ?? media)
87
87
  const system = local === undefined
88
88
  return [theme, setTheme, system] as const
89
89
  }