@semiont/react-ui 0.5.26 → 0.5.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -4
- package/dist/{PdfAnnotationCanvas.client-6ZSF6ZTJ.js → PdfAnnotationCanvas.client-C2IGG4SW.js} +33 -6
- package/dist/{PdfAnnotationCanvas.client-JCJMXWWJ.css → PdfAnnotationCanvas.client-TGDPPGXJ.css} +6 -1
- package/dist/{ar-YTUUGK2O.js → ar-FABPTJVB.js} +88 -26
- package/dist/{bn-ASGNGPMD.js → bn-LKP6BDMH.js} +88 -26
- package/dist/{chunk-L3WKRWP3.js → chunk-2GOHTTHW.js} +88 -26
- package/dist/{chunk-OBQOZCJE.js → chunk-2YHEE63S.js} +31 -31
- package/dist/{cs-WMYVAOZY.js → cs-YQYNWHRG.js} +88 -26
- package/dist/{da-FSHHN4D6.js → da-QHZOYKRY.js} +88 -26
- package/dist/{de-FJFO3TPT.js → de-GKA7RD7J.js} +88 -26
- package/dist/{el-XOH4QIAG.js → el-45T257AL.js} +88 -26
- package/dist/{en-3FCBW3YD.js → en-RVW5EQ66.js} +4 -2
- package/dist/{es-HDX4QI7E.js → es-AVER7RU4.js} +88 -26
- package/dist/{fa-DJ6WTFTJ.js → fa-K3VPK3O2.js} +88 -26
- package/dist/{fi-4S7H7W7U.js → fi-5NEKF7EB.js} +88 -26
- package/dist/{fr-6UJSYHXC.js → fr-FUMNDLBZ.js} +88 -26
- package/dist/{he-ZZJOHJX2.js → he-3JGNA3PR.js} +88 -26
- package/dist/{hi-HZJTAW7U.js → hi-IJY375DF.js} +88 -26
- package/dist/{id-E3I6ILEM.js → id-LWHKJ7ZD.js} +88 -26
- package/dist/index.css +380 -524
- package/dist/index.d.ts +318 -192
- package/dist/index.js +2960 -2421
- package/dist/integrations/css-modules-helper.js +1 -3
- package/dist/{it-ULAPAD7U.js → it-EBVOV4RW.js} +88 -26
- package/dist/{ja-SAHZQ4CZ.js → ja-KWRIX2NF.js} +88 -26
- package/dist/{ko-DFU2ADQ4.js → ko-L5CJMFDS.js} +88 -26
- package/dist/{ms-NWL76XNT.js → ms-LSNMJDR2.js} +88 -26
- package/dist/{nl-ATCM76WN.js → nl-ZB32MB7U.js} +88 -26
- package/dist/{no-UIAQ5RJF.js → no-4GTNY7M5.js} +88 -26
- package/dist/{pl-NOECQDXD.js → pl-LUHBLTHB.js} +88 -26
- package/dist/{pt-SVWIIUPC.js → pt-C4H3UNQ6.js} +88 -26
- package/dist/{ro-NR2DRTZG.js → ro-GGITS5V4.js} +88 -26
- package/dist/{sv-STVJ37JP.js → sv-T56RTLBP.js} +88 -26
- package/dist/test-utils.css +1 -1
- package/dist/test-utils.d.ts +1 -1
- package/dist/test-utils.js +2 -2
- package/dist/{th-UWQR4K54.js → th-22X2IWCB.js} +88 -26
- package/dist/{tr-WNXZSD27.js → tr-77TFG62H.js} +88 -26
- package/dist/{uk-SJRMB47Y.js → uk-MIIL6NXT.js} +88 -26
- package/dist/{vi-TMRQFES2.js → vi-7JYOIGNV.js} +88 -26
- package/dist/{zh-QOL3LYEM.js → zh-ID6DRYU4.js} +88 -26
- package/package.json +11 -10
- package/src/components/AssistProgress.tsx +178 -134
- package/src/components/CodeMirrorRenderer.tsx +8 -8
- package/src/components/{EntityFoundLog.tsx → ItemFoundLog.tsx} +12 -7
- package/src/components/ProtectedErrorBoundary.css +3 -1
- package/src/components/StatusDisplay.css +1 -1
- package/src/components/Toast.css +3 -1
- package/src/components/__tests__/AssistProgress.test.tsx +268 -141
- package/src/components/annotation/annotation-entries.css +0 -4
- package/src/components/annotation/references.css +0 -4
- package/src/components/image-annotation/AnnotationOverlay.tsx +6 -6
- package/src/components/image-annotation/SvgDrawingCanvas.tsx +1 -1
- package/src/components/image-annotation/__tests__/AnnotationOverlay.click.test.tsx +7 -9
- package/src/components/image-annotation/__tests__/SvgDrawingCanvas.click.test.tsx +1 -2
- package/src/components/layout/Header.css +0 -4
- package/src/components/layout/LeftSidebar.css +0 -4
- package/src/components/modals/ComposeStep.tsx +218 -0
- package/src/components/modals/ConfigureGatherStep.tsx +10 -18
- package/src/components/modals/ConfigureGenerationStep.tsx +131 -54
- package/src/components/modals/ConfigureSearchStep.tsx +42 -40
- package/src/components/modals/ContextSummary.tsx +185 -72
- package/src/components/modals/CorpusPane.tsx +75 -0
- package/src/components/modals/DiscardPrompt.tsx +38 -0
- package/src/components/modals/GatherContextStep.tsx +237 -107
- package/src/components/modals/ReferenceWizardModal.tsx +287 -60
- package/src/components/modals/ResourceGenerateModal.tsx +233 -109
- package/src/components/modals/SearchModal.css +335 -111
- package/src/components/modals/SearchModal.tsx +1 -1
- package/src/components/modals/SearchResultsStep.tsx +63 -88
- package/src/components/modals/WizardFooter.tsx +69 -0
- package/src/components/modals/__tests__/ComposeStep.test.tsx +152 -0
- package/src/components/modals/__tests__/ConfigureGatherStep.test.tsx +14 -26
- package/src/components/modals/__tests__/ConfigureGenerationStep.test.tsx +290 -0
- package/src/components/modals/__tests__/ConfigureSearchStep.test.tsx +95 -0
- package/src/components/modals/__tests__/GatherContextStep.resource.test.tsx +463 -25
- package/src/components/modals/__tests__/ReferenceWizardModal.test.tsx +635 -0
- package/src/components/modals/__tests__/ResourceGenerateModal.test.tsx +277 -85
- package/src/components/modals/__tests__/SearchModal.search-wiring.test.tsx +6 -2
- package/src/components/modals/__tests__/SearchResultsStep.test.tsx +61 -0
- package/src/components/modals/__tests__/WizardFooter.test.tsx +344 -0
- package/src/components/modals/modals.css +16 -42
- package/src/components/navigation/NavigationTabs.css +0 -20
- package/src/components/pdf-annotation/PdfAnnotationCanvas.css +21 -2
- package/src/components/pdf-annotation/PdfAnnotationCanvas.tsx +36 -3
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.test.tsx +41 -6
- package/src/components/resource/AnnotateView.tsx +19 -8
- package/src/components/resource/AnnotationHistory.tsx +2 -0
- package/src/components/resource/BrowseView.tsx +20 -9
- package/src/components/resource/ResourceViewer.tsx +27 -28
- package/src/components/resource/__tests__/AnnotateView.embeddable.test.tsx +1 -1
- package/src/components/resource/__tests__/AnnotateView.focus.test.tsx +50 -0
- package/src/components/resource/__tests__/AnnotationHistory.test.tsx +2 -0
- package/src/components/resource/__tests__/BrowseView.embeddable.test.tsx +1 -1
- package/src/components/resource/__tests__/BrowseView.test.tsx +38 -12
- package/src/components/resource/__tests__/ResourceViewer.embeddable.test.tsx +47 -3
- package/src/components/resource/annotate-renderers.tsx +3 -3
- package/src/components/resource/event-formatting.ts +0 -3
- package/src/components/resource/panels/AssessmentEntry.tsx +1 -1
- package/src/components/resource/panels/AssessmentPanel.css +5 -6
- package/src/components/resource/panels/AssistSection.css +95 -263
- package/src/components/resource/panels/AssistSection.tsx +4 -4
- package/src/components/resource/panels/AssistShell.tsx +12 -4
- package/src/components/resource/panels/CollaborationPanel.css +47 -22
- package/src/components/resource/panels/CollaborationPanel.tsx +93 -2
- package/src/components/resource/panels/CommentEntry.tsx +1 -1
- package/src/components/resource/panels/CommentsPanel.css +0 -16
- package/src/components/resource/panels/HighlightEntry.tsx +1 -1
- package/src/components/resource/panels/HighlightPanel.css +0 -7
- package/src/components/resource/panels/JsonLdPanel.css +0 -4
- package/src/components/resource/panels/ReferenceEntry.tsx +10 -3
- package/src/components/resource/panels/ReferencesPanel.css +0 -12
- package/src/components/resource/panels/ReferencesPanel.tsx +16 -20
- package/src/components/resource/panels/ResourceInfoPanel.css +0 -32
- package/src/components/resource/panels/ResourceInfoPanel.tsx +89 -20
- package/src/components/resource/panels/StatisticsPanel.css +0 -20
- package/src/components/resource/panels/TagEntry.tsx +1 -1
- package/src/components/resource/panels/TaggingPanel.css +0 -4
- package/src/components/resource/panels/TaggingPanel.tsx +2 -10
- package/src/components/resource/panels/UnifiedAnnotationsPanel.css +0 -4
- package/src/components/resource/panels/UnifiedAnnotationsPanel.tsx +7 -2
- package/src/components/resource/panels/__tests__/AssessmentEntry.test.tsx +0 -1
- package/src/components/resource/panels/__tests__/AssistSection.test.tsx +48 -50
- package/src/components/resource/panels/__tests__/AssistShell.test.tsx +11 -6
- package/src/components/resource/panels/__tests__/CollaborationPanel.test.tsx +89 -0
- package/src/components/resource/panels/__tests__/CommentEntry.test.tsx +1 -2
- package/src/components/resource/panels/__tests__/HighlightEntry.test.tsx +0 -1
- package/src/components/resource/panels/__tests__/HighlightPanel.annotationProgress.test.tsx +44 -36
- package/src/components/resource/panels/__tests__/ReferenceEntry.test.tsx +41 -1
- package/src/components/resource/panels/__tests__/ReferencesPanel.headless.test.tsx +1 -1
- package/src/components/resource/panels/__tests__/ReferencesPanel.test.tsx +67 -54
- package/src/components/resource/panels/__tests__/ResourceInfoPanel.test.tsx +185 -7
- package/src/components/resource/panels/__tests__/TagEntry.test.tsx +0 -1
- package/src/components/settings/SettingsPanel.css +0 -4
- package/src/features/auth/auth.css +2 -26
- package/src/features/resource-compose/__tests__/ResourceComposePage.test.tsx +0 -65
- package/src/features/resource-compose/components/ResourceComposePage.tsx +17 -130
- package/src/features/resource-compose/state/__tests__/compose-page-state-unit.test.ts +1 -76
- package/src/features/resource-compose/state/compose-page-state-unit.ts +5 -48
- package/src/features/resource-discovery/__tests__/ResourceDiscoveryPage.test.tsx +55 -0
- package/src/features/resource-discovery/components/ResourceDiscoveryPage.tsx +29 -0
- package/src/features/resource-discovery/state/__tests__/discover-state-unit.test.ts +53 -3
- package/src/features/resource-discovery/state/discover-state-unit.ts +29 -8
- package/src/features/resource-viewer/__tests__/ResourceViewerPage.test.tsx +71 -15
- package/src/features/resource-viewer/components/ResourceViewerPage.tsx +166 -71
- package/src/features/resource-viewer/hooks/__tests__/useResourceViewedReport.test.tsx +63 -0
- package/src/features/resource-viewer/hooks/useResourceViewedReport.ts +33 -0
- package/src/features/resource-viewer/state/__tests__/resource-viewer-page-state-unit.test.ts +2 -2
- package/src/features/resource-viewer/state/resource-viewer-page-state-unit.ts +1 -1
- package/src/styles/core/buttons.css +3 -1
- package/src/styles/core/forms.css +35 -29
- package/src/styles/core/indicators.css +0 -4
- package/src/styles/core/inputs.css +0 -4
- package/src/styles/core/progress.css +2 -34
- package/src/styles/core/sliders.css +0 -4
- package/src/styles/core/toggles.css +0 -4
- package/src/styles/features/resource-discovery.css +13 -0
- package/src/styles/features/resource-viewer.css +0 -42
- package/src/styles/features/resource.css +0 -4
- package/src/styles/motivations/motivation-assessment.css +2 -2
- package/src/styles/panels/history-panel.css +0 -40
- package/src/styles/panels/user-panel.css +0 -3
- package/src/styles/patterns/panel-helpers.css +0 -27
- package/src/styles/patterns/panel-sections.css +0 -59
- package/src/styles/patterns/panels-base.css +0 -32
- package/translations/ar.json +84 -24
- package/translations/bn.json +84 -24
- package/translations/cs.json +84 -24
- package/translations/da.json +84 -24
- package/translations/de.json +84 -24
- package/translations/el.json +84 -24
- package/translations/en.json +84 -24
- package/translations/es.json +84 -24
- package/translations/fa.json +84 -24
- package/translations/fi.json +84 -24
- package/translations/fr.json +84 -24
- package/translations/he.json +84 -24
- package/translations/hi.json +84 -24
- package/translations/id.json +84 -24
- package/translations/it.json +84 -24
- package/translations/ja.json +84 -24
- package/translations/ko.json +84 -24
- package/translations/ms.json +84 -24
- package/translations/nl.json +84 -24
- package/translations/no.json +84 -24
- package/translations/pl.json +84 -24
- package/translations/pt.json +84 -24
- package/translations/ro.json +84 -24
- package/translations/sv.json +84 -24
- package/translations/th.json +84 -24
- package/translations/tr.json +84 -24
- package/translations/uk.json +84 -24
- package/translations/vi.json +84 -24
- package/translations/zh.json +84 -24
- package/dist/PdfAnnotationCanvas.client-6ZSF6ZTJ.js.map +0 -1
- package/dist/PdfAnnotationCanvas.client-JCJMXWWJ.css.map +0 -1
- package/dist/ar-YTUUGK2O.js.map +0 -1
- package/dist/bn-ASGNGPMD.js.map +0 -1
- package/dist/chunk-BTUG3VJJ.js.map +0 -1
- package/dist/chunk-L3WKRWP3.js.map +0 -1
- package/dist/chunk-O23TLLXW.js.map +0 -1
- package/dist/chunk-OBQOZCJE.js.map +0 -1
- package/dist/chunk-QT7LYM72.js.map +0 -1
- package/dist/chunk-VXASXU4K.js.map +0 -1
- package/dist/chunk-XUDKYAVC.js +0 -21
- package/dist/chunk-XUDKYAVC.js.map +0 -1
- package/dist/cs-WMYVAOZY.js.map +0 -1
- package/dist/da-FSHHN4D6.js.map +0 -1
- package/dist/de-FJFO3TPT.js.map +0 -1
- package/dist/el-XOH4QIAG.js.map +0 -1
- package/dist/en-3FCBW3YD.js.map +0 -1
- package/dist/es-HDX4QI7E.js.map +0 -1
- package/dist/fa-DJ6WTFTJ.js.map +0 -1
- package/dist/fi-4S7H7W7U.js.map +0 -1
- package/dist/fr-6UJSYHXC.js.map +0 -1
- package/dist/he-ZZJOHJX2.js.map +0 -1
- package/dist/hi-HZJTAW7U.js.map +0 -1
- package/dist/id-E3I6ILEM.js.map +0 -1
- package/dist/index.css.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/integrations/css-modules-helper.js.map +0 -1
- package/dist/integrations/styled-components-theme.js.map +0 -1
- package/dist/it-ULAPAD7U.js.map +0 -1
- package/dist/ja-SAHZQ4CZ.js.map +0 -1
- package/dist/ko-DFU2ADQ4.js.map +0 -1
- package/dist/ms-NWL76XNT.js.map +0 -1
- package/dist/nl-ATCM76WN.js.map +0 -1
- package/dist/no-UIAQ5RJF.js.map +0 -1
- package/dist/pl-NOECQDXD.js.map +0 -1
- package/dist/pt-SVWIIUPC.js.map +0 -1
- package/dist/ro-NR2DRTZG.js.map +0 -1
- package/dist/sv-STVJ37JP.js.map +0 -1
- package/dist/test-utils.css.map +0 -1
- package/dist/test-utils.js.map +0 -1
- package/dist/th-UWQR4K54.js.map +0 -1
- package/dist/tr-WNXZSD27.js.map +0 -1
- package/dist/uk-SJRMB47Y.js.map +0 -1
- package/dist/vi-TMRQFES2.js.map +0 -1
- package/dist/zh-QOL3LYEM.js.map +0 -1
- package/src/components/modals/ResourceSearchModal.tsx +0 -224
- package/src/components/modals/__tests__/ResourceSearchModal.test.tsx +0 -159
- package/src/integrations/tailwind-plugin.cjs +0 -224
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useState, useEffect, useRef } from 'react';
|
|
4
|
-
import { readyValue } from '@semiont/sdk';
|
|
5
|
-
import { Dialog, DialogPanel, DialogTitle, Transition, TransitionChild } from '@headlessui/react';
|
|
6
|
-
import { map } from 'rxjs/operators';
|
|
7
|
-
import { getResourceId, getPrimaryRepresentation } from '@semiont/core';
|
|
8
|
-
import { createSearchPipeline } from '@semiont/sdk';
|
|
9
|
-
import { useSemiont } from '../../session/SemiontProvider';
|
|
10
|
-
import { useObservable } from '../../hooks/useObservable';
|
|
11
|
-
import { useSearchAnnouncements } from '../../hooks/useSearchAnnouncements';
|
|
12
|
-
|
|
13
|
-
import type { ResourceDescriptor } from '@semiont/core';
|
|
14
|
-
|
|
15
|
-
type SearchResult = {
|
|
16
|
-
id: string;
|
|
17
|
-
name: string;
|
|
18
|
-
content?: string;
|
|
19
|
-
mediaType?: string;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const SEARCH_DEBOUNCE_MS = 300;
|
|
23
|
-
const SEARCH_LIMIT = 50;
|
|
24
|
-
|
|
25
|
-
function toSearchResult(resource: ResourceDescriptor & { content?: string }): SearchResult | null {
|
|
26
|
-
const id = getResourceId(resource);
|
|
27
|
-
if (!id) return null;
|
|
28
|
-
const primary = getPrimaryRepresentation(resource);
|
|
29
|
-
return {
|
|
30
|
-
id,
|
|
31
|
-
name: resource.name,
|
|
32
|
-
content: resource.content,
|
|
33
|
-
mediaType: primary?.mediaType,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
interface ResourceSearchModalProps {
|
|
38
|
-
isOpen: boolean;
|
|
39
|
-
onClose: () => void;
|
|
40
|
-
onSelect: (resourceId: string) => void;
|
|
41
|
-
searchTerm?: string;
|
|
42
|
-
translations?: {
|
|
43
|
-
title?: string;
|
|
44
|
-
placeholder?: string;
|
|
45
|
-
searching?: string;
|
|
46
|
-
noResults?: string;
|
|
47
|
-
close?: string;
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function ResourceSearchModal({
|
|
52
|
-
isOpen,
|
|
53
|
-
onClose,
|
|
54
|
-
onSelect,
|
|
55
|
-
searchTerm = '',
|
|
56
|
-
translations = {}
|
|
57
|
-
}: ResourceSearchModalProps) {
|
|
58
|
-
const { announceSearchResults, announceSearching, announceNavigation } = useSearchAnnouncements();
|
|
59
|
-
const semiont = useObservable(useSemiont().activeSession$)?.client;
|
|
60
|
-
// Pipeline factory captures `semiont` once via useState; if semiont is
|
|
61
|
-
// still loading at first render the captured value would be undefined.
|
|
62
|
-
// Route through a ref so the fetch closure reads the latest client.
|
|
63
|
-
const semiontRef = useRef(semiont);
|
|
64
|
-
semiontRef.current = semiont;
|
|
65
|
-
|
|
66
|
-
const t = {
|
|
67
|
-
title: translations.title || 'Search Resources',
|
|
68
|
-
placeholder: translations.placeholder || 'Search for resources...',
|
|
69
|
-
searching: translations.searching || 'Searching...',
|
|
70
|
-
noResults: translations.noResults || 'No documents found',
|
|
71
|
-
close: translations.close || '✕',
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
// ── Search pipeline ─────────────────────────────────────────────────────
|
|
75
|
-
const [pipeline] = useState(() =>
|
|
76
|
-
createSearchPipeline<SearchResult>(
|
|
77
|
-
(q) =>
|
|
78
|
-
semiontRef.current!.browse.resources({ search: q, limit: SEARCH_LIMIT }).pipe(
|
|
79
|
-
map((st) => {
|
|
80
|
-
const resources = readyValue(st);
|
|
81
|
-
if (resources === undefined) return undefined;
|
|
82
|
-
return resources
|
|
83
|
-
.map(toSearchResult)
|
|
84
|
-
.filter((r): r is SearchResult => r !== null);
|
|
85
|
-
}),
|
|
86
|
-
),
|
|
87
|
-
{ debounceMs: SEARCH_DEBOUNCE_MS, initialQuery: searchTerm },
|
|
88
|
-
),
|
|
89
|
-
);
|
|
90
|
-
useEffect(() => () => pipeline.dispose(), [pipeline]);
|
|
91
|
-
|
|
92
|
-
const search = useObservable(pipeline.query$) ?? '';
|
|
93
|
-
const searchState = useObservable(pipeline.state$);
|
|
94
|
-
const results = searchState?.results ?? [];
|
|
95
|
-
const loading = searchState?.isSearching ?? false;
|
|
96
|
-
|
|
97
|
-
// Re-seed when modal re-opens with a different searchTerm prop. The
|
|
98
|
-
// initialQuery option only applies to the first construction; subsequent
|
|
99
|
-
// prop changes need an explicit setQuery.
|
|
100
|
-
useEffect(() => {
|
|
101
|
-
if (isOpen && searchTerm) {
|
|
102
|
-
pipeline.setQuery(searchTerm);
|
|
103
|
-
}
|
|
104
|
-
}, [isOpen, searchTerm, pipeline]);
|
|
105
|
-
|
|
106
|
-
// Accessibility announcements for search lifecycle.
|
|
107
|
-
useEffect(() => {
|
|
108
|
-
if (!search.trim()) return;
|
|
109
|
-
if (loading) {
|
|
110
|
-
announceSearching();
|
|
111
|
-
} else {
|
|
112
|
-
announceSearchResults(results.length, search);
|
|
113
|
-
}
|
|
114
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
115
|
-
}, [loading, results.length]);
|
|
116
|
-
|
|
117
|
-
const handleSelect = (resourceId: string, resourceName: string) => {
|
|
118
|
-
announceNavigation(resourceName, 'resource');
|
|
119
|
-
onSelect(resourceId);
|
|
120
|
-
onClose();
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
return (
|
|
124
|
-
<Transition appear show={isOpen}>
|
|
125
|
-
<Dialog as="div" className="semiont-search-modal semiont-search-modal--resource" onClose={onClose}>
|
|
126
|
-
{/* Backdrop */}
|
|
127
|
-
<TransitionChild
|
|
128
|
-
enter="ease-out duration-200"
|
|
129
|
-
enterFrom="opacity-0"
|
|
130
|
-
enterTo="opacity-100"
|
|
131
|
-
leave="ease-in duration-150"
|
|
132
|
-
leaveFrom="opacity-100"
|
|
133
|
-
leaveTo="opacity-0"
|
|
134
|
-
>
|
|
135
|
-
<div className="semiont-search-modal__backdrop" />
|
|
136
|
-
</TransitionChild>
|
|
137
|
-
|
|
138
|
-
{/* Modal panel */}
|
|
139
|
-
<div className="semiont-search-modal__wrapper">
|
|
140
|
-
<div className="semiont-search-modal__centering semiont-search-modal__centering--center">
|
|
141
|
-
<TransitionChild
|
|
142
|
-
enter="ease-out duration-200"
|
|
143
|
-
enterFrom="opacity-0 scale-95"
|
|
144
|
-
enterTo="opacity-100 scale-100"
|
|
145
|
-
leave="ease-in duration-150"
|
|
146
|
-
leaveFrom="opacity-100 scale-100"
|
|
147
|
-
leaveTo="opacity-0 scale-95"
|
|
148
|
-
>
|
|
149
|
-
<DialogPanel className="semiont-search-modal__panel semiont-search-modal__panel--with-border">
|
|
150
|
-
<div className="semiont-search-modal__header">
|
|
151
|
-
<DialogTitle className="semiont-search-modal__title">
|
|
152
|
-
{t.title}
|
|
153
|
-
</DialogTitle>
|
|
154
|
-
<button
|
|
155
|
-
onClick={onClose}
|
|
156
|
-
className="semiont-search-modal__close-button"
|
|
157
|
-
aria-label={t.close}
|
|
158
|
-
>
|
|
159
|
-
{t.close}
|
|
160
|
-
</button>
|
|
161
|
-
</div>
|
|
162
|
-
|
|
163
|
-
<div className="semiont-search-modal__search-form">
|
|
164
|
-
<input
|
|
165
|
-
type="text"
|
|
166
|
-
value={search}
|
|
167
|
-
onChange={(e) => pipeline.setQuery(e.target.value)}
|
|
168
|
-
placeholder={t.placeholder}
|
|
169
|
-
className="semiont-search-modal__search-input"
|
|
170
|
-
autoFocus
|
|
171
|
-
/>
|
|
172
|
-
</div>
|
|
173
|
-
|
|
174
|
-
<div className="semiont-search-modal__results">
|
|
175
|
-
{loading && (
|
|
176
|
-
<div className="semiont-search-modal__empty">
|
|
177
|
-
{t.searching}
|
|
178
|
-
</div>
|
|
179
|
-
)}
|
|
180
|
-
|
|
181
|
-
{!loading && results.length === 0 && search && (
|
|
182
|
-
<div className="semiont-search-modal__empty">
|
|
183
|
-
{t.noResults}
|
|
184
|
-
</div>
|
|
185
|
-
)}
|
|
186
|
-
|
|
187
|
-
{!loading && results.length > 0 && (
|
|
188
|
-
<div className="semiont-search-modal__resource-list">
|
|
189
|
-
{results.map((resource) => {
|
|
190
|
-
const isImage = resource.mediaType?.startsWith('image/');
|
|
191
|
-
|
|
192
|
-
return (
|
|
193
|
-
<div
|
|
194
|
-
key={resource.id}
|
|
195
|
-
className="semiont-search-modal__resource-item"
|
|
196
|
-
onClick={() => handleSelect(resource.id, resource.name)}
|
|
197
|
-
>
|
|
198
|
-
<h4 className="semiont-search-modal__resource-name">
|
|
199
|
-
{resource.name}
|
|
200
|
-
</h4>
|
|
201
|
-
{resource.content && !isImage && (
|
|
202
|
-
<p className="semiont-search-modal__resource-description">
|
|
203
|
-
{resource.content.substring(0, 150)}...
|
|
204
|
-
</p>
|
|
205
|
-
)}
|
|
206
|
-
{isImage && (
|
|
207
|
-
<p className="semiont-search-modal__resource-media-type">
|
|
208
|
-
{resource.mediaType}
|
|
209
|
-
</p>
|
|
210
|
-
)}
|
|
211
|
-
</div>
|
|
212
|
-
);
|
|
213
|
-
})}
|
|
214
|
-
</div>
|
|
215
|
-
)}
|
|
216
|
-
</div>
|
|
217
|
-
</DialogPanel>
|
|
218
|
-
</TransitionChild>
|
|
219
|
-
</div>
|
|
220
|
-
</div>
|
|
221
|
-
</Dialog>
|
|
222
|
-
</Transition>
|
|
223
|
-
);
|
|
224
|
-
}
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
2
|
-
import { asStates } from '../../../__tests__/test-client';
|
|
3
|
-
import { screen, fireEvent, waitFor } from '@testing-library/react';
|
|
4
|
-
import { BehaviorSubject } from 'rxjs';
|
|
5
|
-
import { renderWithProviders } from '../../../test-utils';
|
|
6
|
-
import '@testing-library/jest-dom';
|
|
7
|
-
import { ResourceSearchModal } from '../ResourceSearchModal';
|
|
8
|
-
|
|
9
|
-
// Mock HeadlessUI to avoid jsdom OOM issues
|
|
10
|
-
vi.mock('@headlessui/react', () => ({
|
|
11
|
-
Dialog: ({ children, onClose, ...props }: any) => <div role="dialog" {...props}>{typeof children === 'function' ? children({ open: true }) : children}</div>,
|
|
12
|
-
DialogPanel: ({ children, ...props }: any) => <div {...props}>{children}</div>,
|
|
13
|
-
DialogTitle: ({ children, ...props }: any) => <h2 {...props}>{children}</h2>,
|
|
14
|
-
Transition: ({ show, children }: any) => show ? <>{children}</> : null,
|
|
15
|
-
TransitionChild: ({ children }: any) => <>{children}</>,
|
|
16
|
-
}));
|
|
17
|
-
|
|
18
|
-
// Mock the http-transport Observable surface.
|
|
19
|
-
// The session-based useSemiont path: useObservable(useSemiont().activeSession$)?.client
|
|
20
|
-
// We mock useSemiont to return a stable browser whose activeSession$ emits a
|
|
21
|
-
// session-shaped object that carries the mock client.
|
|
22
|
-
const browseResourcesSubject = new BehaviorSubject<any[] | undefined>(undefined);
|
|
23
|
-
const browseResourcesMock = vi.fn(() => asStates(browseResourcesSubject.asObservable()));
|
|
24
|
-
const stableMockClient = { browse: { resources: browseResourcesMock } };
|
|
25
|
-
const stableMockSession = { client: stableMockClient };
|
|
26
|
-
const stableActiveSession$ = new BehaviorSubject<any>(stableMockSession);
|
|
27
|
-
const stableMockBrowser = { activeSession$: stableActiveSession$ };
|
|
28
|
-
|
|
29
|
-
vi.mock('../../../session/SemiontProvider', async () => {
|
|
30
|
-
const actual = await vi.importActual<typeof import('../../../session/SemiontProvider')>(
|
|
31
|
-
'../../../session/SemiontProvider'
|
|
32
|
-
);
|
|
33
|
-
return {
|
|
34
|
-
...actual,
|
|
35
|
-
useSemiont: () => stableMockBrowser,
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
// Mock search announcements
|
|
40
|
-
vi.mock('../../../hooks/useSearchAnnouncements', () => ({
|
|
41
|
-
useSearchAnnouncements: vi.fn(() => ({
|
|
42
|
-
announceSearchResults: vi.fn(),
|
|
43
|
-
announceSearching: vi.fn(),
|
|
44
|
-
announceNavigation: vi.fn(),
|
|
45
|
-
})),
|
|
46
|
-
}));
|
|
47
|
-
|
|
48
|
-
function setBrowseResults(resources: any[] | undefined) {
|
|
49
|
-
browseResourcesSubject.next(resources);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
describe('ResourceSearchModal', () => {
|
|
53
|
-
const defaultProps = {
|
|
54
|
-
isOpen: true,
|
|
55
|
-
onClose: vi.fn(),
|
|
56
|
-
onSelect: vi.fn(),
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
beforeEach(() => {
|
|
60
|
-
vi.clearAllMocks();
|
|
61
|
-
browseResourcesSubject.next(undefined);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
const buildResource = (id: string, name: string, mediaType = 'text/plain', content?: string) => ({
|
|
65
|
-
'@context': 'https://www.w3.org/ns/anno.jsonld',
|
|
66
|
-
'@id': id,
|
|
67
|
-
name,
|
|
68
|
-
content,
|
|
69
|
-
representations: [{ mediaType, isPrimary: true }],
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('renders modal with title when open', () => {
|
|
73
|
-
renderWithProviders(<ResourceSearchModal {...defaultProps} />);
|
|
74
|
-
expect(screen.getByText('Search Resources')).toBeInTheDocument();
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('does not render when closed', () => {
|
|
78
|
-
renderWithProviders(
|
|
79
|
-
<ResourceSearchModal {...defaultProps} isOpen={false} />
|
|
80
|
-
);
|
|
81
|
-
expect(screen.queryByText('Search Resources')).not.toBeInTheDocument();
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('renders search input with placeholder', () => {
|
|
85
|
-
renderWithProviders(<ResourceSearchModal {...defaultProps} />);
|
|
86
|
-
expect(screen.getByPlaceholderText('Search for resources...')).toBeInTheDocument();
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('uses custom translations', () => {
|
|
90
|
-
renderWithProviders(
|
|
91
|
-
<ResourceSearchModal
|
|
92
|
-
{...defaultProps}
|
|
93
|
-
translations={{ title: 'Find Docs', placeholder: 'Type here...' }}
|
|
94
|
-
/>
|
|
95
|
-
);
|
|
96
|
-
expect(screen.getByText('Find Docs')).toBeInTheDocument();
|
|
97
|
-
expect(screen.getByPlaceholderText('Type here...')).toBeInTheDocument();
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it('shows loading state while the Observable has not emitted', async () => {
|
|
101
|
-
renderWithProviders(<ResourceSearchModal {...defaultProps} searchTerm="something" />);
|
|
102
|
-
await waitFor(() => expect(screen.getByText('Searching...')).toBeInTheDocument(), { timeout: 1000 });
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it('shows no results message when search returns an empty array', async () => {
|
|
106
|
-
renderWithProviders(<ResourceSearchModal {...defaultProps} searchTerm="xyz" />);
|
|
107
|
-
setBrowseResults([]);
|
|
108
|
-
await waitFor(() => expect(screen.getByText('No documents found')).toBeInTheDocument(), { timeout: 1000 });
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it('renders search results', async () => {
|
|
112
|
-
renderWithProviders(<ResourceSearchModal {...defaultProps} searchTerm="test" />);
|
|
113
|
-
setBrowseResults([buildResource('res-1', 'Test Document', 'text/plain', 'Some content here')]);
|
|
114
|
-
await waitFor(() => expect(screen.getByText('Test Document')).toBeInTheDocument(), { timeout: 1000 });
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('calls onSelect and onClose when a result is clicked', async () => {
|
|
118
|
-
const onSelect = vi.fn();
|
|
119
|
-
const onClose = vi.fn();
|
|
120
|
-
|
|
121
|
-
renderWithProviders(
|
|
122
|
-
<ResourceSearchModal
|
|
123
|
-
{...defaultProps}
|
|
124
|
-
searchTerm="test"
|
|
125
|
-
onSelect={onSelect}
|
|
126
|
-
onClose={onClose}
|
|
127
|
-
/>
|
|
128
|
-
);
|
|
129
|
-
setBrowseResults([buildResource('res-1', 'Test Document', 'text/plain', 'Some content')]);
|
|
130
|
-
await waitFor(() => expect(screen.getByText('Test Document')).toBeInTheDocument(), { timeout: 1000 });
|
|
131
|
-
|
|
132
|
-
fireEvent.click(screen.getByText('Test Document'));
|
|
133
|
-
expect(onSelect).toHaveBeenCalledWith('res-1');
|
|
134
|
-
expect(onClose).toHaveBeenCalled();
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it('shows media type for image results', async () => {
|
|
138
|
-
renderWithProviders(<ResourceSearchModal {...defaultProps} searchTerm="photo" />);
|
|
139
|
-
setBrowseResults([buildResource('res-img', 'Photo', 'image/png')]);
|
|
140
|
-
await waitFor(() => expect(screen.getByText('image/png')).toBeInTheDocument(), { timeout: 1000 });
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
it('calls onClose when close button is clicked', () => {
|
|
144
|
-
const onClose = vi.fn();
|
|
145
|
-
renderWithProviders(
|
|
146
|
-
<ResourceSearchModal {...defaultProps} onClose={onClose} />
|
|
147
|
-
);
|
|
148
|
-
fireEvent.click(screen.getByLabelText('✕'));
|
|
149
|
-
expect(onClose).toHaveBeenCalled();
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it('passes the search term through to browse.resources', async () => {
|
|
153
|
-
renderWithProviders(<ResourceSearchModal {...defaultProps} searchTerm="hello" />);
|
|
154
|
-
await waitFor(
|
|
155
|
-
() => expect(browseResourcesMock).toHaveBeenCalledWith({ search: 'hello', limit: 50 }),
|
|
156
|
-
{ timeout: 1000 }
|
|
157
|
-
);
|
|
158
|
-
});
|
|
159
|
-
});
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tailwind CSS Plugin for Semiont Components
|
|
3
|
-
*
|
|
4
|
-
* This plugin provides utilities for styling Semiont components
|
|
5
|
-
* using Tailwind CSS classes while respecting the data-attribute architecture.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
const plugin = require('tailwindcss/plugin');
|
|
9
|
-
const { tokens } = require('../design-tokens');
|
|
10
|
-
|
|
11
|
-
module.exports = plugin(function({ addBase, addComponents, addUtilities, theme }) {
|
|
12
|
-
// Add base styles for CSS variables
|
|
13
|
-
addBase({
|
|
14
|
-
':root': Object.entries(tokens.colors.primary).reduce((acc, [key, value]) => ({
|
|
15
|
-
...acc,
|
|
16
|
-
[`--semiont-color-primary-${key}`]: value
|
|
17
|
-
}), {}),
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
// Add component styles
|
|
21
|
-
addComponents({
|
|
22
|
-
// Button component styles
|
|
23
|
-
'.semiont-button': {
|
|
24
|
-
'@apply relative inline-flex items-center justify-center': {},
|
|
25
|
-
'@apply font-medium transition-all duration-200': {},
|
|
26
|
-
'@apply focus:outline-hidden focus:ring-2 focus:ring-offset-2': {},
|
|
27
|
-
'@apply disabled:opacity-50 disabled:cursor-not-allowed': {},
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
// Button variants
|
|
31
|
-
'.semiont-button[data-variant="primary"]': {
|
|
32
|
-
'@apply bg-blue-500 text-white hover:bg-blue-600 active:bg-blue-700': {},
|
|
33
|
-
'@apply focus:ring-blue-500': {},
|
|
34
|
-
},
|
|
35
|
-
'.semiont-button[data-variant="secondary"]': {
|
|
36
|
-
'@apply bg-gray-100 text-gray-900 hover:bg-gray-200 active:bg-gray-300': {},
|
|
37
|
-
'@apply focus:ring-gray-500': {},
|
|
38
|
-
},
|
|
39
|
-
'.semiont-button[data-variant="tertiary"]': {
|
|
40
|
-
'@apply bg-transparent text-blue-600 ring-1 ring-inset ring-blue-200': {},
|
|
41
|
-
'@apply hover:bg-blue-50 hover:ring-blue-300 active:bg-blue-100': {},
|
|
42
|
-
'@apply focus:ring-blue-500': {},
|
|
43
|
-
},
|
|
44
|
-
'.semiont-button[data-variant="danger"]': {
|
|
45
|
-
'@apply bg-red-500 text-white hover:bg-red-600 active:bg-red-700': {},
|
|
46
|
-
'@apply focus:ring-red-500': {},
|
|
47
|
-
},
|
|
48
|
-
'.semiont-button[data-variant="warning"]': {
|
|
49
|
-
'@apply bg-amber-500 text-gray-900 hover:bg-amber-600 active:bg-amber-700': {},
|
|
50
|
-
'@apply focus:ring-amber-500': {},
|
|
51
|
-
},
|
|
52
|
-
'.semiont-button[data-variant="ghost"]': {
|
|
53
|
-
'@apply bg-transparent text-gray-700 hover:bg-gray-100 active:bg-gray-200': {},
|
|
54
|
-
'@apply focus:ring-gray-500': {},
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
// Button sizes
|
|
58
|
-
'.semiont-button[data-size="xs"]': {
|
|
59
|
-
'@apply px-2 py-1 text-xs rounded-sm min-h-[1.75rem]': {},
|
|
60
|
-
},
|
|
61
|
-
'.semiont-button[data-size="sm"]': {
|
|
62
|
-
'@apply px-3 py-1.5 text-sm rounded-sm min-h-[2rem]': {},
|
|
63
|
-
},
|
|
64
|
-
'.semiont-button[data-size="md"]': {
|
|
65
|
-
'@apply px-4 py-2 text-base rounded-md min-h-[2.5rem]': {},
|
|
66
|
-
},
|
|
67
|
-
'.semiont-button[data-size="lg"]': {
|
|
68
|
-
'@apply px-6 py-2.5 text-lg rounded-md min-h-[3rem]': {},
|
|
69
|
-
},
|
|
70
|
-
'.semiont-button[data-size="xl"]': {
|
|
71
|
-
'@apply px-8 py-3 text-xl rounded-lg min-h-[3.5rem]': {},
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
// Icon-only buttons
|
|
75
|
-
'.semiont-button[data-icon-only="true"][data-size="xs"]': {
|
|
76
|
-
'@apply p-1 w-7 h-7': {},
|
|
77
|
-
},
|
|
78
|
-
'.semiont-button[data-icon-only="true"][data-size="sm"]': {
|
|
79
|
-
'@apply p-1.5 w-8 h-8': {},
|
|
80
|
-
},
|
|
81
|
-
'.semiont-button[data-icon-only="true"][data-size="md"]': {
|
|
82
|
-
'@apply p-2 w-10 h-10': {},
|
|
83
|
-
},
|
|
84
|
-
'.semiont-button[data-icon-only="true"][data-size="lg"]': {
|
|
85
|
-
'@apply p-2.5 w-12 h-12': {},
|
|
86
|
-
},
|
|
87
|
-
'.semiont-button[data-icon-only="true"][data-size="xl"]': {
|
|
88
|
-
'@apply p-3 w-14 h-14': {},
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
// Full width
|
|
92
|
-
'.semiont-button[data-full-width="true"]': {
|
|
93
|
-
'@apply w-full': {},
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
// Loading state
|
|
97
|
-
'.semiont-button[data-loading="true"]': {
|
|
98
|
-
'@apply pointer-events-none': {},
|
|
99
|
-
},
|
|
100
|
-
'.semiont-button[data-loading="true"] .semiont-button-content': {
|
|
101
|
-
'@apply invisible': {},
|
|
102
|
-
},
|
|
103
|
-
'.semiont-button[data-loading="true"] .semiont-button-icon': {
|
|
104
|
-
'@apply invisible': {},
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
// Button spinner
|
|
108
|
-
'.semiont-button-spinner': {
|
|
109
|
-
'@apply absolute inset-0 flex items-center justify-center': {},
|
|
110
|
-
},
|
|
111
|
-
'.semiont-spinner-svg': {
|
|
112
|
-
'@apply animate-spin w-5 h-5': {},
|
|
113
|
-
},
|
|
114
|
-
|
|
115
|
-
// Button content and icons
|
|
116
|
-
'.semiont-button-content': {
|
|
117
|
-
'@apply inline-flex items-center': {},
|
|
118
|
-
},
|
|
119
|
-
'.semiont-button-icon': {
|
|
120
|
-
'@apply inline-flex items-center justify-center flex-shrink-0': {},
|
|
121
|
-
},
|
|
122
|
-
'.semiont-button-icon-left': {
|
|
123
|
-
'@apply mr-2': {},
|
|
124
|
-
},
|
|
125
|
-
'.semiont-button-icon-right': {
|
|
126
|
-
'@apply ml-2': {},
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
// Button group
|
|
130
|
-
'.semiont-button-group': {
|
|
131
|
-
'@apply flex': {},
|
|
132
|
-
},
|
|
133
|
-
'.semiont-button-group[data-orientation="horizontal"]': {
|
|
134
|
-
'@apply flex-row': {},
|
|
135
|
-
},
|
|
136
|
-
'.semiont-button-group[data-orientation="vertical"]': {
|
|
137
|
-
'@apply flex-col': {},
|
|
138
|
-
},
|
|
139
|
-
|
|
140
|
-
// Button group spacing
|
|
141
|
-
'.semiont-button-group[data-spacing="xs"]': {
|
|
142
|
-
'@apply gap-1': {},
|
|
143
|
-
},
|
|
144
|
-
'.semiont-button-group[data-spacing="sm"]': {
|
|
145
|
-
'@apply gap-2': {},
|
|
146
|
-
},
|
|
147
|
-
'.semiont-button-group[data-spacing="md"]': {
|
|
148
|
-
'@apply gap-4': {},
|
|
149
|
-
},
|
|
150
|
-
'.semiont-button-group[data-spacing="lg"]': {
|
|
151
|
-
'@apply gap-6': {},
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
// Attached button groups
|
|
155
|
-
'.semiont-button-group[data-attached="true"]': {
|
|
156
|
-
'@apply gap-0': {},
|
|
157
|
-
},
|
|
158
|
-
'.semiont-button-group[data-attached="true"][data-orientation="horizontal"] .semiont-button:not(:first-child)': {
|
|
159
|
-
'@apply rounded-l-none -ml-px': {},
|
|
160
|
-
},
|
|
161
|
-
'.semiont-button-group[data-attached="true"][data-orientation="horizontal"] .semiont-button:not(:last-child)': {
|
|
162
|
-
'@apply rounded-r-none': {},
|
|
163
|
-
},
|
|
164
|
-
'.semiont-button-group[data-attached="true"][data-orientation="vertical"] .semiont-button:not(:first-child)': {
|
|
165
|
-
'@apply rounded-t-none -mt-px': {},
|
|
166
|
-
},
|
|
167
|
-
'.semiont-button-group[data-attached="true"][data-orientation="vertical"] .semiont-button:not(:last-child)': {
|
|
168
|
-
'@apply rounded-b-none': {},
|
|
169
|
-
},
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
// Add utility classes for custom data attributes
|
|
173
|
-
addUtilities({
|
|
174
|
-
'.semiont-variant-primary': {
|
|
175
|
-
'&[data-variant="primary"]': {
|
|
176
|
-
'@apply bg-blue-500 text-white': {},
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
'.semiont-variant-secondary': {
|
|
180
|
-
'&[data-variant="secondary"]': {
|
|
181
|
-
'@apply bg-gray-100 text-gray-900': {},
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
'.semiont-size-sm': {
|
|
185
|
-
'&[data-size="sm"]': {
|
|
186
|
-
'@apply px-3 py-1.5 text-sm': {},
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
'.semiont-size-md': {
|
|
190
|
-
'&[data-size="md"]': {
|
|
191
|
-
'@apply px-4 py-2 text-base': {},
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
'.semiont-size-lg': {
|
|
195
|
-
'&[data-size="lg"]': {
|
|
196
|
-
'@apply px-6 py-2.5 text-lg': {},
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
});
|
|
200
|
-
}, {
|
|
201
|
-
// Plugin configuration
|
|
202
|
-
theme: {
|
|
203
|
-
extend: {
|
|
204
|
-
colors: {
|
|
205
|
-
semiont: {
|
|
206
|
-
primary: tokens.colors.primary,
|
|
207
|
-
secondary: tokens.colors.secondary,
|
|
208
|
-
semantic: tokens.colors.semantic,
|
|
209
|
-
neutral: tokens.colors.neutral,
|
|
210
|
-
},
|
|
211
|
-
},
|
|
212
|
-
spacing: tokens.spacing,
|
|
213
|
-
fontSize: tokens.typography.fontSize,
|
|
214
|
-
borderRadius: tokens.borderRadius,
|
|
215
|
-
transitionDuration: tokens.transitions.duration,
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
// Export for CommonJS
|
|
221
|
-
module.exports.semiontPlugin = module.exports;
|
|
222
|
-
|
|
223
|
-
// Export for ESM
|
|
224
|
-
module.exports.default = module.exports;
|