@longline/aqua-ui 1.0.299 → 1.0.302
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/aquaui-sprites.svg +1 -1
- package/formatters/CountryFormatter/CountryFormatter.d.ts +25 -3
- package/formatters/CountryFormatter/CountryFormatter.js +24 -2
- package/formatters/DateTimeFormatter/DateTimeFormatter.d.ts +38 -9
- package/formatters/DateTimeFormatter/DateTimeFormatter.js +38 -9
- package/formatters/DivisionFormatter/DivisionFormatter.d.ts +28 -4
- package/formatters/DivisionFormatter/DivisionFormatter.js +25 -3
- package/formatters/FilesizeFormatter/FilesizeFormatter.d.ts +24 -8
- package/formatters/FilesizeFormatter/FilesizeFormatter.js +50 -31
- package/formatters/GIS/CoordinateFormatter.d.ts +58 -0
- package/formatters/GIS/CoordinateFormatter.js +51 -0
- package/formatters/GIS/LatitudeFormatter.d.ts +5 -4
- package/formatters/GIS/LatitudeFormatter.js +7 -11
- package/formatters/GIS/LongitudeFormatter.d.ts +9 -6
- package/formatters/GIS/LongitudeFormatter.js +11 -13
- package/formatters/GIS/index.d.ts +1 -0
- package/formatters/GIS/index.js +1 -0
- package/formatters/HighlightFormatter/HighlightFormatter.d.ts +26 -5
- package/formatters/HighlightFormatter/HighlightFormatter.js +26 -5
- package/formatters/HttpStatusFormatter/HttpStatusFormatter.d.ts +34 -14
- package/formatters/HttpStatusFormatter/HttpStatusFormatter.js +35 -16
- package/formatters/HumanFormatter/HumanFormatter.d.ts +24 -4
- package/formatters/HumanFormatter/HumanFormatter.js +37 -12
- package/formatters/NumberFormatter/NumberFormatter.d.ts +19 -6
- package/formatters/NumberFormatter/NumberFormatter.js +19 -6
- package/formatters/StringFormatter/StringFormatter.d.ts +22 -4
- package/formatters/StringFormatter/StringFormatter.js +21 -3
- package/map/layers/ParticlesLayer/ParticlesLayer.d.ts +97 -1
- package/map/layers/ParticlesLayer/ParticlesLayer.js +239 -38
- package/map/layers/ParticlesLayer/ParticlesVertexShader.d.ts +1 -1
- package/map/layers/ParticlesLayer/ParticlesVertexShader.js +1 -1
- package/map/layers/ParticlesLayer/PositionComputeFragmentShader.d.ts +2 -0
- package/map/layers/ParticlesLayer/PositionComputeFragmentShader.js +2 -0
- package/map/layers/ParticlesLayer/PositionComputeVertexShader.d.ts +2 -0
- package/map/layers/ParticlesLayer/PositionComputeVertexShader.js +2 -0
- package/package.json +1 -1
- package/services/Dialog/AlertDialog.d.ts +1 -1
- package/services/Dialog/ConfirmDialog.d.ts +5 -5
- package/services/Dialog/ConfirmDialog.js +1 -1
- package/services/Dialog/Dialog.d.ts +46 -16
- package/services/Dialog/Dialog.js +98 -16
- package/services/Dialog/DialogBackground.js +1 -0
- package/services/Dialog/DialogContent.d.ts +3 -3
- package/services/Dialog/DialogContent.js +1 -1
- package/services/Dialog/DialogFooter.d.ts +3 -3
- package/services/Dialog/DialogHeader.d.ts +3 -3
- package/services/Dialog/DialogWindow.d.ts +3 -4
- package/services/Dialog/DialogWindow.js +1 -0
- package/services/Dialog/XhrDialog.d.ts +1 -1
- package/services/Dialog/index.d.ts +7 -1
- package/svg/icons/index.d.ts +1 -0
- package/svg/icons/index.js +1 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var ParticlesVertexShader = /*glsl*/ "\n
|
|
1
|
+
var ParticlesVertexShader = /*glsl*/ "\n attribute vec2 a_pos;\n attribute float a_idx;\n attribute float a_offset;\n\n uniform float u_point_size;\n uniform int u_num_instances;\n uniform int u_frame;\n uniform sampler2D positionTexture; // Pre-computed positions (X in RG, Y in BA)\n uniform float u_posTexWidth;\n uniform float u_posTexHeight;\n uniform float u_density;\n uniform float u_gradientStops[12];\n uniform vec4 u_gradientColors[12];\n\n // Output color, calculated by this vertex shader:\n varying vec4 v_color;\n\n //\n // Given a value, find its corresponding color in the gradient stops.\n //\n vec4 getGradientColor(float position) {\n // Find left and right stop:\n float left = -1.0;\n float right = 99.0;\n vec4 leftColor;\n vec4 rightColor;\n\n for(int i = 0; i < 12; i++) {\n if (u_gradientStops[i] <= position) {\n left = u_gradientStops[i];\n leftColor = u_gradientColors[i];\n } else break;\n }\n\n for(int i = 12 - 1; i >= 0; i--) {\n if (u_gradientStops[i] >= position) {\n right = u_gradientStops[i];\n rightColor = u_gradientColors[i];\n } else break;\n }\n\n // Distance between stops:\n float width = right - left;\n // Distance from left stop:\n float dist = position - left;\n // Right stop weight:\n float weight;\n if(dist == 0.0) {\n weight = dist;\n } else {\n weight = dist / width;\n }\n\n float r = leftColor.x + (rightColor.x - leftColor.x) * weight;\n float g = leftColor.y + (rightColor.y - leftColor.y) * weight;\n float b = leftColor.z + (rightColor.z - leftColor.z) * weight;\n float a = leftColor.w + (rightColor.w - leftColor.w) * weight;\n return vec4(r, g, b, a);\n }\n\n // Decode a 16-bit encoded position from two bytes (high, low as 0-1 floats)\n float decodePosition(float hi, float lo) {\n float encoded = hi * 255.0 * 256.0 + lo * 255.0;\n return encoded / 65535.0 * 2.0 - 1.0;\n }\n\n void main() {\n int idx = int(a_idx);\n int offset = int(a_offset);\n int frame = u_frame + offset;\n if(frame >= u_num_instances) frame -= u_num_instances;\n\n // Determine color from frame.\n int start = idx - frame;\n if(start < 0) start += u_num_instances;\n v_color = getGradientColor(float(u_num_instances - start) / float(u_num_instances));\n\n // Compute texture coordinates for this particle's pre-computed position.\n // WebGL 1 doesn't have gl_VertexID, so we compute the particle index from\n // vertex attributes. The vertex buffer layout is:\n // for y in [0, density): for x in [0, density): for i in [0, particles): (pos, idx, offset)\n\n // Convert grid position back to grid index\n float gridX = (a_pos.x + 0.99) * (u_density - 1.0) / 1.98;\n float gridY = (a_pos.y + 0.99) * (u_density - 1.0) / 1.98;\n float gridIndex = floor(gridY + 0.5) * u_density + floor(gridX + 0.5);\n float particleIdx = gridIndex * float(u_num_instances) + a_idx;\n\n // Convert particle index to texture coordinates\n float texX = mod(particleIdx, u_posTexWidth);\n float texY = floor(particleIdx / u_posTexWidth);\n\n // Sample position texture (add 0.5 to sample pixel center)\n vec2 texCoord = vec2((texX + 0.5) / u_posTexWidth, (texY + 0.5) / u_posTexHeight);\n vec4 encodedPos = texture2D(positionTexture, texCoord);\n\n // Decode position (X in RG, Y in BA)\n float posX = decodePosition(encodedPos.r, encodedPos.g);\n float posY = decodePosition(encodedPos.b, encodedPos.a);\n\n // Check for off-screen marker (position > 1.5 means invalid)\n if(posX > 1.5) return;\n\n gl_Position = vec4(posX, posY, 0.0, 1.0);\n gl_PointSize = u_point_size;\n }\n";
|
|
2
2
|
export { ParticlesVertexShader };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const PositionComputeFragmentShader = "\n #ifdef GL_ES\n precision highp float;\n #endif\n\n uniform sampler2D uvTexture; // Combined UV texture (U in R, V in G)\n uniform float minU;\n uniform float maxU;\n uniform float minV;\n uniform float maxV;\n uniform float u_density; // Grid density (e.g., 40)\n uniform float u_particles; // Particles per trail (e.g., 80)\n uniform float u_texWidth; // Position texture width\n uniform float u_minVisMag; // Minimum visible velocity magnitude\n uniform float u_maxVisMag; // Maximum visible velocity magnitude\n\n // Encode a value in range [-1, 1] to two bytes (high, low) as 0-1 floats\n vec2 encodePosition(float pos) {\n // Map [-1, 1] to [0, 65535]\n float encoded = (pos + 1.0) * 0.5 * 65535.0;\n float hi = floor(encoded / 256.0);\n float lo = encoded - hi * 256.0;\n return vec2(hi / 255.0, lo / 255.0);\n }\n\n void main() {\n // Determine which particle this fragment represents\n float pixelX = floor(gl_FragCoord.x);\n float pixelY = floor(gl_FragCoord.y);\n float particleIndex = pixelY * u_texWidth + pixelX;\n\n float totalParticles = u_density * u_density * u_particles;\n\n // If this pixel is beyond our particle count, output off-screen position\n if (particleIndex >= totalParticles) {\n // Encode (2, 2) as off-screen marker\n gl_FragColor = vec4(encodePosition(2.0), encodePosition(2.0));\n return;\n }\n\n // Compute grid position and trail index from particle index\n float gridIndex = floor(particleIndex / u_particles);\n float trailIdx = particleIndex - gridIndex * u_particles;\n float gridX = mod(gridIndex, u_density);\n float gridY = floor(gridIndex / u_density);\n\n // Compute starting position (same formula as createBufferScreen)\n float startX = gridX * 1.98 / (u_density - 1.0) - 0.99;\n float startY = gridY * 1.98 / (u_density - 1.0) - 0.99;\n\n vec2 pos = vec2(startX, startY);\n\n // Check if starting position has valid UV data\n vec2 texCoord = (pos + 1.0) / 2.0;\n vec4 uvColor = texture2D(uvTexture, texCoord);\n if (uvColor.w == 0.0) {\n // No data at starting position - output off-screen\n gl_FragColor = vec4(encodePosition(2.0), encodePosition(2.0));\n return;\n }\n\n // Compute maximum possible velocity magnitude from data ranges\n // Max magnitude is at one of the four corners of the UV rectangle\n float maxPossibleMag = sqrt(\n max(minU * minU, maxU * maxU) +\n max(minV * minV, maxV * maxV)\n );\n\n // Trace the particle path\n float uRange = maxU - minU;\n float vRange = maxV - minV;\n int idx = int(trailIdx);\n\n for (int i = 1; i < 100; i++) {\n if (i > idx) break;\n\n texCoord = (pos + 1.0) / 2.0;\n uvColor = texture2D(uvTexture, texCoord);\n\n if (uvColor.w == 0.0) {\n // Hit boundary - output off-screen\n gl_FragColor = vec4(encodePosition(2.0), encodePosition(2.0));\n return;\n }\n\n float u = uRange * uvColor.x + minU;\n float v = vRange * uvColor.y + minV;\n\n // Compute velocity magnitude\n float mag = sqrt(u * u + v * v);\n\n // If magnitude is zero, skip this particle entirely\n if (mag == 0.0) {\n gl_FragColor = vec4(encodePosition(2.0), encodePosition(2.0));\n return;\n }\n\n // Linear remap magnitude to visible range [minVisMag, maxVisMag]\n float t = mag / maxPossibleMag; // Normalize to [0, 1]\n float newMag = u_minVisMag + t * (u_maxVisMag - u_minVisMag);\n\n // Scale velocity to new magnitude while preserving direction\n float scale = newMag / mag;\n u = u * scale;\n v = v * scale;\n\n pos.x += u / 10.0;\n pos.y += v / 10.0;\n\n // Bounds check (same as original shader, including the bug with pos.x on right side)\n if (pos.x <= -1.0 || pos.x >= 1.0 || pos.y <= -1.0 || pos.x >= 1.0) {\n gl_FragColor = vec4(encodePosition(2.0), encodePosition(2.0));\n return;\n }\n }\n\n // Output encoded position: X in RG, Y in BA\n gl_FragColor = vec4(encodePosition(pos.x), encodePosition(pos.y));\n }\n";
|
|
2
|
+
export { PositionComputeFragmentShader };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var PositionComputeFragmentShader = /*glsl*/ "\n #ifdef GL_ES\n precision highp float;\n #endif\n\n uniform sampler2D uvTexture; // Combined UV texture (U in R, V in G)\n uniform float minU;\n uniform float maxU;\n uniform float minV;\n uniform float maxV;\n uniform float u_density; // Grid density (e.g., 40)\n uniform float u_particles; // Particles per trail (e.g., 80)\n uniform float u_texWidth; // Position texture width\n uniform float u_minVisMag; // Minimum visible velocity magnitude\n uniform float u_maxVisMag; // Maximum visible velocity magnitude\n\n // Encode a value in range [-1, 1] to two bytes (high, low) as 0-1 floats\n vec2 encodePosition(float pos) {\n // Map [-1, 1] to [0, 65535]\n float encoded = (pos + 1.0) * 0.5 * 65535.0;\n float hi = floor(encoded / 256.0);\n float lo = encoded - hi * 256.0;\n return vec2(hi / 255.0, lo / 255.0);\n }\n\n void main() {\n // Determine which particle this fragment represents\n float pixelX = floor(gl_FragCoord.x);\n float pixelY = floor(gl_FragCoord.y);\n float particleIndex = pixelY * u_texWidth + pixelX;\n\n float totalParticles = u_density * u_density * u_particles;\n\n // If this pixel is beyond our particle count, output off-screen position\n if (particleIndex >= totalParticles) {\n // Encode (2, 2) as off-screen marker\n gl_FragColor = vec4(encodePosition(2.0), encodePosition(2.0));\n return;\n }\n\n // Compute grid position and trail index from particle index\n float gridIndex = floor(particleIndex / u_particles);\n float trailIdx = particleIndex - gridIndex * u_particles;\n float gridX = mod(gridIndex, u_density);\n float gridY = floor(gridIndex / u_density);\n\n // Compute starting position (same formula as createBufferScreen)\n float startX = gridX * 1.98 / (u_density - 1.0) - 0.99;\n float startY = gridY * 1.98 / (u_density - 1.0) - 0.99;\n\n vec2 pos = vec2(startX, startY);\n\n // Check if starting position has valid UV data\n vec2 texCoord = (pos + 1.0) / 2.0;\n vec4 uvColor = texture2D(uvTexture, texCoord);\n if (uvColor.w == 0.0) {\n // No data at starting position - output off-screen\n gl_FragColor = vec4(encodePosition(2.0), encodePosition(2.0));\n return;\n }\n\n // Compute maximum possible velocity magnitude from data ranges\n // Max magnitude is at one of the four corners of the UV rectangle\n float maxPossibleMag = sqrt(\n max(minU * minU, maxU * maxU) +\n max(minV * minV, maxV * maxV)\n );\n\n // Trace the particle path\n float uRange = maxU - minU;\n float vRange = maxV - minV;\n int idx = int(trailIdx);\n\n for (int i = 1; i < 100; i++) {\n if (i > idx) break;\n\n texCoord = (pos + 1.0) / 2.0;\n uvColor = texture2D(uvTexture, texCoord);\n\n if (uvColor.w == 0.0) {\n // Hit boundary - output off-screen\n gl_FragColor = vec4(encodePosition(2.0), encodePosition(2.0));\n return;\n }\n\n float u = uRange * uvColor.x + minU;\n float v = vRange * uvColor.y + minV;\n\n // Compute velocity magnitude\n float mag = sqrt(u * u + v * v);\n\n // If magnitude is zero, skip this particle entirely\n if (mag == 0.0) {\n gl_FragColor = vec4(encodePosition(2.0), encodePosition(2.0));\n return;\n }\n\n // Linear remap magnitude to visible range [minVisMag, maxVisMag]\n float t = mag / maxPossibleMag; // Normalize to [0, 1]\n float newMag = u_minVisMag + t * (u_maxVisMag - u_minVisMag);\n\n // Scale velocity to new magnitude while preserving direction\n float scale = newMag / mag;\n u = u * scale;\n v = v * scale;\n\n pos.x += u / 10.0;\n pos.y += v / 10.0;\n\n // Bounds check (same as original shader, including the bug with pos.x on right side)\n if (pos.x <= -1.0 || pos.x >= 1.0 || pos.y <= -1.0 || pos.x >= 1.0) {\n gl_FragColor = vec4(encodePosition(2.0), encodePosition(2.0));\n return;\n }\n }\n\n // Output encoded position: X in RG, Y in BA\n gl_FragColor = vec4(encodePosition(pos.x), encodePosition(pos.y));\n }\n";
|
|
2
|
+
export { PositionComputeFragmentShader };
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
interface
|
|
2
|
+
interface IConfirmDialogProps {
|
|
3
3
|
/**
|
|
4
4
|
* Dialog content.
|
|
5
5
|
*/
|
|
@@ -23,7 +23,7 @@ interface IProps {
|
|
|
23
23
|
*/
|
|
24
24
|
onConfirm: () => void;
|
|
25
25
|
/**
|
|
26
|
-
* If true,
|
|
26
|
+
* If true, inverts Dialog colors.
|
|
27
27
|
* @default false
|
|
28
28
|
*/
|
|
29
29
|
inverted?: boolean;
|
|
@@ -35,10 +35,10 @@ interface IProps {
|
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* A `Dialog.Confirm` is a preset dialog with a title, and a "Yes" and a "No"
|
|
38
|
-
* button. Clicking "Yes"
|
|
38
|
+
* button. Clicking "Yes" calls `onConfirm`, and clicking "No" calls `onClose`.
|
|
39
39
|
*/
|
|
40
40
|
declare const ConfirmDialog: {
|
|
41
|
-
({ open, title, ...props }:
|
|
41
|
+
({ open, title, ...props }: IConfirmDialogProps): React.JSX.Element;
|
|
42
42
|
displayName: string;
|
|
43
43
|
};
|
|
44
|
-
export { ConfirmDialog,
|
|
44
|
+
export { ConfirmDialog, IConfirmDialogProps };
|
|
@@ -15,7 +15,7 @@ import { Dialog } from './Dialog';
|
|
|
15
15
|
import { PrimaryButton } from '../../controls/PrimaryButton';
|
|
16
16
|
/**
|
|
17
17
|
* A `Dialog.Confirm` is a preset dialog with a title, and a "Yes" and a "No"
|
|
18
|
-
* button. Clicking "Yes"
|
|
18
|
+
* button. Clicking "Yes" calls `onConfirm`, and clicking "No" calls `onClose`.
|
|
19
19
|
*/
|
|
20
20
|
var ConfirmDialog = function (_a) {
|
|
21
21
|
var _b = _a.open, open = _b === void 0 ? false : _b, _c = _a.title, title = _c === void 0 ? 'Confirmation' : _c, props = __rest(_a, ["open", "title"]);
|
|
@@ -25,7 +25,7 @@ interface IDialogProps {
|
|
|
25
25
|
*/
|
|
26
26
|
canClose?: boolean;
|
|
27
27
|
/**
|
|
28
|
-
* If true,
|
|
28
|
+
* If true, inverts Dialog colors.
|
|
29
29
|
* @default false
|
|
30
30
|
*/
|
|
31
31
|
inverted?: boolean;
|
|
@@ -40,47 +40,77 @@ declare const Dialog: {
|
|
|
40
40
|
({ open, canClose, width, inverted, ...props }: IDialogProps): React.JSX.Element;
|
|
41
41
|
displayName: string;
|
|
42
42
|
/**
|
|
43
|
-
* Dialog
|
|
43
|
+
* The header section of a Dialog, typically containing a title.
|
|
44
|
+
* Rendered with larger text and appropriate spacing.
|
|
44
45
|
*/
|
|
45
46
|
Header: {
|
|
46
|
-
(props: import("./DialogHeader").
|
|
47
|
+
(props: import("./DialogHeader").IDialogHeaderProps): React.JSX.Element;
|
|
47
48
|
displayName: string;
|
|
48
49
|
};
|
|
49
50
|
/**
|
|
50
|
-
*
|
|
51
|
+
* The main content area of a Dialog.
|
|
52
|
+
* Provides appropriate padding and scrollable overflow for longer content.
|
|
51
53
|
*/
|
|
52
54
|
Content: {
|
|
53
|
-
({ nopadding, maxHeight, ...props }: import("./DialogContent").
|
|
55
|
+
({ nopadding, maxHeight, ...props }: import("./DialogContent").IDialogContentProps): React.JSX.Element;
|
|
54
56
|
displayName: string;
|
|
55
57
|
};
|
|
56
58
|
/**
|
|
57
|
-
* Dialog
|
|
59
|
+
* The footer section of a Dialog, typically containing action buttons.
|
|
60
|
+
* Buttons are right-aligned with appropriate spacing between them.
|
|
58
61
|
*/
|
|
59
62
|
Footer: {
|
|
60
|
-
({ align, ...props }: import("./DialogFooter").
|
|
63
|
+
({ align, ...props }: import("./DialogFooter").IDialogFooterProps): React.JSX.Element;
|
|
61
64
|
displayName: string;
|
|
62
65
|
};
|
|
63
66
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
67
|
+
* A preset alert dialog with a title, content, and single "OK" button.
|
|
68
|
+
*
|
|
69
|
+
* ```tsx
|
|
70
|
+
* <Dialog.Alert
|
|
71
|
+
* open={showAlert}
|
|
72
|
+
* title="Warning"
|
|
73
|
+
* onClose={() => setShowAlert(false)}
|
|
74
|
+
* >
|
|
75
|
+
* Your session will expire in 5 minutes.
|
|
76
|
+
* </Dialog.Alert>
|
|
77
|
+
* ```
|
|
66
78
|
*/
|
|
67
79
|
Alert: {
|
|
68
80
|
({ open, title, ...props }: import("./AlertDialog").IAlertDialogProps): React.JSX.Element;
|
|
69
81
|
displayName: string;
|
|
70
82
|
};
|
|
71
83
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
84
|
+
* A preset confirmation dialog with "Yes" and "No" buttons.
|
|
85
|
+
*
|
|
86
|
+
* ```tsx
|
|
87
|
+
* <Dialog.Confirm
|
|
88
|
+
* open={showConfirm}
|
|
89
|
+
* title="Delete Item"
|
|
90
|
+
* onYes={handleDelete}
|
|
91
|
+
* onNo={() => setShowConfirm(false)}
|
|
92
|
+
* >
|
|
93
|
+
* Are you sure you want to delete this item?
|
|
94
|
+
* </Dialog.Confirm>
|
|
95
|
+
* ```
|
|
75
96
|
*/
|
|
76
97
|
Confirm: {
|
|
77
|
-
({ open, title, ...props }: import("./ConfirmDialog").
|
|
98
|
+
({ open, title, ...props }: import("./ConfirmDialog").IConfirmDialogProps): React.JSX.Element;
|
|
78
99
|
displayName: string;
|
|
79
100
|
};
|
|
80
101
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
102
|
+
* A preset dialog for displaying Axios network errors.
|
|
103
|
+
* Shows a human-readable error message based on the HTTP status code.
|
|
104
|
+
* Includes "OK" button and optional "Retry" button.
|
|
105
|
+
*
|
|
106
|
+
* ```tsx
|
|
107
|
+
* <Dialog.Xhr
|
|
108
|
+
* open={!!error}
|
|
109
|
+
* error={error}
|
|
110
|
+
* onClose={() => setError(null)}
|
|
111
|
+
* onRetry={() => refetch()}
|
|
112
|
+
* />
|
|
113
|
+
* ```
|
|
84
114
|
*/
|
|
85
115
|
Xhr: {
|
|
86
116
|
({ open, title, ...props }: import("./XhrDialog").IXhrDialogProps): React.JSX.Element;
|
|
@@ -34,11 +34,63 @@ import { ConfirmDialog } from './ConfirmDialog';
|
|
|
34
34
|
import { XhrDialog } from './XhrDialog';
|
|
35
35
|
import { useOutsideClose } from '../../hooks/useOutsideClose';
|
|
36
36
|
/**
|
|
37
|
-
* A
|
|
38
|
-
*
|
|
39
|
-
* `
|
|
40
|
-
*
|
|
41
|
-
* to
|
|
37
|
+
* A modal overlay window for displaying content that requires user attention or interaction.
|
|
38
|
+
*
|
|
39
|
+
* The `Dialog` component renders its content in a React portal, ensuring it appears above
|
|
40
|
+
* all other page content with a semi-transparent backdrop. It supports animated open/close
|
|
41
|
+
* transitions, click-outside-to-close behavior, and escape key handling.
|
|
42
|
+
*
|
|
43
|
+
* ## Usage
|
|
44
|
+
*
|
|
45
|
+
* Build dialogs using the compound component pattern with `Dialog.Header`, `Dialog.Content`,
|
|
46
|
+
* and `Dialog.Footer`:
|
|
47
|
+
*
|
|
48
|
+
* ```tsx
|
|
49
|
+
* const [isOpen, setIsOpen] = useState(false);
|
|
50
|
+
*
|
|
51
|
+
* <Dialog open={isOpen} onClose={() => setIsOpen(false)}>
|
|
52
|
+
* <Dialog.Header>Confirm Action</Dialog.Header>
|
|
53
|
+
* <Dialog.Content>
|
|
54
|
+
* Are you sure you want to proceed?
|
|
55
|
+
* </Dialog.Content>
|
|
56
|
+
* <Dialog.Footer>
|
|
57
|
+
* <Button onClick={() => setIsOpen(false)}>Cancel</Button>
|
|
58
|
+
* <PrimaryButton onClick={handleConfirm}>Confirm</PrimaryButton>
|
|
59
|
+
* </Dialog.Footer>
|
|
60
|
+
* </Dialog>
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* ## Preset Dialogs
|
|
64
|
+
*
|
|
65
|
+
* For common use cases, preset dialog variants are available:
|
|
66
|
+
*
|
|
67
|
+
* | Component | Description |
|
|
68
|
+
* |-----------|-------------|
|
|
69
|
+
* | `Dialog.Alert` | Simple alert with title, content, and "OK" button |
|
|
70
|
+
* | `Dialog.Confirm` | Confirmation with "Yes" and "No" buttons |
|
|
71
|
+
* | `Dialog.Xhr` | Network error display with optional "Retry" button |
|
|
72
|
+
*
|
|
73
|
+
* ## Close Behavior
|
|
74
|
+
*
|
|
75
|
+
* By default, dialogs can be closed by:
|
|
76
|
+
* - Clicking outside the dialog window
|
|
77
|
+
* - Pressing the Escape key
|
|
78
|
+
* - Calling `onClose` programmatically
|
|
79
|
+
*
|
|
80
|
+
* Set `canClose={false}` to prevent user-initiated closing (useful during async operations).
|
|
81
|
+
*
|
|
82
|
+
* ## Animation States
|
|
83
|
+
*
|
|
84
|
+
* The dialog uses `react-transition-state` for smooth enter/exit animations:
|
|
85
|
+
* - **preEnter/exiting**: Faded out, scaled to 80%
|
|
86
|
+
* - **entering/entered**: Fully visible, normal scale
|
|
87
|
+
*
|
|
88
|
+
* Transitions use a 500ms duration with a bounce easing curve.
|
|
89
|
+
*
|
|
90
|
+
* ## Responsive Width
|
|
91
|
+
*
|
|
92
|
+
* On small screens (below theme breakpoint), dialog width automatically reduces to
|
|
93
|
+
* a maximum of 400px to ensure proper display on mobile devices.
|
|
42
94
|
*/
|
|
43
95
|
var DialogBase = function (props) {
|
|
44
96
|
var windowRef = React.useRef(null);
|
|
@@ -74,32 +126,62 @@ var Dialog = function (_a) {
|
|
|
74
126
|
};
|
|
75
127
|
Dialog.displayName = "Dialog";
|
|
76
128
|
/**
|
|
77
|
-
* Dialog
|
|
129
|
+
* The header section of a Dialog, typically containing a title.
|
|
130
|
+
* Rendered with larger text and appropriate spacing.
|
|
78
131
|
*/
|
|
79
132
|
Dialog.Header = DialogHeader;
|
|
80
133
|
/**
|
|
81
|
-
*
|
|
134
|
+
* The main content area of a Dialog.
|
|
135
|
+
* Provides appropriate padding and scrollable overflow for longer content.
|
|
82
136
|
*/
|
|
83
137
|
Dialog.Content = DialogContent;
|
|
84
138
|
/**
|
|
85
|
-
* Dialog
|
|
139
|
+
* The footer section of a Dialog, typically containing action buttons.
|
|
140
|
+
* Buttons are right-aligned with appropriate spacing between them.
|
|
86
141
|
*/
|
|
87
142
|
Dialog.Footer = DialogFooter;
|
|
88
143
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
144
|
+
* A preset alert dialog with a title, content, and single "OK" button.
|
|
145
|
+
*
|
|
146
|
+
* ```tsx
|
|
147
|
+
* <Dialog.Alert
|
|
148
|
+
* open={showAlert}
|
|
149
|
+
* title="Warning"
|
|
150
|
+
* onClose={() => setShowAlert(false)}
|
|
151
|
+
* >
|
|
152
|
+
* Your session will expire in 5 minutes.
|
|
153
|
+
* </Dialog.Alert>
|
|
154
|
+
* ```
|
|
91
155
|
*/
|
|
92
156
|
Dialog.Alert = AlertDialog;
|
|
93
157
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
158
|
+
* A preset confirmation dialog with "Yes" and "No" buttons.
|
|
159
|
+
*
|
|
160
|
+
* ```tsx
|
|
161
|
+
* <Dialog.Confirm
|
|
162
|
+
* open={showConfirm}
|
|
163
|
+
* title="Delete Item"
|
|
164
|
+
* onYes={handleDelete}
|
|
165
|
+
* onNo={() => setShowConfirm(false)}
|
|
166
|
+
* >
|
|
167
|
+
* Are you sure you want to delete this item?
|
|
168
|
+
* </Dialog.Confirm>
|
|
169
|
+
* ```
|
|
97
170
|
*/
|
|
98
171
|
Dialog.Confirm = ConfirmDialog;
|
|
99
172
|
/**
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
173
|
+
* A preset dialog for displaying Axios network errors.
|
|
174
|
+
* Shows a human-readable error message based on the HTTP status code.
|
|
175
|
+
* Includes "OK" button and optional "Retry" button.
|
|
176
|
+
*
|
|
177
|
+
* ```tsx
|
|
178
|
+
* <Dialog.Xhr
|
|
179
|
+
* open={!!error}
|
|
180
|
+
* error={error}
|
|
181
|
+
* onClose={() => setError(null)}
|
|
182
|
+
* onRetry={() => refetch()}
|
|
183
|
+
* />
|
|
184
|
+
* ```
|
|
103
185
|
*/
|
|
104
186
|
Dialog.Xhr = XhrDialog;
|
|
105
187
|
export { Dialog };
|
|
@@ -8,5 +8,6 @@ var DialogBackgroundBase = function (props) {
|
|
|
8
8
|
return React.createElement("div", { className: "".concat(props.className, " ").concat(props.status) });
|
|
9
9
|
};
|
|
10
10
|
var DialogBackground = styled(DialogBackgroundBase)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: fixed;\n z-index: 2000;\n left: 0;\n top: 0;\n right: 0;\n bottom: 0;\n background-color: #00000080;\n opacity: 1;\n\n /* useTransitionState classes */\n transition: opacity 0.5s ease;\n opacity: 0;\n &.preEnter, &.exiting {\n opacity: 0;\n }\n &.entering {\n opacity: 1;\n }\n &.entered {\n opacity: 1;\n } \n"], ["\n position: fixed;\n z-index: 2000;\n left: 0;\n top: 0;\n right: 0;\n bottom: 0;\n background-color: #00000080;\n opacity: 1;\n\n /* useTransitionState classes */\n transition: opacity 0.5s ease;\n opacity: 0;\n &.preEnter, &.exiting {\n opacity: 0;\n }\n &.entering {\n opacity: 1;\n }\n &.entered {\n opacity: 1;\n } \n"])));
|
|
11
|
+
DialogBackground.displayName = "DialogBackground";
|
|
11
12
|
export { DialogBackground };
|
|
12
13
|
var templateObject_1;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
interface
|
|
2
|
+
interface IDialogContentProps {
|
|
3
3
|
/** @ignore */
|
|
4
4
|
className?: string;
|
|
5
5
|
/**
|
|
@@ -24,7 +24,7 @@ interface IProps {
|
|
|
24
24
|
* can be adjusted with the `maxHeight` prop.
|
|
25
25
|
*/
|
|
26
26
|
declare const DialogContent: {
|
|
27
|
-
({ nopadding, maxHeight, ...props }:
|
|
27
|
+
({ nopadding, maxHeight, ...props }: IDialogContentProps): React.JSX.Element;
|
|
28
28
|
displayName: string;
|
|
29
29
|
};
|
|
30
|
-
export { DialogContent,
|
|
30
|
+
export { DialogContent, IDialogContentProps };
|
|
@@ -29,7 +29,7 @@ import styled, { css } from 'styled-components';
|
|
|
29
29
|
var DialogContentBase = function (props) {
|
|
30
30
|
return React.createElement("div", { className: props.className }, props.children);
|
|
31
31
|
};
|
|
32
|
-
var DialogContentStyled = styled(DialogContentBase)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: relative;\n ", "\n max-height: ", "vh;\n overflow-y: auto
|
|
32
|
+
var DialogContentStyled = styled(DialogContentBase)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: relative;\n ", "\n max-height: ", "vh;\n overflow-y: auto;\n"], ["\n position: relative;\n ", "\n max-height: ", "vh;\n overflow-y: auto;\n"
|
|
33
33
|
/**
|
|
34
34
|
* `Dialog.Content` is a content block for a `Dialog` component. The content
|
|
35
35
|
* will auto-scroll when it is taller than 70% of the viewport. This percentage
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
interface
|
|
2
|
+
interface IDialogFooterProps {
|
|
3
3
|
/** @ignore */
|
|
4
4
|
className?: string;
|
|
5
5
|
/**
|
|
@@ -18,7 +18,7 @@ interface IProps {
|
|
|
18
18
|
* where the `align` prop may be used to align them left, right or center.
|
|
19
19
|
*/
|
|
20
20
|
declare const DialogFooter: {
|
|
21
|
-
({ align, ...props }:
|
|
21
|
+
({ align, ...props }: IDialogFooterProps): React.JSX.Element;
|
|
22
22
|
displayName: string;
|
|
23
23
|
};
|
|
24
|
-
export { DialogFooter,
|
|
24
|
+
export { DialogFooter, IDialogFooterProps };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
interface
|
|
2
|
+
interface IDialogHeaderProps {
|
|
3
3
|
/** @ignore */
|
|
4
4
|
className?: string;
|
|
5
5
|
/**
|
|
@@ -12,7 +12,7 @@ interface IProps {
|
|
|
12
12
|
* any JSX.
|
|
13
13
|
*/
|
|
14
14
|
declare const DialogHeader: {
|
|
15
|
-
(props:
|
|
15
|
+
(props: IDialogHeaderProps): React.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
|
-
export { DialogHeader,
|
|
18
|
+
export { DialogHeader, IDialogHeaderProps };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
interface
|
|
2
|
+
interface IDialogWindowProps {
|
|
3
3
|
/** @ignore */
|
|
4
4
|
className?: string;
|
|
5
5
|
/** @ignore */
|
|
6
6
|
children?: React.ReactNode;
|
|
7
|
-
windowRef?: any;
|
|
8
7
|
width?: number | string;
|
|
9
8
|
/**
|
|
10
9
|
* Are Dialog colors inverted?
|
|
@@ -15,7 +14,7 @@ interface IProps {
|
|
|
15
14
|
*/
|
|
16
15
|
status: string;
|
|
17
16
|
}
|
|
18
|
-
declare const DialogWindow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<
|
|
17
|
+
declare const DialogWindow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<IDialogWindowProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
19
18
|
ref?: React.Ref<HTMLDivElement>;
|
|
20
|
-
}, never>> & string & Omit<React.ForwardRefExoticComponent<
|
|
19
|
+
}, never>> & string & Omit<React.ForwardRefExoticComponent<IDialogWindowProps & React.RefAttributes<HTMLDivElement>>, keyof React.Component<any, {}, any>>;
|
|
21
20
|
export { DialogWindow };
|
|
@@ -22,5 +22,6 @@ var DialogWindow = styled(DialogWindowBase)(templateObject_2 || (templateObject_
|
|
|
22
22
|
return p.width;
|
|
23
23
|
return p.width > 400 ? '400px' : "".concat(p.width, "px");
|
|
24
24
|
});
|
|
25
|
+
DialogWindow.displayName = "DialogWindow";
|
|
25
26
|
export { DialogWindow };
|
|
26
27
|
var templateObject_1, templateObject_2;
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
export { Dialog } from './Dialog';
|
|
1
|
+
export { Dialog, IDialogProps } from './Dialog';
|
|
2
|
+
export { IAlertDialogProps } from './AlertDialog';
|
|
3
|
+
export { IConfirmDialogProps } from './ConfirmDialog';
|
|
4
|
+
export { IXhrDialogProps } from './XhrDialog';
|
|
5
|
+
export { IDialogHeaderProps } from './DialogHeader';
|
|
6
|
+
export { IDialogContentProps } from './DialogContent';
|
|
7
|
+
export { IDialogFooterProps } from './DialogFooter';
|
package/svg/icons/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare enum Icons {
|
|
|
22
22
|
Download = "/aquaui-sprites.svg#icon-download",
|
|
23
23
|
Edit = "/aquaui-sprites.svg#icon-edit",
|
|
24
24
|
Ellipsis = "/aquaui-sprites.svg#icon-ellipsis",
|
|
25
|
+
Eyedropper = "/aquaui-sprites.svg#icon-eyedropper",
|
|
25
26
|
Expand = "/aquaui-sprites.svg#icon-expand",
|
|
26
27
|
Export = "/aquaui-sprites.svg#icon-export",
|
|
27
28
|
Extents = "/aquaui-sprites.svg#icon-extents",
|
package/svg/icons/index.js
CHANGED
|
@@ -23,6 +23,7 @@ export var Icons;
|
|
|
23
23
|
Icons["Download"] = "/aquaui-sprites.svg#icon-download";
|
|
24
24
|
Icons["Edit"] = "/aquaui-sprites.svg#icon-edit";
|
|
25
25
|
Icons["Ellipsis"] = "/aquaui-sprites.svg#icon-ellipsis";
|
|
26
|
+
Icons["Eyedropper"] = "/aquaui-sprites.svg#icon-eyedropper";
|
|
26
27
|
Icons["Expand"] = "/aquaui-sprites.svg#icon-expand";
|
|
27
28
|
Icons["Export"] = "/aquaui-sprites.svg#icon-export";
|
|
28
29
|
Icons["Extents"] = "/aquaui-sprites.svg#icon-extents";
|