Skip to content

Conversation

@raimund-schluessler
Copy link
Contributor

@raimund-schluessler raimund-schluessler commented Jun 16, 2025

☑️ Resolves

This adjusts the CSS import of the NcDateTimePicker vendor styles to not be scoped. I don't know if this is the proper way to handle this issue, so plead advise if not.

🖼️ Screenshots

🏚️ Before 🏡 After
Image grafik

🏁 Checklist

  • ⛑️ Tests are included or are not applicable
  • 📘 Component documentation has been extended, updated or is not applicable
  • 2️⃣ Backport to stable8 for maintained Vue 2 version or not applicable

@raimund-schluessler raimund-schluessler added this to the 9.0.0-rc.3 milestone Jun 16, 2025
@raimund-schluessler raimund-schluessler added bug Something isn't working 3. to review Waiting for reviews feature: datepicker Related to the date/time picker component regression Regression of a previous working feature design Design, UX, interface and interaction design labels Jun 16, 2025
@raimund-schluessler
Copy link
Contributor Author

@susnux @ShGKme Could you have a look at this, please? This problem really prevents using NcDateTimePicker at all.

@raimund-schluessler
Copy link
Contributor Author

raimund-schluessler commented Jun 20, 2025

@susnux Is this (roughly) what you had in mind? It works in the Tasks app, but there are still issues:

  • appendToBody still broken
  • Nextcloud styles not correctly applied yet when appendToBody=true
  • styleguide does not build, since the CSS import fails vs. npm run build fails
  • @vuepic/vue-datepicker/dist/main.css defines CSS variables under :root. Importing that nested in a class is not valid, it seems. Is there a better solution than manually duplicating the variables (which seems terrible, because minor changes in the lib might break the CSS).

@ShGKme
Copy link
Contributor

ShGKme commented Jun 20, 2025

  • styleguide does not build, since the CSS import fails vs. npm run build fails

Fixable by adding path.resolve(__dirname, 'node_modules') to sassOptions.includePaths[] in the webpack config.

@ShGKme
Copy link
Contributor

ShGKme commented Jun 20, 2025

  • Is there a better solution than manually duplicating the variables (which seems terrible, because minor changes in the lib might break the CSS).

I'd consider changing CSS variables here a breaking change for the library as it is a public API for theming.

And anyway, it is less dangerous than overriding many other styles in this component.

@raimund-schluessler
Copy link
Contributor Author

Ok, I think this now passes as a PoC. I will try to fix the remaining issues over the weekend if I have time.

@raimund-schluessler raimund-schluessler added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Jun 20, 2025
@ShGKme
Copy link
Contributor

ShGKme commented Jun 20, 2025

  • Nextcloud styles not correctly applied yet when appendToBody=true

Could you elaborate, what you mean?

@raimund-schluessler
Copy link
Contributor Author

  • Nextcloud styles not correctly applied yet when appendToBody=true

Could you elaborate, what you mean?

The style adjustments we do are not applied yet, if the picker is appended to body, because the css classes are not correct yet. You can see this at the buttons at the top or the highlight color.
Just needs some css class adjustments.

@raimund-schluessler
Copy link
Contributor Author

The styles are adjusted now and work for appendToBody as well. But the time-picker elements are differently styled now than before and I couldn't yet figure out what is missing.

@raimund-schluessler
Copy link
Contributor Author

The styles are adjusted now and work for appendToBody as well. But the time-picker elements are differently styled now than before and I couldn't yet figure out what is missing.

It seems the button server styles are not applied anymore, because they are overwritten by vuepic styles with higher priority now.

@julien-nc
Copy link
Contributor

The component can now be used. Picking a date works fine. But the clear button cannot be clicked.

image

@raimund-schluessler raimund-schluessler added this to the 9.0.0-rc.4 milestone Jun 29, 2025
@raimund-schluessler raimund-schluessler force-pushed the fix/noid/datepicker-style-import branch from 657ef9f to 98a2b34 Compare June 29, 2025 21:54
@raimund-schluessler
Copy link
Contributor Author

raimund-schluessler commented Jun 29, 2025

The styles are now in line with server and I hope to have fixed everything. Please review again.

@raimund-schluessler
Copy link
Contributor Author

The component can now be used. Picking a date works fine. But the clear button cannot be clicked.

image

Fix is in #7103.

