import { Checkbox } from '@ankhorage/surface'; import React from 'react'; import type { CheckboxGroupOption, CheckboxGroupProps } from '../../../../../types/checkbox'; import { View } from '../../../../layout/public'; import { withZoraThemeScope } from '../../../../theme/adapters/inbound/withZoraThemeScope'; import { Text } from '../../../../typography/public'; function CheckboxGroupInner({ themeId: _themeId, mode: _mode, value, onValueChange, options, orientation = 'vertical', gap = 's', color = 'primary', size = 'm', invalid = false, readOnly = false, disabled = false, testID, interactionPolicy, }: CheckboxGroupProps) { const selectedValues = new Set(value); const isHorizontal = orientation === 'horizontal'; return ( {options.map((option) => ( ))} ); } /*** * Renders a group of checkboxes for multi-select values. */ export const CheckboxGroup = withZoraThemeScope(CheckboxGroupInner); function CheckboxGroupItem({ option, checked, disabled, invalid, readOnly, size, color, value, onValueChange, interactionPolicy, }: { option: CheckboxGroupOption; checked: boolean; disabled: boolean; invalid: boolean; readOnly: boolean; size: NonNullable['size']>; color: NonNullable['color']>; value: readonly TValue[]; onValueChange: (value: TValue[]) => void; interactionPolicy: CheckboxGroupProps['interactionPolicy']; }) { const passive = interactionPolicy === 'passive'; return ( { if (passive) return; const nextValue = nextChecked ? [...value, option.value] : value.filter((currentValue) => currentValue !== option.value); onValueChange(nextValue); }} > {option.label} {option.description ? ( {option.description} ) : null} ); }