@cladd-ui/react 0.0.13 → 0.0.15
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/CHANGELOG.md +12 -0
- package/components/Backdrop.js +1 -1
- package/components/Button.d.ts +2 -2
- package/components/Button.js +5 -5
- package/components/Checkbox.d.ts +1 -1
- package/components/Checkbox.js +5 -5
- package/components/Chip.d.ts +1 -1
- package/components/Chip.js +2 -2
- package/components/Dialog.d.ts +2 -2
- package/components/Dialog.js +12 -12
- package/components/DialogsPortal.js +2 -2
- package/components/DialogsPortalContext.d.ts +1 -1
- package/components/FocusableLayer.d.ts +1 -1
- package/components/FocusableLayer.js +2 -2
- package/components/Input.d.ts +1 -1
- package/components/Input.js +7 -7
- package/components/Link.js +1 -1
- package/components/List.js +1 -1
- package/components/ListButton.d.ts +3 -3
- package/components/ListButton.js +2 -2
- package/components/ListItem.js +1 -1
- package/components/ListSeparator.js +1 -1
- package/components/ListTitle.js +1 -1
- package/components/NumberField.d.ts +2 -2
- package/components/NumberField.js +6 -6
- package/components/OTPField.d.ts +1 -1
- package/components/OTPField.js +5 -5
- package/components/OTPFieldContext.d.ts +1 -1
- package/components/OTPFieldInput.js +3 -3
- package/components/OTPFieldSeparator.js +1 -1
- package/components/Popover.d.ts +2 -2
- package/components/Popover.js +6 -6
- package/components/Popup.d.ts +1 -1
- package/components/Popup.js +8 -8
- package/components/PopupContent.d.ts +1 -1
- package/components/PopupContent.js +2 -2
- package/components/Radio.d.ts +1 -1
- package/components/Radio.js +4 -4
- package/components/SearchField.d.ts +2 -2
- package/components/SearchField.js +4 -4
- package/components/SectionTitle.js +1 -1
- package/components/Segmented.d.ts +3 -3
- package/components/Segmented.js +3 -3
- package/components/SegmentedButton.d.ts +1 -1
- package/components/SegmentedButton.js +2 -2
- package/components/SegmentedContext.d.ts +2 -2
- package/components/Select.d.ts +4 -4
- package/components/Select.js +13 -13
- package/components/Shortcut.d.ts +2 -2
- package/components/Shortcut.js +11 -11
- package/components/Slider.d.ts +1 -1
- package/components/Slider.js +5 -5
- package/components/Spinner.d.ts +1 -1
- package/components/Spinner.js +2 -2
- package/components/Surface.d.ts +1 -1
- package/components/Surface.js +4 -4
- package/components/SurfaceContent.js +1 -1
- package/components/SurfaceCut.d.ts +1 -1
- package/components/SurfaceCut.js +4 -4
- package/components/SurfaceCutContent.js +1 -1
- package/components/Switch.d.ts +2 -2
- package/components/Switch.js +4 -4
- package/components/TextArea.d.ts +1 -1
- package/components/TextArea.js +6 -6
- package/components/ThemeContext.d.ts +1 -1
- package/components/Toast.d.ts +2 -2
- package/components/Toast.js +7 -7
- package/components/ToastsPortal.js +2 -2
- package/components/ToastsPortalContext.d.ts +1 -1
- package/components/Toolbar.d.ts +3 -3
- package/components/Toolbar.js +4 -4
- package/components/ToolbarButton.d.ts +1 -1
- package/components/ToolbarButton.js +2 -2
- package/components/ToolbarContext.d.ts +2 -2
- package/components/ToolbarSeparator.js +1 -1
- package/components/Tooltip.d.ts +1 -1
- package/components/Tooltip.js +2 -2
- package/components/TooltipPrimitive.d.ts +2 -2
- package/components/TooltipPrimitive.js +5 -5
- package/components/UIProvider.d.ts +1 -1
- package/components/UIProvider.js +5 -5
- package/hooks/use-accent-color.d.ts +1 -1
- package/hooks/use-accent-color.d.ts.map +1 -1
- package/hooks/use-accent-color.js +1 -1
- package/hooks/use-dialog.d.ts +1 -1
- package/hooks/use-dialog.js +2 -2
- package/hooks/use-modal-utils.d.ts +1 -1
- package/hooks/use-modal-utils.js +1 -1
- package/hooks/use-surface.js +1 -1
- package/hooks/use-theme.js +1 -1
- package/hooks/use-toast.d.ts +1 -1
- package/hooks/use-toast.js +1 -1
- package/index.d.ts +55 -54
- package/index.d.ts.map +1 -1
- package/index.js +54 -54
- package/index.js.map +1 -1
- package/package.json +2 -1
- package/shared/rounded-classes.d.ts +4 -4
package/CHANGELOG.md
CHANGED
package/components/Backdrop.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '../shared/cn';
|
|
2
|
+
import { cn } from '../shared/cn.js';
|
|
3
3
|
export const Backdrop = (props) => {
|
|
4
4
|
const { className = '', children, ref, ...rest } = props;
|
|
5
5
|
return (_jsx("div", { ref: ref, className: cn('backdrop fixed inset-0 z-50 bg-backdrop/90', className), ...rest, children: children }));
|
package/components/Button.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ElementType, ReactNode, Ref, CSSProperties, ComponentPropsWithoutRef } from 'react';
|
|
2
|
-
import { Color } from '../types';
|
|
3
|
-
import { SurfaceVariant } from './Surface';
|
|
2
|
+
import { Color } from '../types.js';
|
|
3
|
+
import { SurfaceVariant } from './Surface.js';
|
|
4
4
|
export type ButtonSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
5
5
|
type ButtonSurface = 'surface' | 'cut';
|
|
6
6
|
interface ButtonOwnProps<C extends ElementType = 'button'> {
|
package/components/Button.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useRef, } from 'react';
|
|
3
|
-
import { cn } from '../shared/cn';
|
|
4
|
-
import { roundedClasses } from '../shared/rounded-classes';
|
|
5
|
-
import { FocusableLayer } from './FocusableLayer';
|
|
6
|
-
import { Surface } from './Surface';
|
|
7
|
-
import { SurfaceCut } from './SurfaceCut';
|
|
3
|
+
import { cn } from '../shared/cn.js';
|
|
4
|
+
import { roundedClasses } from '../shared/rounded-classes.js';
|
|
5
|
+
import { FocusableLayer } from './FocusableLayer.js';
|
|
6
|
+
import { Surface } from './Surface.js';
|
|
7
|
+
import { SurfaceCut } from './SurfaceCut.js';
|
|
8
8
|
export const buttonIconSizes = {
|
|
9
9
|
sm: '[&>svg]:size-4',
|
|
10
10
|
md: '[&>svg]:size-4',
|
package/components/Checkbox.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ElementType, ChangeEvent, MouseEvent, PointerEvent, ComponentPropsWithoutRef } from 'react';
|
|
2
|
-
import { Color } from '../types';
|
|
2
|
+
import { Color } from '../types.js';
|
|
3
3
|
export type CheckboxSize = 'sm' | 'md';
|
|
4
4
|
interface CheckboxOwnProps<C extends ElementType = 'label'> {
|
|
5
5
|
/** Controlled checked state. Default `false`. */
|
package/components/Checkbox.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useRef, } from 'react';
|
|
3
|
-
import { useAccentColor } from '../hooks/use-accent-color';
|
|
4
|
-
import { cn } from '../shared/cn';
|
|
5
|
-
import { FocusableLayer } from './FocusableLayer';
|
|
6
|
-
import { CheckIcon } from './icons/CheckIcon';
|
|
7
|
-
import { Surface } from './Surface';
|
|
3
|
+
import { useAccentColor } from '../hooks/use-accent-color.js';
|
|
4
|
+
import { cn } from '../shared/cn.js';
|
|
5
|
+
import { FocusableLayer } from './FocusableLayer.js';
|
|
6
|
+
import { CheckIcon } from './icons/CheckIcon.js';
|
|
7
|
+
import { Surface } from './Surface.js';
|
|
8
8
|
export function Checkbox(props) {
|
|
9
9
|
const accentColor = useAccentColor();
|
|
10
10
|
const { checked = false, disabled = false, readOnly, value, name, size = 'sm', required = false, onChange = () => { }, onClick = () => { }, onPointerDown = () => { }, input = true, inputId, className, checkClassName, color = accentColor, component = 'label', hoverable, focusable, ...rest } = props;
|
package/components/Chip.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode, Ref, ElementType, ComponentPropsWithoutRef } from 'react';
|
|
2
|
-
import { Color } from '../types';
|
|
2
|
+
import { Color } from '../types.js';
|
|
3
3
|
export type ChipSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
4
4
|
interface ChipOwnProps<C extends ElementType = 'span'> {
|
|
5
5
|
/** Chip content - typically a short label, optionally with an icon. */
|
package/components/Chip.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useRef, } from 'react';
|
|
3
|
-
import { cn } from '../shared/cn';
|
|
4
|
-
import { Surface } from './Surface';
|
|
3
|
+
import { cn } from '../shared/cn.js';
|
|
4
|
+
import { Surface } from './Surface.js';
|
|
5
5
|
export const Chip = (props) => {
|
|
6
6
|
const elRef = useRef(null);
|
|
7
7
|
const { children, disabled, className = '', contentClassName = '', rounded = false, size = 'md', component = 'span', outline, hoverable, clickable, color = '', icon: IconComponent, iconProps = {}, ref, ...rest } = props;
|
package/components/Dialog.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode, Ref } from 'react';
|
|
2
|
-
import { Color } from '../types';
|
|
3
|
-
import { SurfaceVariant } from './Surface';
|
|
2
|
+
import { Color } from '../types.js';
|
|
3
|
+
import { SurfaceVariant } from './Surface.js';
|
|
4
4
|
/**
|
|
5
5
|
* State container for the `Dialog` + `DialogTrigger` + `Dialog` compound. Use when you want
|
|
6
6
|
* the trigger and the dialog to be siblings in JSX:
|
package/components/Dialog.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cloneElement, createContext, useContext, useEffect, useId, useRef, useState, } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
|
-
import { useAccentColor } from '../hooks/use-accent-color';
|
|
5
|
-
import { useDevice } from '../hooks/use-device';
|
|
6
|
-
import { useFocusTrap } from '../hooks/use-focus-trap';
|
|
7
|
-
import { useModalUtils } from '../hooks/use-modal-utils';
|
|
8
|
-
import { useTheme } from '../hooks/use-theme';
|
|
9
|
-
import { cn } from '../shared/cn';
|
|
10
|
-
import { nextTick } from '../shared/next-tick';
|
|
11
|
-
import { Backdrop } from './Backdrop';
|
|
12
|
-
import { Button } from './Button';
|
|
13
|
-
import { Input } from './Input';
|
|
14
|
-
import { ModalController } from './ModalController';
|
|
15
|
-
import { Surface } from './Surface';
|
|
4
|
+
import { useAccentColor } from '../hooks/use-accent-color.js';
|
|
5
|
+
import { useDevice } from '../hooks/use-device.js';
|
|
6
|
+
import { useFocusTrap } from '../hooks/use-focus-trap.js';
|
|
7
|
+
import { useModalUtils } from '../hooks/use-modal-utils.js';
|
|
8
|
+
import { useTheme } from '../hooks/use-theme.js';
|
|
9
|
+
import { cn } from '../shared/cn.js';
|
|
10
|
+
import { nextTick } from '../shared/next-tick.js';
|
|
11
|
+
import { Backdrop } from './Backdrop.js';
|
|
12
|
+
import { Button } from './Button.js';
|
|
13
|
+
import { Input } from './Input.js';
|
|
14
|
+
import { ModalController } from './ModalController.js';
|
|
15
|
+
import { Surface } from './Surface.js';
|
|
16
16
|
const DialogRootContext = createContext(null);
|
|
17
17
|
/**
|
|
18
18
|
* State container for the `Dialog` + `DialogTrigger` + `Dialog` compound. Use when you want
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Dialog } from './Dialog';
|
|
3
|
-
import { useDialogsPortalContext } from './DialogsPortalContext';
|
|
2
|
+
import { Dialog } from './Dialog.js';
|
|
3
|
+
import { useDialogsPortalContext } from './DialogsPortalContext.js';
|
|
4
4
|
export function DialogsPortal() {
|
|
5
5
|
const { data, state, setState, setData } = useDialogsPortalContext();
|
|
6
6
|
if (!data)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Color } from '../types';
|
|
2
|
+
import { Color } from '../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Shape of the currently open dialog in the imperative dialog portal. The portal renders at
|
|
5
5
|
* most one dialog at a time; opening a new one replaces the previous via the context setter.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useAccentColor } from '../hooks/use-accent-color';
|
|
3
|
-
import { cn } from '../shared/cn';
|
|
2
|
+
import { useAccentColor } from '../hooks/use-accent-color.js';
|
|
3
|
+
import { cn } from '../shared/cn.js';
|
|
4
4
|
export const FocusableLayer = (props) => {
|
|
5
5
|
const accentColor = useAccentColor();
|
|
6
6
|
const { className, group, color = accentColor, force } = props;
|
package/components/Input.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ElementType, ReactNode, Ref, ChangeEvent, KeyboardEvent, FocusEvent, ComponentPropsWithoutRef } from 'react';
|
|
2
|
-
import { Color } from '../types';
|
|
2
|
+
import { Color } from '../types.js';
|
|
3
3
|
export type InputSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
4
4
|
interface InputOwnProps<C extends ElementType = 'div', IC extends ElementType = 'input'> {
|
|
5
5
|
/** Polymorphic **wrapper** element. Defaults to `'div'`. (For the inner input, see `inputComponent`.) */
|
package/components/Input.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useRef, useState, } from 'react';
|
|
3
|
-
import { useAccentColor } from '../hooks/use-accent-color';
|
|
4
|
-
import { cn } from '../shared/cn';
|
|
5
|
-
import { roundedClasses } from '../shared/rounded-classes';
|
|
6
|
-
import { Button } from './Button';
|
|
7
|
-
import { FocusableLayer } from './FocusableLayer';
|
|
8
|
-
import { CloseIcon } from './icons/CloseIcon';
|
|
9
|
-
import { SurfaceCut } from './SurfaceCut';
|
|
3
|
+
import { useAccentColor } from '../hooks/use-accent-color.js';
|
|
4
|
+
import { cn } from '../shared/cn.js';
|
|
5
|
+
import { roundedClasses } from '../shared/rounded-classes.js';
|
|
6
|
+
import { Button } from './Button.js';
|
|
7
|
+
import { FocusableLayer } from './FocusableLayer.js';
|
|
8
|
+
import { CloseIcon } from './icons/CloseIcon.js';
|
|
9
|
+
import { SurfaceCut } from './SurfaceCut.js';
|
|
10
10
|
export const Input = (props) => {
|
|
11
11
|
const accentColor = useAccentColor();
|
|
12
12
|
const { component = 'div', type = 'text', value, displayValue, placeholder, name, required = false, disabled = false, readOnly, inputId, rounded = false, size = 'lg', onChange = () => { }, onKeyDown = () => { }, onFocus = () => { }, onBlur = () => { }, onClear = () => { }, color = accentColor, prefix, min, step, suffix, className, contentClassName, inputClassName, max, maxLength, clearButton, valid = true, infoMessage, errorMessage, pattern, inputMode, icon, surfaceClassName, autoFocus, inputComponent = 'input', inputComponentProps = {}, ref: externalRef, inputRef: externalInputRef, } = props;
|
package/components/Link.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useRef } from 'react';
|
|
3
|
-
import { cn } from '../shared/cn';
|
|
3
|
+
import { cn } from '../shared/cn.js';
|
|
4
4
|
export const Link = ({ children, className = '', disabled = false, readOnly = false, component, focusable = true, onClick, href, ref, ...rest }) => {
|
|
5
5
|
const elRef = useRef(null);
|
|
6
6
|
const Component = (typeof component === 'undefined'
|
package/components/List.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '../shared/cn';
|
|
2
|
+
import { cn } from '../shared/cn.js';
|
|
3
3
|
export const List = (props) => {
|
|
4
4
|
const { children, className = '', ref, ...rest } = props;
|
|
5
5
|
return (_jsx("div", { ref: ref, className: cn('list flex flex-col p-2', className), ...rest, children: children }));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode, Ref, ElementType } from 'react';
|
|
2
|
-
import { Color } from '../types';
|
|
3
|
-
import { ButtonProps, ButtonSize } from './Button';
|
|
4
|
-
import { SurfaceVariant } from './Surface';
|
|
2
|
+
import { Color } from '../types.js';
|
|
3
|
+
import { ButtonProps, ButtonSize } from './Button.js';
|
|
4
|
+
import { SurfaceVariant } from './Surface.js';
|
|
5
5
|
interface ListButtonOwnProps<C extends ElementType = 'button'> {
|
|
6
6
|
/** Title content of the row (the main text/element on the row). */
|
|
7
7
|
children?: ReactNode;
|
package/components/ListButton.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '../shared/cn';
|
|
3
|
-
import { Button, buttonIconSizes } from './Button';
|
|
2
|
+
import { cn } from '../shared/cn.js';
|
|
3
|
+
import { Button, buttonIconSizes } from './Button.js';
|
|
4
4
|
export const ListButton = (props) => {
|
|
5
5
|
const { children, className = '', contentClassName = '', innerContentClassName = '', disabled = false, readOnly = false, size = 'lg', component = 'button', color = '', icon, iconClassName = '', header, headerClassName = '', footer, footerClassName = '', selected = false, titleClassName = '', after, ref, variant = 'transparent', outline = false, rounded = true, ...rest } = props;
|
|
6
6
|
const ButtonEl = Button;
|
package/components/ListItem.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '../shared/cn';
|
|
2
|
+
import { cn } from '../shared/cn.js';
|
|
3
3
|
export const ListItem = (props, ref) => {
|
|
4
4
|
const { children, className = '', ...rest } = props;
|
|
5
5
|
return (_jsx("div", { ref: ref, className: cn('flex min-h-9 items-center gap-4 px-2 py-1 text-xs font-medium', className), ...rest, children: children }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '../shared/cn';
|
|
2
|
+
import { cn } from '../shared/cn.js';
|
|
3
3
|
export const ListSeparator = (props) => {
|
|
4
4
|
const { children, className = '', ref, ...rest } = props;
|
|
5
5
|
return (_jsx("div", { ref: ref, className: cn('list-separator -mx-2 my-2 h-px bg-surface-outline', className), ...rest, children: children }));
|
package/components/ListTitle.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '../shared/cn';
|
|
2
|
+
import { cn } from '../shared/cn.js';
|
|
3
3
|
export const ListTitle = (props) => {
|
|
4
4
|
const { children, className = '', ref, ...rest } = props;
|
|
5
5
|
return (_jsx("div", { ref: ref, className: cn('list-title flex items-end gap-4 p-2 text-xs font-medium text-on-surface-dark uppercase select-none', className), ...rest, children: children }));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode, Ref } from 'react';
|
|
2
|
-
import { Color } from '../types';
|
|
3
|
-
import { SurfaceProps, SurfaceVariant } from './Surface';
|
|
2
|
+
import { Color } from '../types.js';
|
|
3
|
+
import { SurfaceProps, SurfaceVariant } from './Surface.js';
|
|
4
4
|
export type NumberFieldSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
5
5
|
interface NumberFieldOwnProps {
|
|
6
6
|
/** Custom content rendered inside the number field container (rare - most usage is value-only). */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '../shared/cn';
|
|
3
|
-
import { roundedClasses } from '../shared/rounded-classes';
|
|
4
|
-
import { Button } from './Button';
|
|
5
|
-
import { Input } from './Input';
|
|
6
|
-
import { Surface } from './Surface';
|
|
7
|
-
import { SurfaceCut } from './SurfaceCut';
|
|
2
|
+
import { cn } from '../shared/cn.js';
|
|
3
|
+
import { roundedClasses } from '../shared/rounded-classes.js';
|
|
4
|
+
import { Button } from './Button.js';
|
|
5
|
+
import { Input } from './Input.js';
|
|
6
|
+
import { Surface } from './Surface.js';
|
|
7
|
+
import { SurfaceCut } from './SurfaceCut.js';
|
|
8
8
|
export const NumberField = (props) => {
|
|
9
9
|
const { children, input = true, inputClassName = '', className = '', contentClassName = '', disabled = false, readOnly = false, rounded = true, valueRounded = false, size = 'md', color = '', outline = true, variant = 'gradient', buttonVariant = 'transparent', buttonOutline = false, surfaceLevel, min = 0, max = 1000000, value = 0, step = 1, onChange = () => { }, ref, ...rest } = props;
|
|
10
10
|
const decrease = () => {
|
package/components/OTPField.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, ReactNode, Ref } from 'react';
|
|
2
|
-
import { InputSize } from './Input';
|
|
2
|
+
import { InputSize } from './Input.js';
|
|
3
3
|
interface OTPFieldOwnProps {
|
|
4
4
|
/** OTP cells - one or more `OTPFieldInput`, with optional `OTPFieldSeparator` between. */
|
|
5
5
|
children?: ReactNode;
|
package/components/OTPField.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Children, cloneElement, isValidElement, useCallback, useMemo, useRef, } from 'react';
|
|
3
|
-
import { cn } from '../shared/cn';
|
|
4
|
-
import { roundedClasses } from '../shared/rounded-classes';
|
|
5
|
-
import { FocusableLayer } from './FocusableLayer';
|
|
6
|
-
import { OTPFieldContextProvider } from './OTPFieldContext';
|
|
7
|
-
import { OTPFieldInput } from './OTPFieldInput';
|
|
3
|
+
import { cn } from '../shared/cn.js';
|
|
4
|
+
import { roundedClasses } from '../shared/rounded-classes.js';
|
|
5
|
+
import { FocusableLayer } from './FocusableLayer.js';
|
|
6
|
+
import { OTPFieldContextProvider } from './OTPFieldContext.js';
|
|
7
|
+
import { OTPFieldInput } from './OTPFieldInput.js';
|
|
8
8
|
const isOTPInputElement = (child) => isValidElement(child) &&
|
|
9
9
|
child.type?.__OTPFieldInput ===
|
|
10
10
|
true;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '../shared/cn';
|
|
3
|
-
import { Input } from './Input';
|
|
4
|
-
import { useOTPFieldContext } from './OTPFieldContext';
|
|
2
|
+
import { cn } from '../shared/cn.js';
|
|
3
|
+
import { Input } from './Input.js';
|
|
4
|
+
import { useOTPFieldContext } from './OTPFieldContext.js';
|
|
5
5
|
const widthClasses = {
|
|
6
6
|
sm: 'w-6',
|
|
7
7
|
md: 'w-7',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '../shared/cn';
|
|
2
|
+
import { cn } from '../shared/cn.js';
|
|
3
3
|
export const OTPFieldSeparator = (props) => {
|
|
4
4
|
const { children, className, ref, ...rest } = props;
|
|
5
5
|
return (_jsx("div", { ref: ref, "aria-hidden": true, className: cn('flex items-center text-surface-outline select-none', className), ...rest, children: children ?? _jsx("span", { className: "h-0.5 w-2 bg-surface-outline" }) }));
|
package/components/Popover.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Color } from '../types';
|
|
2
|
-
import { SurfaceProps, SurfaceVariant } from './Surface';
|
|
1
|
+
import { Color } from '../types.js';
|
|
2
|
+
import { SurfaceProps, SurfaceVariant } from './Surface.js';
|
|
3
3
|
/**
|
|
4
4
|
* State container for the `Popover` + `PopoverTrigger` + `Popover` compound. Holds the open
|
|
5
5
|
* state and the anchor ref so a `PopoverTrigger` can register the anchor element and a sibling
|
package/components/Popover.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cloneElement, createContext, useContext, useEffect, useRef, useState, } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
|
-
import { useModalUtils } from '../hooks/use-modal-utils';
|
|
5
|
-
import { useTheme } from '../hooks/use-theme';
|
|
6
|
-
import { cn } from '../shared/cn';
|
|
7
|
-
import { Backdrop } from './Backdrop';
|
|
8
|
-
import { ModalController } from './ModalController';
|
|
9
|
-
import { Surface } from './Surface';
|
|
4
|
+
import { useModalUtils } from '../hooks/use-modal-utils.js';
|
|
5
|
+
import { useTheme } from '../hooks/use-theme.js';
|
|
6
|
+
import { cn } from '../shared/cn.js';
|
|
7
|
+
import { Backdrop } from './Backdrop.js';
|
|
8
|
+
import { ModalController } from './ModalController.js';
|
|
9
|
+
import { Surface } from './Surface.js';
|
|
10
10
|
const PopoverContext = createContext(null);
|
|
11
11
|
const PopoverRootContext = createContext(null);
|
|
12
12
|
/**
|
package/components/Popup.d.ts
CHANGED
package/components/Popup.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cloneElement, createContext, useContext, useEffect, useRef, useState, } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
|
-
import { useFocusTrap } from '../hooks/use-focus-trap';
|
|
5
|
-
import { useModalUtils } from '../hooks/use-modal-utils';
|
|
6
|
-
import { cn } from '../shared/cn';
|
|
7
|
-
import { Backdrop } from './Backdrop';
|
|
8
|
-
import { Button } from './Button';
|
|
9
|
-
import { CloseIcon } from './icons/CloseIcon';
|
|
10
|
-
import { ModalController } from './ModalController';
|
|
11
|
-
import { Surface } from './Surface';
|
|
4
|
+
import { useFocusTrap } from '../hooks/use-focus-trap.js';
|
|
5
|
+
import { useModalUtils } from '../hooks/use-modal-utils.js';
|
|
6
|
+
import { cn } from '../shared/cn.js';
|
|
7
|
+
import { Backdrop } from './Backdrop.js';
|
|
8
|
+
import { Button } from './Button.js';
|
|
9
|
+
import { CloseIcon } from './icons/CloseIcon.js';
|
|
10
|
+
import { ModalController } from './ModalController.js';
|
|
11
|
+
import { Surface } from './Surface.js';
|
|
12
12
|
const PopupRootContext = createContext(null);
|
|
13
13
|
/**
|
|
14
14
|
* State container for the `Popup` + `PopupTrigger` + `Popup` compound. Use when you want
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SurfaceVariant } from './Surface';
|
|
1
|
+
import { SurfaceVariant } from './Surface.js';
|
|
2
2
|
export interface PopupContentProps {
|
|
3
3
|
/** Forwarded to the underlying `Surface` as `level`. Default `1`. Accepts the relative (`"+1"`/`"-1"`) syntax via `Surface.level`. */
|
|
4
4
|
surfaceLevel?: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '../shared/cn';
|
|
3
|
-
import { Surface } from './Surface';
|
|
2
|
+
import { cn } from '../shared/cn.js';
|
|
3
|
+
import { Surface } from './Surface.js';
|
|
4
4
|
export const PopupContent = (props) => {
|
|
5
5
|
const { surfaceLevel = 1, children, contentClassName = '', className = '', variant = 'solid', outline = true, ref, } = props;
|
|
6
6
|
return (_jsx(Surface, { level: surfaceLevel, className: cn('rounded-3xl', className), ref: ref, variant: variant, outline: outline, contentClassName: cn('!h-auto w-full p-4', contentClassName), children: children }));
|
package/components/Radio.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ElementType, ChangeEvent, MouseEvent, PointerEvent, ComponentPropsWithoutRef } from 'react';
|
|
2
|
-
import { Color } from '../types';
|
|
2
|
+
import { Color } from '../types.js';
|
|
3
3
|
export type RadioSize = 'sm' | 'md';
|
|
4
4
|
interface RadioOwnProps<C extends ElementType = 'label'> {
|
|
5
5
|
/** Controlled checked state. Default `false`. */
|
package/components/Radio.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useRef, } from 'react';
|
|
3
|
-
import { useAccentColor } from '../hooks/use-accent-color';
|
|
4
|
-
import { cn } from '../shared/cn';
|
|
5
|
-
import { FocusableLayer } from './FocusableLayer';
|
|
6
|
-
import { Surface } from './Surface';
|
|
3
|
+
import { useAccentColor } from '../hooks/use-accent-color.js';
|
|
4
|
+
import { cn } from '../shared/cn.js';
|
|
5
|
+
import { FocusableLayer } from './FocusableLayer.js';
|
|
6
|
+
import { Surface } from './Surface.js';
|
|
7
7
|
export function Radio(props) {
|
|
8
8
|
const accentColor = useAccentColor();
|
|
9
9
|
const { checked = false, disabled = false, readOnly, value, name, size = 'sm', required = false, onChange = () => { }, onClick = () => { }, onPointerDown = () => { }, input = true, inputId, className, color = accentColor, component = 'label', hoverable, focusable, ...rest } = props;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ref, ChangeEvent } from 'react';
|
|
2
|
-
import { InputSize } from './Input';
|
|
3
|
-
import { SurfaceProps } from './Surface';
|
|
2
|
+
import { InputSize } from './Input.js';
|
|
3
|
+
import { SurfaceProps } from './Surface.js';
|
|
4
4
|
interface SearchFieldOwnProps {
|
|
5
5
|
/** Controlled query string. Default `''`. */
|
|
6
6
|
value?: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '../shared/cn';
|
|
3
|
-
import { SearchIcon } from './icons/SearchIcon';
|
|
4
|
-
import { Input } from './Input';
|
|
5
|
-
import { Surface } from './Surface';
|
|
2
|
+
import { cn } from '../shared/cn.js';
|
|
3
|
+
import { SearchIcon } from './icons/SearchIcon.js';
|
|
4
|
+
import { Input } from './Input.js';
|
|
5
|
+
import { Surface } from './Surface.js';
|
|
6
6
|
export const SearchField = (props) => {
|
|
7
7
|
const { value = '', inset = false, size = 'md', placeholder = 'Search', className = '', onChange = () => { }, ref, ...rest } = props;
|
|
8
8
|
return (_jsx(Surface, { level: inset ? '+0' : '+1', className: cn('sticky z-20', !inset && 'top-0 ml-px rounded-t-3xl', inset && 'top-2 mx-2 w-auto rounded-full', className), outline: !inset, ref: ref, ...rest, children: _jsxs("div", { className: cn('flex items-center', !inset && 'p-1.5'), children: [_jsx(Input, { className: "w-full", placeholder: placeholder, onChange: (v, e) => onChange(v, e), contentClassName: "pl-6.5", value: value, clearButton: true, rounded: true, onClear: () => onChange('') }), _jsx(SearchIcon, { className: cn('pointer-events-none absolute top-1/2 left-2 size-4 -translate-y-1/2 text-on-surface-darker', inset ? 'left-2' : 'left-4') })] }) }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '../shared/cn';
|
|
2
|
+
import { cn } from '../shared/cn.js';
|
|
3
3
|
export const SectionTitle = (props) => {
|
|
4
4
|
const { children, className = '', ref, ...rest } = props;
|
|
5
5
|
return (_jsx("div", { ref: ref, className: cn('section-title flex items-end gap-4 text-xs font-medium text-on-surface-dark uppercase select-none', className), ...rest, children: children }));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode, Ref, ElementType, ComponentPropsWithoutRef } from 'react';
|
|
2
|
-
import { Color } from '../types';
|
|
3
|
-
import { ButtonSize } from './Button';
|
|
4
|
-
import { SurfaceVariant } from './Surface';
|
|
2
|
+
import { Color } from '../types.js';
|
|
3
|
+
import { ButtonSize } from './Button.js';
|
|
4
|
+
import { SurfaceVariant } from './Surface.js';
|
|
5
5
|
interface SegmentedOwnProps<C extends ElementType = 'div'> {
|
|
6
6
|
/** Should be one or more `SegmentedButton` elements. */
|
|
7
7
|
children?: ReactNode;
|
package/components/Segmented.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useRef, } from 'react';
|
|
3
|
-
import { useAccentColor } from '../hooks/use-accent-color';
|
|
4
|
-
import { cn } from '../shared/cn';
|
|
5
|
-
import { SegmentedContextProvider } from './SegmentedContext';
|
|
3
|
+
import { useAccentColor } from '../hooks/use-accent-color.js';
|
|
4
|
+
import { cn } from '../shared/cn.js';
|
|
5
|
+
import { SegmentedContextProvider } from './SegmentedContext.js';
|
|
6
6
|
export const Segmented = (props) => {
|
|
7
7
|
const elRef = useRef(null);
|
|
8
8
|
const accentColor = useAccentColor();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ElementType } from 'react';
|
|
2
|
-
import { ButtonProps } from './Button';
|
|
2
|
+
import { ButtonProps } from './Button.js';
|
|
3
3
|
export type SegmentedButtonProps<C extends ElementType = 'button'> = ButtonProps<C> & {
|
|
4
4
|
/**
|
|
5
5
|
* Marks this button as the selected segment. When `true`, switches to the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button } from './Button';
|
|
3
|
-
import { useSegmentedContext } from './SegmentedContext';
|
|
2
|
+
import { Button } from './Button.js';
|
|
3
|
+
import { useSegmentedContext } from './SegmentedContext.js';
|
|
4
4
|
export const SegmentedButton = (props) => {
|
|
5
5
|
const { size = 'md', rounded = true, color, variant, outline, activeColor, activeVariant, activeOutline, } = useSegmentedContext();
|
|
6
6
|
const { active, ...rest } = props;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { Color } from '../types';
|
|
3
|
-
import { ButtonProps, ButtonSize } from './Button';
|
|
2
|
+
import { Color } from '../types.js';
|
|
3
|
+
import { ButtonProps, ButtonSize } from './Button.js';
|
|
4
4
|
/**
|
|
5
5
|
* Shape of the data published by `Segmented` to its child `SegmentedButton`s.
|
|
6
6
|
* Each `SegmentedButton` reads this via `useSegmentedContext()` to pick its inactive vs active
|
package/components/Select.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ReactNode, Ref, MouseEvent } from 'react';
|
|
2
|
-
import { ButtonSize } from './Button';
|
|
3
|
-
import { PopoverOffset, PopoverPosition } from './Popover';
|
|
2
|
+
import { ButtonSize } from './Button.js';
|
|
3
|
+
import { PopoverOffset, PopoverPosition } from './Popover.js';
|
|
4
4
|
interface SelectOptionRenderParams<T> {
|
|
5
5
|
value: T;
|
|
6
6
|
index: number;
|
|
7
7
|
selected: boolean;
|
|
8
8
|
}
|
|
9
|
-
import { Color } from '../types';
|
|
10
|
-
import { ButtonProps } from './Button';
|
|
9
|
+
import { Color } from '../types.js';
|
|
10
|
+
import { ButtonProps } from './Button.js';
|
|
11
11
|
interface SelectOwnProps<T = string> {
|
|
12
12
|
/** Selected value (single-select) or array of selected values (when `multiple`). */
|
|
13
13
|
value?: T | T[];
|
package/components/Select.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment, useEffect, useId, useRef, useState, } from 'react';
|
|
3
|
-
import { useDevice } from '../hooks/use-device';
|
|
4
|
-
import { useTheme } from '../hooks/use-theme';
|
|
5
|
-
import { cn } from '../shared/cn';
|
|
6
|
-
import { Button, buttonIconSizes } from './Button';
|
|
7
|
-
import { Checkbox } from './Checkbox';
|
|
8
|
-
import { DropdownIcon } from './icons/DropdownIcon';
|
|
9
|
-
import { List } from './List';
|
|
10
|
-
import { ListButton } from './ListButton';
|
|
11
|
-
import { Popover } from './Popover';
|
|
12
|
-
import { Radio } from './Radio';
|
|
13
|
-
import { SearchField } from './SearchField';
|
|
14
|
-
import { SectionTitle } from './SectionTitle';
|
|
15
|
-
import { Shortcut } from './Shortcut';
|
|
3
|
+
import { useDevice } from '../hooks/use-device.js';
|
|
4
|
+
import { useTheme } from '../hooks/use-theme.js';
|
|
5
|
+
import { cn } from '../shared/cn.js';
|
|
6
|
+
import { Button, buttonIconSizes } from './Button.js';
|
|
7
|
+
import { Checkbox } from './Checkbox.js';
|
|
8
|
+
import { DropdownIcon } from './icons/DropdownIcon.js';
|
|
9
|
+
import { List } from './List.js';
|
|
10
|
+
import { ListButton } from './ListButton.js';
|
|
11
|
+
import { Popover } from './Popover.js';
|
|
12
|
+
import { Radio } from './Radio.js';
|
|
13
|
+
import { SearchField } from './SearchField.js';
|
|
14
|
+
import { SectionTitle } from './SectionTitle.js';
|
|
15
|
+
import { Shortcut } from './Shortcut.js';
|
|
16
16
|
export function Select(props) {
|
|
17
17
|
const theme = useTheme();
|
|
18
18
|
const { value = '', placeholder = '', title = '', options = [], multiple, disabled, readOnly,
|
package/components/Shortcut.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, ReactNode, Ref } from 'react';
|
|
2
|
-
import { Color } from '../types';
|
|
3
|
-
import { SurfaceVariant } from './Surface';
|
|
2
|
+
import { Color } from '../types.js';
|
|
3
|
+
import { SurfaceVariant } from './Surface.js';
|
|
4
4
|
export type ShortcutSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
5
5
|
interface ShortcutOwnProps {
|
|
6
6
|
/** Extra classes for the shortcut root container. */
|