@conscience-technology/ovenn 0.7.0 → 0.7.3
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/assets/components/AIMessage/AIMessage.module.css +21 -0
- package/assets/components/AIMessage/AIMessage.tsx +27 -7
- package/assets/components/AttachmentItem/AttachmentItem.module.css +41 -10
- package/assets/components/AttachmentItem/AttachmentItem.tsx +25 -8
- package/assets/components/AttachmentThumb/AttachmentThumb.module.css +9 -10
- package/assets/components/Button/Button.module.css +19 -0
- package/assets/components/Callout/Callout.module.css +53 -7
- package/assets/components/Callout/Callout.tsx +26 -2
- package/assets/components/Callout/index.ts +1 -1
- package/assets/components/ChatComposer/ChatComposer.module.css +17 -0
- package/assets/components/ChatComposer/ChatComposer.tsx +131 -0
- package/assets/components/ChatComposer/index.ts +2 -0
- package/assets/components/ChatInput/ChatInput.module.css +192 -30
- package/assets/components/ChatInput/ChatInput.tsx +137 -45
- package/assets/components/ChatInput/SendButton.tsx +4 -1
- package/assets/components/ChatInput/index.ts +5 -0
- package/assets/components/ChatMessage/ChatMessage.module.css +19 -0
- package/assets/components/ChatMessage/ChatMessage.tsx +63 -0
- package/assets/components/ChatMessage/index.ts +2 -0
- package/assets/components/ChatReactions/ChatReactions.module.css +15 -0
- package/assets/components/ChatReactions/ChatReactions.tsx +58 -0
- package/assets/components/ChatReactions/index.ts +2 -0
- package/assets/components/CodeBlock/CodeBlock.module.css +106 -10
- package/assets/components/CodeBlock/CodeBlock.tsx +114 -29
- package/assets/components/CodeBlock/SyntaxHighlight.tsx +20 -0
- package/assets/components/CodeBlock/diff-lines.ts +21 -0
- package/assets/components/CodeBlock/index.ts +2 -1
- package/assets/components/CodeBlock/line-preview.ts +7 -0
- package/assets/components/CodeBlock/syntax-highlighter.ts +96 -0
- package/assets/components/CodeBlock/use-syntax-tokens.ts +17 -0
- package/assets/components/ColorField/ColorField.module.css +19 -196
- package/assets/components/ColorField/ColorField.tsx +116 -109
- package/assets/components/Combobox/Combobox.module.css +21 -4
- package/assets/components/Combobox/Combobox.tsx +37 -21
- package/assets/components/CommandPalette/CommandPalette.module.css +1 -1
- package/assets/components/ControlGroup/ControlGroup.module.css +13 -6
- package/assets/components/DatePicker/DateField.tsx +72 -25
- package/assets/components/DatePicker/DatePicker.module.css +28 -59
- package/assets/components/DatePicker/DatePicker.tsx +76 -40
- package/assets/components/Drawer/Drawer.module.css +12 -15
- package/assets/components/Drawer/Drawer.tsx +15 -23
- package/assets/components/EmojiPicker/EmojiGlyph.module.css +2 -0
- package/assets/components/EmojiPicker/EmojiGlyph.tsx +12 -0
- package/assets/components/EmojiPicker/EmojiPicker.module.css +43 -0
- package/assets/components/EmojiPicker/EmojiPicker.tsx +143 -0
- package/assets/components/EmojiPicker/UNICODE-LICENSE.txt +39 -0
- package/assets/components/EmojiPicker/data.ts +41 -0
- package/assets/components/EmojiPicker/emojiData-0.json +1 -0
- package/assets/components/EmojiPicker/emojiData-1.json +1 -0
- package/assets/components/EmojiPicker/emojiData-2.json +1 -0
- package/assets/components/EmojiPicker/emojiData-3.json +1 -0
- package/assets/components/EmojiPicker/emojiData.sources.json +35 -0
- package/assets/components/EmojiPicker/emojiData.ts +8 -0
- package/assets/components/EmojiPicker/emojiFallbacks.json +1 -0
- package/assets/components/EmojiPicker/index.ts +4 -0
- package/assets/components/EmptyState/EmptyState.module.css +2 -2
- package/assets/components/FileIcon/FileIcon.module.css +4 -6
- package/assets/components/Icon/LucideFamilyIcon.tsx +2 -0
- package/assets/components/Icon/SolarFamilyIcon.tsx +4 -0
- package/assets/components/Input/Input.module.css +33 -10
- package/assets/components/Input/Input.tsx +20 -9
- package/assets/components/MessageActions/MessageActions.module.css +2 -2
- package/assets/components/Onboarding/Onboarding.module.css +1 -1
- package/assets/components/ProgressBar/ProgressBar.module.css +38 -4
- package/assets/components/ProgressBar/ProgressBar.tsx +5 -1
- package/assets/components/RadioCard/RadioCard.module.css +18 -0
- package/assets/components/RadioCard/RadioCard.tsx +48 -7
- package/assets/components/Select/Select.module.css +9 -7
- package/assets/components/Select/Select.tsx +15 -2
- package/assets/components/Tabs/Tabs.module.css +1 -1
- package/assets/components/Tabs/Tabs.tsx +2 -2
- package/assets/components/Textarea/Textarea.module.css +28 -231
- package/assets/components/Textarea/Textarea.tsx +2 -2
- package/assets/components/TimePicker/TimePicker.module.css +16 -4
- package/assets/components/TimePicker/TimePicker.tsx +66 -8
- package/assets/components/Toast/Toast.module.css +18 -0
- package/assets/components/Toast/Toast.tsx +1 -1
- package/assets/components/Tooltip/Tooltip.tsx +33 -7
- package/assets/components/UserMessage/UserMessage.module.css +110 -1
- package/assets/components/UserMessage/UserMessage.tsx +138 -16
- package/assets/components/UserMessage/index.ts +4 -0
- package/assets/components/_data.ts +10 -5
- package/assets/components/_utils.css +31 -5
- package/assets/components/component-registry.json +1595 -107
- package/assets/components/index.ts +7 -0
- package/assets/components/tokens.css +83 -0
- package/assets/prompts/ASSEMBLY.md +11 -0
- package/assets/prompts/CATALOG.md +110 -106
- package/assets/prompts/PRINCIPLES.md +11 -1
- package/assets/prompts/TEMPLATE_PREVIEWS.md +21 -0
- package/assets/prompts/WORKFLOW_DESIGN.md +2 -0
- package/assets/prompts/axes/font.md +6 -0
- package/assets/prompts/axes/material.md +1 -1
- package/assets/prompts/axes/motion.md +2 -0
- package/assets/prompts/axes/palette.md +9 -2
- package/assets/prompts/axes/voice.md +4 -0
- package/assets/prompts/components/README.md +3 -3
- package/assets/prompts/components/_variants.md +35 -35
- package/assets/prompts/components/accordion.md +15 -15
- package/assets/prompts/components/ai-message.md +14 -12
- package/assets/prompts/components/app-frame.md +16 -16
- package/assets/prompts/components/attachment-item.md +36 -30
- package/assets/prompts/components/attachment-thumb.md +14 -12
- package/assets/prompts/components/avatar-upload.md +10 -10
- package/assets/prompts/components/avatar.md +16 -16
- package/assets/prompts/components/badge.md +4 -4
- package/assets/prompts/components/breadcrumb.md +24 -24
- package/assets/prompts/components/bubble.md +13 -13
- package/assets/prompts/components/button-group.md +1 -1
- package/assets/prompts/components/button.md +37 -36
- package/assets/prompts/components/calendar.md +29 -29
- package/assets/prompts/components/callout.md +39 -23
- package/assets/prompts/components/canvas-edge.md +5 -2
- package/assets/prompts/components/canvas-node.md +3 -3
- package/assets/prompts/components/canvas.md +5 -2
- package/assets/prompts/components/card.md +21 -21
- package/assets/prompts/components/chart-bar.md +7 -7
- package/assets/prompts/components/chart-pie.md +3 -3
- package/assets/prompts/components/chart-radar.md +3 -3
- package/assets/prompts/components/chart-radial.md +4 -4
- package/assets/prompts/components/chat-composer.md +71 -0
- package/assets/prompts/components/chat-input.md +82 -27
- package/assets/prompts/components/chat-message.md +48 -0
- package/assets/prompts/components/chat-reactions.md +38 -0
- package/assets/prompts/components/checkbox-card.md +3 -3
- package/assets/prompts/components/checkbox.md +17 -17
- package/assets/prompts/components/chip.md +32 -32
- package/assets/prompts/components/code-block.md +109 -66
- package/assets/prompts/components/code.md +4 -4
- package/assets/prompts/components/color-area.md +9 -9
- package/assets/prompts/components/color-field.md +17 -13
- package/assets/prompts/components/color-picker.md +6 -6
- package/assets/prompts/components/color-slider.md +8 -8
- package/assets/prompts/components/color-swatch-picker.md +8 -8
- package/assets/prompts/components/color-swatch.md +9 -9
- package/assets/prompts/components/combobox.md +5 -2
- package/assets/prompts/components/command-palette.md +26 -26
- package/assets/prompts/components/comment.md +5 -2
- package/assets/prompts/components/context-menu.md +22 -22
- package/assets/prompts/components/control-group.md +4 -4
- package/assets/prompts/components/date-picker.md +31 -23
- package/assets/prompts/components/disclosure.md +10 -10
- package/assets/prompts/components/drawer.md +19 -18
- package/assets/prompts/components/dropdown-menu.md +21 -21
- package/assets/prompts/components/emoji-picker.md +45 -0
- package/assets/prompts/components/empty-state.md +20 -18
- package/assets/prompts/components/event-chip.md +11 -11
- package/assets/prompts/components/event-list-item.md +21 -21
- package/assets/prompts/components/file-icon.md +18 -19
- package/assets/prompts/components/gallery-item.md +19 -19
- package/assets/prompts/components/generated-image.md +10 -10
- package/assets/prompts/components/hint.md +19 -19
- package/assets/prompts/components/icon-button.md +16 -16
- package/assets/prompts/components/icon.md +12 -9
- package/assets/prompts/components/input.md +49 -46
- package/assets/prompts/components/kanban.md +34 -34
- package/assets/prompts/components/list-item.md +39 -39
- package/assets/prompts/components/menu-item.md +41 -41
- package/assets/prompts/components/message-actions.md +6 -6
- package/assets/prompts/components/message-quote.md +7 -7
- package/assets/prompts/components/message-sources.md +10 -10
- package/assets/prompts/components/message-state.md +17 -17
- package/assets/prompts/components/message-table.md +5 -5
- package/assets/prompts/components/mini-calendar.md +6 -1
- package/assets/prompts/components/modal.md +39 -39
- package/assets/prompts/components/multi-select.md +4 -1
- package/assets/prompts/components/onboarding.md +19 -19
- package/assets/prompts/components/page-header.md +31 -31
- package/assets/prompts/components/pagination.md +17 -17
- package/assets/prompts/components/progress-bar.md +14 -11
- package/assets/prompts/components/quotation-bar.md +10 -10
- package/assets/prompts/components/radio-card.md +7 -6
- package/assets/prompts/components/radio.md +9 -9
- package/assets/prompts/components/select.md +28 -25
- package/assets/prompts/components/shortcut.md +11 -11
- package/assets/prompts/components/sidebar.md +56 -56
- package/assets/prompts/components/skeleton.md +7 -4
- package/assets/prompts/components/slider.md +18 -18
- package/assets/prompts/components/spinner.md +16 -16
- package/assets/prompts/components/stepper.md +14 -14
- package/assets/prompts/components/switch.md +19 -20
- package/assets/prompts/components/tab-strip.md +31 -31
- package/assets/prompts/components/table-cell.md +4 -4
- package/assets/prompts/components/table-header.md +16 -16
- package/assets/prompts/components/table-row-edit.md +19 -19
- package/assets/prompts/components/table-row-select.md +9 -9
- package/assets/prompts/components/table-row.md +18 -18
- package/assets/prompts/components/tabs.md +26 -25
- package/assets/prompts/components/tag.md +6 -6
- package/assets/prompts/components/textarea.md +16 -15
- package/assets/prompts/components/time-picker.md +21 -14
- package/assets/prompts/components/timeline-view.md +4 -4
- package/assets/prompts/components/toast.md +42 -41
- package/assets/prompts/components/toolbar.md +23 -23
- package/assets/prompts/components/tooltip.md +15 -14
- package/assets/prompts/components/top-loader.md +11 -11
- package/assets/prompts/components/topbar.md +35 -35
- package/assets/prompts/components/tree-nav.md +9 -9
- package/assets/prompts/components/user-message.md +23 -12
- package/assets/prompts/design-examples/README.md +1 -1
- package/assets/prompts/design-examples/ai-chat-full-page.png +0 -0
- package/assets/prompts/design-examples/catalog.json +124 -1
- package/assets/prompts/design-examples/sources/ai-chat-full-page/ChatExperience.module.css +346 -0
- package/assets/prompts/design-examples/sources/ai-chat-full-page/ChatExperience.tsx +375 -0
- package/assets/prompts/design-examples/sources/ai-chat-full-page/FullPageChat.tsx +8 -0
- package/assets/prompts/design-examples/sources/ai-chat-full-page/REFERENCE.md +19 -0
- package/assets/prompts/design-examples/sources/ai-chat-full-page/useChatDemo.ts +139 -0
- package/assets/prompts/design-examples/sources/ai-chat-full-page/useDemoTextStream.ts +30 -0
- package/assets/prompts/primitives/emerge.md +2 -0
- package/assets/prompts/templates/README.md +1 -1
- package/assets/prompts/templates/ains.md +7 -0
- package/assets/prompts/templates/minimal.md +6 -0
- package/assets/prompts/templates/onboarding.md +156 -0
- package/assets/prompts/templates/workspace.md +13 -8
- package/assets/prompts/tokens/color.md +7 -2
- package/assets/prompts/tokens/radius.md +22 -0
- package/assets/prompts/use-cases/chart-chart-area.md +40 -40
- package/assets/prompts/use-cases/chart-chart-bar.md +34 -34
- package/assets/prompts/use-cases/chart-chart-pie.md +14 -14
- package/assets/prompts/use-cases/chart-chart-radar.md +24 -24
- package/assets/prompts/use-cases/chart-chart-radial.md +14 -14
- package/assets/prompts/use-cases/chart-segmented-chart.md +32 -32
- package/assets/prompts/use-cases/chat-chat-composer.md +529 -0
- package/assets/prompts/use-cases/chat-chat-input.md +1766 -0
- package/assets/prompts/use-cases/data-comment.md +39 -39
- package/assets/prompts/use-cases/data-data-table.md +34 -34
- package/assets/prompts/use-cases/data-list-item.md +16 -16
- package/assets/prompts/use-cases/data-metric-card.md +18 -18
- package/assets/prompts/use-cases/data-table-row.md +19 -19
- package/assets/prompts/use-cases/data-table-toolbar.md +10 -10
- package/assets/prompts/use-cases/feedback-drawer.md +35 -30
- package/assets/prompts/use-cases/feedback-progress-bar.md +23 -18
- package/assets/prompts/use-cases/general-toolbar.md +16 -16
- package/assets/prompts/use-cases/general-tooltip.md +26 -26
- package/assets/prompts/use-cases/input-checkbox.md +27 -27
- package/assets/prompts/use-cases/structure-card.md +9 -9
- package/assets/prompts/use-cases/structure-page-header.md +17 -17
- package/assets/prompts/use-cases/structure-sidebar.md +20 -20
- package/assets/prompts/use-cases/structure-topbar.md +38 -42
- package/assets/skills/ovenn-wireframe/SKILL.md +17 -4
- package/package.json +6 -2
- package/src/utils/design-examples.js +3 -4
- package/assets/prompts/templates/glass-button.md +0 -337
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { useEffect, useRef, useState, type ReactNode } from "react";
|
|
4
|
-
import { ComboBox as AriaComboBox, Input as AriaInput, Button as AriaButton, Label, Text, Popover, ListBox, ListBoxItem } from "react-aria-components";
|
|
3
|
+
import { useEffect, useRef, useState, type AriaAttributes, type ReactNode } from "react";
|
|
4
|
+
import { ComboBox as AriaComboBox, Input as AriaInput, Button as AriaButton, Label, Text, Group, Popover, ListBox, ListBoxItem } from "react-aria-components";
|
|
5
5
|
import { MenuItem } from "../MenuItem";
|
|
6
6
|
import { Chip } from "../Chip";
|
|
7
7
|
import { Button } from "../Button";
|
|
8
8
|
import { Icon } from "../Icon";
|
|
9
|
+
import { IconButton } from "../IconButton";
|
|
10
|
+
import { useControlGroupSize } from "../ControlGroup/context";
|
|
11
|
+
import { resolveControlGroupSize } from "../ControlGroup/size";
|
|
12
|
+
import type { InputSize, InputVariant, InputWidth } from "../Input";
|
|
9
13
|
import { useTheme } from "../ThemeController";
|
|
10
14
|
import field from "../Input/Input.module.css";
|
|
11
15
|
import styles from "./Combobox.module.css";
|
|
12
16
|
|
|
13
17
|
export interface ComboboxOption { id: string; label: string; disabled?: boolean }
|
|
14
18
|
export type ComboboxLoader = (query: string, signal: AbortSignal) => Promise<ComboboxOption[]>;
|
|
15
|
-
export interface ComboboxCommonProps {
|
|
19
|
+
export interface ComboboxCommonProps extends Pick<AriaAttributes, "aria-label" | "aria-labelledby" | "aria-describedby"> {
|
|
16
20
|
label: string;
|
|
17
21
|
options: ComboboxOption[];
|
|
18
22
|
loadOptions?: ComboboxLoader;
|
|
@@ -20,10 +24,16 @@ export interface ComboboxCommonProps {
|
|
|
20
24
|
warning?: ReactNode;
|
|
21
25
|
placeholder?: string;
|
|
22
26
|
disabled?: boolean;
|
|
27
|
+
readOnly?: boolean;
|
|
28
|
+
invalid?: boolean;
|
|
29
|
+
variant?: InputVariant;
|
|
30
|
+
width?: InputWidth;
|
|
31
|
+
className?: string;
|
|
32
|
+
clearable?: boolean;
|
|
23
33
|
required?: boolean;
|
|
24
34
|
name?: string;
|
|
25
35
|
id?: string;
|
|
26
|
-
size?:
|
|
36
|
+
size?: InputSize;
|
|
27
37
|
}
|
|
28
38
|
export interface ComboboxProps extends ComboboxCommonProps {
|
|
29
39
|
value: string | null;
|
|
@@ -40,7 +50,12 @@ const labels = {
|
|
|
40
50
|
};
|
|
41
51
|
|
|
42
52
|
/** One React Aria engine for single and multiple selection; no custom keyboard engine. */
|
|
43
|
-
export function SearchSelection({ label, options, loadOptions, description, warning, placeholder, disabled, required, name, id, size = "
|
|
53
|
+
export function SearchSelection({ label, options, loadOptions, description, warning, placeholder, disabled, readOnly, invalid: invalidProp, required, name, id, size: sizeProp, variant = "outline", width = "fill", className, clearable = false, multiple = false, value, onChange, ...ariaProps }: SearchSelectionProps) {
|
|
54
|
+
const groupSize = useControlGroupSize();
|
|
55
|
+
const size = resolveControlGroupSize(groupSize, sizeProp, "md");
|
|
56
|
+
const hasWarning = warning != null && warning !== false;
|
|
57
|
+
const invalid = Boolean(invalidProp || hasWarning);
|
|
58
|
+
const widthValue = width === "fill" ? undefined : width === "md" ? "var(--input-w-md)" : width === "lg" ? "var(--input-w-lg)" : `${width}px`;
|
|
44
59
|
const { lang } = useTheme();
|
|
45
60
|
const L = labels[lang];
|
|
46
61
|
const [query, setQuery] = useState(() => !multiple && value[0] ? options.find((option) => option.id === value[0])?.label ?? "" : "");
|
|
@@ -48,6 +63,7 @@ export function SearchSelection({ label, options, loadOptions, description, warn
|
|
|
48
63
|
const [remote, setRemote] = useState<ComboboxOption[]>([]);
|
|
49
64
|
const [status, setStatus] = useState<"idle" | "loading" | "error">("idle");
|
|
50
65
|
const [retry, setRetry] = useState(0);
|
|
66
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
51
67
|
const cache = useRef(new Map<string, ComboboxOption>());
|
|
52
68
|
const generation = useRef(0);
|
|
53
69
|
for (const option of options) cache.current.set(option.id, option);
|
|
@@ -55,7 +71,7 @@ export function SearchSelection({ label, options, loadOptions, description, warn
|
|
|
55
71
|
useEffect(() => {
|
|
56
72
|
const controller = new AbortController();
|
|
57
73
|
const request = ++generation.current;
|
|
58
|
-
if (!loadOptions || composing || disabled) { setStatus("idle"); return () => controller.abort(); }
|
|
74
|
+
if (!loadOptions || composing || disabled || readOnly) { setStatus("idle"); return () => controller.abort(); }
|
|
59
75
|
setStatus("loading");
|
|
60
76
|
setRemote([]);
|
|
61
77
|
Promise.resolve().then(() => loadOptions(query, controller.signal)).then((items) => {
|
|
@@ -65,7 +81,7 @@ export function SearchSelection({ label, options, loadOptions, description, warn
|
|
|
65
81
|
if (!controller.signal.aborted && generation.current === request) setStatus("error");
|
|
66
82
|
});
|
|
67
83
|
return () => controller.abort();
|
|
68
|
-
}, [query, composing, disabled, loadOptions, retry]);
|
|
84
|
+
}, [query, composing, disabled, readOnly, loadOptions, retry]);
|
|
69
85
|
const results = loadOptions ? remote : options.filter((option) => option.label.toLocaleLowerCase(lang).includes(query.toLocaleLowerCase(lang)));
|
|
70
86
|
// Only matching options enter the collection; selected labels live in the cache.
|
|
71
87
|
const items = results;
|
|
@@ -73,24 +89,24 @@ export function SearchSelection({ label, options, loadOptions, description, warn
|
|
|
73
89
|
const selectedLabel = selectedKey ? cache.current.get(selectedKey)?.label : "";
|
|
74
90
|
useEffect(() => { if (!multiple) setQuery(selectedLabel ?? ""); }, [multiple, selectedKey, selectedLabel]);
|
|
75
91
|
const shared = {
|
|
76
|
-
id, name, inputValue: query, onInputChange: setQuery, items,
|
|
77
|
-
isDisabled: disabled, isRequired: required, isInvalid:
|
|
92
|
+
...ariaProps, id, name, inputValue: query, onInputChange: setQuery, items,
|
|
93
|
+
isDisabled: disabled, isReadOnly: readOnly, isRequired: required, isInvalid: invalid,
|
|
78
94
|
disabledKeys: items.filter((item) => item.disabled).map((item) => item.id),
|
|
79
95
|
validationBehavior: "aria" as const, allowsEmptyCollection: true,
|
|
80
96
|
};
|
|
81
97
|
const content = <>
|
|
82
|
-
<Label className={field.label}>{label}</Label>
|
|
83
|
-
<
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
{
|
|
98
|
+
<Label data-slot="combobox-label" className={[field.label, size === "sm" ? field.labelSm : field.labelMd].join(" ")}>{label}{required && <span aria-hidden className={field.requiredMark}>*</span>}</Label>
|
|
99
|
+
<Group isDisabled={disabled} isInvalid={invalid} isReadOnly={readOnly} className={[field.root, field[variant], field[size === "sm" ? "sizeSm" : size === "lg" ? "sizeLg" : "sizeMd"], styles.control, multiple ? styles.multiple : ""].join(" ")} data-slot="combobox-control" data-variant={variant} data-control-group-segment={groupSize && !multiple ? "" : undefined} data-invalid={invalid || undefined} data-disabled={disabled || undefined} data-readonly={readOnly || undefined} onClick={(event) => { if (!disabled && !(event.target as HTMLElement).closest("button")) inputRef.current?.focus(); }}>
|
|
100
|
+
<div className={styles.values}>
|
|
101
|
+
{multiple && value.map((key) => <Chip key={key} size="sm" className={styles.chip} disabled={disabled || readOnly} onRemove={() => { if (disabled || readOnly) return; onChange(value.filter((v) => v !== key)); inputRef.current?.focus(); }} removeLabel={`${cache.current.get(key)?.label ?? key} ${L.remove}`}>{cache.current.get(key)?.label ?? key}</Chip>)}
|
|
102
|
+
<AriaInput ref={inputRef} className={[field.input, styles.input].join(" ")} placeholder={placeholder} onCompositionStart={() => setComposing(true)} onCompositionEnd={(event) => { setQuery(event.currentTarget.value); setComposing(false); }} onKeyDown={(event) => { if (event.nativeEvent.isComposing || composing) event.stopPropagation(); }} />
|
|
103
|
+
</div>
|
|
104
|
+
{clearable && !multiple && value.length > 0 && !readOnly && !disabled && <IconButton type="button" variant="ghost" size="sm" className={styles.clear} icon={<Icon name="x" />} aria-label={L.clear} onClick={() => { onChange([]); setQuery(""); inputRef.current?.focus(); }} />}
|
|
105
|
+
<AriaButton isDisabled={disabled || readOnly} className={styles.open} aria-label={L.open}><Icon name="caret-down" /></AriaButton>
|
|
106
|
+
</Group>
|
|
107
|
+
{hasWarning ? <Text data-slot="combobox-warning" slot="errorMessage" role="alert" className={field.errorText}><span className={field.messageIcon} aria-hidden><Icon name="warning-circle" size={14} /></span>{warning}</Text> : description != null && <Text data-slot="combobox-description" slot="description" className={field.description}><span className={field.messageIcon} aria-hidden><Icon name="info" size={14} /></span>{description}</Text>}
|
|
92
108
|
<span role="status" className={styles.status}>{status === "loading" ? L.loading : status === "error" ? L.error : ""}</span>
|
|
93
|
-
{status === "error" && <Button type="button" variant="ghost" size="sm" disabled={disabled} onClick={() => setRetry((n) => n + 1)}>{L.retry}</Button>}
|
|
109
|
+
{status === "error" && <Button type="button" variant="ghost" size="sm" disabled={disabled || readOnly} onClick={() => setRetry((n) => n + 1)}>{L.retry}</Button>}
|
|
94
110
|
<Popover isNonModal className={[styles.popover, "m-float"].join(" ")}>
|
|
95
111
|
{status === "error" && <Button type="button" variant="ghost" size="sm" onClick={() => setRetry((n) => n + 1)}>{L.retry}</Button>}
|
|
96
112
|
<ListBox<ComboboxOption> className={styles.list} items={items} renderEmptyState={() => <span className={styles.empty}>{status === "loading" ? L.loading : status === "error" ? L.error : L.empty}</span>}>
|
|
@@ -100,7 +116,7 @@ export function SearchSelection({ label, options, loadOptions, description, warn
|
|
|
100
116
|
</ListBox>
|
|
101
117
|
</Popover>
|
|
102
118
|
</>;
|
|
103
|
-
return multiple ? <AriaComboBox<ComboboxOption, "multiple"> {...shared} className={styles.root} selectionMode="multiple" value={value} onChange={(keys) => { const next = keys.map(String); if (next.length === value.length && next.every((key, index) => key === value[index])) return; onChange(next); setQuery(""); }}>{content}</AriaComboBox> : <AriaComboBox<ComboboxOption> {...shared} className={styles.root} value={value[0] ?? null} onChange={(key) => { onChange(key == null ? [] : [String(key)]); setQuery(key == null ? "" : cache.current.get(String(key))?.label ?? ""); }}>{content}</AriaComboBox>;
|
|
119
|
+
return multiple ? <AriaComboBox<ComboboxOption, "multiple"> {...shared} data-slot={groupSize && !multiple ? "combobox-field-wrapper" : undefined} className={[styles.root, className].filter(Boolean).join(" ")} style={widthValue ? { width: widthValue } : undefined} selectionMode="multiple" value={value} onChange={(keys) => { if (disabled || readOnly) return; const next = keys.map(String); if (next.length === value.length && next.every((key, index) => key === value[index])) return; onChange(next); setQuery(""); }}>{content}</AriaComboBox> : <AriaComboBox<ComboboxOption> {...shared} data-slot={groupSize && !multiple ? "combobox-field-wrapper" : undefined} className={[styles.root, className].filter(Boolean).join(" ")} style={widthValue ? { width: widthValue } : undefined} value={value[0] ?? null} onChange={(key) => { if (disabled || readOnly) return; onChange(key == null ? [] : [String(key)]); setQuery(key == null ? "" : cache.current.get(String(key))?.label ?? ""); }}>{content}</AriaComboBox>;
|
|
104
120
|
}
|
|
105
121
|
export function Combobox({ value, onChange, ...props }: ComboboxProps) {
|
|
106
122
|
return <SearchSelection {...props} value={value == null ? [] : [value]} onChange={(keys) => onChange(keys[0] ?? null)} />;
|
|
@@ -174,8 +174,8 @@
|
|
|
174
174
|
max-width: 100%;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
.sm { --control-group-height: var(--control-h-sm); --control-group-radius: var(--radius-xs); }
|
|
178
|
-
.md { --control-group-height: var(--control-h-md); --control-group-radius: var(--radius-sm); }
|
|
177
|
+
.sm { --control-group-height: calc(var(--control-h-sm) + var(--size-0-5)); --control-group-radius: var(--radius-xs); }
|
|
178
|
+
.md { --control-group-height: calc(var(--control-h-md) + var(--size-0-5)); --control-group-radius: var(--radius-sm); }
|
|
179
179
|
.lg { --control-group-height: var(--control-h-lg); --control-group-radius: var(--radius-md); }
|
|
180
180
|
|
|
181
181
|
.controls {
|
|
@@ -287,13 +287,13 @@
|
|
|
287
287
|
.controls :where([data-slot$="field-wrapper"]) > :where([data-control-group-segment]) {
|
|
288
288
|
grid-row: 2;
|
|
289
289
|
}
|
|
290
|
-
.controls :where([data-slot
|
|
290
|
+
.controls :where([data-slot$="-label"]) {
|
|
291
291
|
grid-row: 1;
|
|
292
292
|
margin-bottom: var(--space-1);
|
|
293
293
|
}
|
|
294
|
-
.controls :where([data-slot
|
|
294
|
+
.controls :where([data-slot$="-description"], [data-slot$="-warning"]) {
|
|
295
295
|
grid-row: 3;
|
|
296
|
-
margin-top: var(--space-1);
|
|
296
|
+
margin-top: calc(var(--space-1) + var(--space-0_5));
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
.controls .item > [data-control-group-segment] { width: 100%; min-width: 0; }
|
|
@@ -314,6 +314,13 @@
|
|
|
314
314
|
color: var(--primary);
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
-
.root.controls [data-control-group-segment]
|
|
317
|
+
.root.controls [data-control-group-segment][data-slot="button-root"]:hover:not(:disabled):not([data-disabled]):not([aria-disabled="true"]):not([data-readonly]) {
|
|
318
318
|
background: var(--hover) !important;
|
|
319
319
|
}
|
|
320
|
+
|
|
321
|
+
/* Joined field focus uses borders without adding a fill. */
|
|
322
|
+
.root.controls [data-control-group-segment]:focus-visible,
|
|
323
|
+
.root.controls [data-control-group-segment]:has(:focus-visible) {
|
|
324
|
+
border-color: var(--border-strong) !important;
|
|
325
|
+
color: var(--fg);
|
|
326
|
+
}
|
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
forwardRef,
|
|
18
18
|
useCallback,
|
|
19
19
|
useEffect,
|
|
20
|
-
useMemo,
|
|
21
20
|
useId,
|
|
22
21
|
useRef,
|
|
23
22
|
useState,
|
|
@@ -27,7 +26,11 @@ import {
|
|
|
27
26
|
|
|
28
27
|
import styles from "./DatePicker.module.css";
|
|
29
28
|
import { parseISODate, isDateSelectable } from "./utils";
|
|
30
|
-
import type { InputSize } from "../Input";
|
|
29
|
+
import type { InputSize, InputVariant, InputWidth } from "../Input";
|
|
30
|
+
import inputStyles from "../Input/Input.module.css";
|
|
31
|
+
import { Icon } from "../Icon";
|
|
32
|
+
import { useControlGroupSize } from "../ControlGroup/context";
|
|
33
|
+
import { resolveControlGroupSize } from "../ControlGroup/size";
|
|
31
34
|
import { useTheme } from "../ThemeController";
|
|
32
35
|
|
|
33
36
|
const DF_LABELS = {
|
|
@@ -71,6 +74,15 @@ export interface DateFieldProps {
|
|
|
71
74
|
value: Date | null;
|
|
72
75
|
onChange: (next: Date | null) => void;
|
|
73
76
|
size?: InputSize;
|
|
77
|
+
variant?: InputVariant;
|
|
78
|
+
width?: InputWidth;
|
|
79
|
+
label?: ReactNode;
|
|
80
|
+
description?: ReactNode;
|
|
81
|
+
warning?: ReactNode;
|
|
82
|
+
invalid?: boolean;
|
|
83
|
+
required?: boolean;
|
|
84
|
+
readOnly?: boolean;
|
|
85
|
+
"aria-describedby"?: string;
|
|
74
86
|
minDate?: Date;
|
|
75
87
|
maxDate?: Date;
|
|
76
88
|
isDateUnavailable?: (date: Date) => boolean;
|
|
@@ -90,7 +102,10 @@ export const DateField = forwardRef<HTMLDivElement, DateFieldProps>(
|
|
|
90
102
|
{
|
|
91
103
|
value,
|
|
92
104
|
onChange,
|
|
93
|
-
size
|
|
105
|
+
size: sizeProp,
|
|
106
|
+
variant = "outline", width = "fill", label, description, warning,
|
|
107
|
+
invalid: invalidProp, required, readOnly,
|
|
108
|
+
"aria-describedby": externalDescription,
|
|
94
109
|
minDate, maxDate, isDateUnavailable,
|
|
95
110
|
disabled,
|
|
96
111
|
placeholder = "YYYY / MM / DD",
|
|
@@ -104,8 +119,19 @@ export const DateField = forwardRef<HTMLDivElement, DateFieldProps>(
|
|
|
104
119
|
) {
|
|
105
120
|
const { lang } = useTheme();
|
|
106
121
|
const L = DF_LABELS[lang];
|
|
107
|
-
const
|
|
108
|
-
const
|
|
122
|
+
const groupSize = useControlGroupSize();
|
|
123
|
+
const size = resolveControlGroupSize(groupSize, sizeProp, "md");
|
|
124
|
+
const autoId = useId();
|
|
125
|
+
const fieldId = id ?? autoId;
|
|
126
|
+
const errorId = `${fieldId}-warning`;
|
|
127
|
+
const descriptionId = `${fieldId}-description`;
|
|
128
|
+
const labelId = `${fieldId}-label`;
|
|
129
|
+
const [draftInvalid, setInvalid] = useState(false);
|
|
130
|
+
const hasWarning = warning != null && warning !== false;
|
|
131
|
+
const invalid = Boolean(invalidProp || hasWarning || draftInvalid);
|
|
132
|
+
const message = hasWarning ? warning : draftInvalid ? L.invalid : null;
|
|
133
|
+
const describedBy = [externalDescription, message != null ? errorId : description != null ? descriptionId : null].filter(Boolean).join(" ") || undefined;
|
|
134
|
+
const fieldStyle = { width: width === "fill" ? "100%" : width === "md" ? "var(--input-w-md)" : width === "lg" ? "var(--input-w-lg)" : `${width}px`, maxWidth: "100%" };
|
|
109
135
|
const [draft, setDraft] = useState<{ y: string; m: string; d: string }>(() => ({
|
|
110
136
|
y: value ? padSeg("y", value.getFullYear()) : "",
|
|
111
137
|
m: value ? padSeg("m", value.getMonth() + 1) : "",
|
|
@@ -130,6 +156,7 @@ export const DateField = forwardRef<HTMLDivElement, DateFieldProps>(
|
|
|
130
156
|
|
|
131
157
|
const commit = useCallback(
|
|
132
158
|
(next: { y: string; m: string; d: string }) => {
|
|
159
|
+
if (disabled || readOnly) return;
|
|
133
160
|
if (!next.y || !next.m || !next.d) {
|
|
134
161
|
setInvalid(false); onChange(null); return;
|
|
135
162
|
}
|
|
@@ -137,7 +164,7 @@ export const DateField = forwardRef<HTMLDivElement, DateFieldProps>(
|
|
|
137
164
|
if (!date || !isDateSelectable(date, minDate, maxDate, isDateUnavailable)) { setInvalid(true); return; }
|
|
138
165
|
setInvalid(false); onChange(date);
|
|
139
166
|
},
|
|
140
|
-
[onChange, minDate, maxDate, isDateUnavailable],
|
|
167
|
+
[onChange, minDate, maxDate, isDateUnavailable, disabled, readOnly],
|
|
141
168
|
);
|
|
142
169
|
|
|
143
170
|
const focusSeg = (seg: Seg) => refs[seg].current?.focus();
|
|
@@ -151,6 +178,7 @@ export const DateField = forwardRef<HTMLDivElement, DateFieldProps>(
|
|
|
151
178
|
};
|
|
152
179
|
|
|
153
180
|
const onSegChange = (seg: Seg, raw: string) => {
|
|
181
|
+
if (disabled || readOnly) return;
|
|
154
182
|
const digits = raw.replace(/\D/g, "").slice(0, SEG_WIDTH[seg]);
|
|
155
183
|
const next = { ...draft, [seg]: digits };
|
|
156
184
|
setDraft(next);
|
|
@@ -168,6 +196,7 @@ export const DateField = forwardRef<HTMLDivElement, DateFieldProps>(
|
|
|
168
196
|
};
|
|
169
197
|
|
|
170
198
|
const onSegKeyDown = (seg: Seg, e: KeyboardEvent<HTMLInputElement>) => {
|
|
199
|
+
if (disabled || readOnly) return;
|
|
171
200
|
const cur = draft[seg];
|
|
172
201
|
if (e.key === "ArrowLeft") {
|
|
173
202
|
if ((e.target as HTMLInputElement).selectionStart === 0) {
|
|
@@ -194,29 +223,31 @@ export const DateField = forwardRef<HTMLDivElement, DateFieldProps>(
|
|
|
194
223
|
}
|
|
195
224
|
};
|
|
196
225
|
|
|
197
|
-
const wrapClass = [styles.dateField, className ?? ""].filter(Boolean).join(" ");
|
|
198
|
-
|
|
199
|
-
const sizeCls =
|
|
200
|
-
size === "sm" ? styles.dateFieldSm : size === "lg" ? styles.dateFieldLg : styles.dateFieldMd;
|
|
226
|
+
const wrapClass = [inputStyles.root, inputStyles[variant], inputStyles[size === "sm" ? "sizeSm" : size === "lg" ? "sizeLg" : "sizeMd"], styles.dateField, className ?? ""].filter(Boolean).join(" ");
|
|
201
227
|
|
|
202
228
|
const empty = !draft.y && !draft.m && !draft.d;
|
|
203
229
|
|
|
204
|
-
|
|
205
|
-
<>
|
|
230
|
+
const control = (
|
|
206
231
|
<div
|
|
207
232
|
ref={ref}
|
|
208
|
-
className={
|
|
233
|
+
className={wrapClass}
|
|
234
|
+
style={fieldStyle}
|
|
235
|
+
data-control-group-segment={groupSize ? "" : undefined}
|
|
236
|
+
data-invalid={invalid || undefined}
|
|
237
|
+
data-readonly={readOnly || undefined}
|
|
209
238
|
data-slot="date-field"
|
|
210
239
|
data-disabled={disabled || undefined}
|
|
211
|
-
id={
|
|
240
|
+
id={fieldId}
|
|
212
241
|
role="group"
|
|
213
|
-
aria-describedby={
|
|
214
|
-
aria-label={ariaLabel ?? L.group}
|
|
242
|
+
aria-describedby={describedBy}
|
|
243
|
+
aria-label={ariaLabel ?? (label == null ? L.group : undefined)}
|
|
244
|
+
aria-labelledby={ariaLabel == null && label != null ? labelId : undefined}
|
|
215
245
|
onClick={(e) => {
|
|
216
246
|
/* trailing 쪽 클릭은 무시 (trigger button이 자체 로직). */
|
|
217
247
|
const target = e.target as HTMLElement;
|
|
218
248
|
if (target.closest(`[data-datefield-trailing]`)) return;
|
|
219
|
-
|
|
249
|
+
if (disabled) return;
|
|
250
|
+
if (!readOnly) onClickWrap?.();
|
|
220
251
|
if (!refs.y.current) return;
|
|
221
252
|
if (document.activeElement === refs.y.current) return;
|
|
222
253
|
if (document.activeElement === refs.m.current) return;
|
|
@@ -232,16 +263,20 @@ export const DateField = forwardRef<HTMLDivElement, DateFieldProps>(
|
|
|
232
263
|
)}
|
|
233
264
|
<input
|
|
234
265
|
ref={refs.y}
|
|
266
|
+
id={`${fieldId}-y`}
|
|
267
|
+
data-segment="y"
|
|
235
268
|
className={styles.dateFieldSegment}
|
|
236
269
|
type="text"
|
|
237
270
|
inputMode="numeric"
|
|
238
271
|
maxLength={SEG_WIDTH.y}
|
|
239
272
|
value={draft.y}
|
|
240
|
-
placeholder=
|
|
273
|
+
placeholder="YYYY"
|
|
241
274
|
disabled={disabled}
|
|
275
|
+
readOnly={readOnly}
|
|
276
|
+
required={required}
|
|
242
277
|
data-visible={!empty || undefined}
|
|
243
278
|
aria-invalid={invalid || undefined}
|
|
244
|
-
aria-describedby={
|
|
279
|
+
aria-describedby={describedBy}
|
|
245
280
|
aria-label={L.year}
|
|
246
281
|
onChange={(e) => onSegChange("y", e.target.value)}
|
|
247
282
|
onKeyDown={(e) => onSegKeyDown("y", e)}
|
|
@@ -252,16 +287,20 @@ export const DateField = forwardRef<HTMLDivElement, DateFieldProps>(
|
|
|
252
287
|
</span>
|
|
253
288
|
<input
|
|
254
289
|
ref={refs.m}
|
|
290
|
+
id={`${fieldId}-m`}
|
|
291
|
+
data-segment="m"
|
|
255
292
|
className={styles.dateFieldSegment}
|
|
256
293
|
type="text"
|
|
257
294
|
inputMode="numeric"
|
|
258
295
|
maxLength={SEG_WIDTH.m}
|
|
259
296
|
value={draft.m}
|
|
260
|
-
placeholder=
|
|
297
|
+
placeholder="MM"
|
|
261
298
|
disabled={disabled}
|
|
299
|
+
readOnly={readOnly}
|
|
300
|
+
required={required}
|
|
262
301
|
data-visible={!empty || undefined}
|
|
263
302
|
aria-invalid={invalid || undefined}
|
|
264
|
-
aria-describedby={
|
|
303
|
+
aria-describedby={describedBy}
|
|
265
304
|
aria-label={L.month}
|
|
266
305
|
onChange={(e) => onSegChange("m", e.target.value)}
|
|
267
306
|
onKeyDown={(e) => onSegKeyDown("m", e)}
|
|
@@ -272,16 +311,20 @@ export const DateField = forwardRef<HTMLDivElement, DateFieldProps>(
|
|
|
272
311
|
</span>
|
|
273
312
|
<input
|
|
274
313
|
ref={refs.d}
|
|
314
|
+
id={`${fieldId}-d`}
|
|
315
|
+
data-segment="d"
|
|
275
316
|
className={styles.dateFieldSegment}
|
|
276
317
|
type="text"
|
|
277
318
|
inputMode="numeric"
|
|
278
319
|
maxLength={SEG_WIDTH.d}
|
|
279
320
|
value={draft.d}
|
|
280
|
-
placeholder=
|
|
321
|
+
placeholder="DD"
|
|
281
322
|
disabled={disabled}
|
|
323
|
+
readOnly={readOnly}
|
|
324
|
+
required={required}
|
|
282
325
|
data-visible={!empty || undefined}
|
|
283
326
|
aria-invalid={invalid || undefined}
|
|
284
|
-
aria-describedby={
|
|
327
|
+
aria-describedby={describedBy}
|
|
285
328
|
aria-label={L.day}
|
|
286
329
|
onChange={(e) => onSegChange("d", e.target.value)}
|
|
287
330
|
onKeyDown={(e) => onSegKeyDown("d", e)}
|
|
@@ -294,9 +337,13 @@ export const DateField = forwardRef<HTMLDivElement, DateFieldProps>(
|
|
|
294
337
|
</div>
|
|
295
338
|
)}
|
|
296
339
|
</div>
|
|
297
|
-
{invalid && <span id={errorId} role="alert" className={styles.validation}>{L.invalid}</span>}
|
|
298
|
-
</>
|
|
299
340
|
);
|
|
341
|
+
if (label == null && description == null && message == null) return control;
|
|
342
|
+
return <div data-slot="date-field-wrapper" className={inputStyles.field} style={fieldStyle} data-disabled={disabled || undefined}>
|
|
343
|
+
{label != null && <label data-slot="date-field-label" id={labelId} htmlFor={`${fieldId}-y`} className={[inputStyles.label, inputStyles[size === "sm" ? "labelSm" : "labelMd"]].join(" ")}>{label}{required && <span aria-hidden className={inputStyles.requiredMark}>*</span>}</label>}
|
|
344
|
+
{control}
|
|
345
|
+
{message != null ? <p data-slot="date-field-warning" id={errorId} role="alert" className={inputStyles.errorText}><span className={inputStyles.messageIcon} aria-hidden><Icon name="warning-circle" size={14} /></span>{message}</p> : description != null && <p data-slot="date-field-description" id={descriptionId} className={inputStyles.description}><span className={inputStyles.messageIcon} aria-hidden><Icon name="info" size={14} /></span>{description}</p>}
|
|
346
|
+
</div>;
|
|
300
347
|
},
|
|
301
348
|
);
|
|
302
349
|
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
/* Trigger ─────────────────────────────────────────────────── */
|
|
2
|
-
/* Input
|
|
3
|
-
필요하니 width:auto로 해제하고 min-width만 보장. 소비처가 더 넓게 쓰려면 wrapper에 지정. */
|
|
2
|
+
/* Trigger shares Input width and size contracts. */
|
|
4
3
|
.triggerInput {
|
|
5
|
-
width:
|
|
6
|
-
min-width: calc(var(--size-2) * 22);
|
|
4
|
+
min-width: 0;
|
|
7
5
|
}
|
|
8
6
|
|
|
9
7
|
.triggerInput[data-with-time] {
|
|
10
|
-
min-width:
|
|
8
|
+
min-width: 0;
|
|
11
9
|
}
|
|
12
10
|
|
|
13
|
-
/* The display is
|
|
14
|
-
.triggerInput[data-readonly][
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
.triggerInput[data-readonly][
|
|
18
|
-
|
|
19
|
-
}
|
|
11
|
+
/* The formatted display is read-only while its calendar remains interactive. */
|
|
12
|
+
.triggerInput.trigger_outline[data-readonly]:not([aria-readonly="true"]) { background: var(--bg); }
|
|
13
|
+
.triggerInput.trigger_filled[data-readonly]:not([aria-readonly="true"]) { background: var(--bg-subtle); }
|
|
14
|
+
.triggerInput.trigger_filled[data-readonly]:not([aria-readonly="true"]):focus-visible,
|
|
15
|
+
.triggerInput.trigger_filled[data-readonly]:not([aria-readonly="true"])[data-state="open"] { background: var(--bg-muted); }
|
|
16
|
+
.triggerInput.trigger_line[data-readonly]:not([aria-readonly="true"]) { background: transparent; }
|
|
17
|
+
.triggerInput.trigger_outline[data-readonly]:not([aria-readonly="true"]):hover:not([data-disabled]) { border-color: var(--border-strong); }
|
|
18
|
+
.triggerInput.trigger_line[data-readonly]:not([aria-readonly="true"]):hover:not([data-disabled]) { border-bottom-color: var(--border-strong); }
|
|
19
|
+
.triggerInput[data-invalid][data-readonly]:not([aria-readonly="true"]):hover:not([data-disabled]) { border-color: var(--destructive); }
|
|
20
|
+
.triggerInput.trigger_line[data-invalid][data-readonly]:not([aria-readonly="true"]):hover:not([data-disabled]) { border-color: transparent; border-bottom-color: var(--destructive); }
|
|
20
21
|
|
|
21
22
|
/* RadixPopover.Trigger asChild wrapper(상위 element)가 inline-block으로 폭 자유. */
|
|
22
|
-
.segmentedWrap,
|
|
23
23
|
.inlineWrap {
|
|
24
24
|
width: auto;
|
|
25
25
|
}
|
|
@@ -51,6 +51,10 @@
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
.panel {
|
|
54
|
+
border: 0;
|
|
55
|
+
margin: 0;
|
|
56
|
+
padding: 0;
|
|
57
|
+
min-inline-size: 0;
|
|
54
58
|
display: flex;
|
|
55
59
|
flex-direction: column;
|
|
56
60
|
align-items: stretch;
|
|
@@ -427,47 +431,10 @@
|
|
|
427
431
|
padding: var(--space-2);
|
|
428
432
|
}
|
|
429
433
|
|
|
430
|
-
.segmentedWrap {
|
|
431
|
-
display: inline-flex;
|
|
432
|
-
width: 100%;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
434
|
/* ─────────────────── DateField (세그먼트 입력) ─────────────────── */
|
|
436
435
|
|
|
437
|
-
.dateField {
|
|
438
|
-
|
|
439
|
-
align-items: center;
|
|
440
|
-
width: 100%;
|
|
441
|
-
gap: var(--space-1);
|
|
442
|
-
padding: 0 var(--space-2);
|
|
443
|
-
background: transparent;
|
|
444
|
-
border: var(--hairline) solid var(--border);
|
|
445
|
-
corner-shape: var(--corner-shape);
|
|
446
|
-
border-radius: var(--radius-sm);
|
|
447
|
-
color: var(--fg);
|
|
448
|
-
cursor: text;
|
|
449
|
-
/* input의 기본 line-height(normal)가 세로로 늘어나는 걸 Input과 동일한 어휘로 눌러줌 */
|
|
450
|
-
line-height: var(--lh-sm);
|
|
451
|
-
transition: var(--transition-colors), var(--transition-ring);
|
|
452
|
-
}
|
|
453
|
-
.dateField input {
|
|
454
|
-
line-height: inherit;
|
|
455
|
-
}
|
|
456
|
-
.dateField:hover:not([data-disabled]) {
|
|
457
|
-
border-color: var(--border-strong);
|
|
458
|
-
}
|
|
459
|
-
.dateField:focus-within {
|
|
460
|
-
border-color: var(--primary);
|
|
461
|
-
box-shadow: var(--ring-shadow-field);
|
|
462
|
-
}
|
|
463
|
-
.dateField[data-disabled] {
|
|
464
|
-
opacity: 0.5;
|
|
465
|
-
cursor: not-allowed;
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
.dateFieldSm { min-height: var(--control-h-sm); font-size: var(--text-xs); }
|
|
469
|
-
.dateFieldMd { min-height: var(--control-h-md); font-size: var(--text-sm); }
|
|
470
|
-
.dateFieldLg { min-height: var(--control-h-lg); font-size: var(--text-base); }
|
|
436
|
+
.dateField { line-height: var(--lh-sm); }
|
|
437
|
+
.dateField input { line-height: inherit; }
|
|
471
438
|
|
|
472
439
|
.dateFieldSegments {
|
|
473
440
|
flex: 1;
|
|
@@ -484,7 +451,7 @@
|
|
|
484
451
|
inset: 0;
|
|
485
452
|
display: flex;
|
|
486
453
|
align-items: center;
|
|
487
|
-
color: var(--fg-
|
|
454
|
+
color: var(--fg-placeholder);
|
|
488
455
|
pointer-events: none;
|
|
489
456
|
font-variant-numeric: tabular-nums;
|
|
490
457
|
}
|
|
@@ -493,6 +460,8 @@
|
|
|
493
460
|
}
|
|
494
461
|
|
|
495
462
|
.dateFieldSegment {
|
|
463
|
+
box-sizing: content-box;
|
|
464
|
+
flex: 0 0 auto;
|
|
496
465
|
min-width: 0;
|
|
497
466
|
padding: 0 var(--space-0_5);
|
|
498
467
|
border: 0;
|
|
@@ -506,10 +475,10 @@
|
|
|
506
475
|
caret-color: var(--primary);
|
|
507
476
|
}
|
|
508
477
|
.dateFieldSegment::placeholder {
|
|
509
|
-
color: var(--fg-
|
|
478
|
+
color: var(--fg-placeholder);
|
|
510
479
|
}
|
|
511
480
|
/* 비어있을 때는 세그먼트 숨기고 placeholder만. 포커스 들어오면 세그먼트 노출. */
|
|
512
|
-
.dateFieldSegments[data-empty]
|
|
481
|
+
.dateFieldSegments[data-empty]:not(:focus-within) .dateFieldSegment {
|
|
513
482
|
width: 0;
|
|
514
483
|
padding: 0;
|
|
515
484
|
}
|
|
@@ -521,15 +490,15 @@
|
|
|
521
490
|
}
|
|
522
491
|
|
|
523
492
|
/* 세그먼트별 width — 폰트 사이즈에 맞게 자동. 숫자 자리 수 기반 ch. */
|
|
524
|
-
.dateFieldSegments
|
|
525
|
-
.dateFieldSegments
|
|
526
|
-
.dateFieldSegments
|
|
493
|
+
.dateFieldSegments .dateFieldSegment[data-segment="y"] { width: 4ch; }
|
|
494
|
+
.dateFieldSegments .dateFieldSegment[data-segment="m"],
|
|
495
|
+
.dateFieldSegments .dateFieldSegment[data-segment="d"] { width: 2ch; }
|
|
527
496
|
|
|
528
497
|
.dateFieldSep {
|
|
529
498
|
color: var(--fg-muted);
|
|
530
499
|
user-select: none;
|
|
531
500
|
}
|
|
532
|
-
.dateFieldSegments[data-empty] .dateFieldSep {
|
|
501
|
+
.dateFieldSegments[data-empty]:not(:focus-within) .dateFieldSep {
|
|
533
502
|
display: none;
|
|
534
503
|
}
|
|
535
504
|
|