stp-ui-kit 0.0.75 → 0.0.78

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,93 +1,153 @@
1
- # stp-ui-kit
1
+ # 🎨 stp-ui-kit
2
2
 
3
+ A custom UI Kit developed for the Smartestprep platform.
4
+ It provides a set of reusable, styled, and tested UI components to ensure consistent design and faster development across projects.
3
5
 
6
+ ---
4
7
 
5
- ## Getting started
8
+ ## 📦 Installation
6
9
 
7
- To make it easy for you to get started with GitLab, here's a list of recommended next steps.
10
+ ```bash
11
+ npm install stp-ui-kit
12
+ # or
13
+ yarn add stp-ui-kit
14
+ # or
15
+ bun add stp-ui-kit
16
+ ```
17
+
18
+ ---
8
19
 
9
- Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
20
+ ## 🚀 Usage
10
21
 
11
- ## Add your files
22
+ Import styles and components directly into your React project:
12
23
 
13
- - [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
14
- - [ ] [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-files-to-a-git-repository) or push an existing Git repository with the following command:
24
+ ```tsx
25
+ import { Button } from "stp-ui-kit";
26
+ import "stp-ui-kit/dist/styles/index.css";
15
27
 
28
+ export default function App() {
29
+ return <Button variant='primary'>Click Me</Button>;
30
+ }
16
31
  ```
17
- cd existing_repo
18
- git remote add origin https://gitlab.com/smartest-prep/stp-ui-kit.git
19
- git branch -M main
20
- git push -uf origin main
32
+
33
+ ---
34
+
35
+ ## 📂 Project Structure
36
+
37
+ ```plaintext
38
+ src/
39
+ ├─ assets/ # custom icons and static assets
40
+ ├─ components/ # UI components
41
+ │ ├─ data/
42
+ │ ├─ display/
43
+ │ ├─ feedback/
44
+ │ ├─ form/
45
+ │ ├─ layout/
46
+ │ ├─ navigation/
47
+ │ └─ ui/
48
+ ├─ lib/ # helpers, utils
49
+ ├─ styles/ # global styles, tokens, variables
50
+ │ ├─ _variables.scss
51
+ │ ├─ main.scss
52
+ │ └─ tokens.ts
53
+ ├─ App.tsx # playground / dev entry
54
+ └─ index.ts # main export file
21
55
  ```
22
56
 
23
- ## Integrate with your tools
57
+ ---
58
+
59
+ ## 🛠 Tech Stack
60
+
61
+ - React 18+ / 19+ – core UI framework
62
+ - TypeScript – strongly typed components
63
+ - TailwindCSS 4 + SCSS – styling and design tokens
64
+ - Lucide-react – icon library
65
+ - React Hook Form – form handling integration
66
+ - Storybook 8 – interactive component documentation
67
+ - Vite – development & build tooling
24
68
 
25
- - [ ] [Set up project integrations](https://gitlab.com/smartest-prep/stp-ui-kit/-/settings/integrations)
69
+ ---
26
70
 
27
- ## Collaborate with your team
71
+ ## 📖 Documentation
28
72
 
29
- - [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
30
- - [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
31
- - [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
32
- - [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
33
- - [ ] [Set auto-merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/)
73
+ Run Storybook to explore and test components interactively:
34
74
 
35
- ## Test and Deploy
75
+ ```bash
76
+ npm run storybook
77
+ ```
78
+
79
+ Build the static Storybook docs:
80
+
81
+ ```bash
82
+ npm run build-storybook
83
+ ```
36
84
 
37
- Use the built-in continuous integration in GitLab.
85
+ ---
38
86
 
39
- - [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/)
40
- - [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
41
- - [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
42
- - [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
43
- - [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
87
+ ## 🧑‍💻 Development
44
88
 
45
- ***
89
+ - Start in dev mode
46
90
 
47
- # Editing this README
91
+ ```bash
92
+ npm run dev
93
+ ```
48
94
 
49
- When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
95
+ - Build library
50
96
 
51
- ## Suggestions for a good README
97
+ ```bash
98
+ npm run build
99
+ ```
52
100
 
53
- Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
101
+ - Lint & format
54
102
 
55
- ## Name
56
- Choose a self-explaining name for your project.
103
+ ```bash
104
+ npm run lint
105
+ npm run format
106
+ ```
57
107
 
58
- ## Description
59
- Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
108
+ - Generate tokens
109
+ ```bash
110
+ npm run generate-tokens
111
+ ```
60
112
 
61
- ## Badges
62
- On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
113
+ ---
63
114
 
64
- ## Visuals
65
- Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
115
+ # 🔑 Principles
66
116
 
67
- ## Installation
68
- Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
117
+ - Fully typed components (.ts / .tsx only)
118
+ - Consistent design system powered by tokens according to Figma designs
119
+ - Use named exports only (`export const`)
120
+ - Remove unused/deprecated components over time
121
+ - Do not add new dependencies unless absolutely necessary (to avoid making the project heavy)
69
122
 
70
- ## Usage
71
- Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
123
+ ### 📦 Project Releases
72
124
 
73
- ## Support
74
- Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
125
+ - Always upgrade the version in `package.json` before publishing
126
+ - Do **not** run `npm publish` for every minor change
127
+ - Always run `npm run build` before publishing
128
+ - All changes must be commited into repository
75
129
 
76
- ## Roadmap
77
- If you have ideas for releases in the future, it is a good idea to list them in the README.
130
+ ### 🛠 Local Development
78
131
 
79
- ## Contributing
80
- State if you are open to contributions and what your requirements are for accepting them.
132
+ - When developing locally with other projects, use `npm link`
133
+ ```bash
134
+ # inside stp-ui-kit
135
+ npm link
136
+ # inside your project
137
+ npm link stp-ui-kit
138
+ ```
139
+ - After testing locally, publish the updated package if required
81
140
 
82
- For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
141
+ ## 🤝 Contributing
83
142
 
84
- You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
143
+ 1. Clone the repo
144
+ 2. Install dependencies with `npm install`
145
+ 3. Run Storybook (`npm run storybook`)
146
+ 4. Add or update a component inside `src/components`
147
+ 5. Submit a pull request 🎉
85
148
 
86
- ## Authors and acknowledgment
87
- Show your appreciation to those who have contributed to the project.
149
+ ---
88
150
 
89
- ## License
90
- For open source projects, say how it is licensed.
151
+ ## 📜 License
91
152
 
92
- ## Project status
93
- If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
153
+ MIT © Smartestprep
@@ -1,17 +1,9 @@
1
1
  import { default as React, ReactNode } from 'react';
2
- export interface DropdownItem {
3
- label: string;
4
- icon?: React.ReactNode;
5
- onClick?: () => void;
6
- disabled?: boolean;
7
- }
8
2
  interface DropdownProps {
9
- items: DropdownItem[];
10
3
  children: ReactNode;
4
+ trigger: ReactNode;
11
5
  className?: string;
12
- disabled?: boolean;
13
6
  align?: "left" | "right";
14
- extraContent?: ReactNode;
15
7
  }
16
8
  export declare const Dropdown: React.FC<DropdownProps>;
17
9
  export {};
@@ -0,0 +1,14 @@
1
+ export type ShadowLevel = "lower" | "higher";
2
+ export interface OptionListItem {
3
+ label: string;
4
+ icon?: React.ReactNode;
5
+ onClick?: () => void;
6
+ disabled?: boolean;
7
+ }
8
+ export interface OptionListProps {
9
+ items: OptionListItem[];
10
+ onSelect?: (item: OptionListItem, index: number) => void;
11
+ className?: string;
12
+ shadow?: ShadowLevel;
13
+ }
14
+ export declare const OptionList: ({ items, onSelect, className, shadow, }: OptionListProps) => import("react/jsx-runtime").JSX.Element;
@@ -6,3 +6,4 @@ export * from './IconButton/IconButton';
6
6
  export * from './Typography/Typography';
7
7
  export * from './SvgStyleWrapper/SvgStyleWrapper';
8
8
  export * from './Icon/Icon';
9
+ export * from './OptionList/OptionList';
@@ -0,0 +1,36 @@
1
+ import { default as dayjs, Dayjs } from '../../../lib/dayjs';
2
+ /** Public value types */
3
+ export type SingleValue = Dayjs | null;
4
+ export type RangeTuple = [Dayjs | null, Dayjs | null];
5
+ export type RangeValue = RangeTuple | null;
6
+ /** Shared props */
7
+ export type BaseProps = {
8
+ multiMonth?: boolean;
9
+ onCard?: boolean;
10
+ initialMonth?: Dayjs;
11
+ minDate?: Dayjs;
12
+ maxDate?: Dayjs;
13
+ weekStartsOn?: 0 | 1;
14
+ className?: string;
15
+ };
16
+ /** Single-date props (default mode) */
17
+ export type CalendarPropsSingle = BaseProps & {
18
+ allowRange?: false;
19
+ value?: SingleValue;
20
+ defaultValue?: SingleValue;
21
+ onChange?: (value: SingleValue) => void;
22
+ };
23
+ /** Range props (when allowRange is true) */
24
+ export type CalendarPropsRange = BaseProps & {
25
+ allowRange: true;
26
+ value?: RangeValue;
27
+ defaultValue?: RangeValue;
28
+ onChange?: (value: RangeValue) => void;
29
+ };
30
+ /** Discriminated union of prop shapes */
31
+ export type CalendarProps = CalendarPropsSingle | CalendarPropsRange;
32
+ /** Narrowing helpers */
33
+ export declare const asDay: (d: Dayjs | Date | null | undefined) => dayjs.Dayjs | null;
34
+ /** Overloads for better DX */
35
+ export declare function Calendar(props: CalendarPropsSingle): JSX.Element;
36
+ export declare function Calendar(props: CalendarPropsRange): JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { default as React } from 'react';
2
+ export type CornerType = "start" | "end" | "both" | null;
3
+ export interface CalendarDayProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onClick"> {
4
+ number: number;
5
+ isActive?: boolean;
6
+ isCorner?: boolean;
7
+ isInRange?: boolean;
8
+ cornerType?: CornerType;
9
+ onClick?: (dayNumber: number) => void;
10
+ disabled?: boolean;
11
+ className?: string;
12
+ }
13
+ export declare const CalendarDay: React.MemoExoticComponent<React.ForwardRefExoticComponent<CalendarDayProps & React.RefAttributes<HTMLButtonElement>>>;
@@ -0,0 +1,2 @@
1
+ declare const CalendarDayHeader: () => import("react/jsx-runtime").JSX.Element;
2
+ export default CalendarDayHeader;
@@ -0,0 +1,21 @@
1
+ import { Dayjs } from '../../../../lib/dayjs';
2
+ import { CornerType } from '../CalendarDay/CalendarDay';
3
+ export interface CalendarMonthProps {
4
+ monthDate: Dayjs;
5
+ weekStartsOn: 0 | 1;
6
+ locale?: string;
7
+ minDate?: Dayjs;
8
+ maxDate?: Dayjs;
9
+ onSelectDay: (d: Dayjs) => void;
10
+ isInRange?: (d: Dayjs) => boolean;
11
+ isSelected?: (d: Dayjs) => boolean;
12
+ cornerType?: (d: Dayjs) => CornerType;
13
+ allowRange?: boolean;
14
+ showPrev?: boolean;
15
+ showNext?: boolean;
16
+ onPrev?: () => void;
17
+ onNext?: () => void;
18
+ prevDisabled?: boolean;
19
+ nextDisabled?: boolean;
20
+ }
21
+ export declare const CalendarMonth: import('react').MemoExoticComponent<({ monthDate, weekStartsOn, minDate, maxDate, onSelectDay, isInRange, isSelected, cornerType, allowRange, showPrev, showNext, onPrev, onNext, prevDisabled, nextDisabled, }: CalendarMonthProps) => import("react/jsx-runtime").JSX.Element>;
@@ -0,0 +1,15 @@
1
+ import { Dayjs } from '../../../lib/dayjs';
2
+ export declare const startOfDay: (d: Dayjs) => Dayjs;
3
+ export declare const endOfDay: (d: Dayjs) => Dayjs;
4
+ export declare const isSameDay: (a?: Dayjs | null, b?: Dayjs | null) => boolean;
5
+ export declare const isBefore: (a: Dayjs, b: Dayjs) => boolean;
6
+ export declare const isAfter: (a: Dayjs, b: Dayjs) => boolean;
7
+ export declare const clampDate: (d: Dayjs, min?: Dayjs, max?: Dayjs) => Dayjs;
8
+ export declare const addMonths: (d: Dayjs, n: number) => Dayjs;
9
+ export declare const addDays: (d: Dayjs, n: number) => Dayjs;
10
+ /** 6×7 grid for a month view */
11
+ export declare const daysInMonthGrid: (month: Dayjs, weekStartsOn: 0 | 1) => {
12
+ date: Dayjs;
13
+ inCurrentMonth: boolean;
14
+ }[];
15
+ export declare const isDisabled: (d: Dayjs, min?: Dayjs, max?: Dayjs) => boolean | undefined;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export type FormItemState = "default" | "error" | "disabled" | "readOnly";
3
2
  export interface FormItemContextValue {
4
3
  state: FormItemState;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  interface RadioButtonProps extends React.InputHTMLAttributes<HTMLInputElement> {
3
2
  label?: string;
4
3
  error?: string;
@@ -5,3 +5,7 @@ export * from './Input/Input';
5
5
  export * from './Input/TextArea';
6
6
  export * from './RadioButton/RadioButton';
7
7
  export * from './Select/Select';
8
+ export * from './Calendar/Calendar';
9
+ export * from './Calendar/CalendarDay/CalendarDay';
10
+ export * from './Calendar/CalendarMonth/CalendarMonth';
11
+ export * from './Calendar/dateUtils';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface NavItem {
3
2
  id: string;
4
3
  name: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface CourseNavItem {
3
2
  id: string;
4
3
  name: string;
@@ -0,0 +1,3 @@
1
+ import { default as dayjs } from 'dayjs';
2
+ export default dayjs;
3
+ export type { Dayjs } from 'dayjs';
@@ -0,0 +1 @@
1
+ export declare const useIsMobile: () => boolean;