@igne-agency/react-web-ui 0.3.0 → 0.4.0
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/README.md +32 -1
- package/dist/components/accordion/accordion.css +24 -19
- package/dist/components/accordion/accordion.d.ts +19 -3
- package/dist/components/accordion/accordion.js +86 -32
- package/dist/components/accordion/accordion.module.js +8 -8
- package/dist/components/active-filters/active-filter-describers.d.ts +1 -1
- package/dist/components/active-filters/active-filter-describers.js +1 -1
- package/dist/components/active-filters/active-filters.d.ts +35 -2
- package/dist/components/active-filters/active-filters.js +57 -52
- package/dist/components/active-filters/index.js +2 -2
- package/dist/components/attachment-tile/attachment-preview.d.ts +11 -9
- package/dist/components/attachment-tile/attachment-preview.js +102 -68
- package/dist/components/attachment-tile/attachment-tile.css +22 -13
- package/dist/components/attachment-tile/attachment-tile.d.ts +51 -6
- package/dist/components/attachment-tile/attachment-tile.js +209 -85
- package/dist/components/attachment-tile/attachment-tile.module.js +10 -10
- package/dist/components/attachment-tile/index.d.ts +1 -1
- package/dist/components/attachment-tile/index.js +2 -2
- package/dist/components/avatar/avatar.d.ts +5 -5
- package/dist/components/avatar/avatar.js +64 -37
- package/dist/components/avatar-group/avatar-group.js +2 -2
- package/dist/components/badge/badge.js +1 -1
- package/dist/components/breadcrumbs/breadcrumbs.d.ts +22 -7
- package/dist/components/breadcrumbs/breadcrumbs.js +189 -170
- package/dist/components/button/button.d.ts +2 -3
- package/dist/components/button/button.js +58 -77
- package/dist/components/button/close-button.d.ts +4 -2
- package/dist/components/button/close-button.js +9 -9
- package/dist/components/checkbox-field/checkbox-field.d.ts +17 -3
- package/dist/components/checkbox-field/checkbox-field.js +108 -131
- package/dist/components/checkbox-field/checkbox.css +26 -34
- package/dist/components/checkbox-field/checkbox.d.ts +51 -8
- package/dist/components/checkbox-field/checkbox.js +221 -57
- package/dist/components/checkbox-field/checkbox.module.js +6 -8
- package/dist/components/checkbox-field/index.d.ts +0 -1
- package/dist/components/checkbox-field/index.js +1 -2
- package/dist/components/checkbox-field/tsf-checkbox-field.d.ts +2 -2
- package/dist/components/checkbox-group-field/checkbox-group-field.d.ts +4 -1
- package/dist/components/checkbox-group-field/checkbox-group-field.js +54 -50
- package/dist/components/checkbox-group-field/checkbox-group.d.ts +7 -2
- package/dist/components/checkbox-group-field/checkbox-group.js +8 -3
- package/dist/components/collapsible/collapsible.css +23 -18
- package/dist/components/collapsible/collapsible.d.ts +18 -3
- package/dist/components/collapsible/collapsible.js +85 -32
- package/dist/components/collapsible/collapsible.module.js +7 -7
- package/dist/components/combobox-field/combobox-field.d.ts +9 -1
- package/dist/components/combobox-field/combobox-field.js +195 -175
- package/dist/components/combobox-field/combobox-items.d.ts +2 -2
- package/dist/components/combobox-field/combobox-items.js +4 -4
- package/dist/components/combobox-field/combobox.css +99 -96
- package/dist/components/combobox-field/combobox.d.ts +94 -15
- package/dist/components/combobox-field/combobox.js +484 -159
- package/dist/components/combobox-field/combobox.module.js +21 -21
- package/dist/components/combobox-field/index.d.ts +0 -1
- package/dist/components/combobox-field/selection.d.ts +4 -1
- package/dist/components/combobox-field/value-state-view.css +7 -3
- package/dist/components/combobox-field/value-state-view.d.ts +4 -2
- package/dist/components/combobox-field/value-state-view.js +15 -15
- package/dist/components/combobox-field/value-state-view.module.js +6 -4
- package/dist/components/composer/composer-attachments.d.ts +11 -3
- package/dist/components/composer/composer-attachments.js +61 -47
- package/dist/components/composer/composer-editor.d.ts +2 -1
- package/dist/components/composer/composer-editor.js +79 -71
- package/dist/components/composer/composer-mentions.js +2 -2
- package/dist/components/composer/composer.d.ts +42 -21
- package/dist/components/composer/composer.js +201 -58
- package/dist/components/composer/mention-text.js +3 -3
- package/dist/components/confirm-dialog/confirm-dialog.d.ts +8 -7
- package/dist/components/confirm-dialog/confirm-dialog.js +10 -9
- package/dist/components/conversation/conversation.context.d.ts +0 -5
- package/dist/components/conversation/conversation.d.ts +63 -29
- package/dist/components/conversation/conversation.js +193 -82
- package/dist/components/conversation/index.d.ts +1 -1
- package/dist/components/date-field/date-field.d.ts +10 -4
- package/dist/components/date-field/date-field.js +57 -43
- package/dist/components/date-field/date-input.d.ts +20 -3
- package/dist/components/date-field/date-input.js +28 -13
- package/dist/components/date-field/index.d.ts +1 -1
- package/dist/components/date-field/tsf-date-field.d.ts +1 -1
- package/dist/components/date-field/tsf-date-field.js +1 -1
- package/dist/components/date-range-field/date-range-field.d.ts +8 -4
- package/dist/components/date-range-field/date-range-field.js +57 -45
- package/dist/components/date-range-field/date-range-input.d.ts +20 -3
- package/dist/components/date-range-field/date-range-input.js +27 -12
- package/dist/components/date-range-field/tsf-date-range-field.d.ts +1 -1
- package/dist/components/date-range-field/tsf-date-range-field.js +1 -1
- package/dist/components/detail-list/detail-list.d.ts +28 -27
- package/dist/components/detail-list/detail-list.js +177 -121
- package/dist/components/dialog/dialog.d.ts +47 -27
- package/dist/components/dialog/dialog.js +101 -38
- package/dist/components/divider/divider.js +1 -1
- package/dist/components/drawer/drawer.d.ts +48 -30
- package/dist/components/drawer/drawer.js +113 -41
- package/dist/components/email-field/email-field.d.ts +5 -3
- package/dist/components/email-field/email-field.js +1 -3
- package/dist/components/email-field/tsf-email-field.d.ts +3 -2
- package/dist/components/empty-message/empty-message.d.ts +3 -3
- package/dist/components/empty-message/empty-message.js +3 -3
- package/dist/components/error-boundary/error-boundary.d.ts +5 -2
- package/dist/components/error-boundary/error-boundary.js +2 -3
- package/dist/components/error-message/error-message.d.ts +1 -1
- package/dist/components/error-message/error-message.js +1 -1
- package/dist/components/error-text/error-text.js +3 -3
- package/dist/components/field/field.d.ts +5 -5
- package/dist/components/field/field.js +9 -9
- package/dist/components/field/index.js +2 -2
- package/dist/components/field/input-parts.js +1 -1
- package/dist/components/field-placeholder/field-placeholder.d.ts +4 -1
- package/dist/components/field-placeholder/field-placeholder.js +41 -26
- package/dist/components/fieldset/field-group.js +1 -1
- package/dist/components/fieldset/fieldset-root.js +1 -1
- package/dist/components/fieldset/fieldset.css +4 -3
- package/dist/components/fieldset/fieldset.js +1 -1
- package/dist/components/fieldset/fieldset.module.js +2 -2
- package/dist/components/file-field/file-field.css +19 -15
- package/dist/components/file-field/file-field.d.ts +10 -1
- package/dist/components/file-field/file-field.js +130 -109
- package/dist/components/file-field/file-field.module.js +6 -4
- package/dist/components/file-field/file-input.d.ts +32 -9
- package/dist/components/file-field/file-input.js +94 -74
- package/dist/components/filter-bar/filter-bar.d.ts +79 -51
- package/dist/components/filter-bar/filter-bar.js +552 -216
- package/dist/components/form/form.d.ts +4 -6
- package/dist/components/form/form.js +6 -8
- package/dist/components/icon/icon.d.ts +5 -10
- package/dist/components/icon/icon.js +4 -6
- package/dist/components/link/link.js +1 -1
- package/dist/components/link-button/link-button.d.ts +1 -2
- package/dist/components/link-button/link-button.js +12 -22
- package/dist/components/loading-message/loading-message.d.ts +2 -2
- package/dist/components/loading-message/loading-message.js +1 -1
- package/dist/components/locale-provider/locale-provider.js +1 -1
- package/dist/components/menu/menu.d.ts +40 -22
- package/dist/components/menu/menu.js +100 -40
- package/dist/components/nav/nav-context.d.ts +0 -1
- package/dist/components/nav/nav-context.js +1 -2
- package/dist/components/nav/nav-item-view.d.ts +7 -7
- package/dist/components/nav/nav-item-view.js +27 -51
- package/dist/components/nav/nav.css +72 -60
- package/dist/components/nav/nav.d.ts +15 -8
- package/dist/components/nav/nav.js +105 -52
- package/dist/components/nav/nav.module.js +14 -14
- package/dist/components/number-field/number-field.d.ts +7 -1
- package/dist/components/number-field/number-field.js +98 -82
- package/dist/components/number-field/number-input.d.ts +53 -4
- package/dist/components/number-field/number-input.js +68 -21
- package/dist/components/number-field/tsf-number-field.d.ts +1 -1
- package/dist/components/number-field/tsf-number-field.js +1 -1
- package/dist/components/otp-field/otp-input.d.ts +25 -0
- package/dist/components/otp-field/otp-input.js +26 -1
- package/dist/components/pagination/pagination.d.ts +82 -23
- package/dist/components/pagination/pagination.js +656 -229
- package/dist/components/password-field/password-field.d.ts +7 -1
- package/dist/components/password-field/password-field.js +117 -126
- package/dist/components/password-field/password-strength.js +1 -1
- package/dist/components/password-field/tsf-password-field.d.ts +1 -1
- package/dist/components/password-field/tsf-password-field.js +1 -1
- package/dist/components/photo-field/photo-field.d.ts +17 -3
- package/dist/components/photo-field/photo-field.js +168 -89
- package/dist/components/photo-field/photo-input-context.d.ts +25 -0
- package/dist/components/photo-field/photo-input-context.js +14 -0
- package/dist/components/photo-field/photo-input.d.ts +58 -23
- package/dist/components/photo-field/photo-input.js +459 -261
- package/dist/components/popover/popover.d.ts +55 -23
- package/dist/components/popover/popover.js +205 -61
- package/dist/components/radio-group-field/radio-group.js +1 -1
- package/dist/components/search-field/search-field.d.ts +7 -5
- package/dist/components/search-field/search-field.js +4 -6
- package/dist/components/search-field/tsf-search-field.d.ts +1 -1
- package/dist/components/search-field/tsf-search-field.js +1 -1
- package/dist/components/segmented-control-field/segmented-control.js +1 -1
- package/dist/components/select-field/select-field.d.ts +7 -1
- package/dist/components/select-field/select-field.js +151 -139
- package/dist/components/select-field/select.d.ts +28 -6
- package/dist/components/select-field/select.js +234 -149
- package/dist/components/skeleton/skeleton.js +1 -1
- package/dist/components/spinner/spinner.css +47 -1
- package/dist/components/spinner/spinner.js +28 -11
- package/dist/components/spinner/spinner.module.js +18 -3
- package/dist/components/stale/stale.d.ts +17 -21
- package/dist/components/stale/stale.js +307 -129
- package/dist/components/status-message/status-message.css +22 -21
- package/dist/components/status-message/status-message.d.ts +10 -5
- package/dist/components/status-message/status-message.js +20 -24
- package/dist/components/status-message/status-message.module.js +6 -6
- package/dist/components/status-message/status-preset.d.ts +4 -5
- package/dist/components/status-message/status-preset.js +3 -3
- package/dist/components/switch-field/switch.js +1 -1
- package/dist/components/tabs/tabs.d.ts +51 -28
- package/dist/components/tabs/tabs.js +219 -144
- package/dist/components/tag/tag.css +23 -21
- package/dist/components/tag/tag.d.ts +17 -15
- package/dist/components/tag/tag.js +140 -65
- package/dist/components/tag/tag.module.js +3 -3
- package/dist/components/tag-group/tag-group.css +30 -27
- package/dist/components/tag-group/tag-group.d.ts +10 -4
- package/dist/components/tag-group/tag-group.js +47 -35
- package/dist/components/tag-group/tag-group.module.js +4 -4
- package/dist/components/text-field/text-field.d.ts +14 -3
- package/dist/components/text-field/text-field.js +154 -133
- package/dist/components/text-field/text-input.d.ts +89 -3
- package/dist/components/text-field/text-input.js +184 -70
- package/dist/components/textarea-field/textarea.js +1 -1
- package/dist/components/time-field/time-input.d.ts +6 -0
- package/dist/components/time-field/time-input.js +6 -0
- package/dist/components/time-zone-provider/time-zone-provider.js +1 -1
- package/dist/components/toast/index.js +2 -2
- package/dist/components/toast/toast-provider.css +38 -34
- package/dist/components/toast/toast-provider.d.ts +65 -3
- package/dist/components/toast/toast-provider.js +313 -148
- package/dist/components/toast/toast-provider.module.js +11 -17
- package/dist/components/toast/toast.d.ts +5 -1
- package/dist/components/toast/toast.js +2 -1
- package/dist/components/toggle-group-field/toggle-group.js +1 -1
- package/dist/components/tooltip/tooltip.d.ts +6 -6
- package/dist/components/tooltip/tooltip.js +7 -7
- package/dist/data-table/data-table-content.d.ts +18 -10
- package/dist/data-table/data-table-content.js +145 -290
- package/dist/data-table/data-table-context.d.ts +4 -2
- package/dist/data-table/data-table-context.js +1 -1
- package/dist/data-table/data-table-parts.d.ts +99 -0
- package/dist/data-table/data-table-parts.js +1182 -0
- package/dist/data-table/data-table-selection.d.ts +7 -3
- package/dist/data-table/data-table-selection.js +62 -37
- package/dist/data-table/data-table.css +100 -95
- package/dist/data-table/data-table.d.ts +49 -25
- package/dist/data-table/data-table.js +95 -83
- package/dist/data-table/data-table.module.js +34 -34
- package/dist/data-table/index.d.ts +2 -1
- package/dist/data-table/index.js +2 -1
- package/dist/data-view/use-data-view.d.ts +2 -2
- package/dist/data-view/use-data-view.js +2 -2
- package/dist/index.js +7 -8
- package/dist/lib/calendar/calendar-navigation.d.ts +9 -2
- package/dist/lib/calendar/calendar-navigation.js +72 -73
- package/dist/lib/calendar/calendar-year.d.ts +4 -3
- package/dist/lib/calendar/calendar-year.js +137 -156
- package/dist/lib/calendar/temporal.d.ts +18 -12
- package/dist/lib/calendar/temporal.js +191 -147
- package/dist/lib/table-storage.d.ts +2 -2
- package/dist/lib/table-storage.js +2 -2
- package/dist/lib/unsaved-changes/leave-guard.js +1 -1
- package/dist/terrazzo/index.d.ts +16 -0
- package/dist/terrazzo/index.js +94 -2
- package/dist/tokens.css +71 -69
- package/package.json +3 -2
- package/tokens/ref.tokens.json +0 -30
- package/tokens/sys.tokens.json +0 -7
- package/dist/assets/spinner.js +0 -28
- package/dist/components/checkbox-field/checkbox-glyph.d.ts +0 -12
- package/dist/components/checkbox-field/checkbox-glyph.js +0 -38
- package/dist/components/combobox-field/combobox-popup-body.d.ts +0 -34
- package/dist/components/combobox-field/combobox-popup-body.js +0 -142
- package/dist/components/conversation/conversation.context.js +0 -4
- package/dist/vendor/@material-design-icons/svg/outlined/add.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/arrow_downward.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/arrow_forward.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/arrow_upward.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/attach_file.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/block.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/calendar_today.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/check.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/check_circle.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/chevron_left.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/chevron_right.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/close.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/content_copy.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/date_range.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/description.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/download.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/error.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/error_outline.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/expand_less.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/expand_more.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/filter_alt.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/filter_alt_off.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/first_page.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/info.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/keyboard_arrow_down.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/last_page.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/mail.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/more_horiz.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/photo_camera.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/remove.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/restart_alt.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/restore.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/search.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/unfold_more.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/upload_file.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/visibility.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/visibility_off.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/warning_amber.js +0 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Field
|
|
1
|
+
import { Field } from "../field/field.js";
|
|
2
2
|
import { useFieldState } from "../field/use-field-state.js";
|
|
3
3
|
import { PhotoInput } from "./photo-input.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
@@ -19,56 +19,82 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
19
19
|
* hasStoredImage={user.photo !== null}
|
|
20
20
|
* defaultPreview={<Avatar name={user.name} />}
|
|
21
21
|
* accept={["image/png", "image/jpeg"]}
|
|
22
|
+
* icon={<PhotoCameraIcon />}
|
|
22
23
|
* previewLabel="Preview"
|
|
23
24
|
* photoSetLabel="Photo set"
|
|
24
25
|
* noPhotoLabel="No photo"
|
|
25
26
|
* removeLabel="Remove photo"
|
|
27
|
+
* removeIcon={<CloseIcon />}
|
|
26
28
|
* />
|
|
27
29
|
*/
|
|
28
30
|
var PhotoField = (t0) => {
|
|
29
|
-
const $ = c(
|
|
31
|
+
const $ = c(77);
|
|
30
32
|
let className;
|
|
31
33
|
let controlProps;
|
|
34
|
+
let defaultPreview;
|
|
32
35
|
let description;
|
|
33
36
|
let dirty;
|
|
34
37
|
let errors;
|
|
38
|
+
let hasStoredImage;
|
|
39
|
+
let icon;
|
|
35
40
|
let label;
|
|
41
|
+
let noPhotoLabel;
|
|
36
42
|
let optionalLabel;
|
|
37
43
|
let pending;
|
|
44
|
+
let photoSetLabel;
|
|
45
|
+
let previewLabel;
|
|
38
46
|
let readOnly;
|
|
47
|
+
let removeIcon;
|
|
48
|
+
let removeLabel;
|
|
39
49
|
let requiredness;
|
|
40
50
|
let touched;
|
|
41
51
|
if ($[0] !== t0) {
|
|
42
|
-
({label, description, errors, requiredness, optionalLabel, dirty, touched, pending, readOnly, className, ...controlProps} = t0);
|
|
52
|
+
({label, description, errors, requiredness, optionalLabel, dirty, touched, pending, readOnly, className, defaultPreview, hasStoredImage, previewLabel, photoSetLabel, noPhotoLabel, removeLabel, removeIcon, icon, ...controlProps} = t0);
|
|
43
53
|
$[0] = t0;
|
|
44
54
|
$[1] = className;
|
|
45
55
|
$[2] = controlProps;
|
|
46
|
-
$[3] =
|
|
47
|
-
$[4] =
|
|
48
|
-
$[5] =
|
|
49
|
-
$[6] =
|
|
50
|
-
$[7] =
|
|
51
|
-
$[8] =
|
|
52
|
-
$[9] =
|
|
53
|
-
$[10] =
|
|
54
|
-
$[11] =
|
|
56
|
+
$[3] = defaultPreview;
|
|
57
|
+
$[4] = description;
|
|
58
|
+
$[5] = dirty;
|
|
59
|
+
$[6] = errors;
|
|
60
|
+
$[7] = hasStoredImage;
|
|
61
|
+
$[8] = icon;
|
|
62
|
+
$[9] = label;
|
|
63
|
+
$[10] = noPhotoLabel;
|
|
64
|
+
$[11] = optionalLabel;
|
|
65
|
+
$[12] = pending;
|
|
66
|
+
$[13] = photoSetLabel;
|
|
67
|
+
$[14] = previewLabel;
|
|
68
|
+
$[15] = readOnly;
|
|
69
|
+
$[16] = removeIcon;
|
|
70
|
+
$[17] = removeLabel;
|
|
71
|
+
$[18] = requiredness;
|
|
72
|
+
$[19] = touched;
|
|
55
73
|
} else {
|
|
56
74
|
className = $[1];
|
|
57
75
|
controlProps = $[2];
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
76
|
+
defaultPreview = $[3];
|
|
77
|
+
description = $[4];
|
|
78
|
+
dirty = $[5];
|
|
79
|
+
errors = $[6];
|
|
80
|
+
hasStoredImage = $[7];
|
|
81
|
+
icon = $[8];
|
|
82
|
+
label = $[9];
|
|
83
|
+
noPhotoLabel = $[10];
|
|
84
|
+
optionalLabel = $[11];
|
|
85
|
+
pending = $[12];
|
|
86
|
+
photoSetLabel = $[13];
|
|
87
|
+
previewLabel = $[14];
|
|
88
|
+
readOnly = $[15];
|
|
89
|
+
removeIcon = $[16];
|
|
90
|
+
removeLabel = $[17];
|
|
91
|
+
requiredness = $[18];
|
|
92
|
+
touched = $[19];
|
|
67
93
|
}
|
|
68
|
-
const ids =
|
|
94
|
+
const ids = Field.useIds();
|
|
69
95
|
const { labelId, descriptionId, errorId } = ids;
|
|
70
96
|
let t1;
|
|
71
|
-
if ($[
|
|
97
|
+
if ($[20] !== dirty || $[21] !== errors || $[22] !== pending || $[23] !== readOnly || $[24] !== requiredness || $[25] !== touched) {
|
|
72
98
|
t1 = {
|
|
73
99
|
errors,
|
|
74
100
|
requiredness,
|
|
@@ -77,23 +103,23 @@ var PhotoField = (t0) => {
|
|
|
77
103
|
pending,
|
|
78
104
|
readOnly
|
|
79
105
|
};
|
|
80
|
-
$[
|
|
81
|
-
$[
|
|
82
|
-
$[
|
|
83
|
-
$[
|
|
84
|
-
$[
|
|
85
|
-
$[
|
|
86
|
-
$[
|
|
87
|
-
} else t1 = $[
|
|
106
|
+
$[20] = dirty;
|
|
107
|
+
$[21] = errors;
|
|
108
|
+
$[22] = pending;
|
|
109
|
+
$[23] = readOnly;
|
|
110
|
+
$[24] = requiredness;
|
|
111
|
+
$[25] = touched;
|
|
112
|
+
$[26] = t1;
|
|
113
|
+
} else t1 = $[26];
|
|
88
114
|
const field = useFieldState(t1);
|
|
89
115
|
const { invalid } = field;
|
|
90
116
|
let t2;
|
|
91
|
-
if ($[
|
|
117
|
+
if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
|
|
92
118
|
t2 = /* @__PURE__ */ jsx("span", {});
|
|
93
|
-
$[
|
|
94
|
-
} else t2 = $[
|
|
119
|
+
$[27] = t2;
|
|
120
|
+
} else t2 = $[27];
|
|
95
121
|
let t3;
|
|
96
|
-
if ($[
|
|
122
|
+
if ($[28] !== label || $[29] !== labelId || $[30] !== optionalLabel || $[31] !== requiredness) {
|
|
97
123
|
t3 = /* @__PURE__ */ jsx(Field.Label, {
|
|
98
124
|
id: labelId,
|
|
99
125
|
nativeLabel: false,
|
|
@@ -102,82 +128,135 @@ var PhotoField = (t0) => {
|
|
|
102
128
|
render: t2,
|
|
103
129
|
children: label
|
|
104
130
|
});
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
} else t3 = $[
|
|
131
|
+
$[28] = label;
|
|
132
|
+
$[29] = labelId;
|
|
133
|
+
$[30] = optionalLabel;
|
|
134
|
+
$[31] = requiredness;
|
|
135
|
+
$[32] = t3;
|
|
136
|
+
} else t3 = $[32];
|
|
111
137
|
let t4;
|
|
112
|
-
if ($[
|
|
138
|
+
if ($[33] !== description || $[34] !== ids || $[35] !== invalid) {
|
|
113
139
|
t4 = ids.describedBy(description !== void 0, invalid);
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
117
|
-
$[
|
|
118
|
-
} else t4 = $[
|
|
140
|
+
$[33] = description;
|
|
141
|
+
$[34] = ids;
|
|
142
|
+
$[35] = invalid;
|
|
143
|
+
$[36] = t4;
|
|
144
|
+
} else t4 = $[36];
|
|
119
145
|
let t5;
|
|
120
|
-
if ($[
|
|
121
|
-
t5 = /* @__PURE__ */ jsx(PhotoInput, {
|
|
146
|
+
if ($[37] !== defaultPreview || $[38] !== previewLabel) {
|
|
147
|
+
t5 = /* @__PURE__ */ jsx(PhotoInput.Face, {
|
|
148
|
+
previewLabel,
|
|
149
|
+
children: defaultPreview
|
|
150
|
+
});
|
|
151
|
+
$[37] = defaultPreview;
|
|
152
|
+
$[38] = previewLabel;
|
|
153
|
+
$[39] = t5;
|
|
154
|
+
} else t5 = $[39];
|
|
155
|
+
let t6;
|
|
156
|
+
if ($[40] !== icon) {
|
|
157
|
+
t6 = /* @__PURE__ */ jsx(PhotoInput.Badge, { children: icon });
|
|
158
|
+
$[40] = icon;
|
|
159
|
+
$[41] = t6;
|
|
160
|
+
} else t6 = $[41];
|
|
161
|
+
let t7;
|
|
162
|
+
if ($[42] !== t5 || $[43] !== t6) {
|
|
163
|
+
t7 = /* @__PURE__ */ jsxs(PhotoInput.Well, { children: [t5, t6] });
|
|
164
|
+
$[42] = t5;
|
|
165
|
+
$[43] = t6;
|
|
166
|
+
$[44] = t7;
|
|
167
|
+
} else t7 = $[44];
|
|
168
|
+
let t8;
|
|
169
|
+
if ($[45] !== removeIcon || $[46] !== removeLabel) {
|
|
170
|
+
t8 = /* @__PURE__ */ jsx(PhotoInput.Remove, {
|
|
171
|
+
label: removeLabel,
|
|
172
|
+
icon: removeIcon
|
|
173
|
+
});
|
|
174
|
+
$[45] = removeIcon;
|
|
175
|
+
$[46] = removeLabel;
|
|
176
|
+
$[47] = t8;
|
|
177
|
+
} else t8 = $[47];
|
|
178
|
+
let t9;
|
|
179
|
+
if ($[48] !== noPhotoLabel || $[49] !== photoSetLabel) {
|
|
180
|
+
t9 = /* @__PURE__ */ jsx(PhotoInput.ValueText, {
|
|
181
|
+
photoSetLabel,
|
|
182
|
+
noPhotoLabel
|
|
183
|
+
});
|
|
184
|
+
$[48] = noPhotoLabel;
|
|
185
|
+
$[49] = photoSetLabel;
|
|
186
|
+
$[50] = t9;
|
|
187
|
+
} else t9 = $[50];
|
|
188
|
+
let t10;
|
|
189
|
+
if ($[51] !== controlProps || $[52] !== field.state.pending || $[53] !== hasStoredImage || $[54] !== invalid || $[55] !== labelId || $[56] !== readOnly || $[57] !== t4 || $[58] !== t7 || $[59] !== t8 || $[60] !== t9) {
|
|
190
|
+
t10 = /* @__PURE__ */ jsxs(PhotoInput.Root, {
|
|
122
191
|
...controlProps,
|
|
192
|
+
hasStoredImage,
|
|
123
193
|
labelledBy: labelId,
|
|
124
194
|
describedBy: t4,
|
|
125
195
|
readOnly,
|
|
126
196
|
invalid,
|
|
127
|
-
pending: field.state.pending
|
|
197
|
+
pending: field.state.pending,
|
|
198
|
+
children: [
|
|
199
|
+
t7,
|
|
200
|
+
t8,
|
|
201
|
+
t9
|
|
202
|
+
]
|
|
128
203
|
});
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
204
|
+
$[51] = controlProps;
|
|
205
|
+
$[52] = field.state.pending;
|
|
206
|
+
$[53] = hasStoredImage;
|
|
207
|
+
$[54] = invalid;
|
|
208
|
+
$[55] = labelId;
|
|
209
|
+
$[56] = readOnly;
|
|
210
|
+
$[57] = t4;
|
|
211
|
+
$[58] = t7;
|
|
212
|
+
$[59] = t8;
|
|
213
|
+
$[60] = t9;
|
|
214
|
+
$[61] = t10;
|
|
215
|
+
} else t10 = $[61];
|
|
216
|
+
let t11;
|
|
217
|
+
if ($[62] !== description || $[63] !== descriptionId) {
|
|
218
|
+
t11 = /* @__PURE__ */ jsx(Field.Description, {
|
|
140
219
|
id: descriptionId,
|
|
141
220
|
children: description
|
|
142
221
|
});
|
|
143
|
-
$[
|
|
144
|
-
$[
|
|
145
|
-
$[
|
|
146
|
-
} else
|
|
147
|
-
let
|
|
148
|
-
if ($[
|
|
149
|
-
|
|
222
|
+
$[62] = description;
|
|
223
|
+
$[63] = descriptionId;
|
|
224
|
+
$[64] = t11;
|
|
225
|
+
} else t11 = $[64];
|
|
226
|
+
let t12;
|
|
227
|
+
if ($[65] !== errorId || $[66] !== errors) {
|
|
228
|
+
t12 = /* @__PURE__ */ jsx(Field.Error, {
|
|
150
229
|
id: errorId,
|
|
151
230
|
children: errors
|
|
152
231
|
});
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
} else
|
|
157
|
-
let
|
|
158
|
-
if ($[
|
|
159
|
-
|
|
232
|
+
$[65] = errorId;
|
|
233
|
+
$[66] = errors;
|
|
234
|
+
$[67] = t12;
|
|
235
|
+
} else t12 = $[67];
|
|
236
|
+
let t13;
|
|
237
|
+
if ($[68] !== className || $[69] !== dirty || $[70] !== invalid || $[71] !== t10 || $[72] !== t11 || $[73] !== t12 || $[74] !== t3 || $[75] !== touched) {
|
|
238
|
+
t13 = /* @__PURE__ */ jsxs(Field.Root, {
|
|
160
239
|
className,
|
|
161
240
|
invalid,
|
|
162
241
|
dirty,
|
|
163
242
|
touched,
|
|
164
243
|
children: [
|
|
165
244
|
t3,
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
245
|
+
t10,
|
|
246
|
+
t11,
|
|
247
|
+
t12
|
|
169
248
|
]
|
|
170
249
|
});
|
|
171
|
-
$[
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
177
|
-
$[
|
|
178
|
-
$[
|
|
179
|
-
$[
|
|
180
|
-
} else
|
|
181
|
-
return
|
|
250
|
+
$[68] = className;
|
|
251
|
+
$[69] = dirty;
|
|
252
|
+
$[70] = invalid;
|
|
253
|
+
$[71] = t10;
|
|
254
|
+
$[72] = t11;
|
|
255
|
+
$[73] = t12;
|
|
256
|
+
$[74] = t3;
|
|
257
|
+
$[75] = touched;
|
|
258
|
+
$[76] = t13;
|
|
259
|
+
} else t13 = $[76];
|
|
260
|
+
return t13;
|
|
182
261
|
};
|
|
183
262
|
export { PhotoField };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Context, type RefObject } from "react";
|
|
2
|
+
import type { FieldBlurHandler } from "../field/index.ts";
|
|
3
|
+
export type PhotoInputContextValue = Readonly<{
|
|
4
|
+
value: File | undefined;
|
|
5
|
+
filled: boolean;
|
|
6
|
+
readOnly: boolean;
|
|
7
|
+
invalid: boolean;
|
|
8
|
+
pending: boolean;
|
|
9
|
+
labelledBy: string;
|
|
10
|
+
describedBy: string;
|
|
11
|
+
valueId: string;
|
|
12
|
+
well: RefObject<HTMLButtonElement | null>;
|
|
13
|
+
picker: RefObject<HTMLInputElement | null>;
|
|
14
|
+
pick: (file: File) => Promise<void> | void;
|
|
15
|
+
remove: () => Promise<void>;
|
|
16
|
+
onBlur: FieldBlurHandler | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const PhotoInputContext: Context<PhotoInputContextValue | null>;
|
|
19
|
+
/**
|
|
20
|
+
* The state the enclosing `PhotoInput.Root` holds, for the parts below it.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* const { value, remove } = usePhotoInput();
|
|
24
|
+
*/
|
|
25
|
+
export declare const usePhotoInput: () => PhotoInputContextValue;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useRequiredContext } from "../../lib/use-required-context.js";
|
|
2
|
+
import { createContext } from "react";
|
|
3
|
+
// src/components/photo-field/photo-input-context.ts
|
|
4
|
+
var PhotoInputContext = createContext(null);
|
|
5
|
+
/**
|
|
6
|
+
* The state the enclosing `PhotoInput.Root` holds, for the parts below it.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const { value, remove } = usePhotoInput();
|
|
10
|
+
*/
|
|
11
|
+
var usePhotoInput = () => {
|
|
12
|
+
return useRequiredContext(PhotoInputContext, "The PhotoInput parts must be used within a <PhotoInput.Root>.");
|
|
13
|
+
};
|
|
14
|
+
export { PhotoInputContext, usePhotoInput };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ReactNode } from "react";
|
|
1
|
+
import { type ComponentProps, type HTMLAttributes, type ReactNode } from "react";
|
|
2
2
|
import { type FieldBlurHandler } from "../field/index.ts";
|
|
3
3
|
/** What the circle shows until a photo is picked: a placeholder, or the stored photo. */
|
|
4
4
|
export type PhotoInputPreviewProps = Readonly<{
|
|
@@ -12,11 +12,13 @@ export type PhotoInputPreviewProps = Readonly<{
|
|
|
12
12
|
/** Whether `defaultPreview` is a stored photo rather than a placeholder. */
|
|
13
13
|
hasStoredImage: true;
|
|
14
14
|
}>;
|
|
15
|
-
export type
|
|
15
|
+
export type PhotoInputRootProps = Omit<ComponentProps<"div">, "onBlur"> & Readonly<{
|
|
16
16
|
/** The picked file, or nothing while the stored photo stands. */
|
|
17
17
|
value: File | undefined;
|
|
18
18
|
/** Called with a picked or dropped file, or with nothing once it is removed. */
|
|
19
19
|
onValueChange?: (file: File | undefined) => Promise<void> | void;
|
|
20
|
+
/** Whether a stored photo stands until another is picked. */
|
|
21
|
+
hasStoredImage?: boolean;
|
|
20
22
|
/** Mime types, wildcards or extensions the file dialog offers. @default ["image/*"] */
|
|
21
23
|
accept?: readonly string[];
|
|
22
24
|
/** The id of the label that names the control. */
|
|
@@ -31,33 +33,66 @@ export type PhotoInputProps = PhotoInputPreviewProps & Readonly<{
|
|
|
31
33
|
/** Background work, such as an upload, is in flight. */
|
|
32
34
|
pending?: boolean;
|
|
33
35
|
onBlur?: FieldBlurHandler;
|
|
36
|
+
}>;
|
|
37
|
+
/** The photo input's state and frame, which holds the hidden file input the well opens. */
|
|
38
|
+
declare const PhotoInputRoot: ({ value, onValueChange, hasStoredImage, accept, labelledBy, describedBy, name, readOnly, invalid, pending, onBlur, className, children, ...props }: PhotoInputRootProps) => ReactNode;
|
|
39
|
+
export type PhotoInputWellProps = HTMLAttributes<HTMLElement>;
|
|
40
|
+
/**
|
|
41
|
+
* The circle that shows the photo. It is the button that opens the file dialog
|
|
42
|
+
* and the target a file is dropped on, and Delete removes a picked photo.
|
|
43
|
+
* Read-only, it is a focusable image that opens nothing.
|
|
44
|
+
*/
|
|
45
|
+
declare const PhotoInputWell: ({ className, ...props }: PhotoInputWellProps) => ReactNode;
|
|
46
|
+
export type PhotoInputFaceProps = ComponentProps<"span"> & Readonly<{
|
|
34
47
|
/** The picked photo's alternative text, such as "Preview". */
|
|
35
48
|
previewLabel: string;
|
|
36
|
-
|
|
49
|
+
}>;
|
|
50
|
+
/** The picture inside the well: the picked photo, else its children, such as a placeholder or the stored photo. */
|
|
51
|
+
declare const PhotoInputFace: ({ previewLabel, className, children, ...props }: PhotoInputFaceProps) => ReactNode;
|
|
52
|
+
/** The badge on the well's rim. Its children are the icon, such as a camera; without them, or read-only, it renders nothing. */
|
|
53
|
+
declare const PhotoInputBadge: ({ className, children, ...props }: ComponentProps<"span">) => ReactNode;
|
|
54
|
+
export type PhotoInputRemoveProps = Omit<ComponentProps<"button">, "children"> & Readonly<{
|
|
55
|
+
/** The button's accessible name and tooltip, such as "Remove photo". */
|
|
56
|
+
label: string;
|
|
57
|
+
/** The button's icon, such as a cross. */
|
|
58
|
+
icon: ReactNode;
|
|
59
|
+
}>;
|
|
60
|
+
/** The icon-only button on the rim that removes a picked photo. It renders only while one is picked. */
|
|
61
|
+
declare const PhotoInputRemove: ({ label, icon, className, onClick, ...props }: PhotoInputRemoveProps) => ReactNode;
|
|
62
|
+
export type PhotoInputValueTextProps = Omit<ComponentProps<"span">, "children" | "id"> & Readonly<{
|
|
63
|
+
/** What the well announces while a photo is set, such as "Photo set". */
|
|
37
64
|
photoSetLabel: string;
|
|
38
|
-
/** What the
|
|
65
|
+
/** What the well announces while no photo is set, such as "No photo". */
|
|
39
66
|
noPhotoLabel: string;
|
|
40
|
-
|
|
41
|
-
|
|
67
|
+
}>;
|
|
68
|
+
/** The hidden text that describes the well, saying whether a photo is set. */
|
|
69
|
+
declare const PhotoInputValueText: ({ photoSetLabel, noPhotoLabel, className, ...props }: PhotoInputValueTextProps) => ReactNode;
|
|
70
|
+
/** The parts of a photo input. */
|
|
71
|
+
export type PhotoInputParts = Readonly<{
|
|
72
|
+
Root: typeof PhotoInputRoot;
|
|
73
|
+
Well: typeof PhotoInputWell;
|
|
74
|
+
Face: typeof PhotoInputFace;
|
|
75
|
+
Badge: typeof PhotoInputBadge;
|
|
76
|
+
Remove: typeof PhotoInputRemove;
|
|
77
|
+
ValueText: typeof PhotoInputValueText;
|
|
42
78
|
}>;
|
|
43
79
|
/**
|
|
44
|
-
* The
|
|
45
|
-
* button that opens the file dialog and the target a file is dropped on
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* carries no name of its own, so an enclosing field names it. For the
|
|
49
|
-
* ordinary case, use `PhotoField`.
|
|
80
|
+
* The parts of a photo picker: a circle showing the photo, which is itself the
|
|
81
|
+
* button that opens the file dialog and the target a file is dropped on, with
|
|
82
|
+
* a remove button on its rim. It carries no name of its own, so an enclosing
|
|
83
|
+
* field names it. For the ordinary case, use `PhotoField`.
|
|
50
84
|
*
|
|
51
85
|
* @example
|
|
52
|
-
* <PhotoInput
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
86
|
+
* <PhotoInput.Root labelledBy={labelId} value={file} onValueChange={setFile}>
|
|
87
|
+
* <PhotoInput.Well>
|
|
88
|
+
* <PhotoInput.Face previewLabel="Preview">
|
|
89
|
+
* <Avatar name={user.name} />
|
|
90
|
+
* </PhotoInput.Face>
|
|
91
|
+
* <PhotoInput.Badge><PhotoCameraIcon /></PhotoInput.Badge>
|
|
92
|
+
* </PhotoInput.Well>
|
|
93
|
+
* <PhotoInput.Remove label="Remove photo" icon={<CloseIcon />} />
|
|
94
|
+
* <PhotoInput.ValueText photoSetLabel="Photo set" noPhotoLabel="No photo" />
|
|
95
|
+
* </PhotoInput.Root>
|
|
62
96
|
*/
|
|
63
|
-
export declare const PhotoInput:
|
|
97
|
+
export declare const PhotoInput: PhotoInputParts;
|
|
98
|
+
export {};
|