neba 0.0.1 → 1.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/README.md +177 -2
- package/dist/components/accordion/Accordion.d.ts +97 -0
- package/dist/components/accordion/Accordion.js +1 -0
- package/dist/components/accordion/index.d.ts +2 -0
- package/dist/components/accordion/index.js +1 -0
- package/dist/components/alert/Alert.d.ts +47 -0
- package/dist/components/alert/Alert.js +1 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/alert/index.js +1 -0
- package/dist/components/badge/Badge.d.ts +80 -0
- package/dist/components/badge/Badge.js +1 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/index.js +1 -0
- package/dist/components/blockquote/Blockquote.d.ts +65 -0
- package/dist/components/blockquote/Blockquote.js +1 -0
- package/dist/components/blockquote/index.d.ts +2 -0
- package/dist/components/blockquote/index.js +1 -0
- package/dist/components/box/Box.d.ts +50 -0
- package/dist/components/box/Box.js +1 -0
- package/dist/components/box/index.d.ts +2 -0
- package/dist/components/box/index.js +1 -0
- package/dist/components/button/Button.d.ts +25 -3
- package/dist/components/button/Button.js +1 -1
- package/dist/components/button/index.d.ts +1 -0
- package/dist/components/button-group/ButtonGroup.d.ts +31 -0
- package/dist/components/button-group/ButtonGroup.js +1 -0
- package/dist/components/button-group/index.d.ts +2 -0
- package/dist/components/button-group/index.js +1 -0
- package/dist/components/card/Card.d.ts +45 -0
- package/dist/components/card/Card.js +1 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/index.js +1 -0
- package/dist/components/carousel/Carousel.d.ts +74 -0
- package/dist/components/carousel/Carousel.js +1 -0
- package/dist/components/carousel/index.d.ts +2 -0
- package/dist/components/carousel/index.js +1 -0
- package/dist/components/checkbox/Checkbox.d.ts +39 -0
- package/dist/components/checkbox/Checkbox.js +1 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/checkbox/index.js +1 -0
- package/dist/components/chip/Chip.d.ts +50 -0
- package/dist/components/chip/Chip.js +1 -0
- package/dist/components/chip/index.d.ts +2 -0
- package/dist/components/chip/index.js +1 -0
- package/dist/components/combobox/Combobox.d.ts +131 -0
- package/dist/components/combobox/Combobox.js +1 -0
- package/dist/components/combobox/index.d.ts +2 -0
- package/dist/components/combobox/index.js +1 -0
- package/dist/components/container/Container.d.ts +55 -0
- package/dist/components/container/Container.js +1 -0
- package/dist/components/container/index.d.ts +2 -0
- package/dist/components/container/index.js +1 -0
- package/dist/components/date-picker/DatePicker.d.ts +75 -0
- package/dist/components/date-picker/DatePicker.js +1 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-picker/index.js +1 -0
- package/dist/components/date-range-picker/DateRangePicker.d.ts +81 -0
- package/dist/components/date-range-picker/DateRangePicker.js +1 -0
- package/dist/components/date-range-picker/index.d.ts +2 -0
- package/dist/components/date-range-picker/index.js +1 -0
- package/dist/components/date-time-picker/DateTimePicker.d.ts +68 -0
- package/dist/components/date-time-picker/DateTimePicker.js +1 -0
- package/dist/components/date-time-picker/index.d.ts +2 -0
- package/dist/components/date-time-picker/index.js +1 -0
- package/dist/components/dialog/Dialog.d.ts +111 -0
- package/dist/components/dialog/Dialog.js +1 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/dialog/index.js +1 -0
- package/dist/components/divider/Divider.d.ts +67 -0
- package/dist/components/divider/Divider.js +1 -0
- package/dist/components/divider/index.d.ts +2 -0
- package/dist/components/divider/index.js +1 -0
- package/dist/components/file-picker/FilePicker.d.ts +103 -0
- package/dist/components/file-picker/FilePicker.js +1 -0
- package/dist/components/file-picker/index.d.ts +2 -0
- package/dist/components/file-picker/index.js +1 -0
- package/dist/components/grid/Grid.d.ts +50 -0
- package/dist/components/grid/Grid.js +1 -0
- package/dist/components/grid/index.d.ts +2 -0
- package/dist/components/grid/index.js +1 -0
- package/dist/components/grid-container/GridContainer.d.ts +79 -0
- package/dist/components/grid-container/GridContainer.js +1 -0
- package/dist/components/grid-container/index.d.ts +2 -0
- package/dist/components/grid-container/index.js +1 -0
- package/dist/components/highlight/Highlight.d.ts +84 -0
- package/dist/components/highlight/Highlight.js +1 -0
- package/dist/components/highlight/index.d.ts +2 -0
- package/dist/components/highlight/index.js +1 -0
- package/dist/components/icon/Icon.d.ts +58 -0
- package/dist/components/icon/Icon.js +1 -0
- package/dist/components/icon/index.d.ts +2 -0
- package/dist/components/icon/index.js +1 -0
- package/dist/components/icon-button/IconButton.d.ts +39 -0
- package/dist/components/icon-button/IconButton.js +1 -0
- package/dist/components/icon-button/index.d.ts +2 -0
- package/dist/components/icon-button/index.js +1 -0
- package/dist/components/list/List.d.ts +81 -0
- package/dist/components/list/List.js +1 -0
- package/dist/components/list/index.d.ts +2 -0
- package/dist/components/list/index.js +1 -0
- package/dist/components/menu/Menu.d.ts +216 -0
- package/dist/components/menu/Menu.js +1 -0
- package/dist/components/menu/index.d.ts +2 -0
- package/dist/components/menu/index.js +1 -0
- package/dist/components/number-field/NumberField.d.ts +113 -0
- package/dist/components/number-field/NumberField.js +1 -0
- package/dist/components/number-field/index.d.ts +2 -0
- package/dist/components/number-field/index.js +1 -0
- package/dist/components/overlay/Overlay.d.ts +85 -0
- package/dist/components/overlay/Overlay.js +1 -0
- package/dist/components/overlay/index.d.ts +2 -0
- package/dist/components/overlay/index.js +1 -0
- package/dist/components/pagination/Pagination.d.ts +65 -0
- package/dist/components/pagination/Pagination.js +1 -0
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/index.js +1 -0
- package/dist/components/pill/Pill.d.ts +80 -0
- package/dist/components/pill/Pill.js +1 -0
- package/dist/components/pill/index.d.ts +2 -0
- package/dist/components/pill/index.js +1 -0
- package/dist/components/progress-box/ProgressBox.d.ts +33 -0
- package/dist/components/progress-box/ProgressBox.js +1 -0
- package/dist/components/progress-box/index.d.ts +2 -0
- package/dist/components/progress-box/index.js +1 -0
- package/dist/components/progress-circular/ProgressCircular.d.ts +19 -0
- package/dist/components/progress-circular/ProgressCircular.js +1 -0
- package/dist/components/progress-circular/index.d.ts +2 -0
- package/dist/components/progress-circular/index.js +1 -0
- package/dist/components/progress-linear/ProgressLinear.d.ts +20 -0
- package/dist/components/progress-linear/ProgressLinear.js +1 -0
- package/dist/components/progress-linear/index.d.ts +2 -0
- package/dist/components/progress-linear/index.js +1 -0
- package/dist/components/radio-group/RadioGroup.d.ts +51 -0
- package/dist/components/radio-group/RadioGroup.js +1 -0
- package/dist/components/radio-group/index.d.ts +2 -0
- package/dist/components/radio-group/index.js +1 -0
- package/dist/components/segmented-button/SegmentedButton.d.ts +77 -0
- package/dist/components/segmented-button/SegmentedButton.js +1 -0
- package/dist/components/segmented-button/index.d.ts +2 -0
- package/dist/components/segmented-button/index.js +1 -0
- package/dist/components/select/Select.d.ts +76 -0
- package/dist/components/select/Select.js +1 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.js +1 -0
- package/dist/components/shortcut/Shortcut.d.ts +60 -0
- package/dist/components/shortcut/Shortcut.js +1 -0
- package/dist/components/shortcut/index.d.ts +2 -0
- package/dist/components/shortcut/index.js +1 -0
- package/dist/components/slider/Slider.d.ts +38 -0
- package/dist/components/slider/Slider.js +1 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/index.js +1 -0
- package/dist/components/statistic/Statistic.d.ts +91 -0
- package/dist/components/statistic/Statistic.js +1 -0
- package/dist/components/statistic/index.d.ts +2 -0
- package/dist/components/statistic/index.js +1 -0
- package/dist/components/switch/Switch.d.ts +39 -0
- package/dist/components/switch/Switch.js +1 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +1 -0
- package/dist/components/table/Table.d.ts +80 -0
- package/dist/components/table/Table.js +1 -0
- package/dist/components/table/index.d.ts +2 -0
- package/dist/components/table/index.js +1 -0
- package/dist/components/tabs/Tabs.d.ts +92 -0
- package/dist/components/tabs/Tabs.js +1 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/index.js +1 -0
- package/dist/components/text-field/TextField.d.ts +63 -0
- package/dist/components/text-field/TextField.js +1 -0
- package/dist/components/text-field/index.d.ts +2 -0
- package/dist/components/text-field/index.js +1 -0
- package/dist/components/time-picker/TimePicker.d.ts +76 -0
- package/dist/components/time-picker/TimePicker.js +1 -0
- package/dist/components/time-picker/index.d.ts +2 -0
- package/dist/components/time-picker/index.js +1 -0
- package/dist/components/timeline/Timeline.d.ts +98 -0
- package/dist/components/timeline/Timeline.js +1 -0
- package/dist/components/timeline/index.d.ts +2 -0
- package/dist/components/timeline/index.js +1 -0
- package/dist/components/toast/Toast.d.ts +116 -0
- package/dist/components/toast/Toast.js +1 -0
- package/dist/components/toast/index.d.ts +2 -0
- package/dist/components/toast/index.js +1 -0
- package/dist/components/toolbar/Toolbar.d.ts +67 -0
- package/dist/components/toolbar/Toolbar.js +1 -0
- package/dist/components/toolbar/index.d.ts +2 -0
- package/dist/components/toolbar/index.js +1 -0
- package/dist/components/tooltip/Tooltip.d.ts +81 -0
- package/dist/components/tooltip/Tooltip.js +1 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/components/typography/Typography.d.ts +62 -0
- package/dist/components/typography/Typography.js +1 -0
- package/dist/components/typography/index.d.ts +2 -0
- package/dist/components/typography/index.js +1 -0
- package/dist/index.d.ts +50 -1
- package/dist/index.js +1 -1
- package/dist/internal/button-group.d.ts +25 -0
- package/dist/internal/button-group.js +1 -0
- package/dist/internal/calendar.d.ts +149 -0
- package/dist/internal/calendar.js +1 -0
- package/dist/internal/date.d.ts +170 -0
- package/dist/internal/date.js +1 -0
- package/dist/internal/grid.d.ts +69 -0
- package/dist/internal/grid.js +1 -0
- package/dist/internal/icons.d.ts +79 -0
- package/dist/internal/icons.js +1 -0
- package/dist/internal/menu.d.ts +20 -0
- package/dist/internal/menu.js +1 -0
- package/dist/internal/picker.d.ts +111 -0
- package/dist/internal/picker.js +1 -0
- package/dist/internal/progress.d.ts +122 -0
- package/dist/internal/progress.js +1 -0
- package/dist/internal/sizer.d.ts +33 -0
- package/dist/internal/sizer.js +1 -0
- package/dist/internal/styles.d.ts +257 -0
- package/dist/internal/styles.js +1 -0
- package/dist/styles.css +2 -0
- package/dist/tailwind.css +892 -0
- package/dist/types.d.ts +142 -0
- package/dist/types.js +8 -0
- package/package.json +90 -21
- package/pnpm-workspace.yaml +0 -2
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { NebaAlignSelf, NebaResponsive } from '../../types';
|
|
4
|
+
export interface GridProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* How many of the container's columns the item takes. Read against the
|
|
7
|
+
* container's `columns`, so `span={6}` is a half of the default twelve and a
|
|
8
|
+
* quarter of `columns={24}`.
|
|
9
|
+
*
|
|
10
|
+
* Responsive: `span={{ xs: 12, md: 6, lg: 4 }}` is full width on a phone,
|
|
11
|
+
* half from 48rem and a third from 64rem. Every entry applies from its own
|
|
12
|
+
* breakpoint up, so two of them usually describe a whole layout.
|
|
13
|
+
*
|
|
14
|
+
* A span wider than the row is clamped to the row rather than overflowing.
|
|
15
|
+
* @default the container's full width
|
|
16
|
+
*/
|
|
17
|
+
span?: NebaResponsive<number>;
|
|
18
|
+
/**
|
|
19
|
+
* Columns left empty *before* the item — space pushed in ahead of it, not an
|
|
20
|
+
* absolute position in the row. First in a twelve-column row, `offset={4}`
|
|
21
|
+
* with `span={4}` is the middle third; after an item that already took four
|
|
22
|
+
* columns, the same offset skips four more and lands on the last third.
|
|
23
|
+
*
|
|
24
|
+
* Responsive in the same way `span` is.
|
|
25
|
+
* @default 0
|
|
26
|
+
*/
|
|
27
|
+
offset?: NebaResponsive<number>;
|
|
28
|
+
/** Overrides the row's `alignItems` for this item alone. */
|
|
29
|
+
alignSelf?: NebaAlignSelf;
|
|
30
|
+
/**
|
|
31
|
+
* Renders something other than a `<div>`: `render={<li />}`,
|
|
32
|
+
* `render={<article />}`. Base UI's own escape hatch.
|
|
33
|
+
*/
|
|
34
|
+
render?: useRender.RenderProp;
|
|
35
|
+
children?: React.ReactNode;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* One cell of a `GridContainer`.
|
|
39
|
+
*
|
|
40
|
+
* It is a width and nothing else — no surface, no padding, no typography. What
|
|
41
|
+
* goes inside brings its own, which is the whole reason a grid cell and a Box
|
|
42
|
+
* are two components: wrapping something in a layout should not change how it
|
|
43
|
+
* looks, and a cell that drew a sheet would make `span` a visual decision.
|
|
44
|
+
*
|
|
45
|
+
* The column count it divides by is inherited from the container as a custom
|
|
46
|
+
* property, so a `<Grid>` with no `<GridContainer>` above it falls back to
|
|
47
|
+
* twelve rather than breaking — but it will be a plain block in a plain parent,
|
|
48
|
+
* which is not a layout. Always wrap.
|
|
49
|
+
*/
|
|
50
|
+
export declare const Grid: React.ForwardRefExoticComponent<GridProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{alignSelfClasses as n,offsetValue as o,responsiveSlots as t,spanValue as s}from"../../internal/grid";export const Grid=e.forwardRef(function({span:e,offset:a,alignSelf:i,render:f,className:l,style:c,children:d,...m},p){const u=["neba-grid-item",i?n[i]:"",l??""].filter(Boolean).join(" ");return r({render:f,ref:p,props:{className:u,style:{...t("span",e,s),...t("offset",a,o),...c},children:d,...m}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{Grid}from"./Grid";
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { NebaAlignItems, NebaDensity, NebaJustifyContent, NebaResponsive, NebaSize } from '../../types';
|
|
4
|
+
export interface GridContainerProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* How many columns a row is divided into. Every `span` and every `offset`
|
|
7
|
+
* inside is read against this number, so `columns={24}` makes `span={12}` a
|
|
8
|
+
* half and not a full width.
|
|
9
|
+
* @default 12
|
|
10
|
+
*/
|
|
11
|
+
columns?: NebaResponsive<number>;
|
|
12
|
+
/**
|
|
13
|
+
* The gutter between items, on Tailwind's spacing scale — `spacing={4}` is
|
|
14
|
+
* `1rem`, the same length `gap-4` is. Fractions are allowed, so `1.5` is
|
|
15
|
+
* `0.375rem`.
|
|
16
|
+
* @default 2
|
|
17
|
+
*/
|
|
18
|
+
spacing?: NebaResponsive<number>;
|
|
19
|
+
/** The gutter between rows only. Falls back to `spacing`. */
|
|
20
|
+
rowSpacing?: NebaResponsive<number>;
|
|
21
|
+
/** The gutter between columns only. Falls back to `spacing`. */
|
|
22
|
+
columnSpacing?: NebaResponsive<number>;
|
|
23
|
+
/** How a row distributes the space its items did not use. */
|
|
24
|
+
justifyContent?: NebaJustifyContent;
|
|
25
|
+
/** How items sit against each other across the row. @default 'stretch' */
|
|
26
|
+
alignItems?: NebaAlignItems;
|
|
27
|
+
/** Where the rows sit when the grid is shorter than the box holding it. */
|
|
28
|
+
alignContent?: NebaJustifyContent;
|
|
29
|
+
/**
|
|
30
|
+
* Whether a row that runs out of columns continues on the next one. Turning
|
|
31
|
+
* it off gives one row that overflows, which is what a horizontally
|
|
32
|
+
* scrolling strip wants.
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
35
|
+
wrap?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Inner padding, on the `size`/`density` scale. Turn it off when the grid is
|
|
38
|
+
* already inside something that pads — a Container, a Card, another grid.
|
|
39
|
+
* @default true
|
|
40
|
+
*/
|
|
41
|
+
padded?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* The padding scale. As on Box, this is the size of the *sheet* — it never
|
|
44
|
+
* touches a height or the type scale, and it has nothing to do with the
|
|
45
|
+
* gutters, which are `spacing`.
|
|
46
|
+
* @default 'md'
|
|
47
|
+
*/
|
|
48
|
+
size?: NebaSize;
|
|
49
|
+
/** @default 'default' */
|
|
50
|
+
density?: NebaDensity;
|
|
51
|
+
/**
|
|
52
|
+
* Renders something other than a `<div>`: `render={<section />}`,
|
|
53
|
+
* `render={<ul />}`. Base UI's own escape hatch.
|
|
54
|
+
*/
|
|
55
|
+
render?: useRender.RenderProp;
|
|
56
|
+
children?: React.ReactNode;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The parent every `Grid` needs.
|
|
60
|
+
*
|
|
61
|
+
* It owns the three numbers an item cannot know on its own — how many columns
|
|
62
|
+
* there are and how wide the two gutters are — and hands them down as inherited
|
|
63
|
+
* custom properties rather than through a React context. That is not a
|
|
64
|
+
* shortcut: the values are responsive, and a media query can change an
|
|
65
|
+
* inherited custom property without React hearing about it, so the column count
|
|
66
|
+
* an item lays itself out against is always the one that is on screen. A
|
|
67
|
+
* context would have to re-render the tree at every breakpoint to say the same
|
|
68
|
+
* thing.
|
|
69
|
+
*
|
|
70
|
+
* It deliberately does not take `variant`, `color` or `elevation`. A grid is
|
|
71
|
+
* not a surface — it is the arrangement of the surfaces inside it, and the
|
|
72
|
+
* moment it draws its own sheet it stops being usable as the outermost thing on
|
|
73
|
+
* a page. Wrap it in a Box or a Card when the sheet is wanted.
|
|
74
|
+
*
|
|
75
|
+
* Nesting is a `GridContainer` inside a `Grid`, not a `Grid` that is also a
|
|
76
|
+
* container: the inner grid re-declares the column count for its own subtree
|
|
77
|
+
* while the item around it keeps the width the outer grid gave it.
|
|
78
|
+
*/
|
|
79
|
+
export declare const GridContainer: React.ForwardRefExoticComponent<GridContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{alignContentClasses as n,alignItemsClasses as a,columnCount as o,justifyContentClasses as t,responsiveSlots as i,spacingValue as p,withBaseline as s}from"../../internal/grid";import{boxPaddingClasses as l}from"../box/Box";export const GridContainer=e.forwardRef(function({columns:e,spacing:c,rowSpacing:d,columnSpacing:f,justifyContent:m,alignItems:g,alignContent:x,wrap:u=!0,padded:y=!0,size:w="md",density:b="default",render:C,className:h,style:j,children:B,...N},S){const z=["neba-grid flex",u?"flex-wrap":"flex-nowrap","gap-x-(--n-gap-x) gap-y-(--n-gap-y)",y?l[b][w]:"",m?t[m]:"",g?a[g]:"",x?n[x]:"",h??""].filter(Boolean).join(" ");return r({render:C,ref:S,props:{className:z,style:{...i("cols",s(e,12),o),...i("gap-x",s(f??c,2),p),...i("gap-y",s(d??c,2),p),...j},children:B,...N}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{GridContainer}from"./GridContainer";
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { TypographyWeight } from '../typography/Typography';
|
|
3
|
+
import type { NebaColor, NebaVariant } from '../../types';
|
|
4
|
+
export interface HighlightProps extends Omit<React.ComponentPropsWithoutRef<'span'>, 'color'> {
|
|
5
|
+
/**
|
|
6
|
+
* What to find.
|
|
7
|
+
*
|
|
8
|
+
* A string is one term, an array is several — the longest is tried first, so
|
|
9
|
+
* `['data', 'database']` marks the whole word rather than the first four
|
|
10
|
+
* letters of it. A `RegExp` is used as written, with the global flag forced
|
|
11
|
+
* on; `caseSensitive` and `wholeWord` are ignored for it, because a regular
|
|
12
|
+
* expression already says both of those things itself.
|
|
13
|
+
*/
|
|
14
|
+
query: string | string[] | RegExp;
|
|
15
|
+
/**
|
|
16
|
+
* Weight of the mark.
|
|
17
|
+
*
|
|
18
|
+
* - `solid` — filled, the highlighter pen. The default.
|
|
19
|
+
* - `outline` — a hairline box around the word, for a page where a filled run
|
|
20
|
+
* would be too much.
|
|
21
|
+
* - `text` — the accent colour and nothing else, for marking a word inside a
|
|
22
|
+
* heading that is already loud.
|
|
23
|
+
* @default 'solid'
|
|
24
|
+
*/
|
|
25
|
+
variant?: NebaVariant;
|
|
26
|
+
/**
|
|
27
|
+
* Semantic colour role. `warning` by default, and not arbitrarily: it is the
|
|
28
|
+
* one family whose fill is light with dark ink on it, so a solid `warning`
|
|
29
|
+
* mark is a yellow highlighter over black text rather than a white word on a
|
|
30
|
+
* block of colour.
|
|
31
|
+
* @default 'warning'
|
|
32
|
+
*/
|
|
33
|
+
color?: NebaColor;
|
|
34
|
+
/**
|
|
35
|
+
* Whether `a` and `A` are different letters.
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
caseSensitive?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Whether a term has to be a word on its own — `cat` marking "cat" but not
|
|
41
|
+
* "concatenate".
|
|
42
|
+
*
|
|
43
|
+
* A word here is a run of letters, digits and underscores in any script, so it
|
|
44
|
+
* means what it should for `café` and `naïve`. It means very little for Korean
|
|
45
|
+
* or Japanese, where a phrase is not delimited by spaces at all; that is a
|
|
46
|
+
* property of the writing system rather than of this prop, and is the reason
|
|
47
|
+
* it is off by default.
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
wholeWord?: boolean;
|
|
51
|
+
/** Underlines the mark as well. Combines with every variant. */
|
|
52
|
+
underline?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Sets the mark's weight. Omit it and the mark is the weight of the text
|
|
55
|
+
* around it — the surface is already saying "this one", and a bolded word
|
|
56
|
+
* inside a sentence changes the rhythm of the whole line.
|
|
57
|
+
*/
|
|
58
|
+
weight?: TypographyWeight;
|
|
59
|
+
/**
|
|
60
|
+
* The text to search. Elements are walked into and left otherwise untouched,
|
|
61
|
+
* so a match inside a `<strong>` is still marked and the `<strong>` survives.
|
|
62
|
+
*/
|
|
63
|
+
children?: React.ReactNode;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Marks the words a reader is looking for, inside text they were already
|
|
67
|
+
* reading.
|
|
68
|
+
*
|
|
69
|
+
* The component is the search, not just the styling: `query` is what a search
|
|
70
|
+
* box holds, and everything about *how* the matching is done — case, whole
|
|
71
|
+
* words, a regular expression — is a prop rather than something a caller has to
|
|
72
|
+
* pre-compute into a list of offsets.
|
|
73
|
+
*
|
|
74
|
+
* The mark is a real `<mark>`, which is the element for "text of relevance to
|
|
75
|
+
* the reader" and is announced as such. That has one consequence worth knowing:
|
|
76
|
+
* marking eleven words in a paragraph tells a screen reader that eleven things
|
|
77
|
+
* are important, which is a way of saying nothing. A highlight is for a handful
|
|
78
|
+
* of matches.
|
|
79
|
+
*
|
|
80
|
+
* Nothing here is stateful and nothing measures — the whole component is a pure
|
|
81
|
+
* function of `children` and `query`, so it re-marks on its own the moment the
|
|
82
|
+
* search box changes.
|
|
83
|
+
*/
|
|
84
|
+
export declare const Highlight: React.ForwardRefExoticComponent<HighlightProps & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as n}from"react/jsx-runtime";import*as e from"react";import{transitionClasses as t}from"../../internal/styles";const r={solid:"bg-(--n-fill) text-(--n-on-solid)",outline:"border bg-(--n-panel) text-(--n-accent) [border-color:var(--n-line)]",text:"bg-transparent text-(--n-accent)"},o={regular:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},l=/[\p{L}\p{N}_]/u;function i(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function a(n,e,t){const r=e>0?n[e-1]:"",o=t<n.length?n[t]:"";return!l.test(r)&&!l.test(o)}function s(n,e,t,r){e.lastIndex=0;const o=[];let l,i=0;for(;null!==(l=e.exec(n));){if(""===l[0]){e.lastIndex+=1;continue}const s=l.index,c=s+l[0].length;t&&!a(n,s,c)||(s>i&&o.push(n.slice(i,s)),o.push(r(l[0],`${s}`)),i=c)}return 0===o.length?n:(i<n.length&&o.push(n.slice(i)),o)}function c(n,t,r,o){if("string"==typeof n)return s(n,t,r,o);if("number"==typeof n)return s(String(n),t,r,o);if(Array.isArray(n))return e.Children.map(n,n=>c(n,t,r,o));if(e.isValidElement(n)){const l=n.props.children;return void 0===l||"function"==typeof l?n:e.cloneElement(n,void 0,c(l,t,r,o))}return n}export const Highlight=e.forwardRef(function({query:l,variant:a="solid",color:s="warning",caseSensitive:u=!1,wholeWord:f=!1,underline:d=!1,weight:m,className:p,style:g,children:h,...b},x){const y=e.useMemo(()=>function(n,e){if(n instanceof RegExp)return n.global?n:new RegExp(n.source,`${n.flags}g`);const t=(Array.isArray(n)?n:[n]).map(n=>n.trim()).filter(Boolean).sort((n,e)=>e.length-n.length);return 0===t.length?null:new RegExp(t.map(i).join("|"),e?"gu":"giu")}(l,u),[l,u]),v=["rounded-[0.25rem] px-0.5 -mx-0.5","box-decoration-clone",r[a],d?"underline decoration-2 underline-offset-2":"",m?o[m]:"",t].filter(Boolean).join(" "),$=y?c(h,y,f,(e,t)=>n("mark",{className:v,children:e},t)):h;return n("span",{ref:x,className:p,style:{"--n-fill":`var(--neba-${s}-fill)`,"--n-on-solid":`var(--neba-${s}-on-solid)`,"--n-accent":`var(--neba-${s}-accent)`,"--n-panel":`var(--neba-${s}-panel)`,"--n-line":`var(--neba-${s}-line)`,...g},...b,children:$})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{Highlight}from"./Highlight";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { NebaColor, NebaSize } from '../../types';
|
|
3
|
+
export interface IconProps extends Omit<React.ComponentPropsWithoutRef<'span'>, 'color'> {
|
|
4
|
+
/**
|
|
5
|
+
* The glyph. An `<svg>` element, an `<img>`, a component from an icon set, or
|
|
6
|
+
* a character — whatever is passed is laid into a box of the right size and
|
|
7
|
+
* given a colour to inherit.
|
|
8
|
+
*
|
|
9
|
+
* It is a prop rather than `children` on purpose. An icon set hands you an
|
|
10
|
+
* element you did not draw, and the two things you always want to change about
|
|
11
|
+
* it — how big it is and what colour it is — are the two things you cannot
|
|
12
|
+
* reach once it is a child of something. As a prop it is content the Icon
|
|
13
|
+
* *sizes*, not content the Icon merely wraps.
|
|
14
|
+
*/
|
|
15
|
+
icon: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* The box the glyph is drawn in: 14, 16, 20, 24 and 28px. Its own ladder
|
|
18
|
+
* rather than the control heights, because an icon is not a control.
|
|
19
|
+
* @default 'md'
|
|
20
|
+
*/
|
|
21
|
+
size?: NebaSize;
|
|
22
|
+
/**
|
|
23
|
+
* Semantic colour role, or `inherit` — the default — to take the colour of
|
|
24
|
+
* whatever the icon sits in.
|
|
25
|
+
*
|
|
26
|
+
* `inherit` is the default and not `primary`, which is the one place this prop
|
|
27
|
+
* deviates from every other component in the library. An icon is content, and
|
|
28
|
+
* the overwhelmingly common case is an icon inside something that has already
|
|
29
|
+
* decided what colour its content is: a Button's label, a muted caption, an
|
|
30
|
+
* Alert's own family. An Icon that arrived pre-dyed blue would have to be
|
|
31
|
+
* turned off again at every one of those.
|
|
32
|
+
* @default 'inherit'
|
|
33
|
+
*/
|
|
34
|
+
color?: NebaColor | 'inherit';
|
|
35
|
+
/**
|
|
36
|
+
* What the icon says, for a reader who cannot see it.
|
|
37
|
+
*
|
|
38
|
+
* Without it the icon is hidden from the accessibility tree entirely, which is
|
|
39
|
+
* the right default: the overwhelming majority of icons sit next to a word
|
|
40
|
+
* that already says the same thing, and reading both out loud is worse than
|
|
41
|
+
* reading one. Pass this only when the glyph is carrying meaning on its own.
|
|
42
|
+
*/
|
|
43
|
+
label?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A glyph at a known size, in a known colour.
|
|
47
|
+
*
|
|
48
|
+
* The library draws no icons of its own beyond the handful its components need —
|
|
49
|
+
* an icon set is a font-sized decision that belongs to the app, not to the
|
|
50
|
+
* component library it installs. What this does is give whatever icon the app
|
|
51
|
+
* chose the same two axes everything else here has.
|
|
52
|
+
*
|
|
53
|
+
* The box is `inline-flex` with the glyph told to fill it, and `font-size` is
|
|
54
|
+
* set to the same length — so an `<svg>` with its own `width`, an `<svg>` sized
|
|
55
|
+
* in `em`, and a bare character all come out the same size. That is the whole
|
|
56
|
+
* component: a box, a length written twice, and a colour.
|
|
57
|
+
*/
|
|
58
|
+
export declare const Icon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import*as t from"react";import{iconSizeClasses as i}from"../../internal/styles";const n={xs:"text-[0.875rem]",sm:"text-[1rem]",md:"text-[1.25rem]",lg:"text-[1.5rem]",xl:"text-[1.75rem]"};export const Icon=t.forwardRef(function({icon:t,size:r="md",color:l="inherit",label:s,className:a,style:o,...c},m){const f=["inline-flex shrink-0 items-center justify-center align-middle",i[r],"[&>svg]:block [&>svg]:size-full [&>img]:block [&>img]:size-full",`leading-none ${n[r]}`,"inherit"===l?"":"text-(--n-accent)",a??""].filter(Boolean).join(" ");return e("span",{ref:m,className:f,style:"inherit"===l?o:{"--n-accent":`var(--neba-${l}-accent)`,...o},role:s?"img":void 0,"aria-label":s,"aria-hidden":!s||void 0,...c,children:t})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{Icon}from"./Icon";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ButtonProps } from '../button/Button';
|
|
3
|
+
export interface IconButtonProps extends Omit<ButtonProps, 'children' | 'startIcon' | 'endIcon'> {
|
|
4
|
+
/**
|
|
5
|
+
* The glyph. Wrap it in an `Icon` when it needs a size of its own; passed bare
|
|
6
|
+
* it is sized in `em` against the button, exactly as a `startIcon` is.
|
|
7
|
+
*/
|
|
8
|
+
icon: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* What the button does, in words.
|
|
11
|
+
*
|
|
12
|
+
* Required, and the one prop here that is. A button whose whole label is a
|
|
13
|
+
* drawing has no accessible name at all, and "an icon button with no
|
|
14
|
+
* `aria-label`" is the single most common accessibility defect a component
|
|
15
|
+
* library ships. Making it required is the only fix that survives review.
|
|
16
|
+
*/
|
|
17
|
+
label: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A round button with a glyph in it and nothing else.
|
|
21
|
+
*
|
|
22
|
+
* A [Button] with an icon and no children already goes square — the same height,
|
|
23
|
+
* the same width, the acrylic corners cut off it. This is the other shape: a
|
|
24
|
+
* disc.
|
|
25
|
+
*
|
|
26
|
+
* That disc is a deliberate exception to the house radius rule, which holds
|
|
27
|
+
* every corner just short of the 50% that would make a control a pill, because
|
|
28
|
+
* the flat run along the top and bottom edge is what still reads as a sheet with
|
|
29
|
+
* its corners cut. The rule is about *labelled* controls: the flat run is there
|
|
30
|
+
* for the line of text to sit on, and a glyph has no line of text. A circle with
|
|
31
|
+
* a single mark centred in it is a punched token rather than a moulded key, so
|
|
32
|
+
* it says the thing the rule exists to protect by a different route.
|
|
33
|
+
*
|
|
34
|
+
* Everything else is Button's, unchanged and on purpose: the variants, the
|
|
35
|
+
* elevation ladder, the pointer light, `loading`, `readOnly`, and the values a
|
|
36
|
+
* surrounding ButtonGroup sets. Two components that draw the same surface from
|
|
37
|
+
* two copies of the same table are two components that will eventually disagree.
|
|
38
|
+
*/
|
|
39
|
+
export declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import*as r from"react";import{Button as o}from"../button/Button";export const IconButton=r.forwardRef(function({icon:r,label:e,style:a,...n},s){return t(o,{ref:s,"aria-label":e,startIcon:r,style:{borderRadius:"9999px",...a},...n})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{IconButton}from"./IconButton";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { NebaElevation, NebaStyleProps } from '../../types';
|
|
4
|
+
export interface ListProps extends NebaStyleProps, Omit<React.ComponentPropsWithoutRef<'ul'>, 'color'> {
|
|
5
|
+
/**
|
|
6
|
+
* Drop shadow depth. `0` (the default) is flat.
|
|
7
|
+
* @default 0
|
|
8
|
+
*/
|
|
9
|
+
elevation?: NebaElevation;
|
|
10
|
+
/**
|
|
11
|
+
* Separates the rows with a hairline instead of with space.
|
|
12
|
+
*
|
|
13
|
+
* It changes more than it sounds like: with dividers the rules have to reach
|
|
14
|
+
* both edges of the sheet, so the list gives up its inner padding and the rows
|
|
15
|
+
* give up their rounded corners. A row cannot be a floating tile and a ruled
|
|
16
|
+
* line at the same time.
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
dividers?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Renders something other than a `<ul>` — `render={<ol />}` for a list where
|
|
22
|
+
* the order is the point. Base UI's own escape hatch.
|
|
23
|
+
*/
|
|
24
|
+
render?: useRender.RenderProp;
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
}
|
|
27
|
+
export interface ListItemProps extends Omit<React.ComponentPropsWithoutRef<'li'>, 'color' | 'onClick'> {
|
|
28
|
+
/**
|
|
29
|
+
* Passing it is what turns the row into a real `<button>`. It lands on that
|
|
30
|
+
* button rather than on the `<li>`, which is why the type is loosened from
|
|
31
|
+
* the list item the shell actually is.
|
|
32
|
+
*/
|
|
33
|
+
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
34
|
+
/** Content before the label — an icon, an avatar, a status dot. */
|
|
35
|
+
startIcon?: React.ReactNode;
|
|
36
|
+
/** Content after the label, inside the pressable area. */
|
|
37
|
+
endIcon?: React.ReactNode;
|
|
38
|
+
/** A second line under the label, one step down the type scale and muted. */
|
|
39
|
+
description?: React.ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* A control pinned to the end of the row — a switch, a menu button.
|
|
42
|
+
*
|
|
43
|
+
* Deliberately outside the pressable area: a row that both navigates and
|
|
44
|
+
* holds a toggle has two things to press, and nesting one button inside
|
|
45
|
+
* another is markup the browser rewrites on parse.
|
|
46
|
+
*/
|
|
47
|
+
action?: React.ReactNode;
|
|
48
|
+
/** Renders the row as a link. Mutually exclusive with `onClick` in practice. */
|
|
49
|
+
href?: string;
|
|
50
|
+
/** Marks the row as the chosen one — the open page, the current filter. */
|
|
51
|
+
selected?: boolean;
|
|
52
|
+
/** Unavailable. Drops the colour family for neutral grey, as everywhere else. */
|
|
53
|
+
disabled?: boolean;
|
|
54
|
+
/** The label. */
|
|
55
|
+
children?: React.ReactNode;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A stack of rows.
|
|
59
|
+
*
|
|
60
|
+
* The list is a sheet and the rows are what is on it, which is the whole reason
|
|
61
|
+
* the two are separate components: `size` and `density` are properties of the
|
|
62
|
+
* stack, not of any one line in it, and a context is what carries them down.
|
|
63
|
+
*
|
|
64
|
+
* There is no Base UI primitive under this on purpose. A list is not a
|
|
65
|
+
* composite widget — it has no roving focus, no selection model, no keyboard
|
|
66
|
+
* contract of its own. Reaching for a menu or a listbox primitive to get one
|
|
67
|
+
* would hand every consumer's plain list of links the semantics of a menu,
|
|
68
|
+
* which is the most common way a component library breaks a screen reader.
|
|
69
|
+
*/
|
|
70
|
+
export declare const List: React.ForwardRefExoticComponent<ListProps & React.RefAttributes<HTMLUListElement>>;
|
|
71
|
+
/**
|
|
72
|
+
* One row.
|
|
73
|
+
*
|
|
74
|
+
* The shell is always an `<li>`. What changes is what is inside it: a plain run
|
|
75
|
+
* of content, or — when `onClick` or `href` is given — a real `<button>` or
|
|
76
|
+
* `<a>` wrapping that content, with `action` sitting outside it as a separate
|
|
77
|
+
* control. This is the same shape Chip uses, for the same two reasons: a
|
|
78
|
+
* `<span>` carrying a click handler is invisible to a keyboard, and a
|
|
79
|
+
* `<button>` inside a `<button>` is markup Chrome silently un-nests.
|
|
80
|
+
*/
|
|
81
|
+
export declare const ListItem: React.ForwardRefExoticComponent<ListItemProps & React.RefAttributes<HTMLLIElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as n,Fragment as r}from"react/jsx-runtime";import*as t from"react";import{useRender as l}from"@base-ui/react/use-render";import{boxPaddingXClasses as s}from"../box/Box";import{focusRingClasses as a,gapClasses as i,hasContent as o,iconClasses as d,metaTextClasses as c,radiusClasses as m,sheetBodyClasses as f,surfaceClasses as x,surfaceSlots as p,transitionClasses as u}from"../../internal/styles";const h=t.createContext({size:"md",density:"default",dividers:!1}),b={solid:[x,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[x,"border text-(--neba-fg) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--neba-fg) bg-transparent"},v={default:{xs:"py-1",sm:"py-1.5",md:"py-2",lg:"py-2.5",xl:"py-3"},compact:{xs:"py-0.5",sm:"py-0.5",md:"py-1",lg:"py-1.5",xl:"py-2"}},g={xs:m.xs,sm:m.xs,md:m.sm,lg:m.sm,xl:m.md};export const List=t.forwardRef(function({variant:n="outline",size:r="md",color:s="primary",density:a="default",elevation:i=0,dividers:o=!1,render:d,className:c,style:f,children:x,...v},g){const y=t.useMemo(()=>({size:r,density:a,dividers:o}),[r,a,o]),N=["flex flex-col",m[r],b[n],u,o?"overflow-hidden [&>li+li]:border-t [&>li+li]:[border-color:var(--n-line)]":"p-1",c??""].filter(Boolean).join(" "),w=l({render:d,ref:g,props:{role:"list",className:N,style:{...p(s,i),...f},children:x,...v}});return e(h.Provider,{value:y,children:w})});export const ListItem=t.forwardRef(function({startIcon:l,endIcon:m,description:x,action:p,href:b,selected:y=!1,disabled:N=!1,className:w,children:j,onClick:k,...B},C){const{size:z,density:I,dividers:$}=t.useContext(h),L=Boolean(k||b)&&!N,R=s[I][z],F=["flex min-w-0 flex-1 items-center text-start",R,v[I][z],i[z],f[z],u,d,$?"":g[z],N?"cursor-not-allowed text-(--neba-disabled-fg)":y?"bg-(--n-soft-press) font-medium text-(--n-accent)":"",L?`cursor-pointer ${a}`:"",L&&!y?"hover:bg-(--n-soft)":"",L&&y?"hover:bg-(--n-soft-press)":""].filter(Boolean).join(" "),M=n(r,{children:[o(l)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:l}):null,n("span",{className:"flex min-w-0 flex-1 flex-col",children:[o(j)?e("span",{className:"truncate",children:j}):null,o(x)?e("span",{className:`truncate text-(--neba-muted-fg) ${c[z]}`,children:x}):null]}),o(m)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:m}):null]});return n("li",{ref:C,className:["flex w-full items-center",w??""].filter(Boolean).join(" "),...B,children:[L&&b?e("a",{href:b,className:F,"aria-current":y?"page":void 0,onClick:k,children:M}):L?e("button",{type:"button",className:F,"aria-current":!!y||void 0,onClick:k,children:M}):e("div",{className:F,"aria-disabled":N||void 0,children:M}),o(p)?e("div",{className:`flex shrink-0 items-center ${R}`,children:p}):null]})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{List,ListItem}from"./List";
|