@rivtn/noseur 1.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.
Files changed (138) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2 -0
  3. package/dist/esm/Template.d.ts +7 -0
  4. package/dist/esm/Template.js +13 -0
  5. package/dist/esm/compose/Composed.css +437 -0
  6. package/dist/esm/compose/exotic/ColorPicker.d.ts +41 -0
  7. package/dist/esm/compose/exotic/ColorPicker.js +85 -0
  8. package/dist/esm/compose/exotic/ColorSlider.d.ts +30 -0
  9. package/dist/esm/compose/exotic/ColorSlider.js +99 -0
  10. package/dist/esm/compose/form/ComposedPassword.d.ts +25 -0
  11. package/dist/esm/compose/form/ComposedPassword.js +103 -0
  12. package/dist/esm/compose/form/DateTimeInput.d.ts +28 -0
  13. package/dist/esm/compose/form/DateTimeInput.js +154 -0
  14. package/dist/esm/compose/form/DateTimePicker.d.ts +341 -0
  15. package/dist/esm/compose/form/DateTimePicker.js +1265 -0
  16. package/dist/esm/compose/form/FormControl.d.ts +33 -0
  17. package/dist/esm/compose/form/FormControl.js +163 -0
  18. package/dist/esm/compose/form/FormGroup.d.ts +14 -0
  19. package/dist/esm/compose/form/FormGroup.js +58 -0
  20. package/dist/esm/compose/overlay/Alert.d.ts +56 -0
  21. package/dist/esm/compose/overlay/Alert.js +267 -0
  22. package/dist/esm/constants/Alignment.d.ts +17 -0
  23. package/dist/esm/constants/Alignment.js +18 -0
  24. package/dist/esm/constants/Direction.d.ts +26 -0
  25. package/dist/esm/constants/Direction.js +22 -0
  26. package/dist/esm/constants/Orientation.d.ts +8 -0
  27. package/dist/esm/constants/Orientation.js +9 -0
  28. package/dist/esm/constants/Scheme.d.ts +39 -0
  29. package/dist/esm/constants/Scheme.js +43 -0
  30. package/dist/esm/constants/Transition.d.ts +81 -0
  31. package/dist/esm/constants/Transition.js +85 -0
  32. package/dist/esm/constants/Types.d.ts +74 -0
  33. package/dist/esm/constants/Types.js +14 -0
  34. package/dist/esm/core/ComponentBaseProps.d.ts +53 -0
  35. package/dist/esm/core/ComponentBaseProps.js +33 -0
  36. package/dist/esm/core/noseur.css +2390 -0
  37. package/dist/esm/data/Column.d.ts +235 -0
  38. package/dist/esm/data/Column.js +98 -0
  39. package/dist/esm/data/Data.css +213 -0
  40. package/dist/esm/data/Data.d.ts +98 -0
  41. package/dist/esm/data/Data.js +142 -0
  42. package/dist/esm/data/List.d.ts +14 -0
  43. package/dist/esm/data/List.js +117 -0
  44. package/dist/esm/data/Table.d.ts +22 -0
  45. package/dist/esm/data/Table.js +236 -0
  46. package/dist/esm/form/Button.d.ts +35 -0
  47. package/dist/esm/form/Button.js +131 -0
  48. package/dist/esm/form/Calendar.d.ts +20 -0
  49. package/dist/esm/form/Calendar.js +46 -0
  50. package/dist/esm/form/Checkbox.d.ts +20 -0
  51. package/dist/esm/form/Checkbox.js +155 -0
  52. package/dist/esm/form/ColorMap.d.ts +22 -0
  53. package/dist/esm/form/ColorMap.js +43 -0
  54. package/dist/esm/form/ColorPalette.d.ts +28 -0
  55. package/dist/esm/form/ColorPalette.js +87 -0
  56. package/dist/esm/form/Dropdown.d.ts +78 -0
  57. package/dist/esm/form/Dropdown.js +360 -0
  58. package/dist/esm/form/FileInput.d.ts +134 -0
  59. package/dist/esm/form/FileInput.js +523 -0
  60. package/dist/esm/form/Form.css +467 -0
  61. package/dist/esm/form/Input.d.ts +45 -0
  62. package/dist/esm/form/Input.js +186 -0
  63. package/dist/esm/form/RadioButton.d.ts +21 -0
  64. package/dist/esm/form/RadioButton.js +178 -0
  65. package/dist/esm/form/Slider.d.ts +21 -0
  66. package/dist/esm/form/Slider.js +163 -0
  67. package/dist/esm/hooks/useSearchParams.d.ts +15 -0
  68. package/dist/esm/hooks/useSearchParams.js +50 -0
  69. package/dist/esm/hooks/useSubscription.d.ts +9 -0
  70. package/dist/esm/hooks/useSubscription.js +26 -0
  71. package/dist/esm/index.d.ts +60 -0
  72. package/dist/esm/index.js +73 -0
  73. package/dist/esm/layout/GridView.d.ts +23 -0
  74. package/dist/esm/layout/GridView.js +34 -0
  75. package/dist/esm/layout/Layout.css +5 -0
  76. package/dist/esm/misc/Misc.css +164 -0
  77. package/dist/esm/misc/ProgressBar.d.ts +22 -0
  78. package/dist/esm/misc/ProgressBar.js +86 -0
  79. package/dist/esm/overlay/Dialog.d.ts +46 -0
  80. package/dist/esm/overlay/Dialog.js +290 -0
  81. package/dist/esm/overlay/Message.d.ts +35 -0
  82. package/dist/esm/overlay/Message.js +187 -0
  83. package/dist/esm/overlay/Overlay.css +382 -0
  84. package/dist/esm/overlay/Popover.d.ts +30 -0
  85. package/dist/esm/overlay/Popover.js +245 -0
  86. package/dist/esm/overlay/Portal.d.ts +11 -0
  87. package/dist/esm/overlay/Portal.js +29 -0
  88. package/dist/esm/overlay/Toast.d.ts +49 -0
  89. package/dist/esm/overlay/Toast.js +341 -0
  90. package/dist/esm/panel/Accordion.d.ts +26 -0
  91. package/dist/esm/panel/Accordion.js +127 -0
  92. package/dist/esm/panel/Panel.css +317 -0
  93. package/dist/esm/panel/Panel.d.ts +43 -0
  94. package/dist/esm/panel/Panel.js +125 -0
  95. package/dist/esm/panel/ScrollPanel.d.ts +27 -0
  96. package/dist/esm/panel/ScrollPanel.js +43 -0
  97. package/dist/esm/panel/TabPane.d.ts +82 -0
  98. package/dist/esm/panel/TabPane.js +237 -0
  99. package/dist/esm/presentation/Chart.d.ts +49 -0
  100. package/dist/esm/presentation/Chart.js +62 -0
  101. package/dist/esm/presentation/Paginator.d.ts +90 -0
  102. package/dist/esm/presentation/Paginator.js +331 -0
  103. package/dist/esm/presentation/Presentation.css +23 -0
  104. package/dist/esm/sensor/DragSensor.d.ts +50 -0
  105. package/dist/esm/sensor/DragSensor.js +156 -0
  106. package/dist/esm/sensor/ViewportSensor.d.ts +18 -0
  107. package/dist/esm/sensor/ViewportSensor.js +85 -0
  108. package/dist/esm/utils/BoolHelper.d.ts +13 -0
  109. package/dist/esm/utils/BoolHelper.js +105 -0
  110. package/dist/esm/utils/Classname.d.ts +9 -0
  111. package/dist/esm/utils/Classname.js +20 -0
  112. package/dist/esm/utils/ColorHelper.d.ts +127 -0
  113. package/dist/esm/utils/ColorHelper.js +198 -0
  114. package/dist/esm/utils/DOMUtils.d.ts +142 -0
  115. package/dist/esm/utils/DOMUtils.js +759 -0
  116. package/dist/esm/utils/DateHelper.d.ts +115 -0
  117. package/dist/esm/utils/DateHelper.js +338 -0
  118. package/dist/esm/utils/Debugger.d.ts +12 -0
  119. package/dist/esm/utils/Debugger.js +30 -0
  120. package/dist/esm/utils/FileHelper.d.ts +8 -0
  121. package/dist/esm/utils/FileHelper.js +65 -0
  122. package/dist/esm/utils/FunctionStackManager.d.ts +13 -0
  123. package/dist/esm/utils/FunctionStackManager.js +59 -0
  124. package/dist/esm/utils/InputHelper.d.ts +37 -0
  125. package/dist/esm/utils/InputHelper.js +70 -0
  126. package/dist/esm/utils/MicroBuilder.d.ts +24 -0
  127. package/dist/esm/utils/MicroBuilder.js +61 -0
  128. package/dist/esm/utils/ObjectHelper.d.ts +51 -0
  129. package/dist/esm/utils/ObjectHelper.js +334 -0
  130. package/dist/esm/utils/StringHelper.d.ts +10 -0
  131. package/dist/esm/utils/StringHelper.js +54 -0
  132. package/dist/esm/utils/Subscriber.d.ts +14 -0
  133. package/dist/esm/utils/Subscriber.js +27 -0
  134. package/dist/esm/utils/Timer.d.ts +32 -0
  135. package/dist/esm/utils/Timer.js +68 -0
  136. package/dist/esm/utils/TypeChecker.d.ts +12 -0
  137. package/dist/esm/utils/TypeChecker.js +38 -0
  138. package/package.json +63 -0
