@dnanpm/ui-components 0.0.4 → 0.0.5

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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # DNA UI Components
2
2
 
3
- [![npm version](https://badge.fury.io/js/%40dnanpm%2Fui-components.svg)](https://badge.fury.io/js/%40dnanpm%2Fui-components)
3
+ [![npm version](https://img.shields.io/npm/v/%40dnanpm%2Fui-components?logo=npm)](https://www.npmjs.com/package/@dnanpm/ui-components)
4
4
 
5
5
  > ⚠️ **Under Heavy Development** — This package is actively being developed. Breaking changes may occur between minor versions during the 0.x release cycle.
6
6
 
@@ -12,6 +12,7 @@ React component library for the DNA Design System. Built with TypeScript, CSS Mo
12
12
  ## Features
13
13
 
14
14
  - Accessible, responsive, and customizable components
15
+ - Canonical DNA component APIs with swappable internal implementations
15
16
  - Built with TypeScript and CSS Modules
16
17
  - Themed with design tokens from `@dnanpm/design-tokens`
17
18
  - Supports server-side rendering and tree-shaking
@@ -28,7 +29,7 @@ pnpm add @dnanpm/ui-components @dnanpm/design-tokens
28
29
  ## Usage
29
30
 
30
31
  ```tsx
31
- import { Button, Box } from '@dnanpm/ui-components';
32
+ import { Box, Button, Dialog, Tooltip } from '@dnanpm/ui-components';
32
33
  import '@dnanpm/ui-components/styles.css';
33
34
 
34
35
  function App() {
@@ -43,11 +44,38 @@ function App() {
43
44
  <Box elevation="high">
44
45
  <h2>Elevated Content</h2>
45
46
  </Box>
47
+
48
+ <Tooltip content="Additional context lives behind the same DNA API.">
49
+ <Button aria-label="Show more information" variant="secondary">
50
+ Hover me
51
+ </Button>
52
+ </Tooltip>
53
+
54
+ <Dialog
55
+ trigger={<Button>Open dialog</Button>}
56
+ title="Project details"
57
+ description="Implementation stays internal to the design system."
58
+ footer={<Button>Done</Button>}
59
+ >
60
+ <p>
61
+ Consumers use the same component contract regardless of what powers it
62
+ underneath.
63
+ </p>
64
+ </Dialog>
46
65
  </div>
47
66
  );
48
67
  }
49
68
  ```
50
69
 
70
+ ## Implementation Model
71
+
72
+ This package now supports two contributor paths under one public API surface:
73
+
74
+ - `Plain React` components, written entirely in-house.
75
+ - `Base UI` components, where the public DNA API is built on top of a headless library primitive directly in the component file.
76
+
77
+ Consumers should not need to know which path a component uses. Public names, props, and behavior belong to DNA; implementation choices stay internal.
78
+
51
79
  Design tokens are available as CSS custom properties: `var(--colors-primitive-pink-500)`, `var(--spacing-ui-md)`, etc.
52
80
 
53
81
  ### Tree-shaking
@@ -1,24 +1,2 @@
1
- /**
2
- * Box Component
3
- *
4
- * A versatile container component with elevation (shadow) variants.
5
- * Can be rendered as any HTML element using the polymorphic `as` prop.
6
- *
7
- * Features:
8
- * - Polymorphic: Render as any element (div, section, article, etc.)
9
- * - Elevation: Four shadow depth levels (none, low, high, extraHigh)
10
- * - Ref forwarding supported
11
- * - Uses design tokens for consistent shadows
12
- *
13
- * @example
14
- * // Basic box with no elevation
15
- * <Box>Content</Box>
16
- *
17
- * // Box with elevation
18
- * <Box elevation="high">Elevated content</Box>
19
- *
20
- * // Box as section element
21
- * <Box as="section" elevation="low">Section content</Box>
22
- */
23
1
  export declare const Box: import('react').ForwardRefExoticComponent<import('./Box.types').BaseBoxProps & import('react').HTMLAttributes<HTMLElement> & import('react').RefAttributes<HTMLElement>>;
24
2
  //# sourceMappingURL=Box.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../../src/components/Box/Box.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAOH,eAAO,MAAM,GAAG,0KAUf,CAAC"}
1
+ {"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../../src/components/Box/Box.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,GAAG,0KAUf,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,eAAO,MAAM,MAAM,+HAoDlB,CAAC"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,eAAO,MAAM,MAAM,+HAoDlB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { DialogProps } from './Dialog.types';
2
+ export declare const Dialog: import('react').ForwardRefExoticComponent<DialogProps & import('react').RefAttributes<HTMLDivElement>>;
3
+ //# sourceMappingURL=Dialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,eAAO,MAAM,MAAM,wGAsDjB,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { DialogPortalProps, DialogRootProps } from '@base-ui/react/dialog';
2
+ import * as React from 'react';
3
+ export type DialogSize = 'sm' | 'md' | 'lg';
4
+ export interface DialogProps extends Omit<DialogRootProps, 'children' | 'disablePointerDismissal'>, Pick<DialogPortalProps, 'keepMounted'> {
5
+ /**
6
+ * Optional trigger element composed without changing its public API.
7
+ */
8
+ readonly trigger?: React.ReactElement;
9
+ /**
10
+ * Dialog title announced by assistive technology.
11
+ */
12
+ readonly title: React.ReactNode;
13
+ /**
14
+ * Optional supporting copy below the title.
15
+ */
16
+ readonly description?: React.ReactNode;
17
+ /**
18
+ * Main dialog content.
19
+ */
20
+ readonly children?: React.ReactNode;
21
+ /**
22
+ * Optional footer actions.
23
+ */
24
+ readonly footer?: React.ReactNode;
25
+ /**
26
+ * Whether clicking the backdrop should close the dialog.
27
+ * @default true
28
+ */
29
+ readonly closeOnOutsideClick?: boolean;
30
+ /**
31
+ * Accessible label for the close button.
32
+ * @default 'Close dialog'
33
+ */
34
+ readonly closeLabel?: string;
35
+ /**
36
+ * Width preset for the popup.
37
+ * @default 'md'
38
+ */
39
+ readonly size?: DialogSize;
40
+ /**
41
+ * Optional popup className.
42
+ */
43
+ readonly className?: string;
44
+ }
45
+ //# sourceMappingURL=Dialog.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dialog.types.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAEhF,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,MAAM,WAAW,WACb,SACI,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,yBAAyB,CAAC,EAC7D,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC;IAC1C;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IACtC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC;;OAEG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvC;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACpC;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IACvC;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC/B"}
@@ -0,0 +1,3 @@
1
+ export { Dialog } from './Dialog';
2
+ export type { DialogProps, DialogSize } from './Dialog.types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { TooltipProps } from './Tooltip.types';
2
+ export declare const Tooltip: import('react').ForwardRefExoticComponent<TooltipProps & import('react').RefAttributes<HTMLDivElement>>;
3
+ //# sourceMappingURL=Tooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,eAAO,MAAM,OAAO,yGAqClB,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { TooltipPortalProps, TooltipPositionerProps, TooltipRootProps, TooltipTriggerProps } from '@base-ui/react/tooltip';
2
+ import * as React from 'react';
3
+ export type TooltipSide = 'top' | 'right' | 'bottom' | 'left';
4
+ export type TooltipAlign = 'start' | 'center' | 'end';
5
+ export interface TooltipProps extends Omit<TooltipRootProps, 'children'>, Pick<TooltipTriggerProps, 'delay' | 'closeDelay'>, Pick<TooltipPortalProps, 'keepMounted'>, Pick<TooltipPositionerProps, 'side' | 'align' | 'sideOffset'> {
6
+ /**
7
+ * Visual tooltip content rendered in the popup.
8
+ */
9
+ readonly content: React.ReactNode;
10
+ /**
11
+ * Trigger element composed without changing its public API.
12
+ */
13
+ readonly children: React.ReactElement;
14
+ /**
15
+ * Preferred tooltip side.
16
+ * @default 'top'
17
+ */
18
+ readonly side?: TooltipSide;
19
+ /**
20
+ * Popup alignment relative to the trigger.
21
+ * @default 'center'
22
+ */
23
+ readonly align?: TooltipAlign;
24
+ /**
25
+ * Space between trigger and popup.
26
+ * @default 8
27
+ */
28
+ readonly sideOffset?: number;
29
+ /**
30
+ * Whether to render the arrow.
31
+ * @default true
32
+ */
33
+ readonly showArrow?: boolean;
34
+ /**
35
+ * Optional popup className.
36
+ */
37
+ readonly className?: string;
38
+ }
39
+ //# sourceMappingURL=Tooltip.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tooltip.types.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EACR,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACtB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAC9D,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEtD,MAAM,WAAW,YACb,SACI,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,EAClC,IAAI,CAAC,mBAAmB,EAAE,OAAO,GAAG,YAAY,CAAC,EACjD,IAAI,CAAC,kBAAkB,EAAE,aAAa,CAAC,EACvC,IAAI,CAAC,sBAAsB,EAAE,MAAM,GAAG,OAAO,GAAG,YAAY,CAAC;IACjE;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC/B"}
@@ -0,0 +1,3 @@
1
+ export { Tooltip } from './Tooltip';
2
+ export type { TooltipAlign, TooltipProps, TooltipSide } from './Tooltip.types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,3 +1,5 @@
1
1
  export * from './Box';
2
2
  export * from './Button';
3
+ export * from './Dialog';
4
+ export * from './Tooltip';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC"}