draft-components 1.4.3 → 1.6.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.
@@ -6,7 +6,7 @@ const reactHelpers = require('../../lib/react-helpers.cjs');
6
6
  const useMountTransition = require('../../hooks/use-mount-transition.cjs');
7
7
  const positioner = require('../positioner/positioner.cjs');
8
8
 
9
- function Tooltip({ anchorGap = 8, placement = 'top', alignment = 'center', style, className, content, children, ...props }) {
9
+ function Tooltip({ anchorGap = 8, placement = 'top', alignment = 'center', style, className, htmlContent, content, children, ...props }) {
10
10
  const [defaultShow, setDefaultShow] = react.useState(props.defaultIsShown ?? false);
11
11
  const defaultId = react.useId();
12
12
  const tooltipId = props.id || defaultId;
@@ -66,7 +66,7 @@ function Tooltip({ anchorGap = 8, placement = 'top', alignment = 'center', style
66
66
  '--dc-tooltip-transition-duration': `${durationMs}ms`,
67
67
  ...portalStyle,
68
68
  ...style,
69
- }, className: reactHelpers.classNames('dc-tooltip', transitionClass, className), role: "tooltip", children: content }));
69
+ }, className: reactHelpers.classNames('dc-tooltip', transitionClass, className), content: htmlContent, role: "tooltip", children: content }));
70
70
  }
71
71
  };
72
72
  return (jsxRuntime.jsx(positioner.Positioner, { placement: placement, alignment: alignment, anchorGap: anchorGap, renderAnchor: renderAnchor, renderContent: renderContent }));
@@ -316,7 +316,7 @@
316
316
  --dc-control-on-primary-color: var(--dc-white);
317
317
  --dc-control-secondary-color: rgb(var(--dc-blue-500-rgb) / 0.15);
318
318
  --dc-control-border-color: var(--dc-gray-300);
319
- --dc-control-bg: rgb(var(--dc-gray-50-rgb) / 0.2);
319
+ --dc-control-bg: var(--dc-white);
320
320
  --dc-control-bg-inset: rgb(var(--dc-gray-900-rgb) / 0.15);
321
321
  --dc-control-error-color: var(--dc-red-500);
322
322
  --dc-focus-ring-color: rgb(var(--dc-blue-500-rgb) / 0.7);
@@ -2753,6 +2753,8 @@
2753
2753
 
2754
2754
  .dc-table-container {
2755
2755
  overflow-x: auto;
2756
+ scroll-behavior: smooth;
2757
+ scroll-snap-type: x mandatory;
2756
2758
  box-sizing: border-box;
2757
2759
  width: 100%;
2758
2760
  border: 0 solid var(--dc-table-border-color);
@@ -2797,6 +2799,7 @@
2797
2799
  }
2798
2800
 
2799
2801
  .dc-table-cell {
2802
+ scroll-snap-align: start;
2800
2803
  box-sizing: border-box;
2801
2804
  padding:
2802
2805
  var(--dc-table-cell-padding-y)
@@ -83,7 +83,7 @@
83
83
  --dc-control-on-primary-color: var(--dc-white);
84
84
  --dc-control-secondary-color: rgb(var(--dc-blue-400-rgb) / 0.15);
85
85
  --dc-control-border-color: var(--dc-gray-600);
86
- --dc-control-bg: rgb(var(--dc-gray-50-rgb) / 0.08);
86
+ --dc-control-bg: var(--dc-gray-800);
87
87
  --dc-control-bg-inset: rgb(var(--dc-gray-50-rgb) / 0.25);
88
88
  --dc-control-error-color: var(--dc-red-400);
89
89
  --dc-focus-ring-color: rgb(var(--dc-blue-400-rgb) / 0.7);
@@ -4,7 +4,7 @@ import { isReactElementWithRef, mergeRefs, classNames } from '../../lib/react-he
4
4
  import { useMountTransition } from '../../hooks/use-mount-transition.js';
5
5
  import { Positioner } from '../positioner/positioner.js';
6
6
 
7
- function Tooltip({ anchorGap = 8, placement = 'top', alignment = 'center', style, className, content, children, ...props }) {
7
+ function Tooltip({ anchorGap = 8, placement = 'top', alignment = 'center', style, className, htmlContent, content, children, ...props }) {
8
8
  const [defaultShow, setDefaultShow] = useState(props.defaultIsShown ?? false);
9
9
  const defaultId = useId();
10
10
  const tooltipId = props.id || defaultId;
@@ -64,7 +64,7 @@ function Tooltip({ anchorGap = 8, placement = 'top', alignment = 'center', style
64
64
  '--dc-tooltip-transition-duration': `${durationMs}ms`,
65
65
  ...portalStyle,
66
66
  ...style,
67
- }, className: classNames('dc-tooltip', transitionClass, className), role: "tooltip", children: content }));
67
+ }, className: classNames('dc-tooltip', transitionClass, className), content: htmlContent, role: "tooltip", children: content }));
68
68
  }
