@sebgroup/green-react 1.0.0-beta.42 → 1.0.0-beta.43
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/index.d.ts +1 -0
- package/index.esm.js +191 -13
- package/index.umd.js +190 -11
- package/lib/accordion/accordion-item.d.ts +17 -0
- package/lib/accordion/accordion.d.ts +6 -0
- package/lib/alert/alert.d.ts +1 -1
- package/package.json +3 -3
package/index.d.ts
CHANGED
package/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import React, { useState, useLayoutEffect, useEffect, useMemo, useRef } from 'react';
|
|
3
|
-
import { randomId, validateClassName, createStepper, createDropdown, dropdownValues } from '@sebgroup/extract';
|
|
3
|
+
import { randomId, validateClassName, createStepper, createDropdown, dropdownValues, createDatepicker, months, years } from '@sebgroup/extract';
|
|
4
4
|
|
|
5
5
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
6
6
|
|
|
@@ -1094,15 +1094,15 @@ const ModalHeader = ({
|
|
|
1094
1094
|
}, {
|
|
1095
1095
|
children: [jsx("h3", {
|
|
1096
1096
|
children: _header
|
|
1097
|
-
}),
|
|
1097
|
+
}), jsxs("button", Object.assign({
|
|
1098
1098
|
className: "close",
|
|
1099
1099
|
onClick: handleClose
|
|
1100
1100
|
}, {
|
|
1101
|
-
children: jsx("span", Object.assign({
|
|
1101
|
+
children: [jsx("span", Object.assign({
|
|
1102
1102
|
className: "sr-only"
|
|
1103
1103
|
}, {
|
|
1104
1104
|
children: "Close"
|
|
1105
|
-
}))
|
|
1105
|
+
})), jsx("i", {})]
|
|
1106
1106
|
}))]
|
|
1107
1107
|
}));
|
|
1108
1108
|
};
|
|
@@ -1780,17 +1780,23 @@ function Alert({
|
|
|
1780
1780
|
if (!isCloseable) {
|
|
1781
1781
|
setCloseButton(null);
|
|
1782
1782
|
} else {
|
|
1783
|
-
if (closeText) setCloseButton(
|
|
1784
|
-
|
|
1783
|
+
if (closeText) setCloseButton(jsxs("button", Object.assign({
|
|
1784
|
+
className: "close"
|
|
1785
1785
|
}, {
|
|
1786
|
-
children: jsx("span", Object.assign({
|
|
1786
|
+
children: [jsx("span", Object.assign({
|
|
1787
1787
|
className: "sr-only"
|
|
1788
1788
|
}, {
|
|
1789
1789
|
children: closeText
|
|
1790
|
-
}))
|
|
1791
|
-
})));else setCloseButton(
|
|
1790
|
+
})), jsx("i", {})]
|
|
1791
|
+
})));else setCloseButton(jsxs("button", Object.assign({
|
|
1792
1792
|
className: "close"
|
|
1793
|
-
}
|
|
1793
|
+
}, {
|
|
1794
|
+
children: [jsx("span", Object.assign({
|
|
1795
|
+
className: "sr-only"
|
|
1796
|
+
}, {
|
|
1797
|
+
children: "Close"
|
|
1798
|
+
})), jsx("i", {})]
|
|
1799
|
+
})));
|
|
1794
1800
|
}
|
|
1795
1801
|
}, [isCloseable, closeText]);
|
|
1796
1802
|
return jsxs("div", Object.assign({
|
|
@@ -2564,12 +2570,12 @@ function Badge(_a) {
|
|
|
2564
2570
|
}, {
|
|
2565
2571
|
children: [jsx("strong", {
|
|
2566
2572
|
children: children
|
|
2567
|
-
}), isCloseable &&
|
|
2573
|
+
}), isCloseable && jsxs("button", Object.assign({
|
|
2568
2574
|
type: "button",
|
|
2569
2575
|
className: "close",
|
|
2570
2576
|
onClick: () => setIsClosed(true)
|
|
2571
2577
|
}, {
|
|
2572
|
-
children: closeText
|
|
2578
|
+
children: [closeText, jsx("i", {})]
|
|
2573
2579
|
}))]
|
|
2574
2580
|
})) : null;
|
|
2575
2581
|
}
|
|
@@ -2935,4 +2941,176 @@ const Dropdown = ({
|
|
|
2935
2941
|
}));
|
|
2936
2942
|
};
|
|
2937
2943
|
|
|
2938
|
-
|
|
2944
|
+
const useDatepicker = (datepickerRef, datepickerDialogRef, dateInputRef, datepickerTriggerRef, options = {}) => {
|
|
2945
|
+
const dataStub = {
|
|
2946
|
+
formattedSelectedDate: '',
|
|
2947
|
+
calendar: {
|
|
2948
|
+
headers: [],
|
|
2949
|
+
calendarGrid: []
|
|
2950
|
+
}
|
|
2951
|
+
};
|
|
2952
|
+
const [data, setData] = useState(dataStub);
|
|
2953
|
+
const [state, setState] = useState({
|
|
2954
|
+
isActive: false
|
|
2955
|
+
});
|
|
2956
|
+
const datepickerStub = {};
|
|
2957
|
+
const [datepicker, setDatepicker] = useState(datepickerStub);
|
|
2958
|
+
useEffect(() => {
|
|
2959
|
+
if (!datepicker.open && datepickerRef.current && datepickerDialogRef.current && dateInputRef.current && datepickerTriggerRef.current) {
|
|
2960
|
+
setDatepicker(createDatepicker((data, state) => {
|
|
2961
|
+
if (data) setData(data);
|
|
2962
|
+
if (state) setState(state);
|
|
2963
|
+
}, options, datepickerRef.current, datepickerDialogRef.current, dateInputRef.current, datepickerTriggerRef.current));
|
|
2964
|
+
}
|
|
2965
|
+
}, [datepicker, datepickerRef, datepickerDialogRef, dateInputRef, options]);
|
|
2966
|
+
return {
|
|
2967
|
+
datepicker,
|
|
2968
|
+
data,
|
|
2969
|
+
state
|
|
2970
|
+
};
|
|
2971
|
+
};
|
|
2972
|
+
|
|
2973
|
+
const Datepicker = (options = {}) => {
|
|
2974
|
+
const [uuid] = useState(randomId());
|
|
2975
|
+
const id = `sgr-datepicker-${uuid}`;
|
|
2976
|
+
const datepickerRef = useRef(null);
|
|
2977
|
+
const datepickerTriggerRef = useRef(null);
|
|
2978
|
+
const datepickerDialogRef = useRef(null);
|
|
2979
|
+
const dateInputRef = useRef(null);
|
|
2980
|
+
const {
|
|
2981
|
+
datepicker,
|
|
2982
|
+
data,
|
|
2983
|
+
state
|
|
2984
|
+
} = useDatepicker(datepickerRef, datepickerDialogRef, dateInputRef, datepickerTriggerRef, options);
|
|
2985
|
+
useEffect(() => {
|
|
2986
|
+
var _a;
|
|
2987
|
+
|
|
2988
|
+
const selDateSub = (_a = datepicker.selectedDate$) === null || _a === void 0 ? void 0 : _a.subscribe(newDate => options.onChange && options.onChange(newDate));
|
|
2989
|
+
return () => selDateSub === null || selDateSub === void 0 ? void 0 : selDateSub.unsubscribe();
|
|
2990
|
+
}, [datepicker]);
|
|
2991
|
+
|
|
2992
|
+
const classNames = day => Object.entries({
|
|
2993
|
+
disabled: !day.currentMonth,
|
|
2994
|
+
'sg-date-today': day.today // 'sg-date-holiday': day.holiday,
|
|
2995
|
+
|
|
2996
|
+
}).map(([className, add]) => add ? className : '').join(' ');
|
|
2997
|
+
|
|
2998
|
+
return jsxs(Fragment, {
|
|
2999
|
+
children: [jsxs("div", Object.assign({
|
|
3000
|
+
className: "form-group"
|
|
3001
|
+
}, {
|
|
3002
|
+
children: [jsx("label", Object.assign({
|
|
3003
|
+
htmlFor: id
|
|
3004
|
+
}, {
|
|
3005
|
+
children: "Date"
|
|
3006
|
+
})), jsxs("div", Object.assign({
|
|
3007
|
+
className: "group",
|
|
3008
|
+
ref: datepickerRef
|
|
3009
|
+
}, {
|
|
3010
|
+
children: [jsx("input", {
|
|
3011
|
+
ref: dateInputRef,
|
|
3012
|
+
id: id,
|
|
3013
|
+
type: "text",
|
|
3014
|
+
placeholder: "yyyy-mm-dd",
|
|
3015
|
+
value: data.formattedSelectedDate,
|
|
3016
|
+
onChange: e => datepicker.select(e.target.value)
|
|
3017
|
+
}), jsx("button", Object.assign({
|
|
3018
|
+
ref: datepickerTriggerRef,
|
|
3019
|
+
type: "button",
|
|
3020
|
+
className: "primary",
|
|
3021
|
+
onClick: () => datepicker.toggle()
|
|
3022
|
+
}, {
|
|
3023
|
+
children: jsx("i", Object.assign({
|
|
3024
|
+
className: "sg-icon sg-icon-calendar"
|
|
3025
|
+
}, {
|
|
3026
|
+
children: "Select date"
|
|
3027
|
+
}))
|
|
3028
|
+
}))]
|
|
3029
|
+
})), jsx("span", Object.assign({
|
|
3030
|
+
className: "form-info"
|
|
3031
|
+
}, {
|
|
3032
|
+
children: "Select a date"
|
|
3033
|
+
}))]
|
|
3034
|
+
})), jsx("div", Object.assign({
|
|
3035
|
+
ref: datepickerDialogRef,
|
|
3036
|
+
className: `popover popover-datepicker ${state.isActive ? 'active' : ''}`,
|
|
3037
|
+
role: "dialog",
|
|
3038
|
+
"aria-modal": "true",
|
|
3039
|
+
"aria-label": "Choose Date"
|
|
3040
|
+
}, {
|
|
3041
|
+
children: state.isActive && jsxs("div", Object.assign({
|
|
3042
|
+
className: "sg-date"
|
|
3043
|
+
}, {
|
|
3044
|
+
children: [jsxs("header", {
|
|
3045
|
+
children: [jsx("button", Object.assign({
|
|
3046
|
+
className: "link",
|
|
3047
|
+
onClick: () => datepicker.sub(1, 'months')
|
|
3048
|
+
}, {
|
|
3049
|
+
children: jsx("i", Object.assign({
|
|
3050
|
+
className: "sg-icon sg-icon-previous"
|
|
3051
|
+
}, {
|
|
3052
|
+
children: "Previous month"
|
|
3053
|
+
}))
|
|
3054
|
+
})), jsx(Dropdown, {
|
|
3055
|
+
options: months({}),
|
|
3056
|
+
texts: {
|
|
3057
|
+
placeholder: data.monthName
|
|
3058
|
+
}
|
|
3059
|
+
}), jsx(Dropdown, {
|
|
3060
|
+
options: years({}),
|
|
3061
|
+
texts: {
|
|
3062
|
+
placeholder: data.year + ''
|
|
3063
|
+
}
|
|
3064
|
+
}), jsx("button", Object.assign({
|
|
3065
|
+
className: "link",
|
|
3066
|
+
onClick: () => datepicker.add(1, 'months')
|
|
3067
|
+
}, {
|
|
3068
|
+
children: jsx("i", Object.assign({
|
|
3069
|
+
className: "sg-icon sg-icon-next"
|
|
3070
|
+
}, {
|
|
3071
|
+
children: "Next month"
|
|
3072
|
+
}))
|
|
3073
|
+
}))]
|
|
3074
|
+
}), jsx("main", {
|
|
3075
|
+
children: jsxs("table", Object.assign({
|
|
3076
|
+
role: "grid"
|
|
3077
|
+
}, {
|
|
3078
|
+
children: [jsx("thead", {
|
|
3079
|
+
children: jsx("tr", {
|
|
3080
|
+
children: data.calendar.headers.map((header, ix) => jsx("th", Object.assign({
|
|
3081
|
+
scope: "col",
|
|
3082
|
+
abbr: header.abbr,
|
|
3083
|
+
className: header.type === 'week' ? 'sg-week-header' : 'sg-day-header'
|
|
3084
|
+
}, {
|
|
3085
|
+
children: header.displayText
|
|
3086
|
+
}), `week_${ix}`))
|
|
3087
|
+
})
|
|
3088
|
+
}), jsx("tbody", {
|
|
3089
|
+
children: data.calendar.calendarGrid.map((week, ix) => jsxs("tr", {
|
|
3090
|
+
children: [data.calendar.weekNumbers ? jsx("th", Object.assign({
|
|
3091
|
+
className: "sg-week-number"
|
|
3092
|
+
}, {
|
|
3093
|
+
children: data.calendar.weekNumbers[ix]
|
|
3094
|
+
})) : '', week.map(day => jsx("td", Object.assign({
|
|
3095
|
+
"data-date": day.formattedDate,
|
|
3096
|
+
className: classNames(day),
|
|
3097
|
+
title: day.today ? 'Today' : '',
|
|
3098
|
+
tabIndex: day.highlighted || day.selected && !(data === null || data === void 0 ? void 0 : data.highlightedDate) || day.today && !(data === null || data === void 0 ? void 0 : data.highlightedDate) && !(data === null || data === void 0 ? void 0 : data.selectedDate) ? 0 : -1,
|
|
3099
|
+
role: day.selected ? 'gridcell' : undefined,
|
|
3100
|
+
"aria-selected": day.selected && !(data === null || data === void 0 ? void 0 : data.highlightedDate) ? true : undefined,
|
|
3101
|
+
onClick: () => {
|
|
3102
|
+
day.currentMonth && datepicker.select(day.date);
|
|
3103
|
+
}
|
|
3104
|
+
}, {
|
|
3105
|
+
children: day.day
|
|
3106
|
+
}), day.day))]
|
|
3107
|
+
}, `week_${ix}`))
|
|
3108
|
+
})]
|
|
3109
|
+
}))
|
|
3110
|
+
})]
|
|
3111
|
+
}))
|
|
3112
|
+
}))]
|
|
3113
|
+
});
|
|
3114
|
+
};
|
|
3115
|
+
|
|
3116
|
+
export { Alert, Badge, Button, ButtonGroup, Card, Checkbox, Datepicker, Dropdown, EmailInput, Flexbox, Form, FormItems, Group, Link, List, Modal, Navbar, NumberInput, RadioButton, RadioGroup, RenderInput, Stepper, Text, TextInput };
|
package/index.umd.js
CHANGED
|
@@ -1100,15 +1100,15 @@
|
|
|
1100
1100
|
}, {
|
|
1101
1101
|
children: [jsxRuntime.jsx("h3", {
|
|
1102
1102
|
children: _header
|
|
1103
|
-
}), jsxRuntime.
|
|
1103
|
+
}), jsxRuntime.jsxs("button", Object.assign({
|
|
1104
1104
|
className: "close",
|
|
1105
1105
|
onClick: handleClose
|
|
1106
1106
|
}, {
|
|
1107
|
-
children: jsxRuntime.jsx("span", Object.assign({
|
|
1107
|
+
children: [jsxRuntime.jsx("span", Object.assign({
|
|
1108
1108
|
className: "sr-only"
|
|
1109
1109
|
}, {
|
|
1110
1110
|
children: "Close"
|
|
1111
|
-
}))
|
|
1111
|
+
})), jsxRuntime.jsx("i", {})]
|
|
1112
1112
|
}))]
|
|
1113
1113
|
}));
|
|
1114
1114
|
};
|
|
@@ -1786,17 +1786,23 @@
|
|
|
1786
1786
|
if (!isCloseable) {
|
|
1787
1787
|
setCloseButton(null);
|
|
1788
1788
|
} else {
|
|
1789
|
-
if (closeText) setCloseButton(jsxRuntime.
|
|
1790
|
-
|
|
1789
|
+
if (closeText) setCloseButton(jsxRuntime.jsxs("button", Object.assign({
|
|
1790
|
+
className: "close"
|
|
1791
1791
|
}, {
|
|
1792
|
-
children: jsxRuntime.jsx("span", Object.assign({
|
|
1792
|
+
children: [jsxRuntime.jsx("span", Object.assign({
|
|
1793
1793
|
className: "sr-only"
|
|
1794
1794
|
}, {
|
|
1795
1795
|
children: closeText
|
|
1796
|
-
}))
|
|
1797
|
-
})));else setCloseButton(jsxRuntime.
|
|
1796
|
+
})), jsxRuntime.jsx("i", {})]
|
|
1797
|
+
})));else setCloseButton(jsxRuntime.jsxs("button", Object.assign({
|
|
1798
1798
|
className: "close"
|
|
1799
|
-
}
|
|
1799
|
+
}, {
|
|
1800
|
+
children: [jsxRuntime.jsx("span", Object.assign({
|
|
1801
|
+
className: "sr-only"
|
|
1802
|
+
}, {
|
|
1803
|
+
children: "Close"
|
|
1804
|
+
})), jsxRuntime.jsx("i", {})]
|
|
1805
|
+
})));
|
|
1800
1806
|
}
|
|
1801
1807
|
}, [isCloseable, closeText]);
|
|
1802
1808
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
@@ -2570,12 +2576,12 @@
|
|
|
2570
2576
|
}, {
|
|
2571
2577
|
children: [jsxRuntime.jsx("strong", {
|
|
2572
2578
|
children: children
|
|
2573
|
-
}), isCloseable && jsxRuntime.
|
|
2579
|
+
}), isCloseable && jsxRuntime.jsxs("button", Object.assign({
|
|
2574
2580
|
type: "button",
|
|
2575
2581
|
className: "close",
|
|
2576
2582
|
onClick: () => setIsClosed(true)
|
|
2577
2583
|
}, {
|
|
2578
|
-
children: closeText
|
|
2584
|
+
children: [closeText, jsxRuntime.jsx("i", {})]
|
|
2579
2585
|
}))]
|
|
2580
2586
|
})) : null;
|
|
2581
2587
|
}
|
|
@@ -2941,12 +2947,185 @@
|
|
|
2941
2947
|
}));
|
|
2942
2948
|
};
|
|
2943
2949
|
|
|
2950
|
+
const useDatepicker = (datepickerRef, datepickerDialogRef, dateInputRef, datepickerTriggerRef, options = {}) => {
|
|
2951
|
+
const dataStub = {
|
|
2952
|
+
formattedSelectedDate: '',
|
|
2953
|
+
calendar: {
|
|
2954
|
+
headers: [],
|
|
2955
|
+
calendarGrid: []
|
|
2956
|
+
}
|
|
2957
|
+
};
|
|
2958
|
+
const [data, setData] = React.useState(dataStub);
|
|
2959
|
+
const [state, setState] = React.useState({
|
|
2960
|
+
isActive: false
|
|
2961
|
+
});
|
|
2962
|
+
const datepickerStub = {};
|
|
2963
|
+
const [datepicker, setDatepicker] = React.useState(datepickerStub);
|
|
2964
|
+
React.useEffect(() => {
|
|
2965
|
+
if (!datepicker.open && datepickerRef.current && datepickerDialogRef.current && dateInputRef.current && datepickerTriggerRef.current) {
|
|
2966
|
+
setDatepicker(extract.createDatepicker((data, state) => {
|
|
2967
|
+
if (data) setData(data);
|
|
2968
|
+
if (state) setState(state);
|
|
2969
|
+
}, options, datepickerRef.current, datepickerDialogRef.current, dateInputRef.current, datepickerTriggerRef.current));
|
|
2970
|
+
}
|
|
2971
|
+
}, [datepicker, datepickerRef, datepickerDialogRef, dateInputRef, options]);
|
|
2972
|
+
return {
|
|
2973
|
+
datepicker,
|
|
2974
|
+
data,
|
|
2975
|
+
state
|
|
2976
|
+
};
|
|
2977
|
+
};
|
|
2978
|
+
|
|
2979
|
+
const Datepicker = (options = {}) => {
|
|
2980
|
+
const [uuid] = React.useState(extract.randomId());
|
|
2981
|
+
const id = `sgr-datepicker-${uuid}`;
|
|
2982
|
+
const datepickerRef = React.useRef(null);
|
|
2983
|
+
const datepickerTriggerRef = React.useRef(null);
|
|
2984
|
+
const datepickerDialogRef = React.useRef(null);
|
|
2985
|
+
const dateInputRef = React.useRef(null);
|
|
2986
|
+
const {
|
|
2987
|
+
datepicker,
|
|
2988
|
+
data,
|
|
2989
|
+
state
|
|
2990
|
+
} = useDatepicker(datepickerRef, datepickerDialogRef, dateInputRef, datepickerTriggerRef, options);
|
|
2991
|
+
React.useEffect(() => {
|
|
2992
|
+
var _a;
|
|
2993
|
+
|
|
2994
|
+
const selDateSub = (_a = datepicker.selectedDate$) === null || _a === void 0 ? void 0 : _a.subscribe(newDate => options.onChange && options.onChange(newDate));
|
|
2995
|
+
return () => selDateSub === null || selDateSub === void 0 ? void 0 : selDateSub.unsubscribe();
|
|
2996
|
+
}, [datepicker]);
|
|
2997
|
+
|
|
2998
|
+
const classNames = day => Object.entries({
|
|
2999
|
+
disabled: !day.currentMonth,
|
|
3000
|
+
'sg-date-today': day.today // 'sg-date-holiday': day.holiday,
|
|
3001
|
+
|
|
3002
|
+
}).map(([className, add]) => add ? className : '').join(' ');
|
|
3003
|
+
|
|
3004
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3005
|
+
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
3006
|
+
className: "form-group"
|
|
3007
|
+
}, {
|
|
3008
|
+
children: [jsxRuntime.jsx("label", Object.assign({
|
|
3009
|
+
htmlFor: id
|
|
3010
|
+
}, {
|
|
3011
|
+
children: "Date"
|
|
3012
|
+
})), jsxRuntime.jsxs("div", Object.assign({
|
|
3013
|
+
className: "group",
|
|
3014
|
+
ref: datepickerRef
|
|
3015
|
+
}, {
|
|
3016
|
+
children: [jsxRuntime.jsx("input", {
|
|
3017
|
+
ref: dateInputRef,
|
|
3018
|
+
id: id,
|
|
3019
|
+
type: "text",
|
|
3020
|
+
placeholder: "yyyy-mm-dd",
|
|
3021
|
+
value: data.formattedSelectedDate,
|
|
3022
|
+
onChange: e => datepicker.select(e.target.value)
|
|
3023
|
+
}), jsxRuntime.jsx("button", Object.assign({
|
|
3024
|
+
ref: datepickerTriggerRef,
|
|
3025
|
+
type: "button",
|
|
3026
|
+
className: "primary",
|
|
3027
|
+
onClick: () => datepicker.toggle()
|
|
3028
|
+
}, {
|
|
3029
|
+
children: jsxRuntime.jsx("i", Object.assign({
|
|
3030
|
+
className: "sg-icon sg-icon-calendar"
|
|
3031
|
+
}, {
|
|
3032
|
+
children: "Select date"
|
|
3033
|
+
}))
|
|
3034
|
+
}))]
|
|
3035
|
+
})), jsxRuntime.jsx("span", Object.assign({
|
|
3036
|
+
className: "form-info"
|
|
3037
|
+
}, {
|
|
3038
|
+
children: "Select a date"
|
|
3039
|
+
}))]
|
|
3040
|
+
})), jsxRuntime.jsx("div", Object.assign({
|
|
3041
|
+
ref: datepickerDialogRef,
|
|
3042
|
+
className: `popover popover-datepicker ${state.isActive ? 'active' : ''}`,
|
|
3043
|
+
role: "dialog",
|
|
3044
|
+
"aria-modal": "true",
|
|
3045
|
+
"aria-label": "Choose Date"
|
|
3046
|
+
}, {
|
|
3047
|
+
children: state.isActive && jsxRuntime.jsxs("div", Object.assign({
|
|
3048
|
+
className: "sg-date"
|
|
3049
|
+
}, {
|
|
3050
|
+
children: [jsxRuntime.jsxs("header", {
|
|
3051
|
+
children: [jsxRuntime.jsx("button", Object.assign({
|
|
3052
|
+
className: "link",
|
|
3053
|
+
onClick: () => datepicker.sub(1, 'months')
|
|
3054
|
+
}, {
|
|
3055
|
+
children: jsxRuntime.jsx("i", Object.assign({
|
|
3056
|
+
className: "sg-icon sg-icon-previous"
|
|
3057
|
+
}, {
|
|
3058
|
+
children: "Previous month"
|
|
3059
|
+
}))
|
|
3060
|
+
})), jsxRuntime.jsx(Dropdown, {
|
|
3061
|
+
options: extract.months({}),
|
|
3062
|
+
texts: {
|
|
3063
|
+
placeholder: data.monthName
|
|
3064
|
+
}
|
|
3065
|
+
}), jsxRuntime.jsx(Dropdown, {
|
|
3066
|
+
options: extract.years({}),
|
|
3067
|
+
texts: {
|
|
3068
|
+
placeholder: data.year + ''
|
|
3069
|
+
}
|
|
3070
|
+
}), jsxRuntime.jsx("button", Object.assign({
|
|
3071
|
+
className: "link",
|
|
3072
|
+
onClick: () => datepicker.add(1, 'months')
|
|
3073
|
+
}, {
|
|
3074
|
+
children: jsxRuntime.jsx("i", Object.assign({
|
|
3075
|
+
className: "sg-icon sg-icon-next"
|
|
3076
|
+
}, {
|
|
3077
|
+
children: "Next month"
|
|
3078
|
+
}))
|
|
3079
|
+
}))]
|
|
3080
|
+
}), jsxRuntime.jsx("main", {
|
|
3081
|
+
children: jsxRuntime.jsxs("table", Object.assign({
|
|
3082
|
+
role: "grid"
|
|
3083
|
+
}, {
|
|
3084
|
+
children: [jsxRuntime.jsx("thead", {
|
|
3085
|
+
children: jsxRuntime.jsx("tr", {
|
|
3086
|
+
children: data.calendar.headers.map((header, ix) => jsxRuntime.jsx("th", Object.assign({
|
|
3087
|
+
scope: "col",
|
|
3088
|
+
abbr: header.abbr,
|
|
3089
|
+
className: header.type === 'week' ? 'sg-week-header' : 'sg-day-header'
|
|
3090
|
+
}, {
|
|
3091
|
+
children: header.displayText
|
|
3092
|
+
}), `week_${ix}`))
|
|
3093
|
+
})
|
|
3094
|
+
}), jsxRuntime.jsx("tbody", {
|
|
3095
|
+
children: data.calendar.calendarGrid.map((week, ix) => jsxRuntime.jsxs("tr", {
|
|
3096
|
+
children: [data.calendar.weekNumbers ? jsxRuntime.jsx("th", Object.assign({
|
|
3097
|
+
className: "sg-week-number"
|
|
3098
|
+
}, {
|
|
3099
|
+
children: data.calendar.weekNumbers[ix]
|
|
3100
|
+
})) : '', week.map(day => jsxRuntime.jsx("td", Object.assign({
|
|
3101
|
+
"data-date": day.formattedDate,
|
|
3102
|
+
className: classNames(day),
|
|
3103
|
+
title: day.today ? 'Today' : '',
|
|
3104
|
+
tabIndex: day.highlighted || day.selected && !(data === null || data === void 0 ? void 0 : data.highlightedDate) || day.today && !(data === null || data === void 0 ? void 0 : data.highlightedDate) && !(data === null || data === void 0 ? void 0 : data.selectedDate) ? 0 : -1,
|
|
3105
|
+
role: day.selected ? 'gridcell' : undefined,
|
|
3106
|
+
"aria-selected": day.selected && !(data === null || data === void 0 ? void 0 : data.highlightedDate) ? true : undefined,
|
|
3107
|
+
onClick: () => {
|
|
3108
|
+
day.currentMonth && datepicker.select(day.date);
|
|
3109
|
+
}
|
|
3110
|
+
}, {
|
|
3111
|
+
children: day.day
|
|
3112
|
+
}), day.day))]
|
|
3113
|
+
}, `week_${ix}`))
|
|
3114
|
+
})]
|
|
3115
|
+
}))
|
|
3116
|
+
})]
|
|
3117
|
+
}))
|
|
3118
|
+
}))]
|
|
3119
|
+
});
|
|
3120
|
+
};
|
|
3121
|
+
|
|
2944
3122
|
exports.Alert = Alert;
|
|
2945
3123
|
exports.Badge = Badge;
|
|
2946
3124
|
exports.Button = Button;
|
|
2947
3125
|
exports.ButtonGroup = ButtonGroup;
|
|
2948
3126
|
exports.Card = Card;
|
|
2949
3127
|
exports.Checkbox = Checkbox;
|
|
3128
|
+
exports.Datepicker = Datepicker;
|
|
2950
3129
|
exports.Dropdown = Dropdown;
|
|
2951
3130
|
exports.EmailInput = EmailInput;
|
|
2952
3131
|
exports.Flexbox = Flexbox;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface AccordionItemProps {
|
|
3
|
+
item: AccordionItemInterface;
|
|
4
|
+
index: number;
|
|
5
|
+
uuid: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AccordionItemInterface {
|
|
8
|
+
label: string;
|
|
9
|
+
labelElementLevel: 2 | 3 | 4 | 5 | 6;
|
|
10
|
+
subLabel?: string;
|
|
11
|
+
content: JSX.Element;
|
|
12
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
13
|
+
onOpen?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
14
|
+
onClose?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
15
|
+
}
|
|
16
|
+
declare const AccordionItem: ({ item, index, uuid }: AccordionItemProps) => JSX.Element;
|
|
17
|
+
export default AccordionItem;
|
package/lib/alert/alert.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sebgroup/green-react",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.43",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"react": "^17 || ^18",
|
|
6
6
|
"react-dom": "^17 || ^18"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@sebgroup/chlorophyll": "^1.0.0-beta.
|
|
10
|
-
"@sebgroup/extract": "^1.0.0-beta.
|
|
9
|
+
"@sebgroup/chlorophyll": "^1.0.0-beta.44",
|
|
10
|
+
"@sebgroup/extract": "^1.0.0-beta.43"
|
|
11
11
|
},
|
|
12
12
|
"description": "React components built on top of @sebgroup/chlorophyll.",
|
|
13
13
|
"repository": {
|