Skip to content

Commit

Permalink
feat(styles): add pointer-events help classes
Browse files Browse the repository at this point in the history
  • Loading branch information
hirsch88 committed Dec 6, 2024
1 parent 6c60f1c commit 7150ec8
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/warm-lemons-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@baloise/ds-core': minor
---

**styles**: add pointer-events css help classes
1 change: 1 addition & 0 deletions docs/.storybook/blocks/css-utils/CssInteractions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ import json from '../../../../packages/styles/docs/interaction.json'

export const CssInteractionsCursor = () => <CssUtilitiesTable list={json} search="cursor" />
export const CssInteractionsUserSelect = () => <CssUtilitiesTable list={json} search="user-select" />
export const CssInteractionsPointerEvents = () => <CssUtilitiesTable list={json} search="pointer-events" />
53 changes: 53 additions & 0 deletions docs/stories/utilities/interactions/pointer-events.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { Meta, Source, Canvas } from '@storybook/addon-docs'
import {
Banner,
Lead,
Code,
CssInteractionsPointerEvents,
Footer,
LinkCard,
LinkCards,
} from '../../../.storybook/blocks'

<Meta
title="CSS Utilities/Interactions/Pointer Events"
parameters={{
previewTabs: {
canvas: { hidden: true },
},
}}
/>

<Banner label="Pointer Events" section="CSS Utilities" color="yellow" puzzle />

<Lead>
The pointer-events CSS property determines the conditions under which a specific graphic element can receive pointer
events, if at all.
</Lead>

## Classes

<CssInteractionsPointerEvents />

<Code
language="html"
code={`
<div class="flex flex-wrap align-items-center justify-content-center">
<button class="button m-small pointer-events-auto">Auto</button>
<button class="button m-small pointer-events-none">None</button>
</div>
`}
/>

<Footer>
<LinkCards>
<LinkCard
pageTitle="Foundation/Elevation"
description="Elevation involves the strategic application of shadow and depth to elements, enhancing visual hierarchy and providing depth cues within the user interface"
/>
<LinkCard
pageTitle="Tokens/Overview"
description="Design tokens serve as the definitive source for naming and storing design choices."
/>
</LinkCards>
</Footer>
13 changes: 11 additions & 2 deletions libs/nx/src/executors/build-styles/generators/interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,21 @@ export const generateInteractions = async (options: BuildStylesExecutorSchema) =
},
})

const pointerEvents = utils.staticClass({
property: 'pointer-events',
responsive: false,
values: {
'pointer-events-auto': 'auto',
'pointer-events-none': 'none',
},
})

return utils.save(
'interaction',
options.projectRoot,
utils.merge({
docs: [userSelect.docs, cursor.docs],
rules: [userSelect.rules, cursor.rules],
docs: [userSelect.docs, cursor.docs, pointerEvents.docs],
rules: [userSelect.rules, cursor.rules, pointerEvents.rules],
}),
)
}
16 changes: 16 additions & 0 deletions packages/core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,10 @@ export namespace Components {
* If `true`, in Angular reactive forms the control will not be set invalid
*/
"autoInvalidOff": boolean;
/**
* Indicates whether the value of the control can be automatically completed by the browser.
*/
"autocomplete": BalProps.BalInputAutocomplete;
/**
* Closes the accordion
*/
Expand Down Expand Up @@ -3340,6 +3344,10 @@ export namespace Components {
* Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.
*/
"autocapitalize": string;
/**
* Indicates whether the value of the control can be automatically completed by the browser.
*/
"autocomplete": BalProps.BalInputAutocomplete;
/**
* This Boolean attribute lets you specify that a form control should have input focus when the page loads.
*/
Expand Down Expand Up @@ -5804,6 +5812,10 @@ declare namespace LocalJSX {
* If `true`, in Angular reactive forms the control will not be set invalid
*/
"autoInvalidOff"?: boolean;
/**
* Indicates whether the value of the control can be automatically completed by the browser.
*/
"autocomplete"?: BalProps.BalInputAutocomplete;
/**
* Closes the datepicker popover after selection
*/
Expand Down Expand Up @@ -8422,6 +8434,10 @@ declare namespace LocalJSX {
* Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.
*/
"autocapitalize"?: string;
/**
* Indicates whether the value of the control can be automatically completed by the browser.
*/
"autocomplete"?: BalProps.BalInputAutocomplete;
/**
* This Boolean attribute lets you specify that a form control should have input focus when the page loads.
*/
Expand Down

0 comments on commit 7150ec8

Please sign in to comment.