Skip to content

Commit

Permalink
v0.3.14
Browse files Browse the repository at this point in the history
  • Loading branch information
CarcajadaArtificial committed Mar 6, 2024
1 parent 49faab0 commit c938721
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 37 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## v0.3.13
## v0.3.14

- Updated the `<Button />` component's documentation.

Expand Down
33 changes: 17 additions & 16 deletions components/Button/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,29 @@ import { transition } from '../../src/styles.ts';
import { css } from '../../deps.ts';

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/** Properties of the `<Button />` component. */
export type ButtonProps = {
/** If true, expands the width of the button up to its maximum width. */
/**
* Properties of the `<Button />` component.
* - `maxWidth` (boolean):
* If true, expands the width of the button up to its maximum width.
* - `compact` (boolean):
* If true, the button's paddings will be shorter.
* - `large` (boolean):
* If true, the button's paddings will be larger.
* - `type` (ButtonTypes):
* Changes the button's style depending on the property.
* - **disabled:** Adds `cursor: not-allowed` and makes it look unavailable.
* - **error:** Makes it the standard red color.
* - **panel:** Gives a panel background to the button. If placed on top of a `<Panel />` component,
* it gives a page background instead, simulating a "hole" in the panel.
* - **transparent:** Makes the button's background transparent.
*/
export type iButton = iComponent<HTMLButtonElement> & {
maxWidth: boolean;
/** If true, the button's paddings will be shorter. */
compact: boolean;
/** If true, the button's paddings will be larger. */
large: boolean;
/**
* Changes the button's style depending on the property.
* - **disabled:** Adds `cursor: not-allowed` and makes it look unavailable.
* - **error:** Makes it the standard red color.
* - **panel:** Gives a panel background to the button. If placed on top of a `<Panel />` component,
* it gives a page background instead, simulating a "hole" in the panel.
* - **transparent:** Makes the button's background transparent.
*/
type: ButtonTypes;
};

/** Property type of the `<Button />` component. */
export type iButton = iComponent<HTMLButtonElement> & ButtonProps;

/** Default values of the `<Button />` component's props. */
const defaults: iButton = {
maxWidth: false,
Expand Down
42 changes: 22 additions & 20 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,44 @@
*/
import { JSX, Ref } from 'preact';

/**
* This is a utility type that contains properties that all components must have.
* [See more](https://deno.land/x/lunchbox#configure-anything-easily)
*/
export type GenericComponent<T> = {
/**
* Short for "Forwarded Reference". This prop allows the component to receive a preact reference
* that points to the protagonist HTMLElement in the component.
*/
fref?: Ref<T>;
/** This prop removes the default styles for the component. */
nostyle?: boolean;
/** This prop removes the default styles and all class names for the component. */
nostyleAll?: boolean;
};

/**
* This type is used for standarizing all components. By design every component must have a protagonic
* HTMLElement that inherits its attributes, the GenericComponent properties, Aria atributes, and Event
* Handlers.
* Handlers. [See more](https://deno.land/x/lunchbox#configure-anything-easily)
*
* - `fref?` (Ref<T>):
* Short for "Forwarded Reference". This prop allows the component to receive a preact reference
* that points to the protagonist HTMLElement in the component.
* - `nostyle?` (boolean):
* This prop removes the default styles of the component.
* - `nostyleAll?` (boolean):
* This prop removes the default styles and the class names of all HTMLElements in the component.
*/
export type iComponent<T extends EventTarget = HTMLElement> =
& iElement<T>
& GenericComponent<T>;
& {
fref?: Ref<T>;
nostyle?: boolean;
nostyleAll?: boolean;
};

/**
* This type is a shorthand for an extension of `JSX.HTMLAttributes<T>`, `Partial<ARIAMixin>`, and
* `Partial<GlobalEventHandlers>`.
* `Partial<GlobalEventHandlers>`. It gives all attributes that come native to a particular HTMLElement.
*/
export type iElement<T extends EventTarget = HTMLElement> =
& JSX.HTMLAttributes<T>
& Partial<ARIAMixin>
& Partial<GlobalEventHandlers>;

/**
* This type is a shorthand that helps in forwarding props and references to a component's part.
* This type is a shorthand that helps in forwarding props and references to a component's part. This
* type points to every secondary HTMLElement in a component.
*
* - `ref?` (Ref<T>):
* Stores a reference that points to this HTMLElement.
* - `nostyle?` (boolean):
* If true, removes the default class name of this HTMLElement.
*/
export type iFwd<T extends EventTarget = HTMLElement> = iElement<T> & {
ref?: Ref<T>;
Expand Down

0 comments on commit c938721

Please sign in to comment.