@dxos/plugin-status-bar 0.6.13 → 0.6.14-main.69511f5
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/lib/browser/chunk-4KDZC7WS.mjs +14 -0
- package/dist/lib/browser/chunk-4KDZC7WS.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +32 -137
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/types/src/components/FeedbackForm.d.ts.map +1 -1
- package/dist/types/src/components/StatusBar.d.ts.map +1 -1
- package/dist/types/src/components/StatusBar.stories.d.ts +6 -47
- package/dist/types/src/components/StatusBar.stories.d.ts.map +1 -1
- package/dist/types/src/components/StatusBarPanel.d.ts +3 -0
- package/dist/types/src/components/StatusBarPanel.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +3 -9
- package/dist/types/src/meta.d.ts.map +1 -1
- package/package.json +20 -22
- package/src/StatusBarPlugin.tsx +2 -2
- package/src/components/FeedbackForm.tsx +8 -9
- package/src/components/StatusBar.stories.tsx +33 -28
- package/src/components/StatusBar.tsx +3 -2
- package/src/components/{StatusBarImpl.tsx → StatusBarPanel.tsx} +4 -6
- package/src/components/index.ts +1 -1
- package/src/meta.ts +14 -0
- package/dist/lib/browser/chunk-PL5XPTPX.mjs +0 -18
- package/dist/lib/browser/chunk-PL5XPTPX.mjs.map +0 -7
- package/dist/types/src/components/StatusBarImpl.d.ts +0 -3
- package/dist/types/src/components/StatusBarImpl.d.ts.map +0 -1
- package/dist/types/src/hooks/index.d.ts +0 -2
- package/dist/types/src/hooks/index.d.ts.map +0 -1
- package/dist/types/src/hooks/useForm.d.ts +0 -36
- package/dist/types/src/hooks/useForm.d.ts.map +0 -1
- package/dist/types/src/util/index.d.ts +0 -2
- package/dist/types/src/util/index.d.ts.map +0 -1
- package/dist/types/src/util/validation.d.ts +0 -7
- package/dist/types/src/util/validation.d.ts.map +0 -1
- package/src/hooks/index.ts +0 -5
- package/src/hooks/useForm.ts +0 -119
- package/src/meta.tsx +0 -18
- package/src/util/index.ts +0 -5
- package/src/util/validation.ts +0 -22
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// packages/plugins/plugin-status-bar/src/meta.ts
|
|
2
|
+
var STATUS_BAR_PLUGIN = "dxos.org/plugin/status-bar";
|
|
3
|
+
var meta_default = {
|
|
4
|
+
id: STATUS_BAR_PLUGIN,
|
|
5
|
+
name: "Status Bar",
|
|
6
|
+
description: "Display a bar with status and actions.",
|
|
7
|
+
icon: "ph--info--regular"
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
STATUS_BAR_PLUGIN,
|
|
12
|
+
meta_default
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=chunk-4KDZC7WS.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const STATUS_BAR_PLUGIN = 'dxos.org/plugin/status-bar';\n\nexport default {\n id: STATUS_BAR_PLUGIN,\n name: 'Status Bar',\n description: 'Display a bar with status and actions.',\n icon: 'ph--info--regular',\n} satisfies PluginMeta;\n"],
|
|
5
|
+
"mappings": ";AAMO,IAAMA,oBAAoB;AAEjC,IAAA,eAAe;EACbC,IAAID;EACJE,MAAM;EACNC,aAAa;EACbC,MAAM;AACR;",
|
|
6
|
+
"names": ["STATUS_BAR_PLUGIN", "id", "name", "description", "icon"]
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
STATUS_BAR_PLUGIN,
|
|
3
3
|
meta_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4KDZC7WS.mjs";
|
|
5
5
|
|
|
6
6
|
// packages/plugins/plugin-status-bar/src/StatusBarPlugin.tsx
|
|
7
7
|
import React4 from "react";
|
|
@@ -42,7 +42,7 @@ var StatusBarContainer = /* @__PURE__ */ forwardRef(({ classNames, children }, f
|
|
|
42
42
|
role: "menubar",
|
|
43
43
|
tabIndex: 0,
|
|
44
44
|
...groupAttrs,
|
|
45
|
-
className: mx("bs-[--statusbar-size] flex justify-end items-center gap-2
|
|
45
|
+
className: mx("bs-[--statusbar-size] flex justify-end items-center gap-2 bg-base text-description text-lg pointer-fine:text-xs ch-focus-ring-inset", classNames),
|
|
46
46
|
ref: forwardedRef
|
|
47
47
|
}, children);
|
|
48
48
|
});
|
|
@@ -65,112 +65,20 @@ var StatusBar = {
|
|
|
65
65
|
EndContent
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
// packages/plugins/plugin-status-bar/src/components/
|
|
69
|
-
import
|
|
70
|
-
import React3, { useState as useState2 } from "react";
|
|
68
|
+
// packages/plugins/plugin-status-bar/src/components/StatusBarPanel.tsx
|
|
69
|
+
import React3, { useState } from "react";
|
|
71
70
|
import { Surface } from "@dxos/app-framework";
|
|
72
|
-
import { Popover as Popover2 } from "@dxos/react-ui";
|
|
71
|
+
import { Icon, Popover as Popover2 } from "@dxos/react-ui";
|
|
73
72
|
|
|
74
73
|
// packages/plugins/plugin-status-bar/src/components/FeedbackForm.tsx
|
|
75
|
-
import {
|
|
76
|
-
import
|
|
74
|
+
import { Schema as S } from "@effect/schema";
|
|
75
|
+
import { PaperPlaneTilt, X } from "@phosphor-icons/react";
|
|
76
|
+
import React2, { useCallback } from "react";
|
|
77
77
|
import { useIntentDispatcher } from "@dxos/app-framework";
|
|
78
|
-
import { S as S2 } from "@dxos/echo-schema";
|
|
79
78
|
import { Button, Input, Popover, useTranslation } from "@dxos/react-ui";
|
|
79
|
+
import { useForm } from "@dxos/react-ui-data";
|
|
80
80
|
import { getSize } from "@dxos/react-ui-theme";
|
|
81
81
|
|
|
82
|
-
// packages/plugins/plugin-status-bar/src/hooks/useForm.ts
|
|
83
|
-
import { useCallback, useState } from "react";
|
|
84
|
-
var useForm = ({ initialValues: initialValues2, validate: validate2, onSubmit }) => {
|
|
85
|
-
const [values, setValues] = useState(initialValues2);
|
|
86
|
-
const [errors, setErrors] = useState({});
|
|
87
|
-
const [touched, setTouched] = useState(Object.keys(initialValues2).reduce((acc, key) => ({
|
|
88
|
-
...acc,
|
|
89
|
-
[key]: false
|
|
90
|
-
}), {}));
|
|
91
|
-
const runValidation = useCallback((values2) => {
|
|
92
|
-
const validationErrors = validate2(values2);
|
|
93
|
-
setErrors(collapseErrorArray(validationErrors ?? []));
|
|
94
|
-
return validationErrors === void 0;
|
|
95
|
-
}, [
|
|
96
|
-
validate2
|
|
97
|
-
]);
|
|
98
|
-
const handleChange = useCallback((event) => {
|
|
99
|
-
const { name, value } = event.target;
|
|
100
|
-
const newValues = {
|
|
101
|
-
...values,
|
|
102
|
-
[name]: value
|
|
103
|
-
};
|
|
104
|
-
setValues(newValues);
|
|
105
|
-
runValidation(newValues);
|
|
106
|
-
}, [
|
|
107
|
-
values,
|
|
108
|
-
runValidation
|
|
109
|
-
]);
|
|
110
|
-
const touchAll = useCallback(() => setTouched(mkAllTouched(values)), [
|
|
111
|
-
values,
|
|
112
|
-
setTouched
|
|
113
|
-
]);
|
|
114
|
-
const handleBlur = useCallback((event) => {
|
|
115
|
-
const { name } = event.target;
|
|
116
|
-
setTouched((touched2) => ({
|
|
117
|
-
...touched2,
|
|
118
|
-
[name]: true
|
|
119
|
-
}));
|
|
120
|
-
if (event.relatedTarget?.getAttribute("type") === "submit") {
|
|
121
|
-
touchAll();
|
|
122
|
-
}
|
|
123
|
-
runValidation(values);
|
|
124
|
-
}, [
|
|
125
|
-
runValidation,
|
|
126
|
-
values,
|
|
127
|
-
touchAll
|
|
128
|
-
]);
|
|
129
|
-
const handleSubmit = useCallback(() => {
|
|
130
|
-
if (runValidation(values)) {
|
|
131
|
-
onSubmit(values);
|
|
132
|
-
}
|
|
133
|
-
}, [
|
|
134
|
-
values,
|
|
135
|
-
runValidation,
|
|
136
|
-
onSubmit
|
|
137
|
-
]);
|
|
138
|
-
const canSubmit = Object.keys(values).every((key) => touched[key] === false || !errors[key]);
|
|
139
|
-
const getInputProps = useCallback((key) => ({
|
|
140
|
-
name: key,
|
|
141
|
-
value: values[key],
|
|
142
|
-
onChange: handleChange,
|
|
143
|
-
onBlur: handleBlur,
|
|
144
|
-
"aria-invalid": errors[key] !== void 0
|
|
145
|
-
}), [
|
|
146
|
-
values,
|
|
147
|
-
handleChange,
|
|
148
|
-
handleBlur,
|
|
149
|
-
errors
|
|
150
|
-
]);
|
|
151
|
-
return {
|
|
152
|
-
values,
|
|
153
|
-
handleChange,
|
|
154
|
-
handleSubmit,
|
|
155
|
-
errors,
|
|
156
|
-
canSubmit,
|
|
157
|
-
touched,
|
|
158
|
-
handleBlur,
|
|
159
|
-
onValidate: runValidation,
|
|
160
|
-
getInputProps
|
|
161
|
-
};
|
|
162
|
-
};
|
|
163
|
-
var mkAllTouched = (values) => {
|
|
164
|
-
return Object.keys(values).reduce((acc, key) => ({
|
|
165
|
-
...acc,
|
|
166
|
-
[key]: true
|
|
167
|
-
}), {});
|
|
168
|
-
};
|
|
169
|
-
var collapseErrorArray = (errors) => errors.reduce((acc, { path, message }) => {
|
|
170
|
-
acc[path] = message;
|
|
171
|
-
return acc;
|
|
172
|
-
}, {});
|
|
173
|
-
|
|
174
82
|
// packages/plugins/plugin-status-bar/src/translations.ts
|
|
175
83
|
var entry = (translation) => ({
|
|
176
84
|
[STATUS_BAR_PLUGIN]: translation
|
|
@@ -192,41 +100,22 @@ var translations_default = [
|
|
|
192
100
|
translations
|
|
193
101
|
];
|
|
194
102
|
|
|
195
|
-
// packages/plugins/plugin-status-bar/src/util/validation.ts
|
|
196
|
-
import { ArrayFormatter } from "@effect/schema";
|
|
197
|
-
import { Effect } from "effect";
|
|
198
|
-
import { S } from "@dxos/echo-schema";
|
|
199
|
-
var validate = (schema, data) => {
|
|
200
|
-
const validator = S.decodeUnknownEither(schema, {
|
|
201
|
-
errors: "all"
|
|
202
|
-
});
|
|
203
|
-
const result = validator(data);
|
|
204
|
-
if (result._tag === "Left") {
|
|
205
|
-
const errors = Effect.runSync(ArrayFormatter.formatError(result.left));
|
|
206
|
-
return errors.map(({ message, path }) => ({
|
|
207
|
-
message,
|
|
208
|
-
path: path.join(".")
|
|
209
|
-
}));
|
|
210
|
-
}
|
|
211
|
-
return void 0;
|
|
212
|
-
};
|
|
213
|
-
|
|
214
103
|
// packages/plugins/plugin-status-bar/src/components/FeedbackForm.tsx
|
|
215
|
-
var Email =
|
|
104
|
+
var Email = S.String.pipe(S.nonEmptyString({
|
|
216
105
|
message: () => "Email is required."
|
|
217
|
-
}),
|
|
106
|
+
}), S.pattern(/^(?!\.)(?!.*\.\.)([A-Z0-9_+-.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9-]*\.)+[A-Z]{2,}$/i, {
|
|
218
107
|
message: () => "Invalid email address."
|
|
219
108
|
}));
|
|
220
|
-
var nonEmpty = (field) =>
|
|
109
|
+
var nonEmpty = (field) => S.nonEmptyString({
|
|
221
110
|
message: () => `${field} is required.`
|
|
222
111
|
});
|
|
223
|
-
var maxLength = (field, length) =>
|
|
112
|
+
var maxLength = (field, length) => S.maxLength(length, {
|
|
224
113
|
message: () => `${field} is too long.`
|
|
225
114
|
});
|
|
226
|
-
var FeedbackFormSchema =
|
|
227
|
-
name:
|
|
115
|
+
var FeedbackFormSchema = S.Struct({
|
|
116
|
+
name: S.String.pipe(nonEmpty("Name"), maxLength("Name", 256)),
|
|
228
117
|
email: Email.pipe(maxLength("Email", 256)),
|
|
229
|
-
message:
|
|
118
|
+
message: S.String.pipe(nonEmpty("Feedback"), maxLength("Feedback", 32768))
|
|
230
119
|
});
|
|
231
120
|
var initialValues = {
|
|
232
121
|
name: "",
|
|
@@ -237,7 +126,7 @@ var FeedbackForm = ({ onClose }) => {
|
|
|
237
126
|
const { t } = useTranslation(STATUS_BAR_PLUGIN);
|
|
238
127
|
const translation = mkTranslation(t);
|
|
239
128
|
const dispatch = useIntentDispatcher();
|
|
240
|
-
const onSubmit =
|
|
129
|
+
const onSubmit = useCallback((values) => {
|
|
241
130
|
void dispatch({
|
|
242
131
|
action: "dxos.org/plugin/observability/capture-feedback",
|
|
243
132
|
data: values
|
|
@@ -249,8 +138,8 @@ var FeedbackForm = ({ onClose }) => {
|
|
|
249
138
|
]);
|
|
250
139
|
const { errors, handleSubmit, canSubmit, touched, getInputProps } = useForm({
|
|
251
140
|
initialValues,
|
|
252
|
-
|
|
253
|
-
onSubmit
|
|
141
|
+
schema: FeedbackFormSchema,
|
|
142
|
+
onSubmit
|
|
254
143
|
});
|
|
255
144
|
return /* @__PURE__ */ React2.createElement("div", {
|
|
256
145
|
role: "form",
|
|
@@ -311,9 +200,9 @@ var FeedbackForm = ({ onClose }) => {
|
|
|
311
200
|
})))));
|
|
312
201
|
};
|
|
313
202
|
|
|
314
|
-
// packages/plugins/plugin-status-bar/src/components/
|
|
315
|
-
var
|
|
316
|
-
const [open, setOpen] =
|
|
203
|
+
// packages/plugins/plugin-status-bar/src/components/StatusBarPanel.tsx
|
|
204
|
+
var StatusBarPanel = () => {
|
|
205
|
+
const [open, setOpen] = useState(false);
|
|
317
206
|
return /* @__PURE__ */ React3.createElement(Popover2.Root, {
|
|
318
207
|
open,
|
|
319
208
|
onOpenChange: setOpen
|
|
@@ -322,7 +211,10 @@ var StatusBarImpl = () => {
|
|
|
322
211
|
}, /* @__PURE__ */ React3.createElement(StatusBar.Button, {
|
|
323
212
|
"aria-label": "Give feedback about composer",
|
|
324
213
|
"data-joyride": "welcome/feedback"
|
|
325
|
-
}, /* @__PURE__ */ React3.createElement(
|
|
214
|
+
}, /* @__PURE__ */ React3.createElement(Icon, {
|
|
215
|
+
icon: "ph--paper-plane-tilt--regular",
|
|
216
|
+
size: 4
|
|
217
|
+
}), /* @__PURE__ */ React3.createElement(StatusBar.Text, {
|
|
326
218
|
classNames: "hidden sm:block"
|
|
327
219
|
}, "Feedback"))), /* @__PURE__ */ React3.createElement(StatusBar.Button, {
|
|
328
220
|
"aria-label": "Open DXOS Discord",
|
|
@@ -331,7 +223,10 @@ var StatusBarImpl = () => {
|
|
|
331
223
|
href: "https://dxos.org/discord",
|
|
332
224
|
target: "_blank",
|
|
333
225
|
rel: "noopener noreferrer"
|
|
334
|
-
}, /* @__PURE__ */ React3.createElement(
|
|
226
|
+
}, /* @__PURE__ */ React3.createElement(Icon, {
|
|
227
|
+
icon: "ph--discord-logo--regular",
|
|
228
|
+
size: 4
|
|
229
|
+
}), /* @__PURE__ */ React3.createElement(StatusBar.Text, {
|
|
335
230
|
classNames: "hidden sm:block"
|
|
336
231
|
}, "Discord")))), /* @__PURE__ */ React3.createElement(Surface, {
|
|
337
232
|
role: "status"
|
|
@@ -352,7 +247,7 @@ var StatusBarPlugin = () => {
|
|
|
352
247
|
component: ({ role }) => {
|
|
353
248
|
switch (role) {
|
|
354
249
|
case "status-bar": {
|
|
355
|
-
return /* @__PURE__ */ React4.createElement(
|
|
250
|
+
return /* @__PURE__ */ React4.createElement(StatusBarPanel, null);
|
|
356
251
|
}
|
|
357
252
|
}
|
|
358
253
|
return null;
|
|
@@ -366,7 +261,7 @@ var StatusBarPlugin = () => {
|
|
|
366
261
|
var src_default = StatusBarPlugin;
|
|
367
262
|
export {
|
|
368
263
|
StatusBar,
|
|
369
|
-
|
|
264
|
+
StatusBarPanel,
|
|
370
265
|
StatusBarPlugin,
|
|
371
266
|
src_default as default
|
|
372
267
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/StatusBarPlugin.tsx", "../../../src/components/StatusBar.tsx", "../../../src/components/
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type PluginDefinition, type SurfaceProvides, type TranslationsProvides } from '@dxos/app-framework';\n\nimport { StatusBarImpl } from './components';\nimport meta from './meta';\nimport translations from './translations';\n\nexport type StatusBarPluginProvides = SurfaceProvides & TranslationsProvides;\n\nexport const StatusBarPlugin = (): PluginDefinition<StatusBarPluginProvides> => {\n return {\n meta,\n provides: {\n translations,\n surface: {\n component: ({ role }) => {\n switch (role) {\n case 'status-bar': {\n return <StatusBarImpl />;\n }\n }\n\n return null;\n },\n },\n },\n };\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { Slot } from '@radix-ui/react-slot';\nimport React, { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\ntype StatusBarTextProps = ThemedClassName<{ children: ReactNode }>;\n\nconst StatusBarText = forwardRef<HTMLSpanElement, StatusBarTextProps>(({ classNames, children }, forwardedRef) => (\n <span className={mx(classNames)} ref={forwardedRef}>\n {children}\n </span>\n));\n\ntype StatusBarButtonProps = ThemedClassName<{ children: ReactNode; asChild?: boolean }> &\n HTMLAttributes<HTMLButtonElement>;\n\nconst StatusBarButton = forwardRef<HTMLButtonElement, StatusBarButtonProps>(\n ({ classNames, children, asChild, ...props }, forwardedRef) => {\n const classes = mx(\n 'flex items-center gap-2 p-1 px-2 rounded-sm',\n 'select-none cursor-pointer ch-focus-ring',\n 'hover:bg-neutral-75 active:bg-neutral-150 dark:hover:bg-neutral-750 dark:active:bg-neutral-700',\n classNames,\n );\n\n return asChild ? (\n <Slot role='button' ref={forwardedRef} className={classes} {...props}>\n {children}\n </Slot>\n ) : (\n <button className={classes} ref={forwardedRef} {...props}>\n {children}\n </button>\n );\n },\n);\n\nexport default StatusBarButton;\n\ntype StatusBarItemProps = ThemedClassName<{ children: ReactNode }> & HTMLAttributes<HTMLDivElement>;\n\nconst StatusBarItem = forwardRef<HTMLDivElement, StatusBarItemProps>(\n ({ classNames, children, ...props }, forwardedRef) => (\n <div\n role='menuitem'\n className={mx('flex items-center gap-2 p-1 px-2 rounded-sm select-none', classNames)}\n ref={forwardedRef}\n {...props}\n >\n {children}\n </div>\n ),\n);\ntype StatusBarContainerProps = ThemedClassName<{ children: ReactNode }>;\n\n// TODO(zan): tabable group with tabster\nconst StatusBarContainer = forwardRef<HTMLDivElement, StatusBarContainerProps>(\n ({ classNames, children }, forwardedRef) => {\n const groupAttrs = useFocusableGroup({ tabBehavior: 'limited' });\n return (\n <div\n role='menubar'\n tabIndex={0}\n {...groupAttrs}\n className={mx(\n 'bs-[--statusbar-size] flex justify-end items-center gap-2 border-bs border-separator bg-base text-description text-lg pointer-fine:text-xs ch-focus-ring-inset',\n classNames,\n )}\n ref={forwardedRef}\n >\n {children}\n </div>\n );\n },\n);\n\ntype StartContentProps = ThemedClassName<{ children: ReactNode }>;\n\nconst StartContent = forwardRef<HTMLDivElement, StartContentProps>(({ classNames, children }, forwardedRef) => (\n <div role='none' className={mx('flex-grow flex items-center space-x-2', classNames)} ref={forwardedRef}>\n {children}\n </div>\n));\n\ntype EndContentProps = ThemedClassName<{ children: ReactNode }>;\n\nconst EndContent = forwardRef<HTMLDivElement, EndContentProps>(({ classNames, children }, forwardedRef) => (\n <div role='none' className={mx('flex-grow flex items-center justify-end', classNames)} ref={forwardedRef}>\n {children}\n </div>\n));\n\nexport const StatusBar = {\n Container: StatusBarContainer,\n Text: StatusBarText,\n Item: StatusBarItem,\n Button: StatusBarButton,\n StartContent,\n EndContent,\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { DiscordLogo, PaperPlaneTilt } from '@phosphor-icons/react';\nimport React, { useState } from 'react';\n\nimport { Surface } from '@dxos/app-framework';\nimport { Popover } from '@dxos/react-ui';\n\nimport { FeedbackForm } from './FeedbackForm';\nimport { StatusBar } from './StatusBar';\n\n// TODO(wittjosiah): Rename.\nexport const StatusBarImpl = () => {\n const [open, setOpen] = useState(false);\n\n // TODO(wittjosiah): Factor out feedback and discord buttons.\n return (\n <Popover.Root open={open} onOpenChange={setOpen}>\n <StatusBar.Container>\n <StatusBar.EndContent>\n <Popover.Trigger asChild>\n <StatusBar.Button aria-label='Give feedback about composer' data-joyride='welcome/feedback'>\n <PaperPlaneTilt />\n <StatusBar.Text classNames='hidden sm:block'>Feedback</StatusBar.Text>\n </StatusBar.Button>\n </Popover.Trigger>\n {/* TODO(zan): Configure this label? */}\n <StatusBar.Button aria-label='Open DXOS Discord' asChild>\n <a href='https://dxos.org/discord' target='_blank' rel='noopener noreferrer'>\n <DiscordLogo />\n <StatusBar.Text classNames='hidden sm:block'>Discord</StatusBar.Text>\n </a>\n </StatusBar.Button>\n </StatusBar.EndContent>\n <Surface role='status' />\n </StatusBar.Container>\n <Popover.Content classNames='shadow-lg'>\n <FeedbackForm onClose={() => setOpen(false)} />\n <Popover.Arrow />\n </Popover.Content>\n </Popover.Root>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { X, PaperPlaneTilt } from '@phosphor-icons/react';\nimport React, { useCallback } from 'react';\n\nimport { useIntentDispatcher } from '@dxos/app-framework';\nimport { S } from '@dxos/echo-schema';\nimport { Button, Input, Popover, useTranslation } from '@dxos/react-ui';\nimport { getSize } from '@dxos/react-ui-theme';\n\nimport { useForm } from '../hooks';\nimport { STATUS_BAR_PLUGIN } from '../meta';\nimport { mkTranslation } from '../translations';\nimport { validate } from '../util';\n\nconst Email = S.String.pipe(\n S.nonEmpty({ message: () => 'Email is required.' }),\n S.pattern(/^(?!\\.)(?!.*\\.\\.)([A-Z0-9_+-.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9-]*\\.)+[A-Z]{2,}$/i, {\n message: () => 'Invalid email address.',\n }),\n);\n\nconst nonEmpty = (field: string) => S.nonEmpty({ message: () => `${field} is required.` });\nconst maxLength = (field: string, length: number) => S.maxLength(length, { message: () => `${field} is too long.` });\n\n// -- Types and validation.\nconst FeedbackFormSchema = S.Struct({\n name: S.String.pipe(nonEmpty('Name'), maxLength('Name', 256)),\n email: Email.pipe(maxLength('Email', 256)),\n message: S.String.pipe(nonEmpty('Feedback'), maxLength('Feedback', 32_768)),\n});\n\ntype FeedbackFormState = S.Schema.Type<typeof FeedbackFormSchema>;\n\nconst initialValues: FeedbackFormState = { name: '', email: '', message: '' };\n\nexport const FeedbackForm = ({ onClose }: { onClose: () => void }) => {\n const { t } = useTranslation(STATUS_BAR_PLUGIN);\n const translation = mkTranslation(t);\n const dispatch = useIntentDispatcher();\n\n const onSubmit = useCallback(\n (values: FeedbackFormState) => {\n void dispatch({ action: 'dxos.org/plugin/observability/capture-feedback', data: values });\n onClose();\n },\n [dispatch, onClose],\n );\n\n const { errors, handleSubmit, canSubmit, touched, getInputProps } = useForm<FeedbackFormState>({\n initialValues,\n validate: (values) => validate(FeedbackFormSchema, values),\n onSubmit: (values) => onSubmit(values),\n });\n\n return (\n <div role='form' className='p-3 flex flex-col gap-2'>\n <div role='none' className='space-b-1'>\n <Input.Root validationValence={touched.name && errors.name ? 'error' : undefined}>\n <Input.Label>{translation('name label')}</Input.Label>\n <Input.TextInput\n classNames={'text-sm'}\n placeholder={translation('name placeholder')}\n autoFocus\n {...getInputProps('name')}\n />\n <Input.DescriptionAndValidation>\n <Input.Validation>{touched.name && errors.name}</Input.Validation>\n </Input.DescriptionAndValidation>\n </Input.Root>\n </div>\n\n <div role='none' className='space-b-1'>\n <Input.Root validationValence={touched.email && errors.email ? 'error' : undefined}>\n <Input.Label>{translation('email input label')}</Input.Label>\n <Input.TextInput\n classNames={'text-sm'}\n placeholder={translation('email input placeholder')}\n {...getInputProps('email')}\n />\n <Input.DescriptionAndValidation>\n <Input.Validation>{touched.email && errors.email}</Input.Validation>\n </Input.DescriptionAndValidation>\n </Input.Root>\n </div>\n\n <div role='none' className='space-b-1'>\n <Input.Root validationValence={touched.message && errors.message ? 'error' : undefined}>\n <Input.Label>{translation('feedback text area label')}</Input.Label>\n <Input.TextArea\n classNames={'text-sm'}\n rows={5}\n cols={30}\n placeholder={translation('feedback text area placeholder')}\n {...getInputProps('message')}\n />\n <Input.DescriptionAndValidation>\n <Input.Validation>{touched.message && errors.message}</Input.Validation>\n </Input.DescriptionAndValidation>\n </Input.Root>\n </div>\n\n <div role='none' className='space-b-2'>\n <Button\n type='submit'\n variant='primary'\n classNames='is-full flex gap-2'\n disabled={!canSubmit}\n onClick={handleSubmit}\n >\n <span>{translation('send feedback label')}</span>\n <div className='grow' />\n <PaperPlaneTilt className={getSize(5)} />\n </Button>\n <Popover.Close asChild>\n <Button classNames='is-full flex gap-2'>\n <span>{t('cancel label', { ns: 'os' })}</span>\n <div className='grow' />\n <X className={getSize(5)} />\n </Button>\n </Popover.Close>\n </div>\n </div>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\nimport { type ChangeEvent, useCallback, useState } from 'react';\n\nimport { type ValidationError } from '../util';\n\n// TODO(Zan): This module will be generally useful and we should factor it out after the\n// API crystallizes a bit more.\n\ninterface FormOptions<T> {\n initialValues: T;\n validate: (values: any) => ValidationError[] | undefined;\n onSubmit: (values: T) => void;\n}\n\n/**\n * Creates a hook for managing form state, including values, validation, and submission.\n *\n * @example\n * const { values, handleChange, handleSubmit, errors, canSubmit, getInputProps } = useForm({\n * initialValues: { name: '', email: '' },\n * validate: (values) => { yourValidationLogic(values); },\n * onSubmit: (values) => { submissionLogic(values); },\n * });\n */\nexport const useForm = <T extends object>({ initialValues, validate, onSubmit }: FormOptions<T>) => {\n const [values, setValues] = useState<T>(initialValues);\n const [errors, setErrors] = useState<Record<keyof T, string>>({} as Record<keyof T, string>);\n const [touched, setTouched] = useState<Record<keyof T, boolean>>(\n Object.keys(initialValues).reduce((acc, key) => ({ ...acc, [key]: false }), {} as Record<keyof T, boolean>),\n );\n\n const runValidation = useCallback(\n (values: T) => {\n const validationErrors = validate(values);\n setErrors(collapseErrorArray(validationErrors ?? []));\n\n return validationErrors === undefined;\n },\n [validate],\n );\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n const { name, value } = event.target;\n const newValues = { ...values, [name]: value };\n setValues(newValues);\n runValidation(newValues);\n },\n [values, runValidation],\n );\n\n const touchAll = useCallback(() => setTouched(mkAllTouched(values)), [values, setTouched]);\n\n const handleBlur = useCallback(\n (event: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n const { name } = event.target;\n setTouched((touched) => ({ ...touched, [name]: true }));\n\n // TODO(Zan): This should be configurable behavior.\n if (event.relatedTarget?.getAttribute('type') === 'submit') {\n // NOTE: We do this here instead of onSubmit, because the blur event is triggered before the submit event\n // and results in the submit button being disabled when the form is invalid.\n touchAll();\n }\n\n runValidation(values);\n },\n [runValidation, values, touchAll],\n );\n\n const handleSubmit = useCallback(() => {\n if (runValidation(values)) {\n onSubmit(values);\n }\n }, [values, runValidation, onSubmit]);\n\n // NOTE: We can submit if there is no touched field that has an error.\n // - Basically, if there's a validation message present in the form, submit should be disabled.\n const canSubmit = Object.keys(values).every((key) => touched[key as keyof T] === false || !errors[key as keyof T]);\n\n const getInputProps = useCallback(\n (key: keyof T) => ({\n name: key,\n value: values[key],\n onChange: handleChange,\n onBlur: handleBlur,\n 'aria-invalid': errors[key] !== undefined,\n }),\n [values, handleChange, handleBlur, errors],\n );\n\n return {\n values,\n handleChange,\n handleSubmit,\n errors,\n canSubmit,\n touched,\n handleBlur,\n onValidate: runValidation,\n getInputProps,\n };\n};\n\nconst mkAllTouched = <T extends Record<keyof T, any>>(values: T) => {\n return Object.keys(values).reduce((acc, key) => ({ ...acc, [key]: true }), {} as Record<keyof T, boolean>);\n};\n\nconst collapseErrorArray = <T>(errors: ValidationError[]) =>\n errors.reduce(\n (acc, { path, message }) => {\n // TODO(Zan): This won't play well with nesting.\n acc[path as keyof T] = message;\n return acc;\n },\n {} as Record<keyof T, string>,\n );\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type useTranslation } from '@dxos/react-ui';\n\nimport { STATUS_BAR_PLUGIN } from './meta';\n\ntype StatusBarTranslationKeys =\n | 'plugin name'\n | 'email input label'\n | 'email input placeholder'\n | 'feedback text area label'\n | 'feedback text area placeholder'\n | 'send feedback label'\n | 'name label'\n | 'name placeholder';\n\ntype RequiredTranslation = { [key in StatusBarTranslationKeys]: string };\ntype TranslationEntry = { [STATUS_BAR_PLUGIN]: RequiredTranslation };\ntype Language = string;\n\n// -- helpers.\nconst entry = (translation: RequiredTranslation): TranslationEntry => ({ [STATUS_BAR_PLUGIN]: translation });\nexport const mkTranslation = (t: ReturnType<typeof useTranslation>['t']) => (key: StatusBarTranslationKeys) => t(key);\n\nconst translations: Record<Language, TranslationEntry> = {\n 'en-US': entry({\n 'plugin name': 'Status Bar',\n 'name label': 'Name',\n 'name placeholder': 'Preferred name',\n 'email input label': 'Email',\n 'email input placeholder': 'hello@example.com',\n 'feedback text area label': 'Feedback',\n 'feedback text area placeholder': 'Found a bug? Have a suggestion? Let us know!',\n 'send feedback label': 'Send Feedback',\n }),\n};\n\nexport default [translations];\n", "//\n// Copyright 2024 DXOS.org\n//\nimport { ArrayFormatter } from '@effect/schema';\nimport { Effect } from 'effect';\n\nimport { S } from '@dxos/echo-schema';\n\nexport type ValidationError = { path: string; message: string };\n\nexport const validate = <T>(schema: S.Schema<T>, data: any): ValidationError[] | undefined => {\n const validator = S.decodeUnknownEither(schema, { errors: 'all' });\n const result = validator(data);\n\n if (result._tag === 'Left') {\n const errors = Effect.runSync(ArrayFormatter.formatError(result.left));\n // TODO(Zan): Path.join is an assumption...\n return errors.map(({ message, path }) => ({ message, path: path.join('.') }));\n }\n\n return undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { StatusBarPlugin } from './StatusBarPlugin';\n\nexport default StatusBarPlugin;\n\nexport * from './StatusBarPlugin';\nexport * from './components';\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,OAAOA,YAAW;;;ACAlB,SAASC,yBAAyB;AAClC,SAASC,YAAY;AACrB,OAAOC,SAASC,kBAAuD;AAGvE,SAASC,UAAU;AAInB,IAAMC,gBAAgBC,2BAAgD,CAAC,EAAEC,YAAYC,SAAQ,GAAIC,iBAC/F,sBAAA,cAACC,QAAAA;EAAKC,WAAWC,GAAGL,UAAAA;EAAaM,KAAKJ;GACnCD,QAAAA,CAAAA;AAOL,IAAMM,kBAAkBR,2BACtB,CAAC,EAAEC,YAAYC,UAAUO,SAAS,GAAGC,MAAAA,GAASP,iBAAAA;AAC5C,QAAMQ,UAAUL,GACd,+CACA,4CACA,kGACAL,UAAAA;AAGF,SAAOQ,UACL,sBAAA,cAACG,MAAAA;IAAKC,MAAK;IAASN,KAAKJ;IAAcE,WAAWM;IAAU,GAAGD;KAC5DR,QAAAA,IAGH,sBAAA,cAACY,UAAAA;IAAOT,WAAWM;IAASJ,KAAKJ;IAAe,GAAGO;KAChDR,QAAAA;AAGP,CAAA;AAOF,IAAMa,gBAAgBC,2BACpB,CAAC,EAAEC,YAAYC,UAAU,GAAGC,MAAAA,GAASC,iBACnC,sBAAA,cAACC,OAAAA;EACCC,MAAK;EACLC,WAAWC,GAAG,2DAA2DP,UAAAA;EACzEQ,KAAKL;EACJ,GAAGD;GAEHD,QAAAA,CAAAA;
|
|
6
|
-
"names": ["React", "useFocusableGroup", "Slot", "React", "forwardRef", "mx", "StatusBarText", "forwardRef", "classNames", "children", "forwardedRef", "span", "className", "mx", "ref", "StatusBarButton", "asChild", "props", "classes", "Slot", "role", "button", "StatusBarItem", "forwardRef", "classNames", "children", "props", "forwardedRef", "div", "role", "className", "mx", "ref", "StatusBarContainer", "groupAttrs", "useFocusableGroup", "tabBehavior", "tabIndex", "StartContent", "EndContent", "StatusBar", "Container", "Text", "StatusBarText", "Item", "Button", "StatusBarButton", "
|
|
3
|
+
"sources": ["../../../src/StatusBarPlugin.tsx", "../../../src/components/StatusBar.tsx", "../../../src/components/StatusBarPanel.tsx", "../../../src/components/FeedbackForm.tsx", "../../../src/translations.ts", "../../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type PluginDefinition, type SurfaceProvides, type TranslationsProvides } from '@dxos/app-framework';\n\nimport { StatusBarPanel } from './components';\nimport meta from './meta';\nimport translations from './translations';\n\nexport type StatusBarPluginProvides = SurfaceProvides & TranslationsProvides;\n\nexport const StatusBarPlugin = (): PluginDefinition<StatusBarPluginProvides> => {\n return {\n meta,\n provides: {\n translations,\n surface: {\n component: ({ role }) => {\n switch (role) {\n case 'status-bar': {\n return <StatusBarPanel />;\n }\n }\n\n return null;\n },\n },\n },\n };\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { Slot } from '@radix-ui/react-slot';\nimport React, { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\ntype StatusBarTextProps = ThemedClassName<{ children: ReactNode }>;\n\nconst StatusBarText = forwardRef<HTMLSpanElement, StatusBarTextProps>(({ classNames, children }, forwardedRef) => (\n <span className={mx(classNames)} ref={forwardedRef}>\n {children}\n </span>\n));\n\ntype StatusBarButtonProps = ThemedClassName<{ children: ReactNode; asChild?: boolean }> &\n HTMLAttributes<HTMLButtonElement>;\n\nconst StatusBarButton = forwardRef<HTMLButtonElement, StatusBarButtonProps>(\n ({ classNames, children, asChild, ...props }, forwardedRef) => {\n const classes = mx(\n 'flex items-center gap-2 p-1 px-2 rounded-sm',\n 'select-none cursor-pointer ch-focus-ring',\n 'hover:bg-neutral-75 active:bg-neutral-150 dark:hover:bg-neutral-750 dark:active:bg-neutral-700',\n classNames,\n );\n\n return asChild ? (\n <Slot role='button' ref={forwardedRef} className={classes} {...props}>\n {children}\n </Slot>\n ) : (\n <button className={classes} ref={forwardedRef} {...props}>\n {children}\n </button>\n );\n },\n);\n\nexport default StatusBarButton;\n\ntype StatusBarItemProps = ThemedClassName<{ children: ReactNode }> & HTMLAttributes<HTMLDivElement>;\n\nconst StatusBarItem = forwardRef<HTMLDivElement, StatusBarItemProps>(\n ({ classNames, children, ...props }, forwardedRef) => (\n <div\n role='menuitem'\n className={mx('flex items-center gap-2 p-1 px-2 rounded-sm select-none', classNames)}\n ref={forwardedRef}\n {...props}\n >\n {children}\n </div>\n ),\n);\n\ntype StatusBarContainerProps = ThemedClassName<{ children: ReactNode }>;\n\n// TODO(zan): tabable group with tabster.\nconst StatusBarContainer = forwardRef<HTMLDivElement, StatusBarContainerProps>(\n ({ classNames, children }, forwardedRef) => {\n const groupAttrs = useFocusableGroup({ tabBehavior: 'limited' });\n return (\n <div\n role='menubar'\n tabIndex={0}\n {...groupAttrs}\n className={mx(\n 'bs-[--statusbar-size] flex justify-end items-center gap-2 bg-base text-description text-lg pointer-fine:text-xs ch-focus-ring-inset',\n classNames,\n )}\n ref={forwardedRef}\n >\n {children}\n </div>\n );\n },\n);\n\ntype StartContentProps = ThemedClassName<{ children: ReactNode }>;\n\nconst StartContent = forwardRef<HTMLDivElement, StartContentProps>(({ classNames, children }, forwardedRef) => (\n <div role='none' className={mx('flex-grow flex items-center space-x-2', classNames)} ref={forwardedRef}>\n {children}\n </div>\n));\n\ntype EndContentProps = ThemedClassName<{ children: ReactNode }>;\n\nconst EndContent = forwardRef<HTMLDivElement, EndContentProps>(({ classNames, children }, forwardedRef) => (\n <div role='none' className={mx('flex-grow flex items-center justify-end', classNames)} ref={forwardedRef}>\n {children}\n </div>\n));\n\nexport const StatusBar = {\n Container: StatusBarContainer,\n Text: StatusBarText,\n Item: StatusBarItem,\n Button: StatusBarButton,\n StartContent,\n EndContent,\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useState } from 'react';\n\nimport { Surface } from '@dxos/app-framework';\nimport { Icon, Popover } from '@dxos/react-ui';\n\nimport { FeedbackForm } from './FeedbackForm';\nimport { StatusBar } from './StatusBar';\n\nexport const StatusBarPanel = () => {\n const [open, setOpen] = useState(false);\n\n // TODO(wittjosiah): Factor out feedback and discord buttons.\n return (\n <Popover.Root open={open} onOpenChange={setOpen}>\n <StatusBar.Container>\n <StatusBar.EndContent>\n <Popover.Trigger asChild>\n <StatusBar.Button aria-label='Give feedback about composer' data-joyride='welcome/feedback'>\n <Icon icon='ph--paper-plane-tilt--regular' size={4} />\n <StatusBar.Text classNames='hidden sm:block'>Feedback</StatusBar.Text>\n </StatusBar.Button>\n </Popover.Trigger>\n {/* TODO(zan): Configure this label? */}\n <StatusBar.Button aria-label='Open DXOS Discord' asChild>\n <a href='https://dxos.org/discord' target='_blank' rel='noopener noreferrer'>\n <Icon icon='ph--discord-logo--regular' size={4} />\n <StatusBar.Text classNames='hidden sm:block'>Discord</StatusBar.Text>\n </a>\n </StatusBar.Button>\n </StatusBar.EndContent>\n <Surface role='status' />\n </StatusBar.Container>\n <Popover.Content classNames='shadow-lg'>\n <FeedbackForm onClose={() => setOpen(false)} />\n <Popover.Arrow />\n </Popover.Content>\n </Popover.Root>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema as S } from '@effect/schema';\nimport { PaperPlaneTilt, X } from '@phosphor-icons/react';\nimport React, { useCallback } from 'react';\n\nimport { useIntentDispatcher } from '@dxos/app-framework';\nimport { Button, Input, Popover, useTranslation } from '@dxos/react-ui';\nimport { useForm } from '@dxos/react-ui-data';\nimport { getSize } from '@dxos/react-ui-theme';\n\nimport { STATUS_BAR_PLUGIN } from '../meta';\nimport { mkTranslation } from '../translations';\n\nconst Email = S.String.pipe(\n S.nonEmptyString({ message: () => 'Email is required.' }),\n S.pattern(/^(?!\\.)(?!.*\\.\\.)([A-Z0-9_+-.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9-]*\\.)+[A-Z]{2,}$/i, {\n message: () => 'Invalid email address.',\n }),\n);\n\nconst nonEmpty = (field: string) => S.nonEmptyString({ message: () => `${field} is required.` });\nconst maxLength = (field: string, length: number) => S.maxLength(length, { message: () => `${field} is too long.` });\n\n// Types and validation.\nconst FeedbackFormSchema = S.Struct({\n name: S.String.pipe(nonEmpty('Name'), maxLength('Name', 256)),\n email: Email.pipe(maxLength('Email', 256)),\n message: S.String.pipe(nonEmpty('Feedback'), maxLength('Feedback', 32_768)),\n});\n\ntype FeedbackFormState = S.Schema.Type<typeof FeedbackFormSchema>;\n\nconst initialValues: FeedbackFormState = { name: '', email: '', message: '' };\n\nexport const FeedbackForm = ({ onClose }: { onClose: () => void }) => {\n const { t } = useTranslation(STATUS_BAR_PLUGIN);\n const translation = mkTranslation(t);\n const dispatch = useIntentDispatcher();\n\n const onSubmit = useCallback(\n (values: FeedbackFormState) => {\n void dispatch({ action: 'dxos.org/plugin/observability/capture-feedback', data: values });\n onClose();\n },\n [dispatch, onClose],\n );\n\n const { errors, handleSubmit, canSubmit, touched, getInputProps } = useForm<FeedbackFormState>({\n initialValues,\n schema: FeedbackFormSchema,\n onSubmit,\n });\n\n return (\n <div role='form' className='p-3 flex flex-col gap-2'>\n <div role='none' className='space-b-1'>\n <Input.Root validationValence={touched.name && errors.name ? 'error' : undefined}>\n <Input.Label>{translation('name label')}</Input.Label>\n <Input.TextInput\n classNames={'text-sm'}\n placeholder={translation('name placeholder')}\n autoFocus\n {...getInputProps('name')}\n />\n <Input.DescriptionAndValidation>\n <Input.Validation>{touched.name && errors.name}</Input.Validation>\n </Input.DescriptionAndValidation>\n </Input.Root>\n </div>\n\n <div role='none' className='space-b-1'>\n <Input.Root validationValence={touched.email && errors.email ? 'error' : undefined}>\n <Input.Label>{translation('email input label')}</Input.Label>\n <Input.TextInput\n classNames={'text-sm'}\n placeholder={translation('email input placeholder')}\n {...getInputProps('email')}\n />\n <Input.DescriptionAndValidation>\n <Input.Validation>{touched.email && errors.email}</Input.Validation>\n </Input.DescriptionAndValidation>\n </Input.Root>\n </div>\n\n <div role='none' className='space-b-1'>\n <Input.Root validationValence={touched.message && errors.message ? 'error' : undefined}>\n <Input.Label>{translation('feedback text area label')}</Input.Label>\n <Input.TextArea\n classNames={'text-sm'}\n rows={5}\n cols={30}\n placeholder={translation('feedback text area placeholder')}\n {...getInputProps('message')}\n />\n <Input.DescriptionAndValidation>\n <Input.Validation>{touched.message && errors.message}</Input.Validation>\n </Input.DescriptionAndValidation>\n </Input.Root>\n </div>\n\n <div role='none' className='space-b-2'>\n <Button\n type='submit'\n variant='primary'\n classNames='is-full flex gap-2'\n disabled={!canSubmit}\n onClick={handleSubmit}\n >\n <span>{translation('send feedback label')}</span>\n <div className='grow' />\n <PaperPlaneTilt className={getSize(5)} />\n </Button>\n <Popover.Close asChild>\n <Button classNames='is-full flex gap-2'>\n <span>{t('cancel label', { ns: 'os' })}</span>\n <div className='grow' />\n <X className={getSize(5)} />\n </Button>\n </Popover.Close>\n </div>\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type useTranslation } from '@dxos/react-ui';\n\nimport { STATUS_BAR_PLUGIN } from './meta';\n\ntype StatusBarTranslationKeys =\n | 'plugin name'\n | 'email input label'\n | 'email input placeholder'\n | 'feedback text area label'\n | 'feedback text area placeholder'\n | 'send feedback label'\n | 'name label'\n | 'name placeholder';\n\ntype RequiredTranslation = { [key in StatusBarTranslationKeys]: string };\ntype TranslationEntry = { [STATUS_BAR_PLUGIN]: RequiredTranslation };\ntype Language = string;\n\n// -- helpers.\nconst entry = (translation: RequiredTranslation): TranslationEntry => ({ [STATUS_BAR_PLUGIN]: translation });\nexport const mkTranslation = (t: ReturnType<typeof useTranslation>['t']) => (key: StatusBarTranslationKeys) => t(key);\n\nconst translations: Record<Language, TranslationEntry> = {\n 'en-US': entry({\n 'plugin name': 'Status Bar',\n 'name label': 'Name',\n 'name placeholder': 'Preferred name',\n 'email input label': 'Email',\n 'email input placeholder': 'hello@example.com',\n 'feedback text area label': 'Feedback',\n 'feedback text area placeholder': 'Found a bug? Have a suggestion? Let us know!',\n 'send feedback label': 'Send Feedback',\n }),\n};\n\nexport default [translations];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { StatusBarPlugin } from './StatusBarPlugin';\n\nexport default StatusBarPlugin;\n\nexport * from './StatusBarPlugin';\nexport * from './components';\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,OAAOA,YAAW;;;ACAlB,SAASC,yBAAyB;AAClC,SAASC,YAAY;AACrB,OAAOC,SAASC,kBAAuD;AAGvE,SAASC,UAAU;AAInB,IAAMC,gBAAgBC,2BAAgD,CAAC,EAAEC,YAAYC,SAAQ,GAAIC,iBAC/F,sBAAA,cAACC,QAAAA;EAAKC,WAAWC,GAAGL,UAAAA;EAAaM,KAAKJ;GACnCD,QAAAA,CAAAA;AAOL,IAAMM,kBAAkBR,2BACtB,CAAC,EAAEC,YAAYC,UAAUO,SAAS,GAAGC,MAAAA,GAASP,iBAAAA;AAC5C,QAAMQ,UAAUL,GACd,+CACA,4CACA,kGACAL,UAAAA;AAGF,SAAOQ,UACL,sBAAA,cAACG,MAAAA;IAAKC,MAAK;IAASN,KAAKJ;IAAcE,WAAWM;IAAU,GAAGD;KAC5DR,QAAAA,IAGH,sBAAA,cAACY,UAAAA;IAAOT,WAAWM;IAASJ,KAAKJ;IAAe,GAAGO;KAChDR,QAAAA;AAGP,CAAA;AAOF,IAAMa,gBAAgBC,2BACpB,CAAC,EAAEC,YAAYC,UAAU,GAAGC,MAAAA,GAASC,iBACnC,sBAAA,cAACC,OAAAA;EACCC,MAAK;EACLC,WAAWC,GAAG,2DAA2DP,UAAAA;EACzEQ,KAAKL;EACJ,GAAGD;GAEHD,QAAAA,CAAAA;AAQP,IAAMQ,qBAAqBV,2BACzB,CAAC,EAAEC,YAAYC,SAAQ,GAAIE,iBAAAA;AACzB,QAAMO,aAAaC,kBAAkB;IAAEC,aAAa;EAAU,CAAA;AAC9D,SACE,sBAAA,cAACR,OAAAA;IACCC,MAAK;IACLQ,UAAU;IACT,GAAGH;IACJJ,WAAWC,GACT,uIACAP,UAAAA;IAEFQ,KAAKL;KAEJF,QAAAA;AAGP,CAAA;AAKF,IAAMa,eAAef,2BAA8C,CAAC,EAAEC,YAAYC,SAAQ,GAAIE,iBAC5F,sBAAA,cAACC,OAAAA;EAAIC,MAAK;EAAOC,WAAWC,GAAG,yCAAyCP,UAAAA;EAAaQ,KAAKL;GACvFF,QAAAA,CAAAA;AAML,IAAMc,aAAahB,2BAA4C,CAAC,EAAEC,YAAYC,SAAQ,GAAIE,iBACxF,sBAAA,cAACC,OAAAA;EAAIC,MAAK;EAAOC,WAAWC,GAAG,2CAA2CP,UAAAA;EAAaQ,KAAKL;GACzFF,QAAAA,CAAAA;AAIE,IAAMe,YAAY;EACvBC,WAAWR;EACXS,MAAMC;EACNC,MAAMtB;EACNuB,QAAQC;EACRR;EACAC;AACF;;;ACtGA,OAAOQ,UAASC,gBAAgB;AAEhC,SAASC,eAAe;AACxB,SAASC,MAAMC,WAAAA,gBAAe;;;ACH9B,SAASC,UAAUC,SAAS;AAC5B,SAASC,gBAAgBC,SAAS;AAClC,OAAOC,UAASC,mBAAmB;AAEnC,SAASC,2BAA2B;AACpC,SAASC,QAAQC,OAAOC,SAASC,sBAAsB;AACvD,SAASC,eAAe;AACxB,SAASC,eAAe;;;ACYxB,IAAMC,QAAQ,CAACC,iBAAwD;EAAE,CAACC,iBAAAA,GAAoBD;AAAY;AACnG,IAAME,gBAAgB,CAACC,MAA8C,CAACC,QAAkCD,EAAEC,GAAAA;AAEjH,IAAMC,eAAmD;EACvD,SAASN,MAAM;IACb,eAAe;IACf,cAAc;IACd,oBAAoB;IACpB,qBAAqB;IACrB,2BAA2B;IAC3B,4BAA4B;IAC5B,kCAAkC;IAClC,uBAAuB;EACzB,CAAA;AACF;AAEA,IAAA,uBAAe;EAACM;;;;ADvBhB,IAAMC,QAAQC,EAAEC,OAAOC,KACrBF,EAAEG,eAAe;EAAEC,SAAS,MAAM;AAAqB,CAAA,GACvDJ,EAAEK,QAAQ,kFAAkF;EAC1FD,SAAS,MAAM;AACjB,CAAA,CAAA;AAGF,IAAME,WAAW,CAACC,UAAkBP,EAAEG,eAAe;EAAEC,SAAS,MAAM,GAAGG,KAAAA;AAAqB,CAAA;AAC9F,IAAMC,YAAY,CAACD,OAAeE,WAAmBT,EAAEQ,UAAUC,QAAQ;EAAEL,SAAS,MAAM,GAAGG,KAAAA;AAAqB,CAAA;AAGlH,IAAMG,qBAAqBV,EAAEW,OAAO;EAClCC,MAAMZ,EAAEC,OAAOC,KAAKI,SAAS,MAAA,GAASE,UAAU,QAAQ,GAAA,CAAA;EACxDK,OAAOd,MAAMG,KAAKM,UAAU,SAAS,GAAA,CAAA;EACrCJ,SAASJ,EAAEC,OAAOC,KAAKI,SAAS,UAAA,GAAaE,UAAU,YAAY,KAAA,CAAA;AACrE,CAAA;AAIA,IAAMM,gBAAmC;EAAEF,MAAM;EAAIC,OAAO;EAAIT,SAAS;AAAG;AAErE,IAAMW,eAAe,CAAC,EAAEC,QAAO,MAA2B;AAC/D,QAAM,EAAEC,EAAC,IAAKC,eAAeC,iBAAAA;AAC7B,QAAMC,cAAcC,cAAcJ,CAAAA;AAClC,QAAMK,WAAWC,oBAAAA;AAEjB,QAAMC,WAAWC,YACf,CAACC,WAAAA;AACC,SAAKJ,SAAS;MAAEK,QAAQ;MAAkDC,MAAMF;IAAO,CAAA;AACvFV,YAAAA;EACF,GACA;IAACM;IAAUN;GAAQ;AAGrB,QAAM,EAAEa,QAAQC,cAAcC,WAAWC,SAASC,cAAa,IAAKC,QAA2B;IAC7FpB;IACAqB,QAAQzB;IACRc;EACF,CAAA;AAEA,SACE,gBAAAY,OAAA,cAACC,OAAAA;IAAIC,MAAK;IAAOC,WAAU;KACzB,gBAAAH,OAAA,cAACC,OAAAA;IAAIC,MAAK;IAAOC,WAAU;KACzB,gBAAAH,OAAA,cAACI,MAAMC,MAAI;IAACC,mBAAmBV,QAAQpB,QAAQiB,OAAOjB,OAAO,UAAU+B;KACrE,gBAAAP,OAAA,cAACI,MAAMI,OAAK,MAAExB,YAAY,YAAA,CAAA,GAC1B,gBAAAgB,OAAA,cAACI,MAAMK,WAAS;IACdC,YAAY;IACZC,aAAa3B,YAAY,kBAAA;IACzB4B,WAAAA;IACC,GAAGf,cAAc,MAAA;MAEpB,gBAAAG,OAAA,cAACI,MAAMS,0BAAwB,MAC7B,gBAAAb,OAAA,cAACI,MAAMU,YAAU,MAAElB,QAAQpB,QAAQiB,OAAOjB,IAAI,CAAA,CAAA,CAAA,GAKpD,gBAAAwB,OAAA,cAACC,OAAAA;IAAIC,MAAK;IAAOC,WAAU;KACzB,gBAAAH,OAAA,cAACI,MAAMC,MAAI;IAACC,mBAAmBV,QAAQnB,SAASgB,OAAOhB,QAAQ,UAAU8B;KACvE,gBAAAP,OAAA,cAACI,MAAMI,OAAK,MAAExB,YAAY,mBAAA,CAAA,GAC1B,gBAAAgB,OAAA,cAACI,MAAMK,WAAS;IACdC,YAAY;IACZC,aAAa3B,YAAY,yBAAA;IACxB,GAAGa,cAAc,OAAA;MAEpB,gBAAAG,OAAA,cAACI,MAAMS,0BAAwB,MAC7B,gBAAAb,OAAA,cAACI,MAAMU,YAAU,MAAElB,QAAQnB,SAASgB,OAAOhB,KAAK,CAAA,CAAA,CAAA,GAKtD,gBAAAuB,OAAA,cAACC,OAAAA;IAAIC,MAAK;IAAOC,WAAU;KACzB,gBAAAH,OAAA,cAACI,MAAMC,MAAI;IAACC,mBAAmBV,QAAQ5B,WAAWyB,OAAOzB,UAAU,UAAUuC;KAC3E,gBAAAP,OAAA,cAACI,MAAMI,OAAK,MAAExB,YAAY,0BAAA,CAAA,GAC1B,gBAAAgB,OAAA,cAACI,MAAMW,UAAQ;IACbL,YAAY;IACZM,MAAM;IACNC,MAAM;IACNN,aAAa3B,YAAY,gCAAA;IACxB,GAAGa,cAAc,SAAA;MAEpB,gBAAAG,OAAA,cAACI,MAAMS,0BAAwB,MAC7B,gBAAAb,OAAA,cAACI,MAAMU,YAAU,MAAElB,QAAQ5B,WAAWyB,OAAOzB,OAAO,CAAA,CAAA,CAAA,GAK1D,gBAAAgC,OAAA,cAACC,OAAAA;IAAIC,MAAK;IAAOC,WAAU;KACzB,gBAAAH,OAAA,cAACkB,QAAAA;IACCC,MAAK;IACLC,SAAQ;IACRV,YAAW;IACXW,UAAU,CAAC1B;IACX2B,SAAS5B;KAET,gBAAAM,OAAA,cAACuB,QAAAA,MAAMvC,YAAY,qBAAA,CAAA,GACnB,gBAAAgB,OAAA,cAACC,OAAAA;IAAIE,WAAU;MACf,gBAAAH,OAAA,cAACwB,gBAAAA;IAAerB,WAAWsB,QAAQ,CAAA;OAErC,gBAAAzB,OAAA,cAAC0B,QAAQC,OAAK;IAACC,SAAAA;KACb,gBAAA5B,OAAA,cAACkB,QAAAA;IAAOR,YAAW;KACjB,gBAAAV,OAAA,cAACuB,QAAAA,MAAM1C,EAAE,gBAAgB;IAAEgD,IAAI;EAAK,CAAA,CAAA,GACpC,gBAAA7B,OAAA,cAACC,OAAAA;IAAIE,WAAU;MACf,gBAAAH,OAAA,cAAC8B,GAAAA;IAAE3B,WAAWsB,QAAQ,CAAA;;AAMlC;;;ADjHO,IAAMM,iBAAiB,MAAA;AAC5B,QAAM,CAACC,MAAMC,OAAAA,IAAWC,SAAS,KAAA;AAGjC,SACE,gBAAAC,OAAA,cAACC,SAAQC,MAAI;IAACL;IAAYM,cAAcL;KACtC,gBAAAE,OAAA,cAACI,UAAUC,WAAS,MAClB,gBAAAL,OAAA,cAACI,UAAUE,YAAU,MACnB,gBAAAN,OAAA,cAACC,SAAQM,SAAO;IAACC,SAAAA;KACf,gBAAAR,OAAA,cAACI,UAAUK,QAAM;IAACC,cAAW;IAA+BC,gBAAa;KACvE,gBAAAX,OAAA,cAACY,MAAAA;IAAKC,MAAK;IAAgCC,MAAM;MACjD,gBAAAd,OAAA,cAACI,UAAUW,MAAI;IAACC,YAAW;KAAkB,UAAA,CAAA,CAAA,GAIjD,gBAAAhB,OAAA,cAACI,UAAUK,QAAM;IAACC,cAAW;IAAoBF,SAAAA;KAC/C,gBAAAR,OAAA,cAACiB,KAAAA;IAAEC,MAAK;IAA2BC,QAAO;IAASC,KAAI;KACrD,gBAAApB,OAAA,cAACY,MAAAA;IAAKC,MAAK;IAA4BC,MAAM;MAC7C,gBAAAd,OAAA,cAACI,UAAUW,MAAI;IAACC,YAAW;KAAkB,SAAA,CAAA,CAAA,CAAA,GAInD,gBAAAhB,OAAA,cAACqB,SAAAA;IAAQC,MAAK;OAEhB,gBAAAtB,OAAA,cAACC,SAAQsB,SAAO;IAACP,YAAW;KAC1B,gBAAAhB,OAAA,cAACwB,cAAAA;IAAaC,SAAS,MAAM3B,QAAQ,KAAA;MACrC,gBAAAE,OAAA,cAACC,SAAQyB,OAAK,IAAA,CAAA,CAAA;AAItB;;;AF5BO,IAAMC,kBAAkB,MAAA;AAC7B,SAAO;IACLC;IACAC,UAAU;MACRC;MACAC,SAAS;QACPC,WAAW,CAAC,EAAEC,KAAI,MAAE;AAClB,kBAAQA,MAAAA;YACN,KAAK,cAAc;AACjB,qBAAO,gBAAAC,OAAA,cAACC,gBAAAA,IAAAA;YACV;UACF;AAEA,iBAAO;QACT;MACF;IACF;EACF;AACF;;;AK1BA,IAAA,cAAeC;",
|
|
6
|
+
"names": ["React", "useFocusableGroup", "Slot", "React", "forwardRef", "mx", "StatusBarText", "forwardRef", "classNames", "children", "forwardedRef", "span", "className", "mx", "ref", "StatusBarButton", "asChild", "props", "classes", "Slot", "role", "button", "StatusBarItem", "forwardRef", "classNames", "children", "props", "forwardedRef", "div", "role", "className", "mx", "ref", "StatusBarContainer", "groupAttrs", "useFocusableGroup", "tabBehavior", "tabIndex", "StartContent", "EndContent", "StatusBar", "Container", "Text", "StatusBarText", "Item", "Button", "StatusBarButton", "React", "useState", "Surface", "Icon", "Popover", "Schema", "S", "PaperPlaneTilt", "X", "React", "useCallback", "useIntentDispatcher", "Button", "Input", "Popover", "useTranslation", "useForm", "getSize", "entry", "translation", "STATUS_BAR_PLUGIN", "mkTranslation", "t", "key", "translations", "Email", "S", "String", "pipe", "nonEmptyString", "message", "pattern", "nonEmpty", "field", "maxLength", "length", "FeedbackFormSchema", "Struct", "name", "email", "initialValues", "FeedbackForm", "onClose", "t", "useTranslation", "STATUS_BAR_PLUGIN", "translation", "mkTranslation", "dispatch", "useIntentDispatcher", "onSubmit", "useCallback", "values", "action", "data", "errors", "handleSubmit", "canSubmit", "touched", "getInputProps", "useForm", "schema", "React", "div", "role", "className", "Input", "Root", "validationValence", "undefined", "Label", "TextInput", "classNames", "placeholder", "autoFocus", "DescriptionAndValidation", "Validation", "TextArea", "rows", "cols", "Button", "type", "variant", "disabled", "onClick", "span", "PaperPlaneTilt", "getSize", "Popover", "Close", "asChild", "ns", "X", "StatusBarPanel", "open", "setOpen", "useState", "React", "Popover", "Root", "onOpenChange", "StatusBar", "Container", "EndContent", "Trigger", "asChild", "Button", "aria-label", "data-joyride", "Icon", "icon", "size", "Text", "classNames", "a", "href", "target", "rel", "Surface", "role", "Content", "FeedbackForm", "onClose", "Arrow", "StatusBarPlugin", "meta", "provides", "translations", "surface", "component", "role", "React", "StatusBarPanel", "StatusBarPlugin"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-status-bar/src/components/StatusBar.tsx":{"bytes":
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-status-bar/src/components/StatusBar.tsx":{"bytes":9929,"imports":[{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-status-bar/src/meta.ts":{"bytes":1252,"imports":[],"format":"esm"},"packages/plugins/plugin-status-bar/src/translations.ts":{"bytes":3385,"imports":[{"path":"packages/plugins/plugin-status-bar/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-status-bar/src/components/FeedbackForm.tsx":{"bytes":16534,"imports":[{"path":"@effect/schema","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-data","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-status-bar/src/meta.ts","kind":"import-statement","original":"../meta"},{"path":"packages/plugins/plugin-status-bar/src/translations.ts","kind":"import-statement","original":"../translations"}],"format":"esm"},"packages/plugins/plugin-status-bar/src/components/StatusBarPanel.tsx":{"bytes":6006,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-status-bar/src/components/FeedbackForm.tsx","kind":"import-statement","original":"./FeedbackForm"},{"path":"packages/plugins/plugin-status-bar/src/components/StatusBar.tsx","kind":"import-statement","original":"./StatusBar"}],"format":"esm"},"packages/plugins/plugin-status-bar/src/components/index.ts":{"bytes":624,"imports":[{"path":"packages/plugins/plugin-status-bar/src/components/StatusBar.tsx","kind":"import-statement","original":"./StatusBar"},{"path":"packages/plugins/plugin-status-bar/src/components/StatusBarPanel.tsx","kind":"import-statement","original":"./StatusBarPanel"}],"format":"esm"},"packages/plugins/plugin-status-bar/src/StatusBarPlugin.tsx":{"bytes":2663,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-status-bar/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/plugins/plugin-status-bar/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-status-bar/src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"packages/plugins/plugin-status-bar/src/index.ts":{"bytes":916,"imports":[{"path":"packages/plugins/plugin-status-bar/src/StatusBarPlugin.tsx","kind":"import-statement","original":"./StatusBarPlugin"},{"path":"packages/plugins/plugin-status-bar/src/StatusBarPlugin.tsx","kind":"import-statement","original":"./StatusBarPlugin"},{"path":"packages/plugins/plugin-status-bar/src/components/index.ts","kind":"import-statement","original":"./components"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-status-bar/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":20348},"packages/plugins/plugin-status-bar/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/plugin-status-bar/dist/lib/browser/chunk-4KDZC7WS.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@effect/schema","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-data","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"exports":["StatusBar","StatusBarPanel","StatusBarPlugin","default"],"entryPoint":"packages/plugins/plugin-status-bar/src/index.ts","inputs":{"packages/plugins/plugin-status-bar/src/StatusBarPlugin.tsx":{"bytesInOutput":424},"packages/plugins/plugin-status-bar/src/components/StatusBar.tsx":{"bytesInOutput":2478},"packages/plugins/plugin-status-bar/src/components/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-status-bar/src/components/StatusBarPanel.tsx":{"bytesInOutput":1692},"packages/plugins/plugin-status-bar/src/components/FeedbackForm.tsx":{"bytesInOutput":4721},"packages/plugins/plugin-status-bar/src/translations.ts":{"bytesInOutput":570},"packages/plugins/plugin-status-bar/src/index.ts":{"bytesInOutput":35}},"bytes":10711},"packages/plugins/plugin-status-bar/dist/lib/browser/meta.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-status-bar/dist/lib/browser/meta.mjs":{"imports":[{"path":"packages/plugins/plugin-status-bar/dist/lib/browser/chunk-4KDZC7WS.mjs","kind":"import-statement"}],"exports":["STATUS_BAR_PLUGIN","default"],"entryPoint":"packages/plugins/plugin-status-bar/src/meta.ts","inputs":{},"bytes":169},"packages/plugins/plugin-status-bar/dist/lib/browser/chunk-4KDZC7WS.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":600},"packages/plugins/plugin-status-bar/dist/lib/browser/chunk-4KDZC7WS.mjs":{"imports":[],"exports":["STATUS_BAR_PLUGIN","meta_default"],"inputs":{"packages/plugins/plugin-status-bar/src/meta.ts":{"bytesInOutput":210}},"bytes":353}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeedbackForm.d.ts","sourceRoot":"","sources":["../../../../src/components/FeedbackForm.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FeedbackForm.d.ts","sourceRoot":"","sources":["../../../../src/components/FeedbackForm.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAsB,MAAM,OAAO,CAAC;AA+B3C,eAAO,MAAM,YAAY,gBAAiB;IAAE,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,sBAwFhE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBar.d.ts","sourceRoot":"","sources":["../../../../src/components/StatusBar.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,EAAmC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAgB/E,QAAA,MAAM,eAAe;cAHmC,SAAS;cAAY,OAAO;;;qFAsBnF,CAAC;AAEF,eAAe,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"StatusBar.d.ts","sourceRoot":"","sources":["../../../../src/components/StatusBar.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,EAAmC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAgB/E,QAAA,MAAM,eAAe;cAHmC,SAAS;cAAY,OAAO;;;qFAsBnF,CAAC;AAEF,eAAe,eAAe,CAAC;AAwD/B,eAAO,MAAM,SAAS;;kBAvCqC,SAAS;;;;;kBAjDd,SAAS;;;;;kBAkCT,SAAS;;;;;kBA1BP,SAAS;kBAAY,OAAO;;;;;kBAgE/B,SAAS;;;;;kBAQX,SAAS;;;;CAe3D,CAAC"}
|
|
@@ -1,50 +1,9 @@
|
|
|
1
1
|
import '@dxos-theme';
|
|
2
|
+
import { type Meta } from '@storybook/react';
|
|
2
3
|
import React from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}, "className"> & {
|
|
9
|
-
classNames?: import("packages/ui/react-ui-types/dist/types/src").ClassNameValue;
|
|
10
|
-
} & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
-
Text: React.ForwardRefExoticComponent<Omit<{
|
|
12
|
-
children: React.ReactNode;
|
|
13
|
-
}, "className"> & {
|
|
14
|
-
classNames?: import("packages/ui/react-ui-types/dist/types/src").ClassNameValue;
|
|
15
|
-
} & React.RefAttributes<HTMLSpanElement>>;
|
|
16
|
-
Item: React.ForwardRefExoticComponent<Omit<{
|
|
17
|
-
children: React.ReactNode;
|
|
18
|
-
}, "className"> & {
|
|
19
|
-
classNames?: import("packages/ui/react-ui-types/dist/types/src").ClassNameValue;
|
|
20
|
-
} & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
-
Button: React.ForwardRefExoticComponent<Omit<{
|
|
22
|
-
children: React.ReactNode;
|
|
23
|
-
asChild?: boolean;
|
|
24
|
-
}, "className"> & {
|
|
25
|
-
classNames?: import("packages/ui/react-ui-types/dist/types/src").ClassNameValue;
|
|
26
|
-
} & React.HTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
|
|
27
|
-
StartContent: React.ForwardRefExoticComponent<Omit<{
|
|
28
|
-
children: React.ReactNode;
|
|
29
|
-
}, "className"> & {
|
|
30
|
-
classNames?: import("packages/ui/react-ui-types/dist/types/src").ClassNameValue;
|
|
31
|
-
} & React.RefAttributes<HTMLDivElement>>;
|
|
32
|
-
EndContent: React.ForwardRefExoticComponent<Omit<{
|
|
33
|
-
children: React.ReactNode;
|
|
34
|
-
}, "className"> & {
|
|
35
|
-
classNames?: import("packages/ui/react-ui-types/dist/types/src").ClassNameValue;
|
|
36
|
-
} & React.RefAttributes<HTMLDivElement>>;
|
|
37
|
-
};
|
|
38
|
-
actions: {
|
|
39
|
-
argTypesRegex: string;
|
|
40
|
-
};
|
|
41
|
-
decorators: import("@storybook/react/*").Decorator[];
|
|
42
|
-
parameters: {
|
|
43
|
-
chromatic: {
|
|
44
|
-
disableSnapshot: boolean;
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
export default _default;
|
|
49
|
-
export declare const Normal: (_props: any) => React.JSX.Element;
|
|
4
|
+
import { StatusBar } from './StatusBar';
|
|
5
|
+
export declare const DefaultStory: () => React.JSX.Element;
|
|
6
|
+
export declare const Default: {};
|
|
7
|
+
declare const meta: Meta<typeof StatusBar>;
|
|
8
|
+
export default meta;
|
|
50
9
|
//# sourceMappingURL=StatusBar.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBar.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/StatusBar.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"StatusBar.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/StatusBar.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,eAAO,MAAM,YAAY,yBAmBxB,CAAC;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC;AAE1B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,SAAS,CAQhC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusBarPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/StatusBarPanel.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAQxC,eAAO,MAAM,cAAc,yBA8B1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
|
package/dist/types/src/meta.d.ts
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import { type IconProps } from '@phosphor-icons/react';
|
|
2
|
-
import React from 'react';
|
|
3
1
|
export declare const STATUS_BAR_PLUGIN = "dxos.org/plugin/status-bar";
|
|
4
2
|
declare const _default: {
|
|
5
3
|
id: string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
homePage?: string;
|
|
10
|
-
tags?: string[];
|
|
11
|
-
iconComponent?: React.FC<IconProps>;
|
|
12
|
-
iconSymbol?: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
icon: string;
|
|
13
7
|
};
|
|
14
8
|
export default _default;
|
|
15
9
|
//# sourceMappingURL=meta.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,iBAAiB,+BAA+B,CAAC;;;;;;;AAE9D,wBAKuB"}
|
package/package.json
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-status-bar",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.14-main.69511f5",
|
|
4
4
|
"description": "Status bar plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "DXOS.org",
|
|
9
|
+
"sideEffects": true,
|
|
9
10
|
"exports": {
|
|
10
11
|
".": {
|
|
11
|
-
"
|
|
12
|
-
"
|
|
12
|
+
"types": "./dist/types/src/index.d.ts",
|
|
13
|
+
"browser": "./dist/lib/browser/index.mjs"
|
|
13
14
|
},
|
|
14
15
|
"./meta": {
|
|
15
|
-
"
|
|
16
|
-
"
|
|
16
|
+
"types": "./dist/types/src/meta.d.ts",
|
|
17
|
+
"browser": "./dist/lib/browser/meta.mjs"
|
|
17
18
|
}
|
|
18
19
|
},
|
|
19
20
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -29,19 +30,16 @@
|
|
|
29
30
|
"src"
|
|
30
31
|
],
|
|
31
32
|
"dependencies": {
|
|
32
|
-
"@effect/schema": "^0.
|
|
33
|
+
"@effect/schema": "^0.75.1",
|
|
33
34
|
"@fluentui/react-tabster": "^9.19.0",
|
|
34
35
|
"@preact/signals-core": "^1.6.0",
|
|
35
36
|
"@radix-ui/react-slot": "^1.0.1",
|
|
36
|
-
"effect": "^3.
|
|
37
|
+
"effect": "^3.9.1",
|
|
37
38
|
"react-resize-detector": "^11.0.1",
|
|
38
|
-
"@dxos/app-framework": "0.6.
|
|
39
|
-
"@dxos/async": "0.6.
|
|
40
|
-
"@dxos/echo-schema": "0.6.
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/plugin-client": "0.6.13",
|
|
43
|
-
"@dxos/plugin-stack": "0.6.13",
|
|
44
|
-
"@dxos/react-client": "0.6.13"
|
|
39
|
+
"@dxos/app-framework": "0.6.14-main.69511f5",
|
|
40
|
+
"@dxos/async": "0.6.14-main.69511f5",
|
|
41
|
+
"@dxos/echo-schema": "0.6.14-main.69511f5",
|
|
42
|
+
"@dxos/react-ui-data": "0.6.14-main.69511f5"
|
|
45
43
|
},
|
|
46
44
|
"devDependencies": {
|
|
47
45
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -49,17 +47,17 @@
|
|
|
49
47
|
"@types/react-dom": "~18.2.0",
|
|
50
48
|
"react": "~18.2.0",
|
|
51
49
|
"react-dom": "~18.2.0",
|
|
52
|
-
"vite": "
|
|
53
|
-
"@dxos/react-ui": "0.6.
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
50
|
+
"vite": "5.4.7",
|
|
51
|
+
"@dxos/react-ui": "0.6.14-main.69511f5",
|
|
52
|
+
"@dxos/react-ui-theme": "0.6.14-main.69511f5",
|
|
53
|
+
"@dxos/storybook-utils": "0.6.14-main.69511f5"
|
|
56
54
|
},
|
|
57
55
|
"peerDependencies": {
|
|
58
56
|
"@phosphor-icons/react": "^2.0.5",
|
|
59
|
-
"react": "
|
|
60
|
-
"react-dom": "
|
|
61
|
-
"@dxos/react-ui": "0.6.
|
|
62
|
-
"@dxos/react-ui-theme": "0.6.
|
|
57
|
+
"react": "~18.2.0",
|
|
58
|
+
"react-dom": "~18.2.0",
|
|
59
|
+
"@dxos/react-ui": "0.6.14-main.69511f5",
|
|
60
|
+
"@dxos/react-ui-theme": "0.6.14-main.69511f5"
|
|
63
61
|
},
|
|
64
62
|
"publishConfig": {
|
|
65
63
|
"access": "public"
|
package/src/StatusBarPlugin.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import React from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { type PluginDefinition, type SurfaceProvides, type TranslationsProvides } from '@dxos/app-framework';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { StatusBarPanel } from './components';
|
|
10
10
|
import meta from './meta';
|
|
11
11
|
import translations from './translations';
|
|
12
12
|
|
|
@@ -21,7 +21,7 @@ export const StatusBarPlugin = (): PluginDefinition<StatusBarPluginProvides> =>
|
|
|
21
21
|
component: ({ role }) => {
|
|
22
22
|
switch (role) {
|
|
23
23
|
case 'status-bar': {
|
|
24
|
-
return <
|
|
24
|
+
return <StatusBarPanel />;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -2,30 +2,29 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Schema as S } from '@effect/schema';
|
|
6
|
+
import { PaperPlaneTilt, X } from '@phosphor-icons/react';
|
|
6
7
|
import React, { useCallback } from 'react';
|
|
7
8
|
|
|
8
9
|
import { useIntentDispatcher } from '@dxos/app-framework';
|
|
9
|
-
import { S } from '@dxos/echo-schema';
|
|
10
10
|
import { Button, Input, Popover, useTranslation } from '@dxos/react-ui';
|
|
11
|
+
import { useForm } from '@dxos/react-ui-data';
|
|
11
12
|
import { getSize } from '@dxos/react-ui-theme';
|
|
12
13
|
|
|
13
|
-
import { useForm } from '../hooks';
|
|
14
14
|
import { STATUS_BAR_PLUGIN } from '../meta';
|
|
15
15
|
import { mkTranslation } from '../translations';
|
|
16
|
-
import { validate } from '../util';
|
|
17
16
|
|
|
18
17
|
const Email = S.String.pipe(
|
|
19
|
-
S.
|
|
18
|
+
S.nonEmptyString({ message: () => 'Email is required.' }),
|
|
20
19
|
S.pattern(/^(?!\.)(?!.*\.\.)([A-Z0-9_+-.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9-]*\.)+[A-Z]{2,}$/i, {
|
|
21
20
|
message: () => 'Invalid email address.',
|
|
22
21
|
}),
|
|
23
22
|
);
|
|
24
23
|
|
|
25
|
-
const nonEmpty = (field: string) => S.
|
|
24
|
+
const nonEmpty = (field: string) => S.nonEmptyString({ message: () => `${field} is required.` });
|
|
26
25
|
const maxLength = (field: string, length: number) => S.maxLength(length, { message: () => `${field} is too long.` });
|
|
27
26
|
|
|
28
|
-
//
|
|
27
|
+
// Types and validation.
|
|
29
28
|
const FeedbackFormSchema = S.Struct({
|
|
30
29
|
name: S.String.pipe(nonEmpty('Name'), maxLength('Name', 256)),
|
|
31
30
|
email: Email.pipe(maxLength('Email', 256)),
|
|
@@ -51,8 +50,8 @@ export const FeedbackForm = ({ onClose }: { onClose: () => void }) => {
|
|
|
51
50
|
|
|
52
51
|
const { errors, handleSubmit, canSubmit, touched, getInputProps } = useForm<FeedbackFormState>({
|
|
53
52
|
initialValues,
|
|
54
|
-
|
|
55
|
-
onSubmit
|
|
53
|
+
schema: FeedbackFormSchema,
|
|
54
|
+
onSubmit,
|
|
56
55
|
});
|
|
57
56
|
|
|
58
57
|
return (
|
|
@@ -4,40 +4,45 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { type Meta } from '@storybook/react';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
|
+
import { Icon } from '@dxos/react-ui';
|
|
10
11
|
import { withTheme } from '@dxos/storybook-utils';
|
|
11
12
|
|
|
12
13
|
import { StatusBar } from './StatusBar';
|
|
13
14
|
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export const Normal = (_props: any) => (
|
|
23
|
-
<>
|
|
24
|
-
<StatusBar.Container>
|
|
25
|
-
<StatusBar.EndContent>
|
|
15
|
+
export const DefaultStory = () => (
|
|
16
|
+
<StatusBar.Container>
|
|
17
|
+
<StatusBar.EndContent>
|
|
18
|
+
<StatusBar.Button>
|
|
19
|
+
<Icon icon='ph--mailbox--regular' size={4} />
|
|
20
|
+
<StatusBar.Text>Quick feedback</StatusBar.Text>
|
|
21
|
+
</StatusBar.Button>
|
|
22
|
+
<a href='https://dxos.org/discord' target='_blank' rel='noopener noreferrer'>
|
|
26
23
|
<StatusBar.Button>
|
|
27
|
-
<
|
|
28
|
-
<StatusBar.Text>
|
|
24
|
+
<Icon icon='ph--discord-logo--regular' size={4} />
|
|
25
|
+
<StatusBar.Text>Join us on Discord</StatusBar.Text>
|
|
29
26
|
</StatusBar.Button>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
<Lightning />
|
|
38
|
-
<StatusBar.Text>Online</StatusBar.Text>
|
|
39
|
-
</StatusBar.Item>
|
|
40
|
-
</StatusBar.EndContent>
|
|
41
|
-
</StatusBar.Container>
|
|
42
|
-
</>
|
|
27
|
+
</a>
|
|
28
|
+
<StatusBar.Item>
|
|
29
|
+
<Icon icon='ph--lightning--regular' size={4} />
|
|
30
|
+
<StatusBar.Text>Online</StatusBar.Text>
|
|
31
|
+
</StatusBar.Item>
|
|
32
|
+
</StatusBar.EndContent>
|
|
33
|
+
</StatusBar.Container>
|
|
43
34
|
);
|
|
35
|
+
|
|
36
|
+
export const Default = {};
|
|
37
|
+
|
|
38
|
+
const meta: Meta<typeof StatusBar> = {
|
|
39
|
+
title: 'plugins/plugin-status/StatusBar',
|
|
40
|
+
component: StatusBar as any,
|
|
41
|
+
render: DefaultStory,
|
|
42
|
+
decorators: [withTheme],
|
|
43
|
+
parameters: {
|
|
44
|
+
chromatic: { disableSnapshot: false },
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default meta;
|
|
@@ -57,9 +57,10 @@ const StatusBarItem = forwardRef<HTMLDivElement, StatusBarItemProps>(
|
|
|
57
57
|
</div>
|
|
58
58
|
),
|
|
59
59
|
);
|
|
60
|
+
|
|
60
61
|
type StatusBarContainerProps = ThemedClassName<{ children: ReactNode }>;
|
|
61
62
|
|
|
62
|
-
// TODO(zan): tabable group with tabster
|
|
63
|
+
// TODO(zan): tabable group with tabster.
|
|
63
64
|
const StatusBarContainer = forwardRef<HTMLDivElement, StatusBarContainerProps>(
|
|
64
65
|
({ classNames, children }, forwardedRef) => {
|
|
65
66
|
const groupAttrs = useFocusableGroup({ tabBehavior: 'limited' });
|
|
@@ -69,7 +70,7 @@ const StatusBarContainer = forwardRef<HTMLDivElement, StatusBarContainerProps>(
|
|
|
69
70
|
tabIndex={0}
|
|
70
71
|
{...groupAttrs}
|
|
71
72
|
className={mx(
|
|
72
|
-
'bs-[--statusbar-size] flex justify-end items-center gap-2
|
|
73
|
+
'bs-[--statusbar-size] flex justify-end items-center gap-2 bg-base text-description text-lg pointer-fine:text-xs ch-focus-ring-inset',
|
|
73
74
|
classNames,
|
|
74
75
|
)}
|
|
75
76
|
ref={forwardedRef}
|
|
@@ -2,17 +2,15 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { DiscordLogo, PaperPlaneTilt } from '@phosphor-icons/react';
|
|
6
5
|
import React, { useState } from 'react';
|
|
7
6
|
|
|
8
7
|
import { Surface } from '@dxos/app-framework';
|
|
9
|
-
import { Popover } from '@dxos/react-ui';
|
|
8
|
+
import { Icon, Popover } from '@dxos/react-ui';
|
|
10
9
|
|
|
11
10
|
import { FeedbackForm } from './FeedbackForm';
|
|
12
11
|
import { StatusBar } from './StatusBar';
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
export const StatusBarImpl = () => {
|
|
13
|
+
export const StatusBarPanel = () => {
|
|
16
14
|
const [open, setOpen] = useState(false);
|
|
17
15
|
|
|
18
16
|
// TODO(wittjosiah): Factor out feedback and discord buttons.
|
|
@@ -22,14 +20,14 @@ export const StatusBarImpl = () => {
|
|
|
22
20
|
<StatusBar.EndContent>
|
|
23
21
|
<Popover.Trigger asChild>
|
|
24
22
|
<StatusBar.Button aria-label='Give feedback about composer' data-joyride='welcome/feedback'>
|
|
25
|
-
<
|
|
23
|
+
<Icon icon='ph--paper-plane-tilt--regular' size={4} />
|
|
26
24
|
<StatusBar.Text classNames='hidden sm:block'>Feedback</StatusBar.Text>
|
|
27
25
|
</StatusBar.Button>
|
|
28
26
|
</Popover.Trigger>
|
|
29
27
|
{/* TODO(zan): Configure this label? */}
|
|
30
28
|
<StatusBar.Button aria-label='Open DXOS Discord' asChild>
|
|
31
29
|
<a href='https://dxos.org/discord' target='_blank' rel='noopener noreferrer'>
|
|
32
|
-
<
|
|
30
|
+
<Icon icon='ph--discord-logo--regular' size={4} />
|
|
33
31
|
<StatusBar.Text classNames='hidden sm:block'>Discord</StatusBar.Text>
|
|
34
32
|
</a>
|
|
35
33
|
</StatusBar.Button>
|
package/src/components/index.ts
CHANGED
package/src/meta.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type PluginMeta } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
export const STATUS_BAR_PLUGIN = 'dxos.org/plugin/status-bar';
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
id: STATUS_BAR_PLUGIN,
|
|
11
|
+
name: 'Status Bar',
|
|
12
|
+
description: 'Display a bar with status and actions.',
|
|
13
|
+
icon: 'ph--info--regular',
|
|
14
|
+
} satisfies PluginMeta;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// packages/plugins/plugin-status-bar/src/meta.tsx
|
|
2
|
-
import { Info } from "@phosphor-icons/react";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { pluginMeta } from "@dxos/app-framework";
|
|
5
|
-
var STATUS_BAR_PLUGIN = "dxos.org/plugin/status-bar";
|
|
6
|
-
var meta_default = pluginMeta({
|
|
7
|
-
id: STATUS_BAR_PLUGIN,
|
|
8
|
-
name: "Status Bar",
|
|
9
|
-
description: "Display a bar with status and actions.",
|
|
10
|
-
iconComponent: (props) => /* @__PURE__ */ React.createElement(Info, props),
|
|
11
|
-
iconSymbol: "ph--info--regular"
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
STATUS_BAR_PLUGIN,
|
|
16
|
-
meta_default
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=chunk-PL5XPTPX.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Info, type IconProps } from '@phosphor-icons/react';\nimport React from 'react';\n\nimport { pluginMeta } from '@dxos/app-framework';\n\nexport const STATUS_BAR_PLUGIN = 'dxos.org/plugin/status-bar';\n\nexport default pluginMeta({\n id: STATUS_BAR_PLUGIN,\n name: 'Status Bar',\n description: 'Display a bar with status and actions.',\n iconComponent: (props: IconProps) => <Info {...props} />,\n iconSymbol: 'ph--info--regular',\n});\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,YAA4B;AACrC,OAAOC,WAAW;AAElB,SAASC,kBAAkB;AAEpB,IAAMC,oBAAoB;AAEjC,IAAA,eAAeC,WAAW;EACxBC,IAAIF;EACJG,MAAM;EACNC,aAAa;EACbC,eAAe,CAACC,UAAqB,sBAAA,cAACC,MAASD,KAAAA;EAC/CE,YAAY;AACd,CAAA;",
|
|
6
|
-
"names": ["Info", "React", "pluginMeta", "STATUS_BAR_PLUGIN", "pluginMeta", "id", "name", "description", "iconComponent", "props", "Info", "iconSymbol"]
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBarImpl.d.ts","sourceRoot":"","sources":["../../../../src/components/StatusBarImpl.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAmB,MAAM,OAAO,CAAC;AASxC,eAAO,MAAM,aAAa,yBA8BzB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { type ChangeEvent } from 'react';
|
|
2
|
-
import { type ValidationError } from '../util';
|
|
3
|
-
interface FormOptions<T> {
|
|
4
|
-
initialValues: T;
|
|
5
|
-
validate: (values: any) => ValidationError[] | undefined;
|
|
6
|
-
onSubmit: (values: T) => void;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Creates a hook for managing form state, including values, validation, and submission.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* const { values, handleChange, handleSubmit, errors, canSubmit, getInputProps } = useForm({
|
|
13
|
-
* initialValues: { name: '', email: '' },
|
|
14
|
-
* validate: (values) => { yourValidationLogic(values); },
|
|
15
|
-
* onSubmit: (values) => { submissionLogic(values); },
|
|
16
|
-
* });
|
|
17
|
-
*/
|
|
18
|
-
export declare const useForm: <T extends object>({ initialValues, validate, onSubmit }: FormOptions<T>) => {
|
|
19
|
-
values: T;
|
|
20
|
-
handleChange: (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
21
|
-
handleSubmit: () => void;
|
|
22
|
-
errors: Record<keyof T, string>;
|
|
23
|
-
canSubmit: boolean;
|
|
24
|
-
touched: Record<keyof T, boolean>;
|
|
25
|
-
handleBlur: (event: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
26
|
-
onValidate: (values: T) => boolean;
|
|
27
|
-
getInputProps: (key: keyof T) => {
|
|
28
|
-
name: keyof T;
|
|
29
|
-
value: T[keyof T];
|
|
30
|
-
onChange: (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
31
|
-
onBlur: (event: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
32
|
-
'aria-invalid': boolean;
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
export {};
|
|
36
|
-
//# sourceMappingURL=useForm.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useForm.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAK/C,UAAU,WAAW,CAAC,CAAC;IACrB,aAAa,EAAE,CAAC,CAAC;IACjB,QAAQ,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,eAAe,EAAE,GAAG,SAAS,CAAC;IACzD,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;CAC/B;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,MAAM,yCAAyC,WAAW,CAAC,CAAC,CAAC;;0BAkBnF,WAAW,CAAC,gBAAgB,GAAG,mBAAmB,CAAC;;;;;wBAYnD,KAAK,CAAC,UAAU,CAAC,gBAAgB,GAAG,mBAAmB,CAAC;yBAtBvD,CAAC;yBAiDJ,MAAM,CAAC;;;0BAvCL,WAAW,CAAC,gBAAgB,GAAG,mBAAmB,CAAC;wBAYnD,KAAK,CAAC,UAAU,CAAC,gBAAgB,GAAG,mBAAmB,CAAC;;;CAgDnE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/util/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../../src/util/validation.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAEtC,MAAM,MAAM,eAAe,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhE,eAAO,MAAM,QAAQ,GAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,GAAG,KAAG,eAAe,EAAE,GAAG,SAWhF,CAAC"}
|
package/src/hooks/index.ts
DELETED
package/src/hooks/useForm.ts
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
import { type ChangeEvent, useCallback, useState } from 'react';
|
|
5
|
-
|
|
6
|
-
import { type ValidationError } from '../util';
|
|
7
|
-
|
|
8
|
-
// TODO(Zan): This module will be generally useful and we should factor it out after the
|
|
9
|
-
// API crystallizes a bit more.
|
|
10
|
-
|
|
11
|
-
interface FormOptions<T> {
|
|
12
|
-
initialValues: T;
|
|
13
|
-
validate: (values: any) => ValidationError[] | undefined;
|
|
14
|
-
onSubmit: (values: T) => void;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Creates a hook for managing form state, including values, validation, and submission.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* const { values, handleChange, handleSubmit, errors, canSubmit, getInputProps } = useForm({
|
|
22
|
-
* initialValues: { name: '', email: '' },
|
|
23
|
-
* validate: (values) => { yourValidationLogic(values); },
|
|
24
|
-
* onSubmit: (values) => { submissionLogic(values); },
|
|
25
|
-
* });
|
|
26
|
-
*/
|
|
27
|
-
export const useForm = <T extends object>({ initialValues, validate, onSubmit }: FormOptions<T>) => {
|
|
28
|
-
const [values, setValues] = useState<T>(initialValues);
|
|
29
|
-
const [errors, setErrors] = useState<Record<keyof T, string>>({} as Record<keyof T, string>);
|
|
30
|
-
const [touched, setTouched] = useState<Record<keyof T, boolean>>(
|
|
31
|
-
Object.keys(initialValues).reduce((acc, key) => ({ ...acc, [key]: false }), {} as Record<keyof T, boolean>),
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
const runValidation = useCallback(
|
|
35
|
-
(values: T) => {
|
|
36
|
-
const validationErrors = validate(values);
|
|
37
|
-
setErrors(collapseErrorArray(validationErrors ?? []));
|
|
38
|
-
|
|
39
|
-
return validationErrors === undefined;
|
|
40
|
-
},
|
|
41
|
-
[validate],
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
const handleChange = useCallback(
|
|
45
|
-
(event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
|
|
46
|
-
const { name, value } = event.target;
|
|
47
|
-
const newValues = { ...values, [name]: value };
|
|
48
|
-
setValues(newValues);
|
|
49
|
-
runValidation(newValues);
|
|
50
|
-
},
|
|
51
|
-
[values, runValidation],
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
const touchAll = useCallback(() => setTouched(mkAllTouched(values)), [values, setTouched]);
|
|
55
|
-
|
|
56
|
-
const handleBlur = useCallback(
|
|
57
|
-
(event: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => {
|
|
58
|
-
const { name } = event.target;
|
|
59
|
-
setTouched((touched) => ({ ...touched, [name]: true }));
|
|
60
|
-
|
|
61
|
-
// TODO(Zan): This should be configurable behavior.
|
|
62
|
-
if (event.relatedTarget?.getAttribute('type') === 'submit') {
|
|
63
|
-
// NOTE: We do this here instead of onSubmit, because the blur event is triggered before the submit event
|
|
64
|
-
// and results in the submit button being disabled when the form is invalid.
|
|
65
|
-
touchAll();
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
runValidation(values);
|
|
69
|
-
},
|
|
70
|
-
[runValidation, values, touchAll],
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
const handleSubmit = useCallback(() => {
|
|
74
|
-
if (runValidation(values)) {
|
|
75
|
-
onSubmit(values);
|
|
76
|
-
}
|
|
77
|
-
}, [values, runValidation, onSubmit]);
|
|
78
|
-
|
|
79
|
-
// NOTE: We can submit if there is no touched field that has an error.
|
|
80
|
-
// - Basically, if there's a validation message present in the form, submit should be disabled.
|
|
81
|
-
const canSubmit = Object.keys(values).every((key) => touched[key as keyof T] === false || !errors[key as keyof T]);
|
|
82
|
-
|
|
83
|
-
const getInputProps = useCallback(
|
|
84
|
-
(key: keyof T) => ({
|
|
85
|
-
name: key,
|
|
86
|
-
value: values[key],
|
|
87
|
-
onChange: handleChange,
|
|
88
|
-
onBlur: handleBlur,
|
|
89
|
-
'aria-invalid': errors[key] !== undefined,
|
|
90
|
-
}),
|
|
91
|
-
[values, handleChange, handleBlur, errors],
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
return {
|
|
95
|
-
values,
|
|
96
|
-
handleChange,
|
|
97
|
-
handleSubmit,
|
|
98
|
-
errors,
|
|
99
|
-
canSubmit,
|
|
100
|
-
touched,
|
|
101
|
-
handleBlur,
|
|
102
|
-
onValidate: runValidation,
|
|
103
|
-
getInputProps,
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const mkAllTouched = <T extends Record<keyof T, any>>(values: T) => {
|
|
108
|
-
return Object.keys(values).reduce((acc, key) => ({ ...acc, [key]: true }), {} as Record<keyof T, boolean>);
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
const collapseErrorArray = <T>(errors: ValidationError[]) =>
|
|
112
|
-
errors.reduce(
|
|
113
|
-
(acc, { path, message }) => {
|
|
114
|
-
// TODO(Zan): This won't play well with nesting.
|
|
115
|
-
acc[path as keyof T] = message;
|
|
116
|
-
return acc;
|
|
117
|
-
},
|
|
118
|
-
{} as Record<keyof T, string>,
|
|
119
|
-
);
|
package/src/meta.tsx
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Info, type IconProps } from '@phosphor-icons/react';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
import { pluginMeta } from '@dxos/app-framework';
|
|
9
|
-
|
|
10
|
-
export const STATUS_BAR_PLUGIN = 'dxos.org/plugin/status-bar';
|
|
11
|
-
|
|
12
|
-
export default pluginMeta({
|
|
13
|
-
id: STATUS_BAR_PLUGIN,
|
|
14
|
-
name: 'Status Bar',
|
|
15
|
-
description: 'Display a bar with status and actions.',
|
|
16
|
-
iconComponent: (props: IconProps) => <Info {...props} />,
|
|
17
|
-
iconSymbol: 'ph--info--regular',
|
|
18
|
-
});
|
package/src/util/index.ts
DELETED
package/src/util/validation.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
import { ArrayFormatter } from '@effect/schema';
|
|
5
|
-
import { Effect } from 'effect';
|
|
6
|
-
|
|
7
|
-
import { S } from '@dxos/echo-schema';
|
|
8
|
-
|
|
9
|
-
export type ValidationError = { path: string; message: string };
|
|
10
|
-
|
|
11
|
-
export const validate = <T>(schema: S.Schema<T>, data: any): ValidationError[] | undefined => {
|
|
12
|
-
const validator = S.decodeUnknownEither(schema, { errors: 'all' });
|
|
13
|
-
const result = validator(data);
|
|
14
|
-
|
|
15
|
-
if (result._tag === 'Left') {
|
|
16
|
-
const errors = Effect.runSync(ArrayFormatter.formatError(result.left));
|
|
17
|
-
// TODO(Zan): Path.join is an assumption...
|
|
18
|
-
return errors.map(({ message, path }) => ({ message, path: path.join('.') }));
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return undefined;
|
|
22
|
-
};
|