@@ -0,0 +1,43 @@
1
+ import React from "react";
2
+ import { Classname } from "../utils/Classname";
3
+ import { Scheme } from "../constants/Scheme";
4
+ class ScrollPanelComponent extends React.Component {
5
+ static defaultProps = {};
6
+ state = {};
7
+ constructor(props) {
8
+ super(props);
9
+ }
10
+ render() {
11
+ const component = this.props.isForm ? "form" : "div";
12
+ const className = Classname.build("noseur-scrollpanel", {
13
+ 'noseur-skeleton': this.props.scheme === Scheme.SKELETON,
14
+ 'noseur-scrollpanel-always-show-scrollbars': this.props.alwaysScroll,
15
+ 'noseur-scrollpanel-always-show-scrollbar-x': this.props.alwaysScrollX,
16
+ 'noseur-scrollpanel-always-show-scrollbar-y': this.props.alwaysScrollY,
17
+ 'noseur-scrollpanel-hidden-scrollbar-x': this.props.hideScrollBars ?? this.props.hideScrollBarX,
18
+ 'noseur-scrollpanel-hidden-scrollbar-y': this.props.hideScrollBars ?? this.props.hideScrollBarY
19
+ }, (this.props.scheme ? `${this.props.scheme}-vars` : null), this.props.className);
20
+ const style = {
21
+ ...(this.props.style ?? {})
22
+ };
23
+ if (this.props.scroller?.trackBg)
24
+ style["--scrollTrackBg"] = this.props.scroller?.trackBg;
25
+ if (this.props.scroller?.thumbBg)
26
+ style["--scrollThumbBg"] = this.props.scroller?.thumbBg;
27
+ if (this.props.scroller?.trackWidth)
28
+ style["--scrollTrackWidth"] = this.props.scroller?.trackWidth + "px";
29
+ if (this.props.scroller?.trackBorderRadius)
30
+ style["--scrollTrackBorderRadius"] = this.props.scroller?.trackBorderRadius + "px";
31
+ if (this.props.scroller?.thumbBorderRadius)
32
+ style["--scrollThumbBorderRadius"] = this.props.scroller?.thumbBorderRadius + "px";
33
+ return React.createElement(component, {
34
+ style,
35
+ className,
36
+ id: this.props.id,
37
+ key: this.props.key,
38
+ name: this.props.name,
39
+ }, this.props.children);
40
+ }
41
+ ;
42
+ }
43
+ export const ScrollPanel = ({ ref, ...props }) => (React.createElement(ScrollPanelComponent, { ...props, forwardRef: ref }));
@@ -0,0 +1,82 @@
1
+ import React from "react";
2
+ import { Scheme } from "../constants/Scheme";
3
+ import { Alignment } from "../constants/Alignment";
4
+ import { NoseurElement, NoseurLabel } from "../constants/Types";
5
+ import { ComponentBaseProps, ComponentElementBasicAttributes, TransitionProps } from "../core/ComponentBaseProps";
6
+ export interface TabPanelHeaderOptions {
7
+ index: number;
8
+ scheme: string;
9
+ className: string;
10
+ selected: boolean;
11
+ idleScheme: string;
12
+ props: TabPanelProps;
13
+ onClick: (e: any) => void;
14
+ titleElement: NoseurElement;
15
+ removeElement: NoseurElement;
16
+ leftIconElement: NoseurElement;
17
+ rightIconElement: NoseurElement;
18
+ }
19
+ export type TabPanelHeaderTemplate = (options?: TabPanelHeaderOptions) => NoseurElement;
20
+ export type TabPanelAttributesRelays = {
21
+ header?: ComponentElementBasicAttributes;
22
+ };
23
+ export interface TabPanelManageRef {
24
+ }
25
+ export interface TabPanelProps extends ComponentBaseProps<HTMLDivElement, TabPanelManageRef, TabPanelAttributesRelays> {
26
+ fill: boolean;
27
+ idleScheme: Scheme;
28
+ removable: boolean;
29
+ header: NoseurLabel;
30
+ noUnderline: boolean;
31
+ leftIcon: NoseurElement;
32
+ rightIcon: NoseurElement;
33
+ removeIcon: NoseurElement;
34
+ headerTemplate: TabPanelHeaderTemplate;
35
+ }
36
+ export type TabPaneEventHandler = (index: number) => boolean | void;
37
+ export type TabPaneChangeEventHandler = (state: "active" | "close", index: number) => void;
38
+ export type TabPaneAttributesRelays = {
39
+ content?: ComponentElementBasicAttributes;
40
+ navigator?: {
41
+ headers?: TabPanelAttributesRelays & ComponentElementBasicAttributes;
42
+ control?: {
43
+ prev?: ComponentElementBasicAttributes;
44
+ next?: ComponentElementBasicAttributes;
45
+ };
46
+ } & ComponentElementBasicAttributes;
47
+ };
48
+ export interface TabPaneManageRef {
49
+ next: () => void;
50
+ previous: () => void;
51
+ activeTab: () => number;
52
+ readd: (index: number) => void;
53
+ switch: (index: number) => void;
54
+ remove: (index: number) => void;
55
+ }
56
+ export interface TabPaneProps extends ComponentBaseProps<HTMLDivElement, TabPaneManageRef, TabPaneAttributesRelays>, TransitionProps {
57
+ cyclic: boolean;
58
+ idleScheme: Scheme;
59
+ activeIndex: number;
60
+ scrollable: boolean;
61
+ noUnderline: boolean;
62
+ alignment: Alignment;
63
+ renderActiveTabOnly: boolean;
64
+ children: React.ReactElement<TabPanelProps> | React.ReactElement<TabPanelProps>[] | any;
65
+ scrollIcons: {
66
+ horizontal: {
67
+ prev: NoseurElement;
68
+ next: NoseurElement;
69
+ };
70
+ vertical: {
71
+ prev: NoseurElement;
72
+ next: NoseurElement;
73
+ };
74
+ };
75
+ onTabClose: TabPaneEventHandler;
76
+ onTabActive: TabPaneEventHandler;
77
+ onBeforeTabClose: TabPaneEventHandler;
78
+ onBeforeTabActive: TabPaneEventHandler;
79
+ onTabChange: TabPaneChangeEventHandler;
80
+ }
81
+ export declare const TabPanel: ({ ref, ...props }: Partial<TabPanelProps>) => React.JSX.Element;
82
+ export declare const TabPane: ({ ref, ...props }: Partial<TabPaneProps>) => React.JSX.Element;
@@ -0,0 +1,237 @@
1
+ import React from "react";
2
+ import { Button } from "../form/Button";
3
+ import { Scheme } from "../constants/Scheme";
4
+ import { Classname } from "../utils/Classname";
5
+ import { BoolHelper } from "../utils/BoolHelper";
6
+ import { Alignment } from "../constants/Alignment";
7
+ import { ObjectHelper } from "../utils/ObjectHelper";
8
+ import { MicroBuilder } from "../utils/MicroBuilder";
9
+ class TabPanelComponent extends React.Component {
10
+ static defaultProps = {};
11
+ render() {
12
+ const className = Classname.build("noseur-tabpanel", (this.props.scheme ? `${this.props.scheme}-vars` : null), this.props.className);
13
+ return (React.createElement("div", { className: className, ref: this.props.forwardRef, key: this.props.key, id: this.props.id, style: this.props.style }, this.props.children));
14
+ }
15
+ ;
16
+ }
17
+ class TabPaneComponent extends React.Component {
18
+ static defaultProps = {
19
+ activeIndex: 0,
20
+ alignment: Alignment.TOP_LEFT,
21
+ scrollIcons: {
22
+ vertical: {
23
+ prev: "fa fa-angle-up",
24
+ next: "fa fa-angle-down",
25
+ },
26
+ horizontal: {
27
+ prev: "fa fa-angle-left",
28
+ next: "fa fa-angle-right",
29
+ }
30
+ },
31
+ };
32
+ state = {
33
+ removedIndexes: [],
34
+ activeIndex: this.props.activeIndex,
35
+ childrenCount: this.props.children?.length ?? 0,
36
+ };
37
+ headersContainer;
38
+ constructor(props) {
39
+ super(props);
40
+ this.onScroll = this.onScroll.bind(this);
41
+ this.navigateTab = this.navigateTab.bind(this);
42
+ this.onHeaderClick = this.onHeaderClick.bind(this);
43
+ this.onRemoveHeader = this.onRemoveHeader.bind(this);
44
+ }
45
+ componentDidMount() {
46
+ ObjectHelper.resolveManageRef(this, {
47
+ next: () => this.navigateTab("next"),
48
+ activeTab: () => this.state.activeIndex,
49
+ previous: () => this.navigateTab("prev"),
50
+ readd: (index) => this.onRemoveHeader(index, "readd"),
51
+ remove: (index) => this.onRemoveHeader(index, "remove"),
52
+ switch: (index) => this.onHeaderClick(null, undefined, index),
53
+ });
54
+ }
55
+ navigateTab(direction) {
56
+ let activeIndex = this.state.activeIndex;
57
+ const removedIndexes = this.state.removedIndexes;
58
+ const childrenCount = this.state.childrenCount;
59
+ do {
60
+ activeIndex += (direction === "next" ? 1 : -1);
61
+ } while (removedIndexes.includes(activeIndex));
62
+ if (direction === "next" && !(activeIndex < childrenCount))
63
+ return;
64
+ else if (activeIndex < 0)
65
+ return;
66
+ this.setState({ activeIndex });
67
+ }
68
+ onHeaderClick(e, tab, index) {
69
+ if (tab && tab.props.disabled)
70
+ return;
71
+ const activeIndex = this.state.activeIndex;
72
+ const childrenCount = this.state.childrenCount;
73
+ const removedIndexes = this.state.removedIndexes;
74
+ tab && tab.props.onClick && tab.props.onClick(e);
75
+ if (index < 0 || index >= childrenCount || activeIndex === index || removedIndexes.includes(index))
76
+ return;
77
+ if (this.props.onBeforeTabClose && this.props.onBeforeTabClose(activeIndex) === false)
78
+ return;
79
+ if (this.props.onBeforeTabActive && this.props.onBeforeTabActive(index) === false)
80
+ return;
81
+ if (this.props.onTabChange) {
82
+ this.props.onTabChange("close", activeIndex);
83
+ this.props.onTabChange("active", index);
84
+ }
85
+ this.setState({
86
+ activeIndex: index,
87
+ }, () => {
88
+ this.props.onTabClose && this.props.onTabClose(activeIndex);
89
+ this.props.onTabActive && this.props.onTabActive(index);
90
+ });
91
+ }
92
+ onRemoveHeader(index, op) {
93
+ const activeIndex = this.state.activeIndex;
94
+ const childrenCount = this.state.childrenCount;
95
+ const removedIndexes = this.state.removedIndexes;
96
+ if (op === "readd") {
97
+ if (!removedIndexes.includes(index))
98
+ return;
99
+ removedIndexes.splice(removedIndexes.indexOf(index), 1);
100
+ }
101
+ else {
102
+ removedIndexes.push(index);
103
+ }
104
+ this.setState({
105
+ removedIndexes,
106
+ }, () => {
107
+ if (activeIndex !== index)
108
+ return;
109
+ for (let sindex = 0; sindex < childrenCount; sindex++) {
110
+ if (!removedIndexes.includes(sindex)) {
111
+ this.onHeaderClick(null, undefined, sindex);
112
+ return;
113
+ }
114
+ }
115
+ });
116
+ }
117
+ renderHeader(tab, index, selected, key) {
118
+ const hasTemplate = !!tab.props.headerTemplate;
119
+ let scheme = (selected ? (tab.props.scheme ?? this.props.scheme) : (tab.props.idleScheme ?? this.props.idleScheme)) ?? Scheme.SECONDARY;
120
+ if ((tab.props.scheme ?? this.props.scheme) === Scheme.SKELETON)
121
+ scheme = Scheme.SKELETON;
122
+ const className = Classname.build("noseur-tabpanel-header", {
123
+ "noseur-active": selected,
124
+ "noseur-flex-1": tab.props.fill,
125
+ "noseur-tabpanel-noline": tab.props.noUnderline ?? this.props.noUnderline,
126
+ }, (scheme !== Scheme.SKELETON ? `${scheme}-vars` : scheme), tab.props.attrsRelay?.header?.className);
127
+ const style = {
128
+ ...this.props.attrsRelay?.navigator?.headers?.header?.style,
129
+ ...tab.props.attrsRelay?.header?.style,
130
+ ...tab.props.style,
131
+ };
132
+ const removeElement = (hasTemplate || tab.props.removable ? MicroBuilder.buildIcon(tab.props.removeIcon ?? "fa fa-times", {
133
+ scheme,
134
+ relativeAlignment: tab.props.rightIcon ? Alignment.RIGHT : Alignment.NONE
135
+ }, { onClick: () => this.onRemoveHeader(index, "remove") }) : null);
136
+ if (hasTemplate) {
137
+ return tab.props.headerTemplate({
138
+ index,
139
+ scheme,
140
+ selected,
141
+ className,
142
+ removeElement,
143
+ props: tab.props,
144
+ onClick: (e) => this.onHeaderClick(e, tab, index),
145
+ idleScheme: tab.props.idleScheme ?? this.props.idleScheme,
146
+ titleElement: MicroBuilder.buildLabel(tab.props.header, { scheme }),
147
+ leftIconElement: MicroBuilder.buildIcon(tab.props.leftIcon, { scheme }),
148
+ rightIconElement: MicroBuilder.buildIcon(tab.props.rightIcon, { scheme }),
149
+ });
150
+ }
151
+ const rightIcon = !!removeElement ? (React.createElement("div", null,
152
+ MicroBuilder.buildIcon(tab.props.rightIcon, { scheme }),
153
+ removeElement)) : tab.props.rightIcon;
154
+ return (React.createElement(Button, { disabled: tab.props.disabled, key: key, scheme: scheme, className: className, id: tab.props.attrsRelay?.header?.id, style: style, leftIcon: tab.props.leftIcon, rightIcon: rightIcon, outlined: true, textOnly: true, onClick: (e) => this.onHeaderClick(e, tab, index) }, tab.props.header));
155
+ }
156
+ onScroll(orientation, direction) {
157
+ if (!this.headersContainer)
158
+ return;
159
+ const scrollSize = (direction === "right" ? 500 : -500);
160
+ this.headersContainer[orientation === "horizontal" ? "scrollLeft" : "scrollBottom"] += scrollSize;
161
+ }
162
+ renderTabs() {
163
+ const result = {
164
+ headers: [],
165
+ contents: [],
166
+ };
167
+ React.Children.forEach(this.props.children, (tab, index) => {
168
+ if (tab.type !== TabPanel) {
169
+ result.headers.push(tab);
170
+ return;
171
+ }
172
+ if (this.state.removedIndexes.includes(index))
173
+ return;
174
+ const key = tab.props.key ?? `${index}`;
175
+ const isActiveTab = this.state.activeIndex === index;
176
+ result.headers.push(this.renderHeader(tab, index, isActiveTab, key));
177
+ if (this.props.renderActiveTabOnly && !isActiveTab)
178
+ return;
179
+ result.contents.push(isActiveTab ? tab : React.cloneElement(tab, { key, style: { display: "none" } }));
180
+ });
181
+ return result;
182
+ }
183
+ renderContentAndNavigator(orientation) {
184
+ const { headers, contents } = this.renderTabs();
185
+ const scheme = this.props.attrsRelay?.navigator?.scheme ?? this.props.scheme;
186
+ const contentClassName = Classname.build("noseur-tabpane-content noseur-unset-scheme-vars", this.props.attrsRelay?.content?.className);
187
+ const scrollLeftElement = this.props.scrollable ? MicroBuilder.buildIcon(this.props.scrollIcons[orientation].prev, {
188
+ id: this.props.attrsRelay?.navigator?.control?.prev?.id,
189
+ style: this.props.attrsRelay?.navigator?.control?.prev?.style,
190
+ scheme: this.props.attrsRelay?.navigator?.control?.prev?.scheme ?? scheme,
191
+ className: Classname.build("noseur-tabpane-control noseur-tabpane-control-l", this.props.attrsRelay?.navigator?.control?.prev?.className)
192
+ }, { onClick: () => this.onScroll(orientation, "left") }) : null;
193
+ const scrollRightElement = this.props.scrollable ? MicroBuilder.buildIcon(this.props.scrollIcons[orientation].next, {
194
+ id: this.props.attrsRelay?.navigator?.control?.next?.id,
195
+ style: this.props.attrsRelay?.navigator?.control?.next?.style,
196
+ scheme: this.props.attrsRelay?.navigator?.control?.next?.scheme ?? scheme,
197
+ className: Classname.build("noseur-tabpane-control noseur-tabpane-control-r", this.props.attrsRelay?.navigator?.control?.next?.className)
198
+ }, { onClick: () => this.onScroll(orientation, "right") }) : null;
199
+ const className = Classname.build("noseur-tabpane-navigator", {
200
+ "noseur-tabpane-navigator-top-left": this.props.alignment === Alignment.TOP_LEFT,
201
+ "noseur-tabpane-navigator-top-right": this.props.alignment === Alignment.TOP_RIGHT,
202
+ "noseur-tabpane-navigator-bottom-left": this.props.alignment === Alignment.BOTTOM_LEFT,
203
+ "noseur-tabpane-navigator-bottom-right": this.props.alignment === Alignment.BOTTOM_RIGHT,
204
+ "noseur-tabpane-navigator-left": BoolHelper.equalsAny(this.props.alignment, [Alignment.LEFT, Alignment.CENTER_LEFT]),
205
+ "noseur-tabpane-navigator-right": BoolHelper.equalsAny(this.props.alignment, [Alignment.RIGHT, Alignment.CENTER_RIGHT]),
206
+ "noseur-tabpane-navigator-bottom-center": BoolHelper.equalsAny(this.props.alignment, [Alignment.BOTTOM, Alignment.BOTTOM_CENTER]),
207
+ "noseur-tabpane-navigator-top-center": BoolHelper.equalsAny(this.props.alignment, [Alignment.TOP, Alignment.CENTER, Alignment.TOP_CENTER]),
208
+ }, this.props.attrsRelay?.navigator?.className);
209
+ const content = (React.createElement("div", { className: contentClassName, id: this.props.attrsRelay?.content?.id, style: this.props.attrsRelay?.content?.style }, contents));
210
+ const navigator = (React.createElement("div", { className: className, id: this.props.attrsRelay?.navigator?.id, style: this.props.attrsRelay?.navigator?.style },
211
+ scrollLeftElement,
212
+ React.createElement("div", { className: Classname.build("noseur-tabpane-headers", this.props.attrsRelay?.navigator?.headers?.className), id: this.props.attrsRelay?.navigator?.headers?.id, style: this.props.attrsRelay?.navigator?.headers?.style, ref: (r) => {
213
+ this.headersContainer = r;
214
+ } }, headers),
215
+ scrollRightElement));
216
+ return {
217
+ content,
218
+ navigator
219
+ };
220
+ }
221
+ render() {
222
+ const isVertical = BoolHelper.equalsAny(this.props.alignment, [Alignment.LEFT, Alignment.RIGHT, Alignment.CENTER_LEFT, Alignment.CENTER_RIGHT]);
223
+ const { content, navigator } = this.renderContentAndNavigator(isVertical ? "vertical" : "horizontal");
224
+ const navigatorBelow = this.props.alignment === Alignment.RIGHT || this.props.alignment.startsWith(Alignment.BOTTOM);
225
+ const className = Classname.build("noseur-tabpane", {
226
+ "noseur-tabpane-row": isVertical,
227
+ "noseur-tabpane-scrollable": this.props.scrollable,
228
+ }, (this.props.scheme && this.props.scheme !== Scheme.SKELETON ? `${this.props.scheme}-vars` : null), this.props.className);
229
+ return (React.createElement("div", { className: className, ref: this.props.forwardRef, id: this.props.id, style: this.props.style },
230
+ navigatorBelow ? null : navigator,
231
+ content,
232
+ navigatorBelow ? navigator : null));
233
+ }
234
+ ;
235
+ }
236
+ export const TabPanel = ({ ref, ...props }) => (React.createElement(TabPanelComponent, { ...props, forwardRef: ref }));
237
+ export const TabPane = ({ ref, ...props }) => (React.createElement(TabPaneComponent, { ...props, forwardRef: ref }));
@@ -0,0 +1,49 @@
1
+ import React from 'react';
2
+ import "./Presentation.css";
3
+ import { NoseurObject } from '../constants/Types';
4
+ import { ComponentBaseProps } from '../core/ComponentBaseProps';
5
+ import { ChartData as ChartJsData, Plugin as ChartJsPlugin, ChartDataCustomTypesPerDataset, ChartTypeRegistry } from 'chart.js/auto';
6
+ export declare const ChartType: {
7
+ BAR: string;
8
+ PIE: string;
9
+ NONE: string;
10
+ LINE: string;
11
+ RADAR: string;
12
+ BUBBLE: string;
13
+ SCATTER: string;
14
+ DOUGHNUT: string;
15
+ POLARAREA: string;
16
+ };
17
+ export type ChartPlugin<T extends keyof ChartTypeRegistry> = ChartJsPlugin<T>;
18
+ export type ChartData = ChartJsData<any, any[], unknown> | ChartDataCustomTypesPerDataset<any, any[], unknown>;
19
+ export interface ChartManageRef {
20
+ getChart: () => any;
21
+ update: (type: ChartTypeRegistry | string, data?: ChartData, options?: NoseurObject<any>) => void;
22
+ }
23
+ export interface ChartProps extends ComponentBaseProps<HTMLDivElement, ChartManageRef> {
24
+ data: ChartData;
25
+ canvasClassName: string;
26
+ options: NoseurObject<any>;
27
+ plugins?: ChartPlugin<any>[];
28
+ canvasProps: NoseurObject<any>;
29
+ type: ChartTypeRegistry | string;
30
+ canvasStyle: React.CSSProperties | undefined;
31
+ canvasRef: React.ForwardedRef<HTMLCanvasElement>;
32
+ }
33
+ interface ChartState {
34
+ id: string;
35
+ }
36
+ export declare class ChartComponent extends React.Component<ChartProps, ChartState> {
37
+ static defaultProps: Partial<ChartProps>;
38
+ state: ChartState;
39
+ chart: any;
40
+ canvasElement: HTMLCanvasElement;
41
+ constructor(props: ChartProps);
42
+ componentDidMount(): void;
43
+ componentDidUpdate(prevProps: Readonly<ChartProps>, _: Readonly<ChartState>): void;
44
+ componentWillUnmount(): void;
45
+ renderChart(type: ChartTypeRegistry | string, data?: ChartData, options?: NoseurObject<any>, plugins?: ChartPlugin<any>[]): void;
46
+ render(): React.JSX.Element;
47
+ }
48
+ export { ChartTypeRegistry } from "chart.js/auto";
49
+ export declare const Chart: ({ ref, ...props }: Partial<ChartProps>) => React.JSX.Element;
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import "./Presentation.css";
3
+ import { DOMHelper } from '../utils/DOMUtils';
4
+ import { Classname } from "../utils/Classname";
5
+ import { BoolHelper } from '../utils/BoolHelper';
6
+ import { ObjectHelper } from '../utils/ObjectHelper';
7
+ import { Chart as ChartJs } from 'chart.js/auto';
8
+ export const ChartType = {
9
+ BAR: "bar",
10
+ PIE: "pie",
11
+ NONE: "none",
12
+ LINE: "line",
13
+ RADAR: "radar",
14
+ BUBBLE: "bubble",
15
+ SCATTER: "scatter",
16
+ DOUGHNUT: "doughnut",
17
+ POLARAREA: "polarArea",
18
+ };
19
+ export class ChartComponent extends React.Component {
20
+ static defaultProps = {
21
+ type: ChartType.LINE,
22
+ };
23
+ state = {
24
+ id: this.props.id || DOMHelper.uniqueElementId()
25
+ };
26
+ chart;
27
+ canvasElement;
28
+ constructor(props) {
29
+ super(props);
30
+ this.renderChart = this.renderChart.bind(this);
31
+ }
32
+ componentDidMount() {
33
+ this.renderChart(this.props.type, this.props.data, this.props.options);
34
+ ObjectHelper.resolveManageRef(this, {
35
+ update: this.renderChart,
36
+ getChart: () => this.chart,
37
+ });
38
+ }
39
+ componentDidUpdate(prevProps, _) {
40
+ if (!BoolHelper.deepEqual(this.props, prevProps, ["type", "data", "options", "plugins"])) {
41
+ this.renderChart(this.props.type, this.props.data, this.props.options, this.props.plugins);
42
+ }
43
+ }
44
+ componentWillUnmount() {
45
+ ObjectHelper.resolveManageRef(this, null);
46
+ }
47
+ renderChart(type, data, options, plugins) {
48
+ if (this.chart)
49
+ this.chart.destroy();
50
+ this.chart = new ChartJs(this.canvasElement, { type, data: data ?? this.props.data, options, plugins });
51
+ }
52
+ render() {
53
+ const className = Classname.build("noseur-chart", this.props.className);
54
+ const canvasElement = (ref) => {
55
+ this.canvasElement = ref;
56
+ ObjectHelper.resolveRef(this.props.canvasRef, ref);
57
+ };
58
+ return (React.createElement("div", { className: className, style: this.props.style, ref: this.props.forwardRef },
59
+ React.createElement("canvas", { id: this.state.id, style: this.props.canvasStyle, className: this.props.canvasClassName, ref: canvasElement, ...(this.props.canvasProps || {}) })));
60
+ }
61
+ }
62
+ export const Chart = ({ ref, ...props }) => (React.createElement(ChartComponent, { ...props, forwardRef: ref }));
@@ -0,0 +1,90 @@
1
+ import React from 'react';
2
+ import "./Presentation.css";
3
+ import { Scheme } from '../constants/Scheme';
4
+ import { ComponentBaseProps } from '../core/ComponentBaseProps';
5
+ import { NoseurElement, NoseurObject } from '../constants/Types';
6
+ export declare enum PaginatorDirection {
7
+ PAGE = "",
8
+ NEXT_HIDDEN_PAGES = "nhp",
9
+ NEXT = "fa fa-angle-right",
10
+ PREVIOUS_HIDDEN_PAGES = "phg",
11
+ PREVIOUS = "fa fa-angle-left",
12
+ _HIDDEN_PAGES = "fa fa-ellipsis-h",
13
+ LAST_PAGE = "fa fa-angle-double-right",
14
+ FIRST_PAGE = "fa fa-angle-double-left"
15
+ }
16
+ export interface PaginatorPageElementOption {
17
+ scheme: Scheme;
18
+ active?: boolean;
19
+ disabled?: boolean;
20
+ className?: string;
21
+ key?: string | number;
22
+ label?: number | string;
23
+ style?: NoseurObject<any>;
24
+ direction?: PaginatorDirection;
25
+ onClick?: (...args: any[]) => any;
26
+ }
27
+ export type PaginatorTemplateElementEventHandler = (option: PaginatorPageElementOption) => NoseurElement;
28
+ export type PaginatorTemplateCustomElementEventHandler = (layout: string, props?: PaginatorProps, state?: PaginatorState, layoutElementsMap?: NoseurObject<NoseurElement>) => NoseurElement;
29
+ export interface PaginatorPageChangeOption {
30
+ scheme?: Scheme;
31
+ pageCount: number;
32
+ currentPage: number;
33
+ key?: string | number;
34
+ }
35
+ export type PaginatorTemplateLabelEventHandler = (option: PaginatorPageChangeOption) => NoseurElement;
36
+ export interface PaginatorTemplateOptions {
37
+ layout?: string;
38
+ rowsPerPageElement?: NoseurElement;
39
+ pageElement?: PaginatorTemplateElementEventHandler;
40
+ activePageLabel?: PaginatorTemplateLabelEventHandler;
41
+ nextPageElement?: PaginatorTemplateElementEventHandler;
42
+ lastPageElement?: PaginatorTemplateElementEventHandler;
43
+ firstPageElement?: PaginatorTemplateElementEventHandler;
44
+ propsValueElement?: PaginatorTemplateElementEventHandler;
45
+ hiddenPagesElement?: PaginatorTemplateElementEventHandler;
46
+ previousPageElement?: PaginatorTemplateElementEventHandler;
47
+ customElement?: PaginatorTemplateCustomElementEventHandler;
48
+ }
49
+ export declare enum PaginatorLayoutElements {
50
+ PageCount = "PageCount",
51
+ RowPerPage = "RowPerPage",
52
+ InitialPage = "InitialPage",
53
+ CurrentPage = "CurrentPage",
54
+ TotalRecords = "TotalRecords",
55
+ PageElements = "PageElements",
56
+ NextPageElement = "NextPageElement",
57
+ LastPageElement = "LastPageElement",
58
+ ActivePageLabel = "ActivePageLabel",
59
+ NextPagesElement = "NextPagesElement",
60
+ FirstPageElement = "FirstPageElement",
61
+ VisiblePageCount = "VisiblePageCount",
62
+ PreviousPageElement = "PreviousPageElement",
63
+ PreviousPagesElement = "PreviousPagesElement"
64
+ }
65
+ export interface PaginatorProps extends ComponentBaseProps<NoseurElement> {
66
+ initialPage: number;
67
+ rowsPerPage: number;
68
+ currentPage: number;
69
+ totalRecords: number;
70
+ visiblePageCount: number;
71
+ freezeTotalRecords: boolean;
72
+ reportOnNavigation: boolean;
73
+ rowsPerPageOptions: number[];
74
+ overlayContainer: NoseurElement;
75
+ resetPageOnCountChange: boolean;
76
+ reportOnComponentUpdate: boolean;
77
+ template: PaginatorTemplateOptions;
78
+ expandOnHiddenPagesButtonClicked: boolean;
79
+ leftContent: React.ReactElement<any, any>;
80
+ rightContent: React.ReactElement<any, any>;
81
+ onPageChange?: (event: PaginatorPageChangeOption) => void;
82
+ }
83
+ interface PaginatorState {
84
+ pageCount: number;
85
+ currentPage: number;
86
+ renderNextHiddenPagesElements: boolean;
87
+ renderPreviousHiddenPagesElements: boolean;
88
+ }
89
+ export declare const Paginator: ({ ref, ...props }: Partial<PaginatorProps>) => React.JSX.Element;
90
+ export {};