smartsell-ui-kit 0.1.0 → 0.1.1

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/LICENSE CHANGED
@@ -1,21 +1,22 @@
1
- MIT License
1
+ SmartSell Proprietary License
2
2
 
3
- Copyright (c) 2026 SmartSell
3
+ Copyright (c) 2026 SmartSell. All rights reserved.
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
5
+ This source code, the published package artifacts, and all related documentation
6
+ are proprietary software owned by SmartSell.
11
7
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
8
+ Permission to access, install, and use this software is granted only to people
9
+ and organizations that are explicitly authorized by SmartSell under a valid
10
+ written agreement or commercial relationship.
11
+
12
+ Except where SmartSell has given prior written permission, you may not copy,
13
+ modify, merge, publish, distribute, sublicense, sell, lease, reverse engineer,
14
+ decompile, create derivative works from, or otherwise exploit this software or
15
+ any portion of it.
14
16
 
15
17
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
18
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
19
+ FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT. IN NO EVENT
20
+ SHALL SMARTSELL OR ITS LICENSORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM,
22
+ OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF THE SOFTWARE.
package/README.md CHANGED
@@ -1,23 +1,40 @@
1
1
  # smartsell-ui-kit
2
2
 
3
- `smartsell-ui-kit` is the public UI primitives package for SmartSell Sales custom modules.
3
+ `smartsell-ui-kit` is the shared React component package for SmartSell custom modules, tenant extensions, and isolated integrations.
4
4
 
5
- It is designed for tenant developers who should not need to know how the core app is implemented.
6
- The package stays on the public contract surface:
5
+ It provides the public UI contract that external consumers should rely on instead of importing private SmartSell app internals. The package is built around a few core goals:
7
6
 
8
7
  - theme-aware components powered by `smartsell-theme`
9
- - inline-style primitives that do not depend on private app CSS files
10
- - a composable modal helper with predictable slot ids for `header`, `body`, and `footer`
8
+ - self-contained styling with no dependency on private SmartSell CSS files
9
+ - predictable APIs for forms, modals, data tables, and common surfaces
10
+ - async-friendly primitives for remote search and server-driven datasets
11
+
12
+ ## Highlights
13
+
14
+ - React 18-first component API
15
+ - Consistent theme integration through `smartsell-theme`
16
+ - Form primitives such as `Input`, `Textarea`, `Checkbox`, `DatePicker`, `Select`, and `SelectAsync`
17
+ - Display and layout primitives such as `Card`, `CardSmall`, and `Separator`
18
+ - Modal helpers including `Modal`, `ComposableModal`, and `createModalSlotIds`
19
+ - Data components including `Table` and `TableAsync`
20
+ - Brand images published from the dedicated `smartsell-ui-kit/img` subpath
21
+ - Local Storybook workspace for visual QA before release
22
+
23
+ ## Requirements
24
+
25
+ - React 18+
26
+ - React DOM 18+
27
+ - `smartsell-theme`
11
28
 
12
29
  ## Installation
13
30
 
14
31
  ```bash
15
- npm install react smartsell-theme smartsell-ui-kit
32
+ npm install react@^18 react-dom@^18 smartsell-theme smartsell-ui-kit
16
33
  ```
17
34
 
18
- If you want to connect `ComposableModal` to SmartSell slot overrides, install `smartsell-sales-sdk` as well.
35
+ ## Quick start
19
36
 
20
- ## Basic button and card
37
+ Wrap your module with `ThemeProvider` from `smartsell-theme`, then consume the UI kit components normally.
21
38
 
22
39
  ```tsx
23
40
  import { ThemeProvider } from 'smartsell-theme';
@@ -36,33 +53,79 @@ export default function ExamplePage() {
36
53
  }
37
54
  ```
38
55
 
