@lateralus-ai/shipping-ui 1.4.12 → 1.4.14

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 (64) hide show
  1. package/README.md +108 -108
  2. package/dist/index.cjs +38 -38
  3. package/dist/index.esm.js +4936 -4913
  4. package/dist/tailwind-theme.d.ts +12 -0
  5. package/package.json +99 -99
  6. package/src/components/DocumentEditor/DocumentEditor.tsx +871 -871
  7. package/src/components/HelloWorld.tsx +3 -3
  8. package/src/components/InputPrompt.tsx +96 -96
  9. package/src/components/ModalPanel.tsx +49 -49
  10. package/src/components/PdfViewer/ImageViewer.tsx +211 -211
  11. package/src/components/PdfViewer/PdfViewer.tsx +232 -209
  12. package/src/components/PdfViewer/index.ts +2 -2
  13. package/src/components/PdfViewer/usePageManagement.ts +32 -32
  14. package/src/components/PdfViewer/usePanning.ts +42 -42
  15. package/src/components/PdfViewer/useRefDimensions.ts +16 -16
  16. package/src/components/PdfViewer/useRotation.ts +13 -13
  17. package/src/components/PdfViewer/useZoom.ts +26 -26
  18. package/src/components/SearchModal.tsx +320 -320
  19. package/src/components/Sidebar/Button.tsx +20 -20
  20. package/src/components/Sidebar/Container.tsx +31 -31
  21. package/src/components/Sidebar/Item.tsx +39 -39
  22. package/src/components/Sidebar/Layout.tsx +32 -32
  23. package/src/components/Sidebar/Provider.tsx +47 -47
  24. package/src/components/Sidebar/SecondaryItem.tsx +39 -39
  25. package/src/components/Sidebar/SideContainer.tsx +31 -31
  26. package/src/components/Sidebar/ToggleCollapseButton.tsx +24 -24
  27. package/src/components/Sidebar/index.ts +8 -8
  28. package/src/components/Tabs.tsx +43 -43
  29. package/src/components/icons/CloseSidebarIcon.tsx +19 -19
  30. package/src/components/icons/CloseSidebarMidIcon.tsx +19 -19
  31. package/src/components/icons/ExpandIcon.tsx +21 -21
  32. package/src/components/icons/SendArrowIcon.tsx +23 -23
  33. package/src/components/icons/SendArrowIconGreen.tsx +17 -17
  34. package/src/components/icons/SettingsIcon.tsx +33 -33
  35. package/src/components/icons/XIcon.tsx +21 -21
  36. package/src/components/index.ts +6 -6
  37. package/src/index.ts +4 -4
  38. package/src/material-theme.ts +477 -477
  39. package/src/stories/Buttons.stories.tsx +15 -15
  40. package/src/stories/Buttons.tsx +52 -52
  41. package/src/stories/Checkbox.stories.tsx +15 -15
  42. package/src/stories/Checkbox.tsx +56 -56
  43. package/src/stories/ColorPalette.stories.tsx +15 -15
  44. package/src/stories/ColorPalette.tsx +85 -72
  45. package/src/stories/DocumentEditor.stories.tsx +287 -287
  46. package/src/stories/Dropdowns.stories.tsx +15 -15
  47. package/src/stories/Dropdowns.tsx +52 -52
  48. package/src/stories/InputPrompt.stories.tsx +15 -15
  49. package/src/stories/InputPrompt.tsx +63 -63
  50. package/src/stories/ModalHeader.stories.tsx +35 -35
  51. package/src/stories/PDFViewer.stories.tsx +39 -39
  52. package/src/stories/SearchModal.stories.tsx +132 -132
  53. package/src/stories/SearchModal.tsx +82 -82
  54. package/src/stories/Sidebar.stories.tsx +15 -15
  55. package/src/stories/Sidebar.tsx +108 -108
  56. package/src/stories/Tabs.stories.tsx +51 -51
  57. package/src/stories/Typography.stories.tsx +15 -15
  58. package/src/stories/Typography.tsx +110 -110
  59. package/src/style.css +2 -2
  60. package/src/styles/tabs.css +55 -55
  61. package/src/tailwind-theme.ts +243 -231
  62. package/src/types/documentEditor.ts +55 -55
  63. package/src/utils/checkboxModule.ts +241 -241
  64. package/src/utils/cn.ts +11 -11
