neatkit 0.2.0 → 0.3.1

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 (46) hide show
  1. package/LICENSE.md +373 -674
  2. package/README.md +9 -34
  3. package/dist/components/Alert/Alert.d.ts +2 -2
  4. package/dist/components/Avatar/Avatar.d.ts +1 -1
  5. package/dist/components/Badge/Badge.d.ts +2 -2
  6. package/dist/components/Button/Button.d.ts +3 -3
  7. package/dist/components/Card/Card.d.ts +1 -1
  8. package/dist/components/Checkbox/Checkbox.d.ts +1 -1
  9. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
  10. package/dist/components/CheckboxGroup/contexts/CheckboxGroupContext.d.ts +1 -1
  11. package/dist/components/CheckboxGroup/hooks/useCheckboxGroup.d.ts +1 -1
  12. package/dist/components/Content/Content.d.ts +2 -2
  13. package/dist/components/Content/hooks/useContentLayout.d.ts +1 -1
  14. package/dist/components/Divider/Divider.d.ts +1 -1
  15. package/dist/components/Field/Field.d.ts +1 -1
  16. package/dist/components/Icon/Icon.d.ts +2 -2
  17. package/dist/components/Input/Input.d.ts +1 -1
  18. package/dist/components/Modal/Modal.d.ts +1 -1
  19. package/dist/components/PinInput/PinInput.d.ts +1 -1
  20. package/dist/components/PinInput/hooks/usePinInput.d.ts +1 -1
  21. package/dist/components/Popover/Popover.d.ts +1 -1
  22. package/dist/components/Portal/Portal.d.ts +2 -2
  23. package/dist/components/Portal/hooks/useDismissableLayer.d.ts +1 -1
  24. package/dist/components/Portal/hooks/useFloatingPosition.d.ts +1 -1
  25. package/dist/components/Portal/hooks/useFocusTrap.d.ts +1 -1
  26. package/dist/components/Radio/Radio.d.ts +1 -1
  27. package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
  28. package/dist/components/RadioGroup/contexts/RadioGroupContext.d.ts +1 -1
  29. package/dist/components/RadioGroup/hooks/useRadioGroup.d.ts +1 -1
  30. package/dist/components/Select/Select.d.ts +2 -2
  31. package/dist/components/Skeleton/Skeleton.d.ts +1 -1
  32. package/dist/components/Spinner/Spinner.d.ts +1 -1
  33. package/dist/components/Surface/Surface.d.ts +1 -1
  34. package/dist/components/Switch/Switch.d.ts +1 -1
  35. package/dist/components/Text/Text.d.ts +2 -2
  36. package/dist/components/TextArea/TextArea.d.ts +1 -1
  37. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  38. package/dist/components/Tooltip/TooltipProvider.d.ts +1 -1
  39. package/dist/index.cjs +1 -1
  40. package/dist/index.d.ts +2 -0
  41. package/dist/index.js +937 -887
  42. package/dist/style.css +1 -1
  43. package/dist/tokens.d.ts +85 -0
  44. package/dist/utils/{react-reference.d.ts → reference.d.ts} +1 -1
  45. package/dist/utils/units.d.ts +33 -0
  46. package/package.json +3 -2
package/README.md CHANGED
@@ -2,8 +2,9 @@
2
2
  <!-- The media queries determine the image based on website theme -->
3
3
  <source media="(prefers-color-scheme: dark)" srcset=".assets/banner/dark-mode.png">
4
4
  <source media="(prefers-color-scheme: light)" srcset=".assets/banner/light-mode.png">
5
- <!-- Fallback to light mode variant if no match -->
6
- <img src=".assets/banner/light-mode.png">
5
+ <!-- Fallback to light mode variant if no match. The `alt` attribute is
6
+ intentionally set to a space to prevent rendering if the image is missing -->
7
+ <img alt=" " src=".assets/banner/light-mode.png">
7
8
  </picture>
8
9
 
9
10
  ######
@@ -11,34 +12,8 @@
11
12
  An opinionated React UI library for modern web applications, combining
12
13
  accessible components, a cohesive design system, light and dark themes, accent
13
14
  customization, design tokens, SSR support, strong TypeScript support, and
