-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
18 changed files
with
1,289 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<Form::Label | ||
@text={{@label}} | ||
@identifier={{@identifier}} | ||
@required={{@required}} | ||
/> | ||
|
||
{{#if @onCreate}} | ||
<PowerSelectMultipleWithCreate | ||
@options={{@options}} | ||
@selected={{@selected}} | ||
@disabled={{@disabled}} | ||
@placeholder="Choose…" | ||
@renderInPlace={{true}} | ||
@searchEnabled={{true}} | ||
@searchField={{@searchField}} | ||
@onChange={{@onChange}} | ||
@onCreate={{@onCreate}} | ||
...attributes | ||
as |option| | ||
> | ||
{{yield option}} | ||
</PowerSelectMultipleWithCreate> | ||
{{else}} | ||
<PowerSelectMultiple | ||
@options={{@options}} | ||
@selected={{@selected}} | ||
@disabled={{@disabled}} | ||
@placeholder="Choose…" | ||
@renderInPlace={{true}} | ||
@searchEnabled={{true}} | ||
@searchField={{@searchField}} | ||
@onChange={{@onChange}} | ||
id={{@identifier}} | ||
...attributes | ||
as |option| | ||
> | ||
{{yield option}} | ||
</PowerSelectMultiple> | ||
{{/if}} | ||
|
||
{{#if @help}} | ||
<Form::Help @text={{@help}} /> | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import Component from '@glimmer/component'; | ||
|
||
import type EmberArray from '@ember/array'; | ||
|
||
interface FormPowerSelectMultipleSignature<T> { | ||
Args: { | ||
options: T[]; | ||
selected: T[] | EmberArray<T>; | ||
disabled?: boolean; | ||
placeholder?: string; | ||
label?: string; | ||
help?: string; | ||
identifier: string; | ||
required?: boolean; | ||
renderInPlace?: boolean; | ||
searchEnabled?: boolean; | ||
searchField?: string; | ||
onChange: (selected: never[]) => void; | ||
onCreate?: (query: string) => void; | ||
}; | ||
Blocks: { | ||
default: [T]; | ||
}; | ||
Element: HTMLElement; | ||
} | ||
|
||
export default class FormPowerSelectMultiple<T> extends Component< | ||
FormPowerSelectMultipleSignature<T> | ||
> {} | ||
|
||
declare module '@glint/environment-ember-loose/registry' { | ||
export default interface Registry { | ||
'Form::PowerSelectMultiple': typeof FormPowerSelectMultiple; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<Form::Label | ||
@text={{@label}} | ||
@identifier={{@identifier}} | ||
@required={{@required}} | ||
/> | ||
|
||
{{#if @onCreate}} | ||
<PowerSelectWithCreate | ||
@options={{@options}} | ||
@search={{@search}} | ||
@selected={{@selected}} | ||
@disabled={{@disabled}} | ||
@placeholder="Choose…" | ||
@renderInPlace={{true}} | ||
@searchEnabled={{true}} | ||
@searchField={{@searchField}} | ||
@searchPlaceholder="Search…" | ||
@allowClear={{@allowClear}} | ||
@showCreatePosition="bottom" | ||
@onChange={{@onChange}} | ||
@onCreate={{@onCreate}} | ||
id={{@identifier}} | ||
...attributes | ||
as |option| | ||
> | ||
{{! @glint-ignore }} | ||
{{yield option}} | ||
</PowerSelectWithCreate> | ||
{{else}} | ||
<PowerSelect | ||
@options={{@options}} | ||
@search={{@search}} | ||
@selected={{@selected}} | ||
@disabled={{@disabled}} | ||
@placeholder="Choose…" | ||
@renderInPlace={{true}} | ||
@searchEnabled={{true}} | ||
@searchField={{@searchField}} | ||
@searchPlaceholder="Search…" | ||
@allowClear={{@allowClear}} | ||
@onChange={{@onChange}} | ||
id={{@identifier}} | ||
...attributes | ||
as |option| | ||
> | ||
{{! @glint-ignore }} | ||
{{yield option}} | ||
</PowerSelect> | ||
{{/if}} | ||
|
||
{{!-- <Input | ||
@value={{@selected.content}} | ||
@type="text" | ||
required={{@required}} | ||
class="d-none" | ||
/> | ||
<div class="invalid-feedback"> | ||
{{or @invalidFeedback "Please select a value."}} | ||
</div> --}} | ||
|
||
{{#if @help}} | ||
<Form::Help @text={{@help}} /> | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import Component from '@glimmer/component'; | ||
|
||
import type { Group } from 'ember-power-select/addon/utils/group-utils'; | ||
|
||
interface FormPowerSelectSignature<T> { | ||
Args: { | ||
options?: (T | Group)[]; | ||
selected: T | null | undefined; | ||
label?: string; | ||
identifier: string; | ||
required?: boolean; | ||
disabled?: boolean; | ||
search?: (query: string) => T[]; | ||
searchField?: string; | ||
allowClear?: boolean; | ||
help?: string; | ||
onChange: (selected: never) => void; | ||
onCreate?: (query: string) => void; | ||
}; | ||
Blocks: { | ||
default: [T]; | ||
}; | ||
Element: HTMLElement; | ||
} | ||
|
||
export default class FormPowerSelect<T> extends Component< | ||
FormPowerSelectSignature<T> | ||
> {} | ||
|
||
declare module '@glint/environment-ember-loose/registry' { | ||
export default interface Registry { | ||
'Form::PowerSelect': typeof FormPowerSelect; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from '@trusted-american/design-system/components/form/power-select-multiple'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from '@trusted-american/design-system/components/form/power-select'; |
Oops, something went wrong.