@tumaet/prompt-ui-components 1.0.8 → 1.0.11
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 +21 -0
- package/README.md +106 -0
- package/dist/components/ScoreLevelSelector.js +23 -0
- package/dist/components/ScoreLevelSelector.js.map +1 -0
- package/dist/components/getLevelConfig.js +55 -0
- package/dist/components/getLevelConfig.js.map +1 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/table/PromptTable/tableBarComponents/TableSearch.js +1 -1
- package/dist/components/table/PromptTable/tableBarComponents/TableSearch.js.map +1 -1
- package/dist/types/components/ScoreLevelSelector.d.ts +14 -0
- package/dist/types/components/getLevelConfig.d.ts +8 -0
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/ui/chart.d.ts +6 -6
- package/package.json +23 -22
- package/readme.md +0 -36
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 TUM Applied Education Technologies
|
|
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:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# prompt-ui-components
|
|
2
|
+
|
|
3
|
+
A shared UI component library for the **AET Prompt** system, built on [shadcn/ui](https://ui.shadcn.dev/).
|
|
4
|
+
|
|
5
|
+
Components are designed for **Module Federation** singleton usage, which ensures:
|
|
6
|
+
- A **consistent UI experience** across microfrontends
|
|
7
|
+
- **Reduced bundle size** by avoiding duplicate component loading
|
|
8
|
+
- **Unified UI state** such as shared toast handling across apps
|
|
9
|
+
|
|
10
|
+
For shared state primitives and shared TypeScript interfaces, use [`@tumaet/prompt-shared-state`](https://github.com/prompt-edu/prompt-shared-state).
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Package
|
|
15
|
+
|
|
16
|
+
`@tumaet/prompt-ui-components` provides:
|
|
17
|
+
- **36+ shadcn/ui base components** (buttons, dialogs, forms, tables, etc.)
|
|
18
|
+
- **PromptTable** — advanced data table with sorting, filtering, pagination, row selection, and URL-synced state
|
|
19
|
+
- **MinimalTiptapEditor** — rich text editor with toolbar, code highlighting, image support, and link management
|
|
20
|
+
- **Custom components** — date pickers, multi-select, management page headers, score level selectors, and more
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Prerequisites
|
|
25
|
+
|
|
26
|
+
This project uses **Yarn 4** as specified in the `packageManager` field of each `package.json`. To work with this repository, enable Corepack, which will automatically use the correct Yarn version.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
corepack enable
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Corepack is included by default with Node.js 16.9+ and 14.19+. If you see an error like:
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
error This project's package.json defines "packageManager": "yarn@4.13.0". However the current global version of Yarn is 1.22.22.
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Run `corepack enable` to fix it.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Development
|
|
43
|
+
|
|
44
|
+
### Building Locally
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
yarn install
|
|
48
|
+
yarn build
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Linting
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# From within the package directory
|
|
55
|
+
yarn lint
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Testing Before Release
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
yarn build
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Publishing Packages
|
|
67
|
+
|
|
68
|
+
The package is published to npm when you create a GitHub release.
|
|
69
|
+
|
|
70
|
+
### 1. Update Package Version
|
|
71
|
+
|
|
72
|
+
Ensure `package.json` has the version number matching your intended release tag.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
yarn version patch # 1.2.3 -> 1.2.4
|
|
76
|
+
# or: yarn version minor (1.2.3 -> 1.3.0)
|
|
77
|
+
# or: yarn version major (1.2.3 -> 2.0.0)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Or edit the `package.json` file manually.
|
|
81
|
+
|
|
82
|
+
### 2. Create a GitHub Release
|
|
83
|
+
|
|
84
|
+
1. Go to the [Releases page](../../releases)
|
|
85
|
+
2. Click **"Create a new release"**
|
|
86
|
+
3. Create a new tag with the format `v{version}` (for example, `v1.2.3`)
|
|
87
|
+
4. Set the release title and add release notes
|
|
88
|
+
5. Click **"Publish release"**
|
|
89
|
+
|
|
90
|
+
### 3. Automated Publishing
|
|
91
|
+
|
|
92
|
+
Once you publish the release, the GitHub Actions workflow:
|
|
93
|
+
|
|
94
|
+
1. **Validates** that `package.json` matches the release tag
|
|
95
|
+
2. **Builds** the package
|
|
96
|
+
3. **Publishes** `@tumaet/prompt-ui-components` to npm
|
|
97
|
+
|
|
98
|
+
If there is a version mismatch, the workflow fails with a clear error.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Package Information
|
|
103
|
+
|
|
104
|
+
| Package | Latest Version | Description |
|
|
105
|
+
|---|---|---|
|
|
106
|
+
| [@tumaet/prompt-ui-components](https://www.npmjs.com/package/@tumaet/prompt-ui-components) |  | Reusable React UI components |
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { LockIcon } from 'lucide-react';
|
|
3
|
+
import { ScoreLevel } from '@tumaet/prompt-shared-state';
|
|
4
|
+
import { cn } from '../lib/utils';
|
|
5
|
+
import { getLevelConfig } from './getLevelConfig';
|
|
6
|
+
const scoreLevels = Object.values(ScoreLevel);
|
|
7
|
+
export const ScoreLevelSelector = ({ selectedScore, onScoreChange, completed, descriptionsByLevel, labelsByLevel, showIndicators = true, indicators, hideUnselectedOnDesktop = true, className, }) => {
|
|
8
|
+
const hasIndicators = showIndicators && scoreLevels.some((level) => (indicators?.[level] ?? []).length > 0);
|
|
9
|
+
return (_jsx("div", { className: className, children: scoreLevels.map((level) => {
|
|
10
|
+
const config = getLevelConfig(level);
|
|
11
|
+
const isSelected = selectedScore === level;
|
|
12
|
+
const descriptionID = `score-level-${level}-description`;
|
|
13
|
+
const label = labelsByLevel?.[level] ?? config.title;
|
|
14
|
+
const levelIndicators = showIndicators ? indicators?.[level] ?? [] : [];
|
|
15
|
+
return (_jsxs("div", { className: cn('relative', hideUnselectedOnDesktop &&
|
|
16
|
+
selectedScore !== undefined &&
|
|
17
|
+
!isSelected &&
|
|
18
|
+
'lg:hidden'), children: [levelIndicators.length > 0 && (_jsx("div", { className: 'absolute -top-6 left-0 z-10 w-full', children: _jsx("div", { className: 'flex items-center justify-center gap-2 text-left', children: levelIndicators.map((indicator, index) => (_jsx("span", { className: 'flex items-center', children: indicator }, `${level}-indicator-${index}`))) }) })), _jsxs("button", { type: 'button', onClick: () => onScoreChange(level), disabled: completed, "aria-pressed": isSelected, "aria-disabled": completed, "aria-label": `Select ${label} score level`, "aria-describedby": descriptionID, className: cn('flex h-full w-full flex-col justify-start rounded-lg border-2 p-3 text-left text-sm transition-all', !isSelected && 'hover:bg-gray-100 dark:hover:bg-gray-800', isSelected
|
|
19
|
+
? cn(config.textColor, config.selectedBg)
|
|
20
|
+
: 'bg-gray-50 dark:bg-gray-900', !completed && 'focus:ring-2 focus:ring-gray-400 focus:ring-offset-2', completed && 'cursor-not-allowed opacity-80', hasIndicators && 'mt-2', !selectedScore && config.border), children: [_jsxs("div", { className: 'mb-1 flex justify-between', children: [_jsx("span", { className: 'font-semibold', children: label }), completed && isSelected && (_jsx("span", { className: 'flex items-center gap-1', children: _jsx(LockIcon, { className: cn('h-4 w-4 text-muted-foreground', isSelected && 'dark:text-gray-200') }) }))] }), _jsx("p", { id: descriptionID, className: cn('line-clamp-3 text-muted-foreground', isSelected && 'dark:text-gray-200'), children: descriptionsByLevel[level] })] })] }, level));
|
|
21
|
+
}) }));
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=ScoreLevelSelector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScoreLevelSelector.js","sourceRoot":"","sources":["../../src/components/ScoreLevelSelector.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ScoreLevel } from '@tumaet/prompt-shared-state';
|
|
2
|
+
const assertUnreachable = (value) => {
|
|
3
|
+
throw new Error(`Unhandled ScoreLevel: ${String(value)}`);
|
|
4
|
+
};
|
|
5
|
+
export const getLevelConfig = (level, unknown) => {
|
|
6
|
+
const unknownConfig = {
|
|
7
|
+
title: 'Unknown',
|
|
8
|
+
textColor: 'text-gray-700 dark:text-gray-100',
|
|
9
|
+
selectedBg: 'bg-gray-100 dark:bg-gray-600',
|
|
10
|
+
border: 'border-gray-200 dark:border-gray-200',
|
|
11
|
+
};
|
|
12
|
+
if (unknown) {
|
|
13
|
+
return unknownConfig;
|
|
14
|
+
}
|
|
15
|
+
switch (level) {
|
|
16
|
+
case ScoreLevel.VeryBad:
|
|
17
|
+
return {
|
|
18
|
+
title: 'Strongly Disagree',
|
|
19
|
+
textColor: 'text-red-700 dark:text-red-100',
|
|
20
|
+
selectedBg: 'bg-red-200 dark:bg-red-600',
|
|
21
|
+
border: 'border-red-200 dark:border-red-200',
|
|
22
|
+
};
|
|
23
|
+
case ScoreLevel.Bad:
|
|
24
|
+
return {
|
|
25
|
+
title: 'Disagree',
|
|
26
|
+
textColor: 'text-orange-700 dark:text-orange-100',
|
|
27
|
+
selectedBg: 'bg-orange-200 dark:bg-orange-600',
|
|
28
|
+
border: 'border-orange-200 dark:border-orange-200',
|
|
29
|
+
};
|
|
30
|
+
case ScoreLevel.Ok:
|
|
31
|
+
return {
|
|
32
|
+
title: 'Neutral',
|
|
33
|
+
textColor: 'text-yellow-700 dark:text-yellow-100',
|
|
34
|
+
selectedBg: 'bg-yellow-200 dark:bg-yellow-600',
|
|
35
|
+
border: 'border-yellow-200 dark:border-yellow-200',
|
|
36
|
+
};
|
|
37
|
+
case ScoreLevel.Good:
|
|
38
|
+
return {
|
|
39
|
+
title: 'Agree',
|
|
40
|
+
textColor: 'text-green-700 dark:text-green-100',
|
|
41
|
+
selectedBg: 'bg-green-200 dark:bg-green-600',
|
|
42
|
+
border: 'border-green-200 dark:border-green-200',
|
|
43
|
+
};
|
|
44
|
+
case ScoreLevel.VeryGood:
|
|
45
|
+
return {
|
|
46
|
+
title: 'Strongly Agree',
|
|
47
|
+
textColor: 'text-blue-700 dark:text-blue-100',
|
|
48
|
+
selectedBg: 'bg-blue-200 dark:bg-blue-600',
|
|
49
|
+
border: 'border-blue-200 dark:border-blue-200',
|
|
50
|
+
};
|
|
51
|
+
default:
|
|
52
|
+
return assertUnreachable(level);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=getLevelConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLevelConfig.js","sourceRoot":"","sources":["../../src/components/getLevelConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AASxD,MAAM,iBAAiB,GAAG,CAAC,KAAY,EAAS,EAAE;IAChD,MAAM,IAAI,KAAK,CAAC,yBAAyB,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;AAC3D,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAiB,EAAE,OAAiB,EAAoB,EAAE;IACvF,MAAM,aAAa,GAAqB;QACtC,KAAK,EAAE,SAAS;QAChB,SAAS,EAAE,kCAAkC;QAC7C,UAAU,EAAE,8BAA8B;QAC1C,MAAM,EAAE,sCAAsC;KAC/C,CAAA;IAED,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,aAAa,CAAA;IACtB,CAAC;IAED,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,UAAU,CAAC,OAAO;YACrB,OAAO;gBACL,KAAK,EAAE,mBAAmB;gBAC1B,SAAS,EAAE,gCAAgC;gBAC3C,UAAU,EAAE,4BAA4B;gBACxC,MAAM,EAAE,oCAAoC;aAC7C,CAAA;QACH,KAAK,UAAU,CAAC,GAAG;YACjB,OAAO;gBACL,KAAK,EAAE,UAAU;gBACjB,SAAS,EAAE,sCAAsC;gBACjD,UAAU,EAAE,kCAAkC;gBAC9C,MAAM,EAAE,0CAA0C;aACnD,CAAA;QACH,KAAK,UAAU,CAAC,EAAE;YAChB,OAAO;gBACL,KAAK,EAAE,SAAS;gBAChB,SAAS,EAAE,sCAAsC;gBACjD,UAAU,EAAE,kCAAkC;gBAC9C,MAAM,EAAE,0CAA0C;aACnD,CAAA;QACH,KAAK,UAAU,CAAC,IAAI;YAClB,OAAO;gBACL,KAAK,EAAE,OAAO;gBACd,SAAS,EAAE,oCAAoC;gBAC/C,UAAU,EAAE,gCAAgC;gBAC5C,MAAM,EAAE,wCAAwC;aACjD,CAAA;QACH,KAAK,UAAU,CAAC,QAAQ;YACtB,OAAO;gBACL,KAAK,EAAE,gBAAgB;gBACvB,SAAS,EAAE,kCAAkC;gBAC7C,UAAU,EAAE,8BAA8B;gBAC1C,MAAM,EAAE,sCAAsC;aAC/C,CAAA;QACH;YACE,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAA;IACnC,CAAC;AACH,CAAC,CAAA"}
|
package/dist/components/index.js
CHANGED
|
@@ -10,5 +10,7 @@ export * from './LoadingPage';
|
|
|
10
10
|
export * from './ManagementPageHeader';
|
|
11
11
|
export * from './MultiSelect';
|
|
12
12
|
export * from './SaveChangesAlert';
|
|
13
|
+
export * from './ScoreLevelSelector';
|
|
13
14
|
export * from './UnauthorizedPage';
|
|
15
|
+
export * from './getLevelConfig';
|
|
14
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAA;AACpB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,wBAAwB,CAAA;AACtC,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAA;AACpB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,wBAAwB,CAAA;AACtC,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA"}
|
|
@@ -22,7 +22,7 @@ export function TableSearch({ value, onChange, table, filters }) {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
const showFilter = filters && filters.length > 0 && table;
|
|
25
|
-
return (_jsx("div", { className: 'relative flex-1 min-w-0 h-full', children: _jsxs("div", { className: 'flex rounded-md border border-input focus-within:ring-1 focus-within:ring-ring overflow-hidden h-
|
|
25
|
+
return (_jsx("div", { className: 'relative flex-1 min-w-0 h-full', children: _jsxs("div", { className: 'flex rounded-md border border-input focus-within:ring-1 focus-within:ring-ring overflow-hidden h-10', children: [_jsxs("div", { className: 'relative flex-1 min-w-0', children: [_jsx(Input, { placeholder: 'Search ... (press Enter)', value: inputValue, onChange: (e) => setInputValue(e.target.value), onKeyDown: handleKeyDown, className: 'h-full pl-3 sm:pl-9 w-full border-0 shadow-none focus-visible:ring-0 rounded-none' }), _jsx(SearchIcon, { className: 'absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground hidden sm:block' })] }), showFilter && (_jsx(TableFiltersMenu, { table: table, filters: filters, trigger: _jsxs("button", { type: 'button', "aria-label": 'Filter', className: 'flex items-center gap-1.5 shrink-0 border-l ' +
|
|
26
26
|
'border-input px-3 text-sm text-muted-foreground hover:text-foreground hover:bg-muted transition-colors outline-none', children: [_jsx(Filter, { className: 'h-4 w-4' }), _jsx("span", { className: 'hidden sm:inline', children: "Filter" })] }) }))] }) }));
|
|
27
27
|
}
|
|
28
28
|
//# sourceMappingURL=TableSearch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableSearch.js","sourceRoot":"","sources":["../../../../../src/components/table/PromptTable/tableBarComponents/TableSearch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAA+B,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAGhF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAS9D,MAAM,UAAU,WAAW,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAoB;IAC/E,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IACnD,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAElC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;YACzB,YAAY,CAAC,OAAO,GAAG,KAAK,CAAA;YAC5B,OAAM;QACR,CAAC;QACD,aAAa,CAAC,KAAK,CAAC,CAAA;IACtB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IAEX,MAAM,aAAa,GAAG,CAAC,CAAkC,EAAE,EAAE;QAC3D,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;YACpD,CAAC,CAAC,cAAc,EAAE,CAAA;YAClB,QAAQ,CAAC,UAAU,CAAC,CAAA;YACpB,YAAY,CAAC,OAAO,GAAG,IAAI,CAAA;YAC3B,aAAa,CAAC,EAAE,CAAC,CAAA;QACnB,CAAC;IACH,CAAC,CAAA;IAED,MAAM,UAAU,GAAG,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAA;IAEzD,OAAO,CACL,cAAK,SAAS,EAAC,gCAAgC,YAC7C,eAAK,SAAS,EAAC,
|
|
1
|
+
{"version":3,"file":"TableSearch.js","sourceRoot":"","sources":["../../../../../src/components/table/PromptTable/tableBarComponents/TableSearch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAA+B,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAGhF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAS9D,MAAM,UAAU,WAAW,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAoB;IAC/E,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IACnD,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAElC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;YACzB,YAAY,CAAC,OAAO,GAAG,KAAK,CAAA;YAC5B,OAAM;QACR,CAAC;QACD,aAAa,CAAC,KAAK,CAAC,CAAA;IACtB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IAEX,MAAM,aAAa,GAAG,CAAC,CAAkC,EAAE,EAAE;QAC3D,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;YACpD,CAAC,CAAC,cAAc,EAAE,CAAA;YAClB,QAAQ,CAAC,UAAU,CAAC,CAAA;YACpB,YAAY,CAAC,OAAO,GAAG,IAAI,CAAA;YAC3B,aAAa,CAAC,EAAE,CAAC,CAAA;QACnB,CAAC;IACH,CAAC,CAAA;IAED,MAAM,UAAU,GAAG,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAA;IAEzD,OAAO,CACL,cAAK,SAAS,EAAC,gCAAgC,YAC7C,eAAK,SAAS,EAAC,qGAAqG,aAClH,eAAK,SAAS,EAAC,yBAAyB,aACtC,KAAC,KAAK,IACJ,WAAW,EAAC,0BAA0B,EACtC,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAC9C,SAAS,EAAE,aAAa,EACxB,SAAS,EAAC,mFAAmF,GAC7F,EACF,KAAC,UAAU,IAAC,SAAS,EAAC,wFAAwF,GAAG,IAC7G,EAEL,UAAU,IAAI,CACb,KAAC,gBAAgB,IACf,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,OAAO,EACL,kBACE,IAAI,EAAC,QAAQ,gBACF,QAAQ,EACnB,SAAS,EACP,8CAA8C;4BAC9C,qHAAqH,aAGvH,KAAC,MAAM,IAAC,SAAS,EAAC,SAAS,GAAG,EAC9B,eAAM,SAAS,EAAC,kBAAkB,uBAAc,IACzC,GAEX,CACH,IACG,GACF,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { ScoreLevel } from '@tumaet/prompt-shared-state';
|
|
3
|
+
export interface ScoreLevelSelectorProps {
|
|
4
|
+
selectedScore?: ScoreLevel;
|
|
5
|
+
onScoreChange: (value: ScoreLevel) => void;
|
|
6
|
+
completed: boolean;
|
|
7
|
+
descriptionsByLevel: Record<ScoreLevel, string>;
|
|
8
|
+
labelsByLevel?: Partial<Record<ScoreLevel, string>>;
|
|
9
|
+
showIndicators?: boolean;
|
|
10
|
+
indicators?: Partial<Record<ScoreLevel, ReactNode[]>>;
|
|
11
|
+
hideUnselectedOnDesktop?: boolean;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const ScoreLevelSelector: ({ selectedScore, onScoreChange, completed, descriptionsByLevel, labelsByLevel, showIndicators, indicators, hideUnselectedOnDesktop, className, }: ScoreLevelSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ScoreLevel } from '@tumaet/prompt-shared-state';
|
|
2
|
+
export interface ScoreLevelConfig {
|
|
3
|
+
title: string;
|
|
4
|
+
textColor: string;
|
|
5
|
+
selectedBg: string;
|
|
6
|
+
border: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const getLevelConfig: (level: ScoreLevel, unknown?: boolean) => ScoreLevelConfig;
|
|
@@ -25,23 +25,23 @@ declare const ChartStyle: ({ id, config }: {
|
|
|
25
25
|
config: ChartConfig;
|
|
26
26
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
27
27
|
declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
|
|
28
|
-
declare const ChartTooltipContent: React.ForwardRefExoticComponent<Omit<Omit<RechartsPrimitive.DefaultTooltipContentProps<
|
|
28
|
+
declare const ChartTooltipContent: React.ForwardRefExoticComponent<Omit<Omit<RechartsPrimitive.DefaultTooltipContentProps<RechartsPrimitive.TooltipValueType, import("recharts/types/component/DefaultTooltipContent").NameType>, "label" | "viewBox" | "active" | "payload" | "coordinate" | "accessibilityLayer"> & {
|
|
29
29
|
active?: boolean;
|
|
30
30
|
allowEscapeViewBox?: import("recharts/types/util/types").AllowInDimension;
|
|
31
31
|
animationDuration?: import("recharts/types/util/types").AnimationDuration;
|
|
32
32
|
animationEasing?: import("recharts/types/util/types").AnimationTiming;
|
|
33
33
|
axisId?: RechartsPrimitive.AxisId;
|
|
34
|
-
content?: import("recharts/types/component/Tooltip").ContentType<
|
|
34
|
+
content?: import("recharts/types/component/Tooltip").ContentType<RechartsPrimitive.TooltipValueType, import("recharts/types/component/DefaultTooltipContent").NameType> | undefined;
|
|
35
35
|
contentStyle?: React.CSSProperties;
|
|
36
36
|
cursor?: import("recharts/types/component/Cursor").CursorDefinition;
|
|
37
37
|
defaultIndex?: number | RechartsPrimitive.TooltipIndex;
|
|
38
38
|
filterNull?: boolean;
|
|
39
|
-
formatter?: ((value:
|
|
39
|
+
formatter?: ((value: RechartsPrimitive.TooltipValueType, name: import("recharts/types/component/DefaultTooltipContent").NameType, item: import("recharts/types/state/tooltipSlice").TooltipPayloadEntry, index: number, payload: RechartsPrimitive.TooltipPayload) => React.ReactNode | [React.ReactNode, React.ReactNode]) | undefined;
|
|
40
40
|
includeHidden?: boolean | undefined;
|
|
41
41
|
isAnimationActive?: boolean | "auto";
|
|
42
|
-
itemSorter?:
|
|
42
|
+
itemSorter?: RechartsPrimitive.TooltipItemSorter;
|
|
43
43
|
itemStyle?: React.CSSProperties;
|
|
44
|
-
labelFormatter?: (
|
|
44
|
+
labelFormatter?: (label: any, payload: RechartsPrimitive.TooltipPayload) => React.ReactNode;
|
|
45
45
|
labelStyle?: React.CSSProperties;
|
|
46
46
|
offset?: number | RechartsPrimitive.Coordinate;
|
|
47
47
|
payloadUniqBy?: import("recharts/types/util/payload/getUniqPayload").UniqueOption<import("recharts/types/state/tooltipSlice").TooltipPayloadEntry>;
|
|
@@ -62,7 +62,7 @@ declare const ChartTooltipContent: React.ForwardRefExoticComponent<Omit<Omit<Rec
|
|
|
62
62
|
payload?: any[];
|
|
63
63
|
label?: any;
|
|
64
64
|
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
65
|
-
declare const ChartLegend:
|
|
65
|
+
declare const ChartLegend: React.MemoExoticComponent<(outsideProps: RechartsPrimitive.LegendProps) => React.ReactPortal | null>;
|
|
66
66
|
declare const ChartLegendContent: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
|
|
67
67
|
payload?: any[];
|
|
68
68
|
verticalAlign?: "top" | "bottom";
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tumaet/prompt-ui-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
|
-
"url": "git+https://github.com/
|
|
6
|
+
"url": "git+https://github.com/prompt-edu/prompt-lib.git"
|
|
7
7
|
},
|
|
8
8
|
"main": "./dist/index.js",
|
|
9
9
|
"module": "./dist/index.js",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"build": "yarn build:esm && yarn build:copy-css",
|
|
27
27
|
"lint": "eslint \"**/*.{js,jsx,ts,tsx}\""
|
|
28
28
|
},
|
|
29
|
-
"packageManager": "yarn@4.
|
|
29
|
+
"packageManager": "yarn@4.13.0",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@hookform/resolvers": "^
|
|
31
|
+
"@hookform/resolvers": "^5.2.2",
|
|
32
32
|
"@radix-ui/react-accordion": "^1.2.12",
|
|
33
33
|
"@radix-ui/react-alert-dialog": "^1.1.15",
|
|
34
34
|
"@radix-ui/react-avatar": "^1.1.11",
|
|
@@ -66,40 +66,41 @@
|
|
|
66
66
|
"@tiptap/pm": "^2.27.2",
|
|
67
67
|
"@tiptap/react": "^2.27.2",
|
|
68
68
|
"@tiptap/starter-kit": "^2.27.2",
|
|
69
|
+
"@tumaet/prompt-shared-state": "^1.0.13",
|
|
69
70
|
"class-variance-authority": "^0.7.1",
|
|
70
71
|
"clsx": "^2.1.1",
|
|
71
72
|
"cmdk": "1.1.1",
|
|
72
73
|
"date-fns": "^4.1.0",
|
|
73
74
|
"highlight.js": "^11.11.1",
|
|
74
75
|
"lowlight": "^3.3.0",
|
|
75
|
-
"lucide-react": "^
|
|
76
|
-
"postcss": "^8.5.
|
|
77
|
-
"postcss-preset-env": "^
|
|
78
|
-
"react": "^19.2.
|
|
76
|
+
"lucide-react": "^1.8.0",
|
|
77
|
+
"postcss": "^8.5.10",
|
|
78
|
+
"postcss-preset-env": "^11.2.1",
|
|
79
|
+
"react": "^19.2.5",
|
|
79
80
|
"react-day-picker": "8.10.1",
|
|
80
|
-
"react-dom": "^19.2.
|
|
81
|
-
"react-hook-form": "^7.
|
|
82
|
-
"react-medium-image-zoom": "^5.4.
|
|
83
|
-
"react-router-dom": "^7.
|
|
84
|
-
"recharts": "^3.
|
|
81
|
+
"react-dom": "^19.2.5",
|
|
82
|
+
"react-hook-form": "^7.72.1",
|
|
83
|
+
"react-medium-image-zoom": "^5.4.3",
|
|
84
|
+
"react-router-dom": "^7.14.2",
|
|
85
|
+
"recharts": "^3.8.1",
|
|
85
86
|
"sonner": "^2.0.7",
|
|
86
|
-
"tailwind-merge": "^
|
|
87
|
+
"tailwind-merge": "^3.5.0",
|
|
87
88
|
"tsc-alias": "^1.8.16",
|
|
88
89
|
"typescript": "^5.9.3"
|
|
89
90
|
},
|
|
90
91
|
"devDependencies": {
|
|
91
|
-
"@eslint/compat": "^
|
|
92
|
+
"@eslint/compat": "^2.0.5",
|
|
92
93
|
"@types/react": "^19.2.14",
|
|
93
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
94
|
-
"@typescript-eslint/parser": "^8.
|
|
95
|
-
"eslint": "^
|
|
94
|
+
"@typescript-eslint/eslint-plugin": "^8.57.1",
|
|
95
|
+
"@typescript-eslint/parser": "^8.57.1",
|
|
96
|
+
"eslint": "^10.2.1",
|
|
96
97
|
"eslint-plugin-prettier": "^5.5.5",
|
|
97
98
|
"eslint-plugin-react": "^7.37.5",
|
|
98
|
-
"eslint-plugin-react-hooks": "^
|
|
99
|
-
"postcss-cli": "^
|
|
100
|
-
"prettier": "^3.8.
|
|
99
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
100
|
+
"postcss-cli": "^11.0.1",
|
|
101
|
+
"prettier": "^3.8.3"
|
|
101
102
|
},
|
|
102
103
|
"resolutions": {
|
|
103
|
-
"tar": "^7.5.
|
|
104
|
+
"tar": "^7.5.13"
|
|
104
105
|
}
|
|
105
106
|
}
|
package/readme.md
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# prompt-ui-components
|
|
2
|
-
|
|
3
|
-
A shared library for the **AET Prompt2** system that provides common UI components.
|
|
4
|
-
|
|
5
|
-
These components are built using [shadcn/ui](https://ui.shadcn.dev/) and are maintained centrally to enable loading via **Module Federation** as a **singleton**.
|
|
6
|
-
This ensures:
|
|
7
|
-
- A **consistent UI experience** across microfrontends
|
|
8
|
-
- **Reduced bundle size** by avoiding duplicate component loading
|
|
9
|
-
- **Unified UI state management** (e.g., for global toast notifications)
|
|
10
|
-
|
|
11
|
-
## Overview
|
|
12
|
-
|
|
13
|
-
The **prompt-ui-components-lib** package is designed to allow multiple microfrontends to share:
|
|
14
|
-
- **Common, reusable UI components** with a unified look and feel
|
|
15
|
-
- **Shared UI state**, such as toasts and modals, across independently deployed apps
|
|
16
|
-
|
|
17
|
-
By using this library, all microfrontends rely on the same component instances and styling, preventing UI inconsistencies and improving maintainability.
|
|
18
|
-
|
|
19
|
-
## Features
|
|
20
|
-
|
|
21
|
-
- **Reusable UI Components**: Built on shadcn/ui, styled and configured for the Prompt2 system
|
|
22
|
-
- **Shared UI State**: Centralized management for features like toast notifications
|
|
23
|
-
- **Module Federation Ready**: Components are loaded as a singleton, preventing duplication
|
|
24
|
-
- **Consistent Design System**: Ensures the same visual language across all microfrontends
|
|
25
|
-
|
|
26
|
-
## Installation
|
|
27
|
-
|
|
28
|
-
Install the package with your preferred package manager:
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
# Using Yarn
|
|
32
|
-
yarn add @tumaet/prompt-ui-components-lib
|
|
33
|
-
|
|
34
|
-
# Or using npm
|
|
35
|
-
npm install @tumaet/prompt-ui-components-lib
|
|
36
|
-
```
|