@typeolymp/ui-components 1.19.1 → 1.19.2

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.
@@ -1,9 +1,11 @@
1
1
  import { FC } from "react";
2
2
  import { Locale } from "@typeolymp/utils/enums";
3
- import { ExerciseResult } from "./utils";
3
+ import { Period, ExerciseResult } from "./utils";
4
4
  declare type BasePropsType = {
5
5
  exerciseResults: ExerciseResult[];
6
6
  locale: Locale;
7
+ defaultPeriod?: Period;
8
+ onChangePeriod?: (period: Period) => void;
7
9
  };
8
10
  export declare type PropsType = (BasePropsType & {
9
11
  type: "accuracy" | "hits" | "results" | "speed" | "time";
@@ -11,6 +11,7 @@ export declare const Progress: () => JSX.Element;
11
11
  export declare const Results: () => JSX.Element;
12
12
  export declare const Speed: () => JSX.Element;
13
13
  export declare const Time: () => JSX.Element;
14
+ export declare const Multiple: () => JSX.Element;
14
15
  export declare const Playground: {
15
16
  (args: any): JSX.Element;
16
17
  args: {
package/build/index.es.js CHANGED
@@ -47822,8 +47822,11 @@ var TimeChart = function (_a) {
47822
47822
  };
47823
47823
 
47824
47824
  var Chart = function (_a) {
47825
- var type = _a.type, locale = _a.locale, exerciseResults = _a.exerciseResults, nExercisesInCourse = _a.nExercisesInCourse;
47826
- var _b = useState(Period.TODAY), period = _b[0], setPeriod = _b[1];
47825
+ var type = _a.type, locale = _a.locale, exerciseResults = _a.exerciseResults, _b = _a.defaultPeriod, defaultPeriod = _b === void 0 ? Period.TODAY : _b, onChangePeriod = _a.onChangePeriod, nExercisesInCourse = _a.nExercisesInCourse;
47826
+ var _c = useState(defaultPeriod), period = _c[0], setPeriod = _c[1];
47827
+ useEffect(function () {
47828
+ setPeriod(defaultPeriod);
47829
+ }, [defaultPeriod]);
47827
47830
  var periods = [
47828
47831
  { value: Period.TODAY, label: translations[locale]["Today"] },
47829
47832
  { value: Period.LAST_7_DAYS, label: translations[locale]["Last 7 days"] },
@@ -47863,10 +47866,13 @@ var Chart = function (_a) {
47863
47866
  justifyContent: "space-between",
47864
47867
  marginBottom: 10,
47865
47868
  padding: "0 15px 0 5px",
47866
- } }, { children: [jsx$1(Heading, __assign$2({ type: "h3" }, { children: titles[type] })), jsx$1(Select, __assign$2({ defaultValue: period, onChange: function (value) { return setPeriod(value); }, id: "period", name: "period" }, { children: periods.map(function (_a) {
47869
+ } }, { children: [jsx$1(Heading, __assign$2({ type: "h3" }, { children: titles[type] })), jsx$1(Select, __assign$2({ defaultValue: period, onChange: function (value) {
47870
+ setPeriod(value);
47871
+ onChangePeriod(value);
47872
+ }, id: "period", name: "period" }, { children: periods.map(function (_a) {
47867
47873
  var value = _a.value, label = _a.label;
47868
47874
  return (jsx$1("option", __assign$2({ value: value }, { children: label }), value));
47869
- }) }))] })), renderChart()] }));
47875
+ }) }), period)] })), renderChart()] }));
47870
47876
  };
47871
47877
 
47872
47878
  var StyledTextarea = styled.textarea(templateObject_1$a || (templateObject_1$a = __makeTemplateObject$1(["\n width: 100%;\n min-width: 228px;\n min-height: 50px;\n background-color: ", ";\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n box-sizing: border-box;\n border-radius: 4px;\n padding: 13px 15px;\n cursor: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: 500;\n font-style: normal;\n line-height: ", ";\n color: ", ";\n resize: vertical;\n\n ::placeholder {\n font-family: ", ";\n font-size: ", ";\n font-weight: 500;\n font-style: normal;\n line-height: ", ";\n color: ", ";\n }\n\n ::-webkit-calendar-picker-indicator {\n display: none;\n }\n\n :focus {\n outline: 0;\n border-color: ", ";\n box-shadow: ", ";\n }\n"], ["\n width: 100%;\n min-width: 228px;\n min-height: 50px;\n background-color: ", ";\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n box-sizing: border-box;\n border-radius: 4px;\n padding: 13px 15px;\n cursor: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: 500;\n font-style: normal;\n line-height: ", ";\n color: ", ";\n resize: vertical;\n\n ::placeholder {\n font-family: ", ";\n font-size: ", ";\n font-weight: 500;\n font-style: normal;\n line-height: ", ";\n color: ", ";\n }\n\n ::-webkit-calendar-picker-indicator {\n display: none;\n }\n\n :focus {\n outline: 0;\n border-color: ", ";\n box-shadow: ", ";\n }\n"])), function (_a) {