tecitheme 0.11.8 → 0.11.10

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.
@@ -1,73 +1,113 @@
1
1
  <script>
2
2
  import { slide } from "svelte/transition";
3
- import { cubicIn, cubicOut } from "svelte/easing";
3
+ import { cubicIn, cubicOut, cubicInOut } from "svelte/easing";
4
+ import { makeIdString } from "../utils";
5
+ import { onMount } from "svelte";
6
+ import { page } from "$app/stores";
4
7
 
5
8
  export let data = {};
6
- export let prompts=[];
7
- export let title="";
8
-
9
- let promptsArray;
10
- let accordionTitle;
11
- let openPrompts=[];
12
9
 
13
- if (data.prompts) {
14
- promptsArray = data.prompts;
15
- } else if (prompts) {
16
- promptsArray = prompts;
17
- } else {
18
- promptsArray = [];
19
- }
10
+ let {prompts, title} = data;
11
+ let id = makeIdString(title);
20
12
 
21
- if (title) {
22
- accordionTitle = title;
23
- } else if (data.title) {
24
- accordionTitle = data.title;
25
- } else {
26
- accordionTitle = "";
27
- }
13
+ let openPrompts=[];
28
14
 
29
15
  function addPrompt(id) {
30
16
  openPrompts = [...openPrompts, id];
17
+
31
18
  }
32
19
 
33
20
  function removePrompt(id) {
34
21
  openPrompts = openPrompts.filter((x) => x !== id);
35
22
  }
36
23
 
24
+ onMount(() => {
25
+ if ($page.url.hash) {
26
+ let hashedPrompt = $page.url.hash.slice(1,);
27
+ let initialPrompt = prompts.filter(prompt => {
28
+ return makeIdString(prompt.title) == hashedPrompt;
29
+ })[0]
30
+ let initialPromptIndex = prompts.indexOf(initialPrompt);
31
+
32
+ if (initialPromptIndex != null) {
33
+ openPrompts = [...openPrompts, `prompt-${initialPromptIndex}`]
34
+ }
35
+ }
36
+ });
37
+
37
38
  </script>
38
39
 
