@jig-ui/react 0.1.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.
- package/LICENSE +52 -0
- package/README.md +193 -0
- package/dist/adorn/adorn.d.ts +38 -0
- package/dist/adorn/index.d.ts +2 -0
- package/dist/box/box.d.ts +32 -0
- package/dist/box/index.d.ts +2 -0
- package/dist/breakpoints.d.ts +35 -0
- package/dist/button/button.d.ts +37 -0
- package/dist/button/index.d.ts +2 -0
- package/dist/codeblock/codeblock.d.ts +28 -0
- package/dist/codeblock/index.d.ts +2 -0
- package/dist/collapsible/collapsible.d.ts +116 -0
- package/dist/collapsible/index.d.ts +2 -0
- package/dist/combobox/combobox.d.ts +119 -0
- package/dist/combobox/index.d.ts +2 -0
- package/dist/dev.d.ts +14 -0
- package/dist/dialog/dialog.d.ts +80 -0
- package/dist/dialog/index.d.ts +2 -0
- package/dist/focus-ring.d.ts +15 -0
- package/dist/grid/grid.d.ts +54 -0
- package/dist/grid/index.d.ts +2 -0
- package/dist/icon/generated/arrow-down.d.ts +4 -0
- package/dist/icon/generated/arrow-left.d.ts +4 -0
- package/dist/icon/generated/arrow-right.d.ts +4 -0
- package/dist/icon/generated/arrow-square-out.d.ts +4 -0
- package/dist/icon/generated/arrow-up.d.ts +4 -0
- package/dist/icon/generated/bell.d.ts +4 -0
- package/dist/icon/generated/calendar.d.ts +4 -0
- package/dist/icon/generated/caret-down.d.ts +4 -0
- package/dist/icon/generated/caret-left.d.ts +4 -0
- package/dist/icon/generated/caret-right.d.ts +4 -0
- package/dist/icon/generated/caret-up.d.ts +4 -0
- package/dist/icon/generated/check-circle.d.ts +4 -0
- package/dist/icon/generated/check.d.ts +4 -0
- package/dist/icon/generated/clock.d.ts +4 -0
- package/dist/icon/generated/copy.d.ts +4 -0
- package/dist/icon/generated/dots-nine.d.ts +4 -0
- package/dist/icon/generated/dots-three.d.ts +4 -0
- package/dist/icon/generated/eye-slash.d.ts +4 -0
- package/dist/icon/generated/eye.d.ts +4 -0
- package/dist/icon/generated/gear.d.ts +4 -0
- package/dist/icon/generated/github-logo.d.ts +4 -0
- package/dist/icon/generated/heart.d.ts +4 -0
- package/dist/icon/generated/index.d.ts +151 -0
- package/dist/icon/generated/info.d.ts +4 -0
- package/dist/icon/generated/list.d.ts +4 -0
- package/dist/icon/generated/magnifying-glass.d.ts +4 -0
- package/dist/icon/generated/minus.d.ts +4 -0
- package/dist/icon/generated/moon.d.ts +4 -0
- package/dist/icon/generated/pencil-simple.d.ts +4 -0
- package/dist/icon/generated/plus.d.ts +4 -0
- package/dist/icon/generated/question.d.ts +4 -0
- package/dist/icon/generated/star.d.ts +4 -0
- package/dist/icon/generated/sun.d.ts +4 -0
- package/dist/icon/generated/trash.d.ts +4 -0
- package/dist/icon/generated/user.d.ts +4 -0
- package/dist/icon/generated/warning-circle.d.ts +4 -0
- package/dist/icon/generated/warning.d.ts +4 -0
- package/dist/icon/generated/x.d.ts +4 -0
- package/dist/icon/icon.d.ts +46 -0
- package/dist/icon/index.d.ts +2 -0
- package/dist/icon-BRHwInc5.js +165 -0
- package/dist/icon-B_NrwKaL.js +173 -0
- package/dist/iconbutton/iconbutton.d.ts +35 -0
- package/dist/iconbutton/index.d.ts +2 -0
- package/dist/icons.d.ts +17 -0
- package/dist/icons.js +2 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.js +3061 -0
- package/dist/input/index.d.ts +2 -0
- package/dist/input/input.d.ts +63 -0
- package/dist/layout.d.ts +87 -0
- package/dist/link/index.d.ts +2 -0
- package/dist/link/link.d.ts +125 -0
- package/dist/listitem/index.d.ts +2 -0
- package/dist/listitem/listitem.d.ts +92 -0
- package/dist/polymorphic.d.ts +31 -0
- package/dist/reset.css +4 -0
- package/dist/responsive.d.ts +10 -0
- package/dist/scrollarea/index.d.ts +2 -0
- package/dist/scrollarea/scrollarea.d.ts +26 -0
- package/dist/separator/index.d.ts +2 -0
- package/dist/separator/separator.d.ts +48 -0
- package/dist/sidenav/index.d.ts +2 -0
- package/dist/sidenav/sidenav.d.ts +35 -0
- package/dist/sidenavsection/index.d.ts +2 -0
- package/dist/sidenavsection/sidenavsection.d.ts +44 -0
- package/dist/slider/index.d.ts +2 -0
- package/dist/slider/slider.d.ts +73 -0
- package/dist/spacing.d.ts +35 -0
- package/dist/stack/index.d.ts +2 -0
- package/dist/stack/stack.d.ts +52 -0
- package/dist/structuredlist/index.d.ts +2 -0
- package/dist/structuredlist/structuredlist.d.ts +104 -0
- package/dist/styles.css +911 -0
- package/dist/togglebutton/index.d.ts +2 -0
- package/dist/togglebutton/togglebutton.d.ts +93 -0
- package/dist/togglebuttongroup/index.d.ts +2 -0
- package/dist/togglebuttongroup/togglebuttongroup.d.ts +72 -0
- package/dist/token/index.d.ts +2 -0
- package/dist/token/token.d.ts +82 -0
- package/dist/tokens-vars.d.ts +579 -0
- package/dist/tokens.d.ts +24 -0
- package/dist/tokens.js +577 -0
- package/dist/tooltip/index.d.ts +2 -0
- package/dist/tooltip/tooltip.d.ts +52 -0
- package/dist/typography/index.d.ts +2 -0
- package/dist/typography/typography.d.ts +71 -0
- package/package.json +81 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ReactNode, Ref } from 'react';
|
|
2
|
+
export type SliderSize = 'sm' | 'md' | 'lg';
|
|
3
|
+
export interface SliderProps {
|
|
4
|
+
/** The field's label, rendered as a real `<label>` bound to the control. */
|
|
5
|
+
label?: ReactNode;
|
|
6
|
+
/** Hint text below the control. */
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
/** @default 0 */
|
|
9
|
+
min?: number;
|
|
10
|
+
/** @default 100 */
|
|
11
|
+
max?: number;
|
|
12
|
+
/** @default 1 */
|
|
13
|
+
step?: number;
|
|
14
|
+
/** The jump for Page Up/Down and Shift + Arrow. @default 10 */
|
|
15
|
+
largeStep?: number;
|
|
16
|
+
/** Controlled value. Leave undefined and pass `defaultValue` instead to let the slider manage its own. */
|
|
17
|
+
value?: number;
|
|
18
|
+
defaultValue?: number;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** Identifies the field when a form is submitted. */
|
|
21
|
+
name?: string;
|
|
22
|
+
/** `Intl.NumberFormat` options for the value readout. */
|
|
23
|
+
format?: Intl.NumberFormatOptions;
|
|
24
|
+
locale?: Intl.LocalesArgument;
|
|
25
|
+
onValueChange?: (value: number) => void;
|
|
26
|
+
/** Fires when the interaction ends, rather than on every movement. */
|
|
27
|
+
onValueCommitted?: (value: number) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Show minus and plus buttons flanking the track, for adjusting by exactly
|
|
30
|
+
* one step without dragging.
|
|
31
|
+
*
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
steppers?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Sets the row height from the shared control ramp, so a slider lines up
|
|
37
|
+
* with an Input or Button of the same size.
|
|
38
|
+
*
|
|
39
|
+
* @default 'md'
|
|
40
|
+
*/
|
|
41
|
+
size?: SliderSize;
|
|
42
|
+
/** Applied to the root, not the track. */
|
|
43
|
+
className?: string;
|
|
44
|
+
ref?: Ref<HTMLDivElement>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A slider for choosing one number from a range.
|
|
48
|
+
*
|
|
49
|
+
* `min`, `max` and `step` bound it; `largeStep` is the jump on Page Up and Page
|
|
50
|
+
* Down. `steppers` adds decrement and increment buttons at each end.
|
|
51
|
+
*
|
|
52
|
+
* `onValueChange` fires continuously while dragging; `onValueCommitted` fires
|
|
53
|
+
* once the drag or key press ends — use that one for anything expensive.
|
|
54
|
+
*
|
|
55
|
+
* `format` takes `Intl.NumberFormat` options, so the value can be shown as a
|
|
56
|
+
* percentage, a currency or a plain number, and is what assistive technology
|
|
57
|
+
* announces.
|
|
58
|
+
*
|
|
59
|
+
* The control occupies exactly the width you give it, so it lines up with the
|
|
60
|
+
* fields around it.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* <Slider
|
|
64
|
+
* label="Quality"
|
|
65
|
+
* min={0}
|
|
66
|
+
* max={1}
|
|
67
|
+
* step={0.05}
|
|
68
|
+
* format={{ style: 'percent' }}
|
|
69
|
+
* value={quality}
|
|
70
|
+
* onValueCommitted={save}
|
|
71
|
+
* />
|
|
72
|
+
*/
|
|
73
|
+
export declare function Slider({ label, description, min, max, step, largeStep, value, defaultValue, disabled, name, format, locale, onValueChange, onValueCommitted, steppers, size, className, ref, }: SliderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Responsive } from './responsive';
|
|
2
|
+
declare const shorthandSpacingKeys: readonly ["m", "mx", "my", "mt", "mr", "mb", "ml", "p", "px", "py", "pt", "pr", "pb", "pl"];
|
|
3
|
+
/** The step scale margin and padding props share with Stack/Grid's `spacing`, plus an explicit `none` for clearing one something else already set. */
|
|
4
|
+
export type SpacingScale = 'none' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
|
|
5
|
+
/**
|
|
6
|
+
* Margin and padding props shared by every component that accepts them.
|
|
7
|
+
* Shorthand only — `mt`, `pr`, and so on. The longhand `marginTop` etc. that
|
|
8
|
+
* the sprinkles config needs internally to build those shorthands isn't part
|
|
9
|
+
* of the public surface. Spread into a component's props interface rather
|
|
10
|
+
* than redeclared, so the set only ever grows in one place.
|
|
11
|
+
*
|
|
12
|
+
* Declared by hand against `SpacingScale` rather than derived from the
|
|
13
|
+
* sprinkles function's inferred parameter type, so tooling that reads these
|
|
14
|
+
* types — Storybook's props table included — sees a plain scale instead of
|
|
15
|
+
* Sprinkles' generated conditional-style type.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* <Typography mb="500">Heading</Typography>
|
|
19
|
+
* <Typography mb={{ xs: '300', md: '500' }}>Heading</Typography>
|
|
20
|
+
* <Stack p="400">...</Stack>
|
|
21
|
+
*/
|
|
22
|
+
export type SpacingProps = {
|
|
23
|
+
[K in typeof shorthandSpacingKeys[number]]?: Responsive<SpacingScale>;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Splits the margin/padding props out of a component's props, returning the
|
|
27
|
+
* class name they compile to alongside everything left over for the DOM
|
|
28
|
+
* element. Keeps spacing support to two lines per component instead of a
|
|
29
|
+
* duplicated prop table.
|
|
30
|
+
*/
|
|
31
|
+
export declare function splitSpacing<P extends object>(props: P): {
|
|
32
|
+
spacing: string;
|
|
33
|
+
rest: Omit<P, keyof SpacingProps>;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Responsive } from '../responsive';
|
|
2
|
+
import { SpacingProps } from '../spacing';
|
|
3
|
+
import { LayoutChildProps, LayoutAlign, LayoutDirection, LayoutJustify, LayoutSpacing } from '../layout';
|
|
4
|
+
import { PolymorphicProps } from '../polymorphic';
|
|
5
|
+
/**
|
|
6
|
+
* The elements a Stack is willing to render as. Restricted rather than open:
|
|
7
|
+
* an arbitrary ElementType would let a Stack render as something that has no
|
|
8
|
+
* business being a flex container.
|
|
9
|
+
*/
|
|
10
|
+
export type StackElement = 'div' | 'section' | 'article' | 'aside' | 'nav' | 'header' | 'footer' | 'main' | 'ul' | 'ol' | 'li';
|
|
11
|
+
/**
|
|
12
|
+
* Stack's own props: how it arranges its children, plus the shared child-side
|
|
13
|
+
* set describing how it sits in whatever contains it. The element's own
|
|
14
|
+
* attributes are added by PolymorphicProps.
|
|
15
|
+
*
|
|
16
|
+
* Note `align` and `alignSelf` are both here and are not the same prop —
|
|
17
|
+
* `align` is what the Stack does to its children, `alignSelf` is what it does
|
|
18
|
+
* to itself inside its parent. Spanning changes how wide a Stack is, not how
|
|
19
|
+
* its children fill it: `align` still defaults to `start`, so a spanning Stack
|
|
20
|
+
* whose children should fill the column wants `align="stretch"` as well.
|
|
21
|
+
*/
|
|
22
|
+
export interface StackOwnProps extends SpacingProps, LayoutChildProps {
|
|
23
|
+
direction?: Responsive<LayoutDirection>;
|
|
24
|
+
spacing?: Responsive<LayoutSpacing>;
|
|
25
|
+
align?: Responsive<LayoutAlign>;
|
|
26
|
+
justify?: Responsive<LayoutJustify>;
|
|
27
|
+
}
|
|
28
|
+
export type StackProps<E extends StackElement = 'div'> = PolymorphicProps<E, StackOwnProps>;
|
|
29
|
+
/**
|
|
30
|
+
* A flex container that spaces its children evenly.
|
|
31
|
+
*
|
|
32
|
+
* `direction` defaults to `column`. `spacing` is a step on the shared scale
|
|
33
|
+
* rather than a length, and `direction`, `spacing`, `align` and `justify` all
|
|
34
|
+
* take responsive values keyed by breakpoint.
|
|
35
|
+
*
|
|
36
|
+
* Children take `grow` to absorb leftover space, either through `Box` or
|
|
37
|
+
* directly on a nested Stack or Grid. Stack is a layout child itself, so it
|
|
38
|
+
* also takes `span`, `grow` and `alignSelf` for its own position in a parent.
|
|
39
|
+
*
|
|
40
|
+
* Use `as` to make it a real list or section when that is what the content is.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* <Stack direction={{ xs: 'column', md: 'row' }} spacing="400" align="center">
|
|
44
|
+
* <Icon icon="user" size="2rem" />
|
|
45
|
+
* <Stack spacing="100" grow>
|
|
46
|
+
* <Typography with="heading05">Ada Lovelace</Typography>
|
|
47
|
+
* <Typography tone="muted">Engineering</Typography>
|
|
48
|
+
* </Stack>
|
|
49
|
+
* <Button variant="secondary">Message</Button>
|
|
50
|
+
* </Stack>
|
|
51
|
+
*/
|
|
52
|
+
export declare function Stack<E extends StackElement = 'div'>({ as, direction, spacing: spacingProp, align, justify, span, grow, alignSelf, className, children, ...props }: StackProps<E>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { CSSProperties, HTMLAttributes, ReactNode, Ref } from 'react';
|
|
2
|
+
import { Responsive } from '../responsive';
|
|
3
|
+
import { TypeStyles } from '../typography';
|
|
4
|
+
/** Which way the list lays itself out. */
|
|
5
|
+
export type StructuredListLayout = 'columns' | 'stacked';
|
|
6
|
+
export interface StructuredListProps extends Omit<HTMLAttributes<HTMLDivElement>, 'className' | 'style' | 'children'> {
|
|
7
|
+
/** The rows. `StructuredListRow` elements. */
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* The column headings. Optional — without them the list is columns of values
|
|
11
|
+
* with nothing naming them, and cells fall back to their own `label`.
|
|
12
|
+
*
|
|
13
|
+
* These are also what a cell reads to label itself when stacked, so a string
|
|
14
|
+
* heading is what makes `label` unnecessary at the call site.
|
|
15
|
+
*/
|
|
16
|
+
headers?: ReactNode[];
|
|
17
|
+
/**
|
|
18
|
+
* A width per column, applied in the column layout only.
|
|
19
|
+
*
|
|
20
|
+
* `'auto'` fills the space left over, a bare length is fixed, and anything
|
|
21
|
+
* with a space in it is used as a flex shorthand. Omitted columns keep the
|
|
22
|
+
* default equal share.
|
|
23
|
+
*
|
|
24
|
+
* Declared here rather than on the cell because flex rows lay out
|
|
25
|
+
* independently: the columns line up only while every row's nth cell resolves
|
|
26
|
+
* to the same width, and one array on the list is what guarantees that
|
|
27
|
+
* (0018 D2).
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* columnWidths={['4.5rem', 'auto', '3rem']}
|
|
31
|
+
*/
|
|
32
|
+
columnWidths?: string[];
|
|
33
|
+
/** Column layout, stacked, or one per breakpoint. */
|
|
34
|
+
layout?: Responsive<StructuredListLayout>;
|
|
35
|
+
/**
|
|
36
|
+
* A Typography preset for the whole list, inherited by every row and cell and
|
|
37
|
+
* overridable per cell. Column headings take this preset at weight 600.
|
|
38
|
+
*/
|
|
39
|
+
with?: TypeStyles;
|
|
40
|
+
className?: string;
|
|
41
|
+
style?: CSSProperties;
|
|
42
|
+
ref?: Ref<HTMLDivElement>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Columns of content, laid out as a table on a wide screen and stacked with
|
|
46
|
+
* their labels on a narrow one.
|
|
47
|
+
*
|
|
48
|
+
* Layout only — nothing here is focusable or selectable. It carries ARIA table
|
|
49
|
+
* roles rather than table elements (0017 D1), so the structure a screen reader
|
|
50
|
+
* hears is identical in both layouts.
|
|
51
|
+
*
|
|
52
|
+
* Cells take their stacked label from `headers` by position; pass `label` on a
|
|
53
|
+
* cell only to override it. `columnWidths` gives the columns widths, and `with`
|
|
54
|
+
* sets the type for the list with each cell free to name its own.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* <StructuredList headers={['Plan', 'Requests', 'Price']} columnWidths={['8rem', 'auto', '6rem']}>
|
|
58
|
+
* <StructuredListRow>
|
|
59
|
+
* <StructuredListCell>Starter</StructuredListCell>
|
|
60
|
+
* <StructuredListCell with="caption01">10,000</StructuredListCell>
|
|
61
|
+
* <StructuredListCell><Token color="green">Free</Token></StructuredListCell>
|
|
62
|
+
* </StructuredListRow>
|
|
63
|
+
* </StructuredList>
|
|
64
|
+
*/
|
|
65
|
+
export declare function StructuredList({ children, headers, columnWidths, layout, with: typeStyle, className, style, ref, ...props }: StructuredListProps): import("react/jsx-runtime").JSX.Element;
|
|
66
|
+
export interface StructuredListRowProps extends Omit<HTMLAttributes<HTMLDivElement>, 'className' | 'children'> {
|
|
67
|
+
/** The cells. `StructuredListCell` elements. */
|
|
68
|
+
children?: ReactNode;
|
|
69
|
+
className?: string;
|
|
70
|
+
ref?: Ref<HTMLDivElement>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* One row of a `StructuredList`. Carries `role="row"`, and tells each cell which
|
|
74
|
+
* column it is in — which is what lets a cell find its own heading and width.
|
|
75
|
+
*/
|
|
76
|
+
export declare function StructuredListRow({ children, className, ref, ...props }: StructuredListRowProps): import("react/jsx-runtime").JSX.Element;
|
|
77
|
+
export interface StructuredListCellProps extends Omit<HTMLAttributes<HTMLDivElement>, 'className' | 'children'> {
|
|
78
|
+
/** The cell's content. Anything — a string, a Token, a Link, an Icon. */
|
|
79
|
+
children?: ReactNode;
|
|
80
|
+
/**
|
|
81
|
+
* Overrides the label the cell would take from its column's heading.
|
|
82
|
+
*
|
|
83
|
+
* Only needed when the heading is not a plain string, or when the stacked
|
|
84
|
+
* label should read differently from the column title. Since 0018 D3 the
|
|
85
|
+
* common case is to omit it.
|
|
86
|
+
*/
|
|
87
|
+
label?: string;
|
|
88
|
+
/**
|
|
89
|
+
* A Typography preset for this cell, overriding the list's. The type a column
|
|
90
|
+
* wants is usually a property of the column rather than the whole list —
|
|
91
|
+
* a monospaced value beside prose, a quieter note (0018 D1).
|
|
92
|
+
*/
|
|
93
|
+
with?: TypeStyles;
|
|
94
|
+
className?: string;
|
|
95
|
+
ref?: Ref<HTMLDivElement>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* One cell of a `StructuredListRow`. Carries `role="cell"`.
|
|
99
|
+
*
|
|
100
|
+
* Its stacked label comes from the column heading above it; `label` overrides.
|
|
101
|
+
* The label is `aria-hidden` because the `columnheader` already announces the
|
|
102
|
+
* same words — without that, a screen reader hears the heading twice per cell.
|
|
103
|
+
*/
|
|
104
|
+
export declare function StructuredListCell({ children, label, with: typeStyle, className, ref, ...props }: StructuredListCellProps): import("react/jsx-runtime").JSX.Element;
|