56
+ ## Main exports
57
+
58
+ - `Button`, `Checkbox`, `DatePicker`, `Input`, `Textarea`, `Select`, `SelectAsync`
59
+ - `Card`, `CardSmall`, `Separator`
60
+ - `Modal`, `ComposableModal`, `createModalSlotIds`
61
+ - `Table`, `TableAsync`
62
+ - `useUiKitTheme`
63
+ - `smartsell-ui-kit/img` for branded logo, icon, favicon, and background image components
64
+
65
+ ## Images subpath
66
+
67
+ Import brand images from the dedicated `img` subpath so the main entrypoint stays focused on UI primitives.
68
+
69
+ ```tsx
70
+ import { Icon192, Logo, Texture1 } from 'smartsell-ui-kit/img';
71
+
72
+ export default function BrandHeader() {
73
+ return (
74
+ <div style={{ display: 'grid', gap: 16 }}>
75
+ <Logo style={{ width: 240 }} />
76
+ <Icon192 size={72} alt="SmartSell app icon" />
77
+ <Texture1 decorative style={{ width: '100%', maxWidth: 420 }} />
78
+ </div>
79
+ );
80
+ }
81
+ ```
82
+
83
+ All image components resolve their source from the active `smartsell-theme` context. Right now light and dark modes point to the same files, but the submodule already swaps sources by theme variant so future dark-specific images only require changing the mapped filenames.
84
+
39
85
  ## Composable modal pattern
40
86
 
41
- Use `ComposableModal` when you want the page to keep modal state while tenants customize visual sections independently.
87
+ Use `ComposableModal` when the page should own modal state and business logic, while host applications or extension layers customize the `header`, `body`, and `footer` through stable slot ids.
42
88
 
43
89
  ```tsx
44
- import { SlotRenderer, type ModulePageProps, type SlotComponentProps } from 'smartsell-sales-sdk';
45
- import { ComposableModal, createModalSlotIds } from 'smartsell-ui-kit';
90
+ import { useState } from 'react';
91
+
92
+ import { Button, ComposableModal, createModalSlotIds } from 'smartsell-ui-kit';
46
93
 
47
94
  const slotIds = createModalSlotIds('order-review');
48
95
 
49
- export default function ExamplePage({ sdk }: ModulePageProps) {
96
+ export default function ExamplePage() {
97
+ const [isOpen, setIsOpen] = useState(false);
98
+
99
+ const submitOrder = () => {
100
+ setIsOpen(false);
101
+ };
102
+
50
103
  return (
51
- <ComposableModal
52
- isOpen={isOpen}
53
- onClose={() => setIsOpen(false)}
54
- onConfirm={submitOrder}
55
- title="Order review"
56
- slotBaseId="order-review"
57
- renderSlot={({ id, context, children }) => (
58
- <SlotRenderer id={id} sdk={sdk} context={context}>
59
- {children}
60
- </SlotRenderer>
61
- )}
62
- payload={{ orderNumber: 'SO-1001', total: 421.9 }}
63
- >
64
- <div>Default modal body</div>
65
- </ComposableModal>
104
+ <>
105
+ <Button onClick={() => setIsOpen(true)}>Open order review</Button>
106
+
107
+ <ComposableModal
108
+ isOpen={isOpen}
109
+ onClose={() => setIsOpen(false)}
110
+ onConfirm={submitOrder}
111
+ title="Order review"
112
+ slotBaseId="order-review"
113
+ renderSlot={({ id, context, children }) => {
114
+ if (id === slotIds.footer) {
115
+ return (
116
+ <Button onClick={() => context.confirm?.()}>
117
+ Send order {context.payload?.orderNumber}
118
+ </Button>
119
+ );
120
+ }
121
+
122
+ return children;
123
+ }}
124
+ payload={{ orderNumber: 'SO-1001', total: 421.9 }}
125
+ >
126
+ <div>Default modal body</div>
127
+ </ComposableModal>
128
+ </>
66
129
  );
67
130
  }
68
131
  ```
@@ -73,81 +136,92 @@ Slot ids generated by `createModalSlotIds('order-review')`:
73
136
  - `order-review:modal-body`
74
137
  - `order-review:modal-footer`
75
138
 
76
- Tenant extension example:
139
+ This pattern is useful when:
140
+
141
+ - the page owns data loading, permissions, and submission flow
142
+ - the host app needs stable extension points instead of private imports
143
+ - multiple modal variants should reuse the same contract
144
+
145
+ ## Async components
146
+
147
+ `SelectAsync` is designed for remote option sources while preserving the same interaction model as the regular `Select`.
77
148
 