39
- <section class="mx-auto mb-8 w-full max-w-4xl divide-y divide-gray-900/10">
40
- {#if accordionTitle}
41
- <span class="text-2xl font-bold tracking-tight text-gray-900 mb-8">{accordionTitle}</span>
42
- {/if}
43
- <dl class="space-y-6 divide-y divide-gray-900/10">
44
- {#each promptsArray as prompt, i}
40
+ <section class="mx-auto mb-8 w-full divide-y divide-gray-900/10 px-6 lg:px-8">
41
+ <!-- Header -->
42
+ <div class="flex flex-row w-full items-center space-x-4">
43
+ <!-- Title -->
44
+ {#if title}
45
+ <h2 id={id} class="scroll-mt-16 text-2xl font-bold leading-10 tracking-tight text-gray-900 w-full"><a href={`#${id}`}>{@html title}</a></h2>
46
+ {:else}
47
+ <div class="flex-grow" />
48
+ {/if}
49
+
50
+ <!-- Expand All -->
51
+ <button class="px-2" on:click={() => {
52
+ openPrompts = prompts.map((prompt, index) => `prompt-${index}`);
53
+ }}>
54
+ <span class="sr-only">Expand All</span>
55
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
56
+ <path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" />
57
+ </svg>
58
+ </button>
59
+
60
+ <!-- Collapse All -->
61
+ <button class="px-2" on:click={() => {
62
+ openPrompts = [];
63
+ }}>
64
+ <span class="sr-only">Collapse All</span>
65
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
66
+ <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14" />
67
+ </svg>
68
+ </button>
69
+
70
+ </div>
71
+
72
+ <!-- Prompts -->
73
+ <dl class="space-y-6 divide-y divide-gray-900/10 mt-10">
74
+ {#each prompts as prompt, i}
45
75
  <div id="prompt-{i}" class="pt-6">
46
- <dt>
76
+ <!-- Prompt -->
77
+ <dt class="scroll-mt-16" id={makeIdString(prompt.title)}>
47
78
  <button type="button"
48
79
  on:click={() => openPrompts.includes(`prompt-${i}`) ? removePrompt(`prompt-${i}`) : addPrompt(`prompt-${i}`)}
49
80
  class="flex w-full items-start justify-between text-left text-gray-900"
50
81
  aria-controls="prompt-content-{i}"
51
82
  aria-expanded={openPrompts.includes(`prompt-${i}`)}>
52
- <span class="text-base font-semibold leading-7">{prompt.title}</span>
53
- <span class="ml-6 flex h-7 items-center">
54
- {#if (openPrompts.includes(`prompt-${i}`))}
55
- <svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
56
- <path stroke-linecap="round" stroke-linejoin="round" d="M18 12H6" />
57
- </svg>
58
- {:else}
59
- <svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
60
- <path stroke-linecap="round" stroke-linejoin="round" d="M12 6v12m6-6H6" />
61
- </svg>
62
- {/if}
63
- </span>
83
+
84
+ <a href={`#${makeIdString(prompt.title)}`} class="flex w-full items-start justify-between text-left text-gray-900">
85
+ <span class="text-base font-semibold leading-7">{prompt.title}</span>
86
+ <span class="ml-6 flex h-7 items-center">
87
+ {#if (openPrompts.includes(`prompt-${i}`))}
88
+ <svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
89
+ <path stroke-linecap="round" stroke-linejoin="round" d="M18 12H6" />
90
+ </svg>
91
+ {:else}
92
+ <svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
93
+ <path stroke-linecap="round" stroke-linejoin="round" d="M12 6v12m6-6H6" />
94
+ </svg>
95
+ {/if}
96
+ </span>
97
+ </a>
98
+
64
99
  </button>
65
100
  </dt>
66
- <dd id="prompt-content-{i}" class="mt-2 pr-12 transition-opacity ease-in duration-100 opacity-100 {openPrompts.includes(`prompt-${i}`) ? "opacity-100" : "opacity-0"}">
67
- <p class="text-base leading-7" class:hidden={!openPrompts.includes(`prompt-${i}`)}>
68
- {@html prompt.content}
69
- </p>
70
- </dd>
101
+
102
+ <!-- Content -->
103
+ {#if openPrompts.includes(`prompt-${i}`)}
104
+ <dd id="prompt-content-{i}" class="mt-2 pr-12" transition:slide={{ delay: 100, duration: 300, easing: cubicInOut, axis: 'y' }}>
105
+ <p class="text-base leading-7"
106
+ >
107
+ {@html prompt.content}
108
+ </p>
109
+ </dd>
110
+ {/if}
71
111
  </div>
72
112
  {/each}
73
113
  </dl>
@@ -3,8 +3,6 @@
3
3
  /** @typedef {typeof __propDef.slots} AccordionSlots */
4
4
  export default class Accordion extends SvelteComponent<{
5
5
  data?: {};
6
- title?: string;
7
- prompts?: any[];
8
6
  }, {
9
7
  [evt: string]: CustomEvent<any>;
10
8
  }, {}> {
@@ -16,8 +14,6 @@ import { SvelteComponent } from "svelte";
16
14
  declare const __propDef: {
17
15
  props: {
18
16
  data?: {};
19
- title?: string;
20
- prompts?: any[];
21
17
  };
22
18
  events: {
23
19
  [evt: string]: CustomEvent<any>;
@@ -6,14 +6,14 @@
6
6
  let id = makeIdString(data.name);
7
7
  </script>
8
8
 
9
- <div id={id} class="bg-white">
9
+ <div id={id} class="bg-white scroll-mt-16">
10
10
  <div class="mx-auto max-w-7xl divide-y divide-gray-900/10 px-6 lg:px-8">
11
- <h2 class="text-2xl font-bold leading-10 tracking-tight text-gray-900">Frequently asked questions</h2>
11
+ <h2 class="text-2xl font-bold leading-10 tracking-tight text-gray-900"><a href={`#${id}`}>{@html data.heading}</a></h2>
12
12
  <dl class="mt-10 space-y-8 divide-y divide-gray-900/10">
13
13
  <div class="pt-8 lg:grid lg:grid-cols-12 lg:gap-8">
14
14
 
15
- {#each data.items as item}
16
- <dt class="text-base font-semibold leading-7 text-gray-900 lg:col-span-5">{@html item.label}</dt>
15
+ {#each data.items as item, index}
16
+ <dt id={`${id}-list-item-${index}`} class="text-base font-semibold leading-7 text-gray-900 lg:col-span-5 scroll-mt-16"><a href={`#${id}-list-item-${index}`}>{@html item.label}</a></dt>
17
17
  <dd class="mt-4 lg:col-span-7 lg:mt-0">
18
18
  <p class="text-base leading-7 text-gray-600">{@html item.description}</p>
19
19
  </dd>
@@ -0,0 +1,23 @@
1
+ /** @typedef {typeof __propDef.props} AnswersListProps */
2
+ /** @typedef {typeof __propDef.events} AnswersListEvents */
3
+ /** @typedef {typeof __propDef.slots} AnswersListSlots */
4
+ export default class AnswersList extends SvelteComponent<{
5
+ data?: {};
6
+ }, {
7
+ [evt: string]: CustomEvent<any>;
8
+ }, {}> {
9
+ }
10
+ export type AnswersListProps = typeof __propDef.props;
11
+ export type AnswersListEvents = typeof __propDef.events;
12
+ export type AnswersListSlots = typeof __propDef.slots;
13
+ import { SvelteComponent } from "svelte";
14
+ declare const __propDef: {
15
+ props: {
16
+ data?: {};
17
+ };
18
+ events: {
19
+ [evt: string]: CustomEvent<any>;
20
+ };
21
+ slots: {};
22
+ };
23
+ export {};
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@ export { default as ContentTwoColumns } from "./components/ContentTwoColumns.sve
10
10
  export { default as CountrySelector } from "./components/CountrySelector.svelte";
11
11
  export { default as CTA } from "./components/CTA.svelte";
12
12
  export { default as CTASplitImage } from "./components/CTASplitImage.svelte";
13
- export { default as FaqTable } from "./components/FAQList.svelte";
13
+ export { default as AnswersList } from "./components/AnswersList.svelte";
14
14
  export { default as FeatureGrid } from "./components/FeatureGrid.svelte";
15
15
  export { default as FeatureTable } from "./components/FeatureTable.svelte";
16
16
  export { default as Figure } from "./components/Figure.svelte";
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ export { default as ContentTwoColumns } from './components/ContentTwoColumns.sve
10
10
  export { default as CountrySelector } from './components/CountrySelector.svelte';
11
11
  export { default as CTA } from './components/CTA.svelte';
12
12
  export { default as CTASplitImage } from './components/CTASplitImage.svelte';
13
- export { default as FaqTable } from './components/FAQList.svelte';
13
+ export { default as AnswersList } from './components/AnswersList.svelte';
14
14
  export { default as FeatureGrid } from './components/FeatureGrid.svelte';
15
15
  export { default as FeatureTable } from './components/FeatureTable.svelte';
16
16
  export { default as Figure } from './components/Figure.svelte';
@@ -20,7 +20,7 @@
20
20
  import PageNav from "../components/PageNav.svelte";
21
21
  import Testimonial from "../components/Testimonial.svelte";
22
22
  import PartnersList from "../components/PartnersList.svelte";
23
- import FaqList from "../components/FAQList.svelte";
23
+ import AnswersList from "../components/AnswersList.svelte";
24
24
 
25
25
  let blocks = [
26
26
  { ref: "accordion", component: Accordion},
@@ -44,7 +44,7 @@
44
44
  { ref: "pageNav", component: PageNav },
45
45
  { ref: "testimonial", component: Testimonial },
46
46
  { ref: "partners", component: PartnersList },
47
- { ref: "faq-list", component: FaqList }
47
+ { ref: "answers-list", component: AnswersList }
48
48
  ];
49
49
 
50
50
  export let data = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tecitheme",
3
- "version": "0.11.8",
3
+ "version": "0.11.10",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -1,23 +0,0 @@
1
- /** @typedef {typeof __propDef.props} FaqListProps */
2
- /** @typedef {typeof __propDef.events} FaqListEvents */
3
- /** @typedef {typeof __propDef.slots} FaqListSlots */
4
- export default class FaqList extends SvelteComponent<{
5
- data?: {};
6
- }, {
7
- [evt: string]: CustomEvent<any>;
8
- }, {}> {
9
- }
10
- export type FaqListProps = typeof __propDef.props;
11
- export type FaqListEvents = typeof __propDef.events;
12
- export type FaqListSlots = typeof __propDef.slots;
13
- import { SvelteComponent } from "svelte";
14
- declare const __propDef: {
15
- props: {
16
- data?: {};
17
- };
18
- events: {
19
- [evt: string]: CustomEvent<any>;
20
- };
21
- slots: {};
22
- };
23
- export {};