Skip to content

Commit

Permalink
Merge pull request #841 from buildo/expand-datefield-config
Browse files Browse the repository at this point in the history
Allow config of internal padding and range separator size in DateField
  • Loading branch information
federico-ercoles authored Apr 29, 2024
2 parents 52cd4af + cf13931 commit 72090d6
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 2 deletions.
1 change: 1 addition & 0 deletions ci/tasks/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ outputs:

params:
NODE_OPTIONS: --max-old-space-size=4096
COREPACK_ENABLE_DOWNLOAD_PROMPT: "0"

run:
dir: bento
Expand Down
1 change: 1 addition & 0 deletions ci/tasks/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ inputs:
params:
CHROMATIC_PROJECT_TOKEN: ((chromatic-project-token))
CHROMATIC_OPTIONS:
COREPACK_ENABLE_DOWNLOAD_PROMPT: "0"

run:
dir: bento
Expand Down
3 changes: 3 additions & 0 deletions ci/tasks/circular-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ image_resource:
inputs:
- name: bento

params:
COREPACK_ENABLE_DOWNLOAD_PROMPT: "0"

run:
dir: bento
path: ash
Expand Down
3 changes: 3 additions & 0 deletions ci/tasks/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ image_resource:
inputs:
- name: bento

params:
COREPACK_ENABLE_DOWNLOAD_PROMPT: "0"

run:
dir: bento
path: ash
Expand Down
3 changes: 3 additions & 0 deletions ci/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ outputs:
caches:
- path: bento/.pnpm-store

params:
COREPACK_ENABLE_DOWNLOAD_PROMPT: "0"

run:
dir: bento
path: ash
Expand Down
3 changes: 3 additions & 0 deletions ci/tasks/prettier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ image_resource:
inputs:
- name: bento

params:
COREPACK_ENABLE_DOWNLOAD_PROMPT: "0"

run:
dir: bento
path: ash
Expand Down
1 change: 1 addition & 0 deletions ci/tasks/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ params:
NPM_TOKEN: ((npm_token))
SSH_PRIVATE_KEY: ((private-key))
GITHUB_TOKEN: ((github-token))
COREPACK_ENABLE_DOWNLOAD_PROMPT: "0"

run:
path: ci/tasks/release.sh
Expand Down
1 change: 1 addition & 0 deletions ci/tasks/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ inputs:

params:
CI: true
COREPACK_ENABLE_DOWNLOAD_PROMPT: "0"

run:
dir: bento
Expand Down
3 changes: 3 additions & 0 deletions ci/tasks/typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ image_resource:
inputs:
- name: bento

params:
COREPACK_ENABLE_DOWNLOAD_PROMPT: "0"

run:
dir: bento
path: ash
Expand Down
2 changes: 2 additions & 0 deletions packages/bento-design-system/src/DateField/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import { Children } from "../util/Children";
export type DateFieldConfig = {
radius: BorderRadiusConfig;
padding: NonNullable<BentoSprinkles["padding"]>;
internalPadding: NonNullable<BentoSprinkles["padding"]>;
elevation: "none" | "small" | "medium" | "large";
rangeSeparatorSize: IconProps["size"];
monthYearLabelSize: LabelProps["size"];
dayOfWeekLabelSize: LabelProps["size"];
previousMonthIcon: (props: IconProps) => Children;
Expand Down
7 changes: 5 additions & 2 deletions packages/bento-design-system/src/DateField/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ function DateField({ fieldProps }: { fieldProps: AriaDateFieldOptions<CalendarDa

export function Input(props: Props) {
const config = useBentoConfig().input;
const dateFieldConfig = useBentoConfig().dateField;

const { observe: rightAccessoryRef, width: rightAccessoryWidth } = useDimensions({
// This is needed to include the padding in the width
Expand Down Expand Up @@ -146,10 +147,12 @@ export function Input(props: Props) {
{props.type === "single" ? (
<DateField fieldProps={props.fieldProps} />
) : (
<Columns space={16}>
<Columns space={dateFieldConfig.internalPadding} alignY="stretch">
<DateField fieldProps={props.fieldProps.start} />
<Column width="content">
<IconMinus size={24} />
<Box display="flex" height="full" alignItems="center">
<IconMinus size={dateFieldConfig.rangeSeparatorSize} />
</Box>
</Column>
<DateField fieldProps={props.fieldProps.end} />
</Columns>
Expand Down
2 changes: 2 additions & 0 deletions packages/bento-design-system/src/util/defaultConfigs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,9 @@ export const tooltip: TooltipConfig = {
export const dateField: DateFieldConfig = {
radius: 24,
padding: 24,
internalPadding: 16,
elevation: "medium",
rangeSeparatorSize: 24,
monthYearLabelSize: "large",
dayOfWeekLabelSize: "large",
previousMonthIcon: IconChevronLeft,
Expand Down

0 comments on commit 72090d6

Please sign in to comment.