@pushwoosh/dumb-components 1.0.24 → 1.0.26

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.
@@ -1,7 +1,5 @@
1
- import React, { useRef, useState, useEffect } from 'react';
1
+ import React, { useRef, useEffect } from 'react';
2
2
  import { NativeLabel, NativeCheckbox } from './styles';
3
- // eslint-disable-next-line prefer-const
4
- let counter = 0;
5
3
  export function Checkbox(props) {
6
4
  const {
7
5
  label,
@@ -16,13 +14,6 @@ export function Checkbox(props) {
16
14
  onChange,
17
15
  className
18
16
  } = props;
19
- const [localId] = useState(() => {
20
- if (id) {
21
- return id;
22
- }
23
- const newCounter = counter + 1;
24
- return `checkbox-${newCounter}`;
25
- });
26
17
  const checkboxRef = useRef(null);
27
18
  useEffect(() => {
28
19
  if (checkboxRef.current) {
@@ -30,12 +21,12 @@ export function Checkbox(props) {
30
21
  }
31
22
  }, [checkboxRef, isIndeterminate]);
32
23
  return React.createElement(NativeLabel, {
33
- htmlFor: localId,
24
+ htmlFor: id,
34
25
  "$color": color,
35
26
  className: className
36
27
  }, React.createElement(NativeCheckbox, {
37
28
  type: "checkbox",
38
- id: localId,
29
+ id: id,
39
30
  ref: checkboxRef,
40
31
  value: value,
41
32
  color: activeCheckboxColor,
@@ -9,6 +9,7 @@ export type DropdownMenuButtonProps = {
9
9
  color: RequiredButtonProps['color'];
10
10
  size?: RequiredButtonProps['size'];
11
11
  view?: RequiredButtonProps['view'];
12
+ className?: string;
12
13
  icon?: RequiredButtonProps['icon'];
13
14
  rightIcon?: RequiredButtonProps['rightIcon'];
14
15
  children: (() => ReactNode) | ReactNode;
@@ -11,7 +11,8 @@ export function Tabs(props) {
11
11
  activeTabCode,
12
12
  setActiveTabCode
13
13
  }), [activeTabCode, setActiveTabCode]);
14
+ const Container = props.container || TabsContainer;
14
15
  return React.createElement(TabContext.Provider, {
15
16
  value: contextValue
16
- }, React.createElement(TabsContainer, null, children));
17
+ }, React.createElement(Container, null, children));
17
18
  }
@@ -1,6 +1,7 @@
1
- import type { PropsWithChildren } from 'react';
1
+ import type { ElementType, PropsWithChildren } from 'react';
2
2
  import { type TabCode } from '../../types';
3
3
  export type TabsProps = PropsWithChildren<Readonly<{
4
4
  activeCode: TabCode;
5
5
  onChange: (code: TabCode) => void;
6
+ container?: ElementType;
6
7
  }>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "1.0.24",
3
+ "version": "1.0.26",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",