@estiva-app/ui 0.60.2 → 0.61.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/dist/ShowMore.d.ts +7 -1
- package/dist/ShowMore.d.ts.map +1 -1
- package/dist/index.js +23 -5
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
- package/registry.json +7 -1
- package/src/ShowMore.mdx +7 -0
- package/src/ShowMore.stories.tsx +14 -0
- package/src/ShowMore.test.tsx +16 -0
- package/src/ShowMore.tsx +37 -6
package/dist/ShowMore.d.ts
CHANGED
|
@@ -14,6 +14,10 @@ import { type ReactNode } from 'react';
|
|
|
14
14
|
*
|
|
15
15
|
* Focus arriving inside the cut content opens it: a field or a link there,
|
|
16
16
|
* reached by Tab or a click, is never worked on out of sight.
|
|
17
|
+
*
|
|
18
|
+
* `action` is one more small button on the toggle's row, at its right
|
|
19
|
+
* (Katerina, 8 October: Peek's block card puts "Open in Estiva Ship" level with
|
|
20
|
+
* Show more). The row is drawn for it whether or not the content is cut.
|
|
17
21
|
*/
|
|
18
22
|
export interface ShowMoreProps {
|
|
19
23
|
children: ReactNode;
|
|
@@ -21,7 +25,9 @@ export interface ShowMoreProps {
|
|
|
21
25
|
maxHeight?: number;
|
|
22
26
|
/** What the content sits on, for the fade to end in: a panel's `surface` (default), or an inset card's `inset`. */
|
|
23
27
|
surface?: 'surface' | 'inset';
|
|
28
|
+
/** A small muted `Button` with a leading icon, at the right of the toggle's row: the way out to where the content lives. Its words end where the content does. */
|
|
29
|
+
action?: ReactNode;
|
|
24
30
|
className?: string;
|
|
25
31
|
}
|
|
26
|
-
export declare function ShowMore({ children, maxHeight, surface, className }: ShowMoreProps): import("react").JSX.Element;
|
|
32
|
+
export declare function ShowMore({ children, maxHeight, surface, action, className }: ShowMoreProps): import("react").JSX.Element;
|
|
27
33
|
//# sourceMappingURL=ShowMore.d.ts.map
|
package/dist/ShowMore.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShowMore.d.ts","sourceRoot":"","sources":["../src/ShowMore.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"ShowMore.d.ts","sourceRoot":"","sources":["../src/ShowMore.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAKzE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,SAAS,CAAA;IACnB,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,mHAAmH;IACnH,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAA;IAC7B,kKAAkK;IAClK,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAID,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,SAAc,EAAE,OAAmB,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,aAAa,+BAkC3G"}
|
package/dist/index.js
CHANGED
|
@@ -3705,9 +3705,10 @@ function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sect
|
|
|
3705
3705
|
|
|
3706
3706
|
// src/ShowMore.tsx
|
|
3707
3707
|
import { useLayoutEffect as useLayoutEffect5, useRef as useRef13, useState as useState12 } from "react";
|
|
3708
|
+
import { IconChevronDown as IconChevronDown4, IconChevronUp } from "@tabler/icons-react";
|
|
3708
3709
|
import { jsx as jsx54, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3709
3710
|
var FADE_CLASSES = { surface: "from-bg-surface", inset: "from-bg-inset" };
|
|
3710
|
-
function ShowMore({ children, maxHeight = 96, surface = "surface", className }) {
|
|
3711
|
+
function ShowMore({ children, maxHeight = 96, surface = "surface", action, className }) {
|
|
3711
3712
|
const box = useRef13(null);
|
|
3712
3713
|
const [open, setOpen] = useState12(false);
|
|
3713
3714
|
const [overflows, setOverflows] = useState12(false);
|
|
@@ -3727,10 +3728,27 @@ function ShowMore({ children, maxHeight = 96, surface = "surface", className })
|
|
|
3727
3728
|
children,
|
|
3728
3729
|
cut && /* @__PURE__ */ jsx54("div", { "aria-hidden": true, className: cn("pointer-events-none absolute inset-x-0 bottom-0 h-10 bg-gradient-to-t to-transparent", FADE_CLASSES[surface]) })
|
|
3729
3730
|
] }),
|
|
3730
|
-
|
|
3731
|
-
|
|
3731
|
+
action ? /* @__PURE__ */ jsxs38("div", { className: cn("mt-1 flex w-full items-center gap-2", overflows ? "justify-between" : "justify-end"), children: [
|
|
3732
|
+
overflows && /* @__PURE__ */ jsx54(Toggle, { open, onToggle: () => setOpen((o) => !o) }),
|
|
3733
|
+
/* @__PURE__ */ jsx54("div", { className: "-mr-2 flex shrink-0", children: action })
|
|
3734
|
+
] }) : overflows && /* @__PURE__ */ jsx54(Toggle, { open, onToggle: () => setOpen((o) => !o), className: "mt-1" })
|
|
3732
3735
|
] });
|
|
3733
3736
|
}
|
|
3737
|
+
function Toggle({ open, onToggle, className }) {
|
|
3738
|
+
const Icon = open ? IconChevronUp : IconChevronDown4;
|
|
3739
|
+
return /* @__PURE__ */ jsx54(
|
|
3740
|
+
Button,
|
|
3741
|
+
{
|
|
3742
|
+
variant: "outlined",
|
|
3743
|
+
size: "small",
|
|
3744
|
+
leadingIcon: /* @__PURE__ */ jsx54(Icon, { stroke: 1.5, className: "size-3.5" }),
|
|
3745
|
+
className,
|
|
3746
|
+
"aria-expanded": open,
|
|
3747
|
+
onClick: onToggle,
|
|
3748
|
+
children: open ? "Show less" : "Show more"
|
|
3749
|
+
}
|
|
3750
|
+
);
|
|
3751
|
+
}
|
|
3734
3752
|
|
|
3735
3753
|
// src/Toolbar.tsx
|
|
3736
3754
|
import { Toolbar as BaseToolbar } from "@base-ui/react/toolbar";
|
|
@@ -3908,13 +3926,13 @@ function Property({ label, layout = "row", children, className }) {
|
|
|
3908
3926
|
}
|
|
3909
3927
|
|
|
3910
3928
|
// src/Reaction.tsx
|
|
3911
|
-
import { Toggle } from "@base-ui/react/toggle";
|
|
3929
|
+
import { Toggle as Toggle2 } from "@base-ui/react/toggle";
|
|
3912
3930
|
import { jsx as jsx61, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
3913
3931
|
function Reaction({ emoji, count, pressed = false, className, ...props }) {
|
|
3914
3932
|
return (
|
|
3915
3933
|
// @estiva-escape(no-copied-look): W1 (Katerina, 24 September: leave alone): a reaction pill shares four words with a field's box by coincidence
|
|
3916
3934
|
/* @__PURE__ */ jsxs42(
|
|
3917
|
-
|
|
3935
|
+
Toggle2,
|
|
3918
3936
|
{
|
|
3919
3937
|
pressed,
|
|
3920
3938
|
className: cn(
|