@lgsm/modules 1.6.20-beta.2 → 1.6.20-beta.20
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 +201 -78
- package/dist/main.d.ts +5 -14
- package/dist/main.js +8 -7347
- package/dist/setupBaseURL.d.ts +2 -0
- package/package.json +94 -86
- package/dist/assets/main.css +0 -1
- package/dist/shared-function/jwtDecodeFunc.d.ts +0 -1
- package/dist/shared-function/loginRedirect.d.ts +0 -1
- package/dist/shared-service/apiService.d.ts +0 -8
- package/dist/shared-service/axiosInstance.d.ts +0 -5
- package/dist/shared-ui/Button/index.d.ts +0 -9
- package/dist/shared-ui/Dropdown/index.d.ts +0 -16
- package/dist/shared-ui/Modal/index.d.ts +0 -12
- package/dist/shared-ui/MyCounter/index.d.ts +0 -8
- package/dist/shared-ui/MyTitle/index.d.ts +0 -6
- package/dist/shared-ui/Notification/NotificationContainer.d.ts +0 -1
- package/dist/shared-ui/Notification/index.d.ts +0 -9
- package/dist/shared-ui/Sonner/index.d.ts +0 -1
- package/dist/shared-ui/ThreeDotsLoader/index.d.ts +0 -1
- package/dist/shared-ui/sonnerHelper.d.ts +0 -3
- package/dist/shared-ui/ui/alert.d.ts +0 -8
- package/dist/shared-ui/ui/button.d.ts +0 -11
- package/dist/shared-ui/ui/sonner.d.ts +0 -4
- package/dist/usage-example/example-apiService.d.ts +0 -1
- package/dist/usage-example/example-components.d.ts +0 -1
package/README.md
CHANGED
|
@@ -1,78 +1,201 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
1
|
+
# LGSM shared packages
|
|
2
|
+
|
|
3
|
+
One repository maintains four focused packages and the full-library entry point.
|
|
4
|
+
All packages currently use version 1.6.20-beta.10.
|
|
5
|
+
|
|
6
|
+
| Package | Owns | LGSM dependencies |
|
|
7
|
+
| --- | --- | --- |
|
|
8
|
+
| @lgsm/core | API client, authentication redirects and token decoding | None |
|
|
9
|
+
| @lgsm/ui | Basic controls, dropdowns, dialogs/side drawers, loaders, notifications and error views | None |
|
|
10
|
+
| @lgsm/account | ProfileMenu, SystemSwitcher shell and profile URL helpers | ui |
|
|
11
|
+
| @lgsm/data-table | Tables, editing/filtering/pagination, date/command controls and Excel export | ui |
|
|
12
|
+
| @lgsm/modules | Re-exports all four packages and preserves existing imports | All four |
|
|
13
|
+
|
|
14
|
+
The feature packages never import @lgsm/modules. Account and UI do not depend on
|
|
15
|
+
TanStack Table, Excel/file-export libraries, date pickers or command controls.
|
|
16
|
+
React and React DOM remain peer dependencies. Source code has one home under
|
|
17
|
+
packages/; the umbrella contains exports and the legacy API notification adapter.
|
|
18
|
+
|
|
19
|
+
## Install everything
|
|
20
|
+
|
|
21
|
+
After this release is published:
|
|
22
|
+
|
|
23
|
+
~~~sh
|
|
24
|
+
bun add @lgsm/modules
|
|
25
|
+
~~~
|
|
26
|
+
|
|
27
|
+
Existing imports continue to work:
|
|
28
|
+
|
|
29
|
+
~~~tsx
|
|
30
|
+
import { DataTable, ProfileMenu, SystemSwitcher, Sheet, MainErrorFallback } from '@lgsm/modules'
|
|
31
|
+
~~~
|
|
32
|
+
|
|
33
|
+
The umbrella depends on the feature packages, so one command installs all of them.
|
|
34
|
+
A teammate cloning an app only runs bun install, using its package.json and lockfile.
|
|
35
|
+
|
|
36
|
+
## Install selected features
|
|
37
|
+
|
|
38
|
+
~~~sh
|
|
39
|
+
bun add @lgsm/account
|
|
40
|
+
# Or choose several packages in one command:
|
|
41
|
+
bun add @lgsm/core @lgsm/ui @lgsm/data-table
|
|
42
|
+
~~~
|
|
43
|
+
|
|
44
|
+
~~~tsx
|
|
45
|
+
import { ProfileMenu, SystemSwitcher } from '@lgsm/account'
|
|
46
|
+
import { DataTable, type ColumnConfig } from '@lgsm/data-table'
|
|
47
|
+
import { Sheet, SheetContent, SheetTitle, SheetTrigger, NotFound } from '@lgsm/ui'
|
|
48
|
+
~~~
|
|
49
|
+
|
|
50
|
+
Only required dependencies are installed automatically. Installing account does
|
|
51
|
+
not install core, data-table or the umbrella. The package entry points import their
|
|
52
|
+
compiled, scoped CSS; no source files need to be copied into the app. The shared
|
|
53
|
+
UI package supplies fonts and base styles. Apps intentionally suppressing library
|
|
54
|
+
CSS must register the installed @lgsm packages with Tailwind @source, as LMS does.
|
|
55
|
+
CSS is also exported at each UI package's /styles.css subpath.
|
|
56
|
+
|
|
57
|
+
## Develop this repository
|
|
58
|
+
|
|
59
|
+
~~~sh
|
|
60
|
+
bun install
|
|
61
|
+
bun run build
|
|
62
|
+
bun run test --run
|
|
63
|
+
bun run check:packages
|
|
64
|
+
bun run check:install
|
|
65
|
+
~~~
|
|
66
|
+
|
|
67
|
+
Run bun install once at the repository root. Workspaces link the local packages.
|
|
68
|
+
The build command type-checks and builds core, UI, account, data-table and finally
|
|
69
|
+
the umbrella in dependency order. Existing Storybook stories now live beside their
|
|
70
|
+
components in packages/*/src; start them with bun run storybook.
|
|
71
|
+
|
|
72
|
+
Commit scripts/ alongside the package sources: build and publish checks depend
|
|
73
|
+
on those files. Generated dist/ folders remain Git-ignored.
|
|
74
|
+
|
|
75
|
+
check:packages verifies package boundaries, declared imports, build outputs and
|
|
76
|
+
account-only dependency isolation. check:install packs the actual release files
|
|
77
|
+
and performs clean account-only and full-library installs in temporary directories.
|
|
78
|
+
It asserts that heavy table dependencies are absent from the account-only install.
|
|
79
|
+
It does not publish anything. Open scripts/check-style-isolation.html through the
|
|
80
|
+
local Vite server after building to verify shared CSS isolation in a browser.
|
|
81
|
+
|
|
82
|
+
## Local consumer repositories
|
|
83
|
+
|
|
84
|
+
HRIS, Jakarta and LMS currently keep @lgsm/modules as file:../lampung-fe.
|
|
85
|
+
Their package.json overrides resolve the four unpublished packages from sibling
|
|
86
|
+
folders in packages/. Run bun install in each app after building Lampung. After
|
|
87
|
+
subsequent library-only edits, rebuild Lampung and refresh the app's copied local
|
|
88
|
+
packages with bun install --force. App feature edits do not need a library build.
|
|
89
|
+
|
|
90
|
+
Keep `resolve.dedupe: ['react', 'react-dom']` in each consuming app's Vite config
|
|
91
|
+
so linked library dependencies use the app's React instance. After changing this
|
|
92
|
+
setting, restart the dev server with `bun run dev --force` to refresh Vite's cache.
|
|
93
|
+
|
|
94
|
+
Another local app can use a selective file dependency, for example
|
|
95
|
+
file:../lampung-fe/packages/account, with a local override for its UI dependency.
|
|
96
|
+
Keep overrides in the consuming app, not in published packages.
|
|
97
|
+
When using the published release, replace the file dependency with the package
|
|
98
|
+
version and remove the local LGSM overrides.
|
|
99
|
+
|
|
100
|
+
## Shared account controls
|
|
101
|
+
|
|
102
|
+
~~~tsx
|
|
103
|
+
import { DropdownMenuItem, ProfileMenu, SystemSwitcher } from '@lgsm/modules'
|
|
104
|
+
|
|
105
|
+
<div className="flex items-center gap-4">
|
|
106
|
+
<SystemSwitcher label="Open navigation menus" contentClassName="w-100">
|
|
107
|
+
<div className="grid grid-cols-4 gap-2">
|
|
108
|
+
{menus.map((menu) => (
|
|
109
|
+
<DropdownMenuItem key={menu.path} onSelect={() => navigate(menu.path)}>
|
|
110
|
+
{menu.name}
|
|
111
|
+
</DropdownMenuItem>
|
|
112
|
+
))}
|
|
113
|
+
</div>
|
|
114
|
+
</SystemSwitcher>
|
|
115
|
+
<ProfileMenu
|
|
116
|
+
avatarUrl={user?.userDetails.avtrPath}
|
|
117
|
+
jakartaUrl={import.meta.env.VITE_APP_URL_JAKARTA}
|
|
118
|
+
onChangePassword={changePassword}
|
|
119
|
+
onLogout={logout}
|
|
120
|
+
/>
|
|
121
|
+
</div>
|
|
122
|
+
~~~
|
|
123
|
+
|
|
124
|
+
ProfileMenu owns the bundled fallback avatar and account-menu behavior. My Profile
|
|
125
|
+
opens /profile and My Groups opens /my-groups on the configured Jakarta base URL.
|
|
126
|
+
Jakarta passes window.location.origin. Authentication actions remain app callbacks.
|
|
127
|
+
|
|
128
|
+
SystemSwitcher owns only the shared 32px button, dropdown container, focus and
|
|
129
|
+
open/close behavior. Pass the content as children, use label to name the button,
|
|
130
|
+
and optionally change container sizing through contentClassName. Use
|
|
131
|
+
DropdownMenuItem for selectable children so keyboard navigation and dismissal work.
|
|
132
|
+
Selective consumers import SystemSwitcher from @lgsm/account and declare @lgsm/ui
|
|
133
|
+
when importing DropdownMenuItem directly.
|
|
134
|
+
|
|
135
|
+
Each app owns its API calls, filtering, grid layout and navigation. HRIS's local
|
|
136
|
+
MenuSwitcher uses the existing access-menu context and internal router links in a
|
|
137
|
+
four-column grid. Jakarta supplies its already-loaded application list through a
|
|
138
|
+
local ApplicationSwitcher. LMS's ApplicationSwitcher calls its own SystemService
|
|
139
|
+
and handles loading, retry, inactive systems and HTTP(S)-only external links.
|
|
140
|
+
There are no API calls or application data types in @lgsm/account. The previous
|
|
141
|
+
userId and systems props are replaced by children in this unpublished release.
|
|
142
|
+
|
|
143
|
+
## API initialization
|
|
144
|
+
|
|
145
|
+
The full @lgsm/modules setupBaseURL export keeps existing toast notifications.
|
|
146
|
+
It delegates to the shared core client. Existing five-argument initialization
|
|
147
|
+
calls remain compatible.
|
|
148
|
+
|
|
149
|
+
Selective consumers importing the client directly should declare @lgsm/core as
|
|
150
|
+
an app dependency and provide their notification callback when needed:
|
|
151
|
+
|
|
152
|
+
~~~ts
|
|
153
|
+
import { setupBaseURL } from '@lgsm/core'
|
|
154
|
+
|
|
155
|
+
setupBaseURL(apiUrl, getAccessToken, loginUrl, environment, setAccessToken, showApiError)
|
|
156
|
+
~~~
|
|
157
|
+
|
|
158
|
+
The last callback receives (message, description). Core defaults to console.error
|
|
159
|
+
and has no UI dependency. Apps wanting the shared notifications can pass notifyError
|
|
160
|
+
from @lgsm/ui and render Sonner from that same package. Keep API configuration and
|
|
161
|
+
token state in the host app; feature packages share the configured core client.
|
|
162
|
+
|
|
163
|
+
## Tables, drawers and errors
|
|
164
|
+
|
|
165
|
+
DataTable and ServerTable retain their existing props and permission behavior.
|
|
166
|
+
The app supplies data, columns, validation, save callbacks and access flags.
|
|
167
|
+
Missing permissions keep built-in editing actions read-only. Table-specific
|
|
168
|
+
calendar/command controls and Excel code live only in @lgsm/data-table.
|
|
169
|
+
|
|
170
|
+
Sheet, SheetContent, SheetTrigger, SheetTitle and the other Sheet primitives provide
|
|
171
|
+
the side drawer. MainErrorFallback and NotFound provide the shared error views.
|
|
172
|
+
The host app still owns its router, error-boundary wiring, navigation and permissions.
|
|
173
|
+
All shared roots and portal content retain data-lgsm-ui for style isolation.
|
|
174
|
+
|
|
175
|
+
## Publish
|
|
176
|
+
|
|
177
|
+
Build, test and run both package checks first. Publish to your existing registry
|
|
178
|
+
with the intended package visibility, in this order:
|
|
179
|
+
|
|
180
|
+
1. packages/core and packages/ui
|
|
181
|
+
2. packages/account and packages/data-table
|
|
182
|
+
3. repository root (@lgsm/modules)
|
|
183
|
+
|
|
184
|
+
From this repository root, after npm login:
|
|
185
|
+
|
|
186
|
+
~~~sh
|
|
187
|
+
npm publish -w @lgsm/core --tag beta --access public
|
|
188
|
+
npm publish -w @lgsm/ui --tag beta --access public
|
|
189
|
+
npm publish -w @lgsm/account --tag beta --access public
|
|
190
|
+
npm publish -w @lgsm/data-table --tag beta --access public
|
|
191
|
+
npm publish --tag beta --access public
|
|
192
|
+
~~~
|
|
193
|
+
|
|
194
|
+
The root command publishes only @lgsm/modules, not the workspace packages.
|
|
195
|
+
Published versions cannot be overwritten: use a new beta number for each release.
|
|
196
|
+
|
|
197
|
+
Each folder is independently publishable; only dist, package metadata and README
|
|
198
|
+
are shipped. Runtime package dependencies use registry versions, not local file or
|
|
199
|
+
workspace paths. Use the same release version across the five package manifests
|
|
200
|
+
for now and update internal versions together. No release-management service or
|
|
201
|
+
additional build framework is required.
|
package/dist/main.d.ts
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export {
|
|
6
|
-
export { NotificationContainer } from './shared-ui/Notification/NotificationContainer';
|
|
7
|
-
export { Sonner } from './shared-ui/Sonner';
|
|
8
|
-
export { Modal } from './shared-ui/Modal';
|
|
9
|
-
export { Dropdown } from './shared-ui/Dropdown';
|
|
10
|
-
export { notifyError, notifySuccess, notifyWarning } from './shared-ui/sonnerHelper';
|
|
11
|
-
export { default as apiService } from './shared-service/apiService';
|
|
12
|
-
export { setupBaseURL } from './shared-service/axiosInstance';
|
|
13
|
-
export { loginRedirect } from './shared-function/loginRedirect';
|
|
14
|
-
export { decodeToken } from './shared-function/jwtDecodeFunc';
|
|
1
|
+
export * from '@lgsm/core';
|
|
2
|
+
export * from '@lgsm/ui';
|
|
3
|
+
export * from '@lgsm/account';
|
|
4
|
+
export * from '@lgsm/data-table';
|
|
5
|
+
export { setupBaseURL } from './setupBaseURL';
|