78
149
  ```tsx
79
- import {
80
- defineExtensionManifest,
81
- type ExtensionManifest,
82
- type SlotComponentProps,
83
- } from 'smartsell-sales-sdk';
84
- import {
85
- Button,
86
- type ModalSlotContext,
87
- createModalSlotIds,
88
- } from 'smartsell-ui-kit';
89
-
90
- type OrderPayload = {
91
- orderNumber: string;
92
- total: number;
93
- };
94
-
95
- function CustomFooter({ sdk, context }: SlotComponentProps<ModalSlotContext<OrderPayload>>) {
150
+ import { useState } from 'react';
151
+
152
+ import { SelectAsync, type SelectAsyncOption } from 'smartsell-ui-kit';
153
+
154
+ type CustomerOption = SelectAsyncOption<string>;
155
+
156
+ function CustomerField() {
157
+ const [value, setValue] = useState<CustomerOption | null>(null);
158
+
96
159
  return (
97
- <Button onClick={() => context?.confirm?.()}>
98
- Send order {context?.payload?.orderNumber}
99
- </Button>
160
+ <SelectAsync
161
+ label="Customer"
162
+ value={value}
163
+ onChange={setValue}
164
+ loadOptions={async (query, loadedOptions, { page, signal }) => {
165
+ const response = await fetch(`/api/customers?search=${query}&page=${page}`, { signal });
166
+ const data = await response.json();
167
+
168
+ return {
169
+ options: data.items.map((item: { id: string; tradeName: string }) => ({
170
+ value: item.id,
171
+ label: item.tradeName,
172
+ })),
173
+ hasMore: data.hasMore,
174
+ };
175
+ }}
176
+ />
100
177
  );
101
178
  }
179
+ ```
102
180
 
103
- const slots = createModalSlotIds('order-review');
104
-
105
- const manifest: ExtensionManifest = defineExtensionManifest({
106
- slots: {
107
- [slots.footer]: {
108
- action: 'replace',
109
- component: CustomFooter,
110
- },
111
- },
112
- });
181
+ `TableAsync` follows the same idea for remote datasets, with debounced search and request cancellation support built into the component flow.
113
182
 
114
- export default manifest;
115
- ```
183
+ ## Development workflow
116
184
 
117
- ## Why this modal pattern exists
185
+ Useful local commands:
118
186
 
119
- - The page owns state, data loading, and permissions.
120
- - The tenant customizes `header`, `body`, and `footer` through stable slot ids.
121
- - Slot overrides receive an explicit `context` object instead of relying on private core imports.
122
- - The same pattern works for many modals without creating a new module type.
187
+ ```bash
188
+ npm run storybook
189
+ npm run test
190
+ npm run validate
191
+ npm run validate:release
192
+ ```
123
193
 
124
- ## Publish
194
+ Run Storybook in Docker when you want containerized local development:
125
195
 
126
196
  ```bash
127
- npm run typecheck
128
- npm run build
129
- npm publish
197
+ docker compose up --build
130
198
  ```
131
199
 
132
- ## Component preview workspace
200
+ ## Storybook workspace
133
201
 
134
- The repository now includes a local Storybook workspace so you can inspect and interact with components before publishing the package.
202
+ The repository includes a local Storybook workspace for component review and design QA.
135
203
 
136
- - grouped sidebar navigation for buttons, surfaces, forms, and modals
137
- - live Controls for component props such as size, variants, labels, states, and modal behaviors
138
- - a mocked `ThemeProvider` so components render with the same theme contract used in host apps
204
+ - grouped navigation for buttons, surfaces, forms, modals, and tables
205
+ - a dedicated `Images` section covering logos, icons, and backgrounds from `smartsell-ui-kit/img`
206
+ - live Controls for props and responsive behavior
207
+ - a local `ThemeProvider` preview using the same `smartsell-theme` contract expected by host apps
208
+ - a `Theme/Colors` playground for temporary Storybook-only token overrides
139
209
 
140
- Run it directly with npm:
210
+ Storybook is development-only. It is not published to npm because the package only ships `dist`, `README.md`, and `LICENSE`.
141
211
 
142
- ```bash
143
- npm install
144
- npm run storybook
145
- ```
212
+ Theme overrides from the `Theme/Colors` story affect only the local Storybook session. Runtime consumers still read theme values from their host application's `smartsell-theme` integration.
213
+
214
+ ## Release checklist
146
215
 
147
- Run it in a container with hot reload:
216
+ Before publishing a new version:
148
217
 
149
218
  ```bash
150
- docker compose up --build
219
+ npm run validate
220
+ npm run build:storybook
221
+ npm pack --dry-run
222
+ npm publish
151
223
  ```
152
224
 
153
- The Storybook workspace is development-only. It is not part of the published package because `package.json` only ships `dist`, `README.md`, and `LICENSE`.
225
+ ## License
226
+
227
+ This package is distributed under the SmartSell proprietary license described in `LICENSE`.