@kabobcompany/react 0.1.0 → 0.2.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/GUIDE.md +27 -2
- package/dist/components/Button/Button.d.ts +4 -4
- package/dist/components/Dialog/Dialog.d.ts +6 -1
- package/dist/components/Input/Input.d.ts +3 -1
- package/dist/components/Layout/Layout.d.ts +127 -0
- package/dist/components/Layout/index.d.ts +2 -0
- package/dist/components/Select/Select.d.ts +5 -1
- package/dist/components/SideRail/SideRail.d.ts +3 -1
- package/dist/components/Toast/Toast.d.ts +6 -2
- package/dist/components/Typography/Typography.d.ts +12 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +223 -83
- package/package.json +2 -2
package/GUIDE.md
CHANGED
|
@@ -22,7 +22,9 @@ classes and add behaviour. Without the CSS import nothing is styled.
|
|
|
22
22
|
`dist/components/*/*.d.ts` files beside it): read them instead of guessing.
|
|
23
23
|
2. **Never write a raw colour, font size, radius or shadow.** Use the `--kb-*`
|
|
24
24
|
variables (see Tokens). If a value is missing, ask for a token.
|
|
25
|
-
3. **
|
|
25
|
+
3. **Lay pages out with the layout components** (`Stack`, `Inline`, `Grid`, `Box`, `Spacer`),
|
|
26
|
+
not a utility framework or ad-hoc CSS: spacing comes from the `--kb-space-*` steps, sizes in
|
|
27
|
+
px through props. Components own their look.
|
|
26
28
|
4. **No icons are included.** Pass your own SVGs to `icon`, `searchIcon`, `IconButton`
|
|
27
29
|
and `RailItem`. Size them 20px (16px inside small controls) and use
|
|
28
30
|
`stroke="currentColor"` or `fill="currentColor"` so they take the text colour.
|
|
@@ -40,8 +42,9 @@ classes and add behaviour. Without the CSS import nothing is styled.
|
|
|
40
42
|
| Choice | `Select` (native, few options), `Dropdown` (styled listbox), `Combobox` (searchable), `Checkbox`, `Radio`, `Switch`, `SegmentedControl`, `ChoiceChips`, `OptionCard` / `OptionCardGroup`, `Slider` |
|
|
41
43
|
| Date and time | `DateInput`, `DateRange`, `TimeInput`, `Calendar` |
|
|
42
44
|
| File | `FileUpload` |
|
|
45
|
+
| Page layout | `Stack` (column), `Inline` (row), `Grid` (columns), `Box` (spacing, width, surface, border), `Spacer` |
|
|
43
46
|
| Form layout | `FormGrid` (two columns, in dialogs), `FieldSlot` / `FieldPair`, `FormSection` + `FormSectionRow` (settings pages), `ActionFooter` (sticky save bar) |
|
|
44
|
-
| App frame | `AppBar` (top bar), `SideRail` + `RailItem` (icon navigation), `PageHeader` (band with tabs and actions), `PageTitle` (heading + count), `Toolbar` (search and filters) |
|
|
47
|
+
| App frame | `AppBar` (top bar), `SideRail` + `RailItem` (icon navigation; `expandable` shows labels on hover), `PageHeader` (band with tabs and actions), `PageTitle` (heading + count), `Toolbar` (search and filters) |
|
|
45
48
|
| Navigation | `Tabs` + `Tab`, `Breadcrumb`, `Pagination`, `Tree` + `TreeItem`, `StepNav` |
|
|
46
49
|
| Tabular data | `DataTable` (sorting, selection, loading and empty states) |
|
|
47
50
|
| Rows with detail | `List`, `ListRow`, `ListDetail`, `SubTable`, `Thumbnail`; `Accordion` |
|
|
@@ -147,6 +150,28 @@ Show a validation message on the field itself: `<Input label="Name" error hint="
|
|
|
147
150
|
</ActionFooter>
|
|
148
151
|
```
|
|
149
152
|
|
|
153
|
+
## Layout
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
<Stack gap={4} padding={5}>
|
|
157
|
+
<Inline gap={3}>
|
|
158
|
+
<Heading level={2}>Shops</Heading>
|
|
159
|
+
<Spacer />
|
|
160
|
+
<Button size="sm">Add</Button>
|
|
161
|
+
</Inline>
|
|
162
|
+
<Inline gap={4} align="start">
|
|
163
|
+
<Box width={192}><Caption label>Name</Caption></Box>
|
|
164
|
+
<Box grow><Input aria-label="Name" /></Box>
|
|
165
|
+
</Inline>
|
|
166
|
+
<Grid columns={3} gap={4}>…</Grid>
|
|
167
|
+
</Stack>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Spacing props (`gap`, `padding`, `paddingX`, `margin`…) take a step of the space scale
|
|
171
|
+
(0, 1, 2, 3, 4, 5, 6, 8, 10, 12 → 0–48px). `width`, `minWidth`, `maxWidth` and `height` are px.
|
|
172
|
+
`grow` takes the rest of a row, `scroll` scrolls overflow, `fullHeight` fills the parent.
|
|
173
|
+
`background` and `border` give a block a surface without making it a `Card`.
|
|
174
|
+
|
|
150
175
|
## Tokens
|
|
151
176
|
|
|
152
177
|
All values are CSS variables from `@kabobcompany/tokens`, loaded by `@kabobcompany/css`.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
export type ButtonVariant = 'primary' | 'secondary' | 'accent' | 'ghost' | 'subtle' | 'link' | 'danger' | 'danger-outline';
|
|
3
|
-
export type ButtonSize = 'sm' | 'md' | 'lg' | 'xl';
|
|
2
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'accent' | 'outline' | 'soft' | 'ghost' | 'subtle' | 'link' | 'danger' | 'danger-outline';
|
|
3
|
+
export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
4
4
|
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5
|
-
/** Visual style. `primary` teal, `secondary` slate, `accent` purple, `danger` coral (刪除), `danger-outline` (停用). */
|
|
5
|
+
/** Visual style. `primary` teal, `secondary` slate, `accent` purple, `outline` accent border and text (row actions such as View / Edit), `soft` tinted chip (add buttons in dense panels), `danger` coral (刪除), `danger-outline` (停用). */
|
|
6
6
|
variant?: ButtonVariant;
|
|
7
|
-
/** `sm` 32px / 12px text (toolbars), `md` 36px / 13px, `lg` 44px / 14px (dialog actions), `xl` 50px / radius 5 (mobile). */
|
|
7
|
+
/** `xs` 24px / 11px text (chips in dense panels), `sm` 32px / 12px text (toolbars), `md` 36px / 13px, `lg` 44px / 14px (dialog actions), `xl` 50px / radius 5 (mobile). */
|
|
8
8
|
size?: ButtonSize;
|
|
9
9
|
/** Pill shape with an icon slot, as used for 新增 / 下載 page actions. */
|
|
10
10
|
rounded?: boolean;
|
|
@@ -11,8 +11,12 @@ export interface DialogProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title
|
|
|
11
11
|
small?: boolean;
|
|
12
12
|
/** 960px variant (Info & Remote Access). */
|
|
13
13
|
large?: boolean;
|
|
14
|
+
/** Near full screen (80% of the viewport each way) for a work surface over a page; the body scrolls. */
|
|
15
|
+
full?: boolean;
|
|
14
16
|
/** Vertically centre instead of the 46px top offset. */
|
|
15
17
|
centered?: boolean;
|
|
18
|
+
/** `false` keeps the dialog open on a backdrop click (a form that would lose work). Escape and the close button still close. Default true. */
|
|
19
|
+
closeOnBackdrop?: boolean;
|
|
16
20
|
/** Hide the outside close button. */
|
|
17
21
|
hideClose?: boolean;
|
|
18
22
|
closeLabel?: string;
|
|
@@ -20,5 +24,6 @@ export interface DialogProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title
|
|
|
20
24
|
/**
|
|
21
25
|
* Modal lightbox (Figma 裝置設定). Black 50% backdrop, 840px white panel with header and footer dividers,
|
|
22
26
|
* close X outside the top-right corner. Closes on Escape and backdrop click.
|
|
27
|
+
* Focus moves into the panel when it opens, Tab stays inside it, and focus returns to the opener on close.
|
|
23
28
|
*/
|
|
24
|
-
export declare function Dialog({ open, onClose, title, footer, footerStart, small, large, centered, hideClose, closeLabel, className, children, ...rest }: DialogProps): import('react').JSX.Element | null;
|
|
29
|
+
export declare function Dialog({ open, onClose, title, footer, footerStart, small, large, full, centered, closeOnBackdrop, hideClose, closeLabel, className, children, ...rest }: DialogProps): import('react').JSX.Element | null;
|
|
@@ -24,9 +24,11 @@ export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>,
|
|
|
24
24
|
labelExtra?: ReactNode;
|
|
25
25
|
/** 16px decorative icon at the right edge (calendar, clock). */
|
|
26
26
|
trailingIcon?: ReactNode;
|
|
27
|
+
/** Monospace text (keys, templates). */
|
|
28
|
+
mono?: boolean;
|
|
27
29
|
}
|
|
28
30
|
/** Text input with optional label / hint. White surface, 1px border, radius 3. */
|
|
29
|
-
export declare function Input({ label, hint, error, small, large, size, searchIcon, suffix, action, labelExtra, trailingIcon, id, className, ...rest }: InputProps): import('react').JSX.Element;
|
|
31
|
+
export declare function Input({ label, hint, error, small, large, size, searchIcon, suffix, action, labelExtra, trailingIcon, mono, id, className, ...rest }: InputProps): import('react').JSX.Element;
|
|
30
32
|
/** Two-column form layout used in modals (Figma 裝置設定). Wrap a full-width field in `<FormGrid.Full>`. */
|
|
31
33
|
export declare function FormGrid({ className, children, ...rest }: HTMLAttributes<HTMLDivElement>): import('react').JSX.Element;
|
|
32
34
|
export declare namespace FormGrid {
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { ElementType, HTMLAttributes, ReactNode, Ref } from 'react';
|
|
2
|
+
/** A spacing step: `--kb-space-N` (0 = none). */
|
|
3
|
+
export type Space = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12;
|
|
4
|
+
export type Align = 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
5
|
+
export type Justify = 'start' | 'center' | 'end' | 'between';
|
|
6
|
+
export type Surface = 'canvas' | 'surface' | 'subtle' | 'muted' | 'band' | 'selected' | 'stage';
|
|
7
|
+
export type Border = boolean | 'faint' | 'top' | 'bottom' | 'start' | 'end';
|
|
8
|
+
export interface BoxProps extends Omit<HTMLAttributes<HTMLElement>, 'color'> {
|
|
9
|
+
/** Element to render. @default 'div' */
|
|
10
|
+
as?: ElementType;
|
|
11
|
+
/** Reaches the rendered element. */
|
|
12
|
+
ref?: Ref<HTMLElement>;
|
|
13
|
+
/** Padding on every side, then per axis / side (override `padding`). */
|
|
14
|
+
padding?: Space;
|
|
15
|
+
paddingX?: Space;
|
|
16
|
+
paddingY?: Space;
|
|
17
|
+
paddingTop?: Space;
|
|
18
|
+
paddingBottom?: Space;
|
|
19
|
+
/** Padding at the start / end of the line (left / right in left-to-right text). */
|
|
20
|
+
paddingStart?: Space;
|
|
21
|
+
paddingEnd?: Space;
|
|
22
|
+
/** Margin on every side, then per axis / side. */
|
|
23
|
+
margin?: Space;
|
|
24
|
+
marginX?: Space;
|
|
25
|
+
marginY?: Space;
|
|
26
|
+
marginTop?: Space;
|
|
27
|
+
marginBottom?: Space;
|
|
28
|
+
marginStart?: Space;
|
|
29
|
+
marginEnd?: Space;
|
|
30
|
+
/** Fixed width in px (does not shrink in a row). */
|
|
31
|
+
width?: number;
|
|
32
|
+
minWidth?: number;
|
|
33
|
+
/** Maximum width in px. With `center`, the box is centred in its parent. */
|
|
34
|
+
maxWidth?: number;
|
|
35
|
+
height?: number;
|
|
36
|
+
/** Minimum / maximum height: px, or a share of the viewport as `'60vh'`. */
|
|
37
|
+
minHeight?: number | `${number}vh`;
|
|
38
|
+
maxHeight?: number | `${number}vh`;
|
|
39
|
+
center?: boolean;
|
|
40
|
+
/** Take the remaining space in a row or column (`auto`: in proportion to content). */
|
|
41
|
+
grow?: boolean | 'auto';
|
|
42
|
+
/** Keep its size in a row or column. */
|
|
43
|
+
noShrink?: boolean;
|
|
44
|
+
/** Fill the parent's height (and let children scroll inside). */
|
|
45
|
+
fullHeight?: boolean;
|
|
46
|
+
fullWidth?: boolean;
|
|
47
|
+
/** The viewport's height (`full`, an app shell) or at least it (`min`, a page that grows). */
|
|
48
|
+
viewport?: 'full' | 'min';
|
|
49
|
+
/** Scroll its overflow. */
|
|
50
|
+
scroll?: boolean;
|
|
51
|
+
/** Clip its overflow. */
|
|
52
|
+
clip?: boolean;
|
|
53
|
+
relative?: boolean;
|
|
54
|
+
/** Cover the nearest positioned parent (position absolute, inset 0). */
|
|
55
|
+
overlay?: boolean;
|
|
56
|
+
/** Let pointer events through to what lies under it. */
|
|
57
|
+
passThrough?: boolean;
|
|
58
|
+
/** No text selection (drag surfaces). */
|
|
59
|
+
noSelect?: boolean;
|
|
60
|
+
/** Takes clicks again inside a `passThrough` overlay. */
|
|
61
|
+
takePointer?: boolean;
|
|
62
|
+
/** Pinned to a corner of the nearest positioned parent, `cornerOffset` from its edges. */
|
|
63
|
+
corner?: 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
|
|
64
|
+
cornerOffset?: Space;
|
|
65
|
+
/** Dimmed at half opacity (inactive, empty). */
|
|
66
|
+
muted?: boolean;
|
|
67
|
+
alignSelf?: 'start' | 'center' | 'end' | 'stretch';
|
|
68
|
+
background?: Surface;
|
|
69
|
+
border?: Border;
|
|
70
|
+
/** Colour of the border (default: the default border colour). */
|
|
71
|
+
borderTone?: 'error' | 'brand' | 'divider';
|
|
72
|
+
/** A 4px start border (with `border="start"`), the grouping bar of a card. */
|
|
73
|
+
borderStrong?: boolean;
|
|
74
|
+
/** Dashed instead of solid (with a border prop): drop targets, drafts. */
|
|
75
|
+
dashed?: boolean;
|
|
76
|
+
/** Stacking order among positioned siblings (1–3). */
|
|
77
|
+
layer?: 1 | 2 | 3;
|
|
78
|
+
/** A 2px accent ring (a picked or pointed-at item). */
|
|
79
|
+
ring?: boolean;
|
|
80
|
+
/** Focus outline when the block itself takes keyboard focus. */
|
|
81
|
+
focusRing?: boolean;
|
|
82
|
+
/** For media rendered as a Box (`as="video"` / `"img"`): fill the box, cropped (`cover`) or whole (`contain`). */
|
|
83
|
+
fit?: 'cover' | 'contain';
|
|
84
|
+
/** Tint on hover (a clickable row or block). */
|
|
85
|
+
hover?: boolean;
|
|
86
|
+
radius?: 'sm' | 'md' | 'lg';
|
|
87
|
+
shadow?: 'sm' | 'md';
|
|
88
|
+
children?: ReactNode;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* A plain block with spacing, size and surface from tokens: the layout atom.
|
|
92
|
+
* Use it where a component would otherwise need an ad-hoc wrapper with its own CSS.
|
|
93
|
+
*/
|
|
94
|
+
export declare function Box(props: BoxProps): import('react').JSX.Element;
|
|
95
|
+
export interface FlexProps extends BoxProps {
|
|
96
|
+
/** Space between children. */
|
|
97
|
+
gap?: Space;
|
|
98
|
+
/** Cross-axis alignment. Stack defaults to stretch, Inline to center. */
|
|
99
|
+
align?: Align;
|
|
100
|
+
justify?: Justify;
|
|
101
|
+
/** Let children wrap onto more lines (Inline). */
|
|
102
|
+
wrap?: boolean;
|
|
103
|
+
/** Inline: become a column below this breakpoint (sm 640, md 768, lg 1024, xl 1280). */
|
|
104
|
+
stackBelow?: Breakpoint;
|
|
105
|
+
}
|
|
106
|
+
export type Breakpoint = 'sm' | 'md' | 'lg' | 'xl';
|
|
107
|
+
/** Children in a column with a token gap. */
|
|
108
|
+
export declare function Stack({ gap, align, justify, wrap, stackBelow: _ignored, ...props }: FlexProps): import('react').JSX.Element;
|
|
109
|
+
/** Children in a row (centred vertically by default) with a token gap; `wrap` for a wrapping row. */
|
|
110
|
+
export declare function Inline({ gap, align, justify, wrap, stackBelow, ...props }: FlexProps): import('react').JSX.Element;
|
|
111
|
+
export interface GridProps extends BoxProps {
|
|
112
|
+
/** Equal columns (a number) or a `grid-template-columns` value. @default 1 */
|
|
113
|
+
columns?: number | string;
|
|
114
|
+
/** Instead of `columns`: as many columns as fit, each at least this many px wide. */
|
|
115
|
+
minColumnWidth?: number;
|
|
116
|
+
/** One column below this breakpoint. */
|
|
117
|
+
stackBelow?: Breakpoint;
|
|
118
|
+
gap?: Space;
|
|
119
|
+
/** Gap between rows / columns when they differ (override `gap`). */
|
|
120
|
+
rowGap?: Space;
|
|
121
|
+
columnGap?: Space;
|
|
122
|
+
align?: Align;
|
|
123
|
+
}
|
|
124
|
+
/** Children on a grid of columns with a token gap. */
|
|
125
|
+
export declare function Grid({ columns, minColumnWidth, stackBelow, gap, rowGap, columnGap, align, style, ...props }: GridProps): import('react').JSX.Element;
|
|
126
|
+
/** Pushes the items after it to the far end of a row or column. */
|
|
127
|
+
export declare function Spacer(): import('react').JSX.Element;
|
|
@@ -5,6 +5,10 @@ export interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement
|
|
|
5
5
|
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
6
6
|
/** Label above the control (12px bold). */
|
|
7
7
|
label?: ReactNode;
|
|
8
|
+
/** Helper or error text below the control (shown when `label` is set). */
|
|
9
|
+
hint?: ReactNode;
|
|
10
|
+
/** Marks the control invalid: red border (and red hint). */
|
|
11
|
+
error?: boolean;
|
|
8
12
|
}
|
|
9
13
|
/** Native select styled like Input, with the 10x5 chevron from Figma. Pass `<option>` children. */
|
|
10
|
-
export declare function Select({ small, size, label, id, className, children, ...rest }: SelectProps): import('react').JSX.Element;
|
|
14
|
+
export declare function Select({ small, size, label, hint, error, id, className, children, ...rest }: SelectProps): import('react').JSX.Element;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { AnchorHTMLAttributes, HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
export interface SideRailProps extends HTMLAttributes<HTMLElement> {
|
|
3
|
+
/** Widen over the page on hover or keyboard focus and show each item's label (sits in a 60px slot). */
|
|
4
|
+
expandable?: boolean;
|
|
3
5
|
}
|
|
4
6
|
/** 60px icon-only navigation rail. Compose with `RailItem`. */
|
|
5
|
-
export declare function SideRail({ className, children, ...rest }: SideRailProps): import('react').JSX.Element;
|
|
7
|
+
export declare function SideRail({ expandable, className, children, ...rest }: SideRailProps): import('react').JSX.Element;
|
|
6
8
|
export interface RailItemProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
7
9
|
/** Accessible name; the item shows only an icon. */
|
|
8
10
|
label: string;
|
|
@@ -7,5 +7,9 @@ export interface ToastProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
7
7
|
}
|
|
8
8
|
/** Dark bottom-centre notice (Figma 防止登出密碼設定成功). Render inside `ToastRegion`. */
|
|
9
9
|
export declare function Toast({ tone, onClose, className, children, ...rest }: ToastProps): import('react').JSX.Element;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
export interface ToastRegionProps extends HTMLAttributes<HTMLDivElement> {
|
|
11
|
+
/** `bottom` (default) for toasts; `top` for page notices under the app bar (e.g. an `Alert` after a save). */
|
|
12
|
+
placement?: 'bottom' | 'top';
|
|
13
|
+
}
|
|
14
|
+
/** Fixed container at the bottom (or top) centre of the viewport. */
|
|
15
|
+
export declare function ToastRegion({ placement, className, children, ...rest }: ToastRegionProps): import('react').JSX.Element;
|
|
@@ -2,7 +2,7 @@ import { HTMLAttributes, ReactNode } from 'react';
|
|
|
2
2
|
export type HeadingLevel = 1 | 2 | 3 | 4;
|
|
3
3
|
export type TextSize = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
4
4
|
export type TextWeight = 'regular' | 'medium' | 'bold';
|
|
5
|
-
export type TextTone = 'primary' | 'secondary' | 'muted' | 'brand' | 'error' | 'success' | 'inherit';
|
|
5
|
+
export type TextTone = 'primary' | 'secondary' | 'muted' | 'brand' | 'error' | 'warning' | 'success' | 'inherit';
|
|
6
6
|
export interface HeadingProps extends Omit<HTMLAttributes<HTMLHeadingElement>, 'color'> {
|
|
7
7
|
/**
|
|
8
8
|
* Visual level: 1 = 20px page title, 2 = 16px section / dialog title,
|
|
@@ -37,10 +37,20 @@ export interface TextProps extends Omit<HTMLAttributes<HTMLElement>, 'color'> {
|
|
|
37
37
|
lineClamp?: number;
|
|
38
38
|
/** `for` attribute when rendered as a `label`. */
|
|
39
39
|
htmlFor?: string;
|
|
40
|
+
/** Keep the line breaks written in the text. */
|
|
41
|
+
preLine?: boolean;
|
|
42
|
+
/** Capitals with a little letter spacing (section labels). */
|
|
43
|
+
uppercase?: boolean;
|
|
44
|
+
/** Monospace (keys, templates, codes). */
|
|
45
|
+
mono?: boolean;
|
|
46
|
+
/** Digits of equal width (counters, times). */
|
|
47
|
+
tabular?: boolean;
|
|
48
|
+
/** Text alignment. @default start */
|
|
49
|
+
align?: 'start' | 'center' | 'end';
|
|
40
50
|
children?: ReactNode;
|
|
41
51
|
}
|
|
42
52
|
/** Body text with size, weight, tone and overflow control. */
|
|
43
|
-
export declare function Text({ as: Tag, size, weight, tone, truncate, lineClamp, className, style, children, ...rest }: TextProps): import('react').JSX.Element;
|
|
53
|
+
export declare function Text({ as: Tag, size, weight, tone, truncate, lineClamp, preLine, uppercase, mono, tabular, align, className, style, children, ...rest }: TextProps): import('react').JSX.Element;
|
|
44
54
|
export interface CaptionProps extends HTMLAttributes<HTMLElement> {
|
|
45
55
|
/** Element to render. @default 'span' */
|
|
46
56
|
as?: 'span' | 'p' | 'div' | 'label' | 'figcaption';
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -127,17 +127,18 @@ function x({ children: e, asLabel: r, extra: i, className: a, ...o }) {
|
|
|
127
127
|
}
|
|
128
128
|
//#endregion
|
|
129
129
|
//#region src/components/Input/Input.tsx
|
|
130
|
-
function S({ label: e, hint: r, error: i, small: a, large: o, size: s, searchIcon: c, suffix: l, action: u, labelExtra: f, trailingIcon: p,
|
|
131
|
-
let
|
|
130
|
+
function S({ label: e, hint: r, error: i, small: a, large: o, size: s, searchIcon: c, suffix: l, action: u, labelExtra: f, trailingIcon: p, mono: m, id: h, className: g, ..._ }) {
|
|
131
|
+
let v = d(), y = h ?? v, b = [
|
|
132
132
|
"kb-input",
|
|
133
133
|
s ? `kb-input--${s}` : a ? "kb-input--sm" : o ? "kb-input--lg" : null,
|
|
134
134
|
c && "kb-input--search",
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
135
|
+
m && "kb-input--mono",
|
|
136
|
+
g
|
|
137
|
+
].filter(Boolean).join(" "), x = /* @__PURE__ */ t("input", {
|
|
138
|
+
id: y,
|
|
139
|
+
className: b,
|
|
140
|
+
..._
|
|
141
|
+
}), S = c || l || u || p ? /* @__PURE__ */ n("div", {
|
|
141
142
|
className: "kb-input-group",
|
|
142
143
|
children: [
|
|
143
144
|
c ? /* @__PURE__ */ t("span", {
|
|
@@ -145,7 +146,7 @@ function S({ label: e, hint: r, error: i, small: a, large: o, size: s, searchIco
|
|
|
145
146
|
"aria-hidden": "true",
|
|
146
147
|
children: c
|
|
147
148
|
}) : null,
|
|
148
|
-
|
|
149
|
+
x,
|
|
149
150
|
l ? /* @__PURE__ */ t("span", {
|
|
150
151
|
className: "kb-input-group__suffix",
|
|
151
152
|
children: l
|
|
@@ -160,16 +161,16 @@ function S({ label: e, hint: r, error: i, small: a, large: o, size: s, searchIco
|
|
|
160
161
|
children: u
|
|
161
162
|
}) : null
|
|
162
163
|
]
|
|
163
|
-
}) :
|
|
164
|
-
return !e && !r ?
|
|
164
|
+
}) : x;
|
|
165
|
+
return !e && !r ? S : /* @__PURE__ */ n("div", {
|
|
165
166
|
className: ["kb-field", i && "kb-field--error"].filter(Boolean).join(" "),
|
|
166
167
|
children: [
|
|
167
168
|
e ? /* @__PURE__ */ n("label", {
|
|
168
169
|
className: "kb-field__label",
|
|
169
|
-
htmlFor:
|
|
170
|
+
htmlFor: y,
|
|
170
171
|
children: [e, f]
|
|
171
172
|
}) : null,
|
|
172
|
-
|
|
173
|
+
S,
|
|
173
174
|
r ? /* @__PURE__ */ t("p", {
|
|
174
175
|
className: "kb-field__hint",
|
|
175
176
|
children: r
|
|
@@ -270,28 +271,37 @@ function k({ className: e, children: n, ...r }) {
|
|
|
270
271
|
}
|
|
271
272
|
//#endregion
|
|
272
273
|
//#region src/components/Select/Select.tsx
|
|
273
|
-
function A({ small: e, size: r, label: i,
|
|
274
|
-
let
|
|
274
|
+
function A({ small: e, size: r, label: i, hint: a, error: o, id: s, className: c, children: l, ...u }) {
|
|
275
|
+
let f = d(), p = s ?? f, m = /* @__PURE__ */ t("div", {
|
|
275
276
|
className: [
|
|
276
277
|
"kb-select",
|
|
277
278
|
r ? `kb-select--${r}` : e && "kb-select--sm",
|
|
278
|
-
o
|
|
279
|
+
o && "kb-select--error",
|
|
280
|
+
c
|
|
279
281
|
].filter(Boolean).join(" "),
|
|
280
282
|
children: /* @__PURE__ */ t("select", {
|
|
281
|
-
id:
|
|
283
|
+
id: p,
|
|
282
284
|
className: "kb-select__native",
|
|
283
|
-
|
|
284
|
-
|
|
285
|
+
"aria-invalid": o || void 0,
|
|
286
|
+
...u,
|
|
287
|
+
children: l
|
|
285
288
|
})
|
|
286
289
|
});
|
|
287
|
-
return i ? /* @__PURE__ */ n("div", {
|
|
288
|
-
className: "kb-field",
|
|
289
|
-
children: [
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
290
|
+
return !i && !a ? m : /* @__PURE__ */ n("div", {
|
|
291
|
+
className: ["kb-field", o && "kb-field--error"].filter(Boolean).join(" "),
|
|
292
|
+
children: [
|
|
293
|
+
i ? /* @__PURE__ */ t("label", {
|
|
294
|
+
className: "kb-field__label",
|
|
295
|
+
htmlFor: p,
|
|
296
|
+
children: i
|
|
297
|
+
}) : null,
|
|
298
|
+
m,
|
|
299
|
+
a ? /* @__PURE__ */ t("span", {
|
|
300
|
+
className: "kb-field__hint",
|
|
301
|
+
children: a
|
|
302
|
+
}) : null
|
|
303
|
+
]
|
|
304
|
+
});
|
|
295
305
|
}
|
|
296
306
|
//#endregion
|
|
297
307
|
//#region src/components/Tabs/Tabs.tsx
|
|
@@ -632,7 +642,7 @@ function ne({ title: e, width: r, grow: i, className: a, style: o, children: s,
|
|
|
632
642
|
}
|
|
633
643
|
//#endregion
|
|
634
644
|
//#region src/components/AppBar/AppBar.tsx
|
|
635
|
-
function
|
|
645
|
+
function J({ logo: r, wordmark: i, actions: a, tenant: o, editor: s, title: c, className: l, children: u, ...d }) {
|
|
636
646
|
let f = [
|
|
637
647
|
"kb-app-bar",
|
|
638
648
|
s && "kb-app-bar--editor",
|
|
@@ -677,7 +687,7 @@ function re({ logo: r, wordmark: i, actions: a, tenant: o, editor: s, title: c,
|
|
|
677
687
|
] })
|
|
678
688
|
});
|
|
679
689
|
}
|
|
680
|
-
function
|
|
690
|
+
function re({ icon: e, className: t, children: r, ...i }) {
|
|
681
691
|
return /* @__PURE__ */ n("span", {
|
|
682
692
|
className: ["kb-app-bar__chip", t].filter(Boolean).join(" "),
|
|
683
693
|
...i,
|
|
@@ -686,7 +696,7 @@ function ie({ icon: e, className: t, children: r, ...i }) {
|
|
|
686
696
|
}
|
|
687
697
|
//#endregion
|
|
688
698
|
//#region src/components/PageHeader/PageHeader.tsx
|
|
689
|
-
function
|
|
699
|
+
function ie({ tabs: e, actions: r, title: i, onBack: a, className: o, children: s, ...c }) {
|
|
690
700
|
return /* @__PURE__ */ n("div", {
|
|
691
701
|
className: [
|
|
692
702
|
"kb-page-header",
|
|
@@ -740,28 +750,40 @@ function oe({ className: e, children: n, ...r }) {
|
|
|
740
750
|
}
|
|
741
751
|
//#endregion
|
|
742
752
|
//#region src/components/SideRail/SideRail.tsx
|
|
743
|
-
function se({
|
|
744
|
-
|
|
745
|
-
className: [
|
|
746
|
-
|
|
747
|
-
|
|
753
|
+
function se({ expandable: e, className: n, children: r, ...i }) {
|
|
754
|
+
let a = /* @__PURE__ */ t("nav", {
|
|
755
|
+
className: [
|
|
756
|
+
"kb-rail",
|
|
757
|
+
e && "kb-rail--expandable",
|
|
758
|
+
n
|
|
759
|
+
].filter(Boolean).join(" "),
|
|
760
|
+
...i,
|
|
761
|
+
children: r
|
|
748
762
|
});
|
|
763
|
+
return e ? /* @__PURE__ */ t("div", {
|
|
764
|
+
className: "kb-rail-slot",
|
|
765
|
+
children: a
|
|
766
|
+
}) : a;
|
|
749
767
|
}
|
|
750
|
-
function ce({ label: e, active:
|
|
751
|
-
let
|
|
768
|
+
function ce({ label: e, active: r, bottom: i, dot: a, className: o, children: s, ...c }) {
|
|
769
|
+
let l = [
|
|
752
770
|
"kb-rail__item",
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
771
|
+
r && "kb-rail__item--active",
|
|
772
|
+
i && "kb-rail__item--bottom",
|
|
773
|
+
a && "kb-rail__item--dot",
|
|
774
|
+
o
|
|
757
775
|
].filter(Boolean).join(" ");
|
|
758
|
-
return /* @__PURE__ */
|
|
759
|
-
className:
|
|
776
|
+
return /* @__PURE__ */ n("a", {
|
|
777
|
+
className: l,
|
|
760
778
|
"aria-label": e,
|
|
761
779
|
title: e,
|
|
762
|
-
"aria-current":
|
|
763
|
-
...
|
|
764
|
-
children:
|
|
780
|
+
"aria-current": r ? "page" : void 0,
|
|
781
|
+
...c,
|
|
782
|
+
children: [s, /* @__PURE__ */ t("span", {
|
|
783
|
+
className: "kb-rail__label",
|
|
784
|
+
"aria-hidden": "true",
|
|
785
|
+
children: e
|
|
786
|
+
})]
|
|
765
787
|
});
|
|
766
788
|
}
|
|
767
789
|
//#endregion
|
|
@@ -855,31 +877,50 @@ function pe({ tone: e = "neutral", icon: r, label: i, className: a, children: o,
|
|
|
855
877
|
}
|
|
856
878
|
//#endregion
|
|
857
879
|
//#region src/components/Dialog/Dialog.tsx
|
|
858
|
-
function me({ open: e, onClose: r, title: i, footer: a, footerStart: o, small: s, large: c,
|
|
859
|
-
let
|
|
860
|
-
|
|
880
|
+
function me({ open: e, onClose: r, title: i, footer: a, footerStart: o, small: s, large: c, full: l, centered: f, closeOnBackdrop: p = !0, hideClose: h, closeLabel: g = "Close", className: _, children: v, ...y }) {
|
|
881
|
+
let b = d();
|
|
882
|
+
u(() => {
|
|
861
883
|
if (!e) return;
|
|
862
884
|
let t = (e) => e.key === "Escape" && r();
|
|
863
885
|
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
864
|
-
}, [e, r])
|
|
865
|
-
|
|
866
|
-
|
|
886
|
+
}, [e, r]);
|
|
887
|
+
let x = m(null);
|
|
888
|
+
return u(() => {
|
|
889
|
+
if (!e) return;
|
|
890
|
+
let t = document.activeElement instanceof HTMLElement ? document.activeElement : null, n = x.current;
|
|
891
|
+
return n && !n.contains(document.activeElement) && n.focus(), () => t?.focus();
|
|
892
|
+
}, [e]), e ? /* @__PURE__ */ t("div", {
|
|
893
|
+
className: ["kb-dialog-backdrop", f && "kb-dialog-backdrop--centered"].filter(Boolean).join(" "),
|
|
894
|
+
onMouseDown: (e) => p && e.target === e.currentTarget && r(),
|
|
867
895
|
children: /* @__PURE__ */ n("div", {
|
|
896
|
+
ref: x,
|
|
868
897
|
role: "dialog",
|
|
869
898
|
"aria-modal": "true",
|
|
870
|
-
|
|
899
|
+
tabIndex: -1,
|
|
900
|
+
onKeyDown: (e) => {
|
|
901
|
+
if (e.key !== "Tab" || !x.current) return;
|
|
902
|
+
let t = Array.from(x.current.querySelectorAll("a[href], button:not([disabled]), input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])"));
|
|
903
|
+
if (t.length === 0) {
|
|
904
|
+
e.preventDefault();
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
let n = t[0], r = t[t.length - 1], i = document.activeElement;
|
|
908
|
+
e.shiftKey && (i === n || i === x.current) ? (e.preventDefault(), r.focus()) : !e.shiftKey && i === r && (e.preventDefault(), n.focus());
|
|
909
|
+
},
|
|
910
|
+
"aria-labelledby": i ? b : void 0,
|
|
871
911
|
className: [
|
|
872
912
|
"kb-dialog",
|
|
873
913
|
s && "kb-dialog--sm",
|
|
874
914
|
c && "kb-dialog--lg",
|
|
875
|
-
|
|
915
|
+
l && "kb-dialog--full",
|
|
916
|
+
_
|
|
876
917
|
].filter(Boolean).join(" "),
|
|
877
|
-
...
|
|
918
|
+
...y,
|
|
878
919
|
children: [
|
|
879
|
-
|
|
920
|
+
h ? null : /* @__PURE__ */ t("button", {
|
|
880
921
|
type: "button",
|
|
881
922
|
className: "kb-dialog__close",
|
|
882
|
-
"aria-label":
|
|
923
|
+
"aria-label": g,
|
|
883
924
|
onClick: r,
|
|
884
925
|
children: /* @__PURE__ */ t("svg", {
|
|
885
926
|
viewBox: "0 0 20 20",
|
|
@@ -894,13 +935,13 @@ function me({ open: e, onClose: r, title: i, footer: a, footerStart: o, small: s
|
|
|
894
935
|
className: "kb-dialog__header",
|
|
895
936
|
children: /* @__PURE__ */ t("h2", {
|
|
896
937
|
className: "kb-dialog__title",
|
|
897
|
-
id:
|
|
938
|
+
id: b,
|
|
898
939
|
children: i
|
|
899
940
|
})
|
|
900
941
|
}) : null,
|
|
901
942
|
/* @__PURE__ */ t("div", {
|
|
902
943
|
className: "kb-dialog__body",
|
|
903
|
-
children:
|
|
944
|
+
children: v
|
|
904
945
|
}),
|
|
905
946
|
a || o ? /* @__PURE__ */ n("div", {
|
|
906
947
|
className: "kb-dialog__footer",
|
|
@@ -1107,12 +1148,16 @@ function Te({ tone: e = "neutral", onClose: r, className: i, children: a, ...o }
|
|
|
1107
1148
|
}) : null]
|
|
1108
1149
|
});
|
|
1109
1150
|
}
|
|
1110
|
-
function Ee({
|
|
1151
|
+
function Ee({ placement: e = "bottom", className: n, children: r, ...i }) {
|
|
1111
1152
|
return /* @__PURE__ */ t("div", {
|
|
1112
|
-
className: [
|
|
1153
|
+
className: [
|
|
1154
|
+
"kb-toast-region",
|
|
1155
|
+
e === "top" && "kb-toast-region--top",
|
|
1156
|
+
n
|
|
1157
|
+
].filter(Boolean).join(" "),
|
|
1113
1158
|
"aria-live": "polite",
|
|
1114
|
-
...
|
|
1115
|
-
children:
|
|
1159
|
+
...i,
|
|
1160
|
+
children: r
|
|
1116
1161
|
});
|
|
1117
1162
|
}
|
|
1118
1163
|
//#endregion
|
|
@@ -1935,7 +1980,7 @@ function lt(e) {
|
|
|
1935
1980
|
break;
|
|
1936
1981
|
default: t.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && K(t);
|
|
1937
1982
|
}
|
|
1938
|
-
}, te = r.filter((e) => F.includes(e.value)), q = te.map((e) => e.label).join(", "), ne = s ?? (v ? void 0 : te[0]?.icon),
|
|
1983
|
+
}, te = r.filter((e) => F.includes(e.value)), q = te.map((e) => e.label).join(", "), ne = s ?? (v ? void 0 : te[0]?.icon), J = /* @__PURE__ */ n("div", {
|
|
1939
1984
|
ref: B,
|
|
1940
1985
|
className: [
|
|
1941
1986
|
"kb-dropdown",
|
|
@@ -2037,7 +2082,7 @@ function lt(e) {
|
|
|
2037
2082
|
}, e)) : null
|
|
2038
2083
|
]
|
|
2039
2084
|
});
|
|
2040
|
-
return !c && !l ?
|
|
2085
|
+
return !c && !l ? J : /* @__PURE__ */ n("div", {
|
|
2041
2086
|
className: ["kb-field", f && "kb-field--error"].filter(Boolean).join(" "),
|
|
2042
2087
|
children: [
|
|
2043
2088
|
c ? /* @__PURE__ */ t("label", {
|
|
@@ -2045,7 +2090,7 @@ function lt(e) {
|
|
|
2045
2090
|
htmlFor: A,
|
|
2046
2091
|
children: c
|
|
2047
2092
|
}) : null,
|
|
2048
|
-
|
|
2093
|
+
J,
|
|
2049
2094
|
l ? /* @__PURE__ */ t("p", {
|
|
2050
2095
|
className: "kb-field__hint",
|
|
2051
2096
|
children: l
|
|
@@ -4089,7 +4134,7 @@ function Cn({ value: e, defaultValue: r, onChange: i, onChangeEnd: a, min: o = 0
|
|
|
4089
4134
|
let e = Math.floor(F / c);
|
|
4090
4135
|
if (e <= 50) for (let t = 0; t <= e; t++) K.push({ value: Number((o + t * c).toFixed(I)) });
|
|
4091
4136
|
} else if (Array.isArray(f)) for (let e of f) K.push(typeof e == "number" ? { value: e } : e);
|
|
4092
|
-
let ee = O ? k[0] : o, te = O ? k[1] : k[0], q = (e) => e >= ee && e <= te, ne = K.some((e) => e.label != null),
|
|
4137
|
+
let ee = O ? k[0] : o, te = O ? k[1] : k[0], q = (e) => e >= ee && e <= te, ne = K.some((e) => e.label != null), J = g ?? p != null, re = O ? `${v(k[0])} – ${v(k[1])}` : v(k[0]), ie = Array.isArray(y) ? y : y ? [y, y] : O ? ["Minimum", "Maximum"] : [], ae = [
|
|
4093
4138
|
"kb-slider",
|
|
4094
4139
|
b === "sm" && "kb-slider--sm",
|
|
4095
4140
|
_ === "always" && "kb-slider--tooltip-always",
|
|
@@ -4101,16 +4146,16 @@ function Cn({ value: e, defaultValue: r, onChange: i, onChangeEnd: a, min: o = 0
|
|
|
4101
4146
|
"aria-disabled": x || void 0,
|
|
4102
4147
|
...w,
|
|
4103
4148
|
children: [
|
|
4104
|
-
p != null ||
|
|
4149
|
+
p != null || J ? /* @__PURE__ */ n("div", {
|
|
4105
4150
|
className: "kb-slider__header",
|
|
4106
4151
|
children: [p == null ? /* @__PURE__ */ t("span", {}) : /* @__PURE__ */ t("span", {
|
|
4107
4152
|
className: "kb-slider__label",
|
|
4108
4153
|
id: P,
|
|
4109
4154
|
children: p
|
|
4110
|
-
}),
|
|
4155
|
+
}), J ? /* @__PURE__ */ t("output", {
|
|
4111
4156
|
className: "kb-slider__output",
|
|
4112
4157
|
"aria-live": "off",
|
|
4113
|
-
children:
|
|
4158
|
+
children: re
|
|
4114
4159
|
}) : null]
|
|
4115
4160
|
}) : null,
|
|
4116
4161
|
/* @__PURE__ */ n("div", {
|
|
@@ -4144,8 +4189,8 @@ function Cn({ value: e, defaultValue: r, onChange: i, onChangeEnd: a, min: o = 0
|
|
|
4144
4189
|
"aria-valuetext": v(e),
|
|
4145
4190
|
"aria-orientation": "horizontal",
|
|
4146
4191
|
"aria-disabled": x || void 0,
|
|
4147
|
-
"aria-labelledby": p != null && !
|
|
4148
|
-
"aria-label":
|
|
4192
|
+
"aria-labelledby": p != null && !ie[n] ? P : void 0,
|
|
4193
|
+
"aria-label": ie[n] ? typeof p == "string" ? `${p} ${ie[n]}` : ie[n] : void 0,
|
|
4149
4194
|
onKeyDown: G(n),
|
|
4150
4195
|
children: _ === "none" ? null : /* @__PURE__ */ t("span", {
|
|
4151
4196
|
className: "kb-slider__tooltip",
|
|
@@ -4271,7 +4316,7 @@ function An({ children: i, aspectRatio: a, index: o, defaultIndex: s = 0, onInde
|
|
|
4271
4316
|
D?.(e), e.target.matches(":focus-visible") && H(!0);
|
|
4272
4317
|
}, q = (e) => {
|
|
4273
4318
|
O?.(e), e.currentTarget.contains(e.relatedTarget) || H(!1);
|
|
4274
|
-
}, ne = M || F > 0,
|
|
4319
|
+
}, ne = M || F > 0, J = M || F < j - 1, re = y === "slide" ? { transform: `translateX(${-F * 100}%)` } : void 0, ie = a == null ? void 0 : { aspectRatio: String(a) }, ae = _ && j > 1 || f ? /* @__PURE__ */ n("div", {
|
|
4275
4320
|
className: "kb-carousel__footer",
|
|
4276
4321
|
children: [_ && j > 1 ? /* @__PURE__ */ t("div", {
|
|
4277
4322
|
className: "kb-carousel__dots",
|
|
@@ -4308,11 +4353,11 @@ function An({ children: i, aspectRatio: a, index: o, defaultIndex: s = 0, onInde
|
|
|
4308
4353
|
...k,
|
|
4309
4354
|
children: [/* @__PURE__ */ n("div", {
|
|
4310
4355
|
className: "kb-carousel__viewport",
|
|
4311
|
-
style:
|
|
4356
|
+
style: ie,
|
|
4312
4357
|
children: [
|
|
4313
4358
|
/* @__PURE__ */ t("div", {
|
|
4314
4359
|
className: "kb-carousel__track",
|
|
4315
|
-
style:
|
|
4360
|
+
style: re,
|
|
4316
4361
|
"aria-live": W ? "off" : "polite",
|
|
4317
4362
|
children: A.map((e, n) => /* @__PURE__ */ t("div", {
|
|
4318
4363
|
ref: (e) => {
|
|
@@ -4337,7 +4382,7 @@ function An({ children: i, aspectRatio: a, index: o, defaultIndex: s = 0, onInde
|
|
|
4337
4382
|
type: "button",
|
|
4338
4383
|
className: "kb-carousel__nav kb-carousel__nav--next",
|
|
4339
4384
|
"aria-label": S.next ?? "Next slide",
|
|
4340
|
-
disabled: !
|
|
4385
|
+
disabled: !J,
|
|
4341
4386
|
onClick: () => G(F + 1),
|
|
4342
4387
|
children: /* @__PURE__ */ t(Dn, {})
|
|
4343
4388
|
})] }) : null,
|
|
@@ -4421,13 +4466,13 @@ function In({ level: e = 2, as: n, tone: r, truncate: i, lineClamp: a, className
|
|
|
4421
4466
|
children: c
|
|
4422
4467
|
});
|
|
4423
4468
|
}
|
|
4424
|
-
function Ln({ as: e = "p", size: n, weight: r, tone: i, truncate: a, lineClamp: o,
|
|
4425
|
-
let
|
|
4469
|
+
function Ln({ as: e = "p", size: n, weight: r, tone: i, truncate: a, lineClamp: o, preLine: s, uppercase: c, mono: l, tabular: u, align: d, className: f, style: p, children: m, ...h }) {
|
|
4470
|
+
let g = Fn("kb-text", a, o, p);
|
|
4426
4471
|
return /* @__PURE__ */ t(e, {
|
|
4427
|
-
className: Pn("kb-text", n && n !== "xs" && `kb-text--${n}`, r && r !== "regular" && `kb-text--${r}`, i && i !== "primary" && `kb-text--${i}`, d.className,
|
|
4428
|
-
style:
|
|
4429
|
-
...
|
|
4430
|
-
children:
|
|
4472
|
+
className: Pn("kb-text", n && n !== "xs" && `kb-text--${n}`, r && r !== "regular" && `kb-text--${r}`, i && i !== "primary" && `kb-text--${i}`, s && "kb-text--pre-line", c && "kb-text--uppercase", l && "kb-text--mono", u && "kb-text--tabular", d && d !== "start" && `kb-text--${d}`, g.className, f),
|
|
4473
|
+
style: g.style,
|
|
4474
|
+
...h,
|
|
4475
|
+
children: m
|
|
4431
4476
|
});
|
|
4432
4477
|
}
|
|
4433
4478
|
function Rn({ as: e = "span", label: n, className: r, children: i, ...a }) {
|
|
@@ -4932,4 +4977,99 @@ function or({ options: r, value: i, defaultValue: a = null, onChange: o, filter:
|
|
|
4932
4977
|
}) : U;
|
|
4933
4978
|
}
|
|
4934
4979
|
//#endregion
|
|
4935
|
-
|
|
4980
|
+
//#region src/components/Layout/Layout.tsx
|
|
4981
|
+
var sr = {
|
|
4982
|
+
true: "kb-border",
|
|
4983
|
+
faint: "kb-border-faint",
|
|
4984
|
+
top: "kb-border-top",
|
|
4985
|
+
bottom: "kb-border-bottom",
|
|
4986
|
+
start: "kb-border-start",
|
|
4987
|
+
end: "kb-border-end"
|
|
4988
|
+
};
|
|
4989
|
+
function cr(e) {
|
|
4990
|
+
let t = [], n = (e, n) => {
|
|
4991
|
+
n !== void 0 && t.push(`kb-${e}-${n}`);
|
|
4992
|
+
};
|
|
4993
|
+
n("p", e.padding), n("px", e.paddingX), n("py", e.paddingY), n("pt", e.paddingTop), n("pb", e.paddingBottom), n("ps", e.paddingStart), n("pe", e.paddingEnd), n("m", e.margin), n("mx", e.marginX), n("my", e.marginY), n("mt", e.marginTop), n("mb", e.marginBottom), n("ms", e.marginStart), n("me", e.marginEnd);
|
|
4994
|
+
let r = {};
|
|
4995
|
+
e.width !== void 0 && (t.push("kb-w"), r["--kb-box-width"] = `${e.width}px`), e.minWidth !== void 0 && (t.push("kb-min-w"), r["--kb-box-min-width"] = `${e.minWidth}px`), e.maxWidth !== void 0 && (t.push("kb-max-w"), r["--kb-box-max-width"] = `${e.maxWidth}px`), e.height !== void 0 && (t.push("kb-h"), r["--kb-box-height"] = `${e.height}px`);
|
|
4996
|
+
let i = (e) => typeof e == "number" ? `${e}px` : e;
|
|
4997
|
+
return e.minHeight !== void 0 && (t.push("kb-min-h"), r["--kb-box-min-height"] = i(e.minHeight)), e.maxHeight !== void 0 && (t.push("kb-max-h"), r["--kb-box-max-height"] = i(e.maxHeight)), e.takePointer && t.push("kb-take-pointer"), e.corner && (t.push("kb-corner", `kb-corner--${e.corner}`), e.cornerOffset && (r["--kb-corner-offset"] = `var(--kb-space-${e.cornerOffset})`)), e.muted && t.push("kb-muted"), e.borderStrong && t.push("kb-border-strong"), e.dashed && t.push("kb-border-dashed"), e.layer && t.push(`kb-layer-${e.layer}`), e.ring && t.push("kb-ring"), e.focusRing && t.push("kb-focus-ring"), e.fit && t.push(`kb-${e.fit}`), e.center && t.push("kb-center"), e.grow === !0 && t.push("kb-grow"), e.grow === "auto" && t.push("kb-grow-auto"), e.noShrink && t.push("kb-no-shrink"), e.fullHeight && t.push("kb-full-height"), e.fullWidth && t.push("kb-full-width"), e.viewport === "full" && t.push("kb-viewport"), e.viewport === "min" && t.push("kb-min-viewport"), e.scroll && t.push("kb-scroll"), e.clip && t.push("kb-clip"), e.relative && t.push("kb-relative"), e.overlay && t.push("kb-overlay"), e.passThrough && t.push("kb-pass-through"), e.noSelect && t.push("kb-no-select"), e.alignSelf && t.push(`kb-self-${e.alignSelf}`), e.background && t.push(`kb-bg-${e.background}`), e.border && t.push(sr[String(e.border)]), e.borderTone && t.push(`kb-border-tone-${e.borderTone}`), e.hover && t.push("kb-hover"), e.radius && t.push(`kb-radius-${e.radius}`), e.shadow && t.push(`kb-shadow-${e.shadow}`), {
|
|
4998
|
+
classes: t,
|
|
4999
|
+
style: r
|
|
5000
|
+
};
|
|
5001
|
+
}
|
|
5002
|
+
var lr = /* @__PURE__ */ "as.padding.paddingX.paddingY.paddingTop.paddingBottom.paddingStart.paddingEnd.margin.marginX.marginY.marginTop.marginBottom.marginStart.marginEnd.width.minWidth.maxWidth.height.minHeight.maxHeight.takePointer.corner.cornerOffset.muted.borderStrong.dashed.layer.ring.focusRing.fit.center.grow.noShrink.fullHeight.fullWidth.viewport.scroll.clip.relative.overlay.passThrough.noSelect.alignSelf.background.border.borderTone.hover.radius.shadow".split(".");
|
|
5003
|
+
function ur(e, n) {
|
|
5004
|
+
let { classes: r, style: i } = cr(n), a = { ...n };
|
|
5005
|
+
for (let e of lr) delete a[e];
|
|
5006
|
+
let { className: o, style: s, children: c, ...l } = a, u = n.as ?? "div";
|
|
5007
|
+
return /* @__PURE__ */ t(u, {
|
|
5008
|
+
className: [
|
|
5009
|
+
...e,
|
|
5010
|
+
...r,
|
|
5011
|
+
o
|
|
5012
|
+
].filter(Boolean).join(" "),
|
|
5013
|
+
style: {
|
|
5014
|
+
...i,
|
|
5015
|
+
...s
|
|
5016
|
+
},
|
|
5017
|
+
...l,
|
|
5018
|
+
children: c
|
|
5019
|
+
});
|
|
5020
|
+
}
|
|
5021
|
+
function dr(e) {
|
|
5022
|
+
return ur(["kb-box"], e);
|
|
5023
|
+
}
|
|
5024
|
+
function fr({ gap: e, align: t, justify: n, wrap: r, stackBelow: i }) {
|
|
5025
|
+
return [
|
|
5026
|
+
i ? `kb-stack-below-${i}` : "",
|
|
5027
|
+
e === void 0 ? "" : `kb-gap-${e}`,
|
|
5028
|
+
t ? `kb-align-${t}` : "",
|
|
5029
|
+
n ? `kb-justify-${n}` : "",
|
|
5030
|
+
r ? "kb-wrap" : ""
|
|
5031
|
+
];
|
|
5032
|
+
}
|
|
5033
|
+
function pr({ gap: e, align: t, justify: n, wrap: r, stackBelow: i, ...a }) {
|
|
5034
|
+
return ur(["kb-stack", ...fr({
|
|
5035
|
+
gap: e,
|
|
5036
|
+
align: t,
|
|
5037
|
+
justify: n,
|
|
5038
|
+
wrap: r
|
|
5039
|
+
})], a);
|
|
5040
|
+
}
|
|
5041
|
+
function mr({ gap: e, align: t, justify: n, wrap: r, stackBelow: i, ...a }) {
|
|
5042
|
+
return ur(["kb-inline", ...fr({
|
|
5043
|
+
gap: e,
|
|
5044
|
+
align: t,
|
|
5045
|
+
justify: n,
|
|
5046
|
+
wrap: r,
|
|
5047
|
+
stackBelow: i
|
|
5048
|
+
})], a);
|
|
5049
|
+
}
|
|
5050
|
+
function hr({ columns: e = 1, minColumnWidth: t, stackBelow: n, gap: r, rowGap: i, columnGap: a, align: o, style: s, ...c }) {
|
|
5051
|
+
let l = typeof e == "number" ? `repeat(${e}, minmax(0, 1fr))` : e, u = t === void 0 ? { "--kb-grid-columns": l } : { "--kb-grid-min": `${t}px` }, d = (e) => e === void 0 ? void 0 : e === 0 ? "0" : `var(--kb-space-${e})`;
|
|
5052
|
+
return ur([
|
|
5053
|
+
"kb-grid",
|
|
5054
|
+
t === void 0 ? "" : "kb-grid--fit",
|
|
5055
|
+
n ? `kb-stack-below-${n}` : "",
|
|
5056
|
+
r === void 0 ? "" : `kb-gap-${r}`,
|
|
5057
|
+
o ? `kb-align-${o}` : ""
|
|
5058
|
+
], {
|
|
5059
|
+
...c,
|
|
5060
|
+
style: {
|
|
5061
|
+
...u,
|
|
5062
|
+
rowGap: d(i),
|
|
5063
|
+
columnGap: d(a),
|
|
5064
|
+
...s
|
|
5065
|
+
}
|
|
5066
|
+
});
|
|
5067
|
+
}
|
|
5068
|
+
function gr() {
|
|
5069
|
+
return /* @__PURE__ */ t("span", {
|
|
5070
|
+
className: "kb-spacer",
|
|
5071
|
+
"aria-hidden": "true"
|
|
5072
|
+
});
|
|
5073
|
+
}
|
|
5074
|
+
//#endregion
|
|
5075
|
+
export { yt as Accordion, bt as AccordionItem, xt as AccordionRow, zt as ActionFooter, Mt as Alert, J as AppBar, re as AppBarChip, cn as ArrowButton, bn as Avatar, xn as AvatarGroup, P as Badge, dr as Box, Pt as Breadcrumb, _ as Button, nn as CLOCK_DEFAULT_PATTERN, ke as Calendar, Rn as Caption, H as Card, An as Carousel, y as Checkbox, _t as ChoiceChips, an as Clock, O as ColorInput, or as Combobox, ir as ContextMenu, Zt as CounterTile, Dt as DataTable, D as DateInput, dt as DateRange, Pe as DescriptionList, me as Dialog, It as Drawer, lt as Dropdown, nr as DropdownMenu, We as EditorPanelFooter, Ue as EditorPanelHeader, He as EditorSidebar, Ot as EmptyState, Ae as EventCard, k as FieldPair, w as FieldSlot, gt as FileUpload, be as FilterGroup, xe as FilterOption, Se as FilterSection, rr as FloatingPopover, C as FormGrid, Lt as FormSection, Rt as FormSectionRow, hr as Grid, In as Heading, v as IconButton, V as InfoIcon, mr as Inline, S as Input, Mn as Kbd, Nn as KbdGroup, Ye as LayerItem, Je as LayerList, pn as LayoutPicker, fn as LayoutPreview, U as List, ne as ListCell, G as ListColumn, ee as ListDetail, W as ListHeader, K as ListRow, Qt as Marquee, Be as MediaCard, Re as MediaGrid, Ve as MediaNotice, L as Menu, z as MenuDivider, R as MenuItem, Xt as NumberBoard, st as NumberStepper, Vt as OptionCard, Ht as OptionCardGroup, ie as PageHeader, ae as PageTitle, we as Pagination, Ze as PanelSection, Xe as PanelTitle, vn as PlaylistStrip, ge as Popover, ve as PopoverColumn, _e as PopoverColumns, ye as PopoverFooter, kt as Progress, Kt as QueueItem, qt as QueueRail, Jt as QueueRailSection, b as Radio, ce as RailItem, Kn as ResizableHandle, Gn as ResizablePanel, Jn as ResizablePanelGroup, je as ScheduleBoard, Ne as ScheduleCard, Me as ScheduleColumn, $t as ScreenHeader, N as SegmentedControl, A as Select, jn as Separator, se as SideRail, I as SignalDots, tt as SizeLabel, Ct as Skeleton, $e as SlideCard, Qe as SlideList, Cn as Slider, gr as Spacer, St as Spinner, pr as Stack, pe as Stat, de as StatBar, fe as StatLabel, F as StatusDot, Ie as StepItem, Fe as StepNav, Le as StepTag, te as SubTable, he as Summary, x as Switch, M as Tab, j as Tabs, rt as TagInput, Ln as Text, T as Textarea, q as Thumbnail, Ut as TicketNumber, on as TileCard, sn as TileStat, pt as TimeInput, gn as Timeline, Te as Toast, Ee as ToastRegion, Xn as Toggle, Zn as ToggleGroup, qe as ToolButton, Ge as ToolPalette, Ke as ToolRow, oe as Toolbar, B as Tooltip, le as Tree, ue as TreeItem, et as ZoomControl, rn as formatClock, yn as getInitials, ln as presetLayouts, Qn as useAnchoredPosition, $n as useDismiss };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kabobcompany/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "React components for Kabob. Thin wrappers over @kabobcompany/css classes.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"build": "vite build"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@kabobcompany/css": "0.
|
|
24
|
+
"@kabobcompany/css": "0.2.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"react": "^18.0.0 || ^19.0.0",
|