@txstate-mws/svelte-components 1.0.2 → 1.0.3

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.
Files changed (130) hide show
  1. package/README.md +40 -17
  2. package/{dist/ts/actions → actions}/buttonify.d.ts +0 -0
  3. package/{dist/actions → actions}/buttonify.js +1 -6
  4. package/{dist/ts/actions → actions}/glue.d.ts +1 -1
  5. package/{dist/actions → actions}/glue.js +8 -13
  6. package/actions/index.d.ts +7 -0
  7. package/actions/index.js +7 -0
  8. package/actions/offset.d.ts +15 -0
  9. package/actions/offset.js +35 -0
  10. package/{dist/ts/actions → actions}/portal.d.ts +0 -0
  11. package/actions/portal.js +13 -0
  12. package/{dist/ts/actions → actions}/resize.d.ts +6 -2
  13. package/actions/resize.js +45 -0
  14. package/{dist/ts/actions → actions}/sticky.d.ts +2 -2
  15. package/{dist/actions → actions}/sticky.js +10 -18
  16. package/{dist/ts/actions → actions}/stickyfixed.d.ts +2 -2
  17. package/{dist/actions → actions}/stickyfixed.js +14 -23
  18. package/{dist/components → components}/CollapsingTable.svelte +12 -13
  19. package/components/CollapsingTable.svelte.d.ts +59 -0
  20. package/{dist/ts/components → components}/ConditionalWrapper.svelte +6 -7
  21. package/components/ConditionalWrapper.svelte.d.ts +23 -0
  22. package/{dist/components → components}/FocusLock.svelte +11 -9
  23. package/components/FocusLock.svelte.d.ts +26 -0
  24. package/{dist/components → components}/Modal.svelte +5 -4
  25. package/components/Modal.svelte.d.ts +27 -0
  26. package/{dist/components → components}/PopupMenu.svelte +13 -16
  27. package/components/PopupMenu.svelte.d.ts +44 -0
  28. package/{dist/components → components}/ScreenReaderOnly.svelte +1 -1
  29. package/components/ScreenReaderOnly.svelte.d.ts +20 -0
  30. package/{dist/ts/components → components}/index.d.ts +0 -0
  31. package/components/index.js +6 -0
  32. package/index.d.ts +4 -0
  33. package/index.js +4 -0
  34. package/package.json +47 -76
  35. package/{dist/ts/types → types}/CollapsingTable.d.ts +0 -0
  36. package/{dist/ts/tests/Actions/Actions.stories.d.ts → types/CollapsingTable.js} +0 -0
  37. package/{dist/ts/types → types}/PopupMenu.d.ts +0 -0
  38. package/{dist/ts/tests/CollapsingTable/CollapsingTable.stories.d.ts → types/PopupMenu.js} +0 -0
  39. package/types/index.d.ts +2 -0
  40. package/types/index.js +2 -0
  41. package/{dist/ts/lib → util}/bodyoffset.d.ts +2 -1
  42. package/{dist/lib → util}/bodyoffset.js +10 -14
  43. package/util/index.d.ts +3 -0
  44. package/util/index.js +3 -0
  45. package/{dist/ts/lib → util}/repositioned.d.ts +1 -2
  46. package/{dist/lib → util}/repositioned.js +14 -24
  47. package/{dist/ts/lib → util}/util.d.ts +0 -0
  48. package/util/util.js +10 -0
  49. package/LICENSE +0 -21
  50. package/dist/actions/buttonify.js.map +0 -1
  51. package/dist/actions/glue.js.map +0 -1
  52. package/dist/actions/index.js +0 -20
  53. package/dist/actions/index.js.map +0 -1
  54. package/dist/actions/offset.js +0 -35
  55. package/dist/actions/offset.js.map +0 -1
  56. package/dist/actions/portal.js +0 -19
  57. package/dist/actions/portal.js.map +0 -1
  58. package/dist/actions/resize.js +0 -48
  59. package/dist/actions/resize.js.map +0 -1
  60. package/dist/actions/sticky.js.map +0 -1
  61. package/dist/actions/stickyfixed.js.map +0 -1
  62. package/dist/components/ConditionalWrapper.svelte +0 -38
  63. package/dist/components/index.js +0 -19
  64. package/dist/components/index.js.map +0 -1
  65. package/dist/index.js +0 -17
  66. package/dist/index.js.map +0 -1
  67. package/dist/lib/activestore.js +0 -123
  68. package/dist/lib/activestore.js.map +0 -1
  69. package/dist/lib/bodyoffset.js.map +0 -1
  70. package/dist/lib/convertedstore.js +0 -41
  71. package/dist/lib/convertedstore.js.map +0 -1
  72. package/dist/lib/derivedstore.js +0 -65
  73. package/dist/lib/derivedstore.js.map +0 -1
  74. package/dist/lib/index.js +0 -22
  75. package/dist/lib/index.js.map +0 -1
  76. package/dist/lib/repositioned.js.map +0 -1
  77. package/dist/lib/safestore.js +0 -16
  78. package/dist/lib/safestore.js.map +0 -1
  79. package/dist/lib/store.js +0 -27
  80. package/dist/lib/store.js.map +0 -1
  81. package/dist/lib/substore.js +0 -47
  82. package/dist/lib/substore.js.map +0 -1
  83. package/dist/lib/util.js +0 -16
  84. package/dist/lib/util.js.map +0 -1
  85. package/dist/ts/actions/index.d.ts +0 -7
  86. package/dist/ts/actions/offset.d.ts +0 -15
  87. package/dist/ts/components/CollapsingTable.svelte +0 -147
  88. package/dist/ts/components/FocusLock.svelte +0 -101
  89. package/dist/ts/components/Modal.svelte +0 -54
  90. package/dist/ts/components/PopupMenu.svelte +0 -279
  91. package/dist/ts/components/ScreenReaderOnly.svelte +0 -26
  92. package/dist/ts/index.d.ts +0 -4
  93. package/dist/ts/lib/activestore.d.ts +0 -60
  94. package/dist/ts/lib/convertedstore.d.ts +0 -16
  95. package/dist/ts/lib/derivedstore.d.ts +0 -23
  96. package/dist/ts/lib/index.d.ts +0 -9
  97. package/dist/ts/lib/safestore.d.ts +0 -4
  98. package/dist/ts/lib/store.d.ts +0 -16
  99. package/dist/ts/lib/substore.d.ts +0 -24
  100. package/dist/ts/tests/Actions/Offset.svelte +0 -34
  101. package/dist/ts/tests/Actions/Resize.svelte +0 -31
  102. package/dist/ts/tests/Actions/Sticky.svelte +0 -65
  103. package/dist/ts/tests/CollapsingTable/CollapsingTable.test.d.ts +0 -1
  104. package/dist/ts/tests/CollapsingTable/CollapsingTableTest.svelte +0 -36
  105. package/dist/ts/tests/Modal/Modal.stories.d.ts +0 -1
  106. package/dist/ts/tests/Modal/Modal.test.d.ts +0 -1
  107. package/dist/ts/tests/Modal/ModalTest.svelte +0 -58
  108. package/dist/ts/tests/PopupMenu/PopupMenu.stories.d.ts +0 -1
  109. package/dist/ts/tests/PopupMenu/PopupMenu.test.d.ts +0 -1
  110. package/dist/ts/tests/PopupMenu/PopupMenuBody.svelte +0 -34
  111. package/dist/ts/tests/PopupMenu/PopupMenuButtonIsParent.svelte +0 -36
  112. package/dist/ts/tests/PopupMenu/PopupMenuComplex.svelte +0 -34
  113. package/dist/ts/tests/PopupMenu/PopupMenuSimple.svelte +0 -36
  114. package/dist/ts/tests/stores/deepstore.test.d.ts +0 -1
  115. package/dist/ts/types/index.d.ts +0 -2
  116. package/dist/types/CollapsingTable.js +0 -3
  117. package/dist/types/CollapsingTable.js.map +0 -1
  118. package/dist/types/PopupMenu.js +0 -3
  119. package/dist/types/PopupMenu.js.map +0 -1
  120. package/dist/types/index.js +0 -15
  121. package/dist/types/index.js.map +0 -1
  122. package/docs/CollapsingTable.md +0 -79
  123. package/docs/ConditionalWrapper.md +0 -35
  124. package/docs/Modal.md +0 -63
  125. package/docs/PopupMenu.md +0 -31
  126. package/docs/ScreenReaderOnly.md +0 -10
  127. package/docs/actions.md +0 -84
  128. package/docs/stores.md +0 -203
  129. package/esm/index.js +0 -1
  130. package/esm/package.json +0 -3