14
- comprehensive documentation. To browse the component library, click
15
- [here](https://neatkit.org).
16
-
17
- ### Getting Started
18
-
19
- Install Neatkit with your package manager:
20
-
21
- ```sh
22
- npm install neatkit
23
- ```
24
-
25
- Import the stylesheet once in your app, then use components wherever you need
26
- them:
27
-
28
- ```tsx
29
- import "neatkit/style.css";
30
- import { Button, Content } from "neatkit";
31
-
32
- export function App() {
33
- return (
34
- <Content as="main" fill="viewport">
35
- <Button shape="rectangle" variant="primary">
36
- Get started
37
- </Button>
38
- </Content>
39
- );
40
- }
41
- ```
15
+ comprehensive documentation. To browse the component library and its
16
+ documentation, click [here](https://neatkit.org).
42
17
 
43
18
  ### Contributing
44
19
 
@@ -51,9 +26,9 @@ To get started, see `CONTRIBUTING.md`.
51
26
 
52
27
  ### License
53
28
 
54
- This project is licensed under the GPL-3.0 License, reflecting a commitment to
55
- keeping this software free and open-source. The GPL-3.0 promotes freedom,
56
- transparency, and collaboration, allowing users to freely use, modify, and
57
- distribute the software while ensuring it remains community-driven.
29
+ This project is licensed under the Mozilla Public License 2.0 (MPL-2.0),
30
+ supporting open-source collaboration while allowing use in both open-source
31
+ and proprietary projects. Modifications to MPL-covered files must remain
32
+ available under the same license when distributed.
58
33
 
59
34
  For more details, see `LICENSE.md`.
@@ -1,7 +1,7 @@
1
- import type { HTMLAttributes, ReactNode } from "react";
1
+ import { type HTMLAttributes, type ReactNode } from "react";
2
2
  import "./styles/alert.css";
3
3
  /** A type representing the semantic color treatment applied to an Alert. */
4
- export type AlertTone = "danger" | "info" | "success" | "warning";
4
+ export type AlertTone = "info" | "success" | "warning" | "danger";
5
5
  /** A type representing properties for the Alert component. */
6
6
  export type AlertProps = HTMLAttributes<HTMLDivElement> & {
7
7
  /** The contextual feedback displayed inside the Alert. */
@@ -1,4 +1,4 @@
1
- import type { HTMLAttributes } from "react";
1
+ import { type HTMLAttributes } from "react";
2
2
  import "./styles/avatar.css";
3
3
  /** A type representing properties for the Avatar component. */
4
4
  export type AvatarProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
@@ -1,9 +1,9 @@
1
- import type { HTMLAttributes, ReactNode } from "react";
1
+ import { type HTMLAttributes, type ReactNode } from "react";
2
2
  import "./styles/badge.css";
3
3
  /** A type representing the visual emphasis applied to a Badge. */
4
4
  export type BadgeVariant = "outline" | "soft" | "solid";
5
5
  /** A type representing the semantic color treatment applied to a Badge. */
6
- export type BadgeTone = "neutral" | "success" | "warning" | "danger";
6
+ export type BadgeTone = "neutral" | "info" | "success" | "warning" | "danger";
7
7
  /** A type representing properties for the Badge component. */
8
8
  export type BadgeProps = HTMLAttributes<HTMLSpanElement> & {
9
9
  /** The label content displayed within the Badge. */
@@ -1,10 +1,10 @@
1
- import type { ComponentPropsWithRef, ComponentPropsWithoutRef, ElementType, ReactElement, ReactNode } from "react";
2
- import type { IconType } from "../Icon";
1
+ import { type ComponentPropsWithRef, type ComponentPropsWithoutRef, type ElementType, type ReactElement, type ReactNode } from "react";
2
+ import { type IconType } from "../Icon";
3
3
  import "./styles/button.css";
4
4
  /** A type representing the visual treatment of a Button. */
5
5
  export type ButtonVariant = "primary" | "secondary" | "ghost";
6
6
  /** A type representing the semantic intent applied to a Button. */
7
- export type ButtonTone = "danger" | "success" | "warning";
7
+ export type ButtonTone = "info" | "success" | "warning" | "danger";
8
8
  /** A type representing the outline shape of a Button. */
9
9
  export type ButtonShape = "rectangle" | "capsule";
10
10
  /** A type representing the placement of a Button icon. */
@@ -1,4 +1,4 @@
1
- import type { HTMLAttributes, ReactNode } from "react";
1
+ import { type HTMLAttributes, type ReactNode } from "react";
2
2
  import "./styles/card.css";
3
3
  /** A type representing the optional labels displayed in a Card header. */
4
4
  export type CardHeader = {
@@ -1,4 +1,4 @@
1
- import type { CSSProperties, InputHTMLAttributes, ReactNode } from "react";
1
+ import { type CSSProperties, type InputHTMLAttributes, type ReactNode } from "react";
2
2
  import "./styles/checkbox.css";
3
3
  /** A type representing properties for the Checkbox component. */
4
4
  export type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, "children" | "className" | "style" | "type"> & {
@@ -1,4 +1,4 @@
1
- import type { ChangeEventHandler, HTMLAttributes, ReactNode } from "react";
1
+ import { type ChangeEventHandler, type HTMLAttributes, type ReactNode } from "react";
2
2
  import "./styles/checkbox-group.css";
3
3
  /** A type representing the visual direction of Checkbox options. */
4
4
  export type CheckboxGroupOrientation = "horizontal" | "vertical";
@@ -1,4 +1,4 @@
1
- import type { ChangeEvent } from "react";
1
+ import { type ChangeEvent } from "react";
2
2
  /** A type representing state shared by CheckboxGroup with each Checkbox. */
3
3
  export type CheckboxGroupContextValue = {
4
4
  /** The initial selected values for an uncontrolled group. */
@@ -1,4 +1,4 @@
1
- import type { CheckboxGroupContextValue } from "../contexts/CheckboxGroupContext";
1
+ import { type CheckboxGroupContextValue } from "../contexts/CheckboxGroupContext";
2
2
  /**
3
3
  * Returns the optional CheckboxGroup state surrounding a Checkbox.
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { ComponentPropsWithRef, ComponentPropsWithoutRef, CSSProperties, ElementType, ReactElement } from "react";
1
+ import { type ComponentPropsWithRef, type ComponentPropsWithoutRef, type CSSProperties, type ElementType, type ReactElement } from "react";
2
2
  import "./styles/content.css";
3
3
  /** A type representing the explicit themes supported by Content. */
4
4
  export type ContentTheme = "light" | "dark";
@@ -47,7 +47,7 @@ type ContentComponent = <Component extends ElementType = "div">(props: ContentPr
47
47
  ref?: ContentReference<Component>;
48
48
  }) => ReactElement | null;
49
49
  /**
50
- * Renders a scoped NeatKit design-system boundary.
50
+ * Renders a scoped Neatkit design-system boundary.
51
51
  *
52
52
  * @param props - The properties that configure Content and its root element.
53
53
  * @param forwardedReference - The reference assigned to the root element.
@@ -1,4 +1,4 @@
1
- import type { ForwardedRef, RefCallback } from "react";
1
+ import { type ForwardedRef, type RefCallback } from "react";
2
2
  /** A type representing Content's measured layout state. */
3
3
  type ContentLayout = {
4
4
  /** The callback ref assigned to the Content root. */
@@ -1,4 +1,4 @@
1
- import type { HTMLAttributes } from "react";
1
+ import { type HTMLAttributes } from "react";
2
2
  import "./styles/divider.css";
3
3
  /** A type representing the direction of a Divider. */
4
4
  export type DividerOrientation = "horizontal" | "vertical";
@@ -1,4 +1,4 @@
1
- import type { AriaAttributes, HTMLAttributes, ReactElement, ReactNode } from "react";
1
+ import { type AriaAttributes, type HTMLAttributes, type ReactElement, type ReactNode } from "react";
2
2
  import "./styles/field.css";
3
3
  /** A type representing the label placement used by a Field. */
4
4
  export type FieldOrientation = "horizontal" | "vertical";
@@ -1,5 +1,5 @@
1
- import type { SVGProps } from "react";
2
- import type { IconType } from "./utils/registry";
1
+ import { type SVGProps } from "react";
2
+ import { type IconType } from "./utils/registry";
3
3
  /** A type representing properties for the Icon component. */
4
4
  export type IconProps = Omit<SVGProps<SVGSVGElement>, "children" | "color" | "height" | "width"> & {
5
5
  /** The icon graphic rendered by the component. */
@@ -1,4 +1,4 @@
1
- import type { CSSProperties, InputHTMLAttributes, ReactNode } from "react";
1
+ import { type CSSProperties, type InputHTMLAttributes, type ReactNode } from "react";
2
2
  import "./styles/input.css";
3
3
  /** A type representing the supported native single-line input types. */
4
4
  export type InputType = "email" | "number" | "password" | "search" | "tel" | "text" | "url";
@@ -1,4 +1,4 @@
1
- import type { HTMLAttributes, ReactNode, RefObject } from "react";
1
+ import { type HTMLAttributes, type ReactNode, type RefObject } from "react";
2
2
  import "./styles/modal.css";
3
3
  /** A type representing an interaction that requests Modal closure. */
4
4
  export type ModalCloseReason = "close-button" | "escape" | "outside";
@@ -1,4 +1,4 @@
1
- import type { CSSProperties, InputHTMLAttributes } from "react";
1
+ import { type CSSProperties, type InputHTMLAttributes } from "react";
2
2
  import "./styles/pin-input.css";
3
3
  /** A type representing the characters accepted by PinInput. */
4
4
  export type PinInputMode = "alphanumeric" | "numeric";
@@ -1,4 +1,4 @@
1
- import type { ChangeEvent, ClipboardEvent, FocusEvent, ForwardedRef, KeyboardEvent, PointerEvent, SyntheticEvent } from "react";
1
+ import { type ChangeEvent, type ClipboardEvent, type FocusEvent, type ForwardedRef, type KeyboardEvent, type PointerEvent, type SyntheticEvent } from "react";
2
2
  import type { PinInputMode } from "../PinInput";
3
3
  /** A type representing the options used by PinInput behavior. */
4
4
  type UsePinInputOptions = {
@@ -1,4 +1,4 @@
1
- import type { HTMLAttributes, ReactElement, ReactNode, RefObject } from "react";
1
+ import { type HTMLAttributes, type ReactElement, type ReactNode, type RefObject } from "react";
2
2
  import type { FloatingPlacement } from "../Portal/utils/floating-position";
3
3
  import "./styles/popover.css";
4
4
  /** A type representing the preferred placement of a Popover. */
@@ -1,11 +1,11 @@
1
- import type { ReactNode } from "react";
1
+ import { type ReactNode } from "react";
2
2
  /** A type representing properties accepted by an internal Portal. */
3
3
  type PortalProps = {
4
4
  /** The content rendered outside its React layout parent. */
5
5
  children: ReactNode;
6
6
  /** The optional element receiving the portal content. */
7
7
  container?: Element | null;
8
- /** The optional element whose inherited NeatKit variables are preserved. */
8
+ /** The optional element whose inherited Neatkit variables are preserved. */
9
9
  inheritFrom?: HTMLElement | null;
10
10
  };
11
11
  /**
@@ -1,4 +1,4 @@
1
- import type { RefObject } from "react";
1
+ import { type RefObject } from "react";
2
2
  /** A type representing options accepted by a dismissable overlay layer. */
3
3
  type DismissableLayerOptions = {
4
4
  /** Whether the layer currently receives dismissal interactions. */
@@ -1,4 +1,4 @@
1
- import type { FloatingPlacement, FloatingPosition } from "../utils/floating-position";
1
+ import { type FloatingPlacement, type FloatingPosition } from "../utils/floating-position";
2
2
  /**
3
3
  * Keeps anchored floating content aligned and inside its viewport.
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { RefObject } from "react";
1
+ import { type RefObject } from "react";
2
2
  import type { FocusScopeContextValue } from "../contexts/FocusScopeContext";
3
3
  /** A type representing options accepted by the focus trap hook. */
4
4
  type FocusTrapOptions = {
@@ -1,4 +1,4 @@
1
- import type { CSSProperties, InputHTMLAttributes, ReactNode } from "react";
1
+ import { type CSSProperties, type InputHTMLAttributes, type ReactNode } from "react";
2
2
  import "./styles/radio.css";
3
3
  /** A type representing properties for the Radio component. */
4
4
  export type RadioProps = Omit<InputHTMLAttributes<HTMLInputElement>, "checked" | "children" | "className" | "defaultChecked" | "name" | "onChange" | "required" | "style" | "type" | "value"> & {
@@ -1,4 +1,4 @@
1
- import type { ChangeEventHandler, HTMLAttributes, ReactNode } from "react";
1
+ import { type ChangeEventHandler, type HTMLAttributes, type ReactNode } from "react";
2
2
  import "./styles/radio-group.css";
3
3
  /** A type representing the visual direction of Radio options. */
4
4
  export type RadioGroupOrientation = "horizontal" | "vertical";
@@ -1,4 +1,4 @@
1
- import type { ChangeEventHandler } from "react";
1
+ import { type ChangeEventHandler } from "react";
2
2
  /** A type representing state shared by RadioGroup with each Radio. */
3
3
  export type RadioGroupContextValue = {
4
4
  /** The initial selected value for an uncontrolled group. */
@@ -1,4 +1,4 @@
1
- import type { RadioGroupContextValue } from "../contexts/RadioGroupContext";
1
+ import { type RadioGroupContextValue } from "../contexts/RadioGroupContext";
2
2
  /**
3
3
  * Returns the RadioGroup state required by a Radio.
4
4
  *
@@ -1,5 +1,5 @@
1
- import type { ButtonHTMLAttributes, CSSProperties, ReactElement, ReactNode, RefAttributes, SelectHTMLAttributes } from "react";
2
- import type { IconType } from "../Icon";
1
+ import { type ButtonHTMLAttributes, type CSSProperties, type ReactElement, type ReactNode, type RefAttributes, type SelectHTMLAttributes } from "react";
2
+ import { type IconType } from "../Icon";
3
3
  import "./styles/select.css";
4
4
  /** A type representing one option in a custom Select. */
5
5
  export type SelectOption = {
@@ -1,4 +1,4 @@
1
- import type { HTMLAttributes } from "react";
1
+ import { type HTMLAttributes } from "react";
2
2
  import "./styles/skeleton.css";
3
3
  /** A type representing the silhouette drawn by Skeleton. */
4
4
  export type SkeletonShape = "rectangle" | "circle";
@@ -1,4 +1,4 @@
1
- import type { CSSProperties, HTMLAttributes } from "react";
1
+ import { type CSSProperties, type HTMLAttributes } from "react";
2
2
  import "./styles/spinner.css";
3
3
  /** A type representing properties for the Spinner component. */
4
4
  export type SpinnerProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
@@ -1,4 +1,4 @@
1
- import type { HTMLAttributes, ReactNode } from "react";
1
+ import { type HTMLAttributes, type ReactNode } from "react";
2
2
  import "./styles/surface.css";
3
3
  /**
4
4
  * Renders the shared visual foundation for bordered component surfaces.
@@ -1,4 +1,4 @@
1
- import type { CSSProperties, InputHTMLAttributes } from "react";
1
+ import { type CSSProperties, type InputHTMLAttributes } from "react";
2
2
  import "./styles/switch.css";
3
3
  /** A type representing properties for the Switch component. */
4
4
  export type SwitchProps = Omit<InputHTMLAttributes<HTMLInputElement>, "children" | "className" | "role" | "style" | "type"> & {
@@ -1,11 +1,11 @@
1
- import type { ComponentPropsWithRef, ComponentPropsWithoutRef, ElementType, ReactElement } from "react";
1
+ import { type ComponentPropsWithRef, type ComponentPropsWithoutRef, type ElementType, type ReactElement } from "react";
2
2
  import "./styles/text.css";
3
3
  /** A type representing the visual size applied to Text. */
4
4
  export type TextSize = "caption" | "body" | "subtitle" | "title" | "heading";
5
5
  /** A type representing the visual weight applied to Text. */
6
6
  export type TextWeight = "regular" | "medium" | "semibold";
7
7
  /** A type representing the semantic color treatment applied to Text. */
8
- export type TextTone = "default" | "muted" | "accent" | "success" | "warning" | "danger";
8
+ export type TextTone = "default" | "muted" | "accent" | "info" | "success" | "warning" | "danger";
9
9
  /** A type representing the horizontal alignment applied to Text. */
10
10
  export type TextAlignment = "left" | "center" | "right";
11
11
  /** A type representing the reference accepted by a polymorphic element. */
@@ -1,4 +1,4 @@
1
- import type { CSSProperties, TextareaHTMLAttributes } from "react";
1
+ import { type CSSProperties, type TextareaHTMLAttributes } from "react";
2
2
  import "./styles/text-area.css";
3
3
  /** A type representing the resize behavior applied to TextArea. */
4
4
  export type TextAreaResize = "both" | "horizontal" | "none" | "vertical";
@@ -1,4 +1,4 @@
1
- import type { CSSProperties, ReactElement, ReactNode } from "react";
1
+ import { type CSSProperties, type ReactElement, type ReactNode } from "react";
2
2
  import type { FloatingPlacement } from "../Portal/utils/floating-position";
3
3
  import "./styles/tooltip.css";
4
4
  /** A type representing the preferred placement of a Tooltip. */
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from "react";
1
+ import { type ReactNode } from "react";
2
2
  /** A type representing the shared behavior available to descendant Tooltips. */
3
3
  type TooltipContextValue = {
4
4
  /** The inherited pointer-hover delay in milliseconds. */