@nuralyui/tabs 0.0.13 → 0.0.16

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/index.d.ts CHANGED
@@ -1,2 +1,9 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: MIT
5
+ */
1
6
  export * from './tabs.component.js';
7
+ export * from './tabs.types.js';
8
+ export { NrTabsElement as TabsComponent } from './tabs.component.js';
2
9
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -1,2 +1,10 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: MIT
5
+ */
1
6
  export * from './tabs.component.js';
7
+ export * from './tabs.types.js';
8
+ // For backward compatibility - will be removed in next major version
9
+ export { NrTabsElement as TabsComponent } from './tabs.component.js';
2
10
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/tabs/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './tabs.component.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/tabs/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAEhC,qEAAqE;AACrE,OAAO,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2023 Nuraly, Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nexport * from './tabs.component.js';\nexport * from './tabs.types.js';\n\n// For backward compatibility - will be removed in next major version\nexport { NrTabsElement as TabsComponent } from './tabs.component.js';\n"]}
package/package.json CHANGED
@@ -1,12 +1,40 @@
1
1
  {
2
2
  "name": "@nuralyui/tabs",
3
- "version": "0.0.13",
4
- "description": "",
3
+ "version": "0.0.16",
4
+ "description": "Versatile tabs component with support for multiple orientations, editable tabs, and drag & drop functionality",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "test": "echo \"Error: no test specified\" && exit 1"
9
9
  },
10
+ "keywords": [
11
+ "tabs",
12
+ "web-components",
13
+ "lit-element",
14
+ "typescript",
15
+ "drag-drop",
16
+ "editable",
17
+ "accessibility"
18
+ ],
10
19
  "author": "Labidi Aymen",
11
- "license": "ISC"
20
+ "license": "MIT",
21
+ "exports": {
22
+ ".": {
23
+ "import": "./index.js"
24
+ },
25
+ "./bundle": {
26
+ "import": "./bundle.js"
27
+ },
28
+ "./react": {
29
+ "import": "./react.js"
30
+ }
31
+ },
32
+ "files": [
33
+ "bundle.js",
34
+ "*.js",
35
+ "*.d.ts",
36
+ "*.js.map",
37
+ "react.js",
38
+ "react.d.ts"
39
+ ]
12
40
  }
