@astryxdesign/core 0.1.7-canary.eb8e07b → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
  2. package/dist/ContextMenu/ContextMenu.js +3 -4
  3. package/dist/ContextMenu/index.d.ts +0 -3
  4. package/dist/ContextMenu/index.d.ts.map +1 -1
  5. package/dist/ContextMenu/index.js +1 -7
  6. package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  7. package/dist/DropdownMenu/DropdownMenu.js +4 -8
  8. package/dist/DropdownMenu/DropdownMenuContext.d.ts +1 -17
  9. package/dist/DropdownMenu/DropdownMenuContext.d.ts.map +1 -1
  10. package/dist/DropdownMenu/DropdownMenuContext.js +0 -18
  11. package/dist/DropdownMenu/index.d.ts +1 -5
  12. package/dist/DropdownMenu/index.d.ts.map +1 -1
  13. package/dist/DropdownMenu/index.js +1 -10
  14. package/dist/Icon/Icon.d.ts +12 -17
  15. package/dist/Icon/Icon.d.ts.map +1 -1
  16. package/dist/Icon/Icon.js +20 -28
  17. package/dist/astryx.css +1 -15
  18. package/dist/astryx.umd.js +46 -46
  19. package/dist/astryx.umd.js.map +4 -4
  20. package/package.json +1 -1
  21. package/src/ContextMenu/ContextMenu.test.tsx +1 -75
  22. package/src/ContextMenu/ContextMenu.tsx +5 -10
  23. package/src/ContextMenu/index.ts +0 -15
  24. package/src/DropdownMenu/DropdownMenu.doc.mjs +0 -10
  25. package/src/DropdownMenu/DropdownMenu.tsx +6 -11
  26. package/src/DropdownMenu/DropdownMenuContext.tsx +1 -29
  27. package/src/DropdownMenu/index.ts +3 -23
  28. package/src/Icon/Icon.test.tsx +0 -46
  29. package/src/Icon/Icon.tsx +24 -37
  30. package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts +0 -89
  31. package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +0 -1
  32. package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +0 -170
  33. package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts +0 -69
  34. package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts.map +0 -1
  35. package/dist/DropdownMenu/DropdownMenuRadioGroup.js +0 -70
  36. package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts +0 -69
  37. package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +0 -1
  38. package/dist/DropdownMenu/DropdownMenuRadioItem.js +0 -178
  39. package/dist/DropdownMenu/menuItemRoles.d.ts +0 -13
  40. package/dist/DropdownMenu/menuItemRoles.d.ts.map +0 -1
  41. package/dist/DropdownMenu/menuItemRoles.js +0 -15
  42. package/src/DropdownMenu/DropdownMenuCheckboxItem.doc.mjs +0 -95
  43. package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +0 -237
  44. package/src/DropdownMenu/DropdownMenuRadioGroup.doc.mjs +0 -80
  45. package/src/DropdownMenu/DropdownMenuRadioGroup.tsx +0 -119
  46. package/src/DropdownMenu/DropdownMenuRadioItem.doc.mjs +0 -80
  47. package/src/DropdownMenu/DropdownMenuRadioItem.tsx +0 -232
  48. package/src/DropdownMenu/DropdownMenuSelectable.test.tsx +0 -163
  49. package/src/DropdownMenu/menuItemRoles.ts +0 -22
