kwant-ui 3.44.0 → 3.45.0
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 +150 -42
- package/dist/components/Checkbox/types.d.ts +0 -1
- package/dist/components/Dropdown/DropdownTypes.d.ts +1 -0
- package/dist/components/TimePicker/TimePicker.d.ts +2 -0
- package/dist/components/TimePicker/index.d.ts +2 -0
- package/dist/components/TimePicker/timepicker.styled.d.ts +13 -0
- package/dist/components/TimePicker/types.d.ts +22 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +68 -9
- package/dist/index.js +65 -6
- package/dist/package.json +1 -1
- package/dist/public/assets/icons/US.svg +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,73 +1,181 @@
|
|
|
1
|
-
# Kwant
|
|
1
|
+
# Kwant-UI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`kwant-ui` is the official frontend component library for Kwant-App. It provides a set of reusable, accessible, and themeable React components to build beautiful and consistent user interfaces.
|
|
4
4
|
|
|
5
|
-
## Table of Contents
|
|
5
|
+
## 📋 Table of Contents
|
|
6
6
|
|
|
7
|
-
- [
|
|
8
|
-
- [
|
|
9
|
-
- [Usage](#usage)
|
|
10
|
-
- [Storybook](#storybook)
|
|
7
|
+
- [About The Project](#about-the-project 'null')
|
|
8
|
+
- [Installation](#installation 'null')
|
|
9
|
+
- [Usage](#usage 'null')
|
|
10
|
+
- [Storybook: Visualizing Components](#storybook-visualizing-components 'null')
|
|
11
|
+
- [Available Scripts for Development](#available-scripts-for-development 'null')
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
- [Publishing to NPM](#publishing-to-npm)
|
|
14
|
+
- [Folder Structure](#folder-structure 'null')
|
|
15
|
+
- [Contributing](#contributing 'null')
|
|
13
16
|
|
|
14
|
-
|
|
17
|
+
## 🚀 About The Project
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
# npm
|
|
18
|
-
npm install kwant-ui
|
|
19
|
+
This library contains all the foundational UI elements required for the Kwant ecosystem. Each component is built with TypeScript for type safety and styled to fit our design system. The components are bundled using Rollup.js for optimized performance.
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
yarn add kwant-ui
|
|
22
|
-
```
|
|
21
|
+
**Built With:**
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
- [**React**](https://reactjs.org/ 'null')**:** A JavaScript library for building user interfaces.
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
- [**Styled Components**](https://styled-components.com/ 'null')**:** For component level styling.
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
- [**TypeScript**](https://www.typescriptlang.org/ 'null')**:** For robust, type-safe components.
|
|
28
|
+
- [**Storybook**](https://storybook.js.org/ 'null')**:** For developing and showcasing components in isolation.
|
|
29
|
+
- [**Rollup.js**](https://rollupjs.org/ 'null')**:** For bundling the library into a distributable format.
|
|
30
|
+
- [**ESLint**](https://eslint.org/ 'null')**:** For maintaining code quality.
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
## 📥 Installation
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
cd ui-components
|
|
36
|
-
```
|
|
34
|
+
To use kwant-ui in your project, you need to install the library along with its peer dependencies.
|
|
37
35
|
|
|
38
|
-
|
|
36
|
+
Install with npm:
|
|
39
37
|
|
|
40
|
-
```
|
|
41
|
-
|
|
38
|
+
```
|
|
39
|
+
npm install kwant-ui react react-dom styled-components react-viewport-list
|
|
42
40
|
```
|
|
43
41
|
|
|
44
|
-
|
|
42
|
+
**Note:** `react-dom, styled-components, react-viewport-list` are a peer dependency and must be installed alongside `kwant-ui`.
|
|
45
43
|
|
|
46
|
-
## Usage
|
|
44
|
+
## 💡 Usage
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
To use `kwant-ui`, you must wrap your application with the `ThemeProvider` from `styled-components` and provide it with a theme from our library. This is a required step for the components to render correctly.
|
|
49
47
|
|
|
50
|
-
|
|
48
|
+
### 1. Set up the ThemeProvider
|
|
51
49
|
|
|
52
|
-
|
|
50
|
+
In your main application entry point (`main.tsx` or `index.tsx`), set up the provider as follows:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
import React from 'react';
|
|
54
|
+
import ReactDOM from 'react-dom/client';
|
|
55
|
+
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
|
|
56
|
+
import { ROUTES } from './routes';
|
|
57
|
+
import { ThemeProvider } from 'styled-components';
|
|
58
|
+
import './assets/styles/index.scss';
|
|
59
|
+
import { colors } from 'kwant-ui';
|
|
60
|
+
|
|
61
|
+
const router = createBrowserRouter(ROUTES);
|
|
62
|
+
|
|
63
|
+
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
|
|
64
|
+
<React.StrictMode>
|
|
65
|
+
<ThemeProvider theme={colors}>
|
|
66
|
+
<RouterProvider router={router} />
|
|
67
|
+
</ThemeProvider>
|
|
68
|
+
</React.StrictMode>
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 2. Use Components in Your App
|
|
74
|
+
|
|
75
|
+
Once the `ThemeProvider` is set up, you can import and use any component from the library throughout your application.
|
|
76
|
+
|
|
77
|
+
```
|
|
53
78
|
import React from 'react';
|
|
54
|
-
import { Button } from 'kwant-ui';
|
|
79
|
+
import { Button, Text } from 'kwant-ui';
|
|
55
80
|
|
|
56
|
-
function
|
|
81
|
+
function MyComponent() {
|
|
57
82
|
return (
|
|
58
|
-
|
|
59
|
-
<
|
|
60
|
-
|
|
83
|
+
<>
|
|
84
|
+
<Text category="subtitle2" weight="semiBold">Welcome</Text>
|
|
85
|
+
<Button onClick={() => alert('Button Clicked!')} label="Click Me"/>
|
|
86
|
+
</>
|
|
61
87
|
);
|
|
62
88
|
}
|
|
63
89
|
|
|
64
|
-
export default
|
|
90
|
+
export default MyComponent;
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## 📖 Storybook: Visualizing Components
|
|
95
|
+
|
|
96
|
+
We use Storybook for interactive development and documentation. It allows you to browse the component library, view the different states of each component, and interact with them in a live environment.
|
|
97
|
+
|
|
98
|
+
#### Live Playground
|
|
99
|
+
|
|
100
|
+
_Explore the live Storybook playground at:_ [_https://ui.kwant.ai/_](https://ui.kwant.ai/ 'null')
|
|
101
|
+
|
|
102
|
+
#### Local Development
|
|
103
|
+
|
|
104
|
+
To run Storybook locally, clone this repository and run:
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
npm run storybook
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
This will start the Storybook development server on [http://localhost:6006](https://www.google.com/search?q=http://localhost:6006 'null').
|
|
111
|
+
|
|
112
|
+
## 📜 Available Scripts for Development
|
|
113
|
+
|
|
114
|
+
These scripts are for the development and maintenance of this library.
|
|
115
|
+
|
|
116
|
+
### `npm run storybook` or `npm run dev`
|
|
117
|
+
|
|
118
|
+
Starts the Storybook development server. This is the primary command for developing and testing components in isolation.
|
|
119
|
+
|
|
120
|
+
### `npm run build`
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
rm -rf ./dist && rollup -c --bundleConfigAsCjs
|
|
65
124
|
```
|
|
66
125
|
|
|
67
|
-
|
|
126
|
+
Builds the library for production. It first cleans the `dist` directory and then uses Rollup to bundle the components into an optimized format suitable for publishing to NPM.
|
|
127
|
+
|
|
128
|
+
### `npm run prebuild`
|
|
129
|
+
|
|
130
|
+
This script runs automatically before the `build` script.
|
|
131
|
+
|
|
132
|
+
- `npm run generate-icon-types`: Executes a utility script to automatically generate TypeScript type definitions for the icons used in the library.
|
|
133
|
+
|
|
134
|
+
### `npm run build-storybook`
|
|
135
|
+
|
|
136
|
+
Builds a static version of the Storybook documentation site, which can be deployed and hosted online.
|
|
137
|
+
|
|
138
|
+
### `npm run lint`
|
|
68
139
|
|
|
69
|
-
|
|
140
|
+
```
|
|
141
|
+
eslint "**/*.ts*"
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Lints all TypeScript files (`.ts` and `.tsx`) in the project to enforce code quality and style consistency.
|
|
145
|
+
|
|
146
|
+
## 📦 Publishing to NPM
|
|
147
|
+
|
|
148
|
+
For instructions on how to publish a new version of `kwant-ui` to the NPM repository, please refer to our internal documentation on Confluence.
|
|
149
|
+
|
|
150
|
+
[**Publishing Guide: Publishing a version of ui-components(npm package)**](https://ontargetapp.atlassian.net/wiki/x/AwDcfg 'null')
|
|
151
|
+
|
|
152
|
+
## 📂 Folder Structure
|
|
153
|
+
|
|
154
|
+
The library is organized as follows:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
kwant-ui/
|
|
158
|
+
├── .storybook/ # Storybook configuration files
|
|
159
|
+
├── components/ # The source code for all React components
|
|
160
|
+
├── GlobalStyles/ # Global CSS styles and resets
|
|
161
|
+
├── HOC/ # Higher-Order Components
|
|
162
|
+
├── hooks/ # Custom React hooks
|
|
163
|
+
├── stories/ # Storybook stories for each component
|
|
164
|
+
├── themes/ # Design tokens (colors, spacing, typography)
|
|
165
|
+
├── types/ # Global TypeScript type definitions
|
|
166
|
+
├── utils/ # Utility scripts, like the icon type generator
|
|
167
|
+
├── .eslintrc.cjs # ESLint configuration
|
|
168
|
+
├── .prettierrc # Prettier configuration
|
|
169
|
+
├── package.json # Project dependencies and scripts
|
|
170
|
+
├── rollup.config.js # Rollup configuration for building the library
|
|
171
|
+
└── tsconfig.json # TypeScript configuration
|
|
172
|
+
|
|
173
|
+
```
|
|
70
174
|
|
|
71
|
-
|
|
175
|
+
## 🤝 Contributing
|
|
72
176
|
|
|
73
|
-
|
|
177
|
+
1. Fork the Project
|
|
178
|
+
2. Create your Feature Branch (`git checkout -b PR-JIRA-TICKET-ID`)
|
|
179
|
+
3. Commit your Changes (`git commit -m 'Add NewComponent'`)
|
|
180
|
+
4. Push to the Branch (`git push origin PR-JIRA-TICKET-ID`)
|
|
181
|
+
5. Open a Pull Request
|
|
@@ -10,6 +10,7 @@ export declare namespace IDropdown {
|
|
|
10
10
|
};
|
|
11
11
|
type Props = Omit<IBaseDropdown.Props, 'height' | 'children'> & {
|
|
12
12
|
maxHeight?: number;
|
|
13
|
+
isDynamicOptionPosition?: boolean;
|
|
13
14
|
onChange?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
14
15
|
onDropdownVisibilityChange?: () => void;
|
|
15
16
|
data?: Option[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const TimeContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const TimeInput: import("styled-components").StyledComponent<"input", any, {
|
|
3
|
+
format?: string;
|
|
4
|
+
onlyHours?: boolean;
|
|
5
|
+
}, never>;
|
|
6
|
+
export declare const TimeInputWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
7
|
+
onlyHours?: boolean;
|
|
8
|
+
}, never>;
|
|
9
|
+
export declare const ColonSeparator: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
10
|
+
export declare const DisabledMinutes: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
11
|
+
export declare const DropdownContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
12
|
+
export declare const DropdownButton: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
13
|
+
export declare const PeriodText: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TooltipComponent } from '../Tooltip/types';
|
|
3
|
+
type Period = 'AM' | 'PM';
|
|
4
|
+
type Format = '12' | '24';
|
|
5
|
+
export interface TimePickerProps {
|
|
6
|
+
onChange?: (value: {
|
|
7
|
+
time: string;
|
|
8
|
+
period?: Period;
|
|
9
|
+
}) => void;
|
|
10
|
+
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
required?: boolean;
|
|
13
|
+
label?: string;
|
|
14
|
+
id?: string;
|
|
15
|
+
value?: string;
|
|
16
|
+
tooltipContent?: string;
|
|
17
|
+
tooltipPosition?: TooltipComponent.Position;
|
|
18
|
+
format?: Format;
|
|
19
|
+
period?: Period;
|
|
20
|
+
onlyHours?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -61,6 +61,7 @@ export * from './components/Charts/HorizontalStackedBarChart';
|
|
|
61
61
|
export * from './components/Charts/GaugeChart';
|
|
62
62
|
export * from './components/Charts/ProgressChart';
|
|
63
63
|
export * from './components/Charts/LineChart';
|
|
64
|
+
export * from './components/TimePicker';
|
|
64
65
|
export { CALENDAR_CONSTANTS, getDateObjectForCalendarConstants, } from './components/Calendar/CalendarUtils';
|
|
65
66
|
export * from './components/TrendPercentage';
|
|
66
67
|
export * from './components/Charts/WorkerTimeChart';
|