@typeolymp/ui-components 1.19.1 → 1.19.3

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,6 +1,8 @@
1
1
  import { FC, ReactNode } from "react";
2
+ import { Color } from "@typeolymp/utils/enums";
2
3
  export declare type PropsType = {
3
4
  children?: ReactNode;
5
+ color?: Color;
4
6
  };
5
7
  declare const Tag: FC<PropsType>;
6
8
  export default Tag;
@@ -5,3 +5,4 @@ declare const _default: {
5
5
  };
6
6
  export default _default;
7
7
  export declare const Overview: () => JSX.Element;
8
+ export declare const Playground: (args: any) => JSX.Element;
@@ -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
@@ -8225,11 +8225,32 @@ var DataSummary = function (_a) {
8225
8225
  }) })] }) }));
8226
8226
  };
8227
8227
 
8228
- var Container$o = styled.div(templateObject_1$G || (templateObject_1$G = __makeTemplateObject$1(["\n padding: 7px 10px;\n background-color: ", ";\n box-shadow: 0 2px 0 ", ";\n border: 1px solid ", ";\n border-radius: 4px;\n box-sizing: border-box;\n text-decoration: none;\n\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n font-style: normal;\n color: ", ";\n"], ["\n padding: 7px 10px;\n background-color: ", ";\n box-shadow: 0 2px 0 ", ";\n border: 1px solid ", ";\n border-radius: 4px;\n box-sizing: border-box;\n text-decoration: none;\n\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n font-style: normal;\n color: ", ";\n"])), theme.colors.lightGray.base, theme.colors.lightGray.darker, theme.colors.lightGray.darker, theme.fonts.paragraph, theme.subheading.small.fontSize, theme.subheading.small.fontWeight, theme.colors.darkGray.light);
8228
+ var Container$o = styled.div(templateObject_1$G || (templateObject_1$G = __makeTemplateObject$1(["\n padding: 7px 10px;\n background-color: ", ";\n box-shadow: ", ";\n border: 1px solid;\n border-color: ", ";\n border-radius: 4px;\n box-sizing: border-box;\n text-decoration: none;\n\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n font-style: normal;\n color: ", ";\n"], ["\n padding: 7px 10px;\n background-color: ", ";\n box-shadow: ", ";\n border: 1px solid;\n border-color: ", ";\n border-radius: 4px;\n box-sizing: border-box;\n text-decoration: none;\n\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n font-style: normal;\n color: ", ";\n"])), function (_a) {
8229
+ var color = _a.color;
8230
+ if (!color)
8231
+ return theme.colors.lightGray.base;
8232
+ return theme.colors[color].light;
8233
+ }, function (_a) {
8234
+ var color = _a.color;
8235
+ if (!color)
8236
+ return "0 2px 0 ".concat(theme.colors.lightGray.darker);
8237
+ return "0 2px 0 ".concat(theme.colors[color].dark);
8238
+ }, function (_a) {
8239
+ var color = _a.color;
8240
+ if (!color)
8241
+ return theme.colors.lightGray.darker;
8242
+ return theme.colors[color].dark;
8243
+ }, theme.fonts.paragraph, theme.subheading.small.fontSize, theme.subheading.small.fontWeight, function (_a) {
8244
+ var color = _a.color;
8245
+ if (!color)
8246
+ return theme.colors.darkGray.light;
8247
+ return theme.colors[color].darker;
8248
+ });
8229
8249
  var templateObject_1$G;
8230
8250
 
8231
- var Tag = function (props) {
8232
- return jsx$1(Container$o, { children: props.children });
8251
+ var Tag = function (_a) {
8252
+ var color = _a.color, children = _a.children;
8253
+ return jsx$1(Container$o, __assign$2({ color: color }, { children: children }));
8233
8254
  };
8234
8255
 
8235
8256
  var Container$n = styled.div(templateObject_1$F || (templateObject_1$F = __makeTemplateObject$1(["\n width: 46px;\n min-width: 46px;\n max-width: 46px;\n height: 27px;\n min-height: 27px;\n max-height: 27px;\n border-radius: 14px;\n cursor: ", ";\n position: relative;\n background-color: ", ";\n\n :after {\n content: \"\";\n width: 21px;\n height: 21px;\n border-radius: 50%;\n position: absolute;\n top: 3px;\n right: ", ";\n left: ", ";\n background-color: ", ";\n }\n\n input {\n display: none;\n }\n\n :focus {\n outline: 0;\n border-color: ", ";\n box-shadow: ", ";\n }\n"], ["\n width: 46px;\n min-width: 46px;\n max-width: 46px;\n height: 27px;\n min-height: 27px;\n max-height: 27px;\n border-radius: 14px;\n cursor: ", ";\n position: relative;\n background-color: ", ";\n\n :after {\n content: \"\";\n width: 21px;\n height: 21px;\n border-radius: 50%;\n position: absolute;\n top: 3px;\n right: ", ";\n left: ", ";\n background-color: ", ";\n }\n\n input {\n display: none;\n }\n\n :focus {\n outline: 0;\n border-color: ", ";\n box-shadow: ", ";\n }\n"])), function (_a) {
@@ -47822,8 +47843,11 @@ var TimeChart = function (_a) {
47822
47843
  };
47823
47844
 
47824
47845
  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];
47846
+ 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;
47847
+ var _c = useState(defaultPeriod), period = _c[0], setPeriod = _c[1];
47848
+ useEffect(function () {
47849
+ setPeriod(defaultPeriod);
47850
+ }, [defaultPeriod]);
47827
47851
  var periods = [
47828
47852
  { value: Period.TODAY, label: translations[locale]["Today"] },
47829
47853
  { value: Period.LAST_7_DAYS, label: translations[locale]["Last 7 days"] },
@@ -47863,10 +47887,13 @@ var Chart = function (_a) {
47863
47887
  justifyContent: "space-between",
47864
47888
  marginBottom: 10,
47865
47889
  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) {
47890
+ } }, { children: [jsx$1(Heading, __assign$2({ type: "h3" }, { children: titles[type] })), jsx$1(Select, __assign$2({ defaultValue: period, onChange: function (value) {
47891
+ setPeriod(value);
47892
+ onChangePeriod(value);
47893
+ }, id: "period", name: "period" }, { children: periods.map(function (_a) {
47867
47894
  var value = _a.value, label = _a.label;
47868
47895
  return (jsx$1("option", __assign$2({ value: value }, { children: label }), value));
47869
- }) }))] })), renderChart()] }));
47896
+ }) }), period)] })), renderChart()] }));
47870
47897
  };
47871
47898
 
47872
47899
  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) {