@k8ordo/ui 3.0.0 → 4.0.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 +73 -182
- package/dist/{integrations/_shared → catalog}/icon-map.d.mts +4 -2
- package/dist/catalog/icon-map.mjs +212 -0
- package/dist/catalog/icon-names.d.mts +1 -0
- package/dist/{integrations/_shared → catalog}/icon-names.mjs +3 -1
- package/dist/catalog/index.d.mts +1289 -0
- package/dist/catalog/index.mjs +419 -0
- package/dist/catalog/render.css +34 -0
- package/dist/catalog/render.d.mts +72 -0
- package/dist/catalog/render.mjs +631 -0
- package/dist/catalog/render.module.mjs +11 -0
- package/dist/{integrations/_shared → catalog}/schemas.d.mts +120 -132
- package/dist/{integrations/_shared → catalog}/schemas.mjs +189 -131
- package/dist/catalog/to-tree.d.mts +4 -0
- package/dist/catalog/to-tree.mjs +17 -0
- package/dist/components/_internal/checked-values.d.mts +1 -0
- package/dist/components/_internal/checked-values.mjs +5 -0
- package/dist/components/_internal/field-message.css +25 -0
- package/dist/components/_internal/field-message.d.mts +10 -0
- package/dist/components/_internal/field-message.mjs +22 -0
- package/dist/components/_internal/field-message.module.mjs +9 -0
- package/dist/components/_internal/focus-ring.css +1 -1
- package/dist/components/_internal/high-contrast.css +1 -0
- package/dist/components/{observers/in-view → _internal}/in-view.mjs +1 -1
- package/dist/components/{observers/resize → _internal}/resize.mjs +1 -1
- package/dist/components/ai/_internal/attachment-preview.mjs +1 -1
- package/dist/components/ai/_internal/collapsible.mjs +1 -1
- package/dist/components/ai/attachment/attachment.d.mts +1 -1
- package/dist/components/ai/attachment/index.d.mts +1 -1
- package/dist/components/ai/conversation/conversation.mjs +4 -4
- package/dist/components/ai/index.d.mts +2 -2
- package/dist/components/ai/message/index.d.mts +2 -2
- package/dist/components/ai/message/message.d.mts +2 -2
- package/dist/components/ai/message/message.mjs +9 -9
- package/dist/components/ai/prompt-input/prompt-input.mjs +4 -4
- package/dist/components/ai/source/index.d.mts +2 -2
- package/dist/components/ai/source/source.d.mts +2 -2
- package/dist/components/ai/source/source.mjs +1 -1
- package/dist/components/ai/tool-invocation/approval-bar.mjs +11 -22
- package/dist/components/ai/tool-invocation/tool-invocation.d.mts +2 -2
- package/dist/components/buttons/button/button.css +1 -1
- package/dist/components/buttons/button/button.d.mts +34 -37
- package/dist/components/buttons/button/button.mjs +37 -24
- package/dist/components/buttons/button/button.module.mjs +0 -1
- package/dist/components/buttons/button/index.d.mts +2 -2
- package/dist/components/buttons/copy-button/copy-button.mjs +4 -4
- package/dist/components/buttons/icon-button/icon-button.css +3 -3
- package/dist/components/buttons/icon-button/icon-button.d.mts +37 -43
- package/dist/components/buttons/icon-button/icon-button.mjs +73 -63
- package/dist/components/buttons/icon-button/icon-button.module.mjs +2 -2
- package/dist/components/buttons/icon-button/index.d.mts +2 -2
- package/dist/components/buttons/toolbar/toolbar.css +5 -1
- package/dist/components/buttons/toolbar/toolbar.mjs +1 -1
- package/dist/components/data-display/accordion/accordion-button.d.mts +4 -1
- package/dist/components/data-display/accordion/accordion-button.mjs +4 -4
- package/dist/components/data-display/accordion/index.d.mts +3 -3
- package/dist/components/data-display/card/card-action.d.mts +6 -0
- package/dist/components/data-display/card/card-action.mjs +21 -0
- package/dist/components/data-display/card/card.css +24 -0
- package/dist/components/data-display/card/card.d.mts +26 -3
- package/dist/components/data-display/card/card.mjs +46 -6
- package/dist/components/data-display/card/card.module.mjs +4 -1
- package/dist/components/data-display/card/index.d.mts +2 -2
- package/dist/components/data-display/carousel/carousel.mjs +2 -2
- package/dist/components/data-display/code/code.css +4 -0
- package/dist/components/data-display/code-block/code-block.mjs +1 -1
- package/dist/components/data-display/data-table/data-table.css +0 -3
- package/dist/components/data-display/data-table/data-table.mjs +25 -26
- package/dist/components/data-display/tree/tree.d.mts +1 -1
- package/dist/components/data-display/tree/tree.mjs +6 -5
- package/dist/components/feedback/alert/alert.d.mts +2 -7
- package/dist/components/feedback/alert/alert.mjs +11 -11
- package/dist/components/feedback/alert/index.d.mts +2 -2
- package/dist/components/feedback/callout/callout.mjs +2 -2
- package/dist/components/feedback/progress/progress.mjs +1 -1
- package/dist/components/feedback/toast/context.d.mts +4 -5
- package/dist/components/feedback/toast/index.d.mts +2 -2
- package/dist/components/feedback/toast/provider.d.mts +7 -2
- package/dist/components/feedback/toast/provider.mjs +7 -2
- package/dist/components/feedback/toast/toast.d.mts +2 -3
- package/dist/components/form/autocomplete/autocomplete.d.mts +2 -2
- package/dist/components/form/autocomplete/autocomplete.mjs +12 -9
- package/dist/components/form/calendar/calendar.mjs +3 -5
- package/dist/components/form/checkbox/checkbox.d.mts +3 -1
- package/dist/components/form/checkbox/checkbox.mjs +44 -45
- package/dist/components/form/checkbox-card/checkbox-card.d.mts +3 -2
- package/dist/components/form/checkbox-card/checkbox-card.mjs +13 -6
- package/dist/components/form/checkbox-group/checkbox-group.d.mts +15 -20
- package/dist/components/form/checkbox-group/checkbox-group.mjs +18 -26
- package/dist/components/form/checkbox-group/index.d.mts +2 -34
- package/dist/components/form/checkbox-group/index.mjs +1 -8
- package/dist/components/form/color-picker/color-picker.css +3 -5
- package/dist/components/form/color-picker/color-picker.d.mts +0 -1
- package/dist/components/form/color-picker/color-picker.mjs +4 -4
- package/dist/components/form/combobox/combobox.d.mts +0 -1
- package/dist/components/form/combobox/combobox.mjs +9 -8
- package/dist/components/form/date-picker/date-picker.css +0 -5
- package/dist/components/form/date-picker/date-picker.mjs +21 -22
- package/dist/components/form/file-field/file-field.d.mts +6 -3
- package/dist/components/form/file-field/file-field.mjs +41 -18
- package/dist/components/form/file-field/index.d.mts +4 -1
- package/dist/components/form/form/form.mjs +0 -1
- package/dist/components/form/form-control/form-control.css +0 -15
- package/dist/components/form/form-control/form-control.d.mts +3 -4
- package/dist/components/form/form-control/form-control.mjs +44 -46
- package/dist/components/form/form-control/form-control.module.mjs +0 -3
- package/dist/components/form/number-field/number-field.d.mts +2 -2
- package/dist/components/form/number-field/number-field.mjs +13 -52
- package/dist/components/form/password-input/password-input.mjs +1 -1
- package/dist/components/form/radio/radio.mjs +4 -2
- package/dist/components/form/radio-card/radio-card.mjs +9 -2
- package/dist/components/form/range-slider/range-slider.d.mts +4 -2
- package/dist/components/form/range-slider/range-slider.mjs +2 -4
- package/dist/components/form/select/select.css +6 -4
- package/dist/components/form/select/select.d.mts +5 -0
- package/dist/components/form/select/select.mjs +10 -7
- package/dist/components/form/slider/slider.d.mts +2 -2
- package/dist/components/form/slider/slider.mjs +3 -6
- package/dist/components/form/switch/switch.d.mts +3 -0
- package/dist/components/form/switch/switch.mjs +43 -31
- package/dist/components/form/text-field/index.d.mts +2 -2
- package/dist/components/form/text-field/text-field.css +4 -0
- package/dist/components/form/text-field/text-field.d.mts +1 -1
- package/dist/components/form/textarea/textarea.d.mts +0 -1
- package/dist/components/form/textarea/textarea.mjs +1 -1
- package/dist/components/icons/base.d.mts +0 -1
- package/dist/components/icons/base.mjs +1 -2
- package/dist/components/icons/clipboard-check.d.mts +3 -0
- package/dist/components/icons/clipboard-check.mjs +18 -0
- package/dist/components/icons/git-pull-request.d.mts +3 -0
- package/dist/components/icons/git-pull-request.mjs +20 -0
- package/dist/components/icons/index.d.mts +9 -7
- package/dist/components/icons/index.mjs +30 -28
- package/dist/components/index.d.mts +58 -66
- package/dist/components/index.mjs +13 -19
- package/dist/components/layout/resizable-panels/resizable-panels.mjs +3 -3
- package/dist/components/navigation/anchor/anchor.css +3 -3
- package/dist/components/navigation/anchor/anchor.mjs +20 -7
- package/dist/components/navigation/anchor/anchor.module.mjs +1 -1
- package/dist/components/navigation/breadcrumb/breadcrumb.d.mts +6 -4
- package/dist/components/navigation/breadcrumb/breadcrumb.mjs +3 -2
- package/dist/components/navigation/pagination/pagination.d.mts +2 -2
- package/dist/components/navigation/pagination/pagination.mjs +2 -2
- package/dist/components/navigation/side-nav/side-nav.mjs +1 -1
- package/dist/components/navigation/stepper/stepper.mjs +3 -3
- package/dist/components/navigation/tabs/index.d.mts +10 -5
- package/dist/components/navigation/tabs/tabs.d.mts +11 -6
- package/dist/components/navigation/tabs/tabs.mjs +24 -27
- package/dist/components/overlays/_internal/modal-header.css +38 -0
- package/dist/components/overlays/_internal/modal-header.d.mts +7 -0
- package/dist/components/overlays/_internal/modal-header.mjs +32 -0
- package/dist/components/overlays/_internal/modal-header.module.mjs +10 -0
- package/dist/components/overlays/command-palette/command-palette.d.mts +2 -2
- package/dist/components/overlays/command-palette/command-palette.mjs +9 -8
- package/dist/components/overlays/context-menu/context-menu.mjs +3 -3
- package/dist/components/overlays/context-menu/index.d.mts +27 -2
- package/dist/components/overlays/dialog/dialog.css +3 -21
- package/dist/components/overlays/dialog/dialog.d.mts +20 -9
- package/dist/components/overlays/dialog/dialog.mjs +35 -73
- package/dist/components/overlays/dialog/dialog.module.mjs +1 -3
- package/dist/components/overlays/dialog/index.d.mts +2 -15
- package/dist/components/overlays/dialog/index.mjs +1 -8
- package/dist/components/overlays/drawer/drawer.css +4 -26
- package/dist/components/overlays/drawer/drawer.d.mts +7 -2
- package/dist/components/overlays/drawer/drawer.mjs +24 -37
- package/dist/components/overlays/drawer/drawer.module.mjs +2 -6
- package/dist/components/overlays/dropdown-menu/dropdown-menu.d.mts +35 -5
- package/dist/components/overlays/dropdown-menu/dropdown-menu.mjs +29 -11
- package/dist/components/overlays/dropdown-menu/hooks.d.mts +1 -1
- package/dist/components/overlays/dropdown-menu/hooks.mjs +1 -1
- package/dist/components/overlays/dropdown-menu/index.d.mts +34 -4
- package/dist/components/overlays/dropdown-menu/shared.css +1 -0
- package/dist/components/overlays/dropdown-menu/sub-menu.mjs +4 -4
- package/dist/components/overlays/list-box/hooks.mjs +2 -2
- package/dist/components/overlays/list-box/index.d.mts +2 -25
- package/dist/components/overlays/list-box/index.mjs +1 -9
- package/dist/components/overlays/list-box/list-box.d.mts +11 -16
- package/dist/components/overlays/list-box/list-box.mjs +23 -16
- package/dist/components/overlays/modal/modal.d.mts +8 -7
- package/dist/components/overlays/modal/modal.mjs +23 -32
- package/dist/components/overlays/popover/anchor-positioning.d.mts +3 -16
- package/dist/components/overlays/popover/anchor-positioning.mjs +14 -6
- package/dist/components/overlays/popover/hooks.d.mts +0 -2
- package/dist/components/overlays/popover/hooks.mjs +0 -2
- package/dist/components/overlays/popover/index.d.mts +19 -2
- package/dist/components/overlays/popover/index.mjs +7 -2
- package/dist/components/overlays/popover/popover.css +6 -0
- package/dist/components/overlays/popover/popover.d.mts +15 -2
- package/dist/components/overlays/popover/popover.mjs +28 -13
- package/dist/components/overlays/popover/popover.module.mjs +2 -1
- package/dist/components/overlays/tooltip/bridge.css +1 -1
- package/dist/components/overlays/tooltip/tooltip.mjs +5 -5
- package/dist/helpers/index.mjs +1 -1
- package/dist/i18n/en.mjs +1 -2
- package/dist/i18n/index.d.mts +3 -4
- package/dist/i18n/index.mjs +1 -2
- package/dist/i18n/ja.mjs +1 -2
- package/dist/i18n/messages.d.mts +2 -4
- package/dist/i18n/usage.d.mts +2 -1
- package/dist/i18n/usage.mjs +3 -3
- package/dist/index.d.mts +30 -36
- package/dist/index.mjs +4 -10
- package/dist/internal/iso-date.mjs +1 -1
- package/dist/styles/index.css +79 -225
- package/dist/styles/tailwind.css +1 -1
- package/dist/styles/tokens.css +281 -0
- package/dist/styles/tokens.d.mts +1 -1
- package/dist/styles/tokens.mjs +1 -1
- package/dist/types/index.d.mts +2 -2
- package/dist/types/variables.d.mts +4 -2
- package/docs/GUIDE.md +141 -66
- package/docs/llms.txt +38 -11
- package/docs/props.generated.json +752 -481
- package/docs/references/ai-chat.md +87 -39
- package/docs/references/color.md +15 -15
- package/docs/references/components.md +568 -499
- package/docs/references/generative-ui.md +373 -185
- package/docs/references/interaction-design.md +6 -5
- package/docs/references/spatial-design.md +8 -8
- package/docs/references/types.md +22 -25
- package/package.json +37 -70
- package/dist/components/form/date-field/date-field.css +0 -31
- package/dist/components/form/date-field/date-field.d.mts +0 -7
- package/dist/components/form/date-field/date-field.mjs +0 -19
- package/dist/components/form/date-field/date-field.module.mjs +0 -4
- package/dist/components/form/date-field/index.d.mts +0 -2
- package/dist/components/form/date-field/index.mjs +0 -1
- package/dist/components/observers/in-view/index.d.mts +0 -2
- package/dist/components/observers/in-view/index.mjs +0 -1
- package/dist/components/observers/resize/index.d.mts +0 -2
- package/dist/components/observers/resize/index.mjs +0 -1
- package/dist/components/overlays/_internal/modal-dialog-context.d.mts +0 -11
- package/dist/components/overlays/_internal/modal-dialog-context.mjs +0 -12
- package/dist/components/providers/index.d.mts +0 -3
- package/dist/components/providers/index.mjs +0 -3
- package/dist/components/providers/portal-root.d.mts +0 -8
- package/dist/components/providers/portal-root.mjs +0 -11
- package/dist/components/providers/ui-provider.d.mts +0 -2
- package/dist/components/providers/ui-provider.mjs +0 -6
- package/dist/integrations/_shared/icon-map.mjs +0 -208
- package/dist/integrations/_shared/icon-names.d.mts +0 -1
- package/dist/integrations/_shared/openui-defs.d.mts +0 -15
- package/dist/integrations/_shared/openui-defs.mjs +0 -230
- package/dist/integrations/_shared/renderers.css +0 -50
- package/dist/integrations/_shared/renderers.d.mts +0 -88
- package/dist/integrations/_shared/renderers.mjs +0 -880
- package/dist/integrations/_shared/renderers.module.mjs +0 -13
- package/dist/integrations/ai-sdk/index.d.mts +0 -3
- package/dist/integrations/ai-sdk/index.mjs +0 -1
- package/dist/integrations/ai-sdk/map-parts.d.mts +0 -44
- package/dist/integrations/ai-sdk/map-parts.mjs +0 -56
- package/dist/integrations/json-render/catalog.d.mts +0 -1359
- package/dist/integrations/json-render/catalog.mjs +0 -373
- package/dist/integrations/json-render/registry.d.mts +0 -26
- package/dist/integrations/json-render/registry.mjs +0 -192
- package/dist/integrations/openui/form-views.d.mts +0 -24
- package/dist/integrations/openui/form-views.mjs +0 -89
- package/dist/integrations/openui/library.d.mts +0 -202
- package/dist/integrations/openui/library.mjs +0 -83
- package/dist/integrations/openui/prompt.d.mts +0 -2
- package/dist/integrations/openui/prompt.mjs +0 -18
- /package/dist/components/{observers → _internal}/fragment-instance.d.mts +0 -0
- /package/dist/components/{observers/in-view → _internal}/in-view.d.mts +0 -0
- /package/dist/components/{observers/resize → _internal}/resize.d.mts +0 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { getMessages } from "../../../i18n/current.mjs";
|
|
3
|
-
import
|
|
4
|
-
import { mergeRefs } from "../../../helpers/merge-refs.mjs";
|
|
5
|
-
import focus_ring_module_default from "../../_internal/focus-ring.module.mjs";
|
|
3
|
+
import { ChevronIcon } from "../../icons/chevron.mjs";
|
|
6
4
|
import { chain } from "../../../helpers/chain.mjs";
|
|
5
|
+
import { mergeRefs } from "../../../helpers/merge-refs.mjs";
|
|
7
6
|
import { useControllableState } from "../../../hooks/controllable-state/index.mjs";
|
|
8
|
-
import { ChevronIcon } from "../../icons/chevron.mjs";
|
|
9
|
-
import { toPrecision } from "../../../internal/to-precision.mjs";
|
|
10
7
|
import { clamp } from "../../../internal/clamp.mjs";
|
|
8
|
+
import { toPrecision } from "../../../internal/to-precision.mjs";
|
|
11
9
|
import { cast } from "./cast.mjs";
|
|
10
|
+
import focus_ring_module_default from "../../_internal/focus-ring.module.mjs";
|
|
11
|
+
import sr_only_module_default from "../../_internal/sr-only.module.mjs";
|
|
12
12
|
import number_field_module_default from "./number-field.module.mjs";
|
|
13
13
|
import { clsx } from "clsx";
|
|
14
|
-
import { useEffect, useEffectEvent,
|
|
14
|
+
import { useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
|
|
15
15
|
import { useFormStatus } from "react-dom";
|
|
16
16
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
17
|
// src/components/form/number-field/number-field.tsx
|
|
@@ -19,29 +19,12 @@ const format = (value, precision) => {
|
|
|
19
19
|
if (value === null) return "";
|
|
20
20
|
return precision === void 0 ? String(value) : value.toFixed(precision);
|
|
21
21
|
};
|
|
22
|
-
const toBound = (value, fallback) => {
|
|
23
|
-
const bound = value === void 0 || value === "" ? NaN : Number(value);
|
|
24
|
-
return Number.isFinite(bound) ? bound : fallback;
|
|
25
|
-
};
|
|
26
22
|
const decimalsOf = (step) => String(step).split(".")[1]?.length ?? 0;
|
|
27
|
-
const
|
|
28
|
-
if (value !== null && value < min) return messages.numberFieldRangeUnderflow.replace("{min}", String(min));
|
|
29
|
-
if (value !== null && value > max) return messages.numberFieldRangeOverflow.replace("{max}", String(max));
|
|
30
|
-
return "";
|
|
31
|
-
};
|
|
32
|
-
const ownRangeErrors = /* @__PURE__ */ new WeakMap();
|
|
33
|
-
const applyRangeError = (input, error) => {
|
|
34
|
-
if (error !== "") input.setCustomValidity(error);
|
|
35
|
-
else if (input.validationMessage === ownRangeErrors.get(input)) input.setCustomValidity("");
|
|
36
|
-
ownRangeErrors.set(input, error);
|
|
37
|
-
};
|
|
38
|
-
const NumberField = ({ invalid = false, disabled = false, readOnly = false, required = false, value, defaultValue, onChange, onBlur, onKeyDown, ref, step = 1, precision: precisionProp, max: maxProp, min: minProp, onInput, ...rest }) => {
|
|
23
|
+
const NumberField = ({ invalid = false, disabled = false, readOnly = false, required = false, value, defaultValue, onChange, onBlur, onKeyDown, ref, step = 1, precision: precisionProp, max = Number.MAX_SAFE_INTEGER, min = Number.MIN_SAFE_INTEGER, ...rest }) => {
|
|
39
24
|
const messages = getMessages();
|
|
40
25
|
const inputRef = useRef(null);
|
|
41
26
|
const mergedRef = useMemo(() => mergeRefs(inputRef, ref), [ref]);
|
|
42
27
|
const isControlled = value !== void 0;
|
|
43
|
-
const max = toBound(maxProp, Number.MAX_SAFE_INTEGER);
|
|
44
|
-
const min = toBound(minProp, Number.MIN_SAFE_INTEGER);
|
|
45
28
|
const stepSize = step === "any" ? 1 : step;
|
|
46
29
|
const precision = precisionProp ?? (step === "any" ? void 0 : decimalsOf(step));
|
|
47
30
|
const initialValue = typeof defaultValue === "string" ? cast(defaultValue, precision) : defaultValue ?? null;
|
|
@@ -50,9 +33,6 @@ const NumberField = ({ invalid = false, disabled = false, readOnly = false, requ
|
|
|
50
33
|
defaultValue: initialValue,
|
|
51
34
|
onChange
|
|
52
35
|
});
|
|
53
|
-
const reportRange = (input, text) => {
|
|
54
|
-
applyRangeError(input, rangeErrorOf(cast(text, precision), min, max, messages));
|
|
55
|
-
};
|
|
56
36
|
const [displayValue, setDisplayValue] = useState(() => format(currentValue, precision));
|
|
57
37
|
const [shownValue, setShownValue] = useState(currentValue);
|
|
58
38
|
const { pending } = useFormStatus();
|
|
@@ -61,33 +41,14 @@ const NumberField = ({ invalid = false, disabled = false, readOnly = false, requ
|
|
|
61
41
|
setDisplayValue(format(currentValue, precision));
|
|
62
42
|
setShownValue(currentValue);
|
|
63
43
|
}
|
|
64
|
-
useLayoutEffect(() => {
|
|
65
|
-
const input = inputRef.current;
|
|
66
|
-
if (input === null) return;
|
|
67
|
-
applyRangeError(input, rangeErrorOf(cast(isControlled ? displayValue : input.value, precision), min, max, messages));
|
|
68
|
-
}, [
|
|
69
|
-
isControlled,
|
|
70
|
-
displayValue,
|
|
71
|
-
precision,
|
|
72
|
-
min,
|
|
73
|
-
max,
|
|
74
|
-
messages
|
|
75
|
-
]);
|
|
76
44
|
const handleReset = useEffectEvent(() => {
|
|
77
45
|
if (!isControlled) setCurrentValue(initialValue);
|
|
78
46
|
});
|
|
79
|
-
const handleRestored = useEffectEvent(() => {
|
|
80
|
-
const input = inputRef.current;
|
|
81
|
-
if (input !== null) reportRange(input, input.value);
|
|
82
|
-
});
|
|
83
47
|
useEffect(() => {
|
|
84
48
|
const form = inputRef.current?.form;
|
|
85
49
|
if (!form) return;
|
|
86
50
|
const listener = () => {
|
|
87
51
|
handleReset();
|
|
88
|
-
setTimeout(() => {
|
|
89
|
-
handleRestored();
|
|
90
|
-
}, 0);
|
|
91
52
|
};
|
|
92
53
|
form.addEventListener("reset", listener);
|
|
93
54
|
return () => {
|
|
@@ -103,9 +64,12 @@ const NumberField = ({ invalid = false, disabled = false, readOnly = false, requ
|
|
|
103
64
|
}
|
|
104
65
|
input.value = text;
|
|
105
66
|
setCurrentValue(next);
|
|
106
|
-
reportRange(input, text);
|
|
107
67
|
if (changed) input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
108
68
|
};
|
|
69
|
+
const commitTyped = (input) => {
|
|
70
|
+
const parsed = cast(input.value, precision);
|
|
71
|
+
commit(input, parsed === null ? null : clamp(parsed, min, max));
|
|
72
|
+
};
|
|
109
73
|
const stepBy = (input, delta) => {
|
|
110
74
|
if (readOnlyResolved) return;
|
|
111
75
|
const current = cast(input.value, precision);
|
|
@@ -134,14 +98,11 @@ const NumberField = ({ invalid = false, disabled = false, readOnly = false, requ
|
|
|
134
98
|
disabled,
|
|
135
99
|
readOnly: readOnlyResolved,
|
|
136
100
|
required,
|
|
137
|
-
onInput: chain(onInput, (e) => {
|
|
138
|
-
reportRange(e.currentTarget, e.currentTarget.value);
|
|
139
|
-
}),
|
|
140
101
|
onBlur: chain(onBlur, (e) => {
|
|
141
|
-
|
|
142
|
-
commit(e.currentTarget, parsed === null ? null : clamp(parsed, min, max));
|
|
102
|
+
commitTyped(e.currentTarget);
|
|
143
103
|
}),
|
|
144
104
|
onKeyDown: chain(onKeyDown, (e) => {
|
|
105
|
+
if (e.key === "Enter" && !e.nativeEvent.isComposing) commitTyped(e.currentTarget);
|
|
145
106
|
if (e.key === "ArrowUp") stepBy(e.currentTarget, stepSize);
|
|
146
107
|
if (e.key === "ArrowDown") stepBy(e.currentTarget, -stepSize);
|
|
147
108
|
}),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { getMessages } from "../../../i18n/current.mjs";
|
|
3
|
-
import focus_ring_module_default from "../../_internal/focus-ring.module.mjs";
|
|
4
3
|
import { EyeIcon } from "../../icons/eye.mjs";
|
|
5
4
|
import { EyeClosedIcon } from "../../icons/eye-closed.mjs";
|
|
5
|
+
import focus_ring_module_default from "../../_internal/focus-ring.module.mjs";
|
|
6
6
|
import password_input_module_default from "./password-input.module.mjs";
|
|
7
7
|
import { clsx } from "clsx";
|
|
8
8
|
import { useState } from "react";
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import sr_only_module_default from "../../_internal/sr-only.module.mjs";
|
|
3
2
|
import { ignoreClick } from "../../_internal/ignore-changes.mjs";
|
|
3
|
+
import sr_only_module_default from "../../_internal/sr-only.module.mjs";
|
|
4
4
|
import radio_module_default from "./radio.module.mjs";
|
|
5
5
|
import { clsx } from "clsx";
|
|
6
|
+
import { useId } from "react";
|
|
6
7
|
import { useFormStatus } from "react-dom";
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
// src/components/form/radio/radio.tsx
|
|
9
10
|
const Radio = ({ "aria-labelledby": labelledbyId, name, disabled = false, invalid = false, required = false, value, defaultValue, onChange, options, ref, ...rest }) => {
|
|
10
11
|
const { pending } = useFormStatus();
|
|
12
|
+
const groupName = useId();
|
|
11
13
|
const isControlled = value !== void 0;
|
|
12
14
|
const disabledResolved = disabled || pending;
|
|
13
15
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -26,7 +28,7 @@ const Radio = ({ "aria-labelledby": labelledbyId, name, disabled = false, invali
|
|
|
26
28
|
"aria-disabled": pending || void 0,
|
|
27
29
|
className: clsx(sr_only_module_default.srOnly, radio_module_default.input),
|
|
28
30
|
disabled,
|
|
29
|
-
name: name ??
|
|
31
|
+
name: name ?? groupName,
|
|
30
32
|
onChange: (event) => {
|
|
31
33
|
onChange?.(option.value, event);
|
|
32
34
|
},
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { ignoreClick } from "../../_internal/ignore-changes.mjs";
|
|
2
3
|
import sr_only_module_default from "../../_internal/sr-only.module.mjs";
|
|
3
4
|
import radio_card_module_default from "./radio-card.module.mjs";
|
|
4
5
|
import { clsx } from "clsx";
|
|
5
6
|
import { useId } from "react";
|
|
7
|
+
import { useFormStatus } from "react-dom";
|
|
6
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
9
|
// src/components/form/radio-card/radio-card.tsx
|
|
8
10
|
const RadioCard = ({ "aria-labelledby": labelledbyId, name, disabled = false, invalid = false, required = false, options, value, defaultValue, onChange, ref, ...rest }) => {
|
|
9
11
|
const groupId = useId();
|
|
10
12
|
const isControlled = value !== void 0;
|
|
13
|
+
const { pending } = useFormStatus();
|
|
14
|
+
const disabledResolved = disabled || pending;
|
|
11
15
|
return /* @__PURE__ */ jsx("fieldset", {
|
|
12
16
|
...rest,
|
|
17
|
+
"aria-invalid": invalid,
|
|
13
18
|
"aria-labelledby": labelledbyId,
|
|
14
|
-
className: clsx(radio_card_module_default.root,
|
|
19
|
+
className: clsx(radio_card_module_default.root, disabledResolved && radio_card_module_default.disabled),
|
|
15
20
|
ref,
|
|
16
21
|
role: "radiogroup",
|
|
17
22
|
children: options.map((option) => {
|
|
@@ -20,11 +25,13 @@ const RadioCard = ({ "aria-labelledby": labelledbyId, name, disabled = false, in
|
|
|
20
25
|
const hasVisual = option.visual !== void 0 && option.visual !== null;
|
|
21
26
|
const optionId = `${groupId}-${option.value}`;
|
|
22
27
|
return /* @__PURE__ */ jsxs("label", {
|
|
23
|
-
className: clsx(radio_card_module_default.card, invalid ? radio_card_module_default.invalid : radio_card_module_default.valid, optionDisabled && radio_card_module_default.optionDisabled),
|
|
28
|
+
className: clsx(radio_card_module_default.card, invalid ? radio_card_module_default.invalid : radio_card_module_default.valid, (optionDisabled || pending) && radio_card_module_default.optionDisabled),
|
|
24
29
|
id: optionId,
|
|
30
|
+
onClickCapture: pending ? ignoreClick : void 0,
|
|
25
31
|
children: [
|
|
26
32
|
/* @__PURE__ */ jsx("input", {
|
|
27
33
|
"aria-describedby": hasDescription ? `${optionId}-description` : void 0,
|
|
34
|
+
"aria-disabled": pending || void 0,
|
|
28
35
|
"aria-labelledby": `${optionId}-label`,
|
|
29
36
|
...isControlled ? { checked: value === option.value } : { defaultChecked: defaultValue === option.value },
|
|
30
37
|
className: clsx(sr_only_module_default.srOnly, radio_card_module_default.input),
|
|
@@ -8,8 +8,10 @@ type BaseProps = {
|
|
|
8
8
|
invalid?: boolean;
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* FormControl の props をそのまま広げられるように受け取り、どの要素にも
|
|
12
|
+
* 書かない。HTML は range に required を許さず、range は常に値を持つ。
|
|
13
|
+
* 必須であることは `<FormControl labelAs="group" required>` の印が
|
|
14
|
+
* グループの名前に入って伝わり、各つまみはその名前を読む。
|
|
13
15
|
*/
|
|
14
16
|
required?: boolean;
|
|
15
17
|
ref?: Ref<HTMLDivElement>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { getMessages } from "../../../i18n/current.mjs";
|
|
3
|
-
import high_contrast_module_default from "../../_internal/high-contrast.module.mjs";
|
|
4
3
|
import { ignoreStepKeys } from "../../_internal/ignore-changes.mjs";
|
|
5
4
|
import { rangeInputClass } from "../slider/range-input-class.mjs";
|
|
5
|
+
import high_contrast_module_default from "../../_internal/high-contrast.module.mjs";
|
|
6
6
|
import range_slider_module_default from "./range-slider.module.mjs";
|
|
7
7
|
import { clsx } from "clsx";
|
|
8
8
|
import { useEffect, useId, useRef, useState } from "react";
|
|
@@ -14,7 +14,7 @@ const percentOf = (value, min, max) => {
|
|
|
14
14
|
const ratio = Math.min(Math.max((value - min) / span, 0), 1);
|
|
15
15
|
return `${String(ratio * 100)}%`;
|
|
16
16
|
};
|
|
17
|
-
const RangeSlider = ({ min = 0, max = 100, step = 1, name, value, defaultValue, onChange, invalid = false, disabled = false, required
|
|
17
|
+
const RangeSlider = ({ min = 0, max = 100, step = 1, name, value, defaultValue, onChange, invalid = false, disabled = false, required: _required, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ref, ...rest }) => {
|
|
18
18
|
const messages = getMessages();
|
|
19
19
|
const id = useId();
|
|
20
20
|
const { pending } = useFormStatus();
|
|
@@ -105,7 +105,6 @@ const RangeSlider = ({ min = 0, max = 100, step = 1, name, value, defaultValue,
|
|
|
105
105
|
onChange: commit("start"),
|
|
106
106
|
onKeyDown: pending ? ignoreStepKeys : void 0,
|
|
107
107
|
ref: startRef,
|
|
108
|
-
required,
|
|
109
108
|
step,
|
|
110
109
|
type: "range"
|
|
111
110
|
}),
|
|
@@ -124,7 +123,6 @@ const RangeSlider = ({ min = 0, max = 100, step = 1, name, value, defaultValue,
|
|
|
124
123
|
onChange: commit("end"),
|
|
125
124
|
onKeyDown: pending ? ignoreStepKeys : void 0,
|
|
126
125
|
ref: endRef,
|
|
127
|
-
required,
|
|
128
126
|
step,
|
|
129
127
|
type: "range"
|
|
130
128
|
})
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
border-width: 1px;
|
|
7
7
|
border-color: var(--color-border-base);
|
|
8
8
|
background-color: var(--color-bg-base);
|
|
9
|
-
align-items: center;
|
|
10
9
|
width: 100%;
|
|
11
10
|
height: fit-content;
|
|
12
11
|
display: flex;
|
|
@@ -31,7 +30,7 @@
|
|
|
31
30
|
._93Y5Aq_select {
|
|
32
31
|
appearance: none;
|
|
33
32
|
width: 100%;
|
|
34
|
-
padding-inline: calc(var(--spacing) * 3);
|
|
33
|
+
padding-inline: calc(var(--spacing) * 3) calc(var(--spacing) * 10);
|
|
35
34
|
padding-block: calc(var(--spacing) * 2);
|
|
36
35
|
color: var(--color-fg-base);
|
|
37
36
|
background-color: #0000;
|
|
@@ -62,8 +61,11 @@
|
|
|
62
61
|
|
|
63
62
|
._93Y5Aq_chevron {
|
|
64
63
|
pointer-events: none;
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
align-items: center;
|
|
65
|
+
display: flex;
|
|
66
|
+
position: absolute;
|
|
67
|
+
inset-block: 0;
|
|
68
|
+
inset-inline-end: calc(var(--spacing) * 3);
|
|
67
69
|
|
|
68
70
|
@container style(--writing: vertical) {
|
|
69
71
|
rotate: -90deg;
|
|
@@ -3,6 +3,11 @@ import { FC, Ref, SelectHTMLAttributes } from "react";
|
|
|
3
3
|
type Props = {
|
|
4
4
|
invalid?: boolean;
|
|
5
5
|
options: readonly Option[];
|
|
6
|
+
/**
|
|
7
|
+
* 先頭に置く、値が `''` の選択肢の表示名。選べるので、任意の欄は未選択に
|
|
8
|
+
* 戻せる。`required` の欄では、選ぶまで `valueMissing` になる。
|
|
9
|
+
*/
|
|
10
|
+
placeholder?: string;
|
|
6
11
|
ref?: Ref<HTMLSelectElement>;
|
|
7
12
|
} & Omit<SelectHTMLAttributes<HTMLSelectElement>, 'className' | 'style'>;
|
|
8
13
|
export declare const Select: FC<Props>;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { ignoreSelectKeys } from "../../_internal/ignore-changes.mjs";
|
|
3
|
+
import { ChevronIcon } from "../../icons/chevron.mjs";
|
|
4
|
+
import { chain } from "../../../helpers/chain.mjs";
|
|
2
5
|
import { mergeRefs } from "../../../helpers/merge-refs.mjs";
|
|
3
6
|
import focus_ring_module_default from "../../_internal/focus-ring.module.mjs";
|
|
4
|
-
import { chain } from "../../../helpers/chain.mjs";
|
|
5
|
-
import { ChevronIcon } from "../../icons/chevron.mjs";
|
|
6
|
-
import { ignoreSelectKeys } from "../../_internal/ignore-changes.mjs";
|
|
7
7
|
import select_module_default from "./select.module.mjs";
|
|
8
8
|
import { clsx } from "clsx";
|
|
9
9
|
import { useLayoutEffect, useMemo, useRef } from "react";
|
|
10
10
|
import { useFormStatus } from "react-dom";
|
|
11
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
// src/components/form/select/select.tsx
|
|
13
|
-
const Select = ({ invalid = false, options, disabled = false, defaultValue, onKeyDown, ref, ...rest }) => {
|
|
13
|
+
const Select = ({ invalid = false, options, placeholder, disabled = false, defaultValue, onKeyDown, ref, ...rest }) => {
|
|
14
14
|
const { pending } = useFormStatus();
|
|
15
15
|
const selectRef = useRef(null);
|
|
16
16
|
const mergedRef = useMemo(() => mergeRefs(selectRef, ref), [ref]);
|
|
@@ -23,7 +23,7 @@ const Select = ({ invalid = false, options, disabled = false, defaultValue, onKe
|
|
|
23
23
|
}, [defaultKey]);
|
|
24
24
|
return /* @__PURE__ */ jsxs("div", {
|
|
25
25
|
className: clsx(select_module_default.root, invalid && select_module_default.invalid, (disabled || pending) && select_module_default.disabled, focus_ring_module_default.ringWithin),
|
|
26
|
-
children: [/* @__PURE__ */
|
|
26
|
+
children: [/* @__PURE__ */ jsxs("select", {
|
|
27
27
|
"aria-disabled": pending || void 0,
|
|
28
28
|
"aria-invalid": invalid,
|
|
29
29
|
className: clsx(select_module_default.select, pending && select_module_default.pending),
|
|
@@ -32,10 +32,13 @@ const Select = ({ invalid = false, options, disabled = false, defaultValue, onKe
|
|
|
32
32
|
onKeyDown: chain(onKeyDown, pending ? ignoreSelectKeys : void 0),
|
|
33
33
|
ref: mergedRef,
|
|
34
34
|
...rest,
|
|
35
|
-
children:
|
|
35
|
+
children: [placeholder === void 0 ? null : /* @__PURE__ */ jsx("option", {
|
|
36
|
+
value: "",
|
|
37
|
+
children: placeholder
|
|
38
|
+
}), options.map((option) => /* @__PURE__ */ jsx("option", {
|
|
36
39
|
value: option.value,
|
|
37
40
|
children: option.label
|
|
38
|
-
}, option.value))
|
|
41
|
+
}, option.value))]
|
|
39
42
|
}), /* @__PURE__ */ jsx("span", {
|
|
40
43
|
"aria-hidden": true,
|
|
41
44
|
className: select_module_default.chevron,
|
|
@@ -2,8 +2,8 @@ import { FC, InputHTMLAttributes, Ref } from "react";
|
|
|
2
2
|
type BaseProps = {
|
|
3
3
|
invalid?: boolean;
|
|
4
4
|
step?: number | 'any';
|
|
5
|
-
max?: number
|
|
6
|
-
min?: number
|
|
5
|
+
max?: number;
|
|
6
|
+
min?: number;
|
|
7
7
|
ref?: Ref<HTMLInputElement>;
|
|
8
8
|
} & Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'className' | 'style' | 'value' | 'onChange' | 'defaultValue' | 'children' | 'step' | 'max' | 'min'>;
|
|
9
9
|
type ControlledProps = {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { mergeRefs } from "../../../helpers/merge-refs.mjs";
|
|
3
2
|
import { chain } from "../../../helpers/chain.mjs";
|
|
3
|
+
import { mergeRefs } from "../../../helpers/merge-refs.mjs";
|
|
4
4
|
import { useControllableState } from "../../../hooks/controllable-state/index.mjs";
|
|
5
|
-
import high_contrast_module_default from "../../_internal/high-contrast.module.mjs";
|
|
6
5
|
import { ignoreStepKeys } from "../../_internal/ignore-changes.mjs";
|
|
7
6
|
import { rangeInputClass } from "./range-input-class.mjs";
|
|
7
|
+
import high_contrast_module_default from "../../_internal/high-contrast.module.mjs";
|
|
8
8
|
import slider_module_default from "./slider.module.mjs";
|
|
9
9
|
import { clsx } from "clsx";
|
|
10
10
|
import { useEffect, useEffectEvent, useMemo, useRef } from "react";
|
|
@@ -15,9 +15,7 @@ const toNumber = (value, fallback) => {
|
|
|
15
15
|
const number = value === void 0 || value === "" ? NaN : Number(value);
|
|
16
16
|
return Number.isFinite(number) ? number : fallback;
|
|
17
17
|
};
|
|
18
|
-
const Slider = ({ invalid = false, disabled = false, required
|
|
19
|
-
const max = toNumber(maxProp, 100);
|
|
20
|
-
const min = toNumber(minProp, 0);
|
|
18
|
+
const Slider = ({ invalid = false, disabled = false, required: _required, value, defaultValue, onChange, onKeyDown, ref, step = 1, max = 100, min = 0, ...rest }) => {
|
|
21
19
|
const initialValue = toNumber(defaultValue, min);
|
|
22
20
|
const isControlled = value !== void 0;
|
|
23
21
|
const inputRef = useRef(null);
|
|
@@ -73,7 +71,6 @@ const Slider = ({ invalid = false, disabled = false, required = false, value, de
|
|
|
73
71
|
},
|
|
74
72
|
onKeyDown: chain(onKeyDown, pending ? ignoreStepKeys : void 0),
|
|
75
73
|
ref: mergedRef,
|
|
76
|
-
required,
|
|
77
74
|
step,
|
|
78
75
|
type: "range"
|
|
79
76
|
})]
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { ChangeEvent, FC, InputHTMLAttributes, Ref } from "react";
|
|
2
2
|
type BaseProps = {
|
|
3
|
+
errorText?: string;
|
|
4
|
+
helpText?: string;
|
|
3
5
|
invalid?: boolean;
|
|
4
6
|
label: string;
|
|
5
7
|
ref?: Ref<HTMLInputElement>;
|
|
8
|
+
value?: string;
|
|
6
9
|
} & Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'role' | 'className' | 'style' | 'value' | 'onChange' | 'defaultChecked' | 'checked' | 'children'>;
|
|
7
10
|
type ControlledProps = {
|
|
8
11
|
checked: boolean;
|
|
@@ -1,46 +1,58 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import high_contrast_module_default from "../../_internal/high-contrast.module.mjs";
|
|
2
|
+
import { FieldMessage, describedByWith, hasErrorText } from "../../_internal/field-message.mjs";
|
|
4
3
|
import { ignoreClick } from "../../_internal/ignore-changes.mjs";
|
|
4
|
+
import field_message_module_default from "../../_internal/field-message.module.mjs";
|
|
5
|
+
import high_contrast_module_default from "../../_internal/high-contrast.module.mjs";
|
|
6
|
+
import sr_only_module_default from "../../_internal/sr-only.module.mjs";
|
|
5
7
|
import switch_module_default from "./switch.module.mjs";
|
|
6
8
|
import { clsx } from "clsx";
|
|
7
9
|
import { useId } from "react";
|
|
8
10
|
import { useFormStatus } from "react-dom";
|
|
9
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
12
|
// src/components/form/switch/switch.tsx
|
|
11
|
-
const Switch = ({ checked, defaultChecked, id, disabled = false, invalid = false, required = false, label, onChange, ref, ...rest }) => {
|
|
13
|
+
const Switch = ({ "aria-describedby": describedby, checked, defaultChecked, id, disabled = false, errorText, helpText, invalid = false, required = false, label, onChange, ref, ...rest }) => {
|
|
12
14
|
const generatedId = useId();
|
|
13
15
|
const inputId = id ?? generatedId;
|
|
16
|
+
const message = {
|
|
17
|
+
id: inputId,
|
|
18
|
+
errorText,
|
|
19
|
+
helpText
|
|
20
|
+
};
|
|
14
21
|
const { pending } = useFormStatus();
|
|
15
22
|
const disabledResolved = disabled || pending;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
23
|
+
const invalidResolved = invalid || hasErrorText(errorText);
|
|
24
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
25
|
+
className: field_message_module_default.field,
|
|
26
|
+
children: [/* @__PURE__ */ jsxs("label", {
|
|
27
|
+
className: clsx(switch_module_default.root, disabledResolved && switch_module_default.disabled),
|
|
28
|
+
htmlFor: inputId,
|
|
29
|
+
onClickCapture: pending ? ignoreClick : void 0,
|
|
30
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
31
|
+
className: switch_module_default.control,
|
|
32
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
33
|
+
...rest,
|
|
34
|
+
...checked === void 0 ? { defaultChecked } : { checked },
|
|
35
|
+
"aria-describedby": describedByWith(describedby, message),
|
|
36
|
+
"aria-disabled": pending || void 0,
|
|
37
|
+
"aria-invalid": invalidResolved,
|
|
38
|
+
"aria-required": required,
|
|
39
|
+
className: clsx(sr_only_module_default.srOnly, switch_module_default.input),
|
|
40
|
+
disabled,
|
|
41
|
+
id: inputId,
|
|
42
|
+
onChange: (event) => {
|
|
43
|
+
onChange?.(event.target.checked, event);
|
|
44
|
+
},
|
|
45
|
+
ref,
|
|
46
|
+
required,
|
|
47
|
+
role: "switch",
|
|
48
|
+
type: "checkbox"
|
|
49
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
50
|
+
"aria-hidden": true,
|
|
51
|
+
className: clsx(switch_module_default.track, disabledResolved ? switch_module_default.trackDisabled : switch_module_default.trackEnabled, invalidResolved && switch_module_default.invalid, high_contrast_module_default.edge),
|
|
52
|
+
children: /* @__PURE__ */ jsx("span", { className: clsx(switch_module_default.thumb, high_contrast_module_default.edge, disabledResolved && switch_module_default.thumbDisabled) })
|
|
53
|
+
})]
|
|
54
|
+
}), label ? /* @__PURE__ */ jsx("span", { children: label }) : null]
|
|
55
|
+
}), /* @__PURE__ */ jsx(FieldMessage, { ...message })]
|
|
44
56
|
});
|
|
45
57
|
};
|
|
46
58
|
export { Switch };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TextField } from "./text-field.mjs";
|
|
2
|
-
export { TextField };
|
|
1
|
+
import { TextField, TextInputType } from "./text-field.mjs";
|
|
2
|
+
export { TextField, type TextInputType };
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
inline-size: 100%;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
._83isSa_root:is([type="date"], [type="time"], [type="datetime-local"], [type="month"], [type="week"]) {
|
|
15
|
+
font-variant-numeric: tabular-nums;
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
._83isSa_root:read-only {
|
|
15
19
|
cursor: not-allowed;
|
|
16
20
|
background-color: var(--color-bg-subtle);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FC, HTMLInputTypeAttribute, InputHTMLAttributes, Ref } from "react";
|
|
2
|
-
type TextInputType = Extract<HTMLInputTypeAttribute, 'text' | 'email' | 'tel' | 'url' | 'search' | 'date' | 'time' | 'datetime-local' | 'month' | 'week'>;
|
|
2
|
+
export type TextInputType = Extract<HTMLInputTypeAttribute, 'text' | 'email' | 'tel' | 'url' | 'search' | 'date' | 'time' | 'datetime-local' | 'month' | 'week'>;
|
|
3
3
|
type Props = {
|
|
4
4
|
invalid?: boolean;
|
|
5
5
|
ref?: Ref<HTMLInputElement>;
|
|
@@ -5,7 +5,7 @@ import { clsx } from "clsx";
|
|
|
5
5
|
import { useFormStatus } from "react-dom";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
// src/components/form/textarea/textarea.tsx
|
|
8
|
-
const Textarea = ({ invalid = false, fullHeight = false, autoResize = false, readOnly, ref,
|
|
8
|
+
const Textarea = ({ invalid = false, fullHeight = false, autoResize = false, readOnly, ref, value, onInput, ...rest }) => {
|
|
9
9
|
const { pending } = useFormStatus();
|
|
10
10
|
return /* @__PURE__ */ jsx("textarea", {
|
|
11
11
|
"aria-invalid": invalid,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LineIcon } from "./line-icon.mjs";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
// src/components/icons/clipboard-check.tsx
|
|
4
|
+
const ClipboardCheckIcon = ({ size = "md" }) => /* @__PURE__ */ jsxs(LineIcon, {
|
|
5
|
+
size,
|
|
6
|
+
children: [
|
|
7
|
+
/* @__PURE__ */ jsx("rect", {
|
|
8
|
+
height: "2.5",
|
|
9
|
+
rx: "1",
|
|
10
|
+
width: "4.5",
|
|
11
|
+
x: "5.75",
|
|
12
|
+
y: "2"
|
|
13
|
+
}),
|
|
14
|
+
/* @__PURE__ */ jsx("path", { d: "M10.25 3.25h.5a2 2 0 0 1 2 2v6.5a2 2 0 0 1-2 2h-5.5a2 2 0 0 1-2-2v-6.5a2 2 0 0 1 2-2h.5" }),
|
|
15
|
+
/* @__PURE__ */ jsx("path", { d: "m6 9.25 1.5 1.5 2.5-3" })
|
|
16
|
+
]
|
|
17
|
+
});
|
|
18
|
+
export { ClipboardCheckIcon };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LineIcon } from "./line-icon.mjs";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
// src/components/icons/git-pull-request.tsx
|
|
4
|
+
const GitPullRequestIcon = ({ size = "md" }) => /* @__PURE__ */ jsxs(LineIcon, {
|
|
5
|
+
size,
|
|
6
|
+
children: [
|
|
7
|
+
/* @__PURE__ */ jsx("circle", {
|
|
8
|
+
cx: "4.5",
|
|
9
|
+
cy: "4",
|
|
10
|
+
r: "1.5"
|
|
11
|
+
}),
|
|
12
|
+
/* @__PURE__ */ jsx("circle", {
|
|
13
|
+
cx: "11.5",
|
|
14
|
+
cy: "12",
|
|
15
|
+
r: "1.5"
|
|
16
|
+
}),
|
|
17
|
+
/* @__PURE__ */ jsx("path", { d: "M4.5 5.5v8M8 4h1.75a1.75 1.75 0 0 1 1.75 1.75v4.75" })
|
|
18
|
+
]
|
|
19
|
+
});
|
|
20
|
+
export { GitPullRequestIcon };
|