@box-kite/react 2.2.4 → 2.2.6
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/.claude/rules/box-kite-rules.md +11 -1
- package/.claude/skills/box-kite/SKILL.md +11 -1
- package/.claude/skills/box-kite/references/components.md +83 -3
- package/.cursor/rules/box-kite.mdc +11 -1
- package/AGENTS.md +11 -1
- package/BOX_AI_CONTEXT.md +371 -25
- package/BOX_KITE_AI_CONTEXT.md +371 -25
- package/behavior.cjs +1 -1
- package/behavior.mjs +57 -57
- package/box.cjs +1 -1
- package/box.d.ts +5 -0
- package/box.mjs +15 -15
- package/catalog.cjs +1 -1
- package/catalog.mjs +906 -0
- package/client.cjs +1 -1
- package/client.mjs +94 -80
- package/components/calendar.cjs +1 -0
- package/components/calendar.d.ts +77 -0
- package/components/calendar.mjs +483 -0
- package/components/dashboard.cjs +1 -1
- package/components/dashboard.mjs +1 -1
- package/components/dataGrid/components/dataGridBooleanValue.d.ts +11 -0
- package/components/dataGrid/components/dataGridDateParts.d.ts +40 -0
- package/components/dataGrid/components/dataGridDateValue.d.ts +14 -0
- package/components/dataGrid/components/dataGridList.d.ts +12 -0
- package/components/dataGrid/components/dataGridListAggregate.d.ts +7 -0
- package/components/dataGrid/components/dataGridListFilter.d.ts +7 -0
- package/components/dataGrid/components/dataGridListFilterSheet.d.ts +11 -0
- package/components/dataGrid/components/dataGridListFooter.d.ts +13 -0
- package/components/dataGrid/components/dataGridListGroup.d.ts +13 -0
- package/components/dataGrid/components/dataGridListItem.d.ts +21 -0
- package/components/dataGrid/components/dataGridListLayout.d.ts +20 -0
- package/components/dataGrid/components/dataGridListRecord.d.ts +11 -0
- package/components/dataGrid/components/dataGridListSelectionBar.d.ts +11 -0
- package/components/dataGrid/components/dataGridListSheet.d.ts +30 -0
- package/components/dataGrid/components/dataGridListSortSheet.d.ts +10 -0
- package/components/dataGrid/components/dataGridListToolbar.d.ts +10 -0
- package/components/dataGrid/components/dataGridListValue.d.ts +12 -0
- package/components/dataGrid/contracts/dataGridContract.d.ts +70 -11
- package/components/dataGrid/models/columnModel.d.ts +3 -1
- package/components/dataGrid/models/editModel.d.ts +3 -1
- package/components/dataGrid/models/gridModel.d.ts +3 -0
- package/components/dataGrid/models/listModel.d.ts +129 -0
- package/components/dataGrid/models/localeText.d.ts +36 -0
- package/components/dataGrid/models/viewportModel.d.ts +0 -2
- package/components/dataGrid/useDateParts.d.ts +17 -0
- package/components/dataGrid/useListLayout.d.ts +13 -0
- package/components/dataGrid.cjs +3 -3
- package/components/dataGrid.mjs +1251 -854
- package/components/dateField.cjs +1 -0
- package/components/dateField.d.ts +78 -0
- package/components/dateField.mjs +313 -0
- package/components/datePicker.cjs +1 -0
- package/components/datePicker.d.ts +120 -0
- package/components/datePicker.mjs +529 -0
- package/components/dateTime.cjs +1 -0
- package/components/dateTime.d.ts +23 -0
- package/components/dateTime.mjs +34 -0
- package/components/dialog.cjs +1 -1
- package/components/dialog.mjs +29 -29
- package/components/list/listItemParts.d.ts +9 -0
- package/components/list.cjs +1 -0
- package/components/list.d.ts +118 -0
- package/components/list.mjs +391 -0
- package/components/menu.cjs +1 -1
- package/components/menu.mjs +25 -25
- package/components/overlay.cjs +1 -1
- package/components/overlay.mjs +12 -12
- package/components/semantics.d.ts +29 -29
- package/components/slider.cjs +1 -1
- package/components/slider.mjs +1 -1
- package/components/sortableList.cjs +1 -0
- package/components/sortableList.d.ts +49 -0
- package/components/sortableList.mjs +384 -0
- package/components/swipeItem.cjs +1 -0
- package/components/swipeItem.d.ts +52 -0
- package/components/swipeItem.mjs +321 -0
- package/components/tabs.cjs +1 -1
- package/components/tabs.mjs +1 -1
- package/components/timeZoneSelect.cjs +1 -0
- package/components/timeZoneSelect.d.ts +52 -0
- package/components/timeZoneSelect.mjs +74 -0
- package/components/toaster.cjs +1 -1
- package/components/toaster.mjs +24 -24
- package/components/virtualList.cjs +1 -0
- package/components/virtualList.d.ts +32 -0
- package/components/virtualList.mjs +188 -0
- package/dataGridDateParts.cjs +1 -0
- package/dataGridDateParts.mjs +223 -0
- package/dataGridList.cjs +1 -0
- package/dataGridList.mjs +1314 -0
- package/dataGridListLayout.cjs +1 -0
- package/dataGridListLayout.mjs +49 -0
- package/date-environment.cjs +1 -0
- package/date-environment.mjs +29 -0
- package/date-input.cjs +1 -0
- package/date-input.mjs +346 -0
- package/date-math.cjs +1 -0
- package/date-math.mjs +317 -0
- package/date.cjs +1 -0
- package/date.d.ts +40 -0
- package/date.mjs +4 -0
- package/dates.cjs +1 -0
- package/dates.mjs +689 -0
- package/docs/components.md +10 -1
- package/icons/closeIcon.d.ts +2 -0
- package/icons/filterIcon.d.ts +2 -0
- package/layer.cjs +1 -1
- package/layer.mjs +1 -1
- package/mcp/src/data.d.ts +2 -0
- package/package.json +178 -22
- package/placement.cjs +1 -1
- package/placement.mjs +10 -10
- package/platform.cjs +1 -1
- package/platform.mjs +4 -1
- package/react/a11y/useControllableState.d.ts +2 -1
- package/react/boxComponent.d.ts +1 -1
- package/react/componentsContext.d.ts +4 -0
- package/react/componentsProvider.d.ts +10 -0
- package/react/date/dateChange.d.ts +18 -0
- package/react/date/dateEnvironment.d.ts +34 -0
- package/react/resolveStyles.d.ts +2 -1
- package/react/theme/theme.d.ts +6 -1
- package/react-shared.cjs +1 -1
- package/react-shared.mjs +6 -6
- package/registry/blocks/dashboard-shell/dashboard-shell.d.ts +3 -1
- package/registry/designs/store/address-form.d.ts +11 -0
- package/registry/designs/store/cart-items.d.ts +10 -0
- package/registry/designs/store/cart-page.d.ts +4 -0
- package/registry/designs/store/checkout-page.d.ts +7 -0
- package/registry/designs/store/credit-card-form.d.ts +10 -0
- package/registry/designs/store/form-field.d.ts +19 -0
- package/registry/designs/store/order-summary.d.ts +18 -0
- package/registry/designs/store/product-art.d.ts +26 -0
- package/registry/designs/store/product-card.d.ts +11 -0
- package/registry/designs/store/product-gallery.d.ts +11 -0
- package/registry/designs/store/product-grid.d.ts +10 -0
- package/registry/designs/store/product-page.d.ts +5 -0
- package/registry/designs/store/quantity-stepper.d.ts +13 -0
- package/registry/designs/store/shipping-method.d.ts +14 -0
- package/registry/designs/store/store-data.d.ts +53 -0
- package/registry/designs/store/store-design.d.ts +63 -0
- package/registry/designs/store/store-shell.d.ts +12 -0
- package/registry/designs/store/storefront-page.d.ts +4 -0
- package/registry/designs/store/variant-picker.d.ts +15 -0
- package/rsc.cjs +1 -1
- package/rsc.d.ts +2 -0
- package/rsc.mjs +1 -1
- package/scrolling.cjs +1 -0
- package/scrolling.mjs +22 -0
- package/utils/date/calendar.d.ts +44 -0
- package/utils/date/calendarModel.d.ts +46 -0
- package/utils/date/dateTime.d.ts +144 -0
- package/utils/date/fieldModel.d.ts +74 -0
- package/utils/date/format.d.ts +39 -0
- package/utils/date/iso.d.ts +40 -0
- package/utils/date/locale.d.ts +17 -0
- package/utils/date/parse.d.ts +20 -0
- package/utils/date/settings.d.ts +26 -0
- package/utils/date/value.d.ts +43 -0
- package/utils/date/zoneOptions.d.ts +19 -0
- package/utils/date/zones.d.ts +32 -0
- package/utils/scroll/scrollUtils.d.ts +6 -0
- package/utils/sortable/sortableUtils.d.ts +25 -0
- package/utils/swipe/swipeUtils.d.ts +53 -0
- package/utils/virtual/measuredWindow.d.ts +28 -0
- package/utils/virtual/rowSearch.d.ts +11 -0
package/components/dialog.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { i } from "../
|
|
2
|
+
import { i as e } from "../client.mjs";
|
|
3
|
+
import { a as t, l as n, n as r, u as i } from "../platform.mjs";
|
|
4
4
|
import { n as a } from "../effects.mjs";
|
|
5
5
|
import o from "../box.mjs";
|
|
6
6
|
import { a as s, i as c, n as l, r as u } from "../behavior.mjs";
|
|
@@ -10,14 +10,14 @@ import { createContext as m, useCallback as h, useContext as g, useMemo as _, us
|
|
|
10
10
|
import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
11
11
|
//#region src/react/dialog/useScrollLock.ts
|
|
12
12
|
var C = 0;
|
|
13
|
-
function w(
|
|
14
|
-
let { classNames:
|
|
13
|
+
function w(t) {
|
|
14
|
+
let { classNames: n, styleElements: i } = e({ overflow: "hidden" }, !1), o = n.slice(1).join(" ");
|
|
15
15
|
return a(() => {
|
|
16
|
-
let
|
|
17
|
-
if (!(!
|
|
18
|
-
--C, C === 0 &&
|
|
16
|
+
let e = r();
|
|
17
|
+
if (!(!t || !e || !o)) return C += 1, e.classList.add(o), () => {
|
|
18
|
+
--C, C === 0 && e.classList.remove(o);
|
|
19
19
|
};
|
|
20
|
-
}, [
|
|
20
|
+
}, [t, o]), i;
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
23
23
|
//#region src/components/dialog.tsx
|
|
@@ -41,8 +41,8 @@ function O(e) {
|
|
|
41
41
|
dismissible: !1
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
function k(
|
|
45
|
-
let { role:
|
|
44
|
+
function k(e) {
|
|
45
|
+
let { role: t, trigger: r, children: i, open: u, defaultOpen: f = !1, onOpenChange: p, label: m, labelledBy: g, describedBy: v, modal: C = !0, dismissible: E = !0, lockScroll: D = C, initialFocus: O, props: k, ...j } = e, M = d("dialog"), N = j.id ?? M, [P, F] = c({
|
|
46
46
|
value: u,
|
|
47
47
|
defaultValue: f,
|
|
48
48
|
onChange: p
|
|
@@ -75,8 +75,8 @@ function k(t) {
|
|
|
75
75
|
dismissible: E,
|
|
76
76
|
triggerElement: R
|
|
77
77
|
}), a(() => {
|
|
78
|
-
let
|
|
79
|
-
!P || !
|
|
78
|
+
let e = n(O);
|
|
79
|
+
!P || !e || e.focus();
|
|
80
80
|
}, [P, O]);
|
|
81
81
|
let q = s((e) => {
|
|
82
82
|
F((e) => !e, {
|
|
@@ -108,7 +108,7 @@ function k(t) {
|
|
|
108
108
|
...Y,
|
|
109
109
|
id: N,
|
|
110
110
|
props: {
|
|
111
|
-
role:
|
|
111
|
+
role: t,
|
|
112
112
|
"aria-label": H.title || g ? void 0 : m,
|
|
113
113
|
"aria-labelledby": g ?? (H.title ? K.titleId : void 0),
|
|
114
114
|
"aria-describedby": v ?? (H.description ? K.descriptionId : void 0),
|
|
@@ -120,36 +120,36 @@ function k(t) {
|
|
|
120
120
|
] });
|
|
121
121
|
}
|
|
122
122
|
function A(e) {
|
|
123
|
-
let { dialog:
|
|
123
|
+
let { dialog: n, isOpen: r, domOpen: o, setDomOpen: s, setOpen: c, modal: l, dismissible: d, triggerElement: f } = e, p = v("imperative"), m = t(), h = d ? "any" : "closerequest";
|
|
124
124
|
a(() => {
|
|
125
|
-
!
|
|
125
|
+
!n || r === o || (s(r), r ? l ? n.showModal() : n.show() : n.close());
|
|
126
126
|
}, [
|
|
127
|
+
n,
|
|
127
128
|
r,
|
|
128
|
-
i,
|
|
129
129
|
o,
|
|
130
130
|
l,
|
|
131
131
|
s
|
|
132
132
|
]), a(() => {
|
|
133
|
-
if (!
|
|
133
|
+
if (!n) return;
|
|
134
134
|
let e = new AbortController();
|
|
135
|
-
return
|
|
135
|
+
return n.addEventListener("close", (e) => {
|
|
136
136
|
s(!1), c(!1, {
|
|
137
137
|
reason: p.current,
|
|
138
138
|
event: e
|
|
139
139
|
}), p.current = "imperative";
|
|
140
140
|
}, { signal: e.signal }), () => e.abort();
|
|
141
141
|
}, [
|
|
142
|
-
|
|
142
|
+
n,
|
|
143
143
|
s,
|
|
144
144
|
c
|
|
145
145
|
]), a(() => {
|
|
146
|
-
if (!(!
|
|
146
|
+
if (!(!n || !m)) return n.setAttribute("closedby", h), () => n.removeAttribute("closedby");
|
|
147
147
|
}, [
|
|
148
|
-
|
|
148
|
+
n,
|
|
149
149
|
m,
|
|
150
150
|
h
|
|
151
151
|
]), a(() => {
|
|
152
|
-
if (!
|
|
152
|
+
if (!r || !n) return;
|
|
153
153
|
let e = new AbortController(), t = (t, n) => document.addEventListener(t, n, {
|
|
154
154
|
signal: e.signal,
|
|
155
155
|
capture: !0
|
|
@@ -157,15 +157,15 @@ function A(e) {
|
|
|
157
157
|
return t("keydown", (e) => {
|
|
158
158
|
e.key === "Escape" && (p.current = "escape");
|
|
159
159
|
}), t("pointerdown", (e) => {
|
|
160
|
-
|
|
160
|
+
i(e, [f]) ? p.current = "trigger" : !i(e, [n]) || j(n, e) ? p.current = "outside-pointer" : p.current = "imperative";
|
|
161
161
|
}), () => e.abort();
|
|
162
162
|
}, [
|
|
163
|
-
i,
|
|
164
163
|
r,
|
|
164
|
+
n,
|
|
165
165
|
f
|
|
166
166
|
]), u({
|
|
167
|
-
enabled:
|
|
168
|
-
inside: [
|
|
167
|
+
enabled: r && !l && !m,
|
|
168
|
+
inside: [n],
|
|
169
169
|
escapeKey: !0,
|
|
170
170
|
outsidePointer: !1,
|
|
171
171
|
onDismiss: (e, t) => c(!1, {
|
|
@@ -173,10 +173,10 @@ function A(e) {
|
|
|
173
173
|
event: t
|
|
174
174
|
})
|
|
175
175
|
}), a(() => {
|
|
176
|
-
if (!
|
|
176
|
+
if (!n || !r || !d || m) return;
|
|
177
177
|
let e = new AbortController();
|
|
178
178
|
return document.addEventListener("pointerdown", (e) => {
|
|
179
|
-
|
|
179
|
+
i(e, [f]) || i(e, [n]) && !j(n, e) || c(!1, {
|
|
180
180
|
reason: "outside-pointer",
|
|
181
181
|
event: e
|
|
182
182
|
});
|
|
@@ -185,8 +185,8 @@ function A(e) {
|
|
|
185
185
|
capture: !0
|
|
186
186
|
}), () => e.abort();
|
|
187
187
|
}, [
|
|
188
|
+
n,
|
|
188
189
|
r,
|
|
189
|
-
i,
|
|
190
190
|
d,
|
|
191
191
|
m,
|
|
192
192
|
f,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BoxComponentStyles } from '@box-kite/core/types';
|
|
2
|
+
/** How an item's spacing is set: `md` by default, `sm` for a dense list, `lg` for one with room to breathe. */
|
|
3
|
+
export type ListItemSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
export declare const ITEM_FRAME: BoxComponentStyles;
|
|
5
|
+
/** The row an item lays its parts out in. */
|
|
6
|
+
export declare const ITEM_ROW: BoxComponentStyles;
|
|
7
|
+
export declare const ITEM_SIZES: Record<ListItemSize, BoxComponentStyles>;
|
|
8
|
+
/** A part's defaults under the props it was given. */
|
|
9
|
+
export declare function withDefaults<T extends object>(defaults: BoxComponentStyles, props: T): T;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../react-shared.cjs"),t=require("./svg.cjs");let n=require("@box-kite/core"),r=require("react/jsx-runtime"),i=require("@box-kite/react");var a={position:`relative`,css:{borderRadius:`var(--list-item-radius, 0)`},before:{position:`absolute`,top:0,insetEnd:0,css:{insetInlineStart:`var(--list-divider-inset, 0px)`,height:`1px`}},after:{position:`absolute`,inset:0,pointerEvents:`none`,css:{border:`var(--list-item-frame, none)`,borderRadius:`inherit`}},nth:{first:{before:{css:{display:`var(--list-first-divider, none)`}}}}},o={display:`flex`,ai:`center`,gap:3,px:4,py:3,minHeight:14},s={sm:{gap:2,py:2,minHeight:11},md:{},lg:{gap:4,py:4,minHeight:18}},c=[`css`,`before`,`after`,`nth`];function l(e,t){let r={...e,...t},i=e;for(let e of c){let a=t[e];i[e]&&a&&(r[e]=(0,n.mergeDeep)(i[e],a))}return r}var u=[`h1`,`h2`,`h3`,`h4`,`h5`,`h6`],d={fontVariantNumeric:`tabular-nums`},f={display:`flex`,ai:`center`,jc:`center`,flexShrink:0},p={icon:{width:10,height:10,borderRadius:2},avatar:{width:10,height:10,borderRadius:999,overflow:`hidden`,fontSize:14,fontWeight:600},image:{width:16,height:16,borderRadius:2,overflow:`hidden`}},m={display:`flex`,ai:`baseline`,jc:`space-between`,gap:2,minWidth:0},h={flexWrap:`wrap`,jc:`start`,rowGap:1},g={fontSize:14,lineHeight:20},_={"list.title":{display:`block`,minWidth:0,fontSize:16,lineHeight:22,fontWeight:500},"list.description":{display:`block`,minWidth:0,fontSize:14,lineHeight:20},"list.overline":{display:`block`,minWidth:0,fontSize:12,lineHeight:16,fontWeight:500}},v={color:`currentColor`,textDecoration:`none`,cursor:`pointer`,css:{display:`inherit`,font:`inherit`,textAlign:`inherit`,overflow:`inherit`,textOverflow:`inherit`,WebkitLineClamp:`inherit`,WebkitBoxOrient:`inherit`},after:{position:`absolute`,inset:0,css:{borderRadius:`var(--list-item-radius, 0)`}}},y={1:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},2:{overflow:`hidden`,css:{display:`-webkit-box`,WebkitBoxOrient:`vertical`,WebkitLineClamp:2}},3:{overflow:`hidden`,css:{display:`-webkit-box`,WebkitBoxOrient:`vertical`,WebkitLineClamp:3}}},b={content:{display:`flex`,d:`column`,gap:.5,flex1:!0,minWidth:0},meta:{flexShrink:0,fontSize:13,lineHeight:18,whiteSpace:`nowrap`,css:d},end:{display:`flex`,d:`column`,ai:`end`,gap:.5,flexShrink:0,maxWidth:`1/2`,textAlign:`end`,css:d},actions:{display:`flex`,ai:`center`,gap:1,flexShrink:0,position:`relative`,zIndex:1},fields:{display:`grid`,columnGap:4,rowGap:2,mt:1,css:{gridTemplateColumns:`repeat(auto-fill, minmax(min(8rem, 100%), 1fr))`}}};function x(e,t){let{props:n,...r}=e;return(0,i.useBoxElement)({tag:`ul`,component:`list`,...r,props:{role:`list`,...n}},t)}function S(e,t){let{size:n=`md`,wrap:c=!1,selected:u=!1,chevron:d=!1,variant:f,children:p,...m}=e;return(0,i.useBoxElement)({tag:`li`,component:`list.item`,...l({...a,...o,...s[n],...c?{flexWrap:`wrap`}:{}},m),variant:[f,{selected:u}],children:d?(0,r.jsxs)(r.Fragment,{children:[p,(0,r.jsx)(w,{})]}):p},t)}function C(e,n){return(0,i.useBoxElement)({tag:`span`,component:`list.muted`,display:`flex`,flexShrink:0,alignSelf:`center`,rtl:{flip:`xAxis`},...e,props:{"aria-hidden":!0,...e.props},children:(0,r.jsx)(t.Svg,{viewBox:`0 0 16 16`,width:`1rem`,fill:`none`,stroke:`currentColor`,strokeWidth:1.75,children:(0,r.jsx)(t.Path,{d:`M6 3.5 10.5 8 6 12.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})},n)}var w=e.f(C,`List.Chevron`);function T(e,t){let r=(0,n.classNames)(e.variant).find(e=>e in p);return(0,i.useBoxElement)({component:`list.media`,...f,...r?p[r]:{},...e},t)}function E(e,t){let{wrap:n=!1,secondary:r=!1,...a}=e;return(0,i.useBoxElement)({...r?{component:`list.muted`,...g}:{},...m,...n?h:{},...a},t)}function D(t,n){let r=t!==`list.title`;return e.f((e,n)=>{let{lines:a,...o}=e,s=a?l(_[t],y[a]):_[t];return(0,i.useBoxElement)({tag:`span`,...r?{component:`list.muted`}:{},...l(s,o)},n)},n)}function O(e,t){let{props:n,tag:r,onClick:a,...o}=e,s=r??(n?.href===void 0?n?.htmlFor===void 0?`button`:`label`:`a`);return(0,i.useBoxElement)({tag:s,component:`list.action`,...l(v,o),props:{...s===`button`?{type:`button`}:{},"data-list-action":``,...n,...a?{onClick:a}:{}}},t)}function k(e,t){let{label:n,children:a,...o}=e;return(0,i.useBoxElement)({minWidth:0,...o,children:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(A,{children:n}),(0,r.jsx)(j,{children:a})]})},t)}function A({children:e}){return(0,i.useBoxElement)({tag:`dt`,component:`list.muted`,fontSize:12,lineHeight:16,children:e})}function j({children:e}){return(0,i.useBoxElement)({tag:`dd`,minWidth:0,fontSize:14,lineHeight:20,css:{overflowWrap:`anywhere`,...d},children:e})}function M(e,t){let{label:n,level:a,sticky:o=!1,children:s,...c}=e;return(0,i.useBoxElement)({tag:`li`,...c,children:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(N,{level:a,sticky:o,children:n}),(0,r.jsx)(P,{children:s})]})},t)}function N({level:e,sticky:t,children:n}){return(0,i.useBoxElement)({tag:e?u[e-1]:`div`,component:`list.label`,px:4,py:1.5,fontSize:13,lineHeight:18,fontWeight:600,...t?{position:`sticky`,zIndex:2,css:{top:`var(--list-sticky-top, 0)`}}:{},children:n})}function P({children:e}){return(0,i.useBoxElement)({tag:`ul`,props:{role:`list`},children:e})}function F(t,n,r,a=!1){return e.f((e,r)=>(0,i.useBoxElement)({tag:t,...a?{component:`list.muted`}:{},...l(n,e)},r),r)}var I=e.f(T,`List.Media`),L=F(`div`,b.content,`List.Content`),R=D(`list.overline`,`List.Overline`),z=D(`list.title`,`List.Title`),B=D(`list.description`,`List.Description`),V=F(`span`,b.meta,`List.Meta`,!0),H=F(`div`,b.end,`List.End`),U=F(`div`,b.actions,`List.Actions`),W=F(`dl`,b.fields,`List.Fields`),G=e.f(x,`List`);G.Item=e.f(S,`List.Item`),G.Media=I,G.Content=L,G.Row=e.f(E,`List.Row`),G.Overline=R,G.Title=z,G.Description=B,G.Meta=V,G.End=H,G.Actions=U,G.Action=e.f(O,`List.Action`),G.Fields=W,G.Field=e.f(k,`List.Field`),G.Group=e.f(M,`List.Group`),G.Chevron=w,exports.default=G,exports.i=l,exports.n=o,exports.r=s,exports.t=a;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { RefAttributes } from 'react';
|
|
2
|
+
import { BoxProps, BoxTagProps } from '../box';
|
|
3
|
+
import { ExtractElementFromTag } from '../react/reactTypes';
|
|
4
|
+
import { ComponentsAndVariants } from '@box-kite/core/types';
|
|
5
|
+
import { ListItemSize } from './list/listItemParts';
|
|
6
|
+
export type { ListItemSize };
|
|
7
|
+
/** How many lines a text part runs to: `1` ends in an ellipsis, `2` and `3` are clamped. Unset, it wraps. */
|
|
8
|
+
export type ListLines = 1 | 2 | 3;
|
|
9
|
+
/** Which heading a group's label is. It says where the group sits in the page's outline, nothing more. */
|
|
10
|
+
export type ListGroupLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
11
|
+
type Part<TTag extends keyof React.JSX.IntrinsicElements, TKey extends keyof ComponentsAndVariants> = BoxProps<TTag, TKey> & RefAttributes<ExtractElementFromTag<TTag>>;
|
|
12
|
+
export interface ListProps<TKey extends keyof ComponentsAndVariants = 'list'> extends Omit<BoxProps<'ul', TKey>, 'tag'> {
|
|
13
|
+
/** The items: `List.Item`s, and `List.Group`s for sections. */
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
/** `ol` when the order means something — steps, a ranking. Default `ul`. */
|
|
16
|
+
tag?: 'ul' | 'ol';
|
|
17
|
+
}
|
|
18
|
+
export interface ListItemProps<TKey extends keyof ComponentsAndVariants = 'list.item'> extends BoxProps<'li', TKey> {
|
|
19
|
+
/** The item's parts: `List.Media`, `List.Content`, `List.End`, `List.Actions` — or anything at all, in one row. */
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
/** The item's spacing. Default `md`, at least 56px tall; `sm` is 44px, still a finger's width; `lg` is 72px. */
|
|
22
|
+
size?: ListItemSize;
|
|
23
|
+
/** Lets the item's parts wrap onto a second line when they do not fit, instead of squeezing. */
|
|
24
|
+
wrap?: boolean;
|
|
25
|
+
/** Tints the item as chosen. The state a reader hears belongs on the control that chose it — a checkbox, `aria-pressed`. */
|
|
26
|
+
selected?: boolean;
|
|
27
|
+
/** Ends the item with a chevron: pressing it goes somewhere with more. Decoration, so `aria-hidden`. */
|
|
28
|
+
chevron?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** A slot or a plain part: every Box prop, and what goes in it. `List.Media` takes `variant` `icon`, `avatar` or `image`. */
|
|
31
|
+
export interface ListPartProps<TKey extends keyof ComponentsAndVariants = never> extends BoxProps<'div', TKey> {
|
|
32
|
+
/** What goes in it. */
|
|
33
|
+
children?: React.ReactNode;
|
|
34
|
+
}
|
|
35
|
+
export interface ListRowProps<TKey extends keyof ComponentsAndVariants = never> extends BoxProps<'div', TKey> {
|
|
36
|
+
/** What sits side by side: a title and its time, a status and a count. The first takes the room, the last sits at the end. */
|
|
37
|
+
children?: React.ReactNode;
|
|
38
|
+
/** Lets the row's parts wrap onto a new line — a set of tags — instead of pushing the last to the end. */
|
|
39
|
+
wrap?: boolean;
|
|
40
|
+
/** The quieter line under the main one: smaller and muted. */
|
|
41
|
+
secondary?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface ListTextProps<TKey extends keyof ComponentsAndVariants = never> extends BoxProps<'span', TKey> {
|
|
44
|
+
/** The text. */
|
|
45
|
+
children?: React.ReactNode;
|
|
46
|
+
/** How many lines it runs to before it stops: `1` ends in an ellipsis, `2` and `3` are clamped. Unset, it wraps. */
|
|
47
|
+
lines?: ListLines;
|
|
48
|
+
}
|
|
49
|
+
/** A `List.Title`: the item's name, and where its `List.Action` goes. */
|
|
50
|
+
export type ListTitleProps<TKey extends keyof ComponentsAndVariants = never> = ListTextProps<TKey>;
|
|
51
|
+
/** A `List.Description`: muted supporting text under the title. */
|
|
52
|
+
export type ListDescriptionProps<TKey extends keyof ComponentsAndVariants = never> = ListTextProps<TKey>;
|
|
53
|
+
/** A `List.Overline`: a small line above the title — an id, a date, a category. */
|
|
54
|
+
export type ListOverlineProps<TKey extends keyof ComponentsAndVariants = never> = ListTextProps<TKey>;
|
|
55
|
+
/** A button's attributes, plus the two that turn the action into a link or a label. */
|
|
56
|
+
export type ListActionTagProps = BoxTagProps<'button'> & Pick<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href' | 'target' | 'rel' | 'download' | 'hrefLang' | 'referrerPolicy'> & Pick<React.LabelHTMLAttributes<HTMLLabelElement>, 'htmlFor'>;
|
|
57
|
+
export interface ListActionProps<TKey extends keyof ComponentsAndVariants = 'list.action'> extends Omit<BoxProps<'button', TKey>, 'props' | 'tag'> {
|
|
58
|
+
/** What the action is called: the item's title, and nothing else, since it is the name a reader hears. */
|
|
59
|
+
children?: React.ReactNode;
|
|
60
|
+
/** The element's attributes. An `href` makes it an `<a>`, an `htmlFor` a `<label>`; neither, a `<button type="button">`. */
|
|
61
|
+
props?: ListActionTagProps;
|
|
62
|
+
/** The element, when what `props` holds does not already say: `a` with no `href` is a placeholder link. */
|
|
63
|
+
tag?: 'button' | 'a' | 'label';
|
|
64
|
+
/** Fires on a press anywhere on the item — and on Enter, and on Space for a button. */
|
|
65
|
+
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
66
|
+
}
|
|
67
|
+
export interface ListFieldProps<TKey extends keyof ComponentsAndVariants = never> extends BoxProps<'div', TKey> {
|
|
68
|
+
/** What the value is: the `<dt>`. */
|
|
69
|
+
label: React.ReactNode;
|
|
70
|
+
/** The value: the `<dd>`. */
|
|
71
|
+
children?: React.ReactNode;
|
|
72
|
+
}
|
|
73
|
+
export interface ListGroupProps<TKey extends keyof ComponentsAndVariants = never> extends BoxProps<'li', TKey> {
|
|
74
|
+
/** What the items have in common: "Today", "A", "Unread". */
|
|
75
|
+
label: React.ReactNode;
|
|
76
|
+
/** The group's items. */
|
|
77
|
+
children?: React.ReactNode;
|
|
78
|
+
/** Makes the label a heading of this level, so a screen reader can jump between groups. Unset, it is plain text. */
|
|
79
|
+
level?: ListGroupLevel;
|
|
80
|
+
/** Keeps the label at the top of the screen while its items scroll under it, until the next group's pushes it off. */
|
|
81
|
+
sticky?: boolean;
|
|
82
|
+
}
|
|
83
|
+
interface ListType {
|
|
84
|
+
<TKey extends keyof ComponentsAndVariants = 'list'>(props: ListProps<TKey> & RefAttributes<HTMLUListElement>): React.ReactNode;
|
|
85
|
+
/** One thing in the list: a flex row of `Media`, `Content`, `End` and `Actions`. */
|
|
86
|
+
Item: <TKey extends keyof ComponentsAndVariants = 'list.item'>(props: ListItemProps<TKey> & RefAttributes<HTMLLIElement>) => React.ReactNode;
|
|
87
|
+
/** The leading slot: an icon, an avatar, a thumbnail. `variant` is `icon`, `avatar` or `image`. */
|
|
88
|
+
Media: <TKey extends keyof ComponentsAndVariants = 'list.media'>(props: Part<'div', TKey>) => React.ReactNode;
|
|
89
|
+
/** The middle, taking the room: a column of rows and text. */
|
|
90
|
+
Content: <TKey extends keyof ComponentsAndVariants = never>(props: Part<'div', TKey>) => React.ReactNode;
|
|
91
|
+
/** A row of parts inside the content — the main line, or a `secondary` one. */
|
|
92
|
+
Row: <TKey extends keyof ComponentsAndVariants = never>(props: ListRowProps<TKey> & RefAttributes<HTMLDivElement>) => React.ReactNode;
|
|
93
|
+
/** A small line above the title. */
|
|
94
|
+
Overline: <TKey extends keyof ComponentsAndVariants = never>(props: ListOverlineProps<TKey> & RefAttributes<HTMLSpanElement>) => React.ReactNode;
|
|
95
|
+
/** The item's name. */
|
|
96
|
+
Title: <TKey extends keyof ComponentsAndVariants = never>(props: ListTitleProps<TKey> & RefAttributes<HTMLSpanElement>) => React.ReactNode;
|
|
97
|
+
/** Muted supporting text. */
|
|
98
|
+
Description: <TKey extends keyof ComponentsAndVariants = never>(props: ListDescriptionProps<TKey> & RefAttributes<HTMLSpanElement>) => React.ReactNode;
|
|
99
|
+
/** A small value that never wraps: a time, a count. */
|
|
100
|
+
Meta: <TKey extends keyof ComponentsAndVariants = never>(props: Part<'span', TKey>) => React.ReactNode;
|
|
101
|
+
/** The trailing slot: a value and its label, stacked and aligned to the end. */
|
|
102
|
+
End: <TKey extends keyof ComponentsAndVariants = never>(props: Part<'div', TKey>) => React.ReactNode;
|
|
103
|
+
/** Controls of the item's own, above the action that covers it. */
|
|
104
|
+
Actions: <TKey extends keyof ComponentsAndVariants = never>(props: Part<'div', TKey>) => React.ReactNode;
|
|
105
|
+
/** The item's primary action, covering the whole item. */
|
|
106
|
+
Action: <TKey extends keyof ComponentsAndVariants = 'list.action'>(props: ListActionProps<TKey> & RefAttributes<HTMLButtonElement>) => React.ReactNode;
|
|
107
|
+
/** A `<dl>` of `List.Field`s, as many to a line as fit. */
|
|
108
|
+
Fields: <TKey extends keyof ComponentsAndVariants = never>(props: Part<'dl', TKey>) => React.ReactNode;
|
|
109
|
+
/** One labelled value. */
|
|
110
|
+
Field: <TKey extends keyof ComponentsAndVariants = never>(props: ListFieldProps<TKey> & RefAttributes<HTMLDivElement>) => React.ReactNode;
|
|
111
|
+
/** The chevron `chevron` ends an item with, for an item drawn by something else — a `SwipeItem` has the prop too. */
|
|
112
|
+
Chevron: <TKey extends keyof ComponentsAndVariants = never>(props: Part<'span', TKey>) => React.ReactNode;
|
|
113
|
+
/** A labelled section of items. */
|
|
114
|
+
Group: <TKey extends keyof ComponentsAndVariants = never>(props: ListGroupProps<TKey> & RefAttributes<HTMLLIElement>) => React.ReactNode;
|
|
115
|
+
displayName?: string;
|
|
116
|
+
}
|
|
117
|
+
declare const List: ListType;
|
|
118
|
+
export default List;
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import { f as e } from "../react-shared.mjs";
|
|
2
|
+
import { Path as t, Svg as n } from "./svg.mjs";
|
|
3
|
+
import { classNames as r, mergeDeep as i } from "@box-kite/core";
|
|
4
|
+
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
5
|
+
import { useBoxElement as c } from "@box-kite/react";
|
|
6
|
+
//#region src/components/list/listItemParts.ts
|
|
7
|
+
var l = {
|
|
8
|
+
position: "relative",
|
|
9
|
+
css: { borderRadius: "var(--list-item-radius, 0)" },
|
|
10
|
+
before: {
|
|
11
|
+
position: "absolute",
|
|
12
|
+
top: 0,
|
|
13
|
+
insetEnd: 0,
|
|
14
|
+
css: {
|
|
15
|
+
insetInlineStart: "var(--list-divider-inset, 0px)",
|
|
16
|
+
height: "1px"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
after: {
|
|
20
|
+
position: "absolute",
|
|
21
|
+
inset: 0,
|
|
22
|
+
pointerEvents: "none",
|
|
23
|
+
css: {
|
|
24
|
+
border: "var(--list-item-frame, none)",
|
|
25
|
+
borderRadius: "inherit"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
nth: { first: { before: { css: { display: "var(--list-first-divider, none)" } } } }
|
|
29
|
+
}, u = {
|
|
30
|
+
display: "flex",
|
|
31
|
+
ai: "center",
|
|
32
|
+
gap: 3,
|
|
33
|
+
px: 4,
|
|
34
|
+
py: 3,
|
|
35
|
+
minHeight: 14
|
|
36
|
+
}, d = {
|
|
37
|
+
sm: {
|
|
38
|
+
gap: 2,
|
|
39
|
+
py: 2,
|
|
40
|
+
minHeight: 11
|
|
41
|
+
},
|
|
42
|
+
md: {},
|
|
43
|
+
lg: {
|
|
44
|
+
gap: 4,
|
|
45
|
+
py: 4,
|
|
46
|
+
minHeight: 18
|
|
47
|
+
}
|
|
48
|
+
}, f = [
|
|
49
|
+
"css",
|
|
50
|
+
"before",
|
|
51
|
+
"after",
|
|
52
|
+
"nth"
|
|
53
|
+
];
|
|
54
|
+
function p(e, t) {
|
|
55
|
+
let n = {
|
|
56
|
+
...e,
|
|
57
|
+
...t
|
|
58
|
+
}, r = e;
|
|
59
|
+
for (let e of f) {
|
|
60
|
+
let a = t[e];
|
|
61
|
+
r[e] && a && (n[e] = i(r[e], a));
|
|
62
|
+
}
|
|
63
|
+
return n;
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/components/list.tsx
|
|
67
|
+
var m = [
|
|
68
|
+
"h1",
|
|
69
|
+
"h2",
|
|
70
|
+
"h3",
|
|
71
|
+
"h4",
|
|
72
|
+
"h5",
|
|
73
|
+
"h6"
|
|
74
|
+
], h = { fontVariantNumeric: "tabular-nums" }, g = {
|
|
75
|
+
display: "flex",
|
|
76
|
+
ai: "center",
|
|
77
|
+
jc: "center",
|
|
78
|
+
flexShrink: 0
|
|
79
|
+
}, _ = {
|
|
80
|
+
icon: {
|
|
81
|
+
width: 10,
|
|
82
|
+
height: 10,
|
|
83
|
+
borderRadius: 2
|
|
84
|
+
},
|
|
85
|
+
avatar: {
|
|
86
|
+
width: 10,
|
|
87
|
+
height: 10,
|
|
88
|
+
borderRadius: 999,
|
|
89
|
+
overflow: "hidden",
|
|
90
|
+
fontSize: 14,
|
|
91
|
+
fontWeight: 600
|
|
92
|
+
},
|
|
93
|
+
image: {
|
|
94
|
+
width: 16,
|
|
95
|
+
height: 16,
|
|
96
|
+
borderRadius: 2,
|
|
97
|
+
overflow: "hidden"
|
|
98
|
+
}
|
|
99
|
+
}, v = {
|
|
100
|
+
display: "flex",
|
|
101
|
+
ai: "baseline",
|
|
102
|
+
jc: "space-between",
|
|
103
|
+
gap: 2,
|
|
104
|
+
minWidth: 0
|
|
105
|
+
}, y = {
|
|
106
|
+
flexWrap: "wrap",
|
|
107
|
+
jc: "start",
|
|
108
|
+
rowGap: 1
|
|
109
|
+
}, b = {
|
|
110
|
+
fontSize: 14,
|
|
111
|
+
lineHeight: 20
|
|
112
|
+
}, x = {
|
|
113
|
+
"list.title": {
|
|
114
|
+
display: "block",
|
|
115
|
+
minWidth: 0,
|
|
116
|
+
fontSize: 16,
|
|
117
|
+
lineHeight: 22,
|
|
118
|
+
fontWeight: 500
|
|
119
|
+
},
|
|
120
|
+
"list.description": {
|
|
121
|
+
display: "block",
|
|
122
|
+
minWidth: 0,
|
|
123
|
+
fontSize: 14,
|
|
124
|
+
lineHeight: 20
|
|
125
|
+
},
|
|
126
|
+
"list.overline": {
|
|
127
|
+
display: "block",
|
|
128
|
+
minWidth: 0,
|
|
129
|
+
fontSize: 12,
|
|
130
|
+
lineHeight: 16,
|
|
131
|
+
fontWeight: 500
|
|
132
|
+
}
|
|
133
|
+
}, S = {
|
|
134
|
+
color: "currentColor",
|
|
135
|
+
textDecoration: "none",
|
|
136
|
+
cursor: "pointer",
|
|
137
|
+
css: {
|
|
138
|
+
display: "inherit",
|
|
139
|
+
font: "inherit",
|
|
140
|
+
textAlign: "inherit",
|
|
141
|
+
overflow: "inherit",
|
|
142
|
+
textOverflow: "inherit",
|
|
143
|
+
WebkitLineClamp: "inherit",
|
|
144
|
+
WebkitBoxOrient: "inherit"
|
|
145
|
+
},
|
|
146
|
+
after: {
|
|
147
|
+
position: "absolute",
|
|
148
|
+
inset: 0,
|
|
149
|
+
css: { borderRadius: "var(--list-item-radius, 0)" }
|
|
150
|
+
}
|
|
151
|
+
}, C = {
|
|
152
|
+
1: {
|
|
153
|
+
overflow: "hidden",
|
|
154
|
+
textOverflow: "ellipsis",
|
|
155
|
+
whiteSpace: "nowrap"
|
|
156
|
+
},
|
|
157
|
+
2: {
|
|
158
|
+
overflow: "hidden",
|
|
159
|
+
css: {
|
|
160
|
+
display: "-webkit-box",
|
|
161
|
+
WebkitBoxOrient: "vertical",
|
|
162
|
+
WebkitLineClamp: 2
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
3: {
|
|
166
|
+
overflow: "hidden",
|
|
167
|
+
css: {
|
|
168
|
+
display: "-webkit-box",
|
|
169
|
+
WebkitBoxOrient: "vertical",
|
|
170
|
+
WebkitLineClamp: 3
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}, w = {
|
|
174
|
+
content: {
|
|
175
|
+
display: "flex",
|
|
176
|
+
d: "column",
|
|
177
|
+
gap: .5,
|
|
178
|
+
flex1: !0,
|
|
179
|
+
minWidth: 0
|
|
180
|
+
},
|
|
181
|
+
meta: {
|
|
182
|
+
flexShrink: 0,
|
|
183
|
+
fontSize: 13,
|
|
184
|
+
lineHeight: 18,
|
|
185
|
+
whiteSpace: "nowrap",
|
|
186
|
+
css: h
|
|
187
|
+
},
|
|
188
|
+
end: {
|
|
189
|
+
display: "flex",
|
|
190
|
+
d: "column",
|
|
191
|
+
ai: "end",
|
|
192
|
+
gap: .5,
|
|
193
|
+
flexShrink: 0,
|
|
194
|
+
maxWidth: "1/2",
|
|
195
|
+
textAlign: "end",
|
|
196
|
+
css: h
|
|
197
|
+
},
|
|
198
|
+
actions: {
|
|
199
|
+
display: "flex",
|
|
200
|
+
ai: "center",
|
|
201
|
+
gap: 1,
|
|
202
|
+
flexShrink: 0,
|
|
203
|
+
position: "relative",
|
|
204
|
+
zIndex: 1
|
|
205
|
+
},
|
|
206
|
+
fields: {
|
|
207
|
+
display: "grid",
|
|
208
|
+
columnGap: 4,
|
|
209
|
+
rowGap: 2,
|
|
210
|
+
mt: 1,
|
|
211
|
+
css: { gridTemplateColumns: "repeat(auto-fill, minmax(min(8rem, 100%), 1fr))" }
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
function T(e, t) {
|
|
215
|
+
let { props: n, ...r } = e;
|
|
216
|
+
return c({
|
|
217
|
+
tag: "ul",
|
|
218
|
+
component: "list",
|
|
219
|
+
...r,
|
|
220
|
+
props: {
|
|
221
|
+
role: "list",
|
|
222
|
+
...n
|
|
223
|
+
}
|
|
224
|
+
}, t);
|
|
225
|
+
}
|
|
226
|
+
function E(e, t) {
|
|
227
|
+
let { size: n = "md", wrap: r = !1, selected: i = !1, chevron: f = !1, variant: m, children: h, ...g } = e;
|
|
228
|
+
return c({
|
|
229
|
+
tag: "li",
|
|
230
|
+
component: "list.item",
|
|
231
|
+
...p({
|
|
232
|
+
...l,
|
|
233
|
+
...u,
|
|
234
|
+
...d[n],
|
|
235
|
+
...r ? { flexWrap: "wrap" } : {}
|
|
236
|
+
}, g),
|
|
237
|
+
variant: [m, { selected: i }],
|
|
238
|
+
children: f ? /* @__PURE__ */ s(a, { children: [h, /* @__PURE__ */ o(O, {})] }) : h
|
|
239
|
+
}, t);
|
|
240
|
+
}
|
|
241
|
+
function D(e, r) {
|
|
242
|
+
return c({
|
|
243
|
+
tag: "span",
|
|
244
|
+
component: "list.muted",
|
|
245
|
+
display: "flex",
|
|
246
|
+
flexShrink: 0,
|
|
247
|
+
alignSelf: "center",
|
|
248
|
+
rtl: { flip: "xAxis" },
|
|
249
|
+
...e,
|
|
250
|
+
props: {
|
|
251
|
+
"aria-hidden": !0,
|
|
252
|
+
...e.props
|
|
253
|
+
},
|
|
254
|
+
children: /* @__PURE__ */ o(n, {
|
|
255
|
+
viewBox: "0 0 16 16",
|
|
256
|
+
width: "1rem",
|
|
257
|
+
fill: "none",
|
|
258
|
+
stroke: "currentColor",
|
|
259
|
+
strokeWidth: 1.75,
|
|
260
|
+
children: /* @__PURE__ */ o(t, {
|
|
261
|
+
d: "M6 3.5 10.5 8 6 12.5",
|
|
262
|
+
strokeLinecap: "round",
|
|
263
|
+
strokeLinejoin: "round"
|
|
264
|
+
})
|
|
265
|
+
})
|
|
266
|
+
}, r);
|
|
267
|
+
}
|
|
268
|
+
var O = e(D, "List.Chevron");
|
|
269
|
+
function k(e, t) {
|
|
270
|
+
let n = r(e.variant).find((e) => e in _);
|
|
271
|
+
return c({
|
|
272
|
+
component: "list.media",
|
|
273
|
+
...g,
|
|
274
|
+
...n ? _[n] : {},
|
|
275
|
+
...e
|
|
276
|
+
}, t);
|
|
277
|
+
}
|
|
278
|
+
function A(e, t) {
|
|
279
|
+
let { wrap: n = !1, secondary: r = !1, ...i } = e;
|
|
280
|
+
return c({
|
|
281
|
+
...r ? {
|
|
282
|
+
component: "list.muted",
|
|
283
|
+
...b
|
|
284
|
+
} : {},
|
|
285
|
+
...v,
|
|
286
|
+
...n ? y : {},
|
|
287
|
+
...i
|
|
288
|
+
}, t);
|
|
289
|
+
}
|
|
290
|
+
function j(t, n) {
|
|
291
|
+
let r = t !== "list.title";
|
|
292
|
+
return e((e, n) => {
|
|
293
|
+
let { lines: i, ...a } = e, o = i ? p(x[t], C[i]) : x[t];
|
|
294
|
+
return c({
|
|
295
|
+
tag: "span",
|
|
296
|
+
...r ? { component: "list.muted" } : {},
|
|
297
|
+
...p(o, a)
|
|
298
|
+
}, n);
|
|
299
|
+
}, n);
|
|
300
|
+
}
|
|
301
|
+
function M(e, t) {
|
|
302
|
+
let { props: n, tag: r, onClick: i, ...a } = e, o = r ?? (n?.href === void 0 ? n?.htmlFor === void 0 ? "button" : "label" : "a");
|
|
303
|
+
return c({
|
|
304
|
+
tag: o,
|
|
305
|
+
component: "list.action",
|
|
306
|
+
...p(S, a),
|
|
307
|
+
props: {
|
|
308
|
+
...o === "button" ? { type: "button" } : {},
|
|
309
|
+
"data-list-action": "",
|
|
310
|
+
...n,
|
|
311
|
+
...i ? { onClick: i } : {}
|
|
312
|
+
}
|
|
313
|
+
}, t);
|
|
314
|
+
}
|
|
315
|
+
function N(e, t) {
|
|
316
|
+
let { label: n, children: r, ...i } = e;
|
|
317
|
+
return c({
|
|
318
|
+
minWidth: 0,
|
|
319
|
+
...i,
|
|
320
|
+
children: /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(P, { children: n }), /* @__PURE__ */ o(F, { children: r })] })
|
|
321
|
+
}, t);
|
|
322
|
+
}
|
|
323
|
+
function P({ children: e }) {
|
|
324
|
+
return c({
|
|
325
|
+
tag: "dt",
|
|
326
|
+
component: "list.muted",
|
|
327
|
+
fontSize: 12,
|
|
328
|
+
lineHeight: 16,
|
|
329
|
+
children: e
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
function F({ children: e }) {
|
|
333
|
+
return c({
|
|
334
|
+
tag: "dd",
|
|
335
|
+
minWidth: 0,
|
|
336
|
+
fontSize: 14,
|
|
337
|
+
lineHeight: 20,
|
|
338
|
+
css: {
|
|
339
|
+
overflowWrap: "anywhere",
|
|
340
|
+
...h
|
|
341
|
+
},
|
|
342
|
+
children: e
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
function I(e, t) {
|
|
346
|
+
let { label: n, level: r, sticky: i = !1, children: l, ...u } = e;
|
|
347
|
+
return c({
|
|
348
|
+
tag: "li",
|
|
349
|
+
...u,
|
|
350
|
+
children: /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(L, {
|
|
351
|
+
level: r,
|
|
352
|
+
sticky: i,
|
|
353
|
+
children: n
|
|
354
|
+
}), /* @__PURE__ */ o(R, { children: l })] })
|
|
355
|
+
}, t);
|
|
356
|
+
}
|
|
357
|
+
function L({ level: e, sticky: t, children: n }) {
|
|
358
|
+
return c({
|
|
359
|
+
tag: e ? m[e - 1] : "div",
|
|
360
|
+
component: "list.label",
|
|
361
|
+
px: 4,
|
|
362
|
+
py: 1.5,
|
|
363
|
+
fontSize: 13,
|
|
364
|
+
lineHeight: 18,
|
|
365
|
+
fontWeight: 600,
|
|
366
|
+
...t ? {
|
|
367
|
+
position: "sticky",
|
|
368
|
+
zIndex: 2,
|
|
369
|
+
css: { top: "var(--list-sticky-top, 0)" }
|
|
370
|
+
} : {},
|
|
371
|
+
children: n
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
function R({ children: e }) {
|
|
375
|
+
return c({
|
|
376
|
+
tag: "ul",
|
|
377
|
+
props: { role: "list" },
|
|
378
|
+
children: e
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
function z(t, n, r, i = !1) {
|
|
382
|
+
return e((e, r) => c({
|
|
383
|
+
tag: t,
|
|
384
|
+
...i ? { component: "list.muted" } : {},
|
|
385
|
+
...p(n, e)
|
|
386
|
+
}, r), r);
|
|
387
|
+
}
|
|
388
|
+
var B = e(k, "List.Media"), V = z("div", w.content, "List.Content"), H = j("list.overline", "List.Overline"), U = j("list.title", "List.Title"), W = j("list.description", "List.Description"), G = z("span", w.meta, "List.Meta", !0), K = z("div", w.end, "List.End"), q = z("div", w.actions, "List.Actions"), J = z("dl", w.fields, "List.Fields"), Y = e(T, "List");
|
|
389
|
+
Y.Item = e(E, "List.Item"), Y.Media = B, Y.Content = V, Y.Row = e(A, "List.Row"), Y.Overline = H, Y.Title = U, Y.Description = W, Y.Meta = G, Y.End = K, Y.Actions = q, Y.Action = e(M, "List.Action"), Y.Fields = J, Y.Field = e(N, "List.Field"), Y.Group = e(I, "List.Group"), Y.Chevron = O;
|
|
390
|
+
//#endregion
|
|
391
|
+
export { Y as default, p as i, u as n, d as r, l as t };
|