@estiva-app/ui 0.90.2 → 0.91.1
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/AttachedCard.d.ts +30 -0
- package/dist/AttachedCard.d.ts.map +1 -0
- package/dist/AttachmentCard.d.ts +14 -0
- package/dist/AttachmentCard.d.ts.map +1 -1
- package/dist/AvatarGroup.d.ts +7 -1
- package/dist/AvatarGroup.d.ts.map +1 -1
- package/dist/Card.d.ts +4 -1
- package/dist/Card.d.ts.map +1 -1
- package/dist/CommentBox.d.ts +1 -1
- package/dist/CommentBox.d.ts.map +1 -1
- package/dist/InlineText.d.ts +5 -2
- package/dist/InlineText.d.ts.map +1 -1
- package/dist/Link.d.ts +3 -2
- package/dist/Link.d.ts.map +1 -1
- package/dist/LinkCard.d.ts +3 -3
- package/dist/LinkCard.d.ts.map +1 -1
- package/dist/LinkChip.d.ts.map +1 -1
- package/dist/LinkParts.d.ts +17 -3
- package/dist/LinkParts.d.ts.map +1 -1
- package/dist/LinkPreview.d.ts.map +1 -1
- package/dist/LinkRow.d.ts +10 -5
- package/dist/LinkRow.d.ts.map +1 -1
- package/dist/PartCard.d.ts +16 -4
- package/dist/PartCard.d.ts.map +1 -1
- package/dist/Popover.d.ts +8 -1
- package/dist/Popover.d.ts.map +1 -1
- package/dist/ReactionRow.d.ts.map +1 -1
- package/dist/RichText.d.ts.map +1 -1
- package/dist/ShowMore.d.ts +8 -3
- package/dist/ShowMore.d.ts.map +1 -1
- package/dist/SuggestionMenu.d.ts +6 -2
- package/dist/SuggestionMenu.d.ts.map +1 -1
- package/dist/editor.js +19 -12
- package/dist/editor.js.map +3 -3
- package/dist/eslint/has-a-page-and-a-story.d.ts.map +1 -1
- package/dist/eslint/index.js +1093 -1076
- package/dist/eslint/index.js.map +4 -4
- package/dist/eslint/no-restyled-part.d.ts +9 -4
- package/dist/eslint/no-restyled-part.d.ts.map +1 -1
- package/dist/gates/{chunk-BS5JASHV.js → chunk-P2P6AHRY.js} +2 -2
- package/dist/gates/{chunk-BS5JASHV.js.map → chunk-P2P6AHRY.js.map} +2 -2
- package/dist/gates/cli.js +1 -1
- package/dist/gates/gate-config.d.ts +4 -1
- package/dist/gates/gate-config.d.ts.map +1 -1
- package/dist/gates/hook.d.ts.map +1 -1
- package/dist/gates/index.js +2 -2
- package/dist/gates/index.js.map +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +318 -200
- package/dist/index.js.map +4 -4
- package/dist/linked.d.ts +7 -9
- package/dist/linked.d.ts.map +1 -1
- package/dist/linked.examples.d.ts.map +1 -1
- package/dist/linkedFrom.d.ts +5 -0
- package/dist/linkedFrom.d.ts.map +1 -1
- package/dist/links.d.ts +2 -2
- package/dist/links.d.ts.map +1 -1
- package/dist/looks.d.ts +24 -0
- package/dist/looks.d.ts.map +1 -1
- package/dist/registry/{app-X2GI4WTU.js → app-IGBRDD4L.js} +3 -3
- package/dist/registry/{build-P6X3PTZP.js → build-MWN4UI23.js} +2 -2
- package/dist/registry/{chunk-P55P2QFD.js → chunk-4TWYUIOB.js} +1 -1
- package/dist/registry/chunk-4TWYUIOB.js.map +7 -0
- package/dist/registry/{chunk-V67F474L.js → chunk-NSHK76XT.js} +2 -2
- package/dist/registry/{chunk-4QWD3EBY.js → chunk-THI3SLW5.js} +1 -1
- package/dist/registry/{chunk-4QWD3EBY.js.map → chunk-THI3SLW5.js.map} +1 -1
- package/dist/registry/cli.js +3 -3
- package/dist/registry/find.d.ts +1 -1
- package/dist/registry/find.d.ts.map +1 -1
- package/dist/registry/index.js +3 -3
- package/package.json +1 -1
- package/registry.json +532 -462
- package/src/AppProvider.stories.tsx +1 -1
- package/src/AppShell.stories.tsx +1 -1
- package/src/AttachedCard.mdx +55 -0
- package/src/{CardUnder.stories.tsx → AttachedCard.stories.tsx} +10 -19
- package/src/{CardUnder.test.tsx → AttachedCard.test.tsx} +11 -11
- package/src/AttachedCard.tsx +41 -0
- package/src/AttachmentCard.stories.tsx +1 -1
- package/src/AttachmentCard.tsx +36 -14
- package/src/Avatar.stories.tsx +1 -1
- package/src/AvatarGroup.stories.tsx +1 -1
- package/src/AvatarGroup.tsx +8 -2
- package/src/Banner.stories.tsx +1 -1
- package/src/BlockHandle.stories.tsx +1 -1
- package/src/BlockNodes.stories.tsx +1 -1
- package/src/Breadcrumb.stories.tsx +1 -1
- package/src/Button.stories.tsx +1 -1
- package/src/Card.stories.tsx +1 -1
- package/src/Card.test.tsx +1 -1
- package/src/Card.tsx +5 -2
- package/src/Checkbox.stories.tsx +1 -1
- package/src/Chip.stories.tsx +1 -1
- package/src/ChipInput.stories.tsx +1 -1
- package/src/CodeBlockColours.stories.tsx +1 -1
- package/src/CollapsibleSection.stories.tsx +1 -1
- package/src/CommandPalette.stories.tsx +1 -1
- package/src/CommentBox.mdx +3 -3
- package/src/CommentBox.stories.tsx +39 -7
- package/src/CommentBox.test.tsx +1 -1
- package/src/CommentBox.tsx +27 -17
- package/src/CommentHighlights.stories.tsx +1 -1
- package/src/ComposerTriggers.stories.tsx +1 -1
- package/src/ConfirmDialog.stories.tsx +1 -1
- package/src/ContainerHeader.stories.tsx +1 -1
- package/src/DialogShell.stories.tsx +1 -1
- package/src/Divider.stories.tsx +1 -1
- package/src/DocumentEditor.stories.tsx +1 -1
- package/src/EditableText.stories.tsx +1 -1
- package/src/EditorBlockHandle.stories.tsx +1 -1
- package/src/EditorTableControls.stories.tsx +1 -1
- package/src/EmptyState.stories.tsx +1 -1
- package/src/EntryShell.mdx +1 -1
- package/src/EntryShell.stories.tsx +1 -1
- package/src/ErrorBoundary.stories.tsx +1 -1
- package/src/Field.stories.tsx +1 -1
- package/src/FieldLine.stories.tsx +1 -1
- package/src/FilePicker.stories.tsx +1 -1
- package/src/Form.stories.tsx +1 -1
- package/src/IconButton.stories.tsx +1 -1
- package/src/IdentityMenu.stories.tsx +1 -1
- package/src/InlineChip.stories.tsx +1 -1
- package/src/InlineText.mdx +1 -0
- package/src/InlineText.stories.tsx +6 -3
- package/src/InlineText.tsx +7 -2
- package/src/Kbd.stories.tsx +1 -1
- package/src/KindIcon.stories.tsx +1 -1
- package/src/Lightbox.stories.tsx +1 -1
- package/src/Link.mdx +3 -2
- package/src/Link.stories.tsx +1 -1
- package/src/Link.test.tsx +5 -3
- package/src/Link.tsx +5 -3
- package/src/LinkCard.mdx +7 -5
- package/src/LinkCard.stories.tsx +4 -1
- package/src/LinkCard.test.tsx +8 -2
- package/src/LinkCard.tsx +97 -67
- package/src/LinkChip.mdx +3 -3
- package/src/LinkChip.stories.tsx +1 -1
- package/src/LinkChip.test.tsx +1 -1
- package/src/LinkChip.tsx +17 -4
- package/src/LinkChips.stories.tsx +1 -1
- package/src/LinkParts.stories.tsx +1 -1
- package/src/LinkParts.tsx +40 -8
- package/src/LinkPlaces.stories.tsx +1 -1
- package/src/LinkPreview.mdx +1 -1
- package/src/LinkPreview.stories.tsx +1 -1
- package/src/LinkPreview.tsx +3 -1
- package/src/LinkRow.mdx +8 -6
- package/src/LinkRow.stories.tsx +3 -3
- package/src/LinkRow.test.tsx +3 -3
- package/src/LinkRow.tsx +71 -41
- package/src/ListColumn.stories.tsx +1 -1
- package/src/MembersDialog.stories.tsx +1 -1
- package/src/MembersPill.stories.tsx +1 -1
- package/src/Menu.stories.tsx +1 -1
- package/src/MenuItem.stories.tsx +1 -1
- package/src/NavItem.stories.tsx +1 -1
- package/src/NavTree.stories.tsx +1 -1
- package/src/Panel.stories.tsx +1 -1
- package/src/PartCard.mdx +5 -4
- package/src/PartCard.stories.tsx +34 -7
- package/src/PartCard.test.tsx +5 -3
- package/src/PartCard.tsx +48 -24
- package/src/PastedImages.stories.tsx +1 -1
- package/src/PastedMarkdown.stories.tsx +1 -1
- package/src/Person.stories.tsx +1 -1
- package/src/PersonTrigger.stories.tsx +1 -1
- package/src/Popover.stories.tsx +1 -1
- package/src/Popover.tsx +6 -2
- package/src/PreviewCard.stories.tsx +1 -1
- package/src/ProgressBar.stories.tsx +1 -1
- package/src/Property.stories.tsx +1 -1
- package/src/Rail.stories.tsx +1 -1
- package/src/RailItem.stories.tsx +1 -1
- package/src/Reaction.stories.tsx +1 -1
- package/src/ReactionPicker.stories.tsx +1 -1
- package/src/ReactionRow.stories.tsx +1 -1
- package/src/ReactionRow.tsx +3 -1
- package/src/ReferenceCards.mdx +3 -0
- package/src/ReferenceCards.stories.tsx +3 -1
- package/src/ReferenceMenu.mdx +1 -1
- package/src/ReferenceMenu.stories.tsx +1 -1
- package/src/RichText.stories.tsx +1 -1
- package/src/RichText.tsx +6 -2
- package/src/ScrollArea.stories.tsx +1 -1
- package/src/SearchInput.stories.tsx +1 -1
- package/src/SectionHeader.stories.tsx +1 -1
- package/src/SectionLabel.stories.tsx +1 -1
- package/src/Select.stories.tsx +1 -1
- package/src/SelectionToolbar.stories.tsx +1 -1
- package/src/ShowMore.mdx +4 -4
- package/src/ShowMore.stories.tsx +1 -1
- package/src/ShowMore.tsx +11 -6
- package/src/Sidebar.stories.tsx +1 -1
- package/src/Skeleton.stories.tsx +1 -1
- package/src/SuggestionMenu.mdx +4 -1
- package/src/SuggestionMenu.stories.tsx +14 -8
- package/src/SuggestionMenu.tsx +20 -3
- package/src/Tabs.stories.tsx +1 -1
- package/src/TextInput.stories.tsx +1 -1
- package/src/Textarea.stories.tsx +1 -1
- package/src/Toast.stories.tsx +1 -1
- package/src/Toolbar.stories.tsx +1 -1
- package/src/Tooltip.stories.tsx +1 -1
- package/src/TopBar.stories.tsx +1 -1
- package/src/UnreadDot.stories.tsx +1 -1
- package/src/eslint/has-a-page-and-a-story.test.ts +5 -0
- package/src/eslint/has-a-page-and-a-story.ts +11 -2
- package/src/eslint/no-restyled-part.test.ts +32 -8
- package/src/eslint/no-restyled-part.ts +50 -23
- package/src/gates/gate-config.ts +5 -2
- package/src/gates/gates.test.ts +20 -2
- package/src/gates/hook.ts +4 -3
- package/src/index.ts +2 -1
- package/src/linked.examples.ts +3 -4
- package/src/linked.ts +11 -1
- package/src/linkedFrom.test.tsx +55 -3
- package/src/linkedFrom.ts +47 -2
- package/src/links.ts +3 -2
- package/src/looks.ts +29 -0
- package/src/registry/build.ts +1 -1
- package/src/registry/contract.test.ts +1 -1
- package/src/registry/find.ts +1 -1
- package/src/registry/registry.test.ts +12 -12
- package/src/suggestionPopup.tsx +1 -1
- package/stories/Choosing.mdx +2 -2
- package/stories/DesignTokens.mdx +1 -1
- package/stories/GettingStarted.mdx +2 -2
- package/stories/Introduction.mdx +23 -4
- package/stories/TokensPage.tsx +12 -7
- package/dist/CardUnder.d.ts +0 -31
- package/dist/CardUnder.d.ts.map +0 -1
- package/dist/registry/chunk-P55P2QFD.js.map +0 -7
- package/src/CardUnder.mdx +0 -54
- package/src/CardUnder.tsx +0 -49
- /package/dist/registry/{app-X2GI4WTU.js.map → app-IGBRDD4L.js.map} +0 -0
- /package/dist/registry/{build-P6X3PTZP.js.map → build-MWN4UI23.js.map} +0 -0
- /package/dist/registry/{chunk-V67F474L.js.map → chunk-NSHK76XT.js.map} +0 -0
package/src/ReactionRow.tsx
CHANGED
|
@@ -62,7 +62,9 @@ export function AddReactionButton({ options, onPick, className }: AddReactionBut
|
|
|
62
62
|
align="left"
|
|
63
63
|
ariaLabel="Add a reaction"
|
|
64
64
|
contentClassName="p-1"
|
|
65
|
-
|
|
65
|
+
// As wide as its strip: a panel's 180px is a menu's, and left 24px empty right of the emoji (Katerina, 29 Oct).
|
|
66
|
+
// SelectionToolbar's and Peek's quick menu's panels do the same.
|
|
67
|
+
className={cn('w-auto min-w-0', className)}
|
|
66
68
|
trigger={
|
|
67
69
|
<IconButton variant="muted" tooltip="Add a reaction" aria-label="Add a reaction">
|
|
68
70
|
<IconMoodPlus size={16} stroke={1.5} />
|
package/src/ReferenceCards.mdx
CHANGED
|
@@ -5,6 +5,9 @@ import * as ReferenceCardsStories from './ReferenceCards.stories'
|
|
|
5
5
|
|
|
6
6
|
# ReferenceCards
|
|
7
7
|
|
|
8
|
+
**Deprecated.** A new editor uses **LinkPlaces**. This stays only for an editor
|
|
9
|
+
that has not moved yet.
|
|
10
|
+
|
|
8
11
|
A chip in a document can ask for a card after its line: compact, detailed or
|
|
9
12
|
none. The choice is the chip's own `embed`, so the card moves and goes with it.
|
|
10
13
|
This draws no card itself. It places a slot after each line that asks for
|
|
@@ -14,7 +14,9 @@ import { richTextClassName } from './RichText'
|
|
|
14
14
|
* one is the app's, which knows how to resolve what the chip points at.
|
|
15
15
|
*/
|
|
16
16
|
const meta = {
|
|
17
|
-
title: '
|
|
17
|
+
title: 'Writing/ReferenceCards',
|
|
18
|
+
// On its way out: the sidebar says "deprecated" beside its name (.storybook/manager.ts).
|
|
19
|
+
tags: ['deprecated'],
|
|
18
20
|
parameters: { layout: 'padded' },
|
|
19
21
|
} satisfies Meta
|
|
20
22
|
|
package/src/ReferenceMenu.mdx
CHANGED
|
@@ -23,7 +23,7 @@ Folder alone on its line (which stay chips), offer Open only.
|
|
|
23
23
|
|
|
24
24
|
- A document that is only read → **RichText**: a click on a link follows it.
|
|
25
25
|
- A message's box, where every link is a chip and its card goes under the
|
|
26
|
-
message → **
|
|
26
|
+
message → **AttachedCard**; leave this out, and a click on a chip follows it.
|
|
27
27
|
|
|
28
28
|
## How
|
|
29
29
|
|
package/src/RichText.stories.tsx
CHANGED
|
@@ -29,7 +29,7 @@ const EVERY_BLOCK: RichTextBlock[] = [
|
|
|
29
29
|
]
|
|
30
30
|
|
|
31
31
|
const meta = {
|
|
32
|
-
title: '
|
|
32
|
+
title: 'Writing/RichText',
|
|
33
33
|
component: RichText,
|
|
34
34
|
args: { blocks: EVERY_BLOCK, size: 'default' },
|
|
35
35
|
argTypes: { size: { control: 'inline-radio', options: ['default', 'small'] } },
|
package/src/RichText.tsx
CHANGED
|
@@ -171,7 +171,9 @@ function textWithLinks(text: string, renderText: (text: string) => ReactNode): R
|
|
|
171
171
|
if (written) {
|
|
172
172
|
return (
|
|
173
173
|
<span key={i} className="break-words">
|
|
174
|
-
<Link href={written[2]} external onClick={keepToLink}>
|
|
174
|
+
<Link href={written[2]} external onClick={keepToLink}>
|
|
175
|
+
{written[1]}
|
|
176
|
+
</Link>
|
|
175
177
|
</span>
|
|
176
178
|
)
|
|
177
179
|
}
|
|
@@ -180,7 +182,9 @@ function textWithLinks(text: string, renderText: (text: string) => ReactNode): R
|
|
|
180
182
|
return (
|
|
181
183
|
// An address has no spaces to wrap at, so it may break anywhere.
|
|
182
184
|
<span key={i} className="break-all">
|
|
183
|
-
<Link href={bare[1]} external onClick={keepToLink}>
|
|
185
|
+
<Link href={bare[1]} external onClick={keepToLink}>
|
|
186
|
+
{bare[1]}
|
|
187
|
+
</Link>
|
|
184
188
|
{bare[2]}
|
|
185
189
|
</span>
|
|
186
190
|
)
|
|
@@ -4,7 +4,7 @@ import { ScrollArea } from './ScrollArea'
|
|
|
4
4
|
|
|
5
5
|
/** A region that scrolls without taking width for its scrollbar. */
|
|
6
6
|
const meta = {
|
|
7
|
-
title: '
|
|
7
|
+
title: 'Page structure/ScrollArea',
|
|
8
8
|
component: ScrollArea,
|
|
9
9
|
parameters: { controls: { disable: true } },
|
|
10
10
|
args: { children: null },
|
|
@@ -3,7 +3,7 @@ import { SearchInput } from './SearchInput'
|
|
|
3
3
|
|
|
4
4
|
/** An inset field whose border strengthens on focus; under Signal the shortcut becomes the mono kbd chip. */
|
|
5
5
|
const meta = {
|
|
6
|
-
title: '
|
|
6
|
+
title: 'Forms & fields/SearchInput',
|
|
7
7
|
component: SearchInput,
|
|
8
8
|
decorators: [(Story) => <div className="w-[290px]"><Story /></div>],
|
|
9
9
|
} satisfies Meta<typeof SearchInput>
|
|
@@ -6,7 +6,7 @@ import { SectionHeader } from './SectionHeader'
|
|
|
6
6
|
|
|
7
7
|
/** The 32px row a section starts with. Hover it: the row fills, and its actions appear. A section that folds is CollapsibleSection, whose header this is. */
|
|
8
8
|
const meta = {
|
|
9
|
-
title: '
|
|
9
|
+
title: 'Page structure/SectionHeader',
|
|
10
10
|
component: SectionHeader,
|
|
11
11
|
decorators: [(Story) => <div className="w-[280px]"><Story /></div>],
|
|
12
12
|
args: { title: 'Section', showActions: 'hover' },
|
|
@@ -4,7 +4,7 @@ import { SectionLabel } from './SectionLabel'
|
|
|
4
4
|
|
|
5
5
|
/** Every section title renders through this span — a style change is one edit. Under Signal it becomes the mono uppercase micro-label. */
|
|
6
6
|
const meta = {
|
|
7
|
-
title: '
|
|
7
|
+
title: 'Page structure/SectionLabel',
|
|
8
8
|
component: SectionLabel,
|
|
9
9
|
args: { children: 'Starred' },
|
|
10
10
|
} satisfies Meta<typeof SectionLabel>
|
package/src/Select.stories.tsx
CHANGED
|
@@ -17,7 +17,7 @@ import { TextInput } from './TextInput'
|
|
|
17
17
|
* you stop using one.
|
|
18
18
|
*/
|
|
19
19
|
const meta = {
|
|
20
|
-
title: '
|
|
20
|
+
title: 'Forms & fields/Select',
|
|
21
21
|
component: Select,
|
|
22
22
|
parameters: { layout: 'padded' },
|
|
23
23
|
decorators: [(Story) => <div className="w-[360px]"><Story /></div>],
|
|
@@ -9,7 +9,7 @@ import { KeptSelection, SelectionToolbar, type MarkId } from './SelectionToolbar
|
|
|
9
9
|
* text you have already selected. It follows the selection by itself.
|
|
10
10
|
*/
|
|
11
11
|
const meta = {
|
|
12
|
-
title: '
|
|
12
|
+
title: 'Writing/SelectionToolbar',
|
|
13
13
|
component: SelectionToolbar,
|
|
14
14
|
parameters: { layout: 'padded' },
|
|
15
15
|
} satisfies Meta
|
package/src/ShowMore.mdx
CHANGED
|
@@ -31,16 +31,16 @@ Long content cut at a height behind a fade, with "Show more" under it.
|
|
|
31
31
|
```tsx
|
|
32
32
|
import { ShowMore } from '@estiva-app/ui'
|
|
33
33
|
|
|
34
|
-
<ShowMore
|
|
34
|
+
<ShowMore>
|
|
35
35
|
<p className="text-caption text-text-secondary">{description}</p>
|
|
36
36
|
</ShowMore>
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
- Wrap only the part that runs long. Keep titles and controls outside it, so
|
|
40
40
|
they are never the part that is cut.
|
|
41
|
-
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
- The fade is the content's own: its last 40px fade out over whatever it sits
|
|
42
|
+
on, a panel, an inset card or a selected message alike. `surface` is no
|
|
43
|
+
longer needed, and ignored.
|
|
44
44
|
- `maxHeight` is in px, 96 by default.
|
|
45
45
|
- The toggle is a small outlined `Button` with a chevron: down on "Show more",
|
|
46
46
|
up on "Show less". Its edge starts where the content does.
|
package/src/ShowMore.stories.tsx
CHANGED
|
@@ -11,7 +11,7 @@ const LONG = Array.from(
|
|
|
11
11
|
|
|
12
12
|
/** Long content cut behind a fade, with "Show more" under it. Short content is drawn whole. */
|
|
13
13
|
const meta = {
|
|
14
|
-
title: '
|
|
14
|
+
title: 'Page structure/ShowMore',
|
|
15
15
|
component: ShowMore,
|
|
16
16
|
decorators: [(Story) => <div className="w-[320px]"><Story /></div>],
|
|
17
17
|
args: { children: <p className="text-caption text-text-secondary">{LONG}</p> },
|
package/src/ShowMore.tsx
CHANGED
|
@@ -27,16 +27,22 @@ export interface ShowMoreProps {
|
|
|
27
27
|
children: ReactNode
|
|
28
28
|
/** The height to cut at, in px. Default 96: about seven lines of caption text. */
|
|
29
29
|
maxHeight?: number
|
|
30
|
-
/**
|
|
31
|
-
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated Nothing to choose: the fade is the content's own, fading out over whatever it sits on, a see-through
|
|
32
|
+
* inset card and a selected message included. Accepted, and ignored.
|
|
33
|
+
*/
|
|
34
|
+
surface?: 'surface' | 'inset' | 'elevated'
|
|
32
35
|
/** 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. */
|
|
33
36
|
action?: ReactNode
|
|
37
|
+
/** On the content alone, not the toggle's row under it: PartCard's quote bar runs beside the blocks only. */
|
|
38
|
+
contentClassName?: string
|
|
34
39
|
className?: string
|
|
35
40
|
}
|
|
36
41
|
|
|
37
|
-
|
|
42
|
+
/** The last 40px of cut content fade out: a mask on the content, not a fill over it, so it ends in whatever is behind. */
|
|
43
|
+
const FADE = 'linear-gradient(to top, transparent, black 40px)'
|
|
38
44
|
|
|
39
|
-
export function ShowMore({ children, maxHeight = 96,
|
|
45
|
+
export function ShowMore({ children, maxHeight = 96, action, contentClassName, className }: ShowMoreProps) {
|
|
40
46
|
const box = useRef<HTMLDivElement>(null)
|
|
41
47
|
const [open, setOpen] = useState(false)
|
|
42
48
|
const [overflows, setOverflows] = useState(false)
|
|
@@ -55,9 +61,8 @@ export function ShowMore({ children, maxHeight = 96, surface = 'surface', action
|
|
|
55
61
|
const cut = overflows && !open
|
|
56
62
|
return (
|
|
57
63
|
<div className={cn('flex flex-col items-start', className)}>
|
|
58
|
-
<div ref={box} className={cn('relative w-full', cut && 'overflow-hidden')} style={cut ? { maxHeight } : undefined} onFocus={cut ? () => setOpen(true) : undefined}>
|
|
64
|
+
<div ref={box} className={cn('relative w-full', cut && 'overflow-hidden', contentClassName)} style={cut ? { maxHeight, maskImage: FADE, WebkitMaskImage: FADE } : undefined} onFocus={cut ? () => setOpen(true) : undefined}>
|
|
59
65
|
{children}
|
|
60
|
-
{cut && <div aria-hidden className={cn('pointer-events-none absolute inset-x-0 bottom-0 h-10 bg-gradient-to-t to-transparent', FADE_CLASSES[surface])} />}
|
|
61
66
|
</div>
|
|
62
67
|
{action ? (
|
|
63
68
|
<div className={cn('mt-1 flex w-full items-center gap-2', overflows ? 'justify-between' : 'justify-end')}>
|
package/src/Sidebar.stories.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import { Sidebar } from './Sidebar'
|
|
|
8
8
|
const placeholder = <IconSquareRounded size={16} stroke={1.5} />
|
|
9
9
|
|
|
10
10
|
const meta = {
|
|
11
|
-
title: '
|
|
11
|
+
title: 'App frame/Sidebar',
|
|
12
12
|
component: Sidebar,
|
|
13
13
|
parameters: { layout: 'fullscreen' },
|
|
14
14
|
args: { children: null },
|
package/src/Skeleton.stories.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
|
2
2
|
import { SkeletonBar, SkeletonList, SkeletonRow } from './Skeleton'
|
|
3
3
|
|
|
4
4
|
const meta = {
|
|
5
|
-
title: '
|
|
5
|
+
title: 'Status & feedback/Skeleton',
|
|
6
6
|
component: SkeletonList,
|
|
7
7
|
} satisfies Meta<typeof SkeletonList>
|
|
8
8
|
|
package/src/SuggestionMenu.mdx
CHANGED
|
@@ -72,6 +72,9 @@ Suggestion<Command>({
|
|
|
72
72
|
Escape: the first press closes the list, the second is somebody's own.
|
|
73
73
|
- **Outside an editor**, draw `SuggestionMenu` itself with a `rect` to hang from,
|
|
74
74
|
and call `handle.current.onKeyDown(event)` from wherever the keys arrive.
|
|
75
|
+
Give `rect` as a function that says where the caret is now, as Tiptap's
|
|
76
|
+
`clientRect` does, and the list follows the caret when the page scrolls; a
|
|
77
|
+
rect alone is where the caret was, and the list stays there.
|
|
75
78
|
|
|
76
79
|
<Canvas of={SuggestionMenuStories.InAnEditor} />
|
|
77
80
|
|
|
@@ -83,7 +86,7 @@ It does these by itself. Write none of them around it.
|
|
|
83
86
|
|---|---|---|
|
|
84
87
|
| Moves through its items with the arrow keys, and wraps at the ends | an arrow-key handler | ✓ |
|
|
85
88
|
| Says what it is to assistive technology: a listbox of options, and the editor pointing at the active one | `role="listbox"`, `role="option"`, `aria-activedescendant` | ✓ |
|
|
86
|
-
| Hangs from the caret: above it, below when there is no room, never off the window | position arithmetic | |
|
|
89
|
+
| Hangs from the caret: above it, below when there is no room, never off the window, and follows it when the page scrolls | position arithmetic, a scroll listener | |
|
|
87
90
|
| Scrolls the highlighted row into view, and back to the first row when the list changes | `scrollIntoView` | |
|
|
88
91
|
| Chooses on a press without taking focus from the text | `preventDefault` on each row | |
|
|
89
92
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
2
|
import { IconSquareRounded } from '@tabler/icons-react'
|
|
3
|
-
import { useLayoutEffect, useMemo, useRef, useState, type ReactNode } from 'react'
|
|
3
|
+
import { useCallback, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from 'react'
|
|
4
4
|
import { Extension } from '@tiptap/core'
|
|
5
5
|
import { EditorContent, useEditor } from '@tiptap/react'
|
|
6
6
|
import StarterKit from '@tiptap/starter-kit'
|
|
@@ -15,9 +15,14 @@ import { suggestionPopup } from './suggestionPopup'
|
|
|
15
15
|
* Focus stays in the text: the editor hands its ↑, ↓ and Enter to the list.
|
|
16
16
|
*/
|
|
17
17
|
const meta = {
|
|
18
|
-
title: '
|
|
18
|
+
title: 'Writing/SuggestionMenu',
|
|
19
19
|
component: SuggestionMenu,
|
|
20
|
-
parameters: {
|
|
20
|
+
parameters: {
|
|
21
|
+
layout: 'padded',
|
|
22
|
+
// Each example in a frame of its own on the Docs page, so its list stays in its box. Drawn on the page itself, a
|
|
23
|
+
// list near the top of the window flipped below its caret as the page scrolled, over the words (Katerina, 29 Oct).
|
|
24
|
+
docs: { story: { inline: false, height: '560px' } },
|
|
25
|
+
},
|
|
21
26
|
} satisfies Meta
|
|
22
27
|
|
|
23
28
|
export default meta
|
|
@@ -46,13 +51,14 @@ const commandRow = (c: Command): SuggestionMenuRow => ({ label: c.label, shortcu
|
|
|
46
51
|
|
|
47
52
|
/**
|
|
48
53
|
* A line of text with the caret's place marked, and the list hung from it —
|
|
49
|
-
* the way the editor hangs it
|
|
50
|
-
*
|
|
54
|
+
* the way the editor hangs it: from where a stand-in for the caret is now,
|
|
55
|
+
* asked again each time the list is placed, as Tiptap's `clientRect` is.
|
|
51
56
|
*/
|
|
52
57
|
function AtACaret<T>({ children, ...props }: { children?: ReactNode } & Omit<Parameters<typeof SuggestionMenu<T>>[0], 'rect'>) {
|
|
53
58
|
const caret = useRef<HTMLSpanElement>(null)
|
|
54
|
-
const [
|
|
55
|
-
useLayoutEffect(() =>
|
|
59
|
+
const [drawn, setDrawn] = useState(false)
|
|
60
|
+
useLayoutEffect(() => setDrawn(true), [])
|
|
61
|
+
const where = useCallback(() => caret.current?.getBoundingClientRect() ?? null, [])
|
|
56
62
|
return (
|
|
57
63
|
<div className="flex h-[520px] items-end pb-6 text-body-2 text-text-primary">
|
|
58
64
|
<p>
|
|
@@ -60,7 +66,7 @@ function AtACaret<T>({ children, ...props }: { children?: ReactNode } & Omit<Par
|
|
|
60
66
|
<span ref={caret}>/</span>
|
|
61
67
|
{children}
|
|
62
68
|
</p>
|
|
63
|
-
<SuggestionMenu<T> {...props} rect={
|
|
69
|
+
<SuggestionMenu<T> {...props} rect={drawn ? where : null} />
|
|
64
70
|
</div>
|
|
65
71
|
)
|
|
66
72
|
}
|
package/src/SuggestionMenu.tsx
CHANGED
|
@@ -60,8 +60,12 @@ export interface SuggestionMenuHandle {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
export interface SuggestionMenuProps<T> {
|
|
63
|
-
/**
|
|
64
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Where the caret is, from the editor: Tiptap's `clientRect`, asked again each
|
|
65
|
+
* time the box is placed, so it follows the caret as the page scrolls. A rect
|
|
66
|
+
* is where the caret was, and stays there. `null` closes the box.
|
|
67
|
+
*/
|
|
68
|
+
rect: (() => DOMRect | null) | DOMRect | null
|
|
65
69
|
/** The editor's own element — told which row is active. Absent in a story. */
|
|
66
70
|
editorElement?: HTMLElement | null
|
|
67
71
|
/** Names the list — "Commands", "People". */
|
|
@@ -80,6 +84,19 @@ export interface SuggestionMenuProps<T> {
|
|
|
80
84
|
}
|
|
81
85
|
|
|
82
86
|
export function SuggestionMenu<T>({ rect, editorElement, ariaLabel, width, maxHeight, sections, itemKey, row, onSelect, handle }: SuggestionMenuProps<T>) {
|
|
87
|
+
// The caret where it is now, and the editor it sits in, whose scrolling moves it. Given only the rect it had as the
|
|
88
|
+
// list opened, the list stayed on the screen while the text scrolled away under it (Katerina, 29 Oct).
|
|
89
|
+
const last = useRef<DOMRect | null>(null)
|
|
90
|
+
const anchor = useMemo(() => {
|
|
91
|
+
if (typeof rect !== 'function') return rect
|
|
92
|
+
return {
|
|
93
|
+
getBoundingClientRect: () => {
|
|
94
|
+
last.current = rect() ?? last.current
|
|
95
|
+
return last.current ?? new DOMRect()
|
|
96
|
+
},
|
|
97
|
+
contextElement: editorElement ?? undefined,
|
|
98
|
+
}
|
|
99
|
+
}, [rect, editorElement])
|
|
83
100
|
const shown = useMemo(() => sections.filter((section) => section.items.length > 0), [sections])
|
|
84
101
|
const items = useMemo(() => shown.flatMap((section) => section.items), [shown])
|
|
85
102
|
const keys = items.map(itemKey).join('\n')
|
|
@@ -190,7 +207,7 @@ export function SuggestionMenu<T>({ rect, editorElement, ariaLabel, width, maxHe
|
|
|
190
207
|
|
|
191
208
|
return (
|
|
192
209
|
// finalFocus={false}: focus never left the text, and a list that closes because focus moved elsewhere must not pull it back (71a4577b).
|
|
193
|
-
<Popover anchor={
|
|
210
|
+
<Popover anchor={anchor} open={rect !== null} side="top" align="left" className={width} maxHeight={maxHeight} ariaLabel={ariaLabel} finalFocus={false}>
|
|
194
211
|
{/* The list the editor drives from its caret: a listbox, because Base UI's lists need a text field of their own.
|
|
195
212
|
`gap-0.5`: 2px between rows, as a menu's — a section with a heading
|
|
196
213
|
had them from `MenuSection`, and rows without one touched. */}
|
package/src/Tabs.stories.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { Select } from './Select'
|
|
|
4
4
|
import { TextInput } from './TextInput'
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: '
|
|
7
|
+
title: 'Forms & fields/TextInput',
|
|
8
8
|
component: TextInput,
|
|
9
9
|
parameters: { layout: 'padded' },
|
|
10
10
|
args: { placeholder: 'What is this about?' },
|
package/src/Textarea.stories.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
|
2
2
|
import { Textarea } from './Textarea'
|
|
3
3
|
|
|
4
4
|
const meta = {
|
|
5
|
-
title: '
|
|
5
|
+
title: 'Forms & fields/Textarea',
|
|
6
6
|
component: Textarea,
|
|
7
7
|
parameters: { layout: 'padded' },
|
|
8
8
|
args: { placeholder: 'Summarise the outcome or decision…', className: 'h-[109px]' },
|
package/src/Toast.stories.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { Toast, ToastProvider, useToast } from './Toast'
|
|
|
4
4
|
|
|
5
5
|
/** The pill that confirms something happened. Positioning and auto-dismiss live in ToastProvider. */
|
|
6
6
|
const meta = {
|
|
7
|
-
title: '
|
|
7
|
+
title: 'Status & feedback/Toast',
|
|
8
8
|
component: Toast,
|
|
9
9
|
args: {
|
|
10
10
|
label: 'Changes saved',
|
package/src/Toolbar.stories.tsx
CHANGED
|
@@ -14,7 +14,7 @@ import { Toolbar, ToolbarButton, ToolbarInput, ToolbarLink, ToolbarSeparator } f
|
|
|
14
14
|
* it without the caller drawing anything.
|
|
15
15
|
*/
|
|
16
16
|
const meta = {
|
|
17
|
-
title: '
|
|
17
|
+
title: 'Buttons & links/Toolbar',
|
|
18
18
|
component: Toolbar,
|
|
19
19
|
args: { 'aria-label': 'Formatting', children: null },
|
|
20
20
|
argTypes: { children: { control: false } },
|
package/src/Tooltip.stories.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import { Tooltip, WithTooltip } from './Tooltip'
|
|
|
6
6
|
import { Toolbar, ToolbarButton } from './Toolbar'
|
|
7
7
|
|
|
8
8
|
const meta = {
|
|
9
|
-
title: '
|
|
9
|
+
title: 'Menus & windows/Tooltip',
|
|
10
10
|
component: Tooltip,
|
|
11
11
|
args: { label: 'Add to starred' },
|
|
12
12
|
} satisfies Meta<typeof Tooltip>
|
package/src/TopBar.stories.tsx
CHANGED
|
@@ -16,6 +16,8 @@ const tester = new RuleTester({
|
|
|
16
16
|
|
|
17
17
|
/** Real files of this package, so the rules are tested against what they read. */
|
|
18
18
|
const src = (name: string) => fileURLToPath(new URL(`../${name}`, import.meta.url))
|
|
19
|
+
/** The package's root `stories/`: Storybook's pages and a prototype's helpers, which the gate reads too. */
|
|
20
|
+
const stories = (name: string) => fileURLToPath(new URL(`../../stories/${name}`, import.meta.url))
|
|
19
21
|
const code = 'export function Probe() {\n return null\n}\n'
|
|
20
22
|
const escaped = '// @estiva-escape(component-has-a-page, component-has-a-story): a probe file that documents itself in its own page\nexport function Probe() {\n return null\n}\n'
|
|
21
23
|
|
|
@@ -39,6 +41,8 @@ tester.run('component-has-a-page', componentHasAPage, {
|
|
|
39
41
|
{ name: 'a test file', code, filename: src('Button.test.tsx') },
|
|
40
42
|
{ name: 'a file that is not a component file at all', code, filename: src('index.ts') },
|
|
41
43
|
{ name: 'a component with its reason at the top', code: escaped, filename: src('NoPageProbe.tsx') },
|
|
44
|
+
{ name: "a helper in the root stories/, which is not a part (the One conversation prototype's Conversation.tsx)", code, filename: stories('one-conversation/Conversation.tsx') },
|
|
45
|
+
{ name: 'a page of the root stories/ drawn in a .tsx', code, filename: stories('TokensPage.tsx') },
|
|
42
46
|
],
|
|
43
47
|
invalid: [
|
|
44
48
|
{ name: 'a component with no page', code, filename: src('NoPageProbe.tsx'), errors: [{ messageId: 'missing' }] },
|
|
@@ -50,6 +54,7 @@ tester.run('component-has-a-story', componentHasAStory, {
|
|
|
50
54
|
{ name: 'a component with its story beside it', code, filename: src('Button.tsx') },
|
|
51
55
|
{ name: 'a story file, which is not itself a component', code, filename: src('Button.stories.tsx') },
|
|
52
56
|
{ name: 'a component with its reason at the top', code: escaped, filename: src('NoStoryProbe.tsx') },
|
|
57
|
+
{ name: "a helper in the root stories/, which is not a part (the One conversation prototype's Places.tsx)", code, filename: stories('one-conversation/Places.tsx') },
|
|
53
58
|
],
|
|
54
59
|
invalid: [
|
|
55
60
|
{ name: 'a component with no story', code, filename: src('NoStoryProbe.tsx'), errors: [{ messageId: 'missing' }] },
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs'
|
|
2
|
+
import { relative, sep } from 'node:path'
|
|
2
3
|
import type { Rule } from 'eslint'
|
|
3
4
|
import { ESCAPE_MESSAGES, isEscaped } from './escape'
|
|
5
|
+
import { packageDirOf } from './no-restyled-part'
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* A component of the package with no page, and one with no story (UIG-5, P2 and
|
|
@@ -21,6 +23,11 @@ import { ESCAPE_MESSAGES, isEscaped } from './escape'
|
|
|
21
23
|
* page and its story, never the other way round, so a page without a component
|
|
22
24
|
* is not this rule's business.
|
|
23
25
|
*
|
|
26
|
+
* Only the package's `src/` holds its components. The gate reads `stories/` too
|
|
27
|
+
* (a prototype there is what a build is checked against), but what lives there
|
|
28
|
+
* is Storybook's own pages and the helpers its stories draw with, not parts,
|
|
29
|
+
* so neither rule asks them for a page.
|
|
30
|
+
*
|
|
24
31
|
* A file that stays without one says why at its top: `// @estiva-escape: <why>`.
|
|
25
32
|
*/
|
|
26
33
|
interface ProgramNode {
|
|
@@ -29,9 +36,11 @@ interface ProgramNode {
|
|
|
29
36
|
range: [number, number]
|
|
30
37
|
}
|
|
31
38
|
|
|
32
|
-
/** A component file: a `.tsx` in the package's
|
|
39
|
+
/** A component file: a `.tsx` in the package's `src/` that is not a story or a test. */
|
|
33
40
|
function componentFile(filename: string): boolean {
|
|
34
|
-
|
|
41
|
+
if (!filename.endsWith('.tsx') || /\.(stories|test)\.tsx$/.test(filename)) return false
|
|
42
|
+
const dir = packageDirOf(filename)
|
|
43
|
+
return !dir || relative(dir, filename).split(sep).join('/').startsWith('src/')
|
|
35
44
|
}
|
|
36
45
|
|
|
37
46
|
function sibling(filename: string, extension: string): string {
|
|
@@ -39,13 +39,18 @@ write(
|
|
|
39
39
|
"import { Card, cn } from '@estiva-app/ui'\nexport function ConversationCard({ className, title }: { className?: string; title: string }) {\n return <Card className={cn('relative', className)}>{title}</Card>\n}\n",
|
|
40
40
|
)
|
|
41
41
|
write('app/src/components/Button.tsx', 'export function Button() {\n return null\n}\n')
|
|
42
|
-
write('pkg/package.json', '{ "name": "@estiva-app/ui" }')
|
|
42
|
+
write('pkg/package.json', '{ "name": "@estiva-app/ui", "exports": { ".": { "default": "./dist/index.js" }, "./editor": { "default": "./dist/editor.js" }, "./tokens.css": "./tokens.css" } }')
|
|
43
43
|
write('pkg/src/index.ts', "export { Link, type LinkProps } from './Link'\nexport { Card } from './Card'\nexport { cn } from './cn'\n")
|
|
44
44
|
write('pkg/src/Link.tsx', 'export function Link() {\n return null\n}\n')
|
|
45
45
|
write('pkg/src/cn.ts', 'export const cn = (...a: string[]) => a.join(" ")\n')
|
|
46
|
+
// The second entry, `@estiva-app/ui/editor`, where CommentBox lives.
|
|
47
|
+
write('pkg/src/editor.ts', "export { CommentBox, type CommentBoxProps } from './CommentBox'\n")
|
|
48
|
+
write('pkg/src/CommentBox.tsx', 'export function CommentBox() {\n return null\n}\n')
|
|
46
49
|
|
|
47
50
|
const app = join(root, 'app/src/Probe.tsx')
|
|
48
51
|
const pkg = join(root, 'pkg/src/Card.tsx')
|
|
52
|
+
/** A prototype's helper in the package's root `stories/`, which the gate reads since 28 October. */
|
|
53
|
+
const pkgStory = join(root, 'pkg/stories/one-conversation/Conversation.tsx')
|
|
49
54
|
const ui = (imports: string, body: string) => `import { ${imports} } from '@estiva-app/ui'\nexport function Probe() {\n return (\n${body}\n )\n}\n`
|
|
50
55
|
const local = (imports: string, from: string, body: string) => `import { ${imports} } from '${from}'\nexport function Probe() {\n return (\n${body}\n )\n}\n`
|
|
51
56
|
const USE_VARIANT_OR_SIZE = ' Use its `variant` or `size`.'
|
|
@@ -235,6 +240,20 @@ tester.run('no-restyled-part', noRestyledPart, {
|
|
|
235
240
|
code: local('Link', './Link', ' <Link href="/x" className="rounded-lg border">x</Link>'),
|
|
236
241
|
errors: [{ message: restyled('`rounded-lg` `border`', '`Link`', ' Use its `variant`, `truncate` or `cover`.') }],
|
|
237
242
|
},
|
|
243
|
+
{
|
|
244
|
+
name: 'in an app: a part from the editor entry, restyled',
|
|
245
|
+
filename: app,
|
|
246
|
+
code: "import { CommentBox } from '@estiva-app/ui/editor'\nexport function Probe() {\n return <CommentBox className=\"border-l-4 pl-2\" />\n}\n",
|
|
247
|
+
errors: [{ message: restyled('`border-l-4`', '`CommentBox`', noProp('CommentBox')) }],
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
// The One conversation prototype (estiva-ui concept/one-conversation 8641081, Conversation.tsx:199),
|
|
251
|
+
// which passed because only src/index.ts was read for the package's parts.
|
|
252
|
+
name: "inside the package: the editor entry's CommentBox restyled from a prototype in stories/, behind a condition",
|
|
253
|
+
filename: pkgStory,
|
|
254
|
+
code: "import { CommentBox } from '../../src/CommentBox'\nimport { cn } from '../../src/cn'\nexport function Probe({ on }: { on: boolean }) {\n return <CommentBox className={cn(on && '[&_[data-composer-editor]]:border-l-4 [&_[data-composer-editor]]:border-success-default [&_[data-composer-editor]]:pl-2')} />\n}\n",
|
|
255
|
+
errors: [{ message: restyled('`[&_[data-composer-editor]]:border-l-4` `[&_[data-composer-editor]]:border-success-default` `[&_[data-composer-editor]]:pl-2`', '`CommentBox`', noProp('CommentBox')) }],
|
|
256
|
+
},
|
|
238
257
|
{
|
|
239
258
|
name: 'inside the package: a part used in the file that declares it',
|
|
240
259
|
filename: pkg,
|
|
@@ -244,25 +263,30 @@ tester.run('no-restyled-part', noRestyledPart, {
|
|
|
244
263
|
],
|
|
245
264
|
})
|
|
246
265
|
|
|
247
|
-
/** Every part the package exports, from its own index.ts. */
|
|
266
|
+
/** Every part an entry of the package exports, from its own source: `index.ts`, and `editor.ts` for `@estiva-app/ui/editor`. */
|
|
248
267
|
const SRC = new URL('..', import.meta.url)
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
268
|
+
const partsOf = (entry: string) =>
|
|
269
|
+
[...readFileSync(new URL(entry, SRC), 'utf8').matchAll(/export \{([^}]*)\} from '\.\/[^']+'/g)]
|
|
270
|
+
.flatMap((m) => m[1].split(','))
|
|
271
|
+
.map((name) => name.trim())
|
|
272
|
+
.filter((name) => /^[A-Z][a-z]/.test(name))
|
|
273
|
+
const MAIN_PARTS = partsOf('index.ts')
|
|
274
|
+
const EDITOR_PARTS = partsOf('editor.ts').filter((name) => !MAIN_PARTS.includes(name))
|
|
275
|
+
const PARTS = [...MAIN_PARTS, ...EDITOR_PARTS]
|
|
276
|
+
const entryOf = (part: string) => (EDITOR_PARTS.includes(part) ? '@estiva-app/ui/editor' : '@estiva-app/ui')
|
|
254
277
|
|
|
255
278
|
describe('every part of the package is covered, by where it comes from', () => {
|
|
256
279
|
it('finds the parts', () => {
|
|
257
280
|
expect(PARTS.length).toBeGreaterThan(70)
|
|
258
281
|
expect(PARTS).toContain('EnterHint')
|
|
282
|
+
expect(EDITOR_PARTS).toContain('CommentBox')
|
|
259
283
|
})
|
|
260
284
|
tester.run('no-restyled-part, one case per exported part', noRestyledPart, {
|
|
261
285
|
valid: [],
|
|
262
286
|
invalid: PARTS.map((part) => ({
|
|
263
287
|
name: `${part}, restyled`,
|
|
264
288
|
filename: app,
|
|
265
|
-
code:
|
|
289
|
+
code: `import { ${part} } from '${entryOf(part)}'\nexport function Probe() {\n return (\n <${part} className="bg-bg-surface" />\n )\n}\n`,
|
|
266
290
|
errors: [{ message: restyled('`bg-bg-surface`', `\`${part}\``, PART_LOOK_PROPS[part] ? ` Use its ${PART_LOOK_PROPS[part].length === 1 ? `\`${PART_LOOK_PROPS[part][0]}\`` : `${PART_LOOK_PROPS[part].slice(0, -1).map((p) => `\`${p}\``).join(', ')} or \`${PART_LOOK_PROPS[part].at(-1)}\``}.` : noProp(part)) }],
|
|
267
291
|
})),
|
|
268
292
|
})
|