Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Mar 29, 2022
1 parent 6c3e9c7 commit ae157af
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 30 deletions.
27 changes: 12 additions & 15 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -3522,7 +3522,7 @@ select option[disabled]:first-child {
border-radius: 0.25rem;
padding-inline: 0.5rem;
}
[role=listbox] li:hover {
[role=listbox] li:hover, [role=listbox] li.is-active {
background-color: var(--spruce-base-color-primary);
color: white;
}
Expand Down
4 changes: 2 additions & 2 deletions public/app.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"/app.js": "/app.js?id=8db0273955e7aa0c97fff38a095769c7",
"/app.css": "/app.css?id=fc06152fb066f1ebc43b81fe60fb5c12"
"/app.js": "/app.js?id=fd20d54d831287b8dc7a5af9319b0952",
"/app.css": "/app.css?id=f6af34b1ec88e2d33d0784fddc7340a1"
}
26 changes: 18 additions & 8 deletions resources/js/Components/Form/AsyncSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,29 @@
@change="fetch"
>
<span class="field-feedback field-feedback--invalid" v-if="error">{{ error }}</span>
<ul v-show="isOpen" role="listbox">
<ul v-show="isOpen" role="listbox" style="z-index: 1000;">
<li
ref="option"
v-for="(item, index) in response.data"
v-html="item.formatted_value"
tabindex="-1"
:aria-selected="index === active ? 'true' : 'false'"
:class="{ 'is-active': index === active }"
:key="item.value"
:class="[index === active ? 'is-active' : '']"
@mousedown="select(item.value)"
tabindex="-1"
aria-selected="false"
></li>
<li
v-if="response.data.length === 0"
aria-live="polite"
role="status"
class="field-feedback field-feedback--invalid"
>
{{ __('No items found for the given keyword.') }}
</li>
</ul>
<ul>

</ul>
<div v-if="response.data.length === 0" aria-live="polite" role="status" class="field-feedback field-feedback--invalid">
{{ __('No items found for the given keyword.') }}
</div>
</div>
</template>

Expand All @@ -53,7 +61,7 @@
default: null,
},
modelValue: {
type: [String, Number, Array],
type: [String, Number, Array, Object],
default: null,
},
label: {
Expand Down Expand Up @@ -81,6 +89,7 @@
default: (value, options) => value,
},
value: {
type: [String, Number, Array, Object],
default: null,
},
},
Expand Down Expand Up @@ -121,6 +130,7 @@
this.selectResolver(value, JSON.parse(JSON.stringify(this.response.data)))
);
this.$nextTick(() => this.fetch());
},
select(index) {
Expand Down
3 changes: 2 additions & 1 deletion resources/sass/sprucecss-expansion/_form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ select {
border-radius: spruce.$border-radius-sm;
padding-inline: spruce.spacer(xs);

&:hover {
&:hover,
&.is-active {
background-color: spruce.color(primary);
color: hsl(0 0% 100%);
}
Expand Down
13 changes: 13 additions & 0 deletions src/Fields/BelongsToMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ class BelongsToMany extends BelongsTo
*/
protected array $resolved = [];

/**
* Set the async attribute.
*
* @param bool $value
* @return $this
*/
public function async(bool $value = true): static
{
$this->async = $value;

return $this;
}

/**
* {@inheritdoc}
*/
Expand Down
5 changes: 4 additions & 1 deletion src/RootServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,12 @@ protected function registerPublishes(): void

$this->publishes([
__DIR__.'/../public' => public_path('vendor/root'),
], 'root-compiled');

$this->publishes([
__DIR__.'/../resources/js' => $this->app->resourcePath('js/vendor/root'),
__DIR__.'/../resources/sass' => $this->app->resourcePath('sass/vendor/root'),
], 'root-assets');
], 'root-vendor');

$this->publishes([
__DIR__.'/../resources/views' => $this->app->resourcePath('views/vendor/root'),
Expand Down

0 comments on commit ae157af

Please sign in to comment.