-
Notifications
You must be signed in to change notification settings - Fork 0
feat(FoRange): First implementation #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
01cacc6
feat(FoRange): First implementation
michaelcozzolino ab968c6
feat(RangeDocs): First implementation
michaelcozzolino aebdc2d
feat(FoRange): Add snapshots
michaelcozzolino 3b7e21a
feat(FoRange): Implement steps slot
michaelcozzolino 71651a3
fix(FoRange): Convert input value to number
michaelcozzolino 303059b
Update packages/core/src/UI/Forms/Range/UI/FoRange.vue
michaelcozzolino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,7 @@ | ||
| import type { Colorable, Disableable, Sizable } from '@/Lib'; | ||
|
|
||
| export interface RangeProps extends Colorable, Sizable, Disableable { | ||
| min?: number; | ||
| max?: number; | ||
| step?: number; | ||
| } |
This file contains hidden or 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 * from '@/UI/Forms/Range/Types/Range'; |
This file contains hidden or 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,62 @@ | ||
| <template> | ||
| <component :is="slots.steps ? 'div' : FoFragment" | ||
| :class="slots.steps && 'w-full'" | ||
| :style="slots.steps && $attrs.style" | ||
| > | ||
| <input v-model.number="input" | ||
| class="range" | ||
| :class="[colorClass, sizeClass, slots.steps && $attrs.class]" | ||
| type="range" | ||
| :min="min" | ||
| :max="max" | ||
| :step="step" | ||
| :disabled="isDisabled" | ||
michaelcozzolino marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| v-bind="slots.steps === undefined && $attrs" | ||
| > | ||
|
|
||
| <div v-if="slots.steps" | ||
| class="flex justify-between text-xs px-2" | ||
| > | ||
| <slot name="steps" /> | ||
| </div> | ||
| </component> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import type { ComponentName } from '@/Lib'; | ||
| import type { RangeProps } from '@/UI/Forms/Range'; | ||
| import type { Slot } from 'vue'; | ||
| import { useFlyonUIVueAppConfig } from '@/Lib'; | ||
| import { useColor } from '@/Lib/UseColor/Internal'; | ||
| import { useSize } from '@/Lib/UseSize/Internal'; | ||
| import { FoFragment } from '@/UI/Components/Fragment/Internal'; | ||
|
|
||
| defineOptions({ | ||
| inheritAttrs: false, | ||
| }); | ||
|
|
||
| const props = withDefaults(defineProps<RangeProps>(), { | ||
| min: 0, | ||
| max: 100, | ||
| step: 1, | ||
| isDisabled: false, | ||
| }); | ||
|
|
||
| const slots = defineSlots<{ | ||
| /** The step indicators to show for each step */ | ||
| steps?: Slot; | ||
| }>(); | ||
|
|
||
| const input = defineModel<number>({ required: true }); | ||
|
|
||
| const componentName: ComponentName = 'FoRange'; | ||
| const { config } = useFlyonUIVueAppConfig(); | ||
|
|
||
| const [ | ||
| colorClass, | ||
| sizeClass, | ||
| ] = [ | ||
| useColor(config, componentName, () => props.color), | ||
| useSize(config, componentName, () => props.size), | ||
| ]; | ||
| </script> | ||
This file contains hidden or 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 as FoRange } from '@/UI/Forms/Range/UI/FoRange.vue'; |
This file contains hidden or 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,2 @@ | ||
| export * from '@/UI/Forms/Range/Types'; | ||
| export * from '@/UI/Forms/Range/UI'; |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| export * from '@/UI/Forms/Checkbox'; | ||
| export * from '@/UI/Forms/InputText'; | ||
| export * from '@/UI/Forms/Join'; | ||
| export * from '@/UI/Forms/Range'; | ||
| export * from '@/UI/Forms/Select'; | ||
| export * from '@/UI/Forms/Switch'; | ||
| export * from '@/UI/Forms/Textarea'; |
This file contains hidden or 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 hidden or 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 hidden or 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 @@ | ||
| # Range | ||
|
|
||
| ### Default | ||
|
|
||
| <RangeDocs section="default" /> | ||
|
|
||
| ### Sizes | ||
|
|
||
| <RangeDocs section="size" /> | ||
|
|
||
| ### Colors | ||
|
|
||
| ## Solid | ||
|
|
||
| <RangeDocs section="color" /> | ||
|
|
||
| ## Custom | ||
|
|
||
| <RangeDocs section="custom-color" /> | ||
michaelcozzolino marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ## Illustrations | ||
|
|
||
| ### Disabled | ||
|
|
||
| <RangeDocs section="disabled" /> | ||
|
|
||
| ### Min, max and step | ||
|
|
||
| <RangeDocs section="min-max-and-step" /> | ||
|
|
||
| ### Steps | ||
|
|
||
| <RangeDocs section="steps" /> | ||
|
|
||
| ## Api | ||
|
|
||
| ### Props | ||
|
|
||
| <RangeDocs section="props" /> | ||
|
|
||
| ### Slots | ||
|
|
||
| <RangeDocs section="slots" /> | ||
This file contains hidden or 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,12 @@ | ||
| <template> | ||
| <FoRange v-model="value" | ||
| class="[--range-color:teal]!" | ||
| /> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { FoRange } from 'flyonui-vue'; | ||
| import { ref } from 'vue'; | ||
|
|
||
| const value = ref<number>(50); | ||
| </script> |
This file contains hidden or 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,10 @@ | ||
| <template> | ||
| <FoRange v-model="value" /> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { FoRange } from 'flyonui-vue'; | ||
| import { ref } from 'vue'; | ||
|
|
||
| const value = ref<number>(50); | ||
| </script> |
This file contains hidden or 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,13 @@ | ||
| <template> | ||
| <!-- todo: isDisabled to be changed on 3.x --> | ||
| <FoRange v-model="value" | ||
| is-disabled | ||
| /> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { FoRange } from 'flyonui-vue'; | ||
| import { ref } from 'vue'; | ||
|
|
||
| const value = ref<number>(50); | ||
| </script> |
This file contains hidden or 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,22 @@ | ||
| <template> | ||
| Min: 0, Max: 100, Step: 1, Value: {{ value1 }} | ||
| <FoRange v-model="value1" | ||
| :min="0" | ||
| :max="100" | ||
| /> | ||
|
|
||
| Min: 50, Max: 100, Step: 5, Value: {{ value2 }} | ||
| <FoRange v-model="value2" | ||
| :min="50" | ||
| :max="100" | ||
| :step="5" | ||
| /> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { FoRange } from 'flyonui-vue'; | ||
| import { ref } from 'vue'; | ||
|
|
||
| const value1 = ref<number>(50); | ||
| const value2 = ref<number>(50); | ||
| </script> |
This file contains hidden or 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,40 @@ | ||
| <template> | ||
| <FoRange v-model="value" | ||
| color="neutral" | ||
| /> | ||
|
|
||
| <FoRange v-model="value" | ||
| color="primary" | ||
| /> | ||
|
|
||
| <FoRange v-model="value" | ||
| color="secondary" | ||
| /> | ||
|
|
||
| <FoRange v-model="value" | ||
| color="accent" | ||
| /> | ||
|
|
||
| <FoRange v-model="value" | ||
| color="info" | ||
| /> | ||
|
|
||
| <FoRange v-model="value" | ||
| color="success" | ||
| /> | ||
|
|
||
| <FoRange v-model="value" | ||
| color="warning" | ||
| /> | ||
|
|
||
| <FoRange v-model="value" | ||
| color="error" | ||
| /> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { FoRange } from 'flyonui-vue'; | ||
| import { ref } from 'vue'; | ||
| const value = ref<number>(50); | ||
| </script> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.