@stackone/malachite 2.120.1 → 2.122.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/COMPONENTS.md +3 -3
- package/dist/assets/icons/lock.svg.js +6 -0
- package/dist/assets/icons/lock.svg.js.map +1 -0
- package/dist/components/Card.js +92 -90
- package/dist/components/Card.js.map +1 -1
- package/dist/components/CustomIcons/LockIcon.js +16 -0
- package/dist/components/CustomIcons/LockIcon.js.map +1 -0
- package/dist/components/CustomIcons/index.js +171 -168
- package/dist/components/CustomIcons/index.js.map +1 -1
- package/dist/components/Link.js +20 -16
- package/dist/components/Link.js.map +1 -1
- package/dist/components/Popover.js +150 -146
- package/dist/components/Popover.js.map +1 -1
- package/dist/components/Surface.js +51 -49
- package/dist/components/Surface.js.map +1 -1
- package/dist/components/frameStyles.js +13 -11
- package/dist/components/frameStyles.js.map +1 -1
- package/dist/components/modalTray.js +4 -4
- package/dist/components/modalTray.js.map +1 -1
- package/dist/index.d.ts +42 -22
- package/dist/index.js +138 -136
- package/dist/index.js.map +1 -1
- package/dist/tailwind.css.js +1 -1
- package/package.json +1 -1
package/COMPONENTS.md
CHANGED
|
@@ -8,10 +8,10 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
|
|
|
8
8
|
|
|
9
9
|
- **`Chat`** — A chat column: `Chat.Thread` scrolls and pins itself to the newest message, `Chat.Composer` keeps its own height and owns the Enter/Shift+Enter convention, and `Chat.Message`, `Chat.ToolCall` and `Chat.Thinking` render one turn each. A user turn sits right and hugs its text; an assistant turn runs full width, and `variant="card"` frames it with its state, copy and rating controls, and a token/model line. `variant="bubble"` is a third treatment, not a repaint of either: tinted bubbles whose flattened corner points at whoever spoke, so authorship reads before the words do. `Chat.Context` lists what the conversation can see — a removable chip per source, and an add affordance only when a handler is given. `Chat.Thinking` and a loading turn draw bars in the shape of the answer rather than a spinner. `Chat.Reasoning` shows what a model reasoned, open while it arrives and shut once it stops, until the reader toggles it. `Chat.ToolCall` mounts its payloads only once opened, since a result can be tens of KB; `blocked` is a call something refused to run, as distinct from `error`. The row under a composer is `ComposerChip`, `ContextMeter` and `ModelPicker` — PillButton tabs, so it reads as attached to the field; `ModelPicker` opens a portalled menu with a submenu per model. The transcript is a live `log` region, so a streamed reply is announced, and it shows a centred empty state until the first turn. _Key props:_ `Chat`: `children`, `className`. `Thread`: `aria-label`, `emptyTitle`, `emptyDescription`, `emptyIcon`. `Message`: `role`, `variant` (`plain` | `card`), `content`, `children`, `name`, `avatarSrc`, `status` (`streaming` | `completed` | `error`), `loading`, `onCopy`, `onFeedback`, `usage`. `ToolCall`: `name`, `status` (`running` | `completed` | `error` | `blocked`), `callId`, `input` and `output` (an object, or a string shown as it is), `adornment`, `children`, `defaultExpanded`. `Reasoning`: `text`, `streaming`, `title`. `Thinking`: `label`. `Composer`: `value`, `onChange`, `onSend`, `onStop`, `busy`, `disabled`, `placeholder`, `maxLength`, `rows`, `children`. `ComposerChip`: `label`, `icon`, `trailingIcon`, `onClick`, `disabled`. `ContextMeter`: `used`, `limit`, `cached`, `label`. `ModelPicker`: `models`, `value`, `optionValue`, `onChange`, `openUp`, `disabled`. `Context`: `label`, `items` (`{id, label, onRemove?}`), `onAdd`, `className`.
|
|
10
10
|
- **`Surface`** — Rounded, bordered card container with the standard elevation shadow. Use `overflow="clip"` to keep the rounded clipping while letting a `position: sticky` descendant still pin (`hidden` would trap it); `visible` disables clipping. _Key props:_ `children`, `padding`, `overflow`, `shadow` (`false` sits the card flat, without the elevation shadow), `tone` (`default` | `highlight`; `highlight` paints the warm ground with no border, and sits flat unless `shadow` is passed, for a static block that stands out from the page, such as a hero or a guide's section header; its ground is too close to `Surface.Row`'s hover for clickable rows inside it), `className`, `style`.
|
|
11
|
-
- **`SurfaceRow`** — A full-bleed row inside a Surface (used as `Surface.Row`). Owns hover highlight, colour transition and an optional bottom divider. Pass `onClick`/`href` to make the whole row clickable (renders as a real button/anchor, so keyboard nav works). For a selectable row use `role="radio"` + `selected` and put a presentational `<Radio>` inside as the indicator; `selected` then paints the same treatment `Table` gives `selectedRowKey`. Under `role="checkbox"` it only announces — a multi-select row carries its own checkbox, and a highlight marking one of many says nothing when most rows are checked. `selection` overrides that either way (`highlight` / `announce`). `selected="mixed"` marks a partly selected checkbox row (`aria-checked="mixed"`); it never paints or marks a row current, and counts as not selected under any other role. Use `trailing` for a control that must stay interactive — it renders outside the row button, which a nested control could not be. An `onClick` row with `trailing` is still clickable across its whole box, padding and the space around the slot included (an `href` row leaves that to its link, so a modified click still opens a new tab), with its focus ring at the row's edge; a click inside the slot (or in a menu it portals out) is the slot's own, and a disabled row drops both the click and the ring. `revealTrailing` shows that control only on hover, keyboard focus or while a menu it opened is open, keeping it in the tab order and always showing it on a touch screen. `tone="muted"` tints a row whose subject is inactive, which `disabled` does not: a muted row stays clickable. `leading` puts the row's own indicator (a presentational `Checkbox`) inside the row button ahead of the children (with `leading` or `dimmed`, pass one child; it fills the row), and `dimmed` fades the children but not `leading` or `trailing`, for a row switched off but still a click from on. _Key props:_ `divider`, `disabled`, `hover` (default on; `false` leaves the hover to something inside the row), `tone` (`default` | `muted`), `inset` (`none` | `compact` — the row owns an 8px by 16px inset, wrapping `trailing` too, so its content needs no padding wrapper), `onClick`, `href`, `target`, `rel`, `selected` (`boolean` | `"mixed"`), `selection` (`highlight` | `tint` | `announce`; `tint` paints the selected treatment without the accent bar, for a menu whose choice is already marked inside the row), `trailing`, `revealTrailing`, `leading`, `dimmed`, `role`, `className`, `style`.
|
|
11
|
+
- **`SurfaceRow`** — A full-bleed row inside a Surface (used as `Surface.Row`). Owns hover highlight, colour transition and an optional bottom divider. Pass `onClick`/`href` to make the whole row clickable (renders as a real button/anchor, so keyboard nav works). For a selectable row use `role="radio"` + `selected` and put a presentational `<Radio>` inside as the indicator; `selected` then paints the same treatment `Table` gives `selectedRowKey`. Under `role="checkbox"` it only announces — a multi-select row carries its own checkbox, and a highlight marking one of many says nothing when most rows are checked. `selection` overrides that either way (`highlight` / `announce`). `selected="mixed"` marks a partly selected checkbox row (`aria-checked="mixed"`); it never paints or marks a row current, and counts as not selected under any other role. Use `trailing` for a control that must stay interactive — it renders outside the row button, which a nested control could not be. An `onClick` row with `trailing` is still clickable across its whole box, padding and the space around the slot included (an `href` row leaves that to its link, so a modified click still opens a new tab), with its focus ring at the row's edge; a click inside the slot (or in a menu it portals out) is the slot's own, and a disabled row drops both the click and the ring. `revealTrailing` shows that control only on hover, keyboard focus or while a menu it opened is open, keeping it in the tab order and always showing it on a touch screen. `tone="muted"` tints a row whose subject is inactive, which `disabled` does not: a muted row stays clickable. `leading` puts the row's own indicator (a presentational `Checkbox`) inside the row button ahead of the children (with `leading` or `dimmed`, pass one child; it fills the row), and `dimmed` fades the children but not `leading` or `trailing`, for a row switched off but still a click from on. _Key props:_ `divider`, `disabled`, `hover` (default on; `false` leaves the hover to something inside the row), `tone` (`default` | `muted` | `success` | `warning` | `error`; an outcome tone tints the row and recolours its text with that tag colour), `inset` (`none` | `compact` — the row owns an 8px by 16px inset, wrapping `trailing` too, so its content needs no padding wrapper), `onClick`, `href`, `target`, `rel`, `selected` (`boolean` | `"mixed"`), `selection` (`highlight` | `tint` | `announce`; `tint` paints the selected treatment without the accent bar, for a menu whose choice is already marked inside the row), `trailing`, `revealTrailing`, `leading`, `dimmed`, `role`, `className`, `style`.
|
|
12
12
|
- **`SurfaceExpandableRow`** — A row that opens to reveal a body (used as `Surface.ExpandableRow`), for a line that carries its own controls. Not `Accordion`, which puts its header inside the toggle button, so a header holding a dropdown or a second button would be invalid: here the row surface takes the click and a cell opts out by wrapping its controls in `ExpandableRow.Controls`, while the arrow stays a real button so the keyboard reaches it. That opt-out is explicit rather than sniffing the event target for an interactive ancestor, because a control rendering into a shadow root retargets the event to its host. `sticky` pins the row while its body scrolls, offset by `stickyTopOffset` for whatever is already pinned above it; it only pins while open, since a closed row has nothing to scroll past. _Key props:_ `header`, `children`, `expanded`, `onToggle`, `sticky`, `stickyTopOffset`, `divider`, `tone`, `aria-label`, `className`, `style`.
|
|
13
13
|
- **`DisclosureArrow`** — The expand/collapse triangle disclosure UI shares (`Accordion`, `Surface.ExpandableRow`). Owns its colour states so they never drift between usages: `text-primary` when expanded, `text-placeholder` otherwise, and dark on hover inside a `group` ancestor — put `group` on the clickable header or row so that hover state activates. _Key props:_ `expanded`, `size`, `className`.
|
|
14
|
-
- **`Card`** — Generic content card. `title` heads it, with dimmed `subtitle` text beside it and `extra` actions at the right of the title row. `variant="framed"` draws the detached `Table`’s frame instead: the title row sits on a grey frame and the children in a bordered section inside it, so a card above a table, such as a chart over a log list, reads as part of the same set. `dimmed`, `border`, `size`, `glassFooter` and `headerConfig` do not apply to a framed card. _Key props:_ `variant` (`CardVariant`: `default` | `framed`), `title`, `subtitle`, `extra`, `padding`, `footer`.
|
|
14
|
+
- **`Card`** — Generic content card. `title` heads it, with dimmed `subtitle` text beside it and `extra` actions at the right of the title row. `variant="framed"` draws the detached `Table`’s frame instead: the title row sits on a grey frame and the children in a bordered section inside it, so a card above a table, such as a chart over a log list, reads as part of the same set. `tone` (`CardTone`, the same `neutral` | `warning` | `error` | `success` as `Modal`’s tray) paints a framed card’s frame in that tray colour, for a verdict card; `neutral` keeps the default grey frame. Tone is colour alone, so the title has to say the outcome. It is a type error on a default card. `dimmed`, `border`, `size`, `glassFooter` and `headerConfig` do not apply to a framed card. _Key props:_ `variant` (`CardVariant`: `default` | `framed`), `tone` (`CardTone`, framed only), `title`, `subtitle`, `extra`, `padding`, `footer`.
|
|
15
15
|
- **`LinkCard`** — A compact card that opens more about one thing elsewhere on the screen, such as another tab of a side panel: an optional icon, a title coloured by `tone`, a one-line description cut with an ellipsis, optional `trailing` content such as a level scale, and an accent “Open →”. The whole card is one button, or an anchor with `href` (an unsafe scheme such as `javascript:` is dropped); with neither `onClick` nor a safe `href` it is a static card without the action. Tone is colour alone, so the title has to say the outcome. For a resource in a new tab use `ResourceCard`; for a row in a list use `Surface.Row`. _Key props:_ `title`, `description`, `tone` (`LinkCardTone`: `neutral` | `success` | `warning` | `error`), `icon`, `trailing` (both decorative; `trailing` sits inside the control, so never interactive), `actionLabel` (default `Open`), `onClick`, `href`, `className`.
|
|
16
16
|
- **`ResourceCard`** — A card pointing at a resource elsewhere, such as an SDK’s documentation: a muted icon tile, a title, a description clamped to two lines and a link that opens in a new tab. `ResourceCard.Header` is the icon, title and description on their own, all phrasing content, so a section that opens on them, such as an `Accordion` header, can use it inside its button. _Key props:_ `icon`, `title`, `description`, `href`, `linkLabel` (default `Documentation`), `titleAs` (`h3` | `h4`), `className`. `ResourceCard.Header`: `icon`, `title`, `description`; phrasing content only, so its title is never a heading.
|
|
17
17
|
- **`SelectableCard`** — A card that is one option in a radio group — eyebrow, optional status tag, title, description, a count label and a top-right action slot. Use inside a `CardStrip`. Selection is controlled by the consumer: pass `selected`, which drives both the visual treatment and `aria-checked`. A selected card meets the sheet below the way a browser tab meets its toolbar — its bottom corners flare outward onto the strip’s rule — so its outline is one SVG path rather than borders, which would split into two lines at the tangent. `variant` picks the palette: `profile` (green), `library` (neutral) or `editing` (amber, for a profile with unsaved changes). `actions` stands in the card’s top-right corner, on the eyebrow row, and renders outside the control so a menu or icon button inside it stays clickable and keeps its own tab stop. Nothing else marks that corner: the flared outline, the tint and the green eyebrow already say which card is selected, so a radio there would only repeat them. `onDismiss` adds an x after `actions`, tinted like the eyebrow so it reads as part of the card — for discarding a draft card; `dismissDisabledReason` disables it and explains why in its tooltip. `isDefault` marks the card as the account default with a pin beside the title, named for assistive tech and tooltipped for everyone else — it belongs with the name it qualifies rather than among the actions, which read as things to press. `address` puts a one-line chip above the count for a copyable address such as a server URL: its `label` is cut short with an ellipsis, and its full `value` shows in a tooltip and is copied on click, without selecting the card. It takes the place of `description`, since the card has room for one or the other. For a row-shaped selectable use `Surface.Row` instead. _Key props:_ `value`, `title`, `titleIcon`, `isDefault`, `variant` (`profile` | `library` | `editing`), `eyebrow`, `status` (`label`, `type`, `tooltip`), `description`, `address` (`label`, `value`), `countLabel`, `actions`, `onDismiss` (`dismissLabel`, `dismissDisabledReason`), `selected`, `loading` (`loadingLabel`, `loadingHint`), `disabled`, `dimmed`, `onSelect`, `tabIndex`, `aria-label`, `className`, `style`.
|
|
@@ -120,7 +120,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
|
|
|
120
120
|
- **`PillButton`** — Pill-shaped button, often used for filters/toggleable chips. `shape="tab"` squares the top corners so a row of them reads as attached to whatever sits above — the controls under a chat composer. Pass `href` and an interactive, non-disabled pill renders a real anchor (cmd-click, copy-link) instead of navigating from `onClick`; a disabled or `interactive={false}` pill stays static, and an unsafe scheme such as `javascript:` is dropped. `target="_blank"` always carries `noopener noreferrer`. _Key props:_ `label`, `icon`, `trailingIcon`, `selected`, `disabled`, `interactive`, `size`, `variant`, `shape` (`pill` | `tab`), `onClick`, `href`, `target`, `rel`.
|
|
121
121
|
- **`CopyButton`** — The small copy control a copyable `Input` ends with, for a copyable value that is not an input, such as a list of scopes beside its label, so the two read the same. With `value` it copies and shows a check for a second; without, the click is the caller’s. _Key props:_ `value`, `onCopy`, `copied`, `aria-label`, `tooltip`.
|
|
122
122
|
- **`BannerButton`** — A banner that is one button: the warm ground, an icon in a white tile, a title with one line under it, and an arrow at the end that darkens on hover. For an offer of help beside a form, such as opening its setup guide, that wants more presence than a link and less than a primary button. Pass `aria-expanded` when it opens and closes something. _Key props:_ `icon`, `title`, `description`, `trailing`, `onClick`, `aria-expanded`, `aria-controls`, `aria-label`.
|
|
123
|
-
- **`Link`** — Styled anchor/link text. Opens in a new tab by default; with `renderLink`, a root-relative href goes through the app's own link component instead (href, classes, children and `onClick` when set; no `target` or `rel`), while any other href keeps the new-tab anchor. _Key props:_ `href`, `color
|
|
123
|
+
- **`Link`** — Styled anchor/link text. Opens in a new tab by default; with `renderLink`, a root-relative href goes through the app's own link component instead (href, classes, children and `onClick` when set; no `target` or `rel`), while any other href keeps the new-tab anchor. _Key props:_ `href`, `color` (`default` | `dimmed` | `inherit`; `inherit` takes the surrounding text colour, for a name in a tinted row, and thickens its underline on hover, a cue that shows on any surface and theme; it is always underlined, whatever `underline` says), `size`, `underline`, `truncate` (as a flex item, shrinks and ellipsizes the label), `onClick`, `renderLink`, `target`, `rel`.
|
|
124
124
|
- **`CopyButton`** — The small copy control a copyable `Input` ends with, for a copyable value that is not an input, such as a list of scopes beside its label, so the two read the same. With `value` it copies and shows a check for a second; without, the click is the caller’s. _Key props:_ `value`, `onCopy`, `copied`, `aria-label`, `tooltip`.
|
|
125
125
|
- **`InlineConfirm`** — A confirmation asked on the control that triggered it rather than in a modal, for a reversible bulk edit where a dialog would be heavier than the change it guards. Drawn to the design's chip: 33px tall, 12px radius, its confirm cell running to the pill's own edge between two rules. Reads its own `inlineConfirm` theme tokens — a shade off the `SelectionBar` it appears beside, by design. Carries a spinning glyph by default — its own, so it takes the pill's colour rather than the sheet's dimmed grey — standing for a change waiting on an answer; pass `icon={null}` to drop it or a node to replace it. Anchored placement is in viewport coordinates, so the chip must not sit inside an ancestor carrying `transform`, `filter` or `contain`. It takes focus on open so `Enter` confirms, dismisses on `Escape` (through the shared escape-layer stack, so the topmost overlay answers) or a click outside, and returns focus to whatever opened it. `role="alertdialog"` named by the message itself, so the confirm button is never announced bare. Only one can be open at a time: opening a second dismisses the first, so it is never ambiguous what Yes answers. Pass `anchorTo` (a ref to the control it answers for) and it pins itself to that control's left, follows it while the page or a sticky header scrolls, dismisses once it scrolls out of view, and treats clicks on it as inside — without which the same click would dismiss and reopen. Left unanchored it renders in flow for the consumer to place, and must then not sit in a container that clips overflow (`Table` header cells among them). Nothing renders while `open` is false, and its listeners are attached only while it is open. _Key props:_ `open`, `message`, `confirmLabel`, `onConfirm`, `onDismiss`, `anchorTo`, `icon`, `className`, `style`.
|
|
126
126
|
- **`SelectionBar`** — A bar reporting a pending selection and the actions that resolve it, for flows where changes accumulate and save once rather than writing on every toggle. Paints its own inverted surface from the `selectionBar` theme tokens, so its buttons are its own rather than `Button`. A count renders as one phrase (`3 Added`), not a number styled apart from its label, and an empty `value` carries a bare message instead; the separators between counts and before an action are glyphs (`•`, `|`) in the muted colour, not drawn rules. `emphasis` runs `primary` (a light filled button with its own edge, for the action that commits) → `secondary`, the default (a filled chip) → `quiet` (unfilled, taking a wash on hover). The pill is edgeless in light mode and keeps a hairline `border` token in dark, where a shadow alone would not separate it from the sheet. Defaults to `placement="sticky"` — render it as the last child of the scrolling content and it holds its place over a long list. Counts are announced through a live region that outlives the bar, so the first change is not lost; `open` drives an animated mount so it can appear and leave as the selection goes dirty and clean. Every action closes the bar, so the caller must move focus deliberately in `onClick`. `notice` wraps the whole bar in a warning sleeve carrying that message, for state the bar is reporting rather than an action it offers — a refused exit, say — and it leads the announcement; an empty string renders no sleeve. _Key props:_ `open`, `counts` (`value`, `label`), `actions` (`label`, `onClick`, `emphasis`, `icon`, `iconPosition`, `disabled`, `dividerBefore`), `placement`, `notice`, `aria-label`, `className`.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
const a = (t) => /* @__PURE__ */ e.createElement("svg", { width: 16, height: 16, viewBox: "0 0 256 256", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ e.createElement("path", { d: "M208,76H180V56A52,52,0,0,0,76,56V76H48A20,20,0,0,0,28,96V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V96A20,20,0,0,0,208,76ZM100,56a28,28,0,0,1,56,0V76H100ZM204,204H52V100H204Zm-60-52a16,16,0,1,1-16-16A16,16,0,0,1,144,152Z", fill: "currentColor" }));
|
|
3
|
+
export {
|
|
4
|
+
a as default
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=lock.svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lock.svg.js","sources":["../../../src/assets/icons/lock.svg?react"],"sourcesContent":["import * as React from \"react\";\nconst SvgLock = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 16, height: 16, viewBox: \"0 0 256 256\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { d: \"M208,76H180V56A52,52,0,0,0,76,56V76H48A20,20,0,0,0,28,96V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V96A20,20,0,0,0,208,76ZM100,56a28,28,0,0,1,56,0V76H100ZM204,204H52V100H204Zm-60-52a16,16,0,1,1-16-16A16,16,0,0,1,144,152Z\", fill: \"currentColor\" }));\nexport default SvgLock;\n"],"names":["SvgLock","props","React"],"mappings":";AACK,MAACA,IAAU,CAACC,MAA0B,gBAAAC,EAAM,cAAc,OAAO,EAAE,OAAO,IAAI,QAAQ,IAAI,SAAS,eAAe,MAAM,QAAQ,OAAO,8BAA8B,GAAGD,EAAK,GAAoB,gBAAAC,EAAM,cAAc,QAAQ,EAAE,GAAG,iOAAiO,MAAM,eAAc,CAAE,CAAC;"}
|
package/dist/components/Card.js
CHANGED
|
@@ -1,99 +1,101 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as A, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as h, useState as j, useEffect as G } from "react";
|
|
3
|
-
import P, { HeaderRow as
|
|
4
|
-
import { FRAME_CLASS as
|
|
5
|
-
import { GLASS_SURFACE_STYLE as
|
|
6
|
-
import { hasHeaderContent as
|
|
7
|
-
import { FOREGROUND_RESET as
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
if (
|
|
3
|
+
import P, { HeaderRow as F } from "./FrameHeader.js";
|
|
4
|
+
import { FRAME_CLASS as M, FRAME_SECTION_STYLE as U, frameToneBackground as W } from "./frameStyles.js";
|
|
5
|
+
import { GLASS_SURFACE_STYLE as Y } from "./glassSurface.js";
|
|
6
|
+
import { hasHeaderContent as B } from "./headerContent.js";
|
|
7
|
+
import { FOREGROUND_RESET as C } from "./selectedRow.js";
|
|
8
|
+
const V = /^\d*\.?\d+(px|rem|em)$/, q = (f) => {
|
|
9
|
+
const d = f.trim().split(/\s+/);
|
|
10
|
+
if (d.length > 4 || !d.every((i) => V.test(i)))
|
|
11
11
|
return;
|
|
12
|
-
const [l,
|
|
13
|
-
return parseFloat(
|
|
14
|
-
},
|
|
15
|
-
variant:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
const [l, t = l, , o = t] = d;
|
|
13
|
+
return parseFloat(o) > 0 && parseFloat(t) > 0 ? { paddingLeft: o, paddingRight: t } : void 0;
|
|
14
|
+
}, re = ({
|
|
15
|
+
variant: f = "default",
|
|
16
|
+
tone: d = "neutral",
|
|
17
|
+
title: l,
|
|
18
|
+
subtitle: t,
|
|
19
|
+
extra: o,
|
|
19
20
|
children: i,
|
|
20
|
-
padding:
|
|
21
|
-
size:
|
|
22
|
-
width:
|
|
23
|
-
minWidth:
|
|
24
|
-
dimmed:
|
|
25
|
-
direction:
|
|
26
|
-
align:
|
|
27
|
-
fullHeight:
|
|
28
|
-
border:
|
|
29
|
-
alignSelf:
|
|
30
|
-
height:
|
|
21
|
+
padding: c = "20px",
|
|
22
|
+
size: u = "default",
|
|
23
|
+
width: y,
|
|
24
|
+
minWidth: R,
|
|
25
|
+
dimmed: T = !1,
|
|
26
|
+
direction: p,
|
|
27
|
+
align: S,
|
|
28
|
+
fullHeight: x = !1,
|
|
29
|
+
border: v = "base",
|
|
30
|
+
alignSelf: E,
|
|
31
|
+
height: r,
|
|
31
32
|
footer: e,
|
|
32
|
-
glassFooter:
|
|
33
|
-
className:
|
|
34
|
-
style:
|
|
33
|
+
glassFooter: s = !1,
|
|
34
|
+
className: N = "",
|
|
35
|
+
style: w = {},
|
|
35
36
|
headerConfig: a = {}
|
|
36
37
|
}) => {
|
|
37
|
-
const
|
|
38
|
+
const m = h(null), [b, L] = j(0);
|
|
38
39
|
G(() => {
|
|
39
|
-
if (
|
|
40
|
-
const
|
|
40
|
+
if (s && e && m.current) {
|
|
41
|
+
const _ = new ResizeObserver((O) => {
|
|
41
42
|
for (const $ of O)
|
|
42
43
|
L($.contentRect.height);
|
|
43
44
|
});
|
|
44
|
-
return
|
|
45
|
+
return _.observe(m.current), L(m.current.offsetHeight), () => _.disconnect();
|
|
45
46
|
}
|
|
46
|
-
}, [
|
|
47
|
+
}, [s, e]);
|
|
47
48
|
const H = [
|
|
48
49
|
"card-base",
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
].filter(Boolean).join(" "),
|
|
56
|
-
padding:
|
|
50
|
+
T ? "card-dimmed" : "",
|
|
51
|
+
v === "rounded" ? "card-rounded" : "",
|
|
52
|
+
x ? "h-full" : "",
|
|
53
|
+
r ? "flex flex-col" : "",
|
|
54
|
+
u === "small" ? "text-sm" : "",
|
|
55
|
+
N
|
|
56
|
+
].filter(Boolean).join(" "), I = a != null && a.padding ? void 0 : q(c), k = parseInt(c) || 20, z = {
|
|
57
|
+
padding: c,
|
|
57
58
|
// The card clips overflow, so a long token in flowing text breaks rather than vanishing.
|
|
58
59
|
// Flex and grid items keep their min-content width; those need their own wrapping.
|
|
59
60
|
overflowWrap: "break-word",
|
|
60
|
-
display:
|
|
61
|
-
flexDirection:
|
|
62
|
-
alignItems:
|
|
63
|
-
...
|
|
64
|
-
...
|
|
65
|
-
paddingBottom: `${
|
|
61
|
+
display: p ? "flex" : void 0,
|
|
62
|
+
flexDirection: p,
|
|
63
|
+
alignItems: S,
|
|
64
|
+
...r && { overflow: "auto", height: "100%" },
|
|
65
|
+
...s && e && b > 0 && {
|
|
66
|
+
paddingBottom: `${k + b + 10}px`
|
|
66
67
|
}
|
|
67
68
|
};
|
|
68
|
-
if (
|
|
69
|
-
return /* @__PURE__ */
|
|
69
|
+
if (f === "framed")
|
|
70
|
+
return /* @__PURE__ */ A(
|
|
70
71
|
"div",
|
|
71
72
|
{
|
|
72
|
-
className: `${
|
|
73
|
+
className: `${M} flex flex-col ${N}`,
|
|
73
74
|
style: {
|
|
74
75
|
// The frame drops `card-base`, which carried the text colour.
|
|
75
|
-
...
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
...
|
|
81
|
-
...
|
|
76
|
+
...C,
|
|
77
|
+
backgroundColor: W(d),
|
|
78
|
+
width: y,
|
|
79
|
+
minWidth: R,
|
|
80
|
+
alignSelf: E,
|
|
81
|
+
...x && { height: "100%" },
|
|
82
|
+
...r && { height: r },
|
|
83
|
+
...w
|
|
82
84
|
},
|
|
83
85
|
children: [
|
|
84
|
-
|
|
86
|
+
B({ title: l, subtitle: t, extra: o }) && /* @__PURE__ */ n(P, { title: l, subtitle: t, extra: o }),
|
|
85
87
|
/* @__PURE__ */ n(
|
|
86
88
|
"div",
|
|
87
89
|
{
|
|
88
90
|
className: "min-h-0 flex-1",
|
|
89
91
|
style: {
|
|
90
|
-
...
|
|
91
|
-
padding:
|
|
92
|
+
...U,
|
|
93
|
+
padding: c,
|
|
92
94
|
overflowWrap: "break-word",
|
|
93
|
-
display:
|
|
94
|
-
flexDirection:
|
|
95
|
-
alignItems:
|
|
96
|
-
...
|
|
95
|
+
display: p ? "flex" : void 0,
|
|
96
|
+
flexDirection: p,
|
|
97
|
+
alignItems: S,
|
|
98
|
+
...r && { overflow: "auto" }
|
|
97
99
|
},
|
|
98
100
|
children: i
|
|
99
101
|
}
|
|
@@ -103,32 +105,32 @@ const Y = /^\d*\.?\d+(px|rem|em)$/, V = (m) => {
|
|
|
103
105
|
}
|
|
104
106
|
);
|
|
105
107
|
const D = {
|
|
106
|
-
width:
|
|
107
|
-
minWidth:
|
|
108
|
-
alignSelf:
|
|
109
|
-
...
|
|
110
|
-
...
|
|
111
|
-
...
|
|
108
|
+
width: y,
|
|
109
|
+
minWidth: R,
|
|
110
|
+
alignSelf: E,
|
|
111
|
+
...x && { height: "100%" },
|
|
112
|
+
...r && { height: r, display: "flex", flexDirection: "column" },
|
|
113
|
+
...s && e && { position: "relative" },
|
|
112
114
|
overflow: "hidden",
|
|
113
|
-
...
|
|
115
|
+
...w
|
|
114
116
|
};
|
|
115
|
-
return /* @__PURE__ */
|
|
116
|
-
|
|
117
|
+
return /* @__PURE__ */ A("div", { className: H, style: D, children: [
|
|
118
|
+
B({ title: l, subtitle: t, extra: o }) && /* @__PURE__ */ n(
|
|
117
119
|
"div",
|
|
118
120
|
{
|
|
119
|
-
className:
|
|
121
|
+
className: I ? "card-header py-2" : "card-header px-3 py-2",
|
|
120
122
|
style: {
|
|
121
123
|
marginBottom: "1px",
|
|
122
|
-
fontSize:
|
|
124
|
+
fontSize: u === "small" ? "12px" : "13px",
|
|
123
125
|
fontWeight: "normal",
|
|
124
|
-
...a != null && a.padding ? { padding: a.padding } :
|
|
126
|
+
...a != null && a.padding ? { padding: a.padding } : I
|
|
125
127
|
},
|
|
126
128
|
children: /* @__PURE__ */ n(
|
|
127
|
-
|
|
129
|
+
F,
|
|
128
130
|
{
|
|
129
|
-
title:
|
|
130
|
-
subtitle:
|
|
131
|
-
extra:
|
|
131
|
+
title: l,
|
|
132
|
+
subtitle: t,
|
|
133
|
+
extra: o,
|
|
132
134
|
titleClassName: "font-normal overflow-visible"
|
|
133
135
|
}
|
|
134
136
|
)
|
|
@@ -140,7 +142,7 @@ const Y = /^\d*\.?\d+(px|rem|em)$/, V = (m) => {
|
|
|
140
142
|
className: "flex-1",
|
|
141
143
|
style: {
|
|
142
144
|
...z,
|
|
143
|
-
...
|
|
145
|
+
...s && e && { position: "relative" }
|
|
144
146
|
},
|
|
145
147
|
children: i
|
|
146
148
|
}
|
|
@@ -148,16 +150,16 @@ const Y = /^\d*\.?\d+(px|rem|em)$/, V = (m) => {
|
|
|
148
150
|
e && /* @__PURE__ */ n(
|
|
149
151
|
"div",
|
|
150
152
|
{
|
|
151
|
-
ref:
|
|
153
|
+
ref: s ? m : void 0,
|
|
152
154
|
className: "card-footer px-4 py-3",
|
|
153
|
-
style:
|
|
154
|
-
...
|
|
155
|
+
style: s ? {
|
|
156
|
+
...Y,
|
|
155
157
|
position: "absolute",
|
|
156
158
|
bottom: 0,
|
|
157
159
|
left: 0,
|
|
158
160
|
right: 0,
|
|
159
|
-
borderBottomLeftRadius:
|
|
160
|
-
borderBottomRightRadius:
|
|
161
|
+
borderBottomLeftRadius: v === "rounded" ? "20px" : "12px",
|
|
162
|
+
borderBottomRightRadius: v === "rounded" ? "20px" : "12px"
|
|
161
163
|
} : void 0,
|
|
162
164
|
children: e
|
|
163
165
|
}
|
|
@@ -165,7 +167,7 @@ const Y = /^\d*\.?\d+(px|rem|em)$/, V = (m) => {
|
|
|
165
167
|
] });
|
|
166
168
|
};
|
|
167
169
|
export {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
+
re as Card,
|
|
171
|
+
re as default
|
|
170
172
|
};
|
|
171
173
|
//# sourceMappingURL=Card.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","sources":["../../src/components/Card.tsx"],"sourcesContent":["import React, { useRef, useEffect, useState } from 'react';\nimport FrameHeader, { HeaderRow } from './FrameHeader';\nimport { FRAME_CLASS, FRAME_SECTION_STYLE } from './frameStyles';\nimport { GLASS_SURFACE_STYLE } from './glassSurface';\nimport { hasHeaderContent } from './headerContent';\nimport { FOREGROUND_RESET } from './selectedRow';\n\nexport type CardVariant = 'default' | 'framed';\n\ninterface CardProps {\n /**\n * `framed` draws the detached Table's frame: the title row sits on a grey frame and the\n * children in a bordered section inside it, so a card above a table reads as part of the\n * same set. `dimmed`, `border`, `size`, `glassFooter` and `headerConfig` do not apply to it.\n */\n variant?: CardVariant;\n title?: string | React.ReactNode;\n /** Dimmed text beside the title, such as a count or a unit. */\n subtitle?: React.ReactNode;\n /** Actions at the right of the title row. */\n extra?: React.ReactNode;\n padding?: string;\n children?: React.ReactNode;\n size?: 'default' | 'small';\n width?: string;\n minWidth?: string;\n direction?: 'row' | 'column';\n align?: 'center';\n dimmed?: boolean;\n fullHeight?: boolean;\n border?: 'base' | 'rounded';\n alignSelf?: 'center';\n height?: string;\n footer?: React.ReactNode;\n glassFooter?: boolean;\n className?: string;\n style?: React.CSSProperties;\n headerConfig?: {\n padding?: string;\n };\n}\n\nconst PLAIN_LENGTH = /^\\d*\\.?\\d+(px|rem|em)$/;\n\n// Only plain positive lengths are copied: calc() and var() can't be split from a shorthand, and a\n// zero inset would put the title against the border, so those keep the header's own 12px.\nconst horizontalInset = (padding: string): React.CSSProperties | undefined => {\n const parts = padding.trim().split(/\\s+/);\n if (parts.length > 4 || !parts.every((part) => PLAIN_LENGTH.test(part))) {\n return undefined;\n }\n const [top, right = top, , left = right] = parts;\n return parseFloat(left) > 0 && parseFloat(right) > 0\n ? { paddingLeft: left, paddingRight: right }\n : undefined;\n};\n\nconst Card: React.FC<CardProps> = ({\n variant = 'default',\n title,\n subtitle,\n extra,\n children,\n padding = '20px',\n size = 'default',\n width,\n minWidth,\n dimmed = false,\n direction,\n align,\n fullHeight = false,\n border = 'base',\n alignSelf,\n height,\n footer,\n glassFooter = false,\n className = '',\n style = {},\n headerConfig = {},\n}) => {\n const footerRef = useRef<HTMLDivElement>(null);\n const [footerHeight, setFooterHeight] = useState(0);\n\n useEffect(() => {\n if (glassFooter && footer && footerRef.current) {\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n setFooterHeight(entry.contentRect.height);\n }\n });\n\n observer.observe(footerRef.current);\n setFooterHeight(footerRef.current.offsetHeight);\n\n return () => observer.disconnect();\n }\n }, [glassFooter, footer]);\n\n // Size-specific padding\n const sizeClasses = size === 'small' ? 'text-sm' : '';\n\n // Dynamic classes based on props\n const cardClasses = [\n 'card-base',\n dimmed ? 'card-dimmed' : '',\n border === 'rounded' ? 'card-rounded' : '',\n fullHeight ? 'h-full' : '',\n height ? 'flex flex-col' : '',\n sizeClasses,\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n const headerInset = headerConfig?.padding ? undefined : horizontalInset(padding);\n\n // Content styles\n const paddingValue = parseInt(padding) || 20;\n const extraPadding = 10;\n const contentStyles: React.CSSProperties = {\n padding,\n // The card clips overflow, so a long token in flowing text breaks rather than vanishing.\n // Flex and grid items keep their min-content width; those need their own wrapping.\n overflowWrap: 'break-word',\n display: direction ? 'flex' : undefined,\n flexDirection: direction,\n alignItems: align,\n ...(height && { overflow: 'auto', height: '100%' }),\n ...(glassFooter &&\n footer &&\n footerHeight > 0 && {\n paddingBottom: `${paddingValue + footerHeight + extraPadding}px`,\n }),\n };\n\n if (variant === 'framed') {\n return (\n <div\n className={`${FRAME_CLASS} flex flex-col ${className}`}\n style={{\n // The frame drops `card-base`, which carried the text colour.\n ...FOREGROUND_RESET,\n width,\n minWidth,\n alignSelf,\n ...(fullHeight && { height: '100%' }),\n ...(height && { height }),\n ...style,\n }}\n >\n {hasHeaderContent({ title, subtitle, extra }) && (\n <FrameHeader title={title} subtitle={subtitle} extra={extra} />\n )}\n <div\n className=\"min-h-0 flex-1\"\n style={{\n ...FRAME_SECTION_STYLE,\n padding,\n overflowWrap: 'break-word',\n display: direction ? 'flex' : undefined,\n flexDirection: direction,\n alignItems: align,\n ...(height && { overflow: 'auto' }),\n }}\n >\n {children}\n </div>\n {footer && <div className=\"px-4 py-3\">{footer}</div>}\n </div>\n );\n }\n\n // Card container styles\n const cardContainerStyles: React.CSSProperties = {\n width,\n minWidth,\n alignSelf,\n ...(fullHeight && { height: '100%' }),\n ...(height && { height, display: 'flex', flexDirection: 'column' }),\n ...(glassFooter && footer && { position: 'relative' }),\n overflow: 'hidden',\n ...style,\n };\n\n return (\n <div className={cardClasses} style={cardContainerStyles}>\n {/* Header */}\n {hasHeaderContent({ title, subtitle, extra }) && (\n <div\n className={headerInset ? 'card-header py-2' : 'card-header px-3 py-2'}\n style={{\n marginBottom: '1px',\n fontSize: size === 'small' ? '12px' : '13px',\n fontWeight: 'normal',\n ...(headerConfig?.padding\n ? { padding: headerConfig.padding }\n : headerInset),\n }}\n >\n <HeaderRow\n title={title}\n subtitle={subtitle}\n extra={extra}\n titleClassName=\"font-normal overflow-visible\"\n />\n </div>\n )}\n\n {/* Body */}\n <div\n className=\"flex-1\"\n style={{\n ...contentStyles,\n ...(glassFooter && footer && { position: 'relative' }),\n }}\n >\n {children}\n </div>\n\n {/* Footer */}\n {footer && (\n <div\n ref={glassFooter ? footerRef : undefined}\n className=\"card-footer px-4 py-3\"\n style={\n glassFooter\n ? {\n ...GLASS_SURFACE_STYLE,\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n borderBottomLeftRadius: border === 'rounded' ? '20px' : '12px',\n borderBottomRightRadius: border === 'rounded' ? '20px' : '12px',\n }\n : undefined\n }\n >\n {footer}\n </div>\n )}\n </div>\n );\n};\n\nexport default Card;\nexport { Card };\n"],"names":["PLAIN_LENGTH","horizontalInset","padding","parts","part","top","right","left","Card","variant","title","subtitle","extra","children","size","width","minWidth","dimmed","direction","align","fullHeight","border","alignSelf","height","footer","glassFooter","className","style","headerConfig","footerRef","useRef","footerHeight","setFooterHeight","useState","useEffect","observer","entries","entry","cardClasses","headerInset","paddingValue","contentStyles","jsxs","FRAME_CLASS","FOREGROUND_RESET","hasHeaderContent","jsx","FrameHeader","FRAME_SECTION_STYLE","cardContainerStyles","HeaderRow","GLASS_SURFACE_STYLE"],"mappings":";;;;;;;AA0CA,MAAMA,IAAe,0BAIfC,IAAkB,CAACC,MAAqD;AAC1E,QAAMC,IAAQD,EAAQ,KAAA,EAAO,MAAM,KAAK;AACxC,MAAIC,EAAM,SAAS,KAAK,CAACA,EAAM,MAAM,CAACC,MAASJ,EAAa,KAAKI,CAAI,CAAC;AAClE;AAEJ,QAAM,CAACC,GAAKC,IAAQD,KAAOE,IAAOD,CAAK,IAAIH;AAC3C,SAAO,WAAWI,CAAI,IAAI,KAAK,WAAWD,CAAK,IAAI,IAC7C,EAAE,aAAaC,GAAM,cAAcD,MACnC;AACV,GAEME,KAA4B,CAAC;AAAA,EAC/B,SAAAC,IAAU;AAAA,EACV,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAX,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,SAAS;AAAA,QAAA,IAE7D;AAAA,QAGT,UAAAG;AAAA,MAAA;AAAA,IAAA;AAAA,EACL,GAER;AAER;"}
|
|
1
|
+
{"version":3,"file":"Card.js","sources":["../../src/components/Card.tsx"],"sourcesContent":["import React, { useRef, useEffect, useState } from 'react';\nimport FrameHeader, { HeaderRow } from './FrameHeader';\nimport { FRAME_CLASS, FRAME_SECTION_STYLE, frameToneBackground } from './frameStyles';\nimport { GLASS_SURFACE_STYLE } from './glassSurface';\nimport { hasHeaderContent } from './headerContent';\nimport type { ModalTrayTone } from './modalTray';\nimport { FOREGROUND_RESET } from './selectedRow';\n\n/**\n * `framed` draws the detached Table's frame: the title row sits on a grey frame and the children\n * in a bordered section inside it, so a card above a table reads as part of the same set.\n * `dimmed`, `border`, `size`, `glassFooter` and `headerConfig` do not apply to it.\n */\nexport type CardVariant = 'default' | 'framed';\nexport type CardTone = ModalTrayTone;\n\nexport interface CardProps {\n variant?: CardVariant;\n /** Only a framed card takes a tone; see `FramedCardProps`. */\n tone?: never;\n title?: string | React.ReactNode;\n /** Dimmed text beside the title, such as a count or a unit. */\n subtitle?: React.ReactNode;\n /** Actions at the right of the title row. */\n extra?: React.ReactNode;\n padding?: string;\n children?: React.ReactNode;\n size?: 'default' | 'small';\n width?: string;\n minWidth?: string;\n direction?: 'row' | 'column';\n align?: 'center';\n dimmed?: boolean;\n fullHeight?: boolean;\n border?: 'base' | 'rounded';\n alignSelf?: 'center';\n height?: string;\n footer?: React.ReactNode;\n glassFooter?: boolean;\n className?: string;\n style?: React.CSSProperties;\n headerConfig?: {\n padding?: string;\n };\n}\n\n/** A framed card, which alone takes a `tone`. A second interface so `CardProps` keeps its shape. */\nexport interface FramedCardProps extends Omit<CardProps, 'variant' | 'tone'> {\n variant: Extract<CardVariant, 'framed'>;\n /**\n * Paints the frame in the tray colour of the outcome it reports, as `Modal`'s `tray` does.\n * `neutral` keeps the default grey frame, so it still matches a detached Table.\n */\n tone?: CardTone;\n}\n\nexport type AnyCardProps = CardProps | FramedCardProps;\n\nconst PLAIN_LENGTH = /^\\d*\\.?\\d+(px|rem|em)$/;\n\n// Only plain positive lengths are copied: calc() and var() can't be split from a shorthand, and a\n// zero inset would put the title against the border, so those keep the header's own 12px.\nconst horizontalInset = (padding: string): React.CSSProperties | undefined => {\n const parts = padding.trim().split(/\\s+/);\n if (parts.length > 4 || !parts.every((part) => PLAIN_LENGTH.test(part))) {\n return undefined;\n }\n const [top, right = top, , left = right] = parts;\n return parseFloat(left) > 0 && parseFloat(right) > 0\n ? { paddingLeft: left, paddingRight: right }\n : undefined;\n};\n\nconst Card: React.FC<AnyCardProps> = ({\n variant = 'default',\n tone = 'neutral',\n title,\n subtitle,\n extra,\n children,\n padding = '20px',\n size = 'default',\n width,\n minWidth,\n dimmed = false,\n direction,\n align,\n fullHeight = false,\n border = 'base',\n alignSelf,\n height,\n footer,\n glassFooter = false,\n className = '',\n style = {},\n headerConfig = {},\n}) => {\n const footerRef = useRef<HTMLDivElement>(null);\n const [footerHeight, setFooterHeight] = useState(0);\n\n useEffect(() => {\n if (glassFooter && footer && footerRef.current) {\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n setFooterHeight(entry.contentRect.height);\n }\n });\n\n observer.observe(footerRef.current);\n setFooterHeight(footerRef.current.offsetHeight);\n\n return () => observer.disconnect();\n }\n }, [glassFooter, footer]);\n\n // Size-specific padding\n const sizeClasses = size === 'small' ? 'text-sm' : '';\n\n // Dynamic classes based on props\n const cardClasses = [\n 'card-base',\n dimmed ? 'card-dimmed' : '',\n border === 'rounded' ? 'card-rounded' : '',\n fullHeight ? 'h-full' : '',\n height ? 'flex flex-col' : '',\n sizeClasses,\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n const headerInset = headerConfig?.padding ? undefined : horizontalInset(padding);\n\n // Content styles\n const paddingValue = parseInt(padding) || 20;\n const extraPadding = 10;\n const contentStyles: React.CSSProperties = {\n padding,\n // The card clips overflow, so a long token in flowing text breaks rather than vanishing.\n // Flex and grid items keep their min-content width; those need their own wrapping.\n overflowWrap: 'break-word',\n display: direction ? 'flex' : undefined,\n flexDirection: direction,\n alignItems: align,\n ...(height && { overflow: 'auto', height: '100%' }),\n ...(glassFooter &&\n footer &&\n footerHeight > 0 && {\n paddingBottom: `${paddingValue + footerHeight + extraPadding}px`,\n }),\n };\n\n if (variant === 'framed') {\n return (\n <div\n className={`${FRAME_CLASS} flex flex-col ${className}`}\n style={{\n // The frame drops `card-base`, which carried the text colour.\n ...FOREGROUND_RESET,\n backgroundColor: frameToneBackground(tone),\n width,\n minWidth,\n alignSelf,\n ...(fullHeight && { height: '100%' }),\n ...(height && { height }),\n ...style,\n }}\n >\n {hasHeaderContent({ title, subtitle, extra }) && (\n <FrameHeader title={title} subtitle={subtitle} extra={extra} />\n )}\n <div\n className=\"min-h-0 flex-1\"\n style={{\n ...FRAME_SECTION_STYLE,\n padding,\n overflowWrap: 'break-word',\n display: direction ? 'flex' : undefined,\n flexDirection: direction,\n alignItems: align,\n ...(height && { overflow: 'auto' }),\n }}\n >\n {children}\n </div>\n {footer && <div className=\"px-4 py-3\">{footer}</div>}\n </div>\n );\n }\n\n // Card container styles\n const cardContainerStyles: React.CSSProperties = {\n width,\n minWidth,\n alignSelf,\n ...(fullHeight && { height: '100%' }),\n ...(height && { height, display: 'flex', flexDirection: 'column' }),\n ...(glassFooter && footer && { position: 'relative' }),\n overflow: 'hidden',\n ...style,\n };\n\n return (\n <div className={cardClasses} style={cardContainerStyles}>\n {/* Header */}\n {hasHeaderContent({ title, subtitle, extra }) && (\n <div\n className={headerInset ? 'card-header py-2' : 'card-header px-3 py-2'}\n style={{\n marginBottom: '1px',\n fontSize: size === 'small' ? '12px' : '13px',\n fontWeight: 'normal',\n ...(headerConfig?.padding\n ? { padding: headerConfig.padding }\n : headerInset),\n }}\n >\n <HeaderRow\n title={title}\n subtitle={subtitle}\n extra={extra}\n titleClassName=\"font-normal overflow-visible\"\n />\n </div>\n )}\n\n {/* Body */}\n <div\n className=\"flex-1\"\n style={{\n ...contentStyles,\n ...(glassFooter && footer && { position: 'relative' }),\n }}\n >\n {children}\n </div>\n\n {/* Footer */}\n {footer && (\n <div\n ref={glassFooter ? footerRef : undefined}\n className=\"card-footer px-4 py-3\"\n style={\n glassFooter\n ? {\n ...GLASS_SURFACE_STYLE,\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n borderBottomLeftRadius: border === 'rounded' ? '20px' : '12px',\n borderBottomRightRadius: border === 'rounded' ? '20px' : '12px',\n }\n : undefined\n }\n >\n {footer}\n </div>\n )}\n </div>\n );\n};\n\nexport default Card;\nexport { Card };\n"],"names":["PLAIN_LENGTH","horizontalInset","padding","parts","part","top","right","left","Card","variant","tone","title","subtitle","extra","children","size","width","minWidth","dimmed","direction","align","fullHeight","border","alignSelf","height","footer","glassFooter","className","style","headerConfig","footerRef","useRef","footerHeight","setFooterHeight","useState","useEffect","observer","entries","entry","cardClasses","headerInset","paddingValue","contentStyles","jsxs","FRAME_CLASS","FOREGROUND_RESET","frameToneBackground","hasHeaderContent","jsx","FrameHeader","FRAME_SECTION_STYLE","cardContainerStyles","HeaderRow","GLASS_SURFACE_STYLE"],"mappings":";;;;;;;AA0DA,MAAMA,IAAe,0BAIfC,IAAkB,CAACC,MAAqD;AAC1E,QAAMC,IAAQD,EAAQ,KAAA,EAAO,MAAM,KAAK;AACxC,MAAIC,EAAM,SAAS,KAAK,CAACA,EAAM,MAAM,CAACC,MAASJ,EAAa,KAAKI,CAAI,CAAC;AAClE;AAEJ,QAAM,CAACC,GAAKC,IAAQD,KAAOE,IAAOD,CAAK,IAAIH;AAC3C,SAAO,WAAWI,CAAI,IAAI,KAAK,WAAWD,CAAK,IAAI,IAC7C,EAAE,aAAaC,GAAM,cAAcD,MACnC;AACV,GAEME,KAA+B,CAAC;AAAA,EAClC,SAAAC,IAAU;AAAA,EACV,MAAAC,IAAO;AAAA,EACP,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EAC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UACP,wBAAwB/B,MAAW,YAAY,SAAS;AAAA,UACxD,yBAAyBA,MAAW,YAAY,SAAS;AAAA,QAAA,IAE7D;AAAA,QAGT,UAAAG;AAAA,MAAA;AAAA,IAAA;AAAA,EACL,GAER;AAER;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import p from "../../assets/icons/lock.svg.js";
|
|
3
|
+
const m = ({ size: o = 16, className: t = "", style: r = {}, onClick: n }) => {
|
|
4
|
+
const l = {
|
|
5
|
+
width: typeof o == "number" ? `${o}px` : o,
|
|
6
|
+
height: typeof o == "number" ? `${o}px` : o,
|
|
7
|
+
display: "inline-block",
|
|
8
|
+
fill: "currentColor",
|
|
9
|
+
...r
|
|
10
|
+
};
|
|
11
|
+
return /* @__PURE__ */ c(p, { className: t, style: l, onClick: n });
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
m as default
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=LockIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LockIcon.js","sources":["../../../src/components/CustomIcons/LockIcon.tsx"],"sourcesContent":["import type { CSSProperties } from 'react';\nimport LockIconSvg from '../../assets/icons/lock.svg?react';\nimport type { IconProps } from './PlusIcon';\n\nconst LockIcon: React.FC<IconProps> = ({ size = 16, className = '', style = {}, onClick }) => {\n const iconStyle: CSSProperties = {\n width: typeof size === 'number' ? `${size}px` : size,\n height: typeof size === 'number' ? `${size}px` : size,\n display: 'inline-block',\n fill: 'currentColor',\n ...style,\n };\n\n return <LockIconSvg className={className} style={iconStyle} onClick={onClick} />;\n};\n\nexport default LockIcon;\n"],"names":["LockIcon","size","className","style","onClick","iconStyle","jsx","LockIconSvg"],"mappings":";;AAIA,MAAMA,IAAgC,CAAC,EAAE,MAAAC,IAAO,IAAI,WAAAC,IAAY,IAAI,OAAAC,IAAQ,IAAI,SAAAC,QAAc;AAC1F,QAAMC,IAA2B;AAAA,IAC7B,OAAO,OAAOJ,KAAS,WAAW,GAAGA,CAAI,OAAOA;AAAA,IAChD,QAAQ,OAAOA,KAAS,WAAW,GAAGA,CAAI,OAAOA;AAAA,IACjD,SAAS;AAAA,IACT,MAAM;AAAA,IACN,GAAGE;AAAA,EAAA;AAGP,SAAO,gBAAAG,EAACC,GAAA,EAAY,WAAAL,GAAsB,OAAOG,GAAW,SAAAD,GAAkB;AAClF;"}
|