@@ -1,58 +0,0 @@
1
- <script lang="ts">
2
- import Modal from '../../components/Modal.svelte'
3
- let shown = true
4
- </script>
5
-
6
- {#if shown}
7
- <Modal on:escape={() => shown = false}>
8
- <form>
9
- <div class="formfield">
10
- <label for="firstname">First Name:</label><input id="firstname" type="text" name="firstname">
11
- </div>
12
- <div class="formfield">
13
- <label for="middlename">Middle Name:</label><input id="middlename" type="text" name="middlename">
14
- </div>
15
- <div class="formfield">
16
- <label for="lastname">Last Name:</label><input id="lastname" type="text" name="lastname">
17
- </div>
18
- <input type="submit" value="Submit">
19
- </form>
20
- </Modal>
21
- {/if}
22
- <div class="content">
23
- <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer tempus nulla ut nulla auctor, quis sodales massa laoreet. Duis erat lacus, gravida vitae massa vel, semper accumsan urna. Morbi gravida dui sit amet sodales luctus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Vestibulum eget pulvinar dui. Vivamus quis eros eu ex semper consectetur nec at elit. Praesent faucibus arcu a nisi semper, eu tempus felis vehicula. Suspendisse potenti.</p>
24
-
25
- <p>Donec luctus nulla mattis ipsum aliquam imperdiet. Vestibulum nec finibus enim. Proin et arcu arcu. Quisque feugiat leo velit, vitae mollis felis ornare sed. Suspendisse sollicitudin, libero sed ullamcorper finibus, diam turpis eleifend velit, ut suscipit orci mauris id purus. Donec dapibus facilisis mauris a venenatis. Maecenas gravida velit maximus nibh tincidunt, eget auctor tellus efficitur. Aenean varius tristique lacus, sit amet placerat sem tempor at. Sed imperdiet fermentum nibh, sit amet tempor est cursus ac.</p>
26
- <button data-testid="button" on:click={() => shown = true}>Show Modal</button>
27
- <p>Praesent augue magna, maximus at mattis eget, euismod nec neque. Phasellus ut dolor a turpis molestie fermentum. Phasellus condimentum, ipsum sed rutrum maximus, diam ex ultrices sapien, quis iaculis nisi arcu at turpis. Morbi aliquam mattis posuere. Integer pretium diam diam, non lobortis quam consectetur laoreet. Sed posuere blandit venenatis. Nulla gravida maximus arcu non consectetur.</p>
28
-
29
- <p>Cras egestas massa mattis dictum imperdiet. Nulla bibendum nisl ipsum, ut scelerisque arcu consectetur vitae. Integer convallis id nunc sit amet faucibus. Maecenas suscipit diam orci, ac suscipit dolor convallis sed. Mauris vel tellus eget nunc mattis faucibus sit amet sed lorem. Cras lobortis, massa at vestibulum dignissim, quam tellus sagittis purus, eget dictum dolor quam in leo. Aliquam condimentum, ante sit amet semper laoreet, lacus est scelerisque mi, nec mollis diam massa et massa. Donec sagittis massa quis diam dictum, sit amet convallis mauris tincidunt. Nam vulputate ligula quis ex condimentum, in sollicitudin dolor accumsan. Donec volutpat dui in faucibus tempus. Proin vitae tincidunt ex. Proin ut ultricies diam. Praesent sed purus in purus efficitur fermentum vulputate quis dolor. Morbi viverra quam ac dolor facilisis consectetur.</p>
30
-
31
- <p>Phasellus convallis congue mi, at auctor neque facilisis vestibulum. Maecenas tincidunt eros nec ornare vehicula. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Aenean odio erat, efficitur sit amet neque ut, condimentum scelerisque enim. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis sagittis nisl aliquam, rutrum eros eget, luctus augue. Praesent sollicitudin facilisis nisi, eget tincidunt dolor vestibulum sed. Nullam auctor consequat est, sit amet convallis sem fermentum vitae. Pellentesque tempor, turpis vel tristique imperdiet, tellus nunc blandit lorem, et tristique velit dui sed ante. Praesent tempor, sem at vulputate porta, dolor lacus condimentum augue, non tincidunt magna sapien ultrices massa. In consequat, ligula ac elementum ornare, enim dui semper metus, a vehicula arcu odio at sapien. Donec et sodales dui, sed tempus turpis.</p>
32
-
33
- <p>Donec quis elit dolor. Proin rutrum lorem sapien, eu tempor urna commodo facilisis. Nunc at est eu purus mattis auctor eget et libero. In auctor dictum massa, nec hendrerit augue facilisis a. Vestibulum sit amet accumsan dolor, sit amet porta ante. Nam fringilla, velit eu tempus pulvinar, magna nibh iaculis dolor, a rutrum nibh turpis vel metus. Mauris quis lorem et nunc blandit feugiat. Phasellus vitae luctus turpis, id blandit nulla. Aliquam imperdiet mattis ante laoreet ullamcorper. Vivamus in laoreet purus, id fermentum velit. Phasellus eleifend libero in velit feugiat rhoncus.</p>
34
-
35
- <p>Maecenas et mattis erat. Fusce volutpat urna tortor, sed lobortis sapien dignissim nec. Morbi id aliquet nunc. In hac habitasse platea dictumst. Mauris in lobortis dolor. Nunc orci urna, vehicula et turpis a, sagittis gravida est. Sed quis sem sapien. Morbi finibus neque lorem, non lobortis magna sodales vitae. In feugiat metus purus, ac rhoncus lorem tristique id. Nulla volutpat ex ac nulla ultrices, nec pellentesque urna semper. Donec a neque finibus, faucibus mi ac, viverra diam. Nullam a nisi vel enim gravida semper. Nam a ante nisi. Fusce tempor odio diam, vel commodo odio tempor et. Praesent sagittis consequat leo, eu efficitur justo finibus dignissim. Suspendisse in commodo sapien.</p>
36
-
37
- <p>Pellentesque varius dui mauris, eget commodo lectus aliquet quis. Nulla vehicula vitae est ut euismod. Vivamus tempus tempus volutpat. Etiam cursus in leo et pulvinar. Vestibulum interdum porttitor efficitur. Morbi vestibulum dignissim massa nec molestie. Nullam eu sodales leo, nec pharetra arcu. Proin accumsan ligula ac lorem ullamcorper lacinia. Duis ut mi quis augue auctor tempor. Duis volutpat elit nec venenatis pharetra. Suspendisse luctus placerat tincidunt. Cras interdum interdum felis id vehicula. Aenean quis erat nec urna gravida tristique id in turpis. Integer dapibus placerat enim, vitae vehicula elit.</p>
38
-
39
- <p>Fusce lorem magna, molestie euismod tincidunt et, hendrerit nec nibh. Duis id nibh nisl. Cras lectus sapien, hendrerit vitae dui eu, tincidunt tristique magna. Pellentesque molestie in velit in volutpat. Morbi egestas lacus neque, sit amet pulvinar sem volutpat ut. Aenean congue bibendum nisl ut malesuada. Donec mattis laoreet commodo. Nulla accumsan maximus porttitor.</p>
40
-
41
- <p>Phasellus vel mi nec sapien pharetra mattis quis nec orci. Praesent eu suscipit nisi, a euismod nisi. Sed id dolor quis nisl tincidunt accumsan. Aliquam aliquam sed erat eu vehicula. Sed vestibulum felis egestas, pharetra nisi vel, fringilla sem. In maximus dui in hendrerit vulputate. Quisque lobortis iaculis lacus, sit amet lacinia sapien interdum sed. Vivamus congue neque fringilla tellus pellentesque blandit. Sed nec sapien at nisl molestie sollicitudin. Etiam a nulla tortor. Ut non tellus turpis. Curabitur ultrices pharetra velit, sed ultricies magna viverra sed.</p>
42
-
43
- <p>Nunc in vehicula diam, ac molestie est. Aliquam efficitur at neque nec tristique. Nullam elementum arcu quis dolor sodales pulvinar. Phasellus pretium, ex at hendrerit rhoncus, orci diam mattis purus, a tempor nisi mauris vitae lectus. Aenean eget vulputate diam. Ut ultrices, nunc id hendrerit mattis, mi felis sagittis sapien, eget euismod massa risus eu risus. Morbi euismod vulputate ultrices. Etiam et pretium elit. Suspendisse potenti. Proin scelerisque convallis purus, at viverra massa fermentum a. Curabitur nunc orci, accumsan sodales massa a, dignissim luctus lorem. Praesent tincidunt augue eget tempus auctor.</p>
44
-
45
- <p>Nam rhoncus tincidunt lorem, ac vehicula mauris luctus sit amet. Donec bibendum semper ex, quis condimentum eros elementum id. Morbi id commodo libero, id euismod ipsum. Nullam ante tellus, dapibus ut accumsan ac, pellentesque ut turpis. Quisque ligula nisi, pulvinar id urna id, aliquam laoreet enim. Fusce nec lorem malesuada, dapibus ipsum vel, rhoncus odio. Cras risus tortor, laoreet at odio ac, eleifend rutrum sapien. Sed scelerisque, urna ac iaculis condimentum, odio elit consequat leo, vitae ultricies mi felis eu nibh. Fusce condimentum id diam quis bibendum. Aliquam eget auctor nisi. Suspendisse eleifend sit amet libero at gravida. Cras libero enim, vulputate a nunc non, vulputate bibendum tellus.</p>
46
- </div>
47
-
48
- <style>
49
- form {
50
- background-color: white;
51
- padding: 10px;
52
- border-radius: 5px;
53
- }
54
- .content {
55
- font-size: 18px;
56
- line-height: 2;
57
- }
58
- </style>
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom';
@@ -1,34 +0,0 @@
1
- <script lang="ts">
2
- import PopupMenu from '../../components/PopupMenu.svelte'
3
- let button: HTMLElement
4
-
5
- export let items = [
6
- { value: '0', label: 'Sunday', disabled: true },
7
- { value: '1', label: 'Monday' },
8
- { value: '2', label: 'Tuesday' },
9
- { value: '3', label: 'Wednesday' },
10
- { value: '4', label: 'Thursday', disabled: true },
11
- { value: '5', label: 'Friday' },
12
- { value: '6', label: 'Saturday', disabled: true }
13
- ]
14
- </script>
15
-
16
- <div class="topspacer"></div>
17
- <div class="container">
18
- <div class="container">
19
- <button data-testid="button" class="ui gold button" bind:this={button}>Popup Menu</button>
20
- </div>
21
- <div class="topspacer"></div>
22
- <div class="container">
23
- <PopupMenu buttonelement={button} {items}></PopupMenu>
24
- </div>
25
- </div>
26
-
27
- <style>
28
- .topspacer {
29
- height: 20px;
30
- }
31
- .container {
32
- position: relative;
33
- }
34
- </style>
@@ -1,36 +0,0 @@
1
- <script lang="ts">
2
- import PopupMenu from '../../components/PopupMenu.svelte'
3
- let button: HTMLElement
4
-
5
- export let items = [
6
- { value: '0', label: 'Sunday', disabled: true },
7
- { value: '1', label: 'Monday' },
8
- { value: '2', label: 'Tuesday' },
9
- { value: '3', label: 'Wednesday' },
10
- { value: '4', label: 'Thursday', disabled: true },
11
- { value: '5', label: 'Friday' },
12
- { value: '6', label: 'Saturday', disabled: true }
13
- ]
14
- </script>
15
-
16
- <div class="topspacer"></div>
17
- <div class="container">
18
- <div class="ui gold button" bind:this={button}>
19
- Popup Menu
20
- <PopupMenu buttonelement={button} {items}></PopupMenu>
21
- </div>
22
- </div>
23
-
24
- <style>
25
- .topspacer {
26
- height: 20px;
27
- }
28
- .container {
29
- margin-left: 12px;
30
- }
31
- .button {
32
- position: relative;
33
- margin-left: 12px;
34
- width: 210px;
35
- }
36
- </style>
@@ -1,34 +0,0 @@
1
- <script lang="ts">
2
- import PopupMenu from '../../components/PopupMenu.svelte'
3
- let button: HTMLElement
4
-
5
- export let items = [
6
- { value: '0', label: 'Sunday', disabled: true },
7
- { value: '1', label: 'Monday' },
8
- { value: '2', label: 'Tuesday' },
9
- { value: '3', label: 'Wednesday' },
10
- { value: '4', label: 'Thursday', disabled: true },
11
- { value: '5', label: 'Friday' },
12
- { value: '6', label: 'Saturday', disabled: true }
13
- ]
14
- </script>
15
-
16
- <div class="topspacer"></div>
17
- <div class="container">
18
- <div class="container">
19
- <button data-testid="button" class="ui gold button" bind:this={button}>Popup Menu</button>
20
- </div>
21
- <div class="topspacer"></div>
22
- <div class="container">
23
- <PopupMenu usePortal buttonelement={button} {items}></PopupMenu>
24
- </div>
25
- </div>
26
-
27
- <style>
28
- .topspacer {
29
- height: 20px;
30
- }
31
- .container {
32
- position: relative;
33
- }
34
- </style>
@@ -1,36 +0,0 @@
1
- <script lang="ts">
2
- import { hashify } from 'txstate-utils'
3
- import PopupMenu from '../../components/PopupMenu.svelte'
4
-
5
- export let showSelected = false
6
- export let items = [
7
- { value: '0', label: 'Sunday', disabled: true },
8
- { value: '1', label: 'Monday' },
9
- { value: '2', label: 'Tuesday' },
10
- { value: '3', label: 'Wednesday' },
11
- { value: '4', label: 'Thursday', disabled: true },
12
- { value: '5', label: 'Friday' },
13
- { value: '6', label: 'Saturday', disabled: true }
14
- ]
15
-
16
- let button: HTMLElement
17
- let value: string
18
- $: itemsByValue = hashify(items, 'value')
19
- $: selected = itemsByValue[value]
20
- </script>
21
-
22
- <div class="topspacer"></div>
23
- <div class="container">
24
- <button data-testid="button" class="ui gold button" bind:this={button}>Popup Menu</button>
25
- <div>selected: {#if selected}{selected.value}, {selected.label}{:else}none{/if}</div>
26
- <PopupMenu bind:value buttonelement={button} {items} {showSelected}></PopupMenu>
27
- </div>
28
-
29
- <style>
30
- .topspacer {
31
- height: 20px;
32
- }
33
- .container {
34
- position: relative;
35
- }
36
- </style>
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- export * from './CollapsingTable';
2
- export * from './PopupMenu';
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=CollapsingTable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CollapsingTable.js","sourceRoot":"","sources":["../../src/types/CollapsingTable.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=PopupMenu.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PopupMenu.js","sourceRoot":"","sources":["../../src/types/PopupMenu.ts"],"names":[],"mappings":""}
@@ -1,15 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./CollapsingTable"), exports);
14
- __exportStar(require("./PopupMenu"), exports);
15
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiC;AACjC,8CAA2B"}
@@ -1,79 +0,0 @@
1
- # Collapsing Table
2
-
3
- This component is meant to help make tables responsive by eliminating columns (from the right) as the screen width reduces. When there are hidden columns, the last column header becomes a dropdown button allowing the selection of another column to be displayed instead.
4
-
5
- # Usage
6
-
7
- The only required prop is an `items` array of objects. Column headers will automatically be detected from object keys if no column configuration is present.
8
-
9
- ## Column Configuration
10
-
11
- A `config` prop allows you to pass an array of column definitions. If passed, only these columns will appear, other keys in your `items` objects will be ignored.
12
-
13
- ### Variables accepted for each column
14
-
15
- * `key: string` corresponds to object key in your `items` objects
16
- * `title?: string` a display name for this column's header
17
- * `width?: number` a guess at how wide in pixels this column will be; helps decide when to hide
18
- columns, default 150
19
- * `neverhide?: boolean`<br>
20
- setting to make sure this column is never hidden; good to set on
21
- the column that is most identifying for each row, like a name.
22
- by default the leftmost column will stick around as identifying
23
- * `bodyCellClass?: string` CSS class to set on `td` elements in the body area
24
- * `headerCellClass?: string` CSS class to set on `td` elements in the header row
25
-
26
- ## Optional Props
27
- * `tableClass` CSS class for the `table`
28
- * `bodyRowClass` CSS class for `tr` in the body area
29
- * `bodyCellClass` CSS class for `td` in the body area, additional to the one set in column config
30
- * `headerRowClass` CSS class for `tr` on the header row
31
- * `headerCellClass` CSS class for `th` in the header row, additional to the one set in column config
32
- * `menuClass` CSS class for the `ul` dropdown menu
33
- * `menuItemClass` CSS class for `li` in the dropdown menu
34
- * `menuItemHilitedClass` CSS class for `li` in the dropdown menu when they are currently hilited/active
35
- * `defaultCellWidth`, guess for any column width in pixels, allows you to hide columns earlier/later, default 150
36
-
37
- ## Slots
38
- Lots of slots are provided for extra configuration.
39
-
40
- ### Default Slot
41
- The default slot is used for each table cell in the body area. It is optional and falls back to {value}.
42
- Because of the way slots work, your slot content will be executed in every cell. So if you need to do
43
- something special for just one cell, you have to use an if/else block to identify the special cell,
44
- falling back to {value} for everything else:
45
- ```svelte
46
- <CollapsingTable items={myItems} let:item let:key let:value>
47
- {#if key === 'myspecialkey'}
48
- <MySpecialComponent>{value}</MySpecialComponent>
49
- {:else}
50
- {value}
51
- {/if}
52
- </CollapsingTable>
53
- ```
54
- The slot props are `item`, `key`, and `value`.
55
- ### Header Cell Slot
56
- A slot named `headercell` allows you to do the same thing for cells in the header row that the
57
- default slot allows for body cells.
58
- ```svelte
59
- <CollapsingTable items={myItems} let:column let:key let:title>
60
- <div slot="headercell">
61
- {#if key === 'myspecialkey'}
62
- <MySpecialComponent>{title}</MySpecialComponent>
63
- {:else}
64
- {title}
65
- {/if}
66
- </div>
67
- </CollapsingTable>
68
- ```
69
- The slot props are `column`, `key`, and `title`. `column` is the configuration object for the
70
- current column, `title` is `column.title || column.key`. The title/key will be used as fallback
71
- content if you do not specify a header slot.
72
- ### Dropdown Icon Slot
73
- A slot is provided for you to provide a custom icon for the column header that is serving as the
74
- dropdown button.
75
- ```svelte
76
- <CollapsingTable items={myItems}>
77
- <i type='fa caret-down' slot="dropicon" aria-hidden="true"></i>
78
- </CollapsingTable>
79
- ```
@@ -1,35 +0,0 @@
1
- # Conditional Wrapper
2
- Sometimes you want to wrap a complex bit of HTML in a certain element based on a condition,
3
- and not wrap it at all if the condition isn't met. Without help, this situation results in a
4
- lot of duplicate code because you have to have an if/else block outside the whole thing, and
5
- the complex HTML goes in both branches:
6
- ```svelte
7
- {#if shouldwrap}
8
- <div class="wrapper">
9
- ... a whole bunch of html ...
10
- </div>
11
- {:else}
12
- ... a whole bunch of html, again ...
13
- {/if}
14
- ```
15
- With this component, you can de-duplicate like this:
16
- ```svelte
17
- <ConditionalWrapper class="wrapper" condition={shouldwrap}>
18
- ... a whole bunch of html ...
19
- </ConditionalWrapper>
20
- ```
21
- Any props you provide (except the ConditionalWrapper props like `condition`) will pass through
22
- to the wrapper element/component, if it gets inserted.
23
-
24
- ## Props
25
- * `condition: boolean|undefined` (required) - Whether or not to wrap the element. Accepts `undefined`
26
- for convenience when evaluating presence of an optional variable.
27
- * `component?: SvelteComponent` (optional) - The wrapper will be a svelte component instead of a DOM
28
- element. Props all get passed through.
29
- * `a: boolean` (optional) - The wrapper will be a link element.
30
- * `span: boolean` (optional) - The wrapper will be a span element.
31
- * `element?: HTMLElement` (for binding) - If the wrapper is a DOM element, bind this prop to get a
32
- reference to wrapper element (if it exists). If the wrapper is a svelte component, this will be
33
- passed to it as a prop so that the wrapper component can bind it to a DOM element.
34
-
35
- If none of `a`, `span`, or `component` props are specified, the default is to create a `div` wrapper.
package/docs/Modal.md DELETED
@@ -1,63 +0,0 @@
1
- # Modal
2
- The Modal component is designed to block out the screen and focus the user on the content inside the Modal.
3
-
4
- It provides only the backdrop and a scrollable container for your content. If your content should have a background color, be sure to add it yourself.
5
-
6
- Any time the Modal is in the DOM, it will take over the screen. You make it go away by removing it from the DOM.
7
-
8
- ## Example Usage
9
- ```svelte
10
- <script>
11
- let showMyModal = false
12
- </script>
13
- <button on:click={() => showMyModal = true}>Show Modal</button>
14
- {#if showMyModal}
15
- <Modal on:escape={() => showMyModal = false}>
16
- This is a modal dialog!
17
- </Modal>
18
- {/if}
19
- <style>
20
- :global(.modal-container) { background: white; }
21
- </style>
22
- ```
23
- ## Custom Events
24
- * `on:escape` - dispatched when the user does something that would normally dismiss a modal, such as clicking in the darkened backdrop or pressing the Escape key. You should listen for this and dismiss your modal. If you do not listen for this event, users will only be able to escape by some other means provided within your content. Be careful not to trap them!
25
-
26
- ## Props
27
- * `opaque: boolean` (default `false`) - Make the backdrop completely opaque so that it cannot be seen through. This is a more jarring experience for users but sometimes you don't want background content to be visible at all.
28
- * `containerClass: string` (default `''`) - A class to be added to the scrollable container inside the backdrop. This container will always have the `.modal-container` class regardless of this prop.
29
- * `escapable: boolean` (default `true`) - Let screen readers know that they can escape the modal by pressing the Escape key. If you are not listening for `on:escape` then you should set this `false` to avoid giving screen reader users false information.
30
- * `hidefocus: boolean` (default `true`) - Focus must be moved to the modal when it opens, in order to maintain accessibility. This component avoids making the focus visible to users by default as it might be visually disconcerting. So on mount, focus is moved to an invisible element above your content. If you prefer focus to be visible to users, set this to `false` and focus will automatically be moved to the first element in your content that has a tabindex and therefore be visible to users. This prop is overridden if you provide an `initialfocus`.
31
- * `hidefocuslabel: string` (default `focus is above modal dialog, start tabbing`) - The message that will be read out to users using a screen reader when the focus is on the invisible element created by the `hidefocus` prop.
32
- * `initialfocus: string` (default `undefined`) - A selector to be used to locate and set focus on an element in your content, on mount. Use if you want focus on a specific element when the modal opens. Overrides `hidefocus`.
33
- * `returnfocusto: HTMLElement` (default element that had focus was when modal opened) - Use to control where focus moves when the modal closes. If not provided, component automatically saves the element that had focus on mount. Usually it's the button that triggered the modal.
34
-
35
- # FocusLock
36
- The FocusLock component is for creating accessible modal dialogs that do not have a darkened backdrop. It shares many props and behaviors with Modal because the Modal component uses a FocusLock itself.
37
-
38
- Any time the FocusLock is in the DOM, it will lock screen readers inside it. You release them by removing it from the DOM. Regular users are NOT trapped and may interact with other screen elements. When they do, the `escape` event will be fired, allowing you to remove the dialog.
39
-
40
- FocusLocks can be nested. The user will be trapped inside the deepest FocusLock present in the DOM. When it goes away, they'll be trapped inside the previous FocusLock, and so on.
41
-
42
- ## Custom Events
43
- * `on:escape` - dispatched when the user does something to dismiss the dialog, such as pressing the Escape key or clicking outside the dialog area. You should listen for this and remove the FocusLock. If you do not listen for this event, users will only be able to escape by some other means provided within your content. Be careful not to trap them!
44
-
45
- ## Example Usage
46
- ```svelte
47
- <script>
48
- let showMyDialog = false
49
- </script>
50
- <button on:click={() => showMyDialog = true}>Show Dialog</button>
51
- {#if showMyDialog}
52
- <FocusLock on:escape={() => showMyDialog = false}>
53
- Screen readers cannot escape this!
54
- <button on:click={() => showMyDialog = false}>Collapse Dialog</button>
55
- </FocusLock>
56
- {/if}
57
- ```
58
- ## Props
59
- * `escapable: boolean` (default `true`) - Controls whether the focus lock can be easily escaped by pressing the Escape key or clicking the invisible focus (see `hidefocus`). If you set this `false` you must provide a way to dismiss the lock inside your content or screen readers will be trapped.
60
- * `hidefocus: boolean` (default `true`) - Focus must be moved to the modal when it opens, in order to maintain accessibility. This component avoids making the focus visible to users by default as it might be visually disconcerting. So on mount, focus is moved to an invisible element above your content. If you prefer focus to be visible to users, set this to `false` and focus will automatically be moved to the first element in your content that has a tabindex and therefore be visible to users. This prop is overridden if you provide an `initialfocus`.
61
- * `hidefocuslabel: string` (default `focus is above modal dialog, start tabbing`) - The message that will be read out to users using a screen reader when the focus is on the invisible element created by the `hidefocus` prop.
62
- * `initialfocus: string` (default `undefined`) - A selector to be used to locate and set focus on an element in your content, on mount. Use if you want focus on a specific element when the lock mounts. Overrides `hidefocus`.
63
- * `returnfocusto: HTMLElement` (default element that had focus was when focuslock mounted) - Use to control where focus moves when the lock ends. If not provided, component automatically saves the element that had focus on mount. Usually it's the button that triggered the dialog.
package/docs/PopupMenu.md DELETED
@@ -1,31 +0,0 @@
1
- # PopupMenu
2
-
3
- This component is meant to display a menu of options to the user, activated by clicking
4
- any element. It can also be controlled from the parent, by binding the `menushown` boolean.
5
-
6
- ## Props
7
- * `buttonelement: HTMLElement` (required) - The DOM element that will act as the "button" for this menu. The menu will be placed next to the button and be controlled by the button. Keyboard access will be enabled when the button has focus. This component adds all appropriate attributes (tabindex, roles, and aria) automatically.
8
- * `items: PopupMenuItem[]` (required) - The list of menu items to be shown. Parent may change this at any time based on user activity.
9
- * `menushown?: boolean` (default `false`) - Bind this prop to track/change the visible state of the menu from the parent.
10
- * `value?: string` (default no selection) - Bind this prop to track/change the currently selected value from the parent.
11
- * `align?: GlueAlignOpts` (default `auto`) - Control where the menu will appear. Default is to use the current viewport to make a decision to maximize potential for menu growth.
12
- * `cover?: boolean` (default `false`) - When the menu is active, should it cover the button or be rendered above/below it?
13
- * `showSelected?: boolean` (default `true`) - When an item is currently selected, should it appear in the menu (with a visual indicator), or simply be removed from the list (showSelected: `false`)?
14
- * `width?: string` (default `undefined`) - When defined, this width will be passed through to the menu's CSS width. Use a valid CSS dimension such as `33em` or `159px`. Generally this will be used when you need to match the menu width to something else, like the button. If the width is static like `100%` a simple CSS rule is likely more efficient.
15
- * `computedalign: readable<{ valign: 'top'|'bottom', halign: 'left'|'right' }>` (default store is provided) - Bind this prop to receive a store that is updated each time a menu placement decision is made. Example of when this is useful is when you are trying to round corners of your button and need to know whether the menu is above or below your button so you know which corners to round and which to leave square. Note that the values do not update when the menu is hidden, so you may need to rely on `menushown` as well.
16
- * `usePortal?: HTMLElement|true` (default `false`) - If the menu would be clipped by an `overflow: hidden`, you can set this prop and it will be placed in the specified container, or the `document.body` if you simply say `true`. Placement will still be calculated correctly, unless there are scrolling containers between the button and the menu.
17
- * `emptyText?: string` (default `¯\_(ツ)_/¯`) - When there are no items (e.g. it's a filtered search and there were no results), we still display one disabled item in the menu to let the user know what is going on. Use this prop to specify the message.
18
- * `menuContainerClass?: string` (default `''`) - CSS class to pass through so you can do extra styling work
19
- * `menuClass?: string` (default `''`) - CSS class to pass through so you can do extra styling work
20
- * `menuItemClass?: string` (default `''`) - CSS class to pass through so you can do extra styling work
21
- * `menuItemHilitedClass?: string` (default `''`) - CSS class to pass through so you can do extra styling work
22
- * `menuItemSelectedClass?: string` (default `''`) - CSS class to pass through so you can do extra styling work
23
-
24
- ## Events
25
- * `on:change` - Dispatched any time a new value is selected. Does not fire when you change the `value` property from the outside. Event detail will be the full PopupMenuItem object that was selected.
26
-
27
- ## Types
28
- * `PopupMenuItem: { value: string, label?: string, disabled?: boolean }` - Each item must have a unique non-empty value. Display label is optional, as is a `disabled` status that will show the item in the list but not allow users to hilite or select it.
29
-
30
- ## Disabling
31
- Since there are so many different possibilities for the button you attach to, the PopupMenu does not have a `disabled` prop. If the PopupMenu should be disabled, simply remove it from the DOM with an `{#if}` block. Remember to also set `aria-disabled` on your button and likely provide some visual indicators like `cursor: default` or the `disabled` attribute on elements that support it.
@@ -1,10 +0,0 @@
1
- # ScreenReaderOnly
2
- This component is for adding text that can be read to screen readers while remaining
3
- invisible to regular users. It accepts `arialive` and `ariaatomic` props to pass through to
4
- the corresponding HTML attributes. It also accepts an `id` prop in case you need to
5
- point at it with an aria-describedby attribute on some other element.
6
-
7
- Using this component is often better than using aria-label because aria-label still has poor support
8
- and sometimes is not good enough to make WAVE happy with an empty icon-link. It's also a
9
- good way to add additional text when sighted users have a little text already, e.g. to add
10
- interactivity instructions.
package/docs/actions.md DELETED
@@ -1,84 +0,0 @@
1
- # Actions
2
-
3
- ## use:buttonify
4
- This action turns any HTML element into an accessible button that responds to keyboard events and has
5
- role="button" and the tabindex attribute set. You are still responsible for making sure it has
6
- readable content or a good label. Does NOT change styling at all.
7
- ```svelte
8
- <div use:buttonify on:click={onClick}>You can tab to me and click me with the Enter key</div>
9
- ```
10
-
11
- ## use:glue
12
- This action glues the element it is placed on to the target specified, with a specified alignment
13
- option. It is most useful for dropdown or autocomplete menus.
14
-
15
- The element should have `position: absolute` on it already. It is not moved to a new place in the DOM,
16
- it just gets `top`/`left`/`bottom`/`right` properties set.
17
-
18
- If you have problems with the glued element being clipped by a parent with `overflow: hidden`, you
19
- may combine it with the `use:portal` action to move it somewhere else; `use:glue` will recalculate
20
- for the new location.
21
-
22
- If you do not specify an `align` setting, the default is `auto`, which will evaluate the current
23
- viewport and determine which alignment gives the glued element the most space to grow.
24
- ```svelte
25
- <button bind:this={menubutton}>Activate Menu</button>
26
- <ul use:glue={{ target: menubutton, align: 'bottomright' }}>
27
- <li>Menu Item 1</li>
28
- <li>Menu Item 2</li>
29
- </ul>
30
- ```
31
-
32
- ## use:offset
33
- This action allows you to observe any DOM element's position in the body. You pass in a svelte store
34
- and it will be updated when the element moves.
35
-
36
- Another configuration option is `debounce: number`, which will debounce the updates for the specified
37
- number of milliseconds. Use this option if you will make a complicated calculation after each update and do not
38
- want to perform the calculation multiple times during a single animation or while the user is resizing
39
- their viewport/window. It will defer the updates until the animation or resizing stops for at least `debounce`
40
- milliseconds.
41
- ```svelte
42
- <script>
43
- const offset = writable({ top: 0, left: 0, bottom: 0, right: 0 })
44
- </script>
45
- <div use:offset={{ store: offset }}>distance between me and body top is {$offset.top}</div>
46
- ```
47
-
48
- ## use:portal
49
- This action allows you to move an element to a new place in the DOM upon mount. It's useful when your component
50
- is sensitive to getting clipped by parents with overflow: hidden or for anything like a modal or toast message
51
- that needs to be positioned relative to the body, but created within a smaller component, like a web form.
52
-
53
- For convenience, the default is to move it to `document.body` when you `use:portal` without any config:
54
- ```svelte
55
- <div use:portal>I'm in the body now!</div>
56
- ```
57
- If you are accepting an optional target as a prop, this may cause unexpected behavior where your parent component
58
- declines to pass a portal target, but your element ends up in `document.body`. To prevent this, you may pass `null`
59
- instead of `undefined`, and the element will stay where it was before the change to `null`:
60
- ```svelte
61
- <script>
62
- export let portaltarget = undefined
63
- </script>
64
- <div use:portal={portaltarget || null}></div>
65
- ```
66
-
67
- ## use:resize
68
- This action allows you to observe an element's width and height with the `ResizeObserver`. Svelte has a built-in
69
- `bind:clientWidth` functionality, but it works by inserting an invisible iframe into the DOM for each observation,
70
- which is a little ugly and potentially slow.
71
-
72
- You pass in a svelte store and it will be updated when the element's size changes.
73
-
74
- Another configuration option is `debounce: number`, which will debounce the updates for the specified
75
- number of milliseconds. Use this option if you will make a complicated calculation after each update and do not
76
- want to perform the calculation multiple times during a single animation or while the user is resizing
77
- their viewport/window. It will defer the updates until the animation or resizing stops for at least `debounce`
78
- milliseconds.
79
- ```svelte
80
- <script>
81
- const size = writable({ clientWidth: 100, clientHeight: 100, offsetWidth: 100, offsetHeight: 100 })
82
- </script>
83
- <div use:offset={{ store: size }}>My dimensions are {$size.offsetWidth}x{$size.offsetHeight}</div>
84
- ```