@communitiesuk/svelte-component-library 0.1.17
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 +188 -0
- package/dist/assets/css/govuk-frontend.min.css +2 -0
- package/dist/assets/css/govuk-frontend.min.css.map +1 -0
- package/dist/assets/fonts/bold-affa96571d-v2.woff +0 -0
- package/dist/assets/fonts/bold-b542beb274-v2.woff2 +0 -0
- package/dist/assets/fonts/light-94a07e06a1-v2.woff2 +0 -0
- package/dist/assets/fonts/light-f591b13f7d-v2.woff +0 -0
- package/dist/assets/govuk_publishing_components/images/icon-autocomplete-search-suggestion.svg +4 -0
- package/dist/assets/govuk_publishing_components/images/icon-close.svg +1 -0
- package/dist/assets/images/favicon.ico +0 -0
- package/dist/assets/images/favicon.svg +1 -0
- package/dist/assets/images/govuk-crest-2x.png +0 -0
- package/dist/assets/images/govuk-crest.png +0 -0
- package/dist/assets/images/govuk-crest.svg +1 -0
- package/dist/assets/images/govuk-icon-180.png +0 -0
- package/dist/assets/images/govuk-icon-192.png +0 -0
- package/dist/assets/images/govuk-icon-512.png +0 -0
- package/dist/assets/images/govuk-icon-mask.svg +1 -0
- package/dist/assets/images/govuk-opengraph-image.png +0 -0
- package/dist/assets/images/homepage-illustration.svg +1 -0
- package/dist/assets/images/homepage.svg +44 -0
- package/dist/assets/images/masthead-illustration.svg +123 -0
- package/dist/assets/images/oflog_crest_black.png +0 -0
- package/dist/assets/images/oflog_crest_white.png +0 -0
- package/dist/assets/images/undraw_approved-wireframe_odf4.svg +1 -0
- package/dist/assets/images/undraw_collaborators_rgw4.svg +1 -0
- package/dist/assets/images/undraw_content-creator_vuqg.svg +1 -0
- package/dist/assets/images/undraw_online-media_opxh.svg +1 -0
- package/dist/assets/images/undraw_pull-request_zlsu.svg +1 -0
- package/dist/assets/images/undraw_reviewed-docs_g0cg.svg +1 -0
- package/dist/components/FilterPanel/codeBlocks.d.ts +3 -0
- package/dist/components/FilterPanel/codeBlocks.js +418 -0
- package/dist/components/content/InsetText.svelte +21 -0
- package/dist/components/content/InsetText.svelte.d.ts +7 -0
- package/dist/components/content/WarningText.svelte +27 -0
- package/dist/components/content/WarningText.svelte.d.ts +8 -0
- package/dist/components/data-vis/axis/Axis.svelte +51 -0
- package/dist/components/data-vis/axis/Axis.svelte.d.ts +33 -0
- package/dist/components/data-vis/axis/Ticks.svelte +113 -0
- package/dist/components/data-vis/axis/Ticks.svelte.d.ts +33 -0
- package/dist/components/data-vis/line-chart/Line.svelte +150 -0
- package/dist/components/data-vis/line-chart/Line.svelte.d.ts +85 -0
- package/dist/components/data-vis/line-chart/LineChart.svelte +249 -0
- package/dist/components/data-vis/line-chart/LineChart.svelte.d.ts +73 -0
- package/dist/components/data-vis/line-chart/Lines.svelte +138 -0
- package/dist/components/data-vis/line-chart/Lines.svelte.d.ts +57 -0
- package/dist/components/data-vis/line-chart/Marker.svelte +61 -0
- package/dist/components/data-vis/line-chart/Marker.svelte.d.ts +37 -0
- package/dist/components/data-vis/line-chart/SeriesLabel.svelte +67 -0
- package/dist/components/data-vis/line-chart/SeriesLabel.svelte.d.ts +43 -0
- package/dist/components/data-vis/line-chart/ValueLabel.svelte +50 -0
- package/dist/components/data-vis/line-chart/ValueLabel.svelte.d.ts +25 -0
- package/dist/components/data-vis/map/Map.svelte +392 -0
- package/dist/components/data-vis/map/Map.svelte.d.ts +47 -0
- package/dist/components/data-vis/map/MapLegend.svelte +41 -0
- package/dist/components/data-vis/map/MapLegend.svelte.d.ts +15 -0
- package/dist/components/data-vis/map/NonStandardControls.svelte +42 -0
- package/dist/components/data-vis/map/NonStandardControls.svelte.d.ts +13 -0
- package/dist/components/data-vis/map/Tooltip.svelte +41 -0
- package/dist/components/data-vis/map/Tooltip.svelte.d.ts +19 -0
- package/dist/components/data-vis/map/colorbrewer.d.ts +337 -0
- package/dist/components/data-vis/map/colorbrewer.js +1523 -0
- package/dist/components/data-vis/map/colors.d.ts +13 -0
- package/dist/components/data-vis/map/colors.js +65 -0
- package/dist/components/data-vis/map/dataJoin.d.ts +2 -0
- package/dist/components/data-vis/map/dataJoin.js +27 -0
- package/dist/components/data-vis/map/fullTopo.json +1 -0
- package/dist/components/data-vis/map/jenks.d.ts +1 -0
- package/dist/components/data-vis/map/jenks.js +51 -0
- package/dist/components/data-vis/map/lad2023.json +1 -0
- package/dist/components/data-vis/map/mapUtils.d.ts +5 -0
- package/dist/components/data-vis/map/mapUtils.js +86 -0
- package/dist/components/data-vis/map/topo.json +1 -0
- package/dist/components/data-vis/table/Table.svelte +247 -0
- package/dist/components/data-vis/table/Table.svelte.d.ts +19 -0
- package/dist/components/layout/Breadcrumbs.svelte +191 -0
- package/dist/components/layout/Breadcrumbs.svelte.d.ts +24 -0
- package/dist/components/layout/Footer.svelte +171 -0
- package/dist/components/layout/Footer.svelte.d.ts +30 -0
- package/dist/components/layout/Header.svelte +43 -0
- package/dist/components/layout/Header.svelte.d.ts +7 -0
- package/dist/components/layout/InternalHeader.svelte +628 -0
- package/dist/components/layout/InternalHeader.svelte.d.ts +15 -0
- package/dist/components/layout/PhaseBanner.svelte +28 -0
- package/dist/components/layout/PhaseBanner.svelte.d.ts +9 -0
- package/dist/components/layout/ServiceNavigation.svelte +143 -0
- package/dist/components/layout/ServiceNavigation.svelte.d.ts +13 -0
- package/dist/components/layout/SideNavigation.svelte +345 -0
- package/dist/components/layout/SideNavigation.svelte.d.ts +25 -0
- package/dist/components/layout/service-navigation-nested-mobile/HeaderNav.svelte +91 -0
- package/dist/components/layout/service-navigation-nested-mobile/HeaderNav.svelte.d.ts +15 -0
- package/dist/components/layout/service-navigation-nested-mobile/MobileNav.svelte +233 -0
- package/dist/components/layout/service-navigation-nested-mobile/MobileNav.svelte.d.ts +27 -0
- package/dist/components/layout/service-navigation-nested-mobile/ServiceNavigationNestedMobile.svelte +70 -0
- package/dist/components/layout/service-navigation-nested-mobile/ServiceNavigationNestedMobile.svelte.d.ts +11 -0
- package/dist/components/layout/service-navigation-nested-mobile/SideNav.svelte +276 -0
- package/dist/components/layout/service-navigation-nested-mobile/SideNav.svelte.d.ts +22 -0
- package/dist/components/ui/Accordion.svelte +244 -0
- package/dist/components/ui/Accordion.svelte.d.ts +23 -0
- package/dist/components/ui/Breadcrumbs.svelte +198 -0
- package/dist/components/ui/Breadcrumbs.svelte.d.ts +24 -0
- package/dist/components/ui/Button.svelte +96 -0
- package/dist/components/ui/Button.svelte.d.ts +17 -0
- package/dist/components/ui/CheckBox.svelte +198 -0
- package/dist/components/ui/CheckBox.svelte.d.ts +27 -0
- package/dist/components/ui/ContentsList.svelte +1117 -0
- package/dist/components/ui/ContentsList.svelte.d.ts +25 -0
- package/dist/components/ui/DateInput.svelte +255 -0
- package/dist/components/ui/DateInput.svelte.d.ts +59 -0
- package/dist/components/ui/Details.svelte +12 -0
- package/dist/components/ui/Details.svelte.d.ts +13 -0
- package/dist/components/ui/FilterPanel.svelte +588 -0
- package/dist/components/ui/FilterPanel.svelte.d.ts +74 -0
- package/dist/components/ui/Footer.svelte +171 -0
- package/dist/components/ui/Footer.svelte.d.ts +30 -0
- package/dist/components/ui/Header.svelte +43 -0
- package/dist/components/ui/Header.svelte.d.ts +7 -0
- package/dist/components/ui/Masthead.svelte +267 -0
- package/dist/components/ui/Masthead.svelte.d.ts +12 -0
- package/dist/components/ui/NavigationExample.svelte +117 -0
- package/dist/components/ui/NavigationExample.svelte.d.ts +3 -0
- package/dist/components/ui/NotificationBanner.svelte +93 -0
- package/dist/components/ui/NotificationBanner.svelte.d.ts +15 -0
- package/dist/components/ui/Radios.svelte +176 -0
- package/dist/components/ui/Radios.svelte.d.ts +28 -0
- package/dist/components/ui/RelatedContent.svelte +596 -0
- package/dist/components/ui/RelatedContent.svelte.d.ts +29 -0
- package/dist/components/ui/Search.svelte +499 -0
- package/dist/components/ui/Search.svelte.d.ts +32 -0
- package/dist/components/ui/SearchAutocomplete.svelte +655 -0
- package/dist/components/ui/SearchAutocomplete.svelte.d.ts +37 -0
- package/dist/components/ui/Select.svelte +116 -0
- package/dist/components/ui/Select.svelte.d.ts +22 -0
- package/dist/components/ui/ServiceNavigation.svelte +143 -0
- package/dist/components/ui/ServiceNavigation.svelte.d.ts +13 -0
- package/dist/components/ui/SideNavigation.svelte +346 -0
- package/dist/components/ui/SideNavigation.svelte.d.ts +25 -0
- package/dist/components/ui/Tabs.svelte +306 -0
- package/dist/components/ui/Tabs.svelte.d.ts +18 -0
- package/dist/components/ui/WhatsNew.svelte +155 -0
- package/dist/components/ui/WhatsNew.svelte.d.ts +29 -0
- package/dist/config.d.ts +51 -0
- package/dist/config.js +44 -0
- package/dist/icons/DoubleChevronButton.svelte +62 -0
- package/dist/icons/DoubleChevronButton.svelte.d.ts +13 -0
- package/dist/icons/IconSearch.svelte +42 -0
- package/dist/icons/IconSearch.svelte.d.ts +6 -0
- package/dist/icons/SingleChevronButtonWithLabel.svelte +132 -0
- package/dist/icons/SingleChevronButtonWithLabel.svelte.d.ts +19 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +45 -0
- package/dist/main.css +1 -0
- package/dist/package-wrapping/BaseInformation.svelte +82 -0
- package/dist/package-wrapping/BaseInformation.svelte.d.ts +15 -0
- package/dist/package-wrapping/BaseNameAndStatus.svelte +108 -0
- package/dist/package-wrapping/BaseNameAndStatus.svelte.d.ts +10 -0
- package/dist/package-wrapping/CodeBlock.svelte +62 -0
- package/dist/package-wrapping/CodeBlock.svelte.d.ts +12 -0
- package/dist/package-wrapping/ComponentDemo.svelte +114 -0
- package/dist/package-wrapping/ComponentDemo.svelte.d.ts +25 -0
- package/dist/package-wrapping/ComponentDemoTEMP.svelte +305 -0
- package/dist/package-wrapping/ComponentDemoTEMP.svelte.d.ts +21 -0
- package/dist/package-wrapping/ComponentDetails.svelte +123 -0
- package/dist/package-wrapping/ComponentDetails.svelte.d.ts +13 -0
- package/dist/package-wrapping/DividerLine.svelte +21 -0
- package/dist/package-wrapping/DividerLine.svelte.d.ts +17 -0
- package/dist/package-wrapping/InputForParameter.svelte +205 -0
- package/dist/package-wrapping/InputForParameter.svelte.d.ts +13 -0
- package/dist/package-wrapping/InputForParameterUpdated.svelte +222 -0
- package/dist/package-wrapping/InputForParameterUpdated.svelte.d.ts +17 -0
- package/dist/package-wrapping/InputForParameterUpdatedTEMP.svelte +203 -0
- package/dist/package-wrapping/InputForParameterUpdatedTEMP.svelte.d.ts +17 -0
- package/dist/package-wrapping/ListOfComponentStatuses.svelte +19 -0
- package/dist/package-wrapping/ListOfComponentStatuses.svelte.d.ts +11 -0
- package/dist/package-wrapping/OverlayAndComponentContainer.svelte +426 -0
- package/dist/package-wrapping/OverlayAndComponentContainer.svelte.d.ts +33 -0
- package/dist/package-wrapping/ParametersSection.svelte +235 -0
- package/dist/package-wrapping/ParametersSection.svelte.d.ts +19 -0
- package/dist/package-wrapping/ParsingErrorToastsContainer.svelte +50 -0
- package/dist/package-wrapping/ParsingErrorToastsContainer.svelte.d.ts +15 -0
- package/dist/package-wrapping/Pill.svelte +54 -0
- package/dist/package-wrapping/Pill.svelte.d.ts +25 -0
- package/dist/package-wrapping/PlaygroundDetails.svelte +106 -0
- package/dist/package-wrapping/PlaygroundDetails.svelte.d.ts +13 -0
- package/dist/package-wrapping/ScreenSizeRadio.svelte +24 -0
- package/dist/package-wrapping/ScreenSizeRadio.svelte.d.ts +11 -0
- package/dist/package-wrapping/ScreenSizeRadioUpdated.svelte +23 -0
- package/dist/package-wrapping/ScreenSizeRadioUpdated.svelte.d.ts +11 -0
- package/dist/package-wrapping/SidebarContainer.svelte +103 -0
- package/dist/package-wrapping/SidebarContainer.svelte.d.ts +23 -0
- package/dist/package-wrapping/WrapperDetailsUpdate.svelte +40 -0
- package/dist/package-wrapping/WrapperDetailsUpdate.svelte.d.ts +15 -0
- package/dist/package-wrapping/templates/Template.svelte +100 -0
- package/dist/package-wrapping/templates/Template.svelte.d.ts +25 -0
- package/dist/templates/ComponentPageTemplate.svelte +1 -0
- package/dist/templates/ComponentPageTemplate.svelte.d.ts +26 -0
- package/dist/utils/data-transformations/convertCSV.d.ts +2 -0
- package/dist/utils/data-transformations/convertCSV.js +22 -0
- package/dist/utils/data-transformations/getValueFromParametersArray.d.ts +1 -0
- package/dist/utils/data-transformations/getValueFromParametersArray.js +9 -0
- package/dist/utils/layoutNavHelpers.d.ts +70 -0
- package/dist/utils/layoutNavHelpers.js +129 -0
- package/dist/utils/package-wrapping-specific/addIndexAndInitialValue.d.ts +1 -0
- package/dist/utils/package-wrapping-specific/addIndexAndInitialValue.js +21 -0
- package/dist/utils/package-wrapping-specific/createBindableParametersValuesArray.d.ts +1 -0
- package/dist/utils/package-wrapping-specific/createBindableParametersValuesArray.js +12 -0
- package/dist/utils/package-wrapping-specific/createParametersObject.d.ts +1 -0
- package/dist/utils/package-wrapping-specific/createParametersObject.js +29 -0
- package/dist/utils/package-wrapping-specific/defineDefaultEventHandler.d.ts +1 -0
- package/dist/utils/package-wrapping-specific/defineDefaultEventHandler.js +14 -0
- package/dist/utils/package-wrapping-specific/trackVisibleParameters.d.ts +1 -0
- package/dist/utils/package-wrapping-specific/trackVisibleParameters.js +29 -0
- package/dist/utils/syntax-highlighting/shikiHighlight.d.ts +7 -0
- package/dist/utils/syntax-highlighting/shikiHighlight.js +76 -0
- package/dist/utils/text-string-conversion/textStringConversion.d.ts +9 -0
- package/dist/utils/text-string-conversion/textStringConversion.js +86 -0
- package/package.json +113 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default ListOfComponentStatuses;
|
|
2
|
+
type ListOfComponentStatuses = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const ListOfComponentStatuses: import("svelte").Component<{
|
|
7
|
+
statusObject: any;
|
|
8
|
+
}, {}, "">;
|
|
9
|
+
type $$ComponentProps = {
|
|
10
|
+
statusObject: any;
|
|
11
|
+
};
|
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { Tooltip } from "flowbite-svelte";
|
|
3
|
+
import DividerLine from "./DividerLine.svelte";
|
|
4
|
+
import DoubleChevronButton from "../icons/DoubleChevronButton.svelte";
|
|
5
|
+
import InputForParameterUpdated from "./InputForParameterUpdated.svelte";
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
Component,
|
|
9
|
+
demoScreenWidth,
|
|
10
|
+
parametersSourceArray,
|
|
11
|
+
statedParametersValuesArray = $bindable(),
|
|
12
|
+
derivedParametersValuesArray,
|
|
13
|
+
parametersVisibleArray,
|
|
14
|
+
parametersParsingErrorsObject,
|
|
15
|
+
parameterCategories,
|
|
16
|
+
categoriesOverlayOpenArray = $bindable(),
|
|
17
|
+
selectedCategory,
|
|
18
|
+
overlayOpen = $bindable(),
|
|
19
|
+
componentOpacity,
|
|
20
|
+
} = $props();
|
|
21
|
+
|
|
22
|
+
let componentWidth = $state();
|
|
23
|
+
let componentHeight = $state();
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
{#snippet FixedPropsExplanation()}
|
|
27
|
+
<DividerLine></DividerLine>
|
|
28
|
+
<p class="my-10">
|
|
29
|
+
There are three more advanced prop types which are not demoed here but are
|
|
30
|
+
described below:
|
|
31
|
+
</p>
|
|
32
|
+
<div class="grid grid-cols-[auto_1fr] gap-8">
|
|
33
|
+
<div>Snippet props</div>
|
|
34
|
+
<div>
|
|
35
|
+
<p class="mt-0 mb-8">
|
|
36
|
+
Svelte snippets can also be passed as props. Snippets have <code
|
|
37
|
+
>typeof === 'function'</code
|
|
38
|
+
>, so they are treated the same way as function props (e.g. the example
|
|
39
|
+
code is based on <code>functionElements.functionAsString</code>).
|
|
40
|
+
</p>
|
|
41
|
+
<p class="mb-0 mt-8">
|
|
42
|
+
A simple example using a snippet prop can be viewed <a
|
|
43
|
+
href="./snippet-prop-example">here.</a
|
|
44
|
+
>
|
|
45
|
+
</p>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<div class="col-span-full">
|
|
49
|
+
<DividerLine></DividerLine>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<div>bounded props</div>
|
|
53
|
+
<div>
|
|
54
|
+
<p class="mt-0 mb-8">
|
|
55
|
+
We can use Svelte's <code>bind:</code> directive to allow an update to a
|
|
56
|
+
prop within the component to flow upwards to its parent (in this case the
|
|
57
|
+
Wrapper component).
|
|
58
|
+
</p>
|
|
59
|
+
<p class="mt-8 mb-8">
|
|
60
|
+
For this to work with a wrapper page the variable must be declared
|
|
61
|
+
separately to the <code>parametersSourceArray</code> (e.g.
|
|
62
|
+
<code>let boundedProp = $state([])</code>) and passed to the component
|
|
63
|
+
as an individual bounded prop (e.g.
|
|
64
|
+
<code
|
|
65
|
+
><Template> {...parametersSourceArray}
|
|
66
|
+
bind:boundedProp </Template></code
|
|
67
|
+
>).
|
|
68
|
+
</p>
|
|
69
|
+
<p class="mt-8 mb-8">
|
|
70
|
+
If you wish to see updates reflected in the UI, the prop can also be
|
|
71
|
+
assigned as the value of an entry in <code>parametersSourceArray</code>
|
|
72
|
+
(e.g.
|
|
73
|
+
<code
|
|
74
|
+
>{ name: "boundedProp", isEditable: false, value:
|
|
75
|
+
boundedProp}</code
|
|
76
|
+
>).
|
|
77
|
+
</p>
|
|
78
|
+
<p class="mt-8 mb-0">
|
|
79
|
+
A simple example using a bounded prop can be viewed <a
|
|
80
|
+
href="./bounded-prop-example">here.</a
|
|
81
|
+
>
|
|
82
|
+
</p>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<div class="col-span-full">
|
|
86
|
+
<DividerLine></DividerLine>
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
<div>derived props</div>
|
|
90
|
+
<div>
|
|
91
|
+
<p class="mt-0 mb-8">
|
|
92
|
+
In some cases, you will want a prop to be derived from another prop
|
|
93
|
+
(e.g. a chart component might have a <code>primaryAreaName</code> prop,
|
|
94
|
+
and a <code>title</code> prop derived from that
|
|
95
|
+
<code>primaryAreaName</code>).
|
|
96
|
+
</p>
|
|
97
|
+
<p class="mt-8 mb-8">
|
|
98
|
+
Therefore, prop values can be assigned after <code
|
|
99
|
+
>parametersSourceArray</code
|
|
100
|
+
>
|
|
101
|
+
is defined. The <code>getValue()</code> function can be used to grab the
|
|
102
|
+
reactive value of any prop within <code>parametersSourceArray</code>.
|
|
103
|
+
</p>
|
|
104
|
+
<p class="mt-8 mb-8">
|
|
105
|
+
(e.g.
|
|
106
|
+
<code
|
|
107
|
+
>let chartTitle = $derived(`Recycling rates have increased in
|
|
108
|
+
${getValue('primaryAreaName')} since 2015`)</code
|
|
109
|
+
>
|
|
110
|
+
).
|
|
111
|
+
</p>
|
|
112
|
+
<p class="mt-8 mb-0">
|
|
113
|
+
The <a href="./components-update/data-vis/line">Line component</a> is an
|
|
114
|
+
example of a wrapper utilising derived props.
|
|
115
|
+
<code>xFunction</code>,<code>yFunction</code>
|
|
116
|
+
and <code>lineFunction</code> are all defined based on other props.
|
|
117
|
+
</p>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
{/snippet}
|
|
121
|
+
|
|
122
|
+
<div data-role="component-and-overlay-container">
|
|
123
|
+
<!-- === OVERLAY LAYER === -->
|
|
124
|
+
<!-- Absolutely positioned overlay that appears over the component when parameters are being edited -->
|
|
125
|
+
<!-- OVERLAY POSITIONING STRATEGY:
|
|
126
|
+
- position: absolute within relative container (component-and-overlay-container)
|
|
127
|
+
- Dynamically sized to match component dimensions (componentWidth/Height)
|
|
128
|
+
- z-index: 2 ensures it appears above component (z-index: 1)
|
|
129
|
+
- overflow-scroll handles content that exceeds overlay bounds
|
|
130
|
+
- Opacity coordination: overlay opaque, component dimmed when overlay active -->
|
|
131
|
+
{#if overlayOpen && selectedCategory > -1}
|
|
132
|
+
<div
|
|
133
|
+
data-role="overlay-container"
|
|
134
|
+
class="absolute z-[2] p-0 my-0 ml-0 overflow-scroll overflow-x-auto"
|
|
135
|
+
style="left: 0; right: 0; top: 0; height: {componentHeight}px; width: 100%; max-width: {componentWidth +
|
|
136
|
+
2}px; opacity: {1.1 - 2 * componentOpacity}"
|
|
137
|
+
>
|
|
138
|
+
<!-- Sticky header: stays visible while scrolling through parameters -->
|
|
139
|
+
<!-- FLEX LAYOUT: space-between pushes title left and close button right -->
|
|
140
|
+
<div class="p-5 flex flex-row justify-between bg-white sticky top-0">
|
|
141
|
+
<h6 class="underline underline-offset-4">
|
|
142
|
+
{parameterCategories.find((el, i) => i === selectedCategory)?.name}
|
|
143
|
+
</h6>
|
|
144
|
+
<DoubleChevronButton
|
|
145
|
+
bind:open={overlayOpen}
|
|
146
|
+
onClickFunction={() => {
|
|
147
|
+
overlayOpen = !overlayOpen;
|
|
148
|
+
if (!overlayOpen) {
|
|
149
|
+
categoriesOverlayOpenArray = categoriesOverlayOpenArray.map(
|
|
150
|
+
(el) => false,
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
}}
|
|
154
|
+
></DoubleChevronButton>
|
|
155
|
+
</div>
|
|
156
|
+
<DividerLine></DividerLine>
|
|
157
|
+
|
|
158
|
+
<!-- Parameter grid: responsive 3-column layout for parameter editing -->
|
|
159
|
+
<!-- GRID LAYOUT STRATEGY:
|
|
160
|
+
- Column 1 (auto): Parameter names - sizes to content, constrained by responsive max-widths
|
|
161
|
+
- Column 2 (auto): Input values - sizes to content, constrained by responsive max-widths
|
|
162
|
+
- Column 3 (1fr): Descriptions - takes remaining space, can shrink due to min-width: 0
|
|
163
|
+
- Works with ComponentDemo's flex-1 min-w-0 constraint to prevent horizontal overflow -->
|
|
164
|
+
<div data-role="grid-container" class="m-2 p-5 text-base">
|
|
165
|
+
<!-- Grid headers: establish column structure -->
|
|
166
|
+
<div data-role="item" class="font-bold">Parameter</div>
|
|
167
|
+
<div data-role="item" class="font-bold">Value</div>
|
|
168
|
+
<div data-role="item" class="font-bold">Description</div>
|
|
169
|
+
{#each parametersSourceArray as parameter}
|
|
170
|
+
{#if parameter.category === parameterCategories[selectedCategory]?.name && parametersVisibleArray[parameter.index]}
|
|
171
|
+
<div class="col-span-full">
|
|
172
|
+
<DividerLine></DividerLine>
|
|
173
|
+
</div>
|
|
174
|
+
<!-- RESPONSIVE COLUMN CONSTRAINTS:
|
|
175
|
+
- data-width attribute triggers CSS max-width based on demoScreenWidth
|
|
176
|
+
- Prevents parameter names from becoming too wide on any screen size
|
|
177
|
+
- hyphens-auto + break-words handle text overflow within constraints -->
|
|
178
|
+
<div
|
|
179
|
+
data-role="item"
|
|
180
|
+
data-width={demoScreenWidth < 1024
|
|
181
|
+
? "col1Sm"
|
|
182
|
+
: demoScreenWidth < 1280
|
|
183
|
+
? "col1Md"
|
|
184
|
+
: "col1Lg"}
|
|
185
|
+
class="m-1 hyphens-auto break-words"
|
|
186
|
+
>
|
|
187
|
+
{parameter.name}
|
|
188
|
+
<!-- FLEX LAYOUT: parameter type indicators (prop/required/binded pills) -->
|
|
189
|
+
<!-- flex-row gap-0.5 creates horizontal row with minimal spacing -->
|
|
190
|
+
<div class="flex flex-row gap-0.5">
|
|
191
|
+
{#each [{ check: parameter.isProp, color: "#ba029b", yAdj: 0, label: "p" }, { check: parameter.isRequired, color: "#00695c", yAdj: 0.75, label: "r" }, { check: parameter.isBinded, color: "#1B4079", yAdj: 1.25, label: "b" }] as pill}
|
|
192
|
+
{#if pill.check}
|
|
193
|
+
<svg width="20px" height="20px">
|
|
194
|
+
<circle
|
|
195
|
+
cx="10"
|
|
196
|
+
cy="10"
|
|
197
|
+
r="9"
|
|
198
|
+
stroke={pill.color}
|
|
199
|
+
fill={pill.color}
|
|
200
|
+
fill-opacity="0.05"
|
|
201
|
+
stroke-width="2px"
|
|
202
|
+
>
|
|
203
|
+
</circle>
|
|
204
|
+
<text
|
|
205
|
+
text-anchor="middle"
|
|
206
|
+
x="10"
|
|
207
|
+
y={12.5 + pill.yAdj}
|
|
208
|
+
font-size="12px"
|
|
209
|
+
stroke={pill.color}
|
|
210
|
+
fill={pill.color}
|
|
211
|
+
stroke-width="0.5px">{pill.label}</text
|
|
212
|
+
>
|
|
213
|
+
</svg>
|
|
214
|
+
<Tooltip type="light" placement="right" class="max-w-60">
|
|
215
|
+
{#if pill.label === "p"}
|
|
216
|
+
<div
|
|
217
|
+
class="flex flex-col gap-2"
|
|
218
|
+
style="color: {pill.color}"
|
|
219
|
+
>
|
|
220
|
+
<p class="m-0 p-0">
|
|
221
|
+
This parameter is a <span class="font-bold"
|
|
222
|
+
>prop.</span
|
|
223
|
+
>
|
|
224
|
+
</p>
|
|
225
|
+
|
|
226
|
+
<p class="m-0 p-0">
|
|
227
|
+
This means that the value is passed directly to the
|
|
228
|
+
component.
|
|
229
|
+
</p>
|
|
230
|
+
</div>
|
|
231
|
+
{:else if pill.label === "r"}
|
|
232
|
+
<div
|
|
233
|
+
class="flex flex-col gap-2"
|
|
234
|
+
style="color: {pill.color}"
|
|
235
|
+
>
|
|
236
|
+
<p class="m-0 p-0">
|
|
237
|
+
This prop is <span class="font-bold">required.</span
|
|
238
|
+
>
|
|
239
|
+
</p>
|
|
240
|
+
|
|
241
|
+
<p class="m-0 p-0">
|
|
242
|
+
This means that the component will not render
|
|
243
|
+
properly if this prop is <code>undefined</code>.
|
|
244
|
+
</p>
|
|
245
|
+
</div>
|
|
246
|
+
{:else if pill.label === "b"}
|
|
247
|
+
<div
|
|
248
|
+
class="flex flex-col gap-2"
|
|
249
|
+
style="color: {pill.color}"
|
|
250
|
+
>
|
|
251
|
+
<p class="m-0 p-0">
|
|
252
|
+
This parameter is <span class="font-bold"
|
|
253
|
+
>binded.</span
|
|
254
|
+
>
|
|
255
|
+
</p>
|
|
256
|
+
|
|
257
|
+
<p class="m-0 p-0">
|
|
258
|
+
This means updates to the prop made within the
|
|
259
|
+
component are tracked by the parent.
|
|
260
|
+
</p>
|
|
261
|
+
</div>
|
|
262
|
+
{/if}
|
|
263
|
+
</Tooltip>
|
|
264
|
+
{/if}
|
|
265
|
+
{/each}
|
|
266
|
+
</div>
|
|
267
|
+
</div>
|
|
268
|
+
<!-- VALUE INPUT COLUMN: responsive width constraints for input components -->
|
|
269
|
+
<!-- GRID BEHAVIOR: auto-sizing column with max-width constraints prevents inputs from becoming too wide -->
|
|
270
|
+
<div
|
|
271
|
+
data-role="item"
|
|
272
|
+
data-width={demoScreenWidth < 1024
|
|
273
|
+
? "col2Sm"
|
|
274
|
+
: demoScreenWidth < 1280
|
|
275
|
+
? "col2Md"
|
|
276
|
+
: "col2Lg"}
|
|
277
|
+
>
|
|
278
|
+
<InputForParameterUpdated
|
|
279
|
+
{demoScreenWidth}
|
|
280
|
+
bind:statedValue={statedParametersValuesArray[parameter.index]}
|
|
281
|
+
derivedValue={derivedParametersValuesArray[parameter.index]}
|
|
282
|
+
{parameter}
|
|
283
|
+
></InputForParameterUpdated>
|
|
284
|
+
</div>
|
|
285
|
+
<!-- DESCRIPTION COLUMN: flexible width (1fr) that shrinks when needed -->
|
|
286
|
+
<!-- OVERFLOW HANDLING: inherits min-width: 0 from grid-container, allows text wrapping -->
|
|
287
|
+
<div data-role="item" class="m-1">
|
|
288
|
+
{#if typeof parameter.description === "string"}
|
|
289
|
+
{parameter.description}
|
|
290
|
+
{:else if typeof parameter.description === "object"}
|
|
291
|
+
{#each parameter.description.arr as line}
|
|
292
|
+
<p>
|
|
293
|
+
{#if parameter.description.markdown}
|
|
294
|
+
{@html line}
|
|
295
|
+
{:else}
|
|
296
|
+
{line}
|
|
297
|
+
{/if}
|
|
298
|
+
</p>
|
|
299
|
+
{/each}
|
|
300
|
+
{:else if typeof parameter.description === "function"}
|
|
301
|
+
{@render parameter.description()}
|
|
302
|
+
{:else}
|
|
303
|
+
-
|
|
304
|
+
{/if}
|
|
305
|
+
</div>
|
|
306
|
+
{/if}
|
|
307
|
+
{/each}
|
|
308
|
+
{#if FixedPropsExplanation && parameterCategories[selectedCategory].name === "Fixed props"}
|
|
309
|
+
<div class="col-span-full text-[#6b7280]">
|
|
310
|
+
{@render FixedPropsExplanation()}
|
|
311
|
+
</div>
|
|
312
|
+
{/if}
|
|
313
|
+
</div>
|
|
314
|
+
</div>
|
|
315
|
+
{/if}
|
|
316
|
+
|
|
317
|
+
<!-- === COMPONENT CONTAINER === -->
|
|
318
|
+
<!-- Main container for the component being demonstrated, with responsive width constraints -->
|
|
319
|
+
<div
|
|
320
|
+
data-role="component-container-centered"
|
|
321
|
+
class="px-0 py-5 rounded-md {overlayOpen
|
|
322
|
+
? ''
|
|
323
|
+
: 'border border-solid border-[#d1d5db]'}"
|
|
324
|
+
style="width: 100%; max-width: {demoScreenWidth}px;"
|
|
325
|
+
>
|
|
326
|
+
<!-- Component wrapper: provides minimum height and opacity control for overlay interaction -->
|
|
327
|
+
<div
|
|
328
|
+
class="z-[1]"
|
|
329
|
+
style="z-index: 1; min-height: 600px; opacity: {overlayOpen
|
|
330
|
+
? componentOpacity
|
|
331
|
+
: 1};"
|
|
332
|
+
bind:clientWidth={componentWidth}
|
|
333
|
+
bind:clientHeight={componentHeight}
|
|
334
|
+
>
|
|
335
|
+
<!-- Actual component rendering with error boundary -->
|
|
336
|
+
{#if !Object.values(parametersParsingErrorsObject).includes(true)}
|
|
337
|
+
{@render Component()}
|
|
338
|
+
{:else}
|
|
339
|
+
<h6 class="px-5">Component not rendered due to invalid prop value.</h6>
|
|
340
|
+
{/if}
|
|
341
|
+
</div>
|
|
342
|
+
</div>
|
|
343
|
+
</div>
|
|
344
|
+
|
|
345
|
+
<style>
|
|
346
|
+
/* === POSITIONING CONTEXT === */
|
|
347
|
+
[data-role="component-and-overlay-container"] {
|
|
348
|
+
position: relative; /* Creates positioning context for absolutely positioned overlay */
|
|
349
|
+
display: block;
|
|
350
|
+
width: 100%; /* Takes full width of parent container */
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/* === OVERLAY STYLING === */
|
|
354
|
+
[data-role="overlay-container"] {
|
|
355
|
+
border: solid #d1d5db 1px; /* Visual boundary for overlay */
|
|
356
|
+
border-radius: 5px; /* Rounded corners to match component container */
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/* === RESPONSIVE PARAMETER GRID === */
|
|
360
|
+
[data-role="grid-container"] {
|
|
361
|
+
display: grid;
|
|
362
|
+
grid-template-columns: auto auto 1fr; /* Parameter name | Value input | Description */
|
|
363
|
+
gap: 20px; /* Spacing between grid items */
|
|
364
|
+
min-width: 0; /* Critical: allows grid to shrink and prevents overflow */
|
|
365
|
+
/* CONSTRAINT HIERARCHY:
|
|
366
|
+
1. ComponentDemo provides flex-1 min-w-0 (parent constraint)
|
|
367
|
+
2. This grid inherits that constraint and can shrink below content width
|
|
368
|
+
3. Individual columns use max-width + auto/1fr to distribute space efficiently
|
|
369
|
+
4. Text wrapping (break-words, hyphens-auto) handles content overflow within columns */
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/* === GRID ITEM STYLING === */
|
|
373
|
+
[data-role="item"] {
|
|
374
|
+
color: #6b7280; /* Consistent text color for all grid items */
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/* Remove default margins from first/last paragraphs in grid items */
|
|
378
|
+
[data-role="item"] p:first-of-type {
|
|
379
|
+
margin-top: 0px;
|
|
380
|
+
padding-top: 0px;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
[data-role="item"] p:last-of-type {
|
|
384
|
+
margin-bottom: 0px;
|
|
385
|
+
padding-bottom: 0px;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/* === RESPONSIVE COLUMN WIDTHS === */
|
|
389
|
+
/* RESPONSIVE STRATEGY:
|
|
390
|
+
- Applied via data-width attributes based on demoScreenWidth breakpoints
|
|
391
|
+
- Works with CSS Grid auto-sizing: columns size to content up to max-width limit
|
|
392
|
+
- Prevents columns from becoming too wide/narrow at different screen sizes
|
|
393
|
+
- Coordinates with ComponentDemo's width constraints for optimal space usage */
|
|
394
|
+
|
|
395
|
+
/* Small screens: Compact parameter names and values */
|
|
396
|
+
[data-width="col1Sm"] {
|
|
397
|
+
max-width: 150px; /* Parameter name column - small screens */
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
[data-width="col2Sm"] {
|
|
401
|
+
max-width: 350px; /* Value input column - small screens */
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/* Medium screens: More space for readability */
|
|
405
|
+
[data-width="col1Md"] {
|
|
406
|
+
max-width: 225px; /* Parameter name column - medium screens */
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
[data-width="col2Md"] {
|
|
410
|
+
max-width: 450px; /* Value input column - medium screens */
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/* Large screens: Maximum space for comfortable editing */
|
|
414
|
+
[data-width="col1Lg"] {
|
|
415
|
+
max-width: 300px; /* Parameter name column - large screens */
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
[data-width="col2Lg"] {
|
|
419
|
+
max-width: 550px; /* Value input column - large screens */
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/* === SVG ICON STYLING === */
|
|
423
|
+
svg {
|
|
424
|
+
overflow: visible; /* Ensures SVG icons don't get clipped at container edges */
|
|
425
|
+
}
|
|
426
|
+
</style>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export default OverlayAndComponentContainer;
|
|
2
|
+
type OverlayAndComponentContainer = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const OverlayAndComponentContainer: import("svelte").Component<{
|
|
7
|
+
Component: any;
|
|
8
|
+
demoScreenWidth: any;
|
|
9
|
+
parametersSourceArray: any;
|
|
10
|
+
statedParametersValuesArray?: any;
|
|
11
|
+
derivedParametersValuesArray: any;
|
|
12
|
+
parametersVisibleArray: any;
|
|
13
|
+
parametersParsingErrorsObject: any;
|
|
14
|
+
parameterCategories: any;
|
|
15
|
+
categoriesOverlayOpenArray?: any;
|
|
16
|
+
selectedCategory: any;
|
|
17
|
+
overlayOpen?: any;
|
|
18
|
+
componentOpacity: any;
|
|
19
|
+
}, {}, "overlayOpen" | "categoriesOverlayOpenArray" | "statedParametersValuesArray">;
|
|
20
|
+
type $$ComponentProps = {
|
|
21
|
+
Component: any;
|
|
22
|
+
demoScreenWidth: any;
|
|
23
|
+
parametersSourceArray: any;
|
|
24
|
+
statedParametersValuesArray?: any;
|
|
25
|
+
derivedParametersValuesArray: any;
|
|
26
|
+
parametersVisibleArray: any;
|
|
27
|
+
parametersParsingErrorsObject: any;
|
|
28
|
+
parameterCategories: any;
|
|
29
|
+
categoriesOverlayOpenArray?: any;
|
|
30
|
+
selectedCategory: any;
|
|
31
|
+
overlayOpen?: any;
|
|
32
|
+
componentOpacity: any;
|
|
33
|
+
};
|