|
| 1 | +// Copyright (c) Meta Platforms, Inc. and affiliates. |
| 2 | + |
| 3 | +/** @type {import('@astryxdesign/cli/authoring').ComponentDoc} */ |
| 4 | +export const docs = { |
| 5 | + name: 'CircleCheckIndicator', |
| 6 | + displayName: 'Circle Check Indicator', |
| 7 | + category: 'Form Controls', |
| 8 | + keywords: [ |
| 9 | + 'indicator', |
| 10 | + 'checkbox', |
| 11 | + 'circle', |
| 12 | + 'check', |
| 13 | + 'multiselect', |
| 14 | + 'selection', |
| 15 | + 'edit mode', |
| 16 | + 'ios', |
| 17 | + 'mark', |
| 18 | + ], |
| 19 | + description: |
| 20 | + 'The iOS multiple-selection mark: an empty circle, a filled circle with a checkmark, or a filled circle with a bar for the partial state. A checkbox-family indicator: map it to `checkbox` with defineTheme({indicators}) and every CheckboxInput and CheckboxList draws it. Decorative (aria-hidden); the owning control keeps the input, role, accessible name, focus, and keyboard behavior. Its colors fade over the theme duration on every pointer and change at once under Reduce Motion.', |
| 21 | + props: [ |
| 22 | + { |
| 23 | + name: 'state', |
| 24 | + type: "'unchecked' | 'checked' | 'indeterminate'", |
| 25 | + description: |
| 26 | + 'Which state to draw. The unchecked circle is an empty ring, not nothing.', |
| 27 | + required: true, |
| 28 | + }, |
| 29 | + { |
| 30 | + name: 'size', |
| 31 | + type: "'sm' | 'md'", |
| 32 | + description: |
| 33 | + 'Control size. The circle draws at UIKit’s diameters, 18px (sm) or 21.8px (md), centred in the host’s 20px or 24px slot.', |
| 34 | + default: "'md'", |
| 35 | + }, |
| 36 | + { |
| 37 | + name: 'isDisabled', |
| 38 | + type: 'boolean', |
| 39 | + description: |
| 40 | + 'Draws the disabled look. Purely visual; the owning control keeps the disabled semantics.', |
| 41 | + default: 'false', |
| 42 | + }, |
| 43 | + { |
| 44 | + name: 'children', |
| 45 | + type: 'ReactNode', |
| 46 | + description: |
| 47 | + 'Content drawn inside the circle instead of the mark, e.g. the loading Spinner CheckboxInput passes while a change is pending.', |
| 48 | + }, |
| 49 | + { |
| 50 | + name: 'xstyle', |
| 51 | + type: 'StyleXStyles', |
| 52 | + description: |
| 53 | + 'StyleX styles for layout customization (margins, positioning, sizing). Must be a stylex.create() value, not an inline style object like style={{}}.', |
| 54 | + }, |
| 55 | + ], |
| 56 | + theming: { |
| 57 | + targets: [ |
| 58 | + { |
| 59 | + className: 'astryx-circle-check-indicator', |
| 60 | + visualProps: ['size', 'checked', 'disabled'], |
| 61 | + }, |
| 62 | + {className: 'astryx-circle-check-indicator-check', visualProps: ['size']}, |
| 63 | + {className: 'astryx-circle-check-indicator-dash', visualProps: ['size']}, |
| 64 | + ], |
| 65 | + }, |
| 66 | + usage: { |
| 67 | + description: |
| 68 | + 'Use it where iOS shows a selection circle: the rows of a list in edit mode, and multiple-choice sets whose product follows iOS. Map it to `checkbox` in a theme to change every checkbox at once, or render it in a row you lay out yourself.', |
| 69 | + bestPractices: [ |
| 70 | + { |
| 71 | + guidance: true, |
| 72 | + description: |
| 73 | + 'Map it with defineTheme({indicators: {checkbox: CircleCheckIndicator}}) so CheckboxInput and CheckboxList keep their semantics and focus ring.', |
| 74 | + }, |
| 75 | + { |
| 76 | + guidance: true, |
| 77 | + description: |
| 78 | + 'Map it only in a theme meant for iOS. It draws the circle on every platform, and Android marks multiple choice with a square box.', |
| 79 | + }, |
| 80 | + { |
| 81 | + guidance: true, |
| 82 | + description: |
| 83 | + 'Keep a visible label beside it; the circle is decorative and announces nothing.', |
| 84 | + }, |
| 85 | + { |
| 86 | + guidance: false, |
| 87 | + description: |
| 88 | + 'Use it for a single choice; a radio, or a checkmark on the chosen row, says "one of these".', |
| 89 | + }, |
| 90 | + { |
| 91 | + guidance: false, |
| 92 | + description: |
| 93 | + 'Give it a role, a label or a tab stop; the owning control has those.', |
| 94 | + }, |
| 95 | + ], |
| 96 | + }, |
| 97 | +}; |
| 98 | + |
| 99 | +/** @type {import('@astryxdesign/cli/authoring').ComponentDoc} */ |
| 100 | +export const docsZh = { |
| 101 | + name: 'CircleCheckIndicator', |
| 102 | + displayName: 'Circle Check Indicator', |
| 103 | + description: |
| 104 | + 'iOS 的多选标记:空心圆、带对勾的实心圆,或表示部分选中的带横线实心圆。属于复选框家族的指示器:通过 defineTheme({indicators}) 映射到 `checkbox` 后,所有 CheckboxInput 和 CheckboxList 都会绘制它。仅作装饰(aria-hidden);输入、角色、无障碍名称、焦点和键盘行为由所属控件负责。颜色在任何指针下都按主题时长渐变,开启减弱动态效果时立即切换。', |
| 105 | + props: [ |
| 106 | + { |
| 107 | + name: 'state', |
| 108 | + type: "'unchecked' | 'checked' | 'indeterminate'", |
| 109 | + description: '要绘制的状态。未选中时是一个空心圆环,而不是什么都不画。', |
| 110 | + required: true, |
| 111 | + }, |
| 112 | + { |
| 113 | + name: 'size', |
| 114 | + type: "'sm' | 'md'", |
| 115 | + description: |
| 116 | + '控件尺寸。圆圈按 UIKit 的直径绘制:sm 为 18px,md 为 21.8px,居中于宿主 20px 或 24px 的位置。', |
| 117 | + default: "'md'", |
| 118 | + }, |
| 119 | + { |
| 120 | + name: 'isDisabled', |
| 121 | + type: 'boolean', |
| 122 | + description: '绘制禁用外观。仅影响视觉;禁用语义由所属控件负责。', |
| 123 | + default: 'false', |
| 124 | + }, |
| 125 | + { |
| 126 | + name: 'children', |
| 127 | + type: 'ReactNode', |
| 128 | + description: |
| 129 | + '绘制在圆内、替代标记的内容,例如 CheckboxInput 在变更进行中传入的加载 Spinner。', |
| 130 | + }, |
| 131 | + { |
| 132 | + name: 'xstyle', |
| 133 | + type: 'StyleXStyles', |
| 134 | + description: |
| 135 | + '用于布局自定义的 StyleX 样式(外边距、定位、尺寸)。必须是 stylex.create() 的值,而非内联样式对象如 style={{}}。', |
| 136 | + }, |
| 137 | + ], |
| 138 | + theming: { |
| 139 | + targets: [ |
| 140 | + { |
| 141 | + className: 'astryx-circle-check-indicator', |
| 142 | + visualProps: ['size', 'checked', 'disabled'], |
| 143 | + }, |
| 144 | + {className: 'astryx-circle-check-indicator-check', visualProps: ['size']}, |
| 145 | + {className: 'astryx-circle-check-indicator-dash', visualProps: ['size']}, |
| 146 | + ], |
| 147 | + }, |
| 148 | + usage: { |
| 149 | + description: |
| 150 | + '用在 iOS 显示选择圆圈的地方:编辑模式下的列表行,以及遵循 iOS 的多选集合。在主题中将其映射到 `checkbox` 可一次替换所有复选框,也可以在自行布局的行中直接渲染。', |
| 151 | + bestPractices: [ |
| 152 | + { |
| 153 | + guidance: true, |
| 154 | + description: |
| 155 | + '使用 defineTheme({indicators: {checkbox: CircleCheckIndicator}}) 映射,使 CheckboxInput 和 CheckboxList 保留其语义和焦点环。', |
| 156 | + }, |
| 157 | + { |
| 158 | + guidance: true, |
| 159 | + description: |
| 160 | + '只在面向 iOS 的主题中映射它。它在所有平台上都绘制圆圈,而 Android 用方形复选框表示多选。', |
| 161 | + }, |
| 162 | + { |
| 163 | + guidance: true, |
| 164 | + description: '在旁边保留可见标签;圆圈仅作装饰,不会被朗读。', |
| 165 | + }, |
| 166 | + { |
| 167 | + guidance: false, |
| 168 | + description: '用于单选;单选按钮或所选行上的对勾表示“其中之一”。', |
| 169 | + }, |
| 170 | + { |
| 171 | + guidance: false, |
| 172 | + description: '为其添加角色、标签或 Tab 停靠点;这些属于所属控件。', |
| 173 | + }, |
| 174 | + ], |
| 175 | + }, |
| 176 | +}; |
| 177 | + |
| 178 | +/** @type {import('@astryxdesign/cli/authoring').ComponentTranslationDoc} */ |
| 179 | +export const docsDense = { |
| 180 | + description: |
| 181 | + 'iOS multiselect circle: empty ring / filled circle + check / filled circle + bar. Checkbox-family indicator; map to `checkbox` via defineTheme({indicators}).', |
| 182 | + usage: { |
| 183 | + description: |
| 184 | + 'For iOS-style selection circles: edit-mode list rows and multiple-choice sets. Map it to `checkbox` in a theme, or render it in your own row.', |
| 185 | + bestPractices: [ |
| 186 | + { |
| 187 | + guidance: true, |
| 188 | + description: |
| 189 | + 'Map via defineTheme({indicators: {checkbox: CircleCheckIndicator}}); hosts keep semantics + focus ring.', |
| 190 | + }, |
| 191 | + { |
| 192 | + guidance: true, |
| 193 | + description: 'Keep a visible label; the circle is decorative.', |
| 194 | + }, |
| 195 | + { |
| 196 | + guidance: false, |
| 197 | + description: |
| 198 | + 'Use for a single choice (radio or row checkmark instead).', |
| 199 | + }, |
| 200 | + { |
| 201 | + guidance: false, |
| 202 | + description: |
| 203 | + 'Add role, label or tabIndex; the owning control has them.', |
| 204 | + }, |
| 205 | + ], |
| 206 | + }, |
| 207 | + propDescriptions: { |
| 208 | + state: |
| 209 | + "'unchecked' (empty ring) | 'checked' (check) | 'indeterminate' (bar).", |
| 210 | + size: "'sm' an 18px circle | 'md' a 21.8px circle (in a 20px or 24px slot).", |
| 211 | + isDisabled: 'Disabled look only; owner keeps semantics.', |
| 212 | + children: 'Drawn inside the circle instead of the mark (e.g. Spinner).', |
| 213 | + xstyle: 'StyleX layout styles; must be stylex.create() value.', |
| 214 | + }, |
| 215 | +}; |
0 commit comments