diff --git a/packages/metadata/src/components/index.ts b/packages/metadata/src/components/index.ts index 6d95bd017..777aab146 100644 --- a/packages/metadata/src/components/index.ts +++ b/packages/metadata/src/components/index.ts @@ -11,6 +11,7 @@ export const form: MetaType[] = toMeta([ 'Dropdown', 'Editor', 'FloatLabel', + 'Fluid', 'IconField', 'InputChips', 'InputGroup', diff --git a/packages/primevue/src/autocomplete/AutoComplete.d.ts b/packages/primevue/src/autocomplete/AutoComplete.d.ts index 1d99208e4..5d480acb1 100755 --- a/packages/primevue/src/autocomplete/AutoComplete.d.ts +++ b/packages/primevue/src/autocomplete/AutoComplete.d.ts @@ -503,9 +503,9 @@ export interface AutoCompleteProps { tabindex?: number | string | undefined; /** * Spans 100% width of the container when enabled. - * @defaultValue false + * @defaultValue null */ - fluid?: boolean; + fluid?: boolean | undefined; /** * Defines a string value that labels an interactive element. */ diff --git a/packages/primevue/src/autocomplete/AutoComplete.vue b/packages/primevue/src/autocomplete/AutoComplete.vue index 4ab4665c5..40cad385d 100755 --- a/packages/primevue/src/autocomplete/AutoComplete.vue +++ b/packages/primevue/src/autocomplete/AutoComplete.vue @@ -10,6 +10,7 @@ :value="inputValue" :placeholder="placeholder" :tabindex="!disabled ? tabindex : -1" + :fluid="hasFluid" :disabled="disabled" :invalid="invalid" :variant="variant" @@ -180,10 +181,10 @@ diff --git a/packages/primevue/src/fluid/Fluid.d.ts b/packages/primevue/src/fluid/Fluid.d.ts new file mode 100644 index 000000000..dda785c65 --- /dev/null +++ b/packages/primevue/src/fluid/Fluid.d.ts @@ -0,0 +1,130 @@ +/** + * + * Fluid spans 100% width of the container. + * + * [Live Demo](https://www.primevue.org/fluid/) + * + * @module fluid + * + */ +import type { DefineComponent, DesignToken, EmitFn, GlobalComponentConstructor, PassThrough } from '@primevue/core'; +import type { ComponentHooks } from '@primevue/core/basecomponent'; +import type { PassThroughOptions } from 'primevue/passthrough'; +import { TransitionProps, VNode } from 'vue'; + +export declare type FluidPassThroughOptionType = FluidPassThroughAttributes | ((options: FluidPassThroughMethodOptions) => FluidPassThroughAttributes | string) | string | null | undefined; + +export declare type FluidPassThroughTransitionType = TransitionProps | ((options: FluidPassThroughMethodOptions) => TransitionProps) | undefined; + +/** + * Custom passthrough(pt) option method. + */ +export interface FluidPassThroughMethodOptions { + /** + * Defines instance. + */ + instance: any; + /** + * Defines valid properties. + */ + props: FluidProps; + /** + * Defines valid attributes. + */ + attrs: any; + /** + * Defines parent options. + */ + parent: any; + /** + * Defines passthrough(pt) options in global config. + */ + global: object | undefined; +} + +/** + * Custom passthrough(pt) options. + * @see {@link FluidProps.pt} + */ +export interface FluidPassThroughOptions { + /** + * Used to pass attributes to the root's DOM element. + */ + root?: FluidPassThroughOptionType; + /** + * Used to manage all lifecycle hooks. + * @see {@link BaseComponent.ComponentHooks} + */ + hooks?: ComponentHooks; +} + +/** + * Custom passthrough attributes for each DOM elements + */ +export interface FluidPassThroughAttributes { + [key: string]: any; +} + +/** + * Defines valid properties in Fluid component. + */ +export interface FluidProps { + /** + * It generates scoped CSS variables using design tokens for the component. + */ + dt?: DesignToken; + /** + * Used to pass attributes to DOM elements inside the component. + * @type {FluidPassThroughOptions} + */ + pt?: PassThrough; + /** + * Used to configure passthrough(pt) options of the component. + * @type {PassThroughOptions} + */ + ptOptions?: PassThroughOptions; + /** + * When enabled, it removes component related styles in the core. + * @defaultValue false + */ + unstyled?: boolean; +} + +/** + * Defines valid slots in Fluid component. + */ +export interface FluidSlots { + /** + * Default content slot. + */ + default: () => VNode[]; +} + +/** + * Defines valid emits in Fluid component. + */ +export interface FluidEmitsOptions {} + +export declare type FluidEmits = EmitFn; + +/** + * **PrimeVue - Fluid** + * + * _Fluid spans 100% width of the container._ + * + * [Live Demo](https://www.primevue.org/fluid/) + * --- --- + * ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png) + * + * @group Component + * + */ +declare const Fluid: DefineComponent; + +declare module 'vue' { + export interface GlobalComponents { + Fluid: GlobalComponentConstructor; + } +} + +export default Fluid; diff --git a/packages/primevue/src/fluid/Fluid.vue b/packages/primevue/src/fluid/Fluid.vue new file mode 100644 index 000000000..985f4550a --- /dev/null +++ b/packages/primevue/src/fluid/Fluid.vue @@ -0,0 +1,15 @@ + + + diff --git a/packages/primevue/src/fluid/package.json b/packages/primevue/src/fluid/package.json new file mode 100644 index 000000000..dd1341f3c --- /dev/null +++ b/packages/primevue/src/fluid/package.json @@ -0,0 +1,11 @@ +{ + "main": "./Fluid.vue", + "module": "./Fluid.vue", + "types": "./Fluid.d.ts", + "browser": { + "./sfc": "./Fluid.vue" + }, + "sideEffects": [ + "*.vue" + ] +} diff --git a/packages/primevue/src/fluid/style/FluidStyle.d.ts b/packages/primevue/src/fluid/style/FluidStyle.d.ts new file mode 100644 index 000000000..d7cbe1bf3 --- /dev/null +++ b/packages/primevue/src/fluid/style/FluidStyle.d.ts @@ -0,0 +1,19 @@ +/** + * + * Fluid spans 100% width of the container. + * + * [Live Demo](https://www.primevue.org/fluid/) + * + * @module fluidstyle + * + */ +import type { BaseStyle } from '@primevue/core/base/style'; + +export enum FluidClasses { + /** + * Class name of the root element + */ + root = 'p-fluid' +} + +export interface FluidStyle extends BaseStyle {} diff --git a/packages/primevue/src/fluid/style/FluidStyle.js b/packages/primevue/src/fluid/style/FluidStyle.js new file mode 100644 index 000000000..1b08c6b52 --- /dev/null +++ b/packages/primevue/src/fluid/style/FluidStyle.js @@ -0,0 +1,10 @@ +import BaseStyle from '@primevue/core/base/style'; + +const classes = { + root: 'p-fluid' +}; + +export default BaseStyle.extend({ + name: 'fluid', + classes +}); diff --git a/packages/primevue/src/fluid/style/package.json b/packages/primevue/src/fluid/style/package.json new file mode 100644 index 000000000..88535ee32 --- /dev/null +++ b/packages/primevue/src/fluid/style/package.json @@ -0,0 +1,6 @@ +{ + "main": "./FluidStyle.js", + "module": "./FluidStyle.js", + "types": "./FluidStyle.d.ts", + "sideEffects": false +} diff --git a/packages/primevue/src/inputgroup/BaseInputGroup.vue b/packages/primevue/src/inputgroup/BaseInputGroup.vue index 05fc62e9b..f3e16c3d0 100644 --- a/packages/primevue/src/inputgroup/BaseInputGroup.vue +++ b/packages/primevue/src/inputgroup/BaseInputGroup.vue @@ -8,7 +8,7 @@ export default { props: { fluid: { type: Boolean, - default: false + default: null } }, style: InputGroupStyle, diff --git a/packages/primevue/src/inputgroup/InputGroup.d.ts b/packages/primevue/src/inputgroup/InputGroup.d.ts index 6080ac0f9..0c03bbafb 100644 --- a/packages/primevue/src/inputgroup/InputGroup.d.ts +++ b/packages/primevue/src/inputgroup/InputGroup.d.ts @@ -69,9 +69,9 @@ export interface InputGroupPassThroughAttributes { export interface InputGroupProps { /** * Spans 100% width of the container when enabled. - * @defaultValue false + * @defaultValue null */ - fluid?: boolean; + fluid?: boolean | undefined; /** * It generates scoped CSS variables using design tokens for the component. */ diff --git a/packages/primevue/src/inputgroup/InputGroup.vue b/packages/primevue/src/inputgroup/InputGroup.vue index 2d162da50..a3f5794ad 100644 --- a/packages/primevue/src/inputgroup/InputGroup.vue +++ b/packages/primevue/src/inputgroup/InputGroup.vue @@ -5,11 +5,20 @@ diff --git a/packages/primevue/src/inputgroup/style/InputGroupStyle.js b/packages/primevue/src/inputgroup/style/InputGroupStyle.js index d5d836be8..456986b2e 100644 --- a/packages/primevue/src/inputgroup/style/InputGroupStyle.js +++ b/packages/primevue/src/inputgroup/style/InputGroupStyle.js @@ -102,10 +102,10 @@ const theme = ({ dt }) => ` `; const classes = { - root: ({ props }) => [ + root: ({ instance }) => [ 'p-inputgroup', { - 'p-inputgroup-fluid': props.fluid + 'p-inputgroup-fluid': instance.hasFluid } ] }; diff --git a/packages/primevue/src/inputmask/InputMask.d.ts b/packages/primevue/src/inputmask/InputMask.d.ts index 24e370502..c926fde3c 100755 --- a/packages/primevue/src/inputmask/InputMask.d.ts +++ b/packages/primevue/src/inputmask/InputMask.d.ts @@ -151,9 +151,9 @@ export interface InputMaskProps { variant?: 'outlined' | 'filled' | undefined; /** * Spans 100% width of the container when enabled. - * @defaultValue false + * @defaultValue null */ - fluid?: boolean; + fluid?: boolean | undefined; /** * When present, it specifies that the component should be disabled. * @defaultValue false diff --git a/packages/primevue/src/inputnumber/BaseInputNumber.vue b/packages/primevue/src/inputnumber/BaseInputNumber.vue index 9448dfeeb..8c9eb8ac1 100644 --- a/packages/primevue/src/inputnumber/BaseInputNumber.vue +++ b/packages/primevue/src/inputnumber/BaseInputNumber.vue @@ -135,7 +135,7 @@ export default { }, fluid: { type: Boolean, - default: false + default: null }, inputId: { type: String, diff --git a/packages/primevue/src/inputnumber/InputNumber.d.ts b/packages/primevue/src/inputnumber/InputNumber.d.ts index 558904fe1..a837653fe 100755 --- a/packages/primevue/src/inputnumber/InputNumber.d.ts +++ b/packages/primevue/src/inputnumber/InputNumber.d.ts @@ -336,9 +336,9 @@ export interface InputNumberProps { placeholder?: string | undefined; /** * Spans 100% width of the container when enabled. - * @defaultValue false + * @defaultValue null */ - fluid?: boolean; + fluid?: boolean | undefined; /** * Identifier of the focus input to match a label defined for the chips. */ diff --git a/packages/primevue/src/inputnumber/InputNumber.vue b/packages/primevue/src/inputnumber/InputNumber.vue index 99d09455d..930ec333e 100755 --- a/packages/primevue/src/inputnumber/InputNumber.vue +++ b/packages/primevue/src/inputnumber/InputNumber.vue @@ -72,8 +72,8 @@