@lmfaole/basics 0.2.1 → 0.3.0

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.
@@ -8,7 +8,6 @@ const DEFAULT_LABEL = "Faner";
8
8
  const DEFAULT_ACTIVATION = "automatic";
9
9
  const DEFAULT_ORIENTATION = "horizontal";
10
10
  const MANUAL_ACTIVATION = "manual";
11
- const VERTICAL_ORIENTATION = "vertical";
12
11
  const TABLIST_SELECTOR = "[data-tabs-list]";
13
12
  const TAB_SELECTOR = "[data-tab]";
14
13
  const PANEL_SELECTOR = "[data-tab-panel]";
@@ -16,9 +15,7 @@ const PANEL_SELECTOR = "[data-tab-panel]";
16
15
  let nextTabsInstanceId = 1;
17
16
 
18
17
  export function normalizeTabsOrientation(value) {
19
- return value?.trim().toLowerCase() === VERTICAL_ORIENTATION
20
- ? VERTICAL_ORIENTATION
21
- : DEFAULT_ORIENTATION;
18
+ return DEFAULT_ORIENTATION;
22
19
  }
23
20
 
24
21
  export function normalizeTabsActivation(value) {
@@ -98,7 +95,6 @@ export class TabsElement extends HTMLElementBase {
98
95
  static observedAttributes = [
99
96
  "data-activation",
100
97
  "data-label",
101
- "data-orientation",
102
98
  "data-selected-index",
103
99
  ];
104
100
 
@@ -168,7 +164,6 @@ export class TabsElement extends HTMLElementBase {
168
164
  const tabStates = this.#getTabStates();
169
165
  const currentIndex = this.#tabs.indexOf(currentTab);
170
166
  const activation = this.#getActivation();
171
- const orientation = this.#getOrientation();
172
167
  let nextIndex = -1;
173
168
 
174
169
  if (currentIndex === -1 || currentIndex >= tabStates.length) {
@@ -177,24 +172,10 @@ export class TabsElement extends HTMLElementBase {
177
172
 
178
173
  switch (event.key) {
179
174
  case "ArrowRight":
180
- if (orientation === DEFAULT_ORIENTATION) {
181
- nextIndex = findNextEnabledTabIndex(tabStates, currentIndex, 1);
182
- }
175
+ nextIndex = findNextEnabledTabIndex(tabStates, currentIndex, 1);
183
176
  break;
184
177
  case "ArrowLeft":
185
- if (orientation === DEFAULT_ORIENTATION) {
186
- nextIndex = findNextEnabledTabIndex(tabStates, currentIndex, -1);
187
- }
188
- break;
189
- case "ArrowDown":
190
- if (orientation === VERTICAL_ORIENTATION) {
191
- nextIndex = findNextEnabledTabIndex(tabStates, currentIndex, 1);
192
- }
193
- break;
194
- case "ArrowUp":
195
- if (orientation === VERTICAL_ORIENTATION) {
196
- nextIndex = findNextEnabledTabIndex(tabStates, currentIndex, -1);
197
- }
178
+ nextIndex = findNextEnabledTabIndex(tabStates, currentIndex, -1);
198
179
  break;
199
180
  case "Home":
200
181
  nextIndex = findFirstEnabledTabIndex(tabStates);
@@ -252,12 +233,6 @@ export class TabsElement extends HTMLElementBase {
252
233
  return this.getAttribute("data-label")?.trim() || DEFAULT_LABEL;
253
234
  }
254
235
 
255
- #getOrientation() {
256
- return normalizeTabsOrientation(
257
- this.getAttribute("data-orientation") ?? this.#tabList?.getAttribute("aria-orientation"),
258
- );
259
- }
260
-
261
236
  #getTabStates(configuredSelectedIndex = null) {
262
237
  const pairCount = Math.min(this.#tabs.length, this.#panels.length);
263
238
 
@@ -296,7 +271,6 @@ export class TabsElement extends HTMLElementBase {
296
271
  return;
297
272
  }
298
273
 
299
- const orientation = this.#getOrientation();
300
274
  const pairCount = Math.min(this.#tabs.length, this.#panels.length);
301
275
  const baseId = this.id || this.#instanceId;
302
276
 
@@ -305,7 +279,7 @@ export class TabsElement extends HTMLElementBase {
305
279
  }
306
280
 
307
281
  this.#tabList.setAttribute("role", "tablist");
308
- this.#tabList.setAttribute("aria-orientation", orientation);
282
+ this.#tabList.setAttribute("aria-orientation", DEFAULT_ORIENTATION);
309
283
 
310
284
  for (let index = 0; index < this.#tabs.length; index += 1) {
311
285
  const tab = this.#tabs[index];
package/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export * from "./components/basic-accordion";
2
2
  export * from "./components/basic-dialog";
3
3
  export * from "./components/basic-popover";
4
+ export * from "./components/basic-summary-table";
5
+ export * from "./components/basic-table";
4
6
  export * from "./components/basic-toc";
5
7
  export * from "./components/basic-tabs";
package/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  export * from "./components/basic-accordion/index.js";
2
2
  export * from "./components/basic-dialog/index.js";
3
3
  export * from "./components/basic-popover/index.js";
4
+ export * from "./components/basic-summary-table/index.js";
5
+ export * from "./components/basic-table/index.js";
4
6
  export * from "./components/basic-toc/index.js";
5
7
  export * from "./components/basic-tabs/index.js";
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@lmfaole/basics",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Simple unstyled custom elements and DOM helpers.",
5
5
  "type": "module",
6
6
  "sideEffects": [
7
7
  "./components/basic-accordion/register.js",
8
8
  "./components/basic-dialog/register.js",
9
9
  "./components/basic-popover/register.js",
10
+ "./components/basic-summary-table/register.js",
11
+ "./components/basic-table/register.js",
10
12
  "./components/basic-toc/register.js",
11
13
  "./components/basic-tabs/register.js"
12
14
  ],
@@ -39,6 +41,22 @@
39
41
  "types": "./components/basic-popover/register.d.ts",
40
42
  "import": "./components/basic-popover/register.js"
41
43
  },
44
+ "./components/basic-summary-table": {
45
+ "types": "./components/basic-summary-table/index.d.ts",
46
+ "import": "./components/basic-summary-table/index.js"
47
+ },
48
+ "./components/basic-summary-table/register": {
49
+ "types": "./components/basic-summary-table/register.d.ts",
50
+ "import": "./components/basic-summary-table/register.js"
51
+ },
52
+ "./components/basic-table": {
53
+ "types": "./components/basic-table/index.d.ts",
54
+ "import": "./components/basic-table/index.js"
55
+ },
56
+ "./components/basic-table/register": {
57
+ "types": "./components/basic-table/register.d.ts",
58
+ "import": "./components/basic-table/register.js"
59
+ },
42
60
  "./components/basic-toc": {
43
61
  "types": "./components/basic-toc/index.d.ts",
44
62
  "import": "./components/basic-toc/index.js"
@@ -69,14 +87,18 @@
69
87
  "accordion",
70
88
  "custom-element",
71
89
  "dialog",
90
+ "basic-summary-table",
72
91
  "basic-tabs",
92
+ "basic-table",
73
93
  "basic-toc",
74
94
  "modal",
75
95
  "popover",
76
96
  "overlay",
77
97
  "table-of-contents",
98
+ "summary-table",
78
99
  "tabs",
79
100
  "tablist",
101
+ "table",
80
102
  "toc",
81
103
  "unstyled",
82
104
  "vanilla-js",
package/readme.mdx CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Markdown, Meta } from "@storybook/addon-docs/blocks";
2
2
  import Readme from "./README.md?raw";
3
3
 
4
- <Meta title="Readme" />
4
+ <Meta title="Overview/Readme" />
5
5
 
6
6
  <Markdown>{Readme}</Markdown>