package/react.d.ts CHANGED
@@ -1,9 +1,50 @@
1
- import { TabsComponent } from './tabs.component.js';
2
- export declare const HyTabsComponent: import("@lit-labs/react").ReactWebComponent<TabsComponent, {
3
- removeTab: string;
4
- tabEdited: string;
5
- tabTilteClick: string;
6
- tabOrderChange: string;
7
- addTab: string;
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ import { NrTabsElement } from './tabs.component.js';
7
+ /**
8
+ * React wrapper for the nr-tabs component.
9
+ *
10
+ * @example
11
+ * ```jsx
12
+ * import { NrTabs } from '@nuralyui/tabs/react';
13
+ *
14
+ * const tabs = [
15
+ * { label: 'Tab 1', content: <div>Content 1</div> },
16
+ * { label: 'Tab 2', content: <div>Content 2</div> }
17
+ * ];
18
+ *
19
+ * function MyComponent() {
20
+ * return (
21
+ * <NrTabs
22
+ * tabs={tabs}
23
+ * activeTab={0}
24
+ * orientation="horizontal"
25
+ * onNrTabClick={(e) => console.log('Tab clicked:', e.detail)}
26
+ * />
27
+ * );
28
+ * }
29
+ * ```
30
+ */
31
+ export declare const NrTabs: import("@lit-labs/react").ReactWebComponent<NrTabsElement, {
32
+ onNrTabClick: string;
33
+ onNrTabChange: string;
34
+ onNrTabAdd: string;
35
+ onNrTabRemove: string;
36
+ onNrTabEdit: string;
37
+ onNrTabOrderChange: string;
38
+ }>;
39
+ /**
40
+ * @deprecated Use NrTabs instead. Will be removed in next major version.
41
+ */
42
+ export declare const HyTabsComponent: import("@lit-labs/react").ReactWebComponent<NrTabsElement, {
43
+ onNrTabClick: string;
44
+ onNrTabChange: string;
45
+ onNrTabAdd: string;
46
+ onNrTabRemove: string;
47
+ onNrTabEdit: string;
48
+ onNrTabOrderChange: string;
8
49
  }>;
9
50
  //# sourceMappingURL=react.d.ts.map
package/react.js CHANGED
@@ -1,16 +1,50 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: MIT
5
+ */
1
6
  import { createComponent } from '@lit-labs/react';
2
7
  import * as React from 'react';
3
- import { TabsComponent } from './tabs.component.js';
4
- export const HyTabsComponent = createComponent({
5
- tagName: 'hy-tabs',
6
- elementClass: TabsComponent,
8
+ import { NrTabsElement } from './tabs.component.js';
9
+ /**
10
+ * React wrapper for the nr-tabs component.
11
+ *
12
+ * @example
13
+ * ```jsx
14
+ * import { NrTabs } from '@nuralyui/tabs/react';
15
+ *
16
+ * const tabs = [
17
+ * { label: 'Tab 1', content: <div>Content 1</div> },
18
+ * { label: 'Tab 2', content: <div>Content 2</div> }
19
+ * ];
20
+ *
21
+ * function MyComponent() {
22
+ * return (
23
+ * <NrTabs
24
+ * tabs={tabs}
25
+ * activeTab={0}
26
+ * orientation="horizontal"
27
+ * onNrTabClick={(e) => console.log('Tab clicked:', e.detail)}
28
+ * />
29
+ * );
30
+ * }
31
+ * ```
32
+ */
33
+ export const NrTabs = createComponent({
34
+ tagName: 'nr-tabs',
35
+ elementClass: NrTabsElement,
7
36
  react: React,
8
37
  events: {
9
- removeTab: 'removeTab',
10
- tabEdited: 'tabEdited',
11
- tabTilteClick: 'tabTilteClick',
12
- tabOrderChange: 'tabOrderChange',
13
- addTab: 'addTab',
38
+ onNrTabClick: 'nr-tab-click',
39
+ onNrTabChange: 'nr-tab-change',
40
+ onNrTabAdd: 'nr-tab-add',
41
+ onNrTabRemove: 'nr-tab-remove',
42
+ onNrTabEdit: 'nr-tab-edit',
43
+ onNrTabOrderChange: 'nr-tab-order-change',
14
44
  },
15
45
  });
46
+ /**
47
+ * @deprecated Use NrTabs instead. Will be removed in next major version.
48
+ */
49
+ export const HyTabsComponent = NrTabs;
16
50
  //# sourceMappingURL=react.js.map
package/react.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"react.js","sourceRoot":"","sources":["../../../src/components/tabs/react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAClD,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;IAC7C,OAAO,EAAE,SAAS;IAClB,YAAY,EAAE,aAAa;IAC3B,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE;QACN,SAAS,EAAE,WAAW;QACtB,SAAS,EAAE,WAAW;QACtB,aAAa,EAAE,eAAe;QAC9B,cAAc,EAAE,gBAAgB;QAChC,MAAM,EAAE,QAAQ;KACjB;CACF,CAAC,CAAC","sourcesContent":["import {createComponent} from '@lit-labs/react';\nimport * as React from 'react';\nimport {TabsComponent} from './tabs.component.js';\nexport const HyTabsComponent = createComponent({\n tagName: 'hy-tabs',\n elementClass: TabsComponent,\n react: React,\n events: {\n removeTab: 'removeTab',\n tabEdited: 'tabEdited',\n tabTilteClick: 'tabTilteClick',\n tabOrderChange: 'tabOrderChange',\n addTab: 'addTab',\n },\n});\n"]}
1
+ {"version":3,"file":"react.js","sourceRoot":"","sources":["../../../src/components/tabs/react.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,eAAe,CAAC;IACpC,OAAO,EAAE,SAAS;IAClB,YAAY,EAAE,aAAa;IAC3B,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE;QACN,YAAY,EAAE,cAAc;QAC5B,aAAa,EAAE,eAAe;QAC9B,UAAU,EAAE,YAAY;QACxB,aAAa,EAAE,eAAe;QAC9B,WAAW,EAAE,aAAa;QAC1B,kBAAkB,EAAE,qBAAqB;KAC1C;CACF,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2023 Nuraly, Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport { createComponent } from '@lit-labs/react';\nimport * as React from 'react';\nimport { NrTabsElement } from './tabs.component.js';\n\n/**\n * React wrapper for the nr-tabs component.\n * \n * @example\n * ```jsx\n * import { NrTabs } from '@nuralyui/tabs/react';\n * \n * const tabs = [\n * { label: 'Tab 1', content: <div>Content 1</div> },\n * { label: 'Tab 2', content: <div>Content 2</div> }\n * ];\n * \n * function MyComponent() {\n * return (\n * <NrTabs \n * tabs={tabs}\n * activeTab={0}\n * orientation=\"horizontal\"\n * onNrTabClick={(e) => console.log('Tab clicked:', e.detail)}\n * />\n * );\n * }\n * ```\n */\nexport const NrTabs = createComponent({\n tagName: 'nr-tabs',\n elementClass: NrTabsElement,\n react: React,\n events: {\n onNrTabClick: 'nr-tab-click',\n onNrTabChange: 'nr-tab-change',\n onNrTabAdd: 'nr-tab-add',\n onNrTabRemove: 'nr-tab-remove',\n onNrTabEdit: 'nr-tab-edit',\n onNrTabOrderChange: 'nr-tab-order-change',\n },\n});\n\n/**\n * @deprecated Use NrTabs instead. Will be removed in next major version.\n */\nexport const HyTabsComponent = NrTabs;\n"]}
@@ -1,39 +1,72 @@
1
- import { LitElement, PropertyValueMap, nothing } from 'lit';
2
- import { TabEditable, TabOrientation, TabsAlign } from './tabs.constant.js';
3
1
  /**
4
- * `hy-tabs` is a LitElement that provides a customizable tabs.
5
- * @customElement 'hy-tabs'
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ import { LitElement, PropertyValueMap } from 'lit';
7
+ import { TabOrientation, TabsAlign, TabSize, TabType, TabEditable, TabItem } from './tabs.types.js';
8
+ import '../icon/icon.component.js';
9
+ import { type TabsKeyboardHost, type TabsDragDropHost, type TabsEditableHost, type TabsEventHost } from './controllers/index.js';
10
+ declare const NrTabsElement_base: (new (...args: any[]) => import("@nuralyui/common/mixins").DependencyAware) & (new (...args: any[]) => import("@nuralyui/common/mixins").ThemeAware) & (new (...args: any[]) => import("@nuralyui/common/mixins").EventHandlerCapable) & typeof LitElement;
11
+ /**
12
+ * Versatile tabs component with support for multiple orientations, editable tabs, and drag & drop.
13
+ *
14
+ * @example
15
+ * ```html
16
+ * <!-- Basic usage -->
17
+ * <nr-tabs .tabs=${tabs} activeTab="0"></nr-tabs>
18
+ *
19
+ * <!-- With editing capabilities -->
20
+ * <nr-tabs .tabs=${tabs} .editable=${{canAddTab: true, canDeleteTab: true}}></nr-tabs>
21
+ *
22
+ * <!-- Vertical orientation -->
23
+ * <nr-tabs .tabs=${tabs} orientation="vertical" align="left"></nr-tabs>
24
+ * ```
6
25
  *
7
- * Attributes
8
- * @attr activeTab
9
- * @attr orientation
10
- * @attr tabsAlign
11
- * @attr editable
12
- * Events
13
- * @fires tabEdited - Indicates when tab edited
14
- * @fires removeTab - Indicates when tab removed
15
- * @fires addTab - Indicates when tab added
26
+ * @fires nr-tab-click - Tab clicked
27
+ * @fires nr-tab-change - Active tab changed
28
+ * @fires nr-tab-add - New tab requested
29
+ * @fires nr-tab-remove - Tab removal requested
30
+ * @fires nr-tab-edit - Tab edited
31
+ * @fires nr-tab-order-change - Tab order changed via drag & drop
32
+ *
33
+ * @slot default - Tab content
16
34
  */
17
- export declare class TabsComponent extends LitElement {
35
+ export declare class NrTabsElement extends NrTabsElement_base implements TabsKeyboardHost, TabsDragDropHost, TabsEditableHost, TabsEventHost {
36
+ static styles: import("lit").CSSResult;
37
+ /** Currently active tab index */
18
38
  activeTab: number;
39
+ /** Tab orientation (horizontal, vertical) */
19
40
  orientation: TabOrientation;
20
- tabsAlign: TabsAlign;
21
- editable: TabEditable;
22
- tabs: any[];
23
- static styles: import("lit").CSSResult;
24
- constructor();
25
- render(): import("lit").TemplateResult<1>;
41
+ /** Tab alignment (left, center, right) */
42
+ align: TabsAlign;
43
+ /** Tab size (small, medium, large) */
44
+ tabSize: TabSize;
45
+ /** Tab type/variant */
46
+ variant: TabType;
47
+ /** Editable configuration */
48
+ editable?: TabEditable;
49
+ /** Array of tab items */
50
+ tabs: TabItem[];
51
+ /** Whether tabs are animated */
52
+ animated: boolean;
53
+ /** Whether to destroy inactive tab content */
54
+ destroyInactiveTabPane: boolean;
55
+ /** Custom aria-label for the tabs container */
56
+ tabsAriaLabel: string;
57
+ requiredComponents: string[];
58
+ private keyboardController;
59
+ private dragDropController;
60
+ private editableController;
61
+ private eventController;
26
62
  connectedCallback(): void;
63
+ render(): import("lit").TemplateResult<1>;
27
64
  private observeChildrenChanges;
28
- private handleDragStart;
29
- private handleDragOver;
30
- private handleDragEnter;
31
- private handleDragLeave;
32
- private handleDrop;
33
- renderDeleteIcon(tab: any): typeof nothing | import("lit").TemplateResult<1>;
65
+ private renderDeleteIcon;
34
66
  private renderTabs;
35
67
  updated(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
36
68
  private renderActiveTab;
37
- private setActiveTab;
69
+ setActiveTab(index: number, event?: Event): void;
38
70
  }
71
+ export {};
39
72
  //# sourceMappingURL=tabs.component.d.ts.map