@rfdtech/components 1.0.2 → 1.4.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.
Files changed (34) hide show
  1. package/README.md +23 -6
  2. package/dist/components/app-switcher/AppSwitcher.d.ts +0 -1
  3. package/dist/components/app-switcher/AppSwitcher.d.ts.map +1 -1
  4. package/dist/components/app-switcher/AppSwitcherItem.d.ts.map +1 -1
  5. package/dist/components/app-switcher/hooks/useAppSwitcher.d.ts.map +1 -1
  6. package/dist/components/bulk-import-modal/BulkImportModal.d.ts +1 -2
  7. package/dist/components/bulk-import-modal/BulkImportModal.d.ts.map +1 -1
  8. package/dist/components/bulk-import-modal/{components → internal}/FieldMappingSelect.d.ts +5 -5
  9. package/dist/components/bulk-import-modal/internal/FieldMappingSelect.d.ts.map +1 -0
  10. package/dist/components/bulk-import-modal/steps/MatchColumnsStep.d.ts.map +1 -1
  11. package/dist/components/bulk-import-modal/steps/SelectHeaderRowStep.d.ts.map +1 -1
  12. package/dist/components/theme/ThemeContext.d.ts +3 -0
  13. package/dist/components/theme/ThemeContext.d.ts.map +1 -0
  14. package/dist/components/theme/ThemeProvider.d.ts +3 -0
  15. package/dist/components/theme/ThemeProvider.d.ts.map +1 -0
  16. package/dist/components/theme/ThemeProvider.test.d.ts +2 -0
  17. package/dist/components/theme/ThemeProvider.test.d.ts.map +1 -0
  18. package/dist/components/theme/index.d.ts +4 -0
  19. package/dist/components/theme/index.d.ts.map +1 -0
  20. package/dist/components/theme/resolveTheme.d.ts +3 -0
  21. package/dist/components/theme/resolveTheme.d.ts.map +1 -0
  22. package/dist/components/theme/useTheme.d.ts +3 -0
  23. package/dist/components/theme/useTheme.d.ts.map +1 -0
  24. package/dist/index.cjs +28 -28
  25. package/dist/index.css +1 -1
  26. package/dist/index.d.ts +2 -0
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +4747 -4822
  29. package/dist/types/theme.d.ts +18 -0
  30. package/dist/types/theme.d.ts.map +1 -0
  31. package/package.json +23 -4
  32. package/dist/components/bulk-import-modal/components/FieldMappingSelect.d.ts.map +0 -1
  33. package/dist/components/bulk-import-modal/components/FieldMappingSelect.test.d.ts +0 -2
  34. package/dist/components/bulk-import-modal/components/FieldMappingSelect.test.d.ts.map +0 -1
package/README.md CHANGED
@@ -4,6 +4,10 @@ Shared React component library for Ghana School of Law (GSL) projects.
4
4
 
5
5
  Requires React 18+ and a bundler that processes CSS (Vite, Webpack, etc.).
6
6
 
7
+ ## Changelog
8
+
9
+ See [CHANGELOG.md](./CHANGELOG.md) for release history.
10
+
7
11
  ## Styles
8
12
 
9
13
  Component styles load automatically when you import from `@rfdtech/components` (the JS bundle includes `import './index.css'`). For reliable styling in production, add this once in your app entry (`main.tsx` or `App.tsx`):
@@ -16,10 +20,21 @@ After upgrading the package, clear Vite's dependency cache if styles look stale:
16
20
 
17
21
  ## Shared theming
18
22
 
19
- All components share design tokens defined in [`src/styles/theme.css`](src/styles/theme.css). Tokens are applied on `:root` when a component is imported.
23
+ Wrap your app in `ThemeProvider` for light, dark, and system themes. Design tokens live in [`src/styles/theme.css`](src/styles/theme.css) and apply to `.gsl-theme`, `document.documentElement`, and all components (including portaled modals and popovers).
24
+
25
+ ```tsx
26
+ import { ThemeProvider } from "@rfdtech/components";
27
+ import "@rfdtech/components/style.css";
20
28
 
21
- | Token | Default | Use |
22
- |-------|---------|-----|
29
+ <ThemeProvider defaultTheme="system">
30
+ <App />
31
+ </ThemeProvider>
32
+ ```
33
+
34
+ Use `useTheme()` to read or change the active theme at runtime. See the [Theme](/docs/theme) docs page for token reference and controlled mode.
35
+
36
+ | Token | Light default | Use |
37
+ |-------|---------------|-----|
23
38
  | `--gsl-primary` | `#dc2626` | Buttons, focus rings, accents |
