@typeolymp/ui-components 1.18.0 → 1.18.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.
package/README.md CHANGED
@@ -1,7 +1,11 @@
1
1
  # 💅🏼 ui-components
2
2
  The `ui-components` repository is a collection of [React](https://react.dev/) components, crafted with [Typescript](https://www.typescriptlang.org/) and [Styled Components](https://styled-components.com/). The components are organized according to the [Atomic Design system](https://bradfrost.com/blog/post/atomic-web-design/) and provides a versatile set of building blocks to create beautiful and consistent user interfaces.
3
3
 
4
- ## Development
4
+ ## 📖 Table of Contents
5
+ - [Development](https://github.com/TypeOlymp/ui-components/tree/main#-development)
6
+ - [Contributing](https://github.com/TypeOlymp/ui-components/tree/main#-contributing)
7
+
8
+ ## 👨🏻‍💻 Development
5
9
  To get started with this project, follow these step:
6
10
  1. **Clone the repository:** Clone the [repository](https://github.com/TypeOlymp/ui-components) to your local machine.
7
11
  3. **Install dependencies:** Install the dependencies using `yarn install`
@@ -9,11 +13,12 @@ To get started with this project, follow these step:
9
13
 
10
14
  Open [http://localhost:6006](http://localhost:6006) with your browser to see the result.
11
15
 
12
- ## Contributing
16
+ ## 👫 Contributing
13
17
  To contribute to the `ui-components` package, follow these step:
14
18
  1. **Clone the Repository:** Clone the [repository](https://github.com/TypeOlymp/ui-components) to your local machine.
15
19
  3. **Create a Branch:** Create a new branch for your changes using a descriptive name: `git checkout -b feature/my-new-feature`.
16
20
  4. **Make Changes:** Make your desired changes and improvements to the codebase.
17
21
  5. **Commit Changes:** Commit your changes with a clear and concise commit message: `git commit -m "Add a new feature"`.
18
22
  6. **Push Changes:** Push your changes to your development branch: `git push origin feature/my-new-feature`.
19
- 7. **Open a Pull Request:** Visit the [repository](https://github.com/TypeOlymp/ui-components) and open a Pull Request. Describe your changes, and submit the pull request.
23
+ 7. **Update the CHANGELOG:** Update the `CHANGELOG.md` file with the new changes.
24
+ 8. **Open a Pull Request:** Visit the [repository](https://github.com/TypeOlymp/ui-components) and open a Pull Request. Describe your changes, and submit the pull request.
@@ -0,0 +1,30 @@
1
+ declare const _default: ({
2
+ _id: string;
3
+ student: string;
4
+ exercise: string;
5
+ passed: boolean;
6
+ medal: string;
7
+ accuracy: number;
8
+ kpm: number;
9
+ hits: {
10
+ correct: number;
11
+ wrong: number;
12
+ };
13
+ seconds: number;
14
+ date: string;
15
+ } | {
16
+ _id: string;
17
+ student: string;
18
+ exercise: string;
19
+ passed: boolean;
20
+ accuracy: number;
21
+ kpm: number;
22
+ hits: {
23
+ correct: number;
24
+ wrong: number;
25
+ };
26
+ seconds: number;
27
+ date: string;
28
+ medal?: undefined;
29
+ })[];
30
+ export default _default;
@@ -1,15 +1,15 @@
1
1
  import { FC } from "react";
2
2
  import { Locale } from "@typeolymp/utils/enums";
3
- import { ExerciseResult, ChartType } from "./utils";
3
+ import { ExerciseResult } from "./utils";
4
4
  declare type BasePropsType = {
5
5
  exerciseResults: ExerciseResult[];
6
6
  locale: Locale;
7
7
  };
8
8
  export declare type PropsType = (BasePropsType & {
9
- type: Exclude<ChartType, "progress">;
9
+ type: "accuracy" | "hits" | "results" | "speed" | "time";
10
10
  nExercisesInCourse?: never;
11
11
  }) | (BasePropsType & {
12
- type: ChartType.PROGRESS;
12
+ type: "progress";
13
13
  nExercisesInCourse: number;
14
14
  });
15
15
  declare const Chart: FC<PropsType>;
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { Locale } from "@typeolymp/utils/enums";
2
3
  declare const _default: {
3
4
  title: string;
4
5
  component: React.FC<import(".").PropsType>;
@@ -10,3 +11,38 @@ export declare const Progress: () => JSX.Element;
10
11
  export declare const Results: () => JSX.Element;
11
12
  export declare const Speed: () => JSX.Element;
12
13
  export declare const Time: () => JSX.Element;
14
+ export declare const Playground: {
15
+ (args: any): JSX.Element;
16
+ args: {
17
+ locale: Locale;
18
+ exerciseResults: ({
19
+ _id: string;
20
+ student: string;
21
+ exercise: string;
22
+ passed: boolean;
23
+ medal: string;
24
+ accuracy: number;
25
+ kpm: number;
26
+ hits: {
27
+ correct: number;
28
+ wrong: number;
29
+ };
30
+ seconds: number;
31
+ date: string;
32
+ } | {
33
+ _id: string;
34
+ student: string;
35
+ exercise: string;
36
+ passed: boolean;
37
+ accuracy: number;
38
+ kpm: number;
39
+ hits: {
40
+ correct: number;
41
+ wrong: number;
42
+ };
43
+ seconds: number;
44
+ date: string;
45
+ medal?: undefined;
46
+ })[];
47
+ };
48
+ };
@@ -5,11 +5,3 @@ export declare enum Period {
5
5
  "LAST_3_MONTHS" = "90d",
6
6
  "LAST_12_MONTHS" = "1y"
7
7
  }
8
- export declare enum ChartType {
9
- "ACCURACY" = "accuracy",
10
- "RESULTS" = "results",
11
- "HITS" = "hits",
12
- "SPEED" = "speed",
13
- "PROGRESS" = "progress",
14
- "TIME" = "time"
15
- }
package/build/index.es.js CHANGED
@@ -47363,16 +47363,7 @@ var Period;
47363
47363
  Period["LAST_30_DAYS"] = "30d";
47364
47364
  Period["LAST_3_MONTHS"] = "90d";
47365
47365
  Period["LAST_12_MONTHS"] = "1y";
47366
- })(Period || (Period = {}));
47367
- var ChartType;
47368
- (function (ChartType) {
47369
- ChartType["ACCURACY"] = "accuracy";
47370
- ChartType["RESULTS"] = "results";
47371
- ChartType["HITS"] = "hits";
47372
- ChartType["SPEED"] = "speed";
47373
- ChartType["PROGRESS"] = "progress";
47374
- ChartType["TIME"] = "time";
47375
- })(ChartType || (ChartType = {}));
47366
+ })(Period || (Period = {}));
47376
47367
 
47377
47368
  var getInterval = function (period) {
47378
47369
  var start = undefined;
@@ -47639,8 +47630,8 @@ var ProgressChart = function (_a) {
47639
47630
  return parseISO(date) >= start;
47640
47631
  });
47641
47632
  var _a = prepareData(period, passedExercisesAfterStart), resultsByInterval = _a.resultsByInterval, xAxisTicks = _a.xAxisTicks;
47642
- var count = passedExercisesBeforeStart.length;
47643
47633
  setData(function () {
47634
+ var count = passedExercisesBeforeStart.length;
47644
47635
  return resultsByInterval.map(function (exercises, index) {
47645
47636
  count += exercises.length;
47646
47637
  var progress = Math.floor(100 / (nExercisesInCourse / count));
@@ -47698,11 +47689,7 @@ var Chart = function (_a) {
47698
47689
  time: translations[locale]["Time practised"],
47699
47690
  };
47700
47691
  var renderChart = function () {
47701
- var props = {
47702
- exerciseResults: exerciseResults,
47703
- locale: locale,
47704
- period: period,
47705
- };
47692
+ var props = { exerciseResults: exerciseResults, locale: locale, period: period };
47706
47693
  switch (type) {
47707
47694
  case "accuracy":
47708
47695
  return jsx$1(AccuracyChart, __assign$2({}, props));
@@ -47723,10 +47710,11 @@ var Chart = function (_a) {
47723
47710
  alignItems: "baseline",
47724
47711
  justifyContent: "space-between",
47725
47712
  marginBottom: 10,
47726
- } }, { children: [jsx$1(Heading, __assign$2({ type: "h3" }, { children: titles[type] })), jsx$1("div", __assign$2({ style: { paddingRight: 10 } }, { children: jsx$1(Select, __assign$2({ defaultValue: period, onChange: function (value) { return setPeriod(value); }, id: "period", name: "period" }, { children: periods.map(function (_a) {
47727
- var value = _a.value, label = _a.label;
47728
- return (jsx$1("option", __assign$2({ value: value }, { children: label }), value));
47729
- }) })) }))] })), renderChart()] }));
47713
+ paddingRight: 15,
47714
+ } }, { 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) {
47715
+ var value = _a.value, label = _a.label;
47716
+ return (jsx$1("option", __assign$2({ value: value }, { children: label }), value));
47717
+ }) }))] })), renderChart()] }));
47730
47718
  };
47731
47719
 
47732
47720
  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) {