@@ -1,95 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- /** @type {import('../docs-types').ComponentDoc} */
4
-
5
- export const docs = {
6
- name: 'DropdownMenuCheckboxItem',
7
- subComponentOf: 'DropdownMenu',
8
- displayName: 'Dropdown Menu Checkbox Item',
9
- isHiddenFromOverview: true,
10
- description:
11
- 'A checkable menu item (role="menuitemcheckbox") that toggles an independent boolean. Use for on/off options inside a DropdownMenu; for a one-of-N choice use DropdownMenuRadioGroup.',
12
- props: [
13
- {
14
- name: 'label',
15
- type: 'ReactNode',
16
- description: 'Primary label text identifying the item.',
17
- },
18
- {
19
- name: 'description',
20
- type: 'ReactNode',
21
- description: 'Secondary description text displayed below the label.',
22
- },
23
- {
24
- name: 'icon',
25
- type: 'IconType',
26
- description:
27
- 'Icon to display before the label. See `npx astryx docs icons` for valid semantic names.',
28
- },
29
- {
30
- name: 'value',
31
- type: 'boolean',
32
- description: 'Whether the item is checked. Controlled — pair with onChange.',
33
- },
34
- {
35
- name: 'onChange',
36
- type: '(checked: boolean) => void',
37
- description: 'Callback fired with the next checked state when the item is toggled.',
38
- },
39
- {
40
- name: 'isDisabled',
41
- type: 'boolean',
42
- default: 'false',
43
- description:
44
- 'Whether the item is disabled. Disabled items stay focusable (via aria-disabled) so they remain discoverable by keyboard and assistive technology, but activation is blocked.',
45
- },
46
- {
47
- name: 'hasCloseOnSelect',
48
- type: 'boolean',
49
- default: 'false',
50
- description:
51
- 'Whether toggling the item closes the menu. Checkbox items default to staying open so several can be toggled in a single session.',
52
- },
53
- {
54
- name: 'endContent',
55
- type: 'ReactNode',
56
- description:
57
- 'Content to render after the label and description, such as a keyboard shortcut hint or badge.',
58
- },
59
- ],
60
- };
61
-
62
- export const docsZh = {
63
- name: 'DropdownMenuCheckboxItem',
64
- isHiddenFromOverview: true,
65
- displayName: 'Dropdown Menu Checkbox Item',
66
- description:
67
- '可勾选的菜单项(role="menuitemcheckbox"),用于切换独立的布尔值。用于 DropdownMenu 中的开关选项;单选请使用 DropdownMenuRadioGroup。',
68
- propDescriptions: {
69
- label: '标识该项的主标签文本。',
70
- description: '显示在标签下方的次要描述文本。',
71
- icon: '显示在标签前的图标。',
72
- value: '该项是否被勾选。受控 — 与 onChange 搭配使用。',
73
- onChange: '切换该项时以下一个勾选状态触发的回调。',
74
- isDisabled: '该项是否禁用。',
75
- hasCloseOnSelect: '切换该项是否关闭菜单。默认保持打开。',
76
- endContent: '在标签和描述之后渲染的内容。',
77
- },
78
- };
79
-
80
- export const docsDense = {
81
- name: 'DropdownMenuCheckboxItem',
82
- isHiddenFromOverview: true,
83
- displayName: 'Dropdown Menu Checkbox Item',
84
- description: 'checkable menu item (menuitemcheckbox); independent boolean toggle',
85
- propDescriptions: {
86
- label: 'primary label text',
87
- description: 'secondary text below label',
88
- icon: 'icon before label',
89
- value: 'checked state (controlled, w/ onChange)',
90
- onChange: 'fired w/ next checked state on toggle',
91
- isDisabled: 'disabled; stays focusable via aria-disabled',
92
- hasCloseOnSelect: 'close menu on toggle (default false — stays open)',
93
- endContent: 'content after label+description',
94
- },
95
- };
@@ -1,237 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- 'use client';
4
-
5
- /**
6
- * @file DropdownMenuCheckboxItem.tsx
7
- * @input React, stylex, Item + Icon + DropdownMenu context + tokens from core
8
- * @output DropdownMenuCheckboxItem — a standalone checkable menu item.
9
- * @position Sub-component; used inside DropdownMenu.
10
- *
11
- * A menu item that toggles an independent boolean (role="menuitemcheckbox").
12
- * Unlike CheckboxInput, there is no nested native <input>: the row itself owns
13
- * the role and aria-checked, per the WAI-ARIA menuitemcheckbox pattern.
14
- * Keyboard navigation (arrows/typeahead) and Enter/Space activation come from
15
- * the parent DropdownMenu's useListFocus + activation path, which matches
16
- * menuitemcheckbox alongside plain menuitem rows.
17
- *
18
- * The square checkbox visual is decorative (aria-hidden) — the row owns the
19
- * checked state. Its size is derived from the menu's item size (a `sm` menu
20
- * gets the compact control; `md`/`lg` get the standard one) and it swaps to the
21
- * inline-end of the row on coarse-pointer (touch) devices via CSS `order`, so
22
- * it lands where selection toggles are conventionally placed on mobile. The
23
- * checkmark uses the `check` icon from the active theme's icon registry.
24
- */
25
-
26
- import {useCallback, type ReactNode} from 'react';
27
- import * as stylex from '@stylexjs/stylex';
28
- import {Icon, renderIconSlot, type IconType} from '../Icon';
29
- import {Item} from '../Item';
30
- import {useDropdownMenuContext} from './DropdownMenuContext';
31
- import {
32
- colorVars,
33
- spacingVars,
34
- radiusVars,
35
- durationVars,
36
- easeVars,
37
- borderVars,
38
- } from '../theme/tokens.stylex';
39
- import {mergeProps, themeProps} from '../utils';
40
- import type {BaseProps} from '../BaseProps';
41
-
42
- const styles = stylex.create({
43
- root: {
44
- width: '100%',
45
- borderRadius: `max(0px, calc(var(--_dropdown-menu-radius, ${spacingVars['--spacing-2']}) - var(--_dropdown-menu-padding, ${spacingVars['--spacing-1']})))`,
46
- color: colorVars['--color-text-primary'],
47
- backgroundColor: {
48
- default: 'transparent',
49
- ':focus': colorVars['--color-overlay-hover'],
50
- ':hover': colorVars['--color-overlay-hover'],
51
- },
52
- cursor: 'pointer',
53
- outline: 'none',
54
- },
55
- disabled: {
56
- opacity: 0.5,
57
- cursor: 'not-allowed',
58
- },
59
- // Rendered in Item's `marker` slot as a raw flex child, so `order` moves it
60
- // relative to the label within the row. On touch it moves to the inline-end.
61
- box: {
62
- display: 'flex',
63
- alignItems: 'center',
64
- justifyContent: 'center',
65
- flexShrink: 0,
66
- boxSizing: 'border-box',
67
- borderWidth: borderVars['--border-width'],
68
- borderStyle: 'solid',
69
- borderRadius: radiusVars['--radius-inner'],
70
- color: colorVars['--color-on-accent'],
71
- transitionProperty: 'background-color, border-color',
72
- transitionDuration: {
73
- default: durationVars['--duration-fast'],
74
- '@media (prefers-reduced-motion: reduce)': '0s',
75
- },
76
- transitionTimingFunction: easeVars['--ease-standard'],
77
- order: {
78
- default: 0,
79
- '@media (pointer: coarse)': 1,
80
- },
81
- marginInlineStart: {
82
- default: 0,
83
- '@media (pointer: coarse)': 'auto',
84
- },
85
- },
86
- unchecked: {
87
- borderColor: colorVars['--color-border-emphasized'],
88
- backgroundColor: colorVars['--color-background-surface'],
89
- },
90
- checked: {
91
- borderColor: colorVars['--color-accent'],
92
- backgroundColor: colorVars['--color-accent'],
93
- },
94
- });
95
-
96
- const boxSizeStyles = stylex.create({
97
- sm: {width: 18, height: 18},
98
- md: {width: 22, height: 22},
99
- });
100
-
101
- export interface DropdownMenuCheckboxItemProps extends Omit<
102
- BaseProps,
103
- 'onChange' | 'role' | 'aria-checked' | 'tabIndex'
104
- > {
105
- /**
106
- * Primary label text identifying the item.
107
- */
108
- label: ReactNode;
109
- /**
110
- * Secondary description text displayed below the label.
111
- */
112
- description?: ReactNode;
113
- /**
114
- * Icon to display before the label. Accepts a semantic icon name (see
115
- * `npx astryx docs icons`) or a rendered node.
116
- */
117
- icon?: ReactNode | IconType;
118
- /**
119
- * Whether the item is checked. Controlled — pair with `onChange`.
120
- */
121
- value: boolean;
122
- /**
123
- * Callback fired with the next checked state when the item is toggled.
124
- */
125
- onChange?: (checked: boolean) => void;
126
- /**
127
- * Whether the item is disabled. Disabled items stay focusable (via
128
- * `aria-disabled`) so they remain discoverable by keyboard and assistive
129
- * technology, but activation is blocked.
130
- * @default false
131
- */
132
- isDisabled?: boolean;
133
- /**
134
- * Whether toggling the item closes the menu. Checkbox items default to
135
- * staying open so several can be toggled in a single session, unlike radio
136
- * items which default to closing on selection.
137
- * @default false
138
- */
139
- hasCloseOnSelect?: boolean;
140
- /**
141
- * Content to render after the label and description, such as a keyboard
142
- * shortcut hint or badge.
143
- */
144
- endContent?: ReactNode;
145
- }
146
-
147
- /**
148
- * A checkable dropdown menu item (role="menuitemcheckbox").
149
- *
150
- * Must be used inside a DropdownMenu. Toggles an independent boolean; for a
151
- * one-of-N choice use DropdownMenuRadioGroup + DropdownMenuRadioItem instead.
152
- *
153
- * @example
154
- * ```
155
- * * import {DropdownMenuCheckboxItem} from '@astryxdesign/core/DropdownMenu';
156
- *
157
- * <DropdownMenu button={{label: 'View'}}>
158
- * <DropdownMenuCheckboxItem
159
- * label="Show archived"
160
- * value={showArchived}
161
- * onChange={setShowArchived}
162
- * />
163
- * </DropdownMenu>
164
- * ```
165
- */
166
- export function DropdownMenuCheckboxItem({
167
- label,
168
- description,
169
- icon,
170
- value,
171
- onChange,
172
- isDisabled = false,
173
- hasCloseOnSelect = false,
174
- endContent,
175
- xstyle,
176
- className,
177
- style,
178
- ...rest
179
- }: DropdownMenuCheckboxItemProps) {
180
- const ctx = useDropdownMenuContext();
181
- const menuSize = ctx?.menuSize ?? 'md';
182
- const controlSize = menuSize === 'sm' ? 'sm' : 'md';
183
-
184
- const handleClick = useCallback(() => {
185
- if (isDisabled) {
186
- return;
187
- }
188
- onChange?.(!value);
189
- if (hasCloseOnSelect) {
190
- ctx?.closeMenu();
191
- }
192
- }, [isDisabled, onChange, value, hasCloseOnSelect, ctx]);
193
-
194
- return (
195
- <Item
196
- {...rest}
197
- role="menuitemcheckbox"
198
- aria-checked={value}
199
- tabIndex={isDisabled ? undefined : -1}
200
- marker={
201
- <span
202
- aria-hidden="true"
203
- {...mergeProps(
204
- themeProps('dropdown-menu-checkbox', {
205
- size: controlSize,
206
- checked: value ? 'checked' : null,
207
- disabled: isDisabled ? 'disabled' : null,
208
- }),
209
- stylex.props(
210
- styles.box,
211
- boxSizeStyles[controlSize],
212
- value ? styles.checked : styles.unchecked,
213
- ),
214
- )}>
215
- {value && <Icon icon="check" size="sm" color="inherit" />}
216
- </span>
217
- }
218
- startContent={
219
- icon
220
- ? renderIconSlot(icon, {size: 'sm', color: 'secondary'})
221
- : undefined
222
- }
223
- label={label}
224
- description={description}
225
- endContent={endContent}
226
- onClick={handleClick}
227
- isDisabled={isDisabled}
228
- xstyle={[styles.root, isDisabled && styles.disabled, xstyle]}
229
- {...mergeProps(themeProps('dropdown-menu-item', {size: menuSize}), {
230
- className,
231
- style,
232
- })}
233
- />
234
- );
235
- }
236
-
237
- DropdownMenuCheckboxItem.displayName = 'DropdownMenuCheckboxItem';
@@ -1,80 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- /** @type {import('../docs-types').ComponentDoc} */
4
-
5
- export const docs = {
6
- name: 'DropdownMenuRadioGroup',
7
- subComponentOf: 'DropdownMenu',
8
- displayName: 'Dropdown Menu Radio Group',
9
- isHiddenFromOverview: true,
10
- description:
11
- 'A single-select group of radio menu items (role="group" of menuitemradio). Owns the selected value and lays its items out with the menu\'s inter-item gap.',
12
- props: [
13
- {
14
- name: 'value',
15
- type: 'string | undefined',
16
- description:
17
- 'The currently selected value in the group. Pass undefined when nothing is selected yet.',
18
- },
19
- {
20
- name: 'onChange',
21
- type: '(value: string) => void',
22
- description: 'Callback fired when the selected value changes.',
23
- },
24
- {
25
- name: 'aria-label',
26
- type: 'string',
27
- description:
28
- 'Accessible label for the group. Required (or aria-labelledby) so screen readers announce the radios as a named set, e.g. "Sort by".',
29
- },
30
- {
31
- name: 'aria-labelledby',
32
- type: 'string',
33
- description:
34
- 'The id of an element that labels the group, as an alternative to aria-label.',
35
- },
36
- {
37
- name: 'hasCloseOnSelect',
38
- type: 'boolean',
39
- default: 'true',
40
- description:
41
- 'Whether selecting a value closes the menu. Radio items default to closing on selection (a single-choice commit).',
42
- },
43
- {
44
- name: 'children',
45
- type: 'ReactNode',
46
- description: 'The DropdownMenuRadioItems that make up the group.',
47
- },
48
- ],
49
- };
50
-
51
- export const docsZh = {
52
- name: 'DropdownMenuRadioGroup',
53
- isHiddenFromOverview: true,
54
- displayName: 'Dropdown Menu Radio Group',
55
- description:
56
- '单选的单选菜单项组(menuitemradio 的 role="group")。持有所选值,并以菜单的项间距布局其子项。',
57
- propDescriptions: {
58
- value: '组中当前选中的值。尚无选中项时传 undefined。',
59
- onChange: '所选值变化时触发的回调。',
60
- 'aria-label': '组的无障碍标签。必需(或 aria-labelledby),以便屏幕阅读器将单选项作为命名集合朗读。',
61
- 'aria-labelledby': '标记该组的元素 id,作为 aria-label 的替代。',
62
- hasCloseOnSelect: '选择某值是否关闭菜单。默认关闭。',
63
- children: '组成该组的 DropdownMenuRadioItem。',
64
- },
65
- };
66
-
67
- export const docsDense = {
68
- name: 'DropdownMenuRadioGroup',
69
- isHiddenFromOverview: true,
70
- displayName: 'Dropdown Menu Radio Group',
71
- description: 'single-select group of menuitemradio; owns selected value',
72
- propDescriptions: {
73
- value: 'selected value (undefined = none)',
74
- onChange: 'fired when selected value changes',
75
- 'aria-label': 'accessible group name (or aria-labelledby); required',
76
- 'aria-labelledby': 'id of labelling element (alt to aria-label)',
77
- hasCloseOnSelect: 'close menu on select (default true)',
78
- children: 'the DropdownMenuRadioItems',
79
- },
80
- };
@@ -1,119 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- 'use client';
4
-
5
- /**
6
- * @file DropdownMenuRadioGroup.tsx
7
- * @output DropdownMenuRadioGroup — a single-select group of menu items.
8
- * @position Sub-component; wraps DropdownMenuRadioItem inside a DropdownMenu.
9
- *
10
- * Owns single-selection state (value/onChange) for its child
11
- * DropdownMenuRadioItems and exposes it via context. Renders role="group" with
12
- * an accessible name so the radios are announced as a set. Keyboard navigation
13
- * comes from the parent DropdownMenu's useListFocus, which matches
14
- * menuitemradio rows.
15
- */
16
-
17
- import {useMemo, type ReactNode} from 'react';
18
- import * as stylex from '@stylexjs/stylex';
19
- import {spacingVars} from '../theme/tokens.stylex';
20
- import {mergeProps} from '../utils';
21
- import type {BaseProps} from '../BaseProps';
22
- import {
23
- DropdownMenuRadioGroupContext,
24
- type DropdownMenuRadioGroupContextValue,
25
- } from './DropdownMenuContext';
26
-
27
- const styles = stylex.create({
28
- // Match the menu's own inter-item rhythm (2px) so grouped radio items keep
29
- // the same gap as ungrouped items instead of sitting flush against each
30
- // other inside the role="group" wrapper.
31
- group: {
32
- display: 'flex',
33
- flexDirection: 'column',
34
- gap: spacingVars['--spacing-0-5'],
35
- },
36
- });
37
-
38
- export interface DropdownMenuRadioGroupProps extends Omit<
39
- BaseProps,
40
- 'onChange'
41
- > {
42
- /**
43
- * The currently selected value in the group. Pass `undefined` when nothing
44
- * is selected yet.
45
- */
46
- value: string | undefined;
47
- /**
48
- * Callback fired when the selected value changes.
49
- */
50
- onChange: (value: string) => void;
51
- /**
52
- * Accessible label for the group. Required (together with `aria-labelledby`,
53
- * one of the two) so screen readers announce the radios as a named set,
54
- * e.g. "Sort by".
55
- */
56
- 'aria-label'?: string;
57
- /**
58
- * The id of an element that labels the group, as an alternative to
59
- * `aria-label`.
60
- */
61
- 'aria-labelledby'?: string;
62
- /**
63
- * Whether selecting a value closes the menu. Radio items default to closing
64
- * on selection (a single-choice commit), unlike checkbox items which stay
65
- * open.
66
- * @default true
67
- */
68
- hasCloseOnSelect?: boolean;
69
- /**
70
- * The `DropdownMenuRadioItem`s that make up the group.
71
- */
72
- children: ReactNode;
73
- }
74
-
75
- /**
76
- * A single-select group of radio menu items (role="group" of menuitemradio).
77
- *
78
- * @example
79
- * ```
80
- * * import {
81
- * DropdownMenuRadioGroup,
82
- * DropdownMenuRadioItem,
83
- * } from '@astryxdesign/core/DropdownMenu';
84
- *
85
- * <DropdownMenu button={{label: 'Sort'}}>
86
- * <DropdownMenuRadioGroup value={sort} onChange={setSort} aria-label="Sort by">
87
- * <DropdownMenuRadioItem value="newest" label="Newest" />
88
- * <DropdownMenuRadioItem value="oldest" label="Oldest" />
89
- * </DropdownMenuRadioGroup>
90
- * </DropdownMenu>
91
- * ```
92
- */
93
- export function DropdownMenuRadioGroup({
94
- value,
95
- onChange,
96
- hasCloseOnSelect = true,
97
- children,
98
- className,
99
- style,
100
- ...rest
101
- }: DropdownMenuRadioGroupProps) {
102
- const contextValue = useMemo<DropdownMenuRadioGroupContextValue>(
103
- () => ({value, onChange, hasCloseOnSelect}),
104
- [value, onChange, hasCloseOnSelect],
105
- );
106
-
107
- return (
108
- <div
109
- {...rest}
110
- role="group"
111
- {...mergeProps(stylex.props(styles.group), {className, style})}>
112
- <DropdownMenuRadioGroupContext value={contextValue}>
113
- {children}
114
- </DropdownMenuRadioGroupContext>
115
- </div>
116
- );
117
- }
118
-
119
- DropdownMenuRadioGroup.displayName = 'DropdownMenuRadioGroup';
@@ -1,80 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- /** @type {import('../docs-types').ComponentDoc} */
4
-
5
- export const docs = {
6
- name: 'DropdownMenuRadioItem',
7
- subComponentOf: 'DropdownMenu',
8
- displayName: 'Dropdown Menu Radio Item',
9
- isHiddenFromOverview: true,
10
- description:
11
- 'A single option in a DropdownMenuRadioGroup (role="menuitemradio"). Must be used inside a DropdownMenuRadioGroup.',
12
- props: [
13
- {
14
- name: 'value',
15
- type: 'string',
16
- description:
17
- "The value this item represents within its group. The group's value matches against this to determine the checked state.",
18
- },
19
- {
20
- name: 'label',
21
- type: 'ReactNode',
22
- description: 'Primary label text identifying the option.',
23
- },
24
- {
25
- name: 'description',
26
- type: 'ReactNode',
27
- description: 'Secondary description text displayed below the label.',
28
- },
29
- {
30
- name: 'icon',
31
- type: 'IconType',
32
- description:
33
- 'Icon to display before the label. See `npx astryx docs icons` for valid semantic names.',
34
- },
35
- {
36
- name: 'isDisabled',
37
- type: 'boolean',
38
- default: 'false',
39
- description:
40
- 'Whether this individual radio item is disabled. Disabled items stay focusable (via aria-disabled) so they remain discoverable by keyboard and assistive technology, but selection is blocked.',
41
- },
42
- {
43
- name: 'endContent',
44
- type: 'ReactNode',
45
- description:
46
- 'Content to render after the label and description, such as a badge or metadata.',
47
- },
48
- ],
49
- };
50
-
51
- export const docsZh = {
52
- name: 'DropdownMenuRadioItem',
53
- isHiddenFromOverview: true,
54
- displayName: 'Dropdown Menu Radio Item',
55
- description:
56
- 'DropdownMenuRadioGroup 中的单个选项(role="menuitemradio")。必须在 DropdownMenuRadioGroup 内使用。',
57
- propDescriptions: {
58
- value: '该项在组内代表的值。组的 value 与之匹配以确定勾选状态。',
59
- label: '标识该选项的主标签文本。',
60
- description: '显示在标签下方的次要描述文本。',
61
- icon: '显示在标签前的图标。',
62
- isDisabled: '该单选项是否禁用。',
63
- endContent: '在标签和描述之后渲染的内容。',
64
- },
65
- };
66
-
67
- export const docsDense = {
68
- name: 'DropdownMenuRadioItem',
69
- isHiddenFromOverview: true,
70
- displayName: 'Dropdown Menu Radio Item',
71
- description: 'one option in a DropdownMenuRadioGroup (menuitemradio)',
72
- propDescriptions: {
73
- value: "item's value within the group (matched vs group value)",
74
- label: 'primary label text',
75
- description: 'secondary text below label',
76
- icon: 'icon before label',
77
- isDisabled: 'disabled; stays focusable via aria-disabled',
78
- endContent: 'content after label+description',
79
- },
80
- };