Skip to content

Commit

Permalink
Merge branch 'master' into vibe3
Browse files Browse the repository at this point in the history
  • Loading branch information
talkor committed Oct 9, 2024
2 parents 5ba9094 + cb0c87e commit b06be40
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 16 deletions.
22 changes: 22 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,28 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.139.0](https://github.com/mondaycom/vibe/compare/[email protected]@2.139.0) (2024-10-09)


### Features

* add inputAriaLabel to Dropdown component ([#2466](https://github.com/mondaycom/vibe/issues/2466)) ([1cb3d1e](https://github.com/mondaycom/vibe/commit/1cb3d1eb7608abb575620eb1ba7acbe9e68a77f4))





## [2.138.1](https://github.com/mondaycom/vibe/compare/[email protected]@2.138.1) (2024-10-08)


### Bug Fixes

* **ColorPickerClearButton:** button isn't clickable inside MenuItem ([#2464](https://github.com/mondaycom/vibe/issues/2464)) ([d6bc515](https://github.com/mondaycom/vibe/commit/d6bc51513d95db7db1c4dc8c81ed0a8282dc6990))





# [2.138.0](https://github.com/mondaycom/vibe/compare/[email protected]@2.138.0) (2024-10-06)


Expand Down
14 changes: 14 additions & 0 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,17 @@ npm start
## Themes

Theming is supported using CSS variables - for more info on theming please read the [theme guidelines](./THEME_README.md) file

## SSR (Server Side Rendering)

Components are using style injection on the client side (into <head> element)
This is not usable on the server side.
In order to get the required styles on the server side, you should initialize

```javascript
globalThis.injectedStyles = {};
```

in order to have each server side render component css inserted into the injectedStyles object
each component will insert its css string under a unique key.
Then you can join all the values into one string and add it under a <style> element
34 changes: 19 additions & 15 deletions packages/core/scripts/styleInject.ejs
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
function styleInject(css) {
if(typeof document === 'undefined') return;
const head = document.head || document.getElementsByTagName('head')[0];
const id = "<%= hashValue %>_<%= version %>";
const styleExists = head.querySelector("#" + id);

if(styleExists) return;

const style = document.createElement('style');
style.id = id;

if (head.firstChild) {
head.insertBefore(style, head.firstChild);
} else {
head.appendChild(style);
if(typeof document !== 'undefined') {
const head = document.head || document.getElementsByTagName('head')[0];
const styleExists = head.querySelector("#" + id);

if(styleExists) return;

const style = document.createElement('style');
style.id = id;

if (head.firstChild) {
head.insertBefore(style, head.firstChild);
} else {
head.appendChild(style);
}

style.appendChild(document.createTextNode(css));
} else if (globalThis.injectedStyles) {
// support SSR environments
globalThis.injectedStyles[id] = css;
}

style.appendChild(document.createTextNode(css));
}

styleInject(<%= cssVariableName %>);
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const ColorPickerClearButton: VibeComponent<ColorPickerClearButtonProps>
size="small"
kind="tertiary"
onClick={() => onSelectionAction(-1)} //hack - we don't really have a grid, it's just for keyboard navigation outside the clear button
blurOnMouseUp={false}
className={styles.clearColorButton}
>
<Icon size="16" className={styles.clearColorIcon} />
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/components/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
defaultCustomStyles,
DROPDOWN_CHIP_COLORS,
DROPDOWN_ID,
DROPDOWN_INPUT_ARIA_LABEL,
DROPDOWN_MENU_ARIA_LABEL,
DROPDOWN_MENU_ID,
DROPDOWN_MENU_PLACEMENT,
Expand Down Expand Up @@ -89,6 +90,7 @@ const Dropdown: VibeComponent<DropdownComponentProps, HTMLElement> & {
id = DROPDOWN_ID,
menuId = DROPDOWN_MENU_ID,
menuAriaLabel = DROPDOWN_MENU_ARIA_LABEL,
inputAriaLabel = DROPDOWN_INPUT_ARIA_LABEL,
autoFocus = false,
multi = false,
multiline = false,
Expand Down Expand Up @@ -260,7 +262,7 @@ const Dropdown: VibeComponent<DropdownComponentProps, HTMLElement> & {
aria-activedescendant={ariaActiveDescendant}
role="combobox"
aria-expanded={!readOnly && menuIsOpen}
aria-label="Dropdown input"
aria-label={inputAriaLabel}
aria-controls={menuId}
/>
);
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/components/Dropdown/Dropdown.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ export interface CustomMenuBaseProps {
* aria-label attribute for the menu container
*/
menuAriaLabel?: string;
/**
* aria-label attribute for the dropdown input
*/
inputAriaLabel?: string;
}

export type CustomMenuProps = CustomMenuBaseProps & MenuProps<OptionTypeBase, boolean>;
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/components/Dropdown/DropdownConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const ADD_AUTO_HEIGHT_COMPONENTS = ["container", "control", "valueContain
export const DROPDOWN_ID = "dropdown-menu-id";
export const DROPDOWN_MENU_ID = "dropdown-menu-list-id";
export const DROPDOWN_MENU_ARIA_LABEL = "Dropdown menu";
export const DROPDOWN_INPUT_ARIA_LABEL = "Dropdown input";

/**
* @deprecated
Expand Down

0 comments on commit b06be40

Please sign in to comment.