react-asc 24.0.0 → 25.0.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.
- package/components/Button/Button.d.ts +2 -2
- package/components/FloatingActionButton/FloatingActionButton.d.ts +1 -1
- package/components/Icon/Icon.d.ts +2 -1
- package/components/IconButton/IconButton.d.ts +1 -1
- package/components/List/ListItemAvatar.d.ts +1 -1
- package/components/List/ListItemIcon.d.ts +1 -1
- package/components/Modal/modal.service.d.ts +2 -4
- package/components/Snackbar/snackbar.service.d.ts +3 -2
- package/components/SpeedDial/SpeedDialAction.d.ts +1 -1
- package/components/Tabs/Tab.d.ts +0 -2
- package/components/Tabs/TabContext.d.ts +8 -0
- package/components/Tabs/Tabs.d.ts +2 -6
- package/index.es.js +85 -39
- package/index.js +85 -38
- package/package.json +5 -5
|
@@ -5,8 +5,8 @@ export interface IButtonProps extends React.ComponentProps<'button'> {
|
|
|
5
5
|
isActive?: boolean;
|
|
6
6
|
isRounded?: boolean;
|
|
7
7
|
variant?: VARIANT;
|
|
8
|
-
startIcon?: React.
|
|
9
|
-
endIcon?: React.
|
|
8
|
+
startIcon?: React.ReactNode;
|
|
9
|
+
endIcon?: React.ReactNode;
|
|
10
10
|
shadow?: boolean;
|
|
11
11
|
block?: boolean;
|
|
12
12
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { COLOR, SIZE } from '../component.enums';
|
|
3
3
|
export interface IFloatingActionButtonProps extends React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> {
|
|
4
|
-
icon?: React.
|
|
4
|
+
icon?: React.ReactNode;
|
|
5
5
|
color?: COLOR;
|
|
6
6
|
size?: SIZE;
|
|
7
7
|
fixed?: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ComponentProps } from 'react';
|
|
1
|
+
import React, { ComponentProps } from 'react';
|
|
2
2
|
import { COLOR } from '../component.enums';
|
|
3
3
|
export interface IIconProps extends ComponentProps<'div'> {
|
|
4
4
|
iconColor?: COLOR;
|
|
5
|
+
children?: React.ReactNode;
|
|
5
6
|
}
|
|
6
7
|
export declare const Icon: (props: IIconProps) => JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { COLOR, SIZE, VARIANT } from '../component.enums';
|
|
3
3
|
export interface IIconButtonProps extends React.ComponentProps<'button'> {
|
|
4
|
-
icon?: React.
|
|
4
|
+
icon?: React.ReactNode;
|
|
5
5
|
color?: COLOR;
|
|
6
6
|
size?: SIZE;
|
|
7
7
|
isActive?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
interface IListItemAvatarProps extends React.ComponentProps<'div'> {
|
|
3
|
-
avatar: React.
|
|
3
|
+
avatar: React.ReactNode;
|
|
4
4
|
}
|
|
5
5
|
export declare const ListItemAvatar: ({ avatar, ...rest }: IListItemAvatarProps) => JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
interface IListItemIconProps extends React.ComponentProps<'div'> {
|
|
3
|
-
icon: React.
|
|
3
|
+
icon: React.ReactNode;
|
|
4
4
|
}
|
|
5
5
|
export declare const ListItemIcon: ({ icon, ...rest }: IListItemIconProps) => JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -11,13 +11,11 @@ export interface IModalOptions {
|
|
|
11
11
|
fullScreen?: boolean;
|
|
12
12
|
size?: SIZE;
|
|
13
13
|
}
|
|
14
|
-
export interface IModalFormOptions extends IModalOptions {
|
|
15
|
-
formControls?: IControls;
|
|
16
|
-
}
|
|
17
14
|
declare class ModalService implements IModalService {
|
|
18
15
|
private container;
|
|
16
|
+
private root;
|
|
19
17
|
show(title: string, description: string | ReactElement, options?: IModalOptions): Promise<void>;
|
|
20
|
-
showForm<T>(title: string, options?:
|
|
18
|
+
showForm<T>(title: string, formControls: IControls, options?: IModalOptions): Promise<T>;
|
|
21
19
|
private hide;
|
|
22
20
|
}
|
|
23
21
|
export declare const modalService: ModalService;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { COLOR } from '../component.enums';
|
|
3
3
|
export interface ISnackbarService {
|
|
4
|
-
show(message: React.
|
|
4
|
+
show(message: React.ReactNode | string, options?: ISnackbarOptions): Promise<void>;
|
|
5
5
|
}
|
|
6
6
|
export interface ISnackbarOptions {
|
|
7
7
|
actionText?: string;
|
|
@@ -12,7 +12,8 @@ export interface ISnackbarOptions {
|
|
|
12
12
|
declare class SnackbarService implements ISnackbarService {
|
|
13
13
|
private container;
|
|
14
14
|
private handler;
|
|
15
|
-
|
|
15
|
+
private root;
|
|
16
|
+
show(message: React.ReactNode | string, options?: ISnackbarOptions): Promise<void>;
|
|
16
17
|
private hide;
|
|
17
18
|
}
|
|
18
19
|
export declare const snackbarService: SnackbarService;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { COLOR } from '../component.enums';
|
|
3
3
|
export interface ISpeedDialActionProps extends React.DetailedHTMLProps<React.HtmlHTMLAttributes<HTMLDivElement>, HTMLDivElement> {
|
|
4
|
-
icon: React.
|
|
4
|
+
icon: React.ReactNode;
|
|
5
5
|
tooltipTitle?: string;
|
|
6
6
|
color?: COLOR;
|
|
7
7
|
onClick?: (e: React.MouseEvent) => void;
|
package/components/Tabs/Tab.d.ts
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Dispatch } from 'react';
|
|
2
|
+
export interface ITabsContext {
|
|
3
|
+
fixed: boolean;
|
|
4
|
+
selectedValue: string;
|
|
5
|
+
setSelectedValue: Dispatch<string>;
|
|
6
|
+
}
|
|
7
|
+
export declare const TabContext: import("react").Context<ITabsContext>;
|
|
8
|
+
export declare const useTabContext: () => ITabsContext;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
2
|
import { COLOR } from '../component.enums';
|
|
3
3
|
import { ITabProps } from './Tab';
|
|
4
|
-
export interface ITabOnChangeEvent {
|
|
5
|
-
event: React.MouseEvent;
|
|
6
|
-
newValue: string;
|
|
7
|
-
}
|
|
8
4
|
export interface ITabsProps {
|
|
9
5
|
color?: COLOR;
|
|
10
6
|
indicatorColor?: COLOR;
|
|
11
7
|
children?: ReactElement<ITabProps> | Array<ReactElement<ITabProps>>;
|
|
12
8
|
className?: string;
|
|
13
9
|
fixed?: boolean;
|
|
14
|
-
onChange?: (
|
|
10
|
+
onChange?: (value: string) => void;
|
|
15
11
|
value?: string;
|
|
16
12
|
}
|
|
17
13
|
export declare const Tabs: (props: ITabsProps) => JSX.Element;
|
package/index.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useRef, useEffect, useState, useMemo, createContext, useContext, Fragment, Component, createRef, cloneElement } from 'react';
|
|
2
|
-
import { createPortal, render, unmountComponentAtNode } from 'react-dom';
|
|
2
|
+
import reactDom, { createPortal, render, unmountComponentAtNode } from 'react-dom';
|
|
3
3
|
import { createPopper } from '@popperjs/core';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/******************************************************************************
|
|
6
6
|
Copyright (c) Microsoft Corporation.
|
|
7
7
|
|
|
8
8
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -1879,7 +1879,39 @@ const Modal = (props) => {
|
|
|
1879
1879
|
React.createElement(Backdrop, { onClick: handleClickBackdrop })));
|
|
1880
1880
|
};
|
|
1881
1881
|
|
|
1882
|
-
|
|
1882
|
+
function createCommonjsModule(fn, module) {
|
|
1883
|
+
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
var client = createCommonjsModule(function (module, exports) {
|
|
1887
|
+
|
|
1888
|
+
|
|
1889
|
+
if (process.env.NODE_ENV === 'production') {
|
|
1890
|
+
exports.createRoot = reactDom.createRoot;
|
|
1891
|
+
exports.hydrateRoot = reactDom.hydrateRoot;
|
|
1892
|
+
} else {
|
|
1893
|
+
var i = reactDom.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
1894
|
+
exports.createRoot = function(c, o) {
|
|
1895
|
+
i.usingClientEntryPoint = true;
|
|
1896
|
+
try {
|
|
1897
|
+
return reactDom.createRoot(c, o);
|
|
1898
|
+
} finally {
|
|
1899
|
+
i.usingClientEntryPoint = false;
|
|
1900
|
+
}
|
|
1901
|
+
};
|
|
1902
|
+
exports.hydrateRoot = function(c, h, o) {
|
|
1903
|
+
i.usingClientEntryPoint = true;
|
|
1904
|
+
try {
|
|
1905
|
+
return reactDom.hydrateRoot(c, h, o);
|
|
1906
|
+
} finally {
|
|
1907
|
+
i.usingClientEntryPoint = false;
|
|
1908
|
+
}
|
|
1909
|
+
};
|
|
1910
|
+
}
|
|
1911
|
+
});
|
|
1912
|
+
var client_1 = client.createRoot;
|
|
1913
|
+
client.hydrateRoot;
|
|
1914
|
+
|
|
1883
1915
|
var MODALTYPE;
|
|
1884
1916
|
(function (MODALTYPE) {
|
|
1885
1917
|
MODALTYPE["BASIC"] = "BASIC";
|
|
@@ -1955,11 +1987,12 @@ class ModalService {
|
|
|
1955
1987
|
reject();
|
|
1956
1988
|
this.hide();
|
|
1957
1989
|
};
|
|
1958
|
-
|
|
1990
|
+
this.root = client_1(this.container);
|
|
1991
|
+
this.root.render(React.createElement(GlobalModal, { fullScreen: options && options.fullScreen, size: options && options.size, title: title, description: description, onCancel: handleCancel, onBackdropClick: handleCancel, onOk: handleOk, isDismissable: options && options.isDismissable, buttons: options && options.buttons }));
|
|
1959
1992
|
}
|
|
1960
1993
|
});
|
|
1961
1994
|
}
|
|
1962
|
-
showForm(title, options) {
|
|
1995
|
+
showForm(title, formControls, options) {
|
|
1963
1996
|
return new Promise((resolve, reject) => {
|
|
1964
1997
|
if (!this.container) {
|
|
1965
1998
|
this.container = document.createElement('div');
|
|
@@ -1969,20 +2002,22 @@ class ModalService {
|
|
|
1969
2002
|
this.hide();
|
|
1970
2003
|
};
|
|
1971
2004
|
// TODO - for AutoComplete
|
|
1972
|
-
const handleOnChange = (values) => {
|
|
1973
|
-
|
|
1974
|
-
}
|
|
2005
|
+
// const handleOnChange = (values?: IFormValues) => {
|
|
2006
|
+
// console.info(values);
|
|
2007
|
+
// }
|
|
1975
2008
|
const handleCancel = () => {
|
|
1976
2009
|
reject();
|
|
1977
2010
|
this.hide();
|
|
1978
2011
|
};
|
|
1979
|
-
|
|
2012
|
+
this.root = client_1(this.container);
|
|
2013
|
+
this.root.render(React.createElement(GlobalModal, { fullScreen: options && options.fullScreen, size: options && options.size, title: title, formControls: formControls, onCancel: handleCancel, onBackdropClick: handleCancel, onOk: handleOk, isDismissable: options && options.isDismissable, buttons: options && options.buttons }));
|
|
1980
2014
|
}
|
|
1981
2015
|
});
|
|
1982
2016
|
}
|
|
1983
2017
|
hide() {
|
|
2018
|
+
var _a;
|
|
1984
2019
|
if (this.container) {
|
|
1985
|
-
|
|
2020
|
+
(_a = this.root) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
1986
2021
|
document.body.removeChild(this.container);
|
|
1987
2022
|
this.container = undefined;
|
|
1988
2023
|
}
|
|
@@ -2219,12 +2254,14 @@ class SnackbarService {
|
|
|
2219
2254
|
resolve();
|
|
2220
2255
|
this.hide();
|
|
2221
2256
|
};
|
|
2222
|
-
|
|
2257
|
+
this.root = client_1(this.container);
|
|
2258
|
+
this.root.render(React.createElement(Snackbar, { color: mergedOptions.color, actionText: mergedOptions.actionText, onOk: handleOk }, message));
|
|
2223
2259
|
});
|
|
2224
2260
|
}
|
|
2225
2261
|
hide() {
|
|
2262
|
+
var _a;
|
|
2226
2263
|
if (this.container) {
|
|
2227
|
-
|
|
2264
|
+
(_a = this.root) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
2228
2265
|
document.body.removeChild(this.container);
|
|
2229
2266
|
this.container = undefined;
|
|
2230
2267
|
this.handler && clearTimeout(this.handler);
|
|
@@ -2625,6 +2662,13 @@ const TableCell = (props) => {
|
|
|
2625
2662
|
React.createElement("td", Object.assign({}, rest), children)) }, children));
|
|
2626
2663
|
};
|
|
2627
2664
|
|
|
2665
|
+
const TabContext = createContext({
|
|
2666
|
+
fixed: false,
|
|
2667
|
+
selectedValue: '',
|
|
2668
|
+
setSelectedValue: () => { }
|
|
2669
|
+
});
|
|
2670
|
+
const useTabContext = () => useContext(TabContext);
|
|
2671
|
+
|
|
2628
2672
|
var css_248z$4 = ".TabIndicator-module_tabIndicator__jSJhH {\n bottom: 0;\n height: 2px;\n position: absolute;\n transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n}\n.TabIndicator-module_tabIndicator__jSJhH.TabIndicator-module_primary__Q5jEo {\n background-color: var(--primary);\n}\n.TabIndicator-module_tabIndicator__jSJhH.TabIndicator-module_accent__qbgIG {\n background-color: var(--accent);\n}";
|
|
2629
2673
|
var styles$4 = {"tabIndicator":"TabIndicator-module_tabIndicator__jSJhH","primary":"TabIndicator-module_primary__Q5jEo","accent":"TabIndicator-module_accent__qbgIG"};
|
|
2630
2674
|
styleInject(css_248z$4);
|
|
@@ -2648,40 +2692,40 @@ var styles$3 = {"tabs":"Tabs-module_tabs__YyRTZ"};
|
|
|
2648
2692
|
styleInject(css_248z$3);
|
|
2649
2693
|
|
|
2650
2694
|
const Tabs = (props) => {
|
|
2651
|
-
const { children, className, fixed, color, indicatorColor
|
|
2652
|
-
const [selectedValue, setSelectedValue] = useState(
|
|
2653
|
-
const [selectedIndex, setSelectedIndex] = useState();
|
|
2695
|
+
const { children, className, fixed = false, color, indicatorColor = COLOR.accent, value, onChange } = props;
|
|
2696
|
+
const [selectedValue, setSelectedValue] = useState('');
|
|
2697
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
2698
|
+
const tabContext = ({
|
|
2699
|
+
selectedValue,
|
|
2700
|
+
setSelectedValue,
|
|
2701
|
+
fixed
|
|
2702
|
+
});
|
|
2703
|
+
const prevSelectedValueRef = useRef();
|
|
2704
|
+
useEffect(() => {
|
|
2705
|
+
if (value !== undefined && value !== prevSelectedValueRef.current) {
|
|
2706
|
+
setSelectedValue(value);
|
|
2707
|
+
}
|
|
2708
|
+
}, [value]);
|
|
2654
2709
|
useEffect(() => {
|
|
2655
2710
|
React.Children.toArray(children).forEach((child, index) => {
|
|
2656
|
-
if (child.props.value ===
|
|
2711
|
+
if (child.props.value === selectedValue) {
|
|
2657
2712
|
setSelectedIndex(index);
|
|
2713
|
+
onChange && onChange(selectedValue);
|
|
2658
2714
|
}
|
|
2659
2715
|
});
|
|
2660
|
-
}, [children,
|
|
2716
|
+
}, [children, selectedValue]);
|
|
2661
2717
|
const getCssClasses = () => {
|
|
2662
2718
|
const cssClasses = [];
|
|
2663
2719
|
cssClasses.push(styles$3.tabs);
|
|
2664
2720
|
className && cssClasses.push(className);
|
|
2665
2721
|
return cssClasses.filter(css => css).join(' ');
|
|
2666
2722
|
};
|
|
2667
|
-
const handleClickTab = (event, newValue, index) => {
|
|
2668
|
-
setSelectedValue(newValue);
|
|
2669
|
-
setSelectedIndex(index);
|
|
2670
|
-
onChange && onChange({ event, newValue });
|
|
2671
|
-
};
|
|
2672
|
-
const renderTabs = (child, index) => {
|
|
2673
|
-
return React.isValidElement(child) && cloneElement(child, {
|
|
2674
|
-
key: child.props.value,
|
|
2675
|
-
isActive: child.props.value === selectedValue,
|
|
2676
|
-
fixed: fixed,
|
|
2677
|
-
onClick: (e) => handleClickTab(e.event, e.value, index),
|
|
2678
|
-
});
|
|
2679
|
-
};
|
|
2680
2723
|
return (React.createElement(ButtonContext.Provider, { value: { color: color || COLOR.light } },
|
|
2681
|
-
React.createElement(
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2724
|
+
React.createElement(TabContext.Provider, { value: tabContext },
|
|
2725
|
+
React.createElement("div", { className: getCssClasses() },
|
|
2726
|
+
children,
|
|
2727
|
+
children &&
|
|
2728
|
+
React.createElement(TabIndicator, { color: indicatorColor, width: (100 / React.Children.toArray(children).length) + '%', index: selectedIndex, amount: React.Children.toArray(children).length })))));
|
|
2685
2729
|
};
|
|
2686
2730
|
|
|
2687
2731
|
var css_248z$2 = ".Tab-module_tab__Q8w1f {\n padding: 6px 12px;\n overflow: hidden;\n position: relative;\n font-size: 0.875rem;\n min-width: 72px;\n box-sizing: border-box;\n min-height: 48px;\n text-align: center;\n font-weight: 500;\n line-height: 1.75;\n white-space: normal;\n letter-spacing: 0.02857em;\n text-transform: uppercase;\n border-radius: 0;\n flex-grow: 1;\n flex-basis: 0;\n transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n}";
|
|
@@ -2689,17 +2733,19 @@ var styles$2 = {"tab":"Tab-module_tab__Q8w1f"};
|
|
|
2689
2733
|
styleInject(css_248z$2);
|
|
2690
2734
|
|
|
2691
2735
|
const Tab = (props) => {
|
|
2692
|
-
const { label, className,
|
|
2736
|
+
const { label, className, disabled, value, onClick } = props;
|
|
2737
|
+
const { selectedValue, setSelectedValue } = useTabContext();
|
|
2693
2738
|
const getCssClasses = () => {
|
|
2694
2739
|
const cssClasses = [];
|
|
2695
2740
|
cssClasses.push(styles$2.tab);
|
|
2696
|
-
if (isActive) {
|
|
2697
|
-
cssClasses.push(`show active`);
|
|
2698
|
-
}
|
|
2699
2741
|
className && cssClasses.push(className);
|
|
2700
2742
|
return cssClasses.filter(css => css).join(' ');
|
|
2701
2743
|
};
|
|
2702
|
-
|
|
2744
|
+
const handleClick = (event) => {
|
|
2745
|
+
onClick && onClick({ event, value });
|
|
2746
|
+
setSelectedValue(value);
|
|
2747
|
+
};
|
|
2748
|
+
return (React.createElement(Button, { className: getCssClasses(), onClick: handleClick, isActive: selectedValue === value, disabled: disabled }, label));
|
|
2703
2749
|
};
|
|
2704
2750
|
|
|
2705
2751
|
const TabPanel = (props) => {
|
package/index.js
CHANGED
|
@@ -9,8 +9,9 @@ var core = require('@popperjs/core');
|
|
|
9
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
10
|
|
|
11
11
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
12
|
+
var reactDom__default = /*#__PURE__*/_interopDefaultLegacy(reactDom);
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
/******************************************************************************
|
|
14
15
|
Copyright (c) Microsoft Corporation.
|
|
15
16
|
|
|
16
17
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -1887,7 +1888,39 @@ const Modal = (props) => {
|
|
|
1887
1888
|
React__default["default"].createElement(Backdrop, { onClick: handleClickBackdrop })));
|
|
1888
1889
|
};
|
|
1889
1890
|
|
|
1890
|
-
|
|
1891
|
+
function createCommonjsModule(fn, module) {
|
|
1892
|
+
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
var client = createCommonjsModule(function (module, exports) {
|
|
1896
|
+
|
|
1897
|
+
|
|
1898
|
+
if (process.env.NODE_ENV === 'production') {
|
|
1899
|
+
exports.createRoot = reactDom__default["default"].createRoot;
|
|
1900
|
+
exports.hydrateRoot = reactDom__default["default"].hydrateRoot;
|
|
1901
|
+
} else {
|
|
1902
|
+
var i = reactDom__default["default"].__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
1903
|
+
exports.createRoot = function(c, o) {
|
|
1904
|
+
i.usingClientEntryPoint = true;
|
|
1905
|
+
try {
|
|
1906
|
+
return reactDom__default["default"].createRoot(c, o);
|
|
1907
|
+
} finally {
|
|
1908
|
+
i.usingClientEntryPoint = false;
|
|
1909
|
+
}
|
|
1910
|
+
};
|
|
1911
|
+
exports.hydrateRoot = function(c, h, o) {
|
|
1912
|
+
i.usingClientEntryPoint = true;
|
|
1913
|
+
try {
|
|
1914
|
+
return reactDom__default["default"].hydrateRoot(c, h, o);
|
|
1915
|
+
} finally {
|
|
1916
|
+
i.usingClientEntryPoint = false;
|
|
1917
|
+
}
|
|
1918
|
+
};
|
|
1919
|
+
}
|
|
1920
|
+
});
|
|
1921
|
+
var client_1 = client.createRoot;
|
|
1922
|
+
client.hydrateRoot;
|
|
1923
|
+
|
|
1891
1924
|
exports.MODALTYPE = void 0;
|
|
1892
1925
|
(function (MODALTYPE) {
|
|
1893
1926
|
MODALTYPE["BASIC"] = "BASIC";
|
|
@@ -1963,11 +1996,12 @@ class ModalService {
|
|
|
1963
1996
|
reject();
|
|
1964
1997
|
this.hide();
|
|
1965
1998
|
};
|
|
1966
|
-
|
|
1999
|
+
this.root = client_1(this.container);
|
|
2000
|
+
this.root.render(React__default["default"].createElement(GlobalModal, { fullScreen: options && options.fullScreen, size: options && options.size, title: title, description: description, onCancel: handleCancel, onBackdropClick: handleCancel, onOk: handleOk, isDismissable: options && options.isDismissable, buttons: options && options.buttons }));
|
|
1967
2001
|
}
|
|
1968
2002
|
});
|
|
1969
2003
|
}
|
|
1970
|
-
showForm(title, options) {
|
|
2004
|
+
showForm(title, formControls, options) {
|
|
1971
2005
|
return new Promise((resolve, reject) => {
|
|
1972
2006
|
if (!this.container) {
|
|
1973
2007
|
this.container = document.createElement('div');
|
|
@@ -1977,20 +2011,22 @@ class ModalService {
|
|
|
1977
2011
|
this.hide();
|
|
1978
2012
|
};
|
|
1979
2013
|
// TODO - for AutoComplete
|
|
1980
|
-
const handleOnChange = (values) => {
|
|
1981
|
-
|
|
1982
|
-
}
|
|
2014
|
+
// const handleOnChange = (values?: IFormValues) => {
|
|
2015
|
+
// console.info(values);
|
|
2016
|
+
// }
|
|
1983
2017
|
const handleCancel = () => {
|
|
1984
2018
|
reject();
|
|
1985
2019
|
this.hide();
|
|
1986
2020
|
};
|
|
1987
|
-
|
|
2021
|
+
this.root = client_1(this.container);
|
|
2022
|
+
this.root.render(React__default["default"].createElement(GlobalModal, { fullScreen: options && options.fullScreen, size: options && options.size, title: title, formControls: formControls, onCancel: handleCancel, onBackdropClick: handleCancel, onOk: handleOk, isDismissable: options && options.isDismissable, buttons: options && options.buttons }));
|
|
1988
2023
|
}
|
|
1989
2024
|
});
|
|
1990
2025
|
}
|
|
1991
2026
|
hide() {
|
|
2027
|
+
var _a;
|
|
1992
2028
|
if (this.container) {
|
|
1993
|
-
|
|
2029
|
+
(_a = this.root) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
1994
2030
|
document.body.removeChild(this.container);
|
|
1995
2031
|
this.container = undefined;
|
|
1996
2032
|
}
|
|
@@ -2227,12 +2263,14 @@ class SnackbarService {
|
|
|
2227
2263
|
resolve();
|
|
2228
2264
|
this.hide();
|
|
2229
2265
|
};
|
|
2230
|
-
|
|
2266
|
+
this.root = client_1(this.container);
|
|
2267
|
+
this.root.render(React__default["default"].createElement(Snackbar, { color: mergedOptions.color, actionText: mergedOptions.actionText, onOk: handleOk }, message));
|
|
2231
2268
|
});
|
|
2232
2269
|
}
|
|
2233
2270
|
hide() {
|
|
2271
|
+
var _a;
|
|
2234
2272
|
if (this.container) {
|
|
2235
|
-
|
|
2273
|
+
(_a = this.root) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
2236
2274
|
document.body.removeChild(this.container);
|
|
2237
2275
|
this.container = undefined;
|
|
2238
2276
|
this.handler && clearTimeout(this.handler);
|
|
@@ -2633,6 +2671,13 @@ const TableCell = (props) => {
|
|
|
2633
2671
|
React__default["default"].createElement("td", Object.assign({}, rest), children)) }, children));
|
|
2634
2672
|
};
|
|
2635
2673
|
|
|
2674
|
+
const TabContext = React.createContext({
|
|
2675
|
+
fixed: false,
|
|
2676
|
+
selectedValue: '',
|
|
2677
|
+
setSelectedValue: () => { }
|
|
2678
|
+
});
|
|
2679
|
+
const useTabContext = () => React.useContext(TabContext);
|
|
2680
|
+
|
|
2636
2681
|
var css_248z$4 = ".TabIndicator-module_tabIndicator__jSJhH {\n bottom: 0;\n height: 2px;\n position: absolute;\n transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n}\n.TabIndicator-module_tabIndicator__jSJhH.TabIndicator-module_primary__Q5jEo {\n background-color: var(--primary);\n}\n.TabIndicator-module_tabIndicator__jSJhH.TabIndicator-module_accent__qbgIG {\n background-color: var(--accent);\n}";
|
|
2637
2682
|
var styles$4 = {"tabIndicator":"TabIndicator-module_tabIndicator__jSJhH","primary":"TabIndicator-module_primary__Q5jEo","accent":"TabIndicator-module_accent__qbgIG"};
|
|
2638
2683
|
styleInject(css_248z$4);
|
|
@@ -2656,40 +2701,40 @@ var styles$3 = {"tabs":"Tabs-module_tabs__YyRTZ"};
|
|
|
2656
2701
|
styleInject(css_248z$3);
|
|
2657
2702
|
|
|
2658
2703
|
const Tabs = (props) => {
|
|
2659
|
-
const { children, className, fixed, color, indicatorColor
|
|
2660
|
-
const [selectedValue, setSelectedValue] = React.useState(
|
|
2661
|
-
const [selectedIndex, setSelectedIndex] = React.useState();
|
|
2704
|
+
const { children, className, fixed = false, color, indicatorColor = exports.COLOR.accent, value, onChange } = props;
|
|
2705
|
+
const [selectedValue, setSelectedValue] = React.useState('');
|
|
2706
|
+
const [selectedIndex, setSelectedIndex] = React.useState(0);
|
|
2707
|
+
const tabContext = ({
|
|
2708
|
+
selectedValue,
|
|
2709
|
+
setSelectedValue,
|
|
2710
|
+
fixed
|
|
2711
|
+
});
|
|
2712
|
+
const prevSelectedValueRef = React.useRef();
|
|
2713
|
+
React.useEffect(() => {
|
|
2714
|
+
if (value !== undefined && value !== prevSelectedValueRef.current) {
|
|
2715
|
+
setSelectedValue(value);
|
|
2716
|
+
}
|
|
2717
|
+
}, [value]);
|
|
2662
2718
|
React.useEffect(() => {
|
|
2663
2719
|
React__default["default"].Children.toArray(children).forEach((child, index) => {
|
|
2664
|
-
if (child.props.value ===
|
|
2720
|
+
if (child.props.value === selectedValue) {
|
|
2665
2721
|
setSelectedIndex(index);
|
|
2722
|
+
onChange && onChange(selectedValue);
|
|
2666
2723
|
}
|
|
2667
2724
|
});
|
|
2668
|
-
}, [children,
|
|
2725
|
+
}, [children, selectedValue]);
|
|
2669
2726
|
const getCssClasses = () => {
|
|
2670
2727
|
const cssClasses = [];
|
|
2671
2728
|
cssClasses.push(styles$3.tabs);
|
|
2672
2729
|
className && cssClasses.push(className);
|
|
2673
2730
|
return cssClasses.filter(css => css).join(' ');
|
|
2674
2731
|
};
|
|
2675
|
-
const handleClickTab = (event, newValue, index) => {
|
|
2676
|
-
setSelectedValue(newValue);
|
|
2677
|
-
setSelectedIndex(index);
|
|
2678
|
-
onChange && onChange({ event, newValue });
|
|
2679
|
-
};
|
|
2680
|
-
const renderTabs = (child, index) => {
|
|
2681
|
-
return React__default["default"].isValidElement(child) && React.cloneElement(child, {
|
|
2682
|
-
key: child.props.value,
|
|
2683
|
-
isActive: child.props.value === selectedValue,
|
|
2684
|
-
fixed: fixed,
|
|
2685
|
-
onClick: (e) => handleClickTab(e.event, e.value, index),
|
|
2686
|
-
});
|
|
2687
|
-
};
|
|
2688
2732
|
return (React__default["default"].createElement(ButtonContext.Provider, { value: { color: color || exports.COLOR.light } },
|
|
2689
|
-
React__default["default"].createElement(
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2733
|
+
React__default["default"].createElement(TabContext.Provider, { value: tabContext },
|
|
2734
|
+
React__default["default"].createElement("div", { className: getCssClasses() },
|
|
2735
|
+
children,
|
|
2736
|
+
children &&
|
|
2737
|
+
React__default["default"].createElement(TabIndicator, { color: indicatorColor, width: (100 / React__default["default"].Children.toArray(children).length) + '%', index: selectedIndex, amount: React__default["default"].Children.toArray(children).length })))));
|
|
2693
2738
|
};
|
|
2694
2739
|
|
|
2695
2740
|
var css_248z$2 = ".Tab-module_tab__Q8w1f {\n padding: 6px 12px;\n overflow: hidden;\n position: relative;\n font-size: 0.875rem;\n min-width: 72px;\n box-sizing: border-box;\n min-height: 48px;\n text-align: center;\n font-weight: 500;\n line-height: 1.75;\n white-space: normal;\n letter-spacing: 0.02857em;\n text-transform: uppercase;\n border-radius: 0;\n flex-grow: 1;\n flex-basis: 0;\n transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n}";
|
|
@@ -2697,17 +2742,19 @@ var styles$2 = {"tab":"Tab-module_tab__Q8w1f"};
|
|
|
2697
2742
|
styleInject(css_248z$2);
|
|
2698
2743
|
|
|
2699
2744
|
const Tab = (props) => {
|
|
2700
|
-
const { label, className,
|
|
2745
|
+
const { label, className, disabled, value, onClick } = props;
|
|
2746
|
+
const { selectedValue, setSelectedValue } = useTabContext();
|
|
2701
2747
|
const getCssClasses = () => {
|
|
2702
2748
|
const cssClasses = [];
|
|
2703
2749
|
cssClasses.push(styles$2.tab);
|
|
2704
|
-
if (isActive) {
|
|
2705
|
-
cssClasses.push(`show active`);
|
|
2706
|
-
}
|
|
2707
2750
|
className && cssClasses.push(className);
|
|
2708
2751
|
return cssClasses.filter(css => css).join(' ');
|
|
2709
2752
|
};
|
|
2710
|
-
|
|
2753
|
+
const handleClick = (event) => {
|
|
2754
|
+
onClick && onClick({ event, value });
|
|
2755
|
+
setSelectedValue(value);
|
|
2756
|
+
};
|
|
2757
|
+
return (React__default["default"].createElement(Button, { className: getCssClasses(), onClick: handleClick, isActive: selectedValue === value, disabled: disabled }, label));
|
|
2711
2758
|
};
|
|
2712
2759
|
|
|
2713
2760
|
const TabPanel = (props) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-asc",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.0",
|
|
4
4
|
"description": "handcrafted react components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.es.js",
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"homepage": "https://react-asc.netlify.app",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@popperjs/core": "2.
|
|
13
|
-
"react": "
|
|
14
|
-
"react-dom": "
|
|
15
|
-
"modern-normalize": "
|
|
12
|
+
"@popperjs/core": "2.11.5",
|
|
13
|
+
"react": "18.2.0",
|
|
14
|
+
"react-dom": "18.2.0",
|
|
15
|
+
"modern-normalize": "1.1.0"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
18
|
"pub": "npm publish --access public"
|