Skip to content

Commit 2c02af3

Browse files
Merge pull request #137 from michaelcozzolino/feat/input-file
feat(FoInputFile): First implementation
2 parents e15d21e + f25ad0c commit 2c02af3

36 files changed

+461
-8
lines changed

packages/core/src/Lib/UseFloatingLabel/Internal/Lib/UseFloatingLabel.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@ import { useClass } from '@/Lib/UseClass/Internal';
55
import { computed, toValue } from 'vue';
66

77
export function useFloatingLabel(
8-
elementName: MaybeRefOrGetter<FloatingLabelComponentName>,
8+
componentName: MaybeRefOrGetter<FloatingLabelComponentName>,
99
labelType: MaybeRefOrGetter<LabelType | undefined>,
1010
): ComputedRef<string> {
1111
return computed(() => {
1212
const isFloating = toValue(labelType) === 'floating';
1313

1414
const classes: Record<FloatingLabelComponentName, ComputedRef<string>> = {
15+
FoInputFile: useClass(isFloating, 'input-floating'),
1516
FoInputText: useClass(isFloating, 'input-floating'),
1617
FoSelect: useClass(isFloating, 'select-floating'),
1718
FoTextarea: useClass(isFloating, 'textarea-floating'),
1819
};
1920

20-
return classes[toValue(elementName)].value;
21+
return classes[toValue(componentName)].value;
2122
});
2223
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import type { ComponentName } from '@/Lib';
22

3-
export type FloatingLabelComponentName = Extract<ComponentName, 'FoInputText' | 'FoSelect' | 'FoTextarea'>;
3+
// todo: there is a mismatch between configurable and floating, this should be checked
4+
export type FloatingLabelComponentName = Extract<ComponentName, 'FoInputFile' | 'FoInputText' | 'FoSelect' | 'FoTextarea'>;

packages/core/src/Lib/UseFlyonUIVueAppConfig/Types/ComponentName.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ type NonConfigurableComponentName = 'FoAvatarGroup'
88
| 'FoDiff'
99
| 'FoDotStyleBadge'
1010
| 'FoJoin'
11+
| 'FoImageRadio'
1112
| 'FoLabel'
1213
| 'FoListGroup'
1314
| 'FoListGroupItem'

packages/core/src/Lib/UseFlyonUIVueAppConfig/Types/FlyonUIVueAppConfig.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import type { HeadingProps, KeyboardProps, LinkProps }
2020
import type { DividerProps } from '@/UI/Content/Divider';
2121
import type { IconProps } from '@/UI/Customization';
2222
import type { CheckboxProps, InputTextProps, SelectProps, SwitchProps, TextareaProps } from '@/UI/Forms';
23+
import type { InputFileProps } from '@/UI/Forms/InputFile';
2324
import type { RadioProps } from '@/UI/Forms/Radio';
2425
import type { RangeProps } from '@/UI/Forms/Range';
2526
import type { TabProps, TabsProps } from '@/UI/Navigations';
@@ -113,6 +114,11 @@ export interface ConfigurableComponentProps {
113114
FoDivider: ConfigurableProps<DividerProps>;
114115
FoHeading: ConfigurableProps<HeadingProps>;
115116
FoIcon: ConfigurableProps<IconProps>;
117+
FoInputFile: ConfigurableProps<
118+
InputFileProps
119+
& HorizontalPositionComponentConfig<HorizontalHelperTextPositionConfig>
120+
& LabelTypeComponentConfig
121+
>;
116122
FoInputText: ConfigurableProps<
117123
InputTextProps
118124
& HorizontalPositionComponentConfig<HorizontalPositionGlobalConfig>

packages/core/src/Lib/UseSize/Internal/Lib/UseSize.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ export function useSize(
4040
large: 'checkbox-lg',
4141
extraLarge: 'checkbox-xl',
4242
},
43+
FoInputFile: {
44+
extraSmall: 'input-xs',
45+
small: 'input-sm',
46+
medium: '',
47+
large: 'input-lg',
48+
extraLarge: 'input-xl',
49+
},
4350
FoInputText: {
4451
extraSmall: 'input-xs',
4552
small: 'input-sm',

packages/core/src/Lib/UseSize/Types/Size.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export type SizableComponentName = Extract<
66
| 'FoBadge'
77
| 'FoButton'
88
| 'FoCheckbox'
9+
| 'FoInputFile'
910
| 'FoInputText'
1011
| 'FoKeyboard'
1112
| 'FoLoading'

packages/core/src/UI/Components/HelperText/Types/HelperText.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { ComponentName } from '@/Lib';
22
import type { HorizontalPosition } from '@/Types';
33

4-
export type PositionableHelperTextComponentName = Extract<ComponentName, 'FoInputText' | 'FoSelect' | 'FoTextarea'>;
4+
export type PositionableHelperTextComponentName = Extract<ComponentName, 'FoInputFile' | 'FoInputText' | 'FoSelect' | 'FoTextarea'>;
55

66
export type HelperText = string;
77

packages/core/src/UI/Components/Label/Internal/Types/Label.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import type { ComponentName, FloatingLabelComponentName, MaybeStringId } from '@/Lib';
22
import type { LabelType } from '@/UI/Components';
33

4-
export type ConfigurableLabelComponentName = Extract<ComponentName, 'FoInputText' | 'FoSelect' | 'FoTextarea'>;
4+
export type ConfigurableLabelComponentName = Extract<
5+
ComponentName,
6+
'FoInputFile'
7+
| 'FoInputText'
8+
| 'FoSelect'
9+
| 'FoTextarea'
10+
>;
511

612
export interface LabelProps<T extends LabelType = LabelType> extends MaybeStringId {
713
componentName?: FloatingLabelComponentName;

packages/core/src/UI/Components/Label/Internal/UI/FoLabel.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ const labelClass = computed((): string => {
4646
}
4747
4848
const classes: Record<FloatingLabelComponentName, Record<LabelType, string>> = {
49+
FoInputFile: {
50+
text: 'label-text',
51+
floating: 'input-floating-label',
52+
inline: '',
53+
},
4954
FoInputText: {
5055
text: 'label-text',
5156
floating: 'input-floating-label',
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import type { Disableable, MaybeStringId, Sizable, Validity } from '@/Lib';
2+
import type { LabelType, WithConfigurableHelperText, WithConfigurableInputLabel } from '@/UI/Components';
3+
4+
export type InputFileLabelType = Extract<LabelType, 'text' | 'floating'>;
5+
6+
export type InputFileProps = MaybeStringId
7+
& Disableable
8+
& Sizable
9+
& WithConfigurableInputLabel<InputFileLabelType>
10+
& Validity
11+
& WithConfigurableHelperText;

0 commit comments

Comments
 (0)