Skip to content

Commit

Permalink
feat(design-system): bump version 0.28.16
Browse files Browse the repository at this point in the history
  • Loading branch information
abretonc7s committed Oct 13, 2024
1 parent 6d1a91b commit d1a2bd4
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 33 deletions.
2 changes: 1 addition & 1 deletion packages/design-system/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@siteed/design-system",
"version": "0.28.15",
"version": "0.28.16",
"author": "Arthur Breton <[email protected]> (https://github.com/deeeed)",
"license": "MIT",
"repository": {
Expand Down
44 changes: 27 additions & 17 deletions packages/design-system/src/components/picker/PickerContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const getStyles = (theme: AppTheme) => {
},
createOptionContainer: {
padding: theme.spacing.padding,
paddingBottom: 100,
},
createOptionInput: {
marginBottom: theme.spacing.margin,
Expand Down Expand Up @@ -108,38 +109,45 @@ export const PickerContent: React.FC<PickerContentProps> = ({
initialData: {
value: `new-option-${Date.now()}`,
label: '',
selected: false,
selected: true,
},
title: 'Create New Option',
bottomSheetProps: {
enableDynamicSizing: true,
},
render: ({ data, onChange }) => {
// console.debug('PickerContent: handleCreate render: data', data);
return (
<View style={styles.createOptionContainer}>
<TextInput
autoFocus
label="New Option Label"
value={data?.label}
onChangeText={(text) => onChange({ ...data, label: text })}
onChangeText={(text) => {
console.log('PickerContent: handleCreate onChangeText', text);
onChange({ ...data, label: text });
}}
style={styles.createOptionInput}
/>
</View>
);
},
renderFooter: ({ resolve, data }) => {
return (
<ConfirmCancelFooter
onCancel={() => resolve(undefined)}
onFinish={() => resolve(data)}
/>
<View>
<Text>data: {JSON.stringify(data)}</Text>
<ConfirmCancelFooter
onCancel={() => resolve(undefined)}
onFinish={() => resolve(data)}
/>
</View>
);
},
});

console.log('after drawernewOption', newOption);
if (newOption) {
const updatedOptions = [...tempOptions, newOption];
const updatedOptions = [
...tempOptions,
{ ...newOption, selected: true },
];
setTempOptions(updatedOptions);
onChange(updatedOptions);
}
Expand Down Expand Up @@ -199,13 +207,15 @@ export const PickerContent: React.FC<PickerContentProps> = ({
) : (
renderOptions()
)}
{showDebugCreate && (
<IconButton
icon="plus"
onPress={handleCreate}
style={styles.debugCreateButton}
/>
)}
<View style={{ height: 100 }}>
{showDebugCreate && (
<IconButton
icon="plus"
onPress={handleCreate}
style={styles.debugCreateButton}
/>
)}
</View>
</View>
);
};
34 changes: 19 additions & 15 deletions packages/design-system/src/components/picker/picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,25 @@ export const Picker = ({
const result = await openDrawer<SelectOption[]>({
title: label,
initialData: tempOptions,
render: ({ onChange, data }) => (
<PickerContent
options={data || []}
multi={multi}
showSearch={showSearch}
emptyLabel={emptyLabel}
emptyOptionsTitle={emptyOptionsTitle}
emptyOptionsMessage={emptyOptionsMessage}
noResultsText={noResultsText}
emptyActionLabel={emptyActionLabel}
fullWidthOptions={fullWidthOptions}
onChange={onChange}
emptyAction={emptyAction}
/>
),
render: ({ onChange, data }) => {
logger.debug(`Picker render: data`, data);
console.log('Picker render: tempOptions', tempOptions);
return (
<PickerContent
options={data || []}
multi={multi}
showSearch={showSearch}
emptyLabel={emptyLabel}
emptyOptionsTitle={emptyOptionsTitle}
emptyOptionsMessage={emptyOptionsMessage}
noResultsText={noResultsText}
emptyActionLabel={emptyActionLabel}
fullWidthOptions={fullWidthOptions}
onChange={onChange}
emptyAction={emptyAction}
/>
);
},
renderFooter: ({ data, resolve }) => {
if (initialOptions.length === 0 && !data) {
return null;
Expand Down

0 comments on commit d1a2bd4

Please sign in to comment.