69
69
  };
70
70
  return (jsx(Positioner, { placement: placement, alignment: alignment, anchorGap: anchorGap, renderAnchor: renderAnchor, renderContent: renderContent }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "draft-components",
3
- "version": "1.4.3",
3
+ "version": "1.6.0",
4
4
  "description": "The React based UI components library.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -57,29 +57,29 @@
57
57
  },
58
58
  "devDependencies": {
59
59
  "@alexzimakov/eslint-config": "1.5.0",
60
- "@babel/core": "7.21.8",
61
- "@babel/preset-env": "7.21.5",
62
- "@babel/preset-react": "7.18.6",
63
- "@babel/preset-typescript": "7.21.5",
60
+ "@babel/core": "7.22.5",
61
+ "@babel/preset-env": "7.22.5",
62
+ "@babel/preset-react": "7.22.5",
63
+ "@babel/preset-typescript": "7.22.5",
64
64
  "@heroicons/react": "2.0.18",
65
65
  "@rollup/plugin-typescript": "11.1.1",
66
- "@storybook/addon-actions": "7.0.11",
67
- "@storybook/addon-essentials": "7.0.11",
68
- "@storybook/addon-links": "7.0.11",
69
- "@storybook/react": "7.0.11",
70
- "@storybook/react-vite": "7.0.11",
71
- "@testing-library/dom": "9.3.0",
66
+ "@storybook/addon-actions": "7.0.23",
67
+ "@storybook/addon-essentials": "7.0.23",
68
+ "@storybook/addon-links": "7.0.23",
69
+ "@storybook/react": "7.0.23",
70
+ "@storybook/react-vite": "7.0.23",
71
+ "@testing-library/dom": "9.3.1",
72
72
  "@testing-library/jest-dom": "5.16.5",
73
73
  "@testing-library/react": "14.0.0",
74
74
  "@testing-library/user-event": "14.4.3",
75
- "@types/jest": "29.5.1",
76
- "@types/node": "18.16.8",
77
- "@types/react": "18.2.6",
78
- "@types/react-dom": "18.2.4",
79
- "@typescript-eslint/eslint-plugin": "5.59.5",
80
- "@typescript-eslint/parser": "5.59.5",
75
+ "@types/jest": "29.5.2",
76
+ "@types/node": "18.16.18",
77
+ "@types/react": "18.2.13",
78
+ "@types/react-dom": "18.2.6",
79
+ "@typescript-eslint/eslint-plugin": "5.60.0",
80
+ "@typescript-eslint/parser": "5.60.0",
81
81
  "autoprefixer": "10.4.14",
82
- "eslint": "8.40.0",
82
+ "eslint": "8.43.0",
83
83
  "eslint-plugin-jsx-a11y": "6.7.1",
84
84
  "eslint-plugin-react": "7.32.2",
85
85
  "eslint-plugin-react-hooks": "4.6.0",
@@ -89,17 +89,17 @@
89
89
  "jest": "29.5.0",
90
90
  "jest-environment-jsdom": "29.5.0",
91
91
  "lint-staged": "13.2.2",
92
- "postcss": "8.4.23",
92
+ "postcss": "8.4.24",
93
93
  "postcss-import": "15.1.0",
94
94
  "react": "18.2.0",
95
95
  "react-dom": "18.2.0",
96
- "rollup": "3.21.6",
97
- "storybook": "7.0.11",
98
- "stylelint": "15.6.1",
96
+ "rollup": "3.25.1",
97
+ "storybook": "7.0.23",
98
+ "stylelint": "15.8.0",
99
99
  "stylelint-config-standard": "33.0.0",
100
100
  "stylelint-order": "6.0.3",
101
- "typescript": "4.9.5",
102
- "vite": "4.3.5"
101
+ "typescript": "5.1.3",
102
+ "vite": "4.3.9"
103
103
  },
104
104
  "lint-staged": {
105
105
  "*.ts?(x)": "npm run lint",
@@ -1,4 +1,4 @@
1
- import { type ComponentPropsWithRef, type ReactNode } from 'react';
1
+ import { type ComponentPropsWithRef, type JSX, type ReactNode } from 'react';
2
2
  type AlertHTMLProps = ComponentPropsWithRef<'div'>;
3
3
  export type AlertAppearance = 'default' | 'info' | 'success' | 'warning' | 'error';
4
4
  export type AlertVariant = 'default' | 'full-width' | 'accent-border';
@@ -1,4 +1,4 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
1
+ import { type ComponentPropsWithoutRef, type JSX } from 'react';
2
2
  type AvatarGroupBaseProps = Omit<ComponentPropsWithoutRef<'div'>, 'children'>;
3
3
  export type AvatarGroupProps = AvatarGroupBaseProps & {
4
4
  children: JSX.Element | JSX.Element[];
@@ -1,4 +1,4 @@
1
- import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
1
+ import { type ComponentPropsWithoutRef, type JSX, type ReactNode } from 'react';
2
2
  type BreadcrumbsItemHTMLProps = ComponentPropsWithoutRef<'a'>;
3
3
  export type BreadcrumbsItemRenderFn = (props: {
4
4
  className: string;
@@ -1,4 +1,4 @@
1
- import { type ComponentPropsWithRef, type ReactNode } from 'react';
1
+ import { type ComponentPropsWithRef, type JSX, type ReactNode } from 'react';
2
2
  export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
3
3
  export type ButtonAppearance = 'default' | 'primary' | 'danger' | 'success';
4
4
  export type ButtonVariant = 'filled' | 'tinted' | 'plain';
@@ -1,4 +1,4 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
1
+ import { type ComponentPropsWithoutRef, type JSX } from 'react';
2
2
  type ButtonGroupBaseProps = Omit<ComponentPropsWithoutRef<'div'>, 'children'>;
3
3
  export type ButtonGroupProps = ButtonGroupBaseProps & {
4
4
  children: JSX.Element | JSX.Element[];
@@ -1,5 +1,5 @@
1
1
  import { type DateISO } from '../date-picker/date-helpers';
2
- import { type ReactNode } from 'react';
2
+ import { type JSX, type ReactNode } from 'react';
3
3
  import { type DatePickerProps } from '../date-picker';
4
4
  export type DatePickerChangeValueFn = (value: DateISO) => void;
5
5
  export type DatePickerPopoverProps = {
@@ -1,5 +1,5 @@
1
1
  import { type DateRangePickerPopoverOption, type DateRangePickerPopoverSelection } from './types';
2
- import { type ReactNode } from 'react';
2
+ import { type JSX, type ReactNode } from 'react';
3
3
  import { type PopoverAlignment, type PopoverPlacement } from '../popover';
4
4
  import { type DateRangePickerProps } from '../date-picker';
5
5
  export type DateRangePickerPopoverPlacement = PopoverPlacement;
@@ -1,4 +1,4 @@
1
- import { type ComponentPropsWithoutRef, type KeyboardEventHandler, type MouseEventHandler, type ReactNode, type RefCallback } from 'react';
1
+ import { type ComponentPropsWithoutRef, type JSX, type KeyboardEventHandler, type MouseEventHandler, type ReactNode, type RefCallback } from 'react';
2
2
  import { type ButtonAppearance, type ButtonVariant } from '../button';
3
3
  import { type PopoverAlignment, type PopoverPlacement } from '../popover';
4
4
  export type MenuButtonRenderFn = (props: {
@@ -1,4 +1,4 @@
1
- import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
1
+ import { type ComponentPropsWithoutRef, type JSX, type ReactNode } from 'react';
2
2
  type NavListItemHTMLProps = ComponentPropsWithoutRef<'a'>;
3
3
  export type NavListItemRenderFn = (props: {
4
4
  className: string;
@@ -1,4 +1,4 @@
1
- import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
1
+ import { type ComponentPropsWithoutRef, type JSX, type ReactNode } from 'react';
2
2
  export type SelectionControlRenderFn = (props: {
3
3
  id: string;
4
4
  }) => JSX.Element;
@@ -9,10 +9,11 @@ type TooltipChildrenRenderFn = (props: {
9
9
  showTooltip: () => void;
10
10
  }) => ReactNode;
11
11
  type TooltipHTMLProps = ComponentPropsWithoutRef<'div'>;
12
- type TooltipBaseProps = Omit<TooltipHTMLProps, 'children'>;
12
+ type TooltipBaseProps = Omit<TooltipHTMLProps, 'children' | 'content'>;
13
13
  export type TooltipPlacement = PositionerProps['placement'];
14
14
  export type TooltipAlignment = PositionerProps['alignment'];
15
15
  export type TooltipProps = {
16
+ htmlContent?: TooltipHTMLProps['content'];
16
17
  anchorGap?: number;
17
18
  placement?: TooltipPlacement;
18
19
  alignment?: TooltipAlignment;
@@ -21,5 +22,5 @@ export type TooltipProps = {
21
22
  content: ReactNode;
22
23
  children: ReactNode | TooltipChildrenRenderFn;
23
24
  } & TooltipBaseProps;
24
- export declare function Tooltip({ anchorGap, placement, alignment, style, className, content, children, ...props }: TooltipProps): import("react/jsx-runtime").JSX.Element;
25
+ export declare function Tooltip({ anchorGap, placement, alignment, style, className, htmlContent, content, children, ...props }: TooltipProps): import("react/jsx-runtime").JSX.Element;
25
26
  export {};