@@ -1,287 +1,287 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import { DocumentEditor } from "../components/DocumentEditor";
3
- import type { Schema } from "../types/documentEditor";
4
-
5
- // Sample schema based on the defect report form
6
- const sampleSchema: Schema = {
7
- type: "object",
8
- properties: {
9
- shipName: {
10
- type: "string",
11
- description: "Name of the ship",
12
- },
13
- reportDate: {
14
- type: "string",
15
- format: "date",
16
- description: "Date of the report",
17
- },
18
- reportNo: {
19
- type: "string",
20
- description: "Report number",
21
- },
22
- malfunctionDateTime: {
23
- type: "string",
24
- format: "date",
25
- description: "Date the malfunction occurred",
26
- },
27
- malfunctionDescription: {
28
- type: "string",
29
- description: "Description of the malfunction or defect",
30
- },
31
- isCriticalEquipment: {
32
- type: "boolean",
33
- description: "Whether the equipment referenced is critical",
34
- docx_mapping: {
35
- type: "checkbox",
36
- true_name: "Check1",
37
- false_name: "Check2",
38
- },
39
- },
40
- equipmentManufacturer: {
41
- type: "string",
42
- description: "The malfunctioning equipment manufacturer",
43
- },
44
- equipmentModel: {
45
- type: "string",
46
- description: "The malfunctioning equipment model",
47
- },
48
- equipmentSerial: {
49
- type: "string",
50
- description: "The malfunctioning equipment serial number",
51
- },
52
- equipmentManufacturerModelSerial: {
53
- type: "string",
54
- description: "Manufacturer, model, type, and serial number",
55
- },
56
- consequences: {
57
- type: "string",
58
- description: "Consequences of the malfunction",
59
- },
60
- rootCause: {
61
- type: "string",
62
- description: "Root cause of the defect (if known)",
63
- },
64
- actionsTaken: {
65
- type: "string",
66
- description: "Actions taken or suggestions for corrective actions",
67
- },
68
- isShoreAssistanceRequired: {
69
- type: "boolean",
70
- description: "Whether shore assistance is required",
71
- docx_mapping: {
72
- type: "checkbox",
73
- true_name: "Check3",
74
- false_name: "Check4",
75
- },
76
- },
77
- shoreAssistanceRequisition: {
78
- type: "string",
79
- description: "Requisition details for shore assistance",
80
- },
81
- isEquipmentLandedAshore: {
82
- type: "boolean",
83
- description: "Whether equipment/machinery was landed ashore",
84
- docx_mapping: {
85
- type: "checkbox",
86
- true_name: "Check5",
87
- false_name: "Check6",
88
- },
89
- },
90
- equipmentLandedRequisition: {
91
- type: "string",
92
- description: "Requisition details for equipment landed ashore",
93
- },
94
- areSparesAvailableOnboard: {
95
- type: "boolean",
96
- description: "Whether required spare parts are available onboard",
97
- docx_mapping: {
98
- type: "checkbox",
99
- true_name: "Check7",
100
- false_name: "Check8",
101
- },
102
- },
103
- sparesAvailableRequisition: {
104
- type: "string",
105
- description: "Requisition details if spares are available onboard",
106
- },
107
- isNextDryDock: {
108
- type: "boolean",
109
- description: "If it's going to close out in next dry dock",
110
- docx_mapping: {
111
- type: "checkbox",
112
- true_name: "Check9",
113
- false_name: "Check10",
114
- },
115
- },
116
- proposedCompletionDate: {
117
- type: "string",
118
- format: "date",
119
- description: "Proposed date for completion",
120
- },
121
- chiefEngineerName: {
122
- type: "string",
123
- description: "Name of the Chief Engineer",
124
- },
125
- chiefEngineerSignature: {
126
- type: "string",
127
- description: "Signature of the Chief Engineer (surname only)",
128
- },
129
- chiefEngineerDate: {
130
- type: "string",
131
- format: "date",
132
- description: "Date signed by the Chief Engineer",
133
- },
134
- masterName: {
135
- type: "string",
136
- description: "Name of the Master",
137
- },
138
- masterSignature: {
139
- type: "string",
140
- description: "Signature of the Master (surname only)",
141
- },
142
- masterDate: {
143
- type: "string",
144
- format: "date",
145
- description: "Date signed by the Master",
146
- },
147
- },
148
- required: [],
149
- };
150
-
151
- // Sample initial data for demonstration
152
- const sampleInitialData = {
153
- shipName: "MV Excellence",
154
- reportNo: "DR-2024-001",
155
- reportDate: "2024-03-15",
156
- malfunctionDateTime: "2024-03-14",
157
- malfunctionDescription:
158
- "Main engine turbocharger failure during normal operation",
159
- isCriticalEquipment: true,
160
- equipmentManufacturer: "ABB",
161
- equipmentModel: "TPL 85-B",
162
- equipmentSerial: "TC-12345-2020",
163
- consequences: "Reduced engine power, speed limited to 10 knots",
164
- rootCause: "Bearing failure due to inadequate lubrication",
165
- actionsTaken:
166
- "Turbocharger isolated, vessel proceeding at reduced speed to nearest port",
167
- isShoreAssistanceRequired: true,
168
- shoreAssistanceRequisition:
169
- "Service engineer required for turbocharger overhaul",
170
- isEquipmentLandedAshore: false,
171
- areSparesAvailableOnboard: false,
172
- isNextDryDock: false,
173
- proposedCompletionDate: "2024-03-20",
174
- };
175
-
176
- const DocumentEditorWrapper = () => {
177
- const handleDataChange = (data: Record<string, any>) => {
178
- console.log("Data changed:", data);
179
- };
180
-
181
- return (
182
- <div className="w-full max-w-6xl mx-auto p-4">
183
- <DocumentEditor
184
- docxUrl="/sample-document.docx"
185
- schema={sampleSchema}
186
- onDataChange={handleDataChange}
187
- initialData={sampleInitialData}
188
- readonly={false}
189
- />
190
- </div>
191
- );
192
- };
193
-
194
- const meta = {
195
- title: "Design System/DocumentEditor",
196
- component: DocumentEditorWrapper,
197
- parameters: {
198
- layout: "fullscreen",
199
- docs: {
200
- description: {
201
- component: `
202
- The DocumentEditor component provides an interactive Word document editor with inline field editing capabilities.
203
-
204
- ## Features
205
- - Renders Word documents using docx-preview
206
- - Supports inline editing with various field types (text, boolean, date, dropdown)
207
- - Tracks field changes with visual color coding
208
- - Handles checkbox patterns (single, dual Yes/No, radio buttons)
209
- - Preserves document formatting and layout
210
-
211
- ## Usage
212
- \`\`\`tsx
213
- import { DocumentEditor } from '@lateralus-ai/shipping-ui';
214
-
215
- <DocumentEditor
216
- docxUrl="/path/to/document.docx"
217
- schema={documentSchema}
218
- onDataChange={(data) => console.log(data)}
219
- initialData={initialValues}
220
- readonly={false}
221
- />
222
- \`\`\`
223
- `,
224
- },
225
- },
226
- },
227
- tags: ["autodocs"],
228
- argTypes: {
229
- docxUrl: {
230
- control: "text",
231
- description: "URL to the DOCX document template",
232
- },
233
- readonly: {
234
- control: "boolean",
235
- description: "Whether the document is in read-only mode",
236
- },
237
- },
238
- } satisfies Meta<typeof DocumentEditorWrapper>;
239
-
240
- export default meta;
241
- type Story = StoryObj<typeof meta>;
242
-
243
- export const Default: Story = {
244
- render: () => {
245
- return (
246
- <div className="w-full max-w-6xl mx-auto p-4">
247
- <DocumentEditor
248
- docxUrl="/sample-document.docx"
249
- schema={sampleSchema}
250
- initialData={sampleInitialData}
251
- onDataChange={(data) => console.log(data)}
252
- />
253
- </div>
254
- );
255
- },
256
- };
257
-
258
- export const ReadOnly: Story = {
259
- render: () => {
260
- return (
261
- <div className="w-full max-w-6xl mx-auto p-4">
262
- <DocumentEditor
263
- docxUrl="/sample-document.docx"
264
- schema={sampleSchema}
265
- initialData={sampleInitialData}
266
- readonly={true}
267
- />
268
- </div>
269
- );
270
- },
271
- };
272
-
273
- export const Empty: Story = {
274
- render: () => {
275
- return (
276
- <div className="w-full max-w-6xl mx-auto p-4">
277
- <DocumentEditor
278
- docxUrl="/sample-document.docx"
279
- schema={sampleSchema}
280
- initialData={{}}
281
- readonly={false}
282
- onDataChange={(data) => console.log(data)}
283
- />
284
- </div>
285
- );
286
- },
287
- };
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { DocumentEditor } from "../components/DocumentEditor";
3
+ import type { Schema } from "../types/documentEditor";
4
+
5
+ // Sample schema based on the defect report form
6
+ const sampleSchema: Schema = {
7
+ type: "object",
8
+ properties: {
9
+ shipName: {
10
+ type: "string",
11
+ description: "Name of the ship",
12
+ },
13
+ reportDate: {
14
+ type: "string",
15
+ format: "date",
16
+ description: "Date of the report",
17
+ },
18
+ reportNo: {
19
+ type: "string",
20
+ description: "Report number",
21
+ },
22
+ malfunctionDateTime: {
23
+ type: "string",
24
+ format: "date",
25
+ description: "Date the malfunction occurred",
26
+ },
27
+ malfunctionDescription: {
28
+ type: "string",
29
+ description: "Description of the malfunction or defect",
30
+ },
31
+ isCriticalEquipment: {
32
+ type: "boolean",
33
+ description: "Whether the equipment referenced is critical",
34
+ docx_mapping: {
35
+ type: "checkbox",
36
+ true_name: "Check1",
37
+ false_name: "Check2",
38
+ },
39
+ },
40
+ equipmentManufacturer: {
41
+ type: "string",
42
+ description: "The malfunctioning equipment manufacturer",
43
+ },
44
+ equipmentModel: {
45
+ type: "string",
46
+ description: "The malfunctioning equipment model",
47
+ },
48
+ equipmentSerial: {
49
+ type: "string",
50
+ description: "The malfunctioning equipment serial number",
51
+ },
52
+ equipmentManufacturerModelSerial: {
53
+ type: "string",
54
+ description: "Manufacturer, model, type, and serial number",
55
+ },
56
+ consequences: {
57
+ type: "string",
58
+ description: "Consequences of the malfunction",
59
+ },
60
+ rootCause: {
61
+ type: "string",
62
+ description: "Root cause of the defect (if known)",
63
+ },
64
+ actionsTaken: {
65
+ type: "string",
66
+ description: "Actions taken or suggestions for corrective actions",
67
+ },
68
+ isShoreAssistanceRequired: {
69
+ type: "boolean",
70
+ description: "Whether shore assistance is required",
71
+ docx_mapping: {
72
+ type: "checkbox",
73
+ true_name: "Check3",
74
+ false_name: "Check4",
75
+ },
76
+ },
77
+ shoreAssistanceRequisition: {
78
+ type: "string",
79
+ description: "Requisition details for shore assistance",
80
+ },
81
+ isEquipmentLandedAshore: {
82
+ type: "boolean",
83
+ description: "Whether equipment/machinery was landed ashore",
84
+ docx_mapping: {
85
+ type: "checkbox",
86
+ true_name: "Check5",
87
+ false_name: "Check6",
88
+ },
89
+ },
90
+ equipmentLandedRequisition: {
91
+ type: "string",
92
+ description: "Requisition details for equipment landed ashore",
93
+ },
94
+ areSparesAvailableOnboard: {
95
+ type: "boolean",
96
+ description: "Whether required spare parts are available onboard",
97
+ docx_mapping: {
98
+ type: "checkbox",
99
+ true_name: "Check7",
100
+ false_name: "Check8",
101
+ },
102
+ },
103
+ sparesAvailableRequisition: {
104
+ type: "string",
105
+ description: "Requisition details if spares are available onboard",
106
+ },
107
+ isNextDryDock: {
108
+ type: "boolean",
109
+ description: "If it's going to close out in next dry dock",
110
+ docx_mapping: {
111
+ type: "checkbox",
112
+ true_name: "Check9",
113
+ false_name: "Check10",
114
+ },
115
+ },
116
+ proposedCompletionDate: {
117
+ type: "string",
118
+ format: "date",
119
+ description: "Proposed date for completion",
120
+ },
121
+ chiefEngineerName: {
122
+ type: "string",
123
+ description: "Name of the Chief Engineer",
124
+ },
125
+ chiefEngineerSignature: {
126
+ type: "string",
127
+ description: "Signature of the Chief Engineer (surname only)",
128
+ },
129
+ chiefEngineerDate: {
130
+ type: "string",
131
+ format: "date",
132
+ description: "Date signed by the Chief Engineer",
133
+ },
134
+ masterName: {
135
+ type: "string",
136
+ description: "Name of the Master",
137
+ },
138
+ masterSignature: {
139
+ type: "string",
140
+ description: "Signature of the Master (surname only)",
141
+ },
142
+ masterDate: {
143
+ type: "string",
144
+ format: "date",
145
+ description: "Date signed by the Master",
146
+ },
147
+ },
148
+ required: [],
149
+ };
150
+
151
+ // Sample initial data for demonstration
152
+ const sampleInitialData = {
153
+ shipName: "MV Excellence",
154
+ reportNo: "DR-2024-001",
155
+ reportDate: "2024-03-15",
156
+ malfunctionDateTime: "2024-03-14",
157
+ malfunctionDescription:
158
+ "Main engine turbocharger failure during normal operation",
159
+ isCriticalEquipment: true,
160
+ equipmentManufacturer: "ABB",
161
+ equipmentModel: "TPL 85-B",
162
+ equipmentSerial: "TC-12345-2020",
163
+ consequences: "Reduced engine power, speed limited to 10 knots",
164
+ rootCause: "Bearing failure due to inadequate lubrication",
165
+ actionsTaken:
166
+ "Turbocharger isolated, vessel proceeding at reduced speed to nearest port",
167
+ isShoreAssistanceRequired: true,
168
+ shoreAssistanceRequisition:
169
+ "Service engineer required for turbocharger overhaul",
170
+ isEquipmentLandedAshore: false,
171
+ areSparesAvailableOnboard: false,
172
+ isNextDryDock: false,
173
+ proposedCompletionDate: "2024-03-20",
174
+ };
175
+
176
+ const DocumentEditorWrapper = () => {
177
+ const handleDataChange = (data: Record<string, any>) => {
178
+ console.log("Data changed:", data);
179
+ };
180
+
181
+ return (
182
+ <div className="w-full max-w-6xl mx-auto p-4">
183
+ <DocumentEditor
184
+ docxUrl="/sample-document.docx"
185
+ schema={sampleSchema}
186
+ onDataChange={handleDataChange}
187
+ initialData={sampleInitialData}
188
+ readonly={false}
189
+ />
190
+ </div>
191
+ );
192
+ };
193
+
194
+ const meta = {
195
+ title: "Design System/DocumentEditor",
196
+ component: DocumentEditorWrapper,
197
+ parameters: {
198
+ layout: "fullscreen",
199
+ docs: {
200
+ description: {
201
+ component: `
202
+ The DocumentEditor component provides an interactive Word document editor with inline field editing capabilities.
203
+
204
+ ## Features
205
+ - Renders Word documents using docx-preview
206
+ - Supports inline editing with various field types (text, boolean, date, dropdown)
207
+ - Tracks field changes with visual color coding
208
+ - Handles checkbox patterns (single, dual Yes/No, radio buttons)
209
+ - Preserves document formatting and layout
210
+
211
+ ## Usage
212
+ \`\`\`tsx
213
+ import { DocumentEditor } from '@lateralus-ai/shipping-ui';
214
+
215
+ <DocumentEditor
216
+ docxUrl="/path/to/document.docx"
217
+ schema={documentSchema}
218
+ onDataChange={(data) => console.log(data)}
219
+ initialData={initialValues}
220
+ readonly={false}
221
+ />
222
+ \`\`\`
223
+ `,
224
+ },
225
+ },
226
+ },
227
+ tags: ["autodocs"],
228
+ argTypes: {
229
+ docxUrl: {
230
+ control: "text",
231
+ description: "URL to the DOCX document template",
232
+ },
233
+ readonly: {
234
+ control: "boolean",
235
+ description: "Whether the document is in read-only mode",
236
+ },
237
+ },
238
+ } satisfies Meta<typeof DocumentEditorWrapper>;
239
+
240
+ export default meta;
241
+ type Story = StoryObj<typeof meta>;
242
+
243
+ export const Default: Story = {
244
+ render: () => {
245
+ return (
246
+ <div className="w-full max-w-6xl mx-auto p-4">
247
+ <DocumentEditor
248
+ docxUrl="/sample-document.docx"
249
+ schema={sampleSchema}
250
+ initialData={sampleInitialData}
251
+ onDataChange={(data) => console.log(data)}
252
+ />
253
+ </div>
254
+ );
255
+ },
256
+ };
257
+
258
+ export const ReadOnly: Story = {
259
+ render: () => {
260
+ return (
261
+ <div className="w-full max-w-6xl mx-auto p-4">
262
+ <DocumentEditor
263
+ docxUrl="/sample-document.docx"
264
+ schema={sampleSchema}
265
+ initialData={sampleInitialData}
266
+ readonly={true}
267
+ />
268
+ </div>
269
+ );
270
+ },
271
+ };
272
+
273
+ export const Empty: Story = {
274
+ render: () => {
275
+ return (
276
+ <div className="w-full max-w-6xl mx-auto p-4">
277
+ <DocumentEditor
278
+ docxUrl="/sample-document.docx"
279
+ schema={sampleSchema}
280
+ initialData={{}}
281
+ readonly={false}
282
+ onDataChange={(data) => console.log(data)}
283
+ />
284
+ </div>
285
+ );
286
+ },
287
+ };
@@ -1,15 +1,15 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import { Dropdowns } from "./Dropdowns";
3
-
4
- const meta = {
5
- title: "Design System/Dropdowns",
6
- component: Dropdowns,
7
- parameters: {
8
- layout: "fullscreen",
9
- },
10
- } satisfies Meta<typeof Dropdowns>;
11
-
12
- export default meta;
13
- type Story = StoryObj<typeof meta>;
14
-
15
- export const Default: Story = {};
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { Dropdowns } from "./Dropdowns";
3
+
4
+ const meta = {
5
+ title: "Design System/Dropdowns",
6
+ component: Dropdowns,
7
+ parameters: {
8
+ layout: "fullscreen",
9
+ },
10
+ } satisfies Meta<typeof Dropdowns>;
11
+
12
+ export default meta;
13
+ type Story = StoryObj<typeof meta>;
14
+
15
+ export const Default: Story = {};