@raimund-schluessler raimund-schluessler added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jun 29, 2025
@raimund-schluessler raimund-schluessler changed the title fix(NcDateTimePicker): do not scope imported CSS fix(NcDateTimePicker): correctly import library CSS Jun 30, 2025
Comment on lines 712 to 747
:deep(.dp__input) {
margin: 3px;
margin-inline-start: 0;
padding: 0 12px;
font-size: var(--default-font-size);
background-color: var(--color-main-background);
color: var(--color-main-text);
border: 2px solid var(--color-border-maxcontrast);
outline: none;
border-radius: var(--border-radius-large);
text-overflow: ellipsis;
cursor: pointer;
}
:deep(.dp__btn),
:deep(.dp--time-overlay-btn),
:deep(.dp__action_button) {
margin: 0;
font-weight: bold;
border-radius: var(--border-radius-element);
padding: calc((var(--default-clickable-area) - 1lh) / 2) calc(3 * var(--default-grid-baseline));
font-size: var(--default-font-size);
width: auto;
min-height: var(--default-clickable-area);
cursor: pointer;
box-sizing: border-box;
color: var(--color-primary-element-light-text);
background-color: var(--color-primary-element-light);
border: none;
}
:deep(.dp--time-overlay-btn),
:deep(.dp__action_button) {
margin: 3px;
margin-inline-start: 0;
}
:deep(.dp__inc_dec_button) {
padding: calc((var(--default-clickable-area) - 20px) / 2);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it needed only after scoping or a new change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This might not necessarily be related to scoping. I think it depends in which order the server and library styles are included, which might be arbitrary. If server styles come after the library styles, it works fine. But if not, the library styles overwrite the server styles (mainly the ones for button) and the style looks broken.

Copy link
Contributor

Choose a reason for hiding this comment

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

But it should not be needed, at least many of this styles are already configured by overwriting the variable of the library.
For example the font-size is already configured by --dp-font-size and should not be needed to again configure for all this classes here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, if it's not done, then the style is off. But I am fine with any other solution you have.
I just want this issue to be solved and you see my solution here. Please, feel free to adjust it to your liking.

@raimund-schluessler
Copy link
Contributor Author

Can we merge this for the next RC, please? It's really an annoying issue for apps.

--dp-menu-appear-transition-timing: cubic-bezier(.4, 0, 1, 1);
--dp-transition-timing: ease-out;
--dp-action-row-transtion: all 0.2s ease-in;
--dp-font-family: -apple-system, blinkmacsystemfont, "Segoe UI", roboto, oxygen, ubuntu, cantarell, "Open Sans", "Helvetica Neue", sans-serif;
Copy link
Contributor

Choose a reason for hiding this comment

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

we should probably use our styles here

Copy link
Contributor

@susnux susnux left a comment

Choose a reason for hiding this comment

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

Pushed some fixes to simplify and also adjust some of the places to our styles.

Looks good in apps now:
grafik

:input-label="t('Timezone')" />
</template>
</VueDatePicker>
<span class="vue-date-time-picker__wrapper">
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick, but it is not valid BEM structure - element cannot be a parent of its own block.

Copy link
Contributor

Choose a reason for hiding this comment

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

We do this also in other places 😅

raimund-schluessler and others added 6 commits July 15, 2025 14:24
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
* don't import Teleport
* fix CSS import for styleguide
* fix styles for appendToBody

Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
- use BEM syntax

Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
…lash with server rules

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux susnux force-pushed the fix/noid/datepicker-style-import branch from 6b6c4e2 to 3762252 Compare July 15, 2025 12:30
@susnux
Copy link
Contributor

susnux commented Jul 15, 2025

  1. rebased
  2. squashed some commits
  3. migrate span to div

Copy link
Contributor

@Antreesy Antreesy left a comment

Choose a reason for hiding this comment

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

Tested. Not sure if related to this PR, but some format options are no longer valid

E.g. YYYY -> yyyy and DD - dd
https://github.com/date-fns/date-fns/blob/main/docs/unicodeTokens.md

@susnux susnux merged commit 590b0c8 into main Jul 15, 2025
25 checks passed
@susnux susnux deleted the fix/noid/datepicker-style-import branch July 15, 2025 12:41
@ShGKme ShGKme mentioned this pull request Aug 20, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug Something isn't working design Design, UX, interface and interaction design feature: datepicker Related to the date/time picker component regression Regression of a previous working feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(NcDateTimePicker): append-to-body styling broken

6 participants