@kwiz/fluentui 1.0.129 → 1.0.130

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.
@@ -32,6 +32,7 @@ export * from './search';
32
32
  export * from './section';
33
33
  export * from './stack';
34
34
  export * from './svg';
35
+ export * from './tabs';
35
36
  export * from './tag-ex';
36
37
  export * from './toolbar';
37
38
  export * from './vertical';
@@ -32,6 +32,7 @@ export * from './search';
32
32
  export * from './section';
33
33
  export * from './stack';
34
34
  export * from './svg';
35
+ export * from './tabs';
35
36
  export * from './tag-ex';
36
37
  export * from './toolbar';
37
38
  export * from './vertical';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/controls/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc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AAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { TabListProps, TabProps } from "@fluentui/react-components";
2
+ import { ReactNode } from "react";
3
+ import { IStackProps } from "./stack";
4
+ interface iProps<keyType extends string> {
5
+ tabs: {
6
+ key: keyType;
7
+ title: string | JSX.Element;
8
+ children: ReactNode | JSX.Element;
9
+ props?: TabProps;
10
+ }[];
11
+ root?: TabListProps;
12
+ onSelect?: (value: keyType) => void;
13
+ /** default: {direction:"v"} */
14
+ container: IStackProps;
15
+ }
16
+ type tProps<keyType extends string> = iProps<keyType> & ({
17
+ selected: keyType;
18
+ defaultSelected?: never;
19
+ } | {
20
+ selected?: never;
21
+ defaultSelected: keyType;
22
+ });
23
+ export declare function TabsEX<keyType extends string>(props: tProps<keyType>): import("react/jsx-runtime").JSX.Element;
24
+ export {};
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Tab, TabList } from "@fluentui/react-components";
3
+ import { CommonLogger, firstOrNull, isUndefined } from "@kwiz/common";
4
+ import { useEffect, useMemo, useState } from "react";
5
+ import { Stack } from "./stack";
6
+ const logger = new CommonLogger("Tabs");
7
+ export function TabsEX(props) {
8
+ const [isUnControlled, setIsUnControlled] = useState(!isUndefined(props.defaultSelected));
9
+ const __isUnControlled = !isUndefined(props.defaultSelected);
10
+ useEffect(() => {
11
+ if (__isUnControlled !== isUnControlled) {
12
+ logger.error(`A TabsEX control was switched from controlled to uncontrolled mode. This is not supported.`);
13
+ setIsUnControlled(__isUnControlled);
14
+ if (!__isUnControlled) {
15
+ setUncontrolledSelected(props.selected);
16
+ }
17
+ }
18
+ }, [__isUnControlled, isUnControlled]);
19
+ const [uncontrolledSelected, setUncontrolledSelected] = useState(isUnControlled ? props.defaultSelected : props.selected);
20
+ const selectedValueToUse = isUnControlled ? uncontrolledSelected : props.selected;
21
+ const selectedTab = useMemo(() => {
22
+ return firstOrNull(props.tabs, t => t.key === selectedValueToUse);
23
+ }, [props.tabs, selectedValueToUse]);
24
+ return _jsxs(Stack, Object.assign({}, props.container || { direction: "v" }, { children: [_jsx(TabList, Object.assign({}, props.root, { selectedValue: selectedValueToUse, onTabSelect: (e, data) => {
25
+ var _a;
26
+ setUncontrolledSelected(data.value);
27
+ (_a = props.onSelect) === null || _a === void 0 ? void 0 : _a.call(props, data.value);
28
+ }, children: props.tabs.map(t => _jsx(Tab, { value: t.key, children: t.title }, t.key)) })), selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.children] }));
29
+ }
30
+ //# sourceMappingURL=tabs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../src/controls/tabs.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,OAAO,EAA0B,MAAM,4BAA4B,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAa,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAe,KAAK,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;AAkBxC,MAAM,UAAU,MAAM,CAAyB,KAAsB;IACjE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;IAE1F,MAAM,gBAAgB,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAC7D,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,gBAAgB,KAAK,cAAc,EAAE,CAAC;YACtC,MAAM,CAAC,KAAK,CAAC,4FAA4F,CAAC,CAAC;YAC3G,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;YACpC,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACpB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b,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kwiz/fluentui",
3
- "version": "1.0.129",
3
+ "version": "1.0.130",
4
4
  "description": "KWIZ common controls for FluentUI",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",