@mekari/pixel3-accordion 0.0.1-alpha.0 → 0.0.2

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 (49) hide show
  1. package/dist/accordion.d.mts +44 -0
  2. package/dist/accordion.d.ts +44 -0
  3. package/dist/accordion.js +70 -49
  4. package/dist/accordion.mjs +5 -1
  5. package/dist/chunk-2MFH6MEI.mjs +56 -0
  6. package/dist/chunk-6FLZM2UD.mjs +69 -0
  7. package/dist/chunk-CJKS7PMG.mjs +61 -0
  8. package/dist/chunk-GSM3VVNB.mjs +37 -0
  9. package/dist/chunk-KJJ7ZOJB.mjs +49 -0
  10. package/dist/chunk-PFYTMT2T.mjs +11 -0
  11. package/dist/chunk-QK7KPGDG.mjs +47 -0
  12. package/dist/chunk-QZ7VFGWC.mjs +6 -0
  13. package/dist/chunk-SZIA7VIC.mjs +38 -0
  14. package/dist/header.d.mts +18 -0
  15. package/dist/header.d.ts +18 -0
  16. package/dist/header.js +88 -0
  17. package/dist/header.mjs +9 -0
  18. package/dist/icon.d.mts +45 -0
  19. package/dist/icon.d.ts +45 -0
  20. package/dist/icon.js +81 -0
  21. package/dist/icon.mjs +9 -0
  22. package/dist/index.d.mts +7 -0
  23. package/dist/index.d.ts +7 -0
  24. package/dist/index.js +298 -52
  25. package/dist/index.mjs +22 -2
  26. package/dist/item.d.mts +48 -0
  27. package/dist/item.d.ts +48 -0
  28. package/dist/item.js +132 -0
  29. package/dist/item.mjs +10 -0
  30. package/dist/metafile-cjs.json +1 -1
  31. package/dist/metafile-esm.json +1 -1
  32. package/dist/modules/accordion.context.d.mts +26 -0
  33. package/dist/modules/accordion.context.d.ts +26 -0
  34. package/dist/modules/accordion.context.js +38 -0
  35. package/dist/modules/accordion.context.mjs +13 -0
  36. package/dist/modules/accordion.props.d.mts +67 -0
  37. package/dist/modules/accordion.props.d.ts +67 -0
  38. package/dist/modules/accordion.props.js +96 -0
  39. package/dist/modules/accordion.props.mjs +13 -0
  40. package/dist/modules/useAccordion.d.mts +16 -0
  41. package/dist/modules/useAccordion.d.ts +16 -0
  42. package/dist/modules/useAccordion.js +87 -0
  43. package/dist/modules/useAccordion.mjs +10 -0
  44. package/dist/panel.d.mts +6 -0
  45. package/dist/panel.d.ts +6 -0
  46. package/dist/panel.js +65 -0
  47. package/dist/panel.mjs +8 -0
  48. package/package.json +11 -11
  49. package/dist/chunk-EJFISPTU.mjs +0 -50
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/modules/accordion.props.ts
21
+ var accordion_props_exports = {};
22
+ __export(accordion_props_exports, {
23
+ accordionHeaderProps: () => accordionHeaderProps,
24
+ accordionIconProps: () => accordionIconProps,
25
+ accordionItemProps: () => accordionItemProps,
26
+ accordionProps: () => accordionProps
27
+ });
28
+ module.exports = __toCommonJS(accordion_props_exports);
29
+ var accordionProps = {
30
+ defaultIndexOpen: {
31
+ type: Number
32
+ },
33
+ isAllowMultiple: {
34
+ type: Boolean,
35
+ default: false
36
+ },
37
+ isAllowToggle: {
38
+ type: Boolean,
39
+ default: false
40
+ },
41
+ isControlled: {
42
+ type: Boolean,
43
+ default: false
44
+ }
45
+ };
46
+ var accordionItemProps = {
47
+ id: {
48
+ type: String
49
+ },
50
+ index: {
51
+ type: Number
52
+ },
53
+ isOpen: {
54
+ type: Boolean,
55
+ default: false
56
+ },
57
+ isDefaultIsOpen: {
58
+ type: Boolean,
59
+ default: false
60
+ },
61
+ isDisabled: {
62
+ type: Boolean,
63
+ default: false
64
+ }
65
+ };
66
+ var accordionHeaderProps = {
67
+ isClickable: {
68
+ type: Boolean,
69
+ default: true
70
+ }
71
+ };
72
+ var accordionIconProps = {
73
+ name: {
74
+ type: String,
75
+ default: "caret-down"
76
+ },
77
+ size: {
78
+ type: String,
79
+ default: "md"
80
+ },
81
+ color: {
82
+ type: String,
83
+ default: "gray.600"
84
+ },
85
+ variant: {
86
+ type: String,
87
+ default: "outline"
88
+ }
89
+ };
90
+ // Annotate the CommonJS export names for ESM import in node:
91
+ 0 && (module.exports = {
92
+ accordionHeaderProps,
93
+ accordionIconProps,
94
+ accordionItemProps,
95
+ accordionProps
96
+ });
@@ -0,0 +1,13 @@
1
+ import {
2
+ accordionHeaderProps,
3
+ accordionIconProps,
4
+ accordionItemProps,
5
+ accordionProps
6
+ } from "../chunk-6FLZM2UD.mjs";
7
+ import "../chunk-QZ7VFGWC.mjs";
8
+ export {
9
+ accordionHeaderProps,
10
+ accordionIconProps,
11
+ accordionItemProps,
12
+ accordionProps
13
+ };
@@ -0,0 +1,16 @@
1
+ import * as vue from 'vue';
2
+ import { AccordionProps, AccordionItemProps } from './accordion.props.mjs';
3
+
4
+ declare function useAccordion(props: AccordionProps, emit: CallableFunction): {
5
+ expandedIndex: vue.Ref<number | undefined>;
6
+ onAccordionChange: (index: number, isExpanded: boolean) => void;
7
+ };
8
+ type UseAccordionReturn = ReturnType<typeof useAccordion>;
9
+ declare function useAccordionItem(props: AccordionItemProps): {
10
+ isExpanded: vue.ComputedRef<boolean>;
11
+ onToggle: () => void;
12
+ id: string;
13
+ };
14
+ type UseAccordionItemReturn = ReturnType<typeof useAccordionItem>;
15
+
16
+ export { UseAccordionItemReturn, UseAccordionReturn, useAccordion, useAccordionItem };
@@ -0,0 +1,16 @@
1
+ import * as vue from 'vue';
2
+ import { AccordionProps, AccordionItemProps } from './accordion.props.js';
3
+
4
+ declare function useAccordion(props: AccordionProps, emit: CallableFunction): {
5
+ expandedIndex: vue.Ref<number | undefined>;
6
+ onAccordionChange: (index: number, isExpanded: boolean) => void;
7
+ };
8
+ type UseAccordionReturn = ReturnType<typeof useAccordion>;
9
+ declare function useAccordionItem(props: AccordionItemProps): {
10
+ isExpanded: vue.ComputedRef<boolean>;
11
+ onToggle: () => void;
12
+ id: string;
13
+ };
14
+ type UseAccordionItemReturn = ReturnType<typeof useAccordionItem>;
15
+
16
+ export { UseAccordionItemReturn, UseAccordionReturn, useAccordion, useAccordionItem };
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/modules/useAccordion.ts
22
+ var useAccordion_exports = {};
23
+ __export(useAccordion_exports, {
24
+ useAccordion: () => useAccordion,
25
+ useAccordionItem: () => useAccordionItem
26
+ });
27
+ module.exports = __toCommonJS(useAccordion_exports);
28
+ var import_vue = require("vue");
29
+
30
+ // src/modules/accordion.context.ts
31
+ var import_pixel3_utils = require("@mekari/pixel3-utils");
32
+ var [AccordionProvider, useAccordionContext] = (0, import_pixel3_utils.usePixelCreateContext)("AccordionContext");
33
+ var [AccordionItemProvider, useAccordionItemContext] = (0, import_pixel3_utils.usePixelCreateContext)("AccordionItemContext");
34
+
35
+ // src/modules/useAccordion.ts
36
+ var import_pixel3_utils2 = require("@mekari/pixel3-utils");
37
+ function useAccordion(props, emit) {
38
+ const expandedIndex = (0, import_vue.ref)(props.defaultIndexOpen);
39
+ function onAccordionChange(index, isExpanded) {
40
+ emit("change", index, isExpanded);
41
+ expandedIndex.value = index;
42
+ }
43
+ __name(onAccordionChange, "onAccordionChange");
44
+ return {
45
+ expandedIndex,
46
+ onAccordionChange
47
+ };
48
+ }
49
+ __name(useAccordion, "useAccordion");
50
+ function useAccordionItem(props) {
51
+ const {
52
+ props: rootProps,
53
+ expandedIndex,
54
+ onAccordionChange
55
+ } = useAccordionContext();
56
+ const {
57
+ isAllowMultiple,
58
+ isControlled
59
+ } = rootProps;
60
+ const id = props.id || (0, import_pixel3_utils2.useId)(4);
61
+ const _isExpanded = (0, import_vue.ref)(props.isDefaultIsOpen);
62
+ const isExpanded = (0, import_vue.computed)(() => {
63
+ if (isControlled.value)
64
+ return props.isOpen;
65
+ if (!isAllowMultiple.value)
66
+ return props.index === expandedIndex.value;
67
+ return _isExpanded.value;
68
+ });
69
+ function onToggle() {
70
+ if (isAllowMultiple.value) {
71
+ _isExpanded.value = !_isExpanded.value;
72
+ }
73
+ onAccordionChange(props.index, _isExpanded.value);
74
+ }
75
+ __name(onToggle, "onToggle");
76
+ return {
77
+ isExpanded,
78
+ onToggle,
79
+ id
80
+ };
81
+ }
82
+ __name(useAccordionItem, "useAccordionItem");
83
+ // Annotate the CommonJS export names for ESM import in node:
84
+ 0 && (module.exports = {
85
+ useAccordion,
86
+ useAccordionItem
87
+ });
@@ -0,0 +1,10 @@
1
+ import {
2
+ useAccordion,
3
+ useAccordionItem
4
+ } from "../chunk-CJKS7PMG.mjs";
5
+ import "../chunk-PFYTMT2T.mjs";
6
+ import "../chunk-QZ7VFGWC.mjs";
7
+ export {
8
+ useAccordion,
9
+ useAccordionItem
10
+ };
@@ -0,0 +1,6 @@
1
+ import * as vue from 'vue';
2
+ import * as vue_jsx_runtime from 'vue/jsx-runtime';
3
+
4
+ declare const MpAccordionPanel: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
5
+
6
+ export { MpAccordionPanel };
@@ -0,0 +1,6 @@
1
+ import * as vue from 'vue';
2
+ import * as vue_jsx_runtime from 'vue/jsx-runtime';
3
+
4
+ declare const MpAccordionPanel: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
5
+
6
+ export { MpAccordionPanel };
package/dist/panel.js ADDED
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/panel.tsx
21
+ var panel_exports = {};
22
+ __export(panel_exports, {
23
+ MpAccordionPanel: () => MpAccordionPanel
24
+ });
25
+ module.exports = __toCommonJS(panel_exports);
26
+ var import_vue = require("vue");
27
+ var import_vue2 = require("vue");
28
+ var import_pixel3_collapse = require("@mekari/pixel3-collapse");
29
+
30
+ // src/modules/accordion.context.ts
31
+ var import_pixel3_utils = require("@mekari/pixel3-utils");
32
+ var [AccordionProvider, useAccordionContext] = (0, import_pixel3_utils.usePixelCreateContext)("AccordionContext");
33
+ var [AccordionItemProvider, useAccordionItemContext] = (0, import_pixel3_utils.usePixelCreateContext)("AccordionItemContext");
34
+
35
+ // src/panel.tsx
36
+ var import_css = require("@mekari/pixel3-styled-system/css");
37
+ var MpAccordionPanel = (0, import_vue2.defineComponent)({
38
+ name: "MpAccordionPanel",
39
+ setup(_props, {
40
+ slots
41
+ }) {
42
+ const {
43
+ isExpanded,
44
+ id
45
+ } = useAccordionItemContext();
46
+ return () => {
47
+ return (0, import_vue.createVNode)(import_pixel3_collapse.MpCollapse, {
48
+ "isOpen": isExpanded.value
49
+ }, {
50
+ default: () => [(0, import_vue.createVNode)("div", {
51
+ "data-pixel-component": "MpAccordionPanel",
52
+ "id": `accordin-panel-${id}`,
53
+ "aria-labelledby": `accordion-header-${id}`,
54
+ "class": (0, import_css.css)({
55
+ py: 3
56
+ })
57
+ }, [slots.default()])]
58
+ });
59
+ };
60
+ }
61
+ });
62
+ // Annotate the CommonJS export names for ESM import in node:
63
+ 0 && (module.exports = {
64
+ MpAccordionPanel
65
+ });
package/dist/panel.mjs ADDED
@@ -0,0 +1,8 @@
1
+ import {
2
+ MpAccordionPanel
3
+ } from "./chunk-SZIA7VIC.mjs";
4
+ import "./chunk-PFYTMT2T.mjs";
5
+ import "./chunk-QZ7VFGWC.mjs";
6
+ export {
7
+ MpAccordionPanel
8
+ };
package/package.json CHANGED
@@ -1,25 +1,27 @@
1
1
  {
2
2
  "name": "@mekari/pixel3-accordion",
3
- "version": "0.0.1-alpha.0",
4
- "license": "LGPL-3.0",
3
+ "description": "Accordion component for mekari pixel 3",
4
+ "version": "0.0.2",
5
5
  "main": "dist/index.js",
6
+ "license": "MIT",
6
7
  "files": [
7
8
  "dist"
8
9
  ],
9
10
  "dependencies": {
10
- "@zag-js/accordion": "^0.26.0",
11
- "@zag-js/vue": "^0.26.0",
12
- "@mekari/pixel3-styled-system": "0.0.1-alpha.0"
11
+ "@mekari/pixel3-styled-system": "0.0.1",
12
+ "@mekari/pixel3-icon": "0.0.2",
13
+ "@mekari/pixel3-utils": "0.0.2",
14
+ "@mekari/pixel3-collapse": "0.0.1"
13
15
  },
14
16
  "peerDependencies": {
15
17
  "vue": "^3.3.7"
16
18
  },
17
- "publishConfig": {
18
- "access": "public"
19
- },
20
19
  "devDependencies": {
21
20
  "vue": "^3.3.7"
22
21
  },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
23
25
  "module": "dist/index.mjs",
24
26
  "types": "dist/index.d.ts",
25
27
  "exports": {
@@ -32,12 +34,10 @@
32
34
  "scripts": {
33
35
  "clean": "rimraf dist .turbo",
34
36
  "build": "tsup && pnpm build:types",
35
- "build:css": "pnpm build && pnpm css:gen",
36
37
  "build:fast": "tsup",
37
38
  "build:types": "tsup src --dts-only",
38
- "build:external": "tsup src/index.tsx --external @acme-org/styled-system",
39
+ "build:external": "tsup src/index.tsx --external",
39
40
  "types:check": "tsc --noEmit",
40
- "css:gen": "panda cssgen --outfile dist/styles.css",
41
41
  "replace-config": "clean-package",
42
42
  "restore-config": "clean-package restore"
43
43
  }
@@ -1,50 +0,0 @@
1
- // src/accordion.tsx
2
- import { mergeProps as _mergeProps, createVNode as _createVNode, createTextVNode as _createTextVNode } from "vue";
3
- import * as accordion from "@zag-js/accordion";
4
- import { normalizeProps, useMachine } from "@zag-js/vue";
5
- import { defineComponent, computed } from "vue";
6
- import { accordion as accordionReceipe } from "@mekari/pixel3-styled-system/recipes";
7
- var data = [{
8
- title: "Watercraft",
9
- content: "Sample accordion content"
10
- }, {
11
- title: "Automobiles",
12
- content: "Sample accordion content"
13
- }, {
14
- title: "Aircrafts",
15
- content: "Sample accordion content"
16
- }];
17
- var classNames = accordionReceipe();
18
- var MpAccordion = defineComponent({
19
- // eslint-disable-next-line vue/multi-word-component-names
20
- name: "Accordion",
21
- setup() {
22
- const [state, send] = useMachine(accordion.machine({
23
- id: "1",
24
- multiple: true
25
- }));
26
- const apiRef = computed(() => accordion.connect(state.value, send, normalizeProps));
27
- console.log(apiRef.value);
28
- return () => {
29
- return _createVNode("div", _mergeProps(api.rootProps, {
30
- "class": classNames.root
31
- }), [data.map((item) => _createVNode("div", _mergeProps(api.getItemProps({
32
- value: item.title
33
- }), {
34
- "class": classNames.item
35
- }), [_createVNode("button", _mergeProps(api.getItemTriggerProps({
36
- value: item.title
37
- }), {
38
- "class": classNames.trigger
39
- }), [item.title, _createVNode("div", null, [_createTextVNode("Item Indicator")])]), _createVNode("div", _mergeProps(api.getItemContentProps({
40
- value: item.title
41
- }), {
42
- "class": classNames.content
43
- }), [_createVNode("div", null, [item.content])])]))]);
44
- };
45
- }
46
- });
47
-
48
- export {
49
- MpAccordion
50
- };