@hanzogui/tabs 8.3.1 → 8.3.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.
- package/dist/cjs/StyledContext.js +6 -0
- package/dist/cjs/StyledContext.js.map +1 -0
- package/dist/cjs/Tabs.js +58 -0
- package/dist/cjs/Tabs.js.map +1 -0
- package/dist/cjs/createTabs.js +178 -0
- package/dist/cjs/createTabs.js.map +1 -0
- package/dist/cjs/index.js +14 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/StyledContext.js +3 -0
- package/dist/esm/StyledContext.js.map +1 -0
- package/dist/esm/Tabs.js +55 -0
- package/dist/esm/Tabs.js.map +1 -0
- package/dist/esm/createTabs.js +174 -0
- package/dist/esm/createTabs.js.map +1 -0
- package/dist/esm/index.js +9 -10
- package/dist/esm/index.js.map +1 -1
- package/package.json +34 -29
- package/src/StyledContext.tsx +1 -1
- package/src/createTabs.tsx +6 -2
- package/src/index.ts +8 -4
- package/types/StyledContext.d.ts +1 -1
- package/types/StyledContext.d.ts.map +1 -1
- package/types/Tabs.d.ts +15 -15
- package/types/Tabs.d.ts.map +1 -1
- package/types/createTabs.d.ts +100 -100
- package/types/createTabs.d.ts.map +1 -1
- package/types/index.d.ts +141 -141
- package/types/index.d.ts.map +1 -1
- package/dist/cjs/StyledContext.cjs +0 -33
- package/dist/cjs/StyledContext.native.js +0 -36
- package/dist/cjs/StyledContext.native.js.map +0 -1
- package/dist/cjs/Tabs.cjs +0 -83
- package/dist/cjs/Tabs.native.js +0 -86
- package/dist/cjs/Tabs.native.js.map +0 -1
- package/dist/cjs/createTabs.cjs +0 -293
- package/dist/cjs/createTabs.native.js +0 -308
- package/dist/cjs/createTabs.native.js.map +0 -1
- package/dist/cjs/index.cjs +0 -37
- package/dist/cjs/index.native.js +0 -40
- package/dist/cjs/index.native.js.map +0 -1
- package/dist/esm/StyledContext.mjs +0 -7
- package/dist/esm/StyledContext.mjs.map +0 -1
- package/dist/esm/StyledContext.native.js +0 -7
- package/dist/esm/StyledContext.native.js.map +0 -1
- package/dist/esm/Tabs.mjs +0 -56
- package/dist/esm/Tabs.mjs.map +0 -1
- package/dist/esm/Tabs.native.js +0 -56
- package/dist/esm/Tabs.native.js.map +0 -1
- package/dist/esm/createTabs.mjs +0 -257
- package/dist/esm/createTabs.mjs.map +0 -1
- package/dist/esm/createTabs.native.js +0 -269
- package/dist/esm/createTabs.native.js.map +0 -1
- package/dist/esm/index.mjs +0 -11
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js +0 -11
- package/dist/esm/index.native.js.map +0 -1
- package/dist/jsx/StyledContext.mjs +0 -7
- package/dist/jsx/StyledContext.mjs.map +0 -1
- package/dist/jsx/StyledContext.native.js +0 -36
- package/dist/jsx/StyledContext.native.js.map +0 -1
- package/dist/jsx/Tabs.mjs +0 -56
- package/dist/jsx/Tabs.mjs.map +0 -1
- package/dist/jsx/Tabs.native.js +0 -86
- package/dist/jsx/Tabs.native.js.map +0 -1
- package/dist/jsx/createTabs.mjs +0 -257
- package/dist/jsx/createTabs.mjs.map +0 -1
- package/dist/jsx/createTabs.native.js +0 -308
- package/dist/jsx/createTabs.native.js.map +0 -1
- package/dist/jsx/index.js +0 -11
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs +0 -11
- package/dist/jsx/index.mjs.map +0 -1
- package/dist/jsx/index.native.js +0 -40
- package/dist/jsx/index.native.js.map +0 -1
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AAEnC,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIf,CAAA"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all) __defProp(target, name, {
|
|
7
|
-
get: all[name],
|
|
8
|
-
enumerable: true
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
-
get: () => from[key],
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: true
|
|
22
|
-
}), mod);
|
|
23
|
-
var StyledContext_exports = {};
|
|
24
|
-
__export(StyledContext_exports, {
|
|
25
|
-
TabsProvider: () => TabsProvider,
|
|
26
|
-
useTabsContext: () => useTabsContext
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(StyledContext_exports);
|
|
29
|
-
var import_core = require("@hanzogui/core");
|
|
30
|
-
const {
|
|
31
|
-
Provider: TabsProvider,
|
|
32
|
-
useStyledContext: useTabsContext
|
|
33
|
-
} = (0, import_core.createStyledContext)();
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all) __defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
-
get: () => from[key],
|
|
17
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
-
value: true
|
|
24
|
-
}), mod);
|
|
25
|
-
var StyledContext_exports = {};
|
|
26
|
-
__export(StyledContext_exports, {
|
|
27
|
-
TabsProvider: () => TabsProvider,
|
|
28
|
-
useTabsContext: () => useTabsContext
|
|
29
|
-
});
|
|
30
|
-
module.exports = __toCommonJS(StyledContext_exports);
|
|
31
|
-
var import_core = require("@hanzogui/core");
|
|
32
|
-
var {
|
|
33
|
-
Provider: TabsProvider,
|
|
34
|
-
useStyledContext: useTabsContext
|
|
35
|
-
} = (0, import_core.createStyledContext)();
|
|
36
|
-
//# sourceMappingURL=StyledContext.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","StyledContext_exports","__export","TabsProvider","useTabsContext","module","exports","import_core","require"],"sources":["../../src/StyledContext.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,qBAAA;AAAAC,QAAA,CAAAD,qBAAA;EAAAE,YAAA,EAAAA,CAAA,KAAAA,YAAA;EAAAC,cAAA,EAAAA,CAAA,KAAAA;AAAA;AACAC,MAAA,CAAAC,OAAA,GAAAV,YAAoC,CAAAK,qBAAA;AAgB7B,IAAAM,WAAQ,GAAUC,OAAA,iBAAc","ignoreList":[]}
|
package/dist/cjs/Tabs.cjs
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all) __defProp(target, name, {
|
|
7
|
-
get: all[name],
|
|
8
|
-
enumerable: true
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
-
get: () => from[key],
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: true
|
|
22
|
-
}), mod);
|
|
23
|
-
var Tabs_exports = {};
|
|
24
|
-
__export(Tabs_exports, {
|
|
25
|
-
DefaultTabsContentFrame: () => DefaultTabsContentFrame,
|
|
26
|
-
DefaultTabsFrame: () => DefaultTabsFrame,
|
|
27
|
-
DefaultTabsTabFrame: () => DefaultTabsTabFrame
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(Tabs_exports);
|
|
30
|
-
var import_core = require("@hanzogui/core");
|
|
31
|
-
var import_get_button_sized = require("@hanzogui/get-button-sized");
|
|
32
|
-
var import_stacks = require("@hanzogui/stacks");
|
|
33
|
-
const TABS_NAME = "Tabs";
|
|
34
|
-
const DefaultTabsFrame = (0, import_core.styled)(import_stacks.SizableStack, {
|
|
35
|
-
name: TABS_NAME
|
|
36
|
-
});
|
|
37
|
-
const TRIGGER_NAME = "TabsTrigger";
|
|
38
|
-
const DefaultTabsTabFrame = (0, import_core.styled)(import_core.View, {
|
|
39
|
-
name: TRIGGER_NAME,
|
|
40
|
-
role: "tab",
|
|
41
|
-
variants: {
|
|
42
|
-
size: {
|
|
43
|
-
"...size": import_get_button_sized.getButtonSized
|
|
44
|
-
},
|
|
45
|
-
disabled: {
|
|
46
|
-
true: {
|
|
47
|
-
pointerEvents: "none"
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
unstyled: {
|
|
51
|
-
false: {
|
|
52
|
-
borderWidth: 0,
|
|
53
|
-
backgroundColor: "$background",
|
|
54
|
-
userSelect: "none",
|
|
55
|
-
justifyContent: "center",
|
|
56
|
-
alignItems: "center",
|
|
57
|
-
flexWrap: "nowrap",
|
|
58
|
-
flexDirection: "row",
|
|
59
|
-
cursor: "pointer",
|
|
60
|
-
pressStyle: {
|
|
61
|
-
backgroundColor: "$backgroundPress"
|
|
62
|
-
},
|
|
63
|
-
focusVisibleStyle: {
|
|
64
|
-
outlineColor: "$outlineColor",
|
|
65
|
-
outlineWidth: 2,
|
|
66
|
-
outlineStyle: "solid",
|
|
67
|
-
zIndex: 10
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
defaultVariants: {
|
|
73
|
-
unstyled: process.env.GUI_HEADLESS === "1"
|
|
74
|
-
}
|
|
75
|
-
}, {
|
|
76
|
-
accept: {
|
|
77
|
-
activeStyle: "style"
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
const CONTENT_NAME = "TabsContent";
|
|
81
|
-
const DefaultTabsContentFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
82
|
-
name: CONTENT_NAME
|
|
83
|
-
});
|
package/dist/cjs/Tabs.native.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all) __defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
-
get: () => from[key],
|
|
17
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
-
value: true
|
|
24
|
-
}), mod);
|
|
25
|
-
var Tabs_exports = {};
|
|
26
|
-
__export(Tabs_exports, {
|
|
27
|
-
DefaultTabsContentFrame: () => DefaultTabsContentFrame,
|
|
28
|
-
DefaultTabsFrame: () => DefaultTabsFrame,
|
|
29
|
-
DefaultTabsTabFrame: () => DefaultTabsTabFrame
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(Tabs_exports);
|
|
32
|
-
var import_core = require("@hanzogui/core");
|
|
33
|
-
var import_get_button_sized = require("@hanzogui/get-button-sized");
|
|
34
|
-
var import_stacks = require("@hanzogui/stacks");
|
|
35
|
-
var TABS_NAME = "Tabs";
|
|
36
|
-
var DefaultTabsFrame = (0, import_core.styled)(import_stacks.SizableStack, {
|
|
37
|
-
name: TABS_NAME
|
|
38
|
-
});
|
|
39
|
-
var TRIGGER_NAME = "TabsTrigger";
|
|
40
|
-
var DefaultTabsTabFrame = (0, import_core.styled)(import_core.View, {
|
|
41
|
-
name: TRIGGER_NAME,
|
|
42
|
-
role: "tab",
|
|
43
|
-
variants: {
|
|
44
|
-
size: {
|
|
45
|
-
"...size": import_get_button_sized.getButtonSized
|
|
46
|
-
},
|
|
47
|
-
disabled: {
|
|
48
|
-
true: {
|
|
49
|
-
pointerEvents: "none"
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
unstyled: {
|
|
53
|
-
false: {
|
|
54
|
-
borderWidth: 0,
|
|
55
|
-
backgroundColor: "$background",
|
|
56
|
-
userSelect: "none",
|
|
57
|
-
justifyContent: "center",
|
|
58
|
-
alignItems: "center",
|
|
59
|
-
flexWrap: "nowrap",
|
|
60
|
-
flexDirection: "row",
|
|
61
|
-
cursor: "pointer",
|
|
62
|
-
pressStyle: {
|
|
63
|
-
backgroundColor: "$backgroundPress"
|
|
64
|
-
},
|
|
65
|
-
focusVisibleStyle: {
|
|
66
|
-
outlineColor: "$outlineColor",
|
|
67
|
-
outlineWidth: 2,
|
|
68
|
-
outlineStyle: "solid",
|
|
69
|
-
zIndex: 10
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
defaultVariants: {
|
|
75
|
-
unstyled: process.env.GUI_HEADLESS === "1"
|
|
76
|
-
}
|
|
77
|
-
}, {
|
|
78
|
-
accept: {
|
|
79
|
-
activeStyle: "style"
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
var CONTENT_NAME = "TabsContent";
|
|
83
|
-
var DefaultTabsContentFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
84
|
-
name: CONTENT_NAME
|
|
85
|
-
});
|
|
86
|
-
//# sourceMappingURL=Tabs.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","Tabs_exports","__export","DefaultTabsContentFrame","DefaultTabsFrame","DefaultTabsTabFrame","module","exports","import_core","require","import_get_button_sized","import_stacks","TABS_NAME","styled","SizableStack","name","TRIGGER_NAME","View","role","variants","size","getButtonSized","disabled","true","pointerEvents","unstyled","false","borderWidth","backgroundColor","userSelect","justifyContent","alignItems","flexWrap","flexDirection","cursor","pressStyle","focusVisibleStyle","outlineColor","outlineWidth","outlineStyle","zIndex","defaultVariants","process","env","GUI_HEADLESS","accept","activeStyle","CONTENT_NAME","ThemeableStack"],"sources":["../../src/Tabs.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,YAAA;AAAAC,QAAA,CAAAD,YAAA;EAAAE,uBAAA,EAAAA,CAAA,KAAAA,uBAAA;EAAAC,gBAAA,EAAAA,CAAA,KAAAA,gBAAA;EAAAC,mBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAX,YAA6B,CAAAK,YAAA;AAC7B,IAAAO,WAAA,GAAAC,OAAA,iBAA+B;AAC/B,IAAAC,uBAA6C,GAAAD,OAAA;AAE7C,IAAAE,aAAM,GAAYF,OAAA;AACX,IAAAG,SAAM;AAAwC,IACnDR,gBAAM,OAAAI,WAAA,CAAAK,MAAA,EAAAF,aAAA,CAAAG,YAAA;EACPC,IAAA,EAAAH;AAED;AAEO,IAAAI,YAAM,gBAAsB;AAAA,IACjCX,mBAAA,OAAAG,WAAA,CAAAK,MAAA,EAAAL,WAAA,CAAAS,IAAA;EACAF,IAAA,EAAAC,YAAA;EAAAE,IACE,OAAM;EAAAC,QACA;IAENC,IAAA;MACE,SAAM,EAAAV,uBAAA,CAAAW;IAAA;IACOC,QACb;MAEAC,IAAA;QACEC,aAAM;MAAA;IACW;IACjBC,QACF;MAEAC,KAAA;QACEC,WAAO;QAAAC,eACQ;QAAAC,UACb;QAAiBC,cACL;QAAAC,UACZ,UAAgB;QAAAC,QAChB,UAAY;QAAAC,aACF;QAAAC,MACV,WAAe;QAAAC,UACP;UAERP,eAAY;QAAA;QACOQ,iBACnB;UAEAC,YAAA,iBAAmB;UAAAC,YACjB;UAAcC,YACd,SAAc;UAAAC,MACd;QAAc;MACN;IACV;EACF;EACFC,eACF;IAEAhB,QAAA,EAAAiB,OAAiB,CAAAC,GAAA,CAAAC,YAAA;EAAA;AACwB;EAE3CC,MAAA;IACAC,WAAA;EAAA;AACU;AACO,IACfC,YAAA;AAAA,IACF5C,uBAAA,OAAAK,WAAA,CAAAK,MAAA,EAAAF,aAAA,CAAAqC,cAAA;EACFjC,IAAA,EAAAgC;AAEA","ignoreList":[]}
|
package/dist/cjs/createTabs.cjs
DELETED
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all) __defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
-
get: () => from[key],
|
|
17
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
-
value: mod,
|
|
29
|
-
enumerable: true
|
|
30
|
-
}) : target, mod));
|
|
31
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
-
value: true
|
|
33
|
-
}), mod);
|
|
34
|
-
var createTabs_exports = {};
|
|
35
|
-
__export(createTabs_exports, {
|
|
36
|
-
createTabs: () => createTabs
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(createTabs_exports);
|
|
39
|
-
var import_compose_refs = require("@hanzogui/compose-refs");
|
|
40
|
-
var import_constants = require("@hanzogui/constants");
|
|
41
|
-
var import_group = require("@hanzogui/group");
|
|
42
|
-
var import_helpers = require("@hanzogui/helpers");
|
|
43
|
-
var import_roving_focus = require("@hanzogui/roving-focus");
|
|
44
|
-
var import_sizable_context = require("@hanzogui/sizable-context");
|
|
45
|
-
var import_use_controllable_state = require("@hanzogui/use-controllable-state");
|
|
46
|
-
var import_use_direction = require("@hanzogui/use-direction");
|
|
47
|
-
var import_web = require("@hanzogui/web");
|
|
48
|
-
var React = __toESM(require("react"), 1);
|
|
49
|
-
var import_StyledContext = require("./StyledContext.cjs");
|
|
50
|
-
var import_Tabs = require("./Tabs.cjs");
|
|
51
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
52
|
-
function createTabs(createProps) {
|
|
53
|
-
const {
|
|
54
|
-
ContentFrame = import_Tabs.DefaultTabsContentFrame,
|
|
55
|
-
TabFrame = import_Tabs.DefaultTabsTabFrame,
|
|
56
|
-
TabsFrame = import_Tabs.DefaultTabsFrame
|
|
57
|
-
} = createProps;
|
|
58
|
-
const TABS_CONTEXT = "TabsContext";
|
|
59
|
-
const TAB_LIST_NAME = "TabsList";
|
|
60
|
-
const TabsList = React.forwardRef((props, forwardedRef) => {
|
|
61
|
-
const {
|
|
62
|
-
__scopeTabs,
|
|
63
|
-
loop = true,
|
|
64
|
-
children,
|
|
65
|
-
...listProps
|
|
66
|
-
} = props;
|
|
67
|
-
const context = (0, import_StyledContext.useTabsContext)(__scopeTabs);
|
|
68
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup, {
|
|
69
|
-
__scopeRovingFocusGroup: __scopeTabs || TABS_CONTEXT,
|
|
70
|
-
orientation: context.orientation,
|
|
71
|
-
dir: context.dir,
|
|
72
|
-
loop,
|
|
73
|
-
asChild: true,
|
|
74
|
-
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_group.Group, {
|
|
75
|
-
role: "tablist",
|
|
76
|
-
componentName: TAB_LIST_NAME,
|
|
77
|
-
"aria-orientation": context.orientation,
|
|
78
|
-
ref: forwardedRef,
|
|
79
|
-
orientation: context.orientation,
|
|
80
|
-
...listProps,
|
|
81
|
-
children
|
|
82
|
-
})
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
TabsList.displayName = TAB_LIST_NAME;
|
|
86
|
-
const TRIGGER_NAME = "TabsTrigger";
|
|
87
|
-
const TabsTrigger = TabFrame.styleable((props, forwardedRef) => {
|
|
88
|
-
const {
|
|
89
|
-
__scopeTabs,
|
|
90
|
-
value,
|
|
91
|
-
disabled = false,
|
|
92
|
-
onInteraction,
|
|
93
|
-
activeStyle,
|
|
94
|
-
activeTheme,
|
|
95
|
-
unstyled = false,
|
|
96
|
-
...triggerProps
|
|
97
|
-
} = props;
|
|
98
|
-
const context = (0, import_StyledContext.useTabsContext)(__scopeTabs);
|
|
99
|
-
const triggerId = makeTriggerId(context.baseId, value);
|
|
100
|
-
const contentId = makeContentId(context.baseId, value);
|
|
101
|
-
const isSelected = value === context.value;
|
|
102
|
-
const [layout, setLayout] = React.useState(null);
|
|
103
|
-
const triggerRef = React.useRef(null);
|
|
104
|
-
const groupItemProps = (0, import_group.useGroupItem)({
|
|
105
|
-
disabled: !!disabled
|
|
106
|
-
});
|
|
107
|
-
React.useEffect(() => {
|
|
108
|
-
context.registerTrigger();
|
|
109
|
-
return () => context.unregisterTrigger();
|
|
110
|
-
}, []);
|
|
111
|
-
React.useEffect(() => {
|
|
112
|
-
if (!triggerRef.current || !import_constants.isWeb) return;
|
|
113
|
-
const el = triggerRef.current;
|
|
114
|
-
function getTriggerSize() {
|
|
115
|
-
if (!el) return;
|
|
116
|
-
setLayout({
|
|
117
|
-
width: el.offsetWidth,
|
|
118
|
-
height: el.offsetHeight,
|
|
119
|
-
x: el.offsetLeft,
|
|
120
|
-
y: el.offsetTop
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
getTriggerSize();
|
|
124
|
-
const observer = new ResizeObserver(getTriggerSize);
|
|
125
|
-
observer.observe(el);
|
|
126
|
-
return () => {
|
|
127
|
-
observer.disconnect();
|
|
128
|
-
};
|
|
129
|
-
}, [context.triggersCount]);
|
|
130
|
-
React.useEffect(() => {
|
|
131
|
-
if (isSelected && layout) {
|
|
132
|
-
onInteraction?.("select", layout);
|
|
133
|
-
}
|
|
134
|
-
}, [isSelected, value, layout]);
|
|
135
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup.Item, {
|
|
136
|
-
__scopeRovingFocusGroup: __scopeTabs || TABS_CONTEXT,
|
|
137
|
-
asChild: true,
|
|
138
|
-
focusable: !disabled,
|
|
139
|
-
active: isSelected,
|
|
140
|
-
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(TabFrame, {
|
|
141
|
-
...(!import_constants.isWeb && {
|
|
142
|
-
onLayout: event => {
|
|
143
|
-
setLayout(event.nativeEvent.layout);
|
|
144
|
-
}
|
|
145
|
-
}),
|
|
146
|
-
onMouseEnter: (0, import_helpers.composeEventHandlers)(props.onMouseEnter, () => {
|
|
147
|
-
if (layout) {
|
|
148
|
-
onInteraction?.("hover", layout);
|
|
149
|
-
}
|
|
150
|
-
}),
|
|
151
|
-
onMouseLeave: (0, import_helpers.composeEventHandlers)(props.onMouseLeave, () => {
|
|
152
|
-
onInteraction?.("hover", null);
|
|
153
|
-
}),
|
|
154
|
-
role: "tab",
|
|
155
|
-
"aria-selected": isSelected,
|
|
156
|
-
"aria-controls": contentId,
|
|
157
|
-
"data-state": isSelected ? "active" : "inactive",
|
|
158
|
-
"data-disabled": disabled ? "" : void 0,
|
|
159
|
-
id: triggerId,
|
|
160
|
-
theme: activeTheme ?? null,
|
|
161
|
-
unstyled,
|
|
162
|
-
...(!unstyled && {
|
|
163
|
-
size: context.size
|
|
164
|
-
}),
|
|
165
|
-
...(isSelected && {
|
|
166
|
-
...(!unstyled && !activeStyle && {
|
|
167
|
-
backgroundColor: "$backgroundActive"
|
|
168
|
-
}),
|
|
169
|
-
...activeStyle
|
|
170
|
-
}),
|
|
171
|
-
...groupItemProps,
|
|
172
|
-
disabled: disabled ?? groupItemProps.disabled,
|
|
173
|
-
...triggerProps,
|
|
174
|
-
ref: (0, import_compose_refs.composeRefs)(forwardedRef, triggerRef),
|
|
175
|
-
onPress: (0, import_helpers.composeEventHandlers)(props.onPress ?? void 0, event => {
|
|
176
|
-
const webChecks = !import_constants.isWeb || event.button === 0 && event.ctrlKey === false;
|
|
177
|
-
if (!disabled && !isSelected && webChecks) {
|
|
178
|
-
context.onChange(value);
|
|
179
|
-
}
|
|
180
|
-
}),
|
|
181
|
-
...(import_constants.isWeb && {
|
|
182
|
-
onKeyDown: (0, import_helpers.composeEventHandlers)(props.onKeyDown, event => {
|
|
183
|
-
if ([" ", "Enter"].includes(event.key)) {
|
|
184
|
-
context.onChange(value);
|
|
185
|
-
event.preventDefault();
|
|
186
|
-
}
|
|
187
|
-
}),
|
|
188
|
-
onFocus: (0, import_helpers.composeEventHandlers)(props.onFocus, event => {
|
|
189
|
-
if (layout) {
|
|
190
|
-
onInteraction?.("focus", layout);
|
|
191
|
-
}
|
|
192
|
-
const isAutomaticActivation = context.activationMode !== "manual";
|
|
193
|
-
if (!isSelected && !disabled && isAutomaticActivation) {
|
|
194
|
-
context.onChange(value);
|
|
195
|
-
}
|
|
196
|
-
}),
|
|
197
|
-
onBlur: (0, import_helpers.composeEventHandlers)(props.onBlur, () => {
|
|
198
|
-
onInteraction?.("focus", null);
|
|
199
|
-
})
|
|
200
|
-
})
|
|
201
|
-
})
|
|
202
|
-
});
|
|
203
|
-
});
|
|
204
|
-
TabsTrigger.displayName = TRIGGER_NAME;
|
|
205
|
-
const TabsContent = ContentFrame.styleable(function TabsContent2(props, forwardedRef) {
|
|
206
|
-
const {
|
|
207
|
-
__scopeTabs,
|
|
208
|
-
value,
|
|
209
|
-
forceMount,
|
|
210
|
-
children,
|
|
211
|
-
...contentProps
|
|
212
|
-
} = props;
|
|
213
|
-
const context = (0, import_StyledContext.useTabsContext)(__scopeTabs);
|
|
214
|
-
const isSelected = value === context.value;
|
|
215
|
-
const show = forceMount || isSelected;
|
|
216
|
-
const triggerId = makeTriggerId(context.baseId, value);
|
|
217
|
-
const contentId = makeContentId(context.baseId, value);
|
|
218
|
-
if (!show) {
|
|
219
|
-
return null;
|
|
220
|
-
}
|
|
221
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ContentFrame, {
|
|
222
|
-
"data-state": isSelected ? "active" : "inactive",
|
|
223
|
-
"data-orientation": context.orientation,
|
|
224
|
-
role: "tabpanel",
|
|
225
|
-
"aria-labelledby": triggerId,
|
|
226
|
-
hidden: !show,
|
|
227
|
-
id: contentId,
|
|
228
|
-
tabIndex: 0,
|
|
229
|
-
...contentProps,
|
|
230
|
-
ref: forwardedRef,
|
|
231
|
-
children
|
|
232
|
-
}, value);
|
|
233
|
-
});
|
|
234
|
-
const TabsComponent = TabsFrame.styleable(function Tabs(props, forwardedRef) {
|
|
235
|
-
const {
|
|
236
|
-
__scopeTabs,
|
|
237
|
-
value: valueProp,
|
|
238
|
-
onValueChange,
|
|
239
|
-
defaultValue,
|
|
240
|
-
orientation = "horizontal",
|
|
241
|
-
dir,
|
|
242
|
-
activationMode = "manual",
|
|
243
|
-
size = "$true",
|
|
244
|
-
...tabsProps
|
|
245
|
-
} = props;
|
|
246
|
-
const direction = (0, import_use_direction.useDirection)(dir);
|
|
247
|
-
const [value, setValue] = (0, import_use_controllable_state.useControllableState)({
|
|
248
|
-
prop: valueProp,
|
|
249
|
-
onChange: onValueChange,
|
|
250
|
-
defaultProp: defaultValue ?? ""
|
|
251
|
-
});
|
|
252
|
-
const [triggersCount, setTriggersCount] = React.useState(0);
|
|
253
|
-
const registerTrigger = (0, import_web.useEvent)(() => setTriggersCount(v => v + 1));
|
|
254
|
-
const unregisterTrigger = (0, import_web.useEvent)(() => setTriggersCount(v => v - 1));
|
|
255
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_sizable_context.SizableContext.Provider, {
|
|
256
|
-
size,
|
|
257
|
-
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_StyledContext.TabsProvider, {
|
|
258
|
-
scope: __scopeTabs,
|
|
259
|
-
baseId: React.useId(),
|
|
260
|
-
value,
|
|
261
|
-
onChange: setValue,
|
|
262
|
-
orientation,
|
|
263
|
-
dir: direction,
|
|
264
|
-
activationMode,
|
|
265
|
-
size,
|
|
266
|
-
registerTrigger,
|
|
267
|
-
triggersCount,
|
|
268
|
-
unregisterTrigger,
|
|
269
|
-
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(TabsFrame, {
|
|
270
|
-
direction,
|
|
271
|
-
"data-orientation": orientation,
|
|
272
|
-
...tabsProps,
|
|
273
|
-
ref: forwardedRef
|
|
274
|
-
})
|
|
275
|
-
})
|
|
276
|
-
});
|
|
277
|
-
});
|
|
278
|
-
return (0, import_helpers.withStaticProperties)(TabsComponent, {
|
|
279
|
-
List: TabsList,
|
|
280
|
-
/**
|
|
281
|
-
* @deprecated Use Tabs.Tab instead
|
|
282
|
-
*/
|
|
283
|
-
Trigger: TabsTrigger,
|
|
284
|
-
Tab: TabsTrigger,
|
|
285
|
-
Content: TabsContent
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
function makeTriggerId(baseId, value) {
|
|
289
|
-
return `${baseId}-trigger-${value}`;
|
|
290
|
-
}
|
|
291
|
-
function makeContentId(baseId, value) {
|
|
292
|
-
return `${baseId}-content-${value}`;
|
|
293
|
-
}
|