neba 1.0.0 → 1.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/README.md +27 -16
- package/dist/components/avatar/Avatar.d.ts +100 -0
- package/dist/components/avatar/Avatar.js +1 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/avatar/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/breadcrumb/Breadcrumb.d.ts +92 -0
- package/dist/components/breadcrumb/Breadcrumb.js +1 -0
- package/dist/components/breadcrumb/index.d.ts +2 -0
- package/dist/components/breadcrumb/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/chat-bubble/ChatBubble.d.ts +114 -0
- package/dist/components/chat-bubble/ChatBubble.js +1 -0
- package/dist/components/chat-bubble/index.d.ts +2 -0
- package/dist/components/chat-bubble/index.js +1 -0
- package/dist/components/checkbox/Checkbox.js +1 -1
- package/dist/components/combobox/Combobox.js +1 -1
- 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.js +1 -1
- package/dist/components/divider/Divider.d.ts +19 -0
- package/dist/components/divider/Divider.js +1 -1
- 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/otp-field/OtpField.d.ts +85 -0
- package/dist/components/otp-field/OtpField.js +1 -0
- package/dist/components/otp-field/index.d.ts +2 -0
- package/dist/components/otp-field/index.js +1 -0
- package/dist/components/pagination/Pagination.js +1 -1
- package/dist/components/panes/Panes.d.ts +78 -0
- package/dist/components/panes/Panes.js +1 -0
- package/dist/components/panes/index.d.ts +2 -0
- package/dist/components/panes/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/radio-group/RadioGroup.js +1 -1
- 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.js +1 -1
- 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/spoiler/Spoiler.d.ts +95 -0
- package/dist/components/spoiler/Spoiler.js +1 -0
- package/dist/components/spoiler/index.d.ts +2 -0
- package/dist/components/spoiler/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.js +1 -1
- package/dist/components/text-link/TextLink.d.ts +82 -0
- package/dist/components/text-link/TextLink.js +1 -0
- package/dist/components/text-link/index.d.ts +2 -0
- package/dist/components/text-link/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/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/tree-view/TreeView.d.ts +115 -0
- package/dist/components/tree-view/TreeView.js +1 -0
- package/dist/components/tree-view/index.d.ts +2 -0
- package/dist/components/tree-view/index.js +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +1 -1
- 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/i18n.d.ts +78 -0
- package/dist/internal/i18n.js +1 -0
- package/dist/internal/icons.d.ts +54 -0
- package/dist/internal/icons.js +1 -1
- package/dist/internal/picker.d.ts +111 -0
- package/dist/internal/picker.js +1 -0
- package/dist/internal/sizer.d.ts +33 -0
- package/dist/internal/sizer.js +1 -0
- package/dist/internal/styles.d.ts +33 -0
- package/dist/internal/styles.js +1 -1
- package/dist/styles.css +2 -758
- package/dist/tailwind.css +1017 -0
- package/dist/types.d.ts +65 -0
- package/package.json +25 -12
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PickerLabels } from './calendar';
|
|
3
|
+
import type { NebaColor, NebaElevation, NebaSize, NebaStyleProps } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* The shell all four pickers wear: a field-shaped trigger with a popup hanging
|
|
6
|
+
* off it.
|
|
7
|
+
*
|
|
8
|
+
* It is here rather than in one of the components for the reason the calendar
|
|
9
|
+
* is: four components need it, and none of them should have to import another.
|
|
10
|
+
* What it draws is deliberately not new — the trigger is `fieldRestClasses`,
|
|
11
|
+
* which is the same box a TextField and a Select's trigger are drawn on, to the
|
|
12
|
+
* pixel. A form where the date field is a different height, radius or colour
|
|
13
|
+
* from the text field beside it is a form that looks assembled rather than
|
|
14
|
+
* designed.
|
|
15
|
+
*
|
|
16
|
+
* The one thing the pickers do *not* offer is typing a date into the trigger.
|
|
17
|
+
* Parsing a date out of free text is locale-dependent in a way that cannot be
|
|
18
|
+
* done honestly without a date library, and a field that understands `27/7/26`
|
|
19
|
+
* in one browser and not the next is worse than one that never claimed to. So
|
|
20
|
+
* the trigger is a button, exactly as a Select's is, and the calendar is where
|
|
21
|
+
* the answer comes from.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* The popup's slots: a container's undyed sheet with the *control* fill added
|
|
25
|
+
* back on top.
|
|
26
|
+
*
|
|
27
|
+
* Neither generator in `internal/styles` says this on its own, and the reason is
|
|
28
|
+
* that a picker's popup is both things at once. It is a container — it holds a
|
|
29
|
+
* grid of forty-two days, and dyeing the sheet under them would put every one of
|
|
30
|
+
* them on a background it was not chosen against — and it also holds the one
|
|
31
|
+
* filled token in the library that has to be legible without being read, which
|
|
32
|
+
* is the day you picked. So the sheet stays white and the family arrives in the
|
|
33
|
+
* four fill slots the chosen cell reads.
|
|
34
|
+
*/
|
|
35
|
+
export declare function popupSlots(color: NebaColor, elevation: NebaElevation): React.CSSProperties;
|
|
36
|
+
/**
|
|
37
|
+
* The popup. Like every floating surface in the library it carries a shadow by
|
|
38
|
+
* default, at level 3 — as far as the scale goes without hovering — because it
|
|
39
|
+
* is genuinely off the page rather than merely on top of it.
|
|
40
|
+
*/
|
|
41
|
+
export declare const pickerPopupClasses: string;
|
|
42
|
+
/** The popup's own padding, one track tighter than a control's. */
|
|
43
|
+
export declare const popupPaddingClasses: Record<NebaSize, string>;
|
|
44
|
+
export interface PickerShellProps extends NebaStyleProps {
|
|
45
|
+
elevation?: NebaElevation;
|
|
46
|
+
/** Label above the trigger. */
|
|
47
|
+
label?: React.ReactNode;
|
|
48
|
+
/** Helper text below it. */
|
|
49
|
+
description?: React.ReactNode;
|
|
50
|
+
/** Error message below. Its presence also turns the control invalid. */
|
|
51
|
+
error?: React.ReactNode;
|
|
52
|
+
invalid?: boolean;
|
|
53
|
+
/** The glyph before the value — a calendar or a clock. */
|
|
54
|
+
startIcon?: React.ReactNode;
|
|
55
|
+
fullWidth?: boolean;
|
|
56
|
+
disabled?: boolean;
|
|
57
|
+
readOnly?: boolean;
|
|
58
|
+
required?: boolean;
|
|
59
|
+
id?: string;
|
|
60
|
+
className?: string;
|
|
61
|
+
style?: React.CSSProperties;
|
|
62
|
+
}
|
|
63
|
+
interface InternalShellProps extends PickerShellProps {
|
|
64
|
+
/** What the trigger reads. A placeholder when `empty`. */
|
|
65
|
+
display: React.ReactNode;
|
|
66
|
+
/**
|
|
67
|
+
* Every string the display could hold, so the trigger stops changing width
|
|
68
|
+
* with its value. `displaySamples` in `internal/date` produces them and
|
|
69
|
+
* `WidthSizer` is what lays them out.
|
|
70
|
+
*/
|
|
71
|
+
samples?: string[];
|
|
72
|
+
/** Nothing has been chosen yet, so the display is muted. */
|
|
73
|
+
empty: boolean;
|
|
74
|
+
/** Offers the × that empties the control. */
|
|
75
|
+
clearable?: boolean;
|
|
76
|
+
onClear: () => void;
|
|
77
|
+
open: boolean;
|
|
78
|
+
onOpenChange: (open: boolean) => void;
|
|
79
|
+
labels: PickerLabels;
|
|
80
|
+
/** `<input type="hidden">` rows, so the control submits with a form. */
|
|
81
|
+
hiddenValues?: Array<{
|
|
82
|
+
name: string;
|
|
83
|
+
value: string;
|
|
84
|
+
}>;
|
|
85
|
+
/** How far off the trigger the popup sits. */
|
|
86
|
+
sideOffset?: number;
|
|
87
|
+
children: React.ReactNode;
|
|
88
|
+
triggerRef?: React.Ref<HTMLButtonElement>;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* A trigger, a label, the two lines of text under it, and a popup.
|
|
92
|
+
*
|
|
93
|
+
* Everything about it that is visible is a decision already made elsewhere: the
|
|
94
|
+
* shell classes, the read-only and disabled treatments, the label's type scale
|
|
95
|
+
* and the way `invalid` re-points the whole colour family at `danger` so the
|
|
96
|
+
* edge, the ring and the message turn over together.
|
|
97
|
+
*/
|
|
98
|
+
export declare function PickerShell({ variant, size, color, density, elevation, label, description, error, invalid, startIcon, fullWidth, disabled, readOnly, required, id, className, style, display, samples, empty, clearable, onClear, open, onOpenChange, labels, hiddenValues, sideOffset, children, triggerRef }: InternalShellProps): React.JSX.Element;
|
|
99
|
+
/**
|
|
100
|
+
* The row of shortcuts under a picker's panel.
|
|
101
|
+
*
|
|
102
|
+
* A hairline above it rather than a gap, because the actions act on the panel
|
|
103
|
+
* and a gap would read as a second popup stacked under the first.
|
|
104
|
+
*/
|
|
105
|
+
export declare function PickerFooter({ size, children }: {
|
|
106
|
+
size: NebaSize;
|
|
107
|
+
children: React.ReactNode;
|
|
108
|
+
}): React.JSX.Element;
|
|
109
|
+
/** The vertical hairline between a calendar and the clock beside it. */
|
|
110
|
+
export declare function PickerDivider(): React.JSX.Element;
|
|
111
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as a from"react";import{Field as i}from"@base-ui/react/field";import{Popover as t}from"@base-ui/react/popover";import{CloseIcon as l}from"./icons";import{WidthSizer as r}from"./sizer";import{chipRemoveClasses as o,controlHeightClasses as s,controlTextLeadingClasses as d,cx as c,disabledClasses as p,fieldReadOnlyClasses as u,fieldRestClasses as m,focusWithinRingClasses as f,gapClasses as b,iconClasses as h,metaTextClasses as x,paddingXClasses as g,radiusClasses as v,stackGapClasses as y,surfaceClasses as N,surfaceSlots as w,transitionClasses as P}from"./styles";export function popupSlots(e,n){return{...w(e,n),"--n-fill":`var(--neba-${e}-fill)`,"--n-fill-hover":`var(--neba-${e}-fill-hover)`,"--n-fill-active":`var(--neba-${e}-fill-active)`,"--n-on-solid":`var(--neba-${e}-on-solid)`}}const k=["group relative flex w-full items-center select-none","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",P,"focus-within:[transition-duration:0ms]",f,h].join(" ");export const pickerPopupClasses=[N,"border bg-(--n-panel-press)","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]","[outline:none]","[transition:opacity_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" ");export const popupPaddingClasses={xs:"p-1.5",sm:"p-2",md:"p-2.5",lg:"p-3",xl:"p-3.5"};export function PickerShell({variant:f="outline",size:h="md",color:N="primary",density:P="default",elevation:C=0,label:$,description:j,error:O,invalid:z,startIcon:F,fullWidth:R=!1,disabled:S=!1,readOnly:q=!1,required:D=!1,id:I,className:_,style:B,display:E,samples:L,empty:T,clearable:V=!1,onClear:W,open:A,onOpenChange:G,labels:H,hiddenValues:J,sideOffset:K=6,children:M,triggerRef:Q}){const U=a.useId(),X=I??`${U}-trigger`,Y=`${U}-label`,Z=`${U}-description`,ee=`${U}-error`,ne=null!=O&&!1!==O&&""!==O,ae=z??ne,ie=ae?"danger":N,te=S||q,le=[j?Z:null,ne?ee:null].filter(Boolean).join(" ")||void 0;return n(i.Root,{disabled:S,invalid:ae,className:c("flex-col align-top",y[h],R?"flex w-full":"inline-flex",_),style:{...w(ie,C),...B},children:[$?e(i.Label,{id:Y,htmlFor:X,className:c(x[h],"font-medium",S?"text-(--neba-disabled-fg)":"text-(--neba-fg)"),children:$}):null,n(t.Root,{open:A,onOpenChange:e=>G(e),children:[n("span",{className:c(k,s[h],d[h],v[h],b[h],g[P][h],S?p[f]:q?u[f]:m[f]),children:[n(t.Trigger,{id:X,ref:Q,disabled:S,"aria-labelledby":$?Y:void 0,"aria-describedby":le,"aria-required":D||void 0,"aria-invalid":ae||void 0,className:c("flex min-w-0 flex-1 items-center bg-transparent text-start [font:inherit] text-inherit",b[h],"[outline:none]",te?"cursor-default":"cursor-pointer"),children:[F?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg) transition-[color] duration-(--neba-duration) group-focus-within:text-(--n-accent)",children:F}):null,n("span",{className:"flex min-w-0 flex-1 flex-col",children:[e("span",{className:c("w-full truncate",T?"text-(--neba-muted-fg)":"text-(--neba-fg)"),children:E}),e(r,{samples:L??[]})]})]}),!V||T||te?null:e("button",{type:"button","aria-label":H.clear,className:c(o,"text-(--neba-muted-fg)"),onClick:e=>{e.stopPropagation(),W()},children:e(l,{})})]}),e(t.Portal,{children:e(t.Positioner,{className:"neba-portal z-50 [outline:none]",sideOffset:K,align:"start",children:e(t.Popup,{initialFocus:!1,className:c(pickerPopupClasses,v[h],popupPaddingClasses[h],d[h]),style:popupSlots(ie,3),children:M})})})]}),j?e(i.Description,{id:Z,className:c(x[h],"text-(--neba-muted-fg)"),children:j}):null,ne?e(i.Error,{id:ee,match:!0,className:c(x[h],"text-(--n-accent)"),children:O}):null,J?.map((n,a)=>e("input",{type:"hidden",name:n.name,value:n.value},a))]})}export function PickerFooter({size:n,children:a}){return e("div",{className:c("flex items-center justify-end border-t pt-1.5","[border-color:var(--n-line)]",b[n]),children:a})}export function PickerDivider(){return e("div",{"aria-hidden":"true",className:"w-px self-stretch bg-(--n-line)"})}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Holds a control open at the width of the widest thing it could ever say.
|
|
4
|
+
*
|
|
5
|
+
* A control that is not `fullWidth` is sized by what it is *currently* saying,
|
|
6
|
+
* which for anything whose value changes means the box changes with it. A Select
|
|
7
|
+
* showing `Seoul` is narrower than the same Select showing `Washington DC`; a
|
|
8
|
+
* DatePicker on the 1st is fourteen pixels narrower than the same picker on the
|
|
9
|
+
* 28th. Either way the field moves under the pointer that just used it, and the
|
|
10
|
+
* whole row of controls beside it shuffles along.
|
|
11
|
+
*
|
|
12
|
+
* So the alternatives are laid out too, stacked in a box that is clipped to no
|
|
13
|
+
* height. The control's intrinsic width becomes the widest of them and stops
|
|
14
|
+
* depending on the value.
|
|
15
|
+
*
|
|
16
|
+
* Three things it deliberately is not:
|
|
17
|
+
*
|
|
18
|
+
* - **Not `hidden`, and not `display: none`.** Both take the box out of layout,
|
|
19
|
+
* and a box that is not laid out reserves nothing.
|
|
20
|
+
* - **Not read out.** `aria-hidden`, or a screen reader would announce every
|
|
21
|
+
* value the control might hold before the one it does.
|
|
22
|
+
* - **Not text.** A string sample is drawn as generated content off a data
|
|
23
|
+
* attribute rather than as a text node. `content: attr(…)` lays out exactly
|
|
24
|
+
* like text, so it reserves the same width — but it leaves nothing for
|
|
25
|
+
* `getByText` or a screen reader's find-in-page to trip over, and a caller's
|
|
26
|
+
* test asking for the option they selected keeps finding one element rather
|
|
27
|
+
* than two. Only a sample that is not a string — a Select option whose label
|
|
28
|
+
* is a node — has to be rendered for real, because there is nothing to put in
|
|
29
|
+
* an attribute.
|
|
30
|
+
*/
|
|
31
|
+
export declare function WidthSizer({ samples }: {
|
|
32
|
+
samples: readonly React.ReactNode[];
|
|
33
|
+
}): React.JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";export function WidthSizer({samples:a}){return 0===a.length?null:e("span",{"aria-hidden":"true",className:"invisible h-0 min-h-0 overflow-hidden",children:a.map((a,n)=>"string"==typeof a?e("span",{"data-sample":a,className:"block whitespace-nowrap before:content-[attr(data-sample)]"},`${n}:${a}`):e("span",{className:"block whitespace-nowrap",children:a},n))})}
|
|
@@ -53,6 +53,20 @@ export declare const metaTextClasses: Record<NebaSize, string>;
|
|
|
53
53
|
* two-pixel nudge.
|
|
54
54
|
*/
|
|
55
55
|
export declare const paddingXClasses: Record<NebaDensity, Record<NebaSize, string>>;
|
|
56
|
+
/**
|
|
57
|
+
* A glyph standing on its own, rather than one riding on a label.
|
|
58
|
+
*
|
|
59
|
+
* `iconClasses` below sizes an icon *inside* a control at `1.2em`, which is
|
|
60
|
+
* right when there is a word next to it to be measured against. An `Icon` on its
|
|
61
|
+
* own has no word, so it needs a box — and the box is its own ladder rather than
|
|
62
|
+
* a step off `controlHeightClasses`, because an icon is not a control: at 32px a
|
|
63
|
+
* `md` glyph would be the size of the button it usually sits in.
|
|
64
|
+
*
|
|
65
|
+
* The steps are the sizes icon sets are actually drawn at — 14, 16, 20, 24, 28 —
|
|
66
|
+
* so a Neba `Icon` lands on the same grid as whatever library the glyph came
|
|
67
|
+
* from and never has to be resampled.
|
|
68
|
+
*/
|
|
69
|
+
export declare const iconSizeClasses: Record<NebaSize, string>;
|
|
56
70
|
/**
|
|
57
71
|
* A tick box: the square a Checkbox draws and the circle a Radio draws.
|
|
58
72
|
*
|
|
@@ -68,6 +82,25 @@ export declare const tickSizeClasses: Record<NebaSize, string>;
|
|
|
68
82
|
* a sheet with the corners cut off, never a pill.
|
|
69
83
|
*/
|
|
70
84
|
export declare const tickRadiusClasses: Record<NebaSize, string>;
|
|
85
|
+
/**
|
|
86
|
+
* The dot inside a checked Radio.
|
|
87
|
+
*
|
|
88
|
+
* Whole pixels at every step rather than a percentage of the ring around it.
|
|
89
|
+
* `38%` of an 18px box is 6.08px, and a circle whose diameter lands between two
|
|
90
|
+
* device pixels is antialiased unevenly on its four sides — which is exactly
|
|
91
|
+
* what reads as "the dot is not centred" even when the box says it is.
|
|
92
|
+
*/
|
|
93
|
+
export declare const tickDotClasses: Record<NebaSize, string>;
|
|
94
|
+
/**
|
|
95
|
+
* The line box a tick and its label share.
|
|
96
|
+
*
|
|
97
|
+
* Both the tick's wrapper and the label are measured against it: the wrapper is
|
|
98
|
+
* `h-[1lh]` so the box centres on the label's *first* line rather than on the
|
|
99
|
+
* whole block, and that only lines up if the two agree on what a line is. Left
|
|
100
|
+
* to inherit, `1lh` picks up whatever leading the host page happens to set and
|
|
101
|
+
* the tick drifts a pixel or two off the text beside it.
|
|
102
|
+
*/
|
|
103
|
+
export declare const tickRowLeadingClasses = "leading-[1.4]";
|
|
71
104
|
/**
|
|
72
105
|
* The same two tracks again, as raw lengths.
|
|
73
106
|
*
|
package/dist/internal/styles.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const radiusClasses={xs:"rounded-(--neba-radius-xs)",sm:"rounded-(--neba-radius-sm)",md:"rounded-(--neba-radius-md)",lg:"rounded-(--neba-radius-lg)",xl:"rounded-(--neba-radius-xl)"};export const controlHeightClasses={xs:"h-5.5",sm:"h-6.5",md:"h-8",lg:"h-10",xl:"h-12"};export const controlSquareClasses={xs:"w-5.5",sm:"w-6.5",md:"w-8",lg:"w-10",xl:"w-12"};export const controlTextClasses={xs:"text-[0.6875rem]",sm:"text-[0.75rem]",md:"text-[0.8125rem]",lg:"text-[0.9375rem]",xl:"text-[1.0625rem]"};export const controlTextLeadingClasses={xs:"text-[0.6875rem]/[0.875rem]",sm:"text-[0.75rem]/[1rem]",md:"text-[0.8125rem]/[1.25rem]",lg:"text-[0.9375rem]/[1.375rem]",xl:"text-[1.0625rem]/[1.625rem]"};export const metaTextClasses={xs:"text-[0.625rem]",sm:"text-[0.6875rem]",md:"text-[0.75rem]",lg:"text-[0.8125rem]",xl:"text-[0.875rem]"};export const paddingXClasses={default:{xs:"px-2.5",sm:"px-3",md:"px-4",lg:"px-5",xl:"px-6"},compact:{xs:"px-1.5",sm:"px-2",md:"px-2.5",lg:"px-3",xl:"px-4"}};export const tickSizeClasses={xs:"size-3.5",sm:"size-4",md:"size-4.5",lg:"size-5",xl:"size-6"};export const tickRadiusClasses={xs:"rounded-[0.25rem]",sm:"rounded-[0.3125rem]",md:"rounded-[0.375rem]",lg:"rounded-[0.4375rem]",xl:"rounded-[0.5rem]"};export const paddingXValues={default:{xs:"0.625rem",sm:"0.75rem",md:"1rem",lg:"1.25rem",xl:"1.5rem"},compact:{xs:"0.375rem",sm:"0.5rem",md:"0.625rem",lg:"0.75rem",xl:"1rem"}};export const gapClasses={xs:"gap-1",sm:"gap-1.5",md:"gap-1.5",lg:"gap-2",xl:"gap-2.5"};export const stackGapClasses={xs:"gap-1",sm:"gap-1",md:"gap-1.5",lg:"gap-1.5",xl:"gap-2"};export const sheetTitleClasses={xs:"text-[0.75rem]/[1rem]",sm:"text-[0.8125rem]/[1.125rem]",md:"text-[0.9375rem]/[1.25rem]",lg:"text-[1.0625rem]/[1.5rem]",xl:"text-[1.25rem]/[1.75rem]"};export const sheetBodyClasses={xs:"text-[0.6875rem]/[1rem]",sm:"text-[0.75rem]/[1.125rem]",md:"text-[0.8125rem]/[1.375rem]",lg:"text-[0.9375rem]/[1.5rem]",xl:"text-[1.0625rem]/[1.75rem]"};export const sheetHeaderGapClasses={xs:"gap-0.5",sm:"gap-0.5",md:"gap-1",lg:"gap-1",xl:"gap-1.5"};export const sheetSectionGapClasses={xs:"gap-1.5",sm:"gap-2",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const surfaceClasses="[background-image:var(--neba-grain),var(--neba-sheen)] [background-blend-mode:overlay,normal] [backdrop-filter:var(--neba-blur)]";export const transitionClasses=["[transition-property:background-color,border-color,box-shadow,color]","[transition-duration:var(--neba-duration-fill),var(--neba-duration),var(--neba-duration),var(--neba-duration)]","[transition-timing-function:var(--neba-ease)]"].join(" ");export const pressTransitionClasses="active:[transition-duration:0ms]";export const focusRingClasses="focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2";export const focusWithinRingClasses="has-[:focus-visible]:[outline:2px_solid_var(--n-ring)] has-[:focus-visible]:outline-offset-2";export const iconClasses="[&_svg]:pointer-events-none [&_svg]:size-[1.2em] [&_svg]:shrink-0";export const srOnlyClasses="absolute size-px overflow-hidden whitespace-nowrap [clip-path:inset(50%)]";export function controlSlots(e,s,r){const n="solid"===r;return{"--n-fill":`var(--neba-${e}-fill)`,"--n-fill-hover":`var(--neba-${e}-fill-hover)`,"--n-fill-active":`var(--neba-${e}-fill-active)`,"--n-on-solid":`var(--neba-${e}-on-solid)`,"--n-accent":`var(--neba-${e}-accent)`,"--n-soft":`var(--neba-${e}-soft)`,"--n-soft-hover":`var(--neba-${e}-soft-hover)`,"--n-soft-press":`var(--neba-${e}-soft-press)`,"--n-panel":`var(--neba-${e}-panel)`,"--n-panel-hover":`var(--neba-${e}-panel-hover)`,"--n-panel-press":`var(--neba-${e}-panel-press)`,"--n-line":`var(--neba-${e}-line)`,"--n-line-hover":`var(--neba-${e}-line-hover)`,"--n-ring":`var(--neba-${e}-ring)`,"--n-glow":n?"var(--neba-glow-on-fill)":`var(--neba-${e}-soft)`,"--n-flash":n?"var(--neba-flash-on-fill)":`var(--neba-${e}-soft-press)`,"--n-elev":`var(--neba-shadow-${s})`,"--n-elev-hover":`var(--neba-shadow-${Math.min(s+1,4)})`,"--n-elev-press":`var(--neba-shadow-${Math.max(s-1,0)})`}}export function surfaceSlots(e,s){return{"--n-accent":`var(--neba-${e}-accent)`,"--n-soft":`var(--neba-${e}-soft)`,"--n-soft-hover":`var(--neba-${e}-soft-hover)`,"--n-soft-press":`var(--neba-${e}-soft-press)`,"--n-panel":"var(--neba-panel)","--n-panel-hover":"var(--neba-panel-hover)","--n-panel-press":"var(--neba-panel-press)","--n-line":`var(--neba-${e}-line)`,"--n-line-hover":`var(--neba-${e}-line-hover)`,"--n-ring":`var(--neba-${e}-ring)`,"--n-elev":`var(--neba-shadow-${s})`}}export const disabledClasses={solid:"cursor-not-allowed bg-(--neba-disabled-bg) text-(--neba-disabled-fg) shadow-none",outline:"cursor-not-allowed border bg-transparent text-(--neba-disabled-fg) [border-color:var(--neba-disabled-border)] shadow-none",text:"cursor-not-allowed bg-transparent text-(--neba-disabled-fg) shadow-none"};export const fieldRestClasses={solid:[surfaceClasses,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]","hover:bg-(--n-panel-press)","focus-within:bg-(--n-panel-press)"].join(" "),outline:[surfaceClasses,"border text-(--neba-fg) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]","hover:bg-(--n-panel-hover) hover:[border-color:var(--n-line-hover)]","focus-within:bg-(--n-panel-hover) focus-within:[border-color:var(--n-ring)]"].join(" "),text:["text-(--neba-fg) bg-transparent","hover:bg-(--n-soft)","focus-within:bg-(--n-soft-hover)"].join(" ")};export const fieldReadOnlyClasses={solid:[surfaceClasses,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--neba-plate-solid)] [filter:saturate(0.55)]"].join(" "),outline:[surfaceClasses,"border text-(--neba-fg) bg-(--n-panel)","[border-color:var(--n-line)] [box-shadow:var(--neba-plate-glass)] [filter:saturate(0.55)]"].join(" "),text:"text-(--neba-fg) bg-transparent [filter:saturate(0.55)]"};export const readOnlyFilterClasses="[filter:saturate(0.55)]";export const chipRemoveClasses=["ms-0.5 inline-flex shrink-0 items-center justify-center rounded-full","size-[1.15em] cursor-pointer opacity-70","[transition:opacity_var(--neba-duration)_var(--neba-ease)]","hover:opacity-100 focus-visible:opacity-100","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1","disabled:cursor-not-allowed"].join(" ");export function hasContent(e){return null!=e&&!1!==e&&""!==e}export function cx(...e){return e.filter(Boolean).join(" ")}
|
|
1
|
+
export const radiusClasses={xs:"rounded-(--neba-radius-xs)",sm:"rounded-(--neba-radius-sm)",md:"rounded-(--neba-radius-md)",lg:"rounded-(--neba-radius-lg)",xl:"rounded-(--neba-radius-xl)"};export const controlHeightClasses={xs:"h-5.5",sm:"h-6.5",md:"h-8",lg:"h-10",xl:"h-12"};export const controlSquareClasses={xs:"w-5.5",sm:"w-6.5",md:"w-8",lg:"w-10",xl:"w-12"};export const controlTextClasses={xs:"text-[0.6875rem]",sm:"text-[0.75rem]",md:"text-[0.8125rem]",lg:"text-[0.9375rem]",xl:"text-[1.0625rem]"};export const controlTextLeadingClasses={xs:"text-[0.6875rem]/[0.875rem]",sm:"text-[0.75rem]/[1rem]",md:"text-[0.8125rem]/[1.25rem]",lg:"text-[0.9375rem]/[1.375rem]",xl:"text-[1.0625rem]/[1.625rem]"};export const metaTextClasses={xs:"text-[0.625rem]",sm:"text-[0.6875rem]",md:"text-[0.75rem]",lg:"text-[0.8125rem]",xl:"text-[0.875rem]"};export const paddingXClasses={default:{xs:"px-2.5",sm:"px-3",md:"px-4",lg:"px-5",xl:"px-6"},compact:{xs:"px-1.5",sm:"px-2",md:"px-2.5",lg:"px-3",xl:"px-4"}};export const iconSizeClasses={xs:"size-3.5",sm:"size-4",md:"size-5",lg:"size-6",xl:"size-7"};export const tickSizeClasses={xs:"size-3.5",sm:"size-4",md:"size-4.5",lg:"size-5",xl:"size-6"};export const tickRadiusClasses={xs:"rounded-[0.25rem]",sm:"rounded-[0.3125rem]",md:"rounded-[0.375rem]",lg:"rounded-[0.4375rem]",xl:"rounded-[0.5rem]"};export const tickDotClasses={xs:"size-[0.3125rem]",sm:"size-1.5",md:"size-[0.4375rem]",lg:"size-2",xl:"size-[0.5625rem]"};export const tickRowLeadingClasses="leading-[1.4]";export const paddingXValues={default:{xs:"0.625rem",sm:"0.75rem",md:"1rem",lg:"1.25rem",xl:"1.5rem"},compact:{xs:"0.375rem",sm:"0.5rem",md:"0.625rem",lg:"0.75rem",xl:"1rem"}};export const gapClasses={xs:"gap-1",sm:"gap-1.5",md:"gap-1.5",lg:"gap-2",xl:"gap-2.5"};export const stackGapClasses={xs:"gap-1",sm:"gap-1",md:"gap-1.5",lg:"gap-1.5",xl:"gap-2"};export const sheetTitleClasses={xs:"text-[0.75rem]/[1rem]",sm:"text-[0.8125rem]/[1.125rem]",md:"text-[0.9375rem]/[1.25rem]",lg:"text-[1.0625rem]/[1.5rem]",xl:"text-[1.25rem]/[1.75rem]"};export const sheetBodyClasses={xs:"text-[0.6875rem]/[1rem]",sm:"text-[0.75rem]/[1.125rem]",md:"text-[0.8125rem]/[1.375rem]",lg:"text-[0.9375rem]/[1.5rem]",xl:"text-[1.0625rem]/[1.75rem]"};export const sheetHeaderGapClasses={xs:"gap-0.5",sm:"gap-0.5",md:"gap-1",lg:"gap-1",xl:"gap-1.5"};export const sheetSectionGapClasses={xs:"gap-1.5",sm:"gap-2",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const surfaceClasses="[background-image:var(--neba-grain),var(--neba-sheen)] [background-blend-mode:overlay,normal] [backdrop-filter:var(--neba-blur)]";export const transitionClasses=["[transition-property:background-color,border-color,box-shadow,color]","[transition-duration:var(--neba-duration-fill),var(--neba-duration),var(--neba-duration),var(--neba-duration)]","[transition-timing-function:var(--neba-ease)]"].join(" ");export const pressTransitionClasses="active:[transition-duration:0ms]";export const focusRingClasses="focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2";export const focusWithinRingClasses="has-[:focus-visible]:[outline:2px_solid_var(--n-ring)] has-[:focus-visible]:outline-offset-2";export const iconClasses="[&_svg]:pointer-events-none [&_svg]:size-[1.2em] [&_svg]:shrink-0";export const srOnlyClasses="absolute size-px overflow-hidden whitespace-nowrap [clip-path:inset(50%)]";export function controlSlots(e,s,r){const n="solid"===r;return{"--n-fill":`var(--neba-${e}-fill)`,"--n-fill-hover":`var(--neba-${e}-fill-hover)`,"--n-fill-active":`var(--neba-${e}-fill-active)`,"--n-on-solid":`var(--neba-${e}-on-solid)`,"--n-accent":`var(--neba-${e}-accent)`,"--n-soft":`var(--neba-${e}-soft)`,"--n-soft-hover":`var(--neba-${e}-soft-hover)`,"--n-soft-press":`var(--neba-${e}-soft-press)`,"--n-panel":`var(--neba-${e}-panel)`,"--n-panel-hover":`var(--neba-${e}-panel-hover)`,"--n-panel-press":`var(--neba-${e}-panel-press)`,"--n-line":`var(--neba-${e}-line)`,"--n-line-hover":`var(--neba-${e}-line-hover)`,"--n-ring":`var(--neba-${e}-ring)`,"--n-glow":n?"var(--neba-glow-on-fill)":`var(--neba-${e}-soft)`,"--n-flash":n?"var(--neba-flash-on-fill)":`var(--neba-${e}-soft-press)`,"--n-elev":`var(--neba-shadow-${s})`,"--n-elev-hover":`var(--neba-shadow-${Math.min(s+1,4)})`,"--n-elev-press":`var(--neba-shadow-${Math.max(s-1,0)})`}}export function surfaceSlots(e,s){return{"--n-accent":`var(--neba-${e}-accent)`,"--n-soft":`var(--neba-${e}-soft)`,"--n-soft-hover":`var(--neba-${e}-soft-hover)`,"--n-soft-press":`var(--neba-${e}-soft-press)`,"--n-panel":"var(--neba-panel)","--n-panel-hover":"var(--neba-panel-hover)","--n-panel-press":"var(--neba-panel-press)","--n-line":`var(--neba-${e}-line)`,"--n-line-hover":`var(--neba-${e}-line-hover)`,"--n-ring":`var(--neba-${e}-ring)`,"--n-elev":`var(--neba-shadow-${s})`}}export const disabledClasses={solid:"cursor-not-allowed bg-(--neba-disabled-bg) text-(--neba-disabled-fg) shadow-none",outline:"cursor-not-allowed border bg-transparent text-(--neba-disabled-fg) [border-color:var(--neba-disabled-border)] shadow-none",text:"cursor-not-allowed bg-transparent text-(--neba-disabled-fg) shadow-none"};export const fieldRestClasses={solid:[surfaceClasses,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]","hover:bg-(--n-panel-press)","focus-within:bg-(--n-panel-press)"].join(" "),outline:[surfaceClasses,"border text-(--neba-fg) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]","hover:bg-(--n-panel-hover) hover:[border-color:var(--n-line-hover)]","focus-within:bg-(--n-panel-hover) focus-within:[border-color:var(--n-ring)]"].join(" "),text:["text-(--neba-fg) bg-transparent","hover:bg-(--n-soft)","focus-within:bg-(--n-soft-hover)"].join(" ")};export const fieldReadOnlyClasses={solid:[surfaceClasses,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--neba-plate-solid)] [filter:saturate(0.55)]"].join(" "),outline:[surfaceClasses,"border text-(--neba-fg) bg-(--n-panel)","[border-color:var(--n-line)] [box-shadow:var(--neba-plate-glass)] [filter:saturate(0.55)]"].join(" "),text:"text-(--neba-fg) bg-transparent [filter:saturate(0.55)]"};export const readOnlyFilterClasses="[filter:saturate(0.55)]";export const chipRemoveClasses=["ms-0.5 inline-flex shrink-0 items-center justify-center rounded-full","size-[1.15em] cursor-pointer opacity-70","[transition:opacity_var(--neba-duration)_var(--neba-ease)]","hover:opacity-100 focus-visible:opacity-100","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1","disabled:cursor-not-allowed"].join(" ");export function hasContent(e){return null!=e&&!1!==e&&""!==e}export function cx(...e){return e.filter(Boolean).join(" ")}
|