24
39
  | `--gsl-primary-light` | `#fef2f2` | Selected rows, hover fills |
25
40
  | `--gsl-bg` | `#ffffff` | Surfaces |
@@ -31,7 +46,7 @@ All components share design tokens defined in [`src/styles/theme.css`](src/style
31
46
  | `--gsl-success` | `#16a34a` | Success states |
32
47
  | `--gsl-warning` | `#eab308` | Warnings |
33
48
 
34
- Override on a component root or any ancestor:
49
+ You can still override tokens on any ancestor without `ThemeProvider`:
35
50
 
36
51
  ```css
37
52
  .my-app {
@@ -45,9 +60,11 @@ Override on a component root or any ancestor:
45
60
  ## Install
46
61
 
47
62
  ```bash
48
- npm install @rfdtech/components react react-dom
63
+ npm install @rfdtech/components
49
64
  ```
50
65
 
66
+ Requires React 18+. npm 7+ auto-installs `react` and `react-dom` as peer dependencies. Radix UI and other runtime packages are included as dependencies of `@rfdtech/components`.
67
+
51
68
  ## AppSwitcher
52
69
 
53
70
  Google Apps–style 9-dot launcher for switching between GSL systems. Drop it into your header to let users jump between products.
@@ -389,7 +406,7 @@ To change the gutter size, override `--gsl-bulk-import-gutter` on `.gsl-bulk-imp
389
406
 
390
407
  ```bash
391
408
  npm install
392
- npm run demo # Start demo at http://localhost:5173
409
+ npm run demo # Start demo at http://localhost:5173 — interactive examples at / and MDX docs at /docs
393
410
  npm run test # Run unit and component tests
394
411
  npm run test:watch # Run tests in watch mode
395
412
  npm run build # Build library to dist/
@@ -1,5 +1,4 @@
1
1
  import type { AppSwitcherProps } from "../../types/app-switcher";
2
- import "../../styles/theme.css";
3
2
  import "./styles/app-switcher.css";
4
3
  export declare function AppSwitcher({ apps: appsProp, baseUrl, accessToken, open: controlledOpen, onOpenChange, onAppSelect, columns, triggerLabel, trigger, title, footer, className, style, placement, closeOnSelect, }: AppSwitcherProps): import("react").JSX.Element;
5
4
  //# sourceMappingURL=AppSwitcher.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppSwitcher.d.ts","sourceRoot":"","sources":["../../../src/components/app-switcher/AppSwitcher.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAW,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG1E,OAAO,wBAAwB,CAAC;AAChC,OAAO,2BAA2B,CAAC;AAEnC,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EAAE,QAAQ,EACd,OAAO,EACP,WAAW,EACX,IAAI,EAAE,cAAc,EACpB,YAAY,EACZ,WAAW,EACX,OAAW,EACX,YAAkC,EAClC,OAAO,EACP,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,SAAwB,EACxB,aAAoB,GACrB,EAAE,gBAAgB,+BA6GlB"}
1
+ {"version":3,"file":"AppSwitcher.d.ts","sourceRoot":"","sources":["../../../src/components/app-switcher/AppSwitcher.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAW,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG1E,OAAO,2BAA2B,CAAC;AAcnC,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EAAE,QAAQ,EACd,OAAO,EACP,WAAW,EACX,IAAI,EAAE,cAAc,EACpB,YAAY,EACZ,WAAW,EACX,OAAW,EACX,YAAkC,EAClC,OAAO,EACP,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,SAAwB,EACxB,aAAoB,GACrB,EAAE,gBAAgB,+BAwGlB"}
@@ -1 +1 @@
1
- {"version":3,"file":"AppSwitcherItem.d.ts","sourceRoot":"","sources":["../../../src/components/app-switcher/AppSwitcherItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAExD,UAAU,oBAAoB;IAC5B,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;CAClC;AAYD,wBAAgB,eAAe,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,oBAAoB,+BA8DtE"}
1
+ {"version":3,"file":"AppSwitcherItem.d.ts","sourceRoot":"","sources":["../../../src/components/app-switcher/AppSwitcherItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAExD,UAAU,oBAAoB;IAC5B,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;CAClC;AAYD,wBAAgB,eAAe,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,oBAAoB,+BA0DtE"}
@@ -1 +1 @@
1
- {"version":3,"file":"useAppSwitcher.d.ts","sourceRoot":"","sources":["../../../../src/components/app-switcher/hooks/useAppSwitcher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,6BAA6B,CAAC;AAErC,wBAAgB,cAAc,CAC5B,OAAO,GAAE,qBAA0B,GAClC,oBAAoB,CA8DtB"}
1
+ {"version":3,"file":"useAppSwitcher.d.ts","sourceRoot":"","sources":["../../../../src/components/app-switcher/hooks/useAppSwitcher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,6BAA6B,CAAC;AAErC,wBAAgB,cAAc,CAC5B,OAAO,GAAE,qBAA0B,GAClC,oBAAoB,CA+BtB"}
@@ -1,5 +1,4 @@
1
1
  import type { BulkImportModalProps } from "../../types/bulk-import-modal";
2
- import "../../styles/theme.css";
3
2
  import "./styles/bulk-import-modal.css";
4
- export declare function BulkImportModal({ open, onOpenChange, fields, onComplete, title, maxFileSizeBytes, allowImportWithWarnings, className, }: BulkImportModalProps): import("react").ReactPortal | null;
3
+ export declare function BulkImportModal({ open, onOpenChange, fields, onComplete, title, maxFileSizeBytes, allowImportWithWarnings, className, }: BulkImportModalProps): import("react").JSX.Element;
5
4
  //# sourceMappingURL=BulkImportModal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BulkImportModal.d.ts","sourceRoot":"","sources":["../../../src/components/bulk-import-modal/BulkImportModal.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAO1E,OAAO,wBAAwB,CAAC;AAChC,OAAO,gCAAgC,CAAC;AAyCxC,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,UAAU,EACV,KAAqB,EACrB,gBAAwC,EACxC,uBAA+B,EAC/B,SAAS,GACV,EAAE,oBAAoB,sCA8WtB"}
1
+ {"version":3,"file":"BulkImportModal.d.ts","sourceRoot":"","sources":["../../../src/components/bulk-import-modal/BulkImportModal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAO1E,OAAO,gCAAgC,CAAC;AAgCxC,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,UAAU,EACV,KAAqB,EACrB,gBAAwC,EACxC,uBAA+B,EAC/B,SAAS,GACV,EAAE,oBAAoB,+BA6RtB"}
@@ -1,15 +1,15 @@
1
+ import "./field-mapping-select.css";
1
2
  export interface FieldMappingSelectOption {
2
3
  value: string;
3
4
  label: string;
4
5
  }
5
6
  export interface FieldMappingSelectProps {
6
7
  ariaLabel: string;
7
- placeholder?: string;
8
8
  value: string | null;
9
- options: FieldMappingSelectOption[];
10
- open: boolean;
11
- onOpenChange: (open: boolean) => void;
12
9
  onChange: (value: string | null) => void;
10
+ options: FieldMappingSelectOption[];
11
+ placeholder?: string;
12
+ clearable?: boolean;
13
13
  }
14
- export declare function FieldMappingSelect({ ariaLabel, placeholder, value, options, open, onOpenChange, onChange, }: FieldMappingSelectProps): import("react").JSX.Element;
14
+ export declare function FieldMappingSelect({ ariaLabel, value, onChange, options, placeholder, clearable, }: FieldMappingSelectProps): import("react").JSX.Element;
15
15
  //# sourceMappingURL=FieldMappingSelect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldMappingSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/bulk-import-modal/internal/FieldMappingSelect.tsx"],"names":[],"mappings":"AACA,OAAO,4BAA4B,CAAC;AAIpC,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACzC,OAAO,EAAE,wBAAwB,EAAE,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,SAAS,EACT,KAAK,EACL,QAAQ,EACR,OAAO,EACP,WAAyB,EACzB,SAAiB,GAClB,EAAE,uBAAuB,+BA2DzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"MatchColumnsStep.d.ts","sourceRoot":"","sources":["../../../../src/components/bulk-import-modal/steps/MatchColumnsStep.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,mBAAmB,EACpB,MAAM,kCAAkC,CAAC;AAG1C,UAAU,qBAAqB;IAC7B,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,gBAAgB,EAAE,YAAY,EAAE,CAAC;IACjC,WAAW,EAAE,MAAM,EAAE,EAAE,CAAC;IACxB,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,qBAAqB,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC9E,sBAAsB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CACvD;AAwCD,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,gBAAgB,EAChB,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,sBAAsB,GACvB,EAAE,qBAAqB,+BA4FvB"}
1
+ {"version":3,"file":"MatchColumnsStep.d.ts","sourceRoot":"","sources":["../../../../src/components/bulk-import-modal/steps/MatchColumnsStep.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,mBAAmB,EACpB,MAAM,kCAAkC,CAAC;AAG1C,UAAU,qBAAqB;IAC7B,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,gBAAgB,EAAE,YAAY,EAAE,CAAC;IACjC,WAAW,EAAE,MAAM,EAAE,EAAE,CAAC;IACxB,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,qBAAqB,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC9E,sBAAsB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CACvD;AAwCD,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,gBAAgB,EAChB,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,sBAAsB,GACvB,EAAE,qBAAqB,+BAwFvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"SelectHeaderRowStep.d.ts","sourceRoot":"","sources":["../../../../src/components/bulk-import-modal/steps/SelectHeaderRowStep.tsx"],"names":[],"mappings":"AAAA,UAAU,wBAAwB;IAChC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;IACjB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,cAAc,EACd,iBAAiB,GAClB,EAAE,wBAAwB,+BAkD1B"}
1
+ {"version":3,"file":"SelectHeaderRowStep.d.ts","sourceRoot":"","sources":["../../../../src/components/bulk-import-modal/steps/SelectHeaderRowStep.tsx"],"names":[],"mappings":"AAEA,UAAU,wBAAwB;IAChC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;IACjB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,cAAc,EACd,iBAAiB,GAClB,EAAE,wBAAwB,+BAyD1B"}
@@ -0,0 +1,3 @@
1
+ import type { ThemeContextValue } from "../../types/theme";
2
+ export declare const ThemeContext: import("react").Context<ThemeContextValue | null>;
3
+ //# sourceMappingURL=ThemeContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeContext.d.ts","sourceRoot":"","sources":["../../../src/components/theme/ThemeContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,eAAO,MAAM,YAAY,mDAAgD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ThemeProviderProps } from "../../types/theme";
2
+ export declare function ThemeProvider({ theme: controlledTheme, defaultTheme, onThemeChange, className, style, children, }: ThemeProviderProps): import("react").JSX.Element;
3
+ //# sourceMappingURL=ThemeProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../src/components/theme/ThemeProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAY,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAItE,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EAAE,eAAe,EACtB,YAAuB,EACvB,aAAa,EACb,SAAS,EACT,KAAK,EACL,QAAQ,GACT,EAAE,kBAAkB,+BAwEpB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ThemeProvider.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeProvider.test.d.ts","sourceRoot":"","sources":["../../../src/components/theme/ThemeProvider.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export { ThemeProvider } from "./ThemeProvider";
2
+ export { useTheme } from "./useTheme";
3
+ export type { GslTheme, ResolvedGslTheme, ThemeProviderProps, UseThemeReturn, } from "../../types/theme";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EACV,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare function getSystemTheme(): "light" | "dark";
2
+ export declare function resolveTheme(theme: "light" | "dark" | "system"): "light" | "dark";
3
+ //# sourceMappingURL=resolveTheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveTheme.d.ts","sourceRoot":"","sources":["../../../src/components/theme/resolveTheme.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,IAAI,OAAO,GAAG,MAAM,CAQjD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAMjF"}
@@ -0,0 +1,3 @@
1
+ import type { UseThemeReturn } from "../../types/theme";
2
+ export declare function useTheme(): UseThemeReturn;
3
+ //# sourceMappingURL=useTheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../../src/components/theme/useTheme.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGxD,wBAAgB,QAAQ,IAAI,cAAc,CAQzC"}