Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/dark-pandas-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@hashicorp/design-system-components": patch
---

<!-- START components/form/file-input -->
`FileInput` - Added width of 100% to prevent the component from overflowing its container and making it consistent with other Input components
<!-- END -->
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@use "../../mixins/button" as *;

.hds-form-file-input {
width: 100%; // we want to prevent the input from overflowing its container
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding max-width made no difference, so I left it out

margin: -4px 0 -4px -4px; // offset shadow padding + default 1px spacing
padding: 3px 0 3px 3px; // add padding so button shadow is visible
color: var(--token-color-foreground-primary);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import ShwTextH1 from 'showcase/components/shw/text/h1';

import SubSectionBaseControl from 'showcase/components/page-components/form/file-input/sub-sections/base-control';
import SubSectionFieldControl from 'showcase/components/page-components/form/file-input/sub-sections/field-control';
import SubSectionContainers from 'showcase/components/page-components/form/file-input/sub-sections/containers';

export default class FormFileInputIndex extends Component {
@tracked showHighlight = false;
Expand All @@ -35,6 +36,7 @@ export default class FormFileInputIndex extends Component {
</button>
<SubSectionBaseControl @showHighlight={{this.showHighlight}} />
<SubSectionFieldControl @showHighlight={{this.showHighlight}} />
<SubSectionContainers @showHighlight={{this.showHighlight}} />
</section>
</template>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import type { TemplateOnlyComponent } from '@ember/component/template-only';
import style from 'ember-style-modifier';

import ShwFlex from 'showcase/components/shw/flex';
import ShwTextH2 from 'showcase/components/shw/text/h2';
import ShwOutliner from 'showcase/components/shw/outliner';

import { HdsFormFileInputField } from '@hashicorp/design-system-components/components';

export interface SubSectionContainersSignature {
Args: {
showHighlight: boolean;
};
}

const SubSectionContainers: TemplateOnlyComponent<SubSectionContainersSignature> =
<template>
<ShwTextH2>Containers</ShwTextH2>

<div
class="{{if
@showHighlight
'shw-component-form-file-input-layout-highlight'
}}"
>
<ShwFlex @gap="2rem" as |SF|>
<SF.Item @label="Within a fixed-width container">
<ShwOutliner {{style width="220px"}}>
<HdsFormFileInputField as |F|>
<F.Label>This is the label text</F.Label>
<F.HelperText>This is the helper text with longer wrapping text</F.HelperText>
</HdsFormFileInputField>
</ShwOutliner>
</SF.Item>
</ShwFlex>
</div>
</template>;

export default SubSectionContainers;
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ const SubSectionFieldControl: TemplateOnlyComponent<SubSectionFieldControlSignat
</HdsFormFileInputField>
</SG.Item>
</ShwGrid>

<ShwDivider />
</template>;

export default SubSectionFieldControl;