draft-components 1.1.2 → 1.2.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.
@@ -1,15 +1,16 @@
1
1
  'use strict';
2
2
 
3
3
  const jsxRuntime = require('react/jsx-runtime');
4
+ const react = require('react');
4
5
  const reactHelpers = require('../../lib/react-helpers.cjs');
5
6
 
6
- function Tag({ isRounded = false, variant = 'tinted', fill = 'gray', size = 'md', className, children, ...props }) {
7
- return (jsxRuntime.jsx("strong", { ...props, className: reactHelpers.classNames(className, 'dc-tag', {
7
+ const Tag = react.forwardRef(function Tag({ isRounded = false, variant = 'tinted', fill = 'gray', size = 'md', className, children, ...props }, ref) {
8
+ return (jsxRuntime.jsx("strong", { ...props, ref: ref, className: reactHelpers.classNames(className, 'dc-tag', {
8
9
  [`dc-tag_${variant}`]: variant,
9
10
  [`dc-tag_${fill}`]: fill,
10
11
  [`dc-tag_${size}`]: size,
11
12
  'dc-tag_rounded': isRounded,
12
13
  }), children: children }));
13
- }
14
+ });
14
15
 
15
16
  exports.Tag = Tag;
@@ -1,13 +1,14 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
+ import { forwardRef } from 'react';
2
3
  import { classNames } from '../../lib/react-helpers.js';
3
4
 
4
- function Tag({ isRounded = false, variant = 'tinted', fill = 'gray', size = 'md', className, children, ...props }) {
5
- return (jsx("strong", { ...props, className: classNames(className, 'dc-tag', {
5
+ const Tag = forwardRef(function Tag({ isRounded = false, variant = 'tinted', fill = 'gray', size = 'md', className, children, ...props }, ref) {
6
+ return (jsx("strong", { ...props, ref: ref, className: classNames(className, 'dc-tag', {
6
7
  [`dc-tag_${variant}`]: variant,
7
8
  [`dc-tag_${fill}`]: fill,
8
9
  [`dc-tag_${size}`]: size,
9
10
  'dc-tag_rounded': isRounded,
10
11
  }), children: children }));
11
- }
12
+ });
12
13
 
13
14
  export { Tag };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "draft-components",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "The React based UI components library.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -9,5 +9,10 @@ export type TagProps = {
9
9
  fill?: TagFill;
10
10
  size?: TagSize;
11
11
  } & TagBaseProps;
12
- export declare function Tag({ isRounded, variant, fill, size, className, children, ...props }: TagProps): JSX.Element;
12
+ export declare const Tag: import("react").ForwardRefExoticComponent<{
13
+ isRounded?: boolean | undefined;
14
+ variant?: TagVariant | undefined;
15
+ fill?: TagFill | undefined;
16
+ size?: TagSize | undefined;
17
+ } & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & import("react").RefAttributes<HTMLElement>>;
13
18
  export {};