@ankhorage/zora 1.5.1 → 2.1.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/CHANGELOG.md +29 -0
- package/README.md +125 -123
- package/dist/components/app-bar/AppBar.js +4 -4
- package/dist/components/app-bar/AppBar.js.map +1 -1
- package/dist/components/avatar/Avatar.d.ts.map +1 -1
- package/dist/components/avatar/Avatar.js +19 -9
- package/dist/components/avatar/Avatar.js.map +1 -1
- package/dist/components/avatar/types.d.ts +2 -2
- package/dist/components/avatar/types.d.ts.map +1 -1
- package/dist/components/avatar/types.js.map +1 -1
- package/dist/components/avatar-group/AvatarGroup.js +2 -2
- package/dist/components/avatar-group/AvatarGroup.js.map +1 -1
- package/dist/components/avatar-group/types.d.ts +2 -2
- package/dist/components/avatar-group/types.d.ts.map +1 -1
- package/dist/components/avatar-group/types.js.map +1 -1
- package/dist/components/badge/Badge.js +3 -3
- package/dist/components/badge/Badge.js.map +1 -1
- package/dist/components/badge/types.d.ts +4 -4
- package/dist/components/badge/types.d.ts.map +1 -1
- package/dist/components/badge/types.js.map +1 -1
- package/dist/components/button/Button.js +3 -3
- package/dist/components/button/Button.js.map +1 -1
- package/dist/components/button/meta.d.ts +15 -7
- package/dist/components/button/meta.d.ts.map +1 -1
- package/dist/components/button/meta.js +16 -7
- package/dist/components/button/meta.js.map +1 -1
- package/dist/components/button/types.d.ts +4 -4
- package/dist/components/button/types.d.ts.map +1 -1
- package/dist/components/button/types.js.map +1 -1
- package/dist/components/card/Card.js +2 -2
- package/dist/components/card/Card.js.map +1 -1
- package/dist/components/checkbox/CheckboxGroup.js +5 -5
- package/dist/components/checkbox/CheckboxGroup.js.map +1 -1
- package/dist/components/checkbox/types.d.ts +1 -1
- package/dist/components/checkbox/types.d.ts.map +1 -1
- package/dist/components/checkbox/types.js.map +1 -1
- package/dist/components/chip/Chip.d.ts.map +1 -1
- package/dist/components/chip/Chip.js +9 -10
- package/dist/components/chip/Chip.js.map +1 -1
- package/dist/components/chip/resolveChipColors.d.ts +3 -3
- package/dist/components/chip/resolveChipColors.d.ts.map +1 -1
- package/dist/components/chip/resolveChipColors.js +14 -4
- package/dist/components/chip/resolveChipColors.js.map +1 -1
- package/dist/components/chip/types.d.ts +2 -2
- package/dist/components/chip/types.d.ts.map +1 -1
- package/dist/components/chip/types.js.map +1 -1
- package/dist/components/chip-group/ChipGroup.js +2 -2
- package/dist/components/chip-group/ChipGroup.js.map +1 -1
- package/dist/components/chip-group/types.d.ts +2 -2
- package/dist/components/chip-group/types.d.ts.map +1 -1
- package/dist/components/chip-group/types.js.map +1 -1
- package/dist/components/drawer/Drawer.js +1 -1
- package/dist/components/drawer/Drawer.js.map +1 -1
- package/dist/components/form/FormError.js +1 -1
- package/dist/components/form/FormError.js.map +1 -1
- package/dist/components/form/FormField.js +1 -1
- package/dist/components/form/FormField.js.map +1 -1
- package/dist/components/form/meta.d.ts +13 -0
- package/dist/components/form/meta.d.ts.map +1 -1
- package/dist/components/form/meta.js +15 -0
- package/dist/components/form/meta.js.map +1 -1
- package/dist/components/heading/Heading.d.ts.map +1 -1
- package/dist/components/heading/Heading.js +5 -3
- package/dist/components/heading/Heading.js.map +1 -1
- package/dist/components/heading/index.d.ts +1 -1
- package/dist/components/heading/index.d.ts.map +1 -1
- package/dist/components/heading/index.js.map +1 -1
- package/dist/components/heading/meta.d.ts +9 -3
- package/dist/components/heading/meta.d.ts.map +1 -1
- package/dist/components/heading/meta.js +10 -3
- package/dist/components/heading/meta.js.map +1 -1
- package/dist/components/heading/resolveHeadingRecipe.d.ts +4 -3
- package/dist/components/heading/resolveHeadingRecipe.d.ts.map +1 -1
- package/dist/components/heading/resolveHeadingRecipe.js +33 -12
- package/dist/components/heading/resolveHeadingRecipe.js.map +1 -1
- package/dist/components/heading/types.d.ts +5 -2
- package/dist/components/heading/types.d.ts.map +1 -1
- package/dist/components/heading/types.js.map +1 -1
- package/dist/components/icon-button/IconButton.js +3 -3
- package/dist/components/icon-button/IconButton.js.map +1 -1
- package/dist/components/icon-button/types.d.ts +3 -3
- package/dist/components/icon-button/types.d.ts.map +1 -1
- package/dist/components/icon-button/types.js.map +1 -1
- package/dist/components/input/Input.js +1 -1
- package/dist/components/input/Input.js.map +1 -1
- package/dist/components/media-card/MediaCard.js +2 -2
- package/dist/components/media-card/MediaCard.js.map +1 -1
- package/dist/components/metric-card/MetricCard.js +5 -5
- package/dist/components/metric-card/MetricCard.js.map +1 -1
- package/dist/components/metric-card/types.d.ts +2 -2
- package/dist/components/metric-card/types.d.ts.map +1 -1
- package/dist/components/metric-card/types.js.map +1 -1
- package/dist/components/modal/Modal.js +1 -1
- package/dist/components/modal/Modal.js.map +1 -1
- package/dist/components/progress/Progress.js +2 -2
- package/dist/components/progress/Progress.js.map +1 -1
- package/dist/components/progress/types.d.ts +3 -3
- package/dist/components/progress/types.d.ts.map +1 -1
- package/dist/components/progress/types.js +12 -2
- package/dist/components/progress/types.js.map +1 -1
- package/dist/components/radio/RadioGroup.js +5 -5
- package/dist/components/radio/RadioGroup.js.map +1 -1
- package/dist/components/radio/types.d.ts +1 -1
- package/dist/components/radio/types.d.ts.map +1 -1
- package/dist/components/radio/types.js.map +1 -1
- package/dist/components/rating/Rating.js +2 -2
- package/dist/components/rating/Rating.js.map +1 -1
- package/dist/components/rating/types.d.ts +3 -3
- package/dist/components/rating/types.d.ts.map +1 -1
- package/dist/components/rating/types.js +12 -2
- package/dist/components/rating/types.js.map +1 -1
- package/dist/components/tabs/Tabs.d.ts.map +1 -1
- package/dist/components/tabs/Tabs.js +4 -4
- package/dist/components/tabs/Tabs.js.map +1 -1
- package/dist/components/text/Text.d.ts.map +1 -1
- package/dist/components/text/Text.js +3 -2
- package/dist/components/text/Text.js.map +1 -1
- package/dist/components/text/index.d.ts +1 -1
- package/dist/components/text/index.d.ts.map +1 -1
- package/dist/components/text/index.js.map +1 -1
- package/dist/components/text/meta.d.ts +10 -4
- package/dist/components/text/meta.d.ts.map +1 -1
- package/dist/components/text/meta.js +11 -4
- package/dist/components/text/meta.js.map +1 -1
- package/dist/components/text/resolveTextRecipe.d.ts +4 -3
- package/dist/components/text/resolveTextRecipe.d.ts.map +1 -1
- package/dist/components/text/resolveTextRecipe.js +35 -13
- package/dist/components/text/resolveTextRecipe.js.map +1 -1
- package/dist/components/text/types.d.ts +5 -2
- package/dist/components/text/types.d.ts.map +1 -1
- package/dist/components/text/types.js.map +1 -1
- package/dist/components/toolbar/ToolbarAction.js +1 -1
- package/dist/components/toolbar/ToolbarAction.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/colorModel.d.ts +10 -0
- package/dist/internal/colorModel.d.ts.map +1 -0
- package/dist/internal/colorModel.js +25 -0
- package/dist/internal/colorModel.js.map +1 -0
- package/dist/internal/recipes.d.ts +12 -11
- package/dist/internal/recipes.d.ts.map +1 -1
- package/dist/internal/recipes.js +6 -6
- package/dist/internal/recipes.js.map +1 -1
- package/dist/metadata/index.d.ts +1 -1
- package/dist/metadata/index.d.ts.map +1 -1
- package/dist/metadata/index.js.map +1 -1
- package/dist/metadata/types.d.ts +16 -0
- package/dist/metadata/types.d.ts.map +1 -1
- package/dist/metadata/types.js.map +1 -1
- package/dist/patterns/auth/ForgotPasswordForm.js +2 -2
- package/dist/patterns/auth/ForgotPasswordForm.js.map +1 -1
- package/dist/patterns/auth/OtpForm.js +2 -2
- package/dist/patterns/auth/OtpForm.js.map +1 -1
- package/dist/patterns/auth/SignInForm.js +4 -4
- package/dist/patterns/auth/SignInForm.js.map +1 -1
- package/dist/patterns/auth/SignUpForm.js +2 -2
- package/dist/patterns/auth/SignUpForm.js.map +1 -1
- package/dist/patterns/chat-list-item/ChatListItem.d.ts.map +1 -1
- package/dist/patterns/chat-list-item/ChatListItem.js +6 -6
- package/dist/patterns/chat-list-item/ChatListItem.js.map +1 -1
- package/dist/patterns/chat-list-item/types.d.ts +2 -2
- package/dist/patterns/chat-list-item/types.d.ts.map +1 -1
- package/dist/patterns/chat-list-item/types.js.map +1 -1
- package/dist/patterns/collection-editor/CollectionEditor.js +5 -5
- package/dist/patterns/collection-editor/CollectionEditor.js.map +1 -1
- package/dist/patterns/confirm-dialog/ConfirmDialog.js +3 -3
- package/dist/patterns/confirm-dialog/ConfirmDialog.js.map +1 -1
- package/dist/patterns/confirm-dialog/types.d.ts +3 -3
- package/dist/patterns/confirm-dialog/types.d.ts.map +1 -1
- package/dist/patterns/confirm-dialog/types.js.map +1 -1
- package/dist/patterns/disclosure-section/DisclosureSection.js +1 -1
- package/dist/patterns/disclosure-section/DisclosureSection.js.map +1 -1
- package/dist/patterns/empty-state/EmptyState.js +2 -2
- package/dist/patterns/empty-state/EmptyState.js.map +1 -1
- package/dist/patterns/empty-state/types.d.ts +3 -3
- package/dist/patterns/empty-state/types.d.ts.map +1 -1
- package/dist/patterns/empty-state/types.js.map +1 -1
- package/dist/patterns/form-field/FormField.js +1 -1
- package/dist/patterns/form-field/FormField.js.map +1 -1
- package/dist/patterns/hero/Hero.js +3 -3
- package/dist/patterns/hero/Hero.js.map +1 -1
- package/dist/patterns/hero/types.d.ts +3 -3
- package/dist/patterns/hero/types.d.ts.map +1 -1
- package/dist/patterns/hero/types.js.map +1 -1
- package/dist/patterns/image-preview/ImagePreview.js +1 -1
- package/dist/patterns/image-preview/ImagePreview.js.map +1 -1
- package/dist/patterns/image-upload-field/ImageUploadField.js +7 -7
- package/dist/patterns/image-upload-field/ImageUploadField.js.map +1 -1
- package/dist/patterns/list/ListRow.js +2 -2
- package/dist/patterns/list/ListRow.js.map +1 -1
- package/dist/patterns/list/meta.d.ts +16 -0
- package/dist/patterns/list/meta.d.ts.map +1 -1
- package/dist/patterns/list/meta.js +19 -0
- package/dist/patterns/list/meta.js.map +1 -1
- package/dist/patterns/message-bubble/MessageBubble.d.ts.map +1 -1
- package/dist/patterns/message-bubble/MessageBubble.js +6 -6
- package/dist/patterns/message-bubble/MessageBubble.js.map +1 -1
- package/dist/patterns/message-bubble/types.d.ts +2 -2
- package/dist/patterns/message-bubble/types.d.ts.map +1 -1
- package/dist/patterns/message-bubble/types.js.map +1 -1
- package/dist/patterns/notice/Notice.js +2 -2
- package/dist/patterns/notice/Notice.js.map +1 -1
- package/dist/patterns/notice/types.d.ts +2 -2
- package/dist/patterns/notice/types.d.ts.map +1 -1
- package/dist/patterns/notice/types.js.map +1 -1
- package/dist/patterns/post-card/PostCard.js +4 -4
- package/dist/patterns/post-card/PostCard.js.map +1 -1
- package/dist/patterns/post-card/types.d.ts +2 -2
- package/dist/patterns/post-card/types.d.ts.map +1 -1
- package/dist/patterns/post-card/types.js.map +1 -1
- package/dist/patterns/section-header/SectionHeader.js +2 -2
- package/dist/patterns/section-header/SectionHeader.js.map +1 -1
- package/dist/patterns/settings-row/SettingsRow.js +1 -1
- package/dist/patterns/settings-row/SettingsRow.js.map +1 -1
- package/dist/patterns/theme-composer/ThemeComposer.js +14 -14
- package/dist/patterns/theme-composer/ThemeComposer.js.map +1 -1
- package/dist/patterns/tile-grid/PaletteItem.js +1 -1
- package/dist/patterns/tile-grid/PaletteItem.js.map +1 -1
- package/dist/patterns/timeline/Timeline.d.ts.map +1 -1
- package/dist/patterns/timeline/Timeline.js +14 -4
- package/dist/patterns/timeline/Timeline.js.map +1 -1
- package/dist/patterns/timeline/types.d.ts +2 -2
- package/dist/patterns/timeline/types.d.ts.map +1 -1
- package/dist/patterns/timeline/types.js.map +1 -1
- package/dist/patterns/tree-view/TreeItem.js +1 -1
- package/dist/patterns/tree-view/TreeItem.js.map +1 -1
- package/dist/theme/useZoraTheme.d.ts +1 -1
- package/package.json +3 -3
- package/src/components/app-bar/AppBar.tsx +6 -6
- package/src/components/avatar/Avatar.tsx +21 -11
- package/src/components/avatar/types.ts +2 -2
- package/src/components/avatar-group/AvatarGroup.tsx +2 -2
- package/src/components/avatar-group/types.ts +2 -2
- package/src/components/badge/Badge.tsx +4 -4
- package/src/components/badge/types.ts +4 -4
- package/src/components/button/Button.tsx +4 -4
- package/src/components/button/meta.ts +16 -7
- package/src/components/button/types.ts +4 -4
- package/src/components/card/Card.tsx +2 -2
- package/src/components/checkbox/CheckboxGroup.tsx +6 -6
- package/src/components/checkbox/types.ts +1 -1
- package/src/components/chip/Chip.tsx +9 -10
- package/src/components/chip/resolveChipColors.ts +16 -6
- package/src/components/chip/types.ts +2 -2
- package/src/components/chip-group/ChipGroup.tsx +2 -2
- package/src/components/chip-group/types.ts +2 -2
- package/src/components/drawer/Drawer.tsx +1 -1
- package/src/components/form/FormError.tsx +1 -1
- package/src/components/form/FormField.tsx +1 -1
- package/src/components/form/meta.ts +15 -0
- package/src/components/heading/Heading.tsx +6 -3
- package/src/components/heading/index.ts +2 -1
- package/src/components/heading/meta.ts +10 -3
- package/src/components/heading/resolveHeadingRecipe.test.ts +13 -10
- package/src/components/heading/resolveHeadingRecipe.ts +58 -15
- package/src/components/heading/types.ts +5 -10
- package/src/components/icon-button/IconButton.tsx +4 -4
- package/src/components/icon-button/types.ts +3 -3
- package/src/components/input/Input.tsx +2 -2
- package/src/components/media-card/MediaCard.tsx +2 -2
- package/src/components/metric-card/MetricCard.tsx +6 -6
- package/src/components/metric-card/types.ts +2 -2
- package/src/components/modal/Modal.tsx +1 -1
- package/src/components/progress/Progress.tsx +2 -2
- package/src/components/progress/types.ts +14 -4
- package/src/components/radio/RadioGroup.tsx +6 -6
- package/src/components/radio/types.ts +1 -1
- package/src/components/rating/Rating.tsx +2 -2
- package/src/components/rating/types.ts +14 -4
- package/src/components/tabs/Tabs.tsx +11 -7
- package/src/components/text/Text.tsx +4 -2
- package/src/components/text/index.ts +8 -1
- package/src/components/text/meta.ts +11 -4
- package/src/components/text/resolveTextRecipe.test.ts +18 -14
- package/src/components/text/resolveTextRecipe.ts +42 -15
- package/src/components/text/types.ts +5 -10
- package/src/components/toolbar/ToolbarAction.tsx +2 -2
- package/src/index.ts +26 -2
- package/src/internal/colorModel.ts +39 -0
- package/src/internal/recipes.test.ts +2 -2
- package/src/internal/recipes.ts +18 -18
- package/src/metadata/componentMeta.test.ts +36 -0
- package/src/metadata/index.ts +4 -0
- package/src/metadata/types.ts +27 -0
- package/src/patterns/auth/ForgotPasswordForm.tsx +2 -2
- package/src/patterns/auth/OtpForm.tsx +2 -2
- package/src/patterns/auth/SignInForm.tsx +4 -4
- package/src/patterns/auth/SignUpForm.tsx +2 -2
- package/src/patterns/chat-list-item/ChatListItem.tsx +7 -6
- package/src/patterns/chat-list-item/types.ts +2 -2
- package/src/patterns/collection-editor/CollectionEditor.tsx +6 -6
- package/src/patterns/confirm-dialog/ConfirmDialog.tsx +4 -4
- package/src/patterns/confirm-dialog/types.ts +3 -3
- package/src/patterns/disclosure-section/DisclosureSection.tsx +2 -2
- package/src/patterns/empty-state/EmptyState.tsx +4 -4
- package/src/patterns/empty-state/types.ts +3 -3
- package/src/patterns/form-field/FormField.tsx +1 -1
- package/src/patterns/hero/Hero.tsx +4 -4
- package/src/patterns/hero/types.ts +3 -3
- package/src/patterns/image-preview/ImagePreview.tsx +1 -1
- package/src/patterns/image-upload-field/ImageUploadField.tsx +8 -8
- package/src/patterns/list/ListRow.tsx +2 -2
- package/src/patterns/list/meta.ts +19 -0
- package/src/patterns/message-bubble/MessageBubble.tsx +10 -6
- package/src/patterns/message-bubble/types.ts +2 -2
- package/src/patterns/notice/Notice.tsx +2 -2
- package/src/patterns/notice/types.ts +2 -2
- package/src/patterns/post-card/PostCard.tsx +5 -5
- package/src/patterns/post-card/types.ts +2 -2
- package/src/patterns/section-header/SectionHeader.tsx +2 -2
- package/src/patterns/settings-row/SettingsRow.tsx +1 -1
- package/src/patterns/theme-composer/ThemeComposer.tsx +15 -15
- package/src/patterns/tile-grid/PaletteItem.tsx +1 -1
- package/src/patterns/timeline/Timeline.tsx +15 -5
- package/src/patterns/timeline/types.ts +2 -2
- package/src/patterns/tree-view/TreeItem.tsx +1 -1
|
@@ -4,7 +4,7 @@ import { View } from 'react-native';
|
|
|
4
4
|
import { Stack } from '../../foundation';
|
|
5
5
|
import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
|
|
6
6
|
import { Text } from '../text';
|
|
7
|
-
function CheckboxGroupInner({ themeId: _themeId, mode: _mode, value, onValueChange, options, orientation = 'vertical', gap = 's',
|
|
7
|
+
function CheckboxGroupInner({ themeId: _themeId, mode: _mode, value, onValueChange, options, orientation = 'vertical', gap = 's', color = 'primary', size = 'm', invalid = false, readOnly = false, disabled = false, testID, }) {
|
|
8
8
|
const selectedValues = new Set(value);
|
|
9
9
|
const isHorizontal = orientation === 'horizontal';
|
|
10
10
|
return (<View testID={testID} style={{
|
|
@@ -12,13 +12,13 @@ function CheckboxGroupInner({ themeId: _themeId, mode: _mode, value, onValueChan
|
|
|
12
12
|
flexWrap: isHorizontal ? 'wrap' : 'nowrap',
|
|
13
13
|
}}>
|
|
14
14
|
<Stack direction={isHorizontal ? 'row' : 'column'} gap={gap} wrap={isHorizontal ? 'wrap' : 'nowrap'}>
|
|
15
|
-
{options.map((option) => (<CheckboxGroupItem key={option.value} option={option} checked={selectedValues.has(option.value)} disabled={disabled || option.disabled === true} invalid={invalid} readOnly={readOnly} size={size}
|
|
15
|
+
{options.map((option) => (<CheckboxGroupItem key={option.value} option={option} checked={selectedValues.has(option.value)} disabled={disabled || option.disabled === true} invalid={invalid} readOnly={readOnly} size={size} color={color} value={value} onValueChange={onValueChange}/>))}
|
|
16
16
|
</Stack>
|
|
17
17
|
</View>);
|
|
18
18
|
}
|
|
19
19
|
export const CheckboxGroup = withZoraThemeScope(CheckboxGroupInner);
|
|
20
|
-
function CheckboxGroupItem({ option, checked, disabled, invalid, readOnly, size,
|
|
21
|
-
return (<Checkbox checked={checked} disabled={disabled} invalid={invalid} readOnly={readOnly} size={size}
|
|
20
|
+
function CheckboxGroupItem({ option, checked, disabled, invalid, readOnly, size, color, value, onValueChange, }) {
|
|
21
|
+
return (<Checkbox checked={checked} disabled={disabled} invalid={invalid} readOnly={readOnly} size={size} color={color} testID={option.testID} onCheckedChange={(nextChecked) => {
|
|
22
22
|
const nextValue = nextChecked
|
|
23
23
|
? [...value, option.value]
|
|
24
24
|
: value.filter((currentValue) => currentValue !== option.value);
|
|
@@ -26,7 +26,7 @@ function CheckboxGroupItem({ option, checked, disabled, invalid, readOnly, size,
|
|
|
26
26
|
}}>
|
|
27
27
|
<Stack gap="xs">
|
|
28
28
|
<Text>{option.label}</Text>
|
|
29
|
-
{option.description ? (<Text
|
|
29
|
+
{option.description ? (<Text emphasis="muted" variant="caption">
|
|
30
30
|
{option.description}
|
|
31
31
|
</Text>) : null}
|
|
32
32
|
</Stack>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxGroup.js","sourceRoot":"","sources":["../../../src/components/checkbox/CheckboxGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,SAAS,kBAAkB,CAAwB,EACjD,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,KAAK,EACX,KAAK,EACL,aAAa,EACb,OAAO,EACP,WAAW,GAAG,UAAU,EACxB,GAAG,GAAG,GAAG,EACT,
|
|
1
|
+
{"version":3,"file":"CheckboxGroup.js","sourceRoot":"","sources":["../../../src/components/checkbox/CheckboxGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE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CAAC,CAEF;MAAA,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CACb;QAAA,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,IAAI,CAC1B;QAAA,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CACpB,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CACtC;YAAA,CAAC,MAAM,CAAC,WAAW,CACrB;UAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,IAAI,CACV;MAAA,EAAE,KAAK,CACT;IAAA,EAAE,QAAQ,CAAC,CACZ,CAAC;AACJ,CAAC","sourcesContent":["import { Checkbox } from '@ankhorage/surface';\nimport React from 'react';\nimport { View } from 'react-native';\n\nimport { Stack } from '../../foundation';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport { Text } from '../text';\nimport type { CheckboxGroupOption, CheckboxGroupProps } from './types';\n\nfunction CheckboxGroupInner<TValue extends string>({\n themeId: _themeId,\n mode: _mode,\n value,\n onValueChange,\n options,\n orientation = 'vertical',\n gap = 's',\n color = 'primary',\n size = 'm',\n invalid = false,\n readOnly = false,\n disabled = false,\n testID,\n}: CheckboxGroupProps<TValue>) {\n const selectedValues = new Set(value);\n const isHorizontal = orientation === 'horizontal';\n\n return (\n <View\n testID={testID}\n style={{\n flexDirection: isHorizontal ? 'row' : 'column',\n flexWrap: isHorizontal ? 'wrap' : 'nowrap',\n }}\n >\n <Stack\n direction={isHorizontal ? 'row' : 'column'}\n gap={gap}\n wrap={isHorizontal ? 'wrap' : 'nowrap'}\n >\n {options.map((option) => (\n <CheckboxGroupItem\n key={option.value}\n option={option}\n checked={selectedValues.has(option.value)}\n disabled={disabled || option.disabled === true}\n invalid={invalid}\n readOnly={readOnly}\n size={size}\n color={color}\n value={value}\n onValueChange={onValueChange}\n />\n ))}\n </Stack>\n </View>\n );\n}\n\nexport const CheckboxGroup = withZoraThemeScope(CheckboxGroupInner);\n\nfunction CheckboxGroupItem<TValue extends string>({\n option,\n checked,\n disabled,\n invalid,\n readOnly,\n size,\n color,\n value,\n onValueChange,\n}: {\n option: CheckboxGroupOption<TValue>;\n checked: boolean;\n disabled: boolean;\n invalid: boolean;\n readOnly: boolean;\n size: NonNullable<CheckboxGroupProps<TValue>['size']>;\n color: NonNullable<CheckboxGroupProps<TValue>['color']>;\n value: readonly TValue[];\n onValueChange: (value: TValue[]) => void;\n}) {\n return (\n <Checkbox\n checked={checked}\n disabled={disabled}\n invalid={invalid}\n readOnly={readOnly}\n size={size}\n color={color}\n testID={option.testID}\n onCheckedChange={(nextChecked) => {\n const nextValue = nextChecked\n ? [...value, option.value]\n : value.filter((currentValue) => currentValue !== option.value);\n\n onValueChange(nextValue);\n }}\n >\n <Stack gap=\"xs\">\n <Text>{option.label}</Text>\n {option.description ? (\n <Text emphasis=\"muted\" variant=\"caption\">\n {option.description}\n </Text>\n ) : null}\n </Stack>\n </Checkbox>\n );\n}\n"]}
|
|
@@ -10,7 +10,7 @@ export interface CheckboxGroupOption<TValue extends string> {
|
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
testID?: string;
|
|
12
12
|
}
|
|
13
|
-
export interface CheckboxGroupProps<TValue extends string> extends ZoraBaseProps, Pick<Omit<SurfaceCheckboxProps, 'mode' | 'themeId'>, '
|
|
13
|
+
export interface CheckboxGroupProps<TValue extends string> extends ZoraBaseProps, Pick<Omit<SurfaceCheckboxProps, 'mode' | 'themeId'>, 'color' | 'size' | 'invalid' | 'readOnly' | 'disabled'> {
|
|
14
14
|
value: readonly TValue[];
|
|
15
15
|
onValueChange: (value: TValue[]) => void;
|
|
16
16
|
options: readonly CheckboxGroupOption<TValue>[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/checkbox/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,oBAAoB,EAAE,MAAM,oBAAo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AAC,MAAM,SAAS,MAAM,CACvD,SACE,aAAa,EACb,IAAI,CACF,IAAI,CAAC,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC,EAC9C,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CACvD;IACH,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACzC,OAAO,EAAE,SAAS,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC;IAChD,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC,GAAG,CAAC,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/checkbox/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { CheckboxProps as SurfaceCheckboxProps } from '@ankhorage/surface';\nimport type React from 'react';\n\nimport type { ZoraBaseProps } from '../../theme/ZoraBaseProps';\n\nexport interface CheckboxProps\n extends ZoraBaseProps, Omit<SurfaceCheckboxProps, 'mode' | 'themeId'> {}\n\nexport interface CheckboxGroupOption<TValue extends string> {\n value: TValue;\n label: React.ReactNode;\n description?: React.ReactNode;\n disabled?: boolean;\n testID?: string;\n}\n\nexport interface CheckboxGroupProps<TValue extends string>\n extends\n ZoraBaseProps,\n Pick<\n Omit<SurfaceCheckboxProps, 'mode' | 'themeId'>,\n '
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/checkbox/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { CheckboxProps as SurfaceCheckboxProps } from '@ankhorage/surface';\nimport type React from 'react';\n\nimport type { ZoraBaseProps } from '../../theme/ZoraBaseProps';\n\nexport interface CheckboxProps\n extends ZoraBaseProps, Omit<SurfaceCheckboxProps, 'mode' | 'themeId'> {}\n\nexport interface CheckboxGroupOption<TValue extends string> {\n value: TValue;\n label: React.ReactNode;\n description?: React.ReactNode;\n disabled?: boolean;\n testID?: string;\n}\n\nexport interface CheckboxGroupProps<TValue extends string>\n extends\n ZoraBaseProps,\n Pick<\n Omit<SurfaceCheckboxProps, 'mode' | 'themeId'>,\n 'color' | 'size' | 'invalid' | 'readOnly' | 'disabled'\n > {\n value: readonly TValue[];\n onValueChange: (value: TValue[]) => void;\n options: readonly CheckboxGroupOption<TValue>[];\n orientation?: 'horizontal' | 'vertical';\n gap?: 'xs' | 's' | 'm' | 'l';\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../../src/components/chip/Chip.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EAAwB,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../../src/components/chip/Chip.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EAAwB,SAAS,EAAE,MAAM,SAAS,CAAC;AAmF/D,eAAO,MAAM,IAAI,iDAAgC,CAAC"}
|
|
@@ -18,26 +18,25 @@ function resolveChipPadding(size) {
|
|
|
18
18
|
return { px: 'm', py: 'xs' };
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
function ChipInner({ themeId: _themeId, mode: _mode, testID, children, icon, selected = false, disabled = false,
|
|
21
|
+
function ChipInner({ themeId: _themeId, mode: _mode, testID, children, icon, selected = false, disabled = false, color = 'neutral', size = 's', onPress, }) {
|
|
22
22
|
const { theme } = useZoraTheme();
|
|
23
23
|
const padding = resolveChipPadding(size);
|
|
24
24
|
const iconSize = resolveIconSize(size);
|
|
25
25
|
const renderContent = (state) => {
|
|
26
|
-
const colors = resolveChipColors({ theme,
|
|
27
|
-
const
|
|
28
|
-
?
|
|
29
|
-
: selected
|
|
30
|
-
?
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
: 'default';
|
|
26
|
+
const colors = resolveChipColors({ theme, color, selected, state });
|
|
27
|
+
const textColor = state.disabled
|
|
28
|
+
? undefined
|
|
29
|
+
: selected && color !== 'neutral'
|
|
30
|
+
? color
|
|
31
|
+
: undefined;
|
|
32
|
+
const textEmphasis = state.disabled ? 'muted' : 'default';
|
|
34
33
|
return (<Box bg={colors.backgroundColor} borderColor={colors.borderColor} borderWidth={1} px={padding.px} py={padding.py} radius="full" style={{
|
|
35
34
|
alignSelf: 'flex-start',
|
|
36
35
|
opacity: colors.opacity,
|
|
37
36
|
}}>
|
|
38
37
|
<Inline align="center" gap="xs" wrap="nowrap">
|
|
39
38
|
{icon ? (<Icon color={colors.contentColor} name={icon.name} provider={icon.provider} size={iconSize}/>) : null}
|
|
40
|
-
<Text
|
|
39
|
+
<Text color={textColor} emphasis={textEmphasis} variant="label">
|
|
41
40
|
{children}
|
|
42
41
|
</Text>
|
|
43
42
|
</Inline>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chip.js","sourceRoot":"","sources":["../../../src/components/chip/Chip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,SAAS,kBAAkB,CA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ED,MAAM,CAAC,MAAM,IAAI,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC","sourcesContent":["import { ButtonBase } from '@ankhorage/surface';\nimport React from 'react';\n\nimport { Box, Inline } from '../../foundation';\nimport { resolveIconSize } from '../../internal/recipes';\nimport { useZoraTheme } from '../../theme/useZoraTheme';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport { Icon } from '../icon';\nimport { Text } from '../text';\nimport { resolveChipColors } from './resolveChipColors';\nimport type { ChipInteractionState, ChipProps } from './types';\n\nfunction resolveChipPadding(size: NonNullable<ChipProps['size']>): {\n px: 's' | 'm';\n py: 'xxs' | 'xs';\n} {\n switch (size) {\n case 's':\n return { px: 's', py: 'xxs' };\n case 'm':\n return { px: 'm', py: 'xs' };\n case 'l':\n default:\n return { px: 'm', py: 'xs' };\n }\n}\n\nfunction ChipInner({\n themeId: _themeId,\n mode: _mode,\n testID,\n children,\n icon,\n selected = false,\n disabled = false,\n color = 'neutral',\n size = 's',\n onPress,\n}: ChipProps) {\n const { theme } = useZoraTheme();\n const padding = resolveChipPadding(size);\n const iconSize = resolveIconSize(size);\n\n const renderContent = (state: ChipInteractionState) => {\n const colors = resolveChipColors({ theme, color, selected, state });\n const textColor = state.disabled\n ? undefined\n : selected && color !== 'neutral'\n ? color\n : undefined;\n const textEmphasis = state.disabled ? 'muted' : 'default';\n\n return (\n <Box\n bg={colors.backgroundColor}\n borderColor={colors.borderColor}\n borderWidth={1}\n px={padding.px}\n py={padding.py}\n radius=\"full\"\n style={{\n alignSelf: 'flex-start',\n opacity: colors.opacity,\n }}\n >\n <Inline align=\"center\" gap=\"xs\" wrap=\"nowrap\">\n {icon ? (\n <Icon\n color={colors.contentColor}\n name={icon.name}\n provider={icon.provider}\n size={iconSize}\n />\n ) : null}\n <Text color={textColor} emphasis={textEmphasis} variant=\"label\">\n {children}\n </Text>\n </Inline>\n </Box>\n );\n };\n\n if (!onPress) {\n return renderContent({ disabled, focused: false, hovered: false, pressed: false });\n }\n\n return (\n <ButtonBase disabled={disabled} onPress={onPress} radius=\"full\" testID={testID}>\n {(state) => renderContent(state)}\n </ButtonBase>\n );\n}\n\nexport const Chip = withZoraThemeScope(ChipInner);\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { SurfaceTheme } from '@ankhorage/surface';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ZoraColor } from '../../internal/recipes';
|
|
3
3
|
import type { ChipColors, ChipInteractionState } from './types';
|
|
4
|
-
export declare function resolveChipColors({ theme,
|
|
4
|
+
export declare function resolveChipColors({ theme, color, selected, state, }: {
|
|
5
5
|
theme: SurfaceTheme;
|
|
6
|
-
|
|
6
|
+
color: ZoraColor;
|
|
7
7
|
selected: boolean;
|
|
8
8
|
state: ChipInteractionState;
|
|
9
9
|
}): ChipColors;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveChipColors.d.ts","sourceRoot":"","sources":["../../../src/components/chip/resolveChipColors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"resolveChipColors.d.ts","sourceRoot":"","sources":["../../../src/components/chip/resolveChipColors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AA4BhE,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,KAAK,EACL,QAAQ,EACR,KAAK,GACN,EAAE;IACD,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,oBAAoB,CAAC;CAC7B,GAAG,UAAU,CAiCb"}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
function resolveChipRole(theme,
|
|
2
|
-
switch (
|
|
1
|
+
function resolveChipRole(theme, color) {
|
|
2
|
+
switch (color) {
|
|
3
|
+
case 'secondary':
|
|
4
|
+
return theme.semantics.secondary;
|
|
5
|
+
case 'tertiary':
|
|
6
|
+
return theme.semantics.accent;
|
|
7
|
+
case 'quaternary':
|
|
8
|
+
return theme.semantics.highlight;
|
|
9
|
+
case 'error':
|
|
10
|
+
return theme.semantics.error;
|
|
11
|
+
case 'info':
|
|
12
|
+
return theme.semantics.info;
|
|
3
13
|
case 'primary':
|
|
4
14
|
return theme.semantics.action.primary;
|
|
5
15
|
case 'danger':
|
|
@@ -13,7 +23,7 @@ function resolveChipRole(theme, tone) {
|
|
|
13
23
|
return theme.semantics.action.neutral;
|
|
14
24
|
}
|
|
15
25
|
}
|
|
16
|
-
export function resolveChipColors({ theme,
|
|
26
|
+
export function resolveChipColors({ theme, color, selected, state, }) {
|
|
17
27
|
if (state.disabled) {
|
|
18
28
|
return {
|
|
19
29
|
backgroundColor: theme.semantics.neutral.surface,
|
|
@@ -22,7 +32,7 @@ export function resolveChipColors({ theme, tone, selected, state, }) {
|
|
|
22
32
|
opacity: 0.72,
|
|
23
33
|
};
|
|
24
34
|
}
|
|
25
|
-
const role = resolveChipRole(theme,
|
|
35
|
+
const role = resolveChipRole(theme, color);
|
|
26
36
|
if (selected) {
|
|
27
37
|
return {
|
|
28
38
|
backgroundColor: state.pressed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveChipColors.js","sourceRoot":"","sources":["../../../src/components/chip/resolveChipColors.ts"],"names":[],"mappings":"AAKA,SAAS,eAAe,CAAC,KAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"resolveChipColors.js","sourceRoot":"","sources":["../../../src/components/chip/resolveChipColors.ts"],"names":[],"mappings":"AAKA,SAAS,eAAe,CAAC,KAAmB,EAAE,KAAgB;IAC5D,QAAQ,KAAK,E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K,CAAC,OAAO;gBAC5B,CAAC,CAAC,IAAI,CAAC,UAAU;gBACjB,CAAC,CAAC,KAAK,CAAC,OAAO;oBACb,CAAC,CAAC,IAAI,CAAC,SAAS;oBAChB,CAAC,CAAC,IAAI,CAAC,MAAM;YACjB,WAAW,EAAE,aAAa;YAC1B,YAAY,EAAE,IAAI,CAAC,IAAI;SACxB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,eAAe,EAAE,KAAK,CAAC,OAAO;YAC5B,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,aAAa;YACvC,CAAC,CAAC,KAAK,CAAC,OAAO;gBACb,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,YAAY;gBACtC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO;QACrC,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO;QAC5C,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO;KAC9C,CAAC;AACJ,CAAC","sourcesContent":["import type { RoleSemantics, SurfaceTheme } from '@ankhorage/surface';\n\nimport type { ZoraColor } from '../../internal/recipes';\nimport type { ChipColors, ChipInteractionState } from './types';\n\nfunction resolveChipRole(theme: SurfaceTheme, color: ZoraColor): RoleSemantics {\n switch (color) {\n case 'secondary':\n return theme.semantics.secondary;\n case 'tertiary':\n return theme.semantics.accent;\n case 'quaternary':\n return theme.semantics.highlight;\n case 'error':\n return theme.semantics.error;\n case 'info':\n return theme.semantics.info;\n case 'primary':\n return theme.semantics.action.primary;\n case 'danger':\n return theme.semantics.action.danger;\n case 'success':\n return theme.semantics.success;\n case 'warning':\n return theme.semantics.warning;\n case 'neutral':\n default:\n return theme.semantics.action.neutral;\n }\n}\n\nexport function resolveChipColors({\n theme,\n color,\n selected,\n state,\n}: {\n theme: SurfaceTheme;\n color: ZoraColor;\n selected: boolean;\n state: ChipInteractionState;\n}): ChipColors {\n if (state.disabled) {\n return {\n backgroundColor: theme.semantics.neutral.surface,\n borderColor: theme.semantics.neutral.divider,\n contentColor: theme.semantics.content.muted,\n opacity: 0.72,\n };\n }\n\n const role = resolveChipRole(theme, color);\n\n if (selected) {\n return {\n backgroundColor: state.pressed\n ? role.softActive\n : state.hovered\n ? role.softHover\n : role.softBg,\n borderColor: 'transparent',\n contentColor: role.base,\n };\n }\n\n return {\n backgroundColor: state.pressed\n ? theme.semantics.neutral.surfaceActive\n : state.hovered\n ? theme.semantics.neutral.surfaceHover\n : theme.semantics.neutral.surface,\n borderColor: theme.semantics.neutral.divider,\n contentColor: theme.semantics.content.default,\n };\n}\n"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { ButtonIconSpec } from '@ankhorage/surface';
|
|
2
2
|
import type React from 'react';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ZoraColor, ZoraControlSize } from '../../internal/recipes';
|
|
4
4
|
import type { ZoraBaseProps } from '../../theme/ZoraBaseProps';
|
|
5
5
|
export interface ChipProps extends ZoraBaseProps {
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
icon?: ButtonIconSpec;
|
|
8
8
|
selected?: boolean;
|
|
9
9
|
disabled?: boolean;
|
|
10
|
-
|
|
10
|
+
color?: ZoraColor;
|
|
11
11
|
size?: ZoraControlSize;
|
|
12
12
|
onPress?: () => void;
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/chip/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/chip/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,WAAW,SAAU,SAAQ,aAAa;IAC9C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/chip/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ButtonIconSpec } from '@ankhorage/surface';\nimport type React from 'react';\n\nimport type {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/chip/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ButtonIconSpec } from '@ankhorage/surface';\nimport type React from 'react';\n\nimport type { ZoraColor, ZoraControlSize } from '../../internal/recipes';\nimport type { ZoraBaseProps } from '../../theme/ZoraBaseProps';\n\nexport interface ChipProps extends ZoraBaseProps {\n children: React.ReactNode;\n icon?: ButtonIconSpec;\n selected?: boolean;\n disabled?: boolean;\n color?: ZoraColor;\n size?: ZoraControlSize;\n onPress?: () => void;\n}\n\nexport interface ChipColors {\n backgroundColor: string;\n borderColor: string;\n contentColor: string;\n opacity?: number;\n}\n\nexport interface ChipInteractionState {\n pressed: boolean;\n hovered: boolean;\n focused: boolean;\n disabled: boolean;\n}\n"]}
|
|
@@ -8,7 +8,7 @@ function hasValue(values, value) {
|
|
|
8
8
|
function toggleValue(values, value) {
|
|
9
9
|
return hasValue(values, value) ? values.filter((item) => item !== value) : [...values, value];
|
|
10
10
|
}
|
|
11
|
-
function ChipGroupInner({ themeId: _themeId, mode: _mode, testID, items, value, onValueChange, multiple,
|
|
11
|
+
function ChipGroupInner({ themeId: _themeId, mode: _mode, testID, items, value, onValueChange, multiple, color = 'neutral', size = 's', wrap = true, disabled, }) {
|
|
12
12
|
const renderChip = (item) => {
|
|
13
13
|
const itemDisabled = disabled ?? item.disabled ?? false;
|
|
14
14
|
const isSelected = Array.isArray(value) ? hasValue(value, item.value) : value === item.value;
|
|
@@ -20,7 +20,7 @@ function ChipGroupInner({ themeId: _themeId, mode: _mode, testID, items, value,
|
|
|
20
20
|
}
|
|
21
21
|
onValueChange(item.value);
|
|
22
22
|
};
|
|
23
|
-
return (<Chip key={item.value} disabled={itemDisabled} icon={item.icon} onPress={handlePress} selected={isSelected} size={size} testID={item.testID}
|
|
23
|
+
return (<Chip key={item.value} disabled={itemDisabled} icon={item.icon} onPress={handlePress} selected={isSelected} size={size} testID={item.testID} color={color}>
|
|
24
24
|
{item.label}
|
|
25
25
|
</Chip>);
|
|
26
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChipGroup.js","sourceRoot":"","sources":["../../../src/components/chip-group/ChipGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCA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AC,CAAC;IAEF,OAAO,CACL,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAC5E;MAAA,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CACxB;IAAA,EAAE,MAAM,CAAC,CACV,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC","sourcesContent":["import React from 'react';\n\nimport { Inline } from '../../foundation';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport { Chip } from '../chip';\nimport type { ChipGroupItem, ChipGroupProps } from './types';\n\nfunction hasValue<TValue extends string>(values: readonly TValue[], value: TValue): boolean {\n return values.includes(value);\n}\n\nfunction toggleValue<TValue extends string>(values: readonly TValue[], value: TValue): TValue[] {\n return hasValue(values, value) ? values.filter((item) => item !== value) : [...values, value];\n}\n\nfunction ChipGroupInner<TValue extends string = string>({\n themeId: _themeId,\n mode: _mode,\n testID,\n items,\n value,\n onValueChange,\n multiple,\n color = 'neutral',\n size = 's',\n wrap = true,\n disabled,\n}: ChipGroupProps<TValue>) {\n const renderChip = (item: ChipGroupItem<TValue>) => {\n const itemDisabled = disabled ?? item.disabled ?? false;\n const isSelected = Array.isArray(value) ? hasValue(value, item.value) : value === item.value;\n\n const handlePress = () => {\n if (multiple) {\n const next = toggleValue(value, item.value);\n onValueChange(next);\n return;\n }\n\n onValueChange(item.value);\n };\n\n return (\n <Chip\n key={item.value}\n disabled={itemDisabled}\n icon={item.icon}\n onPress={handlePress}\n selected={isSelected}\n size={size}\n testID={item.testID}\n color={color}\n >\n {item.label}\n </Chip>\n );\n };\n\n return (\n <Inline align=\"center\" gap=\"s\" testID={testID} wrap={wrap ? 'wrap' : 'nowrap'}>\n {items.map(renderChip)}\n </Inline>\n );\n}\n\nexport const ChipGroup = withZoraThemeScope(ChipGroupInner);\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ButtonIconSpec } from '@ankhorage/surface';
|
|
2
2
|
import type React from 'react';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ZoraColor, ZoraControlSize } from '../../internal/recipes';
|
|
4
4
|
import type { ZoraBaseProps } from '../../theme/ZoraBaseProps';
|
|
5
5
|
export interface ChipGroupItem<TValue extends string = string> {
|
|
6
6
|
value: TValue;
|
|
@@ -11,7 +11,7 @@ export interface ChipGroupItem<TValue extends string = string> {
|
|
|
11
11
|
}
|
|
12
12
|
interface ChipGroupBaseProps<TValue extends string> extends ZoraBaseProps {
|
|
13
13
|
items: readonly ChipGroupItem<TValue>[];
|
|
14
|
-
|
|
14
|
+
color?: ZoraColor;
|
|
15
15
|
size?: ZoraControlSize;
|
|
16
16
|
wrap?: boolean;
|
|
17
17
|
disabled?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/chip-group/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/chip-group/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,WAAW,aAAa,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,kBAAkB,CAAC,MAAM,SAAS,MAAM,CAAE,SAAQ,aAAa;IACvE,KAAK,EAAE,SAAS,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;IACxC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,UAAU,oBAAoB,CAAC,MAAM,SAAS,MAAM;IAClD,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED,UAAU,sBAAsB,CAAC,MAAM,SAAS,MAAM;IACpD,QAAQ,EAAE,IAAI,CAAC;IACf,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC1C;AAED,MAAM,MAAM,cAAc,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,IAAI,kBAAkB,CAAC,MAAM,CAAC,GACrF,CAAC,oBAAoB,CAAC,MAAM,CAAC,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/chip-group/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ButtonIconSpec } from '@ankhorage/surface';\nimport type React from 'react';\n\nimport type {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/chip-group/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ButtonIconSpec } from '@ankhorage/surface';\nimport type React from 'react';\n\nimport type { ZoraColor, ZoraControlSize } from '../../internal/recipes';\nimport type { ZoraBaseProps } from '../../theme/ZoraBaseProps';\n\nexport interface ChipGroupItem<TValue extends string = string> {\n value: TValue;\n label: React.ReactNode;\n icon?: ButtonIconSpec;\n disabled?: boolean;\n testID?: string;\n}\n\ninterface ChipGroupBaseProps<TValue extends string> extends ZoraBaseProps {\n items: readonly ChipGroupItem<TValue>[];\n color?: ZoraColor;\n size?: ZoraControlSize;\n wrap?: boolean;\n disabled?: boolean;\n}\n\ninterface ChipGroupSingleProps<TValue extends string> {\n multiple?: false;\n value: TValue;\n onValueChange: (value: TValue) => void;\n}\n\ninterface ChipGroupMultipleProps<TValue extends string> {\n multiple: true;\n value: readonly TValue[];\n onValueChange: (value: TValue[]) => void;\n}\n\nexport type ChipGroupProps<TValue extends string = string> = ChipGroupBaseProps<TValue> &\n (ChipGroupSingleProps<TValue> | ChipGroupMultipleProps<TValue>);\n"]}
|
|
@@ -20,7 +20,7 @@ function DrawerInner({ themeId: _themeId, mode: _mode, children, title, descript
|
|
|
20
20
|
<Stack gap="m">
|
|
21
21
|
{hasHeader ? (<Stack gap="xs">
|
|
22
22
|
{title ? <Heading level={3}>{title}</Heading> : null}
|
|
23
|
-
{description ? (<Text
|
|
23
|
+
{description ? (<Text emphasis="muted" variant="bodySmall">
|
|
24
24
|
{description}
|
|
25
25
|
</Text>) : null}
|
|
26
26
|
</Stack>) : null}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../../src/components/drawer/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM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CAAC,CACX,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CACb;YAAA,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CACpD;YAAA,CAAC,WAAW,CAAC,CAAC,CAAC,CACb,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CACxC;gBAAA,CAAC,WAAW,CACd;cAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,IAAI,CACV;UAAA,EAAE,KAAK,CAAC,CACT,CAAC,CAAC,CAAC,IAAI,CACR;QAAA,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CACjD;QAAA,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAC9C;MAAA,EAAE,KAAK,CACT;IAAA,EAAE,aAAa,CAAC,CACjB,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC","sourcesContent":["import { Drawer as SurfaceDrawer } from '@ankhorage/surface';\nimport React, { useCallback, useEffect, useRef } from 'react';\n\nimport { Box, Stack } from '../../foundation';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport { Heading } from '../heading';\nimport { Text } from '../text';\nimport type { DrawerProps } from './types';\n\nfunction useStableCallback(callback: (() => void) | undefined): (() => void) | undefined {\n const callbackRef = useRef(callback);\n\n useEffect(() => {\n callbackRef.current = callback;\n }, [callback]);\n\n return useCallback(() => {\n callbackRef.current?.();\n }, []);\n}\n\nfunction DrawerInner({\n themeId: _themeId,\n mode: _mode,\n children,\n title,\n description,\n footer,\n onDismiss,\n ...props\n}: DrawerProps) {\n const hasHeader = title != null || description != null;\n const stableOnDismiss = useStableCallback(onDismiss);\n\n return (\n <SurfaceDrawer {...props} onDismiss={stableOnDismiss}>\n <Stack gap=\"m\">\n {hasHeader ? (\n <Stack gap=\"xs\">\n {title ? <Heading level={3}>{title}</Heading> : null}\n {description ? (\n <Text emphasis=\"muted\" variant=\"bodySmall\">\n {description}\n </Text>\n ) : null}\n </Stack>\n ) : null}\n {children ? <Box flex={1}>{children}</Box> : null}\n {footer ? <Box pt=\"xs\">{footer}</Box> : null}\n </Stack>\n </SurfaceDrawer>\n );\n}\n\nexport const Drawer = withZoraThemeScope(DrawerInner);\n"]}
|
|
@@ -9,7 +9,7 @@ function FormErrorInner({ themeId: _themeId, mode: _mode, error, testID }) {
|
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
11
11
|
return (<Box borderColor={theme.colors.error} borderWidth={1} p="s" radius="m" testID={testID}>
|
|
12
|
-
<Text
|
|
12
|
+
<Text color="error" variant="bodySmall">
|
|
13
13
|
{error}
|
|
14
14
|
</Text>
|
|
15
15
|
</Box>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormError.js","sourceRoot":"","sources":["../../../src/components/form/FormError.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,SAAS,cAAc,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAkB;IACvF,MAAM,EAAE,KAAK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EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC","sourcesContent":["import React from 'react';\n\nimport { Box } from '../../foundation';\nimport { useZoraTheme } from '../../theme/useZoraTheme';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport { Text } from '../text';\nimport type { FormErrorProps } from './types';\n\nfunction FormErrorInner({ themeId: _themeId, mode: _mode, error, testID }: FormErrorProps) {\n const { theme } = useZoraTheme();\n\n if (!error) {\n return null;\n }\n\n return (\n <Box borderColor={theme.colors.error} borderWidth={1} p=\"s\" radius=\"m\" testID={testID}>\n <Text color=\"error\" variant=\"bodySmall\">\n {error}\n </Text>\n </Box>\n );\n}\n\nexport const FormError = withZoraThemeScope(FormErrorInner);\n"]}
|
|
@@ -55,7 +55,7 @@ function renderLabel(label, description) {
|
|
|
55
55
|
<Text variant="label" weight="semiBold">
|
|
56
56
|
{label}
|
|
57
57
|
</Text>
|
|
58
|
-
{description ? (<Text
|
|
58
|
+
{description ? (<Text emphasis="muted" variant="bodySmall">
|
|
59
59
|
{description}
|
|
60
60
|
</Text>) : null}
|
|
61
61
|
</Stack>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.js","sourceRoot":"","sources":["../../../src/components/form/FormField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,SAAS,mBAAmB,CAC1B,KAA4B;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react';\n\nimport { Stack } from '../../foundation';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport { Input } from '../input';\nimport { Text } from '../text';\nimport type { FormFieldConfig, FormFieldControlProps, FormFieldProps } from './types';\nimport { hasRequiredRule } from './validation';\n\nfunction isControlFieldProps<TName extends string>(\n props: FormFieldProps<TName>,\n): props is FormFieldControlProps<TName> {\n return 'field' in props;\n}\n\nfunction resolveKeyboardType(field: FormFieldConfig) {\n if (field.keyboardType) {\n return field.keyboardType;\n }\n\n if (field.type === 'email') {\n return 'email-address';\n }\n\n if (field.type === 'number' || field.type === 'otp') {\n return 'number-pad';\n }\n\n if (field.type === 'tel') {\n return 'phone-pad';\n }\n\n if (field.type === 'url') {\n return 'url';\n }\n\n return undefined;\n}\n\nfunction resolveAutoCapitalize(field: FormFieldConfig) {\n if (field.autoCapitalize) {\n return field.autoCapitalize;\n }\n\n if (['email', 'password', 'url'].includes(field.type ?? 'text')) {\n return 'none';\n }\n\n return undefined;\n}\n\nfunction resolveTextContentType(field: FormFieldConfig) {\n if (field.textContentType) {\n return field.textContentType;\n }\n\n if (field.type === 'email') {\n return 'emailAddress';\n }\n\n if (field.type === 'password') {\n return 'password';\n }\n\n if (field.type === 'otp') {\n return 'oneTimeCode';\n }\n\n return undefined;\n}\n\nfunction renderLabel(label: React.ReactNode, description: React.ReactNode | undefined) {\n return (\n <Stack gap=\"xs\">\n <Text variant=\"label\" weight=\"semiBold\">\n {label}\n </Text>\n {description ? (\n <Text emphasis=\"muted\" variant=\"bodySmall\">\n {description}\n </Text>\n ) : null}\n </Stack>\n );\n}\n\nfunction FormFieldInner<TName extends string = string>(props: FormFieldProps<TName>) {\n if (!isControlFieldProps(props)) {\n const {\n themeId: _themeId,\n mode: _mode,\n label,\n description,\n helperText,\n children,\n ...fieldProps\n } = props;\n\n return (\n <Field {...fieldProps} helperText={helperText} label={renderLabel(label, description)}>\n {children}\n </Field>\n );\n }\n\n const {\n themeId: _themeId,\n mode: _mode,\n field,\n value,\n error,\n disabled = false,\n loading = false,\n onChange,\n testID,\n } = props;\n const fieldDisabled = disabled || loading || field.disabled;\n const required = field.required ?? hasRequiredRule(field.rules);\n\n return (\n <Field\n disabled={fieldDisabled}\n errorText={error}\n helperText={field.helperText}\n invalid={Boolean(error)}\n label={renderLabel(field.label, field.description)}\n readOnly={field.readOnly}\n required={required}\n testID={testID ?? field.testID}\n >\n <Input\n accessibilityLabel={typeof field.label === 'string' ? field.label : undefined}\n autoCapitalize={resolveAutoCapitalize(field)}\n autoComplete={field.autoComplete}\n disabled={fieldDisabled}\n invalid={Boolean(error)}\n keyboardType={resolveKeyboardType(field)}\n maxLength={field.maxLength}\n onChangeText={(nextValue) => onChange(field.name, nextValue)}\n placeholder={field.placeholder}\n readOnly={field.readOnly}\n secureTextEntry={field.secureTextEntry ?? field.type === 'password'}\n textContentType={resolveTextContentType(field)}\n value={value}\n />\n </Field>\n );\n}\n\nexport const FormField = withZoraThemeScope(FormFieldInner);\n"]}
|
|
@@ -4,6 +4,19 @@ export declare const formMeta: {
|
|
|
4
4
|
readonly directManifestNode: false;
|
|
5
5
|
readonly allowedChildren: readonly [];
|
|
6
6
|
readonly note: "Form orchestration component; not represented as a manifest node in v1.";
|
|
7
|
+
readonly events: {
|
|
8
|
+
readonly submit: {
|
|
9
|
+
readonly label: "Submit";
|
|
10
|
+
readonly eventType: "form.submit";
|
|
11
|
+
readonly description: "Emitted when the form submits its current values.";
|
|
12
|
+
readonly payloadFields: readonly [{
|
|
13
|
+
readonly path: "payload.values";
|
|
14
|
+
readonly type: "record";
|
|
15
|
+
readonly label: "Values";
|
|
16
|
+
readonly description: "Submitted form values keyed by field name.";
|
|
17
|
+
}];
|
|
18
|
+
};
|
|
19
|
+
};
|
|
7
20
|
readonly props: {};
|
|
8
21
|
};
|
|
9
22
|
export declare const formActionsMeta: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/components/form/meta.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/components/form/meta.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;CAsBiB,CAAC;AAEvC,eAAO,MAAM,eAAe;;;;;;;CAOU,CAAC;AAEvC,eAAO,MAAM,aAAa;;;;;;;CAOY,CAAC;AAEvC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqDY,CAAC"}
|
|
@@ -4,6 +4,21 @@ export const formMeta = {
|
|
|
4
4
|
directManifestNode: false,
|
|
5
5
|
allowedChildren: [],
|
|
6
6
|
note: 'Form orchestration component; not represented as a manifest node in v1.',
|
|
7
|
+
events: {
|
|
8
|
+
submit: {
|
|
9
|
+
label: 'Submit',
|
|
10
|
+
eventType: 'form.submit',
|
|
11
|
+
description: 'Emitted when the form submits its current values.',
|
|
12
|
+
payloadFields: [
|
|
13
|
+
{
|
|
14
|
+
path: 'payload.values',
|
|
15
|
+
type: 'record',
|
|
16
|
+
label: 'Values',
|
|
17
|
+
description: 'Submitted form values keyed by field name.',
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
7
22
|
props: {},
|
|
8
23
|
};
|
|
9
24
|
export const formActionsMeta = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../src/components/form/meta.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,WAAW;IACrB,kBAAkB,EAAE,KAAK;IACzB,eAAe,EAAE,EAAE;IACnB,IAAI,EAAE,yEAAyE;IAC/E,KAAK,EAAE,EAAE;CAC2B,CAAC;AAEvC,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAA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jB,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,KAAK;SACf;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,WAAW;YAClB,OAAO,EAAE,KAAK;SACf;KACF;CACmC,CAAC","sourcesContent":["import type { ZoraComponentMeta } from '../../metadata';\n\nexport const formMeta = {\n name: 'Form',\n category: 'component',\n directManifestNode: false,\n allowedChildren: [],\n note: 'Form orchestration component; not represented as a manifest node in v1.',\n props: {},\n} as const satisfies ZoraComponentMeta;\n\nexport const formActionsMeta = {\n name: 'FormActions',\n category: 'component',\n directManifestNode: false,\n allowedChildren: [],\n note: 'Form helper component; not represented as a manifest node in v1.',\n props: {},\n} as const satisfies ZoraComponentMeta;\n\nexport const formErrorMeta = {\n name: 'FormError',\n category: 'component',\n directManifestNode: false,\n allowedChildren: [],\n note: 'Form helper component; not represented as a manifest node in v1.',\n props: {},\n} as const satisfies ZoraComponentMeta;\n\nexport const formFieldMeta = {\n name: 'FormField',\n category: 'component',\n directManifestNode: true,\n allowedChildren: ['Input', 'Textarea'],\n blueprint: {\n label: 'Form field',\n defaultProps: {\n label: 'Label',\n },\n },\n props: {\n label: {\n type: 'string',\n category: 'Content',\n label: 'Label',\n default: 'Label',\n },\n description: {\n type: 'string',\n category: 'Content',\n label: 'Description',\n },\n helperText: {\n type: 'string',\n category: 'Content',\n label: 'Helper text',\n },\n required: {\n type: 'boolean',\n category: 'Validation',\n label: 'Required',\n default: false,\n },\n invalid: {\n type: 'boolean',\n category: 'Validation',\n label: 'Invalid',\n default: false,\n },\n disabled: {\n type: 'boolean',\n category: 'State',\n label: 'Disabled',\n default: false,\n },\n readOnly: {\n type: 'boolean',\n category: 'State',\n label: 'Read-only',\n default: false,\n },\n },\n} as const satisfies ZoraComponentMeta;\n"]}
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../src/components/form/meta.ts"],"names":[],"mappings":"AAEA,MAAM,CAA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;SACjB;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,SAAS;YACnB,KAAK,EAAE,aAAa;SACrB;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,SAAS;YACnB,KAAK,EAAE,aAAa;SACrB;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,YAAY;YACtB,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,KAAK;SACf;QACD,OAAO,EAAE;YACP,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,YAAY;YACtB,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE,KAAK;SACf;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,KAAK;SACf;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,WAAW;YAClB,OAAO,EAAE,KAAK;SACf;KACF;CACmC,CAAC","sourcesContent":["import type { ZoraComponentMeta } from '../../metadata';\n\nexport const formMeta = {\n name: 'Form',\n category: 'component',\n directManifestNode: false,\n allowedChildren: [],\n note: 'Form orchestration component; not represented as a manifest node in v1.',\n events: {\n submit: {\n label: 'Submit',\n eventType: 'form.submit',\n description: 'Emitted when the form submits its current values.',\n payloadFields: [\n {\n path: 'payload.values',\n type: 'record',\n label: 'Values',\n description: 'Submitted form values keyed by field name.',\n },\n ],\n },\n },\n props: {},\n} as const satisfies ZoraComponentMeta;\n\nexport const formActionsMeta = {\n name: 'FormActions',\n category: 'component',\n directManifestNode: false,\n allowedChildren: [],\n note: 'Form helper component; not represented as a manifest node in v1.',\n props: {},\n} as const satisfies ZoraComponentMeta;\n\nexport const formErrorMeta = {\n name: 'FormError',\n category: 'component',\n directManifestNode: false,\n allowedChildren: [],\n note: 'Form helper component; not represented as a manifest node in v1.',\n props: {},\n} as const satisfies ZoraComponentMeta;\n\nexport const formFieldMeta = {\n name: 'FormField',\n category: 'component',\n directManifestNode: true,\n allowedChildren: ['Input', 'Textarea'],\n blueprint: {\n label: 'Form field',\n defaultProps: {\n label: 'Label',\n },\n },\n props: {\n label: {\n type: 'string',\n category: 'Content',\n label: 'Label',\n default: 'Label',\n },\n description: {\n type: 'string',\n category: 'Content',\n label: 'Description',\n },\n helperText: {\n type: 'string',\n category: 'Content',\n label: 'Helper text',\n },\n required: {\n type: 'boolean',\n category: 'Validation',\n label: 'Required',\n default: false,\n },\n invalid: {\n type: 'boolean',\n category: 'Validation',\n label: 'Invalid',\n default: false,\n },\n disabled: {\n type: 'boolean',\n category: 'State',\n label: 'Disabled',\n default: false,\n },\n readOnly: {\n type: 'boolean',\n category: 'State',\n label: 'Read-only',\n default: false,\n },\n },\n} as const satisfies ZoraComponentMeta;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Heading.d.ts","sourceRoot":"","sources":["../../../src/components/heading/Heading.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Heading.d.ts","sourceRoot":"","sources":["../../../src/components/heading/Heading.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAsF5C,eAAO,MAAM,OAAO,oDAAmC,CAAC"}
|
|
@@ -16,12 +16,13 @@ function resolveHeadingContent({ children, text, i18nKey, }) {
|
|
|
16
16
|
}
|
|
17
17
|
return i18nKey;
|
|
18
18
|
}
|
|
19
|
-
function HeadingInner({ themeId: _themeId, mode: _mode, children, text, i18nKey, level = 2, size,
|
|
19
|
+
function HeadingInner({ themeId: _themeId, mode: _mode, children, text, i18nKey, level = 2, size, color, emphasis = 'default', align, weight, italic = false, numberOfLines, ellipsizeMode, selectable, accessibilityLabel, accessibilityHint, accessibilityRole = 'header', nativeID, testID, }) {
|
|
20
20
|
const { theme } = useZoraTheme();
|
|
21
21
|
const { breakpoint } = useResponsiveRuntime();
|
|
22
22
|
const content = resolveHeadingContent({ children, text, i18nKey });
|
|
23
23
|
const resolvedSize = resolveResponsive(size, breakpoint) ?? resolveHeadingSizeFromLevel(level);
|
|
24
|
-
const
|
|
24
|
+
const resolvedColor = resolveResponsive(color, breakpoint);
|
|
25
|
+
const resolvedEmphasis = resolveResponsive(emphasis, breakpoint) ?? 'default';
|
|
25
26
|
const resolvedAlign = resolveResponsive(align, breakpoint);
|
|
26
27
|
const resolvedWeight = resolveResponsive(weight, breakpoint);
|
|
27
28
|
if (content === null || content === undefined) {
|
|
@@ -32,7 +33,8 @@ function HeadingInner({ themeId: _themeId, mode: _mode, children, text, i18nKey,
|
|
|
32
33
|
italic,
|
|
33
34
|
level,
|
|
34
35
|
size: resolvedSize,
|
|
35
|
-
|
|
36
|
+
color: resolvedColor,
|
|
37
|
+
emphasis: resolvedEmphasis,
|
|
36
38
|
weight: resolvedWeight,
|
|
37
39
|
})}>
|
|
38
40
|
{content}
|