@ncds/ui-admin 1.8.16 → 1.8.17
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/dist/cjs/src/components/forms-and-input/file-input/FileInput.js +25 -7
- package/dist/cjs/src/components/forms-and-input/file-input/__tests__/FileInput.test.js +168 -0
- package/dist/cjs/src/components/forms-and-input/image-file-input/ImageFileInput.js +76 -19
- package/dist/cjs/src/components/forms-and-input/image-file-input/__tests__/ImageFileInput.test.js +533 -0
- package/dist/cjs/src/components/forms-and-input/image-file-input/components/ImagePreview.js +10 -3
- package/dist/cjs/src/hooks/__tests__/useObjectUrl.test.js +120 -0
- package/dist/cjs/src/hooks/index.js +11 -0
- package/dist/cjs/src/hooks/useObjectUrl.js +39 -0
- package/dist/esm/src/components/forms-and-input/file-input/FileInput.js +25 -7
- package/dist/esm/src/components/forms-and-input/file-input/__tests__/FileInput.test.js +165 -0
- package/dist/esm/src/components/forms-and-input/image-file-input/ImageFileInput.js +71 -19
- package/dist/esm/src/components/forms-and-input/image-file-input/__tests__/ImageFileInput.test.js +530 -0
- package/dist/esm/src/components/forms-and-input/image-file-input/components/ImagePreview.js +10 -3
- package/dist/esm/src/hooks/__tests__/useObjectUrl.test.js +117 -0
- package/dist/esm/src/hooks/index.js +2 -1
- package/dist/esm/src/hooks/useObjectUrl.js +32 -0
- package/dist/temp/src/components/forms-and-input/file-input/FileInput.d.ts +8 -0
- package/dist/temp/src/components/forms-and-input/file-input/FileInput.js +16 -3
- package/dist/temp/src/components/forms-and-input/file-input/__tests__/FileInput.test.d.ts +1 -0
- package/dist/temp/src/components/forms-and-input/file-input/__tests__/FileInput.test.js +139 -0
- package/dist/temp/src/components/forms-and-input/image-file-input/ImageFileInput.d.ts +33 -1
- package/dist/temp/src/components/forms-and-input/image-file-input/ImageFileInput.js +63 -18
- package/dist/temp/src/components/forms-and-input/image-file-input/__tests__/ImageFileInput.test.d.ts +1 -0
- package/dist/temp/src/components/forms-and-input/image-file-input/__tests__/ImageFileInput.test.js +435 -0
- package/dist/temp/src/components/forms-and-input/image-file-input/components/ImagePreview.d.ts +20 -2
- package/dist/temp/src/components/forms-and-input/image-file-input/components/ImagePreview.js +7 -2
- package/dist/temp/src/hooks/__tests__/useObjectUrl.test.d.ts +1 -0
- package/dist/temp/src/hooks/__tests__/useObjectUrl.test.js +96 -0
- package/dist/temp/src/hooks/index.d.ts +1 -0
- package/dist/temp/src/hooks/index.js +1 -0
- package/dist/temp/src/hooks/useObjectUrl.d.ts +16 -0
- package/dist/temp/src/hooks/useObjectUrl.js +32 -0
- package/dist/types/src/components/forms-and-input/file-input/FileInput.d.ts +8 -0
- package/dist/types/src/components/forms-and-input/file-input/__tests__/FileInput.test.d.ts +1 -0
- package/dist/types/src/components/forms-and-input/image-file-input/ImageFileInput.d.ts +33 -1
- package/dist/types/src/components/forms-and-input/image-file-input/__tests__/ImageFileInput.test.d.ts +1 -0
- package/dist/types/src/components/forms-and-input/image-file-input/components/ImagePreview.d.ts +20 -2
- package/dist/types/src/hooks/__tests__/useObjectUrl.test.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/useObjectUrl.d.ts +16 -0
- package/dist/ui-admin/assets/styles/style.css +20 -4
- package/package.json +1 -1
|
@@ -1,5 +1,17 @@
|
|
|
1
|
-
import { type InvalidFile } from '../file-input/FileInput';
|
|
1
|
+
import { FileInputErrorType as ImageFileInputErrorType, type InvalidFile } from '../file-input/FileInput';
|
|
2
2
|
import type { InputBaseProps } from '../input-base/InputBase';
|
|
3
|
+
/**
|
|
4
|
+
* An image already stored on the server, identified by its URL.
|
|
5
|
+
*
|
|
6
|
+
* Mirrors the vanilla implementation's `UploadedFile`
|
|
7
|
+
* (assets/scripts/imageFileInput/const/types.ts), with two deliberate differences:
|
|
8
|
+
* the name is prefixed because this one is re-exported from the package root,
|
|
9
|
+
* and `fileImageUrl` is required — a preview entry without a URL has nothing to render.
|
|
10
|
+
*/
|
|
11
|
+
export type ImageUploadedFile = {
|
|
12
|
+
fileName: string;
|
|
13
|
+
fileImageUrl: string;
|
|
14
|
+
};
|
|
3
15
|
export interface ImageFileInputProps extends Omit<InputBaseProps, 'clearText' | 'onClearText' | 'hintText' | 'value' | 'onChange'> {
|
|
4
16
|
/**
|
|
5
17
|
* Accepted file types
|
|
@@ -22,6 +34,19 @@ export interface ImageFileInputProps extends Omit<InputBaseProps, 'clearText' |
|
|
|
22
34
|
* Callback when files change (controlled mode)
|
|
23
35
|
*/
|
|
24
36
|
onChange?: (files: File[]) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Images already stored on the server, shown before newly selected files.
|
|
39
|
+
* Rendered straight from their URL, so no fetch or CORS handling is needed.
|
|
40
|
+
*/
|
|
41
|
+
uploadedFiles?: ImageUploadedFile[];
|
|
42
|
+
/**
|
|
43
|
+
* Callback when a stored image is removed. Receives the remaining list.
|
|
44
|
+
*
|
|
45
|
+
* `uploadedFiles` is a controlled prop — just like `value`/`onChange`, removal
|
|
46
|
+
* only takes effect once the caller applies this list back. Passing
|
|
47
|
+
* `uploadedFiles` without this callback leaves the previews frozen.
|
|
48
|
+
*/
|
|
49
|
+
onUploadedFilesChange?: (uploadedFiles: ImageUploadedFile[]) => void;
|
|
25
50
|
/**
|
|
26
51
|
* Callback when files are selected (uncontrolled mode)
|
|
27
52
|
*/
|
|
@@ -68,3 +93,10 @@ export interface ImageFileInputProps extends Omit<InputBaseProps, 'clearText' |
|
|
|
68
93
|
showFileInput?: boolean;
|
|
69
94
|
}
|
|
70
95
|
export declare const ImageFileInput: import("react").ForwardRefExoticComponent<ImageFileInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
96
|
+
/**
|
|
97
|
+
* Rejection reasons reported through `onFail`.
|
|
98
|
+
*
|
|
99
|
+
* Re-exported under the ImageFileInput name so callers do not have to reach
|
|
100
|
+
* into FileInput for it. Same enum, same values.
|
|
101
|
+
*/
|
|
102
|
+
export { ImageFileInputErrorType };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/src/components/forms-and-input/image-file-input/components/ImagePreview.d.ts
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
export interface ImagePreviewProps {
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Newly selected file. Rendered via object URL.
|
|
4
|
+
* Either this or `imageUrl` must be provided.
|
|
5
|
+
*/
|
|
6
|
+
file?: File;
|
|
7
|
+
/**
|
|
8
|
+
* URL of an image already stored on the server.
|
|
9
|
+
* Rendered directly, so no fetch or CORS handling is required.
|
|
10
|
+
*/
|
|
11
|
+
imageUrl?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Alternative text. Falls back to the file name when `file` is given.
|
|
14
|
+
*/
|
|
15
|
+
alt?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Read-only mode. The thumbnail stays visible but the remove button is not
|
|
18
|
+
* rendered, per DES-SPEC-013 §5.3 (Disabled — 삭제 아이콘 미노출).
|
|
19
|
+
*/
|
|
20
|
+
disabled?: boolean;
|
|
3
21
|
onRemove: () => void;
|
|
4
22
|
}
|
|
5
|
-
export declare const ImagePreview: ({ file, onRemove }: ImagePreviewProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare const ImagePreview: ({ file, imageUrl, alt, disabled, onRemove }: ImagePreviewProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an object URL for a file and revokes it when the file changes
|
|
3
|
+
* or the component unmounts.
|
|
4
|
+
*
|
|
5
|
+
* Calling `URL.createObjectURL` inline while rendering mints a new blob URL on
|
|
6
|
+
* every re-render and never releases it, so the browser holds every one of them
|
|
7
|
+
* for the lifetime of the document. Creating it in an effect gives us a cleanup
|
|
8
|
+
* hook to revoke on.
|
|
9
|
+
*
|
|
10
|
+
* A layout effect is used so the URL is in place before the browser paints —
|
|
11
|
+
* with a plain effect the image would blink out for a frame whenever the
|
|
12
|
+
* component remounts (for example when a sibling is removed and keys shift).
|
|
13
|
+
*
|
|
14
|
+
* Returns `null` while no file is given.
|
|
15
|
+
*/
|
|
16
|
+
export declare const useObjectUrl: (file?: File) => string | null;
|
|
@@ -973,7 +973,7 @@ button {
|
|
|
973
973
|
background-color: var(--gray-100);
|
|
974
974
|
border-radius: 4px;
|
|
975
975
|
}
|
|
976
|
-
.ncua-checkbox-input:has(input:checked)::before, .ncua-checkbox-input.has-indeterminate::before {
|
|
976
|
+
.ncua-checkbox-input:has(input:checked)::before, .ncua-checkbox-input:has(input:indeterminate)::before, .ncua-checkbox-input.has-indeterminate::before {
|
|
977
977
|
position: absolute;
|
|
978
978
|
top: 50%;
|
|
979
979
|
left: 50%;
|
|
@@ -992,14 +992,14 @@ button {
|
|
|
992
992
|
.ncua-checkbox-input:has(input:disabled:checked)::before {
|
|
993
993
|
background-image: var(--check-icon-disabled);
|
|
994
994
|
}
|
|
995
|
-
.ncua-checkbox-input.has-indeterminate :where(input) {
|
|
995
|
+
.ncua-checkbox-input:has(input:indeterminate) :where(input), .ncua-checkbox-input.has-indeterminate :where(input) {
|
|
996
996
|
border-color: var(--gray-700);
|
|
997
997
|
background-color: var(--gray-50);
|
|
998
998
|
}
|
|
999
|
-
.ncua-checkbox-input.has-indeterminate::before {
|
|
999
|
+
.ncua-checkbox-input:has(input:indeterminate)::before, .ncua-checkbox-input.has-indeterminate::before {
|
|
1000
1000
|
background-image: var(--indeterminate-icon);
|
|
1001
1001
|
}
|
|
1002
|
-
.ncua-checkbox-input.has-indeterminate:has(input:disabled)::before {
|
|
1002
|
+
.ncua-checkbox-input:has(input:indeterminate):has(input:disabled)::before, .ncua-checkbox-input.has-indeterminate:has(input:disabled)::before {
|
|
1003
1003
|
background-image: var(--indeterminate-icon-disabled);
|
|
1004
1004
|
}
|
|
1005
1005
|
|
|
@@ -6764,6 +6764,14 @@ button {
|
|
|
6764
6764
|
line-height: var(--line-heights-xs);
|
|
6765
6765
|
color: var(--gray-500);
|
|
6766
6766
|
}
|
|
6767
|
+
.ncua-data-grid__summary-count {
|
|
6768
|
+
color: var(--primary-red-500);
|
|
6769
|
+
font-weight: 700;
|
|
6770
|
+
}
|
|
6771
|
+
.ncua-data-grid__summary-actions {
|
|
6772
|
+
display: flex;
|
|
6773
|
+
gap: var(--spacing-xs);
|
|
6774
|
+
}
|
|
6767
6775
|
.ncua-data-grid__table-wrapper {
|
|
6768
6776
|
border: 1px solid var(--gray-100);
|
|
6769
6777
|
border-radius: var(--border-radius-md);
|
|
@@ -6811,6 +6819,14 @@ button {
|
|
|
6811
6819
|
.ncua-data-grid__action-bar--space-between {
|
|
6812
6820
|
justify-content: space-between;
|
|
6813
6821
|
}
|
|
6822
|
+
.ncua-data-grid__action-bar-group {
|
|
6823
|
+
display: flex;
|
|
6824
|
+
align-items: center;
|
|
6825
|
+
gap: var(--spacing-s);
|
|
6826
|
+
}
|
|
6827
|
+
.ncua-data-grid__action-bar-group--right {
|
|
6828
|
+
gap: var(--spacing-xs);
|
|
6829
|
+
}
|
|
6814
6830
|
.ncua-data-grid__table {
|
|
6815
6831
|
width: 100%;
|
|
6816
6832
|
position: relative;
|